@pnp/cli-microsoft365 7.2.0-beta.f440e15 → 7.3.0-beta.01256d2

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 (366) hide show
  1. package/.devcontainer/Dockerfile +0 -1
  2. package/.eslintrc.cjs +2 -0
  3. package/Dockerfile +0 -1
  4. package/allCommands.json +1 -0
  5. package/allCommandsFull.json +1 -0
  6. package/dist/Auth.js +1 -1
  7. package/dist/Command.js +18 -28
  8. package/dist/api.js +5 -7
  9. package/dist/appInsights.js +2 -1
  10. package/dist/chili/chili.js +40 -51
  11. package/dist/cli/Cli.js +133 -142
  12. package/dist/cli/timings.js +9 -0
  13. package/dist/index.js +1 -15
  14. package/dist/m365/aad/commands/administrativeunit/administrativeunit-add.js +3 -3
  15. package/dist/m365/aad/commands/administrativeunit/administrativeunit-get.js +2 -15
  16. package/dist/m365/aad/commands/administrativeunit/administrativeunit-remove.js +5 -22
  17. package/dist/m365/aad/commands/app/app-remove.js +2 -7
  18. package/dist/m365/aad/commands/app/app-role-remove.js +2 -7
  19. package/dist/m365/aad/commands/approleassignment/approleassignment-remove.js +2 -7
  20. package/dist/m365/aad/commands/group/group-list.js +69 -1
  21. package/dist/m365/aad/commands/group/group-remove.js +2 -7
  22. package/dist/m365/aad/commands/groupsetting/groupsetting-remove.js +2 -7
  23. package/dist/m365/aad/commands/m365group/m365group-recyclebinitem-clear.js +2 -7
  24. package/dist/m365/aad/commands/m365group/m365group-recyclebinitem-remove.js +2 -7
  25. package/dist/m365/aad/commands/m365group/m365group-remove.js +2 -7
  26. package/dist/m365/aad/commands/m365group/m365group-user-remove.js +2 -7
  27. package/dist/m365/aad/commands/oauth2grant/oauth2grant-remove.js +2 -7
  28. package/dist/m365/aad/commands/siteclassification/siteclassification-disable.js +2 -7
  29. package/dist/m365/aad/commands/user/user-license-remove.js +2 -7
  30. package/dist/m365/aad/commands/user/user-recyclebinitem-clear.js +2 -7
  31. package/dist/m365/aad/commands/user/user-recyclebinitem-remove.js +2 -7
  32. package/dist/m365/aad/commands/user/user-remove.js +2 -7
  33. package/dist/m365/cli/commands/config/config-set.js +13 -0
  34. package/dist/m365/commands/login.js +12 -8
  35. package/dist/m365/commands/setup.js +31 -37
  36. package/dist/m365/context/commands/context-remove.js +2 -7
  37. package/dist/m365/context/commands/option/option-remove.js +2 -7
  38. package/dist/m365/{search/commands/externalconnection/externalconnection-add.js → external/commands/connection/connection-add.js} +16 -13
  39. package/dist/m365/external/commands/connection/connection-doctor.js +424 -0
  40. package/dist/m365/{search/commands/externalconnection/externalconnection-get.js → external/commands/connection/connection-get.js} +16 -13
  41. package/dist/m365/{search/commands/externalconnection/externalconnection-list.js → external/commands/connection/connection-list.js} +7 -4
  42. package/dist/m365/{search/commands/externalconnection/externalconnection-remove.js → external/commands/connection/connection-remove.js} +19 -21
  43. package/dist/m365/{search/commands/externalconnection/externalconnection-schema-add.js → external/commands/connection/connection-schema-add.js} +14 -11
  44. package/dist/m365/external/commands/item/item-add.js +144 -0
  45. package/dist/m365/external/commands.js +17 -0
  46. package/dist/m365/flow/commands/environment/environment-list.js +6 -4
  47. package/dist/m365/flow/commands/flow-remove.js +2 -7
  48. package/dist/m365/flow/commands/owner/owner-remove.js +2 -7
  49. package/dist/m365/flow/commands/run/run-cancel.js +2 -7
  50. package/dist/m365/flow/commands/run/run-resubmit.js +2 -7
  51. package/dist/m365/graph/commands/schemaextension/schemaextension-remove.js +2 -7
  52. package/dist/m365/pa/commands/app/app-consent-set.js +2 -7
  53. package/dist/m365/pa/commands/app/app-permission-remove.js +2 -7
  54. package/dist/m365/pa/commands/app/app-remove.js +2 -7
  55. package/dist/m365/planner/commands/bucket/bucket-remove.js +2 -7
  56. package/dist/m365/planner/commands/plan/plan-remove.js +2 -7
  57. package/dist/m365/planner/commands/roster/roster-member-remove.js +4 -14
  58. package/dist/m365/planner/commands/roster/roster-remove.js +2 -7
  59. package/dist/m365/planner/commands/task/task-checklistitem-remove.js +2 -7
  60. package/dist/m365/planner/commands/task/task-reference-remove.js +2 -7
  61. package/dist/m365/planner/commands/task/task-remove.js +2 -7
  62. package/dist/m365/pp/commands/aibuildermodel/aibuildermodel-remove.js +2 -7
  63. package/dist/m365/pp/commands/card/card-remove.js +2 -7
  64. package/dist/m365/pp/commands/chatbot/chatbot-remove.js +2 -7
  65. package/dist/m365/pp/commands/dataverse/dataverse-table-remove.js +2 -7
  66. package/dist/m365/pp/commands/dataverse/dataverse-table-row-remove.js +2 -7
  67. package/dist/m365/pp/commands/solution/solution-publisher-remove.js +2 -7
  68. package/dist/m365/pp/commands/solution/solution-remove.js +2 -7
  69. package/dist/m365/purview/commands/retentionevent/retentionevent-remove.js +2 -7
  70. package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-remove.js +2 -7
  71. package/dist/m365/purview/commands/retentionlabel/retentionlabel-remove.js +2 -7
  72. package/dist/m365/spfx/commands/project/DeployWorkflow.js +4 -4
  73. package/dist/m365/spfx/commands/project/project-doctor/{doctor-1.18.1-rc.0.js → doctor-1.18.1.js} +1 -1
  74. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.18.2.js +21 -0
  75. package/dist/m365/spfx/commands/project/project-doctor.js +6 -3
  76. package/dist/m365/spfx/commands/project/project-github-workflow-add.js +17 -0
  77. package/dist/m365/spfx/commands/project/project-upgrade/{upgrade-1.18.1-rc.0.js → upgrade-1.18.1.js} +26 -26
  78. package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.18.2.js +53 -0
  79. package/dist/m365/spfx/commands/project/project-upgrade.js +18 -17
  80. package/dist/m365/spfx/commands/spfx-doctor.js +16 -1
  81. package/dist/m365/spo/commands/app/app-remove.js +2 -7
  82. package/dist/m365/spo/commands/app/app-retract.js +2 -7
  83. package/dist/m365/spo/commands/app/app-uninstall.js +2 -7
  84. package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-remove.js +2 -7
  85. package/dist/m365/spo/commands/cdn/cdn-origin-remove.js +2 -7
  86. package/dist/m365/spo/commands/commandset/commandset-remove.js +2 -7
  87. package/dist/m365/spo/commands/contenttype/contenttype-field-remove.js +2 -7
  88. package/dist/m365/spo/commands/contenttype/contenttype-remove.js +2 -2
  89. package/dist/m365/spo/commands/customaction/customaction-clear.js +2 -7
  90. package/dist/m365/spo/commands/customaction/customaction-remove.js +2 -7
  91. package/dist/m365/spo/commands/eventreceiver/eventreceiver-remove.js +2 -7
  92. package/dist/m365/spo/commands/field/field-remove.js +2 -7
  93. package/dist/m365/spo/commands/file/file-checkout-undo.js +2 -7
  94. package/dist/m365/spo/commands/file/file-remove.js +2 -7
  95. package/dist/m365/spo/commands/file/file-retentionlabel-ensure.js +14 -23
  96. package/dist/m365/spo/commands/file/file-retentionlabel-remove.js +21 -34
  97. package/dist/m365/spo/commands/file/file-roleassignment-remove.js +2 -7
  98. package/dist/m365/spo/commands/file/file-roleinheritance-break.js +2 -7
  99. package/dist/m365/spo/commands/file/file-roleinheritance-reset.js +2 -7
  100. package/dist/m365/spo/commands/file/file-sharinglink-clear.js +2 -7
  101. package/dist/m365/spo/commands/file/file-sharinglink-remove.js +2 -7
  102. package/dist/m365/spo/commands/file/file-version-clear.js +2 -7
  103. package/dist/m365/spo/commands/file/file-version-remove.js +2 -7
  104. package/dist/m365/spo/commands/file/file-version-restore.js +2 -7
  105. package/dist/m365/spo/commands/folder/folder-remove.js +2 -7
  106. package/dist/m365/spo/commands/folder/folder-retentionlabel-ensure.js +9 -29
  107. package/dist/m365/spo/commands/folder/folder-retentionlabel-remove.js +11 -35
  108. package/dist/m365/spo/commands/folder/folder-roleassignment-remove.js +2 -7
  109. package/dist/m365/spo/commands/folder/folder-roleinheritance-break.js +2 -7
  110. package/dist/m365/spo/commands/folder/folder-roleinheritance-reset.js +2 -7
  111. package/dist/m365/spo/commands/group/group-member-remove.js +2 -7
  112. package/dist/m365/spo/commands/group/group-remove.js +2 -7
  113. package/dist/m365/spo/commands/homesite/homesite-remove.js +2 -7
  114. package/dist/m365/spo/commands/hubsite/hubsite-disconnect.js +2 -7
  115. package/dist/m365/spo/commands/hubsite/hubsite-rights-revoke.js +2 -7
  116. package/dist/m365/spo/commands/hubsite/hubsite-unregister.js +2 -7
  117. package/dist/m365/spo/commands/knowledgehub/knowledgehub-remove.js +2 -7
  118. package/dist/m365/spo/commands/list/list-contenttype-remove.js +2 -7
  119. package/dist/m365/spo/commands/list/list-remove.js +2 -7
  120. package/dist/m365/spo/commands/list/list-retentionlabel-ensure.js +27 -37
  121. package/dist/m365/spo/commands/list/list-retentionlabel-remove.js +8 -26
  122. package/dist/m365/spo/commands/list/list-roleassignment-remove.js +2 -7
  123. package/dist/m365/spo/commands/list/list-roleinheritance-break.js +2 -7
  124. package/dist/m365/spo/commands/list/list-roleinheritance-reset.js +2 -7
  125. package/dist/m365/spo/commands/list/list-view-field-remove.js +2 -7
  126. package/dist/m365/spo/commands/list/list-view-remove.js +2 -7
  127. package/dist/m365/spo/commands/list/list-webhook-remove.js +2 -7
  128. package/dist/m365/spo/commands/listitem/listitem-attachment-remove.js +2 -7
  129. package/dist/m365/spo/commands/listitem/listitem-batch-add.js +5 -0
  130. package/dist/m365/spo/commands/listitem/listitem-remove.js +2 -7
  131. package/dist/m365/spo/commands/listitem/listitem-retentionlabel-ensure.js +36 -37
  132. package/dist/m365/spo/commands/listitem/listitem-retentionlabel-remove.js +38 -39
  133. package/dist/m365/spo/commands/listitem/listitem-roleassignment-remove.js +2 -7
  134. package/dist/m365/spo/commands/listitem/listitem-roleinheritance-break.js +2 -7
  135. package/dist/m365/spo/commands/listitem/listitem-roleinheritance-reset.js +2 -7
  136. package/dist/m365/spo/commands/navigation/navigation-node-remove.js +2 -7
  137. package/dist/m365/spo/commands/orgassetslibrary/orgassetslibrary-remove.js +2 -7
  138. package/dist/m365/spo/commands/orgnewssite/orgnewssite-remove.js +2 -7
  139. package/dist/m365/spo/commands/page/page-remove.js +2 -7
  140. package/dist/m365/spo/commands/propertybag/propertybag-remove.js +2 -7
  141. package/dist/m365/spo/commands/roledefinition/roledefinition-remove.js +2 -7
  142. package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-grant-revoke.js +49 -12
  143. package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-set.js +2 -7
  144. package/dist/m365/spo/commands/site/site-add.js +45 -12
  145. package/dist/m365/spo/commands/site/site-apppermission-remove.js +2 -7
  146. package/dist/m365/spo/commands/site/site-hubsite-disconnect.js +2 -7
  147. package/dist/m365/spo/commands/site/site-recyclebinitem-clear.js +2 -7
  148. package/dist/m365/spo/commands/site/site-recyclebinitem-move.js +2 -7
  149. package/dist/m365/spo/commands/site/site-recyclebinitem-remove.js +2 -7
  150. package/dist/m365/spo/commands/site/site-remove.js +2 -7
  151. package/dist/m365/spo/commands/site/site-set.js +33 -1
  152. package/dist/m365/spo/commands/sitedesign/sitedesign-remove.js +2 -7
  153. package/dist/m365/spo/commands/sitedesign/sitedesign-rights-revoke.js +2 -7
  154. package/dist/m365/spo/commands/sitedesign/sitedesign-task-remove.js +2 -7
  155. package/dist/m365/spo/commands/sitescript/sitescript-get.js +8 -2
  156. package/dist/m365/spo/commands/sitescript/sitescript-remove.js +2 -7
  157. package/dist/m365/spo/commands/storageentity/storageentity-remove.js +2 -7
  158. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-remove.js +2 -7
  159. package/dist/m365/spo/commands/tenant/tenant-commandset-remove.js +2 -7
  160. package/dist/m365/spo/commands/tenant/tenant-recyclebinitem-remove.js +2 -7
  161. package/dist/m365/spo/commands/tenant/tenant-recyclebinitem-restore.js +19 -2
  162. package/dist/m365/spo/commands/theme/theme-remove.js +2 -7
  163. package/dist/m365/spo/commands/user/user-remove.js +2 -7
  164. package/dist/m365/spo/commands/web/web-remove.js +2 -7
  165. package/dist/m365/spo/commands/web/web-roleassignment-remove.js +2 -7
  166. package/dist/m365/spo/commands/web/web-roleinheritance-break.js +2 -7
  167. package/dist/m365/spo/commands/web/web-roleinheritance-reset.js +2 -7
  168. package/dist/m365/teams/commands/app/app-remove.js +2 -7
  169. package/dist/m365/teams/commands/app/app-uninstall.js +2 -7
  170. package/dist/m365/teams/commands/cache/cache-remove.js +2 -7
  171. package/dist/m365/teams/commands/channel/channel-member-remove.js +2 -7
  172. package/dist/m365/teams/commands/channel/channel-remove.js +2 -7
  173. package/dist/m365/teams/commands/chat/chat-member-remove.js +2 -7
  174. package/dist/m365/teams/commands/meeting/meeting-add.js +151 -0
  175. package/dist/m365/teams/commands/tab/tab-remove.js +2 -7
  176. package/dist/m365/teams/commands/team/team-remove.js +2 -7
  177. package/dist/m365/teams/commands/user/user-app-remove.js +51 -12
  178. package/dist/m365/teams/commands.js +2 -1
  179. package/dist/m365/tenant/commands/people/people-profilecardproperty-add.js +131 -0
  180. package/dist/m365/tenant/commands/people/people-profilecardproperty-get.js +75 -0
  181. package/dist/m365/tenant/commands/people/people-profilecardproperty-list.js +53 -0
  182. package/dist/m365/tenant/commands/people/people-profilecardproperty-remove.js +79 -0
  183. package/dist/m365/tenant/commands/people/people-profilecardproperty-set.js +118 -0
  184. package/dist/m365/tenant/commands/people/profileCardProperties.js +24 -0
  185. package/dist/m365/tenant/commands.js +5 -0
  186. package/dist/m365/todo/commands/list/list-remove.js +2 -7
  187. package/dist/m365/todo/commands/task/task-remove.js +2 -7
  188. package/dist/m365/yammer/commands/group/group-user-remove.js +2 -7
  189. package/dist/m365/yammer/commands/message/message-like-set.js +3 -8
  190. package/dist/m365/yammer/commands/message/message-remove.js +2 -7
  191. package/dist/request.js +6 -0
  192. package/dist/settingsNames.js +2 -0
  193. package/dist/telemetry.js +0 -8
  194. package/dist/utils/aadAdministrativeUnit.js +25 -0
  195. package/dist/utils/prompt.js +30 -7
  196. package/dist/utils/spo.js +109 -0
  197. package/dist/utils/validation.js +5 -2
  198. package/docs/docs/_clisettings.mdx +2 -0
  199. package/docs/docs/cmd/aad/administrativeunit/administrativeunit-add.mdx +6 -2
  200. package/docs/docs/cmd/aad/administrativeunit/administrativeunit-get.mdx +5 -1
  201. package/docs/docs/cmd/aad/administrativeunit/administrativeunit-list.mdx +5 -1
  202. package/docs/docs/cmd/aad/administrativeunit/administrativeunit-remove.mdx +6 -2
  203. package/docs/docs/cmd/aad/approleassignment/approleassignment-add.mdx +1 -1
  204. package/docs/docs/cmd/aad/approleassignment/approleassignment-list.mdx +2 -2
  205. package/docs/docs/cmd/aad/approleassignment/approleassignment-remove.mdx +1 -1
  206. package/docs/docs/cmd/aad/group/group-list.mdx +11 -0
  207. package/docs/docs/cmd/aad/oauth2grant/oauth2grant-add.mdx +1 -1
  208. package/docs/docs/cmd/aad/oauth2grant/oauth2grant-list.mdx +2 -2
  209. package/docs/docs/cmd/aad/oauth2grant/oauth2grant-remove.mdx +2 -2
  210. package/docs/docs/cmd/aad/oauth2grant/oauth2grant-set.mdx +2 -2
  211. package/docs/docs/cmd/aad/policy/policy-list.mdx +1 -1
  212. package/docs/docs/cmd/aad/siteclassification/siteclassification-disable.mdx +1 -1
  213. package/docs/docs/cmd/aad/siteclassification/siteclassification-enable.mdx +1 -1
  214. package/docs/docs/cmd/aad/siteclassification/siteclassification-get.mdx +1 -1
  215. package/docs/docs/cmd/aad/siteclassification/siteclassification-set.mdx +1 -1
  216. package/docs/docs/cmd/aad/sp/sp-add.mdx +2 -2
  217. package/docs/docs/cmd/aad/sp/sp-get.mdx +2 -2
  218. package/docs/docs/cmd/aad/user/user-add.mdx +3 -3
  219. package/docs/docs/cmd/aad/user/user-guest-add.mdx +1 -1
  220. package/docs/docs/cmd/aad/user/user-set.mdx +3 -3
  221. package/docs/docs/cmd/{search/externalconnection/externalconnection-add.mdx → external/connection/connection-add.mdx} +16 -10
  222. package/docs/docs/cmd/external/connection/connection-doctor.mdx +179 -0
  223. package/docs/docs/cmd/{search/externalconnection/externalconnection-get.mdx → external/connection/connection-get.mdx} +16 -11
  224. package/docs/docs/cmd/{search/externalconnection/externalconnection-list.mdx → external/connection/connection-list.mdx} +12 -7
  225. package/docs/docs/cmd/external/connection/connection-remove.mdx +54 -0
  226. package/docs/docs/cmd/external/connection/connection-schema-add.mdx +41 -0
  227. package/docs/docs/cmd/external/item/item-add.mdx +145 -0
  228. package/docs/docs/cmd/flow/run/run-cancel.mdx +3 -0
  229. package/docs/docs/cmd/graph/changelog/changelog-list.mdx +5 -5
  230. package/docs/docs/cmd/login.mdx +1 -1
  231. package/docs/docs/cmd/onedrive/report/report-activityfilecounts.mdx +0 -3
  232. package/docs/docs/cmd/onedrive/report/report-activityusercounts.mdx +0 -3
  233. package/docs/docs/cmd/onedrive/report/report-activityuserdetail.mdx +0 -3
  234. package/docs/docs/cmd/onedrive/report/report-usageaccountcounts.mdx +0 -3
  235. package/docs/docs/cmd/onedrive/report/report-usageaccountdetail.mdx +0 -3
  236. package/docs/docs/cmd/onedrive/report/report-usagefilecounts.mdx +0 -3
  237. package/docs/docs/cmd/onedrive/report/report-usagestorage.mdx +0 -3
  238. package/docs/docs/cmd/onenote/notebook/notebook-list.mdx +1 -1
  239. package/docs/docs/cmd/outlook/message/message-list.mdx +1 -1
  240. package/docs/docs/cmd/outlook/message/message-move.mdx +1 -1
  241. package/docs/docs/cmd/outlook/report/report-mailactivitycounts.mdx +0 -3
  242. package/docs/docs/cmd/outlook/report/report-mailactivityusercounts.mdx +0 -3
  243. package/docs/docs/cmd/outlook/report/report-mailactivityuserdetail.mdx +0 -3
  244. package/docs/docs/cmd/outlook/report/report-mailappusageappsusercounts.mdx +0 -3
  245. package/docs/docs/cmd/outlook/report/report-mailappusageusercounts.mdx +0 -3
  246. package/docs/docs/cmd/outlook/report/report-mailappusageuserdetail.mdx +0 -3
  247. package/docs/docs/cmd/outlook/report/report-mailappusageversionsusercounts.mdx +0 -3
  248. package/docs/docs/cmd/outlook/report/report-mailboxusagedetail.mdx +0 -3
  249. package/docs/docs/cmd/outlook/report/report-mailboxusagemailboxcount.mdx +0 -3
  250. package/docs/docs/cmd/outlook/report/report-mailboxusagequotastatusmailboxcounts.mdx +0 -3
  251. package/docs/docs/cmd/outlook/report/report-mailboxusagestorage.mdx +0 -3
  252. package/docs/docs/cmd/planner/bucket/bucket-add.mdx +1 -1
  253. package/docs/docs/cmd/planner/bucket/bucket-set.mdx +1 -1
  254. package/docs/docs/cmd/planner/plan/plan-set.mdx +3 -3
  255. package/docs/docs/cmd/planner/task/task-set.mdx +1 -1
  256. package/docs/docs/cmd/purview/auditlog/auditlog-list.mdx +3 -3
  257. package/docs/docs/cmd/purview/retentionevent/retentionevent-add.mdx +1 -1
  258. package/docs/docs/cmd/purview/retentionevent/retentionevent-get.mdx +1 -1
  259. package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-add.mdx +1 -1
  260. package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-get.mdx +1 -1
  261. package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-remove.mdx +1 -1
  262. package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-set.mdx +1 -1
  263. package/docs/docs/cmd/purview/retentionlabel/retentionlabel-add.mdx +1 -1
  264. package/docs/docs/cmd/purview/sensitivitylabel/sensitivitylabel-policysettings-list.mdx +4 -4
  265. package/docs/docs/cmd/skype/report/report-activitycounts.mdx +0 -2
  266. package/docs/docs/cmd/skype/report/report-activityusercounts.mdx +0 -3
  267. package/docs/docs/cmd/skype/report/report-activityuserdetail.mdx +0 -3
  268. package/docs/docs/cmd/spfx/project/project-upgrade.mdx +1 -1
  269. package/docs/docs/cmd/spo/app/app-add.mdx +1 -1
  270. package/docs/docs/cmd/spo/app/app-deploy.mdx +1 -1
  271. package/docs/docs/cmd/spo/app/app-get.mdx +1 -1
  272. package/docs/docs/cmd/spo/app/app-install.mdx +1 -1
  273. package/docs/docs/cmd/spo/app/app-list.mdx +1 -1
  274. package/docs/docs/cmd/spo/app/app-remove.mdx +1 -1
  275. package/docs/docs/cmd/spo/app/app-retract.mdx +1 -1
  276. package/docs/docs/cmd/spo/app/app-uninstall.mdx +1 -1
  277. package/docs/docs/cmd/spo/app/app-upgrade.mdx +1 -1
  278. package/docs/docs/cmd/spo/contenttype/contenttype-add.mdx +1 -1
  279. package/docs/docs/cmd/spo/contenttype/contenttype-set.mdx +1 -1
  280. package/docs/docs/cmd/spo/file/file-rename.mdx +2 -0
  281. package/docs/docs/cmd/spo/hidedefaultthemes/hidedefaultthemes-get.mdx +1 -1
  282. package/docs/docs/cmd/spo/hidedefaultthemes/hidedefaultthemes-set.mdx +1 -1
  283. package/docs/docs/cmd/spo/report/report-activityfilecounts.mdx +0 -3
  284. package/docs/docs/cmd/spo/report/report-activitypages.mdx +0 -3
  285. package/docs/docs/cmd/spo/report/report-activityusercounts.mdx +0 -3
  286. package/docs/docs/cmd/spo/report/report-activityuserdetail.mdx +0 -3
  287. package/docs/docs/cmd/spo/report/report-siteusagedetail.mdx +0 -3
  288. package/docs/docs/cmd/spo/report/report-siteusagefilecounts.mdx +0 -3
  289. package/docs/docs/cmd/spo/report/report-siteusagepages.mdx +0 -3
  290. package/docs/docs/cmd/spo/report/report-siteusagesitecounts.mdx +0 -3
  291. package/docs/docs/cmd/spo/report/report-siteusagestorage.mdx +0 -3
  292. package/docs/docs/cmd/spo/serviceprincipal/serviceprincipal-grant-revoke.mdx +10 -1
  293. package/docs/docs/cmd/spo/site/site-add.mdx +25 -4
  294. package/docs/docs/cmd/spo/site/site-appcatalog-add.mdx +1 -1
  295. package/docs/docs/cmd/spo/site/site-appcatalog-remove.mdx +1 -1
  296. package/docs/docs/cmd/spo/site/site-groupify.mdx +1 -1
  297. package/docs/docs/cmd/spo/site/site-set.mdx +15 -0
  298. package/docs/docs/cmd/spo/sitedesign/sitedesign-add.mdx +3 -3
  299. package/docs/docs/cmd/spo/sitedesign/sitedesign-apply.mdx +1 -1
  300. package/docs/docs/cmd/spo/sitedesign/sitedesign-get.mdx +1 -1
  301. package/docs/docs/cmd/spo/sitedesign/sitedesign-list.mdx +1 -1
  302. package/docs/docs/cmd/spo/sitedesign/sitedesign-remove.mdx +1 -1
  303. package/docs/docs/cmd/spo/sitedesign/sitedesign-rights-grant.mdx +1 -1
  304. package/docs/docs/cmd/spo/sitedesign/sitedesign-rights-list.mdx +1 -1
  305. package/docs/docs/cmd/spo/sitedesign/sitedesign-rights-revoke.mdx +1 -1
  306. package/docs/docs/cmd/spo/sitedesign/sitedesign-run-list.mdx +1 -1
  307. package/docs/docs/cmd/spo/sitedesign/sitedesign-run-status-get.mdx +1 -1
  308. package/docs/docs/cmd/spo/sitedesign/sitedesign-set.mdx +3 -3
  309. package/docs/docs/cmd/spo/sitedesign/sitedesign-task-get.mdx +1 -1
  310. package/docs/docs/cmd/spo/sitedesign/sitedesign-task-list.mdx +1 -1
  311. package/docs/docs/cmd/spo/sitedesign/sitedesign-task-remove.mdx +1 -1
  312. package/docs/docs/cmd/spo/sitescript/sitescript-add.mdx +1 -1
  313. package/docs/docs/cmd/spo/sitescript/sitescript-get.mdx +73 -3
  314. package/docs/docs/cmd/spo/sitescript/sitescript-list.mdx +1 -1
  315. package/docs/docs/cmd/spo/sitescript/sitescript-remove.mdx +1 -1
  316. package/docs/docs/cmd/spo/sitescript/sitescript-set.mdx +1 -1
  317. package/docs/docs/cmd/spo/storageentity/storageentity-get.mdx +1 -1
  318. package/docs/docs/cmd/spo/storageentity/storageentity-list.mdx +1 -1
  319. package/docs/docs/cmd/spo/storageentity/storageentity-remove.mdx +1 -1
  320. package/docs/docs/cmd/spo/storageentity/storageentity-set.mdx +1 -1
  321. package/docs/docs/cmd/spo/theme/theme-apply.mdx +1 -1
  322. package/docs/docs/cmd/spo/theme/theme-get.mdx +1 -1
  323. package/docs/docs/cmd/spo/theme/theme-list.mdx +1 -1
  324. package/docs/docs/cmd/spo/theme/theme-remove.mdx +1 -1
  325. package/docs/docs/cmd/spo/user/user-remove.mdx +1 -1
  326. package/docs/docs/cmd/spo/web/web-set.mdx +1 -1
  327. package/docs/docs/cmd/teams/channel/channel-remove.mdx +1 -1
  328. package/docs/docs/cmd/teams/meeting/meeting-add.mdx +283 -0
  329. package/docs/docs/cmd/teams/meeting/meeting-get.mdx +1 -1
  330. package/docs/docs/cmd/teams/meeting/meeting-transcript-list.mdx +1 -1
  331. package/docs/docs/cmd/teams/report/report-deviceusagedistributionusercounts.mdx +0 -3
  332. package/docs/docs/cmd/teams/report/report-deviceusageusercounts.mdx +0 -3
  333. package/docs/docs/cmd/teams/report/report-deviceusageuserdetail.mdx +0 -3
  334. package/docs/docs/cmd/teams/report/report-pstncalls.mdx +1 -1
  335. package/docs/docs/cmd/teams/report/report-useractivitycounts.mdx +0 -3
  336. package/docs/docs/cmd/teams/report/report-useractivityusercounts.mdx +0 -3
  337. package/docs/docs/cmd/teams/report/report-useractivityuserdetail.mdx +0 -3
  338. package/docs/docs/cmd/teams/tab/tab-remove.mdx +1 -1
  339. package/docs/docs/cmd/teams/team/team-remove.mdx +1 -1
  340. package/docs/docs/cmd/teams/user/user-app-remove.mdx +23 -5
  341. package/docs/docs/cmd/tenant/people/people-profilecardproperty-add.mdx +126 -0
  342. package/docs/docs/cmd/tenant/people/people-profilecardproperty-get.mdx +101 -0
  343. package/docs/docs/cmd/tenant/people/people-profilecardproperty-list.mdx +98 -0
  344. package/docs/docs/cmd/tenant/people/people-profilecardproperty-remove.mdx +61 -0
  345. package/docs/docs/cmd/tenant/people/people-profilecardproperty-set.mdx +120 -0
  346. package/docs/docs/cmd/tenant/report/report-activeusercounts.mdx +0 -3
  347. package/docs/docs/cmd/tenant/report/report-activeuserdetail.mdx +0 -3
  348. package/docs/docs/cmd/tenant/report/report-servicesusercounts.mdx +0 -3
  349. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-healthissue-list.mdx +1 -1
  350. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-message-get.mdx +1 -1
  351. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-message-list.mdx +1 -1
  352. package/docs/docs/cmd/todo/task/task-set.mdx +1 -1
  353. package/docs/docs/cmd/yammer/report/report-activitycounts.mdx +0 -3
  354. package/docs/docs/cmd/yammer/report/report-activityusercounts.mdx +0 -3
  355. package/docs/docs/cmd/yammer/report/report-activityuserdetail.mdx +0 -3
  356. package/docs/docs/cmd/yammer/report/report-deviceusagedistributionusercounts.mdx +0 -3
  357. package/docs/docs/cmd/yammer/report/report-deviceusageusercounts.mdx +0 -3
  358. package/docs/docs/cmd/yammer/report/report-deviceusageuserdetail.mdx +0 -3
  359. package/docs/docs/cmd/yammer/report/report-groupsactivitycounts.mdx +0 -3
  360. package/docs/docs/cmd/yammer/report/report-groupsactivitydetail.mdx +0 -3
  361. package/docs/docs/cmd/yammer/report/report-groupsactivitygroupcounts.mdx +0 -3
  362. package/npm-shrinkwrap.json +609 -569
  363. package/package.json +37 -37
  364. package/dist/m365/search/commands.js +0 -9
  365. package/docs/docs/cmd/search/externalconnection/externalconnection-remove.mdx +0 -48
  366. package/docs/docs/cmd/search/externalconnection/externalconnection-schema-add.mdx +0 -35
