@pnp/cli-microsoft365 12.0.0-beta.10c5833 → 12.0.0-beta.4ac11a7

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 (137) hide show
  1. package/.devproxy/generate-openapi-spec.json +1 -1
  2. package/allCommands.json +1 -1
  3. package/allCommandsFull.json +1 -1
  4. package/dist/Auth.js +15 -1
  5. package/dist/googleAnalytics.js +96 -0
  6. package/dist/m365/spfx/commands/SpfxCompatibilityMatrix.js +15 -0
  7. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.24.0-rc.0.js +19 -0
  8. package/dist/m365/spfx/commands/project/project-doctor.js +2 -1
  9. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN012021_TSC_excludeDirectories.js +43 -0
  10. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN027002_OVERRIDES_qs.js +33 -0
  11. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN027003_OVERRIDES_uuid.js +33 -0
  12. package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.24.0-rc.0.js +77 -0
  13. package/dist/m365/spfx/commands/project/project-upgrade.js +12 -11
  14. package/dist/m365/spo/commands/app/app-add.js +35 -56
  15. package/dist/m365/spo/commands/app/app-deploy.js +41 -59
  16. package/dist/m365/spo/commands/app/app-get.js +40 -56
  17. package/dist/m365/spo/commands/app/app-install.js +20 -41
  18. package/dist/m365/spo/commands/app/app-instance-list.js +12 -24
  19. package/dist/m365/spo/commands/app/app-list.js +26 -44
  20. package/dist/m365/spo/commands/app/app-remove.js +32 -52
  21. package/dist/m365/spo/commands/app/app-retract.js +32 -51
  22. package/dist/m365/spo/commands/app/app-teamspackage-download.js +35 -54
  23. package/dist/m365/spo/commands/app/app-uninstall.js +21 -44
  24. package/dist/m365/spo/commands/app/app-upgrade.js +20 -41
  25. package/dist/m365/spo/commands/feature/feature-disable.js +20 -50
  26. package/dist/m365/spo/commands/feature/feature-enable.js +22 -50
  27. package/dist/m365/spo/commands/feature/feature-list.js +11 -36
  28. package/dist/m365/spo/commands/field/field-add.js +33 -62
  29. package/dist/m365/spo/commands/field/field-get.js +30 -57
  30. package/dist/m365/spo/commands/field/field-list.js +21 -46
  31. package/dist/m365/spo/commands/field/field-remove.js +32 -63
  32. package/dist/m365/spo/commands/field/field-set.js +34 -66
  33. package/dist/m365/spo/commands/file/file-get.js +4 -3
  34. package/dist/m365/spo/commands/folder/folder-unarchive.js +90 -0
  35. package/dist/m365/spo/commands/hubsite/hubsite-connect.js +38 -63
  36. package/dist/m365/spo/commands/hubsite/hubsite-data-get.js +11 -27
  37. package/dist/m365/spo/commands/hubsite/hubsite-disconnect.js +25 -47
  38. package/dist/m365/spo/commands/hubsite/hubsite-get.js +25 -37
  39. package/dist/m365/spo/commands/hubsite/hubsite-list.js +12 -24
  40. package/dist/m365/spo/commands/hubsite/hubsite-register.js +10 -18
  41. package/dist/m365/spo/commands/hubsite/hubsite-rights-grant.js +14 -32
  42. package/dist/m365/spo/commands/hubsite/hubsite-rights-revoke.js +12 -29
  43. package/dist/m365/spo/commands/hubsite/hubsite-set.js +19 -46
  44. package/dist/m365/spo/commands/hubsite/hubsite-unregister.js +11 -27
  45. package/dist/m365/spo/commands/listitem/listitem-get.js +1 -12
  46. package/dist/m365/spo/commands/navigation/navigation-node-add.js +74 -120
  47. package/dist/m365/spo/commands/navigation/navigation-node-get.js +4 -13
  48. package/dist/m365/spo/commands/navigation/navigation-node-list.js +6 -4
  49. package/dist/m365/spo/commands/navigation/navigation-node-set.js +53 -114
  50. package/dist/m365/spo/commands/page/page-unpublish.js +53 -0
  51. package/dist/m365/spo/commands/sitescript/sitescript-add.js +22 -37
  52. package/dist/m365/spo/commands/sitescript/sitescript-get.js +9 -26
  53. package/dist/m365/spo/commands/sitescript/sitescript-list.js +5 -0
  54. package/dist/m365/spo/commands/sitescript/sitescript-remove.js +9 -33
  55. package/dist/m365/spo/commands/sitescript/sitescript-set.js +29 -56
  56. package/dist/m365/spo/commands.js +3 -1
  57. package/dist/m365/spp/commands/contentcenter/contentcenter-list.js +5 -0
  58. package/dist/m365/spp/commands/model/model-get.js +25 -45
  59. package/dist/m365/spp/commands/model/model-list.js +12 -23
  60. package/dist/m365/spp/commands/model/model-remove.js +25 -45
  61. package/dist/m365/teams/commands/channel/channel-add.js +46 -57
  62. package/dist/m365/teams/commands/channel/channel-get.js +41 -48
  63. package/dist/m365/teams/commands/channel/channel-list.js +28 -42
  64. package/dist/m365/teams/commands/channel/channel-member-add.js +53 -54
  65. package/dist/m365/teams/commands/channel/channel-member-list.js +47 -55
  66. package/dist/m365/teams/commands/channel/channel-member-remove.js +62 -62
  67. package/dist/m365/teams/commands/channel/channel-member-set.js +61 -65
  68. package/dist/m365/teams/commands/channel/channel-remove.js +47 -49
  69. package/dist/m365/teams/commands/channel/channel-set.js +47 -54
  70. package/dist/m365/teams/commands/chat/chat-get.js +30 -45
  71. package/dist/m365/teams/commands/chat/chat-list.js +22 -42
  72. package/dist/m365/teams/commands/chat/chat-member-add.js +43 -64
  73. package/dist/m365/teams/commands/chat/chat-member-list.js +10 -23
  74. package/dist/m365/teams/commands/chat/chat-member-remove.js +28 -50
  75. package/dist/m365/teams/commands/chat/chat-message-send.js +32 -55
  76. package/dist/m365/util/commands/accesstoken/accesstoken-get.js +10 -28
  77. package/dist/telemetry.js +7 -11
  78. package/dist/utils/spo.js +40 -3
  79. package/dist/utils/urlUtil.js +2 -2
  80. package/docs/docs/cmd/login.mdx +15 -2
  81. package/docs/docs/cmd/spo/file/file-archive.mdx +1 -1
  82. package/docs/docs/cmd/spo/file/file-checkin.mdx +2 -2
  83. package/docs/docs/cmd/spo/file/file-checkout-undo.mdx +1 -1
  84. package/docs/docs/cmd/spo/file/file-checkout.mdx +2 -2
  85. package/docs/docs/cmd/spo/file/file-copy.mdx +2 -2
  86. package/docs/docs/cmd/spo/file/file-get.mdx +6 -6
  87. package/docs/docs/cmd/spo/file/file-retentionlabel-ensure.mdx +1 -1
  88. package/docs/docs/cmd/spo/file/file-retentionlabel-remove.mdx +1 -1
  89. package/docs/docs/cmd/spo/file/file-roleassignment-add.mdx +1 -1
  90. package/docs/docs/cmd/spo/file/file-roleassignment-remove.mdx +1 -1
  91. package/docs/docs/cmd/spo/file/file-roleinheritance-break.mdx +3 -3
  92. package/docs/docs/cmd/spo/file/file-roleinheritance-reset.mdx +2 -2
  93. package/docs/docs/cmd/spo/file/file-sharinginfo-get.mdx +2 -2
  94. package/docs/docs/cmd/spo/file/file-sharinglink-add.mdx +22 -1
  95. package/docs/docs/cmd/spo/file/file-sharinglink-clear.mdx +24 -1
  96. package/docs/docs/cmd/spo/file/file-sharinglink-get.mdx +22 -1
  97. package/docs/docs/cmd/spo/file/file-sharinglink-list.mdx +22 -1
  98. package/docs/docs/cmd/spo/file/file-sharinglink-remove.mdx +24 -1
  99. package/docs/docs/cmd/spo/file/file-sharinglink-set.mdx +22 -1
  100. package/docs/docs/cmd/spo/file/file-unarchive.mdx +1 -1
  101. package/docs/docs/cmd/spo/file/file-version-clear.mdx +1 -1
  102. package/docs/docs/cmd/spo/file/file-version-get.mdx +1 -1
  103. package/docs/docs/cmd/spo/file/file-version-keep.mdx +1 -1
  104. package/docs/docs/cmd/spo/file/file-version-list.mdx +1 -1
  105. package/docs/docs/cmd/spo/file/file-version-remove.mdx +1 -1
  106. package/docs/docs/cmd/spo/file/file-version-restore.mdx +1 -1
  107. package/docs/docs/cmd/spo/folder/folder-archive.mdx +1 -1
  108. package/docs/docs/cmd/spo/folder/folder-copy.mdx +1 -1
  109. package/docs/docs/cmd/spo/folder/folder-get.mdx +2 -2
  110. package/docs/docs/cmd/spo/folder/folder-retentionlabel-ensure.mdx +1 -1
  111. package/docs/docs/cmd/spo/folder/folder-retentionlabel-remove.mdx +1 -1
  112. package/docs/docs/cmd/spo/folder/folder-sharinglink-add.mdx +22 -1
  113. package/docs/docs/cmd/spo/folder/folder-sharinglink-clear.mdx +23 -0
  114. package/docs/docs/cmd/spo/folder/folder-sharinglink-get.mdx +21 -0
  115. package/docs/docs/cmd/spo/folder/folder-sharinglink-list.mdx +22 -1
  116. package/docs/docs/cmd/spo/folder/folder-sharinglink-remove.mdx +24 -1
  117. package/docs/docs/cmd/spo/folder/folder-sharinglink-set.mdx +21 -0
  118. package/docs/docs/cmd/spo/folder/folder-unarchive.mdx +76 -0
  119. package/docs/docs/cmd/spo/listitem/listitem-get.mdx +0 -6
  120. package/docs/docs/cmd/spo/navigation/navigation-node-add.mdx +45 -30
  121. package/docs/docs/cmd/spo/navigation/navigation-node-get.mdx +64 -42
  122. package/docs/docs/cmd/spo/navigation/navigation-node-list.mdx +37 -27
  123. package/docs/docs/cmd/spo/navigation/navigation-node-set.mdx +10 -8
  124. package/docs/docs/cmd/spo/page/page-unpublish.mdx +63 -0
  125. package/docs/docs/cmd/spp/model/model-get.mdx +1 -1
  126. package/docs/docs/cmd/spp/model/model-remove.mdx +1 -1
  127. package/docs/docs/cmd/teams/tab/tab-add.mdx +19 -0
  128. package/docs/docs/cmd/teams/tab/tab-get.mdx +19 -0
  129. package/docs/docs/cmd/teams/tab/tab-list.mdx +19 -0
  130. package/docs/docs/cmd/teams/tab/tab-remove.mdx +21 -0
  131. package/docs/docs/cmd/viva/engage/engage-message-add.mdx +17 -0
  132. package/docs/docs/cmd/viva/engage/engage-message-get.mdx +17 -0
  133. package/docs/docs/cmd/viva/engage/engage-message-list.mdx +17 -0
  134. package/docs/docs/cmd/viva/engage/engage-message-remove.mdx +19 -0
  135. package/npm-shrinkwrap.json +702 -3230
  136. package/package.json +21 -38
  137. package/dist/appInsights.js +0 -43
