@pnp/cli-microsoft365 5.0.0-beta.fc638c4 → 5.1.0-beta.55e5dfb

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 (447) hide show
  1. package/.devcontainer/devcontainer.json +12 -9
  2. package/.eslintrc.js +2 -0
  3. package/.mocharc.json +9 -0
  4. package/README.md +2 -2
  5. package/dist/Auth.js +22 -9
  6. package/dist/Command.js +1 -1
  7. package/dist/api.d.ts +13 -0
  8. package/dist/api.js +17 -0
  9. package/dist/cli/Cli.js +40 -10
  10. package/dist/m365/aad/commands/app/app-add.js +54 -18
  11. package/dist/m365/aad/commands/app/app-delete.js +123 -0
  12. package/dist/m365/aad/commands/app/app-get.js +59 -14
  13. package/dist/m365/aad/commands/app/app-role-delete.js +2 -2
  14. package/dist/m365/aad/commands/app/app-role-list.js +6 -5
  15. package/dist/m365/aad/commands/app/app-set.js +98 -3
  16. package/dist/m365/aad/commands/approleassignment/approleassignment-add.js +4 -4
  17. package/dist/m365/aad/commands/approleassignment/approleassignment-list.js +3 -3
  18. package/dist/m365/aad/commands/approleassignment/approleassignment-remove.js +4 -4
  19. package/dist/m365/aad/commands/group/group-list.js +21 -7
  20. package/dist/m365/aad/commands/groupsetting/groupsetting-add.js +2 -2
  21. package/dist/m365/aad/commands/groupsetting/groupsetting-get.js +2 -2
  22. package/dist/m365/aad/commands/groupsetting/groupsetting-list.js +7 -6
  23. package/dist/m365/aad/commands/groupsetting/groupsetting-remove.js +2 -2
  24. package/dist/m365/aad/commands/groupsetting/groupsetting-set.js +2 -2
  25. package/dist/m365/aad/commands/groupsettingtemplate/groupsettingtemplate-get.js +8 -8
  26. package/dist/m365/aad/commands/groupsettingtemplate/groupsettingtemplate-list.js +7 -6
  27. package/dist/m365/aad/commands/o365group/o365group-add.js +2 -2
  28. package/dist/m365/aad/commands/o365group/o365group-conversation-list.js +41 -0
  29. package/dist/m365/aad/commands/o365group/o365group-get.js +2 -2
  30. package/dist/m365/aad/commands/o365group/o365group-list.js +15 -12
  31. package/dist/m365/aad/commands/o365group/o365group-recyclebinitem-clear.js +8 -7
  32. package/dist/m365/aad/commands/o365group/o365group-recyclebinitem-list.js +7 -6
  33. package/dist/m365/aad/commands/o365group/o365group-recyclebinitem-restore.js +2 -2
  34. package/dist/m365/aad/commands/o365group/o365group-remove.js +2 -2
  35. package/dist/m365/aad/commands/o365group/o365group-renew.js +2 -2
  36. package/dist/m365/aad/commands/o365group/o365group-set.js +2 -2
  37. package/dist/m365/aad/commands/o365group/o365group-teamify.js +2 -2
  38. package/dist/m365/aad/commands/o365group/o365group-user-add.js +3 -3
  39. package/dist/m365/aad/commands/o365group/o365group-user-list.js +21 -15
  40. package/dist/m365/aad/commands/o365group/o365group-user-remove.js +3 -3
  41. package/dist/m365/aad/commands/o365group/o365group-user-set.js +23 -17
  42. package/dist/m365/aad/commands/oauth2grant/oauth2grant-add.js +3 -3
  43. package/dist/m365/aad/commands/oauth2grant/oauth2grant-list.js +2 -2
  44. package/dist/m365/aad/commands/sp/sp-add.js +3 -3
  45. package/dist/m365/aad/commands/sp/sp-get.js +3 -3
  46. package/dist/m365/aad/commands/user/user-get.js +2 -2
  47. package/dist/m365/aad/commands/user/user-hibp.js +2 -2
  48. package/dist/m365/aad/commands/user/user-list.js +7 -6
  49. package/dist/m365/aad/commands/user/user-set.js +2 -2
  50. package/dist/m365/aad/commands.js +2 -0
  51. package/dist/m365/base/AppCommand.js +2 -2
  52. package/dist/m365/base/SpoCommand.js +0 -260
  53. package/dist/m365/cli/commands/cli-doctor.js +2 -2
  54. package/dist/m365/cli/commands/config/config-set.js +1 -0
  55. package/dist/m365/commands/status.js +3 -3
  56. package/dist/m365/file/commands/file-add.js +3 -3
  57. package/dist/m365/file/commands/file-list.js +14 -12
  58. package/dist/m365/flow/commands/flow-export.js +2 -2
  59. package/dist/m365/flow/commands/flow-remove.js +2 -2
  60. package/dist/m365/flow/commands/run/run-cancel.js +2 -2
  61. package/dist/m365/flow/commands/run/run-resubmit.js +2 -2
  62. package/dist/m365/graph/commands/schemaextension/schemaextension-add.js +2 -2
  63. package/dist/m365/graph/commands/schemaextension/schemaextension-list.js +2 -2
  64. package/dist/m365/graph/commands/schemaextension/schemaextension-set.js +2 -2
  65. package/dist/m365/graph/commands/subscription/subscription-add.js +2 -2
  66. package/dist/m365/onedrive/commands/onedrive-list.js +3 -2
  67. package/dist/m365/outlook/commands/message/message-list.js +6 -5
  68. package/dist/m365/outlook/commands/room/room-list.js +44 -0
  69. package/dist/m365/outlook/commands/roomlist/roomlist-list.js +26 -0
  70. package/dist/m365/outlook/commands.js +2 -0
  71. package/dist/m365/pa/commands/app/app-get.js +2 -2
  72. package/dist/m365/pa/commands/app/app-remove.js +2 -2
  73. package/dist/m365/pa/commands/pcf/pcf-init.js +4 -4
  74. package/dist/m365/pa/commands/solution/solution-init.js +2 -2
  75. package/dist/m365/planner/commands/bucket/bucket-add.js +2 -2
  76. package/dist/m365/planner/commands/bucket/bucket-list.js +7 -7
  77. package/dist/m365/planner/commands/plan/plan-add.js +2 -2
  78. package/dist/m365/planner/commands/plan/plan-details-get.js +134 -0
  79. package/dist/m365/planner/commands/plan/plan-get.js +7 -7
  80. package/dist/m365/planner/commands/plan/plan-list.js +2 -2
  81. package/dist/m365/planner/commands/task/task-add.js +6 -6
  82. package/dist/m365/planner/commands/task/task-details-get.js +39 -0
  83. package/dist/m365/planner/commands/task/task-get.js +37 -0
  84. package/dist/m365/planner/commands/task/task-list.js +46 -16
  85. package/dist/m365/planner/commands/task/task-set.js +6 -6
  86. package/dist/m365/planner/commands.js +3 -0
  87. package/dist/m365/spfx/commands/package/package-generate.js +4 -4
  88. package/dist/m365/spfx/commands/project/base-project-command.js +18 -19
  89. package/dist/m365/spfx/commands/project/project-upgrade/index.js +0 -1
  90. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN001005_DEP_types_react.js +2 -2
  91. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN001006_DEP_types_react_dom.js +2 -2
  92. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN001008_DEP_react.js +2 -2
  93. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN001009_DEP_react_dom.js +2 -2
  94. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN001015_DEP_types_react_addons_shallow_compare.js +2 -2
  95. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN001016_DEP_types_react_addons_update.js +2 -2
  96. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN001017_DEP_types_react_addons_update.js +2 -2
  97. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN001019_DEP_knockout.js +2 -2
  98. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN001020_DEP_types_knockout.js +2 -2
  99. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN001022_DEP_office_ui_fabric_react.js +2 -2
  100. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002015_DEVDEP_types_react.js +2 -2
  101. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002016_DEVDEP_types_react_dom.js +2 -2
  102. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN020001_RES_types_react.js +2 -2
  103. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN022001_SCSS_remove_fabric_react.js +2 -2
  104. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN022002_SCSS_add_fabric_react.js +2 -2
  105. package/dist/m365/spfx/commands/project/project-upgrade/{upgrade-1.14.0-beta.5.js → upgrade-1.14.0.js} +25 -25
  106. package/dist/m365/spfx/commands/project/project-upgrade.js +13 -15
  107. package/dist/m365/spfx/commands/spfx-doctor.js +25 -6
  108. package/dist/m365/spo/commands/app/app-add.js +3 -2
  109. package/dist/m365/spo/commands/app/app-deploy.js +4 -4
  110. package/dist/m365/spo/commands/app/app-get.js +4 -4
  111. package/dist/m365/spo/commands/app/app-install.js +3 -3
  112. package/dist/m365/spo/commands/app/app-instance-list.js +2 -1
  113. package/dist/m365/spo/commands/app/app-list.js +3 -2
  114. package/dist/m365/spo/commands/app/app-remove.js +4 -5
  115. package/dist/m365/spo/commands/app/app-retract.js +4 -5
  116. package/dist/m365/spo/commands/app/app-uninstall.js +3 -3
  117. package/dist/m365/spo/commands/app/app-upgrade.js +3 -3
  118. package/dist/m365/spo/commands/apppage/apppage-add.js +2 -2
  119. package/dist/m365/spo/commands/apppage/apppage-set.js +2 -2
  120. package/dist/m365/spo/commands/cdn/cdn-get.js +4 -3
  121. package/dist/m365/spo/commands/cdn/cdn-origin-add.js +5 -5
  122. package/dist/m365/spo/commands/cdn/cdn-origin-list.js +4 -3
  123. package/dist/m365/spo/commands/cdn/cdn-origin-remove.js +5 -5
  124. package/dist/m365/spo/commands/cdn/cdn-policy-list.js +4 -3
  125. package/dist/m365/spo/commands/cdn/cdn-policy-set.js +5 -5
  126. package/dist/m365/spo/commands/cdn/cdn-set.js +3 -2
  127. package/dist/m365/spo/commands/contenttype/contenttype-add.js +6 -6
  128. package/dist/m365/spo/commands/contenttype/contenttype-field-remove.js +6 -6
  129. package/dist/m365/spo/commands/contenttype/contenttype-field-set.js +6 -6
  130. package/dist/m365/spo/commands/contenttype/contenttype-get.js +2 -1
  131. package/dist/m365/spo/commands/contenttype/contenttype-list.js +2 -1
  132. package/dist/m365/spo/commands/contenttype/contenttype-remove.js +2 -1
  133. package/dist/m365/spo/commands/contenttypehub/contenttypehub-get.js +3 -2
  134. package/dist/m365/spo/commands/customaction/customaction-add.js +3 -3
  135. package/dist/m365/spo/commands/customaction/customaction-clear.js +2 -1
  136. package/dist/m365/spo/commands/customaction/customaction-get.js +3 -3
  137. package/dist/m365/spo/commands/customaction/customaction-list.js +2 -1
  138. package/dist/m365/spo/commands/customaction/customaction-remove.js +3 -3
  139. package/dist/m365/spo/commands/customaction/customaction-set.js +4 -4
  140. package/dist/m365/spo/commands/externaluser/externaluser-list.js +6 -6
  141. package/dist/m365/spo/commands/feature/feature-enable.js +2 -1
  142. package/dist/m365/spo/commands/feature/feature-list.js +2 -1
  143. package/dist/m365/spo/commands/field/field-add.js +3 -2
  144. package/dist/m365/spo/commands/field/field-get.js +5 -5
  145. package/dist/m365/spo/commands/field/field-remove.js +5 -5
  146. package/dist/m365/spo/commands/field/field-set.js +10 -10
  147. package/dist/m365/spo/commands/file/file-add.js +5 -7
  148. package/dist/m365/spo/commands/file/file-checkin.js +3 -3
  149. package/dist/m365/spo/commands/file/file-checkout.js +3 -3
  150. package/dist/m365/spo/commands/file/file-copy.js +18 -7
  151. package/dist/m365/spo/commands/file/file-get.js +3 -3
  152. package/dist/m365/spo/commands/file/file-list.js +3 -3
  153. package/dist/m365/spo/commands/file/file-move.js +18 -7
  154. package/dist/m365/spo/commands/file/file-remove.js +3 -3
  155. package/dist/m365/spo/commands/file/file-sharinginfo-get.js +3 -3
  156. package/dist/m365/spo/commands/folder/folder-add.js +3 -3
  157. package/dist/m365/spo/commands/folder/folder-copy.js +16 -5
  158. package/dist/m365/spo/commands/folder/folder-get.js +3 -3
  159. package/dist/m365/spo/commands/folder/folder-list.js +3 -3
  160. package/dist/m365/spo/commands/folder/folder-move.js +16 -5
  161. package/dist/m365/spo/commands/folder/folder-remove.js +3 -3
  162. package/dist/m365/spo/commands/folder/folder-rename.js +6 -8
  163. package/dist/m365/spo/commands/group/group-get.js +2 -1
  164. package/dist/m365/spo/commands/group/group-list.js +2 -1
  165. package/dist/m365/spo/commands/group/group-remove.js +2 -1
  166. package/dist/m365/spo/commands/group/group-user-add.js +17 -9
  167. package/dist/m365/spo/commands/group/group-user-list.js +2 -1
  168. package/dist/m365/spo/commands/group/group-user-remove.js +101 -0
  169. package/dist/m365/spo/commands/hidedefaultthemes/hidedefaultthemes-get.js +2 -1
  170. package/dist/m365/spo/commands/hidedefaultthemes/hidedefaultthemes-set.js +2 -1
  171. package/dist/m365/spo/commands/homesite/homesite-get.js +2 -1
  172. package/dist/m365/spo/commands/homesite/homesite-remove.js +3 -2
  173. package/dist/m365/spo/commands/homesite/homesite-set.js +5 -5
  174. package/dist/m365/spo/commands/hubsite/hubsite-connect.js +4 -4
  175. package/dist/m365/spo/commands/hubsite/hubsite-data-get.js +2 -1
  176. package/dist/m365/spo/commands/hubsite/hubsite-disconnect.js +3 -2
  177. package/dist/m365/spo/commands/hubsite/hubsite-get.js +3 -3
  178. package/dist/m365/spo/commands/hubsite/hubsite-list.js +2 -1
  179. package/dist/m365/spo/commands/hubsite/hubsite-register.js +3 -2
  180. package/dist/m365/spo/commands/hubsite/hubsite-rights-grant.js +6 -6
  181. package/dist/m365/spo/commands/hubsite/hubsite-rights-revoke.js +6 -6
  182. package/dist/m365/spo/commands/hubsite/hubsite-set.js +8 -8
  183. package/dist/m365/spo/commands/hubsite/hubsite-theme-sync.js +2 -1
  184. package/dist/m365/spo/commands/hubsite/hubsite-unregister.js +3 -2
  185. package/dist/m365/spo/commands/knowledgehub/knowledgehub-get.js +3 -2
  186. package/dist/m365/spo/commands/knowledgehub/knowledgehub-remove.js +3 -2
  187. package/dist/m365/spo/commands/knowledgehub/knowledgehub-set.js +5 -5
  188. package/dist/m365/spo/commands/list/list-add.js +5 -5
  189. package/dist/m365/spo/commands/list/list-contenttype-add.js +3 -3
  190. package/dist/m365/spo/commands/list/list-contenttype-default-set.js +3 -3
  191. package/dist/m365/spo/commands/list/list-contenttype-list.js +3 -3
  192. package/dist/m365/spo/commands/list/list-contenttype-remove.js +3 -3
  193. package/dist/m365/spo/commands/list/list-get.js +3 -3
  194. package/dist/m365/spo/commands/list/list-label-get.js +4 -4
  195. package/dist/m365/spo/commands/list/list-label-set.js +5 -5
  196. package/dist/m365/spo/commands/list/list-list.js +2 -1
  197. package/dist/m365/spo/commands/list/list-remove.js +3 -3
  198. package/dist/m365/spo/commands/list/list-set.js +6 -6
  199. package/dist/m365/spo/commands/list/list-sitescript-get.js +4 -4
  200. package/dist/m365/spo/commands/list/list-view-field-add.js +5 -5
  201. package/dist/m365/spo/commands/list/list-view-field-remove.js +5 -5
  202. package/dist/m365/spo/commands/list/list-view-field-set.js +5 -5
  203. package/dist/m365/spo/commands/list/list-view-get.js +5 -5
  204. package/dist/m365/spo/commands/list/list-view-list.js +3 -3
  205. package/dist/m365/spo/commands/list/list-view-remove.js +4 -4
  206. package/dist/m365/spo/commands/list/list-view-set.js +5 -5
  207. package/dist/m365/spo/commands/list/list-webhook-add.js +3 -3
  208. package/dist/m365/spo/commands/list/list-webhook-get.js +4 -4
  209. package/dist/m365/spo/commands/list/list-webhook-list.js +4 -4
  210. package/dist/m365/spo/commands/list/list-webhook-remove.js +4 -4
  211. package/dist/m365/spo/commands/list/list-webhook-set.js +4 -4
  212. package/dist/m365/spo/commands/listitem/listitem-add.js +5 -7
  213. package/dist/m365/spo/commands/listitem/listitem-attachment-list.js +3 -3
  214. package/dist/m365/spo/commands/listitem/listitem-get.js +3 -3
  215. package/dist/m365/spo/commands/listitem/listitem-isrecord.js +5 -7
  216. package/dist/m365/spo/commands/listitem/listitem-list.js +4 -4
  217. package/dist/m365/spo/commands/listitem/listitem-record-declare.js +6 -8
  218. package/dist/m365/spo/commands/listitem/listitem-record-undeclare.js +5 -7
  219. package/dist/m365/spo/commands/listitem/listitem-remove.js +3 -3
  220. package/dist/m365/spo/commands/listitem/listitem-set.js +4 -4
  221. package/dist/m365/spo/commands/mail/mail-send.js +2 -1
  222. package/dist/m365/spo/commands/navigation/navigation-node-add.js +2 -1
  223. package/dist/m365/spo/commands/navigation/navigation-node-list.js +2 -1
  224. package/dist/m365/spo/commands/navigation/navigation-node-remove.js +3 -2
  225. package/dist/m365/spo/commands/orgassetslibrary/orgassetslibrary-add.js +5 -4
  226. package/dist/m365/spo/commands/orgassetslibrary/orgassetslibrary-list.js +3 -2
  227. package/dist/m365/spo/commands/orgassetslibrary/orgassetslibrary-remove.js +3 -2
  228. package/dist/m365/spo/commands/orgnewssite/orgnewssite-list.js +3 -2
  229. package/dist/m365/spo/commands/orgnewssite/orgnewssite-remove.js +5 -5
  230. package/dist/m365/spo/commands/orgnewssite/orgnewssite-set.js +5 -5
  231. package/dist/m365/spo/commands/page/Page.js +2 -2
  232. package/dist/m365/spo/commands/page/page-add.js +4 -4
  233. package/dist/m365/spo/commands/page/page-clientsidewebpart-add.js +3 -3
  234. package/dist/m365/spo/commands/page/page-column-get.js +2 -1
  235. package/dist/m365/spo/commands/page/page-column-list.js +2 -1
  236. package/dist/m365/spo/commands/page/page-control-get.js +3 -3
  237. package/dist/m365/spo/commands/page/page-control-list.js +2 -1
  238. package/dist/m365/spo/commands/page/page-control-set.js +3 -3
  239. package/dist/m365/spo/commands/page/page-copy.js +2 -1
  240. package/dist/m365/spo/commands/page/page-get.js +3 -3
  241. package/dist/m365/spo/commands/page/page-header-set.js +2 -1
  242. package/dist/m365/spo/commands/page/page-list.js +2 -1
  243. package/dist/m365/spo/commands/page/page-remove.js +4 -4
  244. package/dist/m365/spo/commands/page/page-section-add.js +2 -1
  245. package/dist/m365/spo/commands/page/page-section-get.js +2 -1
  246. package/dist/m365/spo/commands/page/page-section-list.js +2 -1
  247. package/dist/m365/spo/commands/page/page-set.js +4 -4
  248. package/dist/m365/spo/commands/page/page-template-list.js +2 -1
  249. package/dist/m365/spo/commands/page/page-text-add.js +4 -4
  250. package/dist/m365/spo/commands/propertybag/propertybag-base.js +4 -4
  251. package/dist/m365/spo/commands/propertybag/propertybag-get.js +4 -6
  252. package/dist/m365/spo/commands/propertybag/propertybag-list.js +4 -6
  253. package/dist/m365/spo/commands/propertybag/propertybag-remove.js +6 -9
  254. package/dist/m365/spo/commands/propertybag/propertybag-set.js +8 -10
  255. package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-grant-add.js +4 -4
  256. package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-grant-list.js +3 -2
  257. package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-grant-revoke.js +4 -4
  258. package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-permissionrequest-approve.js +5 -5
  259. package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-permissionrequest-deny.js +5 -5
  260. package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-permissionrequest-list.js +3 -2
  261. package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-set.js +3 -2
  262. package/dist/m365/spo/commands/site/site-add.js +36 -16
  263. package/dist/m365/spo/commands/site/site-appcatalog-add.js +5 -5
  264. package/dist/m365/spo/commands/site/site-appcatalog-remove.js +5 -5
  265. package/dist/m365/spo/commands/site/site-apppermission-add.js +3 -4
  266. package/dist/m365/spo/commands/site/site-apppermission-get.js +2 -2
  267. package/dist/m365/spo/commands/site/site-apppermission-list.js +2 -2
  268. package/dist/m365/spo/commands/site/site-apppermission-remove.js +3 -4
  269. package/dist/m365/spo/commands/site/site-apppermission-set.js +3 -4
  270. package/dist/m365/spo/commands/site/site-chrome-set.js +2 -1
  271. package/dist/m365/spo/commands/site/site-classic-add.js +33 -13
  272. package/dist/m365/spo/commands/site/site-classic-list.js +4 -4
  273. package/dist/m365/spo/commands/site/site-classic-set.js +33 -13
  274. package/dist/m365/spo/commands/site/site-commsite-enable.js +6 -6
  275. package/dist/m365/spo/commands/site/site-ensure.js +2 -1
  276. package/dist/m365/spo/commands/site/site-get.js +2 -1
  277. package/dist/m365/spo/commands/site/site-groupify.js +2 -1
  278. package/dist/m365/spo/commands/site/site-inplacerecordsmanagement-set.js +3 -3
  279. package/dist/m365/spo/commands/site/site-list.js +4 -4
  280. package/dist/m365/spo/commands/site/site-recyclebinitem-list.js +2 -1
  281. package/dist/m365/spo/commands/site/site-remove.js +34 -14
  282. package/dist/m365/spo/commands/site/site-rename.js +3 -2
  283. package/dist/m365/spo/commands/site/site-set.js +12 -12
  284. package/dist/m365/spo/commands/sitedesign/sitedesign-add.js +4 -4
  285. package/dist/m365/spo/commands/sitedesign/sitedesign-apply.js +4 -4
  286. package/dist/m365/spo/commands/sitedesign/sitedesign-get.js +3 -3
  287. package/dist/m365/spo/commands/sitedesign/sitedesign-list.js +2 -1
  288. package/dist/m365/spo/commands/sitedesign/sitedesign-remove.js +4 -4
  289. package/dist/m365/spo/commands/sitedesign/sitedesign-rights-grant.js +4 -4
  290. package/dist/m365/spo/commands/sitedesign/sitedesign-rights-list.js +4 -4
  291. package/dist/m365/spo/commands/sitedesign/sitedesign-rights-revoke.js +4 -4
  292. package/dist/m365/spo/commands/sitedesign/sitedesign-run-list.js +3 -3
  293. package/dist/m365/spo/commands/sitedesign/sitedesign-run-status-get.js +3 -3
  294. package/dist/m365/spo/commands/sitedesign/sitedesign-set.js +4 -4
  295. package/dist/m365/spo/commands/sitedesign/sitedesign-task-get.js +3 -3
  296. package/dist/m365/spo/commands/sitedesign/sitedesign-task-list.js +2 -1
  297. package/dist/m365/spo/commands/sitedesign/sitedesign-task-remove.js +3 -3
  298. package/dist/m365/spo/commands/sitescript/sitescript-add.js +3 -2
  299. package/dist/m365/spo/commands/sitescript/sitescript-get.js +4 -4
  300. package/dist/m365/spo/commands/sitescript/sitescript-list.js +3 -2
  301. package/dist/m365/spo/commands/sitescript/sitescript-remove.js +4 -4
  302. package/dist/m365/spo/commands/sitescript/sitescript-set.js +4 -4
  303. package/dist/m365/spo/commands/spo-search.js +4 -4
  304. package/dist/m365/spo/commands/spo-set.js +2 -1
  305. package/dist/m365/spo/commands/storageentity/storageentity-get.js +2 -1
  306. package/dist/m365/spo/commands/storageentity/storageentity-list.js +2 -1
  307. package/dist/m365/spo/commands/storageentity/storageentity-remove.js +5 -5
  308. package/dist/m365/spo/commands/storageentity/storageentity-set.js +5 -5
  309. package/dist/m365/spo/commands/tenant/tenant-appcatalog-add.js +2 -1
  310. package/dist/m365/spo/commands/tenant/tenant-appcatalogurl-get.js +2 -1
  311. package/dist/m365/spo/commands/tenant/tenant-recyclebinitem-list.js +3 -2
  312. package/dist/m365/spo/commands/tenant/tenant-recyclebinitem-remove.js +16 -6
  313. package/dist/m365/spo/commands/tenant/tenant-recyclebinitem-restore.js +16 -6
  314. package/dist/m365/spo/commands/tenant/tenant-settings-list.js +3 -2
  315. package/dist/m365/spo/commands/tenant/tenant-settings-set.js +5 -5
  316. package/dist/m365/spo/commands/term/term-add.js +13 -13
  317. package/dist/m365/spo/commands/term/term-get.js +9 -9
  318. package/dist/m365/spo/commands/term/term-group-add.js +6 -6
  319. package/dist/m365/spo/commands/term/term-group-get.js +5 -5
  320. package/dist/m365/spo/commands/term/term-group-list.js +3 -2
  321. package/dist/m365/spo/commands/term/term-list.js +7 -7
  322. package/dist/m365/spo/commands/term/term-set-add.js +9 -9
  323. package/dist/m365/spo/commands/term/term-set-get.js +7 -7
  324. package/dist/m365/spo/commands/term/term-set-list.js +5 -5
  325. package/dist/m365/spo/commands/theme/theme-apply.js +5 -5
  326. package/dist/m365/spo/commands/theme/theme-get.js +4 -4
  327. package/dist/m365/spo/commands/theme/theme-list.js +2 -1
  328. package/dist/m365/spo/commands/theme/theme-remove.js +2 -1
  329. package/dist/m365/spo/commands/theme/theme-set.js +5 -5
  330. package/dist/m365/spo/commands/user/user-get.js +2 -1
  331. package/dist/m365/spo/commands/user/user-list.js +2 -1
  332. package/dist/m365/spo/commands/user/user-remove.js +2 -1
  333. package/dist/m365/spo/commands/userprofile/userprofile-get.js +3 -3
  334. package/dist/m365/spo/commands/userprofile/userprofile-set.js +3 -2
  335. package/dist/m365/spo/commands/web/web-add.js +4 -3
  336. package/dist/m365/spo/commands/web/web-clientsidewebpart-list.js +2 -1
  337. package/dist/m365/spo/commands/web/web-get.js +2 -1
  338. package/dist/m365/spo/commands/web/web-installedlanguage-list.js +2 -1
  339. package/dist/m365/spo/commands/web/web-list.js +2 -1
  340. package/dist/m365/spo/commands/web/web-reindex.js +10 -11
  341. package/dist/m365/spo/commands/web/web-remove.js +2 -1
  342. package/dist/m365/spo/commands/web/web-set.js +2 -1
  343. package/dist/m365/spo/commands.js +1 -0
  344. package/dist/m365/teams/commands/app/app-install.js +77 -23
  345. package/dist/m365/teams/commands/app/app-list.js +8 -8
  346. package/dist/m365/teams/commands/app/app-remove.js +2 -2
  347. package/dist/m365/teams/commands/app/app-uninstall.js +2 -2
  348. package/dist/m365/teams/commands/app/app-update.js +55 -13
  349. package/dist/m365/teams/commands/channel/channel-add.js +2 -2
  350. package/dist/m365/teams/commands/channel/channel-get.js +32 -10
  351. package/dist/m365/teams/commands/channel/channel-list.js +7 -8
  352. package/dist/m365/teams/commands/channel/channel-remove.js +3 -3
  353. package/dist/m365/teams/commands/channel/channel-set.js +2 -2
  354. package/dist/m365/teams/commands/chat/chat-list.js +7 -6
  355. package/dist/m365/teams/commands/chat/chat-member-list.js +8 -8
  356. package/dist/m365/teams/commands/chat/chat-message-list.js +9 -9
  357. package/dist/m365/teams/commands/chat/chat-message-send.js +225 -0
  358. package/dist/m365/teams/commands/conversationmember/conversationmember-add.js +3 -3
  359. package/dist/m365/teams/commands/conversationmember/conversationmember-list.js +9 -9
  360. package/dist/m365/teams/commands/funsettings/funsettings-list.js +2 -2
  361. package/dist/m365/teams/commands/funsettings/funsettings-set.js +2 -2
  362. package/dist/m365/teams/commands/guestsettings/guestsettings-list.js +2 -2
  363. package/dist/m365/teams/commands/guestsettings/guestsettings-set.js +2 -2
  364. package/dist/m365/teams/commands/membersettings/membersettings-list.js +2 -2
  365. package/dist/m365/teams/commands/membersettings/membersettings-set.js +2 -2
  366. package/dist/m365/teams/commands/message/message-get.js +3 -3
  367. package/dist/m365/teams/commands/message/message-list.js +12 -12
  368. package/dist/m365/teams/commands/message/message-reply-list.js +10 -10
  369. package/dist/m365/teams/commands/messagingsettings/messagingsettings-list.js +2 -2
  370. package/dist/m365/teams/commands/messagingsettings/messagingsettings-set.js +3 -3
  371. package/dist/m365/teams/commands/report/report-directroutingcalls.js +3 -3
  372. package/dist/m365/teams/commands/report/report-pstncalls.js +3 -3
  373. package/dist/m365/teams/commands/tab/tab-add.js +5 -5
  374. package/dist/m365/teams/commands/tab/tab-get.js +4 -4
  375. package/dist/m365/teams/commands/tab/tab-list.js +10 -10
  376. package/dist/m365/teams/commands/tab/tab-remove.js +4 -4
  377. package/dist/m365/teams/commands/team/team-archive.js +2 -2
  378. package/dist/m365/teams/commands/team/team-clone.js +2 -2
  379. package/dist/m365/teams/commands/team/team-get.js +2 -2
  380. package/dist/m365/teams/commands/team/team-list.js +10 -12
  381. package/dist/m365/teams/commands/team/team-remove.js +2 -2
  382. package/dist/m365/teams/commands/team/team-set.js +2 -2
  383. package/dist/m365/teams/commands/team/team-unarchive.js +2 -2
  384. package/dist/m365/teams/commands/user/user-app-add.js +3 -3
  385. package/dist/m365/teams/commands/user/user-app-list.js +10 -10
  386. package/dist/m365/teams/commands/user/user-app-remove.js +2 -2
  387. package/dist/m365/teams/commands/user/user-list.js +14 -8
  388. package/dist/m365/teams/commands.js +1 -0
  389. package/dist/m365/tenant/commands/auditlog/auditlog-report.js +2 -2
  390. package/dist/m365/tenant/commands/id/id-get.js +2 -2
  391. package/dist/m365/tenant/commands/report/report-office365activationcounts.js +2 -2
  392. package/dist/m365/tenant/commands/report/report-office365activationsusercounts.js +2 -2
  393. package/dist/m365/tenant/commands/report/report-office365activationsuserdetail.js +2 -2
  394. package/dist/m365/tenant/commands/service/service-list.js +2 -2
  395. package/dist/m365/tenant/commands/service/service-message-list.js +2 -2
  396. package/dist/m365/tenant/commands/service/service-report-historicalservicestatus.js +2 -2
  397. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-healthissue-get.js +5 -13
  398. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-healthissue-list.js +9 -16
  399. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-message-get.js +3 -6
  400. package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-message-list.js +8 -15
  401. package/dist/m365/tenant/commands/status/status-list.js +2 -2
  402. package/dist/m365/todo/commands/list/list-list.js +7 -6
  403. package/dist/m365/todo/commands/task/task-list.js +7 -6
  404. package/dist/request.js +4 -4
  405. package/dist/settingsNames.js +8 -6
  406. package/dist/utils/accessToken.js +44 -0
  407. package/dist/utils/formatting.js +66 -0
  408. package/dist/utils/fsUtil.js +36 -0
  409. package/dist/utils/index.js +22 -0
  410. package/dist/utils/odata.js +37 -0
  411. package/dist/utils/sinonUtil.js +19 -0
  412. package/dist/{m365/spfx/commands/project/project-upgrade/Utils.js → utils/spfx.js} +7 -19
  413. package/dist/utils/spo.js +432 -0
  414. package/dist/utils/urlUtil.js +174 -0
  415. package/dist/utils/validation.js +310 -0
  416. package/docs/docs/cmd/aad/app/app-delete.md +51 -0
  417. package/docs/docs/cmd/aad/app/app-get.md +12 -1
  418. package/docs/docs/cmd/aad/app/app-set.md +21 -0
  419. package/docs/docs/cmd/aad/group/group-list.md +9 -0
  420. package/docs/docs/cmd/aad/o365group/o365group-conversation-list.md +24 -0
  421. package/docs/docs/cmd/outlook/room/room-list.md +30 -0
  422. package/docs/docs/cmd/outlook/roomlist/roomlist-list.md +21 -0
  423. package/docs/docs/cmd/planner/plan/plan-details-get.md +45 -0
  424. package/docs/docs/cmd/planner/task/task-details-get.md +24 -0
  425. package/docs/docs/cmd/planner/task/task-get.md +29 -0
  426. package/docs/docs/cmd/planner/task/task-list.md +5 -0
  427. package/docs/docs/cmd/search/externalconnection/externalconnection-add.md +3 -3
  428. package/docs/docs/cmd/spfx/project/project-upgrade.md +8 -8
  429. package/docs/docs/cmd/spo/group/group-user-add.md +4 -0
  430. package/docs/docs/cmd/spo/group/group-user-remove.md +39 -0
  431. package/docs/docs/cmd/teams/app/app-install.md +22 -4
  432. package/docs/docs/cmd/teams/app/app-update.md +12 -3
  433. package/docs/docs/cmd/teams/channel/channel-get.md +11 -2
  434. package/docs/docs/cmd/teams/chat/chat-message-send.md +55 -0
  435. package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-healthissue-get.md +5 -9
  436. package/npm-shrinkwrap.json +840 -769
  437. package/package.json +23 -18
  438. package/dist/Utils.js +0 -575
  439. package/dist/m365/base/AadCommand.js +0 -10
  440. package/dist/m365/base/AzmgmtResponse.js +0 -3
  441. package/dist/m365/base/GraphItemsListCommand.js +0 -46
  442. package/dist/m365/base/GraphResponse.js +0 -3
  443. package/dist/m365/base/GraphResponseError.js +0 -3
  444. package/dist/m365/spo/ClientSvc.js +0 -128
  445. package/dist/m365/spo/FolderExtensions.js +0 -101
  446. package/dist/m365/spo/commands/site/SpoOperation.js +0 -3
  447. package/dist/m365/spo/spo.js +0 -3
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const fs = require("fs");
4
4
  const path = require("path");
