@pnp/cli-microsoft365 6.0.0-beta.7d5fdf6 → 6.0.0-beta.b689fd4

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.
Files changed (54) hide show
  1. package/dist/m365/aad/commands/app/app-remove.js +0 -4
  2. package/dist/m365/aad/commands/app/app-role-remove.js +0 -4
  3. package/dist/m365/aad/commands/o365group/o365group-recyclebinitem-restore.js +60 -9
  4. package/dist/m365/aad/commands.js +0 -2
  5. package/dist/m365/planner/commands/bucket/bucket-add.js +4 -12
  6. package/dist/m365/planner/commands/bucket/bucket-get.js +4 -12
  7. package/dist/m365/planner/commands/bucket/bucket-list.js +4 -12
  8. package/dist/m365/planner/commands/bucket/bucket-remove.js +4 -12
  9. package/dist/m365/planner/commands/bucket/bucket-set.js +4 -12
  10. package/dist/m365/planner/commands/plan/plan-get.js +0 -4
  11. package/dist/m365/planner/commands/task/task-add.js +4 -10
  12. package/dist/m365/planner/commands/task/task-get.js +4 -19
  13. package/dist/m365/planner/commands/task/task-list.js +4 -12
  14. package/dist/m365/planner/commands/task/task-set.js +4 -10
  15. package/dist/m365/planner/commands.js +0 -2
  16. package/dist/m365/spo/commands/customaction/customaction-get.js +32 -4
  17. package/dist/m365/spo/commands/customaction/customaction-remove.js +43 -8
  18. package/dist/m365/spo/commands/list/list-list.js +1 -10
  19. package/dist/m365/spo/commands/listitem/listitem-list.js +4 -25
  20. package/dist/m365/spo/commands/site/site-list.js +47 -16
  21. package/dist/m365/spo/commands/site/site-set.js +322 -162
  22. package/dist/m365/spo/commands/tenant/tenant-appcatalog-add.js +9 -6
  23. package/dist/m365/spo/commands.js +0 -3
  24. package/dist/m365/teams/commands/team/team-clone.js +33 -7
  25. package/dist/m365/teams/commands/team/team-set.js +25 -5
  26. package/docs/docs/cmd/aad/app/app-remove.md +0 -6
  27. package/docs/docs/cmd/aad/app/app-role-remove.md +0 -6
  28. package/docs/docs/cmd/aad/o365group/o365group-recyclebinitem-restore.md +21 -3
  29. package/docs/docs/cmd/planner/bucket/bucket-add.md +0 -3
  30. package/docs/docs/cmd/planner/bucket/bucket-get.md +0 -3
  31. package/docs/docs/cmd/planner/bucket/bucket-list.md +0 -3
  32. package/docs/docs/cmd/planner/bucket/bucket-remove.md +0 -3
  33. package/docs/docs/cmd/planner/bucket/bucket-set.md +0 -3
  34. package/docs/docs/cmd/planner/plan/plan-get.md +0 -6
  35. package/docs/docs/cmd/planner/task/task-add.md +0 -3
  36. package/docs/docs/cmd/planner/task/task-get.md +0 -3
  37. package/docs/docs/cmd/planner/task/task-list.md +0 -3
  38. package/docs/docs/cmd/planner/task/task-set.md +0 -3
  39. package/docs/docs/cmd/spo/customaction/customaction-get.md +15 -2
  40. package/docs/docs/cmd/spo/customaction/customaction-remove.md +33 -2
  41. package/docs/docs/cmd/spo/list/list-list.md +0 -3
  42. package/docs/docs/cmd/spo/listitem/listitem-list.md +0 -6
  43. package/docs/docs/cmd/spo/site/site-list.md +19 -7
  44. package/docs/docs/cmd/spo/site/site-set.md +50 -6
  45. package/docs/docs/cmd/teams/team/team-clone.md +11 -5
  46. package/docs/docs/cmd/teams/team/team-set.md +10 -4
  47. package/npm-shrinkwrap.json +173 -158
  48. package/package.json +13 -13
  49. package/dist/m365/spo/commands/site/site-classic-add.js +0 -333
  50. package/dist/m365/spo/commands/site/site-classic-list.js +0 -98
  51. package/dist/m365/spo/commands/site/site-classic-set.js +0 -358
  52. package/docs/docs/cmd/spo/site/site-classic-add.md +0 -93
  53. package/docs/docs/cmd/spo/site/site-classic-list.md +0 -65
  54. package/docs/docs/cmd/spo/site/site-classic-set.md +0 -99
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnp/cli-microsoft365",
3
- "version": "6.0.0-beta.7d5fdf6",
3
+ "version": "6.0.0-beta.b689fd4",
4
4
  "description": "Manage Microsoft 365 and SharePoint Framework projects on any platform",
