@pnp/cli-microsoft365 12.0.0-beta.1752794 → 12.0.0-beta.235caf5

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 (216) hide show
  1. package/allCommands.json +1 -1
  2. package/allCommandsFull.json +1 -1
  3. package/dist/Auth.js +19 -2
  4. package/dist/cli/cli.js +3 -0
  5. package/dist/config.js +1 -0
  6. package/dist/m365/cli/commands/cli-consent.js +9 -2
  7. package/dist/m365/entra/commands/agent/agent-blueprint-list.js +52 -0
  8. package/dist/m365/entra/commands/m365group/m365group-add.js +52 -97
  9. package/dist/m365/entra/commands/m365group/m365group-conversation-list.js +20 -33
  10. package/dist/m365/entra/commands/m365group/m365group-conversation-post-list.js +20 -39
  11. package/dist/m365/entra/commands/m365group/m365group-get.js +20 -41
  12. package/dist/m365/entra/commands/m365group/m365group-list.js +11 -31
  13. package/dist/m365/entra/commands/m365group/m365group-recyclebinitem-clear.js +8 -22
  14. package/dist/m365/entra/commands/m365group/m365group-recyclebinitem-list.js +9 -25
  15. package/dist/m365/entra/commands/m365group/m365group-recyclebinitem-remove.js +21 -43
  16. package/dist/m365/entra/commands/m365group/m365group-recyclebinitem-restore.js +21 -41
  17. package/dist/m365/entra/commands/m365group/m365group-remove.js +25 -46
  18. package/dist/m365/entra/commands/m365group/m365group-renew.js +19 -32
  19. package/dist/m365/entra/commands/m365group/m365group-set.js +86 -141
  20. package/dist/m365/entra/commands/m365group/m365group-teamify.js +20 -43
  21. package/dist/m365/entra/commands/m365group/m365group-user-add.js +44 -77
  22. package/dist/m365/entra/commands/m365group/m365group-user-list.js +28 -55
  23. package/dist/m365/entra/commands/m365group/m365group-user-remove.js +37 -74
  24. package/dist/m365/entra/commands/m365group/m365group-user-set.js +45 -77
  25. package/dist/m365/entra/commands.js +1 -0
  26. package/dist/m365/graph/commands/schemaextension/schemaextension-list.js +14 -16
  27. package/dist/m365/outlook/commands/calendargroup/calendargroup-add.js +97 -0
  28. package/dist/m365/outlook/commands/event/event-add.js +324 -0
  29. package/dist/m365/outlook/commands.js +2 -0
  30. package/dist/m365/spe/commands/container/container-permission-add.js +114 -0
  31. package/dist/m365/spe/commands/container/container-permission-remove.js +94 -0
  32. package/dist/m365/spe/commands/container/container-permission-set.js +90 -0
  33. package/dist/m365/spe/commands.js +3 -0
  34. package/dist/m365/spfx/commands/SpfxCompatibilityMatrix.js +15 -0
  35. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.24.0.js +19 -0
  36. package/dist/m365/spfx/commands/project/project-doctor.js +2 -1
  37. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN012021_TSC_excludeDirectories.js +43 -0
  38. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN027002_OVERRIDES_qs.js +33 -0
  39. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN027003_OVERRIDES_uuid.js +33 -0
  40. package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.24.0.js +77 -0
  41. package/dist/m365/spfx/commands/project/project-upgrade.js +2 -1
  42. package/dist/m365/spo/commands/commandset/commandset-add.js +17 -59
  43. package/dist/m365/spo/commands/commandset/commandset-get.js +24 -62
  44. package/dist/m365/spo/commands/commandset/commandset-list.js +11 -34
  45. package/dist/m365/spo/commands/commandset/commandset-remove.js +21 -54
  46. package/dist/m365/spo/commands/commandset/commandset-set.js +30 -83
  47. package/dist/m365/spo/commands/contenttype/contenttype-add.js +22 -51
  48. package/dist/m365/spo/commands/contenttype/contenttype-field-list.js +38 -62
  49. package/dist/m365/spo/commands/contenttype/contenttype-field-remove.js +25 -54
  50. package/dist/m365/spo/commands/contenttype/contenttype-field-set.js +20 -43
  51. package/dist/m365/spo/commands/contenttype/contenttype-get.js +29 -54
  52. package/dist/m365/spo/commands/contenttype/contenttype-list.js +13 -30
  53. package/dist/m365/spo/commands/contenttype/contenttype-remove.js +24 -39
  54. package/dist/m365/spo/commands/contenttype/contenttype-set.js +42 -63
  55. package/dist/m365/spo/commands/contenttype/contenttype-sync.js +37 -59
  56. package/dist/m365/spo/commands/contenttypehub/contenttypehub-get.js +5 -0
  57. package/dist/m365/spo/commands/customaction/customaction-add.js +124 -145
  58. package/dist/m365/spo/commands/customaction/customaction-clear.js +12 -43
  59. package/dist/m365/spo/commands/customaction/customaction-get.js +28 -59
  60. package/dist/m365/spo/commands/customaction/customaction-list.js +12 -42
  61. package/dist/m365/spo/commands/customaction/customaction-remove.js +26 -54
  62. package/dist/m365/spo/commands/customaction/customaction-set.js +75 -132
  63. package/dist/m365/spo/commands/externaluser/externaluser-list.js +5 -14
  64. package/dist/m365/spo/commands/knowledgehub/knowledgehub-get.js +5 -0
  65. package/dist/m365/spo/commands/knowledgehub/knowledgehub-remove.js +8 -22
  66. package/dist/m365/spo/commands/knowledgehub/knowledgehub-set.js +10 -18
  67. package/dist/m365/spo/commands/listitem/listitem-add.js +27 -55
  68. package/dist/m365/spo/commands/listitem/listitem-attachment-add.js +30 -58
  69. package/dist/m365/spo/commands/listitem/listitem-attachment-get.js +27 -52
  70. package/dist/m365/spo/commands/listitem/listitem-attachment-list.js +26 -50
  71. package/dist/m365/spo/commands/listitem/listitem-attachment-remove.js +28 -55
  72. package/dist/m365/spo/commands/listitem/listitem-attachment-set.js +30 -57
  73. package/dist/m365/spo/commands/listitem/listitem-batch-add.js +36 -58
  74. package/dist/m365/spo/commands/listitem/listitem-batch-remove.js +68 -92
  75. package/dist/m365/spo/commands/listitem/listitem-batch-set.js +37 -57
  76. package/dist/m365/spo/commands/listitem/listitem-get.js +45 -68
  77. package/dist/m365/spo/commands/listitem/listitem-isrecord.js +31 -55
  78. package/dist/m365/spo/commands/listitem/listitem-list.js +47 -81
  79. package/dist/m365/spo/commands/listitem/listitem-record-declare.js +37 -60
  80. package/dist/m365/spo/commands/listitem/listitem-record-lock.js +30 -52
  81. package/dist/m365/spo/commands/listitem/listitem-record-undeclare.js +31 -52
  82. package/dist/m365/spo/commands/listitem/listitem-record-unlock.js +30 -52
  83. package/dist/m365/spo/commands/listitem/listitem-remove.js +33 -61
  84. package/dist/m365/spo/commands/listitem/listitem-retentionlabel-ensure.js +46 -67
  85. package/dist/m365/spo/commands/listitem/listitem-retentionlabel-remove.js +33 -56
  86. package/dist/m365/spo/commands/listitem/listitem-roleassignment-add.js +55 -98
  87. package/dist/m365/spo/commands/listitem/listitem-roleassignment-remove.js +48 -74
  88. package/dist/m365/spo/commands/listitem/listitem-roleinheritance-break.js +33 -56
  89. package/dist/m365/spo/commands/listitem/listitem-roleinheritance-reset.js +31 -53
  90. package/dist/m365/spo/commands/listitem/listitem-set.js +33 -58
  91. package/dist/m365/spo/commands/navigation/navigation-node-add.js +74 -120
  92. package/dist/m365/spo/commands/navigation/navigation-node-get.js +4 -13
  93. package/dist/m365/spo/commands/navigation/navigation-node-list.js +1 -1
  94. package/dist/m365/spo/commands/navigation/navigation-node-remove.js +13 -47
  95. package/dist/m365/spo/commands/navigation/navigation-node-set.js +53 -114
  96. package/dist/m365/spo/commands/orgassetslibrary/orgassetslibrary-list.js +1 -1
  97. package/dist/m365/spo/commands/page/page-column-list.js +7 -8
  98. package/dist/m365/spo/commands/page/page-section-list.js +15 -17
  99. package/dist/m365/spo/commands/page/page-unpublish.js +53 -0
  100. package/dist/m365/spo/commands/sitescript/sitescript-add.js +22 -37
  101. package/dist/m365/spo/commands/sitescript/sitescript-get.js +9 -26
  102. package/dist/m365/spo/commands/sitescript/sitescript-list.js +5 -0
  103. package/dist/m365/spo/commands/sitescript/sitescript-remove.js +9 -33
  104. package/dist/m365/spo/commands/sitescript/sitescript-set.js +29 -56
  105. package/dist/m365/spo/commands/spo-search.js +43 -116
  106. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-add.js +8 -1
  107. package/dist/m365/spo/commands/tenant/tenant-commandset-add.js +8 -1
  108. package/dist/m365/spo/commands/term/term-group-list.js +7 -8
  109. package/dist/m365/spo/commands/term/term-set-list.js +6 -9
  110. package/dist/m365/spo/commands.js +1 -0
  111. package/dist/m365/spp/commands/contentcenter/contentcenter-list.js +5 -0
  112. package/dist/m365/spp/commands/model/model-get.js +25 -45
  113. package/dist/m365/spp/commands/model/model-list.js +12 -23
  114. package/dist/m365/spp/commands/model/model-remove.js +25 -45
  115. package/dist/m365/teams/commands/app/app-install.js +35 -44
  116. package/dist/m365/teams/commands/app/app-list.js +8 -33
  117. package/dist/m365/teams/commands/app/app-publish.js +21 -27
  118. package/dist/m365/teams/commands/app/app-remove.js +22 -39
  119. package/dist/m365/teams/commands/app/app-uninstall.js +12 -34
  120. package/dist/m365/teams/commands/app/app-update.js +35 -45
  121. package/dist/m365/teams/commands/funsettings/funsettings-list.js +12 -23
  122. package/dist/m365/teams/commands/funsettings/funsettings-set.js +18 -54
  123. package/dist/m365/teams/commands/guestsettings/guestsettings-list.js +12 -23
  124. package/dist/m365/teams/commands/guestsettings/guestsettings-set.js +15 -40
  125. package/dist/m365/teams/commands/meeting/meeting-add.js +57 -68
  126. package/dist/m365/teams/commands/meeting/meeting-attendancereport-get.js +33 -58
  127. package/dist/m365/teams/commands/meeting/meeting-attendancereport-list.js +14 -38
  128. package/dist/m365/teams/commands/meeting/meeting-get.js +14 -38
  129. package/dist/m365/teams/commands/meeting/meeting-list.js +34 -59
  130. package/dist/m365/teams/commands/meeting/meeting-transcript-get.js +34 -58
  131. package/dist/m365/teams/commands/meeting/meeting-transcript-list.js +29 -50
  132. package/dist/m365/teams/commands/membersettings/membersettings-list.js +12 -23
  133. package/dist/m365/teams/commands/membersettings/membersettings-set.js +18 -49
  134. package/dist/m365/teams/commands/message/message-get.js +19 -30
  135. package/dist/m365/teams/commands/message/message-list.js +26 -43
  136. package/dist/m365/teams/commands/message/message-remove.js +43 -58
  137. package/dist/m365/teams/commands/message/message-reply-list.js +19 -30
  138. package/dist/m365/teams/commands/message/message-restore.js +40 -50
  139. package/dist/m365/teams/commands/message/message-send.js +19 -30
  140. package/dist/m365/teams/commands/messagingsettings/messagingsettings-list.js +12 -23
  141. package/dist/m365/teams/commands/messagingsettings/messagingsettings-set.js +18 -60
  142. package/dist/m365/teams/commands/report/report-deviceusagedistributionusercounts.js +10 -0
  143. package/dist/m365/teams/commands/report/report-deviceusageusercounts.js +10 -0
  144. package/dist/m365/teams/commands/report/report-deviceusageuserdetail.js +22 -0
  145. package/dist/m365/teams/commands/report/report-directroutingcalls.js +19 -39
  146. package/dist/m365/teams/commands/report/report-pstncalls.js +19 -39
  147. package/dist/m365/teams/commands/report/report-useractivitycounts.js +10 -0
  148. package/dist/m365/teams/commands/report/report-useractivityusercounts.js +10 -0
  149. package/dist/m365/teams/commands/report/report-useractivityuserdetail.js +22 -0
  150. package/dist/m365/teams/commands/tab/tab-add.js +23 -49
  151. package/dist/m365/teams/commands/tab/tab-get.js +55 -56
  152. package/dist/m365/teams/commands/tab/tab-list.js +17 -28
  153. package/dist/m365/teams/commands/tab/tab-remove.js +23 -42
  154. package/dist/m365/teams/commands/team/team-add.js +76 -114
  155. package/dist/m365/teams/commands/team/team-app-list.js +23 -36
  156. package/dist/m365/teams/commands/team/team-archive.js +24 -39
  157. package/dist/m365/teams/commands/team/team-clone.js +28 -62
  158. package/dist/m365/teams/commands/team/team-get.js +23 -36
  159. package/dist/m365/teams/commands/team/team-list.js +43 -57
  160. package/dist/m365/teams/commands/team/team-remove.js +24 -37
  161. package/dist/m365/teams/commands/team/team-set.js +23 -52
  162. package/dist/m365/teams/commands/team/team-unarchive.js +23 -28
  163. package/dist/m365/teams/commands/user/user-app-add.js +40 -49
  164. package/dist/m365/teams/commands/user/user-app-list.js +26 -39
  165. package/dist/m365/teams/commands/user/user-app-remove.js +37 -49
  166. package/dist/m365/teams/commands/user/user-app-upgrade.js +36 -52
  167. package/dist/m365/teams/commands/user/user-list.js +17 -39
  168. package/dist/m365/tenant/commands/report/report-activeusercounts.js +2 -1
  169. package/dist/m365/tenant/commands/report/report-activeuserdetail.js +2 -1
  170. package/dist/m365/tenant/commands/report/report-office365activationcounts.js +9 -0
  171. package/dist/m365/tenant/commands/report/report-office365activationsusercounts.js +9 -0
  172. package/dist/m365/tenant/commands/report/report-office365activationsuserdetail.js +9 -0
  173. package/dist/m365/tenant/commands/report/report-servicesusercounts.js +2 -1
  174. package/dist/m365/tenant/commands/report/report-settings-get.js +5 -0
  175. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-health-get.js +9 -20
  176. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-health-list.js +8 -20
  177. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-healthissue-get.js +8 -15
  178. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-healthissue-list.js +8 -15
  179. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-message-get.js +12 -26
  180. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-message-list.js +8 -22
  181. package/dist/utils/calendar.js +1 -1
  182. package/dist/utils/formatting.js +16 -0
  183. package/dist/utils/pid.js +7 -16
  184. package/dist/utils/spe.js +1 -1
  185. package/dist/utils/spo.js +39 -0
  186. package/dist/utils/validation.js +24 -0
  187. package/dist/utils/zod.js +17 -7
  188. package/docs/docs/cmd/entra/agent/agent-blueprint-list.mdx +175 -0
  189. package/docs/docs/cmd/login.mdx +15 -2
  190. package/docs/docs/cmd/outlook/calendargroup/calendargroup-add.mdx +126 -0
  191. package/docs/docs/cmd/outlook/event/event-add.mdx +390 -0
  192. package/docs/docs/cmd/spe/container/container-add.mdx +0 -8
  193. package/docs/docs/cmd/spe/container/container-list.mdx +0 -8
  194. package/docs/docs/cmd/spe/container/container-permission-add.mdx +140 -0
  195. package/docs/docs/cmd/spe/container/container-permission-remove.mdx +78 -0
  196. package/docs/docs/cmd/spe/container/container-permission-set.mdx +78 -0
  197. package/docs/docs/cmd/spe/container/container-recyclebinitem-list.mdx +0 -8
  198. package/docs/docs/cmd/spe/container/container-recyclebinitem-restore.mdx +0 -8
  199. package/docs/docs/cmd/spe/container/container-remove.mdx +0 -8
  200. package/docs/docs/cmd/spe/containertype/containertype-add.mdx +1 -1
  201. package/docs/docs/cmd/spfx/project/project-upgrade.mdx +1 -1
  202. package/docs/docs/cmd/spo/externaluser/externaluser-list.mdx +17 -30
  203. package/docs/docs/cmd/spo/navigation/navigation-node-add.mdx +45 -30
  204. package/docs/docs/cmd/spo/navigation/navigation-node-get.mdx +64 -42
  205. package/docs/docs/cmd/spo/navigation/navigation-node-set.mdx +10 -8
  206. package/docs/docs/cmd/spo/orgassetslibrary/orgassetslibrary-list.mdx +0 -21
  207. package/docs/docs/cmd/spo/page/page-unpublish.mdx +63 -0
  208. package/docs/docs/cmd/teams/tab/tab-add.mdx +19 -0
  209. package/docs/docs/cmd/teams/tab/tab-get.mdx +19 -0
  210. package/docs/docs/cmd/teams/tab/tab-list.mdx +19 -0
  211. package/docs/docs/cmd/teams/tab/tab-remove.mdx +21 -0
  212. package/docs/docs/cmd/viva/engage/engage-message-add.mdx +17 -0
  213. package/docs/docs/cmd/viva/engage/engage-message-get.mdx +17 -0
  214. package/docs/docs/cmd/viva/engage/engage-message-list.mdx +17 -0
  215. package/docs/docs/cmd/viva/engage/engage-message-remove.mdx +19 -0
  216. package/package.json +4 -6
