@pnp/cli-microsoft365 7.0.0 → 7.1.0-beta.129c6c7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.devcontainer/Dockerfile +0 -1
- package/.eslintrc.cjs +1 -0
- package/Dockerfile +0 -1
- package/dist/Auth.js +1 -1
- package/dist/Command.js +18 -28
- package/dist/appInsights.js +5 -9
- package/dist/cli/Cli.js +9 -4
- package/dist/m365/aad/commands/m365group/m365group-remove.js +109 -15
- package/dist/m365/commands/setup.js +2 -1
- package/dist/m365/spo/commands/app/app-deploy.js +1 -1
- package/dist/m365/spo/commands/app/app-get.js +1 -1
- package/dist/m365/spo/commands/app/app-teamspackage-download.js +1 -1
- package/dist/m365/spo/commands/apppage/apppage-add.js +1 -1
- package/dist/m365/spo/commands/feature/feature-disable.js +8 -6
- package/dist/m365/spo/commands/feature/feature-enable.js +6 -5
- package/dist/m365/spo/commands/page/Page.js +1 -1
- package/dist/m365/spo/commands/page/page-add.js +1 -1
- package/dist/m365/spo/commands/page/page-get.js +1 -1
- package/dist/m365/spo/commands/page/page-header-set.js +1 -1
- package/dist/m365/spo/commands/page/page-remove.js +1 -1
- package/dist/m365/spo/commands/page/page-set.js +2 -2
- package/dist/m365/spo/commands/page/page-text-add.js +1 -1
- package/dist/m365/spo/commands/sitedesign/sitedesign-get.js +15 -14
- package/dist/m365/spo/commands/sitedesign/sitedesign-remove.js +22 -22
- package/dist/m365/spo/commands/user/user-get.js +7 -1
- package/dist/m365/todo/commands/task/task-list.js +8 -10
- package/dist/m365/todo/commands/task/task-remove.js +36 -36
- package/dist/m365/todo/commands/task/task-set.js +11 -13
- package/dist/m365/yammer/commands/group/group-user-remove.js +22 -23
- package/dist/telemetry.js +30 -14
- package/dist/telemetryRunner.js +26 -0
- package/dist/utils/prompt.js +16 -0
- package/docs/docs/cmd/aad/license/license-list.mdx +21 -16
- package/docs/docs/cmd/aad/m365group/m365group-add.mdx +1 -1
- package/docs/docs/cmd/aad/m365group/m365group-remove.mdx +11 -1
- package/docs/docs/cmd/aad/user/user-add.mdx +2 -4
- package/docs/docs/cmd/aad/user/user-license-add.mdx +2 -4
- package/docs/docs/cmd/aad/user/user-license-list.mdx +3 -5
- package/docs/docs/cmd/aad/user/user-recyclebinitem-list.mdx +1 -3
- package/docs/docs/cmd/aad/user/user-recyclebinitem-restore.mdx +1 -3
- package/docs/docs/cmd/flow/environment/environment-get.mdx +3 -4
- package/docs/docs/cmd/flow/environment/environment-list.mdx +3 -4
- package/docs/docs/cmd/flow/owner/owner-list.mdx +2 -3
- package/docs/docs/cmd/flow/run/run-list.mdx +6 -8
- package/docs/docs/cmd/graph/schemaextension/schemaextension-list.mdx +2 -3
- package/docs/docs/cmd/onenote/page/page-list.mdx +6 -9
- package/docs/docs/cmd/outlook/message/message-get.mdx +5 -15
- package/docs/docs/cmd/outlook/message/message-list.mdx +5 -14
- package/docs/docs/cmd/outlook/room/room-list.mdx +3 -6
- package/docs/docs/cmd/outlook/roomlist/roomlist-list.mdx +1 -3
- package/docs/docs/cmd/pa/app/app-get.mdx +4 -7
- package/docs/docs/cmd/pa/app/app-list.mdx +4 -7
- package/docs/docs/cmd/pa/connector/connector-list.mdx +2 -4
- package/docs/docs/cmd/pa/environment/environment-get.mdx +2 -4
- package/docs/docs/cmd/pa/environment/environment-list.mdx +1 -3
- package/docs/docs/cmd/planner/plan/plan-add.mdx +4 -11
- package/docs/docs/cmd/planner/plan/plan-get.mdx +4 -9
- package/docs/docs/cmd/planner/plan/plan-list.mdx +3 -6
- package/docs/docs/cmd/planner/plan/plan-set.mdx +3 -9
- package/docs/docs/cmd/planner/roster/roster-member-add.mdx +2 -4
- package/docs/docs/cmd/planner/roster/roster-member-get.mdx +2 -4
- package/docs/docs/cmd/planner/roster/roster-member-list.mdx +1 -3
- package/docs/docs/cmd/planner/task/task-add.mdx +4 -14
- package/docs/docs/cmd/planner/task/task-checklistitem-add.mdx +2 -4
- package/docs/docs/cmd/planner/task/task-checklistitem-list.mdx +1 -3
- package/docs/docs/cmd/planner/task/task-get.mdx +0 -7
- package/docs/docs/cmd/planner/task/task-list.mdx +1 -5
- package/docs/docs/cmd/planner/task/task-reference-add.mdx +0 -2
- package/docs/docs/cmd/planner/task/task-reference-list.mdx +0 -2
- package/docs/docs/cmd/planner/task/task-set.mdx +4 -13
- package/docs/docs/cmd/planner/tenant/tenant-settings-list.mdx +1 -3
- package/docs/docs/cmd/planner/tenant/tenant-settings-set.mdx +3 -5
- package/docs/docs/cmd/pp/aibuildermodel/aibuildermodel-get.mdx +6 -8
- package/docs/docs/cmd/pp/aibuildermodel/aibuildermodel-list.mdx +4 -7
- package/docs/docs/cmd/pp/card/card-get.mdx +4 -8
- package/docs/docs/cmd/pp/card/card-list.mdx +0 -4
- package/docs/docs/cmd/pp/chatbot/chatbot-get.mdx +4 -6
- package/docs/docs/cmd/pp/dataverse/dataverse-table-get.mdx +3 -14
- package/docs/docs/cmd/pp/dataverse/dataverse-table-list.mdx +3 -14
- package/docs/docs/cmd/pp/environment/environment-get.mdx +3 -5
- package/docs/docs/cmd/pp/environment/environment-list.mdx +2 -4
- package/docs/docs/cmd/pp/gateway/gateway-get.mdx +0 -3
- package/docs/docs/cmd/pp/gateway/gateway-list.mdx +1 -4
- package/docs/docs/cmd/purview/auditlog/auditlog-list.mdx +4 -0
- package/docs/docs/cmd/purview/retentionevent/retentionevent-add.mdx +3 -8
- package/docs/docs/cmd/purview/retentionevent/retentionevent-get.mdx +1 -3
- package/docs/docs/cmd/purview/retentionevent/retentionevent-list.mdx +1 -5
- package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-add.mdx +0 -2
- package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-get.mdx +1 -3
- package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-list.mdx +1 -3
- package/docs/docs/cmd/purview/sensitivitylabel/sensitivitylabel-get.mdx +3 -6
- package/docs/docs/cmd/purview/sensitivitylabel/sensitivitylabel-list.mdx +3 -5
- package/docs/docs/cmd/purview/threatassessment/threatassessment-get.mdx +4 -8
- package/docs/docs/cmd/spo/app/app-add.mdx +94 -7
- package/docs/docs/cmd/spo/app/app-deploy.mdx +11 -7
- package/docs/docs/cmd/spo/app/app-get.mdx +117 -8
- package/docs/docs/cmd/spo/app/app-install.mdx +9 -5
- package/docs/docs/cmd/spo/app/app-instance-list.mdx +85 -2
- package/docs/docs/cmd/spo/app/app-list.mdx +95 -3
- package/docs/docs/cmd/spo/app/app-remove.mdx +11 -7
- package/docs/docs/cmd/spo/app/app-retract.mdx +9 -5
- package/docs/docs/cmd/spo/app/app-teamspackage-download.mdx +12 -8
- package/docs/docs/cmd/spo/app/app-uninstall.mdx +11 -7
- package/docs/docs/cmd/spo/app/app-upgrade.mdx +9 -5
- package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-add.mdx +4 -2
- package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-get.mdx +9 -7
- package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-list.mdx +6 -6
- package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-remove.mdx +12 -6
- package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-set.mdx +4 -2
- package/docs/docs/cmd/spo/apppage/apppage-add.mdx +54 -5
- package/docs/docs/cmd/spo/apppage/apppage-set.mdx +8 -4
- package/docs/docs/cmd/spo/cdn/cdn-get.mdx +36 -1
- package/docs/docs/cmd/spo/cdn/cdn-origin-add.mdx +7 -3
- package/docs/docs/cmd/spo/cdn/cdn-origin-list.mdx +48 -3
- package/docs/docs/cmd/spo/cdn/cdn-origin-remove.mdx +8 -4
- package/docs/docs/cmd/spo/cdn/cdn-policy-list.mdx +53 -3
- package/docs/docs/cmd/spo/cdn/cdn-policy-set.mdx +7 -3
- package/docs/docs/cmd/spo/cdn/cdn-set.mdx +7 -3
- package/docs/docs/cmd/spo/commandset/commandset-add.mdx +6 -6
- package/docs/docs/cmd/spo/commandset/commandset-get.mdx +3 -5
- package/docs/docs/cmd/spo/commandset/commandset-list.mdx +6 -5
- package/docs/docs/cmd/spo/commandset/commandset-remove.mdx +7 -3
- package/docs/docs/cmd/spo/commandset/commandset-set.mdx +6 -4
- package/docs/docs/cmd/spo/contenttype/contenttype-add.mdx +148 -9
- package/docs/docs/cmd/spo/contenttype/contenttype-field-remove.mdx +19 -15
- package/docs/docs/cmd/spo/contenttype/contenttype-field-set.mdx +12 -8
- package/docs/docs/cmd/spo/contenttype/contenttype-get.mdx +147 -8
- package/docs/docs/cmd/spo/contenttype/contenttype-list.mdx +115 -4
- package/docs/docs/cmd/spo/contenttype/contenttype-remove.mdx +8 -4
- package/docs/docs/cmd/spo/contenttype/contenttype-set.mdx +8 -4
- package/docs/docs/cmd/spo/contenttypehub/contenttypehub-get.mdx +44 -0
- package/docs/docs/cmd/spo/customaction/customaction-add.mdx +12 -8
- package/docs/docs/cmd/spo/customaction/customaction-clear.mdx +10 -7
- package/docs/docs/cmd/spo/customaction/customaction-get.mdx +11 -15
- package/docs/docs/cmd/spo/customaction/customaction-list.mdx +87 -5
- package/docs/docs/cmd/spo/customaction/customaction-remove.mdx +17 -13
- package/docs/docs/cmd/spo/customaction/customaction-set.mdx +27 -23
- package/docs/docs/cmd/spo/eventreceiver/eventreceiver-get.mdx +29 -14
- package/docs/docs/cmd/spo/eventreceiver/eventreceiver-list.mdx +66 -5
- package/docs/docs/cmd/spo/eventreceiver/eventreceiver-remove.mdx +4 -0
- package/docs/docs/cmd/spo/externaluser/externaluser-list.mdx +78 -7
- package/docs/docs/cmd/spo/feature/feature-disable.mdx +10 -6
- package/docs/docs/cmd/spo/feature/feature-enable.mdx +9 -5
- package/docs/docs/cmd/spo/feature/feature-list.mdx +52 -0
- package/docs/docs/cmd/spo/field/field-add.mdx +177 -11
- package/docs/docs/cmd/spo/field/field-get.mdx +175 -9
- package/docs/docs/cmd/spo/field/field-list.mdx +135 -8
- package/docs/docs/cmd/spo/field/field-remove.mdx +16 -12
- package/docs/docs/cmd/spo/field/field-set.mdx +15 -11
- package/docs/docs/cmd/spo/file/file-add.mdx +31 -27
- package/docs/docs/cmd/spo/file/file-checkin.mdx +13 -9
- package/docs/docs/cmd/spo/file/file-checkout.mdx +9 -5
- package/docs/docs/cmd/spo/file/file-copy.mdx +5 -5
- package/docs/docs/cmd/spo/file/file-get.mdx +89 -18
- package/docs/docs/cmd/spo/file/file-list.mdx +5 -5
- package/docs/docs/cmd/spo/file/file-move.mdx +5 -5
- package/docs/docs/cmd/spo/file/file-remove.mdx +13 -9
- package/docs/docs/cmd/spo/file/file-rename.mdx +63 -5
- package/docs/docs/cmd/spo/file/file-retentionlabel-ensure.mdx +3 -3
- package/docs/docs/cmd/spo/file/file-retentionlabel-remove.mdx +2 -2
- package/docs/docs/cmd/spo/file/file-roleassignment-add.mdx +4 -0
- package/docs/docs/cmd/spo/file/file-roleassignment-remove.mdx +7 -3
- package/docs/docs/cmd/spo/file/file-roleinheritance-break.mdx +9 -5
- package/docs/docs/cmd/spo/file/file-roleinheritance-reset.mdx +10 -6
- package/docs/docs/cmd/spo/file/file-sharinginfo-get.mdx +133 -5
- package/docs/docs/cmd/spo/file/file-sharinglink-add.mdx +21 -3
- package/docs/docs/cmd/spo/file/file-sharinglink-clear.mdx +2 -2
- package/docs/docs/cmd/spo/file/file-sharinglink-get.mdx +18 -0
- package/docs/docs/cmd/spo/file/file-sharinglink-list.mdx +20 -3
- package/docs/docs/cmd/spo/file/file-sharinglink-set.mdx +2 -7
- package/docs/docs/cmd/spo/file/file-version-clear.mdx +7 -7
- package/docs/docs/cmd/spo/file/file-version-get.mdx +28 -6
- package/docs/docs/cmd/spo/file/file-version-list.mdx +28 -6
- package/docs/docs/cmd/spo/file/file-version-remove.mdx +8 -8
- package/docs/docs/cmd/spo/file/file-version-restore.mdx +8 -8
- package/docs/docs/cmd/spo/folder/folder-add.mdx +3 -3
- package/docs/docs/cmd/spo/folder/folder-copy.mdx +1 -1
- package/docs/docs/cmd/spo/folder/folder-get.mdx +257 -3
- package/docs/docs/cmd/spo/folder/folder-list.mdx +3 -4
- package/docs/docs/cmd/spo/folder/folder-move.mdx +5 -5
- package/docs/docs/cmd/spo/folder/folder-remove.mdx +6 -2
- package/docs/docs/cmd/spo/folder/folder-rename.mdx +2 -2
- package/docs/docs/cmd/spo/folder/folder-retentionlabel-ensure.mdx +3 -3
- package/docs/docs/cmd/spo/folder/folder-retentionlabel-remove.mdx +2 -2
- package/docs/docs/cmd/spo/folder/folder-roleassignment-add.mdx +13 -8
- package/docs/docs/cmd/spo/folder/folder-roleassignment-remove.mdx +8 -4
- package/docs/docs/cmd/spo/folder/folder-roleinheritance-break.mdx +4 -0
- package/docs/docs/cmd/spo/folder/folder-roleinheritance-reset.mdx +5 -1
- package/docs/docs/cmd/spo/group/group-add.mdx +78 -0
- package/docs/docs/cmd/spo/group/group-get.mdx +81 -3
- package/docs/docs/cmd/spo/group/group-list.mdx +74 -3
- package/docs/docs/cmd/spo/group/group-member-add.mdx +13 -21
- package/docs/docs/cmd/spo/group/group-member-list.mdx +80 -5
- package/docs/docs/cmd/spo/group/group-member-remove.mdx +4 -4
- package/docs/docs/cmd/spo/group/group-remove.mdx +10 -6
- package/docs/docs/cmd/spo/group/group-set.mdx +9 -5
- package/docs/docs/cmd/spo/hidedefaultthemes/hidedefaultthemes-get.mdx +36 -1
- package/docs/docs/cmd/spo/hidedefaultthemes/hidedefaultthemes-set.mdx +6 -2
- package/docs/docs/cmd/spo/hubsite/hubsite-data-get.mdx +0 -2
- package/docs/docs/cmd/spo/list/list-add.mdx +0 -3
- package/docs/docs/cmd/spo/list/list-contenttype-add.mdx +0 -2
- package/docs/docs/cmd/spo/list/list-contenttype-list.mdx +0 -2
- package/docs/docs/cmd/spo/list/list-get.mdx +1 -4
- package/docs/docs/cmd/spo/list/list-list.mdx +0 -4
- package/docs/docs/cmd/spo/list/list-view-add.mdx +0 -3
- package/docs/docs/cmd/spo/list/list-view-get.mdx +9 -12
- package/docs/docs/cmd/spo/list/list-view-list.mdx +4 -7
- package/docs/docs/cmd/spo/listitem/listitem-attachment-list.mdx +8 -11
- package/docs/docs/cmd/spo/listitem/listitem-get.mdx +0 -2
- package/docs/docs/cmd/spo/navigation/navigation-node-add.mdx +4 -6
- package/docs/docs/cmd/spo/navigation/navigation-node-get.mdx +0 -2
- package/docs/docs/cmd/spo/navigation/navigation-node-list.mdx +4 -6
- package/docs/docs/cmd/spo/page/page-copy.mdx +4 -8
- package/docs/docs/cmd/spo/page/page-get.mdx +2 -5
- package/docs/docs/cmd/spo/page/page-list.mdx +1 -5
- package/docs/docs/cmd/spo/sitescript/sitescript-get.mdx +4 -4
- package/docs/docs/cmd/spo/sitescript/sitescript-set.mdx +6 -7
- package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-add.mdx +3 -1
- package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-get.mdx +5 -3
- package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-list.mdx +4 -2
- package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-remove.mdx +5 -1
- package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-set.mdx +2 -0
- package/docs/docs/cmd/spo/tenant/tenant-commandset-add.mdx +2 -1
- package/docs/docs/cmd/spo/tenant/tenant-commandset-get.mdx +5 -2
- package/docs/docs/cmd/spo/tenant/tenant-commandset-list.mdx +4 -1
- package/docs/docs/cmd/spo/tenant/tenant-commandset-remove.mdx +5 -1
- package/docs/docs/cmd/spo/tenant/tenant-commandset-set.mdx +3 -1
- package/docs/docs/cmd/spo/user/user-get.mdx +6 -0
- package/docs/docs/cmd/teams/channel/channel-member-list.mdx +3 -5
- package/docs/docs/cmd/teams/channel/channel-member-set.mdx +0 -2
- package/docs/docs/cmd/teams/chat/chat-get.mdx +2 -4
- package/docs/docs/cmd/teams/chat/chat-list.mdx +1 -3
- package/docs/docs/cmd/teams/chat/chat-member-list.mdx +2 -4
- package/docs/docs/cmd/teams/message/message-get.mdx +0 -7
- package/docs/docs/cmd/teams/message/message-list.mdx +0 -6
- package/docs/docs/cmd/teams/message/message-reply-list.mdx +0 -6
- package/docs/docs/cmd/teams/tab/tab-add.mdx +10 -12
- package/docs/docs/cmd/teams/tab/tab-get.mdx +8 -10
- package/docs/docs/cmd/teams/tab/tab-list.mdx +4 -7
- package/docs/docs/cmd/teams/team/team-add.mdx +0 -7
- package/docs/docs/cmd/teams/team/team-get.mdx +0 -6
- package/docs/docs/cmd/tenant/security/security-alerts-list.mdx +1 -1
- package/docs/docs/cmd/todo/task/task-add.mdx +9 -13
- package/docs/docs/cmd/todo/task/task-set.mdx +10 -14
- package/eslint-rules/lib/index.js +2 -1
- package/eslint-rules/lib/rules/no-by-server-relative-url-usage.js +55 -0
- package/npm-shrinkwrap.json +88 -84
- package/package.json +53 -32
package/.devcontainer/Dockerfile
CHANGED
|
@@ -6,7 +6,6 @@ LABEL name="CLI for Microsoft 365 Development" \
|
|
|
6
6
|
maintainers="Waldek Mastykarz <waldek@mastykarz.nl>, \
|
|
7
7
|
Garry Trinder <garry.trinder@live.com>, \
|
|
8
8
|
Albert-Jan Schot <appie@digiwijs.nl>, \
|
|
9
|
-
Rabia Williams <rabiawilliams@gmail.com>, \
|
|
10
9
|
Patrick Lamber <patrick@nubo.eu>, \
|
|
11
10
|
Arjun Menon <arjun.umenon@gmail.com>, \
|
|
12
11
|
Adam Wojcik <adam.wojcik.it@gmail.com>, \
|
package/.eslintrc.cjs
CHANGED
|
@@ -136,6 +136,7 @@ module.exports = {
|
|
|
136
136
|
"rules": {
|
|
137
137
|
"cli-microsoft365/correct-command-class-name": ["error", sortedDictionary, capitalized],
|
|
138
138
|
"cli-microsoft365/correct-command-name": "error",
|
|
139
|
+
"cli-microsoft365/no-by-server-relative-url-usage": "error",
|
|
139
140
|
"indent": "off",
|
|
140
141
|
"@typescript-eslint/indent": [
|
|
141
142
|
"error",
|
package/Dockerfile
CHANGED
|
@@ -8,7 +8,6 @@ LABEL name="m365pnp/cli-microsoft365:${CLI_VERSION}" \
|
|
|
8
8
|
maintainers="Waldek Mastykarz <waldek@mastykarz.nl>, \
|
|
9
9
|
Garry Trinder <garry.trinder@live.com>, \
|
|
10
10
|
Albert-Jan Schot <appie@digiwijs.nl>, \
|
|
11
|
-
Rabia Williams <rabiawilliams@gmail.com>, \
|
|
12
11
|
Patrick Lamber <patrick@nubo.eu>, \
|
|
13
12
|
Arjun Menon <arjun.umenon@gmail.com>, \
|
|
14
13
|
Adam Wojcik <adam.wojcik.it@gmail.com>, \
|
package/dist/Auth.js
CHANGED
package/dist/Command.js
CHANGED
|
@@ -12,6 +12,7 @@ import { settingsNames } from './settingsNames.js';
|
|
|
12
12
|
import { telemetry } from './telemetry.js';
|
|
13
13
|
import { accessToken } from './utils/accessToken.js';
|
|
14
14
|
import { md } from './utils/md.js';
|
|
15
|
+
import { prompt } from './utils/prompt.js';
|
|
15
16
|
export class CommandError {
|
|
16
17
|
constructor(message, code) {
|
|
17
18
|
this.message = message;
|
|
@@ -75,7 +76,6 @@ class Command {
|
|
|
75
76
|
}
|
|
76
77
|
async validateRequiredOptions(args, command) {
|
|
77
78
|
const shouldPrompt = Cli.getInstance().getSettingWithDefaultValue(settingsNames.prompt, true);
|
|
78
|
-
let inquirer;
|
|
79
79
|
let prompted = false;
|
|
80
80
|
for (let i = 0; i < command.options.length; i++) {
|
|
81
81
|
if (!command.options[i].required ||
|
|
@@ -87,19 +87,17 @@ class Command {
|
|
|
87
87
|
}
|
|
88
88
|
if (!prompted) {
|
|
89
89
|
prompted = true;
|
|
90
|
-
Cli.
|
|
90
|
+
Cli.error('🌶️ Provide values for the following parameters:');
|
|
91
91
|
}
|
|
92
|
-
|
|
93
|
-
inquirer = await import('inquirer');
|
|
94
|
-
}
|
|
95
|
-
const missingRequireOptionValue = await inquirer.default
|
|
96
|
-
.prompt({
|
|
92
|
+
const missingRequireOptionValue = await prompt.forInput({
|
|
97
93
|
name: 'missingRequireOptionValue',
|
|
98
94
|
message: `${command.options[i].name}: `
|
|
99
|
-
})
|
|
100
|
-
.then(result => result.missingRequireOptionValue);
|
|
95
|
+
}).then(result => result.missingRequireOptionValue);
|
|
101
96
|
args.options[command.options[i].name] = missingRequireOptionValue;
|
|
102
97
|
}
|
|
98
|
+
if (prompted) {
|
|
99
|
+
Cli.error('');
|
|
100
|
+
}
|
|
103
101
|
this.processOptions(args.options);
|
|
104
102
|
return true;
|
|
105
103
|
}
|
|
@@ -108,7 +106,6 @@ class Command {
|
|
|
108
106
|
if (!optionsSets || optionsSets.length === 0) {
|
|
109
107
|
return true;
|
|
110
108
|
}
|
|
111
|
-
let inquirer;
|
|
112
109
|
const shouldPrompt = Cli.getInstance().getSettingWithDefaultValue(settingsNames.prompt, true);
|
|
113
110
|
const argsOptions = Object.keys(args.options);
|
|
114
111
|
for (const optionSet of optionsSets.sort(opt => opt.runsWhen ? 0 : 1)) {
|
|
@@ -120,50 +117,43 @@ class Command {
|
|
|
120
117
|
if (!shouldPrompt) {
|
|
121
118
|
return `Specify one of the following options: ${optionSet.options.join(', ')}.`;
|
|
122
119
|
}
|
|
123
|
-
await this.promptForOptionSetNameAndValue(args, optionSet
|
|
120
|
+
await this.promptForOptionSetNameAndValue(args, optionSet);
|
|
124
121
|
}
|
|
125
122
|
if (commonOptions.length > 1) {
|
|
126
123
|
if (!shouldPrompt) {
|
|
127
124
|
return `Specify one of the following options: ${optionSet.options.join(', ')}, but not multiple.`;
|
|
128
125
|
}
|
|
129
|
-
await this.promptForSpecificOption(args, commonOptions
|
|
126
|
+
await this.promptForSpecificOption(args, commonOptions);
|
|
130
127
|
}
|
|
131
128
|
}
|
|
132
129
|
return true;
|
|
133
130
|
}
|
|
134
|
-
async promptForOptionSetNameAndValue(args, optionSet
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
Cli.log(`Please specify one of the following options:`);
|
|
139
|
-
const resultOptionName = await inquirer.default.prompt({
|
|
131
|
+
async promptForOptionSetNameAndValue(args, optionSet) {
|
|
132
|
+
Cli.error(`🌶️ Please specify one of the following options:`);
|
|
133
|
+
const resultOptionName = await prompt.forInput({
|
|
140
134
|
type: 'list',
|
|
141
135
|
name: 'missingRequiredOptionName',
|
|
142
136
|
message: `Option to use:`,
|
|
143
137
|
choices: optionSet.options
|
|
144
138
|
});
|
|
145
139
|
const missingRequiredOptionName = resultOptionName.missingRequiredOptionName;
|
|
146
|
-
const resultOptionValue = await
|
|
147
|
-
.prompt({
|
|
140
|
+
const resultOptionValue = await prompt.forInput({
|
|
148
141
|
name: 'missingRequiredOptionValue',
|
|
149
142
|
message: `${missingRequiredOptionName}:`
|
|
150
143
|
});
|
|
151
144
|
args.options[missingRequiredOptionName] = resultOptionValue.missingRequiredOptionValue;
|
|
152
|
-
Cli.
|
|
145
|
+
Cli.error('');
|
|
153
146
|
}
|
|
154
|
-
async promptForSpecificOption(args, commonOptions
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}
|
|
158
|
-
Cli.log(`Multiple options for an option set specified. Please specify the correct option that you wish to use.`);
|
|
159
|
-
const requiredOptionNameResult = await inquirer.default.prompt({
|
|
147
|
+
async promptForSpecificOption(args, commonOptions) {
|
|
148
|
+
Cli.error(`🌶️ Multiple options for an option set specified. Please specify the correct option that you wish to use.`);
|
|
149
|
+
const requiredOptionNameResult = await prompt.forInput({
|
|
160
150
|
type: 'list',
|
|
161
151
|
name: 'missingRequiredOptionName',
|
|
162
152
|
message: `Option to use:`,
|
|
163
153
|
choices: commonOptions
|
|
164
154
|
});
|
|
165
155
|
commonOptions.filter(y => y !== requiredOptionNameResult.missingRequiredOptionName).map(optionName => args.options[optionName] = undefined);
|
|
166
|
-
Cli.
|
|
156
|
+
Cli.error('');
|
|
167
157
|
}
|
|
168
158
|
async validateOutput(args) {
|
|
169
159
|
if (args.options.output &&
|
package/dist/appInsights.js
CHANGED
|
@@ -9,7 +9,6 @@ import fs from 'fs';
|
|
|
9
9
|
import path from 'path';
|
|
10
10
|
import url from 'url';
|
|
11
11
|
import { app } from './utils/app.js';
|
|
12
|
-
import { pid } from './utils/pid.js';
|
|
13
12
|
const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
|
|
14
13
|
const config = appInsights.setup('6b908c80-d09f-4cf6-8274-e54349a0149a');
|
|
15
14
|
config.setInternalLogging(false, false);
|
|
@@ -18,17 +17,14 @@ config.setInternalLogging(false, false);
|
|
|
18
17
|
// in the telemetry
|
|
19
18
|
const version = `${app.packageJson().version}${fs.existsSync(path.join(__dirname, `..${path.sep}src`)) ? '-dev' : ''}`;
|
|
20
19
|
const env = process.env.CLIMICROSOFT365_ENV !== undefined ? process.env.CLIMICROSOFT365_ENV : '';
|
|
21
|
-
appInsights.default.defaultClient
|
|
20
|
+
const appInsightsClient = appInsights.default.defaultClient;
|
|
21
|
+
appInsightsClient.commonProperties = {
|
|
22
22
|
version: version,
|
|
23
23
|
node: process.version,
|
|
24
|
-
shell: pid.getProcessName(process.ppid) || '',
|
|
25
24
|
env: env,
|
|
26
25
|
ci: Boolean(process.env.CI).toString()
|
|
27
26
|
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
crypto.createHash('sha256').update(appInsights.default.defaultClient.context.tags['ai.cloud.roleInstance']).digest('hex');
|
|
32
|
-
delete appInsights.default.defaultClient.context.tags['ai.cloud.role'];
|
|
33
|
-
export default appInsights.default.defaultClient;
|
|
27
|
+
appInsightsClient.context.tags['ai.cloud.roleInstance'] = crypto.createHash('sha256').update(appInsightsClient.context.tags['ai.cloud.roleInstance']).digest('hex');
|
|
28
|
+
appInsightsClient.context.tags['ai.cloud.role'];
|
|
29
|
+
export default appInsightsClient;
|
|
34
30
|
//# sourceMappingURL=appInsights.js.map
|
package/dist/cli/Cli.js
CHANGED
|
@@ -15,6 +15,7 @@ import { formatting } from '../utils/formatting.js';
|
|
|
15
15
|
import { fsUtil } from '../utils/fsUtil.js';
|
|
16
16
|
import { md } from '../utils/md.js';
|
|
17
17
|
import { validation } from '../utils/validation.js';
|
|
18
|
+
import { prompt } from '../utils/prompt.js';
|
|
18
19
|
export class Cli {
|
|
19
20
|
get config() {
|
|
20
21
|
if (!this._config) {
|
|
@@ -31,11 +32,15 @@ export class Cli {
|
|
|
31
32
|
return configuredValue;
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
35
35
|
constructor() {
|
|
36
36
|
this.commands = [];
|
|
37
37
|
this.commandsFolder = '';
|
|
38
|
-
|
|
38
|
+
const options = {
|
|
39
|
+
text: 'Running command...',
|
|
40
|
+
/* c8 ignore next 1 */
|
|
41
|
+
stream: this.getSettingWithDefaultValue('errorOutput', 'stderr') === 'stderr' ? process.stderr : process.stdout
|
|
42
|
+
};
|
|
43
|
+
this.spinner = ora(options);
|
|
39
44
|
}
|
|
40
45
|
static getInstance() {
|
|
41
46
|
if (!Cli.instance) {
|
|
@@ -799,14 +804,13 @@ export class Cli {
|
|
|
799
804
|
}
|
|
800
805
|
}
|
|
801
806
|
static async prompt(options, answers) {
|
|
802
|
-
const inquirer = await import('inquirer');
|
|
803
807
|
const cli = Cli.getInstance();
|
|
804
808
|
const spinnerSpinning = cli.spinner.isSpinning;
|
|
805
809
|
/* c8 ignore next 3 */
|
|
806
810
|
if (spinnerSpinning) {
|
|
807
811
|
cli.spinner.stop();
|
|
808
812
|
}
|
|
809
|
-
const response = await
|
|
813
|
+
const response = await prompt.forInput(options, answers);
|
|
810
814
|
// Restart the spinner if it was running before the prompt
|
|
811
815
|
/* c8 ignore next 3 */
|
|
812
816
|
if (spinnerSpinning) {
|
|
@@ -823,6 +827,7 @@ export class Cli {
|
|
|
823
827
|
type: 'list',
|
|
824
828
|
name: 'select',
|
|
825
829
|
default: 0,
|
|
830
|
+
prefix: '🌶️ ',
|
|
826
831
|
message: `${message} Please choose one:`,
|
|
827
832
|
choices: Object.keys(values)
|
|
828
833
|
});
|
|
@@ -10,16 +10,21 @@ import { aadGroup } from '../../../../utils/aadGroup.js';
|
|
|
10
10
|
import { validation } from '../../../../utils/validation.js';
|
|
11
11
|
import GraphCommand from '../../../base/GraphCommand.js';
|
|
12
12
|
import commands from '../../commands.js';
|
|
13
|
+
import config from '../../../../config.js';
|
|
14
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
15
|
+
import { spo } from '../../../../utils/spo.js';
|
|
16
|
+
import { setTimeout } from 'timers/promises';
|
|
13
17
|
class AadM365GroupRemoveCommand extends GraphCommand {
|
|
14
18
|
get name() {
|
|
15
19
|
return commands.M365GROUP_REMOVE;
|
|
16
20
|
}
|
|
17
21
|
get description() {
|
|
18
|
-
return 'Removes
|
|
22
|
+
return 'Removes a Microsoft 365 Group';
|
|
19
23
|
}
|
|
20
24
|
constructor() {
|
|
21
25
|
super();
|
|
22
26
|
_AadM365GroupRemoveCommand_instances.add(this);
|
|
27
|
+
this.intervalInMs = 5000;
|
|
23
28
|
__classPrivateFieldGet(this, _AadM365GroupRemoveCommand_instances, "m", _AadM365GroupRemoveCommand_initTelemetry).call(this);
|
|
24
29
|
__classPrivateFieldGet(this, _AadM365GroupRemoveCommand_instances, "m", _AadM365GroupRemoveCommand_initOptions).call(this);
|
|
25
30
|
__classPrivateFieldGet(this, _AadM365GroupRemoveCommand_instances, "m", _AadM365GroupRemoveCommand_initValidators).call(this);
|
|
@@ -34,21 +39,13 @@ class AadM365GroupRemoveCommand extends GraphCommand {
|
|
|
34
39
|
if (!isUnifiedGroup) {
|
|
35
40
|
throw Error(`Specified group with id '${args.options.id}' is not a Microsoft 365 group.`);
|
|
36
41
|
}
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
await request.delete(requestOptions);
|
|
42
|
+
const siteUrl = await this.getM365GroupSiteUrl(logger, args.options.id);
|
|
43
|
+
const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.debug);
|
|
44
|
+
// Delete the Microsoft 365 group site. This operation will also delete the group.
|
|
45
|
+
await this.deleteM365GroupSite(logger, siteUrl, spoAdminUrl);
|
|
44
46
|
if (args.options.skipRecycleBin) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
headers: {
|
|
48
|
-
'accept': 'application/json;odata.metadata=none'
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
await request.delete(requestOptions2);
|
|
47
|
+
await this.deleteM365GroupFromRecycleBin(logger, args.options.id);
|
|
48
|
+
await this.deleteSiteFromRecycleBin(logger, siteUrl, spoAdminUrl);
|
|
52
49
|
}
|
|
53
50
|
}
|
|
54
51
|
catch (err) {
|
|
@@ -70,6 +67,102 @@ class AadM365GroupRemoveCommand extends GraphCommand {
|
|
|
70
67
|
}
|
|
71
68
|
}
|
|
72
69
|
}
|
|
70
|
+
async getM365GroupSiteUrl(logger, id) {
|
|
71
|
+
if (this.verbose) {
|
|
72
|
+
await logger.logToStderr(`Getting the site URL of Microsoft 365 Group: ${id}...`);
|
|
73
|
+
}
|
|
74
|
+
const requestOptions = {
|
|
75
|
+
url: `${this.resource}/v1.0/groups/${id}/drive?$select=webUrl`,
|
|
76
|
+
headers: {
|
|
77
|
+
accept: 'application/json;odata.metadata=none'
|
|
78
|
+
},
|
|
79
|
+
responseType: 'json'
|
|
80
|
+
};
|
|
81
|
+
const res = await request.get(requestOptions);
|
|
82
|
+
// Extract the base URL by removing everything after the last '/' character in the URL.
|
|
83
|
+
const baseUrl = res.webUrl.substring(0, res.webUrl.lastIndexOf('/'));
|
|
84
|
+
return baseUrl;
|
|
85
|
+
}
|
|
86
|
+
async deleteM365GroupSite(logger, url, spoAdminUrl) {
|
|
87
|
+
if (this.verbose) {
|
|
88
|
+
await logger.logToStderr(`Deleting the group site: '${url}'...`);
|
|
89
|
+
}
|
|
90
|
+
const requestOptions = {
|
|
91
|
+
url: `${spoAdminUrl}/_api/GroupSiteManager/Delete?siteUrl='${url}'`,
|
|
92
|
+
headers: {
|
|
93
|
+
accept: 'application/json;odata=nometadata'
|
|
94
|
+
},
|
|
95
|
+
responseType: 'json'
|
|
96
|
+
};
|
|
97
|
+
await request.post(requestOptions);
|
|
98
|
+
}
|
|
99
|
+
async deleteM365GroupFromRecycleBin(logger, id) {
|
|
100
|
+
for (let retries = 0; retries < AadM365GroupRemoveCommand.maxRetries; retries++) {
|
|
101
|
+
if (await this.isM365GroupInDeletedItemsList(id)) {
|
|
102
|
+
await this.removeM365GroupPermanently(logger, id);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
if (this.verbose) {
|
|
107
|
+
await logger.logToStderr(`Group has not been deleted yet. Waiting for ${this.intervalInMs / 1000} seconds before the next attempt. ${AadM365GroupRemoveCommand.maxRetries - retries} attempts remaining...`);
|
|
108
|
+
}
|
|
109
|
+
await setTimeout(this.intervalInMs);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
await logger.logToStderr(`Group has been successfully deleted, but it couldn't be permanently removed from the recycle bin after all retries. It will still appear in the deleted groups list.`);
|
|
113
|
+
}
|
|
114
|
+
async removeM365GroupPermanently(logger, id) {
|
|
115
|
+
if (this.verbose) {
|
|
116
|
+
await logger.logToStderr(`Group has been deleted and is now available in the deleted groups list. Removing permanently...`);
|
|
117
|
+
}
|
|
118
|
+
const requestOptions = {
|
|
119
|
+
url: `${this.resource}/v1.0/directory/deletedItems/${id}`,
|
|
120
|
+
headers: {
|
|
121
|
+
accept: 'application/json;odata.metadata=none'
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
await request.delete(requestOptions);
|
|
125
|
+
}
|
|
126
|
+
async isM365GroupInDeletedItemsList(id) {
|
|
127
|
+
const requestOptions = {
|
|
128
|
+
url: `${this.resource}/v1.0/directory/deletedItems/${id}`,
|
|
129
|
+
headers: {
|
|
130
|
+
accept: 'application/json;odata.metadata=none'
|
|
131
|
+
},
|
|
132
|
+
responseType: 'json'
|
|
133
|
+
};
|
|
134
|
+
try {
|
|
135
|
+
const response = await request.get(requestOptions);
|
|
136
|
+
return Boolean(response && response.id);
|
|
137
|
+
}
|
|
138
|
+
catch (error) {
|
|
139
|
+
if (error.response && error.response.status === 404) {
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
throw error;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
async deleteSiteFromRecycleBin(logger, url, spoAdminUrl) {
|
|
148
|
+
if (this.verbose) {
|
|
149
|
+
await logger.logToStderr(`Deleting the M365 group site '${url}' from the recycle bin...`);
|
|
150
|
+
}
|
|
151
|
+
const res = await spo.ensureFormDigest(spoAdminUrl, logger, undefined, this.debug);
|
|
152
|
+
const requestOptions = {
|
|
153
|
+
url: `${spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
154
|
+
headers: {
|
|
155
|
+
'X-RequestDigest': res.FormDigestValue
|
|
156
|
+
},
|
|
157
|
+
data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="185" ObjectPathId="184" /><Query Id="186" ObjectPathId="184"><Query SelectAllProperties="false"><Properties><Property Name="IsComplete" ScalarProperty="true" /><Property Name="PollingInterval" ScalarProperty="true" /></Properties></Query></Query></Actions><ObjectPaths><Method Id="184" ParentId="175" Name="RemoveDeletedSite"><Parameters><Parameter Type="String">${formatting.escapeXml(url)}</Parameter></Parameters></Method><Constructor Id="175" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /></ObjectPaths></Request>`
|
|
158
|
+
};
|
|
159
|
+
const processQuery = await request.post(requestOptions);
|
|
160
|
+
const json = JSON.parse(processQuery);
|
|
161
|
+
const response = json[0];
|
|
162
|
+
if (response.ErrorInfo) {
|
|
163
|
+
throw response.ErrorInfo.ErrorMessage;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
73
166
|
}
|
|
74
167
|
_AadM365GroupRemoveCommand_instances = new WeakSet(), _AadM365GroupRemoveCommand_initTelemetry = function _AadM365GroupRemoveCommand_initTelemetry() {
|
|
75
168
|
this.telemetry.push((args) => {
|
|
@@ -94,5 +187,6 @@ _AadM365GroupRemoveCommand_instances = new WeakSet(), _AadM365GroupRemoveCommand
|
|
|
94
187
|
return true;
|
|
95
188
|
});
|
|
96
189
|
};
|
|
190
|
+
AadM365GroupRemoveCommand.maxRetries = 10;
|
|
97
191
|
export default new AadM365GroupRemoveCommand();
|
|
98
192
|
//# sourceMappingURL=m365group-remove.js.map
|
|
@@ -12,6 +12,7 @@ import { pid } from '../../utils/pid.js';
|
|
|
12
12
|
import AnonymousCommand from '../base/AnonymousCommand.js';
|
|
13
13
|
import commands from './commands.js';
|
|
14
14
|
import { interactivePreset, powerShellPreset, scriptingPreset } from './setupPresets.js';
|
|
15
|
+
import { prompt } from '../../utils/prompt.js';
|
|
15
16
|
class SetupCommand extends AnonymousCommand {
|
|
16
17
|
get name() {
|
|
17
18
|
return commands.SETUP;
|
|
@@ -48,7 +49,7 @@ class SetupCommand extends AnonymousCommand {
|
|
|
48
49
|
await logger.logToStderr(`This command will guide you through the process of configuring the CLI for your needs.`);
|
|
49
50
|
await logger.logToStderr(`Please, answer the following questions and we'll define a set of settings to best match how you intend to use the CLI.`);
|
|
50
51
|
await logger.logToStderr('');
|
|
51
|
-
const preferences = await
|
|
52
|
+
const preferences = await prompt.forInput([
|
|
52
53
|
{
|
|
53
54
|
type: 'list',
|
|
54
55
|
name: 'usageMode',
|
|
@@ -43,7 +43,7 @@ class SpoAppDeployCommand extends SpoAppBaseCommand {
|
|
|
43
43
|
await logger.logToStderr(`Looking up app id for app named ${args.options.name}...`);
|
|
44
44
|
}
|
|
45
45
|
const requestOptions = {
|
|
46
|
-
url: `${appCatalogUrl}/_api/web/
|
|
46
|
+
url: `${appCatalogUrl}/_api/web/GetFolderByServerRelativePath(DecodedUrl='AppCatalog')/files('${args.options.name}')?$select=UniqueId`,
|
|
47
47
|
headers: {
|
|
48
48
|
accept: 'application/json;odata=nometadata'
|
|
49
49
|
},
|
|
@@ -39,7 +39,7 @@ class SpoAppGetCommand extends SpoAppBaseCommand {
|
|
|
39
39
|
await logger.logToStderr(`Looking up app id for app named ${args.options.name}...`);
|
|
40
40
|
}
|
|
41
41
|
const requestOptions = {
|
|
42
|
-
url: `${appCatalogSiteUrl}/_api/web/
|
|
42
|
+
url: `${appCatalogSiteUrl}/_api/web/GetFolderByServerRelativePath(DecodedUrl='AppCatalog')/files('${args.options.name}')?$select=UniqueId`,
|
|
43
43
|
headers: {
|
|
44
44
|
accept: 'application/json;odata=nometadata'
|
|
45
45
|
},
|
|
@@ -88,7 +88,7 @@ class SpoAppTeamsPackageDownloadCommand extends SpoAppBaseCommand {
|
|
|
88
88
|
url += `GetList('${serverRelativeAppCatalogListUrl}')/GetItemById(${args.options.appItemId})?$expand=File&$select=File/Name`;
|
|
89
89
|
}
|
|
90
90
|
else if (args.options.appName) {
|
|
91
|
-
url += `
|
|
91
|
+
url += `GetFolderByServerRelativePath(DecodedUrl='${appCatalogListName}')/files('${formatting.encodeQueryParameter(args.options.appName)}')/ListItemAllFields?$select=Id`;
|
|
92
92
|
}
|
|
93
93
|
const requestOptions = {
|
|
94
94
|
url,
|
|
@@ -38,7 +38,7 @@ class SpoAppPageAddCommand extends SpoCommand {
|
|
|
38
38
|
const page = await request.post(createPageRequestOptions);
|
|
39
39
|
const pageUrl = page.value;
|
|
40
40
|
let requestOptions = {
|
|
41
|
-
url: `${args.options.webUrl}/_api/web/
|
|
41
|
+
url: `${args.options.webUrl}/_api/web/GetFileByServerRelativePath(DecodedUrl='${urlUtil.getServerRelativeSiteUrl(args.options.webUrl)}/${pageUrl}')?$expand=ListItemAllFields`,
|
|
42
42
|
headers: {
|
|
43
43
|
'content-type': 'application/json;charset=utf-8',
|
|
44
44
|
accept: 'application/json;odata=nometadata'
|
|
@@ -5,6 +5,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
5
5
|
};
|
|
6
6
|
var _SpoFeatureDisableCommand_instances, _SpoFeatureDisableCommand_initTelemetry, _SpoFeatureDisableCommand_initOptions, _SpoFeatureDisableCommand_initValidators, _SpoFeatureDisableCommand_initTypes;
|
|
7
7
|
import request from "../../../../request.js";
|
|
8
|
+
import { validation } from '../../../../utils/validation.js';
|
|
8
9
|
import SpoCommand from "../../../base/SpoCommand.js";
|
|
9
10
|
import commands from "../../commands.js";
|
|
10
11
|
class SpoFeatureDisableCommand extends SpoCommand {
|
|
@@ -24,13 +25,10 @@ class SpoFeatureDisableCommand extends SpoCommand {
|
|
|
24
25
|
}
|
|
25
26
|
async commandAction(logger, args) {
|
|
26
27
|
let scope = args.options.scope;
|
|
27
|
-
|
|
28
|
+
const force = !!args.options.force;
|
|
28
29
|
if (!scope) {
|
|
29
30
|
scope = "web";
|
|
30
31
|
}
|
|
31
|
-
if (!force) {
|
|
32
|
-
force = false;
|
|
33
|
-
}
|
|
34
32
|
if (this.verbose) {
|
|
35
33
|
await logger.logToStderr(`Disabling feature '${args.options.id}' on scope '${scope}' for url '${args.options.webUrl}' (force='${force}')...`);
|
|
36
34
|
}
|
|
@@ -39,7 +37,8 @@ class SpoFeatureDisableCommand extends SpoCommand {
|
|
|
39
37
|
url: url,
|
|
40
38
|
headers: {
|
|
41
39
|
accept: 'application/json;odata=nometadata'
|
|
42
|
-
}
|
|
40
|
+
},
|
|
41
|
+
responseType: 'json'
|
|
43
42
|
};
|
|
44
43
|
try {
|
|
45
44
|
await request.post(requestOptions);
|
|
@@ -69,9 +68,12 @@ _SpoFeatureDisableCommand_instances = new WeakSet(), _SpoFeatureDisableCommand_i
|
|
|
69
68
|
});
|
|
70
69
|
}, _SpoFeatureDisableCommand_initValidators = function _SpoFeatureDisableCommand_initValidators() {
|
|
71
70
|
this.validators.push(async (args) => {
|
|
71
|
+
if (!validation.isValidGuid(args.options.id)) {
|
|
72
|
+
return `${args.options.id} is not a valid GUID for option id.`;
|
|
73
|
+
}
|
|
72
74
|
if (args.options.scope) {
|
|
73
75
|
if (['site', 'web'].indexOf(args.options.scope.toLowerCase()) < 0) {
|
|
74
|
-
return `${args.options.scope} is not a valid Feature scope. Allowed values are Site
|
|
76
|
+
return `${args.options.scope} is not a valid Feature scope. Allowed values are: Site, Web.`;
|
|
75
77
|
}
|
|
76
78
|
}
|
|
77
79
|
return true;
|
|
@@ -25,13 +25,10 @@ class SpoFeatureEnableCommand extends SpoCommand {
|
|
|
25
25
|
}
|
|
26
26
|
async commandAction(logger, args) {
|
|
27
27
|
let scope = args.options.scope;
|
|
28
|
-
|
|
28
|
+
const force = !!args.options.force;
|
|
29
29
|
if (!scope) {
|
|
30
30
|
scope = "web";
|
|
31
31
|
}
|
|
32
|
-
if (!force) {
|
|
33
|
-
force = false;
|
|
34
|
-
}
|
|
35
32
|
if (this.verbose) {
|
|
36
33
|
await logger.logToStderr(`Enabling feature '${args.options.id}' on scope '${scope}' for url '${args.options.webUrl}' (force='${force}')...`);
|
|
37
34
|
}
|
|
@@ -40,7 +37,8 @@ class SpoFeatureEnableCommand extends SpoCommand {
|
|
|
40
37
|
url: url,
|
|
41
38
|
headers: {
|
|
42
39
|
accept: 'application/json;odata=nometadata'
|
|
43
|
-
}
|
|
40
|
+
},
|
|
41
|
+
responseType: 'json'
|
|
44
42
|
};
|
|
45
43
|
try {
|
|
46
44
|
await request.post(requestOptions);
|
|
@@ -70,6 +68,9 @@ _SpoFeatureEnableCommand_instances = new WeakSet(), _SpoFeatureEnableCommand_ini
|
|
|
70
68
|
});
|
|
71
69
|
}, _SpoFeatureEnableCommand_initValidators = function _SpoFeatureEnableCommand_initValidators() {
|
|
72
70
|
this.validators.push(async (args) => {
|
|
71
|
+
if (!validation.isValidGuid(args.options.id)) {
|
|
72
|
+
return `${args.options.id} is not a valid GUID for option id.`;
|
|
73
|
+
}
|
|
73
74
|
if (args.options.scope) {
|
|
74
75
|
if (['site', 'web'].indexOf(args.options.scope.toLowerCase()) < 0) {
|
|
75
76
|
return `${args.options.scope} is not a valid Feature scope. Allowed values are Site|Web`;
|
|
@@ -12,7 +12,7 @@ export class Page {
|
|
|
12
12
|
}
|
|
13
13
|
const pageName = this.getPageNameWithExtension(name);
|
|
14
14
|
const requestOptions = {
|
|
15
|
-
url: `${webUrl}/_api/web/
|
|
15
|
+
url: `${webUrl}/_api/web/GetFileByServerRelativePath(DecodedUrl='${urlUtil.getServerRelativeSiteUrl(webUrl)}/SitePages/${formatting.encodeQueryParameter(pageName)}')?$expand=ListItemAllFields/ClientSideApplicationId`,
|
|
16
16
|
headers: {
|
|
17
17
|
'content-type': 'application/json;charset=utf-8',
|
|
18
18
|
accept: 'application/json;odata=nometadata'
|
|
@@ -52,7 +52,7 @@ class SpoPageAddCommand extends SpoCommand {
|
|
|
52
52
|
const reqDigest = await spo.getRequestDigest(args.options.webUrl);
|
|
53
53
|
requestDigest = reqDigest.FormDigestValue;
|
|
54
54
|
let requestOptions = {
|
|
55
|
-
url: `${args.options.webUrl}/_api/web/
|
|
55
|
+
url: `${args.options.webUrl}/_api/web/GetFolderByServerRelativePath(DecodedUrl='${serverRelativeSiteUrl}/sitepages')/files/AddTemplateFile`,
|
|
56
56
|
headers: {
|
|
57
57
|
'X-RequestDigest': requestDigest,
|
|
58
58
|
'content-type': 'application/json;odata=nometadata',
|
|
@@ -36,7 +36,7 @@ class SpoPageGetCommand extends SpoCommand {
|
|
|
36
36
|
}
|
|
37
37
|
try {
|
|
38
38
|
let requestOptions = {
|
|
39
|
-
url: `${args.options.webUrl}/_api/web/
|
|
39
|
+
url: `${args.options.webUrl}/_api/web/GetFileByServerRelativePath(DecodedUrl='${urlUtil.getServerRelativeSiteUrl(args.options.webUrl)}/SitePages/${formatting.encodeQueryParameter(pageName)}')?$expand=ListItemAllFields/ClientSideApplicationId,ListItemAllFields/PageLayoutType,ListItemAllFields/CommentsDisabled`,
|
|
40
40
|
headers: {
|
|
41
41
|
'content-type': 'application/json;charset=utf-8',
|
|
42
42
|
accept: 'application/json;odata=nometadata'
|
|
@@ -300,7 +300,7 @@ class SpoPageHeaderSetCommand extends SpoCommand {
|
|
|
300
300
|
await logger.logToStderr(`Retrieving information about the header image...`);
|
|
301
301
|
}
|
|
302
302
|
const requestOptions = {
|
|
303
|
-
url: `${siteUrl}/_api/web/
|
|
303
|
+
url: `${siteUrl}/_api/web/GetFileByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(imageUrl)}')?$select=ListId,UniqueId`,
|
|
304
304
|
headers: {
|
|
305
305
|
accept: 'application/json;odata=nometadata'
|
|
306
306
|
},
|
|
@@ -54,7 +54,7 @@ class SpoPageRemoveCommand extends SpoCommand {
|
|
|
54
54
|
}
|
|
55
55
|
const requestOptions = {
|
|
56
56
|
url: `${args.options
|
|
57
|
-
.webUrl}/_api/web/
|
|
57
|
+
.webUrl}/_api/web/GetFileByServerRelativePath(DecodedUrl='${urlUtil.getServerRelativeSiteUrl(args.options.webUrl)}/sitepages/${pageName}')`,
|
|
58
58
|
headers: {
|
|
59
59
|
'X-RequestDigest': requestDigest,
|
|
60
60
|
'X-HTTP-Method': 'DELETE',
|
|
@@ -199,7 +199,7 @@ class SpoPageSetCommand extends SpoCommand {
|
|
|
199
199
|
}
|
|
200
200
|
if (typeof args.options.commentsEnabled !== 'undefined') {
|
|
201
201
|
const requestOptions = {
|
|
202
|
-
url: `${args.options.webUrl}/_api/web/
|
|
202
|
+
url: `${args.options.webUrl}/_api/web/GetFileByServerRelativePath(DecodedUrl='${serverRelativeFileUrl}')/ListItemAllFields/SetCommentsDisabled(${args.options.commentsEnabled === false})`,
|
|
203
203
|
headers: {
|
|
204
204
|
'X-RequestDigest': requestDigest,
|
|
205
205
|
'content-type': 'application/json;odata=nometadata',
|
|
@@ -239,7 +239,7 @@ class SpoPageSetCommand extends SpoCommand {
|
|
|
239
239
|
}
|
|
240
240
|
else {
|
|
241
241
|
requestOptions = {
|
|
242
|
-
url: `${args.options.webUrl}/_api/web/
|
|
242
|
+
url: `${args.options.webUrl}/_api/web/GetFileByServerRelativePath(DecodedUrl='${serverRelativeFileUrl}')/CheckIn(comment=@a1,checkintype=@a2)?@a1='${formatting.encodeQueryParameter(args.options.publishMessage || '')}'&@a2=1`,
|
|
243
243
|
headers: {
|
|
244
244
|
'X-RequestDigest': requestDigest,
|
|
245
245
|
'content-type': 'application/json;odata=nometadata',
|
|
@@ -79,7 +79,7 @@ class SpoPageTextAddCommand extends SpoCommand {
|
|
|
79
79
|
}
|
|
80
80
|
const requestOptions = {
|
|
81
81
|
url: `${args.options
|
|
82
|
-
.webUrl}/_api/web/
|
|
82
|
+
.webUrl}/_api/web/GetFileByServerRelativePath(DecodedUrl='${urlUtil.getServerRelativeSiteUrl(args.options.webUrl)}/sitepages/${pageName}')/ListItemAllFields`,
|
|
83
83
|
headers: {
|
|
84
84
|
'X-RequestDigest': requestDigest,
|
|
85
85
|
'content-type': 'application/json;odata=nometadata',
|