@@ -1,139 +1,78 @@
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 _SpoNavigationNodeSetCommand_instances, _SpoNavigationNodeSetCommand_initTelemetry, _SpoNavigationNodeSetCommand_initTypes, _SpoNavigationNodeSetCommand_initOptions, _SpoNavigationNodeSetCommand_initValidators;
7
- import request from '../../../../request.js';
1
+ import { globalOptionsZod } from '../../../../Command.js';
2
+ import { z } from 'zod';
8
3
  import { spo } from '../../../../utils/spo.js';
9
4
  import { validation } from '../../../../utils/validation.js';
10
5
  import SpoCommand from '../../../base/SpoCommand.js';
11
6
  import commands from '../../commands.js';
7
+ export const options = z.strictObject({
8
+ ...globalOptionsZod.shape,
9
+ webUrl: z.string()
10
+ .refine(url => validation.isValidSharePointUrl(url) === true, {
11
+ error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
12
+ })
13
+ .alias('u'),
14
+ location: z.enum(['QuickLaunch', 'TopNavigationBar']).alias('l'),
15
+ id: z.int().positive(),
16
+ title: z.string().min(1, 'Cannot be empty.').optional(),
17
+ url: z.string().optional(),
18
+ audienceIds: z.string()
19
+ .refine(audienceIds => audienceIds === '' || audienceIds.split(',').length <= 10, {
20
+ error: 'The maximum amount of audienceIds per navigation node exceeded. The maximum amount of audienceIds is 10.'
21
+ })
22
+ .refine(audienceIds => audienceIds === '' || validation.isValidGuidArray(audienceIds) === true, {
23
+ error: e => `The following GUIDs are invalid for the option 'audienceIds': ${validation.isValidGuidArray(e.input)}.`
24
+ })
25
+ .optional(),
26
+ openInNewWindow: z.boolean().optional()
27
+ });
12
28
  class SpoNavigationNodeSetCommand extends SpoCommand {
13
29
  get name() {
14
30
  return commands.NAVIGATION_NODE_SET;
15
31
  }
16
32
  get description() {
17
- return 'Adds a navigation node to the specified site navigation';
33
+ return 'Updates a SharePoint navigation node';
18
34
  }
19
- constructor() {
20
- super();
21
- _SpoNavigationNodeSetCommand_instances.add(this);
22
- __classPrivateFieldGet(this, _SpoNavigationNodeSetCommand_instances, "m", _SpoNavigationNodeSetCommand_initTelemetry).call(this);
23
- __classPrivateFieldGet(this, _SpoNavigationNodeSetCommand_instances, "m", _SpoNavigationNodeSetCommand_initOptions).call(this);
24
- __classPrivateFieldGet(this, _SpoNavigationNodeSetCommand_instances, "m", _SpoNavigationNodeSetCommand_initTypes).call(this);
25
- __classPrivateFieldGet(this, _SpoNavigationNodeSetCommand_instances, "m", _SpoNavigationNodeSetCommand_initValidators).call(this);
35
+ get schema() {
36
+ return options;
37
+ }
38
+ getRefinedSchema(schema) {
39
+ return schema
40
+ .refine(options => [options.title, options.url, options.audienceIds, options.openInNewWindow].some(o => o !== undefined), {
41
+ error: 'Specify at least one property to update.',
42
+ params: {
43
+ customCode: 'optionSet',
44
+ options: ['title', 'url', 'audienceIds', 'openInNewWindow']
45
+ }
46
+ });
47
+ }
48
+ getExcludedOptionsWithUrls() {
49
+ return ['url'];
26
50
  }
27
51
  async commandAction(logger, args) {
52
+ const { webUrl, location, id, title, url, audienceIds, openInNewWindow } = args.options;
53
+ if (this.verbose) {
54
+ await logger.logToStderr(`Updating navigation node with id ${id}...`);
55
+ }
28
56
  try {
29
- if (this.verbose) {
30
- await logger.logToStderr(`Setting navigation node...`);
31
- }
32
- let url = args.options.url;
33
- if (url === '') {
34
- url = 'http://linkless.header/';
57
+ const { menuState, node } = await spo.getMenuStateNodeByKey(webUrl, id.toString(), location);
58
+ if (title !== undefined) {
59
+ node.Title = title;
35
60
  }
36
- const requestBody = {
37
- Title: args.options.title,
38
- IsExternal: args.options.isExternal,
39
- Url: url
40
- };
41
- if (args.options.audienceIds !== undefined) {
42
- requestBody.AudienceIds = args.options.audienceIds === '' ? [] : args.options.audienceIds.split(',');
61
+ if (url !== undefined) {
62
+ node.SimpleUrl = url;
43
63
  }
44
- const requestOptions = {
45
- url: `${args.options.webUrl}/_api/web/navigation/GetNodeById(${args.options.id})`,
46
- headers: {
47
- accept: 'application/json;odata=nometadata',
48
- 'content-type': 'application/json;odata=nometadata'
49
- },
50
- data: requestBody,
51
- responseType: 'json'
52
- };
53
- const response = await request.patch(requestOptions);
54
- if (response['odata.null'] === true) {
55
- throw `Navigation node does not exist.`;
64
+ if (audienceIds !== undefined) {
65
+ node.AudienceIds = audienceIds === '' ? [] : audienceIds.split(',');
56
66
  }
57
- if (args.options.openInNewWindow !== undefined) {
58
- if (this.verbose) {
59
- await logger.logToStderr(`Making sure that the navigation node opens in a new window.`);
60
- }
61
- let menuState = await spo.getQuickLaunchMenuState(args.options.webUrl);
62
- let menuStateItem = this.getMenuStateNode(menuState.Nodes, args.options.id);
63
- if (!menuStateItem) {
64
- menuState = await spo.getTopNavigationMenuState(args.options.webUrl);
65
- menuStateItem = this.getMenuStateNode(menuState.Nodes, args.options.id);
66
- }
67
- menuStateItem.OpenInNewWindow = args.options.openInNewWindow;
68
- await spo.saveMenuState(args.options.webUrl, menuState);
67
+ if (openInNewWindow !== undefined) {
68
+ node.OpenInNewWindow = openInNewWindow;
69
69
  }
70
+ await spo.saveMenuState(webUrl, menuState);
70
71
  }
71
72
  catch (err) {
72
73
  this.handleRejectedODataJsonPromise(err);
73
74
  }
74
75
  }
75
- getMenuStateNode(nodes, id) {
76
- let menuNode = nodes.find((node) => node.Key.toString() === id.toString());
77
- if (menuNode === undefined) {
78
- for (const node of nodes.filter(node => node.Nodes.length > 0)) {
79
- menuNode = this.getMenuStateNode(node.Nodes, id);
80
- if (menuNode) {
81
- break;
82
- }
83
- }
84
- }
85
- return menuNode;
86
- }
87
76
  }
88
- _SpoNavigationNodeSetCommand_instances = new WeakSet(), _SpoNavigationNodeSetCommand_initTelemetry = function _SpoNavigationNodeSetCommand_initTelemetry() {
89
- this.telemetry.push((args) => {
90
- Object.assign(this.telemetryProperties, {
91
- title: typeof args.options.title !== 'undefined',
92
- url: typeof args.options.url !== 'undefined',
93
- isExternal: typeof args.options.isExternal !== 'undefined',
94
- audienceIds: typeof args.options.audienceIds !== 'undefined',
95
- openInNewWindow: typeof args.options.openInNewWindow !== 'undefined'
96
- });
97
- });
98
- }, _SpoNavigationNodeSetCommand_initTypes = function _SpoNavigationNodeSetCommand_initTypes() {
99
- this.types.boolean.push('isExternal');
100
- }, _SpoNavigationNodeSetCommand_initOptions = function _SpoNavigationNodeSetCommand_initOptions() {
101
- this.options.unshift({
102
- option: '-u, --webUrl <webUrl>'
103
- }, {
104
- option: '--id <id>'
105
- }, {
106
- option: '--title [title]'
107
- }, {
108
- option: '--url [url]'
109
- }, {
110
- option: '--audienceIds [audienceIds]'
111
- }, {
112
- option: '--isExternal [isExternal]'
113
- }, {
114
- option: '--openInNewWindow [openInNewWindow]'
115
- });
116
- }, _SpoNavigationNodeSetCommand_initValidators = function _SpoNavigationNodeSetCommand_initValidators() {
117
- this.validators.push(async (args) => {
118
- const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
119
- if (isValidSharePointUrl !== true) {
120
- return isValidSharePointUrl;
121
- }
122
- if (args.options.audienceIds === undefined && args.options.url === undefined && args.options.isExternal === undefined && !args.options.title && args.options.openInNewWindow === undefined) {
123
- return `Please specify at least one property to update.`;
124
- }
125
- if (args.options.audienceIds) {
126
- const audienceIdsSplitted = args.options.audienceIds.split(',');
127
- if (audienceIdsSplitted.length > 10) {
128
- return 'The maximum amount of audienceIds per navigation node exceeded. The maximum amount of audienceIds is 10.';
129
- }
130
- const isValidGUIDArrayResult = validation.isValidGuidArray(args.options.audienceIds);
131
- if (isValidGUIDArrayResult !== true) {
132
- return `The following GUIDs are invalid for the option 'audienceIds': ${isValidGUIDArrayResult}.`;
133
- }
134
- }
135
- return true;
136
- });
137
- };
138
77
  export default new SpoNavigationNodeSetCommand();
139
78
  //# sourceMappingURL=navigation-node-set.js.map
@@ -0,0 +1,53 @@
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
3
+ import request from '../../../../request.js';
4
+ import { formatting } from '../../../../utils/formatting.js';
5
+ import { urlUtil } from '../../../../utils/urlUtil.js';
6
+ import { validation } from '../../../../utils/validation.js';
7
+ import SpoCommand from '../../../base/SpoCommand.js';
8
+ import commands from '../../commands.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
+ name: z.string().alias('n')
17
+ });
18
+ class SpoPageUnpublishCommand extends SpoCommand {
19
+ get name() {
20
+ return commands.PAGE_UNPUBLISH;
21
+ }
22
+ get description() {
23
+ return 'Unpublishes a modern page';
24
+ }
25
+ get schema() {
26
+ return options;
27
+ }
28
+ async commandAction(logger, args) {
29
+ try {
30
+ let pageName = urlUtil.removeLeadingSlashes(args.options.name);
31
+ if (!pageName.toLowerCase().endsWith('.aspx')) {
32
+ pageName += '.aspx';
33
+ }
34
+ if (this.verbose) {
35
+ await logger.logToStderr(`Unpublishing page ${pageName}...`);
36
+ }
37
+ const filePath = `${urlUtil.getServerRelativeSiteUrl(args.options.webUrl)}/SitePages/${pageName}`;
38
+ const requestOptions = {
39
+ url: `${args.options.webUrl}/_api/web/GetFileByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(filePath)}')/UnPublish`,
40
+ headers: {
41
+ accept: 'application/json;odata=nometadata'
42
+ },
43
+ responseType: 'json'
44
+ };
45
+ await request.post(requestOptions);
46
+ }
47
+ catch (err) {
48
+ this.handleRejectedODataJsonPromise(err);
49
+ }
50
+ }
51
+ }
52
+ export default new SpoPageUnpublishCommand();
53
+ //# sourceMappingURL=page-unpublish.js.map
@@ -1,14 +1,28 @@
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 _SpoSiteScriptAddCommand_instances, _SpoSiteScriptAddCommand_initTelemetry, _SpoSiteScriptAddCommand_initOptions, _SpoSiteScriptAddCommand_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';
10
6
  import SpoCommand from '../../../base/SpoCommand.js';
11
7
  import commands from '../../commands.js';
8
+ export const options = z.strictObject({
9
+ ...globalOptionsZod.shape,
10
+ title: z.string().alias('t'),
11
+ content: z.string()
12
+ .refine(val => {
13
+ try {
14
+ JSON.parse(val);
15
+ return true;
16
+ }
17
+ catch {
18
+ return false;
19
+ }
20
+ }, {
21
+ error: 'Specified content value is not a valid JSON string.'
22
+ })
23
+ .alias('c'),
24
+ description: z.string().optional().alias('d')
25
+ });
12
26
  class SpoSiteScriptAddCommand extends SpoCommand {
13
27
  get name() {
14
28
  return commands.SITESCRIPT_ADD;
@@ -16,12 +30,8 @@ class SpoSiteScriptAddCommand extends SpoCommand {
16
30
  get description() {
17
31
  return 'Adds site script for use with site designs';
18
32
  }
19
- constructor() {
20
- super();
21
- _SpoSiteScriptAddCommand_instances.add(this);
22
- __classPrivateFieldGet(this, _SpoSiteScriptAddCommand_instances, "m", _SpoSiteScriptAddCommand_initTelemetry).call(this);
23
- __classPrivateFieldGet(this, _SpoSiteScriptAddCommand_instances, "m", _SpoSiteScriptAddCommand_initOptions).call(this);
24
- __classPrivateFieldGet(this, _SpoSiteScriptAddCommand_instances, "m", _SpoSiteScriptAddCommand_initValidators).call(this);
33
+ get schema() {
34
+ return options;
25
35
  }
26
36
  async commandAction(logger, args) {
27
37
  try {
@@ -45,30 +55,5 @@ class SpoSiteScriptAddCommand extends SpoCommand {
45
55
  }
46
56
  }
47
57
  }
48
- _SpoSiteScriptAddCommand_instances = new WeakSet(), _SpoSiteScriptAddCommand_initTelemetry = function _SpoSiteScriptAddCommand_initTelemetry() {
49
- this.telemetry.push((args) => {
50
- Object.assign(this.telemetryProperties, {
51
- description: typeof args.options.description !== 'undefined'
52
- });
53
- });
54
- }, _SpoSiteScriptAddCommand_initOptions = function _SpoSiteScriptAddCommand_initOptions() {
55
- this.options.unshift({
56
- option: '-t, --title <title>'
57
- }, {
58
- option: '-c, --content <content>'
59
- }, {
60
- option: '-d, --description [description]'
61
- });
62
- }, _SpoSiteScriptAddCommand_initValidators = function _SpoSiteScriptAddCommand_initValidators() {
63
- this.validators.push(async (args) => {
64
- try {
65
- JSON.parse(args.options.content);
66
- }
67
- catch (e) {
68
- return `Specified content value is not a valid JSON string. Error: ${e}`;
69
- }
70
- return true;
71
- });
72
- };
73
58
  export default new SpoSiteScriptAddCommand();
74
59
  //# sourceMappingURL=sitescript-add.js.map
@@ -1,14 +1,14 @@
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 _SpoSiteScriptGetCommand_instances, _SpoSiteScriptGetCommand_initOptions, _SpoSiteScriptGetCommand_initValidators;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
7
3
  import request from '../../../../request.js';
8
4
  import { spo } from '../../../../utils/spo.js';
9
- import { validation } from '../../../../utils/validation.js';
10
5
  import SpoCommand from '../../../base/SpoCommand.js';
11
6
  import commands from '../../commands.js';
7
+ export const options = z.strictObject({
8
+ ...globalOptionsZod.shape,
9
+ id: z.guid().alias('i'),
10
+ content: z.boolean().optional().alias('c')
11
+ });
12
12
  class SpoSiteScriptGetCommand extends SpoCommand {
13
13
  get name() {
14
14
  return commands.SITESCRIPT_GET;
@@ -16,11 +16,8 @@ class SpoSiteScriptGetCommand extends SpoCommand {
16
16
  get description() {
17
17
  return 'Gets information about the specified site script';
18
18
  }
19
- constructor() {
20
- super();
21
- _SpoSiteScriptGetCommand_instances.add(this);
22
- __classPrivateFieldGet(this, _SpoSiteScriptGetCommand_instances, "m", _SpoSiteScriptGetCommand_initOptions).call(this);
23
- __classPrivateFieldGet(this, _SpoSiteScriptGetCommand_instances, "m", _SpoSiteScriptGetCommand_initValidators).call(this);
19
+ get schema() {
20
+ return options;
24
21
  }
25
22
  async commandAction(logger, args) {
26
23
  try {
@@ -49,19 +46,5 @@ class SpoSiteScriptGetCommand extends SpoCommand {
49
46
  }
50
47
  }
51
48
  }
52
- _SpoSiteScriptGetCommand_instances = new WeakSet(), _SpoSiteScriptGetCommand_initOptions = function _SpoSiteScriptGetCommand_initOptions() {
53
- this.options.unshift({
54
- option: '-i, --id <id>'
55
- }, {
56
- option: '-c, --content'
57
- });
58
- }, _SpoSiteScriptGetCommand_initValidators = function _SpoSiteScriptGetCommand_initValidators() {
59
- this.validators.push(async (args) => {
60
- if (!validation.isValidGuid(args.options.id)) {
61
- return `${args.options.id} is not a valid GUID`;
62
- }
63
- return true;
64
- });
65
- };
66
49
  export default new SpoSiteScriptGetCommand();
67
50
  //# sourceMappingURL=sitescript-get.js.map
@@ -1,7 +1,9 @@
1
+ import { globalOptionsZod } from '../../../../Command.js';
1
2
  import request from '../../../../request.js';
2
3
  import { spo } from '../../../../utils/spo.js';
3
4
  import SpoCommand from '../../../base/SpoCommand.js';
4
5
  import commands from '../../commands.js';
6
+ export const options = globalOptionsZod.strict();
5
7
  class SpoSiteScriptListCommand extends SpoCommand {
6
8
  get name() {
7
9
  return commands.SITESCRIPT_LIST;
@@ -9,6 +11,9 @@ class SpoSiteScriptListCommand extends SpoCommand {
9
11
  get description() {
10
12
  return 'Lists site script available for use with site designs';
11
13
  }
14
+ get schema() {
15
+ return options;
16
+ }
12
17
  async commandAction(logger) {
13
18
  try {
14
19
  const spoUrl = await spo.getSpoUrl(logger, this.debug);
@@ -1,15 +1,15 @@
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 _SpoSiteScriptRemoveCommand_instances, _SpoSiteScriptRemoveCommand_initTelemetry, _SpoSiteScriptRemoveCommand_initOptions, _SpoSiteScriptRemoveCommand_initValidators;
1
+ import { z } from 'zod';
7
2
  import { cli } from '../../../../cli/cli.js';
3
+ import { globalOptionsZod } from '../../../../Command.js';
8
4
  import request from '../../../../request.js';
9
5
  import { spo } from '../../../../utils/spo.js';
10
- import { validation } from '../../../../utils/validation.js';
11
6
  import SpoCommand from '../../../base/SpoCommand.js';
12
7
  import commands from '../../commands.js';
8
+ export const options = z.strictObject({
9
+ ...globalOptionsZod.shape,
10
+ id: z.guid().alias('i'),
11
+ force: z.boolean().optional().alias('f')
12
+ });
13
13
  class SpoSiteScriptRemoveCommand extends SpoCommand {
14
14
  get name() {
15
15
  return commands.SITESCRIPT_REMOVE;
@@ -17,12 +17,8 @@ class SpoSiteScriptRemoveCommand extends SpoCommand {
17
17
  get description() {
18
18
  return 'Removes the specified site script';
19
19
  }
20
- constructor() {
21
- super();
22
- _SpoSiteScriptRemoveCommand_instances.add(this);
23
- __classPrivateFieldGet(this, _SpoSiteScriptRemoveCommand_instances, "m", _SpoSiteScriptRemoveCommand_initTelemetry).call(this);
24
- __classPrivateFieldGet(this, _SpoSiteScriptRemoveCommand_instances, "m", _SpoSiteScriptRemoveCommand_initOptions).call(this);
25
- __classPrivateFieldGet(this, _SpoSiteScriptRemoveCommand_instances, "m", _SpoSiteScriptRemoveCommand_initValidators).call(this);
20
+ get schema() {
21
+ return options;
26
22
  }
27
23
  async commandAction(logger, args) {
28
24
  if (args.options.force) {
@@ -56,25 +52,5 @@ class SpoSiteScriptRemoveCommand extends SpoCommand {
56
52
  }
57
53
  }
58
54
  }
59
- _SpoSiteScriptRemoveCommand_instances = new WeakSet(), _SpoSiteScriptRemoveCommand_initTelemetry = function _SpoSiteScriptRemoveCommand_initTelemetry() {
60
- this.telemetry.push((args) => {
61
- Object.assign(this.telemetryProperties, {
62
- force: args.options.force || false
63
- });
64
- });
65
- }, _SpoSiteScriptRemoveCommand_initOptions = function _SpoSiteScriptRemoveCommand_initOptions() {
66
- this.options.unshift({
67
- option: '-i, --id <id>'
68
- }, {
69
- option: '-f, --force'
70
- });
71
- }, _SpoSiteScriptRemoveCommand_initValidators = function _SpoSiteScriptRemoveCommand_initValidators() {
72
- this.validators.push(async (args) => {
73
- if (!validation.isValidGuid(args.options.id)) {
74
- return `${args.options.id} is not a valid GUID`;
75
- }
76
- return true;
77
- });
78
- };
79
55
  export default new SpoSiteScriptRemoveCommand();
80
56
  //# sourceMappingURL=sitescript-remove.js.map
@@ -1,14 +1,34 @@
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 _SpoSiteScriptSetCommand_instances, _SpoSiteScriptSetCommand_initTelemetry, _SpoSiteScriptSetCommand_initOptions, _SpoSiteScriptSetCommand_initValidators;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
7
3
  import request from '../../../../request.js';
8
4
  import { spo } from '../../../../utils/spo.js';
9
- import { validation } from '../../../../utils/validation.js';
10
5
  import SpoCommand from '../../../base/SpoCommand.js';
11
6
  import commands from '../../commands.js';
7
+ import { validation } from '../../../../utils/validation.js';
8
+ export const options = z.strictObject({
9
+ ...globalOptionsZod.shape,
10
+ id: z.guid().alias('i'),
11
+ title: z.string().optional().alias('t'),
12
+ description: z.string().optional().alias('d'),
13
+ version: z.string()
14
+ .refine(val => validation.isValidPositiveInteger(val), {
15
+ error: 'Version must be a number.'
16
+ })
17
+ .optional().alias('v'),
18
+ content: z.string()
19
+ .refine(val => {
20
+ try {
21
+ JSON.parse(val);
22
+ return true;
23
+ }
24
+ catch {
25
+ return false;
26
+ }
27
+ }, {
28
+ error: 'Specified content value is not a valid JSON string.'
29
+ })
30
+ .optional().alias('c')
31
+ });
12
32
  class SpoSiteScriptSetCommand extends SpoCommand {
13
33
  get name() {
14
34
  return commands.SITESCRIPT_SET;
@@ -16,12 +36,8 @@ class SpoSiteScriptSetCommand extends SpoCommand {
16
36
  get description() {
17
37
  return 'Updates existing site script';
18
38
  }
19
- constructor() {
20
- super();
21
- _SpoSiteScriptSetCommand_instances.add(this);
22
- __classPrivateFieldGet(this, _SpoSiteScriptSetCommand_instances, "m", _SpoSiteScriptSetCommand_initTelemetry).call(this);
23
- __classPrivateFieldGet(this, _SpoSiteScriptSetCommand_instances, "m", _SpoSiteScriptSetCommand_initOptions).call(this);
24
- __classPrivateFieldGet(this, _SpoSiteScriptSetCommand_instances, "m", _SpoSiteScriptSetCommand_initValidators).call(this);
39
+ get schema() {
40
+ return options;
25
41
  }
26
42
  async commandAction(logger, args) {
27
43
  try {
@@ -60,48 +76,5 @@ class SpoSiteScriptSetCommand extends SpoCommand {
60
76
  }
61
77
  }
62
78
  }
63
- _SpoSiteScriptSetCommand_instances = new WeakSet(), _SpoSiteScriptSetCommand_initTelemetry = function _SpoSiteScriptSetCommand_initTelemetry() {
64
- this.telemetry.push((args) => {
65
- Object.assign(this.telemetryProperties, {
66
- title: (!(!args.options.title)).toString(),
67
- description: (!(!args.options.description)).toString(),
68
- version: (!(!args.options.version)).toString(),
69
- content: (!(!args.options.content)).toString()
70
- });
71
- });
72
- }, _SpoSiteScriptSetCommand_initOptions = function _SpoSiteScriptSetCommand_initOptions() {
73
- this.options.unshift({
74
- option: '-i, --id <id>'
75
- }, {
76
- option: '-t, --title [title]'
77
- }, {
78
- option: '-d, --description [description]'
79
- }, {
80
- option: '-v, --version [version]'
81
- }, {
82
- option: '-c, --content [content]'
83
- });
84
- }, _SpoSiteScriptSetCommand_initValidators = function _SpoSiteScriptSetCommand_initValidators() {
85
- this.validators.push(async (args) => {
86
- if (!validation.isValidGuid(args.options.id)) {
87
- return `${args.options.id} is not a valid GUID`;
88
- }
89
- if (args.options.version) {
90
- const version = parseInt(args.options.version);
91
- if (isNaN(version)) {
92
- return `${args.options.version} is not a number`;
93
- }
94
- }
95
- if (args.options.content) {
96
- try {
97
- JSON.parse(args.options.content);
98
- }
99
- catch (e) {
100
- return `Specified content value is not a valid JSON string. Error: ${e}`;
101
- }
102
- }
103
- return true;
104
- });
105
- };
106
79
  export default new SpoSiteScriptSetCommand();
107
80
  //# sourceMappingURL=sitescript-set.js.map
@@ -72,6 +72,7 @@ export default {
72
72
  FILE_MOVE: `${prefix} file move`,
73
73
  FILE_REMOVE: `${prefix} file remove`,
74
74
  FILE_RENAME: `${prefix} file rename`,
75
+ FILE_UNARCHIVE: `${prefix} file unarchive`,
75
76
  FILE_RETENTIONLABEL_ENSURE: `${prefix} file retentionlabel ensure`,
76
77
  FILE_RETENTIONLABEL_REMOVE: `${prefix} file retentionlabel remove`,
77
78
  FILE_ROLEASSIGNMENT_ADD: `${prefix} file roleassignment add`,
@@ -85,7 +86,6 @@ export default {
85
86
  FILE_SHARINGLINK_LIST: `${prefix} file sharinglink list`,
86
87
  FILE_SHARINGLINK_REMOVE: `${prefix} file sharinglink remove`,
87
88
  FILE_SHARINGLINK_SET: `${prefix} file sharinglink set`,
88
- FILE_UNARCHIVE: `${prefix} file unarchive`,
89
89
  FILE_VERSION_CLEAR: `${prefix} file version clear`,
90
90
  FILE_VERSION_GET: `${prefix} file version get`,
91
91
  FILE_VERSION_KEEP: `${prefix} file version keep`,
@@ -112,6 +112,7 @@ export default {
112
112
  FOLDER_SHARINGLINK_LIST: `${prefix} folder sharinglink list`,
113
113
  FOLDER_SHARINGLINK_REMOVE: `${prefix} folder sharinglink remove`,
114
114
  FOLDER_SHARINGLINK_SET: `${prefix} folder sharinglink set`,
115
+ FOLDER_UNARCHIVE: `${prefix} folder unarchive`,
115
116
  GET: `${prefix} get`,
116
117
  GROUP_ADD: `${prefix} group add`,
117
118
  GROUP_GET: `${prefix} group get`,
@@ -235,6 +236,7 @@ export default {
235
236
  PAGE_TEMPLATE_LIST: `${prefix} page template list`,
236
237
  PAGE_TEMPLATE_REMOVE: `${prefix} page template remove`,
237
238
  PAGE_TEXT_ADD: `${prefix} page text add`,
239
+ PAGE_UNPUBLISH: `${prefix} page unpublish`,
238
240
  PROPERTYBAG_GET: `${prefix} propertybag get`,
239
241
  PROPERTYBAG_LIST: `${prefix} propertybag list`,
240
242
  PROPERTYBAG_REMOVE: `${prefix} propertybag remove`,
@@ -1,8 +1,10 @@
1
+ import { globalOptionsZod } from '../../../../Command.js';
1
2
  import config from '../../../../config.js';
2
3
  import request from '../../../../request.js';
3
4
  import { spo } from '../../../../utils/spo.js';
4
5
  import SpoCommand from '../../../base/SpoCommand.js';
5
6
  import commands from '../../commands.js';
7
+ export const options = globalOptionsZod.strict();
6
8
  class SppContentCenterListCommand extends SpoCommand {
7
9
  get name() {
8
10
  return commands.CONTENTCENTER_LIST;
@@ -13,6 +15,9 @@ class SppContentCenterListCommand extends SpoCommand {
13
15
  defaultProperties() {
14
16
  return ['Title', 'Url'];
15
17
  }
18
+ get schema() {
19
+ return options;
20
+ }
16
21
  async commandAction(logger) {
17
22
  try {
18
23
  if (this.verbose) {