@pnp/cli-microsoft365 12.0.0-beta.4ac11a7 → 12.0.0-beta.8769a5e

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 (265) hide show
  1. package/allCommands.json +1 -1
  2. package/allCommandsFull.json +1 -1
  3. package/dist/Auth.js +4 -1
  4. package/dist/Command.js +11 -8
  5. package/dist/cli/cli.js +15 -0
  6. package/dist/config.js +2 -0
  7. package/dist/m365/cli/commands/cli-consent.js +9 -2
  8. package/dist/m365/entra/commands/agent/agent-blueprint-list.js +52 -0
  9. package/dist/m365/entra/commands/agent/agent-blueprintprincipal-list.js +56 -0
  10. package/dist/m365/entra/commands/m365group/m365group-add.js +52 -97
  11. package/dist/m365/entra/commands/m365group/m365group-conversation-list.js +20 -33
  12. package/dist/m365/entra/commands/m365group/m365group-conversation-post-list.js +20 -39
  13. package/dist/m365/entra/commands/m365group/m365group-get.js +20 -41
  14. package/dist/m365/entra/commands/m365group/m365group-list.js +11 -31
  15. package/dist/m365/entra/commands/m365group/m365group-recyclebinitem-clear.js +8 -22
  16. package/dist/m365/entra/commands/m365group/m365group-recyclebinitem-list.js +9 -25
  17. package/dist/m365/entra/commands/m365group/m365group-recyclebinitem-remove.js +21 -43
  18. package/dist/m365/entra/commands/m365group/m365group-recyclebinitem-restore.js +21 -41
  19. package/dist/m365/entra/commands/m365group/m365group-remove.js +25 -46
  20. package/dist/m365/entra/commands/m365group/m365group-renew.js +19 -32
  21. package/dist/m365/entra/commands/m365group/m365group-set.js +86 -141
  22. package/dist/m365/entra/commands/m365group/m365group-teamify.js +20 -43
  23. package/dist/m365/entra/commands/m365group/m365group-user-add.js +44 -77
  24. package/dist/m365/entra/commands/m365group/m365group-user-list.js +28 -55
  25. package/dist/m365/entra/commands/m365group/m365group-user-remove.js +37 -74
  26. package/dist/m365/entra/commands/m365group/m365group-user-set.js +45 -77
  27. package/dist/m365/entra/commands.js +2 -0
  28. package/dist/m365/graph/commands/schemaextension/schemaextension-list.js +14 -16
  29. package/dist/m365/outlook/commands/calendargroup/calendargroup-add.js +97 -0
  30. package/dist/m365/outlook/commands/event/event-add.js +324 -0
  31. package/dist/m365/outlook/commands.js +2 -0
  32. package/dist/m365/spe/commands/container/container-activate.js +8 -16
  33. package/dist/m365/spe/commands/container/container-list.js +21 -42
  34. package/dist/m365/spe/commands/container/container-permission-add.js +114 -0
  35. package/dist/m365/spe/commands/container/container-permission-remove.js +94 -0
  36. package/dist/m365/spe/commands/container/container-permission-set.js +90 -0
  37. package/dist/m365/spe/commands/containertype/containertype-list.js +5 -0
  38. package/dist/m365/spe/commands.js +3 -0
  39. package/dist/m365/spfx/commands/SpfxCompatibilityMatrix.js +1 -1
  40. package/dist/m365/spfx/commands/project/project-doctor/{doctor-1.24.0-rc.0.js → doctor-1.24.0.js} +1 -1
  41. package/dist/m365/spfx/commands/project/project-doctor.js +1 -1
  42. package/dist/m365/spfx/commands/project/project-upgrade/{upgrade-1.24.0-rc.0.js → upgrade-1.24.0.js} +27 -27
  43. package/dist/m365/spfx/commands/project/project-upgrade.js +11 -11
  44. package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-add.js +38 -71
  45. package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-get.js +25 -59
  46. package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-list.js +11 -34
  47. package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-remove.js +25 -54
  48. package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-set.js +52 -83
  49. package/dist/m365/spo/commands/apppage/apppage-add.js +21 -39
  50. package/dist/m365/spo/commands/apppage/apppage-set.js +20 -30
  51. package/dist/m365/spo/commands/commandset/commandset-add.js +17 -59
  52. package/dist/m365/spo/commands/commandset/commandset-get.js +24 -62
  53. package/dist/m365/spo/commands/commandset/commandset-list.js +11 -34
  54. package/dist/m365/spo/commands/commandset/commandset-remove.js +21 -54
  55. package/dist/m365/spo/commands/commandset/commandset-set.js +30 -83
  56. package/dist/m365/spo/commands/contenttype/contenttype-add.js +22 -51
  57. package/dist/m365/spo/commands/contenttype/contenttype-field-list.js +38 -62
  58. package/dist/m365/spo/commands/contenttype/contenttype-field-remove.js +25 -54
  59. package/dist/m365/spo/commands/contenttype/contenttype-field-set.js +20 -43
  60. package/dist/m365/spo/commands/contenttype/contenttype-get.js +29 -54
  61. package/dist/m365/spo/commands/contenttype/contenttype-list.js +13 -30
  62. package/dist/m365/spo/commands/contenttype/contenttype-remove.js +24 -39
  63. package/dist/m365/spo/commands/contenttype/contenttype-set.js +42 -63
  64. package/dist/m365/spo/commands/contenttype/contenttype-sync.js +37 -59
  65. package/dist/m365/spo/commands/contenttypehub/contenttypehub-get.js +5 -0
  66. package/dist/m365/spo/commands/customaction/customaction-add.js +124 -145
  67. package/dist/m365/spo/commands/customaction/customaction-clear.js +12 -43
  68. package/dist/m365/spo/commands/customaction/customaction-get.js +28 -59
  69. package/dist/m365/spo/commands/customaction/customaction-list.js +12 -42
  70. package/dist/m365/spo/commands/customaction/customaction-remove.js +26 -54
  71. package/dist/m365/spo/commands/customaction/customaction-set.js +75 -132
  72. package/dist/m365/spo/commands/externaluser/externaluser-list.js +5 -14
  73. package/dist/m365/spo/commands/knowledgehub/knowledgehub-get.js +5 -0
  74. package/dist/m365/spo/commands/knowledgehub/knowledgehub-remove.js +8 -22
  75. package/dist/m365/spo/commands/knowledgehub/knowledgehub-set.js +10 -18
  76. package/dist/m365/spo/commands/listitem/listitem-add.js +27 -55
  77. package/dist/m365/spo/commands/listitem/listitem-attachment-add.js +30 -58
  78. package/dist/m365/spo/commands/listitem/listitem-attachment-get.js +27 -52
  79. package/dist/m365/spo/commands/listitem/listitem-attachment-list.js +26 -50
  80. package/dist/m365/spo/commands/listitem/listitem-attachment-remove.js +28 -55
  81. package/dist/m365/spo/commands/listitem/listitem-attachment-set.js +30 -57
  82. package/dist/m365/spo/commands/listitem/listitem-batch-add.js +36 -58
  83. package/dist/m365/spo/commands/listitem/listitem-batch-remove.js +68 -92
  84. package/dist/m365/spo/commands/listitem/listitem-batch-set.js +37 -57
  85. package/dist/m365/spo/commands/listitem/listitem-get.js +45 -68
  86. package/dist/m365/spo/commands/listitem/listitem-isrecord.js +31 -55
  87. package/dist/m365/spo/commands/listitem/listitem-list.js +47 -81
  88. package/dist/m365/spo/commands/listitem/listitem-record-declare.js +37 -60
  89. package/dist/m365/spo/commands/listitem/listitem-record-lock.js +30 -52
  90. package/dist/m365/spo/commands/listitem/listitem-record-undeclare.js +31 -52
  91. package/dist/m365/spo/commands/listitem/listitem-record-unlock.js +30 -52
  92. package/dist/m365/spo/commands/listitem/listitem-remove.js +33 -61
  93. package/dist/m365/spo/commands/listitem/listitem-retentionlabel-ensure.js +46 -67
  94. package/dist/m365/spo/commands/listitem/listitem-retentionlabel-remove.js +33 -56
  95. package/dist/m365/spo/commands/listitem/listitem-roleassignment-add.js +55 -98
  96. package/dist/m365/spo/commands/listitem/listitem-roleassignment-remove.js +48 -74
  97. package/dist/m365/spo/commands/listitem/listitem-roleinheritance-break.js +33 -56
  98. package/dist/m365/spo/commands/listitem/listitem-roleinheritance-reset.js +31 -53
  99. package/dist/m365/spo/commands/listitem/listitem-set.js +33 -58
  100. package/dist/m365/spo/commands/navigation/navigation-node-add.js +1 -1
  101. package/dist/m365/spo/commands/navigation/navigation-node-get.js +1 -1
  102. package/dist/m365/spo/commands/navigation/navigation-node-list.js +1 -1
  103. package/dist/m365/spo/commands/navigation/navigation-node-remove.js +13 -47
  104. package/dist/m365/spo/commands/navigation/navigation-node-set.js +2 -2
  105. package/dist/m365/spo/commands/orgassetslibrary/orgassetslibrary-add.js +15 -49
  106. package/dist/m365/spo/commands/orgassetslibrary/orgassetslibrary-list.js +6 -1
  107. package/dist/m365/spo/commands/orgassetslibrary/orgassetslibrary-remove.js +9 -17
  108. package/dist/m365/spo/commands/orgnewssite/orgnewssite-list.js +5 -0
  109. package/dist/m365/spo/commands/orgnewssite/orgnewssite-remove.js +11 -27
  110. package/dist/m365/spo/commands/orgnewssite/orgnewssite-set.js +10 -18
  111. package/dist/m365/spo/commands/page/page-column-list.js +7 -8
  112. package/dist/m365/spo/commands/page/page-section-list.js +15 -17
  113. package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-grant-add.js +9 -17
  114. package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-grant-list.js +5 -0
  115. package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-grant-revoke.js +9 -17
  116. package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-permissionrequest-approve.js +29 -39
  117. package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-permissionrequest-deny.js +10 -23
  118. package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-permissionrequest-list.js +5 -0
  119. package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-set.js +19 -28
  120. package/dist/m365/spo/commands/sitedesign/sitedesign-add.js +24 -59
  121. package/dist/m365/spo/commands/sitedesign/sitedesign-apply.js +10 -34
  122. package/dist/m365/spo/commands/sitedesign/sitedesign-get.js +19 -36
  123. package/dist/m365/spo/commands/sitedesign/sitedesign-list.js +8 -0
  124. package/dist/m365/spo/commands/sitedesign/sitedesign-remove.js +9 -32
  125. package/dist/m365/spo/commands/sitedesign/sitedesign-rights-grant.js +10 -31
  126. package/dist/m365/spo/commands/sitedesign/sitedesign-rights-list.js +8 -23
  127. package/dist/m365/spo/commands/sitedesign/sitedesign-rights-revoke.js +10 -34
  128. package/dist/m365/spo/commands/sitedesign/sitedesign-run-list.js +9 -38
  129. package/dist/m365/spo/commands/sitedesign/sitedesign-run-status-get.js +9 -29
  130. package/dist/m365/spo/commands/sitedesign/sitedesign-set.js +27 -80
  131. package/dist/m365/spo/commands/sitedesign/sitedesign-task-get.js +8 -23
  132. package/dist/m365/spo/commands/sitedesign/sitedesign-task-list.js +8 -18
  133. package/dist/m365/spo/commands/sitedesign/sitedesign-task-remove.js +9 -32
  134. package/dist/m365/spo/commands/spo-search.js +43 -116
  135. package/dist/m365/spo/commands/tenant/tenant-appcatalog-add.js +15 -46
  136. package/dist/m365/spo/commands/tenant/tenant-appcatalogurl-get.js +5 -0
  137. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-add.js +20 -57
  138. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-get.js +25 -49
  139. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-list.js +5 -1
  140. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-remove.js +25 -49
  141. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-set.js +47 -79
  142. package/dist/m365/spo/commands/tenant/tenant-commandset-add.js +23 -54
  143. package/dist/m365/spo/commands/tenant/tenant-commandset-get.js +25 -50
  144. package/dist/m365/spo/commands/tenant/tenant-commandset-list.js +5 -1
  145. package/dist/m365/spo/commands/tenant/tenant-commandset-remove.js +25 -49
  146. package/dist/m365/spo/commands/tenant/tenant-commandset-set.js +41 -65
  147. package/dist/m365/spo/commands/tenant/tenant-recyclebinitem-list.js +5 -0
  148. package/dist/m365/spo/commands/tenant/tenant-recyclebinitem-remove.js +10 -30
  149. package/dist/m365/spo/commands/tenant/tenant-recyclebinitem-restore.js +8 -21
  150. package/dist/m365/spo/commands/tenant/tenant-settings-list.js +5 -0
  151. package/dist/m365/spo/commands/tenant/tenant-settings-set.js +104 -386
  152. package/dist/m365/spo/commands/term/term-add.js +95 -110
  153. package/dist/m365/spo/commands/term/term-get.js +63 -75
  154. package/dist/m365/spo/commands/term/term-group-add.js +11 -41
  155. package/dist/m365/spo/commands/term/term-group-get.js +16 -47
  156. package/dist/m365/spo/commands/term/term-group-list.js +16 -42
  157. package/dist/m365/spo/commands/term/term-list.js +42 -57
  158. package/dist/m365/spo/commands/term/term-set-add.js +50 -71
  159. package/dist/m365/spo/commands/term/term-set-get.js +41 -58
  160. package/dist/m365/spo/commands/term/term-set-list.js +22 -56
  161. package/dist/m365/spo/commands/theme/theme-apply.js +27 -43
  162. package/dist/m365/spo/commands/theme/theme-get.js +8 -15
  163. package/dist/m365/spo/commands/theme/theme-list.js +5 -0
  164. package/dist/m365/spo/commands/theme/theme-remove.js +9 -24
  165. package/dist/m365/spo/commands/theme/theme-set.js +12 -34
  166. package/dist/m365/teams/commands/app/app-install.js +35 -44
  167. package/dist/m365/teams/commands/app/app-list.js +8 -33
  168. package/dist/m365/teams/commands/app/app-publish.js +21 -27
  169. package/dist/m365/teams/commands/app/app-remove.js +22 -39
  170. package/dist/m365/teams/commands/app/app-uninstall.js +12 -34
  171. package/dist/m365/teams/commands/app/app-update.js +35 -45
  172. package/dist/m365/teams/commands/funsettings/funsettings-list.js +12 -23
  173. package/dist/m365/teams/commands/funsettings/funsettings-set.js +18 -54
  174. package/dist/m365/teams/commands/guestsettings/guestsettings-list.js +12 -23
  175. package/dist/m365/teams/commands/guestsettings/guestsettings-set.js +15 -40
  176. package/dist/m365/teams/commands/meeting/meeting-add.js +57 -68
  177. package/dist/m365/teams/commands/meeting/meeting-attendancereport-get.js +33 -58
  178. package/dist/m365/teams/commands/meeting/meeting-attendancereport-list.js +14 -38
  179. package/dist/m365/teams/commands/meeting/meeting-get.js +14 -38
  180. package/dist/m365/teams/commands/meeting/meeting-list.js +34 -59
  181. package/dist/m365/teams/commands/meeting/meeting-transcript-get.js +34 -58
  182. package/dist/m365/teams/commands/meeting/meeting-transcript-list.js +29 -50
  183. package/dist/m365/teams/commands/membersettings/membersettings-list.js +12 -23
  184. package/dist/m365/teams/commands/membersettings/membersettings-set.js +18 -49
  185. package/dist/m365/teams/commands/message/message-get.js +19 -30
  186. package/dist/m365/teams/commands/message/message-list.js +26 -43
  187. package/dist/m365/teams/commands/message/message-remove.js +43 -58
  188. package/dist/m365/teams/commands/message/message-reply-list.js +19 -30
  189. package/dist/m365/teams/commands/message/message-restore.js +40 -50
  190. package/dist/m365/teams/commands/message/message-send.js +19 -30
  191. package/dist/m365/teams/commands/messagingsettings/messagingsettings-list.js +12 -23
  192. package/dist/m365/teams/commands/messagingsettings/messagingsettings-set.js +18 -60
  193. package/dist/m365/teams/commands/report/report-deviceusagedistributionusercounts.js +10 -0
  194. package/dist/m365/teams/commands/report/report-deviceusageusercounts.js +10 -0
  195. package/dist/m365/teams/commands/report/report-deviceusageuserdetail.js +22 -0
  196. package/dist/m365/teams/commands/report/report-directroutingcalls.js +19 -39
  197. package/dist/m365/teams/commands/report/report-pstncalls.js +19 -39
  198. package/dist/m365/teams/commands/report/report-useractivitycounts.js +10 -0
  199. package/dist/m365/teams/commands/report/report-useractivityusercounts.js +10 -0
  200. package/dist/m365/teams/commands/report/report-useractivityuserdetail.js +22 -0
  201. package/dist/m365/teams/commands/tab/tab-add.js +23 -49
  202. package/dist/m365/teams/commands/tab/tab-get.js +55 -56
  203. package/dist/m365/teams/commands/tab/tab-list.js +17 -28
  204. package/dist/m365/teams/commands/tab/tab-remove.js +23 -42
  205. package/dist/m365/teams/commands/team/team-add.js +76 -114
  206. package/dist/m365/teams/commands/team/team-app-list.js +23 -36
  207. package/dist/m365/teams/commands/team/team-archive.js +24 -39
  208. package/dist/m365/teams/commands/team/team-clone.js +28 -62
  209. package/dist/m365/teams/commands/team/team-get.js +23 -36
  210. package/dist/m365/teams/commands/team/team-list.js +43 -57
  211. package/dist/m365/teams/commands/team/team-remove.js +24 -37
  212. package/dist/m365/teams/commands/team/team-set.js +23 -52
  213. package/dist/m365/teams/commands/team/team-unarchive.js +23 -28
  214. package/dist/m365/teams/commands/user/user-app-add.js +40 -49
  215. package/dist/m365/teams/commands/user/user-app-list.js +26 -39
  216. package/dist/m365/teams/commands/user/user-app-remove.js +37 -49
  217. package/dist/m365/teams/commands/user/user-app-upgrade.js +36 -52
  218. package/dist/m365/teams/commands/user/user-list.js +17 -39
  219. package/dist/m365/tenant/commands/id/id-get.js +8 -22
  220. package/dist/m365/tenant/commands/info/info-get.js +23 -36
  221. package/dist/m365/tenant/commands/people/people-profilecardproperty-add.js +67 -55
  222. package/dist/m365/tenant/commands/people/people-profilecardproperty-get.js +11 -24
  223. package/dist/m365/tenant/commands/people/people-profilecardproperty-list.js +5 -0
  224. package/dist/m365/tenant/commands/people/people-profilecardproperty-remove.js +12 -33
  225. package/dist/m365/tenant/commands/people/people-profilecardproperty-set.js +31 -51
  226. package/dist/m365/tenant/commands/people/people-pronouns-get.js +5 -0
  227. package/dist/m365/tenant/commands/people/profileCardProperties.js +10 -7
  228. package/dist/m365/tenant/commands/report/report-activeusercounts.js +2 -1
  229. package/dist/m365/tenant/commands/report/report-activeuserdetail.js +2 -1
  230. package/dist/m365/tenant/commands/report/report-office365activationcounts.js +9 -0
  231. package/dist/m365/tenant/commands/report/report-office365activationsusercounts.js +9 -0
  232. package/dist/m365/tenant/commands/report/report-office365activationsuserdetail.js +9 -0
  233. package/dist/m365/tenant/commands/report/report-servicesusercounts.js +2 -1
  234. package/dist/m365/tenant/commands/report/report-settings-get.js +5 -0
  235. package/dist/m365/tenant/commands/security/security-alerts-list.js +8 -20
  236. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-health-get.js +9 -20
  237. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-health-list.js +8 -20
  238. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-healthissue-get.js +8 -15
  239. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-healthissue-list.js +8 -15
  240. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-message-get.js +12 -26
  241. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-message-list.js +8 -22
  242. package/dist/utils/calendar.js +1 -1
  243. package/dist/utils/formatting.js +16 -0
  244. package/dist/utils/pid.js +7 -16
  245. package/dist/utils/spe.js +1 -1
  246. package/dist/utils/validation.js +36 -0
  247. package/dist/utils/zod.js +18 -7
  248. package/docs/docs/cmd/entra/agent/agent-blueprint-list.mdx +175 -0
  249. package/docs/docs/cmd/entra/agent/agent-blueprintprincipal-list.mdx +156 -0
  250. package/docs/docs/cmd/outlook/calendargroup/calendargroup-add.mdx +126 -0
  251. package/docs/docs/cmd/outlook/event/event-add.mdx +390 -0
  252. package/docs/docs/cmd/spe/container/container-add.mdx +0 -8
  253. package/docs/docs/cmd/spe/container/container-list.mdx +0 -8
  254. package/docs/docs/cmd/spe/container/container-permission-add.mdx +140 -0
  255. package/docs/docs/cmd/spe/container/container-permission-remove.mdx +78 -0
  256. package/docs/docs/cmd/spe/container/container-permission-set.mdx +78 -0
  257. package/docs/docs/cmd/spe/container/container-recyclebinitem-list.mdx +0 -8
  258. package/docs/docs/cmd/spe/container/container-recyclebinitem-restore.mdx +0 -8
  259. package/docs/docs/cmd/spe/container/container-remove.mdx +0 -8
  260. package/docs/docs/cmd/spe/containertype/containertype-add.mdx +1 -1
  261. package/docs/docs/cmd/spfx/project/project-upgrade.mdx +1 -1
  262. package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-set.mdx +1 -1
  263. package/docs/docs/cmd/spo/externaluser/externaluser-list.mdx +17 -30
  264. package/docs/docs/cmd/spo/orgassetslibrary/orgassetslibrary-list.mdx +0 -21
  265. package/package.json +1 -1
