@pnp/cli-microsoft365 6.9.0-beta.6a23aba → 6.9.0-beta.8393174
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 +12 -19
- package/.devcontainer/devcontainer.json +24 -17
- package/Dockerfile +3 -1
- package/dist/Auth.js +2 -8
- package/dist/AuthServer.js +2 -4
- package/dist/cli/Cli.js +16 -0
- package/dist/m365/aad/commands/app/app-add.js +258 -249
- package/dist/m365/aad/commands/app/app-get.js +65 -62
- package/dist/m365/aad/commands/app/app-remove.js +22 -23
- package/dist/m365/aad/commands/app/app-role-add.js +35 -34
- package/dist/m365/aad/commands/app/app-role-list.js +22 -23
- package/dist/m365/aad/commands/app/app-role-remove.js +76 -73
- package/dist/m365/aad/commands/app/app-set.js +103 -103
- package/dist/m365/aad/commands/approleassignment/approleassignment-add.js +16 -14
- package/dist/m365/aad/commands/approleassignment/approleassignment-list.js +43 -52
- package/dist/m365/aad/commands/approleassignment/approleassignment-remove.js +20 -16
- package/dist/m365/aad/commands/o365group/o365group-add.js +40 -37
- package/dist/m365/aad/commands/o365group/o365group-conversation-post-list.js +7 -6
- package/dist/m365/aad/commands/o365group/o365group-list.js +6 -11
- package/dist/m365/aad/commands/o365group/o365group-recyclebinitem-clear.js +7 -8
- package/dist/m365/aad/commands/o365group/o365group-recyclebinitem-restore.js +23 -24
- package/dist/m365/aad/commands/o365group/o365group-set.js +15 -20
- package/dist/m365/aad/commands/o365group/o365group-teamify.js +15 -16
- package/dist/m365/aad/commands/o365group/o365group-user-list.js +17 -10
- package/dist/m365/aad/commands/o365group/o365group-user-set.js +17 -10
- package/dist/m365/aad/commands/policy/policy-list.js +12 -13
- package/dist/m365/aad/commands/siteclassification/siteclassification-enable.js +1 -3
- package/dist/m365/aad/commands/siteclassification/siteclassification-set.js +19 -20
- package/dist/m365/aad/commands/sp/sp-add.js +22 -23
- package/dist/m365/aad/commands/sp/sp-get.js +22 -23
- package/dist/m365/app/commands/app-open.js +4 -14
- package/dist/m365/cli/commands/cli-issue.js +4 -10
- package/dist/m365/cli/commands/cli-reconsent.js +2 -8
- package/dist/m365/cli/commands/config/config-set.js +1 -0
- package/dist/m365/commands/docs.js +2 -8
- package/dist/m365/commands/login.js +20 -0
- package/dist/m365/commands/setupPresets.js +2 -0
- package/dist/m365/file/commands/convert/convert-pdf.js +147 -143
- package/dist/m365/file/commands/file-add.js +87 -93
- package/dist/m365/file/commands/file-list.js +49 -55
- package/dist/m365/flow/commands/flow-list.js +4 -4
- package/dist/m365/flow/commands/flow-remove.js +2 -3
- package/dist/m365/flow/commands/run/run-resubmit.js +11 -10
- package/dist/m365/onedrive/commands/onedrive-list.js +21 -32
- package/dist/m365/outlook/commands/message/message-list.js +18 -23
- package/dist/m365/outlook/commands/message/message-move.js +15 -20
- package/dist/m365/pa/commands/app/app-export.js +3 -4
- package/dist/m365/pa/commands/app/app-get.js +11 -9
- package/dist/m365/pa/commands/app/app-remove.js +1 -1
- package/dist/m365/pa/commands/pcf/pcf-init.js +1 -2
- package/dist/m365/pa/commands/solution/solution-init.js +1 -2
- package/dist/m365/pa/commands/solution/solution-reference-add.js +1 -2
- package/dist/m365/planner/commands/bucket/bucket-add.js +15 -13
- package/dist/m365/planner/commands/bucket/bucket-get.js +27 -28
- package/dist/m365/planner/commands/bucket/bucket-list.js +15 -13
- package/dist/m365/planner/commands/bucket/bucket-remove.js +33 -34
- package/dist/m365/planner/commands/bucket/bucket-set.js +33 -34
- package/dist/m365/planner/commands/plan/plan-add.js +49 -52
- package/dist/m365/planner/commands/plan/plan-set.js +19 -20
- package/dist/m365/planner/commands/task/task-add.js +75 -78
- package/dist/m365/planner/commands/task/task-checklistitem-add.js +11 -10
- package/dist/m365/planner/commands/task/task-checklistitem-remove.js +10 -8
- package/dist/m365/planner/commands/task/task-get.js +53 -56
- package/dist/m365/planner/commands/task/task-list.js +23 -24
- package/dist/m365/planner/commands/task/task-reference-add.js +11 -10
- package/dist/m365/planner/commands/task/task-reference-remove.js +13 -14
- package/dist/m365/planner/commands/task/task-remove.js +44 -48
- package/dist/m365/planner/commands/task/task-set.js +83 -87
- package/dist/m365/pp/commands/card/card-get.js +6 -1
- package/dist/m365/purview/commands/retentionevent/retentionevent-add.js +0 -5
- package/dist/m365/purview/commands/retentionevent/retentionevent-get.js +0 -5
- package/dist/m365/purview/commands/retentionevent/retentionevent-list.js +0 -5
- package/dist/m365/purview/commands/retentionevent/retentionevent-remove.js +0 -5
- package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-add.js +0 -5
- package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-get.js +0 -5
- package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-list.js +0 -5
- package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-remove.js +0 -5
- package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-set.js +0 -5
- package/dist/m365/purview/commands/retentionlabel/retentionlabel-add.js +0 -5
- package/dist/m365/purview/commands/retentionlabel/retentionlabel-get.js +0 -5
- package/dist/m365/purview/commands/retentionlabel/retentionlabel-list.js +0 -5
- package/dist/m365/purview/commands/retentionlabel/retentionlabel-remove.js +19 -22
- package/dist/m365/purview/commands/retentionlabel/retentionlabel-set.js +0 -5
- package/dist/m365/spfx/commands/project/JsonRule.js +1 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN021003_PKG_engines_node.js +1 -0
- package/dist/m365/spo/commands/app/app-teamspackage-download.js +17 -24
- package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-set.js +154 -0
- package/dist/m365/spo/commands/commandset/commandset-set.js +11 -2
- package/dist/m365/spo/commands/file/file-checkout-undo.js +119 -0
- package/dist/m365/spo/commands/homesite/homesite-remove.js +1 -1
- package/dist/m365/spo/commands/list/list-sensitivitylabel-ensure.js +127 -0
- package/dist/m365/spo/commands/navigation/navigation-node-add.js +31 -1
- package/dist/m365/spo/commands/navigation/navigation-node-set.js +31 -2
- package/dist/m365/{teams/Message.js → spo/commands/tenant/Solution.js} +1 -1
- package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-set.js +156 -0
- package/dist/m365/spo/commands/tenant/tenant-commandset-add.js +215 -0
- package/dist/m365/spo/commands/tenant/tenant-commandset-get.js +114 -0
- package/dist/m365/spo/commands/tenant/tenant-commandset-list.js +50 -0
- package/dist/m365/spo/commands/tenant/tenant-commandset-set.js +1 -1
- package/dist/m365/spo/commands.js +7 -0
- package/dist/m365/util/commands/accesstoken/accesstoken-get.js +10 -7
- package/dist/settingsNames.js +1 -0
- package/dist/utils/browserUtil.js +23 -0
- package/dist/utils/md.js +1 -3
- package/dist/utils/spo.js +60 -0
- package/docs/docs/cmd/aad/app/app-add.mdx +113 -0
- package/docs/docs/cmd/aad/app/app-get.mdx +217 -0
- package/docs/docs/cmd/aad/app/app-list.mdx +21 -0
- package/docs/docs/cmd/aad/app/app-role-add.mdx +4 -0
- package/docs/docs/cmd/aad/app/app-role-list.mdx +63 -0
- package/docs/docs/cmd/aad/app/app-role-remove.mdx +4 -0
- package/docs/docs/cmd/aad/app/app-set.mdx +4 -0
- package/docs/docs/cmd/aad/approleassignment/approleassignment-add.mdx +61 -0
- package/docs/docs/cmd/aad/approleassignment/approleassignment-list.mdx +59 -0
- package/docs/docs/cmd/aad/approleassignment/approleassignment-remove.mdx +4 -0
- package/docs/docs/cmd/aad/group/group-get.mdx +24 -0
- package/docs/docs/cmd/aad/group/group-list.mdx +98 -0
- package/docs/docs/cmd/aad/groupsetting/groupsetting-add.mdx +114 -0
- package/docs/docs/cmd/aad/groupsetting/groupsetting-get.mdx +115 -0
- package/docs/docs/cmd/aad/groupsetting/groupsetting-list.mdx +115 -0
- package/docs/docs/cmd/aad/groupsetting/groupsetting-remove.mdx +4 -0
- package/docs/docs/cmd/aad/groupsetting/groupsetting-set.mdx +4 -0
- package/docs/docs/cmd/aad/groupsettingtemplate/groupsettingtemplate-get.mdx +63 -0
- package/docs/docs/cmd/aad/groupsettingtemplate/groupsettingtemplate-list.mdx +63 -0
- package/docs/docs/cmd/aad/o365group/o365group-add.mdx +122 -0
- package/docs/docs/cmd/aad/o365group/o365group-conversation-list.mdx +68 -0
- package/docs/docs/cmd/aad/o365group/o365group-conversation-post-list.mdx +77 -0
- package/docs/docs/cmd/aad/o365group/o365group-get.mdx +122 -0
- package/docs/docs/cmd/aad/o365group/o365group-list.mdx +99 -0
- package/docs/docs/cmd/aad/o365group/o365group-recyclebinitem-clear.mdx +4 -0
- package/docs/docs/cmd/aad/o365group/o365group-recyclebinitem-list.mdx +96 -0
- package/docs/docs/cmd/aad/o365group/o365group-recyclebinitem-remove.mdx +4 -0
- package/docs/docs/cmd/aad/o365group/o365group-recyclebinitem-restore.mdx +4 -0
- package/docs/docs/cmd/aad/o365group/o365group-remove.mdx +4 -0
- package/docs/docs/cmd/aad/o365group/o365group-renew.mdx +4 -0
- package/docs/docs/cmd/aad/o365group/o365group-report-activitycounts.mdx +48 -0
- package/docs/docs/cmd/aad/o365group/o365group-report-activitydetail.mdx +60 -0
- package/docs/docs/cmd/aad/o365group/o365group-report-activityfilecounts.mdx +46 -0
- package/docs/docs/cmd/aad/o365group/o365group-report-activitygroupcounts.mdx +46 -0
- package/docs/docs/cmd/aad/o365group/o365group-report-activitystorage.mdx +46 -0
- package/docs/docs/cmd/aad/o365group/o365group-set.mdx +4 -0
- package/docs/docs/cmd/aad/o365group/o365group-teamify.mdx +4 -0
- package/docs/docs/cmd/aad/o365group/o365group-user-add.mdx +4 -0
- package/docs/docs/cmd/aad/o365group/o365group-user-list.mdx +56 -0
- package/docs/docs/cmd/aad/o365group/o365group-user-remove.mdx +4 -0
- package/docs/docs/cmd/aad/o365group/o365group-user-set.mdx +8 -4
- package/docs/docs/cmd/aad/oauth2grant/oauth2grant-add.mdx +4 -0
- package/docs/docs/cmd/aad/oauth2grant/oauth2grant-list.mdx +59 -0
- package/docs/docs/cmd/aad/oauth2grant/oauth2grant-remove.mdx +4 -0
- package/docs/docs/cmd/aad/oauth2grant/oauth2grant-set.mdx +4 -0
- package/docs/docs/cmd/aad/policy/policy-list.mdx +77 -0
- package/docs/docs/cmd/aad/siteclassification/siteclassification-disable.mdx +4 -0
- package/docs/docs/cmd/aad/siteclassification/siteclassification-enable.mdx +4 -0
- package/docs/docs/cmd/aad/siteclassification/siteclassification-get.mdx +57 -0
- package/docs/docs/cmd/aad/siteclassification/siteclassification-set.mdx +4 -0
- package/docs/docs/cmd/aad/sp/sp-add.mdx +136 -0
- package/docs/docs/cmd/aad/sp/sp-get.mdx +166 -0
- package/docs/docs/cmd/aad/user/user-get.mdx +75 -0
- package/docs/docs/cmd/aad/user/user-guest-add.mdx +23 -0
- package/docs/docs/cmd/aad/user/user-hibp.mdx +82 -0
- package/docs/docs/cmd/aad/user/user-license-add.mdx +2 -2
- package/docs/docs/cmd/aad/user/user-license-remove.mdx +2 -2
- package/docs/docs/cmd/aad/user/user-list.mdx +52 -0
- package/docs/docs/cmd/aad/user/user-password-validate.mdx +67 -0
- package/docs/docs/cmd/aad/user/user-signin-list.mdx +131 -0
- package/docs/docs/cmd/flow/flow-list.mdx +11 -3
- package/docs/docs/cmd/flow/run/run-list.mdx +0 -3
- package/docs/docs/cmd/login.mdx +39 -0
- package/docs/docs/cmd/purview/retentionevent/retentionevent-add.mdx +0 -6
- package/docs/docs/cmd/purview/retentionevent/retentionevent-get.mdx +0 -6
- package/docs/docs/cmd/purview/retentionevent/retentionevent-list.mdx +0 -7
- package/docs/docs/cmd/purview/retentionevent/retentionevent-remove.mdx +0 -6
- package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-add.mdx +0 -6
- package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-get.mdx +0 -6
- package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-list.mdx +0 -6
- package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-remove.mdx +0 -6
- package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-set.mdx +0 -6
- package/docs/docs/cmd/purview/retentionlabel/retentionlabel-add.mdx +0 -6
- package/docs/docs/cmd/purview/retentionlabel/retentionlabel-get.mdx +0 -6
- package/docs/docs/cmd/purview/retentionlabel/retentionlabel-list.mdx +0 -6
- package/docs/docs/cmd/purview/retentionlabel/retentionlabel-remove.mdx +0 -6
- package/docs/docs/cmd/purview/retentionlabel/retentionlabel-set.mdx +0 -6
- package/docs/docs/cmd/setup.mdx +2 -0
- package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-set.mdx +72 -0
- package/docs/docs/cmd/spo/commandset/commandset-set.mdx +12 -3
- package/docs/docs/cmd/spo/file/file-checkout-undo.mdx +55 -0
- package/docs/docs/cmd/spo/list/list-sensitivitylabel-ensure.mdx +64 -0
- package/docs/docs/cmd/spo/navigation/navigation-node-add.mdx +7 -4
- package/docs/docs/cmd/spo/navigation/navigation-node-set.mdx +9 -0
- package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-set.mdx +81 -0
- package/docs/docs/cmd/spo/tenant/tenant-commandset-add.mdx +183 -0
- package/docs/docs/cmd/spo/tenant/tenant-commandset-get.mdx +155 -0
- package/docs/docs/cmd/spo/tenant/tenant-commandset-list.mdx +114 -0
- package/docs/docs/cmd/spo/tenant/tenant-commandset-set.mdx +1 -1
- package/docs/docs/cmd/status.mdx +6 -3
- package/docs/docs/cmd/util/accesstoken/accesstoken-get.mdx +12 -2
- package/npm-shrinkwrap.json +299 -272
- package/package.json +17 -17
- package/dist/m365/aad/commands/approleassignment/AppRoleAssignment.js +0 -3
- package/dist/m365/aad/commands/approleassignment/ServicePrincipal.js +0 -3
- package/dist/m365/aad/commands/groupsetting/GroupSetting.js +0 -3
- package/dist/m365/aad/commands/groupsettingtemplate/GroupSettingTemplate.js +0 -3
- package/dist/m365/aad/commands/siteclassification/DirectorySetting.js +0 -10
- package/dist/m365/aad/commands/siteclassification/DirectorySettingTemplatesRsp.js +0 -3
- package/dist/m365/aad/commands/siteclassification/DirectorySettingValue.js +0 -3
- package/dist/m365/outlook/Message.js +0 -3
- package/dist/m365/spo/commands/site/SitePermission.js +0 -3
- package/dist/m365/teams/Channel.js +0 -3
- package/dist/m365/teams/ConversationMember.js +0 -3
- package/dist/m365/teams/Reply.js +0 -3
- package/dist/m365/teams/Tab.js +0 -3
- package/dist/m365/teams/Team.js +0 -3
- package/dist/m365/teams/TeamsApp.js +0 -3
- package/dist/m365/teams/TeamsAppInstallation.js +0 -3
- package/dist/m365/teams/TeamsTabConfiguration.js +0 -3
- package/dist/m365/teams/commands/Meeting.js +0 -3
|
@@ -9,8 +9,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const Auth_1 = require("../../../../Auth");
|
|
13
|
-
const accessToken_1 = require("../../../../utils/accessToken");
|
|
14
12
|
const odata_1 = require("../../../../utils/odata");
|
|
15
13
|
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
16
14
|
const commands_1 = require("../../commands");
|
|
@@ -26,9 +24,6 @@ class PurviewRetentionLabelListCommand extends GraphCommand_1.default {
|
|
|
26
24
|
}
|
|
27
25
|
commandAction(logger) {
|
|
28
26
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
if (accessToken_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
|
|
30
|
-
this.handleError('This command does not support application permissions.');
|
|
31
|
-
}
|
|
32
27
|
try {
|
|
33
28
|
const items = yield odata_1.odata.getAllItems(`${this.resource}/beta/security/labels/retentionLabels`);
|
|
34
29
|
logger.log(items);
|
|
@@ -15,13 +15,11 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
15
15
|
};
|
|
16
16
|
var _PurviewRetentionLabelRemoveCommand_instances, _PurviewRetentionLabelRemoveCommand_initTelemetry, _PurviewRetentionLabelRemoveCommand_initOptions, _PurviewRetentionLabelRemoveCommand_initValidators;
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
const Auth_1 = require("../../../../Auth");
|
|
19
18
|
const Cli_1 = require("../../../../cli/Cli");
|
|
20
19
|
const validation_1 = require("../../../../utils/validation");
|
|
21
20
|
const request_1 = require("../../../../request");
|
|
22
21
|
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
23
22
|
const commands_1 = require("../../commands");
|
|
24
|
-
const accessToken_1 = require("../../../../utils/accessToken");
|
|
25
23
|
class PurviewRetentionLabelRemoveCommand extends GraphCommand_1.default {
|
|
26
24
|
get name() {
|
|
27
25
|
return commands_1.default.RETENTIONLABEL_REMOVE;
|
|
@@ -38,26 +36,8 @@ class PurviewRetentionLabelRemoveCommand extends GraphCommand_1.default {
|
|
|
38
36
|
}
|
|
39
37
|
commandAction(logger, args) {
|
|
40
38
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
-
if (accessToken_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
|
|
42
|
-
this.handleError('This command does not support application permissions.');
|
|
43
|
-
}
|
|
44
|
-
const removeRetentionLabel = () => __awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
try {
|
|
46
|
-
const requestOptions = {
|
|
47
|
-
url: `${this.resource}/beta/security/labels/retentionLabels/${args.options.id}`,
|
|
48
|
-
headers: {
|
|
49
|
-
accept: 'application/json;odata.metadata=none'
|
|
50
|
-
},
|
|
51
|
-
responseType: 'json'
|
|
52
|
-
};
|
|
53
|
-
yield request_1.default.delete(requestOptions);
|
|
54
|
-
}
|
|
55
|
-
catch (err) {
|
|
56
|
-
this.handleRejectedODataJsonPromise(err);
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
39
|
if (args.options.confirm) {
|
|
60
|
-
yield removeRetentionLabel();
|
|
40
|
+
yield this.removeRetentionLabel(args);
|
|
61
41
|
}
|
|
62
42
|
else {
|
|
63
43
|
const result = yield Cli_1.Cli.prompt({
|
|
@@ -67,11 +47,28 @@ class PurviewRetentionLabelRemoveCommand extends GraphCommand_1.default {
|
|
|
67
47
|
message: `Are you sure you want to remove the retention label ${args.options.id}?`
|
|
68
48
|
});
|
|
69
49
|
if (result.continue) {
|
|
70
|
-
yield removeRetentionLabel();
|
|
50
|
+
yield this.removeRetentionLabel(args);
|
|
71
51
|
}
|
|
72
52
|
}
|
|
73
53
|
});
|
|
74
54
|
}
|
|
55
|
+
removeRetentionLabel(args) {
|
|
56
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
try {
|
|
58
|
+
const requestOptions = {
|
|
59
|
+
url: `${this.resource}/beta/security/labels/retentionLabels/${args.options.id}`,
|
|
60
|
+
headers: {
|
|
61
|
+
accept: 'application/json;odata.metadata=none'
|
|
62
|
+
},
|
|
63
|
+
responseType: 'json'
|
|
64
|
+
};
|
|
65
|
+
yield request_1.default.delete(requestOptions);
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
this.handleRejectedODataJsonPromise(err);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
75
72
|
}
|
|
76
73
|
_PurviewRetentionLabelRemoveCommand_instances = new WeakSet(), _PurviewRetentionLabelRemoveCommand_initTelemetry = function _PurviewRetentionLabelRemoveCommand_initTelemetry() {
|
|
77
74
|
this.telemetry.push((args) => {
|
|
@@ -15,12 +15,10 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
15
15
|
};
|
|
16
16
|
var _PurviewRetentionLabelSetCommand_instances, _PurviewRetentionLabelSetCommand_initTelemetry, _PurviewRetentionLabelSetCommand_initOptions, _PurviewRetentionLabelSetCommand_initValidators;
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
const Auth_1 = require("../../../../Auth");
|
|
19
18
|
const validation_1 = require("../../../../utils/validation");
|
|
20
19
|
const request_1 = require("../../../../request");
|
|
21
20
|
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
22
21
|
const commands_1 = require("../../commands");
|
|
23
|
-
const accessToken_1 = require("../../../../utils/accessToken");
|
|
24
22
|
class PurviewRetentionLabelSetCommand extends GraphCommand_1.default {
|
|
25
23
|
get name() {
|
|
26
24
|
return commands_1.default.RETENTIONLABEL_SET;
|
|
@@ -41,9 +39,6 @@ class PurviewRetentionLabelSetCommand extends GraphCommand_1.default {
|
|
|
41
39
|
}
|
|
42
40
|
commandAction(logger, args) {
|
|
43
41
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
if (accessToken_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
|
|
45
|
-
this.handleError('This command does not support application permissions.');
|
|
46
|
-
}
|
|
47
42
|
if (this.verbose) {
|
|
48
43
|
logger.log(`Starting to update retention label with id ${args.options.id}`);
|
|
49
44
|
}
|
|
@@ -39,7 +39,7 @@ class JsonRule extends Rule_1.Rule {
|
|
|
39
39
|
return this.getAstNodeForProperty(jsonFile.ast, jsonProperty);
|
|
40
40
|
}
|
|
41
41
|
getAstNodeForProperty(node, jsonProperty) {
|
|
42
|
-
if (node.children.length === 0) {
|
|
42
|
+
if (!node.children || node.children.length === 0) {
|
|
43
43
|
return node;
|
|
44
44
|
}
|
|
45
45
|
if (jsonProperty === '') {
|
|
@@ -37,6 +37,7 @@ class FN021003_PKG_engines_node extends JsonRule_1.JsonRule {
|
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
if (!project.packageJson.engines ||
|
|
40
|
+
typeof project.packageJson.engines !== 'object' ||
|
|
40
41
|
!project.packageJson.engines.node ||
|
|
41
42
|
project.packageJson.engines.node !== this.version) {
|
|
42
43
|
const node = this.getAstNodeFromFile(project.packageJson, 'engines.node');
|
|
@@ -85,15 +85,14 @@ class SpoAppTeamsPackageDownloadCommand extends SpoAppBaseCommand_1.SpoAppBaseCo
|
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
87
|
ensureAppInfo(logger, args, appInfo) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
.loadAppCatalogUrl(logger, args)
|
|
96
|
-
.then(_ => {
|
|
88
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
89
|
+
if (appInfo.id && appInfo.packageFileName) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (args.options.appName && !appInfo.packageFileName) {
|
|
93
|
+
appInfo.packageFileName = this.getPackageNameFromFileName(args.options.appName);
|
|
94
|
+
}
|
|
95
|
+
yield this.loadAppCatalogUrl(logger, args);
|
|
97
96
|
const appCatalogListName = 'AppCatalog';
|
|
98
97
|
const serverRelativeAppCatalogListUrl = `${urlUtil_1.urlUtil.getServerRelativeSiteUrl(this.appCatalogUrl)}/${appCatalogListName}`;
|
|
99
98
|
let url = `${this.appCatalogUrl}/_api/web/`;
|
|
@@ -113,39 +112,33 @@ class SpoAppTeamsPackageDownloadCommand extends SpoAppBaseCommand_1.SpoAppBaseCo
|
|
|
113
112
|
},
|
|
114
113
|
responseType: 'json'
|
|
115
114
|
};
|
|
116
|
-
|
|
117
|
-
})
|
|
118
|
-
.then(res => {
|
|
115
|
+
const res = yield request_1.default.get(requestOptions);
|
|
119
116
|
if (args.options.appItemUniqueId) {
|
|
120
117
|
appInfo.id = parseInt(res.Id);
|
|
121
118
|
if (!appInfo.packageFileName) {
|
|
122
119
|
appInfo.packageFileName = this.getPackageNameFromFileName(res.File.Name);
|
|
123
120
|
}
|
|
124
|
-
return
|
|
121
|
+
return;
|
|
125
122
|
}
|
|
126
123
|
if (args.options.appItemId) {
|
|
127
124
|
if (!appInfo.packageFileName) {
|
|
128
125
|
appInfo.packageFileName = this.getPackageNameFromFileName(res.File.Name);
|
|
129
126
|
}
|
|
130
|
-
return
|
|
127
|
+
return;
|
|
131
128
|
}
|
|
132
|
-
// if (args.options.appName)
|
|
133
|
-
// skipped 'if' clause to provide a default code branch
|
|
134
129
|
appInfo.id = parseInt(res.Id);
|
|
135
|
-
return Promise.resolve();
|
|
136
130
|
});
|
|
137
131
|
}
|
|
138
132
|
getPackageNameFromFileName(fileName) {
|
|
139
133
|
return `${path.basename(fileName, path.extname(fileName))}.zip`;
|
|
140
134
|
}
|
|
141
135
|
loadAppCatalogUrl(logger, args) {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
.getSpoUrl(logger, this.debug)
|
|
147
|
-
|
|
148
|
-
.then(appCatalogUrl => {
|
|
136
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
137
|
+
if (this.appCatalogUrl) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
const spoUrl = yield spo_1.spo.getSpoUrl(logger, this.debug);
|
|
141
|
+
const appCatalogUrl = yield this.getAppCatalogSiteUrl(logger, spoUrl, args);
|
|
149
142
|
this.appCatalogUrl = appCatalogUrl;
|
|
150
143
|
});
|
|
151
144
|
}
|
|
@@ -0,0 +1,154 @@
|
|
|
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 _SpoApplicationCustomizerSetCommand_instances, _SpoApplicationCustomizerSetCommand_initOptions, _SpoApplicationCustomizerSetCommand_initTelemetry, _SpoApplicationCustomizerSetCommand_initValidators, _SpoApplicationCustomizerSetCommand_initOptionSets;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const request_1 = require("../../../../request");
|
|
19
|
+
const validation_1 = require("../../../../utils/validation");
|
|
20
|
+
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
21
|
+
const commands_1 = require("../../commands");
|
|
22
|
+
const spo_1 = require("../../../../utils/spo");
|
|
23
|
+
const formatting_1 = require("../../../../utils/formatting");
|
|
24
|
+
const os = require("os");
|
|
25
|
+
class SpoApplicationCustomizerSetCommand extends SpoCommand_1.default {
|
|
26
|
+
get name() {
|
|
27
|
+
return commands_1.default.APPLICATIONCUSTOMIZER_SET;
|
|
28
|
+
}
|
|
29
|
+
get description() {
|
|
30
|
+
return 'Updates an existing Application Customizer on a site';
|
|
31
|
+
}
|
|
32
|
+
constructor() {
|
|
33
|
+
super();
|
|
34
|
+
_SpoApplicationCustomizerSetCommand_instances.add(this);
|
|
35
|
+
this.allowedScopes = ['Site', 'Web', 'All'];
|
|
36
|
+
__classPrivateFieldGet(this, _SpoApplicationCustomizerSetCommand_instances, "m", _SpoApplicationCustomizerSetCommand_initTelemetry).call(this);
|
|
37
|
+
__classPrivateFieldGet(this, _SpoApplicationCustomizerSetCommand_instances, "m", _SpoApplicationCustomizerSetCommand_initOptions).call(this);
|
|
38
|
+
__classPrivateFieldGet(this, _SpoApplicationCustomizerSetCommand_instances, "m", _SpoApplicationCustomizerSetCommand_initValidators).call(this);
|
|
39
|
+
__classPrivateFieldGet(this, _SpoApplicationCustomizerSetCommand_instances, "m", _SpoApplicationCustomizerSetCommand_initOptionSets).call(this);
|
|
40
|
+
}
|
|
41
|
+
commandAction(logger, args) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
try {
|
|
44
|
+
const appCustomizer = yield this.getAppCustomizerToUpdate(logger, args.options);
|
|
45
|
+
yield this.updateAppCustomizer(logger, args.options, appCustomizer);
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
this.handleRejectedODataJsonPromise(err);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
updateAppCustomizer(logger, options, appCustomizer) {
|
|
53
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
const { clientSideComponentProperties, webUrl, newTitle } = options;
|
|
55
|
+
if (this.verbose) {
|
|
56
|
+
logger.logToStderr(`Updating application customizer with ID '${appCustomizer.Id}' on the site '${webUrl}'...`);
|
|
57
|
+
}
|
|
58
|
+
const requestBody = {};
|
|
59
|
+
if (newTitle) {
|
|
60
|
+
requestBody.Title = newTitle;
|
|
61
|
+
}
|
|
62
|
+
if (clientSideComponentProperties !== undefined) {
|
|
63
|
+
requestBody.ClientSideComponentProperties = clientSideComponentProperties;
|
|
64
|
+
}
|
|
65
|
+
const requestOptions = {
|
|
66
|
+
url: `${webUrl}/_api/${appCustomizer.Scope.toString() === '2' ? 'Site' : 'Web'}/UserCustomActions('${appCustomizer.Id}')`,
|
|
67
|
+
headers: {
|
|
68
|
+
accept: 'application/json;odata=nometadata',
|
|
69
|
+
'X-HTTP-Method': 'MERGE'
|
|
70
|
+
},
|
|
71
|
+
data: requestBody,
|
|
72
|
+
responseType: 'json'
|
|
73
|
+
};
|
|
74
|
+
yield request_1.default.post(requestOptions);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
getAppCustomizerToUpdate(logger, options) {
|
|
78
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
const { id, webUrl, title, clientSideComponentId, scope } = options;
|
|
80
|
+
const resolvedScope = scope || 'All';
|
|
81
|
+
if (this.verbose) {
|
|
82
|
+
logger.logToStderr(`Getting application customizer ${title || clientSideComponentId || id} to update...`);
|
|
83
|
+
}
|
|
84
|
+
let appCustomizers = [];
|
|
85
|
+
if (id) {
|
|
86
|
+
const appCustomizer = yield spo_1.spo.getCustomActionById(webUrl, id, resolvedScope);
|
|
87
|
+
if (appCustomizer && appCustomizer.Location === 'ClientSideExtension.ApplicationCustomizer') {
|
|
88
|
+
appCustomizers.push(appCustomizer);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
else if (title) {
|
|
92
|
+
appCustomizers = yield spo_1.spo.getCustomActions(webUrl, resolvedScope, `(Title eq '${formatting_1.formatting.encodeQueryParameter(title)}') and (startswith(Location,'ClientSideExtension.ApplicationCustomizer'))`);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
appCustomizers = yield spo_1.spo.getCustomActions(webUrl, resolvedScope, `(ClientSideComponentId eq guid'${clientSideComponentId}') and (startswith(Location,'ClientSideExtension.ApplicationCustomizer'))`);
|
|
96
|
+
}
|
|
97
|
+
if (appCustomizers.length === 0) {
|
|
98
|
+
throw `No application customizer with ${title && `title '${title}'` || clientSideComponentId && `ClientSideComponentId '${clientSideComponentId}'` || id && `id '${id}'`} found`;
|
|
99
|
+
}
|
|
100
|
+
if (appCustomizers.length > 1) {
|
|
101
|
+
throw `Multiple application customizer with ${title ? `title '${title}'` : `ClientSideComponentId '${clientSideComponentId}'`} found. Please disambiguate using IDs: ${os.EOL}${appCustomizers.map(a => `- ${a.Id}`).join(os.EOL)}`;
|
|
102
|
+
}
|
|
103
|
+
return appCustomizers[0];
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
_SpoApplicationCustomizerSetCommand_instances = new WeakSet(), _SpoApplicationCustomizerSetCommand_initOptions = function _SpoApplicationCustomizerSetCommand_initOptions() {
|
|
108
|
+
this.options.unshift({
|
|
109
|
+
option: '-u, --webUrl <webUrl>'
|
|
110
|
+
}, {
|
|
111
|
+
option: '-t, --title [title]'
|
|
112
|
+
}, {
|
|
113
|
+
option: '-i, --id [id]'
|
|
114
|
+
}, {
|
|
115
|
+
option: '-c, --clientSideComponentId [clientSideComponentId]'
|
|
116
|
+
}, {
|
|
117
|
+
option: '--newTitle [newTitle]'
|
|
118
|
+
}, {
|
|
119
|
+
option: '-p, --clientSideComponentProperties [clientSideComponentProperties]'
|
|
120
|
+
}, {
|
|
121
|
+
option: '-s, --scope [scope]', autocomplete: this.allowedScopes
|
|
122
|
+
});
|
|
123
|
+
}, _SpoApplicationCustomizerSetCommand_initTelemetry = function _SpoApplicationCustomizerSetCommand_initTelemetry() {
|
|
124
|
+
this.telemetry.push((args) => {
|
|
125
|
+
Object.assign(this.telemetryProperties, {
|
|
126
|
+
title: typeof args.options.title !== 'undefined',
|
|
127
|
+
id: typeof args.options.id !== 'undefined',
|
|
128
|
+
clientSideComponentId: typeof args.options.clientSideComponentId !== 'undefined',
|
|
129
|
+
newTitle: typeof args.options.newTitle !== 'undefined',
|
|
130
|
+
clientSideComponentProperties: typeof args.options.clientSideComponentProperties !== 'undefined',
|
|
131
|
+
scope: typeof args.options.scope !== 'undefined'
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
}, _SpoApplicationCustomizerSetCommand_initValidators = function _SpoApplicationCustomizerSetCommand_initValidators() {
|
|
135
|
+
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
136
|
+
if (args.options.id && !validation_1.validation.isValidGuid(args.options.id)) {
|
|
137
|
+
return `${args.options.id} is not a valid GUID`;
|
|
138
|
+
}
|
|
139
|
+
if (args.options.clientSideComponentId && !validation_1.validation.isValidGuid(args.options.clientSideComponentId)) {
|
|
140
|
+
return `${args.options.clientSideComponentId} is not a valid GUID`;
|
|
141
|
+
}
|
|
142
|
+
if (args.options.scope && this.allowedScopes.indexOf(args.options.scope) === -1) {
|
|
143
|
+
return `'${args.options.scope}' is not a valid application customizer scope. Allowed values are: ${this.allowedScopes.join(',')}`;
|
|
144
|
+
}
|
|
145
|
+
if (!args.options.newTitle && !args.options.clientSideComponentProperties) {
|
|
146
|
+
return `Please specify an option to be updated`;
|
|
147
|
+
}
|
|
148
|
+
return validation_1.validation.isValidSharePointUrl(args.options.webUrl);
|
|
149
|
+
}));
|
|
150
|
+
}, _SpoApplicationCustomizerSetCommand_initOptionSets = function _SpoApplicationCustomizerSetCommand_initOptionSets() {
|
|
151
|
+
this.optionSets.push({ options: ['id', 'title', 'clientSideComponentId'] });
|
|
152
|
+
};
|
|
153
|
+
module.exports = new SpoApplicationCustomizerSetCommand();
|
|
154
|
+
//# sourceMappingURL=applicationcustomizer-set.js.map
|
|
@@ -39,7 +39,7 @@ class SpoCommandSetSetCommand extends SpoCommand_1.default {
|
|
|
39
39
|
commandAction(logger, args) {
|
|
40
40
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41
41
|
if (this.verbose) {
|
|
42
|
-
logger.logToStderr(`Updating ListView Command Set ${args.options.clientSideComponentId} to site '${args.options.webUrl}'...`);
|
|
42
|
+
logger.logToStderr(`Updating ListView Command Set ${args.options.id || args.options.title || args.options.clientSideComponentId} to site '${args.options.webUrl}'...`);
|
|
43
43
|
}
|
|
44
44
|
if (!args.options.scope) {
|
|
45
45
|
args.options.scope = 'All';
|
|
@@ -59,6 +59,9 @@ class SpoCommandSetSetCommand extends SpoCommand_1.default {
|
|
|
59
59
|
if (args.options.clientSideComponentProperties) {
|
|
60
60
|
requestBody.ClientSideComponentProperties = args.options.clientSideComponentProperties;
|
|
61
61
|
}
|
|
62
|
+
if (args.options.newClientSideComponentId) {
|
|
63
|
+
requestBody.ClientSideComponentId = args.options.newClientSideComponentId;
|
|
64
|
+
}
|
|
62
65
|
const customAction = yield this.getCustomAction(args.options);
|
|
63
66
|
const requestOptions = {
|
|
64
67
|
url: `${args.options.webUrl}/_api/${customAction.Scope === 3 ? "Web" : "Site"}/UserCustomActions('${formatting_1.formatting.encodeQueryParameter(customAction.Id)}')`,
|
|
@@ -127,6 +130,7 @@ _SpoCommandSetSetCommand_instances = new WeakSet(), _SpoCommandSetSetCommand_ini
|
|
|
127
130
|
title: typeof args.options.title !== 'undefined',
|
|
128
131
|
id: typeof args.options.id !== 'undefined',
|
|
129
132
|
clientSideComponentId: typeof args.options.clientSideComponentId !== 'undefined',
|
|
133
|
+
newClientSideComponentId: typeof args.options.newClientSideComponentId !== 'undefined',
|
|
130
134
|
listType: typeof args.options.listType !== 'undefined',
|
|
131
135
|
clientSideComponentProperties: typeof args.options.clientSideComponentProperties !== 'undefined',
|
|
132
136
|
scope: typeof args.options.scope !== 'undefined',
|
|
@@ -142,6 +146,8 @@ _SpoCommandSetSetCommand_instances = new WeakSet(), _SpoCommandSetSetCommand_ini
|
|
|
142
146
|
option: '-i, --id [id]'
|
|
143
147
|
}, {
|
|
144
148
|
option: '-c, --clientSideComponentId [clientSideComponentId]'
|
|
149
|
+
}, {
|
|
150
|
+
option: '--newClientSideComponentId [newClientSideComponentId]'
|
|
145
151
|
}, {
|
|
146
152
|
option: '--newTitle [newTitle]'
|
|
147
153
|
}, {
|
|
@@ -161,6 +167,9 @@ _SpoCommandSetSetCommand_instances = new WeakSet(), _SpoCommandSetSetCommand_ini
|
|
|
161
167
|
if (args.options.clientSideComponentId && !validation_1.validation.isValidGuid(args.options.clientSideComponentId)) {
|
|
162
168
|
return `${args.options.clientSideComponentId} is not a valid GUID`;
|
|
163
169
|
}
|
|
170
|
+
if (args.options.newClientSideComponentId && !validation_1.validation.isValidGuid(args.options.newClientSideComponentId)) {
|
|
171
|
+
return `${args.options.newClientSideComponentId} is not a valid GUID`;
|
|
172
|
+
}
|
|
164
173
|
if (args.options.listType && SpoCommandSetSetCommand.listTypes.indexOf(args.options.listType) < 0) {
|
|
165
174
|
return `${args.options.listType} is not a valid list type. Allowed values are ${SpoCommandSetSetCommand.listTypes.join(', ')}`;
|
|
166
175
|
}
|
|
@@ -170,7 +179,7 @@ _SpoCommandSetSetCommand_instances = new WeakSet(), _SpoCommandSetSetCommand_ini
|
|
|
170
179
|
if (args.options.location && SpoCommandSetSetCommand.locations.indexOf(args.options.location) < 0) {
|
|
171
180
|
return `${args.options.location} is not a valid location. Allowed values are ${SpoCommandSetSetCommand.locations.join(', ')}`;
|
|
172
181
|
}
|
|
173
|
-
if (!args.options.newTitle && !args.options.listType && !args.options.clientSideComponentProperties && !args.options.location) {
|
|
182
|
+
if (!args.options.newTitle && !args.options.listType && !args.options.clientSideComponentProperties && !args.options.location && !args.options.newClientSideComponentId) {
|
|
174
183
|
return `Please specify option to be updated`;
|
|
175
184
|
}
|
|
176
185
|
return validation_1.validation.isValidSharePointUrl(args.options.webUrl);
|
|
@@ -0,0 +1,119 @@
|
|
|
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 _SpoFileCheckoutUndoCommand_instances, _SpoFileCheckoutUndoCommand_initTelemetry, _SpoFileCheckoutUndoCommand_initOptions, _SpoFileCheckoutUndoCommand_initValidators, _SpoFileCheckoutUndoCommand_initOptionSets;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const Cli_1 = require("../../../../cli/Cli");
|
|
19
|
+
const request_1 = require("../../../../request");
|
|
20
|
+
const formatting_1 = require("../../../../utils/formatting");
|
|
21
|
+
const urlUtil_1 = require("../../../../utils/urlUtil");
|
|
22
|
+
const validation_1 = require("../../../../utils/validation");
|
|
23
|
+
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
24
|
+
const commands_1 = require("../../commands");
|
|
25
|
+
class SpoFileCheckoutUndoCommand extends SpoCommand_1.default {
|
|
26
|
+
get name() {
|
|
27
|
+
return commands_1.default.FILE_CHECKOUT_UNDO;
|
|
28
|
+
}
|
|
29
|
+
get description() {
|
|
30
|
+
return 'Discards a checked out file';
|
|
31
|
+
}
|
|
32
|
+
constructor() {
|
|
33
|
+
super();
|
|
34
|
+
_SpoFileCheckoutUndoCommand_instances.add(this);
|
|
35
|
+
__classPrivateFieldGet(this, _SpoFileCheckoutUndoCommand_instances, "m", _SpoFileCheckoutUndoCommand_initTelemetry).call(this);
|
|
36
|
+
__classPrivateFieldGet(this, _SpoFileCheckoutUndoCommand_instances, "m", _SpoFileCheckoutUndoCommand_initOptions).call(this);
|
|
37
|
+
__classPrivateFieldGet(this, _SpoFileCheckoutUndoCommand_instances, "m", _SpoFileCheckoutUndoCommand_initValidators).call(this);
|
|
38
|
+
__classPrivateFieldGet(this, _SpoFileCheckoutUndoCommand_instances, "m", _SpoFileCheckoutUndoCommand_initOptionSets).call(this);
|
|
39
|
+
}
|
|
40
|
+
commandAction(logger, args) {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
const undoCheckout = () => __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
try {
|
|
44
|
+
if (this.verbose) {
|
|
45
|
+
logger.logToStderr(`Undoing checkout for file ${args.options.fileId || args.options.fileUrl} on web ${args.options.webUrl}`);
|
|
46
|
+
}
|
|
47
|
+
let requestUrl = `${args.options.webUrl}/_api/web/`;
|
|
48
|
+
if (args.options.fileId) {
|
|
49
|
+
requestUrl += `getFileById('${args.options.fileId}')`;
|
|
50
|
+
}
|
|
51
|
+
else if (args.options.fileUrl) {
|
|
52
|
+
const serverRelativePath = urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.fileUrl);
|
|
53
|
+
requestUrl += `getFileByServerRelativePath(DecodedUrl='${formatting_1.formatting.encodeQueryParameter(serverRelativePath)}')`;
|
|
54
|
+
}
|
|
55
|
+
requestUrl += '/undocheckout';
|
|
56
|
+
const requestOptions = {
|
|
57
|
+
url: requestUrl,
|
|
58
|
+
headers: {
|
|
59
|
+
'accept': 'application/json;odata=nometadata'
|
|
60
|
+
},
|
|
61
|
+
responseType: 'json'
|
|
62
|
+
};
|
|
63
|
+
yield request_1.default.post(requestOptions);
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
this.handleRejectedODataJsonPromise(err);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
if (args.options.confirm) {
|
|
70
|
+
yield undoCheckout();
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
const result = yield Cli_1.Cli.prompt({
|
|
74
|
+
type: 'confirm',
|
|
75
|
+
name: 'continue',
|
|
76
|
+
default: false,
|
|
77
|
+
message: `Are you sure you want to undo the checkout for file ${args.options.fileId || args.options.fileUrl} ?`
|
|
78
|
+
});
|
|
79
|
+
if (result.continue) {
|
|
80
|
+
yield undoCheckout();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
_SpoFileCheckoutUndoCommand_instances = new WeakSet(), _SpoFileCheckoutUndoCommand_initTelemetry = function _SpoFileCheckoutUndoCommand_initTelemetry() {
|
|
87
|
+
this.telemetry.push((args) => {
|
|
88
|
+
Object.assign(this.telemetryProperties, {
|
|
89
|
+
fileId: typeof args.options.fileId !== 'undefined',
|
|
90
|
+
fileUrl: typeof args.options.fileUrl !== 'undefined',
|
|
91
|
+
confirm: !!args.options.confirm
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
}, _SpoFileCheckoutUndoCommand_initOptions = function _SpoFileCheckoutUndoCommand_initOptions() {
|
|
95
|
+
this.options.unshift({
|
|
96
|
+
option: '-u, --webUrl <webUrl>'
|
|
97
|
+
}, {
|
|
98
|
+
option: '-f, --fileUrl [fileUrl]'
|
|
99
|
+
}, {
|
|
100
|
+
option: '-i, --fileId [fileId]'
|
|
101
|
+
}, {
|
|
102
|
+
option: '--confirm'
|
|
103
|
+
});
|
|
104
|
+
}, _SpoFileCheckoutUndoCommand_initValidators = function _SpoFileCheckoutUndoCommand_initValidators() {
|
|
105
|
+
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
106
|
+
const isValidSharePointUrl = validation_1.validation.isValidSharePointUrl(args.options.webUrl);
|
|
107
|
+
if (isValidSharePointUrl !== true) {
|
|
108
|
+
return isValidSharePointUrl;
|
|
109
|
+
}
|
|
110
|
+
if (args.options.fileId && !validation_1.validation.isValidGuid(args.options.fileId)) {
|
|
111
|
+
return `${args.options.fileId} is not a valid GUID`;
|
|
112
|
+
}
|
|
113
|
+
return true;
|
|
114
|
+
}));
|
|
115
|
+
}, _SpoFileCheckoutUndoCommand_initOptionSets = function _SpoFileCheckoutUndoCommand_initOptionSets() {
|
|
116
|
+
this.optionSets.push({ options: ['fileId', 'fileUrl'] });
|
|
117
|
+
};
|
|
118
|
+
module.exports = new SpoFileCheckoutUndoCommand();
|
|
119
|
+
//# sourceMappingURL=file-checkout-undo.js.map
|