@pnp/cli-microsoft365 12.1.0-beta.0c2915d → 12.1.0-beta.ab87e08

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 (31) hide show
  1. package/allCommands.json +1 -1
  2. package/allCommandsFull.json +1 -1
  3. package/dist/m365/spo/commands/page/page-add.js +31 -68
  4. package/dist/m365/spo/commands/page/page-clientsidewebpart-add.js +74 -101
  5. package/dist/m365/spo/commands/page/page-column-get.js +15 -32
  6. package/dist/m365/spo/commands/page/page-column-list.js +14 -27
  7. package/dist/m365/spo/commands/page/page-control-get.js +18 -27
  8. package/dist/m365/spo/commands/page/page-control-list.js +13 -20
  9. package/dist/m365/spo/commands/page/page-control-remove.js +1 -1
  10. package/dist/m365/spo/commands/page/page-control-set.js +51 -61
  11. package/dist/m365/spo/commands/page/page-copy.js +15 -31
  12. package/dist/m365/spo/commands/page/page-header-set.js +25 -89
  13. package/dist/m365/spo/commands/page/page-list.js +12 -18
  14. package/dist/m365/spo/commands/page/page-remove.js +16 -39
  15. package/dist/m365/spo/commands/page/page-section-add.js +108 -173
  16. package/dist/m365/spo/commands/page/page-section-get.js +17 -27
  17. package/dist/m365/spo/commands/page/page-section-list.js +13 -20
  18. package/dist/m365/spo/commands/page/page-section-remove.js +4 -1
  19. package/dist/m365/spo/commands/page/page-set.js +50 -100
  20. package/dist/m365/spo/commands/page/page-template-list.js +12 -18
  21. package/dist/m365/spo/commands/page/page-text-add.js +23 -45
  22. package/docs/docs/cmd/spo/listitem/listitem-record-declare.mdx +19 -0
  23. package/docs/docs/cmd/spo/listitem/listitem-record-lock.mdx +21 -0
  24. package/docs/docs/cmd/spo/listitem/listitem-record-undeclare.mdx +21 -0
  25. package/docs/docs/cmd/spo/listitem/listitem-record-unlock.mdx +21 -0
  26. package/docs/docs/cmd/spo/page/page-text-add.mdx +1 -1
  27. package/docs/docs/cmd/viva/engage/engage-community-add.mdx +19 -0
  28. package/docs/docs/cmd/viva/engage/engage-community-get.mdx +19 -0
  29. package/docs/docs/cmd/viva/engage/engage-community-remove.mdx +21 -0
  30. package/docs/docs/cmd/viva/engage/engage-community-set.mdx +19 -0
  31. package/package.json +1 -1
@@ -1,9 +1,5 @@
1
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
- 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");
4
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
- };
6
- var _SpoPageAddCommand_instances, _SpoPageAddCommand_initTelemetry, _SpoPageAddCommand_initOptions, _SpoPageAddCommand_initValidators;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
7
3
  import request from '../../../../request.js';
8
4
  import { formatting } from '../../../../utils/formatting.js';
9
5
  import { spo } from '../../../../utils/spo.js';
@@ -12,6 +8,22 @@ import { validation } from '../../../../utils/validation.js';
12
8
  import SpoCommand from '../../../base/SpoCommand.js';
13
9
  import commands from '../../commands.js';
14
10
  import { Page, supportedPageLayouts, supportedPromoteAs } from './Page.js';