5
5
  "license": "MIT",
6
6
  "main": "./dist/api.js",
@@ -186,8 +186,8 @@
186
186
  "Wojcik, Adam <adam.wojcik.it@gmail.com>"
187
187
  ],
188
188
  "dependencies": {
189
- "@azure/msal-node": "^1.9.1",
190
- "@xmldom/xmldom": "^0.7.5",
189
+ "@azure/msal-node": "^1.11.0",
190
+ "@xmldom/xmldom": "^0.8.2",
191
191
  "adaptive-expressions": "^4.16.0",
192
192
  "adaptivecards": "^2.10.0",
193
193
  "adaptivecards-templating": "^2.2.0",
@@ -196,7 +196,7 @@
196
196
  "axios": "^0.27.2",
197
197
  "chalk": "^4.1.2",
198
198
  "clipboardy": "^2.3.0",
199
- "csv-stringify": "^6.1.0",
199
+ "csv-stringify": "^6.2.0",
200
200
  "easy-table": "^1.2.0",
201
201
  "inquirer": "^8.2.4",
202
202
  "jmespath": "^0.16.0",
@@ -207,28 +207,28 @@
207
207
  "open": "^8.4.0",
208
208
  "semver": "^7.3.7",
209
209
  "strip-json-comments": "^3.1.1",
210
- "typescript": "^4.7.3",
210
+ "typescript": "^4.7.4",
211
211
  "update-notifier": "^5.1.0",
212
212
  "uuid": "^8.3.2"
213
213
  },
