@pnp/cli-microsoft365 12.0.0-beta.e4f7675 → 12.0.0-beta.feb621e

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 (188) 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 +2 -6
  5. package/dist/auth/FileTokenStorage.js +0 -3
  6. package/dist/auth/msalCachePlugin.js +201 -12
  7. package/dist/googleAnalytics.js +96 -0
  8. package/dist/m365/commands/logout.js +2 -4
  9. package/dist/m365/entra/commands/m365group/m365group-remove.js +4 -3
  10. package/dist/m365/spe/commands/container/container-remove.js +6 -7
  11. package/dist/m365/spfx/commands/SpfxCompatibilityMatrix.js +15 -0
  12. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.24.0-rc.0.js +19 -0
  13. package/dist/m365/spfx/commands/project/project-doctor.js +2 -1
  14. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN012021_TSC_excludeDirectories.js +43 -0
  15. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN027002_OVERRIDES_qs.js +33 -0
  16. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN027003_OVERRIDES_uuid.js +33 -0
  17. package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.24.0-rc.0.js +77 -0
  18. package/dist/m365/spfx/commands/project/project-upgrade.js +12 -11
  19. package/dist/m365/spo/commands/app/app-add.js +35 -56
  20. package/dist/m365/spo/commands/app/app-deploy.js +41 -59
  21. package/dist/m365/spo/commands/app/app-get.js +40 -56
  22. package/dist/m365/spo/commands/app/app-install.js +20 -41
  23. package/dist/m365/spo/commands/app/app-instance-list.js +12 -24
  24. package/dist/m365/spo/commands/app/app-list.js +26 -44
  25. package/dist/m365/spo/commands/app/app-remove.js +32 -52
  26. package/dist/m365/spo/commands/app/app-retract.js +32 -51
  27. package/dist/m365/spo/commands/app/app-teamspackage-download.js +35 -54
  28. package/dist/m365/spo/commands/app/app-uninstall.js +21 -44
  29. package/dist/m365/spo/commands/app/app-upgrade.js +20 -41
  30. package/dist/m365/spo/commands/feature/feature-disable.js +20 -50
  31. package/dist/m365/spo/commands/feature/feature-enable.js +22 -50
  32. package/dist/m365/spo/commands/feature/feature-list.js +11 -36
  33. package/dist/m365/spo/commands/field/field-add.js +33 -62
  34. package/dist/m365/spo/commands/field/field-get.js +30 -57
  35. package/dist/m365/spo/commands/field/field-list.js +21 -46
  36. package/dist/m365/spo/commands/field/field-remove.js +32 -63
  37. package/dist/m365/spo/commands/field/field-set.js +34 -66
  38. package/dist/m365/spo/commands/file/file-archive.js +1 -1
  39. package/dist/m365/spo/commands/file/file-get.js +4 -3
  40. package/dist/m365/spo/commands/file/file-remove.js +5 -5
  41. package/dist/m365/spo/commands/file/file-unarchive.js +1 -1
  42. package/dist/m365/spo/commands/folder/folder-archive.js +1 -1
  43. package/dist/m365/spo/commands/folder/folder-remove.js +5 -5
  44. package/dist/m365/spo/commands/folder/folder-unarchive.js +90 -0
  45. package/dist/m365/spo/commands/hidedefaultthemes/hidedefaultthemes-get.js +5 -0
  46. package/dist/m365/spo/commands/hidedefaultthemes/hidedefaultthemes-set.js +8 -26
  47. package/dist/m365/spo/commands/homesite/homesite-list.js +5 -0
  48. package/dist/m365/spo/commands/hubsite/hubsite-connect.js +38 -63
  49. package/dist/m365/spo/commands/hubsite/hubsite-data-get.js +11 -27
  50. package/dist/m365/spo/commands/hubsite/hubsite-disconnect.js +25 -47
  51. package/dist/m365/spo/commands/hubsite/hubsite-get.js +25 -37
  52. package/dist/m365/spo/commands/hubsite/hubsite-list.js +12 -24
  53. package/dist/m365/spo/commands/hubsite/hubsite-register.js +10 -18
  54. package/dist/m365/spo/commands/hubsite/hubsite-rights-grant.js +14 -32
  55. package/dist/m365/spo/commands/hubsite/hubsite-rights-revoke.js +12 -29
  56. package/dist/m365/spo/commands/hubsite/hubsite-set.js +19 -46
  57. package/dist/m365/spo/commands/hubsite/hubsite-unregister.js +11 -27
  58. package/dist/m365/spo/commands/list/list-remove.js +4 -4
  59. package/dist/m365/spo/commands/listitem/listitem-batch-remove.js +5 -4
  60. package/dist/m365/spo/commands/listitem/listitem-get.js +1 -12
  61. package/dist/m365/spo/commands/listitem/listitem-remove.js +8 -5
  62. package/dist/m365/spo/commands/navigation/navigation-node-list.js +6 -4
  63. package/dist/m365/spo/commands/page/page-remove.js +7 -7
  64. package/dist/m365/spo/commands/site/site-remove.js +7 -7
  65. package/dist/m365/spo/commands/spo-get.js +5 -0
  66. package/dist/m365/spo/commands/spo-set.js +10 -21
  67. package/dist/m365/spo/commands/tenant/tenant-appcatalog-add.js +1 -1
  68. package/dist/m365/spo/commands/user/user-ensure.js +24 -60
  69. package/dist/m365/spo/commands/user/user-get.js +25 -65
  70. package/dist/m365/spo/commands/user/user-list.js +10 -18
  71. package/dist/m365/spo/commands/user/user-remove.js +26 -68
  72. package/dist/m365/spo/commands/userprofile/userprofile-get.js +10 -23
  73. package/dist/m365/spo/commands/userprofile/userprofile-set.js +10 -19
  74. package/dist/m365/spo/commands/web/web-add.js +20 -55
  75. package/dist/m365/spo/commands/web/web-clientsidewebpart-list.js +10 -18
  76. package/dist/m365/spo/commands/web/web-get.js +12 -30
  77. package/dist/m365/spo/commands/web/web-installedlanguage-list.js +10 -18
  78. package/dist/m365/spo/commands/web/web-list.js +10 -18
  79. package/dist/m365/spo/commands/web/web-reindex.js +10 -18
  80. package/dist/m365/spo/commands/web/web-remove.js +11 -27
  81. package/dist/m365/spo/commands/web/web-retentionlabel-list.js +10 -18
  82. package/dist/m365/spo/commands/web/web-roleassignment-add.js +40 -64
  83. package/dist/m365/spo/commands/web/web-roleassignment-remove.js +31 -58
  84. package/dist/m365/spo/commands/web/web-roleinheritance-break.js +12 -36
  85. package/dist/m365/spo/commands/web/web-roleinheritance-reset.js +11 -29
  86. package/dist/m365/spo/commands/web/web-rule-get.js +47 -0
  87. package/dist/m365/spo/commands/web/web-rule-list.js +6 -4
  88. package/dist/m365/spo/commands/web/web-rule-remove.js +0 -3
  89. package/dist/m365/spo/commands/web/web-set.js +26 -96
  90. package/dist/m365/spo/commands.js +3 -3
  91. package/dist/m365/teams/commands/channel/channel-add.js +46 -57
  92. package/dist/m365/teams/commands/channel/channel-get.js +41 -48
  93. package/dist/m365/teams/commands/channel/channel-list.js +28 -42
  94. package/dist/m365/teams/commands/channel/channel-member-add.js +53 -54
  95. package/dist/m365/teams/commands/channel/channel-member-list.js +47 -55
  96. package/dist/m365/teams/commands/channel/channel-member-remove.js +62 -62
  97. package/dist/m365/teams/commands/channel/channel-member-set.js +61 -65
  98. package/dist/m365/teams/commands/channel/channel-remove.js +47 -49
  99. package/dist/m365/teams/commands/channel/channel-set.js +47 -54
  100. package/dist/m365/teams/commands/chat/chat-get.js +30 -45
  101. package/dist/m365/teams/commands/chat/chat-list.js +22 -42
  102. package/dist/m365/teams/commands/chat/chat-member-add.js +43 -64
  103. package/dist/m365/teams/commands/chat/chat-member-list.js +10 -23
  104. package/dist/m365/teams/commands/chat/chat-member-remove.js +28 -50
  105. package/dist/m365/teams/commands/chat/chat-message-send.js +32 -55
  106. package/dist/m365/util/commands/accesstoken/accesstoken-get.js +10 -28
  107. package/dist/telemetry.js +7 -11
  108. package/dist/utils/spo.js +1 -3
  109. package/dist/utils/urlUtil.js +2 -2
  110. package/docs/docs/cmd/entra/m365group/m365group-remove.mdx +4 -4
  111. package/docs/docs/cmd/spe/container/container-remove.mdx +5 -5
  112. package/docs/docs/cmd/spo/file/file-archive.mdx +9 -1
  113. package/docs/docs/cmd/spo/file/file-checkin.mdx +2 -2
  114. package/docs/docs/cmd/spo/file/file-checkout-undo.mdx +1 -1
  115. package/docs/docs/cmd/spo/file/file-checkout.mdx +2 -2
  116. package/docs/docs/cmd/spo/file/file-copy.mdx +2 -2
  117. package/docs/docs/cmd/spo/file/file-get.mdx +6 -6
  118. package/docs/docs/cmd/spo/file/file-remove.mdx +4 -4
  119. package/docs/docs/cmd/spo/file/file-retentionlabel-ensure.mdx +1 -1
  120. package/docs/docs/cmd/spo/file/file-retentionlabel-remove.mdx +1 -1
  121. package/docs/docs/cmd/spo/file/file-roleassignment-add.mdx +1 -1
  122. package/docs/docs/cmd/spo/file/file-roleassignment-remove.mdx +1 -1
  123. package/docs/docs/cmd/spo/file/file-roleinheritance-break.mdx +3 -3
  124. package/docs/docs/cmd/spo/file/file-roleinheritance-reset.mdx +2 -2
  125. package/docs/docs/cmd/spo/file/file-sharinginfo-get.mdx +2 -2
  126. package/docs/docs/cmd/spo/file/file-sharinglink-add.mdx +22 -1
  127. package/docs/docs/cmd/spo/file/file-sharinglink-clear.mdx +24 -1
  128. package/docs/docs/cmd/spo/file/file-sharinglink-get.mdx +22 -1
  129. package/docs/docs/cmd/spo/file/file-sharinglink-list.mdx +22 -1
  130. package/docs/docs/cmd/spo/file/file-sharinglink-remove.mdx +24 -1
  131. package/docs/docs/cmd/spo/file/file-sharinglink-set.mdx +22 -1
  132. package/docs/docs/cmd/spo/file/file-unarchive.mdx +9 -1
  133. package/docs/docs/cmd/spo/file/file-version-clear.mdx +1 -1
  134. package/docs/docs/cmd/spo/file/file-version-get.mdx +1 -1
  135. package/docs/docs/cmd/spo/file/file-version-keep.mdx +1 -1
  136. package/docs/docs/cmd/spo/file/file-version-list.mdx +1 -1
  137. package/docs/docs/cmd/spo/file/file-version-remove.mdx +1 -1
  138. package/docs/docs/cmd/spo/file/file-version-restore.mdx +1 -1
  139. package/docs/docs/cmd/spo/folder/folder-archive.mdx +7 -1
  140. package/docs/docs/cmd/spo/folder/folder-copy.mdx +1 -1
  141. package/docs/docs/cmd/spo/folder/folder-get.mdx +2 -2
  142. package/docs/docs/cmd/spo/folder/folder-remove.mdx +4 -4
  143. package/docs/docs/cmd/spo/folder/folder-retentionlabel-ensure.mdx +1 -1
  144. package/docs/docs/cmd/spo/folder/folder-retentionlabel-remove.mdx +1 -1
  145. package/docs/docs/cmd/spo/folder/folder-sharinglink-add.mdx +22 -1
  146. package/docs/docs/cmd/spo/folder/folder-sharinglink-clear.mdx +23 -0
  147. package/docs/docs/cmd/spo/folder/folder-sharinglink-get.mdx +21 -0
  148. package/docs/docs/cmd/spo/folder/folder-sharinglink-list.mdx +22 -1
  149. package/docs/docs/cmd/spo/folder/folder-sharinglink-remove.mdx +24 -1
  150. package/docs/docs/cmd/spo/folder/folder-sharinglink-set.mdx +21 -0
  151. package/docs/docs/cmd/spo/folder/folder-unarchive.mdx +76 -0
  152. package/docs/docs/cmd/spo/list/list-remove.mdx +4 -4
  153. package/docs/docs/cmd/spo/listitem/listitem-batch-remove.mdx +8 -2
  154. package/docs/docs/cmd/spo/listitem/listitem-get.mdx +0 -6
  155. package/docs/docs/cmd/spo/listitem/listitem-remove.mdx +8 -2
  156. package/docs/docs/cmd/spo/navigation/navigation-node-list.mdx +37 -27
  157. package/docs/docs/cmd/spo/page/page-remove.mdx +4 -4
  158. package/docs/docs/cmd/spo/site/site-apppermission-add.mdx +52 -21
  159. package/docs/docs/cmd/spo/site/site-remove.mdx +3 -3
  160. package/docs/docs/cmd/spo/web/web-rule-get.mdx +108 -0
  161. package/docs/docs/cmd/spo/web/web-rule-list.mdx +8 -12
  162. package/docs/docs/cmd/spo/web/web-rule-remove.mdx +0 -6
  163. package/docs/docs/cmd/spp/model/model-get.mdx +1 -1
  164. package/docs/docs/cmd/spp/model/model-remove.mdx +1 -1
  165. package/docs/docs/cmd/teams/app/app-install.mdx +21 -0
  166. package/docs/docs/cmd/teams/app/app-list.mdx +19 -0
  167. package/docs/docs/cmd/teams/app/app-publish.mdx +17 -0
  168. package/docs/docs/cmd/teams/app/app-remove.mdx +19 -0
  169. package/docs/docs/cmd/teams/app/app-uninstall.mdx +21 -0
  170. package/docs/docs/cmd/teams/app/app-update.mdx +19 -0
  171. package/docs/docs/cmd/tenant/people/people-profilecardproperty-add.mdx +19 -0
  172. package/docs/docs/cmd/tenant/people/people-profilecardproperty-get.mdx +19 -0
  173. package/docs/docs/cmd/tenant/people/people-profilecardproperty-list.mdx +19 -0
  174. package/docs/docs/cmd/tenant/people/people-profilecardproperty-remove.mdx +19 -0
  175. package/docs/docs/cmd/tenant/people/people-profilecardproperty-set.mdx +19 -0
  176. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-health-get.mdx +19 -0
  177. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-health-list.mdx +19 -0
  178. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-healthissue-get.mdx +19 -0
  179. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-healthissue-list.mdx +19 -0
  180. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-message-get.mdx +19 -0
  181. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-message-list.mdx +19 -0
  182. package/docs/docs/cmd/viva/engage/engage-message-add.mdx +17 -0
  183. package/docs/docs/cmd/viva/engage/engage-message-get.mdx +17 -0
  184. package/docs/docs/cmd/viva/engage/engage-message-list.mdx +17 -0
  185. package/docs/docs/cmd/viva/engage/engage-message-remove.mdx +19 -0
  186. package/npm-shrinkwrap.json +1120 -3216
  187. package/package.json +24 -38
  188. package/dist/appInsights.js +0 -43