11
+ export const options = z.strictObject({
12
+ ...globalOptionsZod.shape,
13
+ webUrl: z.string()
14
+ .refine(url => validation.isValidSharePointUrl(url) === true, {
15
+ error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
16
+ })
17
+ .alias('u'),
18
+ name: z.string().alias('n'),
19
+ title: z.string().optional().alias('t'),
20
+ layoutType: z.enum(supportedPageLayouts).optional().alias('l'),
21
+ promoteAs: z.enum(supportedPromoteAs).optional().alias('p'),
22
+ commentsEnabled: z.boolean().optional(),
23
+ publish: z.boolean().optional(),
24
+ publishMessage: z.string().optional(),
25
+ description: z.string().optional()
26
+ });
15
27
  class SpoPageAddCommand extends SpoCommand {
16
28
  get name() {
17
29
  return commands.PAGE_ADD;
@@ -19,12 +31,19 @@ class SpoPageAddCommand extends SpoCommand {
19
31
  get description() {
20
32
  return 'Creates modern page';
21
33
  }
22
- constructor() {
23
- super();
24
- _SpoPageAddCommand_instances.add(this);
25
- __classPrivateFieldGet(this, _SpoPageAddCommand_instances, "m", _SpoPageAddCommand_initTelemetry).call(this);
26
- __classPrivateFieldGet(this, _SpoPageAddCommand_instances, "m", _SpoPageAddCommand_initOptions).call(this);
27
- __classPrivateFieldGet(this, _SpoPageAddCommand_instances, "m", _SpoPageAddCommand_initValidators).call(this);
34
+ get schema() {
35
+ return options;
36
+ }
37
+ getRefinedSchema(schema) {
38
+ return schema
39
+ .refine(opts => opts.promoteAs !== 'HomePage' || opts.layoutType === 'Home', {
40
+ error: 'You can only promote home pages as site home page',
41
+ path: ['promoteAs']
42
+ })
43
+ .refine(opts => opts.promoteAs !== 'NewsPage' || !opts.layoutType || opts.layoutType === 'Article', {
44
+ error: 'You can only promote article pages as news article',
45
+ path: ['promoteAs']
46
+ });
28
47
  }
29
48
  async commandAction(logger, args) {
30
49
  let pageName = args.options.name;
@@ -207,61 +226,5 @@ class SpoPageAddCommand extends SpoCommand {
207
226
  }
208
227
  }
209
228
  }
210
- _SpoPageAddCommand_instances = new WeakSet(), _SpoPageAddCommand_initTelemetry = function _SpoPageAddCommand_initTelemetry() {
211
- this.telemetry.push((args) => {
212
- Object.assign(this.telemetryProperties, {
213
- layoutType: args.options.layoutType,
214
- promoteAs: args.options.promoteAs,
215
- commentsEnabled: args.options.commentsEnabled || false,
216
- publish: args.options.publish || false,
217
- publishMessage: typeof args.options.publishMessage !== 'undefined',
218
- description: typeof args.options.description !== 'undefined'
219
- });
220
- });
221
- }, _SpoPageAddCommand_initOptions = function _SpoPageAddCommand_initOptions() {
222
- this.options.unshift({
223
- option: '-n, --name <name>'
224
- }, {
225
- option: '-u, --webUrl <webUrl>'
226
- }, {
227
- option: '-t, --title [title]'
228
- }, {
229
- option: '-l, --layoutType [layoutType]',
230
- autocomplete: supportedPageLayouts
231
- }, {
232
- option: '-p, --promoteAs [promoteAs]',
233
- autocomplete: supportedPromoteAs
234
- }, {
235
- option: '--commentsEnabled'
236
- }, {
237
- option: '--publish'
238
- }, {
239
- option: '--publishMessage [publishMessage]'
240
- }, {
241
- option: '--description [description]'
242
- });
243
- }, _SpoPageAddCommand_initValidators = function _SpoPageAddCommand_initValidators() {
244
- this.validators.push(async (args) => {
245
- const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
246
- if (isValidSharePointUrl !== true) {
247
- return isValidSharePointUrl;
248
- }
249
- if (args.options.layoutType &&
250
- supportedPageLayouts.indexOf(args.options.layoutType) < 0) {
251
- return `${args.options.layoutType} is not a valid option for layoutType. Allowed values ${supportedPageLayouts.join(', ')}`;
252
- }
253
- if (args.options.promoteAs &&
254
- supportedPromoteAs.indexOf(args.options.promoteAs) < 0) {
255
- return `${args.options.promoteAs} is not a valid option for promoteAs. Allowed values ${supportedPromoteAs.join(', ')}`;
256
- }
257
- if (args.options.promoteAs === 'HomePage' && args.options.layoutType !== 'Home') {
258
- return 'You can only promote home pages as site home page';
259
- }
260
- if (args.options.promoteAs === 'NewsPage' && args.options.layoutType && args.options.layoutType !== 'Article') {
261
- return 'You can only promote article pages as news article';
262
- }
263
- return true;
264
- });
265
- };
266
229
  export default new SpoPageAddCommand();
267
230
  //# sourceMappingURL=page-add.js.map
@@ -1,10 +1,6 @@
1
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
- 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");
4
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
- };
6
- var _SpoPageClientSideWebPartAddCommand_instances, _SpoPageClientSideWebPartAddCommand_initTelemetry, _SpoPageClientSideWebPartAddCommand_initOptions, _SpoPageClientSideWebPartAddCommand_initValidators, _SpoPageClientSideWebPartAddCommand_initOptionSets;
7
1
  import { v4 } from 'uuid';
2
+ import { z } from 'zod';
3
+ import { globalOptionsZod } from '../../../../Command.js';
8
4
  import request from '../../../../request.js';
9
5
  import { formatting } from '../../../../utils/formatting.js';
10
6
  import { validation } from '../../../../utils/validation.js';
@@ -12,6 +8,55 @@ import SpoCommand from '../../../base/SpoCommand.js';
12
8
  import commands from '../../commands.js';
13
9
  import { StandardWebPartUtils } from '../../StandardWebPartTypes.js';
14
10
  import { Page } from './Page.js';
11
+ export const options = z.strictObject({
12
+ ...globalOptionsZod.shape,
13
+ pageName: z.string().alias('n'),
14
+ webUrl: z.string()
15
+ .refine(url => validation.isValidSharePointUrl(url) === true, {
16
+ error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
17
+ })
18
+ .alias('u'),
19
+ standardWebPart: z.string()
20
+ .refine(webPart => StandardWebPartUtils.isValidStandardWebPartType(webPart), {
21
+ error: e => `${e.input} is not a valid standard web part type`
22
+ })
23
+ .optional(),
24
+ webPartData: z.string()
25
+ .refine(data => {
26
+ try {
27
+ JSON.parse(data);
28
+ return true;
29
+ }
30
+ catch {
31
+ return false;
32
+ }
33
+ }, {
34
+ error: 'Specified webPartData is not a valid JSON string.'
35
+ })
36
+ .optional(),
37
+ webPartId: z.string()
38
+ .refine(id => validation.isValidGuid(id), {
39
+ error: e => `The webPartId '${e.input}' is not a valid GUID`
40
+ })
41
+ .optional(),
42
+ webPartProperties: z.string()
43
+ .refine(properties => {
44
+ try {
45
+ JSON.parse(properties);
46
+ return true;
47
+ }
48
+ catch {
49
+ return false;
50
+ }
51
+ }, {
52
+ error: 'Specified webPartProperties is not a valid JSON string.'
53
+ })
54
+ .optional(),
55
+ section: z.number().int().min(1, { error: 'The value of parameter section must be 1 or higher' }).optional(),
56
+ column: z.number().int().min(1, { error: 'The value of parameter column must be 1 or higher' }).optional(),
57
+ order: z.number().optional(),
58
+ verticalSection: z.boolean().optional()
59
+ });
15
60
  class SpoPageClientSideWebPartAddCommand extends SpoCommand {
16
61
  get name() {
17
62
  return commands.PAGE_CLIENTSIDEWEBPART_ADD;
@@ -19,13 +64,27 @@ class SpoPageClientSideWebPartAddCommand extends SpoCommand {
19
64
  get description() {
20
65
  return 'Adds a client-side web part to a modern page';
21
66
  }
22
- constructor() {
23
- super();
24
- _SpoPageClientSideWebPartAddCommand_instances.add(this);
25
- __classPrivateFieldGet(this, _SpoPageClientSideWebPartAddCommand_instances, "m", _SpoPageClientSideWebPartAddCommand_initTelemetry).call(this);
26
- __classPrivateFieldGet(this, _SpoPageClientSideWebPartAddCommand_instances, "m", _SpoPageClientSideWebPartAddCommand_initOptions).call(this);
27
- __classPrivateFieldGet(this, _SpoPageClientSideWebPartAddCommand_instances, "m", _SpoPageClientSideWebPartAddCommand_initValidators).call(this);
28
- __classPrivateFieldGet(this, _SpoPageClientSideWebPartAddCommand_instances, "m", _SpoPageClientSideWebPartAddCommand_initOptionSets).call(this);
67
+ get schema() {
68
+ return options;
69
+ }
70
+ getRefinedSchema(schema) {
71
+ return schema
72
+ .refine(opts => [opts.standardWebPart, opts.webPartId].filter(o => o !== undefined).length === 1, {
73
+ error: 'Specify one of the following options: standardWebPart, webPartId.',
74
+ params: {
75
+ customCode: 'optionSet',
76
+ options: ['standardWebPart', 'webPartId']
77
+ }
78
+ })
79
+ .refine(opts => !(opts.webPartProperties && opts.webPartData), {
80
+ error: 'Specify webPartProperties or webPartData but not both'
81
+ })
82
+ .refine(opts => !(opts.section && opts.verticalSection), {
83
+ error: 'Specify section or verticalSection but not both'
84
+ })
85
+ .refine(opts => !(opts.column && opts.verticalSection), {
86
+ error: 'Use column in combination with section, not with verticalSection'
87
+ });
29
88
  }
30
89
  async commandAction(logger, args) {
31
90
  let canvasContent;
@@ -228,13 +287,8 @@ class SpoPageClientSideWebPartAddCommand extends SpoCommand {
228
287
  await logger.logToStderr(args.options.webPartProperties);
229
288
  await logger.logToStderr('');
230
289
  }
231
- try {
232
- const properties = JSON.parse(args.options.webPartProperties);
233
- webPart.webPartData.properties = this.extend(webPart.webPartData.properties, properties);
234
- }
235
- catch {
236
- // Do nothing
237
- }
290
+ const properties = JSON.parse(args.options.webPartProperties) ?? {};
291
+ webPart.webPartData.properties = this.extend(webPart.webPartData.properties, properties);
238
292
  }
239
293
  if (args.options.webPartData) {
240
294
  if (this.debug) {
@@ -332,86 +386,5 @@ class SpoPageClientSideWebPartAddCommand extends SpoCommand {
332
386
  }, target);
333
387
  }
334
388
  }
335
- _SpoPageClientSideWebPartAddCommand_instances = new WeakSet(), _SpoPageClientSideWebPartAddCommand_initTelemetry = function _SpoPageClientSideWebPartAddCommand_initTelemetry() {
336
- this.telemetry.push((args) => {
337
- Object.assign(this.telemetryProperties, {
338
- standardWebPart: args.options.standardWebPart,
339
- webPartData: typeof args.options.webPartData !== 'undefined',
340
- webPartId: typeof args.options.webPartId !== 'undefined',
341
- webPartProperties: typeof args.options.webPartProperties !== 'undefined',
342
- section: typeof args.options.section !== 'undefined',
343
- column: typeof args.options.column !== 'undefined',
344
- order: typeof args.options.order !== 'undefined',
345
- verticalSection: !!args.options.verticalSection
346
- });
347
- });
348
- }, _SpoPageClientSideWebPartAddCommand_initOptions = function _SpoPageClientSideWebPartAddCommand_initOptions() {
349
- this.options.unshift({
350
- option: '-u, --webUrl <webUrl>'
351
- }, {
352
- option: '-n, --pageName <pageName>'
353
- }, {
354
- option: '--standardWebPart [standardWebPart]'
355
- }, {
356
- option: '--webPartId [webPartId]'
357
- }, {
358
- option: '--webPartProperties [webPartProperties]'
359
- }, {
360
- option: '--webPartData [webPartData]'
361
- }, {
362
- option: '--section [section]'
363
- }, {
364
- option: '--column [column]'
365
- }, {
366
- option: '--order [order]'
367
- }, {
368
- option: '--verticalSection'
369
- });
370
- }, _SpoPageClientSideWebPartAddCommand_initValidators = function _SpoPageClientSideWebPartAddCommand_initValidators() {
371
- this.validators.push(async (args) => {
372
- if (args.options.webPartId && !validation.isValidGuid(args.options.webPartId)) {
373
- return `The webPartId '${args.options.webPartId}' is not a valid GUID`;
374
- }
375
- if (args.options.standardWebPart && !StandardWebPartUtils.isValidStandardWebPartType(args.options.standardWebPart)) {
376
- return `${args.options.standardWebPart} is not a valid standard web part type`;
377
- }
378
- if (args.options.webPartProperties && args.options.webPartData) {
379
- return 'Specify webPartProperties or webPartData but not both';
380
- }
381
- if (args.options.webPartProperties) {
382
- try {
383
- JSON.parse(args.options.webPartProperties);
384
- }
385
- catch (e) {
386
- return `Specified webPartProperties is not a valid JSON string. Input: ${args.options
387
- .webPartProperties}. Error: ${e}`;
388
- }
389
- }
390
- if (args.options.webPartData) {
391
- try {
392
- JSON.parse(args.options.webPartData);
393
- }
394
- catch (e) {
395
- return `Specified webPartData is not a valid JSON string. Input: ${args.options
396
- .webPartData}. Error: ${e}`;
397
- }
398
- }
399
- if (args.options.section && (!Number.isInteger(args.options.section) || args.options.section < 1)) {
400
- return 'The value of parameter section must be 1 or higher';
401
- }
402
- if (args.options.column && (!Number.isInteger(args.options.column) || args.options.column < 1)) {
403
- return 'The value of parameter column must be 1 or higher';
404
- }
405
- if (args.options.section && args.options.verticalSection) {
406
- return 'Specify section or verticalSection but not both';
407
- }
408
- if (args.options.column && args.options.verticalSection) {
409
- return 'Use column in combination with section, not with verticalSection';
410
- }
411
- return validation.isValidSharePointUrl(args.options.webUrl);
412
- });
413
- }, _SpoPageClientSideWebPartAddCommand_initOptionSets = function _SpoPageClientSideWebPartAddCommand_initOptionSets() {
414
- this.optionSets.push({ options: ['standardWebPart', 'webPartId'] });
415
- };
416
389
  export default new SpoPageClientSideWebPartAddCommand();
417
390
  //# sourceMappingURL=page-clientsidewebpart-add.js.map
@@ -1,14 +1,21 @@
1
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
- 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");
4
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
- };
6
- var _SpoPageColumnGetCommand_instances, _SpoPageColumnGetCommand_initOptions, _SpoPageColumnGetCommand_initValidators;
1
+ import { z } from 'zod';
7
2
  import { cli } from '../../../../cli/cli.js';
3
+ import { globalOptionsZod } from '../../../../Command.js';
8
4
  import { validation } from '../../../../utils/validation.js';
9
5
  import SpoCommand from '../../../base/SpoCommand.js';
10
6
  import commands from '../../commands.js';
11
7
  import { Page } from './Page.js';
8
+ export const options = z.strictObject({
9
+ ...globalOptionsZod.shape,
10
+ webUrl: z.string()
11
+ .refine(url => validation.isValidSharePointUrl(url) === true, {
12
+ error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
13
+ })
14
+ .alias('u'),
15
+ pageName: z.string().alias('n'),
16
+ section: z.number().alias('s'),
17
+ column: z.number().alias('c')
18
+ });
12
19
  class SpoPageColumnGetCommand extends SpoCommand {
13
20
  get name() {
14
21
  return commands.PAGE_COLUMN_GET;
@@ -16,11 +23,8 @@ class SpoPageColumnGetCommand extends SpoCommand {
16
23
  get description() {
17
24
  return 'Gets information about a specific column of a modern page';
18
25
  }
19
- constructor() {
20
- super();
21
- _SpoPageColumnGetCommand_instances.add(this);
22
- __classPrivateFieldGet(this, _SpoPageColumnGetCommand_instances, "m", _SpoPageColumnGetCommand_initOptions).call(this);
23
- __classPrivateFieldGet(this, _SpoPageColumnGetCommand_instances, "m", _SpoPageColumnGetCommand_initValidators).call(this);
26
+ get schema() {
27
+ return options;
24
28
  }
25
29
  async commandAction(logger, args) {
26
30
  try {
@@ -48,26 +52,5 @@ class SpoPageColumnGetCommand extends SpoCommand {
48
52
  }
49
53
  }
50
54
  }
51
- _SpoPageColumnGetCommand_instances = new WeakSet(), _SpoPageColumnGetCommand_initOptions = function _SpoPageColumnGetCommand_initOptions() {
52
- this.options.unshift({
53
- option: '-u, --webUrl <webUrl>'
54
- }, {
55
- option: '-n, --pageName <pageName>'
56
- }, {
57
- option: '-s, --section <section>'
58
- }, {
59
- option: '-c, --column <column>'
60
- });
61
- }, _SpoPageColumnGetCommand_initValidators = function _SpoPageColumnGetCommand_initValidators() {
62
- this.validators.push(async (args) => {
63
- if (isNaN(args.options.section)) {
64
- return `${args.options.section} is not a number`;
65
- }
66
- if (isNaN(args.options.column)) {
67
- return `${args.options.column} is not a number`;
68
- }
69
- return validation.isValidSharePointUrl(args.options.webUrl);
70
- });
71
- };
72
55
  export default new SpoPageColumnGetCommand();
73
56
  //# sourceMappingURL=page-column-get.js.map
@@ -1,14 +1,20 @@
1
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
- 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");
4
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
- };
6
- var _SpoPageColumnListCommand_instances, _SpoPageColumnListCommand_initOptions, _SpoPageColumnListCommand_initValidators;
1
+ import { z } from 'zod';
7
2
  import { cli } from '../../../../cli/cli.js';
3
+ import { globalOptionsZod } from '../../../../Command.js';
8
4
  import { validation } from '../../../../utils/validation.js';
9
5
  import SpoCommand from '../../../base/SpoCommand.js';
10
6
  import commands from '../../commands.js';
11
7
  import { Page } from './Page.js';
8
+ export const options = z.strictObject({
9
+ ...globalOptionsZod.shape,
10
+ webUrl: z.string()
11
+ .refine(url => validation.isValidSharePointUrl(url) === true, {
12
+ error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
13
+ })
14
+ .alias('u'),
15
+ pageName: z.string().alias('n'),
16
+ section: z.number().alias('s')
17
+ });
12
18
  class SpoPageColumnListCommand extends SpoCommand {
13
19
  get name() {
14
20
  return commands.PAGE_COLUMN_LIST;
@@ -16,11 +22,8 @@ class SpoPageColumnListCommand extends SpoCommand {
16
22
  get description() {
17
23
  return 'Lists columns in the specific section of a modern page';
18
24
  }
19
- constructor() {
20
- super();
21
- _SpoPageColumnListCommand_instances.add(this);
22
- __classPrivateFieldGet(this, _SpoPageColumnListCommand_instances, "m", _SpoPageColumnListCommand_initOptions).call(this);
23
- __classPrivateFieldGet(this, _SpoPageColumnListCommand_instances, "m", _SpoPageColumnListCommand_initValidators).call(this);
25
+ get schema() {
26
+ return options;
24
27
  }
25
28
  async commandAction(logger, args) {
26
29
  try {
@@ -40,21 +43,5 @@ class SpoPageColumnListCommand extends SpoCommand {
40
43
  }
41
44
  }
42
45
  }
43
- _SpoPageColumnListCommand_instances = new WeakSet(), _SpoPageColumnListCommand_initOptions = function _SpoPageColumnListCommand_initOptions() {
44
- this.options.unshift({
45
- option: '-u, --webUrl <webUrl>'
46
- }, {
47
- option: '-n, --pageName <pageName>'
48
- }, {
49
- option: '-s, --section <sectionId>'
50
- });
51
- }, _SpoPageColumnListCommand_initValidators = function _SpoPageColumnListCommand_initValidators() {
52
- this.validators.push(async (args) => {
53
- if (isNaN(args.options.section)) {
54
- return `${args.options.section} is not a number`;
55
- }
56
- return validation.isValidSharePointUrl(args.options.webUrl);
57
- });
58
- };
59
46
  export default new SpoPageColumnListCommand();
60
47
  //# sourceMappingURL=page-column-list.js.map
@@ -1,15 +1,25 @@
1
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
- 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");
4
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
- };
6
- var _SpoPageControlGetCommand_instances, _SpoPageControlGetCommand_initOptions, _SpoPageControlGetCommand_initValidators;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
7
3
  import request from '../../../../request.js';
8
4
  import { formatting } from '../../../../utils/formatting.js';
9
5
  import { validation } from '../../../../utils/validation.js';
10
6
  import SpoCommand from '../../../base/SpoCommand.js';
11
7
  import commands from '../../commands.js';
12
8
  import { getControlTypeDisplayName } from './pageMethods.js';
9
+ export const options = z.strictObject({
10
+ ...globalOptionsZod.shape,
11
+ webUrl: z.string()
12
+ .refine(url => validation.isValidSharePointUrl(url) === true, {
13
+ error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
14
+ })
15
+ .alias('u'),
16
+ pageName: z.string().alias('n'),
17
+ id: z.string()
18
+ .refine(id => validation.isValidGuid(id), {
19
+ error: e => `${e.input} is not a valid GUID`
20
+ })
21
+ .alias('i')
22
+ });
13
23
  class SpoPageControlGetCommand extends SpoCommand {
14
24
  get name() {
15
25
  return commands.PAGE_CONTROL_GET;
@@ -17,11 +27,8 @@ class SpoPageControlGetCommand extends SpoCommand {
17
27
  get description() {
18
28
  return 'Gets information about the specific control on a modern page';
19
29
  }
20
- constructor() {
21
- super();
22
- _SpoPageControlGetCommand_instances.add(this);
23
- __classPrivateFieldGet(this, _SpoPageControlGetCommand_instances, "m", _SpoPageControlGetCommand_initOptions).call(this);
24
- __classPrivateFieldGet(this, _SpoPageControlGetCommand_instances, "m", _SpoPageControlGetCommand_initValidators).call(this);
30
+ get schema() {
31
+ return options;
25
32
  }
26
33
  async commandAction(logger, args) {
27
34
  let pageName = args.options.pageName;
@@ -63,21 +70,5 @@ class SpoPageControlGetCommand extends SpoCommand {
63
70
  }
64
71
  }
65
72
  }
66
- _SpoPageControlGetCommand_instances = new WeakSet(), _SpoPageControlGetCommand_initOptions = function _SpoPageControlGetCommand_initOptions() {
67
- this.options.unshift({
68
- option: '-i, --id <id>'
69
- }, {
70
- option: '-n, --pageName <pageName>'
71
- }, {
72
- option: '-u, --webUrl <webUrl>'
73
- });
74
- }, _SpoPageControlGetCommand_initValidators = function _SpoPageControlGetCommand_initValidators() {
75
- this.validators.push(async (args) => {
76
- if (!validation.isValidGuid(args.options.id)) {
77
- return `${args.options.id} is not a valid GUID`;
78
- }
79
- return validation.isValidSharePointUrl(args.options.webUrl);
80
- });
81
- };
82
73
  export default new SpoPageControlGetCommand();
83
74
  //# sourceMappingURL=page-control-get.js.map
@@ -1,15 +1,20 @@
1
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
- 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");
4
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
- };
6
- var _SpoPageControlListCommand_instances, _SpoPageControlListCommand_initOptions, _SpoPageControlListCommand_initValidators;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
7
3
  import request from '../../../../request.js';
8
4
  import { formatting } from '../../../../utils/formatting.js';
9
5
  import { validation } from '../../../../utils/validation.js';
10
6
  import SpoCommand from '../../../base/SpoCommand.js';
11
7
  import commands from '../../commands.js';
12
8
  import { getControlTypeDisplayName } from './pageMethods.js';
9
+ export const options = z.strictObject({
10
+ ...globalOptionsZod.shape,
11
+ webUrl: z.string()
12
+ .refine(url => validation.isValidSharePointUrl(url) === true, {
13
+ error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
14
+ })
15
+ .alias('u'),
16
+ pageName: z.string().alias('n')
17
+ });
13
18
  class SpoPageControlListCommand extends SpoCommand {
14
19
  get name() {
15
20
  return commands.PAGE_CONTROL_LIST;
@@ -20,11 +25,8 @@ class SpoPageControlListCommand extends SpoCommand {
20
25
  defaultProperties() {
21
26
  return ['id', 'type', 'title'];
22
27
  }
23
- constructor() {
24
- super();
25
- _SpoPageControlListCommand_instances.add(this);
26
- __classPrivateFieldGet(this, _SpoPageControlListCommand_instances, "m", _SpoPageControlListCommand_initOptions).call(this);
27
- __classPrivateFieldGet(this, _SpoPageControlListCommand_instances, "m", _SpoPageControlListCommand_initValidators).call(this);
28
+ get schema() {
29
+ return options;
28
30
  }
29
31
  async commandAction(logger, args) {
30
32
  let pageName = args.options.pageName;
@@ -60,14 +62,5 @@ class SpoPageControlListCommand extends SpoCommand {
60
62
  }
61
63
  }
62
64
  }
63
- _SpoPageControlListCommand_instances = new WeakSet(), _SpoPageControlListCommand_initOptions = function _SpoPageControlListCommand_initOptions() {
64
- this.options.unshift({
65
- option: '-n, --pageName <pageName>'
66
- }, {
67
- option: '-u, --webUrl <webUrl>'
68
- });
69
- }, _SpoPageControlListCommand_initValidators = function _SpoPageControlListCommand_initValidators() {
70
- this.validators.push(async (args) => validation.isValidSharePointUrl(args.options.webUrl));
71
- };
72
65
  export default new SpoPageControlListCommand();
73
66
  //# sourceMappingURL=page-control-list.js.map
@@ -16,7 +16,7 @@ export const options = z.strictObject({
16
16
  })
17
17
  .alias('u'),
18
18
  pageName: z.string().alias('n'),
19
- id: z.uuid().alias('i'),
19
+ id: z.guid().alias('i'),
20
20
  draft: z.boolean().optional(),
21
21
  force: z.boolean().optional().alias('f')
22
22
  });