@pnp/cli-microsoft365 6.3.0-beta.fee5cdb → 6.4.0-beta.006c079
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 +5 -2
- package/.eslintrc.js +4 -0
- package/Dockerfile +6 -3
- package/README.md +12 -1
- package/dist/Command.js +1 -0
- package/dist/appInsights.js +2 -1
- package/dist/cli/Cli.js +70 -2
- package/dist/m365/aad/commands/license/license-list.js +41 -0
- package/dist/m365/aad/commands/user/user-add.js +223 -0
- package/dist/m365/aad/commands/user/user-get.js +3 -0
- package/dist/m365/aad/commands/user/user-license-add.js +88 -0
- package/dist/m365/aad/commands/user/user-license-list.js +99 -0
- package/dist/m365/aad/commands/user/user-license-remove.js +115 -0
- package/dist/m365/aad/commands/user/user-recyclebinitem-clear.js +1 -1
- package/dist/m365/aad/commands/user/user-recyclebinitem-list.js +41 -0
- package/dist/m365/aad/commands/user/user-recyclebinitem-remove.js +92 -0
- package/dist/m365/aad/commands/user/user-recyclebinitem-restore.js +70 -0
- package/dist/m365/aad/commands/user/user-remove.js +107 -0
- package/dist/m365/aad/commands/user/user-set.js +3 -0
- package/dist/m365/aad/commands/user/user-signin-list.js +3 -0
- package/dist/m365/aad/commands.js +9 -0
- package/dist/m365/file/commands/file-list.js +5 -1
- package/dist/m365/flow/commands/environment/FlowEnvironmentDetails.js +3 -0
- package/dist/m365/flow/commands/environment/environment-get.js +26 -11
- package/dist/m365/flow/commands/flow-disable.js +9 -2
- package/dist/m365/flow/commands/flow-enable.js +9 -2
- package/dist/m365/flow/commands/flow-get.js +9 -2
- package/dist/m365/flow/commands/flow-list.js +1 -1
- package/dist/m365/flow/commands/flow-remove.js +2 -2
- package/dist/m365/flow/commands/owner/owner-ensure.js +147 -0
- package/dist/m365/flow/commands/owner/owner-list.js +89 -0
- package/dist/m365/flow/commands/owner/owner-remove.js +147 -0
- package/dist/m365/flow/commands/run/run-cancel.js +9 -2
- package/dist/m365/flow/commands/run/run-list.js +5 -2
- package/dist/m365/flow/commands.js +3 -0
- package/dist/m365/planner/commands/roster/roster-member-add.js +3 -0
- package/dist/m365/planner/commands/roster/roster-member-get.js +98 -0
- package/dist/m365/planner/commands.js +1 -0
- package/dist/m365/pp/commands/environment/environment-get.js +18 -9
- package/dist/m365/purview/commands/retentionevent/retentionevent-add.js +138 -0
- package/dist/m365/purview/commands/retentionlabel/retentionlabel-add.js +48 -14
- package/dist/m365/purview/commands.js +1 -0
- package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.17.0-beta.1.js +59 -0
- package/dist/m365/spfx/commands/project/project-upgrade.js +16 -13
- package/dist/m365/spfx/commands/spfx-doctor.js +43 -29
- package/dist/m365/spo/commands/commandset/commandset-add.js +138 -0
- package/dist/m365/spo/commands/commandset/commandset-get.js +128 -0
- package/dist/m365/spo/commands/commandset/commandset-list.js +77 -0
- package/dist/m365/spo/commands/commandset/commandset-remove.js +146 -0
- package/dist/m365/spo/commands/commandset/commandset-set.js +182 -0
- package/dist/m365/spo/commands/customaction/customaction-get.js +27 -7
- package/dist/m365/spo/commands/file/file-move.js +1 -3
- package/dist/m365/spo/commands/folder/folder-copy.js +0 -2
- package/dist/m365/spo/commands/folder/folder-move.js +0 -2
- package/dist/m365/spo/commands/group/group-member-add.js +54 -95
- package/dist/m365/spo/commands/list/list-add.js +11 -8
- package/dist/m365/spo/commands/list/list-set.js +3 -3
- package/dist/m365/spo/commands/navigation/navigation-node-add.js +5 -4
- package/dist/m365/spo/commands/navigation/navigation-node-set.js +5 -1
- package/dist/m365/spo/commands/site/site-add.js +0 -3
- package/dist/m365/spo/commands/site/site-remove.js +0 -3
- package/dist/m365/spo/commands/site/site-set.js +0 -2
- package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-get.js +118 -0
- package/dist/m365/spo/commands/tenant/tenant-recyclebinitem-remove.js +0 -1
- package/dist/m365/spo/commands/term/term-get.js +68 -48
- package/dist/m365/spo/commands/user/user-ensure.js +105 -0
- package/dist/m365/spo/commands.js +7 -0
- package/dist/m365/teams/commands/team/team-add.js +3 -8
- package/dist/m365/todo/commands/task/task-add.js +35 -3
- package/dist/utils/aadGroup.js +18 -0
- package/dist/utils/aadUser.js +37 -0
- package/dist/utils/md.js +7 -0
- package/dist/utils/session.js +18 -0
- package/dist/utils/spo.js +35 -12
- package/docs/docs/cmd/aad/app/app-add.md +3 -3
- package/docs/docs/cmd/aad/approleassignment/approleassignment-add.md +5 -5
- package/docs/docs/cmd/aad/approleassignment/approleassignment-remove.md +3 -3
- package/docs/docs/cmd/aad/license/license-list.md +87 -0
- package/docs/docs/cmd/aad/user/user-add.md +168 -0
- package/docs/docs/cmd/aad/user/user-license-add.md +108 -0
- package/docs/docs/cmd/aad/user/user-license-list.md +98 -0
- package/docs/docs/cmd/aad/user/user-license-remove.md +43 -0
- package/docs/docs/cmd/aad/user/user-recyclebinitem-clear.md +1 -1
- package/docs/docs/cmd/aad/user/user-recyclebinitem-list.md +82 -0
- package/docs/docs/cmd/aad/user/user-recyclebinitem-remove.md +45 -0
- package/docs/docs/cmd/aad/user/user-recyclebinitem-restore.md +99 -0
- package/docs/docs/cmd/aad/user/user-remove.md +51 -0
- package/docs/docs/cmd/aad/user/user-set.md +1 -1
- package/docs/docs/cmd/cli/completion/completion-clink-update.md +4 -4
- package/docs/docs/cmd/flow/environment/environment-get.md +31 -3
- package/docs/docs/cmd/flow/owner/owner-ensure.md +61 -0
- package/docs/docs/cmd/flow/owner/owner-list.md +90 -0
- package/docs/docs/cmd/flow/owner/owner-remove.md +67 -0
- package/docs/docs/cmd/flow/run/run-list.md +28 -0
- package/docs/docs/cmd/onenote/page/page-list.md +1 -1
- package/docs/docs/cmd/outlook/mail/mail-send.md +7 -3
- package/docs/docs/cmd/outlook/message/message-get.md +143 -0
- package/docs/docs/cmd/outlook/message/message-list.md +119 -0
- package/docs/docs/cmd/outlook/message/message-move.md +4 -0
- package/docs/docs/cmd/outlook/report/report-mailactivitycounts.md +40 -0
- package/docs/docs/cmd/outlook/report/report-mailactivityusercounts.md +40 -0
- package/docs/docs/cmd/outlook/report/report-mailactivityuserdetail.md +45 -0
- package/docs/docs/cmd/outlook/report/report-mailappusageappsusercounts.md +43 -0
- package/docs/docs/cmd/outlook/report/report-mailappusageusercounts.md +44 -0
- package/docs/docs/cmd/outlook/report/report-mailappusageuserdetail.md +48 -0
- package/docs/docs/cmd/outlook/report/report-mailappusageversionsusercounts.md +41 -0
- package/docs/docs/cmd/outlook/report/report-mailboxusagedetail.md +49 -0
- package/docs/docs/cmd/outlook/report/report-mailboxusagemailboxcount.md +37 -0
- package/docs/docs/cmd/outlook/report/report-mailboxusagequotastatusmailboxcounts.md +40 -0
- package/docs/docs/cmd/outlook/report/report-mailboxusagestorage.md +36 -0
- package/docs/docs/cmd/outlook/room/room-list.md +81 -0
- package/docs/docs/cmd/outlook/roomlist/roomlist-list.md +58 -0
- package/docs/docs/cmd/planner/plan/plan-add.md +3 -3
- package/docs/docs/cmd/planner/plan/plan-set.md +73 -7
- package/docs/docs/cmd/planner/roster/roster-add.md +16 -1
- package/docs/docs/cmd/planner/roster/roster-member-get.md +87 -0
- package/docs/docs/cmd/planner/task/task-add.md +230 -0
- package/docs/docs/cmd/planner/task/task-checklistitem-add.md +55 -0
- package/docs/docs/cmd/planner/task/task-checklistitem-list.md +55 -0
- package/docs/docs/cmd/planner/task/task-checklistitem-remove.md +4 -0
- package/docs/docs/cmd/planner/task/task-get.md +131 -0
- package/docs/docs/cmd/planner/task/task-list.md +92 -0
- package/docs/docs/cmd/planner/task/task-reference-add.md +46 -0
- package/docs/docs/cmd/planner/task/task-reference-list.md +46 -0
- package/docs/docs/cmd/planner/task/task-reference-remove.md +4 -0
- package/docs/docs/cmd/planner/task/task-remove.md +4 -0
- package/docs/docs/cmd/planner/task/task-set.md +230 -0
- package/docs/docs/cmd/planner/tenant/tenant-settings-list.md +55 -0
- package/docs/docs/cmd/planner/tenant/tenant-settings-set.md +55 -0
- package/docs/docs/cmd/pp/card/card-get.md +2 -2
- package/docs/docs/cmd/pp/card/card-list.md +2 -2
- package/docs/docs/cmd/purview/retentionevent/retentionevent-add.md +149 -0
- package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-add.md +7 -7
- package/docs/docs/cmd/purview/retentionlabel/retentionlabel-add.md +12 -0
- package/docs/docs/cmd/skype/report/report-activitycounts.md +38 -0
- package/docs/docs/cmd/skype/report/report-activityusercounts.md +38 -0
- package/docs/docs/cmd/skype/report/report-activityuserdetail.md +67 -0
- package/docs/docs/cmd/spfx/project/project-doctor.md +3 -3
- package/docs/docs/cmd/spfx/project/project-externalize.md +3 -3
- package/docs/docs/cmd/spfx/project/project-permissions-grant.md +21 -0
- package/docs/docs/cmd/spfx/project/project-upgrade.md +3 -3
- package/docs/docs/cmd/spfx/spfx-doctor.md +3 -3
- package/docs/docs/cmd/spo/cdn/cdn-get.md +6 -6
- package/docs/docs/cmd/spo/cdn/cdn-origin-add.md +3 -3
- package/docs/docs/cmd/spo/cdn/cdn-origin-list.md +3 -3
- package/docs/docs/cmd/spo/cdn/cdn-origin-remove.md +3 -3
- package/docs/docs/cmd/spo/cdn/cdn-policy-list.md +3 -3
- package/docs/docs/cmd/spo/cdn/cdn-policy-set.md +3 -3
- package/docs/docs/cmd/spo/cdn/cdn-set.md +3 -3
- package/docs/docs/cmd/spo/commandset/commandset-add.md +159 -0
- package/docs/docs/cmd/spo/commandset/commandset-get.md +149 -0
- package/docs/docs/cmd/spo/commandset/commandset-list.md +109 -0
- package/docs/docs/cmd/spo/commandset/commandset-remove.md +55 -0
- package/docs/docs/cmd/spo/commandset/commandset-set.md +71 -0
- package/docs/docs/cmd/spo/customaction/customaction-get.md +113 -11
- package/docs/docs/cmd/spo/externaluser/externaluser-list.md +2 -0
- package/docs/docs/cmd/spo/group/group-member-add.md +26 -4
- package/docs/docs/cmd/spo/hidedefaultthemes/hidedefaultthemes-get.md +2 -0
- package/docs/docs/cmd/spo/hidedefaultthemes/hidedefaultthemes-set.md +2 -0
- package/docs/docs/cmd/spo/homesite/homesite-get.md +20 -1
- package/docs/docs/cmd/spo/homesite/homesite-remove.md +10 -2
- package/docs/docs/cmd/spo/homesite/homesite-set.md +10 -2
- package/docs/docs/cmd/spo/hubsite/hubsite-connect.md +9 -9
- package/docs/docs/cmd/spo/hubsite/hubsite-data-get.md +34 -5
- package/docs/docs/cmd/spo/hubsite/hubsite-disconnect.md +6 -6
- package/docs/docs/cmd/spo/hubsite/hubsite-get.md +36 -19
- package/docs/docs/cmd/spo/hubsite/hubsite-list.md +59 -1
- package/docs/docs/cmd/spo/hubsite/hubsite-register.md +30 -1
- package/docs/docs/cmd/spo/hubsite/hubsite-rights-grant.md +6 -6
- package/docs/docs/cmd/spo/hubsite/hubsite-rights-revoke.md +4 -4
- package/docs/docs/cmd/spo/hubsite/hubsite-set.md +40 -15
- package/docs/docs/cmd/spo/hubsite/hubsite-unregister.md +4 -4
- package/docs/docs/cmd/spo/knowledgehub/knowledgehub-get.md +9 -1
- package/docs/docs/cmd/spo/knowledgehub/knowledgehub-remove.md +11 -3
- package/docs/docs/cmd/spo/knowledgehub/knowledgehub-set.md +11 -5
- package/docs/docs/cmd/spo/list/list-add.md +124 -58
- package/docs/docs/cmd/spo/list/list-contenttype-add.md +50 -5
- package/docs/docs/cmd/spo/list/list-contenttype-default-set.md +4 -4
- package/docs/docs/cmd/spo/list/list-contenttype-list.md +49 -4
- package/docs/docs/cmd/spo/list/list-contenttype-remove.md +6 -6
- package/docs/docs/cmd/spo/list/list-get.md +70 -4
- package/docs/docs/cmd/spo/list/list-list.md +70 -2
- package/docs/docs/cmd/spo/list/list-remove.md +6 -6
- package/docs/docs/cmd/spo/list/list-retentionlabel-ensure.md +2 -2
- package/docs/docs/cmd/spo/list/list-retentionlabel-get.md +36 -3
- package/docs/docs/cmd/spo/list/list-retentionlabel-remove.md +3 -3
- package/docs/docs/cmd/spo/list/list-roleassignment-add.md +6 -6
- package/docs/docs/cmd/spo/list/list-roleassignment-remove.md +3 -3
- package/docs/docs/cmd/spo/list/list-roleinheritance-break.md +9 -9
- package/docs/docs/cmd/spo/list/list-roleinheritance-reset.md +7 -7
- package/docs/docs/cmd/spo/list/list-set.md +61 -61
- package/docs/docs/cmd/spo/list/list-sitescript-get.md +35 -3
- package/docs/docs/cmd/spo/list/list-view-add.md +66 -5
- package/docs/docs/cmd/spo/list/list-view-field-add.md +10 -10
- package/docs/docs/cmd/spo/list/list-view-get.md +61 -0
- package/docs/docs/cmd/spo/list/list-view-list.md +61 -0
- package/docs/docs/cmd/spo/list/list-view-set.md +1 -1
- package/docs/docs/cmd/spo/list/list-webhook-add.md +19 -0
- package/docs/docs/cmd/spo/list/list-webhook-get.md +19 -0
- package/docs/docs/cmd/spo/list/list-webhook-list.md +19 -0
- package/docs/docs/cmd/spo/listitem/listitem-add.md +30 -1
- package/docs/docs/cmd/spo/listitem/listitem-attachment-list.md +17 -2
- package/docs/docs/cmd/spo/listitem/listitem-batch-add.md +1 -1
- package/docs/docs/cmd/spo/listitem/listitem-get.md +57 -0
- package/docs/docs/cmd/spo/listitem/listitem-isrecord.md +6 -0
- package/docs/docs/cmd/spo/listitem/listitem-list.md +28 -0
- package/docs/docs/cmd/spo/listitem/listitem-record-declare.md +15 -0
- package/docs/docs/cmd/spo/listitem/listitem-set.md +31 -1
- package/docs/docs/cmd/spo/navigation/navigation-node-add.md +25 -3
- package/docs/docs/cmd/spo/navigation/navigation-node-set.md +2 -2
- package/docs/docs/cmd/spo/orgassetslibrary/orgassetslibrary-add.md +2 -0
- package/docs/docs/cmd/spo/orgassetslibrary/orgassetslibrary-list.md +2 -0
- package/docs/docs/cmd/spo/orgassetslibrary/orgassetslibrary-remove.md +2 -0
- package/docs/docs/cmd/spo/orgnewssite/orgnewssite-list.md +2 -0
- package/docs/docs/cmd/spo/orgnewssite/orgnewssite-remove.md +2 -0
- package/docs/docs/cmd/spo/orgnewssite/orgnewssite-set.md +3 -3
- package/docs/docs/cmd/spo/site/site-appcatalog-add.md +2 -0
- package/docs/docs/cmd/spo/site/site-appcatalog-remove.md +3 -3
- package/docs/docs/cmd/spo/site/site-commsite-enable.md +2 -0
- package/docs/docs/cmd/spo/site/site-list.md +3 -3
- package/docs/docs/cmd/spo/site/site-remove.md +3 -3
- package/docs/docs/cmd/spo/site/site-rename.md +3 -3
- package/docs/docs/cmd/spo/site/site-set.md +5 -5
- package/docs/docs/cmd/spo/storageentity/storageentity-remove.md +3 -3
- package/docs/docs/cmd/spo/storageentity/storageentity-set.md +3 -3
- package/docs/docs/cmd/spo/tenant/tenant-appcatalog-add.md +3 -3
- package/docs/docs/cmd/spo/tenant/tenant-appcatalogurl-get.md +2 -0
- package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-add.md +3 -3
- package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-get.md +142 -0
- package/docs/docs/cmd/spo/tenant/tenant-recyclebinitem-list.md +2 -0
- package/docs/docs/cmd/spo/tenant/tenant-recyclebinitem-remove.md +3 -3
- package/docs/docs/cmd/spo/tenant/tenant-recyclebinitem-restore.md +3 -3
- package/docs/docs/cmd/spo/tenant/tenant-settings-list.md +2 -0
- package/docs/docs/cmd/spo/tenant/tenant-settings-set.md +28 -26
- package/docs/docs/cmd/spo/term/term-add.md +3 -3
- package/docs/docs/cmd/spo/term/term-get.md +3 -3
- package/docs/docs/cmd/spo/term/term-group-add.md +2 -0
- package/docs/docs/cmd/spo/term/term-group-get.md +2 -0
- package/docs/docs/cmd/spo/term/term-group-list.md +2 -0
- package/docs/docs/cmd/spo/term/term-list.md +3 -1
- package/docs/docs/cmd/spo/term/term-set-add.md +3 -3
- package/docs/docs/cmd/spo/term/term-set-get.md +2 -0
- package/docs/docs/cmd/spo/term/term-set-list.md +2 -0
- package/docs/docs/cmd/spo/theme/theme-apply.md +3 -3
- package/docs/docs/cmd/spo/theme/theme-get.md +2 -0
- package/docs/docs/cmd/spo/theme/theme-list.md +2 -0
- package/docs/docs/cmd/spo/theme/theme-remove.md +2 -0
- package/docs/docs/cmd/spo/theme/theme-set.md +3 -3
- package/docs/docs/cmd/spo/user/user-ensure.md +109 -0
- package/docs/docs/cmd/teams/channel/channel-get.md +1 -1
- package/docs/docs/cmd/teams/channel/channel-member-add.md +2 -2
- package/docs/docs/cmd/teams/message/message-get.md +39 -4
- package/docs/docs/cmd/teams/message/message-list.md +41 -6
- package/docs/docs/cmd/teams/message/message-reply-list.md +39 -4
- package/docs/docs/cmd/teams/messagingsettings/messagingsettings-list.md +20 -2
- package/docs/docs/cmd/teams/messagingsettings/messagingsettings-set.md +8 -8
- package/docs/docs/cmd/teams/report/report-deviceusagedistributionusercounts.md +12 -5
- package/docs/docs/cmd/teams/report/report-deviceusageusercounts.md +13 -6
- package/docs/docs/cmd/teams/report/report-deviceusageuserdetail.md +14 -7
- package/docs/docs/cmd/teams/report/report-directroutingcalls.md +13 -6
- package/docs/docs/cmd/teams/report/report-pstncalls.md +13 -6
- package/docs/docs/cmd/teams/report/report-useractivitycounts.md +13 -6
- package/docs/docs/cmd/teams/report/report-useractivityusercounts.md +13 -6
- package/docs/docs/cmd/teams/report/report-useractivityuserdetail.md +13 -6
- package/docs/docs/cmd/teams/tab/tab-add.md +16 -0
- package/docs/docs/cmd/teams/tab/tab-get.md +17 -0
- package/docs/docs/cmd/teams/tab/tab-list.md +19 -0
- package/docs/docs/cmd/teams/team/team-add.md +77 -8
- package/docs/docs/cmd/teams/team/team-app-list.md +18 -2
- package/docs/docs/cmd/teams/team/team-archive.md +2 -2
- package/docs/docs/cmd/teams/team/team-clone.md +8 -8
- package/docs/docs/cmd/teams/team/team-get.md +34 -4
- package/docs/docs/cmd/teams/team/team-list.md +34 -3
- package/docs/docs/cmd/teams/team/team-remove.md +3 -3
- package/docs/docs/cmd/teams/team/team-set.md +8 -8
- package/docs/docs/cmd/teams/team/team-unarchive.md +3 -2
- package/docs/docs/cmd/teams/user/user-app-add.md +3 -3
- package/docs/docs/cmd/teams/user/user-app-list.md +18 -2
- package/docs/docs/cmd/teams/user/user-app-remove.md +4 -4
- package/docs/docs/cmd/teams/user/user-list.md +21 -4
- package/docs/docs/cmd/todo/task/task-add.md +47 -2
- package/npm-shrinkwrap.json +280 -194
- package/package.json +15 -13
|
@@ -18,8 +18,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
18
18
|
const chalk = require("chalk");
|
|
19
19
|
const child_process = require("child_process");
|
|
20
20
|
const semver_1 = require("semver");
|
|
21
|
-
const AnonymousCommand_1 = require("../../base/AnonymousCommand");
|
|
22
21
|
const commands_1 = require("../commands");
|
|
22
|
+
const base_project_command_1 = require("./project/base-project-command");
|
|
23
23
|
/**
|
|
24
24
|
* Has the particular check passed or failed
|
|
25
25
|
*/
|
|
@@ -64,7 +64,7 @@ var SharePointVersion;
|
|
|
64
64
|
SharePointVersion[SharePointVersion["SPO"] = 4] = "SPO";
|
|
65
65
|
SharePointVersion[SharePointVersion["All"] = 7] = "All";
|
|
66
66
|
})(SharePointVersion || (SharePointVersion = {}));
|
|
67
|
-
class SpfxDoctorCommand extends
|
|
67
|
+
class SpfxDoctorCommand extends base_project_command_1.BaseProjectCommand {
|
|
68
68
|
get allowedOutputs() {
|
|
69
69
|
return ['text'];
|
|
70
70
|
}
|
|
@@ -479,6 +479,7 @@ class SpfxDoctorCommand extends AnonymousCommand_1.default {
|
|
|
479
479
|
if (!args.options.output) {
|
|
480
480
|
args.options.output = 'text';
|
|
481
481
|
}
|
|
482
|
+
this.projectRootPath = this.getProjectRoot(process.cwd());
|
|
482
483
|
logger.log(' ');
|
|
483
484
|
logger.log('CLI for Microsoft 365 SharePoint Framework doctor');
|
|
484
485
|
logger.log('Verifying configuration of your system for working with the SharePoint Framework');
|
|
@@ -557,9 +558,11 @@ class SpfxDoctorCommand extends AnonymousCommand_1.default {
|
|
|
557
558
|
});
|
|
558
559
|
}
|
|
559
560
|
checkSharePointFrameworkVersion(spfxVersionRequested, fixes, logger) {
|
|
560
|
-
return this
|
|
561
|
-
|
|
562
|
-
|
|
561
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
562
|
+
let spfxVersionDetected = this.getSPFxVersionFromYoRcFile(logger);
|
|
563
|
+
if (!spfxVersionDetected) {
|
|
564
|
+
spfxVersionDetected = yield this.getPackageVersion('@microsoft/generator-sharepoint', PackageSearchMode.GlobalOnly, HandlePromise.Continue, logger);
|
|
565
|
+
}
|
|
563
566
|
const versionCheck = {
|
|
564
567
|
range: spfxVersionRequested,
|
|
565
568
|
fix: `npm i -g @microsoft/generator-sharepoint@${spfxVersionRequested}`
|
|
@@ -625,39 +628,50 @@ class SpfxDoctorCommand extends AnonymousCommand_1.default {
|
|
|
625
628
|
spVersionStringToEnum(sp) {
|
|
626
629
|
return SharePointVersion[sp.toUpperCase()];
|
|
627
630
|
}
|
|
631
|
+
getSPFxVersionFromYoRcFile(logger) {
|
|
632
|
+
if (this.projectRootPath !== null) {
|
|
633
|
+
const spfxVersion = this.getProjectVersion();
|
|
634
|
+
if (spfxVersion) {
|
|
635
|
+
if (this.debug) {
|
|
636
|
+
logger.logToStderr(`SPFx version retrieved from .yo-rc.json file. Retrieved version: ${spfxVersion}`);
|
|
637
|
+
}
|
|
638
|
+
return spfxVersion;
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
return undefined;
|
|
642
|
+
}
|
|
628
643
|
getSharePointFrameworkVersion(logger) {
|
|
629
|
-
return
|
|
630
|
-
|
|
631
|
-
|
|
644
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
645
|
+
let spfxVersion = this.getSPFxVersionFromYoRcFile(logger);
|
|
646
|
+
if (spfxVersion) {
|
|
647
|
+
return spfxVersion;
|
|
632
648
|
}
|
|
633
|
-
|
|
634
|
-
.getPackageVersion('@microsoft/sp-core-library', PackageSearchMode.LocalOnly, HandlePromise.Fail, logger)
|
|
635
|
-
.then((version) => {
|
|
649
|
+
try {
|
|
650
|
+
spfxVersion = yield this.getPackageVersion('@microsoft/sp-core-library', PackageSearchMode.LocalOnly, HandlePromise.Fail, logger);
|
|
636
651
|
if (this.debug) {
|
|
637
|
-
logger.logToStderr(`Found @microsoft/sp-core-library@${
|
|
652
|
+
logger.logToStderr(`Found @microsoft/sp-core-library@${spfxVersion}`);
|
|
638
653
|
}
|
|
639
|
-
return
|
|
640
|
-
}
|
|
641
|
-
|
|
654
|
+
return spfxVersion;
|
|
655
|
+
}
|
|
656
|
+
catch (_a) {
|
|
642
657
|
if (this.debug) {
|
|
643
658
|
logger.logToStderr(`@microsoft/sp-core-library not found. Search for @microsoft/generator-sharepoint local or global...`);
|
|
644
659
|
}
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
.then((version) => {
|
|
648
|
-
resolve(version);
|
|
649
|
-
})
|
|
650
|
-
.catch((error) => {
|
|
651
|
-
if (this.debug) {
|
|
652
|
-
logger.logToStderr('@microsoft/generator-sharepoint not found');
|
|
653
|
-
}
|
|
654
|
-
if (error && error.indexOf('ENOENT') > -1) {
|
|
655
|
-
reject('npm not found');
|
|
660
|
+
try {
|
|
661
|
+
return yield this.getPackageVersion('@microsoft/generator-sharepoint', PackageSearchMode.LocalAndGlobal, HandlePromise.Fail, logger);
|
|
656
662
|
}
|
|
657
|
-
|
|
658
|
-
|
|
663
|
+
catch (error) {
|
|
664
|
+
if (this.debug) {
|
|
665
|
+
logger.logToStderr('@microsoft/generator-sharepoint not found');
|
|
666
|
+
}
|
|
667
|
+
if (error && error.indexOf('ENOENT') > -1) {
|
|
668
|
+
throw 'npm not found';
|
|
669
|
+
}
|
|
670
|
+
else {
|
|
671
|
+
return '';
|
|
672
|
+
}
|
|
659
673
|
}
|
|
660
|
-
}
|
|
674
|
+
}
|
|
661
675
|
});
|
|
662
676
|
}
|
|
663
677
|
getPackageVersion(packageName, searchMode, handlePromise, logger) {
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
12
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
13
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
14
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
15
|
+
};
|
|
16
|
+
var _SpoCommandSetAddCommand_instances, _SpoCommandSetAddCommand_initTelemetry, _SpoCommandSetAddCommand_initOptions, _SpoCommandSetAddCommand_initValidators;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const commands_1 = require("../../commands");
|
|
19
|
+
const validation_1 = require("../../../../utils/validation");
|
|
20
|
+
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
21
|
+
const request_1 = require("../../../../request");
|
|
22
|
+
class SpoCommandSetAddCommand extends SpoCommand_1.default {
|
|
23
|
+
get name() {
|
|
24
|
+
return commands_1.default.COMMANDSET_ADD;
|
|
25
|
+
}
|
|
26
|
+
get description() {
|
|
27
|
+
return 'Add a ListView Command Set to a site.';
|
|
28
|
+
}
|
|
29
|
+
constructor() {
|
|
30
|
+
super();
|
|
31
|
+
_SpoCommandSetAddCommand_instances.add(this);
|
|
32
|
+
__classPrivateFieldGet(this, _SpoCommandSetAddCommand_instances, "m", _SpoCommandSetAddCommand_initTelemetry).call(this);
|
|
33
|
+
__classPrivateFieldGet(this, _SpoCommandSetAddCommand_instances, "m", _SpoCommandSetAddCommand_initOptions).call(this);
|
|
34
|
+
__classPrivateFieldGet(this, _SpoCommandSetAddCommand_instances, "m", _SpoCommandSetAddCommand_initValidators).call(this);
|
|
35
|
+
}
|
|
36
|
+
commandAction(logger, args) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
if (this.verbose) {
|
|
39
|
+
logger.logToStderr(`Adding ListView Command Set ${args.options.clientSideComponentId} to site '${args.options.webUrl}'...`);
|
|
40
|
+
}
|
|
41
|
+
if (!args.options.scope) {
|
|
42
|
+
args.options.scope = 'Web';
|
|
43
|
+
}
|
|
44
|
+
const location = args.options.location && this.getLocation(args.options.location);
|
|
45
|
+
const listType = this.getListTemplate(args.options.listType);
|
|
46
|
+
try {
|
|
47
|
+
const requestBody = {
|
|
48
|
+
Title: args.options.title,
|
|
49
|
+
Location: location,
|
|
50
|
+
ClientSideComponentId: args.options.clientSideComponentId,
|
|
51
|
+
RegistrationId: listType
|
|
52
|
+
};
|
|
53
|
+
if (args.options.clientSideComponentProperties) {
|
|
54
|
+
requestBody.ClientSideComponentProperties = args.options.clientSideComponentProperties;
|
|
55
|
+
}
|
|
56
|
+
const requestOptions = {
|
|
57
|
+
url: `${args.options.webUrl}/_api/${args.options.scope}/UserCustomActions`,
|
|
58
|
+
headers: {
|
|
59
|
+
accept: 'application/json;odata=nometadata'
|
|
60
|
+
},
|
|
61
|
+
data: requestBody,
|
|
62
|
+
responseType: 'json'
|
|
63
|
+
};
|
|
64
|
+
const response = yield request_1.default.post(requestOptions);
|
|
65
|
+
logger.log(response);
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
this.handleRejectedODataJsonPromise(err);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
getLocation(location) {
|
|
73
|
+
switch (location) {
|
|
74
|
+
case 'Both':
|
|
75
|
+
return 'ClientSideExtension.ListViewCommandSet';
|
|
76
|
+
case 'ContextMenu':
|
|
77
|
+
return 'ClientSideExtension.ListViewCommandSet.ContextMenu';
|
|
78
|
+
default:
|
|
79
|
+
return 'ClientSideExtension.ListViewCommandSet.CommandBar';
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
getListTemplate(listTemplate) {
|
|
83
|
+
switch (listTemplate) {
|
|
84
|
+
case 'SitePages':
|
|
85
|
+
return '119';
|
|
86
|
+
case 'Library':
|
|
87
|
+
return '101';
|
|
88
|
+
default:
|
|
89
|
+
return '100';
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
_SpoCommandSetAddCommand_instances = new WeakSet(), _SpoCommandSetAddCommand_initTelemetry = function _SpoCommandSetAddCommand_initTelemetry() {
|
|
94
|
+
this.telemetry.push((args) => {
|
|
95
|
+
Object.assign(this.telemetryProperties, {
|
|
96
|
+
clientSideComponentProperties: typeof args.options.clientSideComponentProperties !== 'undefined',
|
|
97
|
+
scope: typeof args.options.scope !== 'undefined',
|
|
98
|
+
location: typeof args.options.location !== 'undefined'
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
}, _SpoCommandSetAddCommand_initOptions = function _SpoCommandSetAddCommand_initOptions() {
|
|
102
|
+
this.options.unshift({
|
|
103
|
+
option: '-t, --title <title>'
|
|
104
|
+
}, {
|
|
105
|
+
option: '-u, --webUrl <webUrl>'
|
|
106
|
+
}, {
|
|
107
|
+
option: '-l, --listType <listType>', autocomplete: SpoCommandSetAddCommand.listTypes
|
|
108
|
+
}, {
|
|
109
|
+
option: '-i, --clientSideComponentId <clientSideComponentId>'
|
|
110
|
+
}, {
|
|
111
|
+
option: '--clientSideComponentProperties [clientSideComponentProperties]'
|
|
112
|
+
}, {
|
|
113
|
+
option: '-s, --scope [scope]', autocomplete: SpoCommandSetAddCommand.scopes
|
|
114
|
+
}, {
|
|
115
|
+
option: '--location [location]', autocomplete: SpoCommandSetAddCommand.locations
|
|
116
|
+
});
|
|
117
|
+
}, _SpoCommandSetAddCommand_initValidators = function _SpoCommandSetAddCommand_initValidators() {
|
|
118
|
+
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
119
|
+
if (args.options.clientSideComponentId && !validation_1.validation.isValidGuid(args.options.clientSideComponentId)) {
|
|
120
|
+
return `${args.options.clientSideComponentId} is not a valid GUID`;
|
|
121
|
+
}
|
|
122
|
+
if (SpoCommandSetAddCommand.listTypes.indexOf(args.options.listType) < 0) {
|
|
123
|
+
return `${args.options.listType} is not a valid list type. Allowed values are ${SpoCommandSetAddCommand.listTypes.join(', ')}`;
|
|
124
|
+
}
|
|
125
|
+
if (args.options.scope && SpoCommandSetAddCommand.scopes.indexOf(args.options.scope) < 0) {
|
|
126
|
+
return `${args.options.scope} is not a valid scope. Allowed values are ${SpoCommandSetAddCommand.scopes.join(', ')}`;
|
|
127
|
+
}
|
|
128
|
+
if (args.options.location && SpoCommandSetAddCommand.locations.indexOf(args.options.location) < 0) {
|
|
129
|
+
return `${args.options.location} is not a valid location. Allowed values are ${SpoCommandSetAddCommand.locations.join(', ')}`;
|
|
130
|
+
}
|
|
131
|
+
return validation_1.validation.isValidSharePointUrl(args.options.webUrl);
|
|
132
|
+
}));
|
|
133
|
+
};
|
|
134
|
+
SpoCommandSetAddCommand.listTypes = ['List', 'Library', 'SitePages'];
|
|
135
|
+
SpoCommandSetAddCommand.scopes = ['Site', 'Web'];
|
|
136
|
+
SpoCommandSetAddCommand.locations = ['ContextMenu', 'CommandBar', 'Both'];
|
|
137
|
+
module.exports = new SpoCommandSetAddCommand();
|
|
138
|
+
//# sourceMappingURL=commandset-add.js.map
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
12
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
13
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
14
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
15
|
+
};
|
|
16
|
+
var _SpoCommandSetGetCommand_instances, _SpoCommandSetGetCommand_initTelemetry, _SpoCommandSetGetCommand_initOptions, _SpoCommandSetGetCommand_initValidators, _SpoCommandSetGetCommand_initOptionSets;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const os = require("os");
|
|
19
|
+
const formatting_1 = require("../../../../utils/formatting");
|
|
20
|
+
const spo_1 = require("../../../../utils/spo");
|
|
21
|
+
const validation_1 = require("../../../../utils/validation");
|
|
22
|
+
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
23
|
+
const commands_1 = require("../../commands");
|
|
24
|
+
class SpoCommandSetGetCommand extends SpoCommand_1.default {
|
|
25
|
+
get name() {
|
|
26
|
+
return commands_1.default.COMMANDSET_GET;
|
|
27
|
+
}
|
|
28
|
+
get description() {
|
|
29
|
+
return 'Get a ListView Command Set that is added to a site.';
|
|
30
|
+
}
|
|
31
|
+
constructor() {
|
|
32
|
+
super();
|
|
33
|
+
_SpoCommandSetGetCommand_instances.add(this);
|
|
34
|
+
__classPrivateFieldGet(this, _SpoCommandSetGetCommand_instances, "m", _SpoCommandSetGetCommand_initTelemetry).call(this);
|
|
35
|
+
__classPrivateFieldGet(this, _SpoCommandSetGetCommand_instances, "m", _SpoCommandSetGetCommand_initOptions).call(this);
|
|
36
|
+
__classPrivateFieldGet(this, _SpoCommandSetGetCommand_instances, "m", _SpoCommandSetGetCommand_initValidators).call(this);
|
|
37
|
+
__classPrivateFieldGet(this, _SpoCommandSetGetCommand_instances, "m", _SpoCommandSetGetCommand_initOptionSets).call(this);
|
|
38
|
+
}
|
|
39
|
+
commandAction(logger, args) {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
try {
|
|
42
|
+
if (this.verbose) {
|
|
43
|
+
logger.logToStderr(`Attempt to get a specific commandset by property ${args.options.title || args.options.id || args.options.clientSideComponentId}.`);
|
|
44
|
+
}
|
|
45
|
+
if (args.options.id) {
|
|
46
|
+
const commandSet = yield spo_1.spo.getCustomActionById(args.options.webUrl, args.options.id, args.options.scope);
|
|
47
|
+
if (commandSet === undefined) {
|
|
48
|
+
throw `Command set with id ${args.options.id} can't be found.`;
|
|
49
|
+
}
|
|
50
|
+
else if (!SpoCommandSetGetCommand.allowedCommandSetLocations.some(allowedLocation => allowedLocation === commandSet.Location)) {
|
|
51
|
+
throw `Custom action with id ${args.options.id} is not a command set.`;
|
|
52
|
+
}
|
|
53
|
+
logger.log(commandSet);
|
|
54
|
+
}
|
|
55
|
+
else if (args.options.clientSideComponentId) {
|
|
56
|
+
const filter = `${this.getBaseFilter()} ClientSideComponentId eq guid'${args.options.clientSideComponentId}'`;
|
|
57
|
+
const commandSets = yield spo_1.spo.getCustomActions(args.options.webUrl, args.options.scope, filter);
|
|
58
|
+
if (commandSets.length === 0) {
|
|
59
|
+
throw `No command set with clientSideComponentId '${args.options.clientSideComponentId}' found.`;
|
|
60
|
+
}
|
|
61
|
+
logger.log(commandSets[0]);
|
|
62
|
+
}
|
|
63
|
+
else if (args.options.title) {
|
|
64
|
+
const filter = `${this.getBaseFilter()} Title eq '${formatting_1.formatting.encodeQueryParameter(args.options.title)}'`;
|
|
65
|
+
const commandSets = yield spo_1.spo.getCustomActions(args.options.webUrl, args.options.scope, filter);
|
|
66
|
+
if (commandSets.length === 1) {
|
|
67
|
+
logger.log(commandSets[0]);
|
|
68
|
+
}
|
|
69
|
+
else if (commandSets.length === 0) {
|
|
70
|
+
throw `No command set with title '${args.options.title}' found.`;
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
throw `Multiple command sets with title '${args.options.title}' found. Please disambiguate using IDs: ${os.EOL}${commandSets.map(commandSet => `- ${commandSet.Id}`).join(os.EOL)}.`;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
catch (err) {
|
|
78
|
+
this.handleRejectedODataJsonPromise(err);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
getBaseFilter() {
|
|
83
|
+
return `startswith(Location,'${SpoCommandSetGetCommand.baseLocation}') and`;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
_SpoCommandSetGetCommand_instances = new WeakSet(), _SpoCommandSetGetCommand_initTelemetry = function _SpoCommandSetGetCommand_initTelemetry() {
|
|
87
|
+
this.telemetry.push((args) => {
|
|
88
|
+
Object.assign(this.telemetryProperties, {
|
|
89
|
+
title: typeof args.options.title !== 'undefined',
|
|
90
|
+
id: typeof args.options.id !== 'undefined',
|
|
91
|
+
clientSideComponentId: typeof args.options.clientSideComponentId !== 'undefined',
|
|
92
|
+
scope: typeof args.options.scope !== 'undefined'
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
}, _SpoCommandSetGetCommand_initOptions = function _SpoCommandSetGetCommand_initOptions() {
|
|
96
|
+
this.options.unshift({
|
|
97
|
+
option: '-u, --webUrl <webUrl>'
|
|
98
|
+
}, {
|
|
99
|
+
option: '-t, --title [title]'
|
|
100
|
+
}, {
|
|
101
|
+
option: '-i, --id [id]'
|
|
102
|
+
}, {
|
|
103
|
+
option: '-c, --clientSideComponentId [clientSideComponentId]'
|
|
104
|
+
}, {
|
|
105
|
+
option: '-s, --scope [scope]',
|
|
106
|
+
autocomplete: SpoCommandSetGetCommand.scopes
|
|
107
|
+
});
|
|
108
|
+
}, _SpoCommandSetGetCommand_initValidators = function _SpoCommandSetGetCommand_initValidators() {
|
|
109
|
+
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
110
|
+
if (args.options.id && !validation_1.validation.isValidGuid(args.options.id)) {
|
|
111
|
+
return `${args.options.id} is not a valid GUID.`;
|
|
112
|
+
}
|
|
113
|
+
if (args.options.clientSideComponentId && !validation_1.validation.isValidGuid(args.options.clientSideComponentId)) {
|
|
114
|
+
return `${args.options.clientSideComponentId} is not a valid GUID.`;
|
|
115
|
+
}
|
|
116
|
+
if (args.options.scope && SpoCommandSetGetCommand.scopes.indexOf(args.options.scope) < 0) {
|
|
117
|
+
return `${args.options.scope} is not a valid scope. Valid scopes are ${SpoCommandSetGetCommand.scopes.join(', ')}`;
|
|
118
|
+
}
|
|
119
|
+
return validation_1.validation.isValidSharePointUrl(args.options.webUrl);
|
|
120
|
+
}));
|
|
121
|
+
}, _SpoCommandSetGetCommand_initOptionSets = function _SpoCommandSetGetCommand_initOptionSets() {
|
|
122
|
+
this.optionSets.push({ options: ['title', 'id', 'clientSideComponentId'] });
|
|
123
|
+
};
|
|
124
|
+
SpoCommandSetGetCommand.scopes = ['All', 'Site', 'Web'];
|
|
125
|
+
SpoCommandSetGetCommand.baseLocation = 'ClientSideExtension.ListViewCommandSet';
|
|
126
|
+
SpoCommandSetGetCommand.allowedCommandSetLocations = [SpoCommandSetGetCommand.baseLocation, `${SpoCommandSetGetCommand.baseLocation}.CommandBar`, `${SpoCommandSetGetCommand.baseLocation}.ContextMenu`];
|
|
127
|
+
module.exports = new SpoCommandSetGetCommand();
|
|
128
|
+
//# sourceMappingURL=commandset-get.js.map
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
12
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
13
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
14
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
15
|
+
};
|
|
16
|
+
var _SpoCommandSetListCommand_instances, _SpoCommandSetListCommand_initTelemetry, _SpoCommandSetListCommand_initOptions, _SpoCommandSetListCommand_initValidators;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const spo_1 = require("../../../../utils/spo");
|
|
19
|
+
const validation_1 = require("../../../../utils/validation");
|
|
20
|
+
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
21
|
+
const commands_1 = require("../../commands");
|
|
22
|
+
class SpoCommandSetListCommand extends SpoCommand_1.default {
|
|
23
|
+
get name() {
|
|
24
|
+
return commands_1.default.COMMANDSET_LIST;
|
|
25
|
+
}
|
|
26
|
+
get description() {
|
|
27
|
+
return 'Get a list of ListView Command Sets that are added to a site.';
|
|
28
|
+
}
|
|
29
|
+
defaultProperties() {
|
|
30
|
+
return ['Name', 'Location', 'Scope', 'Id'];
|
|
31
|
+
}
|
|
32
|
+
constructor() {
|
|
33
|
+
super();
|
|
34
|
+
_SpoCommandSetListCommand_instances.add(this);
|
|
35
|
+
__classPrivateFieldGet(this, _SpoCommandSetListCommand_instances, "m", _SpoCommandSetListCommand_initTelemetry).call(this);
|
|
36
|
+
__classPrivateFieldGet(this, _SpoCommandSetListCommand_instances, "m", _SpoCommandSetListCommand_initOptions).call(this);
|
|
37
|
+
__classPrivateFieldGet(this, _SpoCommandSetListCommand_instances, "m", _SpoCommandSetListCommand_initValidators).call(this);
|
|
38
|
+
}
|
|
39
|
+
commandAction(logger, args) {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
try {
|
|
42
|
+
if (this.verbose) {
|
|
43
|
+
logger.logToStderr(`Attempt to get commandsets...`);
|
|
44
|
+
}
|
|
45
|
+
const commandsets = yield spo_1.spo.getCustomActions(args.options.webUrl, args.options.scope, `startswith(Location,'ClientSideExtension.ListViewCommandSet')`);
|
|
46
|
+
logger.log(commandsets);
|
|
47
|
+
}
|
|
48
|
+
catch (err) {
|
|
49
|
+
this.handleRejectedPromise(err);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
_SpoCommandSetListCommand_instances = new WeakSet(), _SpoCommandSetListCommand_initTelemetry = function _SpoCommandSetListCommand_initTelemetry() {
|
|
55
|
+
this.telemetry.push((args) => {
|
|
56
|
+
Object.assign(this.telemetryProperties, {
|
|
57
|
+
scope: args.options.scope || 'All'
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
}, _SpoCommandSetListCommand_initOptions = function _SpoCommandSetListCommand_initOptions() {
|
|
61
|
+
this.options.unshift({
|
|
62
|
+
option: '-u, --webUrl <webUrl>'
|
|
63
|
+
}, {
|
|
64
|
+
option: '-s, --scope [scope]',
|
|
65
|
+
autocomplete: SpoCommandSetListCommand.scopes
|
|
66
|
+
});
|
|
67
|
+
}, _SpoCommandSetListCommand_initValidators = function _SpoCommandSetListCommand_initValidators() {
|
|
68
|
+
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
if (args.options.scope && SpoCommandSetListCommand.scopes.indexOf(args.options.scope) < 0) {
|
|
70
|
+
return `${args.options.scope} is not a valid scope. Valid scopes are ${SpoCommandSetListCommand.scopes.join(', ')}`;
|
|
71
|
+
}
|
|
72
|
+
return validation_1.validation.isValidSharePointUrl(args.options.webUrl);
|
|
73
|
+
}));
|
|
74
|
+
};
|
|
75
|
+
SpoCommandSetListCommand.scopes = ['All', 'Site', 'Web'];
|
|
76
|
+
module.exports = new SpoCommandSetListCommand();
|
|
77
|
+
//# sourceMappingURL=commandset-list.js.map
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
12
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
13
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
14
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
15
|
+
};
|
|
16
|
+
var _SpoCommandSetRemoveCommand_instances, _SpoCommandSetRemoveCommand_initTelemetry, _SpoCommandSetRemoveCommand_initOptions, _SpoCommandSetRemoveCommand_initValidators, _SpoCommandSetRemoveCommand_initOptionSets;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const commands_1 = require("../../commands");
|
|
19
|
+
const validation_1 = require("../../../../utils/validation");
|
|
20
|
+
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
21
|
+
const request_1 = require("../../../../request");
|
|
22
|
+
const formatting_1 = require("../../../../utils/formatting");
|
|
23
|
+
const spo_1 = require("../../../../utils/spo");
|
|
24
|
+
const Cli_1 = require("../../../../cli/Cli");
|
|
25
|
+
class SpoCommandSetRemoveCommand extends SpoCommand_1.default {
|
|
26
|
+
get name() {
|
|
27
|
+
return commands_1.default.COMMANDSET_REMOVE;
|
|
28
|
+
}
|
|
29
|
+
get description() {
|
|
30
|
+
return 'Remove a ListView Command Set that is added to a site.';
|
|
31
|
+
}
|
|
32
|
+
constructor() {
|
|
33
|
+
super();
|
|
34
|
+
_SpoCommandSetRemoveCommand_instances.add(this);
|
|
35
|
+
__classPrivateFieldGet(this, _SpoCommandSetRemoveCommand_instances, "m", _SpoCommandSetRemoveCommand_initTelemetry).call(this);
|
|
36
|
+
__classPrivateFieldGet(this, _SpoCommandSetRemoveCommand_instances, "m", _SpoCommandSetRemoveCommand_initOptions).call(this);
|
|
37
|
+
__classPrivateFieldGet(this, _SpoCommandSetRemoveCommand_instances, "m", _SpoCommandSetRemoveCommand_initValidators).call(this);
|
|
38
|
+
__classPrivateFieldGet(this, _SpoCommandSetRemoveCommand_instances, "m", _SpoCommandSetRemoveCommand_initOptionSets).call(this);
|
|
39
|
+
}
|
|
40
|
+
commandAction(logger, args) {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
if (this.verbose) {
|
|
43
|
+
logger.logToStderr(`Removing ListView Command Set ${args.options.clientSideComponentId || args.options.title || args.options.id} to site '${args.options.webUrl}'...`);
|
|
44
|
+
}
|
|
45
|
+
if (args.options.confirm) {
|
|
46
|
+
yield this.deleteCommandset(args);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
const result = yield Cli_1.Cli.prompt({
|
|
50
|
+
type: 'confirm',
|
|
51
|
+
name: 'continue',
|
|
52
|
+
default: false,
|
|
53
|
+
message: `Are you sure you want to remove command set '${args.options.clientSideComponentId || args.options.title || args.options.id}'?`
|
|
54
|
+
});
|
|
55
|
+
if (result.continue) {
|
|
56
|
+
yield this.deleteCommandset(args);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
getCommandSetId(options) {
|
|
62
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
if (options.id) {
|
|
64
|
+
return options.id;
|
|
65
|
+
}
|
|
66
|
+
let commandSets = [];
|
|
67
|
+
if (options.title) {
|
|
68
|
+
commandSets = yield spo_1.spo.getCustomActions(options.webUrl, options.scope, `(Title eq '${formatting_1.formatting.encodeQueryParameter(options.title)}') and (startswith(Location,'ClientSideExtension.ListViewCommandSet'))`);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
commandSets = yield spo_1.spo.getCustomActions(options.webUrl, options.scope, `(ClientSideComponentId eq guid'${options.clientSideComponentId}') and (startswith(Location,'ClientSideExtension.ListViewCommandSet'))`);
|
|
72
|
+
}
|
|
73
|
+
if (commandSets.length === 0) {
|
|
74
|
+
throw `No user commandsets with ${options.title ? `title '${options.title}'` : `ClientSideComponentId '${options.clientSideComponentId}'`} found`;
|
|
75
|
+
}
|
|
76
|
+
if (commandSets.length > 1) {
|
|
77
|
+
throw `Multiple user commandsets with ${options.title ? `title '${options.title}'` : `ClientSideComponentId '${options.clientSideComponentId}'`} found. Please disambiguate using IDs: ${commandSets.map((commandSet) => commandSet.Id).join(', ')}`;
|
|
78
|
+
}
|
|
79
|
+
return commandSets[0].Id;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
deleteCommandset(args) {
|
|
83
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
+
if (!args.options.scope) {
|
|
85
|
+
args.options.scope = 'Site';
|
|
86
|
+
}
|
|
87
|
+
try {
|
|
88
|
+
const id = yield this.getCommandSetId(args.options);
|
|
89
|
+
const requestOptions = {
|
|
90
|
+
url: `${args.options.webUrl}/_api/${args.options.scope}/UserCustomActions('${formatting_1.formatting.encodeQueryParameter(id)}')`,
|
|
91
|
+
headers: {
|
|
92
|
+
accept: 'application/json;odata=nometadata'
|
|
93
|
+
},
|
|
94
|
+
responseType: 'json'
|
|
95
|
+
};
|
|
96
|
+
yield request_1.default.delete(requestOptions);
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
this.handleRejectedODataJsonPromise(err);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
_SpoCommandSetRemoveCommand_instances = new WeakSet(), _SpoCommandSetRemoveCommand_initTelemetry = function _SpoCommandSetRemoveCommand_initTelemetry() {
|
|
105
|
+
this.telemetry.push((args) => {
|
|
106
|
+
Object.assign(this.telemetryProperties, {
|
|
107
|
+
title: typeof args.options.title !== 'undefined',
|
|
108
|
+
id: typeof args.options.id !== 'undefined',
|
|
109
|
+
clientSideComponentId: typeof args.options.clientSideComponentId !== 'undefined',
|
|
110
|
+
scope: typeof args.options.scope !== 'undefined',
|
|
111
|
+
confirm: !!args.options.confirm
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
}, _SpoCommandSetRemoveCommand_initOptions = function _SpoCommandSetRemoveCommand_initOptions() {
|
|
115
|
+
this.options.unshift({
|
|
116
|
+
option: '-u, --webUrl <webUrl>'
|
|
117
|
+
}, {
|
|
118
|
+
option: '-t, --title [title]'
|
|
119
|
+
}, {
|
|
120
|
+
option: '-i, --id [id]'
|
|
121
|
+
}, {
|
|
122
|
+
option: '-c, --clientSideComponentId [clientSideComponentId]'
|
|
123
|
+
}, {
|
|
124
|
+
option: '-s, --scope [scope]', autocomplete: SpoCommandSetRemoveCommand.scopes
|
|
125
|
+
}, {
|
|
126
|
+
option: '--confirm'
|
|
127
|
+
});
|
|
128
|
+
}, _SpoCommandSetRemoveCommand_initValidators = function _SpoCommandSetRemoveCommand_initValidators() {
|
|
129
|
+
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
130
|
+
if (args.options.id && !validation_1.validation.isValidGuid(args.options.id)) {
|
|
131
|
+
return `${args.options.id} is not a valid GUID`;
|
|
132
|
+
}
|
|
133
|
+
if (args.options.clientSideComponentId && !validation_1.validation.isValidGuid(args.options.clientSideComponentId)) {
|
|
134
|
+
return `${args.options.clientSideComponentId} is not a valid GUID`;
|
|
135
|
+
}
|
|
136
|
+
if (args.options.scope && SpoCommandSetRemoveCommand.scopes.indexOf(args.options.scope) < 0) {
|
|
137
|
+
return `${args.options.scope} is not a valid scope. Allowed values are ${SpoCommandSetRemoveCommand.scopes.join(', ')}`;
|
|
138
|
+
}
|
|
139
|
+
return validation_1.validation.isValidSharePointUrl(args.options.webUrl);
|
|
140
|
+
}));
|
|
141
|
+
}, _SpoCommandSetRemoveCommand_initOptionSets = function _SpoCommandSetRemoveCommand_initOptionSets() {
|
|
142
|
+
this.optionSets.push({ options: ['id', 'title', 'clientSideComponentId'] });
|
|
143
|
+
};
|
|
144
|
+
SpoCommandSetRemoveCommand.scopes = ['All', 'Site', 'Web'];
|
|
145
|
+
module.exports = new SpoCommandSetRemoveCommand();
|
|
146
|
+
//# sourceMappingURL=commandset-remove.js.map
|