5
5
  const request_1 = require("../../../../request");
6
- const Utils_1 = require("../../../../Utils");
6
+ const utils_1 = require("../../../../utils");
7
7
  const GraphCommand_1 = require("../../../base/GraphCommand");
8
8
  const commands_1 = require("../../commands");
9
9
  class TeamsAppUpdateCommand extends GraphCommand_1.default {
@@ -13,27 +13,63 @@ class TeamsAppUpdateCommand extends GraphCommand_1.default {
13
13
  get description() {
14
14
  return 'Updates Teams app in the organization\'s app catalog';
15
15
  }
16
+ getTelemetryProperties(args) {
17
+ const telemetryProps = super.getTelemetryProperties(args);
18
+ telemetryProps.id = typeof args.options.id !== 'undefined';
19
+ telemetryProps.name = typeof args.options.name !== 'undefined';
20
+ return telemetryProps;
21
+ }
16
22
  commandAction(logger, args, cb) {
17
- const { id: appId, filePath } = args.options;
18
- const fullPath = path.resolve(filePath);
19
- if (this.verbose) {
20
- logger.logToStderr(`Updating app with id '${appId}' and file '${fullPath}' in the app catalog...`);
23
+ const { filePath } = args.options;
24
+ this
25
+ .getAppId(args)
26
+ .then((appId) => {
27
+ const fullPath = path.resolve(filePath);
28
+ if (this.verbose) {
29
+ logger.logToStderr(`Updating app with id '${appId}' and file '${fullPath}' in the app catalog...`);
30
+ }
31
+ const requestOptions = {
32
+ url: `${this.resource}/v1.0/appCatalogs/teamsApps/${appId}`,
33
+ headers: {
34
+ "content-type": "application/zip"
35
+ },
36
+ data: fs.readFileSync(fullPath)
37
+ };
38
+ return request_1.default.put(requestOptions);
39
+ })
40
+ .then(_ => cb(), (res) => this.handleRejectedODataJsonPromise(res, logger, cb));
41
+ }
42
+ getAppId(args) {
43
+ if (args.options.id) {
44
+ return Promise.resolve(args.options.id);
21
45
  }
22
46
  const requestOptions = {
23
- url: `${this.resource}/v1.0/appCatalogs/teamsApps/${appId}`,
47
+ url: `${this.resource}/v1.0/appCatalogs/teamsApps?$filter=displayName eq '${encodeURIComponent(args.options.name)}'`,
24
48
  headers: {
25
- "content-type": "application/zip"
49
+ accept: 'application/json;odata.metadata=none'
26
50
  },
27
- data: fs.readFileSync(fullPath)
51
+ responseType: 'json'
28
52
  };
29
- request_1.default
30
- .put(requestOptions)
31
- .then(_ => cb(), (res) => this.handleRejectedODataJsonPromise(res, logger, cb));
53
+ return request_1.default
54
+ .get(requestOptions)
55
+ .then(response => {
56
+ const app = response.value[0];
57
+ if (!app) {
58
+ return Promise.reject(`The specified Teams app does not exist`);
59
+ }
60
+ if (response.value.length > 1) {
61
+ return Promise.reject(`Multiple Teams apps with name ${args.options.name} found. Please choose one of these ids: ${response.value.map(x => x.id).join(', ')}`);
62
+ }
63
+ return Promise.resolve(app.id);
64
+ });
32
65
  }
33
66
  options() {
34
67
  const options = [
35
68
  {
36
- option: '-i, --id <id>'
69
+ option: '-i, --id [id]'
70
+ },
71
+ {
72
+ option: '-n, --name [name]'
37
73
  },
38
74
  {
39
75
  option: '-p, --filePath <filePath>'
@@ -43,7 +79,13 @@ class TeamsAppUpdateCommand extends GraphCommand_1.default {
43
79
  return options.concat(parentOptions);
44
80
  }
45
81
  validate(args) {
46
- if (!Utils_1.default.isValidGuid(args.options.id)) {
82
+ if (!args.options.id && !args.options.name) {
83
+ return 'Specify either id or name';
84
+ }
85
+ if (args.options.id && args.options.name) {
86
+ return 'Specify either id or name, but not both';
87
+ }
88
+ if (args.options.id && !utils_1.validation.isValidGuid(args.options.id)) {
47
89
  return `${args.options.id} is not a valid GUID`;
48
90
  }
49
91
  const fullPath = path.resolve(args.options.filePath);
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const request_1 = require("../../../../request");
4
- const Utils_1 = require("../../../../Utils");
4
+ const utils_1 = require("../../../../utils");
5
5
  const GraphCommand_1 = require("../../../base/GraphCommand");
6
6
  const commands_1 = require("../../commands");
7
7
  class TeamsChannelAddCommand extends GraphCommand_1.default {
@@ -91,7 +91,7 @@ class TeamsChannelAddCommand extends GraphCommand_1.default {
91
91
  if (!args.options.teamId && !args.options.teamName) {
92
92
  return 'Specify teamId or teamName, one is required';
93
93
  }
94
- if (args.options.teamId && !Utils_1.default.isValidGuid(args.options.teamId)) {
94
+ if (args.options.teamId && !utils_1.validation.isValidGuid(args.options.teamId)) {
95
95
  return `${args.options.teamId} is not a valid GUID`;
96
96
  }
97
97
  return true;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const request_1 = require("../../../../request");
4
- const Utils_1 = require("../../../../Utils");
4
+ const utils_1 = require("../../../../utils");
5
5
  const GraphCommand_1 = require("../../../base/GraphCommand");
6
6
  const commands_1 = require("../../commands");
7
7
  class TeamsChannelGetCommand extends GraphCommand_1.default {
@@ -21,6 +21,7 @@ class TeamsChannelGetCommand extends GraphCommand_1.default {
21
21
  telemetryProps.teamName = typeof args.options.teamName !== 'undefined';
22
22
  telemetryProps.channelId = typeof args.options.channelId !== 'undefined';
23
23
  telemetryProps.channelName = typeof args.options.channelName !== 'undefined';
24
+ telemetryProps.primary = (!(!args.options.primary)).toString();
24
25
  return telemetryProps;
25
26
  }
26
27
  getTeamId(args) {
@@ -54,6 +55,9 @@ class TeamsChannelGetCommand extends GraphCommand_1.default {
54
55
  if (args.options.channelId) {
55
56
  return Promise.resolve(args.options.channelId);
56
57
  }
58
+ if (args.options.primary) {
59
+ return Promise.resolve('');
60
+ }
57
61
  const channelRequestOptions = {
58
62
  url: `${this.resource}/v1.0/teams/${encodeURIComponent(this.teamId)}/channels?$filter=displayName eq '${encodeURIComponent(args.options.channelName)}'`,
59
63
  headers: {
@@ -79,15 +83,21 @@ class TeamsChannelGetCommand extends GraphCommand_1.default {
79
83
  return this.getChannelId(args);
80
84
  })
81
85
  .then((channelId) => {
86
+ let url = '';
87
+ if (args.options.primary) {
88
+ url = `${this.resource}/v1.0/teams/${encodeURIComponent(this.teamId)}/primaryChannel`;
89
+ }
90
+ else {
91
+ url = `${this.resource}/v1.0/teams/${encodeURIComponent(this.teamId)}/channels/${encodeURIComponent(channelId)}`;
92
+ }
82
93
  const requestOptions = {
83
- url: `${this.resource}/v1.0/teams/${encodeURIComponent(this.teamId)}/channels/${encodeURIComponent(channelId)}`,
94
+ url: url,
84
95
  headers: {
85
96
  accept: 'application/json;odata.metadata=none'
86
97
  },
87
98
  responseType: 'json'
88
99
  };
89
- return request_1.default
90
- .get(requestOptions);
100
+ return request_1.default.get(requestOptions);
91
101
  })
92
102
  .then((res) => {
93
103
  logger.log(res);
@@ -107,6 +117,9 @@ class TeamsChannelGetCommand extends GraphCommand_1.default {
107
117
  },
108
118
  {
109
119
  option: '--channelName [channelName]'
120
+ },
121
+ {
122
+ option: '--primary'
110
123
  }
111
124
  ];
112
125
  const parentOptions = super.options();
@@ -119,16 +132,25 @@ class TeamsChannelGetCommand extends GraphCommand_1.default {
119
132
  if (!args.options.teamId && !args.options.teamName) {
120
133
  return 'Specify teamId or teamName, one is required';
121
134
  }
122
- if (args.options.teamId && !Utils_1.default.isValidGuid(args.options.teamId)) {
135
+ if (args.options.teamId && !utils_1.validation.isValidGuid(args.options.teamId)) {
123
136
  return `${args.options.teamId} is not a valid GUID`;
124
137
  }
125
- if (args.options.channelId && args.options.channelName) {
126
- return 'Specify either channelId or channelName, but not both.';
138
+ if (args.options.channelId && args.options.channelName && args.options.primary) {
139
+ return 'Specify channelId, channelName or primary';
140
+ }
141
+ if (!args.options.channelId && args.options.channelName && args.options.primary) {
142
+ return 'Specify channelId, channelName or primary.';
143
+ }
144
+ if (args.options.channelId && !args.options.channelName && args.options.primary) {
145
+ return 'Specify channelId, channelName or primary.';
146
+ }
147
+ if (args.options.channelId && args.options.channelName && !args.options.primary) {
148
+ return 'Specify channelId, channelName or primary.';
127
149
  }
128
- if (!args.options.channelId && !args.options.channelName) {
129
- return 'Specify channelId or channelName, one is required';
150
+ if (!args.options.channelId && !args.options.channelName && !args.options.primary) {
151
+ return 'Specify channelId, channelName or primary, one is required';
130
152
  }
131
- if (args.options.channelId && !Utils_1.default.isValidTeamsChannelId(args.options.channelId)) {
153
+ if (args.options.channelId && !utils_1.validation.isValidTeamsChannelId(args.options.channelId)) {
132
154
  return `${args.options.channelId} is not a valid Teams ChannelId`;
133
155
  }
134
156
  return true;
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const request_1 = require("../../../../request");
4
- const Utils_1 = require("../../../../Utils");
5
- const GraphItemsListCommand_1 = require("../../../base/GraphItemsListCommand");
4
+ const utils_1 = require("../../../../utils");
5
+ const GraphCommand_1 = require("../../../base/GraphCommand");
6
6
  const commands_1 = require("../../commands");
7
- class TeamsChannelListCommand extends GraphItemsListCommand_1.GraphItemsListCommand {
7
+ class TeamsChannelListCommand extends GraphCommand_1.default {
8
8
  get name() {
9
9
  return commands_1.default.CHANNEL_LIST;
10
10
  }
@@ -50,11 +50,10 @@ class TeamsChannelListCommand extends GraphItemsListCommand_1.GraphItemsListComm
50
50
  .getTeamId(args)
51
51
  .then((teamId) => {
52
52
  const endpoint = `${this.resource}/v1.0/teams/${teamId}/channels`;
53
- return this
54
- .getAllItems(endpoint, logger, true);
53
+ return utils_1.odata.getAllItems(endpoint, logger);
55
54
  })
56
- .then(() => {
57
- logger.log(this.items);
55
+ .then((items) => {
56
+ logger.log(items);
58
57
  cb();
59
58
  }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
60
59
  }
@@ -77,7 +76,7 @@ class TeamsChannelListCommand extends GraphItemsListCommand_1.GraphItemsListComm
77
76
  if (!args.options.teamId && !args.options.teamName) {
78
77
  return 'Specify teamId or teamName, one is required';
79
78
  }
80
- if (args.options.teamId && !Utils_1.default.isValidGuid(args.options.teamId)) {
79
+ if (args.options.teamId && !utils_1.validation.isValidGuid(args.options.teamId)) {
81
80
  return `${args.options.teamId} is not a valid GUID`;
82
81
  }
83
82
  return true;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const cli_1 = require("../../../../cli");
4
4
  const request_1 = require("../../../../request");
5
- const Utils_1 = require("../../../../Utils");
5
+ const utils_1 = require("../../../../utils");
6
6
  const GraphCommand_1 = require("../../../base/GraphCommand");
7
7
  const commands_1 = require("../../commands");
8
8
  class TeamsChannelRemoveCommand extends GraphCommand_1.default {
@@ -106,10 +106,10 @@ class TeamsChannelRemoveCommand extends GraphCommand_1.default {
106
106
  if (!args.options.channelId && !args.options.channelName) {
107
107
  return 'Specify channelId or channelName';
108
108
  }
109
- if (args.options.channelId && !Utils_1.default.isValidTeamsChannelId(args.options.channelId)) {
109
+ if (args.options.channelId && !utils_1.validation.isValidTeamsChannelId(args.options.channelId)) {
110
110
  return `${args.options.channelId} is not a valid Teams Channel Id`;
111
111
  }
112
- if (args.options.teamId && !Utils_1.default.isValidGuid(args.options.teamId)) {
112
+ if (args.options.teamId && !utils_1.validation.isValidGuid(args.options.teamId)) {
113
113
  return `${args.options.teamId} is not a valid GUID`;
114
114
  }
115
115
  return true;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const request_1 = require("../../../../request");
4
- const Utils_1 = require("../../../../Utils");
4
+ const utils_1 = require("../../../../utils");
5
5
  const GraphCommand_1 = require("../../../base/GraphCommand");
6
6
  const commands_1 = require("../../commands");
7
7
  class TeamsChannelSetCommand extends GraphCommand_1.default {
@@ -65,7 +65,7 @@ class TeamsChannelSetCommand extends GraphCommand_1.default {
65
65
  return options.concat(parentOptions);
66
66
  }
67
67
  validate(args) {
68
- if (!Utils_1.default.isValidGuid(args.options.teamId)) {
68
+ if (!utils_1.validation.isValidGuid(args.options.teamId)) {
69
69
  return `${args.options.teamId} is not a valid GUID`;
70
70
  }
71
71
  if (args.options.channelName.toLowerCase() === "general") {
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const GraphItemsListCommand_1 = require("../../../base/GraphItemsListCommand");
3
+ const utils_1 = require("../../../../utils");
4
+ const GraphCommand_1 = require("../../../base/GraphCommand");
4
5
  const commands_1 = require("../../commands");
5
- class TeamsChatListCommand extends GraphItemsListCommand_1.GraphItemsListCommand {
6
+ class TeamsChatListCommand extends GraphCommand_1.default {
6
7
  get name() {
7
8
  return commands_1.default.CHAT_LIST;
8
9
  }
@@ -15,10 +16,10 @@ class TeamsChatListCommand extends GraphItemsListCommand_1.GraphItemsListCommand
15
16
  commandAction(logger, args, cb) {
16
17
  const filter = args.options.type !== undefined ? `?$filter=chatType eq '${args.options.type}'` : '';
17
18
  const endpoint = `${this.resource}/v1.0/chats${filter}`;
18
- this
19
- .getAllItems(endpoint, logger, true)
20
- .then(() => {
21
- logger.log(this.items);
19
+ utils_1.odata
20
+ .getAllItems(endpoint, logger)
21
+ .then((items) => {
22
+ logger.log(items);
22
23
  cb();
23
24
  }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
24
25
  }
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const Utils_1 = require("../../../../Utils");
4
- const GraphItemsListCommand_1 = require("../../../base/GraphItemsListCommand");
3
+ const utils_1 = require("../../../../utils");
4
+ const GraphCommand_1 = require("../../../base/GraphCommand");
5
5
  const commands_1 = require("../../commands");
6
- class TeamsChatMemberListCommand extends GraphItemsListCommand_1.GraphItemsListCommand {
6
+ class TeamsChatMemberListCommand extends GraphCommand_1.default {
7
7
  get name() {
8
8
  return commands_1.default.CHAT_MEMBER_LIST;
9
9
  }
@@ -15,10 +15,10 @@ class TeamsChatMemberListCommand extends GraphItemsListCommand_1.GraphItemsListC
15
15
  }
16
16
  commandAction(logger, args, cb) {
17
17
  const endpoint = `${this.resource}/v1.0/chats/${args.options.chatId}/members`;
18
- this
19
- .getAllItems(endpoint, logger, true)
20
- .then(() => {
21
- logger.log(this.items);
18
+ utils_1.odata
19
+ .getAllItems(endpoint, logger)
20
+ .then((items) => {
21
+ logger.log(items);
22
22
  cb();
23
23
  }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
24
24
  }
@@ -32,7 +32,7 @@ class TeamsChatMemberListCommand extends GraphItemsListCommand_1.GraphItemsListC
32
32
  return options.concat(parentOptions);
33
33
  }
34
34
  validate(args) {
35
- if (!Utils_1.default.isValidTeamsChatId(args.options.chatId)) {
35
+ if (!utils_1.validation.isValidTeamsChatId(args.options.chatId)) {
36
36
  return `${args.options.chatId} is not a valid Teams ChatId`;
37
37
  }
38
38
  return true;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const Utils_1 = require("../../../../Utils");
4
- const GraphItemsListCommand_1 = require("../../../base/GraphItemsListCommand");
3
+ const utils_1 = require("../../../../utils");
4
+ const GraphCommand_1 = require("../../../base/GraphCommand");
5
5
  const commands_1 = require("../../commands");
6
- class TeamsChatMessageListCommand extends GraphItemsListCommand_1.GraphItemsListCommand {
6
+ class TeamsChatMessageListCommand extends GraphCommand_1.default {
7
7
  get name() {
8
8
  return commands_1.default.CHAT_MESSAGE_LIST;
9
9
  }
@@ -15,11 +15,11 @@ class TeamsChatMessageListCommand extends GraphItemsListCommand_1.GraphItemsList
15
15
  }
16
16
  commandAction(logger, args, cb) {
17
17
  const endpoint = `${this.resource}/v1.0/chats/${args.options.chatId}/messages`;
18
- this
19
- .getAllItems(endpoint, logger, true)
20
- .then(() => {
18
+ utils_1.odata
19
+ .getAllItems(endpoint, logger)
20
+ .then((items) => {
21
21
  if (args.options.output !== 'json') {
22
- this.items.forEach(i => {
22
+ items.forEach(i => {
23
23
  // hoist the content to body for readability
24
24
  i.body = i.body.content;
25
25
  let shortBody;
@@ -36,7 +36,7 @@ class TeamsChatMessageListCommand extends GraphItemsListCommand_1.GraphItemsList
36
36
  i.shortBody = shortBody;
37
37
  });
38
38
  }
39
- logger.log(this.items);
39
+ logger.log(items);
40
40
  cb();
41
41
  }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
42
42
  }
@@ -50,7 +50,7 @@ class TeamsChatMessageListCommand extends GraphItemsListCommand_1.GraphItemsList
50
50
  return options.concat(parentOptions);
51
51
  }
52
52
  validate(args) {
53
- if (!Utils_1.default.isValidTeamsChatId(args.options.chatId)) {
53
+ if (!utils_1.validation.isValidTeamsChatId(args.options.chatId)) {
54
54
  return `${args.options.chatId} is not a valid Teams chat ID`;
55
55
  }
56
56
  return true;
@@ -0,0 +1,225 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const os = require("os");
13
+ const Auth_1 = require("../../../../Auth");
14
+ const request_1 = require("../../../../request");
15
+ const utils_1 = require("../../../../utils");
16
+ const GraphCommand_1 = require("../../../base/GraphCommand");
17
+ const commands_1 = require("../../commands");
18
+ class TeamsChatMessageSendCommand extends GraphCommand_1.default {
19
+ get name() {
20
+ return commands_1.default.CHAT_MESSAGE_SEND;
21
+ }
22
+ get description() {
23
+ return 'Send a message to an existing or new chat conversation.';
24
+ }
25
+ commandAction(logger, args, cb) {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ try {
28
+ const chatId = args.options.chatId
29
+ || args.options.userEmails && (yield this.ensureChatIdByUserEmails(args.options.userEmails))
30
+ || args.options.chatName && (yield this.getChatIdByName(args.options.chatName));
31
+ yield this.sendChatMessage(chatId, args.options);
32
+ cb();
33
+ }
34
+ catch (error) {
35
+ this.handleRejectedODataJsonPromise(error, logger, cb);
36
+ }
37
+ });
38
+ }
39
+ options() {
40
+ const options = [
41
+ {
42
+ option: '--chatId [chatId]'
43
+ },
44
+ {
45
+ option: '-e, --userEmails [userEmails]'
46
+ },
47
+ {
48
+ option: '--chatName [chatName]'
49
+ },
50
+ {
51
+ option: '-m, --message <message>'
52
+ }
53
+ ];
54
+ const parentOptions = super.options();
55
+ return options.concat(parentOptions);
56
+ }
57
+ validate(args) {
58
+ if (!args.options.chatId && !args.options.userEmails && !args.options.chatName) {
59
+ return 'Specify chatId or userEmails or chatName, one is required.';
60
+ }
61
+ let nrOfMutuallyExclusiveOptionsInUse = 0;
62
+ if (args.options.chatId) {
63
+ nrOfMutuallyExclusiveOptionsInUse++;
64
+ }
65
+ if (args.options.userEmails) {
66
+ nrOfMutuallyExclusiveOptionsInUse++;
67
+ }
68
+ if (args.options.chatName) {
69
+ nrOfMutuallyExclusiveOptionsInUse++;
70
+ }
71
+ if (nrOfMutuallyExclusiveOptionsInUse > 1) {
72
+ return 'Specify either chatId or userEmails or chatName, but not multiple.';
73
+ }
74
+ if (!args.options.message) {
75
+ return 'Specify a message to send.';
76
+ }
77
+ if (args.options.chatId && !utils_1.validation.isValidTeamsChatId(args.options.chatId)) {
78
+ return `${args.options.chatId} is not a valid Teams ChatId.`;
79
+ }
80
+ if (args.options.userEmails) {
81
+ const userEmails = args.options.userEmails.toLowerCase().replace(/\s/g, '').split(',').filter(e => e && e !== '');
82
+ if (!userEmails || userEmails.length === 0 || userEmails.some(e => !utils_1.validation.isValidUserPrincipalName(e))) {
83
+ return `${args.options.userEmails} contains one or more invalid email addresses.`;
84
+ }
85
+ }
86
+ return true;
87
+ }
88
+ ensureChatIdByUserEmails(userEmailsOption) {
89
+ return __awaiter(this, void 0, void 0, function* () {
90
+ const userEmails = userEmailsOption.toLowerCase().replace(/\s/g, '').split(',').filter(e => e && e !== '');
91
+ const currentUserEmail = utils_1.accessToken.getUserNameFromAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken).toLowerCase();
92
+ const existingChats = yield this.findExistingGroupChatsByMembers([currentUserEmail, ...userEmails]);
93
+ if (existingChats && existingChats.length > 0) {
94
+ if (existingChats.length > 1) {
95
+ const disambiguationText = existingChats.map(c => {
96
+ return `- ${c.id}${c.topic && ' - '}${c.topic} - ${c.createdDateTime && new Date(c.createdDateTime).toLocaleString()}`;
97
+ }).join(os.EOL);
98
+ throw new Error(`Multiple chat conversations with this topic found. Please disambiguate:${os.EOL}${disambiguationText}`);
99
+ }
100
+ else {
101
+ return existingChats[0].id;
102
+ }
103
+ }
104
+ const chat = yield this.createConversation([currentUserEmail, ...userEmails]);
105
+ return chat.id;
106
+ });
107
+ }
108
+ getChatIdByName(chatName) {
109
+ return __awaiter(this, void 0, void 0, function* () {
110
+ const existingChats = yield this.findExistingGroupChatsByTopic(chatName);
111
+ if (!existingChats || existingChats.length === 0) {
112
+ throw new Error('No chat conversation was found with this name.');
113
+ }
114
+ if (existingChats.length === 1) {
115
+ return existingChats[0].id;
116
+ }
117
+ const disambiguationText = existingChats.map(c => {
118
+ const memberstring = c.members.map(m => m.email).join(', ');
119
+ return `- ${c.id} - ${c.createdDateTime && new Date(c.createdDateTime).toLocaleString()} - ${memberstring}`;
120
+ }).join(os.EOL);
121
+ throw new Error(`Multiple chat conversations with this topic found. Please disambiguate:${os.EOL}${disambiguationText}`);
122
+ });
123
+ }
124
+ // This Microsoft Graph API request throws an intermittent 404 exception, saying that it cannot find the principal.
125
+ // The same behavior occurs when creating the conversation through the Graph Explorer.
126
+ // It seems to happen when the userEmail casing does not match the casing of the actual UPN.
127
+ // When the first request throws an error, the second request does succeed.
128
+ // Therefore a retry-mechanism is implemented here.
129
+ createConversation(memberEmails, retried = 0) {
130
+ var _a;
131
+ return __awaiter(this, void 0, void 0, function* () {
132
+ try {
133
+ const jsonBody = {
134
+ chatType: memberEmails.length > 2 ? 'group' : 'oneOnOne',
135
+ members: memberEmails.map(email => {
136
+ return {
137
+ '@odata.type': '#microsoft.graph.aadUserConversationMember',
138
+ roles: ['owner'],
139
+ 'user@odata.bind': `https://graph.microsoft.com/v1.0/users/${email}`
140
+ };
141
+ })
142
+ };
143
+ const requestOptions = {
144
+ url: `${this.resource}/v1.0/chats`,
145
+ headers: {
146
+ accept: 'application/json;odata.metadata=none',
147
+ 'content-type': 'application/json;odata=nometadata'
148
+ },
149
+ responseType: 'json',
150
+ data: jsonBody
151
+ };
152
+ return yield request_1.default.post(requestOptions);
153
+ }
154
+ catch (err) {
155
+ if (((_a = err.message) === null || _a === void 0 ? void 0 : _a.indexOf('404')) > -1 && retried < 4) {
156
+ return yield this.createConversation(memberEmails, retried + 1);
157
+ }
158
+ throw err;
159
+ }
160
+ });
161
+ }
162
+ sendChatMessage(chatId, options) {
163
+ return __awaiter(this, void 0, void 0, function* () {
164
+ const requestOptions = {
165
+ url: `${this.resource}/v1.0/chats/${chatId}/messages`,
166
+ headers: {
167
+ accept: 'application/json;odata.metadata=none',
168
+ 'content-type': 'application/json;odata=nometadata'
169
+ },
170
+ responseType: 'json',
171
+ data: {
172
+ body: {
173
+ content: options.message
174
+ }
175
+ }
176
+ };
177
+ yield request_1.default.post(requestOptions);
178
+ });
179
+ }
180
+ findExistingGroupChatsByMembers(expectedMemberEmails) {
181
+ return __awaiter(this, void 0, void 0, function* () {
182
+ const endpoint = `${this.resource}/v1.0/chats?$filter=chatType eq 'group'&$expand=members&$select=id,topic,createdDateTime,members`;
183
+ const foundChats = [];
184
+ const chats = yield this.getAllChats(endpoint, []);
185
+ for (const chat of chats) {
186
+ const chatMembers = chat.members;
187
+ if (chatMembers.length === expectedMemberEmails.length) {
188
+ const chatMemberEmails = chatMembers.map(member => { var _a; return (_a = member.email) === null || _a === void 0 ? void 0 : _a.toLowerCase(); });
189
+ if (expectedMemberEmails.every(email => chatMemberEmails.some(memberEmail => memberEmail === email))) {
190
+ foundChats.push(chat);
191
+ }
192
+ }
193
+ }
194
+ return foundChats;
195
+ });
196
+ }
197
+ findExistingGroupChatsByTopic(topic) {
198
+ return __awaiter(this, void 0, void 0, function* () {
199
+ const endpoint = `${this.resource}/v1.0/chats?$filter=topic eq '${encodeURIComponent(topic)}'&$expand=members&$select=id,topic,createdDateTime,chatType`;
200
+ const chats = yield this.getAllChats(endpoint, []);
201
+ return chats;
202
+ });
203
+ }
204
+ getAllChats(url, items) {
205
+ return __awaiter(this, void 0, void 0, function* () {
206
+ const requestOptions = {
207
+ url: url,
208
+ headers: {
209
+ accept: 'application/json;odata.metadata=none'
210
+ },
211
+ responseType: 'json'
212
+ };
213
+ const res = yield request_1.default.get(requestOptions);
214
+ items = items.concat(res.value);
215
+ if (res['@odata.nextLink']) {
216
+ return yield this.getAllChats(res['@odata.nextLink'], items);
217
+ }
218
+ else {
219
+ return items;
220
+ }
221
+ });
222
+ }
223
+ }
224
+ module.exports = new TeamsChatMessageSendCommand();
225
+ //# sourceMappingURL=chat-message-send.js.map
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const os = require("os");
4
4
  const request_1 = require("../../../../request");
5
- const Utils_1 = require("../../../../Utils");
5
+ const utils_1 = require("../../../../utils");
6
6
  const GraphCommand_1 = require("../../../base/GraphCommand");
7
7
  const commands_1 = require("../../commands");
8
8
  class TeamsConversationMemberAddCommand extends GraphCommand_1.default {
@@ -81,7 +81,7 @@ class TeamsConversationMemberAddCommand extends GraphCommand_1.default {
81
81
  if (!args.options.teamId && !args.options.teamName) {
82
82
  return 'Specify teamId or teamName, one is required';
83
83
  }
84
- if (args.options.teamId && !Utils_1.default.isValidGuid(args.options.teamId)) {
84
+ if (args.options.teamId && !utils_1.validation.isValidGuid(args.options.teamId)) {
85
85
  return `${args.options.teamId} is not a valid GUID`;
86
86
  }
87
87
  if (args.options.channelId && args.options.channelName) {
@@ -90,7 +90,7 @@ class TeamsConversationMemberAddCommand extends GraphCommand_1.default {
90
90
  if (!args.options.channelId && !args.options.channelName) {
91
91
  return 'Specify channelId or channelName, one is required';
92
92
  }
93
- if (args.options.channelId && !Utils_1.default.isValidTeamsChannelId(args.options.channelId)) {
93
+ if (args.options.channelId && !utils_1.validation.isValidTeamsChannelId(args.options.channelId)) {
94
94
  return `${args.options.channelId} is not a valid Teams ChannelId`;
95
95
  }
96
96
  if (args.options.userId && args.options.userDisplayName) {