diff --git a/.c8rc.json b/.c8rc.json index d90ba5ea89a..554200f7e7e 100644 --- a/.c8rc.json +++ b/.c8rc.json @@ -1,9 +1,16 @@ { - "exclude": ["**/*.spec.js", "**/*.mock.js", "**/clientsidepages.js"], + "exclude": [ + "**/*.spec.js", + "**/*.mock.js", + "**/clientsidepages.js", + "docs", + "**/ci-test-summary.cjs" + ], "reporter": ["lcov", "text", "text-summary"], "check-coverage": true, "branches": 100, "functions": 100, "lines": 100, - "statements": 100 -} \ No newline at end of file + "statements": 100, + "skip-full": true +} diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 8ca1fdffec3..7490621907f 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,33 +1,28 @@ -FROM mcr.microsoft.com/powershell:7.1.0-ubuntu-focal +FROM waldekm/powershell:alpine-3.23 LABEL name="CLI for Microsoft 365 Development" \ description="Development container for contributing to CLI for Microsoft 365" \ homepage="https://pnp.github.io/cli-microsoft365" \ maintainers="Waldek Mastykarz , \ - Velin Georgiev , \ Garry Trinder , \ Albert-Jan Schot , \ - Rabia Williams , \ - Mark Powney , \ - Patrick Lamber " + Adam Wojcik , \ + Martin Lingstuyl , \ + Jasey Waegebaert <38426621+Jwaegebaert@users.noreply.github.com>, \ + Milan Holemans <11723921+milanholemans@users.noreply.github.com>" ENV NPM_CONFIG_PREFIX=/home/cli-microsoft365-dev/.npm-global \ PATH=$PATH:/home/cli-microsoft365-dev/.npm-global/bin -RUN apt-get update && apt-get install -y \ +RUN apk add --no-cache \ git \ curl \ sudo \ + shadow \ zsh \ jq \ - vim \ - python3.8 \ - python3-pip \ - && curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash - \ - && apt-get install nodejs -y \ - && rm -rf /var/lib/apt/lists/* - -RUN pip3 install mkdocs-material==3.1.0 pymdown-extensions==6.0 + nodejs-current \ + npm RUN useradd \ --user-group \ @@ -40,15 +35,15 @@ USER cli-microsoft365-dev WORKDIR /home/cli-microsoft365 -RUN zsh -c "$(curl https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" --unattended \ - && git clone https://github.com/denysdovhan/spaceship-prompt.git "$HOME/.oh-my-zsh/custom/themes/spaceship-prompt" --depth=1 \ - && ln -s "$HOME/.oh-my-zsh/custom/themes/spaceship-prompt/spaceship.zsh-theme" "$HOME/.oh-my-zsh/custom/themes/spaceship.zsh-theme" \ - && cp "$HOME/.oh-my-zsh/templates/zshrc.zsh-template" $HOME/.zshrc \ - && git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $HOME/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting \ - && git clone https://github.com/zsh-users/zsh-autosuggestions $HOME/.oh-my-zsh/custom/plugins/zsh-autosuggestions \ +RUN git clone https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh \ + && cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc \ + && git clone https://github.com/denysdovhan/spaceship-prompt.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/spaceship-prompt --depth=1 \ + && ln -s ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/spaceship-prompt/spaceship.zsh-theme ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/spaceship.zsh-theme \ && sed -i "11s/ZSH_THEME=\"robbyrussell\"/ZSH_THEME=\"spaceship\"/" ~/.zshrc \ - && sed -i "27s/# DISABLE_AUTO_UPDATE=\"true\"/DISABLE_AUTO_UPDATE=\"true\"/" ~/.zshrc \ + && git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting \ + && git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions \ && sed -i "73s/plugins=(git)/plugins=(git zsh-autosuggestions zsh-syntax-highlighting)/" ~/.zshrc \ + && sed -i "27s/# DISABLE_AUTO_UPDATE=\"true\"/DISABLE_AUTO_UPDATE=\"true\"/" ~/.zshrc \ && sed -i "50s/# COMPLETION_WAITING_DOTS/COMPLETION_WAITING_DOTS/" ~/.zshrc -CMD [ "/bin/zsh", "-l" ] \ No newline at end of file +CMD [ "/bin/zsh", "-l" ] diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 3d8a7126009..2805ff0abac 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,11 +1,30 @@ { "name": "CLI for Microsoft 365", "dockerFile": "Dockerfile", - "settings": { - "terminal.integrated.shell.linux": "/bin/zsh" + "context": "..", + "postCreateCommand": { + "cli": "npm i && npm run clean && npm run build && npm link", + "docs": "cd docs && npm i" }, - "postCreateCommand": "npm i && npm run clean && npm run build && npm link", - "extensions": [ - "dbaeumer.vscode-eslint" - ] + "customizations": { + "vscode": { + "extensions": [ + "dbaeumer.vscode-eslint", + "hbenl.vscode-test-explorer", + "hbenl.vscode-mocha-test-adapter", + "eamodio.gitlens" + ], + "settings": { + "terminal.integrated.profiles.linux": { + "zsh": { + "path": "/bin/zsh", + "args": [ + "-l" + ] + } + }, + "terminal.integrated.defaultProfile.linux": "zsh" + } + } + } } \ No newline at end of file diff --git a/.devproxy/api-specs/sharepoint-admin.yaml b/.devproxy/api-specs/sharepoint-admin.yaml new file mode 100644 index 00000000000..3ff26da3013 --- /dev/null +++ b/.devproxy/api-specs/sharepoint-admin.yaml @@ -0,0 +1,157 @@ +openapi: 3.0.4 +info: + title: SharePoint Tenant Admin site API + description: SharePoint Tenant Admin site API + version: v1.0 +servers: + - url: https://{tenant}-admin.sharepoint.com + variables: + tenant: + default: contoso +components: + securitySchemes: + delegated: + type: oauth2 + flows: + authorizationCode: + authorizationUrl: https://login.microsoftonline.com/common/v2.0/oauth2/authorize + tokenUrl: https://login.microsoftonline.com/common/v2.0/oauth2/token + scopes: + AllSites.FullControl: AllSites.FullControl + AllSites.Manage: AllSites.Manage + AllSites.Read: AllSites.Read + AllSites.Write: AllSites.Write + EnterpriseResource.Read: EnterpriseResource.Read + EnterpriseResource.Write: EnterpriseResource.Write + MyFiles.Read: MyFiles.Read + MyFiles.Write: MyFiles.Write + Project.Read: Project.Read + Project.Write: Project.Write + ProjectWebApp.FullControl: ProjectWebApp.FullControl + ProjectWebAppReporting.Read: ProjectWebAppReporting.Read + Sites.Search.All: Sites.Search.All + TaskStatus.Submit: TaskStatus.Submit + TermStore.Read.All: TermStore.Read.All + TermStore.ReadWrite.All: TermStore.ReadWrite.All + User.Read.All: User.Read.All + User.ReadWrite.All: User.ReadWrite.All + application: + type: oauth2 + flows: + clientCredentials: + tokenUrl: https://login.microsoftonline.com/common/v2.0/oauth2/token + scopes: + Sites.FullControl.All: Sites.FullControl.All + Sites.Manage.All: Sites.Manage.All + Sites.Read.All: Sites.Read.All + Sites.ReadWrite.All: Sites.ReadWrite.All + Sites.Selected: Sites.Selected + TermStore.Read.All: TermStore.Read.All + TermStore.ReadWrite.All: TermStore.ReadWrite.All + User.Read.All: User.Read.All + User.ReadWrite.All: User.ReadWrite.All +paths: + /_api/contextinfo: + post: + security: + - delegated: + - AllSites.Read + - AllSites.Write + - AllSites.Manage + - AllSites.FullControl + responses: + 200: + description: OK + /_api/SPHSite/AddHomeSite: + post: + security: + - delegated: + - AllSites.FullControl + - application: + - Sites.FullControl.All + responses: + 200: + description: OK + /_api/SPO.Tenant/GetSitePropertiesByUrl: + post: + security: + - delegated: + - AllSites.FullControl + - application: + - Sites.FullControl.All + responses: + 200: + description: OK + /_api/SPO.Tenant/GetTargetedSitesDetails: + get: + security: + - delegated: + - AllSites.FullControl + - application: + - Sites.FullControl.All + responses: + 200: + description: OK + /_api/SPO.Tenant/RemoveTargetedSite: + post: + security: + - delegated: + - AllSites.FullControl + - application: + - Sites.FullControl.All + responses: + 200: + description: OK + /_api/SPO.Tenant/sites('{id}'): + get: + parameters: + - name: id + in: path + required: true + schema: + type: string + description: The site collection ID (GUID) + - name: $select + in: query + required: false + schema: + type: string + description: e.g. "$select=Url" to retrieve only the site URL + security: + - delegated: + - AllSites.FullControl + - application: + - Sites.FullControl.All + responses: + 200: + description: OK + /_api/SPO.Tenant/UpdateTargetedSite: + post: + security: + - delegated: + - AllSites.FullControl + - application: + - Sites.FullControl.All + responses: + 200: + description: OK + /_api/web/lists/GetByTitle('{listTitle}')/RenderListDataAsStream: + post: + parameters: + - name: listTitle + in: path + required: true + schema: + type: string + description: The list title (e.g. DO_NOT_DELETE_SPLIST_TENANTADMIN_AGGREGATED_SITECOLLECTIONS) + security: + - delegated: + - AllSites.FullControl + - application: + - Sites.FullControl.All + responses: + 200: + description: OK +x-ms-generated-by: + toolName: Dev Proxy + toolVersion: 0.25.0 \ No newline at end of file diff --git a/.devproxy/api-specs/sharepoint.yaml b/.devproxy/api-specs/sharepoint.yaml new file mode 100644 index 00000000000..cdd0339b081 --- /dev/null +++ b/.devproxy/api-specs/sharepoint.yaml @@ -0,0 +1,674 @@ +openapi: 3.0.4 +info: + title: SharePoint REST API + description: SharePoint REST API + version: v1.0 +servers: + - url: https://{tenant}.sharepoint.com/{site} + variables: + tenant: + default: contoso + site: + default: "" + - url: https://{tenant}.sharepoint.com + variables: + tenant: + default: contoso +components: + securitySchemes: + delegated: + type: oauth2 + flows: + authorizationCode: + authorizationUrl: https://login.microsoftonline.com/common/v2.0/oauth2/authorize + tokenUrl: https://login.microsoftonline.com/common/v2.0/oauth2/token + scopes: + AllSites.FullControl: AllSites.FullControl + AllSites.Manage: AllSites.Manage + AllSites.Read: AllSites.Read + AllSites.Write: AllSites.Write + EnterpriseResource.Read: EnterpriseResource.Read + EnterpriseResource.Write: EnterpriseResource.Write + MyFiles.Read: MyFiles.Read + MyFiles.Write: MyFiles.Write + Project.Read: Project.Read + Project.Write: Project.Write + ProjectWebApp.FullControl: ProjectWebApp.FullControl + ProjectWebAppReporting.Read: ProjectWebAppReporting.Read + Sites.Search.All: Sites.Search.All + TaskStatus.Submit: TaskStatus.Submit + TermStore.Read.All: TermStore.Read.All + TermStore.ReadWrite.All: TermStore.ReadWrite.All + User.Read.All: User.Read.All + User.ReadWrite.All: User.ReadWrite.All + application: + type: oauth2 + flows: + clientCredentials: + tokenUrl: https://login.microsoftonline.com/common/v2.0/oauth2/token + scopes: + Sites.FullControl.All: Sites.FullControl.All + Sites.Manage.All: Sites.Manage.All + Sites.Read.All: Sites.Read.All + Sites.ReadWrite.All: Sites.ReadWrite.All + Sites.Selected: Sites.Selected + TermStore.Read.All: TermStore.Read.All + TermStore.ReadWrite.All: TermStore.ReadWrite.All + User.Read.All: User.Read.All + User.ReadWrite.All: User.ReadWrite.All +paths: + /_api/Brandcenter/Configuration: + get: + security: + - delegated: + - AllSites.Read + - AllSites.Write + - AllSites.Manage + - AllSites.FullControl + - application: + - Sites.Read.All + - Sites.ReadWrite.All + - Sites.Manage.All + - Sites.FullControl.All + responses: + 200: + description: OK + /_api/Lists(guid'{listId}')/items({itemId})/UnArchive: + post: + parameters: + - name: listId + in: path + required: true + description: list GUID + schema: + type: string + example: b2307a39-e878-458b-bc90-03bc578531d6 + - name: itemId + in: path + required: true + description: list item ID + schema: + type: integer + example: 1 + security: + - delegated: + - AllSites.Write + - AllSites.Manage + - AllSites.FullControl + - application: + - Sites.ReadWrite.All + - Sites.Manage.All + - Sites.FullControl.All + responses: + 200: + description: OK + /_api/contextinfo: + post: + security: + - delegated: + - AllSites.Read + - AllSites.Write + - AllSites.Manage + - AllSites.FullControl + responses: + 200: + description: OK + /_api/Lists(guid{listId})/items({itemId})/Archive: + post: + parameters: + - name: listId + in: path + required: true + description: list GUID + schema: + type: string + example: "'b2307a39-e878-458b-bc90-03bc578531d6'" + - name: itemId + in: path + required: true + description: list item ID + schema: + type: integer + example: 1 + security: + - delegated: + - AllSites.Write + - AllSites.Manage + - AllSites.FullControl + - application: + - Sites.ReadWrite.All + - Sites.Manage.All + - Sites.FullControl.All + responses: + 200: + description: OK + /_api/SP_TenantSettings_Current: + get: + security: + - delegated: + - AllSites.Read + - AllSites.Write + - AllSites.Manage + - AllSites.FullControl + responses: + 200: + description: OK + /_api/site/VersionPolicyForNewLibrariesTemplate: + get: + parameters: + - name: $expand + in: query + required: false + schema: + type: string + example: VersionPolicies + security: + - delegated: + - AllSites.Read + - AllSites.Write + - AllSites.Manage + - AllSites.FullControl + - application: + - Sites.Read.All + - Sites.ReadWrite.All + - Sites.Manage.All + - Sites.FullControl.All + responses: + 200: + description: OK + /_api/web: + get: + security: + - delegated: + - AllSites.Read + - AllSites.Write + - AllSites.Manage + - AllSites.FullControl + responses: + 200: + description: OK + /_api/web/alerts: + get: + parameters: + - name: $expand + in: query + required: false + schema: + type: string + example: "List,User,List/Rootfolder,Item" + - name: $select + in: query + required: false + schema: + type: string + example: "*,List/Id,List/Title,List/Rootfolder/ServerRelativeUrl,Item/ID,Item/FileRef,Item/Guid" + security: + - delegated: + - AllSites.FullControl + - application: + - Sites.FullControl.All + responses: + 200: + description: OK + /_api/web/Alerts/DeleteAlert({id}): + delete: + parameters: + - name: id + in: path + required: true + description: GUID of the alert to delete + schema: + type: string + example: "'f55e3c17-63ea-456a-8451-48d2839760f7'" + security: + - delegated: + - AllSites.FullControl + - application: + - Sites.FullControl.All + responses: + 200: + description: OK + /_api/web/folders/addUsingPath(decodedUrl={folderPath}): + post: + parameters: + - name: folderPath + in: path + required: true + description: URL-encoded server-relative path to the folder + schema: + type: string + example: "'%2FShared%20Documents%2FMy%20Folder%20Name'" + security: + - delegated: + - AllSites.Write + - AllSites.Manage + - AllSites.FullControl + responses: + 200: + description: OK + /_api/web/GetFileById({fileId}): + get: + parameters: + - name: fileId + in: path + required: true + description: file unique ID + schema: + type: string + example: "'7a8c9207-7745-4cda-b0e2-be2618ee3030'" + security: + - delegated: + - AllSites.Read + - AllSites.Write + - AllSites.Manage + - AllSites.FullControl + - application: + - Sites.Read.All + - Sites.ReadWrite.All + - Sites.Manage.All + - Sites.FullControl.All + responses: + 200: + description: OK + /_api/web/GetFileById({fileId})/versions: + get: + parameters: + - name: fileId + in: path + required: true + schema: + type: string + example: "'19bbfec4-4425-4660-95cb-da1887baa7b9'" + security: + - delegated: + - AllSites.Read + - AllSites.Write + - AllSites.Manage + - AllSites.FullControl + - application: + - Sites.Read.All + - Sites.ReadWrite.All + - Sites.Manage.All + - Sites.FullControl.All + responses: + 200: + description: OK + /_api/web/GetFileById({fileId})/versions({versionId})/SetExpirationDate(): + post: + parameters: + - name: fileId + in: path + required: true + schema: + type: string + example: "'19bbfec4-4425-4660-95cb-da1887baa7b9'" + - name: versionId + in: path + required: true + schema: + type: integer + example: 1030 + security: + - delegated: + - AllSites.Write + - AllSites.Manage + - AllSites.FullControl + - application: + - Sites.ReadWrite.All + - Sites.Manage.All + - Sites.FullControl.All + responses: + 200: + description: OK + /_api/web/GetFileByServerRelativePath(DecodedUrl={filePath}): + get: + parameters: + - name: filePath + in: path + required: true + description: URL-encoded server-relative path to the file + schema: + type: string + example: "'%2Fsites%2FM365SOBA%2Fshared%20documents%2Fgeneral%2Fdocument.docx'" + security: + - delegated: + - AllSites.Read + - AllSites.Write + - AllSites.Manage + - AllSites.FullControl + - application: + - Sites.Read.All + - Sites.ReadWrite.All + - Sites.Manage.All + - Sites.FullControl.All + responses: + 200: + description: OK + /_api/web/GetFileByServerRelativePath(DecodedUrl={filePath})/$value: + get: + parameters: + - name: filePath + in: path + required: true + description: URL-encoded server-relative path to the file + schema: + type: string + example: "'%2FShared%20Documents%2FForms%2Fclient_LocationBasedDefaults.html'" + security: + - delegated: + - AllSites.Read + - AllSites.Write + - AllSites.Manage + - AllSites.FullControl + responses: + 200: + description: OK + /_api/web/GetFolderById({folderId}): + get: + parameters: + - name: folderId + in: path + required: true + description: folder unique ID + schema: + type: string + example: "'b2307a39-e878-458b-bc90-03bc578531d6'" + security: + - delegated: + - AllSites.Read + - AllSites.Write + - AllSites.Manage + - AllSites.FullControl + - application: + - Sites.Read.All + - Sites.ReadWrite.All + - Sites.Manage.All + - Sites.FullControl.All + responses: + 200: + description: OK + /_api/web/GetFolderByServerRelativePath(DecodedUrl={folderPath}): + get: + parameters: + - name: folderPath + in: path + required: true + description: URL-encoded server-relative path to the folder + schema: + type: string + example: "'%2FShared%20Documents'" + security: + - delegated: + - AllSites.Read + - AllSites.Write + - AllSites.Manage + - AllSites.FullControl + - application: + - Sites.Read.All + - Sites.ReadWrite.All + - Sites.Manage.All + - Sites.FullControl.All + responses: + 200: + description: OK + /_api/web/GetFolderByServerRelativePath(DecodedUrl={folderPath})/Files/Add({filesAddOptions}): + post: + parameters: + - name: folderPath + in: path + required: true + description: URL-encoded server-relative path to the folder + schema: + type: string + example: "'%2FShared%20Documents'" + - name: filesAddOptions + in: path + required: true + description: Options for adding files + schema: + type: string + example: "url='README.md',%20overwrite=true" + security: + - delegated: + - AllSites.Write + - AllSites.Manage + - AllSites.FullControl + responses: + 200: + description: OK + /_api/web/lists: + get: + security: + - delegated: + - AllSites.Read + - AllSites.Write + - AllSites.Manage + - AllSites.FullControl + - application: + - Sites.Read.All + - Sites.Manage.All + - Sites.ReadWrite.All + - Sites.FullControl.All + responses: + 200: + description: OK + /_api/web/lists({listId}): + get: + parameters: + - name: listId + in: path + required: true + description: list GUID + schema: + type: string + example: "'56bbfec4-4425-4660-95cb-da1887baa7b9'" + security: + - delegated: + - AllSites.Read + - AllSites.Write + - AllSites.Manage + - AllSites.FullControl + - application: + - Sites.Read.All + - Sites.Manage.All + - Sites.ReadWrite.All + - Sites.FullControl.All + responses: + 200: + description: OK + /_api/web/lists(guid'{listId}'): + patch: + parameters: + - name: listId + in: path + required: true + description: list GUID + schema: + type: string + example: "b4cfa0d9-b3d7-49ae-a0f0-f14ffdd005f7" + requestBody: + required: true + content: + application/json: + example: + DefaultSensitivityLabelForLibrary: "" + security: + - delegated: + - AllSites.Write + - AllSites.Manage + - AllSites.FullControl + - application: + - Sites.ReadWrite.All + - Sites.Manage.All + - Sites.FullControl.All + responses: + 204: + description: No Content + /_api/web/lists/getByTitle('{listTitle}'): + patch: + parameters: + - name: listTitle + in: path + required: true + description: list title + schema: + type: string + example: "Shared Documents" + requestBody: + required: true + content: + application/json: + example: + DefaultSensitivityLabelForLibrary: "" + security: + - delegated: + - AllSites.Write + - AllSites.Manage + - AllSites.FullControl + - application: + - Sites.ReadWrite.All + - Sites.Manage.All + - Sites.FullControl.All + responses: + 204: + description: No Content + /_api/web/GetList('{listServerRelativeUrl}'): + patch: + parameters: + - name: listServerRelativeUrl + in: path + required: true + description: Server-relative URL of the list + schema: + type: string + example: "/Shared Documents" + requestBody: + required: true + content: + application/json: + example: + DefaultSensitivityLabelForLibrary: "" + security: + - delegated: + - AllSites.Write + - AllSites.Manage + - AllSites.FullControl + - application: + - Sites.ReadWrite.All + - Sites.Manage.All + - Sites.FullControl.All + responses: + 204: + description: No Content + /_api/web/webs: + get: + security: + - delegated: + - AllSites.Write + - AllSites.Manage + - AllSites.FullControl + - application: + - Sites.Read.All + - Sites.Manage.All + - Sites.ReadWrite.All + - Sites.FullControl.All + responses: + 200: + description: OK + /sites/{appCatalog}/_api/web/tenantappcatalog/Add({addOptions}): + post: + parameters: + - name: appCatalog + in: path + required: true + description: App catalog site URL + schema: + type: string + example: "appcatalog" + - name: addOptions + in: path + required: true + description: Options for adding the app package + schema: + type: string + example: "overwrite=false,%20url='spfx.sppkg'" + security: + - delegated: + - AllSites.FullControl + responses: + 200: + description: OK + /sites/{appCatalog}/_api/web/tenantappcatalog/AvailableApps/GetById({appId})/deploy: + post: + parameters: + - name: appCatalog + in: path + required: true + description: App catalog site URL + schema: + type: string + example: "appcatalog" + - name: appId + in: path + required: true + description: App ID to deploy + schema: + type: string + example: "'f55e3c17-63ea-456a-8451-48d2839760f7'" + security: + - delegated: + - AllSites.FullControl + responses: + 200: + description: OK + /_api/web: + patch: + requestBody: + required: true + content: + application/json: + example: + RequestAccessEmail: "john.doe@contoso.com" + security: + - delegated: + - AllSites.FullControl + - application: + - Sites.FullControl.All + responses: + 200: + description: OK + /_api/web/SetUseAccessRequestDefaultAndUpdate: + post: + requestBody: + required: true + content: + application/json: + example: + useAccessRequestDefault: true + security: + - delegated: + - AllSites.FullControl + - application: + - Sites.FullControl.All + responses: + 200: + description: OK + /_api/web/SetAccessRequestSiteDescriptionAndUpdate: + post: + requestBody: + required: true + content: + application/json: + example: + description: "Motivate why you need access." + security: + - delegated: + - AllSites.FullControl + - application: + - Sites.FullControl.All + responses: + 200: + description: OK +x-ms-generated-by: + toolName: Dev Proxy + toolVersion: 0.25.0 diff --git a/.devproxy/devproxyrc.json b/.devproxy/devproxyrc.json new file mode 100644 index 00000000000..2dd77085175 --- /dev/null +++ b/.devproxy/devproxyrc.json @@ -0,0 +1,48 @@ +{ + "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v1.0.0/rc.schema.json", + "plugins": [ + { + "name": "GraphMinimalPermissionsPlugin", + "enabled": true, + "pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll", + "urlsToWatch": [ + "https://graph.microsoft.com/*" + ] + }, + { + "name": "MinimalPermissionsPlugin", + "enabled": true, + "pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll", + "configSection": "minimalPermissionsPlugin", + "urlsToWatch": [ + "https://*.sharepoint.com/*_api/*" + ] + }, + { + "name": "MinimalCsomPermissionsPlugin", + "enabled": true, + "pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll", + "configSection": "minimalCsomPermissionsPlugin", + "urlsToWatch": [ + "https://*.sharepoint.com/*_vti_bin/client.svc/ProcessQuery" + ] + } + ], + "urlsToWatch": [ + "https://*.sharepoint.com/*", + "https://graph.microsoft.com/*" + ], + "minimalPermissionsPlugin": { + "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v1.0.0/minimalpermissionsplugin.schema.json", + "apiSpecsFolderPath": "./api-specs" + }, + "minimalCsomPermissionsPlugin": { + "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v1.0.0/minimalcsompermissionsplugin.schema.json", + "typesFilePath": "./spo-csom-types.json" + }, + "asSystemProxy": false, + "logLevel": "information", + "newVersionNotification": "stable", + "showSkipMessages": true, + "record": true +} \ No newline at end of file diff --git a/.devproxy/generate-openapi-spec.json b/.devproxy/generate-openapi-spec.json new file mode 100644 index 00000000000..e5f0767d271 --- /dev/null +++ b/.devproxy/generate-openapi-spec.json @@ -0,0 +1,24 @@ +{ + "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v1.0.0/rc.schema.json", + "plugins": [ + { + "name": "OpenApiSpecGeneratorPlugin", + "enabled": true, + "pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll", + "configSection": "openApiSpecGeneratorPlugin" + } + ], + "urlsToWatch": [ + "!https://login.microsoftonline.com/*", + "!https://*.applicationinsights.azure.com/*", + "*" + ], + "openApiSpecGeneratorPlugin": { + "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v1.0.0/openapispecgeneratorplugin.schema.json", + "includeOptionsRequests": false, + "specVersion": "v3_0", + "specFormat": "Yaml" + }, + "asSystemProxy": false, + "record": true +} diff --git a/.devproxy/spo-csom-types.json b/.devproxy/spo-csom-types.json new file mode 100644 index 00000000000..fc056d825dc --- /dev/null +++ b/.devproxy/spo-csom-types.json @@ -0,0 +1,54 @@ +{ + "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v1.0.0/minimalcsompermissions.types.schema.json", + "types": { + "104e8f06-1e00-4675-99c6-1b9b504ed8d8": "Microsoft.Online.SharePoint.TenantAdministration.Internal.SPOWebAppServicePrincipal", + "268004ae-ef6b-4e9b-8425-127220d84719": "Microsoft.Online.SharePoint.TenantAdministration.Tenant", + "3747adcd-a3c3-41b9-bfab-4a64dd2f1e0a": "Microsoft.SharePoint.Client.RequestContext" + }, + "returnTypes": { + "Microsoft.SharePoint.Client.RequestContext.Current.Site": "Microsoft.SharePoint.Client.Site" + }, + "actions": { + "Microsoft.SharePoint.Client.RequestContext.Current": { + "delegated": [ + "AllSites.Read", + "AllSites.Write", + "AllSites.Manage", + "AllSites.FullControl" + ], + "application": [] + }, + "Microsoft.SharePoint.Client.Site.setProperty": { + "delegated": [ + "AllSites.FullControl" + ], + "application": [] + }, + "Microsoft.Online.SharePoint.TenantAdministration.Tenant.ctor": { + "delegated": [ + "AllSites.Read", + "AllSites.Write", + "AllSites.Manage", + "AllSites.FullControl" + ], + "application": [ + ] + }, + "Microsoft.Online.SharePoint.TenantAdministration.Tenant.query": { + "delegated": [ + "AllSites.Write", + "AllSites.Manage", + "AllSites.FullControl" + ], + "application": [ + ] + }, + "Microsoft.Online.SharePoint.TenantAdministration.Tenant.GetSitePropertiesFromSharePointByFilters": { + "delegated": [ + "AllSites.FullControl" + ], + "application": [ + ] + } + } +} \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 21ac4bdb6e3..00000000000 --- a/.eslintrc.js +++ /dev/null @@ -1,190 +0,0 @@ -// list of words used in command names used for word breaking -// sorted alphabetically for easy maintenance -const dictionary = [ - 'access', - 'activation', - 'activations', - 'adaptive', - 'app', - 'apply', - 'approve', - 'assets', - 'bin', - 'catalog', - 'client', - 'comm', - 'content', - 'conversation', - 'custom', - 'default', - 'external', - 'externalize', - 'fun', - 'group', - 'groupify', - 'guest', - 'hide', - 'historical', - 'home', - 'hub', - 'in', - 'init', - 'install', - 'is', - 'issue', - 'list', - 'member', - 'messaging', - 'news', - 'oauth2', - 'office365', - 'org', - 'o365', - 'permission', - 'place', - 'property', - 'records', - 'recycle', - 'role', - 'schema', - 'service', - 'setting', - 'settings', - 'side', - 'site', - 'status', - 'storage', - 'token', - 'type', - 'user', - 'web', - 'webhook' -]; - -// list of words that should be capitalized in a specific way -const capitalized = [ - 'OAuth2' -]; - -// sort dictionary to put the longest words first -const sortedDictionary = dictionary.sort((a, b) => b.length - a.length); - -module.exports = { - "root": true, - "env": { - "node": true, - "es2021": true, - "commonjs": true, - "mocha": true - }, - "globals": { - "NodeJS": true - }, - "extends": [ - "plugin:@typescript-eslint/recommended" - ], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaVersion": 2015, - "sourceType": "module" - }, - "plugins": [ - "@typescript-eslint", - "cli-microsoft365" - ], - "ignorePatterns": [ - "**/pcf-init/assets/**", - "**/solution-init/assets/**", - "**/package-generate/assets/**", - "**/test-projects/**", - "clientsidepages.ts", - "*.js" - ], - "rules": { - "cli-microsoft365/correct-command-class-name": ["error", sortedDictionary, capitalized], - "cli-microsoft365/correct-command-name": "error", - "indent": "off", - "@typescript-eslint/indent": [ - "error", - 2 - ], - "semi": "off", - "@typescript-eslint/semi": [ - "error" - ], - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-var-requires": "off", - "@typescript-eslint/no-inferrable-types": "off", - "@typescript-eslint/no-non-null-assertion": "off", - "@typescript-eslint/explicit-module-boundary-types": [ - "error", - { - "allowArgumentsExplicitlyTypedAsAny": true - } - ], - "@typescript-eslint/no-unused-vars": [ - "error", - { - "argsIgnorePattern": "^_" - } - ], - "brace-style": [ - "error", - "stroustrup", - { - "allowSingleLine": true - } - ], - "camelcase": [ - "error", - { - "allow": [ - "child_process", - "error_description", - "_Child_Items_", - "_Object_Type_", - "FN\\d+", - "OData__.*", - "vti_.*", - "Query.*", - "app_displayname", - "access_token", - "expires_on" - ] - } - ], - "comma-dangle": [ - "error", - "never" - ], - "curly": [ - "error", - "all" - ], - "eqeqeq": [ - "error", - "always" - ] - }, - "overrides": [ - { - "files": [ - "*.spec.ts" - ], - "rules": { - "no-console": "error", - "@typescript-eslint/no-empty-function": "off", - "cli-microsoft365/correct-command-class-name": "off", - "cli-microsoft365/correct-command-name": "off" - } - }, - { - "files": [ - "**/yammer/**" - ], - "rules": { - "camelcase": "off" - } - } - ] -} diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml new file mode 100644 index 00000000000..e0e111b2f09 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -0,0 +1,125 @@ +name: Bug report +description: Let us know about functionality that is not working as expected +labels: [ bug ] +title: "Bug report: " +body: + - type: markdown + attributes: + value: | + Thank you for reporting the issue you are facing. + + Please complete the below form to ensure we have the necessary details to assist you. + - type: dropdown + id: priority + attributes: + label: Priority + description: Let us know how this issue is affecting you + options: + - (Low) Something is a little off + - (Medium) I'm annoyed but I'll live + - (Urgent) I can't use the CLI + validations: + required: true + - type: textarea + id: description + attributes: + label: Description + description: Provide a short description of the issue you are facing + validations: + required: true + - type: textarea + id: steps + attributes: + label: Steps to reproduce + description: Provide the steps you have taken so that we can reproduce the error + validations: + required: true + - type: textarea + id: expected + attributes: + label: Expected results + description: Provide a description of what you expect to happen + validations: + required: true + - type: textarea + id: actual + attributes: + label: Actual results + description: Provide a description of what actually happens + validations: + required: true + - type: textarea + id: debug + attributes: + label: Diagnostics + description: | + Provide the output from the command when using the `--debug` option + + *IMPORTANT: You should be careful to sanitise any sensitive output such as tenant information and access tokens before sharing* + validations: + required: false + - type: input + id: cliversion + attributes: + label: CLI for Microsoft 365 version + description: | + Provide the version of the CLI you are using + + Execute `m365 version` in your terminal to identify your version + validations: + required: true + - type: input + id: nodeversion + attributes: + label: nodejs version + description: | + Provide the version of nodejs you are using + + Execute `node -v` in your terminal to identify your version + validations: + required: true + - type: dropdown + id: os + attributes: + label: Operating system (environment) + description: Provide the operating system that you are using + options: + - Windows + - macOS + - Linux + - Azure Cloud Shell + - Other + validations: + required: true + - type: dropdown + id: shell + attributes: + label: Shell + description: Provide the shell that you are using + options: + - PowerShell + - Windows PowerShell + - cmd + - bash + - zsh + - Other + validations: + required: true + - type: textarea + id: doctor + attributes: + label: cli doctor + description: | + Provide the output of the `cli doctor` command + + *NOTE: You must be using CLI for Microsoft v3.12 or higher, to use the `m365 cli doctor` command* + validations: + required: false + - type: textarea + id: info + attributes: + label: Additional Info + description: | + Provide any additional information that may help with the identification of the root cause of this issue + validations: + required: false \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 9c63cb6d206..00000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -name: Bug report -about: Let us know about functionality that is not working as expected -title: 'Bug report: ' -labels: '' -assignees: '' - ---- - -> Thank you for reporting an issue. Please complete the below template to ensure we have the necessary details to assist you. -> -> _(DELETE THIS PARAGRAPH AFTER READING)_ -> - -### Description - -> Provide a short description of the issue you are facing -> -> _(DELETE THIS PARAGRAPH AFTER READING)_ -> - -### Steps to reproduce - -> Provide the steps you have taken so that we can reproduce the error -> -> _(DELETE THIS PARAGRAPH AFTER READING)_ -> - -### Expected result - -> Provide a description of what you expect to happen -> -> _(DELETE THIS PARAGRAPH AFTER READING)_ -> - -### Actual result - -> Provide a description of what actually happens, please provide any screenshots or error logs here -> -> _(DELETE THIS PARAGRAPH AFTER READING)_ -> - -### Environment - -> Provide details of the environment in which this issue was discovered, please include the operating system, shell and version of CLI used (`m365 version`), for example, "_MacOS Catalina, bash, 2.0.0_" -> -> _(DELETE THIS PARAGRAPH AFTER READING)_ -> \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000000..c4f92bdaca5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,10 @@ +blank_issues_enabled: true +contact_links: + - name: Need help? + url: https://aka.ms/cli-m365/discord + about: Ask a question in our community Discord server. + - name: Request office hours + url: https://forms.office.com/r/F7nUDGFNBB + about: Request a call with CLI for Microsoft 365 maintainer to recheck your case or provide support with CLI for Microsoft 365. + + diff --git a/.github/ISSUE_TEMPLATE/new-command.md b/.github/ISSUE_TEMPLATE/new-command.md deleted file mode 100644 index 7d249de4c84..00000000000 --- a/.github/ISSUE_TEMPLATE/new-command.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -name: New command -about: Suggest a new command to be included in this project -title: 'New command: ' -labels: '' -assignees: '' - ---- - -> Thank you for suggesting a new command to be added to this project. Please complete the below template to ensure we have the necessary details to assist you. -> -> _(DELETE THIS PARAGRAPH AFTER READING)_ -> - -### Usage - -> This should describe how the command will be used. Commands should follow a pattern of *service* *entity* *verb*. Verbs include *get, set, remove, add, list* -> -> `teams user list [options]` -> -> _(DELETE THIS PARAGRAPH AFTER READING)_ - -### Description - -> A short description of what the command does -> -> `Retrieve information about the specified site` -> -> _(DELETE THIS PARAGRAPH AFTER READING)_ - -### Options - -> Complete the table below with the options used on this command. A short (single character) and long version of the option should be provided along with `[optional]` or `` parameters. -> -> Option | Description -> -- | -- -> `-i, --teamId ` | The Id of the Microsoft Team -> `-r, --role [role]` | Filter the results to only users with the given role: Owner or Member. -> -> _(DELETE THIS PARAGRAPH AFTER READING)_ - -| Option | Description | -| ----------------------- | ----------------------------------------- | -| `-o, --option