@@ -1,16 +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 _SpoHubSiteSetCommand_instances, _SpoHubSiteSetCommand_initTelemetry, _SpoHubSiteSetCommand_initOptions, _SpoHubSiteSetCommand_initValidators, _SpoHubSiteSetCommand_initTypes;
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';
11
7
  import { validation } from '../../../../utils/validation.js';
12
8
  import SpoCommand from '../../../base/SpoCommand.js';
13
9
  import commands from '../../commands.js';
10
+ export const options = z.strictObject({
11
+ ...globalOptionsZod.shape,
12
+ id: z.string().refine(id => validation.isValidGuid(id), {
13
+ error: e => `${e.input} is not a valid GUID`
14
+ }).alias('i'),
15
+ title: z.string().optional().alias('t'),
16
+ description: z.string().optional().alias('d'),
17
+ logoUrl: z.string().optional().alias('l')
18
+ });
14
19
  class SpoHubSiteSetCommand extends SpoCommand {
15
20
  get name() {
16
21
  return commands.HUBSITE_SET;
@@ -18,13 +23,14 @@ class SpoHubSiteSetCommand extends SpoCommand {
18
23
  get description() {
19
24
  return 'Updates properties of the specified hub site';
20
25
  }
21
- constructor() {
22
- super();
23
- _SpoHubSiteSetCommand_instances.add(this);
24
- __classPrivateFieldGet(this, _SpoHubSiteSetCommand_instances, "m", _SpoHubSiteSetCommand_initTelemetry).call(this);
25
- __classPrivateFieldGet(this, _SpoHubSiteSetCommand_instances, "m", _SpoHubSiteSetCommand_initOptions).call(this);
26
- __classPrivateFieldGet(this, _SpoHubSiteSetCommand_instances, "m", _SpoHubSiteSetCommand_initValidators).call(this);
27
- __classPrivateFieldGet(this, _SpoHubSiteSetCommand_instances, "m", _SpoHubSiteSetCommand_initTypes).call(this);
26
+ get schema() {
27
+ return options;
28
+ }
29
+ getRefinedSchema(schema) {
30
+ return schema
31
+ .refine(opts => opts.title !== undefined || opts.description !== undefined || opts.logoUrl !== undefined, {
32
+ error: 'Specify title, description or logoUrl to update'
33
+ });
28
34
  }
29
35
  async commandAction(logger, args) {
30
36
  try {
@@ -62,38 +68,5 @@ class SpoHubSiteSetCommand extends SpoCommand {
62
68
  }
63
69
  }
64
70
  }
65
- _SpoHubSiteSetCommand_instances = new WeakSet(), _SpoHubSiteSetCommand_initTelemetry = function _SpoHubSiteSetCommand_initTelemetry() {
66
- this.telemetry.push((args) => {
67
- Object.assign(this.telemetryProperties, {
68
- title: typeof args.options.title === 'string',
69
- description: typeof args.options.description === 'string',
70
- logoUrl: typeof args.options.logoUrl === 'string'
71
- });
72
- });
73
- }, _SpoHubSiteSetCommand_initOptions = function _SpoHubSiteSetCommand_initOptions() {
74
- this.options.unshift({
75
- option: '-i, --id <id>'
76
- }, {
77
- option: '-t, --title [title]'
78
- }, {
79
- option: '-d, --description [description]'
80
- }, {
81
- option: '-l, --logoUrl [logoUrl]'
82
- });
83
- }, _SpoHubSiteSetCommand_initValidators = function _SpoHubSiteSetCommand_initValidators() {
84
- this.validators.push(async (args) => {
85
- if (!validation.isValidGuid(args.options.id)) {
86
- return `${args.options.id} is not a valid GUID`;
87
- }
88
- if (!args.options.title &&
89
- !args.options.description &&
90
- !args.options.logoUrl) {
91
- return 'Specify title, description or logoUrl to update';
92
- }
93
- return true;
94
- });
95
- }, _SpoHubSiteSetCommand_initTypes = function _SpoHubSiteSetCommand_initTypes() {
96
- this.types.string.push('t', 'title', 'd', 'description', 'l', 'logoUrl');
97
- };
98
71
  export default new SpoHubSiteSetCommand();
99
72
  //# sourceMappingURL=hubsite-set.js.map
@@ -1,15 +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 _SpoHubSiteUnregisterCommand_instances, _SpoHubSiteUnregisterCommand_initTelemetry, _SpoHubSiteUnregisterCommand_initOptions, _SpoHubSiteUnregisterCommand_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
6
  import { validation } from '../../../../utils/validation.js';
11
7
  import SpoCommand from '../../../base/SpoCommand.js';
12
8
  import commands from '../../commands.js';
9
+ export const options = z.strictObject({
10
+ ...globalOptionsZod.shape,
11
+ url: z.string().refine(url => validation.isValidSharePointUrl(url) === true, {
12
+ error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
13
+ }).alias('u'),
14
+ force: z.boolean().optional().alias('f')
15
+ });
13
16
  class SpoHubSiteUnregisterCommand extends SpoCommand {
14
17
  get name() {
15
18
  return commands.HUBSITE_UNREGISTER;
@@ -17,12 +20,8 @@ class SpoHubSiteUnregisterCommand extends SpoCommand {
17
20
  get description() {
18
21
  return 'Unregisters the specified site collection as a hub site';
19
22
  }
20
- constructor() {
21
- super();
22
- _SpoHubSiteUnregisterCommand_instances.add(this);
23
- __classPrivateFieldGet(this, _SpoHubSiteUnregisterCommand_instances, "m", _SpoHubSiteUnregisterCommand_initTelemetry).call(this);
24
- __classPrivateFieldGet(this, _SpoHubSiteUnregisterCommand_instances, "m", _SpoHubSiteUnregisterCommand_initOptions).call(this);
25
- __classPrivateFieldGet(this, _SpoHubSiteUnregisterCommand_instances, "m", _SpoHubSiteUnregisterCommand_initValidators).call(this);
23
+ get schema() {
24
+ return options;
26
25
  }
27
26
  async commandAction(logger, args) {
28
27
  const unregisterHubSite = async () => {
@@ -56,20 +55,5 @@ class SpoHubSiteUnregisterCommand extends SpoCommand {
56
55
  }
57
56
  }
58
57
  }
59
- _SpoHubSiteUnregisterCommand_instances = new WeakSet(), _SpoHubSiteUnregisterCommand_initTelemetry = function _SpoHubSiteUnregisterCommand_initTelemetry() {
60
- this.telemetry.push((args) => {
61
- Object.assign(this.telemetryProperties, {
62
- force: args.options.force || false
63
- });
64
- });
65
- }, _SpoHubSiteUnregisterCommand_initOptions = function _SpoHubSiteUnregisterCommand_initOptions() {
66
- this.options.unshift({
67
- option: '-u, --url <url>'
68
- }, {
69
- option: '-f, --force'
70
- });
71
- }, _SpoHubSiteUnregisterCommand_initValidators = function _SpoHubSiteUnregisterCommand_initValidators() {
72
- this.validators.push(async (args) => validation.isValidSharePointUrl(args.options.url));
73
- };
74
58
  export default new SpoHubSiteUnregisterCommand();
75
59
  //# sourceMappingURL=hubsite-unregister.js.map
@@ -38,7 +38,7 @@ class SpoListRemoveCommand extends SpoCommand {
38
38
  else {
39
39
  requestUrl = `${args.options.webUrl}/_api/web/lists/GetByTitle('${formatting.encodeQueryParameter(args.options.title)}')`;
40
40
  }
41
- if (args.options.recycle) {
41
+ if (!args.options.permanent) {
42
42
  requestUrl += `/recycle`;
43
43
  }
44
44
  const requestOptions = {
@@ -75,7 +75,7 @@ _SpoListRemoveCommand_instances = new WeakSet(), _SpoListRemoveCommand_initTelem
75
75
  id: typeof args.options.id !== 'undefined',
76
76
  title: typeof args.options.title !== 'undefined',
77
77
  force: !!args.options.force,
78
- recycle: !!args.options.recycle
78
+ permanent: !!args.options.permanent
79
79
  });
80
80
  });
81
81
  }, _SpoListRemoveCommand_initOptions = function _SpoListRemoveCommand_initOptions() {
@@ -86,7 +86,7 @@ _SpoListRemoveCommand_instances = new WeakSet(), _SpoListRemoveCommand_initTelem
86
86
  }, {
87
87
  option: '-t, --title [title]'
88
88
  }, {
89
- option: '--recycle'
89
+ option: '--permanent'
90
90
  }, {
91
91
  option: '-f, --force'
92
92
  });
@@ -106,7 +106,7 @@ _SpoListRemoveCommand_instances = new WeakSet(), _SpoListRemoveCommand_initTelem
106
106
  this.optionSets.push({ options: ['id', 'title'] });
107
107
  }, _SpoListRemoveCommand_initTypes = function _SpoListRemoveCommand_initTypes() {
108
108
  this.types.string.push('id', 'title', 'webUrl');
109
- this.types.boolean.push('force', 'recycle');
109
+ this.types.boolean.push('force', 'permanent');
110
110
  };
111
111
  export default new SpoListRemoveCommand();
112
112
  //# sourceMappingURL=list-remove.js.map
@@ -56,7 +56,7 @@ class SpoListItemBatchRemoveCommand extends SpoCommand {
56
56
  await removeListItems();
57
57
  }
58
58
  else {
59
- const result = await cli.promptForConfirmation({ message: `Are you sure you want to ${args.options.recycle ? "recycle" : "remove"} the list items from list ${args.options.listId || args.options.listTitle || args.options.listUrl} located in site ${args.options.webUrl}?` });
59
+ const result = await cli.promptForConfirmation({ message: `Are you sure you want to ${args.options.permanent ? 'permanently remove' : 'recycle'} the list items from list ${args.options.listId || args.options.listTitle || args.options.listUrl} located in site ${args.options.webUrl}?` });
60
60
  if (result) {
61
61
  await removeListItems();
62
62
  }
@@ -142,7 +142,7 @@ class SpoListItemBatchRemoveCommand extends SpoCommand {
142
142
  requestUrl += `GetList('${formatting.encodeQueryParameter(listServerRelativeUrl)}')`;
143
143
  }
144
144
  requestUrl += `/items(${item})`;
145
- if (options.recycle) {
145
+ if (!options.permanent) {
146
146
  requestUrl += '/recycle()';
147
147
  }
148
148
  return requestUrl;
@@ -156,7 +156,7 @@ _SpoListItemBatchRemoveCommand_instances = new WeakSet(), _SpoListItemBatchRemov
156
156
  listId: typeof args.options.listId !== 'undefined',
157
157
  listTitle: typeof args.options.listTitle !== 'undefined',
158
158
  listUrl: typeof args.options.listUrl !== 'undefined',
159
- recycle: !!args.options.recycle,
159
+ permanent: !!args.options.permanent,
160
160
  force: !!args.options.force
161
161
  });
162
162
  });
@@ -174,7 +174,7 @@ _SpoListItemBatchRemoveCommand_instances = new WeakSet(), _SpoListItemBatchRemov
174
174
  }, {
175
175
  option: '-i, --ids [ids]'
176
176
  }, {
177
- option: '-r, --recycle'
177
+ option: '--permanent'
178
178
  }, {
179
179
  option: '-f, --force'
180
180
  });
