@pnp/cli-microsoft365 11.12.0-beta.8589b73 → 12.0.0-beta.8dff3ac

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 (167) hide show
  1. package/allCommands.json +1 -1
  2. package/allCommandsFull.json +1 -1
  3. package/dist/Auth.js +2 -6
  4. package/dist/auth/FileTokenStorage.js +0 -3
  5. package/dist/auth/msalCachePlugin.js +201 -12
  6. package/dist/m365/commands/logout.js +2 -4
  7. package/dist/m365/entra/commands/m365group/m365group-remove.js +4 -3
  8. package/dist/m365/spe/commands/container/container-remove.js +6 -7
  9. package/dist/m365/spfx/commands/project/DeployWorkflow.js +7 -15
  10. package/dist/m365/spfx/commands/project/project-azuredevops-pipeline-add.js +30 -2
  11. package/dist/m365/spfx/commands/project/project-github-workflow-add.js +12 -2
  12. package/dist/m365/spo/commands/cdn/cdn-get.js +8 -35
  13. package/dist/m365/spo/commands/cdn/cdn-origin-add.js +9 -36
  14. package/dist/m365/spo/commands/cdn/cdn-origin-list.js +8 -34
  15. package/dist/m365/spo/commands/cdn/cdn-origin-remove.js +10 -39
  16. package/dist/m365/spo/commands/cdn/cdn-policy-list.js +8 -34
  17. package/dist/m365/spo/commands/cdn/cdn-policy-set.js +10 -45
  18. package/dist/m365/spo/commands/cdn/cdn-set.js +10 -46
  19. package/dist/m365/spo/commands/contenttype/contenttype-sync.js +12 -24
  20. package/dist/m365/spo/commands/file/file-add.js +2 -6
  21. package/dist/m365/spo/commands/file/file-archive.js +1 -1
  22. package/dist/m365/spo/commands/file/file-remove.js +5 -5
  23. package/dist/m365/spo/commands/file/file-unarchive.js +1 -1
  24. package/dist/m365/spo/commands/folder/folder-archive.js +1 -1
  25. package/dist/m365/spo/commands/folder/folder-remove.js +5 -5
  26. package/dist/m365/spo/commands/hidedefaultthemes/hidedefaultthemes-get.js +5 -0
  27. package/dist/m365/spo/commands/hidedefaultthemes/hidedefaultthemes-set.js +8 -26
  28. package/dist/m365/spo/commands/homesite/homesite-list.js +5 -0
  29. package/dist/m365/spo/commands/list/list-remove.js +4 -4
  30. package/dist/m365/spo/commands/listitem/listitem-batch-remove.js +5 -4
  31. package/dist/m365/spo/commands/listitem/listitem-get.js +15 -7
  32. package/dist/m365/spo/commands/listitem/listitem-remove.js +8 -5
  33. package/dist/m365/spo/commands/page/page-header-set.js +123 -64
  34. package/dist/m365/spo/commands/page/page-remove.js +7 -7
  35. package/dist/m365/spo/commands/site/site-list.js +60 -49
  36. package/dist/m365/spo/commands/site/site-remove.js +7 -7
  37. package/dist/m365/spo/commands/spo-get.js +5 -0
  38. package/dist/m365/spo/commands/spo-set.js +10 -21
  39. package/dist/m365/spo/commands/storageentity/storageentity-get.js +23 -17
  40. package/dist/m365/spo/commands/storageentity/storageentity-list.js +39 -36
  41. package/dist/m365/spo/commands/storageentity/storageentity-remove.js +26 -33
  42. package/dist/m365/spo/commands/storageentity/storageentity-set.js +26 -36
  43. package/dist/m365/spo/commands/tenant/tenant-appcatalog-add.js +1 -1
  44. package/dist/m365/spo/commands/user/user-ensure.js +24 -60
  45. package/dist/m365/spo/commands/user/user-get.js +25 -65
  46. package/dist/m365/spo/commands/user/user-list.js +10 -18
  47. package/dist/m365/spo/commands/user/user-remove.js +26 -68
  48. package/dist/m365/spo/commands/userprofile/userprofile-get.js +10 -23
  49. package/dist/m365/spo/commands/userprofile/userprofile-set.js +10 -19
  50. package/dist/m365/spo/commands/web/web-add.js +20 -55
  51. package/dist/m365/spo/commands/web/web-clientsidewebpart-list.js +10 -18
  52. package/dist/m365/spo/commands/web/web-get.js +12 -30
  53. package/dist/m365/spo/commands/web/web-installedlanguage-list.js +10 -18
  54. package/dist/m365/spo/commands/web/web-list.js +10 -18
  55. package/dist/m365/spo/commands/web/web-reindex.js +10 -18
  56. package/dist/m365/spo/commands/web/web-remove.js +11 -27
  57. package/dist/m365/spo/commands/web/web-retentionlabel-list.js +10 -18
  58. package/dist/m365/spo/commands/web/web-roleassignment-add.js +40 -64
  59. package/dist/m365/spo/commands/web/web-roleassignment-remove.js +31 -58
  60. package/dist/m365/spo/commands/web/web-roleinheritance-break.js +12 -36
  61. package/dist/m365/spo/commands/web/web-roleinheritance-reset.js +11 -29
  62. package/dist/m365/spo/commands/web/web-rule-list.js +6 -4
  63. package/dist/m365/spo/commands/web/web-rule-remove.js +0 -3
  64. package/dist/m365/spo/commands/web/web-set.js +26 -96
  65. package/dist/m365/spo/commands.js +0 -2
  66. package/dist/m365/teams/commands/channel/channel-list.js +2 -6
  67. package/dist/m365/teams/commands/channel/channel-member-add.js +2 -6
  68. package/dist/m365/teams/commands/channel/channel-member-list.js +2 -6
  69. package/dist/m365/teams/commands/channel/channel-member-remove.js +2 -6
  70. package/dist/m365/teams/commands/channel/channel-member-set.js +2 -6
  71. package/dist/m365/teams/commands/channel/channel-remove.js +2 -8
  72. package/dist/m365/teams/commands/channel/channel-set.js +2 -8
  73. package/dist/m365/teams/commands/tab/tab-get.js +2 -6
  74. package/dist/m365/teams/commands/team/team-archive.js +2 -6
  75. package/dist/m365/teams/commands/team/team-remove.js +2 -6
  76. package/dist/m365/teams/commands/team/team-unarchive.js +2 -6
  77. package/docs/docs/cmd/entra/m365group/m365group-remove.mdx +4 -4
  78. package/docs/docs/cmd/spe/container/container-remove.mdx +5 -5
  79. package/docs/docs/cmd/spo/contenttype/contenttype-sync.mdx +4 -4
  80. package/docs/docs/cmd/spo/file/file-add.mdx +2 -2
  81. package/docs/docs/cmd/spo/file/file-archive.mdx +8 -0
  82. package/docs/docs/cmd/spo/file/file-checkin.mdx +21 -0
  83. package/docs/docs/cmd/spo/file/file-checkout.mdx +21 -0
  84. package/docs/docs/cmd/spo/file/file-copy.mdx +19 -0
  85. package/docs/docs/cmd/spo/file/file-get.mdx +19 -0
  86. package/docs/docs/cmd/spo/file/file-list.mdx +19 -0
  87. package/docs/docs/cmd/spo/file/file-move.mdx +19 -0
  88. package/docs/docs/cmd/spo/file/file-remove.mdx +25 -4
  89. package/docs/docs/cmd/spo/file/file-rename.mdx +19 -0
  90. package/docs/docs/cmd/spo/file/file-unarchive.mdx +8 -0
  91. package/docs/docs/cmd/spo/folder/folder-archive.mdx +6 -0
  92. package/docs/docs/cmd/spo/folder/folder-remove.mdx +4 -4
  93. package/docs/docs/cmd/spo/folder/folder-retentionlabel-ensure.mdx +21 -0
  94. package/docs/docs/cmd/spo/folder/folder-retentionlabel-remove.mdx +21 -0
  95. package/docs/docs/cmd/spo/folder/folder-roleassignment-add.mdx +21 -0
  96. package/docs/docs/cmd/spo/folder/folder-roleassignment-remove.mdx +21 -0
  97. package/docs/docs/cmd/spo/folder/folder-roleinheritance-break.mdx +21 -0
  98. package/docs/docs/cmd/spo/folder/folder-roleinheritance-reset.mdx +21 -0
  99. package/docs/docs/cmd/spo/list/list-add.mdx +19 -0
  100. package/docs/docs/cmd/spo/list/list-contenttype-add.mdx +19 -0
  101. package/docs/docs/cmd/spo/list/list-contenttype-default-set.mdx +21 -0
  102. package/docs/docs/cmd/spo/list/list-contenttype-list.mdx +19 -0
  103. package/docs/docs/cmd/spo/list/list-contenttype-remove.mdx +21 -0
  104. package/docs/docs/cmd/spo/list/list-defaultvalue-clear.mdx +21 -0
  105. package/docs/docs/cmd/spo/list/list-defaultvalue-list.mdx +19 -0
  106. package/docs/docs/cmd/spo/list/list-defaultvalue-remove.mdx +21 -0
  107. package/docs/docs/cmd/spo/list/list-defaultvalue-set.mdx +21 -0
  108. package/docs/docs/cmd/spo/list/list-get.mdx +19 -0
  109. package/docs/docs/cmd/spo/list/list-list.mdx +19 -0
  110. package/docs/docs/cmd/spo/list/list-remove.mdx +25 -4
  111. package/docs/docs/cmd/spo/list/list-retentionlabel-ensure.mdx +21 -0
  112. package/docs/docs/cmd/spo/list/list-retentionlabel-get.mdx +19 -0
  113. package/docs/docs/cmd/spo/list/list-retentionlabel-remove.mdx +21 -0
  114. package/docs/docs/cmd/spo/list/list-roleassignment-add.mdx +21 -0
  115. package/docs/docs/cmd/spo/list/list-roleassignment-remove.mdx +21 -0
  116. package/docs/docs/cmd/spo/list/list-roleinheritance-break.mdx +21 -0
  117. package/docs/docs/cmd/spo/list/list-roleinheritance-reset.mdx +21 -0
  118. package/docs/docs/cmd/spo/list/list-sensitivitylabel-ensure.mdx +23 -0
  119. package/docs/docs/cmd/spo/list/list-set.mdx +21 -0
  120. package/docs/docs/cmd/spo/list/list-sitescript-get.mdx +19 -0
  121. package/docs/docs/cmd/spo/list/list-view-add.mdx +19 -0
  122. package/docs/docs/cmd/spo/list/list-view-field-add.mdx +21 -0
  123. package/docs/docs/cmd/spo/list/list-view-field-remove.mdx +21 -0
  124. package/docs/docs/cmd/spo/list/list-view-field-set.mdx +21 -0
  125. package/docs/docs/cmd/spo/list/list-view-get.mdx +19 -0
  126. package/docs/docs/cmd/spo/list/list-view-list.mdx +19 -0
  127. package/docs/docs/cmd/spo/list/list-view-remove.mdx +21 -0
  128. package/docs/docs/cmd/spo/list/list-view-set.mdx +19 -0
  129. package/docs/docs/cmd/spo/list/list-webhook-add.mdx +19 -0
  130. package/docs/docs/cmd/spo/list/list-webhook-get.mdx +19 -0
  131. package/docs/docs/cmd/spo/list/list-webhook-list.mdx +19 -0
  132. package/docs/docs/cmd/spo/list/list-webhook-remove.mdx +21 -0
  133. package/docs/docs/cmd/spo/list/list-webhook-set.mdx +21 -0
  134. package/docs/docs/cmd/spo/listitem/listitem-attachment-add.mdx +19 -0
  135. package/docs/docs/cmd/spo/listitem/listitem-attachment-get.mdx +19 -0
  136. package/docs/docs/cmd/spo/listitem/listitem-attachment-list.mdx +19 -0
  137. package/docs/docs/cmd/spo/listitem/listitem-attachment-remove.mdx +19 -0
  138. package/docs/docs/cmd/spo/listitem/listitem-attachment-set.mdx +19 -0
  139. package/docs/docs/cmd/spo/listitem/listitem-batch-remove.mdx +8 -2
  140. package/docs/docs/cmd/spo/listitem/listitem-get.mdx +13 -7
  141. package/docs/docs/cmd/spo/listitem/listitem-remove.mdx +8 -2
  142. package/docs/docs/cmd/spo/page/page-header-set.mdx +9 -9
  143. package/docs/docs/cmd/spo/page/page-remove.mdx +4 -4
  144. package/docs/docs/cmd/spo/site/site-apppermission-add.mdx +52 -21
  145. package/docs/docs/cmd/spo/site/site-list.mdx +22 -1
  146. package/docs/docs/cmd/spo/site/site-remove.mdx +3 -3
  147. package/docs/docs/cmd/spo/storageentity/storageentity-get.mdx +11 -2
  148. package/docs/docs/cmd/spo/storageentity/storageentity-list.mdx +9 -3
  149. package/docs/docs/cmd/spo/storageentity/storageentity-remove.mdx +6 -6
  150. package/docs/docs/cmd/spo/storageentity/storageentity-set.mdx +10 -4
  151. package/docs/docs/cmd/spo/web/web-rule-list.mdx +8 -12
  152. package/docs/docs/cmd/spo/web/web-rule-remove.mdx +0 -6
  153. package/docs/docs/cmd/teams/app/app-install.mdx +21 -0
  154. package/docs/docs/cmd/teams/app/app-list.mdx +19 -0
  155. package/docs/docs/cmd/teams/app/app-publish.mdx +17 -0
  156. package/docs/docs/cmd/teams/app/app-remove.mdx +19 -0
  157. package/docs/docs/cmd/teams/app/app-uninstall.mdx +21 -0
  158. package/docs/docs/cmd/teams/app/app-update.mdx +19 -0
  159. package/docs/docs/cmd/tenant/id/id-get.mdx +15 -0
  160. package/docs/docs/cmd/tenant/info/info-get.mdx +19 -0
  161. package/docs/docs/cmd/tenant/people/people-pronouns-get.mdx +19 -0
  162. package/docs/docs/cmd/tenant/people/people-pronouns-set.mdx +19 -0
  163. package/docs/docs/cmd/tenant/report/report-settings-get.mdx +19 -0
  164. package/docs/docs/cmd/tenant/report/report-settings-set.mdx +21 -0
  165. package/docs/docs/cmd/tenant/security/security-alerts-list.mdx +19 -0
  166. package/npm-shrinkwrap.json +1541 -1163
  167. package/package.json +22 -17
