@pnp/cli-microsoft365 6.7.0-beta.f5f5666 → 6.8.0-beta.00c3a00
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/.eslintrc.js +2 -0
- package/.mocharc.json +1 -0
- package/README.md +15 -10
- package/dist/Command.js +62 -7
- package/dist/chili/chili.js +298 -0
- package/dist/chili/index.js +20 -0
- package/dist/cli/Cli.js +2 -2
- package/dist/m365/aad/commands/user/user-add.js +30 -21
- package/dist/m365/app/commands/permission/permission-add.js +279 -0
- package/dist/m365/app/commands.js +1 -0
- package/dist/m365/commands/commands.js +2 -0
- package/dist/m365/commands/docs.js +42 -0
- package/dist/m365/commands/login.js +1 -1
- package/dist/m365/commands/setup.js +180 -0
- package/dist/m365/commands/setupPresets.js +25 -0
- package/dist/m365/flow/commands/run/run-get.js +31 -1
- package/dist/m365/pa/commands/app/app-consent-set.js +101 -0
- package/dist/m365/pa/commands.js +1 -0
- package/dist/m365/planner/commands/roster/roster-plan-list.js +102 -0
- package/dist/m365/planner/commands.js +1 -0
- package/dist/m365/purview/commands/sensitivitylabel/sensitivitylabel-get.js +97 -0
- package/dist/m365/purview/commands/sensitivitylabel/sensitivitylabel-list.js +85 -0
- package/dist/m365/purview/commands/sensitivitylabel/sensitivitylabel-policysettings-list.js +89 -0
- package/dist/m365/purview/commands.js +3 -0
- package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.15.2.js +2 -0
- package/dist/m365/spfx/commands/spfx-doctor.js +14 -30
- package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-remove.js +146 -0
- package/dist/m365/spo/commands/file/file-checkin.js +8 -3
- package/dist/m365/spo/commands/file/file-checkout.js +8 -3
- package/dist/m365/spo/commands/file/file-copy.js +4 -4
- package/dist/m365/spo/commands/file/file-get.js +3 -1
- package/dist/m365/spo/commands/file/file-list.js +121 -34
- package/dist/m365/spo/commands/file/file-move.js +6 -7
- package/dist/m365/spo/commands/file/file-remove.js +6 -12
- package/dist/m365/spo/commands/file/file-rename.js +3 -3
- package/dist/m365/spo/commands/file/file-roleassignment-add.js +2 -1
- package/dist/m365/spo/commands/file/file-roleassignment-remove.js +3 -3
- package/dist/m365/spo/commands/file/file-roleinheritance-break.js +2 -1
- package/dist/m365/spo/commands/file/file-roleinheritance-reset.js +2 -1
- package/dist/m365/spo/commands/file/file-sharinginfo-get.js +4 -2
- package/dist/m365/spo/commands/file/file-version-clear.js +3 -1
- package/dist/m365/spo/commands/file/file-version-get.js +3 -1
- package/dist/m365/spo/commands/file/file-version-remove.js +3 -1
- package/dist/m365/spo/commands/file/file-version-restore.js +3 -1
- package/dist/m365/spo/commands/folder/folder-copy.js +4 -4
- package/dist/m365/spo/commands/folder/folder-get.js +5 -2
- package/dist/m365/spo/commands/folder/folder-list.js +73 -16
- package/dist/m365/spo/commands/folder/folder-move.js +3 -2
- package/dist/m365/spo/commands/folder/folder-rename.js +5 -2
- package/dist/m365/spo/commands/list/list-get.js +30 -3
- package/dist/m365/spo/commands/list/list-list.js +39 -2
- package/dist/m365/spo/commands/listitem/listitem-batch-set.js +308 -0
- package/dist/m365/spo/commands/page/page-section-add.js +2 -3
- package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-permissionrequest-list.js +46 -1
- package/dist/m365/spo/commands/site/site-recyclebinitem-move.js +119 -0
- package/dist/m365/spo/commands/site/site-recyclebinitem-remove.js +106 -0
- package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-get.js +30 -39
- package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-list.js +47 -0
- package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-remove.js +151 -0
- package/dist/m365/spo/commands/tenant/tenant-commandset-remove.js +152 -0
- package/dist/m365/spo/commands/tenant/tenant-commandset-set.js +203 -0
- package/dist/m365/spo/commands/tenant/tenant-settings-set.js +4 -0
- package/dist/m365/spo/commands/term/term-add.js +13 -4
- package/dist/m365/spo/commands/term/term-get.js +14 -5
- package/dist/m365/spo/commands/term/term-group-get.js +12 -3
- package/dist/m365/spo/commands/term/term-group-list.js +39 -4
- package/dist/m365/spo/commands/term/term-list.js +18 -9
- package/dist/m365/spo/commands/term/term-set-add.js +13 -4
- package/dist/m365/spo/commands/term/term-set-get.js +12 -3
- package/dist/m365/spo/commands/term/term-set-list.js +12 -3
- package/dist/m365/spo/commands.js +9 -0
- package/dist/m365/teams/commands/chat/chat-member-remove.js +137 -0
- package/dist/m365/teams/commands/meeting/meeting-transcript-list.js +124 -0
- package/dist/m365/teams/commands.js +2 -0
- package/dist/utils/formatting.js +35 -11
- package/dist/utils/pid.js +5 -0
- package/dist/utils/spo.js +1 -1
- package/docs/docs/cmd/aad/o365group/o365group-get.md +0 -12
- package/docs/docs/cmd/aad/user/user-add.md +4 -0
- package/docs/docs/cmd/aad/user/user-set.md +2 -2
- package/docs/docs/cmd/app/permission/permission-add.md +53 -0
- package/docs/docs/cmd/cli/cli-consent.md +6 -0
- package/docs/docs/cmd/cli/cli-doctor.md +17 -0
- package/docs/docs/cmd/cli/cli-issue.md +6 -0
- package/docs/docs/cmd/cli/cli-reconsent.md +6 -0
- package/docs/docs/cmd/cli/completion/completion-sh-setup.md +6 -0
- package/docs/docs/cmd/cli/config/config-get.md +6 -0
- package/docs/docs/cmd/docs.md +51 -0
- package/docs/docs/cmd/flow/environment/environment-list.md +18 -0
- package/docs/docs/cmd/flow/flow-get.md +20 -0
- package/docs/docs/cmd/flow/flow-list.md +17 -0
- package/docs/docs/cmd/flow/run/run-get.md +110 -9
- package/docs/docs/cmd/graph/changelog/changelog-list.md +52 -0
- package/docs/docs/cmd/graph/schemaextension/schemaextension-add.md +61 -0
- package/docs/docs/cmd/graph/schemaextension/schemaextension-get.md +61 -0
- package/docs/docs/cmd/graph/schemaextension/schemaextension-list.md +61 -0
- package/docs/docs/cmd/graph/schemaextension/schemaextension-remove.md +4 -0
- package/docs/docs/cmd/graph/schemaextension/schemaextension-set.md +4 -0
- package/docs/docs/cmd/graph/subscription/subscription-add.md +73 -0
- package/docs/docs/cmd/login.md +1 -1
- package/docs/docs/cmd/onedrive/onedrive-list.md +225 -0
- package/docs/docs/cmd/onedrive/report/report-activityfilecounts.md +39 -0
- package/docs/docs/cmd/onedrive/report/report-activityusercounts.md +39 -0
- package/docs/docs/cmd/onedrive/report/report-activityuserdetail.md +43 -0
- package/docs/docs/cmd/onedrive/report/report-usageaccountcounts.md +38 -0
- package/docs/docs/cmd/onedrive/report/report-usageaccountdetail.md +43 -0
- package/docs/docs/cmd/onedrive/report/report-usagefilecounts.md +38 -0
- package/docs/docs/cmd/onedrive/report/report-usagestorage.md +37 -0
- package/docs/docs/cmd/onenote/notebook/notebook-list.md +79 -0
- package/docs/docs/cmd/pa/app/app-consent-set.md +47 -0
- package/docs/docs/cmd/planner/plan/plan-get.md +1 -1
- package/docs/docs/cmd/planner/plan/plan-list.md +1 -1
- package/docs/docs/cmd/planner/roster/roster-add.md +2 -1
- package/docs/docs/cmd/planner/roster/roster-get.md +1 -1
- package/docs/docs/cmd/planner/roster/roster-plan-list.md +109 -0
- package/docs/docs/cmd/planner/roster/roster-remove.md +2 -1
- package/docs/docs/cmd/planner/task/task-add.md +3 -1
- package/docs/docs/cmd/planner/task/task-get.md +0 -6
- package/docs/docs/cmd/planner/task/task-set.md +7 -5
- package/docs/docs/cmd/purview/retentionevent/retentionevent-add.md +6 -7
- package/docs/docs/cmd/purview/retentionevent/retentionevent-get.md +6 -7
- package/docs/docs/cmd/purview/retentionevent/retentionevent-list.md +4 -4
- package/docs/docs/cmd/purview/retentionevent/retentionevent-remove.md +4 -4
- package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-add.md +10 -10
- package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-get.md +11 -11
- package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-list.md +10 -10
- package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-remove.md +10 -10
- package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-set.md +10 -10
- package/docs/docs/cmd/purview/retentionlabel/retentionlabel-add.md +12 -12
- package/docs/docs/cmd/purview/retentionlabel/retentionlabel-get.md +8 -9
- package/docs/docs/cmd/purview/retentionlabel/retentionlabel-list.md +8 -9
- package/docs/docs/cmd/purview/retentionlabel/retentionlabel-remove.md +8 -8
- package/docs/docs/cmd/purview/retentionlabel/retentionlabel-set.md +8 -8
- package/docs/docs/cmd/purview/sensitivitylabel/sensitivitylabel-get.md +118 -0
- package/docs/docs/cmd/purview/sensitivitylabel/sensitivitylabel-list.md +111 -0
- package/docs/docs/cmd/purview/sensitivitylabel/sensitivitylabel-policysettings-list.md +97 -0
- package/docs/docs/cmd/search/externalconnection/externalconnection-get.md +17 -0
- package/docs/docs/cmd/search/externalconnection/externalconnection-list.md +17 -0
- package/docs/docs/cmd/setup.md +86 -0
- package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-add.md +1 -1
- package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-remove.md +77 -0
- package/docs/docs/cmd/spo/commandset/commandset-set.md +1 -1
- package/docs/docs/cmd/spo/contenttype/contenttype-set.md +2 -2
- package/docs/docs/cmd/spo/customaction/customaction-add.md +1 -1
- package/docs/docs/cmd/spo/customaction/customaction-set.md +1 -1
- package/docs/docs/cmd/spo/feature/feature-enable.md +2 -2
- package/docs/docs/cmd/spo/file/file-add.md +1 -1
- package/docs/docs/cmd/spo/file/file-checkin.md +1 -1
- package/docs/docs/cmd/spo/file/file-checkout.md +1 -1
- package/docs/docs/cmd/spo/file/file-copy.md +1 -1
- package/docs/docs/cmd/spo/file/file-get.md +1 -1
- package/docs/docs/cmd/spo/file/file-list.md +93 -5
- package/docs/docs/cmd/spo/file/file-move.md +3 -3
- package/docs/docs/cmd/spo/file/file-remove.md +12 -0
- package/docs/docs/cmd/spo/file/file-rename.md +1 -1
- package/docs/docs/cmd/spo/file/file-retentionlabel-ensure.md +3 -3
- package/docs/docs/cmd/spo/file/file-retentionlabel-remove.md +2 -2
- package/docs/docs/cmd/spo/file/file-roleassignment-add.md +1 -1
- package/docs/docs/cmd/spo/file/file-roleassignment-remove.md +1 -1
- package/docs/docs/cmd/spo/file/file-roleinheritance-break.md +1 -1
- package/docs/docs/cmd/spo/file/file-roleinheritance-reset.md +1 -1
- package/docs/docs/cmd/spo/file/file-sharinginfo-get.md +1 -1
- package/docs/docs/cmd/spo/file/file-sharinglink-add.md +1 -1
- package/docs/docs/cmd/spo/file/file-sharinglink-clear.md +1 -1
- package/docs/docs/cmd/spo/file/file-sharinglink-get.md +1 -1
- package/docs/docs/cmd/spo/file/file-sharinglink-list.md +1 -1
- package/docs/docs/cmd/spo/file/file-sharinglink-remove.md +1 -1
- package/docs/docs/cmd/spo/file/file-sharinglink-set.md +1 -1
- package/docs/docs/cmd/spo/file/file-version-clear.md +2 -2
- package/docs/docs/cmd/spo/file/file-version-get.md +1 -1
- package/docs/docs/cmd/spo/file/file-version-list.md +1 -1
- package/docs/docs/cmd/spo/file/file-version-remove.md +1 -1
- package/docs/docs/cmd/spo/file/file-version-restore.md +1 -1
- package/docs/docs/cmd/spo/folder/folder-add.md +9 -3
- package/docs/docs/cmd/spo/folder/folder-copy.md +2 -2
- package/docs/docs/cmd/spo/folder/folder-get.md +7 -7
- package/docs/docs/cmd/spo/folder/folder-list.md +45 -10
- package/docs/docs/cmd/spo/folder/folder-move.md +1 -1
- package/docs/docs/cmd/spo/folder/folder-remove.md +7 -7
- package/docs/docs/cmd/spo/folder/folder-rename.md +11 -5
- package/docs/docs/cmd/spo/folder/folder-retentionlabel-ensure.md +3 -3
- package/docs/docs/cmd/spo/folder/folder-retentionlabel-remove.md +1 -1
- package/docs/docs/cmd/spo/folder/folder-roleinheritance-break.md +1 -1
- package/docs/docs/cmd/spo/folder/folder-roleinheritance-reset.md +4 -4
- package/docs/docs/cmd/spo/list/list-get.md +10 -0
- package/docs/docs/cmd/spo/list/list-list.md +28 -0
- package/docs/docs/cmd/spo/listitem/listitem-batch-set.md +67 -0
- package/docs/docs/cmd/spo/orgassetslibrary/orgassetslibrary-list.md +19 -0
- package/docs/docs/cmd/spo/orgassetslibrary/orgassetslibrary-remove.md +12 -0
- package/docs/docs/cmd/spo/orgnewssite/orgnewssite-list.md +6 -0
- package/docs/docs/cmd/spo/page/page-column-get.md +15 -0
- package/docs/docs/cmd/spo/page/page-column-list.md +16 -0
- package/docs/docs/cmd/spo/page/page-control-get.md +18 -0
- package/docs/docs/cmd/spo/page/page-control-list.md +18 -0
- package/docs/docs/cmd/spo/page/page-copy.md +35 -0
- package/docs/docs/cmd/spo/page/page-get.md +39 -0
- package/docs/docs/cmd/spo/page/page-list.md +53 -0
- package/docs/docs/cmd/spo/page/page-section-get.md +12 -0
- package/docs/docs/cmd/spo/page/page-section-list.md +13 -0
- package/docs/docs/cmd/spo/page/page-template-list.md +31 -0
- package/docs/docs/cmd/spo/propertybag/propertybag-get.md +6 -0
- package/docs/docs/cmd/spo/propertybag/propertybag-list.md +13 -0
- package/docs/docs/cmd/spo/report/report-activityfilecounts.md +7 -0
- package/docs/docs/cmd/spo/report/report-activitypages.md +7 -0
- package/docs/docs/cmd/spo/report/report-activityusercounts.md +7 -0
- package/docs/docs/cmd/spo/report/report-activityuserdetail.md +7 -0
- package/docs/docs/cmd/spo/report/report-siteusagedetail.md +7 -0
- package/docs/docs/cmd/spo/report/report-siteusagefilecounts.md +7 -0
- package/docs/docs/cmd/spo/report/report-siteusagepages.md +7 -0
- package/docs/docs/cmd/spo/report/report-siteusagesitecounts.md +7 -0
- package/docs/docs/cmd/spo/report/report-siteusagestorage.md +7 -0
- package/docs/docs/cmd/spo/roledefinition/roledefinition-get.md +20 -0
- package/docs/docs/cmd/spo/roledefinition/roledefinition-list.md +20 -0
- package/docs/docs/cmd/spo/serviceprincipal/serviceprincipal-grant-add.md +20 -0
- package/docs/docs/cmd/spo/serviceprincipal/serviceprincipal-grant-list.md +18 -0
- package/docs/docs/cmd/spo/serviceprincipal/serviceprincipal-permissionrequest-approve.md +20 -0
- package/docs/docs/cmd/spo/serviceprincipal/serviceprincipal-permissionrequest-list.md +17 -0
- package/docs/docs/cmd/spo/serviceprincipal/serviceprincipal-set.md +13 -0
- package/docs/docs/cmd/spo/site/site-recyclebinitem-move.md +43 -0
- package/docs/docs/cmd/spo/site/site-recyclebinitem-remove.md +45 -0
- package/docs/docs/cmd/spo/spo-get.md +12 -0
- package/docs/docs/cmd/spo/spo-search.md +16 -3
- package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-add.md +1 -1
- package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-list.md +103 -0
- package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-remove.md +49 -0
- package/docs/docs/cmd/spo/tenant/tenant-commandset-remove.md +49 -0
- package/docs/docs/cmd/spo/tenant/tenant-commandset-set.md +57 -0
- package/docs/docs/cmd/spo/tenant/tenant-settings-set.md +57 -54
- package/docs/docs/cmd/spo/term/term-add.md +107 -6
- package/docs/docs/cmd/spo/term/term-get.md +111 -10
- package/docs/docs/cmd/spo/term/term-group-get.md +71 -5
- package/docs/docs/cmd/spo/term/term-group-list.md +70 -2
- package/docs/docs/cmd/spo/term/term-list.md +80 -8
- package/docs/docs/cmd/spo/term/term-set-add.md +95 -11
- package/docs/docs/cmd/spo/term/term-set-get.md +92 -8
- package/docs/docs/cmd/spo/term/term-set-list.md +85 -5
- package/docs/docs/cmd/spo/user/user-ensure.md +1 -2
- package/docs/docs/cmd/spo/user/user-get.md +24 -0
- package/docs/docs/cmd/spo/user/user-list.md +27 -3
- package/docs/docs/cmd/spo/userprofile/userprofile-get.md +21 -0
- package/docs/docs/cmd/spo/web/web-add.md +24 -0
- package/docs/docs/cmd/spo/web/web-clientsidewebpart-list.md +16 -0
- package/docs/docs/cmd/spo/web/web-get.md +124 -0
- package/docs/docs/cmd/spo/web/web-installedlanguage-list.md +16 -0
- package/docs/docs/cmd/spo/web/web-list.md +16 -0
- package/docs/docs/cmd/spo/web/web-retentionlabel-list.md +29 -2
- package/docs/docs/cmd/teams/app/app-list.md +17 -0
- package/docs/docs/cmd/teams/app/app-publish.md +18 -1
- package/docs/docs/cmd/teams/channel/channel-add.md +20 -0
- package/docs/docs/cmd/teams/channel/channel-get.md +21 -0
- package/docs/docs/cmd/teams/channel/channel-list.md +21 -0
- package/docs/docs/cmd/teams/channel/channel-member-list.md +20 -0
- package/docs/docs/cmd/teams/channel/channel-member-set.md +21 -0
- package/docs/docs/cmd/teams/chat/chat-get.md +22 -0
- package/docs/docs/cmd/teams/chat/chat-list.md +22 -0
- package/docs/docs/cmd/teams/chat/chat-member-list.md +20 -0
- package/docs/docs/cmd/teams/chat/chat-member-remove.md +52 -0
- package/docs/docs/cmd/teams/chat/chat-message-list.md +23 -0
- package/docs/docs/cmd/teams/funsettings/funsettings-list.md +15 -0
- package/docs/docs/cmd/teams/guestsettings/guestsettings-list.md +13 -0
- package/docs/docs/cmd/teams/meeting/meeting-transcript-list.md +96 -0
- package/docs/docs/cmd/teams/membersettings/membersettings-list.md +17 -0
- package/docs/docs/cmd/teams/tab/tab-remove.md +1 -1
- package/docs/docs/cmd/version.md +1 -1
- package/docs/docs/cmd/yammer/group/group-list.md +42 -0
- package/docs/docs/cmd/yammer/message/message-add.md +32 -0
- package/docs/docs/cmd/yammer/message/message-get.md +32 -0
- package/docs/docs/cmd/yammer/message/message-list.md +34 -0
- package/docs/docs/cmd/yammer/network/network-list.md +70 -0
- package/docs/docs/cmd/yammer/report/report-activitycounts.md +7 -0
- package/docs/docs/cmd/yammer/report/report-activityusercounts.md +7 -0
- package/docs/docs/cmd/yammer/report/report-activityuserdetail.md +7 -0
- package/docs/docs/cmd/yammer/report/report-deviceusagedistributionusercounts.md +7 -0
- package/docs/docs/cmd/yammer/report/report-deviceusageusercounts.md +7 -0
- package/docs/docs/cmd/yammer/report/report-deviceusageuserdetail.md +7 -0
- package/docs/docs/cmd/yammer/report/report-groupsactivitycounts.md +7 -0
- package/docs/docs/cmd/yammer/report/report-groupsactivitydetail.md +7 -0
- package/docs/docs/cmd/yammer/report/report-groupsactivitygroupcounts.md +7 -0
- package/docs/docs/cmd/yammer/user/user-get.md +55 -0
- package/docs/docs/cmd/yammer/user/user-list.md +55 -0
- package/docs/docs/cmd/yammer/yammer-search.md +15 -3
- package/npm-shrinkwrap.json +269 -336
- package/package.json +15 -12
- package/dist/m365/spo/commands/file/FilePropertiesCollection.js +0 -3
- package/dist/m365/spo/commands/folder/FileFolderCollection.js +0 -3
|
@@ -15,19 +15,11 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
15
15
|
};
|
|
16
16
|
var _SpfxDoctorCommand_instances, _SpfxDoctorCommand_initTelemetry, _SpfxDoctorCommand_initOptions, _SpfxDoctorCommand_initValidators;
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
const chalk = require("chalk");
|
|
19
18
|
const child_process = require("child_process");
|
|
20
19
|
const semver_1 = require("semver");
|
|
20
|
+
const formatting_1 = require("../../../utils/formatting");
|
|
21
21
|
const commands_1 = require("../commands");
|
|
22
22
|
const base_project_command_1 = require("./project/base-project-command");
|
|
23
|
-
/**
|
|
24
|
-
* Has the particular check passed or failed
|
|
25
|
-
*/
|
|
26
|
-
var CheckStatus;
|
|
27
|
-
(function (CheckStatus) {
|
|
28
|
-
CheckStatus[CheckStatus["Success"] = 0] = "Success";
|
|
29
|
-
CheckStatus[CheckStatus["Failure"] = 1] = "Failure";
|
|
30
|
-
})(CheckStatus || (CheckStatus = {}));
|
|
31
23
|
/**
|
|
32
24
|
* Where to search for the particular npm package: only in the current project,
|
|
33
25
|
* in global packages or both
|
|
@@ -520,12 +512,12 @@ class SpfxDoctorCommand extends base_project_command_1.BaseProjectCommand {
|
|
|
520
512
|
try {
|
|
521
513
|
spfxVersion = (_a = args.options.spfxVersion) !== null && _a !== void 0 ? _a : yield this.getSharePointFrameworkVersion(logger);
|
|
522
514
|
if (!spfxVersion) {
|
|
523
|
-
logger.log(
|
|
515
|
+
logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Failure, `SharePoint Framework`));
|
|
524
516
|
throw `SharePoint Framework not found`;
|
|
525
517
|
}
|
|
526
518
|
prerequisites = this.versions[spfxVersion];
|
|
527
519
|
if (!prerequisites) {
|
|
528
|
-
logger.log(
|
|
520
|
+
logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Failure, `SharePoint Framework v${spfxVersion}`));
|
|
529
521
|
throw `spfx doctor doesn't support SPFx v${spfxVersion} at this moment`;
|
|
530
522
|
}
|
|
531
523
|
if (args.options.spfxVersion) {
|
|
@@ -533,7 +525,7 @@ class SpfxDoctorCommand extends base_project_command_1.BaseProjectCommand {
|
|
|
533
525
|
}
|
|
534
526
|
else {
|
|
535
527
|
// spfx was detected and if we are here, it means that we support it
|
|
536
|
-
logger.log(
|
|
528
|
+
logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Success, `SharePoint Framework v${spfxVersion}`));
|
|
537
529
|
}
|
|
538
530
|
yield this.checkSharePointCompatibility(spfxVersion, prerequisites, args, fixes, logger);
|
|
539
531
|
yield this.checkNodeVersion(prerequisites, fixes, logger);
|
|
@@ -566,11 +558,11 @@ class SpfxDoctorCommand extends base_project_command_1.BaseProjectCommand {
|
|
|
566
558
|
if (args.options.env) {
|
|
567
559
|
const sp = this.spVersionStringToEnum(args.options.env);
|
|
568
560
|
if ((prerequisites.sp & sp) === sp) {
|
|
569
|
-
logger.log(
|
|
561
|
+
logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Success, `Supported in ${SharePointVersion[sp]}`));
|
|
570
562
|
resolve();
|
|
571
563
|
}
|
|
572
564
|
else {
|
|
573
|
-
logger.log(
|
|
565
|
+
logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Failure, `Not supported in ${SharePointVersion[sp]}`));
|
|
574
566
|
fixes.push(`Use SharePoint Framework v${(sp === SharePointVersion.SP2016 ? '1.1' : '1.4.1')}`);
|
|
575
567
|
reject(`SharePoint Framework v${spfxVersion} is not supported in ${SharePointVersion[sp]}`);
|
|
576
568
|
}
|
|
@@ -601,7 +593,7 @@ class SpfxDoctorCommand extends base_project_command_1.BaseProjectCommand {
|
|
|
601
593
|
this.checkStatus(`SharePoint Framework`, spfxVersionDetected, versionCheck, OptionalOrRequired.Required, fixes, logger);
|
|
602
594
|
}
|
|
603
595
|
else {
|
|
604
|
-
logger.log(
|
|
596
|
+
logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Failure, `SharePoint Framework v${spfxVersionRequested} not found`));
|
|
605
597
|
fixes.push(versionCheck.fix);
|
|
606
598
|
}
|
|
607
599
|
});
|
|
@@ -614,7 +606,7 @@ class SpfxDoctorCommand extends base_project_command_1.BaseProjectCommand {
|
|
|
614
606
|
this.checkStatus('yo', yoVersion, prerequisites.yo, OptionalOrRequired.Required, fixes, logger);
|
|
615
607
|
}
|
|
616
608
|
else {
|
|
617
|
-
logger.log(
|
|
609
|
+
logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Failure, `yo not found`));
|
|
618
610
|
fixes.push(prerequisites.yo.fix);
|
|
619
611
|
}
|
|
620
612
|
});
|
|
@@ -627,7 +619,7 @@ class SpfxDoctorCommand extends base_project_command_1.BaseProjectCommand {
|
|
|
627
619
|
this.checkStatus('gulp-cli', gulpCliVersion, prerequisites.gulpCli, OptionalOrRequired.Required, fixes, logger);
|
|
628
620
|
}
|
|
629
621
|
else {
|
|
630
|
-
logger.log(
|
|
622
|
+
logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Failure, `gulp-cli not found`));
|
|
631
623
|
fixes.push(prerequisites.gulpCli.fix);
|
|
632
624
|
}
|
|
633
625
|
});
|
|
@@ -637,7 +629,7 @@ class SpfxDoctorCommand extends base_project_command_1.BaseProjectCommand {
|
|
|
637
629
|
.getPackageVersion('gulp', PackageSearchMode.GlobalOnly, HandlePromise.Continue, logger)
|
|
638
630
|
.then((gulpVersion) => {
|
|
639
631
|
if (gulpVersion) {
|
|
640
|
-
logger.log(
|
|
632
|
+
logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Failure, `gulp should be removed`));
|
|
641
633
|
fixes.push('npm un -g gulp');
|
|
642
634
|
}
|
|
643
635
|
});
|
|
@@ -647,11 +639,11 @@ class SpfxDoctorCommand extends base_project_command_1.BaseProjectCommand {
|
|
|
647
639
|
.getPackageVersion('typescript', PackageSearchMode.LocalOnly, HandlePromise.Continue, logger)
|
|
648
640
|
.then((typeScriptVersion) => {
|
|
649
641
|
if (typeScriptVersion) {
|
|
650
|
-
logger.log(
|
|
642
|
+
logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Failure, `typescript v${typeScriptVersion} installed in the project`));
|
|
651
643
|
fixes.push('npm un typescript');
|
|
652
644
|
}
|
|
653
645
|
else {
|
|
654
|
-
logger.log(
|
|
646
|
+
logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Success, `bundled typescript used`));
|
|
655
647
|
}
|
|
656
648
|
});
|
|
657
649
|
}
|
|
@@ -775,22 +767,14 @@ class SpfxDoctorCommand extends base_project_command_1.BaseProjectCommand {
|
|
|
775
767
|
checkStatus(what, versionFound, versionCheck, optionalOrRequired, fixes, logger) {
|
|
776
768
|
if (versionFound) {
|
|
777
769
|
if ((0, semver_1.satisfies)(versionFound, versionCheck.range)) {
|
|
778
|
-
logger.log(
|
|
770
|
+
logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Success, `${what} v${versionFound}`));
|
|
779
771
|
}
|
|
780
772
|
else {
|
|
781
|
-
logger.log(
|
|
773
|
+
logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Failure, `${what} v${versionFound} found, v${versionCheck.range} required`));
|
|
782
774
|
fixes.push(versionCheck.fix);
|
|
783
775
|
}
|
|
784
776
|
}
|
|
785
777
|
}
|
|
786
|
-
getStatus(result, message) {
|
|
787
|
-
const primarySupported = process.platform !== 'win32' ||
|
|
788
|
-
process.env.CI === 'true' ||
|
|
789
|
-
process.env.TERM === 'xterm-256color';
|
|
790
|
-
const success = primarySupported ? '✔' : '√';
|
|
791
|
-
const failure = primarySupported ? '✖' : '×';
|
|
792
|
-
return `${result === CheckStatus.Success ? chalk.green(success) : chalk.red(failure)} ${message}`;
|
|
793
|
-
}
|
|
794
778
|
}
|
|
795
779
|
_SpfxDoctorCommand_instances = new WeakSet(), _SpfxDoctorCommand_initTelemetry = function _SpfxDoctorCommand_initTelemetry() {
|
|
796
780
|
this.telemetry.push((args) => {
|
|
@@ -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 _SpoApplicationCustomizerRemoveCommand_instances, _SpoApplicationCustomizerRemoveCommand_initOptions, _SpoApplicationCustomizerRemoveCommand_initTelemetry, _SpoApplicationCustomizerRemoveCommand_initValidators, _SpoApplicationCustomizerRemoveCommand_initOptionSets;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const Cli_1 = require("../../../../cli/Cli");
|
|
19
|
+
const request_1 = require("../../../../request");
|
|
20
|
+
const validation_1 = require("../../../../utils/validation");
|
|
21
|
+
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
22
|
+
const commands_1 = require("../../commands");
|
|
23
|
+
const spo_1 = require("../../../../utils/spo");
|
|
24
|
+
const formatting_1 = require("../../../../utils/formatting");
|
|
25
|
+
const os = require("os");
|
|
26
|
+
class SpoApplicationCustomizerRemoveCommand extends SpoCommand_1.default {
|
|
27
|
+
get name() {
|
|
28
|
+
return commands_1.default.APPLICATIONCUSTOMIZER_REMOVE;
|
|
29
|
+
}
|
|
30
|
+
get description() {
|
|
31
|
+
return 'Removes an application customizer that is added to a site';
|
|
32
|
+
}
|
|
33
|
+
constructor() {
|
|
34
|
+
super();
|
|
35
|
+
_SpoApplicationCustomizerRemoveCommand_instances.add(this);
|
|
36
|
+
this.allowedScopes = ['Site', 'Web', 'All'];
|
|
37
|
+
__classPrivateFieldGet(this, _SpoApplicationCustomizerRemoveCommand_instances, "m", _SpoApplicationCustomizerRemoveCommand_initTelemetry).call(this);
|
|
38
|
+
__classPrivateFieldGet(this, _SpoApplicationCustomizerRemoveCommand_instances, "m", _SpoApplicationCustomizerRemoveCommand_initOptions).call(this);
|
|
39
|
+
__classPrivateFieldGet(this, _SpoApplicationCustomizerRemoveCommand_instances, "m", _SpoApplicationCustomizerRemoveCommand_initValidators).call(this);
|
|
40
|
+
__classPrivateFieldGet(this, _SpoApplicationCustomizerRemoveCommand_instances, "m", _SpoApplicationCustomizerRemoveCommand_initOptionSets).call(this);
|
|
41
|
+
}
|
|
42
|
+
commandAction(logger, args) {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
try {
|
|
45
|
+
if (args.options.confirm) {
|
|
46
|
+
return yield this.removeApplicationCustomizer(logger, args.options);
|
|
47
|
+
}
|
|
48
|
+
const result = yield Cli_1.Cli.prompt({
|
|
49
|
+
type: 'confirm',
|
|
50
|
+
name: 'continue',
|
|
51
|
+
default: false,
|
|
52
|
+
message: `Are you sure you want to remove the application customizer '${args.options.clientSideComponentId || args.options.title || args.options.id}'?`
|
|
53
|
+
});
|
|
54
|
+
if (result.continue) {
|
|
55
|
+
yield this.removeApplicationCustomizer(logger, args.options);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
this.handleRejectedODataJsonPromise(err);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
removeApplicationCustomizer(logger, options) {
|
|
64
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
65
|
+
const applicationCustomizer = yield this.getApplicationCustomizer(options);
|
|
66
|
+
if (this.verbose) {
|
|
67
|
+
logger.logToStderr(`Removing application customizer '${options.clientSideComponentId || options.title || options.id}' from the site '${options.webUrl}'...`);
|
|
68
|
+
}
|
|
69
|
+
const requestOptions = {
|
|
70
|
+
url: `${options.webUrl}/_api/${applicationCustomizer.Scope.toString() === '2' ? 'Site' : 'Web'}/UserCustomActions('${applicationCustomizer.Id}')`,
|
|
71
|
+
headers: {
|
|
72
|
+
accept: 'application/json;odata=nometadata'
|
|
73
|
+
},
|
|
74
|
+
responseType: 'json'
|
|
75
|
+
};
|
|
76
|
+
yield request_1.default.delete(requestOptions);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
getApplicationCustomizer(options) {
|
|
80
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
+
const resolvedScope = options.scope || 'All';
|
|
82
|
+
let appCustomizers = [];
|
|
83
|
+
if (options.id) {
|
|
84
|
+
const appCustomizer = yield spo_1.spo.getCustomActionById(options.webUrl, options.id, resolvedScope);
|
|
85
|
+
if (appCustomizer) {
|
|
86
|
+
appCustomizers.push(appCustomizer);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
else if (options.title) {
|
|
90
|
+
appCustomizers = yield spo_1.spo.getCustomActions(options.webUrl, resolvedScope, `(Title eq '${formatting_1.formatting.encodeQueryParameter(options.title)}') and (startswith(Location,'ClientSideExtension.ApplicationCustomizer'))`);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
appCustomizers = yield spo_1.spo.getCustomActions(options.webUrl, resolvedScope, `(ClientSideComponentId eq guid'${options.clientSideComponentId}') and (startswith(Location,'ClientSideExtension.ApplicationCustomizer'))`);
|
|
94
|
+
}
|
|
95
|
+
if (appCustomizers.length === 0) {
|
|
96
|
+
throw `No application customizer with ${options.title && `title '${options.title}'` || options.clientSideComponentId && `ClientSideComponentId '${options.clientSideComponentId}'` || options.id && `id '${options.id}'`} found`;
|
|
97
|
+
}
|
|
98
|
+
if (appCustomizers.length > 1) {
|
|
99
|
+
throw `Multiple application customizer with ${options.title ? `title '${options.title}'` : `ClientSideComponentId '${options.clientSideComponentId}'`} found. Please disambiguate using IDs: ${os.EOL}${appCustomizers.map(a => `- ${a.Id}`).join(os.EOL)}`;
|
|
100
|
+
}
|
|
101
|
+
return appCustomizers[0];
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
_SpoApplicationCustomizerRemoveCommand_instances = new WeakSet(), _SpoApplicationCustomizerRemoveCommand_initOptions = function _SpoApplicationCustomizerRemoveCommand_initOptions() {
|
|
106
|
+
this.options.unshift({
|
|
107
|
+
option: '-u, --webUrl <webUrl>'
|
|
108
|
+
}, {
|
|
109
|
+
option: '-t, --title [title]'
|
|
110
|
+
}, {
|
|
111
|
+
option: '-i, --id [id]'
|
|
112
|
+
}, {
|
|
113
|
+
option: '-c, --clientSideComponentId [clientSideComponentId]'
|
|
114
|
+
}, {
|
|
115
|
+
option: '-s, --scope [scope]', autocomplete: this.allowedScopes
|
|
116
|
+
}, {
|
|
117
|
+
option: '--confirm'
|
|
118
|
+
});
|
|
119
|
+
}, _SpoApplicationCustomizerRemoveCommand_initTelemetry = function _SpoApplicationCustomizerRemoveCommand_initTelemetry() {
|
|
120
|
+
this.telemetry.push((args) => {
|
|
121
|
+
Object.assign(this.telemetryProperties, {
|
|
122
|
+
title: typeof args.options.title !== 'undefined',
|
|
123
|
+
id: typeof args.options.id !== 'undefined',
|
|
124
|
+
clientSideComponentId: typeof args.options.clientSideComponentId !== 'undefined',
|
|
125
|
+
scope: typeof args.options.scope !== 'undefined',
|
|
126
|
+
confirm: !!args.options.confirm
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
}, _SpoApplicationCustomizerRemoveCommand_initValidators = function _SpoApplicationCustomizerRemoveCommand_initValidators() {
|
|
130
|
+
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
131
|
+
if (args.options.id && !validation_1.validation.isValidGuid(args.options.id)) {
|
|
132
|
+
return `${args.options.id} is not a valid GUID`;
|
|
133
|
+
}
|
|
134
|
+
if (args.options.clientSideComponentId && !validation_1.validation.isValidGuid(args.options.clientSideComponentId)) {
|
|
135
|
+
return `${args.options.clientSideComponentId} is not a valid GUID`;
|
|
136
|
+
}
|
|
137
|
+
if (args.options.scope && this.allowedScopes.indexOf(args.options.scope) === -1) {
|
|
138
|
+
return `'${args.options.scope}' is not a valid application customizer scope. Allowed values are: ${this.allowedScopes.join(',')}`;
|
|
139
|
+
}
|
|
140
|
+
return validation_1.validation.isValidSharePointUrl(args.options.webUrl);
|
|
141
|
+
}));
|
|
142
|
+
}, _SpoApplicationCustomizerRemoveCommand_initOptionSets = function _SpoApplicationCustomizerRemoveCommand_initOptionSets() {
|
|
143
|
+
this.optionSets.push({ options: ['id', 'title', 'clientSideComponentId'] });
|
|
144
|
+
};
|
|
145
|
+
module.exports = new SpoApplicationCustomizerRemoveCommand();
|
|
146
|
+
//# sourceMappingURL=applicationcustomizer-remove.js.map
|
|
@@ -17,6 +17,7 @@ var _SpoFileCheckinCommand_instances, _SpoFileCheckinCommand_initTelemetry, _Spo
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
const request_1 = require("../../../../request");
|
|
19
19
|
const formatting_1 = require("../../../../utils/formatting");
|
|
20
|
+
const urlUtil_1 = require("../../../../utils/urlUtil");
|
|
20
21
|
const validation_1 = require("../../../../utils/validation");
|
|
21
22
|
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
22
23
|
const commands_1 = require("../../commands");
|
|
@@ -41,6 +42,9 @@ class SpoFileCheckinCommand extends SpoCommand_1.default {
|
|
|
41
42
|
__classPrivateFieldGet(this, _SpoFileCheckinCommand_instances, "m", _SpoFileCheckinCommand_initValidators).call(this);
|
|
42
43
|
__classPrivateFieldGet(this, _SpoFileCheckinCommand_instances, "m", _SpoFileCheckinCommand_initOptionSets).call(this);
|
|
43
44
|
}
|
|
45
|
+
getExcludedOptionsWithUrls() {
|
|
46
|
+
return ['url'];
|
|
47
|
+
}
|
|
44
48
|
commandAction(logger, args) {
|
|
45
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46
50
|
let type = CheckinType.Major;
|
|
@@ -62,7 +66,8 @@ class SpoFileCheckinCommand extends SpoCommand_1.default {
|
|
|
62
66
|
requestUrl = `${args.options.webUrl}/_api/web/GetFileById('${formatting_1.formatting.encodeQueryParameter(args.options.id)}')/checkin(comment='${comment}',checkintype=${type})`;
|
|
63
67
|
}
|
|
64
68
|
if (args.options.url) {
|
|
65
|
-
|
|
69
|
+
const serverRelativePath = urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.url);
|
|
70
|
+
requestUrl = `${args.options.webUrl}/_api/web/GetFileByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(serverRelativePath)}')/checkin(comment='${comment}',checkintype=${type})`;
|
|
66
71
|
}
|
|
67
72
|
const requestOptions = {
|
|
68
73
|
url: requestUrl,
|
|
@@ -83,8 +88,8 @@ class SpoFileCheckinCommand extends SpoCommand_1.default {
|
|
|
83
88
|
_SpoFileCheckinCommand_instances = new WeakSet(), _SpoFileCheckinCommand_initTelemetry = function _SpoFileCheckinCommand_initTelemetry() {
|
|
84
89
|
this.telemetry.push((args) => {
|
|
85
90
|
Object.assign(this.telemetryProperties, {
|
|
86
|
-
id:
|
|
87
|
-
url:
|
|
91
|
+
id: typeof args.options.id !== 'undefined',
|
|
92
|
+
url: typeof args.options.url !== 'undefined',
|
|
88
93
|
type: args.options.type || 'Major',
|
|
89
94
|
comment: typeof args.options.comment !== 'undefined'
|
|
90
95
|
});
|
|
@@ -17,6 +17,7 @@ var _SpoFileCheckoutCommand_instances, _SpoFileCheckoutCommand_initTelemetry, _S
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
const request_1 = require("../../../../request");
|
|
19
19
|
const formatting_1 = require("../../../../utils/formatting");
|
|
20
|
+
const urlUtil_1 = require("../../../../utils/urlUtil");
|
|
20
21
|
const validation_1 = require("../../../../utils/validation");
|
|
21
22
|
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
22
23
|
const commands_1 = require("../../commands");
|
|
@@ -35,6 +36,9 @@ class SpoFileCheckoutCommand extends SpoCommand_1.default {
|
|
|
35
36
|
__classPrivateFieldGet(this, _SpoFileCheckoutCommand_instances, "m", _SpoFileCheckoutCommand_initValidators).call(this);
|
|
36
37
|
__classPrivateFieldGet(this, _SpoFileCheckoutCommand_instances, "m", _SpoFileCheckoutCommand_initOptionSets).call(this);
|
|
37
38
|
}
|
|
39
|
+
getExcludedOptionsWithUrls() {
|
|
40
|
+
return ['url'];
|
|
41
|
+
}
|
|
38
42
|
commandAction(logger, args) {
|
|
39
43
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40
44
|
let requestUrl = '';
|
|
@@ -42,7 +46,8 @@ class SpoFileCheckoutCommand extends SpoCommand_1.default {
|
|
|
42
46
|
requestUrl = `${args.options.webUrl}/_api/web/GetFileById('${formatting_1.formatting.encodeQueryParameter(args.options.id)}')/checkout`;
|
|
43
47
|
}
|
|
44
48
|
if (args.options.url) {
|
|
45
|
-
|
|
49
|
+
const serverRelativePath = urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.url);
|
|
50
|
+
requestUrl = `${args.options.webUrl}/_api/web/GetFileByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(serverRelativePath)}')/checkout`;
|
|
46
51
|
}
|
|
47
52
|
const requestOptions = {
|
|
48
53
|
url: requestUrl,
|
|
@@ -63,8 +68,8 @@ class SpoFileCheckoutCommand extends SpoCommand_1.default {
|
|
|
63
68
|
_SpoFileCheckoutCommand_instances = new WeakSet(), _SpoFileCheckoutCommand_initTelemetry = function _SpoFileCheckoutCommand_initTelemetry() {
|
|
64
69
|
this.telemetry.push((args) => {
|
|
65
70
|
Object.assign(this.telemetryProperties, {
|
|
66
|
-
id:
|
|
67
|
-
url:
|
|
71
|
+
id: typeof args.options.id !== 'undefined',
|
|
72
|
+
url: typeof args.options.url !== 'undefined'
|
|
68
73
|
});
|
|
69
74
|
});
|
|
70
75
|
}, _SpoFileCheckoutCommand_initOptions = function _SpoFileCheckoutCommand_initOptions() {
|
|
@@ -38,10 +38,7 @@ class SpoFileCopyCommand extends SpoCommand_1.default {
|
|
|
38
38
|
commandAction(logger, args) {
|
|
39
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40
40
|
try {
|
|
41
|
-
|
|
42
|
-
logger.logToStderr(`Copying file '${args.options.sourceUrl}' to '${args.options.targetUrl}'...`);
|
|
43
|
-
}
|
|
44
|
-
const sourcePath = this.getAbsoluteUrl(args.options.webUrl, args.options.sourceUrl);
|
|
41
|
+
const sourcePath = this.getAbsoluteUrl(args.options.webUrl, urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.sourceUrl));
|
|
45
42
|
let destinationPath = this.getAbsoluteUrl(args.options.webUrl, args.options.targetUrl) + '/';
|
|
46
43
|
if (args.options.newName) {
|
|
47
44
|
destinationPath += args.options.newName;
|
|
@@ -50,6 +47,9 @@ class SpoFileCopyCommand extends SpoCommand_1.default {
|
|
|
50
47
|
// Keep the original file name
|
|
51
48
|
destinationPath += sourcePath.substring(sourcePath.lastIndexOf('/') + 1);
|
|
52
49
|
}
|
|
50
|
+
if (this.verbose) {
|
|
51
|
+
logger.logToStderr(`Copying file '${sourcePath}' to '${destinationPath}'...`);
|
|
52
|
+
}
|
|
53
53
|
const requestOptions = {
|
|
54
54
|
url: `${args.options.webUrl}/_api/SP.MoveCopyUtil.CopyFileByPath`,
|
|
55
55
|
headers: {
|
|
@@ -19,6 +19,7 @@ const fs = require("fs");
|
|
|
19
19
|
const path = require("path");
|
|
20
20
|
const request_1 = require("../../../../request");
|
|
21
21
|
const formatting_1 = require("../../../../utils/formatting");
|
|
22
|
+
const urlUtil_1 = require("../../../../utils/urlUtil");
|
|
22
23
|
const validation_1 = require("../../../../utils/validation");
|
|
23
24
|
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
24
25
|
const commands_1 = require("../../commands");
|
|
@@ -66,7 +67,8 @@ class SpoFileGetCommand extends SpoCommand_1.default {
|
|
|
66
67
|
else {
|
|
67
68
|
options += '&';
|
|
68
69
|
}
|
|
69
|
-
|
|
70
|
+
const serverRelativePath = urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.url);
|
|
71
|
+
options += `@f='${formatting_1.formatting.encodeQueryParameter(serverRelativePath)}'`;
|
|
70
72
|
}
|
|
71
73
|
const requestOptions = {
|
|
72
74
|
url: requestUrl + options,
|
|
@@ -13,10 +13,11 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
13
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
14
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
15
15
|
};
|
|
16
|
-
var _SpoFileListCommand_instances, _SpoFileListCommand_initTelemetry, _SpoFileListCommand_initOptions, _SpoFileListCommand_initValidators;
|
|
16
|
+
var _SpoFileListCommand_instances, _SpoFileListCommand_initTelemetry, _SpoFileListCommand_initOptions, _SpoFileListCommand_initValidators, _SpoFileListCommand_initOptionSets;
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
const request_1 = require("../../../../request");
|
|
19
19
|
const formatting_1 = require("../../../../utils/formatting");
|
|
20
|
+
const urlUtil_1 = require("../../../../utils/urlUtil");
|
|
20
21
|
const validation_1 = require("../../../../utils/validation");
|
|
21
22
|
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
22
23
|
const commands_1 = require("../../commands");
|
|
@@ -33,69 +34,155 @@ class SpoFileListCommand extends SpoCommand_1.default {
|
|
|
33
34
|
__classPrivateFieldGet(this, _SpoFileListCommand_instances, "m", _SpoFileListCommand_initTelemetry).call(this);
|
|
34
35
|
__classPrivateFieldGet(this, _SpoFileListCommand_instances, "m", _SpoFileListCommand_initOptions).call(this);
|
|
35
36
|
__classPrivateFieldGet(this, _SpoFileListCommand_instances, "m", _SpoFileListCommand_initValidators).call(this);
|
|
37
|
+
__classPrivateFieldGet(this, _SpoFileListCommand_instances, "m", _SpoFileListCommand_initOptionSets).call(this);
|
|
36
38
|
}
|
|
37
39
|
commandAction(logger, args) {
|
|
38
40
|
return __awaiter(this, void 0, void 0, function* () {
|
|
39
41
|
if (this.verbose) {
|
|
40
|
-
logger.logToStderr(`Retrieving all files in folder ${args.options.folder} at site ${args.options.webUrl}...`);
|
|
42
|
+
logger.logToStderr(`Retrieving all files in folder '${args.options.folder}' at site '${args.options.webUrl}'${args.options.recursive ? ' (recursive)' : ''}...`);
|
|
41
43
|
}
|
|
42
44
|
try {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
if (args.options.folder) {
|
|
46
|
+
args.options.folderUrl = args.options.folder;
|
|
47
|
+
this.warn(logger, `Option 'folder' is deprecated. Please use 'folderUrl' instead`);
|
|
48
|
+
}
|
|
49
|
+
const fieldProperties = this.formatSelectProperties(args.options.fields, args.options.output);
|
|
50
|
+
const allFiles = [];
|
|
51
|
+
const allFolders = args.options.recursive
|
|
52
|
+
? [...yield this.getFolders(args.options.folderUrl, args, logger), args.options.folderUrl]
|
|
53
|
+
: [args.options.folderUrl];
|
|
54
|
+
for (const folder of allFolders) {
|
|
55
|
+
const files = yield this.getFiles(folder, fieldProperties, args, logger);
|
|
56
|
+
files.forEach((file) => allFiles.push(file));
|
|
57
|
+
}
|
|
58
|
+
// Clean ListItemAllFields.ID property from the output if included
|
|
59
|
+
// Reason: It causes a casing conflict with 'Id' when parsing JSON in PowerShell
|
|
60
|
+
if (fieldProperties.selectProperties.some(p => p.toLowerCase().indexOf('listitemallfields') > -1)) {
|
|
61
|
+
allFiles.filter(file => { var _a; return ((_a = file.ListItemAllFields) === null || _a === void 0 ? void 0 : _a.ID) !== undefined; }).forEach(file => delete file.ListItemAllFields['ID']);
|
|
62
|
+
}
|
|
63
|
+
logger.log(allFiles);
|
|
45
64
|
}
|
|
46
65
|
catch (err) {
|
|
47
66
|
this.handleRejectedODataJsonPromise(err);
|
|
48
67
|
}
|
|
49
68
|
});
|
|
50
69
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
70
|
+
getFiles(folderUrl, fieldProperties, args, logger, skip = 0) {
|
|
71
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
+
if (this.verbose) {
|
|
73
|
+
const page = Math.ceil(skip / SpoFileListCommand.pageSize) + 1;
|
|
74
|
+
logger.logToStderr(`Retrieving files in folder '${folderUrl}'${page > 1 ? ', page ' + page : ''}...`);
|
|
75
|
+
}
|
|
76
|
+
const allFiles = [];
|
|
77
|
+
const serverRelativePath = urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, folderUrl);
|
|
78
|
+
const requestUrl = `${args.options.webUrl}/_api/web/GetFolderByServerRelativeUrl(@url)/Files?@url='${formatting_1.formatting.encodeQueryParameter(serverRelativePath)}'`;
|
|
79
|
+
const queryParams = [`$skip=${skip}`, `$top=${SpoFileListCommand.pageSize}`];
|
|
80
|
+
if (fieldProperties.expandProperties.length > 0) {
|
|
81
|
+
queryParams.push(`$expand=${fieldProperties.expandProperties.join(',')}`);
|
|
82
|
+
}
|
|
83
|
+
if (fieldProperties.selectProperties.length > 0) {
|
|
84
|
+
queryParams.push(`$select=${fieldProperties.selectProperties.join(',')}`);
|
|
85
|
+
}
|
|
86
|
+
if (args.options.filter) {
|
|
87
|
+
queryParams.push(`$filter=${args.options.filter}`);
|
|
88
|
+
}
|
|
89
|
+
const requestOptions = {
|
|
90
|
+
url: `${requestUrl}&${queryParams.join('&')}`,
|
|
91
|
+
method: 'GET',
|
|
92
|
+
headers: {
|
|
93
|
+
'accept': 'application/json;odata=nometadata'
|
|
94
|
+
},
|
|
95
|
+
responseType: 'json'
|
|
96
|
+
};
|
|
97
|
+
const response = yield request_1.default.get(requestOptions);
|
|
98
|
+
response.value.forEach(file => allFiles.push(file));
|
|
99
|
+
if (response.value.length === SpoFileListCommand.pageSize) {
|
|
100
|
+
const files = yield this.getFiles(folderUrl, fieldProperties, args, logger, skip + SpoFileListCommand.pageSize);
|
|
101
|
+
files.forEach(file => allFiles.push(file));
|
|
102
|
+
}
|
|
103
|
+
return allFiles;
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
getFolders(folderUrl, args, logger, skip = 0) {
|
|
107
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
108
|
+
if (this.verbose) {
|
|
109
|
+
const page = Math.ceil(skip / SpoFileListCommand.pageSize) + 1;
|
|
110
|
+
logger.logToStderr(`Retrieving folders in folder '${folderUrl}'${page > 1 ? ', page ' + page : ''}...`);
|
|
111
|
+
}
|
|
112
|
+
const allFolders = [];
|
|
113
|
+
const serverRelativeUrl = urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, folderUrl);
|
|
114
|
+
const requestUrl = `${args.options.webUrl}/_api/web/GetFolderByServerRelativeUrl(@url)/Folders?@url='${formatting_1.formatting.encodeQueryParameter(serverRelativeUrl)}'`;
|
|
115
|
+
const requestOptions = {
|
|
116
|
+
url: `${requestUrl}&$skip=${skip}&$top=${SpoFileListCommand.pageSize}&$select=ServerRelativeUrl`,
|
|
117
|
+
method: 'GET',
|
|
118
|
+
headers: {
|
|
119
|
+
'accept': 'application/json;odata=nometadata'
|
|
120
|
+
},
|
|
121
|
+
responseType: 'json'
|
|
122
|
+
};
|
|
123
|
+
const response = yield request_1.default.get(requestOptions);
|
|
124
|
+
for (const folder of response.value) {
|
|
125
|
+
allFolders.push(folder.ServerRelativeUrl);
|
|
126
|
+
const subfolders = yield this.getFolders(folder.ServerRelativeUrl, args, logger);
|
|
127
|
+
subfolders.forEach(folder => allFolders.push(folder));
|
|
76
128
|
}
|
|
77
|
-
|
|
78
|
-
|
|
129
|
+
if (response.value.length === SpoFileListCommand.pageSize) {
|
|
130
|
+
const folders = yield this.getFolders(folderUrl, args, logger, skip + SpoFileListCommand.pageSize);
|
|
131
|
+
folders.forEach(folder => allFolders.push(folder));
|
|
79
132
|
}
|
|
80
|
-
|
|
133
|
+
return allFolders;
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
formatSelectProperties(fields, output) {
|
|
137
|
+
let selectProperties = [];
|
|
138
|
+
const expandProperties = [];
|
|
139
|
+
if (output === 'text' && !fields) {
|
|
140
|
+
selectProperties = ['UniqueId', 'Name', 'ServerRelativeUrl'];
|
|
141
|
+
}
|
|
142
|
+
if (fields) {
|
|
143
|
+
fields.split(',').forEach((field) => {
|
|
144
|
+
const subparts = field.trim().split('/');
|
|
145
|
+
if (subparts.length > 1) {
|
|
146
|
+
expandProperties.push(subparts[0]);
|
|
147
|
+
}
|
|
148
|
+
selectProperties.push(field.trim());
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
return {
|
|
152
|
+
selectProperties: [...new Set(selectProperties)],
|
|
153
|
+
expandProperties: [...new Set(expandProperties)]
|
|
154
|
+
};
|
|
81
155
|
}
|
|
82
156
|
}
|
|
83
157
|
_SpoFileListCommand_instances = new WeakSet(), _SpoFileListCommand_initTelemetry = function _SpoFileListCommand_initTelemetry() {
|
|
84
158
|
this.telemetry.push((args) => {
|
|
85
159
|
Object.assign(this.telemetryProperties, {
|
|
86
|
-
|
|
160
|
+
folder: typeof args.options.folder !== 'undefined',
|
|
161
|
+
folderUrl: typeof args.options.folderUrl !== 'undefined',
|
|
162
|
+
recursive: args.options.recursive,
|
|
163
|
+
fields: typeof args.options.fields !== 'undefined',
|
|
164
|
+
filter: typeof args.options.filter !== 'undefined'
|
|
87
165
|
});
|
|
88
166
|
});
|
|
89
167
|
}, _SpoFileListCommand_initOptions = function _SpoFileListCommand_initOptions() {
|
|
90
168
|
this.options.unshift({
|
|
91
169
|
option: '-u, --webUrl <webUrl>'
|
|
92
170
|
}, {
|
|
93
|
-
option: '-f, --folder
|
|
171
|
+
option: '-f, --folder [folder]'
|
|
172
|
+
}, {
|
|
173
|
+
option: '-f, --folderUrl [folderUrl]'
|
|
174
|
+
}, {
|
|
175
|
+
option: '--fields [fields]'
|
|
176
|
+
}, {
|
|
177
|
+
option: '--filter [filter]'
|
|
94
178
|
}, {
|
|
95
179
|
option: '-r, --recursive'
|
|
96
180
|
});
|
|
97
181
|
}, _SpoFileListCommand_initValidators = function _SpoFileListCommand_initValidators() {
|
|
98
182
|
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () { return validation_1.validation.isValidSharePointUrl(args.options.webUrl); }));
|
|
183
|
+
}, _SpoFileListCommand_initOptionSets = function _SpoFileListCommand_initOptionSets() {
|
|
184
|
+
this.optionSets.push({ options: ['folder', 'folderUrl'] });
|
|
99
185
|
};
|
|
186
|
+
SpoFileListCommand.pageSize = 5000;
|
|
100
187
|
module.exports = new SpoFileListCommand();
|
|
101
188
|
//# sourceMappingURL=file-list.js.map
|