@@ -213,6 +213,7 @@ _SpoListItemBatchRemoveCommand_instances = new WeakSet(), _SpoListItemBatchRemov
213
213
  });
214
214
  }, _SpoListItemBatchRemoveCommand_initTypes = function _SpoListItemBatchRemoveCommand_initTypes() {
215
215
  this.types.string.push('webUrl', 'listId', 'listTitle', 'listUrl', 'ids', 'filePath');
216
+ this.types.boolean.push('permanent', 'force');
216
217
  }, _SpoListItemBatchRemoveCommand_initOptionSets = function _SpoListItemBatchRemoveCommand_initOptionSets() {
217
218
  this.optionSets.push({
218
219
  options: ['listId', 'listTitle', 'listUrl']
@@ -11,9 +11,6 @@ import { validation } from '../../../../utils/validation.js';
11
11
  import SpoCommand from '../../../base/SpoCommand.js';
12
12
  import commands from '../../commands.js';
13
13
  class SpoListItemGetCommand extends SpoCommand {
14
- allowUnknownOptions() {
15
- return true;
16
- }
17
14
  get name() {
18
15
  return commands.LISTITEM_GET;
19
16
  }
@@ -30,12 +27,6 @@ class SpoListItemGetCommand extends SpoCommand {
30
27
  __classPrivateFieldGet(this, _SpoListItemGetCommand_instances, "m", _SpoListItemGetCommand_initOptionSets).call(this);
31
28
  }
32
29
  async commandAction(logger, args) {
33
- if (args.options.properties) {
34
- await this.warn(logger, `Option 'properties' is deprecated. Please use 'fields' instead.`);
35
- if (!args.options.fields) {
36
- args.options.fields = args.options.properties;
37
- }
38
- }
39
30
  let requestUrl = `${args.options.webUrl}/_api/web`;
40
31
  if (args.options.listId) {
41
32
  requestUrl += `/lists(guid'${formatting.encodeQueryParameter(args.options.listId)}')`;
@@ -109,8 +100,6 @@ _SpoListItemGetCommand_instances = new WeakSet(), _SpoListItemGetCommand_initTel
109
100
  option: '--listUrl [listUrl]'
110
101
  }, {
111
102
  option: '--fields [fields]'
112
- }, {
113
- option: '-p, --properties [properties]'
114
103
  }, {
115
104
  option: '--withPermissions'
116
105
  });
@@ -135,7 +124,7 @@ _SpoListItemGetCommand_instances = new WeakSet(), _SpoListItemGetCommand_initTel
135
124
  return true;
136
125
  });
137
126
  }, _SpoListItemGetCommand_initTypes = function _SpoListItemGetCommand_initTypes() {
138
- this.types.string.push('webUrl', 'listId', 'listTitle', 'id', 'uniqueId', 'fields', 'properties');
127
+ this.types.string.push('webUrl', 'listId', 'listTitle', 'id', 'uniqueId', 'fields');
139
128
  }, _SpoListItemGetCommand_initOptionSets = function _SpoListItemGetCommand_initOptionSets() {
140
129
  this.optionSets.push({ options: ['listId', 'listTitle', 'listUrl'] }, { options: ['id', 'uniqueId'] });
141
130
  };
@@ -3,7 +3,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
3
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
4
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
5
  };