@@ -1,15 +1,23 @@
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 _SpoUserGetCommand_instances, _SpoUserGetCommand_initTelemetry, _SpoUserGetCommand_initOptions, _SpoUserGetCommand_initTypes, _SpoUserGetCommand_initValidators, _SpoUserGetCommand_initOptionSets;
1
+ import { globalOptionsZod } from '../../../../Command.js';
7
2
  import request from '../../../../request.js';
8
3
  import { entraGroup } from '../../../../utils/entraGroup.js';
9
4
  import { formatting } from '../../../../utils/formatting.js';
10
5
  import { validation } from '../../../../utils/validation.js';
11
6
  import SpoCommand from '../../../base/SpoCommand.js';
12
7
  import commands from '../../commands.js';
8
+ import { z } from 'zod';
9
+ export const options = z.strictObject({
10
+ ...globalOptionsZod.shape,
11
+ webUrl: z.string().refine(webUrl => validation.isValidSharePointUrl(webUrl) === true, {
12
+ error: e => `${e.input} is not a valid SharePoint Online site URL.`
13
+ }).alias('u'),
14
+ id: z.number().int().positive().optional().alias('i'),
15
+ email: z.string().refine(email => validation.isValidUserPrincipalName(email), { error: e => `${e.input} is not a valid email.` }).optional(),
16
+ loginName: z.string().optional(),
17
+ userName: z.string().refine(userName => validation.isValidUserPrincipalName(userName), { error: e => `${e.input} is not a valid userName.` }).optional(),
18
+ entraGroupId: z.string().refine(id => validation.isValidGuid(id), { error: e => `${e.input} is not a valid GUID.` }).optional(),
19
+ entraGroupName: z.string().optional()
20
+ });
13
21
  class SpoUserGetCommand extends SpoCommand {
14
22
  get name() {
15
23
  return commands.USER_GET;
@@ -17,14 +25,17 @@ class SpoUserGetCommand extends SpoCommand {
17
25
  get description() {
18
26
  return 'Gets a site user within specific web';
19
27
  }
20
- constructor() {
21
- super();
22
- _SpoUserGetCommand_instances.add(this);
23
- __classPrivateFieldGet(this, _SpoUserGetCommand_instances, "m", _SpoUserGetCommand_initTelemetry).call(this);
24
- __classPrivateFieldGet(this, _SpoUserGetCommand_instances, "m", _SpoUserGetCommand_initOptions).call(this);
25
- __classPrivateFieldGet(this, _SpoUserGetCommand_instances, "m", _SpoUserGetCommand_initValidators).call(this);
26
- __classPrivateFieldGet(this, _SpoUserGetCommand_instances, "m", _SpoUserGetCommand_initOptionSets).call(this);
27
- __classPrivateFieldGet(this, _SpoUserGetCommand_instances, "m", _SpoUserGetCommand_initTypes).call(this);
28
+ get schema() {
29
+ return options;
30
+ }
31
+ getRefinedSchema(schema) {
32
+ return schema.refine(opts => [opts.id, opts.email, opts.loginName, opts.userName, opts.entraGroupId, opts.entraGroupName].filter(value => value !== undefined).length <= 1, {
33
+ error: 'Specify no more than one of the following options: id, email, loginName, userName, entraGroupId, entraGroupName.',
34
+ params: {
35
+ customCode: 'optionSet',
36
+ options: ['id', 'email', 'loginName', 'userName', 'entraGroupId', 'entraGroupName']
37
+ }
38
+ });
28
39
  }
29
40
  async commandAction(logger, args) {
30
41
  if (this.verbose) {
@@ -96,56 +107,5 @@ class SpoUserGetCommand extends SpoCommand {
96
107
  return entraGroup.getGroupByDisplayName(entraGroupName);
97
108
  }
98
109
  }
99
- _SpoUserGetCommand_instances = new WeakSet(), _SpoUserGetCommand_initTelemetry = function _SpoUserGetCommand_initTelemetry() {
100
- this.telemetry.push((args) => {
101
- Object.assign(this.telemetryProperties, {
102
- id: typeof args.options.id !== 'undefined',
103
- email: typeof args.options.email !== 'undefined',
104
- loginName: typeof args.options.loginName !== 'undefined',
105
- userName: typeof args.options.userName !== 'undefined',
106
- entraGroupId: typeof args.options.entraGroupId !== 'undefined',
107
- entraGroupName: typeof args.options.entraGroupName !== 'undefined'
108
- });
109
- });
110
- }, _SpoUserGetCommand_initOptions = function _SpoUserGetCommand_initOptions() {
111
- this.options.unshift({
112
- option: '-u, --webUrl <webUrl>'
113
- }, {
114
- option: '-i, --id [id]'
115
- }, {
116
- option: '--email [email]'
117
- }, {
118
- option: '--loginName [loginName]'
119
- }, {
120
- option: '--userName [userName]'
121
- }, {
122
- option: '--entraGroupId [entraGroupId]'
123
- }, {
124
- option: '--entraGroupName [entraGroupName]'
125
- });
126
- }, _SpoUserGetCommand_initTypes = function _SpoUserGetCommand_initTypes() {
127
- this.types.string.push('webUrl', 'email', 'loginName', 'userName', 'entraGroupId', 'entraGroupName');
128
- }, _SpoUserGetCommand_initValidators = function _SpoUserGetCommand_initValidators() {
129
- this.validators.push(async (args) => {
130
- if (args.options.id && !validation.isValidPositiveInteger(args.options.id)) {
131
- return `Specified id ${args.options.id} is not a valid number.`;
132
- }
133
- if (args.options.entraGroupId && !validation.isValidGuid(args.options.entraGroupId)) {
134
- return `${args.options.entraGroupId} is not a valid GUID.`;
135
- }
136
- if (args.options.userName && !validation.isValidUserPrincipalName(args.options.userName)) {
137
- return `${args.options.userName} is not a valid userName.`;
138
- }
139
- if (args.options.email && !validation.isValidUserPrincipalName(args.options.email)) {
140
- return `${args.options.email} is not a valid email.`;
141
- }
142
- return validation.isValidSharePointUrl(args.options.webUrl);
143
- });
144
- }, _SpoUserGetCommand_initOptionSets = function _SpoUserGetCommand_initOptionSets() {
145
- this.optionSets.push({
146
- options: ['id', 'email', 'loginName', 'userName', 'entraGroupId', 'entraGroupName'],
147
- runsWhen: (args) => args.options.id || args.options.email || args.options.loginName || args.options.userName || args.options.entraGroupId || args.options.entraGroupName
148
- });
149
- };
150
110
  export default new SpoUserGetCommand();
151
111
  //# sourceMappingURL=user-get.js.map
@@ -1,13 +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 _SpoUserListCommand_instances, _SpoUserListCommand_initOptions, _SpoUserListCommand_initValidators;
1
+ import { globalOptionsZod } from '../../../../Command.js';
7
2
  import request from '../../../../request.js';
8
3
  import { validation } from '../../../../utils/validation.js';
9
4
  import SpoCommand from '../../../base/SpoCommand.js';
10
5
  import commands from '../../commands.js';
6
+ import { z } from 'zod';
7
+ export const options = z.strictObject({
8
+ ...globalOptionsZod.shape,
9
+ webUrl: z.string().refine(webUrl => validation.isValidSharePointUrl(webUrl) === true, {
10
+ error: e => `${e.input} is not a valid SharePoint Online site URL.`
11
+ }).alias('u')
12
+ });
11
13
  class SpoUserListCommand extends SpoCommand {
12
14
  get name() {
13
15
  return commands.USER_LIST;
@@ -18,11 +20,8 @@ class SpoUserListCommand extends SpoCommand {
18
20
  defaultProperties() {
19
21
  return ['Id', 'Title', 'LoginName'];
20
22
  }
21
- constructor() {
22
- super();
23
- _SpoUserListCommand_instances.add(this);
24
- __classPrivateFieldGet(this, _SpoUserListCommand_instances, "m", _SpoUserListCommand_initOptions).call(this);
25
- __classPrivateFieldGet(this, _SpoUserListCommand_instances, "m", _SpoUserListCommand_initValidators).call(this);
23
+ get schema() {
24
+ return options;
26
25
  }
27
26
  async commandAction(logger, args) {
28
27
  if (this.verbose) {
@@ -45,12 +44,5 @@ class SpoUserListCommand extends SpoCommand {
45
44
  }
46
45
  }
47
46
  }
48
- _SpoUserListCommand_instances = new WeakSet(), _SpoUserListCommand_initOptions = function _SpoUserListCommand_initOptions() {
49
- this.options.unshift({
50
- option: '-u, --webUrl <webUrl>'
51
- });
52
- }, _SpoUserListCommand_initValidators = function _SpoUserListCommand_initValidators() {
53
- this.validators.push(async (args) => validation.isValidSharePointUrl(args.options.webUrl));
54
- };
55
47
  export default new SpoUserListCommand();
56
48
  //# sourceMappingURL=user-list.js.map
@@ -1,10 +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 _SpoUserRemoveCommand_instances, _SpoUserRemoveCommand_initTelemetry, _SpoUserRemoveCommand_initOptions, _SpoUserRemoveCommand_initValidators, _SpoUserRemoveCommand_initOptionSets;
7
1
  import { cli } from '../../../../cli/cli.js';
2
+ import { globalOptionsZod } from '../../../../Command.js';
8
3
  import { spo } from '../../../../utils/spo.js';
9
4
  import request from '../../../../request.js';
10
5
  import { entraGroup } from '../../../../utils/entraGroup.js';
@@ -12,6 +7,20 @@ import { formatting } from '../../../../utils/formatting.js';
12
7
  import { validation } from '../../../../utils/validation.js';
13
8
  import SpoCommand from '../../../base/SpoCommand.js';
14
9
  import commands from '../../commands.js';
10
+ import { z } from 'zod';
11
+ export const options = z.strictObject({
12
+ ...globalOptionsZod.shape,
13
+ webUrl: z.string().refine(webUrl => validation.isValidSharePointUrl(webUrl) === true, {
14
+ error: e => `${e.input} is not a valid SharePoint Online site URL.`
15
+ }).alias('u'),
16
+ id: z.number().int().positive().optional().alias('i'),
17
+ loginName: z.string().optional(),
18
+ email: z.string().refine(email => validation.isValidUserPrincipalName(email), { error: e => `${e.input} is not a valid email.` }).optional(),
19
+ userName: z.string().refine(userName => validation.isValidUserPrincipalName(userName), { error: e => `${e.input} is not a valid userName.` }).optional(),
20
+ entraGroupId: z.string().refine(id => validation.isValidGuid(id), { error: e => `${e.input} is not a valid GUID.` }).optional(),
21
+ entraGroupName: z.string().optional(),
22
+ force: z.boolean().optional().alias('f')
23
+ });
15
24
  ;
16
25
  class SpoUserRemoveCommand extends SpoCommand {
17
26
  get name() {
@@ -20,13 +29,17 @@ class SpoUserRemoveCommand extends SpoCommand {
20
29
  get description() {
21
30
  return 'Removes user from specific web';
22
31
  }
23
- constructor() {
24
- super();
25
- _SpoUserRemoveCommand_instances.add(this);
26
- __classPrivateFieldGet(this, _SpoUserRemoveCommand_instances, "m", _SpoUserRemoveCommand_initTelemetry).call(this);
27
- __classPrivateFieldGet(this, _SpoUserRemoveCommand_instances, "m", _SpoUserRemoveCommand_initOptions).call(this);
28
- __classPrivateFieldGet(this, _SpoUserRemoveCommand_instances, "m", _SpoUserRemoveCommand_initValidators).call(this);
29
- __classPrivateFieldGet(this, _SpoUserRemoveCommand_instances, "m", _SpoUserRemoveCommand_initOptionSets).call(this);
32
+ get schema() {
33
+ return options;
34
+ }
35
+ getRefinedSchema(schema) {
36
+ return schema.refine(opts => [opts.id, opts.loginName, opts.email, opts.userName, opts.entraGroupId, opts.entraGroupName].filter(value => value !== undefined).length === 1, {
37
+ error: 'Specify one of the following options: id, loginName, email, userName, entraGroupId, entraGroupName.',
38
+ params: {
39
+ customCode: 'optionSet',
40
+ options: ['id', 'loginName', 'email', 'userName', 'entraGroupId', 'entraGroupName']
41
+ }
42
+ });
30
43
  }
31
44
  async commandAction(logger, args) {
32
45
  if (args.options.force) {
@@ -109,60 +122,5 @@ class SpoUserRemoveCommand extends SpoCommand {
109
122
  return options.entraGroupId ? await entraGroup.getGroupById(options.entraGroupId) : await entraGroup.getGroupByDisplayName(options.entraGroupName);
110
123
  }
111
124
  }
112
- _SpoUserRemoveCommand_instances = new WeakSet(), _SpoUserRemoveCommand_initTelemetry = function _SpoUserRemoveCommand_initTelemetry() {
113
- this.telemetry.push((args) => {
114
- Object.assign(this.telemetryProperties, {
115
- id: typeof args.options.id !== 'undefined',
116
- loginName: typeof args.options.loginName !== 'undefined',
117
- email: typeof args.options.email !== 'undefined',
118
- userName: typeof args.options.userName !== 'undefined',
119
- entraGroupId: typeof args.options.entraGroupId !== 'undefined',
120
- entraGroupName: typeof args.options.entraGroupName !== 'undefined',
121
- force: !!args.options.force
122
- });
123
- });
124
- }, _SpoUserRemoveCommand_initOptions = function _SpoUserRemoveCommand_initOptions() {
125
- this.options.unshift({
126
- option: '-u, --webUrl <webUrl>'
127
- }, {
128
- option: '-i, --id [id]'
129
- }, {
130
- option: '--loginName [loginName]'
131
- }, {
132
- option: '--email [email]'
133
- }, {
134
- option: '--userName [userName]'
135
- }, {
136
- option: '--entraGroupId [entraGroupId]'
137
- }, {
138
- option: '--entraGroupName [entraGroupName]'
139
- }, {
140
- option: '-f, --force'
141
- });
142
- }, _SpoUserRemoveCommand_initValidators = function _SpoUserRemoveCommand_initValidators() {
143
- this.validators.push(async (args) => {
144
- const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
145
- if (isValidSharePointUrl !== true) {
146
- return isValidSharePointUrl;
147
- }
148
- if (args.options.id && isNaN(parseInt(args.options.id))) {
149
- return `Specified id ${args.options.id} is not a number`;
150
- }
151
- if (args.options.entraGroupId && !validation.isValidGuid(args.options.entraGroupId)) {
152
- return `${args.options.entraId} is not a valid GUID.`;
153
- }
154
- if (args.options.userName && !validation.isValidUserPrincipalName(args.options.userName)) {
155
- return `${args.options.userName} is not a valid userName.`;
156
- }
157
- if (args.options.email && !validation.isValidUserPrincipalName(args.options.email)) {
158
- return `${args.options.email} is not a valid email.`;
159
- }
160
- return true;
161
- });
162
- }, _SpoUserRemoveCommand_initOptionSets = function _SpoUserRemoveCommand_initOptionSets() {
163
- this.optionSets.push({
164
- options: ['id', 'loginName', 'email', 'userName', 'entraGroupId', 'entraGroupName']
165
- });
166
- };
167
125
  export default new SpoUserRemoveCommand();
168
126
  //# sourceMappingURL=user-remove.js.map
@@ -1,16 +1,18 @@
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 _SpoUserProfileGetCommand_instances, _SpoUserProfileGetCommand_initOptions, _SpoUserProfileGetCommand_initValidators;
7
1
  import { cli } from '../../../../cli/cli.js';
2
+ import { globalOptionsZod } from '../../../../Command.js';
8
3
  import request from '../../../../request.js';
9
4
  import { formatting } from '../../../../utils/formatting.js';
10
5
  import { spo } from '../../../../utils/spo.js';
11
6
  import { validation } from '../../../../utils/validation.js';
12
7
  import SpoCommand from '../../../base/SpoCommand.js';
13
8
  import commands from '../../commands.js';
9
+ import { z } from 'zod';
10
+ export const options = z.strictObject({
11
+ ...globalOptionsZod.shape,
12
+ userName: z.string().refine(userName => validation.isValidUserPrincipalName(userName), {
13
+ error: e => `${e.input} is not a valid user principal name`
14
+ }).alias('u')
15
+ });
14
16
  class SpoUserProfileGetCommand extends SpoCommand {
15
17
  get name() {
16
18
  return commands.USERPROFILE_GET;
@@ -18,11 +20,8 @@ class SpoUserProfileGetCommand extends SpoCommand {
18
20
  get description() {
19
21
  return 'Gets SharePoint user profile properties for the specified user';
20
22
  }
21
- constructor() {
22
- super();
23
- _SpoUserProfileGetCommand_instances.add(this);
24
- __classPrivateFieldGet(this, _SpoUserProfileGetCommand_instances, "m", _SpoUserProfileGetCommand_initOptions).call(this);
25
- __classPrivateFieldGet(this, _SpoUserProfileGetCommand_instances, "m", _SpoUserProfileGetCommand_initValidators).call(this);
23
+ get schema() {
24
+ return options;
26
25
  }
27
26
  async commandAction(logger, args) {
28
27
  try {
@@ -46,17 +45,5 @@ class SpoUserProfileGetCommand extends SpoCommand {
46
45
  }
47
46
  }
48
47
  }
49
- _SpoUserProfileGetCommand_instances = new WeakSet(), _SpoUserProfileGetCommand_initOptions = function _SpoUserProfileGetCommand_initOptions() {
50
- this.options.unshift({
51
- option: '-u, --userName <userName>'
52
- });
53
- }, _SpoUserProfileGetCommand_initValidators = function _SpoUserProfileGetCommand_initValidators() {
54
- this.validators.push(async (args) => {
55
- if (!validation.isValidUserPrincipalName(args.options.userName)) {
56
- return `${args.options.userName} is not a valid user principal name`;
57
- }
58
- return true;
59
- });
60
- };
61
48
  export default new SpoUserProfileGetCommand();
62
49
  //# sourceMappingURL=userprofile-get.js.map
@@ -1,13 +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 _SpoUserProfileSetCommand_instances, _SpoUserProfileSetCommand_initOptions;
1
+ import { globalOptionsZod } from '../../../../Command.js';
7
2
  import request from '../../../../request.js';
8
3
  import { spo } from '../../../../utils/spo.js';
9
4
  import SpoCommand from '../../../base/SpoCommand.js';
10
5
  import commands from '../../commands.js';
6
+ import { z } from 'zod';
7
+ export const options = z.strictObject({
8
+ ...globalOptionsZod.shape,
9
+ userName: z.string().alias('u'),
10
+ propertyName: z.string().alias('n'),
11
+ propertyValue: z.string().alias('v')
12
+ });
11
13
  class SpoUserProfileSetCommand extends SpoCommand {
12
14
  get name() {
13
15
  return commands.USERPROFILE_SET;
@@ -15,10 +17,8 @@ class SpoUserProfileSetCommand extends SpoCommand {
15
17
  get description() {
16
18
  return 'Sets user profile property for a SharePoint user';
17
19
  }
18
- constructor() {
19
- super();
20
- _SpoUserProfileSetCommand_instances.add(this);
21
- __classPrivateFieldGet(this, _SpoUserProfileSetCommand_instances, "m", _SpoUserProfileSetCommand_initOptions).call(this);
20
+ get schema() {
21
+ return options;
22
22
  }
23
23
  async commandAction(logger, args) {
24
24
  try {
@@ -54,14 +54,5 @@ class SpoUserProfileSetCommand extends SpoCommand {
54
54
  }
55
55
  }
56
56
  }
57
- _SpoUserProfileSetCommand_instances = new WeakSet(), _SpoUserProfileSetCommand_initOptions = function _SpoUserProfileSetCommand_initOptions() {
58
- this.options.unshift({
59
- option: '-u, --userName <userName>'
60
- }, {
61
- option: '-n, --propertyName <propertyName>'
62
- }, {
63
- option: '-v, --propertyValue <propertyValue>'
64
- });
65
- };
66
57
  export default new SpoUserProfileSetCommand();
67
58
  //# sourceMappingURL=userprofile-set.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 _SpoWebAddCommand_instances, _SpoWebAddCommand_initTelemetry, _SpoWebAddCommand_initOptions, _SpoWebAddCommand_initValidators;
1
+ import { z } from 'zod';
7
2
  import config from '../../../../config.js';
3
+ import { globalOptionsZod } from '../../../../Command.js';
8
4
  import request from '../../../../request.js';
9
5
  import { formatting } from '../../../../utils/formatting.js';
10
6
  import { spo } from '../../../../utils/spo.js';
@@ -12,6 +8,21 @@ import { validation } from '../../../../utils/validation.js';
12
8
  import SpoCommand from '../../../base/SpoCommand.js';
13
9
  import { BasePermissions, PermissionKind } from '../../base-permissions.js';
14
10
  import commands from '../../commands.js';
11
+ export const options = z.strictObject({
12
+ ...globalOptionsZod.shape,
13
+ title: z.string().alias('t'),
14
+ description: z.string().optional().alias('d'),
15
+ url: z.string().alias('u'),
16
+ webTemplate: z.string().alias('w'),
17
+ parentWebUrl: z.string().refine(url => validation.isValidSharePointUrl(url) === true, {
18
+ error: e => `${e.input} is not a valid SharePoint Online site URL.`
19
+ }).alias('p'),
20
+ locale: z.union([z.string(), z.number()]).refine(locale => !isNaN(parseInt(locale.toString())), {
21
+ error: e => `${e.input} is not a valid locale number`
22
+ }).optional().alias('l'),
23
+ breakInheritance: z.boolean().optional(),
24
+ inheritNavigation: z.boolean().optional()
25
+ });
15
26
  class SpoWebAddCommand extends SpoCommand {
16
27
  get name() {
17
28
  return commands.WEB_ADD;
@@ -19,12 +30,8 @@ class SpoWebAddCommand extends SpoCommand {
19
30
  get description() {
20
31
  return 'Creates new subsite';
21
32
  }
22
- constructor() {
23
- super();
24
- _SpoWebAddCommand_instances.add(this);
25
- __classPrivateFieldGet(this, _SpoWebAddCommand_instances, "m", _SpoWebAddCommand_initTelemetry).call(this);
26
- __classPrivateFieldGet(this, _SpoWebAddCommand_instances, "m", _SpoWebAddCommand_initOptions).call(this);
27
- __classPrivateFieldGet(this, _SpoWebAddCommand_instances, "m", _SpoWebAddCommand_initValidators).call(this);
33
+ get schema() {
34
+ return options;
28
35
  }
29
36
  getExcludedOptionsWithUrls() {
30
37
  return ['url'];
@@ -52,7 +59,7 @@ class SpoWebAddCommand extends SpoCommand {
52
59
  }
53
60
  };
54
61
  if (this.verbose) {
55
- await logger.logToStderr(`Creating subsite ${args.options.parentWebUrl}/${args.options.webUrl}...`);
62
+ await logger.logToStderr(`Creating subsite ${args.options.parentWebUrl}/${args.options.url}...`);
56
63
  }
57
64
  const siteInfo = await request.post(requestOptionsPost);
58
65
  if (args.options.inheritNavigation) {
@@ -105,47 +112,5 @@ class SpoWebAddCommand extends SpoCommand {
105
112
  }
106
113
  }
107
114
  }
108
- _SpoWebAddCommand_instances = new WeakSet(), _SpoWebAddCommand_initTelemetry = function _SpoWebAddCommand_initTelemetry() {
109
- this.telemetry.push((args) => {
110
- Object.assign(this.telemetryProperties, {
111
- description: (!(!args.options.description)).toString(),
112
- locale: args.options.locale || '1033',
113
- breakInheritance: args.options.breakInheritance || false,
114
- inheritNavigation: args.options.inheritNavigation || false
115
- });
116
- });
117
- }, _SpoWebAddCommand_initOptions = function _SpoWebAddCommand_initOptions() {
118
- this.options.unshift({
119
- option: '-t, --title <title>'
120
- }, {
121
- option: '-d, --description [description]'
122
- }, {
123
- option: '-u, --url <url>'
124
- }, {
125
- option: '-w, --webTemplate <webTemplate>'
126
- }, {
127
- option: '-p, --parentWebUrl <parentWebUrl>'
128
- }, {
129
- option: '-l, --locale [locale]'
130
- }, {
131
- option: '--breakInheritance'
132
- }, {
133
- option: '--inheritNavigation'
134
- });
135
- }, _SpoWebAddCommand_initValidators = function _SpoWebAddCommand_initValidators() {
136
- this.validators.push(async (args) => {
137
- const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.parentWebUrl);
138
- if (isValidSharePointUrl !== true) {
139
- return isValidSharePointUrl;
140
- }
141
- if (args.options.locale) {
142
- const locale = parseInt(args.options.locale);
143
- if (isNaN(locale)) {
144
- return `${args.options.locale} is not a valid locale number`;
145
- }
146
- }
147
- return true;
148
- });
149
- };
150
115
  export default new SpoWebAddCommand();
151
116
  //# sourceMappingURL=web-add.js.map
@@ -1,13 +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 _SpoWebClientSideWebPartListCommand_instances, _SpoWebClientSideWebPartListCommand_initOptions, _SpoWebClientSideWebPartListCommand_initValidators;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
7
3
  import request from '../../../../request.js';
8
4
  import { validation } from '../../../../utils/validation.js';
9
5
  import SpoCommand from '../../../base/SpoCommand.js';
10
6
  import commands from '../../commands.js';
7
+ export const options = z.strictObject({
8
+ ...globalOptionsZod.shape,
9
+ webUrl: z.string().refine(url => validation.isValidSharePointUrl(url) === true, {
10
+ error: e => `${e.input} is not a valid SharePoint Online site URL.`
11
+ }).alias('u')
12
+ });
11
13
  class SpoWebClientSideWebPartListCommand extends SpoCommand {
12
14
  get name() {
13
15
  return commands.WEB_CLIENTSIDEWEBPART_LIST;
@@ -15,11 +17,8 @@ class SpoWebClientSideWebPartListCommand extends SpoCommand {
15
17
  get description() {
16
18
  return 'Lists available client-side web parts';
17
19
  }
18
- constructor() {
19
- super();
20
- _SpoWebClientSideWebPartListCommand_instances.add(this);
21
- __classPrivateFieldGet(this, _SpoWebClientSideWebPartListCommand_instances, "m", _SpoWebClientSideWebPartListCommand_initOptions).call(this);
22
- __classPrivateFieldGet(this, _SpoWebClientSideWebPartListCommand_instances, "m", _SpoWebClientSideWebPartListCommand_initValidators).call(this);
20
+ get schema() {
21
+ return options;
23
22
  }
24
23
  async commandAction(logger, args) {
25
24
  const requestOptions = {
@@ -48,12 +47,5 @@ class SpoWebClientSideWebPartListCommand extends SpoCommand {
48
47
  }
49
48
  }
50
49
  }
51
- _SpoWebClientSideWebPartListCommand_instances = new WeakSet(), _SpoWebClientSideWebPartListCommand_initOptions = function _SpoWebClientSideWebPartListCommand_initOptions() {
52
- this.options.unshift({
53
- option: '-u, --webUrl <webUrl>'
54
- });
55
- }, _SpoWebClientSideWebPartListCommand_initValidators = function _SpoWebClientSideWebPartListCommand_initValidators() {
56
- this.validators.push(async (args) => validation.isValidSharePointUrl(args.options.webUrl));
57
- };
58
50
  export default new SpoWebClientSideWebPartListCommand();
59
51
  //# sourceMappingURL=web-clientsidewebpart-list.js.map
@@ -1,14 +1,18 @@
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 _SpoWebGetCommand_instances, _SpoWebGetCommand_initTelemetry, _SpoWebGetCommand_initOptions, _SpoWebGetCommand_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';
8
+ export const options = z.strictObject({
9
+ ...globalOptionsZod.shape,
10
+ url: z.string().refine(url => validation.isValidSharePointUrl(url) === true, {
11
+ error: e => `${e.input} is not a valid SharePoint Online site URL.`
12
+ }).alias('u'),
13
+ withGroups: z.boolean().optional(),
14
+ withPermissions: z.boolean().optional()
15
+ });
12
16
  class SpoWebGetCommand extends SpoCommand {
13
17
  get name() {
14
18
  return commands.WEB_GET;
@@ -16,12 +20,8 @@ class SpoWebGetCommand extends SpoCommand {
16
20
  get description() {
17
21
  return 'Retrieves information about the specified site';
18
22
  }
19
- constructor() {
20
- super();
21
- _SpoWebGetCommand_instances.add(this);
22
- __classPrivateFieldGet(this, _SpoWebGetCommand_instances, "m", _SpoWebGetCommand_initTelemetry).call(this);
23
- __classPrivateFieldGet(this, _SpoWebGetCommand_instances, "m", _SpoWebGetCommand_initOptions).call(this);
24
- __classPrivateFieldGet(this, _SpoWebGetCommand_instances, "m", _SpoWebGetCommand_initValidators).call(this);
23
+ get schema() {
24
+ return options;
25
25
  }
26
26
  async commandAction(logger, args) {
27
27
  let url = `${args.options.url}/_api/web`;
@@ -52,23 +52,5 @@ class SpoWebGetCommand extends SpoCommand {
52
52
  }
53
53
  }
54
54
  }
55
- _SpoWebGetCommand_instances = new WeakSet(), _SpoWebGetCommand_initTelemetry = function _SpoWebGetCommand_initTelemetry() {
56
- this.telemetry.push((args) => {
57
- Object.assign(this.telemetryProperties, {
58
- withGroups: !!args.options.withGroups,
59
- withPermissions: !!args.options.withPermissions
60
- });
61
- });
62
- }, _SpoWebGetCommand_initOptions = function _SpoWebGetCommand_initOptions() {
63
- this.options.unshift({
64
- option: '-u, --url <url>'
65
- }, {
66
- option: '--withGroups'
67
- }, {
68
- option: '--withPermissions'
69
- });
70
- }, _SpoWebGetCommand_initValidators = function _SpoWebGetCommand_initValidators() {
71
- this.validators.push(async (args) => validation.isValidSharePointUrl(args.options.url));
72
- };
73
55
  export default new SpoWebGetCommand();
74
56
  //# sourceMappingURL=web-get.js.map
@@ -1,13 +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 _SpoWebInstalledLanguageListCommand_instances, _SpoWebInstalledLanguageListCommand_initOptions, _SpoWebInstalledLanguageListCommand_initValidators;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
7
3
  import request from '../../../../request.js';
8
4
  import { validation } from '../../../../utils/validation.js';
9
5
  import SpoCommand from '../../../base/SpoCommand.js';
10
6
  import commands from '../../commands.js';
7
+ export const options = z.strictObject({
8
+ ...globalOptionsZod.shape,
9
+ webUrl: z.string().refine(url => validation.isValidSharePointUrl(url) === true, {
10
+ error: e => `${e.input} is not a valid SharePoint Online site URL.`
11
+ }).alias('u')
12
+ });
11
13
  class SpoWebInstalledLanguageListCommand extends SpoCommand {
12
14
  get name() {
13
15
  return commands.WEB_INSTALLEDLANGUAGE_LIST;
@@ -18,11 +20,8 @@ class SpoWebInstalledLanguageListCommand extends SpoCommand {
18
20
  defaultProperties() {
19
21
  return ['DisplayName', 'LanguageTag', 'Lcid'];
20
22
  }
21
- constructor() {
22
- super();
23
- _SpoWebInstalledLanguageListCommand_instances.add(this);
24
- __classPrivateFieldGet(this, _SpoWebInstalledLanguageListCommand_instances, "m", _SpoWebInstalledLanguageListCommand_initOptions).call(this);
25
- __classPrivateFieldGet(this, _SpoWebInstalledLanguageListCommand_instances, "m", _SpoWebInstalledLanguageListCommand_initValidators).call(this);
23
+ get schema() {
24
+ return options;
26
25
  }
27
26
  async commandAction(logger, args) {
28
27
  if (this.verbose) {
@@ -44,12 +43,5 @@ class SpoWebInstalledLanguageListCommand extends SpoCommand {
44
43
  }
45
44
  }
46
45
  }
47
- _SpoWebInstalledLanguageListCommand_instances = new WeakSet(), _SpoWebInstalledLanguageListCommand_initOptions = function _SpoWebInstalledLanguageListCommand_initOptions() {
48
- this.options.unshift({
49
- option: '-u, --webUrl <webUrl>'
50
- });
51
- }, _SpoWebInstalledLanguageListCommand_initValidators = function _SpoWebInstalledLanguageListCommand_initValidators() {
52
- this.validators.push(async (args) => validation.isValidSharePointUrl(args.options.webUrl));
53
- };
54
46
  export default new SpoWebInstalledLanguageListCommand();
55
47
  //# sourceMappingURL=web-installedlanguage-list.js.map