@pnp/cli-microsoft365 6.3.0-beta.fee5cdb → 6.4.0-beta.006c079

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 (283) hide show
  1. package/.devcontainer/Dockerfile +5 -2
  2. package/.eslintrc.js +4 -0
  3. package/Dockerfile +6 -3
  4. package/README.md +12 -1
  5. package/dist/Command.js +1 -0
  6. package/dist/appInsights.js +2 -1
  7. package/dist/cli/Cli.js +70 -2
  8. package/dist/m365/aad/commands/license/license-list.js +41 -0
  9. package/dist/m365/aad/commands/user/user-add.js +223 -0
  10. package/dist/m365/aad/commands/user/user-get.js +3 -0
  11. package/dist/m365/aad/commands/user/user-license-add.js +88 -0
  12. package/dist/m365/aad/commands/user/user-license-list.js +99 -0
  13. package/dist/m365/aad/commands/user/user-license-remove.js +115 -0
  14. package/dist/m365/aad/commands/user/user-recyclebinitem-clear.js +1 -1
  15. package/dist/m365/aad/commands/user/user-recyclebinitem-list.js +41 -0
  16. package/dist/m365/aad/commands/user/user-recyclebinitem-remove.js +92 -0
  17. package/dist/m365/aad/commands/user/user-recyclebinitem-restore.js +70 -0
  18. package/dist/m365/aad/commands/user/user-remove.js +107 -0
  19. package/dist/m365/aad/commands/user/user-set.js +3 -0
  20. package/dist/m365/aad/commands/user/user-signin-list.js +3 -0
  21. package/dist/m365/aad/commands.js +9 -0
  22. package/dist/m365/file/commands/file-list.js +5 -1
  23. package/dist/m365/flow/commands/environment/FlowEnvironmentDetails.js +3 -0
  24. package/dist/m365/flow/commands/environment/environment-get.js +26 -11
  25. package/dist/m365/flow/commands/flow-disable.js +9 -2
  26. package/dist/m365/flow/commands/flow-enable.js +9 -2
  27. package/dist/m365/flow/commands/flow-get.js +9 -2
  28. package/dist/m365/flow/commands/flow-list.js +1 -1
  29. package/dist/m365/flow/commands/flow-remove.js +2 -2
  30. package/dist/m365/flow/commands/owner/owner-ensure.js +147 -0
  31. package/dist/m365/flow/commands/owner/owner-list.js +89 -0
  32. package/dist/m365/flow/commands/owner/owner-remove.js +147 -0
  33. package/dist/m365/flow/commands/run/run-cancel.js +9 -2
  34. package/dist/m365/flow/commands/run/run-list.js +5 -2
  35. package/dist/m365/flow/commands.js +3 -0
  36. package/dist/m365/planner/commands/roster/roster-member-add.js +3 -0
  37. package/dist/m365/planner/commands/roster/roster-member-get.js +98 -0
  38. package/dist/m365/planner/commands.js +1 -0
  39. package/dist/m365/pp/commands/environment/environment-get.js +18 -9
  40. package/dist/m365/purview/commands/retentionevent/retentionevent-add.js +138 -0
  41. package/dist/m365/purview/commands/retentionlabel/retentionlabel-add.js +48 -14
  42. package/dist/m365/purview/commands.js +1 -0
  43. package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.17.0-beta.1.js +59 -0
  44. package/dist/m365/spfx/commands/project/project-upgrade.js +16 -13
  45. package/dist/m365/spfx/commands/spfx-doctor.js +43 -29
  46. package/dist/m365/spo/commands/commandset/commandset-add.js +138 -0
  47. package/dist/m365/spo/commands/commandset/commandset-get.js +128 -0
  48. package/dist/m365/spo/commands/commandset/commandset-list.js +77 -0
  49. package/dist/m365/spo/commands/commandset/commandset-remove.js +146 -0
  50. package/dist/m365/spo/commands/commandset/commandset-set.js +182 -0
  51. package/dist/m365/spo/commands/customaction/customaction-get.js +27 -7
  52. package/dist/m365/spo/commands/file/file-move.js +1 -3
  53. package/dist/m365/spo/commands/folder/folder-copy.js +0 -2
  54. package/dist/m365/spo/commands/folder/folder-move.js +0 -2
  55. package/dist/m365/spo/commands/group/group-member-add.js +54 -95
  56. package/dist/m365/spo/commands/list/list-add.js +11 -8
  57. package/dist/m365/spo/commands/list/list-set.js +3 -3
  58. package/dist/m365/spo/commands/navigation/navigation-node-add.js +5 -4
  59. package/dist/m365/spo/commands/navigation/navigation-node-set.js +5 -1
  60. package/dist/m365/spo/commands/site/site-add.js +0 -3
  61. package/dist/m365/spo/commands/site/site-remove.js +0 -3
  62. package/dist/m365/spo/commands/site/site-set.js +0 -2
  63. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-get.js +118 -0
  64. package/dist/m365/spo/commands/tenant/tenant-recyclebinitem-remove.js +0 -1
  65. package/dist/m365/spo/commands/term/term-get.js +68 -48
  66. package/dist/m365/spo/commands/user/user-ensure.js +105 -0
  67. package/dist/m365/spo/commands.js +7 -0
  68. package/dist/m365/teams/commands/team/team-add.js +3 -8
  69. package/dist/m365/todo/commands/task/task-add.js +35 -3
  70. package/dist/utils/aadGroup.js +18 -0
  71. package/dist/utils/aadUser.js +37 -0
  72. package/dist/utils/md.js +7 -0
  73. package/dist/utils/session.js +18 -0
  74. package/dist/utils/spo.js +35 -12
  75. package/docs/docs/cmd/aad/app/app-add.md +3 -3
  76. package/docs/docs/cmd/aad/approleassignment/approleassignment-add.md +5 -5
  77. package/docs/docs/cmd/aad/approleassignment/approleassignment-remove.md +3 -3
  78. package/docs/docs/cmd/aad/license/license-list.md +87 -0
  79. package/docs/docs/cmd/aad/user/user-add.md +168 -0
  80. package/docs/docs/cmd/aad/user/user-license-add.md +108 -0
  81. package/docs/docs/cmd/aad/user/user-license-list.md +98 -0
  82. package/docs/docs/cmd/aad/user/user-license-remove.md +43 -0
  83. package/docs/docs/cmd/aad/user/user-recyclebinitem-clear.md +1 -1
  84. package/docs/docs/cmd/aad/user/user-recyclebinitem-list.md +82 -0
  85. package/docs/docs/cmd/aad/user/user-recyclebinitem-remove.md +45 -0
  86. package/docs/docs/cmd/aad/user/user-recyclebinitem-restore.md +99 -0
  87. package/docs/docs/cmd/aad/user/user-remove.md +51 -0
  88. package/docs/docs/cmd/aad/user/user-set.md +1 -1
  89. package/docs/docs/cmd/cli/completion/completion-clink-update.md +4 -4
  90. package/docs/docs/cmd/flow/environment/environment-get.md +31 -3
  91. package/docs/docs/cmd/flow/owner/owner-ensure.md +61 -0
  92. package/docs/docs/cmd/flow/owner/owner-list.md +90 -0
  93. package/docs/docs/cmd/flow/owner/owner-remove.md +67 -0
  94. package/docs/docs/cmd/flow/run/run-list.md +28 -0
  95. package/docs/docs/cmd/onenote/page/page-list.md +1 -1
  96. package/docs/docs/cmd/outlook/mail/mail-send.md +7 -3
  97. package/docs/docs/cmd/outlook/message/message-get.md +143 -0
  98. package/docs/docs/cmd/outlook/message/message-list.md +119 -0
  99. package/docs/docs/cmd/outlook/message/message-move.md +4 -0
  100. package/docs/docs/cmd/outlook/report/report-mailactivitycounts.md +40 -0
  101. package/docs/docs/cmd/outlook/report/report-mailactivityusercounts.md +40 -0
  102. package/docs/docs/cmd/outlook/report/report-mailactivityuserdetail.md +45 -0
  103. package/docs/docs/cmd/outlook/report/report-mailappusageappsusercounts.md +43 -0
  104. package/docs/docs/cmd/outlook/report/report-mailappusageusercounts.md +44 -0
  105. package/docs/docs/cmd/outlook/report/report-mailappusageuserdetail.md +48 -0
  106. package/docs/docs/cmd/outlook/report/report-mailappusageversionsusercounts.md +41 -0
  107. package/docs/docs/cmd/outlook/report/report-mailboxusagedetail.md +49 -0
  108. package/docs/docs/cmd/outlook/report/report-mailboxusagemailboxcount.md +37 -0
  109. package/docs/docs/cmd/outlook/report/report-mailboxusagequotastatusmailboxcounts.md +40 -0
  110. package/docs/docs/cmd/outlook/report/report-mailboxusagestorage.md +36 -0
  111. package/docs/docs/cmd/outlook/room/room-list.md +81 -0
  112. package/docs/docs/cmd/outlook/roomlist/roomlist-list.md +58 -0
  113. package/docs/docs/cmd/planner/plan/plan-add.md +3 -3
  114. package/docs/docs/cmd/planner/plan/plan-set.md +73 -7
  115. package/docs/docs/cmd/planner/roster/roster-add.md +16 -1
  116. package/docs/docs/cmd/planner/roster/roster-member-get.md +87 -0
  117. package/docs/docs/cmd/planner/task/task-add.md +230 -0
  118. package/docs/docs/cmd/planner/task/task-checklistitem-add.md +55 -0
  119. package/docs/docs/cmd/planner/task/task-checklistitem-list.md +55 -0
  120. package/docs/docs/cmd/planner/task/task-checklistitem-remove.md +4 -0
  121. package/docs/docs/cmd/planner/task/task-get.md +131 -0
  122. package/docs/docs/cmd/planner/task/task-list.md +92 -0
  123. package/docs/docs/cmd/planner/task/task-reference-add.md +46 -0
  124. package/docs/docs/cmd/planner/task/task-reference-list.md +46 -0
  125. package/docs/docs/cmd/planner/task/task-reference-remove.md +4 -0
  126. package/docs/docs/cmd/planner/task/task-remove.md +4 -0
  127. package/docs/docs/cmd/planner/task/task-set.md +230 -0
  128. package/docs/docs/cmd/planner/tenant/tenant-settings-list.md +55 -0
  129. package/docs/docs/cmd/planner/tenant/tenant-settings-set.md +55 -0
  130. package/docs/docs/cmd/pp/card/card-get.md +2 -2
  131. package/docs/docs/cmd/pp/card/card-list.md +2 -2
  132. package/docs/docs/cmd/purview/retentionevent/retentionevent-add.md +149 -0
  133. package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-add.md +7 -7
  134. package/docs/docs/cmd/purview/retentionlabel/retentionlabel-add.md +12 -0
  135. package/docs/docs/cmd/skype/report/report-activitycounts.md +38 -0
  136. package/docs/docs/cmd/skype/report/report-activityusercounts.md +38 -0
  137. package/docs/docs/cmd/skype/report/report-activityuserdetail.md +67 -0
  138. package/docs/docs/cmd/spfx/project/project-doctor.md +3 -3
  139. package/docs/docs/cmd/spfx/project/project-externalize.md +3 -3
  140. package/docs/docs/cmd/spfx/project/project-permissions-grant.md +21 -0
  141. package/docs/docs/cmd/spfx/project/project-upgrade.md +3 -3
  142. package/docs/docs/cmd/spfx/spfx-doctor.md +3 -3
  143. package/docs/docs/cmd/spo/cdn/cdn-get.md +6 -6
  144. package/docs/docs/cmd/spo/cdn/cdn-origin-add.md +3 -3
  145. package/docs/docs/cmd/spo/cdn/cdn-origin-list.md +3 -3
  146. package/docs/docs/cmd/spo/cdn/cdn-origin-remove.md +3 -3
  147. package/docs/docs/cmd/spo/cdn/cdn-policy-list.md +3 -3
  148. package/docs/docs/cmd/spo/cdn/cdn-policy-set.md +3 -3
  149. package/docs/docs/cmd/spo/cdn/cdn-set.md +3 -3
  150. package/docs/docs/cmd/spo/commandset/commandset-add.md +159 -0
  151. package/docs/docs/cmd/spo/commandset/commandset-get.md +149 -0
  152. package/docs/docs/cmd/spo/commandset/commandset-list.md +109 -0
  153. package/docs/docs/cmd/spo/commandset/commandset-remove.md +55 -0
  154. package/docs/docs/cmd/spo/commandset/commandset-set.md +71 -0
  155. package/docs/docs/cmd/spo/customaction/customaction-get.md +113 -11
  156. package/docs/docs/cmd/spo/externaluser/externaluser-list.md +2 -0
  157. package/docs/docs/cmd/spo/group/group-member-add.md +26 -4
  158. package/docs/docs/cmd/spo/hidedefaultthemes/hidedefaultthemes-get.md +2 -0
  159. package/docs/docs/cmd/spo/hidedefaultthemes/hidedefaultthemes-set.md +2 -0
  160. package/docs/docs/cmd/spo/homesite/homesite-get.md +20 -1
  161. package/docs/docs/cmd/spo/homesite/homesite-remove.md +10 -2
  162. package/docs/docs/cmd/spo/homesite/homesite-set.md +10 -2
  163. package/docs/docs/cmd/spo/hubsite/hubsite-connect.md +9 -9
  164. package/docs/docs/cmd/spo/hubsite/hubsite-data-get.md +34 -5
  165. package/docs/docs/cmd/spo/hubsite/hubsite-disconnect.md +6 -6
  166. package/docs/docs/cmd/spo/hubsite/hubsite-get.md +36 -19
  167. package/docs/docs/cmd/spo/hubsite/hubsite-list.md +59 -1
  168. package/docs/docs/cmd/spo/hubsite/hubsite-register.md +30 -1
  169. package/docs/docs/cmd/spo/hubsite/hubsite-rights-grant.md +6 -6
  170. package/docs/docs/cmd/spo/hubsite/hubsite-rights-revoke.md +4 -4
  171. package/docs/docs/cmd/spo/hubsite/hubsite-set.md +40 -15
  172. package/docs/docs/cmd/spo/hubsite/hubsite-unregister.md +4 -4
  173. package/docs/docs/cmd/spo/knowledgehub/knowledgehub-get.md +9 -1
  174. package/docs/docs/cmd/spo/knowledgehub/knowledgehub-remove.md +11 -3
  175. package/docs/docs/cmd/spo/knowledgehub/knowledgehub-set.md +11 -5
  176. package/docs/docs/cmd/spo/list/list-add.md +124 -58
  177. package/docs/docs/cmd/spo/list/list-contenttype-add.md +50 -5
  178. package/docs/docs/cmd/spo/list/list-contenttype-default-set.md +4 -4
  179. package/docs/docs/cmd/spo/list/list-contenttype-list.md +49 -4
  180. package/docs/docs/cmd/spo/list/list-contenttype-remove.md +6 -6
  181. package/docs/docs/cmd/spo/list/list-get.md +70 -4
  182. package/docs/docs/cmd/spo/list/list-list.md +70 -2
  183. package/docs/docs/cmd/spo/list/list-remove.md +6 -6
  184. package/docs/docs/cmd/spo/list/list-retentionlabel-ensure.md +2 -2
  185. package/docs/docs/cmd/spo/list/list-retentionlabel-get.md +36 -3
  186. package/docs/docs/cmd/spo/list/list-retentionlabel-remove.md +3 -3
  187. package/docs/docs/cmd/spo/list/list-roleassignment-add.md +6 -6
  188. package/docs/docs/cmd/spo/list/list-roleassignment-remove.md +3 -3
  189. package/docs/docs/cmd/spo/list/list-roleinheritance-break.md +9 -9
  190. package/docs/docs/cmd/spo/list/list-roleinheritance-reset.md +7 -7
  191. package/docs/docs/cmd/spo/list/list-set.md +61 -61
  192. package/docs/docs/cmd/spo/list/list-sitescript-get.md +35 -3
  193. package/docs/docs/cmd/spo/list/list-view-add.md +66 -5
  194. package/docs/docs/cmd/spo/list/list-view-field-add.md +10 -10
  195. package/docs/docs/cmd/spo/list/list-view-get.md +61 -0
  196. package/docs/docs/cmd/spo/list/list-view-list.md +61 -0
  197. package/docs/docs/cmd/spo/list/list-view-set.md +1 -1
  198. package/docs/docs/cmd/spo/list/list-webhook-add.md +19 -0
  199. package/docs/docs/cmd/spo/list/list-webhook-get.md +19 -0
  200. package/docs/docs/cmd/spo/list/list-webhook-list.md +19 -0
  201. package/docs/docs/cmd/spo/listitem/listitem-add.md +30 -1
  202. package/docs/docs/cmd/spo/listitem/listitem-attachment-list.md +17 -2
  203. package/docs/docs/cmd/spo/listitem/listitem-batch-add.md +1 -1
  204. package/docs/docs/cmd/spo/listitem/listitem-get.md +57 -0
  205. package/docs/docs/cmd/spo/listitem/listitem-isrecord.md +6 -0
  206. package/docs/docs/cmd/spo/listitem/listitem-list.md +28 -0
  207. package/docs/docs/cmd/spo/listitem/listitem-record-declare.md +15 -0
  208. package/docs/docs/cmd/spo/listitem/listitem-set.md +31 -1
  209. package/docs/docs/cmd/spo/navigation/navigation-node-add.md +25 -3
  210. package/docs/docs/cmd/spo/navigation/navigation-node-set.md +2 -2
  211. package/docs/docs/cmd/spo/orgassetslibrary/orgassetslibrary-add.md +2 -0
  212. package/docs/docs/cmd/spo/orgassetslibrary/orgassetslibrary-list.md +2 -0
  213. package/docs/docs/cmd/spo/orgassetslibrary/orgassetslibrary-remove.md +2 -0
  214. package/docs/docs/cmd/spo/orgnewssite/orgnewssite-list.md +2 -0
  215. package/docs/docs/cmd/spo/orgnewssite/orgnewssite-remove.md +2 -0
  216. package/docs/docs/cmd/spo/orgnewssite/orgnewssite-set.md +3 -3
  217. package/docs/docs/cmd/spo/site/site-appcatalog-add.md +2 -0
  218. package/docs/docs/cmd/spo/site/site-appcatalog-remove.md +3 -3
  219. package/docs/docs/cmd/spo/site/site-commsite-enable.md +2 -0
  220. package/docs/docs/cmd/spo/site/site-list.md +3 -3
  221. package/docs/docs/cmd/spo/site/site-remove.md +3 -3
  222. package/docs/docs/cmd/spo/site/site-rename.md +3 -3
  223. package/docs/docs/cmd/spo/site/site-set.md +5 -5
  224. package/docs/docs/cmd/spo/storageentity/storageentity-remove.md +3 -3
  225. package/docs/docs/cmd/spo/storageentity/storageentity-set.md +3 -3
  226. package/docs/docs/cmd/spo/tenant/tenant-appcatalog-add.md +3 -3
  227. package/docs/docs/cmd/spo/tenant/tenant-appcatalogurl-get.md +2 -0
  228. package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-add.md +3 -3
  229. package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-get.md +142 -0
  230. package/docs/docs/cmd/spo/tenant/tenant-recyclebinitem-list.md +2 -0
  231. package/docs/docs/cmd/spo/tenant/tenant-recyclebinitem-remove.md +3 -3
  232. package/docs/docs/cmd/spo/tenant/tenant-recyclebinitem-restore.md +3 -3
  233. package/docs/docs/cmd/spo/tenant/tenant-settings-list.md +2 -0
  234. package/docs/docs/cmd/spo/tenant/tenant-settings-set.md +28 -26
  235. package/docs/docs/cmd/spo/term/term-add.md +3 -3
  236. package/docs/docs/cmd/spo/term/term-get.md +3 -3
  237. package/docs/docs/cmd/spo/term/term-group-add.md +2 -0
  238. package/docs/docs/cmd/spo/term/term-group-get.md +2 -0
  239. package/docs/docs/cmd/spo/term/term-group-list.md +2 -0
  240. package/docs/docs/cmd/spo/term/term-list.md +3 -1
  241. package/docs/docs/cmd/spo/term/term-set-add.md +3 -3
  242. package/docs/docs/cmd/spo/term/term-set-get.md +2 -0
  243. package/docs/docs/cmd/spo/term/term-set-list.md +2 -0
  244. package/docs/docs/cmd/spo/theme/theme-apply.md +3 -3
  245. package/docs/docs/cmd/spo/theme/theme-get.md +2 -0
  246. package/docs/docs/cmd/spo/theme/theme-list.md +2 -0
  247. package/docs/docs/cmd/spo/theme/theme-remove.md +2 -0
  248. package/docs/docs/cmd/spo/theme/theme-set.md +3 -3
  249. package/docs/docs/cmd/spo/user/user-ensure.md +109 -0
  250. package/docs/docs/cmd/teams/channel/channel-get.md +1 -1
  251. package/docs/docs/cmd/teams/channel/channel-member-add.md +2 -2
  252. package/docs/docs/cmd/teams/message/message-get.md +39 -4
  253. package/docs/docs/cmd/teams/message/message-list.md +41 -6
  254. package/docs/docs/cmd/teams/message/message-reply-list.md +39 -4
  255. package/docs/docs/cmd/teams/messagingsettings/messagingsettings-list.md +20 -2
  256. package/docs/docs/cmd/teams/messagingsettings/messagingsettings-set.md +8 -8
  257. package/docs/docs/cmd/teams/report/report-deviceusagedistributionusercounts.md +12 -5
  258. package/docs/docs/cmd/teams/report/report-deviceusageusercounts.md +13 -6
  259. package/docs/docs/cmd/teams/report/report-deviceusageuserdetail.md +14 -7
  260. package/docs/docs/cmd/teams/report/report-directroutingcalls.md +13 -6
  261. package/docs/docs/cmd/teams/report/report-pstncalls.md +13 -6
  262. package/docs/docs/cmd/teams/report/report-useractivitycounts.md +13 -6
  263. package/docs/docs/cmd/teams/report/report-useractivityusercounts.md +13 -6
  264. package/docs/docs/cmd/teams/report/report-useractivityuserdetail.md +13 -6
  265. package/docs/docs/cmd/teams/tab/tab-add.md +16 -0
  266. package/docs/docs/cmd/teams/tab/tab-get.md +17 -0
  267. package/docs/docs/cmd/teams/tab/tab-list.md +19 -0
  268. package/docs/docs/cmd/teams/team/team-add.md +77 -8
  269. package/docs/docs/cmd/teams/team/team-app-list.md +18 -2
  270. package/docs/docs/cmd/teams/team/team-archive.md +2 -2
  271. package/docs/docs/cmd/teams/team/team-clone.md +8 -8
  272. package/docs/docs/cmd/teams/team/team-get.md +34 -4
  273. package/docs/docs/cmd/teams/team/team-list.md +34 -3
  274. package/docs/docs/cmd/teams/team/team-remove.md +3 -3
  275. package/docs/docs/cmd/teams/team/team-set.md +8 -8
  276. package/docs/docs/cmd/teams/team/team-unarchive.md +3 -2
  277. package/docs/docs/cmd/teams/user/user-app-add.md +3 -3
  278. package/docs/docs/cmd/teams/user/user-app-list.md +18 -2
  279. package/docs/docs/cmd/teams/user/user-app-remove.md +4 -4
  280. package/docs/docs/cmd/teams/user/user-list.md +21 -4
  281. package/docs/docs/cmd/todo/task/task-add.md +47 -2
  282. package/npm-shrinkwrap.json +280 -194
  283. package/package.json +15 -13