6
- var _SpoListItemRemoveCommand_instances, _SpoListItemRemoveCommand_initTelemetry, _SpoListItemRemoveCommand_initOptions, _SpoListItemRemoveCommand_initValidators, _SpoListItemRemoveCommand_initOptionSets;
6
+ var _SpoListItemRemoveCommand_instances, _SpoListItemRemoveCommand_initTelemetry, _SpoListItemRemoveCommand_initOptions, _SpoListItemRemoveCommand_initValidators, _SpoListItemRemoveCommand_initOptionSets, _SpoListItemRemoveCommand_initTypes;
7
7
  import { cli } from '../../../../cli/cli.js';
8
8
  import request from '../../../../request.js';
9
9
  import { formatting } from '../../../../utils/formatting.js';
@@ -25,6 +25,7 @@ class SpoListItemRemoveCommand extends SpoCommand {
25
25
  __classPrivateFieldGet(this, _SpoListItemRemoveCommand_instances, "m", _SpoListItemRemoveCommand_initOptions).call(this);
26
26
  __classPrivateFieldGet(this, _SpoListItemRemoveCommand_instances, "m", _SpoListItemRemoveCommand_initValidators).call(this);
27
27
  __classPrivateFieldGet(this, _SpoListItemRemoveCommand_instances, "m", _SpoListItemRemoveCommand_initOptionSets).call(this);
28
+ __classPrivateFieldGet(this, _SpoListItemRemoveCommand_instances, "m", _SpoListItemRemoveCommand_initTypes).call(this);
28
29
  }