@@ -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 _SpoListItemRecordUnlockCommand_instances, _SpoListItemRecordUnlockCommand_initTelemetry, _SpoListItemRecordUnlockCommand_initOptions, _SpoListItemRecordUnlockCommand_initValidators, _SpoListItemRecordUnlockCommand_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(webUrl => validation.isValidSharePointUrl(webUrl) === true, {
13
+ error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
14
+ })
15
+ .alias('u'),
16
+ listId: z.string()
17
+ .refine(listId => validation.isValidGuid(listId), {
18
+ error: e => `${e.input} is not a valid GUID`
19
+ })
20
+ .optional(),
21
+ listTitle: z.string().optional(),
22
+ listUrl: z.string().optional(),
23
+ listItemId: z.number().int().positive()
24
+ });
13
25
  class SpoListItemRecordUnlockCommand extends SpoCommand {
14
26
  get name() {
15
27
  return commands.LISTITEM_RECORD_UNLOCK;
@@ -17,13 +29,18 @@ class SpoListItemRecordUnlockCommand extends SpoCommand {
17
29
  get description() {
18
30
  return 'Unlocks the list item record';
19
31
  }
20
- constructor() {
21
- super();
22
- _SpoListItemRecordUnlockCommand_instances.add(this);
23
- __classPrivateFieldGet(this, _SpoListItemRecordUnlockCommand_instances, "m", _SpoListItemRecordUnlockCommand_initTelemetry).call(this);
24
- __classPrivateFieldGet(this, _SpoListItemRecordUnlockCommand_instances, "m", _SpoListItemRecordUnlockCommand_initOptions).call(this);
25
- __classPrivateFieldGet(this, _SpoListItemRecordUnlockCommand_instances, "m", _SpoListItemRecordUnlockCommand_initValidators).call(this);
26
- __classPrivateFieldGet(this, _SpoListItemRecordUnlockCommand_instances, "m", _SpoListItemRecordUnlockCommand_initOptionSets).call(this);
32
+ get schema() {
33
+ return options;
34
+ }
35
+ getRefinedSchema(schema) {
36
+ return schema
37
+ .refine(opts => [opts.listId, opts.listTitle, opts.listUrl].filter(o => o !== undefined).length === 1, {
38
+ error: 'Specify one of the following options: listId, listTitle, listUrl.',
39
+ params: {
40
+ customCode: 'optionSet',
41
+ options: ['listId', 'listTitle', 'listUrl']
42
+ }
43
+ });
27
44
  }
28
45
  async commandAction(logger, args) {
29
46
  if (this.verbose) {
@@ -73,44 +90,5 @@ class SpoListItemRecordUnlockCommand extends SpoCommand {
73
90
  }
74
91
  }
75
92
  }
76
- _SpoListItemRecordUnlockCommand_instances = new WeakSet(), _SpoListItemRecordUnlockCommand_initTelemetry = function _SpoListItemRecordUnlockCommand_initTelemetry() {
77
- this.telemetry.push((args) => {
78
- Object.assign(this.telemetryProperties, {
79
- listId: typeof args.options.listId !== 'undefined',
80
- listTitle: typeof args.options.listTitle !== 'undefined',
81
- listUrl: typeof args.options.listUrl !== 'undefined'
82
- });
83
- });
84
- }, _SpoListItemRecordUnlockCommand_initOptions = function _SpoListItemRecordUnlockCommand_initOptions() {
85
- this.options.unshift({
86
- option: '-u, --webUrl <webUrl>'
87
- }, {
88
- option: '--listItemId <listItemId>'
89
- }, {
90
- option: '--listId [listId]'
91
- }, {
92
- option: '--listTitle [listTitle]'
93
- }, {
94
- option: '--listUrl [listUrl]'
95
- });
96
- }, _SpoListItemRecordUnlockCommand_initValidators = function _SpoListItemRecordUnlockCommand_initValidators() {
97
- this.validators.push(async (args) => {
98
- const id = parseInt(args.options.listItemId);
99
- if (isNaN(id)) {
100
- return `${args.options.listItemId} is not a valid list item ID`;
101
- }
102
- const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
103
- if (isValidSharePointUrl !== true) {
104
- return isValidSharePointUrl;
105
- }
106
- if (args.options.listId &&
107
- !validation.isValidGuid(args.options.listId)) {
108
- return `${args.options.listId} is not a valid GUID`;
109
- }
110
- return true;
111
- });
112
- }, _SpoListItemRecordUnlockCommand_initOptionSets = function _SpoListItemRecordUnlockCommand_initOptionSets() {
113
- this.optionSets.push({ options: ['listId', 'listTitle', 'listUrl'] });
114
- };
115
93
  export default new SpoListItemRecordUnlockCommand();
116
94
  //# sourceMappingURL=listitem-record-unlock.js.map
@@ -1,16 +1,31 @@
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 _SpoListItemRemoveCommand_instances, _SpoListItemRemoveCommand_initTelemetry, _SpoListItemRemoveCommand_initOptions, _SpoListItemRemoveCommand_initValidators, _SpoListItemRemoveCommand_initOptionSets, _SpoListItemRemoveCommand_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 { urlUtil } from '../../../../utils/urlUtil.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
+ webUrl: z.string()
13
+ .refine(url => validation.isValidSharePointUrl(url) === true, {
14
+ error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
15
+ })
16
+ .alias('u'),
17
+ id: z.number().alias('i'),
18
+ listId: z.string()
19
+ .refine(id => validation.isValidGuid(id), {
20
+ error: e => `${e.input} is not a valid GUID`
21
+ })
22
+ .optional()
23
+ .alias('l'),
24
+ listTitle: z.string().optional().alias('t'),
25
+ listUrl: z.string().optional(),
26
+ permanent: z.boolean().optional(),
27
+ force: z.boolean().optional().alias('f')
28
+ });
14
29
  class SpoListItemRemoveCommand extends SpoCommand {
15
30
  get name() {
16
31
  return commands.LISTITEM_REMOVE;
@@ -18,14 +33,18 @@ class SpoListItemRemoveCommand extends SpoCommand {
18
33
  get description() {
19
34
  return 'Removes the specified list item';
20
35
  }
21
- constructor() {
22
- super();
23
- _SpoListItemRemoveCommand_instances.add(this);
24
- __classPrivateFieldGet(this, _SpoListItemRemoveCommand_instances, "m", _SpoListItemRemoveCommand_initTelemetry).call(this);
25
- __classPrivateFieldGet(this, _SpoListItemRemoveCommand_instances, "m", _SpoListItemRemoveCommand_initOptions).call(this);
26
- __classPrivateFieldGet(this, _SpoListItemRemoveCommand_instances, "m", _SpoListItemRemoveCommand_initValidators).call(this);
27
- __classPrivateFieldGet(this, _SpoListItemRemoveCommand_instances, "m", _SpoListItemRemoveCommand_initOptionSets).call(this);
28
- __classPrivateFieldGet(this, _SpoListItemRemoveCommand_instances, "m", _SpoListItemRemoveCommand_initTypes).call(this);
36
+ get schema() {
37
+ return options;
38
+ }
39
+ getRefinedSchema(schema) {
40
+ return schema
41
+ .refine(opts => [opts.listId, opts.listTitle, opts.listUrl].filter(o => o !== undefined).length === 1, {
42
+ error: 'Specify either listId, listTitle or listUrl.',
43
+ params: {
44
+ customCode: 'optionSet',
45
+ options: ['listId', 'listTitle', 'listUrl']
46
+ }
47
+ });
29
48
  }
30
49
  async commandAction(logger, args) {
31
50
  const removeListItem = async () => {
@@ -76,52 +95,5 @@ class SpoListItemRemoveCommand extends SpoCommand {
76
95
  }
77
96
  }
78
97
  }
79
- _SpoListItemRemoveCommand_instances = new WeakSet(), _SpoListItemRemoveCommand_initTelemetry = function _SpoListItemRemoveCommand_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
- permanent: !!args.options.permanent,
86
- force: !!args.options.force
87
- });
88
- });
89
- }, _SpoListItemRemoveCommand_initOptions = function _SpoListItemRemoveCommand_initOptions() {
90
- this.options.unshift({
91
- option: '-u, --webUrl <webUrl>'
92
- }, {
93
- option: '-i, --id <id>'
94
- }, {
95
- option: '-l, --listId [listId]'
96
- }, {
97
- option: '-t, --listTitle [listTitle]'
98
- }, {
99
- option: '--listUrl [listUrl]'
100
- }, {
101
- option: '--permanent'
102
- }, {
103
- option: '-f, --force'
104
- });
105
- }, _SpoListItemRemoveCommand_initValidators = function _SpoListItemRemoveCommand_initValidators() {
106
- this.validators.push(async (args) => {
107
- const id = parseInt(args.options.id);
108
- if (isNaN(id)) {
109
- return `${args.options.id} is not a valid list item ID`;
110
- }
111
- const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
112
- if (isValidSharePointUrl !== true) {
113
- return isValidSharePointUrl;
114
- }
115
- if (args.options.listId &&
116
- !validation.isValidGuid(args.options.listId)) {
117
- return `${args.options.listId} is not a valid GUID`;
118
- }
119
- return true;
120
- });
121
- }, _SpoListItemRemoveCommand_initOptionSets = function _SpoListItemRemoveCommand_initOptionSets() {
122
- this.optionSets.push({ options: ['listId', 'listTitle', 'listUrl'] });
123
- }, _SpoListItemRemoveCommand_initTypes = function _SpoListItemRemoveCommand_initTypes() {
124
- this.types.boolean.push('permanent', 'force');
125
- };
126
98
  export default new SpoListItemRemoveCommand();
127
99
  //# sourceMappingURL=listitem-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 _SpoListItemRetentionLabelEnsureCommand_instances, _SpoListItemRetentionLabelEnsureCommand_initTelemetry, _SpoListItemRetentionLabelEnsureCommand_initOptions, _SpoListItemRetentionLabelEnsureCommand_initValidators, _SpoListItemRetentionLabelEnsureCommand_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';
@@ -12,6 +8,30 @@ import SpoCommand from '../../../base/SpoCommand.js';
12
8
  import commands from '../../commands.js';
13
9
  import { spo } from '../../../../utils/spo.js';
14
10
  import { odata } from '../../../../utils/odata.js';
11
+ export const options = z.strictObject({
12
+ ...globalOptionsZod.shape,
13
+ webUrl: z.string()
14
+ .refine(url => validation.isValidSharePointUrl(url) === true, {
15
+ error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
16
+ })
17
+ .alias('u'),
18
+ listItemId: z.number(),
19
+ listId: z.string()
20
+ .refine(id => validation.isValidGuid(id), {
21
+ error: e => `${e.input} is not a valid GUID`
22
+ })
23
+ .optional(),
24
+ listTitle: z.string().optional(),
25
+ listUrl: z.string().optional(),
26
+ name: z.string().optional().alias('n'),
27
+ id: z.string()
28
+ .refine(id => validation.isValidGuid(id), {
29
+ error: e => `${e.input} is not a valid GUID`
30
+ })
31
+ .optional()
32
+ .alias('i'),
33
+ assetId: z.string().optional().alias('a')
34
+ });
15
35
  class SpoListItemRetentionLabelEnsureCommand extends SpoCommand {
16
36
  get name() {
17
37
  return commands.LISTITEM_RETENTIONLABEL_ENSURE;
@@ -19,13 +39,25 @@ class SpoListItemRetentionLabelEnsureCommand extends SpoCommand {
19
39
  get description() {
20
40
  return 'Applies a retention label to a list item';
21
41
  }
22
- constructor() {
23
- super();
24
- _SpoListItemRetentionLabelEnsureCommand_instances.add(this);
25
- __classPrivateFieldGet(this, _SpoListItemRetentionLabelEnsureCommand_instances, "m", _SpoListItemRetentionLabelEnsureCommand_initTelemetry).call(this);
26
- __classPrivateFieldGet(this, _SpoListItemRetentionLabelEnsureCommand_instances, "m", _SpoListItemRetentionLabelEnsureCommand_initOptions).call(this);
27
- __classPrivateFieldGet(this, _SpoListItemRetentionLabelEnsureCommand_instances, "m", _SpoListItemRetentionLabelEnsureCommand_initValidators).call(this);
28
- __classPrivateFieldGet(this, _SpoListItemRetentionLabelEnsureCommand_instances, "m", _SpoListItemRetentionLabelEnsureCommand_initOptionSets).call(this);
42
+ get schema() {
43
+ return options;
44
+ }
45
+ getRefinedSchema(schema) {
46
+ return schema
47
+ .refine(opts => [opts.listId, opts.listTitle, opts.listUrl].filter(o => o !== undefined).length === 1, {
48
+ error: 'Specify either listId, listTitle or listUrl.',
49
+ params: {
50
+ customCode: 'optionSet',
51
+ options: ['listId', 'listTitle', 'listUrl']
52
+ }
53
+ })
54
+ .refine(opts => [opts.name, opts.id].filter(o => o !== undefined).length === 1, {
55
+ error: 'Specify either name or id.',
56
+ params: {
57
+ customCode: 'optionSet',
58
+ options: ['name', 'id']
59
+ }
60
+ });
29
61
  }
30
62
  async commandAction(logger, args) {
31
63
  try {
@@ -34,7 +66,7 @@ class SpoListItemRetentionLabelEnsureCommand extends SpoCommand {
34
66
  if (args.options.assetId) {
35
67
  await this.applyAssetId(args.options, logger);
36
68
  }
37
- await spo.applyRetentionLabelToListItems(args.options.webUrl, labelName, listAbsoluteUrl, [parseInt(args.options.listItemId)], logger, args.options.verbose);
69
+ await spo.applyRetentionLabelToListItems(args.options.webUrl, labelName, listAbsoluteUrl, [args.options.listItemId], logger, args.options.verbose);
38
70
  }
39
71
  catch (err) {
40
72
  this.handleRejectedODataJsonPromise(err);
@@ -117,58 +149,5 @@ class SpoListItemRetentionLabelEnsureCommand extends SpoCommand {
117
149
  await request.post(requestOptions);
118
150
  }
119
151
  }
120
- _SpoListItemRetentionLabelEnsureCommand_instances = new WeakSet(), _SpoListItemRetentionLabelEnsureCommand_initTelemetry = function _SpoListItemRetentionLabelEnsureCommand_initTelemetry() {
121
- this.telemetry.push((args) => {
122
- Object.assign(this.telemetryProperties, {
123
- listId: typeof args.options.listId !== 'undefined',
124
- listTitle: typeof args.options.listTitle !== 'undefined',
125
- listUrl: typeof args.options.listUrl !== 'undefined',
126
- name: typeof args.options.name !== 'undefined',
127
- id: typeof args.options.id !== 'undefined',
128
- assetId: typeof args.options.assetId !== 'undefined'
129
- });
130
- });
131
- }, _SpoListItemRetentionLabelEnsureCommand_initOptions = function _SpoListItemRetentionLabelEnsureCommand_initOptions() {
132
- this.options.unshift({
133
- option: '-u, --webUrl <webUrl>'
134
- }, {
135
- option: '--listItemId <listItemId>'
136
- }, {
137
- option: '--listId [listId]'
138
- }, {
139
- option: '--listTitle [listTitle]'
140
- }, {
141
- option: '--listUrl [listUrl]'
142
- }, {
143
- option: '-n, --name [name]'
144
- }, {
145
- option: '-i, --id [id]'
146
- }, {
147
- option: '-a, --assetId [assetId]'
148
- });
149
- }, _SpoListItemRetentionLabelEnsureCommand_initValidators = function _SpoListItemRetentionLabelEnsureCommand_initValidators() {
150
- this.validators.push(async (args) => {
151
- const id = parseInt(args.options.listItemId);
152
- if (isNaN(id)) {
153
- return `${args.options.listItemId} is not a valid list item ID`;
154
- }
155
- const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
156
- if (isValidSharePointUrl !== true) {
157
- return isValidSharePointUrl;
158
- }
159
- if (args.options.listId &&
160
- !validation.isValidGuid(args.options.listId)) {
161
- return `${args.options.listId} is not a valid GUID`;
162
- }
163
- if (args.options.id &&
164
- !validation.isValidGuid(args.options.id)) {
165
- return `${args.options.id} is not a valid GUID`;
166
- }
167
- return true;
168
- });
169
- }, _SpoListItemRetentionLabelEnsureCommand_initOptionSets = function _SpoListItemRetentionLabelEnsureCommand_initOptionSets() {
170
- this.optionSets.push({ options: ['listId', 'listTitle', 'listUrl'] });
171
- this.optionSets.push({ options: ['name', 'id'] });
172
- };
173
152
  export default new SpoListItemRetentionLabelEnsureCommand();
174
153
  //# sourceMappingURL=listitem-retentionlabel-ensure.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 _SpoListItemRetentionLabelRemoveCommand_instances, _SpoListItemRetentionLabelRemoveCommand_initTelemetry, _SpoListItemRetentionLabelRemoveCommand_initOptions, _SpoListItemRetentionLabelRemoveCommand_initValidators, _SpoListItemRetentionLabelRemoveCommand_initOptionSets;
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 { urlUtil } from '../../../../utils/urlUtil.js';
@@ -12,6 +8,24 @@ import { validation } from '../../../../utils/validation.js';
12
8
  import SpoCommand from '../../../base/SpoCommand.js';
13
9
  import commands from '../../commands.js';
14
10
  import { spo } from '../../../../utils/spo.js';
11
+ export const options = z.strictObject({
12
+ ...globalOptionsZod.shape,
13
+ webUrl: z.string()
14
+ .refine(url => validation.isValidSharePointUrl(url) === true, {
15
+ error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
16
+ })
17
+ .alias('u'),
18
+ listItemId: z.number().alias('i'),
19
+ listId: z.string()
20
+ .refine(id => validation.isValidGuid(id), {
21
+ error: e => `${e.input} is not a valid GUID`
22
+ })
23
+ .optional()
24
+ .alias('l'),
25
+ listTitle: z.string().optional().alias('t'),
26
+ listUrl: z.string().optional(),
27
+ force: z.boolean().optional().alias('f')
28
+ });
15
29
  class SpoListItemRetentionLabelRemoveCommand extends SpoCommand {
16
30
  get name() {
17
31
  return commands.LISTITEM_RETENTIONLABEL_REMOVE;
@@ -19,13 +33,18 @@ class SpoListItemRetentionLabelRemoveCommand extends SpoCommand {
19
33
  get description() {
20
34
  return 'Clears the retention label from a list item';
21
35
  }
22
- constructor() {
23
- super();
24
- _SpoListItemRetentionLabelRemoveCommand_instances.add(this);
25
- __classPrivateFieldGet(this, _SpoListItemRetentionLabelRemoveCommand_instances, "m", _SpoListItemRetentionLabelRemoveCommand_initTelemetry).call(this);
26
- __classPrivateFieldGet(this, _SpoListItemRetentionLabelRemoveCommand_instances, "m", _SpoListItemRetentionLabelRemoveCommand_initOptions).call(this);
27
- __classPrivateFieldGet(this, _SpoListItemRetentionLabelRemoveCommand_instances, "m", _SpoListItemRetentionLabelRemoveCommand_initValidators).call(this);
28
- __classPrivateFieldGet(this, _SpoListItemRetentionLabelRemoveCommand_instances, "m", _SpoListItemRetentionLabelRemoveCommand_initOptionSets).call(this);
36
+ get schema() {
37
+ return options;
38
+ }
39
+ getRefinedSchema(schema) {
40
+ return schema
41
+ .refine(opts => [opts.listId, opts.listTitle, opts.listUrl].filter(o => o !== undefined).length === 1, {
42
+ error: 'Specify either listId, listTitle or listUrl.',
43
+ params: {
44
+ customCode: 'optionSet',
45
+ options: ['listId', 'listTitle', 'listUrl']
46
+ }
47
+ });
29
48
  }
30
49
  async commandAction(logger, args) {
31
50
  if (args.options.force) {
@@ -41,7 +60,7 @@ class SpoListItemRetentionLabelRemoveCommand extends SpoCommand {
41
60
  async removeListItemRetentionLabel(logger, args) {
42
61
  try {
43
62
  const listAbsoluteUrl = await this.getListAbsoluteUrl(args.options, logger);
44
- await spo.removeRetentionLabelFromListItems(args.options.webUrl, listAbsoluteUrl, [parseInt(args.options.listItemId)], logger, args.options.verbose);
63
+ await spo.removeRetentionLabelFromListItems(args.options.webUrl, listAbsoluteUrl, [args.options.listItemId], logger, args.options.verbose);
45
64
  }
46
65
  catch (err) {
47
66
  this.handleRejectedODataJsonPromise(err);
@@ -80,47 +99,5 @@ class SpoListItemRetentionLabelRemoveCommand extends SpoCommand {
80
99
  return listAbsoluteUrl;
81
100
  }
82
101
  }
83
- _SpoListItemRetentionLabelRemoveCommand_instances = new WeakSet(), _SpoListItemRetentionLabelRemoveCommand_initTelemetry = function _SpoListItemRetentionLabelRemoveCommand_initTelemetry() {
84
- this.telemetry.push((args) => {
85
- Object.assign(this.telemetryProperties, {
86
- listId: typeof args.options.listId !== 'undefined',
87
- listTitle: typeof args.options.listTitle !== 'undefined',
88
- listUrl: typeof args.options.listUrl !== 'undefined',
89
- force: !!args.options.force
90
- });
91
- });
92
- }, _SpoListItemRetentionLabelRemoveCommand_initOptions = function _SpoListItemRetentionLabelRemoveCommand_initOptions() {
93
- this.options.unshift({
94
- option: '-u, --webUrl <webUrl>'
95
- }, {
96
- option: '-i, --listItemId <listItemId>'
97
- }, {
98
- option: '-l, --listId [listId]'
99
- }, {
100
- option: '-t, --listTitle [listTitle]'
101
- }, {
102
- option: '--listUrl [listUrl]'
103
- }, {
104
- option: '-f, --force'
105
- });
106
- }, _SpoListItemRetentionLabelRemoveCommand_initValidators = function _SpoListItemRetentionLabelRemoveCommand_initValidators() {
107
- this.validators.push(async (args) => {
108
- const id = parseInt(args.options.listItemId);
109
- if (isNaN(id)) {
110
- return `${args.options.listItemId} is not a valid list item ID`;
111
- }
112
- const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
113
- if (isValidSharePointUrl !== true) {
114
- return isValidSharePointUrl;
115
- }
116
- if (args.options.listId &&
117
- !validation.isValidGuid(args.options.listId)) {
118
- return `${args.options.listId} is not a valid GUID`;
119
- }
120
- return true;
121
- });
122
- }, _SpoListItemRetentionLabelRemoveCommand_initOptionSets = function _SpoListItemRetentionLabelRemoveCommand_initOptionSets() {
123
- this.optionSets.push({ options: ['listId', 'listTitle', 'listUrl'] });
124
- };
125
102
  export default new SpoListItemRetentionLabelRemoveCommand();
126
103
  //# sourceMappingURL=listitem-retentionlabel-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 _SpoListItemRoleAssignmentAddCommand_instances, _SpoListItemRoleAssignmentAddCommand_initTelemetry, _SpoListItemRoleAssignmentAddCommand_initOptions, _SpoListItemRoleAssignmentAddCommand_initValidators;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
7
3
  import request from '../../../../request.js';
8
4
  import { entraGroup } from '../../../../utils/entraGroup.js';
9
5
  import { formatting } from '../../../../utils/formatting.js';
@@ -12,6 +8,33 @@ import { validation } from '../../../../utils/validation.js';
12
8
  import SpoCommand from '../../../base/SpoCommand.js';
13
9
  import commands from '../../commands.js';
14
10
  import { spo } from '../../../../utils/spo.js';
11
+ export const options = z.strictObject({
12
+ ...globalOptionsZod.shape,
13
+ webUrl: z.string()
14
+ .refine(url => validation.isValidSharePointUrl(url) === true, {
15
+ error: e => `'${e.input}' is not a valid SharePoint Online site URL.`
16
+ })
17
+ .alias('u'),
18
+ listItemId: z.number(),
19
+ listId: z.string()
20
+ .refine(id => validation.isValidGuid(id), {
21
+ error: e => `${e.input} is not a valid GUID`
22
+ })
23
+ .optional(),
24
+ listTitle: z.string().optional(),
25
+ listUrl: z.string().optional(),
26
+ principalId: z.number().optional(),
27
+ upn: z.string().optional(),
28
+ groupName: z.string().optional(),
29
+ entraGroupId: z.string()
30
+ .refine(id => validation.isValidGuid(id), {
31
+ error: e => `'${e.input}' is not a valid GUID for option entraGroupId.`
32
+ })
33
+ .optional(),
34
+ entraGroupName: z.string().optional(),
35
+ roleDefinitionId: z.number().optional(),
36
+ roleDefinitionName: z.string().optional()
37
+ });
15
38
  class SpoListItemRoleAssignmentAddCommand extends SpoCommand {
16
39
  get name() {
17
40
  return commands.LISTITEM_ROLEASSIGNMENT_ADD;
@@ -19,12 +42,32 @@ class SpoListItemRoleAssignmentAddCommand extends SpoCommand {
19
42
  get description() {
20
43
  return 'Adds a role assignment to a listitem.';
21
44
  }
22
- constructor() {
23
- super();
24
- _SpoListItemRoleAssignmentAddCommand_instances.add(this);
25
- __classPrivateFieldGet(this, _SpoListItemRoleAssignmentAddCommand_instances, "m", _SpoListItemRoleAssignmentAddCommand_initTelemetry).call(this);
26
- __classPrivateFieldGet(this, _SpoListItemRoleAssignmentAddCommand_instances, "m", _SpoListItemRoleAssignmentAddCommand_initOptions).call(this);
27
- __classPrivateFieldGet(this, _SpoListItemRoleAssignmentAddCommand_instances, "m", _SpoListItemRoleAssignmentAddCommand_initValidators).call(this);
45
+ get schema() {
46
+ return options;
47
+ }
48
+ getRefinedSchema(schema) {
49
+ return schema
50
+ .refine(opts => [opts.listId, opts.listTitle, opts.listUrl].filter(o => o !== undefined).length === 1, {
51
+ error: 'Specify either listId, listTitle or listUrl.',
52
+ params: {
53
+ customCode: 'optionSet',
54
+ options: ['listId', 'listTitle', 'listUrl']
55
+ }
56
+ })
57
+ .refine(opts => [opts.principalId, opts.upn, opts.groupName, opts.entraGroupId, opts.entraGroupName].filter(o => o !== undefined).length === 1, {
58
+ error: 'Specify either principalId, upn, groupName, entraGroupId or entraGroupName.',
59
+ params: {
60
+ customCode: 'optionSet',
61
+ options: ['principalId', 'upn', 'groupName', 'entraGroupId', 'entraGroupName']
62
+ }
63
+ })
64
+ .refine(opts => [opts.roleDefinitionId, opts.roleDefinitionName].filter(o => o !== undefined).length === 1, {
65
+ error: 'Specify either roleDefinitionId or roleDefinitionName.',
66
+ params: {
67
+ customCode: 'optionSet',
68
+ options: ['roleDefinitionId', 'roleDefinitionName']
69
+ }
70
+ });
28
71
  }
29
72
  async commandAction(logger, args) {
30
73
  if (this.verbose) {
@@ -95,91 +138,5 @@ class SpoListItemRoleAssignmentAddCommand extends SpoCommand {
95
138
  return user.Id;
96
139
  }
97
140
  }
98
- _SpoListItemRoleAssignmentAddCommand_instances = new WeakSet(), _SpoListItemRoleAssignmentAddCommand_initTelemetry = function _SpoListItemRoleAssignmentAddCommand_initTelemetry() {
99
- this.telemetry.push((args) => {
100
- Object.assign(this.telemetryProperties, {
101
- listId: typeof args.options.listId !== 'undefined',
102
- listTitle: typeof args.options.listTitle !== 'undefined',
103
- listUrl: typeof args.options.listUrl !== 'undefined',
104
- principalId: typeof args.options.principalId !== 'undefined',
105
- upn: typeof args.options.upn !== 'undefined',
106
- groupName: typeof args.options.groupName !== 'undefined',
107
- entraGroupId: typeof args.options.entraGroupId !== 'undefined',
108
- entraGroupName: typeof args.options.entraGroupName !== 'undefined',
109
- roleDefinitionId: typeof args.options.roleDefinitionId !== 'undefined',
110
- roleDefinitionName: typeof args.options.roleDefinitionName !== 'undefined'
111
- });
112
- });
113
- }, _SpoListItemRoleAssignmentAddCommand_initOptions = function _SpoListItemRoleAssignmentAddCommand_initOptions() {
114
- this.options.unshift({
115
- option: '-u, --webUrl <webUrl>'
116
- }, {
117
- option: '--listItemId <listItemId>'
118
- }, {
119
- option: '--listId [listId]'
120
- }, {
121
- option: '--listTitle [listTitle]'
122
- }, {
123
- option: '--listUrl [listUrl]'
124
- }, {
125
- option: '--principalId [principalId]'
126
- }, {
127
- option: '--upn [upn]'
128
- }, {
129
- option: '--groupName [groupName]'
130
- }, {
131
- option: '--entraGroupId [entraGroupId]'
132
- }, {
133
- option: '--entraGroupName [entraGroupName]'
134
- }, {
135
- option: '--roleDefinitionId [roleDefinitionId]'
136
- }, {
137
- option: '--roleDefinitionName [roleDefinitionName]'
138
- });
139
- }, _SpoListItemRoleAssignmentAddCommand_initValidators = function _SpoListItemRoleAssignmentAddCommand_initValidators() {
140
- this.validators.push(async (args) => {
141
- const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
142
- if (isValidSharePointUrl !== true) {
143
- return isValidSharePointUrl;
144
- }
145
- if (args.options.listId && !validation.isValidGuid(args.options.listId)) {
146
- return `${args.options.listId} is not a valid GUID`;
147
- }
148
- if (args.options.listItemId && isNaN(args.options.listItemId)) {
149
- return `Specified listItemId ${args.options.listItemId} is not a number`;
150
- }
151
- if (args.options.principalId && isNaN(args.options.principalId)) {
152
- return `Specified principalId ${args.options.principalId} is not a number`;
153
- }
154
- if (args.options.roleDefinitionId && isNaN(args.options.roleDefinitionId)) {
155
- return `Specified roleDefinitionId ${args.options.roleDefinitionId} is not a number`;
156
- }
157
- const listOptions = [args.options.listId, args.options.listTitle, args.options.listUrl];
158
- if (listOptions.some(item => item !== undefined) && listOptions.filter(item => item !== undefined).length > 1) {
159
- return `Specify either list id or title or list url`;
160
- }
161
- if (listOptions.filter(item => item !== undefined).length === 0) {
162
- return `Specify at least list id or title or list url`;
163
- }
164
- const principalOptions = [args.options.principalId, args.options.upn, args.options.groupName, args.options.entraGroupId, args.options.entraGroupName];
165
- if (!principalOptions.some(item => item !== undefined)) {
166
- return `Specify either principalId, upn, groupName, entraGroupId or entraGroupName`;
167
- }
168
- if (principalOptions.filter(item => item !== undefined).length > 1) {
169
- return `Specify either principalId, upn, groupName, entraGroupId or entraGroupName but not multiple`;
170
- }
171
- if (args.options.entraGroupId && !validation.isValidGuid(args.options.entraGroupId)) {
172
- return `'${args.options.entraGroupId}' is not a valid GUID for option entraGroupId.`;
173
- }
174
- const roleDefinitionOptions = [args.options.roleDefinitionId, args.options.roleDefinitionName];
175
- if (!roleDefinitionOptions.some(item => item !== undefined)) {
176
- return `Specify either roleDefinitionId or roleDefinitionName`;
177
- }
178
- if (roleDefinitionOptions.filter(item => item !== undefined).length > 1) {
179
- return `Specify either roleDefinitionId or roleDefinitionName but not multiple`;
180
- }
181
- return true;
182
- });
183
- };
184
141
  export default new SpoListItemRoleAssignmentAddCommand();
185
142
  //# sourceMappingURL=listitem-roleassignment-add.js.map