214
214
  "devDependencies": {
215
- "@microsoft/microsoft-graph-types": "^2.20.0",
215
+ "@microsoft/microsoft-graph-types": "^2.22.0",
216
216
  "@types/adm-zip": "^0.5.0",
217
217
  "@types/inquirer": "^8.2.1",
218
218
  "@types/jmespath": "^0.15.0",
219
219
  "@types/json-to-ast": "^2.1.2",
220
220
  "@types/minimist": "^1.2.2",
221
221
  "@types/mocha": "^9.1.1",
222
- "@types/node": "^16.11.38",
223
- "@types/node-forge": "^1.0.2",
224
- "@types/semver": "^7.3.9",
225
- "@types/sinon": "^10.0.11",
222
+ "@types/node": "^16.11.43",
223
+ "@types/node-forge": "^1.0.3",
224
+ "@types/semver": "^7.3.10",
225
+ "@types/sinon": "^10.0.12",
226
226
  "@types/update-notifier": "^5.1.0",
227
227
  "@types/uuid": "^8.3.4",
228
- "@typescript-eslint/eslint-plugin": "^5.27.1",
229
- "@typescript-eslint/parser": "^5.27.1",
228
+ "@typescript-eslint/eslint-plugin": "^5.30.5",
229
+ "@typescript-eslint/parser": "^5.30.5",
230
230
  "c8": "^7.11.3",
231
- "eslint": "^8.17.0",
231
+ "eslint": "^8.19.0",
232
232
  "eslint-config-standard": "^17.0.0",
233
233
  "eslint-plugin-cli-microsoft365": "file:eslint-rules",
234
234
  "eslint-plugin-import": "^2.26.0",
@@ -1,333 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const config_1 = require("../../../../config");
4
- const request_1 = require("../../../../request");
5
- const utils_1 = require("../../../../utils");
6
- const SpoCommand_1 = require("../../../base/SpoCommand");
7
- const commands_1 = require("../../commands");
8
- class SpoSiteClassicAddCommand extends SpoCommand_1.default {
9
- get name() {
10
- return commands_1.default.SITE_CLASSIC_ADD;
11
- }
12
- get description() {
13
- return 'Creates new classic site';
14
- }
15
- getTelemetryProperties(args) {
16
- const telemetryProps = super.getTelemetryProperties(args);
17
- telemetryProps.lcid = typeof args.options.lcid !== 'undefined';
18
- telemetryProps.webTemplate = typeof args.options.webTemplate !== 'undefined';
19
- telemetryProps.resourceQuota = typeof args.options.resourceQuota !== 'undefined';
20
- telemetryProps.resourceQuotaWarningLevel = typeof args.options.resourceQuotaWarningLevel !== 'undefined';
21
- telemetryProps.storageQuota = typeof args.options.storageQuota !== 'undefined';
22
- telemetryProps.storageQuotaWarningLevel = typeof args.options.storageQuotaWarningLevel !== 'undefined';
23
- telemetryProps.removeDeletedSite = args.options.removeDeletedSite;
24
- telemetryProps.wait = args.options.wait;
25
- return telemetryProps;
26
- }
27
- commandAction(logger, args, cb) {
28
- this.dots = '';
29
- this.showDeprecationWarning(logger, commands_1.default.SITE_CLASSIC_ADD, commands_1.default.SITE_ADD);
30
- utils_1.spo
31
- .getSpoAdminUrl(logger, this.debug)
32
- .then((_spoAdminUrl) => {
33
- this.spoAdminUrl = _spoAdminUrl;
34
- return utils_1.spo.ensureFormDigest(this.spoAdminUrl, logger, this.context, this.debug);
35
- })
36
- .then((res) => {
37
- this.context = res;
38
- if (args.options.removeDeletedSite) {
39
- return this.siteExistsInTheRecycleBin(args.options.url, logger);
40
- }
41
- else {
42
- // assume site doesn't exist
43
- return Promise.resolve(false);
44
- }
45
- })
46
- .then((exists) => {
47
- if (exists) {
48
- if (this.verbose) {
49
- logger.logToStderr('Site exists in the recycle bin');
50
- }
51
- return this.deleteSiteFromTheRecycleBin(args.options.url, args.options.wait, logger);
52
- }
53
- else {
54
- if (this.verbose) {
55
- logger.logToStderr('Site not found');
56
- }
57
- return Promise.resolve();
58
- }
59
- })
60
- .then(() => {
61
- return utils_1.spo.ensureFormDigest(this.spoAdminUrl, logger, this.context, this.debug);
62
- })
63
- .then((res) => {
64
- this.context = res;
65
- if (this.verbose) {
66
- logger.logToStderr(`Creating site collection ${args.options.url}...`);
67
- }
68
- const lcid = typeof args.options.lcid === 'number' ? args.options.lcid : 1033;
69
- const storageQuota = typeof args.options.storageQuota === 'number' ? args.options.storageQuota : 100;
70
- const storageQuotaWarningLevel = typeof args.options.storageQuotaWarningLevel === 'number' ? args.options.storageQuotaWarningLevel : 100;
71
- const resourceQuota = typeof args.options.resourceQuota === 'number' ? args.options.resourceQuota : 0;
72
- const resourceQuotaWarningLevel = typeof args.options.resourceQuotaWarningLevel === 'number' ? args.options.resourceQuotaWarningLevel : 0;
73
- const webTemplate = args.options.webTemplate || 'STS#0';
74
- const requestOptions = {
75
- url: `${this.spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
76
- headers: {
77
- 'X-RequestDigest': this.context.FormDigestValue
78
- },
79
- data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config_1.default.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="4" ObjectPathId="3" /><ObjectPath Id="6" ObjectPathId="5" /><Query Id="7" ObjectPathId="3"><Query SelectAllProperties="true"><Properties /></Query></Query><Query Id="8" ObjectPathId="5"><Query SelectAllProperties="false"><Properties><Property Name="IsComplete" ScalarProperty="true" /><Property Name="PollingInterval" ScalarProperty="true" /></Properties></Query></Query></Actions><ObjectPaths><Constructor Id="3" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /><Method Id="5" ParentId="3" Name="CreateSite"><Parameters><Parameter TypeId="{11f84fff-b8cf-47b6-8b50-34e692656606}"><Property Name="CompatibilityLevel" Type="Int32">0</Property><Property Name="Lcid" Type="UInt32">${lcid}</Property><Property Name="Owner" Type="String">${utils_1.formatting.escapeXml(args.options.owner)}</Property><Property Name="StorageMaximumLevel" Type="Int64">${storageQuota}</Property><Property Name="StorageWarningLevel" Type="Int64">${storageQuotaWarningLevel}</Property><Property Name="Template" Type="String">${utils_1.formatting.escapeXml(webTemplate)}</Property><Property Name="TimeZoneId" Type="Int32">${args.options.timeZone}</Property><Property Name="Title" Type="String">${utils_1.formatting.escapeXml(args.options.title)}</Property><Property Name="Url" Type="String">${utils_1.formatting.escapeXml(args.options.url)}</Property><Property Name="UserCodeMaximumLevel" Type="Double">${resourceQuota}</Property><Property Name="UserCodeWarningLevel" Type="Double">${resourceQuotaWarningLevel}</Property></Parameter></Parameters></Method></ObjectPaths></Request>`
80
- };
81
- return request_1.default.post(requestOptions);
82
- })
83
- .then((res) => {
84
- return new Promise((resolve, reject) => {
85
- const json = JSON.parse(res);
86
- const response = json[0];
87
- if (response.ErrorInfo) {
88
- reject(response.ErrorInfo.ErrorMessage);
89
- }
90
- else {
91
- const operation = json[json.length - 1];
92
- const isComplete = operation.IsComplete;
93
- if (!args.options.wait || isComplete) {
94
- resolve();
95
- return;
96
- }
97
- setTimeout(() => {
98
- utils_1.spo.waitUntilFinished({
99
- operationId: JSON.stringify(operation._ObjectIdentity_),
100
- siteUrl: this.spoAdminUrl,
101
- resolve,
102
- reject,
103
- logger,
104
- currentContext: this.context,
105
- dots: this.dots,
106
- debug: this.debug,
107
- verbose: this.verbose
108
- });
109
- }, operation.PollingInterval);
110
- }
111
- });
112
- })
113
- .then(_ => cb(), (err) => this.handleRejectedPromise(err, logger, cb));
114
- }
115
- siteExistsInTheRecycleBin(url, logger) {
116
- return new Promise((resolve, reject) => {
117
- utils_1.spo
118
- .ensureFormDigest(this.spoAdminUrl, logger, this.context, this.debug)
119
- .then((res) => {
120
- this.context = res;
121
- if (this.verbose) {
122
- logger.logToStderr(`Checking if the site ${url} exists...`);
123
- }
124
- const requestOptions = {
125
- url: `${this.spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
126
- headers: {
127
- 'X-RequestDigest': this.context.FormDigestValue
128
- },
129
- data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config_1.default.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="197" ObjectPathId="196" /><ObjectPath Id="199" ObjectPathId="198" /><Query Id="200" ObjectPathId="198"><Query SelectAllProperties="true"><Properties /></Query></Query></Actions><ObjectPaths><Constructor Id="196" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /><Method Id="198" ParentId="196" Name="GetSitePropertiesByUrl"><Parameters><Parameter Type="String">${utils_1.formatting.escapeXml(url)}</Parameter><Parameter Type="Boolean">false</Parameter></Parameters></Method></ObjectPaths></Request>`
130
- };
131
- return request_1.default.post(requestOptions);
132
- })
133
- .then((res) => {
134
- const json = JSON.parse(res);
135
- const response = json[0];
136
- if (response.ErrorInfo) {
137
- if (response.ErrorInfo.ErrorTypeName === 'Microsoft.Online.SharePoint.Common.SpoNoSiteException') {
138
- return Promise.resolve(false);
139
- }
140
- else {
141
- return Promise.reject(response.ErrorInfo.ErrorMessage);
142
- }
143
- }
144
- else {
145
- const site = json[json.length - 1];
146
- if (site.Status === 'Recycled') {
147
- return Promise.reject(true);
148
- }
149
- else {
150
- return Promise.resolve(false);
151
- }
152
- }
153
- })
154
- .then(() => {
155
- if (this.verbose) {
156
- logger.logToStderr(`Site doesn't exist. Checking if the site ${url} exists in the recycle bin...`);
157
- }
158
- const requestOptions = {
159
- url: `${this.spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
160
- headers: {
161
- 'X-RequestDigest': this.context.FormDigestValue
162
- },
163
- data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config_1.default.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="181" ObjectPathId="180" /><Query Id="182" ObjectPathId="180"><Query SelectAllProperties="true"><Properties /></Query></Query></Actions><ObjectPaths><Method Id="180" ParentId="175" Name="GetDeletedSitePropertiesByUrl"><Parameters><Parameter Type="String">${utils_1.formatting.escapeXml(url)}</Parameter></Parameters></Method><Constructor Id="175" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /></ObjectPaths></Request>`
164
- };
165
- return request_1.default.post(requestOptions);
166
- })
167
- .then((res) => {
168
- const json = JSON.parse(res);
169
- const response = json[0];
170
- if (response.ErrorInfo) {
171
- if (response.ErrorInfo.ErrorTypeName === 'Microsoft.SharePoint.Client.UnknownError') {
172
- resolve(false);
173
- }
174
- else {
175
- reject(response.ErrorInfo.ErrorMessage);
176
- }
177
- }
178
- else {
179
- const site = json[json.length - 1];
180
- if (site.Status === 'Recycled') {
181
- resolve(true);
182
- }
183
- else {
184
- resolve(false);
185
- }
186
- }
187
- }, (error) => {
188
- if (typeof error === 'boolean') {
189
- resolve(error);
190
- }
191
- else {
192
- reject(error);
193
- }
194
- });
195
- });
196
- }
197
- deleteSiteFromTheRecycleBin(url, wait, logger) {
198
- return new Promise((resolve, reject) => {
199
- utils_1.spo
200
- .ensureFormDigest(this.spoAdminUrl, logger, this.context, this.debug)
201
- .then((res) => {
202
- this.context = res;
203
- if (this.verbose) {
204
- logger.logToStderr(`Deleting site ${url} from the recycle bin...`);
205
- }
206
- const requestOptions = {
207
- url: `${this.spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
208
- headers: {
209
- 'X-RequestDigest': this.context.FormDigestValue
210
- },
211
- data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config_1.default.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="185" ObjectPathId="184" /><Query Id="186" ObjectPathId="184"><Query SelectAllProperties="false"><Properties><Property Name="IsComplete" ScalarProperty="true" /><Property Name="PollingInterval" ScalarProperty="true" /></Properties></Query></Query></Actions><ObjectPaths><Method Id="184" ParentId="175" Name="RemoveDeletedSite"><Parameters><Parameter Type="String">${utils_1.formatting.escapeXml(url)}</Parameter></Parameters></Method><Constructor Id="175" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /></ObjectPaths></Request>`
212
- };
213
- return request_1.default.post(requestOptions);
214
- })
215
- .then((res) => {
216
- const json = JSON.parse(res);
217
- const response = json[0];
218
- if (response.ErrorInfo) {
219
- reject(response.ErrorInfo.ErrorMessage);
220
- }
221
- else {
222
- const operation = json[json.length - 1];
223
- const isComplete = operation.IsComplete;
224
- if (!wait || isComplete) {
225
- resolve();
226
- return;
227
- }
228
- setTimeout(() => {
229
- utils_1.spo.waitUntilFinished({
230
- operationId: JSON.stringify(operation._ObjectIdentity_),
231
- siteUrl: this.spoAdminUrl,
232
- resolve,
233
- reject,
234
- logger,
235
- currentContext: this.context,
236
- dots: this.dots,
237
- verbose: this.verbose,
238
- debug: this.debug
239
- });
240
- }, operation.PollingInterval);
241
- }
242
- });
243
- });
244
- }
245
- options() {
246
- const options = [
247
- {
248
- option: '-u, --url <url>'
249
- },
250
- {
251
- option: '-t, --title <title>'
252
- },
253
- {
254
- option: '--owner <owner>'
255
- },
256
- {
257
- option: '-z, --timeZone <timeZone>'
258
- },
259
- {
260
- option: '-l, --lcid [lcid]'
261
- },
262
- {
263
- option: '-w, --webTemplate [webTemplate]'
264
- },
265
- {
266
- option: '--resourceQuota [resourceQuota]'
267
- },
268
- {
269
- option: '--resourceQuotaWarningLevel [resourceQuotaWarningLevel]'
270
- },
271
- {
272
- option: '--storageQuota [storageQuota]'
273
- },
274
- {
275
- option: '--storageQuotaWarningLevel [storageQuotaWarningLevel]'
276
- },
277
- {
278
- option: '--removeDeletedSite'
279
- },
280
- {
281
- option: '--wait'
282
- }
283
- ];
284
- const parentOptions = super.options();
285
- return options.concat(parentOptions);
286
- }
287
- validate(args) {
288
- const isValidSharePointUrl = utils_1.validation.isValidSharePointUrl(args.options.url);
289
- if (isValidSharePointUrl !== true) {
290
- return isValidSharePointUrl;
291
- }
292
- if (typeof args.options.timeZone !== 'number') {
293
- return `${args.options.timeZone} is not a number`;
294
- }
295
- if (args.options.lcid &&
296
- typeof args.options.lcid !== 'number') {
297
- return `${args.options.lcid} is not a number`;
298
- }
299
- if (args.options.resourceQuota &&
300
- typeof args.options.resourceQuota !== 'number') {
301
- return `${args.options.resourceQuota} is not a number`;
302
- }
303
- if (args.options.resourceQuotaWarningLevel &&
304
- typeof args.options.resourceQuotaWarningLevel !== 'number') {
305
- return `${args.options.resourceQuotaWarningLevel} is not a number`;
306
- }
307
- if (args.options.resourceQuotaWarningLevel &&
308
- !args.options.resourceQuota) {
309
- return `You cannot specify resourceQuotaWarningLevel without specifying resourceQuota`;
310
- }
311
- if (args.options.resourceQuotaWarningLevel > args.options.resourceQuota) {
312
- return `resourceQuotaWarningLevel cannot exceed resourceQuota`;
313
- }
314
- if (args.options.storageQuota &&
315
- typeof args.options.storageQuota !== 'number') {
316
- return `${args.options.storageQuota} is not a number`;
317
- }
318
- if (args.options.storageQuotaWarningLevel &&
319
- typeof args.options.storageQuotaWarningLevel !== 'number') {
320
- return `${args.options.storageQuotaWarningLevel} is not a number`;
321
- }
322
- if (args.options.storageQuotaWarningLevel &&
323
- !args.options.storageQuota) {
324
- return `You cannot specify storageQuotaWarningLevel without specifying storageQuota`;
325
- }
326
- if (args.options.storageQuotaWarningLevel > args.options.storageQuota) {
327
- return `storageQuotaWarningLevel cannot exceed storageQuota`;
328
- }
329
- return true;
330
- }
331
- }
332
- module.exports = new SpoSiteClassicAddCommand();
333
- //# sourceMappingURL=site-classic-add.js.map
@@ -1,98 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const config_1 = require("../../../../config");
4
- const request_1 = require("../../../../request");
5
- const utils_1 = require("../../../../utils");
6
- const SpoCommand_1 = require("../../../base/SpoCommand");
7
- const commands_1 = require("../../commands");
8
- class SpoSiteClassicListCommand extends SpoCommand_1.default {
9
- get name() {
10
- return commands_1.default.SITE_CLASSIC_LIST;
11
- }
12
- get description() {
13
- return 'Lists sites of the given type';
14
- }
15
- getTelemetryProperties(args) {
16
- const telemetryProps = super.getTelemetryProperties(args);
17
- telemetryProps.webTemplate = args.options.webTemplate;
18
- telemetryProps.filter = (!(!args.options.filter)).toString();
19
- telemetryProps.includeOneDriveSites = args.options.includeOneDriveSites;
20
- return telemetryProps;
21
- }
22
- defaultProperties() {
23
- return ['Title', 'Url'];
24
- }
25
- commandAction(logger, args, cb) {
26
- const webTemplate = args.options.webTemplate || '';
27
- const includeOneDriveSites = args.options.includeOneDriveSites || false;
28
- const personalSite = includeOneDriveSites === false ? '0' : '1';
29
- let spoAdminUrl = '';
30
- utils_1.spo
31
- .getSpoAdminUrl(logger, this.debug)
32
- .then((_spoAdminUrl) => {
33
- spoAdminUrl = _spoAdminUrl;
34
- if (this.verbose) {
35
- logger.logToStderr(`Retrieving list of site collections...`);
36
- }
37
- this.allSites = [];
38
- return this.getAllSites(spoAdminUrl, utils_1.formatting.escapeXml(args.options.filter || ''), '0', personalSite, webTemplate, undefined, logger);
39
- })
40
- .then(_ => {
41
- logger.log(this.allSites);
42
- cb();
43
- }, (err) => this.handleRejectedPromise(err, logger, cb));
44
- }
45
- getAllSites(spoAdminUrl, filter, startIndex, personalSite, webTemplate, formDigest, logger) {
46
- return new Promise((resolve, reject) => {
47
- utils_1.spo
48
- .ensureFormDigest(spoAdminUrl, logger, formDigest, this.debug)
49
- .then((res) => {
50
- const requestOptions = {
51
- url: `${spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
52
- headers: {
53
- 'X-RequestDigest': res.FormDigestValue
54
- },
55
- data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config_1.default.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="2" ObjectPathId="1" /><ObjectPath Id="4" ObjectPathId="3" /><Query Id="5" ObjectPathId="3"><Query SelectAllProperties="true"><Properties /></Query><ChildItemQuery SelectAllProperties="true"><Properties /></ChildItemQuery></Query></Actions><ObjectPaths><Constructor Id="1" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /><Method Id="3" ParentId="1" Name="GetSitePropertiesFromSharePointByFilters"><Parameters><Parameter TypeId="{b92aeee2-c92c-4b67-abcc-024e471bc140}"><Property Name="Filter" Type="String">${filter}</Property><Property Name="IncludeDetail" Type="Boolean">false</Property><Property Name="IncludePersonalSite" Type="Enum">${personalSite}</Property><Property Name="StartIndex" Type="String">${startIndex}</Property><Property Name="Template" Type="String">${webTemplate}</Property></Parameter></Parameters></Method></ObjectPaths></Request>`
56
- };
57
- return request_1.default.post(requestOptions);
58
- })
59
- .then((res) => {
60
- const json = JSON.parse(res);
61
- const response = json[0];
62
- if (response.ErrorInfo) {
63
- reject(response.ErrorInfo.ErrorMessage);
64
- return;
65
- }
66
- else {
67
- const sites = json[json.length - 1];
68
- this.allSites.push(...sites._Child_Items_);
69
- if (sites.NextStartIndexFromSharePoint) {
70
- this
71
- .getAllSites(spoAdminUrl, filter, sites.NextStartIndexFromSharePoint, personalSite, webTemplate, formDigest, logger)
72
- .then(_ => resolve(), err => reject(err));
73
- }
74
- else {
75
- resolve();
76
- }
77
- }
78
- }, err => reject(err));
79
- });
80
- }
81
- options() {
82
- const options = [
83
- {
84
- option: '-t, --webTemplate [webTemplate]'
85
- },
86
- {
87
- option: '-f, --filter [filter]'
88
- },
89
- {
90
- option: '--includeOneDriveSites'
91
- }
92
- ];
93
- const parentOptions = super.options();
94
- return options.concat(parentOptions);
95
- }
96
- }
97
- module.exports = new SpoSiteClassicListCommand();
98
- //# sourceMappingURL=site-classic-list.js.map