29
30
  async commandAction(logger, args) {
30
31
  const removeListItem = async () => {
@@ -43,7 +44,7 @@ class SpoListItemRemoveCommand extends SpoCommand {
43
44
  requestUrl += `/GetList('${formatting.encodeQueryParameter(listServerRelativeUrl)}')`;
44
45
  }
45
46
  requestUrl += `/items(${args.options.id})`;
46
- if (args.options.recycle) {
47
+ if (!args.options.permanent) {
47
48
  requestUrl += `/recycle()`;
48
49
  }
49
50
  const requestOptions = {
@@ -68,7 +69,7 @@ class SpoListItemRemoveCommand extends SpoCommand {
68
69
  await removeListItem();
69
70
  }
70
71
  else {
71
- const result = await cli.promptForConfirmation({ message: `Are you sure you want to ${args.options.recycle ? "recycle" : "remove"} the list item ${args.options.id} from list ${args.options.listId || args.options.listTitle || args.options.listUrl} located in site ${args.options.webUrl}?` });
72
+ const result = await cli.promptForConfirmation({ message: `Are you sure you want to ${args.options.permanent ? 'permanently remove' : 'recycle'} the list item ${args.options.id} from list ${args.options.listId || args.options.listTitle || args.options.listUrl} located in site ${args.options.webUrl}?` });
72
73
  if (result) {
73
74
  await removeListItem();
74
75
  }
@@ -81,7 +82,7 @@ _SpoListItemRemoveCommand_instances = new WeakSet(), _SpoListItemRemoveCommand_i
81
82
  listId: typeof args.options.listId !== 'undefined',
82
83
  listTitle: typeof args.options.listTitle !== 'undefined',
83
84
  listUrl: typeof args.options.listUrl !== 'undefined',
84
- recycle: !!args.options.recycle,
85
+ permanent: !!args.options.permanent,
85
86
  force: !!args.options.force
86
87
  });
87
88
  });
@@ -97,7 +98,7 @@ _SpoListItemRemoveCommand_instances = new WeakSet(), _SpoListItemRemoveCommand_i
97
98
  }, {
98
99
  option: '--listUrl [listUrl]'
99
100
  }, {
100
- option: '--recycle'
101
+ option: '--permanent'
101
102
  }, {
102
103
  option: '-f, --force'
103
104
  });