@@ -40,10 +40,14 @@ class SpoNavigationNodeSetCommand extends SpoCommand_1.default {
40
40
  if (this.verbose) {
41
41
  logger.logToStderr(`Setting navigation node...`);
42
42
  }
43
+ let url = args.options.url;
44
+ if (url === '') {
45
+ url = 'http://linkless.header/';
46
+ }
43
47
  const requestBody = {
44
48
  Title: args.options.title,
45
49
  IsExternal: args.options.isExternal,
46
- Url: args.options.url
50
+ Url: url
47
51
  };
48
52
  if (args.options.audienceIds !== undefined) {
49
53
  requestBody.AudienceIds = args.options.audienceIds === '' ? [] : args.options.audienceIds.split(',');
@@ -166,7 +166,6 @@ class SpoSiteAddCommand extends SpoCommand_1.default {
166
166
  }
167
167
  createClassicSite(logger, args) {
168
168
  return __awaiter(this, void 0, void 0, function* () {
169
- this.dots = '';
170
169
  try {
171
170
  this.spoAdminUrl = yield spo_1.spo.getSpoAdminUrl(logger, this.debug);
172
171
  this.context = yield spo_1.spo.ensureFormDigest(this.spoAdminUrl, logger, this.context, this.debug);
@@ -228,7 +227,6 @@ class SpoSiteAddCommand extends SpoCommand_1.default {
228
227
  reject,
229
228
  logger,
230
229
  currentContext: this.context,
231
- dots: this.dots,
232
230
  verbose: this.verbose,
233
231
  debug: this.debug
234
232
  });
@@ -362,7 +360,6 @@ class SpoSiteAddCommand extends SpoCommand_1.default {
362
360
  reject,
363
361
  logger,
364
362
  currentContext: this.context,
365
- dots: this.dots,
366
363
  verbose: this.verbose,
367
364
  debug: this.debug
368
365
  });
@@ -43,7 +43,6 @@ class SpoSiteRemoveCommand extends SpoCommand_1.default {
43
43
  return __awaiter(this, void 0, void 0, function* () {
44
44
  const removeSite = () => __awaiter(this, void 0, void 0, function* () {
45
45
  try {
46
- this.dots = '';
47
46
  if (args.options.fromRecycleBin) {
48
47
  yield this.deleteSiteWithoutGroup(logger, args);
49
48
  }
@@ -203,7 +202,6 @@ class SpoSiteRemoveCommand extends SpoCommand_1.default {
203
202
  reject,
204
203
  logger,
205
204
  currentContext: this.context,
206
- dots: this.dots,
207
205
  debug: this.debug,
208
206
  verbose: this.verbose
209
207
  });
@@ -248,7 +246,6 @@ class SpoSiteRemoveCommand extends SpoCommand_1.default {
248
246
  reject,
249
247
  logger,
250
248
  currentContext: this.context,
251
- dots: this.dots,
252
249
  debug: this.debug,
253
250
  verbose: this.verbose
254
251
  });
@@ -46,7 +46,6 @@ class SpoSiteSetCommand extends SpoCommand_1.default {
46
46
  commandAction(logger, args) {
47
47
  return __awaiter(this, void 0, void 0, function* () {
48
48
  try {
49
- this.dots = '';
50
49
  this.tenantId = yield spo_1.spo.getTenantId(logger, this.debug);
51
50
  this.spoAdminUrl = yield spo_1.spo.getSpoAdminUrl(logger, this.debug);
52
51
  this.context = yield spo_1.spo.ensureFormDigest(this.spoAdminUrl, logger, this.context, this.debug);
@@ -128,7 +127,6 @@ class SpoSiteSetCommand extends SpoCommand_1.default {
128
127
  reject,
129
128
  logger,
130
129
  currentContext: this.context,
131
- dots: this.dots,
132
130
  debug: this.debug,
133
131
  verbose: this.verbose
134
132
  });
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
12
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
13
+ 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");
14
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15
+ };
16
+ var _SpoTenantApplicationCustomizerGetCommand_instances, _SpoTenantApplicationCustomizerGetCommand_initTelemetry, _SpoTenantApplicationCustomizerGetCommand_initOptions, _SpoTenantApplicationCustomizerGetCommand_initValidators, _SpoTenantApplicationCustomizerGetCommand_initOptionSets;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const Command_1 = require("../../../../Command");
19
+ const request_1 = require("../../../../request");
20
+ const formatting_1 = require("../../../../utils/formatting");
21
+ const spo_1 = require("../../../../utils/spo");
22
+ const urlUtil_1 = require("../../../../utils/urlUtil");
23
+ const validation_1 = require("../../../../utils/validation");
24
+ const SpoCommand_1 = require("../../../base/SpoCommand");
25
+ const commands_1 = require("../../commands");
26
+ class SpoTenantApplicationCustomizerGetCommand extends SpoCommand_1.default {
27
+ get name() {
28
+ return commands_1.default.TENANT_APPLICATIONCUSTOMIZER_GET;
29
+ }
30
+ get description() {
31
+ return 'Get an application customizer that is installed tenant wide';
32
+ }
33
+ constructor() {
34
+ super();
35
+ _SpoTenantApplicationCustomizerGetCommand_instances.add(this);
36
+ __classPrivateFieldGet(this, _SpoTenantApplicationCustomizerGetCommand_instances, "m", _SpoTenantApplicationCustomizerGetCommand_initTelemetry).call(this);
37
+ __classPrivateFieldGet(this, _SpoTenantApplicationCustomizerGetCommand_instances, "m", _SpoTenantApplicationCustomizerGetCommand_initOptions).call(this);
38
+ __classPrivateFieldGet(this, _SpoTenantApplicationCustomizerGetCommand_instances, "m", _SpoTenantApplicationCustomizerGetCommand_initValidators).call(this);
39
+ __classPrivateFieldGet(this, _SpoTenantApplicationCustomizerGetCommand_instances, "m", _SpoTenantApplicationCustomizerGetCommand_initOptionSets).call(this);
40
+ }
41
+ commandAction(logger, args) {
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ const appCatalogUrl = yield spo_1.spo.getTenantAppCatalogUrl(logger, this.debug);
44
+ if (!appCatalogUrl) {
45
+ throw new Command_1.CommandError('No app catalog URL found');
46
+ }
47
+ let filter = '';
48
+ if (args.options.title) {
49
+ filter = `Title eq '${args.options.title}'`;
50
+ }
51
+ else if (args.options.id) {
52
+ filter = `GUID eq '${args.options.id}'`;
53
+ }
54
+ else if (args.options.clientSideComponentId) {
55
+ filter = `TenantWideExtensionComponentId eq '${args.options.clientSideComponentId}'`;
56
+ }
57
+ const listServerRelativeUrl = urlUtil_1.urlUtil.getServerRelativePath(appCatalogUrl, '/lists/TenantWideExtensions');
58
+ const reqOptions = {
59
+ url: `${appCatalogUrl}/_api/web/GetList('${formatting_1.formatting.encodeQueryParameter(listServerRelativeUrl)}')/items?$filter=${filter}`,
60
+ headers: {
61
+ 'accept': 'application/json;odata=nometadata'
62
+ },
63
+ responseType: 'json'
64
+ };
65
+ let listItemInstances;
66
+ try {
67
+ listItemInstances = yield request_1.default.get(reqOptions);
68
+ }
69
+ catch (err) {
70
+ return this.handleRejectedODataJsonPromise(err);
71
+ }
72
+ if (listItemInstances) {
73
+ if (listItemInstances.value.length === 0) {
74
+ throw new Command_1.CommandError('The specified application customizer was not found');
75
+ }
76
+ if (listItemInstances.value.length > 1) {
77
+ throw new Command_1.CommandError(`Multiple application customizers with ${args.options.title || args.options.clientSideComponentId} were found. Please disambiguate (IDs): ${listItemInstances.value.map(item => item.GUID).join(', ')}`);
78
+ }
79
+ listItemInstances.value.forEach(v => delete v['ID']);
80
+ logger.log(listItemInstances.value[0]);
81
+ }
82
+ else {
83
+ throw new Command_1.CommandError('The specified application customizer was not found');
84
+ }
85
+ });
86
+ }
87
+ }
88
+ _SpoTenantApplicationCustomizerGetCommand_instances = new WeakSet(), _SpoTenantApplicationCustomizerGetCommand_initTelemetry = function _SpoTenantApplicationCustomizerGetCommand_initTelemetry() {
89
+ this.telemetry.push((args) => {
90
+ Object.assign(this.telemetryProperties, {
91
+ title: typeof args.options.title !== 'undefined',
92
+ id: typeof args.options.id !== 'undefined',
93
+ clientSideComponentId: typeof args.options.clientSideComponentId !== 'undefined'
94
+ });
95
+ });
96
+ }, _SpoTenantApplicationCustomizerGetCommand_initOptions = function _SpoTenantApplicationCustomizerGetCommand_initOptions() {
97
+ this.options.unshift({
98
+ option: '-t, --title [title]'
99
+ }, {
100
+ option: '-i, --id [id]'
101
+ }, {
102
+ option: '-c, --clientSideComponentId [clientSideComponentId]'
103
+ });
104
+ }, _SpoTenantApplicationCustomizerGetCommand_initValidators = function _SpoTenantApplicationCustomizerGetCommand_initValidators() {
105
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
106
+ if (args.options.id && !validation_1.validation.isValidGuid(args.options.id)) {
107
+ return `${args.options.id} is not a valid GUID`;
108
+ }
109
+ if (args.options.clientSideComponentId && !validation_1.validation.isValidGuid(args.options.clientSideComponentId)) {
110
+ return `${args.options.clientSideComponentId} is not a valid GUID`;
111
+ }
112
+ return true;
113
+ }));
114
+ }, _SpoTenantApplicationCustomizerGetCommand_initOptionSets = function _SpoTenantApplicationCustomizerGetCommand_initOptionSets() {
115
+ this.optionSets.push({ options: ['title', 'id', 'clientSideComponentId'] });
116
+ };
117
+ module.exports = new SpoTenantApplicationCustomizerGetCommand();
118
+ //# sourceMappingURL=tenant-applicationcustomizer-get.js.map
@@ -74,7 +74,6 @@ class SpoTenantRecycleBinItemRemoveCommand extends SpoCommand_1.default {
74
74
  reject,
75
75
  logger,
76
76
  currentContext: this.context,
77
- dots: this.dots,
78
77
  debug: this.debug,
79
78
  verbose: this.verbose
80
79
  });
@@ -22,6 +22,7 @@ const spo_1 = require("../../../../utils/spo");
22
22
  const validation_1 = require("../../../../utils/validation");
23
23
  const SpoCommand_1 = require("../../../base/SpoCommand");
24
24
  const commands_1 = require("../../commands");
25
+ const os = require("os");
25
26
  class SpoTermGetCommand extends SpoCommand_1.default {
26
27
  get name() {
27
28
  return commands_1.default.TERM_GET;
@@ -50,32 +51,34 @@ class SpoTermGetCommand extends SpoCommand_1.default {
50
51
  data = `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config_1.default.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="14" ObjectPathId="13" /><ObjectIdentityQuery Id="15" ObjectPathId="13" /><Query Id="16" ObjectPathId="13"><Query SelectAllProperties="true"><Properties /></Query></Query></Actions><ObjectPaths><StaticMethod Id="6" Name="GetTaxonomySession" TypeId="{981cbc68-9edc-4f8d-872f-71146fcbb84f}" /><Method Id="7" ParentId="6" Name="GetDefaultSiteCollectionTermStore" /><Method Id="13" ParentId="7" Name="GetTerm"><Parameters><Parameter Type="Guid">{${args.options.id}}</Parameter></Parameters></Method></ObjectPaths></Request>`;
51
52
  }
52
53
  else {
53
- const termGroupQuery = args.options.termGroupId ? `<Method Id="98" ParentId="96" Name="GetById"><Parameters><Parameter Type="Guid">{${args.options.termGroupId}}</Parameter></Parameters></Method>` : `<Method Id="98" ParentId="96" Name="GetByName"><Parameters><Parameter Type="String">${formatting_1.formatting.escapeXml(args.options.termGroupName)}</Parameter></Parameters></Method>`;
54
- const termSetQuery = args.options.termSetId ? `<Method Id="103" ParentId="101" Name="GetById"><Parameters><Parameter Type="Guid">{${args.options.termSetId}}</Parameter></Parameters></Method>` : `<Method Id="103" ParentId="101" Name="GetByName"><Parameters><Parameter Type="String">${formatting_1.formatting.escapeXml(args.options.termSetName)}</Parameter></Parameters></Method>`;
55
- data = `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config_1.default.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="91" ObjectPathId="90" /><ObjectIdentityQuery Id="92" ObjectPathId="90" /><ObjectPath Id="94" ObjectPathId="93" /><ObjectIdentityQuery Id="95" ObjectPathId="93" /><ObjectPath Id="97" ObjectPathId="96" /><ObjectPath Id="99" ObjectPathId="98" /><ObjectIdentityQuery Id="100" ObjectPathId="98" /><ObjectPath Id="102" ObjectPathId="101" /><ObjectPath Id="104" ObjectPathId="103" /><ObjectIdentityQuery Id="105" ObjectPathId="103" /><ObjectPath Id="107" ObjectPathId="106" /><ObjectPath Id="109" ObjectPathId="108" /><ObjectIdentityQuery Id="110" ObjectPathId="108" /><Query Id="111" ObjectPathId="108"><Query SelectAllProperties="true"><Properties /></Query></Query></Actions><ObjectPaths><StaticMethod Id="90" Name="GetTaxonomySession" TypeId="{981cbc68-9edc-4f8d-872f-71146fcbb84f}" /><Method Id="93" ParentId="90" Name="GetDefaultSiteCollectionTermStore" /><Property Id="96" ParentId="93" Name="Groups" />${termGroupQuery}<Property Id="101" ParentId="98" Name="TermSets" />${termSetQuery}<Property Id="106" ParentId="103" Name="Terms" /><Method Id="108" ParentId="106" Name="GetByName"><Parameters><Parameter Type="String">${formatting_1.formatting.escapeXml(args.options.name)}</Parameter></Parameters></Method></ObjectPaths></Request>`;
54
+ data = `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config_1.default.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="2" ObjectPathId="1" /><ObjectIdentityQuery Id="3" ObjectPathId="1" /><ObjectPath Id="5" ObjectPathId="4" /><ObjectIdentityQuery Id="6" ObjectPathId="4" /><ObjectPath Id="8" ObjectPathId="7" /><ObjectPath Id="10" ObjectPathId="9" /><ObjectIdentityQuery Id="11" ObjectPathId="9" /><ObjectPath Id="13" ObjectPathId="12" /><ObjectPath Id="15" ObjectPathId="14" /><ObjectIdentityQuery Id="16" ObjectPathId="14" /><ObjectPath Id="18" ObjectPathId="17" /><SetProperty Id="19" ObjectPathId="17" Name="TrimUnavailable"><Parameter Type="Boolean">true</Parameter></SetProperty><SetProperty Id="20" ObjectPathId="17" Name="TermLabel"><Parameter Type="String">${formatting_1.formatting.escapeXml(args.options.name)}</Parameter></SetProperty><ObjectPath Id="22" ObjectPathId="21" /><Query Id="23" ObjectPathId="21"><Query SelectAllProperties="true"><Properties /></Query><ChildItemQuery SelectAllProperties="true"><Properties /></ChildItemQuery></Query></Actions><ObjectPaths><StaticMethod Id="1" Name="GetTaxonomySession" TypeId="{981cbc68-9edc-4f8d-872f-71146fcbb84f}" /><Method Id="4" ParentId="1" Name="GetDefaultSiteCollectionTermStore" /><Property Id="7" ParentId="4" Name="Groups" /><Method Id="9" ParentId="7" Name="${args.options.termGroupName === undefined ? "GetById" : "GetByName"}"><Parameters><Parameter Type="String">${formatting_1.formatting.escapeXml(args.options.termGroupName) || args.options.termGroupId}</Parameter></Parameters></Method><Property Id="12" ParentId="9" Name="TermSets" /><Method Id="14" ParentId="12" Name="${args.options.termSetName === undefined ? "GetById" : "GetByName"}"><Parameters><Parameter Type="String">${formatting_1.formatting.escapeXml(args.options.termSetName) || args.options.termSetId}</Parameter></Parameters></Method><Constructor Id="17" TypeId="{61a1d689-2744-4ea3-a88b-c95bee9803aa}" /><Method Id="21" ParentId="14" Name="GetTerms"><Parameters><Parameter ObjectPathId="17" /></Parameters></Method></ObjectPaths></Request>`;
56
55
  }
57
- const requestOptions = {
58
- url: `${spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
59
- headers: {
60
- 'X-RequestDigest': res.FormDigestValue
61
- },
62
- data: data
63
- };
64
- const processQuery = yield request_1.default.post(requestOptions);
65
- const json = JSON.parse(processQuery);
66
- const response = json[0];
67
- if (response.ErrorInfo) {
68
- throw response.ErrorInfo.ErrorMessage;
56
+ let term;
57
+ const csomResponse = yield this.executeCsomCall(data, spoAdminUrl, res);
58
+ if (csomResponse === null) {
59
+ throw `Term with id '${args.options.id}' could not be found.`;
69
60
  }
70
- const term = json[json.length - 1];
71
- if (!term) {
72
- return;
61
+ else if (csomResponse._Child_Items_ !== undefined) {
62
+ const terms = csomResponse;
63
+ if (terms._Child_Items_.length === 0) {
64
+ throw `Term with name '${args.options.name}' could not be found.`;
65
+ }
66
+ if (terms._Child_Items_.length > 1) {
67
+ const disambiguationText = terms._Child_Items_.map(c => {
68
+ return `- ${this.getTermId(c.Id)} - ${c.PathOfTerm}`;
69
+ }).join(os.EOL);
70
+ throw new Error(`Multiple terms with the specific term name found. Please disambiguate:${os.EOL}${disambiguationText}`);
71
+ }
72
+ term = terms._Child_Items_[0];
73
+ }
74
+ else {
75
+ term = csomResponse;
73
76
  }
74
77
  delete term._ObjectIdentity_;
75
78
  delete term._ObjectType_;
76
- term.CreatedDate = new Date(Number(term.CreatedDate.replace('/Date(', '').replace(')/', ''))).toISOString();
77
- term.Id = term.Id.replace('/Guid(', '').replace(')/', '');
78
- term.LastModifiedDate = new Date(Number(term.LastModifiedDate.replace('/Date(', '').replace(')/', ''))).toISOString();
79
+ term.CreatedDate = this.parseTermDateToIsoString(term.CreatedDate);
80
+ term.Id = this.getTermId(term.Id);
81
+ term.LastModifiedDate = this.parseTermDateToIsoString(term.LastModifiedDate);
79
82
  logger.log(term);
80
83
  }
81
84
  catch (err) {
@@ -83,6 +86,31 @@ class SpoTermGetCommand extends SpoCommand_1.default {
83
86
  }
84
87
  });
85
88
  }
89
+ executeCsomCall(data, spoAdminUrl, res) {
90
+ return __awaiter(this, void 0, void 0, function* () {
91
+ const requestOptions = {
92
+ url: `${spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
93
+ headers: {
94
+ 'X-RequestDigest': res.FormDigestValue
95
+ },
96
+ data: data
97
+ };
98
+ const processQuery = yield request_1.default.post(requestOptions);
99
+ const json = JSON.parse(processQuery);
100
+ const response = json[0];
101
+ if (response.ErrorInfo) {
102
+ throw response.ErrorInfo.ErrorMessage;
103
+ }
104
+ const responseObject = json[json.length - 1];
105
+ return responseObject;
106
+ });
107
+ }
108
+ getTermId(termId) {
109
+ return termId.replace('/Guid(', '').replace(')/', '');
110
+ }
111
+ parseTermDateToIsoString(dateAsString) {
112
+ return new Date(Number(dateAsString.replace('/Date(', '').replace(')/', ''))).toISOString();
113
+ }
86
114
  }
87
115
  _SpoTermGetCommand_instances = new WeakSet(), _SpoTermGetCommand_initTelemetry = function _SpoTermGetCommand_initTelemetry() {
88
116
  this.telemetry.push((args) => {
@@ -111,39 +139,31 @@ _SpoTermGetCommand_instances = new WeakSet(), _SpoTermGetCommand_initTelemetry =
111
139
  });
112
140
  }, _SpoTermGetCommand_initValidators = function _SpoTermGetCommand_initValidators() {
113
141
  this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
114
- if (args.options.id) {
115
- if (!validation_1.validation.isValidGuid(args.options.id)) {
116
- return `${args.options.id} is not a valid GUID`;
117
- }
142
+ if (args.options.id && !validation_1.validation.isValidGuid(args.options.id)) {
143
+ return `${args.options.id} is not a valid GUID`;
118
144
  }
119
- if (args.options.name) {
120
- if (!args.options.termGroupId && !args.options.termGroupName) {
121
- return 'Specify termGroupId or termGroupName';
122
- }
123
- if (!args.options.termSetId && !args.options.termSetName) {
124
- return 'Specify termSetId or termSetName';
125
- }
145
+ if (args.options.termGroupId && !validation_1.validation.isValidGuid(args.options.termGroupId)) {
146
+ return `${args.options.termGroupId} is not a valid GUID`;
126
147
  }
127
- if (args.options.termGroupId && args.options.termGroupName) {
128
- return 'Specify termGroupId or termGroupName but not both';
129
- }
130
- if (args.options.termGroupId) {
131
- if (!validation_1.validation.isValidGuid(args.options.termGroupId)) {
132
- return `${args.options.termGroupId} is not a valid GUID`;
133
- }
134
- }
135
- if (args.options.termSetId && args.options.termSetName) {
136
- return 'Specify termSetId or termSetName but not both';
137
- }
138
- if (args.options.termSetId) {
139
- if (!validation_1.validation.isValidGuid(args.options.termSetId)) {
140
- return `${args.options.termSetId} is not a valid GUID`;
141
- }
148
+ if (args.options.termSetId && !validation_1.validation.isValidGuid(args.options.termSetId)) {
149
+ return `${args.options.termSetId} is not a valid GUID`;
142
150
  }
143
151
  return true;
144
152
  }));
145
153
  }, _SpoTermGetCommand_initOptionSets = function _SpoTermGetCommand_initOptionSets() {
146
- this.optionSets.push({ options: ['id', 'name'] });
154
+ this.optionSets.push({
155
+ options: ['id', 'name']
156
+ }, {
157
+ options: ['termGroupId', 'termGroupName'],
158
+ runsWhen: (args) => {
159
+ return args.options.name !== undefined;
160
+ }
161
+ }, {
162
+ options: ['termSetId', 'termSetName'],
163
+ runsWhen: (args) => {
164
+ return args.options.name !== undefined;
165
+ }
166
+ });
147
167
  };
148
168
  module.exports = new SpoTermGetCommand();
149
169
  //# sourceMappingURL=term-get.js.map
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
12
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
13
+ 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");
14
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15
+ };
16
+ var _SpoUserEnsureCommand_instances, _SpoUserEnsureCommand_initTelemetry, _SpoUserEnsureCommand_initOptions, _SpoUserEnsureCommand_initValidators, _SpoUserEnsureCommand_initOptionSets;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const request_1 = require("../../../../request");
19
+ const aadUser_1 = require("../../../../utils/aadUser");
20
+ const validation_1 = require("../../../../utils/validation");
21
+ const SpoCommand_1 = require("../../../base/SpoCommand");
22
+ const commands_1 = require("../../commands");
23
+ class SpoUserEnsureCommand extends SpoCommand_1.default {
24
+ get name() {
25
+ return commands_1.default.USER_ENSURE;
26
+ }
27
+ get description() {
28
+ return 'Ensures that a user is available on a specific site';
29
+ }
30
+ constructor() {
31
+ super();
32
+ _SpoUserEnsureCommand_instances.add(this);
33
+ __classPrivateFieldGet(this, _SpoUserEnsureCommand_instances, "m", _SpoUserEnsureCommand_initTelemetry).call(this);
34
+ __classPrivateFieldGet(this, _SpoUserEnsureCommand_instances, "m", _SpoUserEnsureCommand_initOptions).call(this);
35
+ __classPrivateFieldGet(this, _SpoUserEnsureCommand_instances, "m", _SpoUserEnsureCommand_initValidators).call(this);
36
+ __classPrivateFieldGet(this, _SpoUserEnsureCommand_instances, "m", _SpoUserEnsureCommand_initOptionSets).call(this);
37
+ }
38
+ commandAction(logger, args) {
39
+ return __awaiter(this, void 0, void 0, function* () {
40
+ if (this.verbose) {
41
+ logger.logToStderr(`Ensuring user ${args.options.aadId || args.options.userName} at site ${args.options.webUrl}`);
42
+ }
43
+ try {
44
+ const requestBody = {
45
+ logonName: args.options.userName || (yield this.getUpnByUserId(args.options.aadId, logger))
46
+ };
47
+ const requestOptions = {
48
+ url: `${args.options.webUrl}/_api/web/ensureuser`,
49
+ headers: {
50
+ accept: 'application/json;odata=nometadata'
51
+ },
52
+ data: requestBody,
53
+ responseType: 'json'
54
+ };
55
+ const response = yield request_1.default.post(requestOptions);
56
+ logger.log(response);
57
+ }
58
+ catch (err) {
59
+ this.handleRejectedODataJsonPromise(err);
60
+ }
61
+ });
62
+ }
63
+ getUpnByUserId(aadId, logger) {
64
+ return __awaiter(this, void 0, void 0, function* () {
65
+ if (this.verbose) {
66
+ logger.logToStderr(`Retrieving user principal name for user with id ${aadId}`);
67
+ }
68
+ return yield aadUser_1.aadUser.getUpnByUserId(aadId);
69
+ });
70
+ }
71
+ }
72
+ _SpoUserEnsureCommand_instances = new WeakSet(), _SpoUserEnsureCommand_initTelemetry = function _SpoUserEnsureCommand_initTelemetry() {
73
+ this.telemetry.push((args) => {
74
+ Object.assign(this.telemetryProperties, {
75
+ aadId: typeof args.options.aadId !== 'undefined',
76
+ userName: typeof args.options.userName !== 'undefined'
77
+ });
78
+ });
79
+ }, _SpoUserEnsureCommand_initOptions = function _SpoUserEnsureCommand_initOptions() {
80
+ this.options.unshift({
81
+ option: '-u, --webUrl <webUrl>'
82
+ }, {
83
+ option: '--aadId [aadId]'
84
+ }, {
85
+ option: '--userName [userName]'
86
+ });
87
+ }, _SpoUserEnsureCommand_initValidators = function _SpoUserEnsureCommand_initValidators() {
88
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
89
+ const isValidSharePointUrl = validation_1.validation.isValidSharePointUrl(args.options.webUrl);
90
+ if (isValidSharePointUrl !== true) {
91
+ return isValidSharePointUrl;
92
+ }
93
+ if (args.options.aadId && !validation_1.validation.isValidGuid(args.options.aadId)) {
94
+ return `${args.options.aadId} is not a valid GUID.`;
95
+ }
96
+ if (args.options.userName && !validation_1.validation.isValidUserPrincipalName(args.options.userName)) {
97
+ return `${args.options.userName} is not a valid userName.`;
98
+ }
99
+ return true;
100
+ }));
101
+ }, _SpoUserEnsureCommand_initOptionSets = function _SpoUserEnsureCommand_initOptionSets() {
102
+ this.optionSets.push({ options: ['aadId', 'userName'] });
103
+ };
104
+ module.exports = new SpoUserEnsureCommand();
105
+ //# sourceMappingURL=user-ensure.js.map
@@ -23,6 +23,11 @@ exports.default = {
23
23
  CDN_POLICY_LIST: `${prefix} cdn policy list`,
24
24
  CDN_POLICY_SET: `${prefix} cdn policy set`,
25
25
  CDN_SET: `${prefix} cdn set`,
26
+ COMMANDSET_ADD: `${prefix} commandset add`,
27
+ COMMANDSET_GET: `${prefix} commandset get`,
28
+ COMMANDSET_LIST: `${prefix} commandset list`,
29
+ COMMANDSET_REMOVE: `${prefix} commandset remove`,
30
+ COMMANDSET_SET: `${prefix} commandset set`,
26
31
  CONTENTTYPE_ADD: `${prefix} contenttype add`,
27
32
  CONTENTTYPE_FIELD_REMOVE: `${prefix} contenttype field remove`,
28
33
  CONTENTTYPE_FIELD_SET: `${prefix} contenttype field set`,
@@ -279,6 +284,7 @@ exports.default = {
279
284
  TENANT_APPCATALOG_ADD: `${prefix} tenant appcatalog add`,
280
285
  TENANT_APPCATALOGURL_GET: `${prefix} tenant appcatalogurl get`,
281
286
  TENANT_APPLICATIONCUSTOMIZER_ADD: `${prefix} tenant applicationcustomizer add`,
287
+ TENANT_APPLICATIONCUSTOMIZER_GET: `${prefix} tenant applicationcustomizer get`,
282
288
  TENANT_RECYCLEBINITEM_LIST: `${prefix} tenant recyclebinitem list`,
283
289
  TENANT_RECYCLEBINITEM_REMOVE: `${prefix} tenant recyclebinitem remove`,
284
290
  TENANT_RECYCLEBINITEM_RESTORE: `${prefix} tenant recyclebinitem restore`,
@@ -298,6 +304,7 @@ exports.default = {
298
304
  THEME_LIST: `${prefix} theme list`,
299
305
  THEME_REMOVE: `${prefix} theme remove`,
300
306
  THEME_SET: `${prefix} theme set`,
307
+ USER_ENSURE: `${prefix} user ensure`,
301
308
  USER_GET: `${prefix} user get`,
302
309
  USER_LIST: `${prefix} user list`,
303
310
  USER_REMOVE: `${prefix} user remove`,
@@ -44,7 +44,6 @@ class TeamsTeamAddCommand extends GraphCommand_1.default {
44
44
  }
45
45
  commandAction(logger, args) {
46
46
  return __awaiter(this, void 0, void 0, function* () {
47
- this.dots = '';
48
47
  let requestBody;
49
48
  if (args.options.template) {
50
49
  if (this.verbose) {
@@ -95,7 +94,7 @@ class TeamsTeamAddCommand extends GraphCommand_1.default {
95
94
  }
96
95
  else {
97
96
  setTimeout(() => {
98
- this.waitUntilFinished(requestOptions, resolve, reject, logger, this.dots);
97
+ this.waitUntilFinished(requestOptions, resolve, reject, logger);
99
98
  }, this.pollingInterval);
100
99
  }
101
100
  }));
@@ -113,11 +112,7 @@ class TeamsTeamAddCommand extends GraphCommand_1.default {
113
112
  }
114
113
  });
115
114
  }
116
- waitUntilFinished(requestOptions, resolve, reject, logger, dots) {
117
- if (!this.debug && this.verbose) {
118
- dots += '.';
119
- process.stdout.write(`\r${dots}`);
120
- }
115
+ waitUntilFinished(requestOptions, resolve, reject, logger) {
121
116
  request_1.default
122
117
  .get(requestOptions)
123
118
  .then((teamsAsyncOperation) => {
@@ -133,7 +128,7 @@ class TeamsTeamAddCommand extends GraphCommand_1.default {
133
128
  return;
134
129
  }
135
130
  setTimeout(() => {
136
- this.waitUntilFinished(requestOptions, resolve, reject, logger, dots);
131
+ this.waitUntilFinished(requestOptions, resolve, reject, logger);
137
132
  }, this.pollingInterval);
138
133
  }).catch(err => reject(err));
139
134
  }
@@ -35,11 +35,12 @@ class TodoTaskAddCommand extends GraphCommand_1.default {
35
35
  __classPrivateFieldGet(this, _TodoTaskAddCommand_instances, "m", _TodoTaskAddCommand_initOptionSets).call(this);
36
36
  }
37
37
  commandAction(logger, args) {
38
- var _a, _b;
38
+ var _a, _b, _c;
39
39
  return __awaiter(this, void 0, void 0, function* () {
40
40
  const endpoint = `${this.resource}/v1.0`;
41
41
  try {
42
42
  const listId = yield this.getTodoListId(args);
43
+ const status = args.options.status && TodoTaskAddCommand.allowedStatuses.filter(x => x.toLowerCase() === args.options.status.toLowerCase())[0];
43
44
  const requestOptions = {
44
45
  url: `${endpoint}/me/todo/lists/${listId}/tasks`,
45
46
  headers: {
@@ -54,7 +55,11 @@ class TodoTaskAddCommand extends GraphCommand_1.default {
54
55
  },
55
56
  importance: (_b = args.options.importance) === null || _b === void 0 ? void 0 : _b.toLowerCase(),
56
57
  dueDateTime: this.getDateTimeTimeZone(args.options.dueDateTime),
57
- reminderDateTime: this.getDateTimeTimeZone(args.options.reminderDateTime)
58
+ reminderDateTime: this.getDateTimeTimeZone(args.options.reminderDateTime),
59
+ categories: (_c = args.options.categories) === null || _c === void 0 ? void 0 : _c.split(','),
60
+ completedDateTime: this.getDateTimeTimeZone(args.options.completedDateTime),
61
+ startDateTime: this.getDateTimeTimeZone(args.options.startDateTime),
62
+ status: status
58
63
  },
59
64
  responseType: 'json'
60
65
  };
@@ -105,7 +110,11 @@ _TodoTaskAddCommand_instances = new WeakSet(), _TodoTaskAddCommand_initTelemetry
105
110
  bodyContentType: args.options.bodyContentType,
106
111
  dueDateTime: typeof args.options.dueDateTime !== 'undefined',
107
112
  importance: args.options.importance,
108
- reminderDateTime: typeof args.options.reminderDateTime !== 'undefined'
113
+ reminderDateTime: typeof args.options.reminderDateTime !== 'undefined',
114
+ categories: typeof args.options.categories !== 'undefined',
115
+ completedDateTime: typeof args.options.completedDateTime !== 'undefined',
116
+ startDateTime: typeof args.options.startDateTime !== 'undefined',
117
+ status: typeof args.options.status !== 'undefined'
109
118
  });
110
119
  });
111
120
  }, _TodoTaskAddCommand_initOptions = function _TodoTaskAddCommand_initOptions() {
@@ -127,9 +136,19 @@ _TodoTaskAddCommand_instances = new WeakSet(), _TodoTaskAddCommand_initTelemetry
127
136
  autocomplete: ['low', 'normal', 'high']
128
137
  }, {
129
138
  option: '--reminderDateTime [reminderDateTime]'
139
+ }, {
140
+ option: '--categories [categories]'
141
+ }, {
142
+ option: '--completedDateTime [completedDateTime]'
143
+ }, {
144
+ option: '--startDateTime [startDateTime]'
145
+ }, {
146
+ option: '--status [status]',
147
+ autocomplete: TodoTaskAddCommand.allowedStatuses
130
148
  });
131
149
  }, _TodoTaskAddCommand_initValidators = function _TodoTaskAddCommand_initValidators() {
132
150
  this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
151
+ var _a;
133
152
  if (args.options.bodyContentType && ['text', 'html'].indexOf(args.options.bodyContentType.toLowerCase()) === -1) {
134
153
  return `'${args.options.bodyContentType}' is not a valid value for the bodyContentType option. Allowed values are text|html`;
135
154
  }
@@ -142,10 +161,23 @@ _TodoTaskAddCommand_instances = new WeakSet(), _TodoTaskAddCommand_initTelemetry
142
161
  if (args.options.reminderDateTime && !validation_1.validation.isValidISODateTime(args.options.reminderDateTime)) {
143
162
  return `'${args.options.reminderDateTime}' is not a valid ISO date string`;
144
163
  }
164
+ if (args.options.completedDateTime && !validation_1.validation.isValidISODateTime(args.options.completedDateTime)) {
165
+ return `'${args.options.completedDateTime}' is not a valid datetime.`;
166
+ }
167
+ if (args.options.startDateTime && !validation_1.validation.isValidISODateTime(args.options.startDateTime)) {
168
+ return `'${args.options.startDateTime}' is not a valid datetime.`;
169
+ }
170
+ if (args.options.status && TodoTaskAddCommand.allowedStatuses.map(x => x.toLowerCase()).indexOf(args.options.status.toLowerCase()) === -1) {
171
+ return `${args.options.status} is not a valid value for status. Valid values are ${TodoTaskAddCommand.allowedStatuses.join(', ')}`;
172
+ }
173
+ if (args.options.completedDateTime && ((_a = args.options.status) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== 'completed') {
174
+ return `The completedDateTime option can only be used when the status option is set to completed`;
175
+ }
145
176
  return true;
146
177
  }));
147
178
  }, _TodoTaskAddCommand_initOptionSets = function _TodoTaskAddCommand_initOptionSets() {
148
179
  this.optionSets.push({ options: ['listId', 'listName'] });
149
180
  };
181
+ TodoTaskAddCommand.allowedStatuses = ['notStarted', 'inProgress', 'completed', 'waitingOnOthers', 'deferred'];
150
182
  module.exports = new TodoTaskAddCommand();
151
183
  //# sourceMappingURL=task-add.js.map