@@ -1,9 +1,4 @@
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 _SpoCommandSetSetCommand_instances, _a, _SpoCommandSetSetCommand_initTelemetry, _SpoCommandSetSetCommand_initOptions, _SpoCommandSetSetCommand_initValidators, _SpoCommandSetSetCommand_initOptionSets;
1
+ import { globalOptionsZod } from '../../../../Command.js';
7
2
  import commands from '../../commands.js';
8
3
  import { validation } from '../../../../utils/validation.js';
9
4
  import SpoCommand from '../../../base/SpoCommand.js';
@@ -11,6 +6,23 @@ import request from '../../../../request.js';
11
6
  import { formatting } from '../../../../utils/formatting.js';
12
7
  import { spo } from '../../../../utils/spo.js';
13
8
  import { cli } from '../../../../cli/cli.js';
9
+ import { z } from 'zod';
10
+ export const options = z.strictObject({
11
+ ...globalOptionsZod.shape,
12
+ webUrl: z.string().refine(url => validation.isValidSharePointUrl(url) === true, {
13
+ error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
14
+ }).alias('u'),
15
+ title: z.string().optional().alias('t'),
16
+ id: z.string().refine(validation.isValidGuid, { message: 'The value must be a valid GUID.' }).optional().alias('i'),
17
+ clientSideComponentId: z.string().refine(validation.isValidGuid, { message: 'The value must be a valid GUID.' }).optional().alias('c'),
18
+ newClientSideComponentId: z.string().refine(validation.isValidGuid, { message: 'The value must be a valid GUID.' }).optional(),
19
+ newTitle: z.string().optional(),
20
+ description: z.string().optional(),
21
+ listType: z.enum(['List', 'Library', 'SitePages']).optional().alias('l'),
22
+ clientSideComponentProperties: z.string().optional(),
23
+ scope: z.enum(['All', 'Site', 'Web']).optional().alias('s'),
24
+ location: z.enum(['ContextMenu', 'CommandBar', 'Both']).optional()
25
+ });
14
26
  class SpoCommandSetSetCommand extends SpoCommand {
15
27
  get name() {
16
28
  return commands.COMMANDSET_SET;
@@ -18,13 +30,18 @@ class SpoCommandSetSetCommand extends SpoCommand {
18
30
  get description() {
19
31
  return 'Updates a ListView Command Set on a site.';
20
32
  }
21
- constructor() {
22
- super();
23
- _SpoCommandSetSetCommand_instances.add(this);
24
- __classPrivateFieldGet(this, _SpoCommandSetSetCommand_instances, "m", _SpoCommandSetSetCommand_initTelemetry).call(this);
25
- __classPrivateFieldGet(this, _SpoCommandSetSetCommand_instances, "m", _SpoCommandSetSetCommand_initOptions).call(this);
26
- __classPrivateFieldGet(this, _SpoCommandSetSetCommand_instances, "m", _SpoCommandSetSetCommand_initValidators).call(this);
27
- __classPrivateFieldGet(this, _SpoCommandSetSetCommand_instances, "m", _SpoCommandSetSetCommand_initOptionSets).call(this);
33
+ get schema() {
34
+ return options;
35
+ }
36
+ getRefinedSchema(schema) {
37
+ return schema
38
+ .refine(opts => [opts.title, opts.id, opts.clientSideComponentId].filter(x => x !== undefined).length === 1, {
39
+ message: `Specify either 'title', 'id' or 'clientSideComponentId', but not multiple.`,
40
+ params: { customCode: 'optionSet', options: ['title', 'id', 'clientSideComponentId'] }
41
+ })
42
+ .refine(opts => !!opts.newTitle || opts.description !== undefined || !!opts.listType || !!opts.clientSideComponentProperties || !!opts.location || !!opts.newClientSideComponentId, {
43
+ message: 'Please specify option to be updated'
44
+ });
28
45
  }
29
46
  async commandAction(logger, args) {
30
47
  if (this.verbose) {
@@ -114,75 +131,5 @@ class SpoCommandSetSetCommand extends SpoCommand {
114
131
  }
115
132
  }
116
133
  }
117
- _a = SpoCommandSetSetCommand, _SpoCommandSetSetCommand_instances = new WeakSet(), _SpoCommandSetSetCommand_initTelemetry = function _SpoCommandSetSetCommand_initTelemetry() {
118
- this.telemetry.push((args) => {
119
- Object.assign(this.telemetryProperties, {
120
- title: typeof args.options.title !== 'undefined',
121
- id: typeof args.options.id !== 'undefined',
122
- clientSideComponentId: typeof args.options.clientSideComponentId !== 'undefined',
123
- newClientSideComponentId: typeof args.options.newClientSideComponentId !== 'undefined',
124
- newTitle: typeof args.options.newTitle !== 'undefined',
125
- description: typeof args.options.description !== 'undefined',
126
- listType: typeof args.options.listType !== 'undefined',
127
- clientSideComponentProperties: typeof args.options.clientSideComponentProperties !== 'undefined',
128
- scope: typeof args.options.scope !== 'undefined',
129
- location: typeof args.options.location !== 'undefined'
130
- });
131
- });
132
- }, _SpoCommandSetSetCommand_initOptions = function _SpoCommandSetSetCommand_initOptions() {
133
- this.options.unshift({
134
- option: '-u, --webUrl <webUrl>'
135
- }, {
136
- option: '-t, --title [title]'
137
- }, {
138
- option: '-i, --id [id]'
139
- }, {
140
- option: '-c, --clientSideComponentId [clientSideComponentId]'
141
- }, {
142
- option: '--newClientSideComponentId [newClientSideComponentId]'
143
- }, {
144
- option: '--newTitle [newTitle]'
145
- }, {
146
- option: '--description [description]'
147
- }, {
148
- option: '-l, --listType [listType]', autocomplete: _a.listTypes
149
- }, {
150
- option: '--clientSideComponentProperties [clientSideComponentProperties]'
151
- }, {
152
- option: '-s, --scope [scope]', autocomplete: _a.scopes
153
- }, {
154
- option: '--location [location]', autocomplete: _a.locations
155
- });
156
- }, _SpoCommandSetSetCommand_initValidators = function _SpoCommandSetSetCommand_initValidators() {
157
- this.validators.push(async (args) => {
158
- if (args.options.id && !validation.isValidGuid(args.options.id)) {
159
- return `${args.options.id} is not a valid GUID`;
160
- }
161
- if (args.options.clientSideComponentId && !validation.isValidGuid(args.options.clientSideComponentId)) {
162
- return `${args.options.clientSideComponentId} is not a valid GUID`;
163
- }
164
- if (args.options.newClientSideComponentId && !validation.isValidGuid(args.options.newClientSideComponentId)) {
165
- return `${args.options.newClientSideComponentId} is not a valid GUID`;
166
- }
167
- if (args.options.listType && _a.listTypes.indexOf(args.options.listType) < 0) {
168
- return `${args.options.listType} is not a valid list type. Allowed values are ${_a.listTypes.join(', ')}`;
169
- }
170
- if (args.options.scope && _a.scopes.indexOf(args.options.scope) < 0) {
171
- return `${args.options.scope} is not a valid scope. Allowed values are ${_a.scopes.join(', ')}`;
172
- }
173
- if (args.options.location && _a.locations.indexOf(args.options.location) < 0) {
174
- return `${args.options.location} is not a valid location. Allowed values are ${_a.locations.join(', ')}`;
175
- }
176
- if (!args.options.newTitle && args.options.description === undefined && !args.options.listType && !args.options.clientSideComponentProperties && !args.options.location && !args.options.newClientSideComponentId) {
177
- return `Please specify option to be updated`;
178
- }
179
- return validation.isValidSharePointUrl(args.options.webUrl);
180
- });
181
- }, _SpoCommandSetSetCommand_initOptionSets = function _SpoCommandSetSetCommand_initOptionSets() {
182
- this.optionSets.push({ options: ['id', 'title', 'clientSideComponentId'] });
183
- };
184
- SpoCommandSetSetCommand.listTypes = ['List', 'Library', 'SitePages'];
185
- SpoCommandSetSetCommand.scopes = ['All', 'Site', 'Web'];
186
- SpoCommandSetSetCommand.locations = ['ContextMenu', 'CommandBar', 'Both'];
187
134
  export default new SpoCommandSetSetCommand();
188
135
  //# sourceMappingURL=commandset-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 _SpoContentTypeAddCommand_instances, _SpoContentTypeAddCommand_initTelemetry, _SpoContentTypeAddCommand_initOptions, _SpoContentTypeAddCommand_initValidators, _SpoContentTypeAddCommand_initTypes;
1
+ import { z } from 'zod';
7
2
  import { cli } from '../../../../cli/cli.js';
3
+ import { globalOptionsZod } from '../../../../Command.js';
8
4
  import config from '../../../../config.js';
9
5
  import request from '../../../../request.js';
10
6
  import { formatting } from '../../../../utils/formatting.js';
@@ -13,6 +9,24 @@ import { validation } from '../../../../utils/validation.js';
13
9
  import SpoCommand from '../../../base/SpoCommand.js';
14
10
  import commands from '../../commands.js';
15
11
  import spoContentTypeGetCommand from './contenttype-get.js';
12
+ export const options = z.strictObject({
13
+ ...globalOptionsZod.shape,
14
+ webUrl: z.string()
15
+ .refine(url => validation.isValidSharePointUrl(url) === true, {
16
+ error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
17
+ })
18
+ .alias('u'),
19
+ listTitle: z.string().optional().alias('l'),
20
+ listId: z.string()
21
+ .refine(id => validation.isValidGuid(id), {
22
+ error: e => `${e.input} is not a valid GUID`
23
+ }).optional(),
24
+ listUrl: z.string().optional(),
25
+ id: z.string().alias('i'),
26
+ name: z.string().alias('n'),
27
+ description: z.string().optional().alias('d'),
28
+ group: z.string().optional().alias('g')
29
+ });
16
30
  class SpoContentTypeAddCommand extends SpoCommand {
17
31
  get name() {
18
32
  return commands.CONTENTTYPE_ADD;
@@ -20,13 +34,8 @@ class SpoContentTypeAddCommand extends SpoCommand {
20
34
  get description() {
21
35
  return 'Adds a new list or site content type';
22
36
  }
23
- constructor() {
24
- super();
25
- _SpoContentTypeAddCommand_instances.add(this);
26
- __classPrivateFieldGet(this, _SpoContentTypeAddCommand_instances, "m", _SpoContentTypeAddCommand_initTelemetry).call(this);
27
- __classPrivateFieldGet(this, _SpoContentTypeAddCommand_instances, "m", _SpoContentTypeAddCommand_initOptions).call(this);
28
- __classPrivateFieldGet(this, _SpoContentTypeAddCommand_instances, "m", _SpoContentTypeAddCommand_initValidators).call(this);
29
- __classPrivateFieldGet(this, _SpoContentTypeAddCommand_instances, "m", _SpoContentTypeAddCommand_initTypes).call(this);
37
+ get schema() {
38
+ return options;
30
39
  }
31
40
  async commandAction(logger, args) {
32
41
  try {
@@ -92,43 +101,5 @@ class SpoContentTypeAddCommand extends SpoCommand {
92
101
  return `<Identity Id="5" Name="1a48869e-c092-0000-1f61-81ec89809537|740c6a0b-85e2-48a0-a494-e0f1759d4aa7:site:${siteId}:web:${webId}:list:${listId}" />`;
93
102
  }
94
103
  }
95
- _SpoContentTypeAddCommand_instances = new WeakSet(), _SpoContentTypeAddCommand_initTelemetry = function _SpoContentTypeAddCommand_initTelemetry() {
96
- this.telemetry.push((args) => {
97
- Object.assign(this.telemetryProperties, {
98
- listTitle: typeof args.options.listTitle !== 'undefined',
99
- description: typeof args.options.description !== 'undefined',
100
- group: typeof args.options.group !== 'undefined'
101
- });
102
- });
103
- }, _SpoContentTypeAddCommand_initOptions = function _SpoContentTypeAddCommand_initOptions() {
104
- this.options.unshift({
105
- option: '-u, --webUrl <webUrl>'
106
- }, {
107
- option: '-l, --listTitle [listTitle]'
108
- }, {
109
- option: '--listId [listId]'
110
- }, {
111
- option: '--listUrl [listUrl]'
112
- }, {
113
- option: '-i, --id <id>'
114
- }, {
115
- option: '-n, --name <name>'
116
- }, {
117
- option: '-d, --description [description]'
118
- }, {
119
- option: '-g, --group [group]'
120
- });
121
- }, _SpoContentTypeAddCommand_initValidators = function _SpoContentTypeAddCommand_initValidators() {
122
- this.validators.push(async (args) => {
123
- if (args.options.listId) {
124
- if (!validation.isValidGuid(args.options.listId)) {
125
- return `${args.options.listId} is not a valid GUID`;
126
- }
127
- }
128
- return validation.isValidSharePointUrl(args.options.webUrl);
129
- });
130
- }, _SpoContentTypeAddCommand_initTypes = function _SpoContentTypeAddCommand_initTypes() {
131
- this.types.string.push('id', 'i');
132
- };
133
104
  export default new SpoContentTypeAddCommand();
134
105
  //# sourceMappingURL=contenttype-add.js.map
@@ -1,15 +1,28 @@
1
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
- };
6
- var _SpoContentTypeFieldListCommand_instances, _SpoContentTypeFieldListCommand_initTelemetry, _SpoContentTypeFieldListCommand_initOptions, _SpoContentTypeFieldListCommand_initValidators, _SpoContentTypeFieldListCommand_initTypes, _SpoContentTypeFieldListCommand_initOptionSets;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
7
3
  import { formatting } from '../../../../utils/formatting.js';
8
4
  import { odata } from '../../../../utils/odata.js';
9
5
  import { urlUtil } from '../../../../utils/urlUtil.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
+ webUrl: z.string()
12
+ .refine(url => validation.isValidSharePointUrl(url) === true, {
13
+ error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
14
+ })
15
+ .alias('u'),
16
+ contentTypeId: z.string().optional().alias('i'),
17
+ contentTypeName: z.string().optional().alias('n'),
18
+ listTitle: z.string().optional().alias('l'),
19
+ listId: z.string()
20
+ .refine(id => validation.isValidGuid(id), {
21
+ error: e => `${e.input} is not a valid GUID for option 'listId'.`
22
+ }).optional(),
23
+ listUrl: z.string().optional(),
24
+ properties: z.string().optional().alias('p')
25
+ });
13
26
  class SpoContentTypeFieldListCommand extends SpoCommand {
14
27
  get name() {
15
28
  return commands.CONTENTTYPE_FIELD_LIST;
@@ -20,14 +33,25 @@ class SpoContentTypeFieldListCommand extends SpoCommand {
20
33
  defaultProperties() {
21
34
  return ['Id', 'Title', 'InternalName', 'Hidden'];
22
35
  }
23
- constructor() {
24
- super();
25
- _SpoContentTypeFieldListCommand_instances.add(this);
26
- __classPrivateFieldGet(this, _SpoContentTypeFieldListCommand_instances, "m", _SpoContentTypeFieldListCommand_initTelemetry).call(this);
27
- __classPrivateFieldGet(this, _SpoContentTypeFieldListCommand_instances, "m", _SpoContentTypeFieldListCommand_initOptions).call(this);
28
- __classPrivateFieldGet(this, _SpoContentTypeFieldListCommand_instances, "m", _SpoContentTypeFieldListCommand_initValidators).call(this);
29
- __classPrivateFieldGet(this, _SpoContentTypeFieldListCommand_instances, "m", _SpoContentTypeFieldListCommand_initTypes).call(this);
30
- __classPrivateFieldGet(this, _SpoContentTypeFieldListCommand_instances, "m", _SpoContentTypeFieldListCommand_initOptionSets).call(this);
36
+ get schema() {
37
+ return options;
38
+ }
39
+ getRefinedSchema(schema) {
40
+ return schema
41
+ .refine(opts => [opts.contentTypeId, opts.contentTypeName].filter(x => x !== undefined).length === 1, {
42
+ error: `Specify either 'contentTypeId' or 'contentTypeName', but not both.`,
43
+ params: {
44
+ customCode: 'optionSet',
45
+ options: ['contentTypeId', 'contentTypeName']
46
+ }
47
+ })
48
+ .refine(opts => [opts.listId, opts.listTitle, opts.listUrl].filter(x => x !== undefined).length <= 1, {
49
+ error: `Specify either 'listId', 'listTitle' or 'listUrl'.`,
50
+ params: {
51
+ customCode: 'optionSet',
52
+ options: ['listId', 'listTitle', 'listUrl']
53
+ }
54
+ });
31
55
  }
32
56
  async commandAction(logger, args) {
33
57
  try {
@@ -72,53 +96,5 @@ class SpoContentTypeFieldListCommand extends SpoCommand {
72
96
  return res[0].StringId;
73
97
  }
74
98
  }
75
- _SpoContentTypeFieldListCommand_instances = new WeakSet(), _SpoContentTypeFieldListCommand_initTelemetry = function _SpoContentTypeFieldListCommand_initTelemetry() {
76
- this.telemetry.push((args) => {
77
- Object.assign(this.telemetryProperties, {
78
- contentTypeId: typeof args.options.contentTypeId !== 'undefined',
79
- contentTypeName: typeof args.options.contentTypeName !== 'undefined',
80
- listId: typeof args.options.listId !== 'undefined',
81
- listTitle: typeof args.options.listTitle !== 'undefined',
82
- listUrl: typeof args.options.listUrl !== 'undefined',
83
- properties: typeof args.options.properties !== 'undefined'
84
- });
85
- });
86
- }, _SpoContentTypeFieldListCommand_initOptions = function _SpoContentTypeFieldListCommand_initOptions() {
87
- this.options.unshift({
88
- option: '-u, --webUrl <webUrl>'
89
- }, {
90
- option: '-i, --contentTypeId [contentTypeId]'
91
- }, {
92
- option: '-n, --contentTypeName [contentTypeName]'
93
- }, {
94
- option: '-l, --listTitle [listTitle]'
95
- }, {
96
- option: '--listId [listId]'
97
- }, {
98
- option: '--listUrl [listUrl]'
99
- }, {
100
- option: '-p, --properties [properties]'
101
- });
102
- }, _SpoContentTypeFieldListCommand_initValidators = function _SpoContentTypeFieldListCommand_initValidators() {
103
- this.validators.push(async (args) => {
104
- const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
105
- if (isValidSharePointUrl !== true) {
106
- return isValidSharePointUrl;
107
- }
108
- if (args.options.listId && !validation.isValidGuid(args.options.listId)) {
109
- return `${args.options.listId} is not a valid GUID for option 'listId'.`;
110
- }
111
- return true;
112
- });
113
- }, _SpoContentTypeFieldListCommand_initTypes = function _SpoContentTypeFieldListCommand_initTypes() {
114
- this.types.string.push('webUrl', 'contentTypeId', 'contentTypeName', 'listTitle', 'listId', 'listUrl', 'properties');
115
- }, _SpoContentTypeFieldListCommand_initOptionSets = function _SpoContentTypeFieldListCommand_initOptionSets() {
116
- this.optionSets.push({
117
- options: ['contentTypeId', 'contentTypeName']
118
- }, {
119
- options: ['listId', 'listTitle', 'listUrl'],
120
- runsWhen: (args) => args.options.listId || args.options.listTitle || args.options.listUrl
121
- });
122
- };
123
99
  export default new SpoContentTypeFieldListCommand();
124
100
  //# sourceMappingURL=contenttype-field-list.js.map
@@ -1,16 +1,33 @@
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 _SpoContentTypeFieldRemoveCommand_instances, _SpoContentTypeFieldRemoveCommand_initTelemetry, _SpoContentTypeFieldRemoveCommand_initOptions, _SpoContentTypeFieldRemoveCommand_initValidators, _SpoContentTypeFieldRemoveCommand_initTypes;
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 { 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
+ contentTypeId: z.string(),
13
+ id: z.string()
14
+ .refine(id => validation.isValidGuid(id), {
15
+ error: e => `${e.input} is not a valid GUID`
16
+ }).alias('i'),
17
+ webUrl: z.string()
18
+ .refine(url => validation.isValidSharePointUrl(url) === true, {
19
+ error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
20
+ })
21
+ .alias('u'),
22
+ listId: z.string()
23
+ .refine(id => validation.isValidGuid(id), {
24
+ error: e => `${e.input} is not a valid GUID`
25
+ }).optional(),
26
+ listTitle: z.string().optional().alias('l'),
27
+ listUrl: z.string().optional(),
28
+ updateChildContentTypes: z.boolean().optional().alias('c'),
29
+ force: z.boolean().optional().alias('f')
30
+ });
14
31
  class SpoContentTypeFieldRemoveCommand extends SpoCommand {
15
32
  get name() {
16
33
  return commands.CONTENTTYPE_FIELD_REMOVE;
@@ -18,13 +35,8 @@ class SpoContentTypeFieldRemoveCommand extends SpoCommand {
18
35
  get description() {
19
36
  return 'Removes a column from a site- or list content type';
20
37
  }
21
- constructor() {
22
- super();
23
- _SpoContentTypeFieldRemoveCommand_instances.add(this);
24
- __classPrivateFieldGet(this, _SpoContentTypeFieldRemoveCommand_instances, "m", _SpoContentTypeFieldRemoveCommand_initTelemetry).call(this);
25
- __classPrivateFieldGet(this, _SpoContentTypeFieldRemoveCommand_instances, "m", _SpoContentTypeFieldRemoveCommand_initOptions).call(this);
26
- __classPrivateFieldGet(this, _SpoContentTypeFieldRemoveCommand_instances, "m", _SpoContentTypeFieldRemoveCommand_initValidators).call(this);
27
- __classPrivateFieldGet(this, _SpoContentTypeFieldRemoveCommand_instances, "m", _SpoContentTypeFieldRemoveCommand_initTypes).call(this);
38
+ get schema() {
39
+ return options;
28
40
  }
29
41
  async commandAction(logger, args) {
30
42
  const removeFieldLink = async () => {
@@ -95,46 +107,5 @@ class SpoContentTypeFieldRemoveCommand extends SpoCommand {
95
107
  }
96
108
  }
97
109
  }
98
- _SpoContentTypeFieldRemoveCommand_instances = new WeakSet(), _SpoContentTypeFieldRemoveCommand_initTelemetry = function _SpoContentTypeFieldRemoveCommand_initTelemetry() {
99
- this.telemetry.push((args) => {
100
- Object.assign(this.telemetryProperties, {
101
- listTitle: typeof args.options.listTitle !== 'undefined',
102
- listId: typeof args.options.listId !== 'undefined',
103
- listUrl: typeof args.options.listUrl !== 'undefined',
104
- updateChildContentTypes: !!args.options.updateChildContentTypes,
105
- force: !!args.options.force
106
- });
107
- });
108
- }, _SpoContentTypeFieldRemoveCommand_initOptions = function _SpoContentTypeFieldRemoveCommand_initOptions() {
109
- this.options.unshift({
110
- option: '-u, --webUrl <webUrl>'
111
- }, {
112
- option: '-l, --listTitle [listTitle]'
113
- }, {
114
- option: '--listId [listId]'
115
- }, {
116
- option: '--listUrl [listUrl]'
117
- }, {
118
- option: '--contentTypeId <contentTypeId>'
119
- }, {
120
- option: '-i, --id <id>'
121
- }, {
122
- option: '-c, --updateChildContentTypes'
123
- }, {
124
- option: '-f, --force'
125
- });
126
- }, _SpoContentTypeFieldRemoveCommand_initValidators = function _SpoContentTypeFieldRemoveCommand_initValidators() {
127
- this.validators.push(async (args) => {
128
- if (!validation.isValidGuid(args.options.id)) {
129
- return `${args.options.id} is not a valid GUID`;
130
- }
131
- if (args.options.listId && !validation.isValidGuid(args.options.listId)) {
132
- return `${args.options.listId} is not a valid GUID`;
133
- }
134
- return validation.isValidSharePointUrl(args.options.webUrl);
135
- });
136
- }, _SpoContentTypeFieldRemoveCommand_initTypes = function _SpoContentTypeFieldRemoveCommand_initTypes() {
137
- this.types.string.push('i', 'contentTypeId');
138
- };
139
110
  export default new SpoContentTypeFieldRemoveCommand();
140
111
  //# sourceMappingURL=contenttype-field-remove.js.map
@@ -1,9 +1,5 @@
1
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
- };
6
- var _SpoContentTypeFieldSetCommand_instances, _SpoContentTypeFieldSetCommand_initTelemetry, _SpoContentTypeFieldSetCommand_initOptions, _SpoContentTypeFieldSetCommand_initValidators, _SpoContentTypeFieldSetCommand_initTypes;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
7
3
  import config from '../../../../config.js';
8
4
  import request from '../../../../request.js';
9
5
  import { formatting } from '../../../../utils/formatting.js';
@@ -11,6 +7,21 @@ 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
+ contentTypeId: z.string(),
13
+ id: z.string()
14
+ .refine(id => validation.isValidGuid(id), {
15
+ error: e => `${e.input} is not a valid GUID`
16
+ }).alias('i'),
17
+ hidden: z.boolean().optional(),
18
+ required: z.boolean().optional().alias('r'),
19
+ webUrl: z.string()
20
+ .refine(url => validation.isValidSharePointUrl(url) === true, {
21
+ error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
22
+ })
23
+ .alias('u')
24
+ });
14
25
  class SpoContentTypeFieldSetCommand extends SpoCommand {
15
26
  get name() {
16
27
  return commands.CONTENTTYPE_FIELD_SET;
@@ -18,13 +29,11 @@ class SpoContentTypeFieldSetCommand extends SpoCommand {
18
29
  get description() {
19
30
  return 'Adds or updates a site column reference in a site content type';
20
31
  }
32
+ get schema() {
33
+ return options;
34
+ }
21
35
  constructor() {
22
36
  super();
23
- _SpoContentTypeFieldSetCommand_instances.add(this);
24
- __classPrivateFieldGet(this, _SpoContentTypeFieldSetCommand_instances, "m", _SpoContentTypeFieldSetCommand_initTelemetry).call(this);
25
- __classPrivateFieldGet(this, _SpoContentTypeFieldSetCommand_instances, "m", _SpoContentTypeFieldSetCommand_initOptions).call(this);
26
- __classPrivateFieldGet(this, _SpoContentTypeFieldSetCommand_instances, "m", _SpoContentTypeFieldSetCommand_initValidators).call(this);
27
- __classPrivateFieldGet(this, _SpoContentTypeFieldSetCommand_instances, "m", _SpoContentTypeFieldSetCommand_initTypes).call(this);
28
37
  this.requestDigest = '';
29
38
  this.siteId = '';
30
39
  this.webId = '';
@@ -207,37 +216,5 @@ class SpoContentTypeFieldSetCommand extends SpoCommand {
207
216
  this.requestDigest = res.FormDigestValue;
208
217
  }
209
218
  }
210
- _SpoContentTypeFieldSetCommand_instances = new WeakSet(), _SpoContentTypeFieldSetCommand_initTelemetry = function _SpoContentTypeFieldSetCommand_initTelemetry() {
211
- this.telemetry.push((args) => {
212
- Object.assign(this.telemetryProperties, {
213
- hidden: args.options.hidden,
214
- required: args.options.required
215
- });
216
- });
217
- }, _SpoContentTypeFieldSetCommand_initOptions = function _SpoContentTypeFieldSetCommand_initOptions() {
218
- this.options.unshift({
219
- option: '-u, --webUrl <webUrl>'
220
- }, {
221
- option: '--contentTypeId <contentTypeId>'
222
- }, {
223
- option: '-i, --id <id>'
224
- }, {
225
- option: '-r, --required [required]',
226
- autocomplete: ['true', 'false']
227
- }, {
228
- option: '--hidden [hidden]',
229
- autocomplete: ['true', 'false']
230
- });
231
- }, _SpoContentTypeFieldSetCommand_initValidators = function _SpoContentTypeFieldSetCommand_initValidators() {
232
- this.validators.push(async (args) => {
233
- if (!validation.isValidGuid(args.options.id)) {
234
- return `${args.options.id} is not a valid GUID`;
235
- }
236
- return validation.isValidSharePointUrl(args.options.webUrl);
237
- });
238
- }, _SpoContentTypeFieldSetCommand_initTypes = function _SpoContentTypeFieldSetCommand_initTypes() {
239
- this.types.string.push('contentTypeId', 'c');
240
- this.types.boolean.push('required', 'hidden');
241
- };
242
219
  export default new SpoContentTypeFieldSetCommand();
243
220
  //# sourceMappingURL=contenttype-field-set.js.map
@@ -1,15 +1,27 @@
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 _SpoContentTypeGetCommand_instances, _SpoContentTypeGetCommand_initTelemetry, _SpoContentTypeGetCommand_initOptions, _SpoContentTypeGetCommand_initValidators, _SpoContentTypeGetCommand_initTypes, _SpoContentTypeGetCommand_initOptionSets;
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 { urlUtil } from '../../../../utils/urlUtil.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
+ webUrl: z.string()
12
+ .refine(url => validation.isValidSharePointUrl(url) === true, {
13
+ error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
14
+ })
15
+ .alias('u'),
16
+ listTitle: z.string().optional().alias('l'),
17
+ listId: z.string()
18
+ .refine(id => validation.isValidGuid(id), {
19
+ error: e => `${e.input} is not a valid GUID`
20
+ }).optional(),
21
+ listUrl: z.string().optional(),
22
+ id: z.string().optional().alias('i'),
23
+ name: z.string().optional().alias('n')
24
+ });
13
25
  class SpoContentTypeGetCommand extends SpoCommand {
14
26
  get name() {
15
27
  return commands.CONTENTTYPE_GET;
@@ -17,14 +29,17 @@ class SpoContentTypeGetCommand extends SpoCommand {
17
29
  get description() {
18
30
  return 'Retrieves information about the specified list or site content type';
19
31
  }
20
- constructor() {
21
- super();
22
- _SpoContentTypeGetCommand_instances.add(this);
23
- __classPrivateFieldGet(this, _SpoContentTypeGetCommand_instances, "m", _SpoContentTypeGetCommand_initTelemetry).call(this);
24
- __classPrivateFieldGet(this, _SpoContentTypeGetCommand_instances, "m", _SpoContentTypeGetCommand_initOptions).call(this);
25
- __classPrivateFieldGet(this, _SpoContentTypeGetCommand_instances, "m", _SpoContentTypeGetCommand_initValidators).call(this);
26
- __classPrivateFieldGet(this, _SpoContentTypeGetCommand_instances, "m", _SpoContentTypeGetCommand_initTypes).call(this);
27
- __classPrivateFieldGet(this, _SpoContentTypeGetCommand_instances, "m", _SpoContentTypeGetCommand_initOptionSets).call(this);
32
+ get schema() {
33
+ return options;
34
+ }
35
+ getRefinedSchema(schema) {
36
+ return schema.refine(opts => [opts.id, opts.name].filter(x => x !== undefined).length === 1, {
37
+ error: `Specify either 'id' or 'name', but not both.`,
38
+ params: {
39
+ customCode: 'optionSet',
40
+ options: ['id', 'name']
41
+ }
42
+ });
28
43
  }
29
44
  async commandAction(logger, args) {
30
45
  let requestUrl = `${args.options.webUrl}/_api/web`;
@@ -76,45 +91,5 @@ class SpoContentTypeGetCommand extends SpoCommand {
76
91
  }
77
92
  }
78
93
  }
79
- _SpoContentTypeGetCommand_instances = new WeakSet(), _SpoContentTypeGetCommand_initTelemetry = function _SpoContentTypeGetCommand_initTelemetry() {
80
- this.telemetry.push((args) => {
81
- Object.assign(this.telemetryProperties, {
82
- listId: typeof args.options.listId !== 'undefined',
83
- listTitle: typeof args.options.listTitle !== 'undefined',
84
- listUrl: typeof args.options.listUrl !== 'undefined',
85
- id: typeof args.options.id !== 'undefined',
86
- name: typeof args.options.name !== 'undefined'
87
- });
88
- });
89
- }, _SpoContentTypeGetCommand_initOptions = function _SpoContentTypeGetCommand_initOptions() {
90
- this.options.unshift({
91
- option: '-u, --webUrl <webUrl>'
92
- }, {
93
- option: '-l, --listTitle [listTitle]'
94
- }, {
95
- option: '--listId [listId]'
96
- }, {
97
- option: '--listUrl [listUrl]'
98
- }, {
99
- option: '-i, --id [id]'
100
- }, {
101
- option: '-n, --name [name]'
102
- });
103
- }, _SpoContentTypeGetCommand_initValidators = function _SpoContentTypeGetCommand_initValidators() {
104
- this.validators.push(async (args) => {
105
- const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
106
- if (isValidSharePointUrl !== true) {
107
- return isValidSharePointUrl;
108
- }
109
- if (args.options.listId && !validation.isValidGuid(args.options.listId)) {
110
- return `${args.options.listId} is not a valid GUID`;
111
- }
112
- return true;
113
- });
114
- }, _SpoContentTypeGetCommand_initTypes = function _SpoContentTypeGetCommand_initTypes() {
115
- this.types.string.push('id', 'i');
116
- }, _SpoContentTypeGetCommand_initOptionSets = function _SpoContentTypeGetCommand_initOptionSets() {
117
- this.optionSets.push({ options: ['id', 'name'] });
118
- };
119
94
  export default new SpoContentTypeGetCommand();
120
95
  //# sourceMappingURL=contenttype-get.js.map