@@ -119,6 +120,8 @@ _SpoListItemRemoveCommand_instances = new WeakSet(), _SpoListItemRemoveCommand_i
119
120
  });
120
121
  }, _SpoListItemRemoveCommand_initOptionSets = function _SpoListItemRemoveCommand_initOptionSets() {
121
122
  this.optionSets.push({ options: ['listId', 'listTitle', 'listUrl'] });
123
+ }, _SpoListItemRemoveCommand_initTypes = function _SpoListItemRemoveCommand_initTypes() {
124
+ this.types.boolean.push('permanent', 'force');
122
125
  };
123
126
  export default new SpoListItemRemoveCommand();
124
127
  //# sourceMappingURL=listitem-remove.js.map
@@ -1,6 +1,6 @@
1
1
  import { globalOptionsZod } from '../../../../Command.js';
2
2
  import { z } from 'zod';
3
- import { odata } from '../../../../utils/odata.js';
3
+ import { spo } from '../../../../utils/spo.js';
4
4
  import { validation } from '../../../../utils/validation.js';
5
5
  import SpoCommand from '../../../base/SpoCommand.js';
6
6
  import commands from '../../commands.js';
@@ -21,7 +21,7 @@ class SpoNavigationNodeListCommand extends SpoCommand {
21
21
  return 'Lists nodes from the specified site navigation';
22
22
  }
23
23
  defaultProperties() {
24
- return ['Id', 'Title', 'Url'];
24
+ return ['Key', 'Title', 'SimpleUrl'];
25
25
  }