package/dist/cli/Cli.js CHANGED
@@ -1,10 +1,11 @@
1
1
  import Configstore from 'configstore';
2
2
  import fs from 'fs';
3
3
  import minimist from 'minimist';
4
+ import { createRequire } from 'module';
4
5
  import ora from 'ora';
5
6
  import os from 'os';
6
7
  import path from 'path';
7
- import { pathToFileURL } from 'url';
8
+ import { fileURLToPath, pathToFileURL } from 'url';
8
9
  import Command, { CommandError } from '../Command.js';
9
10
  import config from '../config.js';
10
11
  import request from '../request.js';
@@ -12,10 +13,12 @@ import { settingsNames } from '../settingsNames.js';
12
13
  import { telemetry } from '../telemetry.js';
13
14
  import { app } from '../utils/app.js';
14
15
  import { formatting } from '../utils/formatting.js';
15
- import { fsUtil } from '../utils/fsUtil.js';
16
16
  import { md } from '../utils/md.js';
17
17
  import { validation } from '../utils/validation.js';
18
18
  import { prompt } from '../utils/prompt.js';
19
+ import { timings } from './timings.js';
20
+ const require = createRequire(import.meta.url);
21
+ const __dirname = fileURLToPath(new URL('.', import.meta.url));
19
22
  export class Cli {
20
23
  get config() {
21
24
  if (!this._config) {
@@ -34,7 +37,6 @@ export class Cli {
34
37
  }
35
38
  constructor() {
36
39
  this.commands = [];
37
- this.commandsFolder = '';
38
40
  const options = {
39
41
  text: 'Running command...',
40
42
  /* c8 ignore next 1 */
@@ -48,8 +50,11 @@ export class Cli {
48
50
  }
49
51
  return Cli.instance;
50
52
  }
51
- async execute(commandsFolder, rawArgs) {
52
- this.commandsFolder = commandsFolder;
53
+ async execute(rawArgs) {
54
+ const start = process.hrtime.bigint();
55
+ // for completion commands we also need information about commands' options
56
+ const loadAllCommandInfo = rawArgs.indexOf('completion') > -1;
57
+ this.loadAllCommandsInfo(loadAllCommandInfo);
53
58
  // check if help for a specific command has been requested using the
54
59
  // 'm365 help xyz' format. If so, remove 'help' from the array of words
55
60
  // to use lazy loading commands but keep track of the fact that help should
@@ -59,22 +64,10 @@ export class Cli {
59
64
  showHelp = true;
60
65
  rawArgs.shift();
61
66
  }
62
- // parse args to see if a command has been specified and can be loaded
63
- // rather than loading all commands
67
+ // parse args to see if a command has been specified
64
68
  const parsedArgs = minimist(rawArgs);
65
- // load commands
69
+ // load command
66
70
  await this.loadCommandFromArgs(parsedArgs._);
67
- if (this.currentCommandName) {
68
- for (let i = 0; i < this.commands.length; i++) {
69
- const command = this.commands[i];
70
- if (command.name === this.currentCommandName ||
71
- (command.aliases &&
72
- command.aliases.indexOf(this.currentCommandName) > -1)) {
73
- this.commandToExecute = command;
74
- break;
75
- }
76
- }
77
- }
78
71
  if (this.commandToExecute) {
79
72
  // we have found a command to execute. Parse args again taking into
80
73
  // account short and long options, option types and whether the command
@@ -90,6 +83,8 @@ export class Cli {
90
83
  }
91
84
  }
92
85
  else {
86
+ // we need this to properly support displaying commands
87
+ // from the current group
93
88
  this.optionsFromArgs = {
94
89
  options: parsedArgs
95
90
  };
@@ -105,34 +100,65 @@ export class Cli {
105
100
  }
106
101
  return Promise.resolve();
107
102
  }
108
- const optionsWithoutShorts = Cli.removeShortOptions(this.optionsFromArgs);
103
+ delete this.optionsFromArgs.options._;
104
+ delete this.optionsFromArgs.options['--'];
109
105
  try {
110
106
  // replace values staring with @ with file contents
111
- Cli.loadOptionValuesFromFiles(optionsWithoutShorts);
107
+ Cli.loadOptionValuesFromFiles(this.optionsFromArgs);
112
108
  }
113
109
  catch (e) {
114
- return this.closeWithError(e, optionsWithoutShorts);
110
+ return this.closeWithError(e, this.optionsFromArgs);
115
111
  }
112
+ const startProcessing = process.hrtime.bigint();
116
113
  try {
117
114
  // process options before passing them on to validation stage
118
- const contextCommandOptions = await this.loadOptionsFromContext(this.commandToExecute.options, optionsWithoutShorts.options.debug);
119
- optionsWithoutShorts.options = { ...contextCommandOptions, ...optionsWithoutShorts.options };
120
- await this.commandToExecute.command.processOptions(optionsWithoutShorts.options);
115
+ const contextCommandOptions = await this.loadOptionsFromContext(this.commandToExecute.options, this.optionsFromArgs.options.debug);
116
+ this.optionsFromArgs.options = { ...contextCommandOptions, ...this.optionsFromArgs.options };
117
+ await this.commandToExecute.command.processOptions(this.optionsFromArgs.options);
118
+ const endProcessing = process.hrtime.bigint();
119
+ timings.options.push(Number(endProcessing - startProcessing));
121
120
  }
122
121
  catch (e) {
123
- return this.closeWithError(e.message, optionsWithoutShorts, false);
122
+ const endProcessing = process.hrtime.bigint();
123
+ timings.options.push(Number(endProcessing - startProcessing));
124
+ return this.closeWithError(e.message, this.optionsFromArgs, false);
124
125
  }
125
126
  // if output not specified, set the configured output value (if any)
126
- if (optionsWithoutShorts.options.output === undefined) {
127
- optionsWithoutShorts.options.output = this.getSettingWithDefaultValue(settingsNames.output, 'json');
127
+ if (this.optionsFromArgs.options.output === undefined) {
128
+ this.optionsFromArgs.options.output = this.getSettingWithDefaultValue(settingsNames.output, 'json');
128
129
  }
129
- const validationResult = await this.commandToExecute.command.validate(optionsWithoutShorts, this.commandToExecute);
130
+ const startValidation = process.hrtime.bigint();
131
+ const validationResult = await this.commandToExecute.command.validate(this.optionsFromArgs, this.commandToExecute);
132
+ const endValidation = process.hrtime.bigint();
133
+ timings.validation.push(Number(endValidation - startValidation));
130
134
  if (validationResult !== true) {
131
- return this.closeWithError(validationResult, optionsWithoutShorts, true);
135
+ return this.closeWithError(validationResult, this.optionsFromArgs, true);
136
+ }
137
+ const end = process.hrtime.bigint();
138
+ timings.core.push(Number(end - start));
139
+ try {
140
+ await Cli.executeCommand(this.commandToExecute.command, this.optionsFromArgs);
141
+ const endTotal = process.hrtime.bigint();
142
+ timings.total.push(Number(endTotal - start));
143
+ this.printTimings(rawArgs);
144
+ process.exit(0);
145
+ }
146
+ catch (err) {
147
+ const endTotal = process.hrtime.bigint();
148
+ timings.total.push(Number(endTotal - start));
149
+ this.printTimings(rawArgs);
150
+ await this.closeWithError(err, this.optionsFromArgs);
151
+ /* c8 ignore next */
152
+ }
153
+ }
154
+ printTimings(rawArgs) {
155
+ if (rawArgs.some(arg => arg === '--debug')) {
156
+ Cli.error('');
157
+ Cli.error('Timings:');
158
+ Object.getOwnPropertyNames(timings).forEach(key => {
159
+ Cli.error(`${key}: ${timings[key].reduce((a, b) => a + b, 0) / 1e6}ms`);
160
+ });
132
161
  }
133
- return Cli
134
- .executeCommand(this.commandToExecute.command, optionsWithoutShorts)
135
- .then(_ => process.exit(0), err => this.closeWithError(err, optionsWithoutShorts));
136
162
  }
137
163
  static async executeCommand(command, args) {
138
164
  const logger = {
@@ -167,6 +193,7 @@ export class Cli {
167
193
  if (showSpinner && typeof global.it === 'undefined') {
168
194
  cli.spinner.start();
169
195
  }
196
+ const startCommand = process.hrtime.bigint();
170
197
  try {
171
198
  await command.action(logger, args);
172
199
  if (args.options.debug || args.options.verbose) {
@@ -181,6 +208,8 @@ export class Cli {
181
208
  if (cli.spinner.isSpinning) {
182
209
  cli.spinner.stop();
183
210
  }
211
+ const endCommand = process.hrtime.bigint();
212
+ timings.command.push(Number(endCommand - startCommand));
184
213
  }
185
214
  }
186
215
  static async executeCommandWithOutput(command, args, listener) {
@@ -248,55 +277,26 @@ export class Cli {
248
277
  request.logger = currentLogger;
249
278
  }
250
279
  }
251
- async loadAllCommands() {
252
- const files = fsUtil.readdirR(this.commandsFolder);
253
- await Promise.all(files.map(async (filePath) => {
254
- const file = pathToFileURL(filePath).toString();
255
- if (file.indexOf(`/commands/`) > -1 &&
256
- file.indexOf(`/assets/`) < 0 &&
257
- file.endsWith('.js') &&
258
- !file.endsWith('.spec.js')) {
259
- try {
260
- const command = await import(file);
261
- if (command.default instanceof Command) {
262
- this.loadCommand(command.default);
263
- }
264
- }
265
- catch (e) {
266
- this.closeWithError(e, { options: {} });
267
- }
268
- }
269
- }));
280
+ loadAllCommandsInfo(loadFull = false) {
281
+ const commandsInfoFileName = loadFull ? 'allCommandsFull.json' : 'allCommands.json';
282
+ this.commands = require(path.join(__dirname, '..', '..', commandsInfoFileName));
270
283
  }
271
284
  /**
272
285
  * Loads command files into CLI based on the specified arguments.
273
286
  *
274
287
  * @param commandNameWords Array of words specified as args
275
- */
288
+ */
276
289
  async loadCommandFromArgs(commandNameWords) {
277
- this.currentCommandName = commandNameWords.join(' ');
278
290
  if (commandNameWords.length === 0) {
279
- await this.loadAllCommands();
280
- return;
281
- }
282
- const isCompletionCommand = commandNameWords.indexOf('completion') > -1;
283
- if (isCompletionCommand) {
284
- await this.loadAllCommands();
285
291
  return;
286
292
  }
287
- let commandFilePath = '';
288
- if (commandNameWords.length === 1) {
289
- commandFilePath = path.join(this.commandsFolder, 'commands', `${commandNameWords[0]}.js`);
290
- }
291
- else {
292
- if (commandNameWords.length === 2) {
293
- commandFilePath = path.join(this.commandsFolder, commandNameWords[0], 'commands', `${commandNameWords.join('-')}.js`);
294
- }
295
- else {
296
- commandFilePath = path.join(this.commandsFolder, commandNameWords[0], 'commands', commandNameWords[1], commandNameWords.slice(1).join('-') + '.js');
297
- }
293
+ this.currentCommandName = commandNameWords.join(' ');
294
+ const commandFilePath = this.commands
295
+ .find(c => c.name === this.currentCommandName ||
296
+ c.aliases?.find(a => a === this.currentCommandName))?.file ?? '';
297
+ if (commandFilePath) {
298
+ await this.loadCommandFromFile(commandFilePath);
298
299
  }
299
- await this.loadCommandFromFile(commandFilePath);
300
300
  }
301
301
  async loadOptionsFromContext(commandOptions, debug) {
302
302
  const filePath = '.m365rc.json';
@@ -339,39 +339,37 @@ export class Cli {
339
339
  * Loads command from the specified file into CLI. If can't find the file
340
340
  * or the file doesn't contain a command, loads all available commands.
341
341
  *
342
- * @param commandFilePath File path of the file with command to load
342
+ * @param commandFilePathUrl File path of the file with command to load
343
343
  */
344
- async loadCommandFromFile(commandFilePath) {
345
- if (!fs.existsSync(commandFilePath)) {
346
- await this.loadAllCommands();
344
+ async loadCommandFromFile(commandFileUrl) {
345
+ const commandsFolder = path.join(__dirname, '../m365');
346
+ const filePath = path.join(commandsFolder, commandFileUrl);
347
+ if (!fs.existsSync(filePath)) {
348
+ // reset command name
349
+ this.currentCommandName = undefined;
347
350
  return;
348
351
  }
349
352
  try {
350
- const commandFileUrl = pathToFileURL(commandFilePath).toString();
351
- const command = await import(commandFileUrl);
353
+ const command = await import(pathToFileURL(filePath).toString());
352
354
  if (command.default instanceof Command) {
353
- this.loadCommand(command.default);
354
- }
355
- else {
356
- await this.loadAllCommands();
355
+ const commandInfo = this.commands.find(c => c.file === commandFileUrl);
356
+ this.commandToExecute = Cli.getCommandInfo(command.default, commandFileUrl, commandInfo?.help);
357
357
  }
358
358
  }
359
- catch {
360
- await this.loadAllCommands();
361
- }
359
+ catch { }
362
360
  }
363
- static getCommandInfo(command) {
361
+ static getCommandInfo(command, filePath = '', helpFilePath = '') {
364
362
  return {
365
363
  aliases: command.alias(),
366
364
  name: command.name,
365
+ description: command.description,
367
366
  command: command,
368
367
  options: this.getCommandOptions(command),
369
- defaultProperties: command.defaultProperties()
368
+ defaultProperties: command.defaultProperties(),
369
+ file: filePath,
370
+ help: helpFilePath
370
371
  };
371
372
  }
372
- loadCommand(command) {
373
- this.commands.push(Cli.getCommandInfo(command));
374
- }
375
373
  static getCommandOptions(command) {
376
374
  const options = [];
377
375
  command.options.forEach(option => {
@@ -508,7 +506,7 @@ export class Cli {
508
506
  if (arrayType !== 'object') {
509
507
  return logStatement.join(os.EOL);
510
508
  }
511
- // if output type has been set to 'text' or 'csv', process the retrieved
509
+ // if output type has been set to 'text', process the retrieved
512
510
  // data so that returned objects contain only default properties specified
513
511
  // on the current command. If there is no current command or the
514
512
  // command doesn't specify default properties, return original data
@@ -568,58 +566,39 @@ export class Cli {
568
566
  process.exit(exitCode);
569
567
  }
570
568
  printCommandHelp(helpMode) {
571
- let helpFilePath = '';
572
- let commandNameWords = [];
573
- if (this.commandToExecute) {
574
- commandNameWords = (this.commandToExecute.name).split(' ');
575
- }
576
- const pathChunks = [this.commandsFolder, '..', '..', 'docs', 'docs', 'cmd'];
577
- if (commandNameWords.length === 1) {
578
- pathChunks.push(`${commandNameWords[0]}.mdx`);
579
- }
580
- else {
581
- if (commandNameWords.length === 2) {
582
- pathChunks.push(commandNameWords[0], `${commandNameWords.join('-')}.mdx`);
583
- }
584
- else {
585
- pathChunks.push(commandNameWords[0], commandNameWords[1], commandNameWords.slice(1).join('-') + '.mdx');
586
- }
587
- }
588
- helpFilePath = path.join(...pathChunks);
569
+ const docsRootDir = path.join(__dirname, '..', '..', 'docs');
570
+ const helpFilePath = path.join(docsRootDir, 'docs', 'cmd', this.commandToExecute.help);
589
571
  if (fs.existsSync(helpFilePath)) {
590
572
  let helpContents = fs.readFileSync(helpFilePath, 'utf8');
591
573
  helpContents = this.getHelpSection(helpMode, helpContents);
592
- helpContents = md.md2plain(helpContents, path.join(this.commandsFolder, '..', '..', 'docs'));
574
+ helpContents = md.md2plain(helpContents, docsRootDir);
593
575
  Cli.log();
594
576
  Cli.log(helpContents);
595
577
  }
596
578
  }
597
579
  async getHelpMode(options) {
598
- const h = options.h;
599
- const help = options.help;
580
+ const { h, help } = options;
581
+ if (!h && !help) {
582
+ return this.getSettingWithDefaultValue(settingsNames.helpMode, Cli.defaultHelpMode);
583
+ }
600
584
  // user passed -h or --help, let's see if they passed a specific mode
601
585
  // or requested the default
602
- if (h || help) {
603
- const helpMode = h ?? help;
604
- if (typeof helpMode === 'boolean' || typeof helpMode !== 'string') {
605
- // requested default mode or passed a number, let's use default
606
- return this.getSettingWithDefaultValue(settingsNames.helpMode, Cli.defaultHelpMode);
586
+ const helpMode = h ?? help;
587
+ if (typeof helpMode === 'boolean' || typeof helpMode !== 'string') {
588
+ // requested default mode or passed a number, let's use default
589
+ return this.getSettingWithDefaultValue(settingsNames.helpMode, Cli.defaultHelpMode);
590
+ }
591
+ else {
592
+ const lowerCaseHelpMode = helpMode.toLowerCase();
593
+ if (Cli.helpModes.indexOf(lowerCaseHelpMode) < 0) {
594
+ await Cli.getInstance().closeWithError(`Unknown help mode ${helpMode}. Allowed values are ${Cli.helpModes.join(', ')}`, { options }, false);
595
+ /* c8 ignore next 2 */
596
+ return ''; // noop
607
597
  }
608
598
  else {
609
- const lowerCaseHelpMode = helpMode.toLowerCase();
610
- if (Cli.helpModes.indexOf(lowerCaseHelpMode) < 0) {
611
- await Cli.getInstance().closeWithError(`Unknown help mode ${helpMode}. Allowed values are ${Cli.helpModes.join(', ')}`, { options }, false);
612
- /* c8 ignore next 2 */
613
- return ''; // noop
614
- }
615
- else {
616
- return lowerCaseHelpMode;
617
- }
599
+ return lowerCaseHelpMode;
618
600
  }
619
601
  }
620
- else {
621
- return this.getSettingWithDefaultValue(settingsNames.helpMode, Cli.defaultHelpMode);
622
- }
623
602
  }
624
603
  getHelpSection(helpMode, helpContents) {
625
604
  if (helpMode === 'full') {
@@ -709,7 +688,7 @@ export class Cli {
709
688
  Cli.log();
710
689
  const sortedCommandNamesToPrint = Object.getOwnPropertyNames(commandsToPrint).sort();
711
690
  sortedCommandNamesToPrint.forEach(commandName => {
712
- Cli.log(` ${`${commandName} [options]`.padEnd(maxLength, ' ')} ${commandsToPrint[commandName].command.description}`);
691
+ Cli.log(` ${`${commandName} [options]`.padEnd(maxLength, ' ')} ${commandsToPrint[commandName].description}`);
713
692
  });
714
693
  }
715
694
  const namesOfCommandGroupsToPrint = Object.keys(commandGroupsToPrint);
@@ -804,35 +783,47 @@ export class Cli {
804
783
  cli.spinner.start();
805
784
  }
806
785
  }
807
- static async prompt(options, answers) {
786
+ static async promptForSelection(config) {
787
+ const cli = Cli.getInstance();
788
+ const spinnerSpinning = cli.spinner.isSpinning;
789
+ /* c8 ignore next 3 */
790
+ if (spinnerSpinning) {
791
+ cli.spinner.stop();
792
+ }
793
+ const answer = await prompt.forSelection(config);
794
+ Cli.error('');
795
+ // Restart the spinner if it was running before the prompt
796
+ /* c8 ignore next 3 */
797
+ if (spinnerSpinning) {
798
+ cli.spinner.start();
799
+ }
800
+ return answer;
801
+ }
802
+ static async promptForConfirmation(config) {
808
803
  const cli = Cli.getInstance();
809
804
  const spinnerSpinning = cli.spinner.isSpinning;
810
805
  /* c8 ignore next 3 */
811
806
  if (spinnerSpinning) {
812
807
  cli.spinner.stop();
813
808
  }
814
- const response = await prompt.forInput(options, answers);
809
+ const answer = await prompt.forConfirmation(config);
810
+ Cli.error('');
815
811
  // Restart the spinner if it was running before the prompt
816
812
  /* c8 ignore next 3 */
817
813
  if (spinnerSpinning) {
818
814
  cli.spinner.start();
819
815
  }
820
- return response;
816
+ return answer;
821
817
  }
822
818
  static async handleMultipleResultsFound(message, values) {
823
819
  const prompt = Cli.getInstance().getSettingWithDefaultValue(settingsNames.prompt, true);
824
820
  if (!prompt) {
825
821
  throw new Error(`${message} Found: ${Object.keys(values).join(', ')}.`);
826
822
  }
827
- const response = await Cli.prompt({
828
- type: 'list',
829
- name: 'select',
830
- default: 0,
831
- prefix: '🌶️ ',
832
- message: `${message} Please choose one:`,
833
- choices: Object.keys(values)
834
- });
835
- return values[response.select];
823
+ Cli.error(`🌶️ ${message}`);
824
+ const choices = Object.keys(values).map((choice) => { return { name: choice, value: choice }; });
825
+ const response = await Cli.promptForSelection({ message: `Please choose one:`, choices });
826
+ return values[response];
836
827
  }
837
828
  static removeShortOptions(args) {
838
829
  const filteredArgs = JSON.parse(JSON.stringify(args));
@@ -0,0 +1,9 @@
1
+ export const timings = {
2
+ api: [],
3
+ core: [],
4
+ command: [],
5
+ options: [],
6
+ total: [],
7
+ validation: []
8
+ };
9
+ //# sourceMappingURL=timings.js.map
package/dist/index.js CHANGED
@@ -1,11 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import fs from 'fs';
3
- import path from 'path';
4
- import url from 'url';
5
2
  import { Cli } from './cli/Cli.js';
6
- import { telemetry } from './telemetry.js';
7
3
  import { app } from './utils/app.js';
8
- const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
9
4
  // required to make console.log() in combination with piped output synchronous
10
5
  // on Windows/in PowerShell so that the output is not trimmed by calling
11
6
  // process.exit() after executing the command, while the output is still
@@ -18,14 +13,5 @@ if (!process.env.CLIMICROSOFT365_NOUPDATE) {
18
13
  updateNotifier.default({ pkg: app.packageJson() }).notify({ defer: false });
19
14
  });
20
15
  }
21
- fs.realpath(__dirname, async (err, resolvedPath) => {
22
- try {
23
- const cli = Cli.getInstance();
24
- await cli.execute(path.join(resolvedPath, 'm365'), process.argv.slice(2));
25
- }
26
- catch (e) {
27
- telemetry.trackException(e);
28
- process.exit(1);
29
- }
30
- });
16
+ Cli.getInstance().execute(process.argv.slice(2));
31
17
  //# sourceMappingURL=index.js.map
@@ -24,7 +24,7 @@ class AadAdministrativeUnitAddCommand extends GraphCommand {
24
24
  const requestOptions = {
25
25
  url: `${this.resource}/v1.0/directory/administrativeUnits`,
26
26
  headers: {
27
- 'accept': 'application/json;odata.metadata=none'
27
+ accept: 'application/json;odata.metadata=none'
28
28
  },
29
29
  responseType: 'json',
30
30
  data: {
@@ -45,7 +45,7 @@ class AadAdministrativeUnitAddCommand extends GraphCommand {
45
45
  _AadAdministrativeUnitAddCommand_instances = new WeakSet(), _AadAdministrativeUnitAddCommand_initTelemetry = function _AadAdministrativeUnitAddCommand_initTelemetry() {
46
46
  this.telemetry.push((args) => {
47
47
  Object.assign(this.telemetryProperties, {
48
- hiddenMembership: args.options.hiddenMembership
48
+ hiddenMembership: !!args.options.hiddenMembership
49
49
  });
50
50
  });
51
51
  }, _AadAdministrativeUnitAddCommand_initOptions = function _AadAdministrativeUnitAddCommand_initOptions() {
@@ -54,7 +54,7 @@ _AadAdministrativeUnitAddCommand_instances = new WeakSet(), _AadAdministrativeUn
54
54
  }, {
55
55
  option: '-d, --description [description]'
56
56
  }, {
57
- option: '--hiddenMembership [hiddenMembership]'
57
+ option: '--hiddenMembership'
58
58
  });
59
59
  };
60
60
  export default new AadAdministrativeUnitAddCommand();
@@ -8,9 +8,7 @@ import { validation } from "../../../../utils/validation.js";
8
8
  import request from "../../../../request.js";
9
9
  import GraphCommand from "../../../base/GraphCommand.js";
10
10
  import commands from "../../commands.js";
11
- import { odata } from "../../../../utils/odata.js";
12
- import { formatting } from "../../../../utils/formatting.js";
13
- import { Cli } from "../../../../cli/Cli.js";
11
+ import { aadAdministrativeUnit } from "../../../../utils/aadAdministrativeUnit.js";
14
12
  class AadAdministrativeUnitGetCommand extends GraphCommand {
15
13
  get name() {
16
14
  return commands.ADMINISTRATIVEUNIT_GET;
@@ -34,7 +32,7 @@ class AadAdministrativeUnitGetCommand extends GraphCommand {
34
32
  administrativeUnit = await this.getAdministrativeUnitById(args.options.id);
35
33
  }
36
34
  else {
37
- administrativeUnit = await this.getAdministrativeUnitByDisplayName(args.options.displayName);
35
+ administrativeUnit = await aadAdministrativeUnit.getAdministrativeUnitByDisplayName(args.options.displayName);
38
36
  }
39
37
  await logger.log(administrativeUnit);
40
38
  }
@@ -52,17 +50,6 @@ class AadAdministrativeUnitGetCommand extends GraphCommand {
52
50
  };
53
51
  return await request.get(requestOptions);
54
52
  }
55
- async getAdministrativeUnitByDisplayName(displayName) {
56
- const administrativeUnits = await odata.getAllItems(`${this.resource}/v1.0/directory/administrativeUnits?$filter=displayName eq '${formatting.encodeQueryParameter(displayName)}'`);
57
- if (administrativeUnits.length === 0) {
58
- throw `The specified administrative unit '${displayName}' does not exist.`;
59
- }
60
- if (administrativeUnits.length > 1) {
61
- const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', administrativeUnits);
62
- return await Cli.handleMultipleResultsFound(`Multiple administrative units with name '${displayName}' found.`, resultAsKeyValuePair);
63
- }
64
- return administrativeUnits[0];
65
- }
66
53
  }
67
54
  _AadAdministrativeUnitGetCommand_instances = new WeakSet(), _AadAdministrativeUnitGetCommand_initTelemetry = function _AadAdministrativeUnitGetCommand_initTelemetry() {
68
55
  this.telemetry.push((args) => {
@@ -4,12 +4,11 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
4
4
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
5
  };
6
6
  var _AadAdministrativeUnitRemoveCommand_instances, _AadAdministrativeUnitRemoveCommand_initTelemetry, _AadAdministrativeUnitRemoveCommand_initOptions, _AadAdministrativeUnitRemoveCommand_initOptionSets, _AadAdministrativeUnitRemoveCommand_initValidators, _AadAdministrativeUnitRemoveCommand_initTypes;
7
+ import { aadAdministrativeUnit } from '../../../../utils/aadAdministrativeUnit.js';
7
8
  import { validation } from "../../../../utils/validation.js";
8
9
  import request from "../../../../request.js";
9
10
  import GraphCommand from "../../../base/GraphCommand.js";
10
11
  import commands from "../../commands.js";
11
- import { odata } from "../../../../utils/odata.js";
12
- import { formatting } from "../../../../utils/formatting.js";
13
12
  import { Cli } from "../../../../cli/Cli.js";
14
13
  class AadAdministrativeUnitRemoveCommand extends GraphCommand {
15
14
  get name() {
@@ -32,7 +31,8 @@ class AadAdministrativeUnitRemoveCommand extends GraphCommand {
32
31
  try {
33
32
  let administrativeUnitId = args.options.id;
34
33
  if (args.options.displayName) {
35
- administrativeUnitId = await this.getAdministrativeUnitIdByDisplayName(args.options.displayName);
34
+ const administrativeUnit = await aadAdministrativeUnit.getAdministrativeUnitByDisplayName(args.options.displayName);
35
+ administrativeUnitId = administrativeUnit.id;
36
36
  }
37
37
  const requestOptions = {
38
38
  url: `${this.resource}/v1.0/directory/administrativeUnits/${administrativeUnitId}`,
@@ -50,29 +50,12 @@ class AadAdministrativeUnitRemoveCommand extends GraphCommand {
50
50
  await removeAdministrativeUnit();
51
51
  }
52
52
  else {
53
- const result = await Cli.prompt({
54
- type: 'confirm',
55
- name: 'continue',
56
- default: false,
57
- message: `Are you sure you want to remove administrative unit '${args.options.id || args.options.displayName}'?`
58
- });
59
- if (result.continue) {
53
+ const result = await Cli.promptForConfirmation({ message: `Are you sure you want to remove administrative unit '${args.options.id || args.options.displayName}'?` });
54
+ if (result) {
60
55
  await removeAdministrativeUnit();
61
56
  }
62
57
  }
63
58
  }
64
- async getAdministrativeUnitIdByDisplayName(displayName) {
65
- const administrativeUnits = await odata.getAllItems(`${this.resource}/v1.0/directory/administrativeUnits?$filter=displayName eq '${formatting.encodeQueryParameter(displayName)}'&$select=id`);
66
- if (administrativeUnits.length === 0) {
67
- throw `The specified administrative unit '${displayName}' does not exist.`;
68
- }
69
- if (administrativeUnits.length > 1) {
70
- const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', administrativeUnits);
71
- const selectedAdministrativeUnit = await Cli.handleMultipleResultsFound(`Multiple administrative units with name '${displayName}' found.`, resultAsKeyValuePair);
72
- return selectedAdministrativeUnit.id;
73
- }
74
- return administrativeUnits[0].id;
75
- }
76
59
  }
77
60
  _AadAdministrativeUnitRemoveCommand_instances = new WeakSet(), _AadAdministrativeUnitRemoveCommand_initTelemetry = function _AadAdministrativeUnitRemoveCommand_initTelemetry() {
78
61
  this.telemetry.push((args) => {
@@ -49,13 +49,8 @@ class AadAppRemoveCommand extends GraphCommand {
49
49
  await deleteApp();
50
50
  }
51
51
  else {
52
- const result = await Cli.prompt({
53
- type: 'confirm',
54
- name: 'continue',
55
- default: false,
56
- message: `Are you sure you want to remove the app?`
57
- });
58
- if (result.continue) {
52
+ const result = await Cli.promptForConfirmation({ message: `Are you sure you want to remove the app?` });
53
+ if (result) {
59
54
  await deleteApp();
60
55
  }
61
56
  }
@@ -38,13 +38,8 @@ class AadAppRoleRemoveCommand extends GraphCommand {
38
38
  await deleteAppRole();
39
39
  }
40
40
  else {
41
- const result = await Cli.prompt({
42
- type: 'confirm',
43
- name: 'continue',
44
- default: false,
45
- message: `Are you sure you want to remove the app role ?`
46
- });
47
- if (result.continue) {
41
+ const result = await Cli.promptForConfirmation({ message: `Are you sure you want to remove the app role?` });
42
+ if (result) {
48
43
  await deleteAppRole();
49
44
  }
50
45
  }