@pnp/cli-microsoft365 6.7.0-beta.87c47df → 6.7.0-beta.eb19618
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 +1 -1
- package/README.md +1 -1
- package/csom.json +2 -0
- package/dist/Auth.js +75 -4
- package/dist/AuthServer.js +2 -1
- package/dist/Command.js +56 -7
- package/dist/m365/aad/commands/user/user-set.js +145 -30
- package/dist/m365/base/AzmgmtCommand.js +11 -0
- package/dist/m365/base/PowerAppsCommand.js +11 -0
- package/dist/m365/base/PowerPlatformCommand.js +11 -0
- package/dist/m365/commands/login.js +17 -1
- package/dist/m365/commands/status.js +4 -2
- package/dist/m365/flow/commands/run/run-get.js +31 -1
- package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-get.js +144 -0
- package/dist/m365/spo/commands/list/list-add.js +7 -0
- package/dist/m365/spo/commands/list/list-set.js +7 -0
- package/dist/m365/spo/commands/listitem/listitem-list.js +113 -55
- package/dist/m365/spo/commands/site/site-recyclebinitem-clear.js +115 -0
- package/dist/m365/spo/commands.js +2 -0
- package/dist/m365/teams/commands/team/team-add.js +2 -2
- package/dist/request.js +7 -0
- package/dist/utils/misc.js +11 -0
- package/docs/docs/cmd/aad/user/user-set.md +53 -8
- package/docs/docs/cmd/flow/run/run-get.md +110 -9
- package/docs/docs/cmd/login.md +5 -2
- package/docs/docs/cmd/planner/task/task-add.md +3 -1
- package/docs/docs/cmd/planner/task/task-set.md +6 -4
- package/docs/docs/cmd/pp/tenant/tenant-settings-list.md +25 -9
- package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-get.md +145 -0
- package/docs/docs/cmd/spo/list/list-add.md +3 -0
- package/docs/docs/cmd/spo/list/list-set.md +3 -0
- package/docs/docs/cmd/spo/listitem/listitem-list.md +22 -8
- package/docs/docs/cmd/spo/site/site-recyclebinitem-clear.md +45 -0
- package/docs/docs/cmd/tenant/id/id-get.md +6 -0
- package/docs/docs/cmd/tenant/report/report-activeusercounts.md +7 -0
- package/docs/docs/cmd/tenant/report/report-activeuserdetail.md +7 -0
- package/docs/docs/cmd/tenant/report/report-office365activationcounts.md +7 -0
- package/docs/docs/cmd/tenant/report/report-office365activationsusercounts.md +7 -0
- package/docs/docs/cmd/tenant/report/report-office365activationsuserdetail.md +7 -0
- package/docs/docs/cmd/tenant/report/report-servicesusercounts.md +7 -0
- package/docs/docs/cmd/tenant/security/security-alerts-list.md +23 -0
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-health-get.md +32 -0
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-health-list.md +32 -0
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-healthissue-get.md +26 -0
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-healthissue-list.md +26 -0
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-message-get.md +22 -0
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-message-list.md +22 -0
- package/package.json +2 -1
|
@@ -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 _FlowRunGetCommand_instances, _FlowRunGetCommand_initOptions;
|
|
16
|
+
var _FlowRunGetCommand_instances, _FlowRunGetCommand_initOptions, _FlowRunGetCommand_initValidators, _FlowRunGetCommand_initTelemetry;
|
|
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 validation_1 = require("../../../../utils/validation");
|
|
20
21
|
const AzmgmtCommand_1 = require("../../../base/AzmgmtCommand");
|
|
21
22
|
const commands_1 = require("../../commands");
|
|
22
23
|
class FlowRunGetCommand extends AzmgmtCommand_1.default {
|
|
@@ -32,7 +33,9 @@ class FlowRunGetCommand extends AzmgmtCommand_1.default {
|
|
|
32
33
|
constructor() {
|
|
33
34
|
super();
|
|
34
35
|
_FlowRunGetCommand_instances.add(this);
|
|
36
|
+
__classPrivateFieldGet(this, _FlowRunGetCommand_instances, "m", _FlowRunGetCommand_initTelemetry).call(this);
|
|
35
37
|
__classPrivateFieldGet(this, _FlowRunGetCommand_instances, "m", _FlowRunGetCommand_initOptions).call(this);
|
|
38
|
+
__classPrivateFieldGet(this, _FlowRunGetCommand_instances, "m", _FlowRunGetCommand_initValidators).call(this);
|
|
36
39
|
}
|
|
37
40
|
commandAction(logger, args) {
|
|
38
41
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -52,6 +55,18 @@ class FlowRunGetCommand extends AzmgmtCommand_1.default {
|
|
|
52
55
|
res.endTime = res.properties.endTime || '';
|
|
53
56
|
res.status = res.properties.status;
|
|
54
57
|
res.triggerName = res.properties.trigger.name;
|
|
58
|
+
if (args.options.includeTriggerInformation && res.properties.trigger.outputsLink) {
|
|
59
|
+
const triggerInformationOptions = {
|
|
60
|
+
url: res.properties.trigger.outputsLink.uri,
|
|
61
|
+
headers: {
|
|
62
|
+
accept: 'application/json',
|
|
63
|
+
'x-anonymous': true
|
|
64
|
+
},
|
|
65
|
+
responseType: 'json'
|
|
66
|
+
};
|
|
67
|
+
const triggerInformationResponse = yield request_1.default.get(triggerInformationOptions);
|
|
68
|
+
res.triggerInformation = triggerInformationResponse.body;
|
|
69
|
+
}
|
|
55
70
|
logger.log(res);
|
|
56
71
|
}
|
|
57
72
|
catch (err) {
|
|
@@ -67,6 +82,21 @@ _FlowRunGetCommand_instances = new WeakSet(), _FlowRunGetCommand_initOptions = f
|
|
|
67
82
|
option: '-f, --flowName <flowName>'
|
|
68
83
|
}, {
|
|
69
84
|
option: '-e, --environmentName <environmentName>'
|
|
85
|
+
}, {
|
|
86
|
+
option: '--includeTriggerInformation'
|
|
87
|
+
});
|
|
88
|
+
}, _FlowRunGetCommand_initValidators = function _FlowRunGetCommand_initValidators() {
|
|
89
|
+
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
90
|
+
if (!validation_1.validation.isValidGuid(args.options.flowName)) {
|
|
91
|
+
return `${args.options.flowName} is not a valid GUID`;
|
|
92
|
+
}
|
|
93
|
+
return true;
|
|
94
|
+
}));
|
|
95
|
+
}, _FlowRunGetCommand_initTelemetry = function _FlowRunGetCommand_initTelemetry() {
|
|
96
|
+
this.telemetry.push((args) => {
|
|
97
|
+
Object.assign(this.telemetryProperties, {
|
|
98
|
+
includeTriggerInformation: !!args.options.includeTriggerInformation
|
|
99
|
+
});
|
|
70
100
|
});
|
|
71
101
|
};
|
|
72
102
|
module.exports = new FlowRunGetCommand();
|
|
@@ -0,0 +1,144 @@
|
|
|
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 _SpoApplicationCustomizerGetCommand_instances, _SpoApplicationCustomizerGetCommand_initTelemetry, _SpoApplicationCustomizerGetCommand_initOptions, _SpoApplicationCustomizerGetCommand_initValidators, _SpoApplicationCustomizerGetCommand_initOptionSets;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const formatting_1 = require("../../../../utils/formatting");
|
|
19
|
+
const spo_1 = require("../../../../utils/spo");
|
|
20
|
+
const validation_1 = require("../../../../utils/validation");
|
|
21
|
+
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
22
|
+
const commands_1 = require("../../commands");
|
|
23
|
+
class SpoApplicationCustomizerGetCommand extends SpoCommand_1.default {
|
|
24
|
+
get name() {
|
|
25
|
+
return commands_1.default.APPLICATIONCUSTOMIZER_GET;
|
|
26
|
+
}
|
|
27
|
+
get description() {
|
|
28
|
+
return 'Get an application customizer that is added to a site.';
|
|
29
|
+
}
|
|
30
|
+
constructor() {
|
|
31
|
+
super();
|
|
32
|
+
_SpoApplicationCustomizerGetCommand_instances.add(this);
|
|
33
|
+
this.allowedScopes = ['All', 'Site', 'Web'];
|
|
34
|
+
__classPrivateFieldGet(this, _SpoApplicationCustomizerGetCommand_instances, "m", _SpoApplicationCustomizerGetCommand_initTelemetry).call(this);
|
|
35
|
+
__classPrivateFieldGet(this, _SpoApplicationCustomizerGetCommand_instances, "m", _SpoApplicationCustomizerGetCommand_initOptions).call(this);
|
|
36
|
+
__classPrivateFieldGet(this, _SpoApplicationCustomizerGetCommand_instances, "m", _SpoApplicationCustomizerGetCommand_initValidators).call(this);
|
|
37
|
+
__classPrivateFieldGet(this, _SpoApplicationCustomizerGetCommand_instances, "m", _SpoApplicationCustomizerGetCommand_initOptionSets).call(this);
|
|
38
|
+
}
|
|
39
|
+
commandAction(logger, args) {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
try {
|
|
42
|
+
const customAction = yield this.getCustomAction(args.options);
|
|
43
|
+
if (customAction) {
|
|
44
|
+
logger.log({
|
|
45
|
+
ClientSideComponentId: customAction.ClientSideComponentId,
|
|
46
|
+
ClientSideComponentProperties: customAction.ClientSideComponentProperties,
|
|
47
|
+
CommandUIExtension: customAction.CommandUIExtension,
|
|
48
|
+
Description: customAction.Description,
|
|
49
|
+
Group: customAction.Group,
|
|
50
|
+
Id: customAction.Id,
|
|
51
|
+
ImageUrl: customAction.ImageUrl,
|
|
52
|
+
Location: customAction.Location,
|
|
53
|
+
Name: customAction.Name,
|
|
54
|
+
RegistrationId: customAction.RegistrationId,
|
|
55
|
+
RegistrationType: customAction.RegistrationType,
|
|
56
|
+
Rights: JSON.stringify(customAction.Rights),
|
|
57
|
+
Scope: this.humanizeScope(customAction.Scope),
|
|
58
|
+
ScriptBlock: customAction.ScriptBlock,
|
|
59
|
+
ScriptSrc: customAction.ScriptSrc,
|
|
60
|
+
Sequence: customAction.Sequence,
|
|
61
|
+
Title: customAction.Title,
|
|
62
|
+
Url: customAction.Url,
|
|
63
|
+
VersionOfUserCustomAction: customAction.VersionOfUserCustomAction
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
this.handleRejectedPromise(err);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
getCustomAction(options) {
|
|
73
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
if (options.id) {
|
|
75
|
+
const customAction = yield spo_1.spo.getCustomActionById(options.webUrl, options.id, options.scope);
|
|
76
|
+
if (!customAction || (customAction && customAction.Location !== 'ClientSideExtension.ApplicationCustomizer')) {
|
|
77
|
+
throw `No application customizer with id '${options.id}' found`;
|
|
78
|
+
}
|
|
79
|
+
return customAction;
|
|
80
|
+
}
|
|
81
|
+
const filter = options.title ? `Title eq '${formatting_1.formatting.encodeQueryParameter(options.title)}'` : `ClientSideComponentId eq guid'${formatting_1.formatting.encodeQueryParameter(options.clientSideComponentId)}'`;
|
|
82
|
+
const customActions = yield spo_1.spo.getCustomActions(options.webUrl, options.scope, `${filter} and Location eq 'ClientSideExtension.ApplicationCustomizer'`);
|
|
83
|
+
if (customActions.length === 1) {
|
|
84
|
+
return customActions[0];
|
|
85
|
+
}
|
|
86
|
+
const errorMessage = options.title ? `title '${options.title}'` : `Client Side Component Id '${options.clientSideComponentId}'`;
|
|
87
|
+
if (customActions.length === 0) {
|
|
88
|
+
throw `No application customizer with ${errorMessage} found`;
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
throw `Multiple application customizers with ${errorMessage} found. Please disambiguate using IDs: ${customActions.map(a => a.Id).join(', ')}`;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
humanizeScope(scope) {
|
|
96
|
+
switch (scope) {
|
|
97
|
+
case 2:
|
|
98
|
+
return "Site";
|
|
99
|
+
case 3:
|
|
100
|
+
return "Web";
|
|
101
|
+
}
|
|
102
|
+
return `${scope}`;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
_SpoApplicationCustomizerGetCommand_instances = new WeakSet(), _SpoApplicationCustomizerGetCommand_initTelemetry = function _SpoApplicationCustomizerGetCommand_initTelemetry() {
|
|
106
|
+
this.telemetry.push((args) => {
|
|
107
|
+
Object.assign(this.telemetryProperties, {
|
|
108
|
+
title: typeof args.options.title !== 'undefined',
|
|
109
|
+
id: typeof args.options.id !== 'undefined',
|
|
110
|
+
clientSideComponentId: typeof args.options.clientSideComponentId !== 'undefined',
|
|
111
|
+
scope: typeof args.options.scope !== 'undefined'
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
}, _SpoApplicationCustomizerGetCommand_initOptions = function _SpoApplicationCustomizerGetCommand_initOptions() {
|
|
115
|
+
this.options.unshift({
|
|
116
|
+
option: '-u, --webUrl <webUrl>'
|
|
117
|
+
}, {
|
|
118
|
+
option: '-t, --title [title]'
|
|
119
|
+
}, {
|
|
120
|
+
option: '-i, --id [id]'
|
|
121
|
+
}, {
|
|
122
|
+
option: '-c, --clientSideComponentId [clientSideComponentId]'
|
|
123
|
+
}, {
|
|
124
|
+
option: '-s, --scope [scope]',
|
|
125
|
+
autocomplete: this.allowedScopes
|
|
126
|
+
});
|
|
127
|
+
}, _SpoApplicationCustomizerGetCommand_initValidators = function _SpoApplicationCustomizerGetCommand_initValidators() {
|
|
128
|
+
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
129
|
+
if (args.options.id && !validation_1.validation.isValidGuid(args.options.id)) {
|
|
130
|
+
return `${args.options.id} is not a valid GUID`;
|
|
131
|
+
}
|
|
132
|
+
if (args.options.clientSideComponentId && !validation_1.validation.isValidGuid(args.options.clientSideComponentId)) {
|
|
133
|
+
return `${args.options.clientSideComponentId} is not a valid GUID`;
|
|
134
|
+
}
|
|
135
|
+
if (args.options.scope && this.allowedScopes.indexOf(args.options.scope) === -1) {
|
|
136
|
+
return `'${args.options.scope}' is not a valid application customizer scope. Allowed values are: ${this.allowedScopes.join(',')}`;
|
|
137
|
+
}
|
|
138
|
+
return validation_1.validation.isValidSharePointUrl(args.options.webUrl);
|
|
139
|
+
}));
|
|
140
|
+
}, _SpoApplicationCustomizerGetCommand_initOptionSets = function _SpoApplicationCustomizerGetCommand_initOptionSets() {
|
|
141
|
+
this.optionSets.push({ options: ['title', 'id', 'clientSideComponentId'] });
|
|
142
|
+
};
|
|
143
|
+
module.exports = new SpoApplicationCustomizerGetCommand();
|
|
144
|
+
//# sourceMappingURL=applicationcustomizer-get.js.map
|
|
@@ -144,6 +144,9 @@ class SpoListAddCommand extends SpoCommand_1.default {
|
|
|
144
144
|
if (options.direction) {
|
|
145
145
|
requestBody.Direction = options.direction;
|
|
146
146
|
}
|
|
147
|
+
if (options.disableCommenting !== undefined) {
|
|
148
|
+
requestBody.DisableCommenting = options.disableCommenting;
|
|
149
|
+
}
|
|
147
150
|
if (options.disableGridEditing !== undefined) {
|
|
148
151
|
requestBody.DisableGridEditing = options.disableGridEditing;
|
|
149
152
|
}
|
|
@@ -377,6 +380,9 @@ _SpoListAddCommand_instances = new WeakSet(), _SpoListAddCommand_initTelemetry =
|
|
|
377
380
|
}, {
|
|
378
381
|
option: '--direction [direction]',
|
|
379
382
|
autocomplete: ['NONE', 'LTR', 'RTL']
|
|
383
|
+
}, {
|
|
384
|
+
option: '--disableCommenting [disableCommenting]',
|
|
385
|
+
autocomplete: ['true', 'false']
|
|
380
386
|
}, {
|
|
381
387
|
option: '--disableGridEditing [disableGridEditing]',
|
|
382
388
|
autocomplete: ['true', 'false']
|
|
@@ -585,6 +591,7 @@ SpoListAddCommand.booleanOptions = [
|
|
|
585
591
|
'allowMultiResponses',
|
|
586
592
|
'contentTypesEnabled',
|
|
587
593
|
'crawlNonDefaultViews',
|
|
594
|
+
'disableCommenting',
|
|
588
595
|
'disableGridEditing',
|
|
589
596
|
'enableAssignToEmail',
|
|
590
597
|
'enableAttachments',
|
|
@@ -146,6 +146,9 @@ class SpoListSetCommand extends SpoCommand_1.default {
|
|
|
146
146
|
if (options.direction) {
|
|
147
147
|
requestBody.Direction = options.direction;
|
|
148
148
|
}
|
|
149
|
+
if (options.disableCommenting !== undefined) {
|
|
150
|
+
requestBody.DisableCommenting = options.disableCommenting;
|
|
151
|
+
}
|
|
149
152
|
if (options.disableGridEditing !== undefined) {
|
|
150
153
|
requestBody.DisableGridEditing = options.disableGridEditing;
|
|
151
154
|
}
|
|
@@ -380,6 +383,9 @@ _SpoListSetCommand_instances = new WeakSet(), _SpoListSetCommand_initTelemetry =
|
|
|
380
383
|
}, {
|
|
381
384
|
option: '--direction [direction]',
|
|
382
385
|
autocomplete: ['NONE', 'LTR', 'RTL']
|
|
386
|
+
}, {
|
|
387
|
+
option: '--disableCommenting [disableCommenting]',
|
|
388
|
+
autocomplete: ['true', 'false']
|
|
383
389
|
}, {
|
|
384
390
|
option: '--disableGridEditing [disableGridEditing]',
|
|
385
391
|
autocomplete: ['true', 'false']
|
|
@@ -591,6 +597,7 @@ SpoListSetCommand.booleanOptions = [
|
|
|
591
597
|
'allowMultiResponses',
|
|
592
598
|
'contentTypesEnabled',
|
|
593
599
|
'crawlNonDefaultViews',
|
|
600
|
+
'disableCommenting',
|
|
594
601
|
'disableGridEditing',
|
|
595
602
|
'enableAssignToEmail',
|
|
596
603
|
'enableAttachments',
|
|
@@ -18,6 +18,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
18
18
|
const Cli_1 = require("../../../../cli/Cli");
|
|
19
19
|
const request_1 = require("../../../../request");
|
|
20
20
|
const formatting_1 = require("../../../../utils/formatting");
|
|
21
|
+
const odata_1 = require("../../../../utils/odata");
|
|
21
22
|
const spo_1 = require("../../../../utils/spo");
|
|
22
23
|
const urlUtil_1 = require("../../../../utils/urlUtil");
|
|
23
24
|
const validation_1 = require("../../../../utils/validation");
|
|
@@ -41,63 +42,94 @@ class SpoListItemListCommand extends SpoCommand_1.default {
|
|
|
41
42
|
}
|
|
42
43
|
commandAction(logger, args) {
|
|
43
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
let
|
|
45
|
+
let listApiUrl = `${args.options.webUrl}/_api/web`;
|
|
45
46
|
if (args.options.listId) {
|
|
46
|
-
|
|
47
|
+
listApiUrl += `/lists(guid'${formatting_1.formatting.encodeQueryParameter(args.options.listId)}')`;
|
|
47
48
|
}
|
|
48
49
|
else if (args.options.listTitle) {
|
|
49
|
-
|
|
50
|
+
listApiUrl += `/lists/getByTitle('${formatting_1.formatting.encodeQueryParameter(args.options.listTitle)}')`;
|
|
50
51
|
}
|
|
51
52
|
else if (args.options.listUrl) {
|
|
52
53
|
const listServerRelativeUrl = urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.listUrl);
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
let formDigestValue = '';
|
|
56
|
-
const fieldsArray = args.options.fields ? args.options.fields.split(",")
|
|
57
|
-
: (!args.options.output || Cli_1.Cli.shouldTrimOutput(args.options.output)) ? ["Title", "Id"] : [];
|
|
58
|
-
const fieldsWithSlash = fieldsArray.filter(item => item.includes('/'));
|
|
59
|
-
const fieldsToExpand = fieldsWithSlash.map(e => e.split('/')[0]);
|
|
60
|
-
const expandFieldsArray = fieldsToExpand.filter((item, pos) => fieldsToExpand.indexOf(item) === pos);
|
|
54
|
+
listApiUrl += `/GetList('${formatting_1.formatting.encodeQueryParameter(listServerRelativeUrl)}')`;
|
|
55
|
+
}
|
|
61
56
|
try {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
57
|
+
const listItems = args.options.camlQuery
|
|
58
|
+
? yield this.getItemsUsingCAMLQuery(logger, args.options, listApiUrl)
|
|
59
|
+
: yield this.getItems(logger, args.options, listApiUrl);
|
|
60
|
+
listItems.forEach(v => delete v['ID']);
|
|
61
|
+
logger.log(listItems);
|
|
62
|
+
}
|
|
63
|
+
catch (err) {
|
|
64
|
+
this.handleRejectedODataJsonPromise(err);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
getItems(logger, options, listApiUrl) {
|
|
69
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
if (this.verbose) {
|
|
71
|
+
logger.logToStderr(`Getting list items`);
|
|
72
|
+
}
|
|
73
|
+
const queryParams = [];
|
|
74
|
+
const fieldsArray = options.fields ? options.fields.split(",")
|
|
75
|
+
: (!options.output || Cli_1.Cli.shouldTrimOutput(options.output)) ? ["Title", "Id"] : [];
|
|
76
|
+
const expandFieldsArray = this.getExpandFieldsArray(fieldsArray);
|
|
77
|
+
const skipTokenId = yield this.getLastItemIdForPage(logger, options, listApiUrl);
|
|
78
|
+
queryParams.push(`$top=${options.pageSize || 5000}`);
|
|
79
|
+
if (options.filter) {
|
|
80
|
+
queryParams.push(`$filter=${encodeURIComponent(options.filter)}`);
|
|
81
|
+
}
|
|
82
|
+
if (expandFieldsArray.length > 0) {
|
|
83
|
+
queryParams.push(`$expand=${expandFieldsArray.join(",")}`);
|
|
84
|
+
}
|
|
85
|
+
if (fieldsArray.length > 0) {
|
|
86
|
+
queryParams.push(`$select=${formatting_1.formatting.encodeQueryParameter(fieldsArray.join(","))}`);
|
|
87
|
+
}
|
|
88
|
+
if (skipTokenId !== undefined) {
|
|
89
|
+
queryParams.push(`$skiptoken=Paged=TRUE%26p_ID=${skipTokenId}`);
|
|
90
|
+
}
|
|
91
|
+
// If skiptoken is not found, then we are past the last page
|
|
92
|
+
if (options.pageNumber && Number(options.pageNumber) > 0 && skipTokenId === undefined) {
|
|
93
|
+
return [];
|
|
94
|
+
}
|
|
95
|
+
if (!options.pageSize) {
|
|
96
|
+
return yield odata_1.odata.getAllItems(`${listApiUrl}/items?${queryParams.join('&')}`);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
const requestOptions = {
|
|
100
|
+
url: `${listApiUrl}/items?${queryParams.join('&')}`,
|
|
101
|
+
headers: {
|
|
102
|
+
'accept': 'application/json;odata=nometadata'
|
|
103
|
+
},
|
|
104
|
+
responseType: 'json'
|
|
105
|
+
};
|
|
106
|
+
const listItemCollection = yield request_1.default.get(requestOptions);
|
|
107
|
+
return listItemCollection.value;
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
getItemsUsingCAMLQuery(logger, options, listApiUrl) {
|
|
112
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
113
|
+
const formDigestValue = (yield spo_1.spo.getRequestDigest(options.webUrl)).FormDigestValue;
|
|
114
|
+
if (this.verbose) {
|
|
115
|
+
logger.logToStderr(`Getting list items using CAML query`);
|
|
116
|
+
}
|
|
117
|
+
const items = [];
|
|
118
|
+
let skipTokenId = undefined;
|
|
119
|
+
do {
|
|
120
|
+
const requestBody = {
|
|
121
|
+
"query": {
|
|
122
|
+
"ViewXml": options.camlQuery,
|
|
123
|
+
"AllowIncrementalResults": true
|
|
65
124
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
if (args.options.pageNumber && Number(args.options.pageNumber) > 0) {
|
|
71
|
-
const rowLimit = `$top=${Number(args.options.pageSize) * Number(args.options.pageNumber)}`;
|
|
72
|
-
const filter = args.options.filter ? `$filter=${encodeURIComponent(args.options.filter)}` : ``;
|
|
73
|
-
const fieldSelect = `?$select=Id&${rowLimit}&${filter}`;
|
|
74
|
-
const requestOptions = {
|
|
75
|
-
url: `${requestUrl}/items${fieldSelect}`,
|
|
76
|
-
headers: {
|
|
77
|
-
'accept': 'application/json;odata=nometadata',
|
|
78
|
-
'X-RequestDigest': formDigestValue
|
|
79
|
-
},
|
|
80
|
-
responseType: 'json'
|
|
125
|
+
};
|
|
126
|
+
if (skipTokenId !== undefined) {
|
|
127
|
+
requestBody.query.ListItemCollectionPosition = {
|
|
128
|
+
"PagingInfo": `Paged=TRUE&p_ID=${skipTokenId}`
|
|
81
129
|
};
|
|
82
|
-
res = yield request_1.default.get(requestOptions);
|
|
83
130
|
}
|
|
84
|
-
const skipTokenId = (res && res.value && res.value.length && res.value[res.value.length - 1]) ? res.value[res.value.length - 1].Id : 0;
|
|
85
|
-
const skipToken = (args.options.pageNumber && Number(args.options.pageNumber) > 0 && skipTokenId > 0) ? `$skiptoken=Paged=TRUE%26p_ID=${res.value[res.value.length - 1].Id}` : ``;
|
|
86
|
-
const rowLimit = args.options.pageSize ? `$top=${args.options.pageSize}` : ``;
|
|
87
|
-
const filter = args.options.filter ? `$filter=${encodeURIComponent(args.options.filter)}` : ``;
|
|
88
|
-
const fieldExpand = expandFieldsArray.length > 0 ? `&$expand=${expandFieldsArray.join(",")}` : ``;
|
|
89
|
-
const fieldSelect = fieldsArray.length > 0 ?
|
|
90
|
-
`?$select=${formatting_1.formatting.encodeQueryParameter(fieldsArray.join(","))}${fieldExpand}&${rowLimit}&${skipToken}&${filter}` :
|
|
91
|
-
`?${rowLimit}&${skipToken}&${filter}`;
|
|
92
|
-
const requestBody = args.options.camlQuery ?
|
|
93
|
-
{
|
|
94
|
-
"query": {
|
|
95
|
-
"ViewXml": args.options.camlQuery
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
: ``;
|
|
99
131
|
const requestOptions = {
|
|
100
|
-
url: `${
|
|
132
|
+
url: `${listApiUrl}/GetItems`,
|
|
101
133
|
headers: {
|
|
102
134
|
'accept': 'application/json;odata=nometadata',
|
|
103
135
|
'X-RequestDigest': formDigestValue
|
|
@@ -105,13 +137,39 @@ class SpoListItemListCommand extends SpoCommand_1.default {
|
|
|
105
137
|
responseType: 'json',
|
|
106
138
|
data: requestBody
|
|
107
139
|
};
|
|
108
|
-
const listItemInstances =
|
|
109
|
-
listItemInstances.value.
|
|
110
|
-
|
|
140
|
+
const listItemInstances = yield request_1.default.post(requestOptions);
|
|
141
|
+
skipTokenId = listItemInstances.value.length > 0 ? listItemInstances.value[listItemInstances.value.length - 1].Id : undefined;
|
|
142
|
+
items.push(...listItemInstances.value);
|
|
143
|
+
} while (skipTokenId !== undefined);
|
|
144
|
+
return items;
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
getExpandFieldsArray(fieldsArray) {
|
|
148
|
+
const fieldsWithSlash = fieldsArray.filter(item => item.includes('/'));
|
|
149
|
+
const fieldsToExpand = fieldsWithSlash.map(e => e.split('/')[0]);
|
|
150
|
+
const expandFieldsArray = fieldsToExpand.filter((item, pos) => fieldsToExpand.indexOf(item) === pos);
|
|
151
|
+
return expandFieldsArray;
|
|
152
|
+
}
|
|
153
|
+
getLastItemIdForPage(logger, options, listApiUrl) {
|
|
154
|
+
var _a;
|
|
155
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
156
|
+
if (!options.pageNumber || Number(options.pageNumber) === 0) {
|
|
157
|
+
return undefined;
|
|
111
158
|
}
|
|
112
|
-
|
|
113
|
-
|
|
159
|
+
if (this.verbose) {
|
|
160
|
+
logger.logToStderr(`Getting skipToken Id for page ${options.pageNumber}`);
|
|
114
161
|
}
|
|
162
|
+
const rowLimit = `$top=${Number(options.pageSize) * Number(options.pageNumber)}`;
|
|
163
|
+
const filter = options.filter ? `$filter=${encodeURIComponent(options.filter)}` : ``;
|
|
164
|
+
const requestOptions = {
|
|
165
|
+
url: `${listApiUrl}/items?$select=Id&${rowLimit}&${filter}`,
|
|
166
|
+
headers: {
|
|
167
|
+
'accept': 'application/json;odata=nometadata'
|
|
168
|
+
},
|
|
169
|
+
responseType: 'json'
|
|
170
|
+
};
|
|
171
|
+
const response = yield request_1.default.get(requestOptions);
|
|
172
|
+
return (_a = response.value[response.value.length - 1]) === null || _a === void 0 ? void 0 : _a.Id;
|
|
115
173
|
});
|
|
116
174
|
}
|
|
117
175
|
}
|
|
@@ -155,16 +213,16 @@ _SpoListItemListCommand_instances = new WeakSet(), _SpoListItemListCommand_initT
|
|
|
155
213
|
return isValidSharePointUrl;
|
|
156
214
|
}
|
|
157
215
|
if (args.options.camlQuery && args.options.fields) {
|
|
158
|
-
return `
|
|
216
|
+
return `You cannot use the fields-option when specifying a camlQuery`;
|
|
159
217
|
}
|
|
160
218
|
if (args.options.camlQuery && args.options.pageSize) {
|
|
161
|
-
return `
|
|
219
|
+
return `You cannot use the pageSize-option when specifying a camlQuery`;
|
|
162
220
|
}
|
|
163
221
|
if (args.options.camlQuery && args.options.pageNumber) {
|
|
164
|
-
return `
|
|
222
|
+
return `You cannot use the pageNumber-option when specifying a camlQuery`;
|
|
165
223
|
}
|
|
166
224
|
if (args.options.pageSize && isNaN(Number(args.options.pageSize))) {
|
|
167
|
-
return `pageSize must be numeric`;
|
|
225
|
+
return `pageSize ${args.options.pageSize} must be numeric`;
|
|
168
226
|
}
|
|
169
227
|
if (args.options.pageNumber && !args.options.pageSize) {
|
|
170
228
|
return `pageSize must be specified if pageNumber is specified`;
|
|
@@ -0,0 +1,115 @@
|
|
|
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 _SpoSiteRecycleBinItemClearCommand_instances, _SpoSiteRecycleBinItemClearCommand_initTelemetry, _SpoSiteRecycleBinItemClearCommand_initOptions, _SpoSiteRecycleBinItemClearCommand_initValidators;
|
|
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
|
+
class SpoSiteRecycleBinItemClearCommand extends SpoCommand_1.default {
|
|
24
|
+
get name() {
|
|
25
|
+
return commands_1.default.SITE_RECYCLEBINITEM_CLEAR;
|
|
26
|
+
}
|
|
27
|
+
get description() {
|
|
28
|
+
return 'Permanently removes all items in a site recycle bin';
|
|
29
|
+
}
|
|
30
|
+
constructor() {
|
|
31
|
+
super();
|
|
32
|
+
_SpoSiteRecycleBinItemClearCommand_instances.add(this);
|
|
33
|
+
__classPrivateFieldGet(this, _SpoSiteRecycleBinItemClearCommand_instances, "m", _SpoSiteRecycleBinItemClearCommand_initTelemetry).call(this);
|
|
34
|
+
__classPrivateFieldGet(this, _SpoSiteRecycleBinItemClearCommand_instances, "m", _SpoSiteRecycleBinItemClearCommand_initOptions).call(this);
|
|
35
|
+
__classPrivateFieldGet(this, _SpoSiteRecycleBinItemClearCommand_instances, "m", _SpoSiteRecycleBinItemClearCommand_initValidators).call(this);
|
|
36
|
+
}
|
|
37
|
+
commandAction(logger, args) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
if (args.options.confirm) {
|
|
40
|
+
yield this.clearRecycleBin(args, logger);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
const result = yield Cli_1.Cli.prompt({
|
|
44
|
+
type: 'confirm',
|
|
45
|
+
name: 'continue',
|
|
46
|
+
default: false,
|
|
47
|
+
message: `Are you sure you want to clear the recycle bin of site ${args.options.siteUrl}?`
|
|
48
|
+
});
|
|
49
|
+
if (result.continue) {
|
|
50
|
+
yield this.clearRecycleBin(args, logger);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
clearRecycleBin(args, logger) {
|
|
56
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
try {
|
|
58
|
+
if (this.verbose) {
|
|
59
|
+
logger.logToStderr(`Permanently removing all items in recycle bin of site ${args.options.siteUrl}...`);
|
|
60
|
+
}
|
|
61
|
+
const requestOptions = {
|
|
62
|
+
headers: {
|
|
63
|
+
accept: 'application/json;odata=nometadata'
|
|
64
|
+
},
|
|
65
|
+
responseType: 'json'
|
|
66
|
+
};
|
|
67
|
+
if (args.options.secondary) {
|
|
68
|
+
if (this.verbose) {
|
|
69
|
+
logger.logToStderr('Removing all items from the second-stage recycle bin');
|
|
70
|
+
}
|
|
71
|
+
requestOptions.url = `${args.options.siteUrl}/_api/site/RecycleBin/DeleteAllSecondStageItems`;
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
if (this.verbose) {
|
|
75
|
+
logger.logToStderr('Removing all items from the first-stage recycle bin');
|
|
76
|
+
}
|
|
77
|
+
requestOptions.url = `${args.options.siteUrl}/_api/web/RecycleBin/DeleteAll`;
|
|
78
|
+
}
|
|
79
|
+
const result = yield request_1.default.post(requestOptions);
|
|
80
|
+
if (result['odata.null'] !== true) {
|
|
81
|
+
throw result;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
catch (err) {
|
|
85
|
+
this.handleRejectedODataJsonPromise(err);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
_SpoSiteRecycleBinItemClearCommand_instances = new WeakSet(), _SpoSiteRecycleBinItemClearCommand_initTelemetry = function _SpoSiteRecycleBinItemClearCommand_initTelemetry() {
|
|
91
|
+
this.telemetry.push((args) => {
|
|
92
|
+
Object.assign(this.telemetryProperties, {
|
|
93
|
+
secondary: !!args.options.secondary,
|
|
94
|
+
confirm: !!args.options.confirm
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
}, _SpoSiteRecycleBinItemClearCommand_initOptions = function _SpoSiteRecycleBinItemClearCommand_initOptions() {
|
|
98
|
+
this.options.unshift({
|
|
99
|
+
option: '-u, --siteUrl <siteUrl>'
|
|
100
|
+
}, {
|
|
101
|
+
option: '--secondary'
|
|
102
|
+
}, {
|
|
103
|
+
option: '--confirm'
|
|
104
|
+
});
|
|
105
|
+
}, _SpoSiteRecycleBinItemClearCommand_initValidators = function _SpoSiteRecycleBinItemClearCommand_initValidators() {
|
|
106
|
+
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
107
|
+
const isValidSharePointUrl = validation_1.validation.isValidSharePointUrl(args.options.siteUrl);
|
|
108
|
+
if (isValidSharePointUrl !== true) {
|
|
109
|
+
return isValidSharePointUrl;
|
|
110
|
+
}
|
|
111
|
+
return true;
|
|
112
|
+
}));
|
|
113
|
+
};
|
|
114
|
+
module.exports = new SpoSiteRecycleBinItemClearCommand();
|
|
115
|
+
//# sourceMappingURL=site-recyclebinitem-clear.js.map
|
|
@@ -14,6 +14,7 @@ exports.default = {
|
|
|
14
14
|
APP_UNINSTALL: `${prefix} app uninstall`,
|
|
15
15
|
APP_UPGRADE: `${prefix} app upgrade`,
|
|
16
16
|
APPLICATIONCUSTOMIZER_ADD: `${prefix} applicationcustomizer add`,
|
|
17
|
+
APPLICATIONCUSTOMIZER_GET: `${prefix} applicationcustomizer get`,
|
|
17
18
|
APPLICATIONCUSTOMIZER_LIST: `${prefix} applicationcustomizer list`,
|
|
18
19
|
APPPAGE_ADD: `${prefix} apppage add`,
|
|
19
20
|
APPPAGE_SET: `${prefix} apppage set`,
|
|
@@ -246,6 +247,7 @@ exports.default = {
|
|
|
246
247
|
SITE_HUBSITE_THEME_SYNC: `${prefix} site hubsite theme sync`,
|
|
247
248
|
SITE_LIST: `${prefix} site list`,
|
|
248
249
|
SITE_INPLACERECORDSMANAGEMENT_SET: `${prefix} site inplacerecordsmanagement set`,
|
|
250
|
+
SITE_RECYCLEBINITEM_CLEAR: `${prefix} site recyclebinitem clear`,
|
|
249
251
|
SITE_RECYCLEBINITEM_LIST: `${prefix} site recyclebinitem list`,
|
|
250
252
|
SITE_RECYCLEBINITEM_RESTORE: `${prefix} site recyclebinitem restore`,
|
|
251
253
|
SITE_REMOVE: `${prefix} site remove`,
|
|
@@ -99,7 +99,7 @@ class TeamsTeamAddCommand extends GraphCommand_1.default {
|
|
|
99
99
|
}
|
|
100
100
|
}));
|
|
101
101
|
let output;
|
|
102
|
-
if (
|
|
102
|
+
if (!args.options.wait) {
|
|
103
103
|
output = teamsAsyncOperation;
|
|
104
104
|
}
|
|
105
105
|
else {
|
|
@@ -139,7 +139,7 @@ _TeamsTeamAddCommand_instances = new WeakSet(), _TeamsTeamAddCommand_initTelemet
|
|
|
139
139
|
name: typeof args.options.name !== 'undefined',
|
|
140
140
|
description: typeof args.options.description !== 'undefined',
|
|
141
141
|
template: typeof args.options.template !== 'undefined',
|
|
142
|
-
wait: args.options.wait
|
|
142
|
+
wait: !!args.options.wait
|
|
143
143
|
});
|
|
144
144
|
});
|
|
145
145
|
}, _TeamsTeamAddCommand_initOptions = function _TeamsTeamAddCommand_initOptions() {
|
package/dist/request.js
CHANGED
|
@@ -123,6 +123,7 @@ class Request {
|
|
|
123
123
|
if (!this._logger) {
|
|
124
124
|
return Promise.reject('Logger not set on the request object');
|
|
125
125
|
}
|
|
126
|
+
this.updateRequestForCloudType(options, Auth_1.default.service.cloudType);
|
|
126
127
|
return new Promise((_resolve, _reject) => {
|
|
127
128
|
(() => {
|
|
128
129
|
if (options.headers && options.headers['x-anonymous']) {
|
|
@@ -181,6 +182,12 @@ class Request {
|
|
|
181
182
|
});
|
|
182
183
|
});
|
|
183
184
|
}
|
|
185
|
+
updateRequestForCloudType(options, cloudType) {
|
|
186
|
+
const url = new URL(options.url);
|
|
187
|
+
const hostname = `${url.protocol}//${url.hostname}`;
|
|
188
|
+
const cloudUrl = Auth_1.Auth.getEndpointForResource(hostname, cloudType);
|
|
189
|
+
options.url = options.url.replace(hostname, cloudUrl);
|
|
190
|
+
}
|
|
184
191
|
}
|
|
185
192
|
exports.default = new Request();
|
|
186
193
|
//# sourceMappingURL=request.js.map
|