26
26
  get schema() {
27
27
  return options;
@@ -31,8 +31,10 @@ class SpoNavigationNodeListCommand extends SpoCommand {
31
31
  await logger.logToStderr(`Retrieving navigation nodes...`);
32
32
  }
33
33
  try {
34
- const res = await odata.getAllItems(`${args.options.webUrl}/_api/web/navigation/${args.options.location.toLowerCase()}?$expand=Children,Children/Children,Children/Children/Children`);
35
- await logger.log(res);
34
+ const menuState = args.options.location === 'TopNavigationBar'
35
+ ? await spo.getTopNavigationMenuState(args.options.webUrl)
36
+ : await spo.getQuickLaunchMenuState(args.options.webUrl);
37
+ await logger.log(menuState.Nodes);
36
38
  }
37
39
  catch (err) {
38
40
  this.handleRejectedODataJsonPromise(err);
@@ -58,12 +58,12 @@ class SpoPageRemoveCommand extends SpoCommand {
58
58
  if (args.options.bypassSharedLock) {
59
59
  requestOptions.headers.Prefer = 'bypass-shared-lock';
60
60
  }
61
- if (args.options.recycle) {
62
- requestOptions.url += '/Recycle';
63
- await request.post(requestOptions);
61
+ if (args.options.permanent) {
62
+ await request.delete(requestOptions);
64
63
  }
65
64
  else {
66
- await request.delete(requestOptions);
65
+ requestOptions.url += '/Recycle';
66
+ await request.post(requestOptions);
67
67
  }
68
68
  }
69
69
  catch (err) {
@@ -75,7 +75,7 @@ _SpoPageRemoveCommand_instances = new WeakSet(), _SpoPageRemoveCommand_initTelem
75
75
  this.telemetry.push((args) => {
76
76
  Object.assign(this.telemetryProperties, {
77
77
  force: !!args.options.force,
78
- recycle: !!args.options.recycle,
78
+ permanent: !!args.options.permanent,
79
79
  bypassSharedLock: !!args.options.bypassSharedLock
80
80
  });
81
81
  });
@@ -85,7 +85,7 @@ _SpoPageRemoveCommand_instances = new WeakSet(), _SpoPageRemoveCommand_initTelem
85
85
  }, {
86
86
  option: '-n, --name <name>'
87
87
  }, {
88
- option: '--recycle'
88
+ option: '--permanent'
89
89
  }, {
90
90
  option: '--bypassSharedLock'
91
91
  }, {
@@ -95,7 +95,7 @@ _SpoPageRemoveCommand_instances = new WeakSet(), _SpoPageRemoveCommand_initTelem
95
95
  this.validators.push(async (args) => validation.isValidSharePointUrl(args.options.webUrl));
96
96
  }, _SpoPageRemoveCommand_initTypes = function _SpoPageRemoveCommand_initTypes() {
97
97
  this.types.string.push('name', 'webUrl');
98
- this.types.boolean.push('force', 'bypassSharedLock', 'recycle');
98
+ this.types.boolean.push('force', 'bypassSharedLock', 'permanent');
99
99
  };
100
100
  export default new SpoPageRemoveCommand();
101
101
  //# sourceMappingURL=page-remove.js.map
@@ -71,7 +71,7 @@ class SpoSiteRemoveCommand extends SpoCommand {
71
71
  }
72
72
  if (isGroupSite) {
73
73
  await this.deleteGroupifiedSite(logger, siteUrl);
74
- if (options.skipRecycleBin) {
74
+ if (options.permanent) {
75
75
  let isGroupInRecycleBin = await this.isGroupInEntraRecycleBin(logger, siteDetails.GroupId);
76
76
  let amountOfPolls = 0;
77
77
  while (!isGroupInRecycleBin && amountOfPolls < 20) {
@@ -87,7 +87,7 @@ class SpoSiteRemoveCommand extends SpoCommand {
87
87
  else {
88
88
  await this.deleteNonGroupSite(logger, siteUrl);
89
89
  }
90
- if (options.skipRecycleBin) {
90
+ if (options.permanent) {
91
91
  await this.deleteSiteFromSharePointRecycleBin(logger, siteUrl);
92
92
  }
93
93
  }
@@ -191,7 +191,7 @@ class SpoSiteRemoveCommand extends SpoCommand {
191
191
  _SpoSiteRemoveCommand_instances = new WeakSet(), _SpoSiteRemoveCommand_initTelemetry = function _SpoSiteRemoveCommand_initTelemetry() {
192
192
  this.telemetry.push((args) => {
193
193
  Object.assign(this.telemetryProperties, {
194
- skipRecycleBin: !!args.options.skipRecycleBin,
194
+ permanent: !!args.options.permanent,
195
195
  fromRecycleBin: !!args.options.fromRecycleBin,
196
196
  force: !!args.options.force
197
197
  });
@@ -200,7 +200,7 @@ _SpoSiteRemoveCommand_instances = new WeakSet(), _SpoSiteRemoveCommand_initTelem
200
200
  this.options.unshift({
201
201
  option: '-u, --url <url>'
202
202
  }, {
203
- option: '--skipRecycleBin'
203
+ option: '--permanent'
204
204
  }, {
205
205
  option: '--fromRecycleBin'
206
206
  }, {
@@ -217,14 +217,14 @@ _SpoSiteRemoveCommand_instances = new WeakSet(), _SpoSiteRemoveCommand_initTelem
217
217
  if (rootUrl.toLowerCase() === urlUtil.removeTrailingSlashes(args.options.url.toLowerCase())) {
218
218
  return `The root site cannot be deleted.`;
219
219
  }
220
- if (args.options.fromRecycleBin && args.options.skipRecycleBin) {
221
- return 'Specify either fromRecycleBin or skipRecycleBin, but not both.';
220
+ if (args.options.fromRecycleBin && args.options.permanent) {
221
+ return 'Specify either fromRecycleBin or permanent, but not both.';
222
222
  }
223
223
  return true;
224
224
  });
225
225
  }, _SpoSiteRemoveCommand_initTypes = function _SpoSiteRemoveCommand_initTypes() {
226
226
  this.types.string.push('url');
227
- this.types.boolean.push('skipRecycleBin', 'fromRecycleBin', 'force');
227
+ this.types.boolean.push('permanent', 'fromRecycleBin', 'force');
228
228
  };
229
229
  export default new SpoSiteRemoveCommand();
230
230
  //# sourceMappingURL=site-remove.js.map
@@ -1,6 +1,8 @@
1
1
  import auth from '../../../Auth.js';
2
+ import { globalOptionsZod } from '../../../Command.js';
2
3
  import SpoCommand from '../../base/SpoCommand.js';
3
4
  import commands from '../commands.js';
5
+ export const options = globalOptionsZod.strict();
4
6
  class SpoGetCommand extends SpoCommand {
5
7
  get name() {
6
8
  return commands.GET;
@@ -8,6 +10,9 @@ class SpoGetCommand extends SpoCommand {
8
10
  get description() {
9
11
  return 'Gets the context URL for the root SharePoint site collection and SharePoint tenant admin site';
10
12
  }
13
+ get schema() {
14
+ return options;
15
+ }
11
16
  async commandAction(logger) {
12
17
  const spoContext = {
13
18
  SpoUrl: auth.connection.spoUrl ? auth.connection.spoUrl : ''
@@ -1,14 +1,16 @@
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 _SpoSetCommand_instances, _SpoSetCommand_initOptions, _SpoSetCommand_initValidators, _SpoSetCommand_initTypes;
7
1
  import auth from '../../../Auth.js';
2
+ import { globalOptionsZod } from '../../../Command.js';
8
3
  import { urlUtil } from '../../../utils/urlUtil.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
+ import { z } from 'zod';
8
+ export const options = z.strictObject({
9
+ ...globalOptionsZod.shape,
10
+ url: z.string().alias('u').refine(url => validation.isValidSharePointUrl(url) === true, {
11
+ message: 'Specify a valid SharePoint URL'
12
+ })
13
+ });
12
14
  class SpoSetCommand extends SpoCommand {
13
15
  get name() {
14
16
  return commands.SET;
@@ -16,12 +18,8 @@ class SpoSetCommand extends SpoCommand {
16
18
  get description() {
17
19
  return 'Sets the URL of the root SharePoint site collection for use in SPO commands';
18
20
  }
19
- constructor() {
20
- super();
21
- _SpoSetCommand_instances.add(this);
22
- __classPrivateFieldGet(this, _SpoSetCommand_instances, "m", _SpoSetCommand_initOptions).call(this);
23
- __classPrivateFieldGet(this, _SpoSetCommand_instances, "m", _SpoSetCommand_initValidators).call(this);
24
- __classPrivateFieldGet(this, _SpoSetCommand_instances, "m", _SpoSetCommand_initTypes).call(this);
21
+ get schema() {
22
+ return options;
25
23
  }
26
24
  async commandAction(logger, args) {
27
25
  auth.connection.spoUrl = urlUtil.removeTrailingSlashes(args.options.url);
@@ -33,14 +31,5 @@ class SpoSetCommand extends SpoCommand {
33
31
  }
34
32
  }
35
33
  }
36
- _SpoSetCommand_instances = new WeakSet(), _SpoSetCommand_initOptions = function _SpoSetCommand_initOptions() {
37
- this.options.unshift({
38
- option: '-u, --url <url>'
39
- });
40
- }, _SpoSetCommand_initValidators = function _SpoSetCommand_initValidators() {
41
- this.validators.push(async (args) => validation.isValidSharePointUrl(args.options.url));
42
- }, _SpoSetCommand_initTypes = function _SpoSetCommand_initTypes() {
43
- this.types.string.push('url');
44
- };
45
34
  export default new SpoSetCommand();
46
35
  //# sourceMappingURL=spo-set.js.map
@@ -73,7 +73,7 @@ class SpoTenantAppCatalogAddCommand extends SpoCommand {
73
73
  }
74
74
  const siteRemoveOptions = {
75
75
  url: url,
76
- skipRecycleBin: true,
76
+ permanent: true,
77
77
  wait: true,
78
78
  force: true,
79
79
  verbose: this.verbose,
@@ -1,15 +1,22 @@
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 _SpoUserEnsureCommand_instances, _SpoUserEnsureCommand_initTelemetry, _SpoUserEnsureCommand_initOptions, _SpoUserEnsureCommand_initValidators, _SpoUserEnsureCommand_initOptionSets, _SpoUserEnsureCommand_initTypes;
1
+ import { globalOptionsZod } from '../../../../Command.js';
7
2
  import request from '../../../../request.js';
8
3
  import { entraGroup } from '../../../../utils/entraGroup.js';
9
4
  import { validation } from '../../../../utils/validation.js';
10
5
  import SpoCommand from '../../../base/SpoCommand.js';
11
6
  import commands from '../../commands.js';
12
7
  import { entraUser } from '../../../../utils/entraUser.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
+ entraId: z.string().refine(id => validation.isValidGuid(id), { error: e => `${e.input} is not a valid GUID.` }).optional(),
15
+ userName: z.string().refine(userName => validation.isValidUserPrincipalName(userName), { error: e => `${e.input} is not a valid userName.` }).optional(),
16
+ loginName: z.string().optional(),
17
+ entraGroupId: z.string().refine(id => validation.isValidGuid(id), { error: e => `${e.input} is not a valid GUID for option 'entraGroupId'.` }).optional(),
18
+ entraGroupName: z.string().optional()
19
+ });
13
20
  class SpoUserEnsureCommand extends SpoCommand {
14
21
  get name() {
15
22
  return commands.USER_ENSURE;
@@ -17,14 +24,17 @@ class SpoUserEnsureCommand extends SpoCommand {
17
24
  get description() {
18
25
  return 'Ensures that a user is available on a specific site';
19
26
  }
20
- constructor() {
21
- super();
22
- _SpoUserEnsureCommand_instances.add(this);
23
- __classPrivateFieldGet(this, _SpoUserEnsureCommand_instances, "m", _SpoUserEnsureCommand_initTelemetry).call(this);
24
- __classPrivateFieldGet(this, _SpoUserEnsureCommand_instances, "m", _SpoUserEnsureCommand_initOptions).call(this);
25
- __classPrivateFieldGet(this, _SpoUserEnsureCommand_instances, "m", _SpoUserEnsureCommand_initValidators).call(this);
26
- __classPrivateFieldGet(this, _SpoUserEnsureCommand_instances, "m", _SpoUserEnsureCommand_initOptionSets).call(this);
27
- __classPrivateFieldGet(this, _SpoUserEnsureCommand_instances, "m", _SpoUserEnsureCommand_initTypes).call(this);
27
+ get schema() {
28
+ return options;
29
+ }
30
+ getRefinedSchema(schema) {
31
+ return schema.refine(opts => [opts.entraId, opts.userName, opts.loginName, opts.entraGroupId, opts.entraGroupName].filter(value => value !== undefined).length === 1, {
32
+ error: 'Specify one of the following options: entraId, userName, loginName, entraGroupId, entraGroupName.',
33
+ params: {
34
+ customCode: 'optionSet',
35
+ options: ['entraId', 'userName', 'loginName', 'entraGroupId', 'entraGroupName']
36
+ }
37
+ });
28
38
  }
29
39
  async commandAction(logger, args) {
30
40
  if (this.verbose) {
@@ -73,51 +83,5 @@ class SpoUserEnsureCommand extends SpoCommand {
73
83
  return entraGroup.getGroupByDisplayName(entraGroupName);
74
84
  }
75
85
  }
76
- _SpoUserEnsureCommand_instances = new WeakSet(), _SpoUserEnsureCommand_initTelemetry = function _SpoUserEnsureCommand_initTelemetry() {
77
- this.telemetry.push((args) => {
78
- Object.assign(this.telemetryProperties, {
79
- entraId: typeof args.options.entraId !== 'undefined',
80
- userName: typeof args.options.userName !== 'undefined',
81
- loginName: typeof args.options.loginName !== 'undefined',
82
- entraGroupId: typeof args.options.entraGroupId !== 'undefined',
83
- entraGroupName: typeof args.options.entraGroupName !== 'undefined'
84
- });
85
- });
86
- }, _SpoUserEnsureCommand_initOptions = function _SpoUserEnsureCommand_initOptions() {
87
- this.options.unshift({
88
- option: '-u, --webUrl <webUrl>'
89
- }, {
90
- option: '--entraId [entraId]'
91
- }, {
92
- option: '--userName [userName]'
93
- }, {
94
- option: '--loginName [loginName]'
95
- }, {
96
- option: '--entraGroupId [entraGroupId]'
97
- }, {
98
- option: '--entraGroupName [entraGroupName]'
99
- });
100
- }, _SpoUserEnsureCommand_initValidators = function _SpoUserEnsureCommand_initValidators() {
101
- this.validators.push(async (args) => {
102
- const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
103
- if (isValidSharePointUrl !== true) {
104
- return isValidSharePointUrl;
105
- }
106
- if (args.options.entraId && !validation.isValidGuid(args.options.entraId)) {
107
- return `${args.options.entraId} is not a valid GUID.`;
108
- }
109
- if (args.options.userName && !validation.isValidUserPrincipalName(args.options.userName)) {
110
- return `${args.options.userName} is not a valid userName.`;
111
- }
112
- if (args.options.entraGroupId && !validation.isValidGuid(args.options.entraGroupId)) {
113
- return `${args.options.entraGroupId} is not a valid GUID for option 'entraGroupId'.`;
114
- }
115
- return true;
116
- });
117
- }, _SpoUserEnsureCommand_initOptionSets = function _SpoUserEnsureCommand_initOptionSets() {
118
- this.optionSets.push({ options: ['entraId', 'userName', 'loginName', 'entraGroupId', 'entraGroupName'] });
119
- }, _SpoUserEnsureCommand_initTypes = function _SpoUserEnsureCommand_initTypes() {
120
- this.types.string.push('webUrl', 'entraId', 'userName', 'loginName', 'entraGroupId', 'entraGroupName');
121
- };
122
86
  export default new SpoUserEnsureCommand();
123
87
  //# sourceMappingURL=user-ensure.js.map