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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (283) hide show
  1. package/.devcontainer/Dockerfile +5 -2
  2. package/.eslintrc.js +4 -0
  3. package/Dockerfile +6 -3
  4. package/README.md +12 -1
  5. package/dist/Command.js +1 -0
  6. package/dist/appInsights.js +2 -1
  7. package/dist/cli/Cli.js +70 -2
  8. package/dist/m365/aad/commands/license/license-list.js +41 -0
  9. package/dist/m365/aad/commands/user/user-add.js +223 -0
  10. package/dist/m365/aad/commands/user/user-get.js +3 -0
  11. package/dist/m365/aad/commands/user/user-license-add.js +88 -0
  12. package/dist/m365/aad/commands/user/user-license-list.js +99 -0
  13. package/dist/m365/aad/commands/user/user-license-remove.js +115 -0
  14. package/dist/m365/aad/commands/user/user-recyclebinitem-clear.js +1 -1
  15. package/dist/m365/aad/commands/user/user-recyclebinitem-list.js +41 -0
  16. package/dist/m365/aad/commands/user/user-recyclebinitem-remove.js +92 -0
  17. package/dist/m365/aad/commands/user/user-recyclebinitem-restore.js +70 -0
  18. package/dist/m365/aad/commands/user/user-remove.js +107 -0
  19. package/dist/m365/aad/commands/user/user-set.js +3 -0
  20. package/dist/m365/aad/commands/user/user-signin-list.js +3 -0
  21. package/dist/m365/aad/commands.js +9 -0
  22. package/dist/m365/file/commands/file-list.js +5 -1
  23. package/dist/m365/flow/commands/environment/FlowEnvironmentDetails.js +3 -0
  24. package/dist/m365/flow/commands/environment/environment-get.js +26 -11
  25. package/dist/m365/flow/commands/flow-disable.js +9 -2
  26. package/dist/m365/flow/commands/flow-enable.js +9 -2
  27. package/dist/m365/flow/commands/flow-get.js +9 -2
  28. package/dist/m365/flow/commands/flow-list.js +1 -1
  29. package/dist/m365/flow/commands/flow-remove.js +2 -2
  30. package/dist/m365/flow/commands/owner/owner-ensure.js +147 -0
  31. package/dist/m365/flow/commands/owner/owner-list.js +89 -0
  32. package/dist/m365/flow/commands/owner/owner-remove.js +147 -0
  33. package/dist/m365/flow/commands/run/run-cancel.js +9 -2
  34. package/dist/m365/flow/commands/run/run-list.js +5 -2
  35. package/dist/m365/flow/commands.js +3 -0
  36. package/dist/m365/planner/commands/roster/roster-member-add.js +3 -0
  37. package/dist/m365/planner/commands/roster/roster-member-get.js +98 -0
  38. package/dist/m365/planner/commands.js +1 -0
  39. package/dist/m365/pp/commands/environment/environment-get.js +18 -9
  40. package/dist/m365/purview/commands/retentionevent/retentionevent-add.js +138 -0
  41. package/dist/m365/purview/commands/retentionlabel/retentionlabel-add.js +48 -14
  42. package/dist/m365/purview/commands.js +1 -0
  43. package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.17.0-beta.1.js +59 -0
  44. package/dist/m365/spfx/commands/project/project-upgrade.js +16 -13
  45. package/dist/m365/spfx/commands/spfx-doctor.js +43 -29
  46. package/dist/m365/spo/commands/commandset/commandset-add.js +138 -0
  47. package/dist/m365/spo/commands/commandset/commandset-get.js +128 -0
  48. package/dist/m365/spo/commands/commandset/commandset-list.js +77 -0
  49. package/dist/m365/spo/commands/commandset/commandset-remove.js +146 -0
  50. package/dist/m365/spo/commands/commandset/commandset-set.js +182 -0
  51. package/dist/m365/spo/commands/customaction/customaction-get.js +27 -7
  52. package/dist/m365/spo/commands/file/file-move.js +1 -3
  53. package/dist/m365/spo/commands/folder/folder-copy.js +0 -2
  54. package/dist/m365/spo/commands/folder/folder-move.js +0 -2
  55. package/dist/m365/spo/commands/group/group-member-add.js +54 -95
  56. package/dist/m365/spo/commands/list/list-add.js +11 -8
  57. package/dist/m365/spo/commands/list/list-set.js +3 -3
  58. package/dist/m365/spo/commands/navigation/navigation-node-add.js +5 -4
  59. package/dist/m365/spo/commands/navigation/navigation-node-set.js +5 -1
  60. package/dist/m365/spo/commands/site/site-add.js +0 -3
  61. package/dist/m365/spo/commands/site/site-remove.js +0 -3
  62. package/dist/m365/spo/commands/site/site-set.js +0 -2
  63. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-get.js +118 -0
  64. package/dist/m365/spo/commands/tenant/tenant-recyclebinitem-remove.js +0 -1
  65. package/dist/m365/spo/commands/term/term-get.js +68 -48
  66. package/dist/m365/spo/commands/user/user-ensure.js +105 -0
  67. package/dist/m365/spo/commands.js +7 -0
  68. package/dist/m365/teams/commands/team/team-add.js +3 -8
  69. package/dist/m365/todo/commands/task/task-add.js +35 -3
  70. package/dist/utils/aadGroup.js +18 -0
  71. package/dist/utils/aadUser.js +37 -0
  72. package/dist/utils/md.js +7 -0
  73. package/dist/utils/session.js +18 -0
  74. package/dist/utils/spo.js +35 -12
  75. package/docs/docs/cmd/aad/app/app-add.md +3 -3
  76. package/docs/docs/cmd/aad/approleassignment/approleassignment-add.md +5 -5
  77. package/docs/docs/cmd/aad/approleassignment/approleassignment-remove.md +3 -3
  78. package/docs/docs/cmd/aad/license/license-list.md +87 -0
  79. package/docs/docs/cmd/aad/user/user-add.md +168 -0
  80. package/docs/docs/cmd/aad/user/user-license-add.md +108 -0
  81. package/docs/docs/cmd/aad/user/user-license-list.md +98 -0
  82. package/docs/docs/cmd/aad/user/user-license-remove.md +43 -0
  83. package/docs/docs/cmd/aad/user/user-recyclebinitem-clear.md +1 -1
  84. package/docs/docs/cmd/aad/user/user-recyclebinitem-list.md +82 -0
  85. package/docs/docs/cmd/aad/user/user-recyclebinitem-remove.md +45 -0
  86. package/docs/docs/cmd/aad/user/user-recyclebinitem-restore.md +99 -0
  87. package/docs/docs/cmd/aad/user/user-remove.md +51 -0
  88. package/docs/docs/cmd/aad/user/user-set.md +1 -1
  89. package/docs/docs/cmd/cli/completion/completion-clink-update.md +4 -4
  90. package/docs/docs/cmd/flow/environment/environment-get.md +31 -3
  91. package/docs/docs/cmd/flow/owner/owner-ensure.md +61 -0
  92. package/docs/docs/cmd/flow/owner/owner-list.md +90 -0
  93. package/docs/docs/cmd/flow/owner/owner-remove.md +67 -0
  94. package/docs/docs/cmd/flow/run/run-list.md +28 -0
  95. package/docs/docs/cmd/onenote/page/page-list.md +1 -1
  96. package/docs/docs/cmd/outlook/mail/mail-send.md +7 -3
  97. package/docs/docs/cmd/outlook/message/message-get.md +143 -0
  98. package/docs/docs/cmd/outlook/message/message-list.md +119 -0
  99. package/docs/docs/cmd/outlook/message/message-move.md +4 -0
  100. package/docs/docs/cmd/outlook/report/report-mailactivitycounts.md +40 -0
  101. package/docs/docs/cmd/outlook/report/report-mailactivityusercounts.md +40 -0
  102. package/docs/docs/cmd/outlook/report/report-mailactivityuserdetail.md +45 -0
  103. package/docs/docs/cmd/outlook/report/report-mailappusageappsusercounts.md +43 -0
  104. package/docs/docs/cmd/outlook/report/report-mailappusageusercounts.md +44 -0
  105. package/docs/docs/cmd/outlook/report/report-mailappusageuserdetail.md +48 -0
  106. package/docs/docs/cmd/outlook/report/report-mailappusageversionsusercounts.md +41 -0
  107. package/docs/docs/cmd/outlook/report/report-mailboxusagedetail.md +49 -0
  108. package/docs/docs/cmd/outlook/report/report-mailboxusagemailboxcount.md +37 -0
  109. package/docs/docs/cmd/outlook/report/report-mailboxusagequotastatusmailboxcounts.md +40 -0
  110. package/docs/docs/cmd/outlook/report/report-mailboxusagestorage.md +36 -0
  111. package/docs/docs/cmd/outlook/room/room-list.md +81 -0
  112. package/docs/docs/cmd/outlook/roomlist/roomlist-list.md +58 -0
  113. package/docs/docs/cmd/planner/plan/plan-add.md +3 -3
  114. package/docs/docs/cmd/planner/plan/plan-set.md +73 -7
  115. package/docs/docs/cmd/planner/roster/roster-add.md +16 -1
  116. package/docs/docs/cmd/planner/roster/roster-member-get.md +87 -0
  117. package/docs/docs/cmd/planner/task/task-add.md +230 -0
  118. package/docs/docs/cmd/planner/task/task-checklistitem-add.md +55 -0
  119. package/docs/docs/cmd/planner/task/task-checklistitem-list.md +55 -0
  120. package/docs/docs/cmd/planner/task/task-checklistitem-remove.md +4 -0
  121. package/docs/docs/cmd/planner/task/task-get.md +131 -0
  122. package/docs/docs/cmd/planner/task/task-list.md +92 -0
  123. package/docs/docs/cmd/planner/task/task-reference-add.md +46 -0
  124. package/docs/docs/cmd/planner/task/task-reference-list.md +46 -0
  125. package/docs/docs/cmd/planner/task/task-reference-remove.md +4 -0
  126. package/docs/docs/cmd/planner/task/task-remove.md +4 -0
  127. package/docs/docs/cmd/planner/task/task-set.md +230 -0
  128. package/docs/docs/cmd/planner/tenant/tenant-settings-list.md +55 -0
  129. package/docs/docs/cmd/planner/tenant/tenant-settings-set.md +55 -0
  130. package/docs/docs/cmd/pp/card/card-get.md +2 -2
  131. package/docs/docs/cmd/pp/card/card-list.md +2 -2
  132. package/docs/docs/cmd/purview/retentionevent/retentionevent-add.md +149 -0
  133. package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-add.md +7 -7
  134. package/docs/docs/cmd/purview/retentionlabel/retentionlabel-add.md +12 -0
  135. package/docs/docs/cmd/skype/report/report-activitycounts.md +38 -0
  136. package/docs/docs/cmd/skype/report/report-activityusercounts.md +38 -0
  137. package/docs/docs/cmd/skype/report/report-activityuserdetail.md +67 -0
  138. package/docs/docs/cmd/spfx/project/project-doctor.md +3 -3
  139. package/docs/docs/cmd/spfx/project/project-externalize.md +3 -3
  140. package/docs/docs/cmd/spfx/project/project-permissions-grant.md +21 -0
  141. package/docs/docs/cmd/spfx/project/project-upgrade.md +3 -3
  142. package/docs/docs/cmd/spfx/spfx-doctor.md +3 -3
  143. package/docs/docs/cmd/spo/cdn/cdn-get.md +6 -6
  144. package/docs/docs/cmd/spo/cdn/cdn-origin-add.md +3 -3
  145. package/docs/docs/cmd/spo/cdn/cdn-origin-list.md +3 -3
  146. package/docs/docs/cmd/spo/cdn/cdn-origin-remove.md +3 -3
  147. package/docs/docs/cmd/spo/cdn/cdn-policy-list.md +3 -3
  148. package/docs/docs/cmd/spo/cdn/cdn-policy-set.md +3 -3
  149. package/docs/docs/cmd/spo/cdn/cdn-set.md +3 -3
  150. package/docs/docs/cmd/spo/commandset/commandset-add.md +159 -0
  151. package/docs/docs/cmd/spo/commandset/commandset-get.md +149 -0
  152. package/docs/docs/cmd/spo/commandset/commandset-list.md +109 -0
  153. package/docs/docs/cmd/spo/commandset/commandset-remove.md +55 -0
  154. package/docs/docs/cmd/spo/commandset/commandset-set.md +71 -0
  155. package/docs/docs/cmd/spo/customaction/customaction-get.md +113 -11
  156. package/docs/docs/cmd/spo/externaluser/externaluser-list.md +2 -0
  157. package/docs/docs/cmd/spo/group/group-member-add.md +26 -4
  158. package/docs/docs/cmd/spo/hidedefaultthemes/hidedefaultthemes-get.md +2 -0
  159. package/docs/docs/cmd/spo/hidedefaultthemes/hidedefaultthemes-set.md +2 -0
  160. package/docs/docs/cmd/spo/homesite/homesite-get.md +20 -1
  161. package/docs/docs/cmd/spo/homesite/homesite-remove.md +10 -2
  162. package/docs/docs/cmd/spo/homesite/homesite-set.md +10 -2
  163. package/docs/docs/cmd/spo/hubsite/hubsite-connect.md +9 -9
  164. package/docs/docs/cmd/spo/hubsite/hubsite-data-get.md +34 -5
  165. package/docs/docs/cmd/spo/hubsite/hubsite-disconnect.md +6 -6
  166. package/docs/docs/cmd/spo/hubsite/hubsite-get.md +36 -19
  167. package/docs/docs/cmd/spo/hubsite/hubsite-list.md +59 -1
  168. package/docs/docs/cmd/spo/hubsite/hubsite-register.md +30 -1
  169. package/docs/docs/cmd/spo/hubsite/hubsite-rights-grant.md +6 -6
  170. package/docs/docs/cmd/spo/hubsite/hubsite-rights-revoke.md +4 -4
  171. package/docs/docs/cmd/spo/hubsite/hubsite-set.md +40 -15
  172. package/docs/docs/cmd/spo/hubsite/hubsite-unregister.md +4 -4
  173. package/docs/docs/cmd/spo/knowledgehub/knowledgehub-get.md +9 -1
  174. package/docs/docs/cmd/spo/knowledgehub/knowledgehub-remove.md +11 -3
  175. package/docs/docs/cmd/spo/knowledgehub/knowledgehub-set.md +11 -5
  176. package/docs/docs/cmd/spo/list/list-add.md +124 -58
  177. package/docs/docs/cmd/spo/list/list-contenttype-add.md +50 -5
  178. package/docs/docs/cmd/spo/list/list-contenttype-default-set.md +4 -4
  179. package/docs/docs/cmd/spo/list/list-contenttype-list.md +49 -4
  180. package/docs/docs/cmd/spo/list/list-contenttype-remove.md +6 -6
  181. package/docs/docs/cmd/spo/list/list-get.md +70 -4
  182. package/docs/docs/cmd/spo/list/list-list.md +70 -2
  183. package/docs/docs/cmd/spo/list/list-remove.md +6 -6
  184. package/docs/docs/cmd/spo/list/list-retentionlabel-ensure.md +2 -2
  185. package/docs/docs/cmd/spo/list/list-retentionlabel-get.md +36 -3
  186. package/docs/docs/cmd/spo/list/list-retentionlabel-remove.md +3 -3
  187. package/docs/docs/cmd/spo/list/list-roleassignment-add.md +6 -6
  188. package/docs/docs/cmd/spo/list/list-roleassignment-remove.md +3 -3
  189. package/docs/docs/cmd/spo/list/list-roleinheritance-break.md +9 -9
  190. package/docs/docs/cmd/spo/list/list-roleinheritance-reset.md +7 -7
  191. package/docs/docs/cmd/spo/list/list-set.md +61 -61
  192. package/docs/docs/cmd/spo/list/list-sitescript-get.md +35 -3
  193. package/docs/docs/cmd/spo/list/list-view-add.md +66 -5
  194. package/docs/docs/cmd/spo/list/list-view-field-add.md +10 -10
  195. package/docs/docs/cmd/spo/list/list-view-get.md +61 -0
  196. package/docs/docs/cmd/spo/list/list-view-list.md +61 -0
  197. package/docs/docs/cmd/spo/list/list-view-set.md +1 -1
  198. package/docs/docs/cmd/spo/list/list-webhook-add.md +19 -0
  199. package/docs/docs/cmd/spo/list/list-webhook-get.md +19 -0
  200. package/docs/docs/cmd/spo/list/list-webhook-list.md +19 -0
  201. package/docs/docs/cmd/spo/listitem/listitem-add.md +30 -1
  202. package/docs/docs/cmd/spo/listitem/listitem-attachment-list.md +17 -2
  203. package/docs/docs/cmd/spo/listitem/listitem-batch-add.md +1 -1
  204. package/docs/docs/cmd/spo/listitem/listitem-get.md +57 -0
  205. package/docs/docs/cmd/spo/listitem/listitem-isrecord.md +6 -0
  206. package/docs/docs/cmd/spo/listitem/listitem-list.md +28 -0
  207. package/docs/docs/cmd/spo/listitem/listitem-record-declare.md +15 -0
  208. package/docs/docs/cmd/spo/listitem/listitem-set.md +31 -1
  209. package/docs/docs/cmd/spo/navigation/navigation-node-add.md +25 -3
  210. package/docs/docs/cmd/spo/navigation/navigation-node-set.md +2 -2
  211. package/docs/docs/cmd/spo/orgassetslibrary/orgassetslibrary-add.md +2 -0
  212. package/docs/docs/cmd/spo/orgassetslibrary/orgassetslibrary-list.md +2 -0
  213. package/docs/docs/cmd/spo/orgassetslibrary/orgassetslibrary-remove.md +2 -0
  214. package/docs/docs/cmd/spo/orgnewssite/orgnewssite-list.md +2 -0
  215. package/docs/docs/cmd/spo/orgnewssite/orgnewssite-remove.md +2 -0
  216. package/docs/docs/cmd/spo/orgnewssite/orgnewssite-set.md +3 -3
  217. package/docs/docs/cmd/spo/site/site-appcatalog-add.md +2 -0
  218. package/docs/docs/cmd/spo/site/site-appcatalog-remove.md +3 -3
  219. package/docs/docs/cmd/spo/site/site-commsite-enable.md +2 -0
  220. package/docs/docs/cmd/spo/site/site-list.md +3 -3
  221. package/docs/docs/cmd/spo/site/site-remove.md +3 -3
  222. package/docs/docs/cmd/spo/site/site-rename.md +3 -3
  223. package/docs/docs/cmd/spo/site/site-set.md +5 -5
  224. package/docs/docs/cmd/spo/storageentity/storageentity-remove.md +3 -3
  225. package/docs/docs/cmd/spo/storageentity/storageentity-set.md +3 -3
  226. package/docs/docs/cmd/spo/tenant/tenant-appcatalog-add.md +3 -3
  227. package/docs/docs/cmd/spo/tenant/tenant-appcatalogurl-get.md +2 -0
  228. package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-add.md +3 -3
  229. package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-get.md +142 -0
  230. package/docs/docs/cmd/spo/tenant/tenant-recyclebinitem-list.md +2 -0
  231. package/docs/docs/cmd/spo/tenant/tenant-recyclebinitem-remove.md +3 -3
  232. package/docs/docs/cmd/spo/tenant/tenant-recyclebinitem-restore.md +3 -3
  233. package/docs/docs/cmd/spo/tenant/tenant-settings-list.md +2 -0
  234. package/docs/docs/cmd/spo/tenant/tenant-settings-set.md +28 -26
  235. package/docs/docs/cmd/spo/term/term-add.md +3 -3
  236. package/docs/docs/cmd/spo/term/term-get.md +3 -3
  237. package/docs/docs/cmd/spo/term/term-group-add.md +2 -0
  238. package/docs/docs/cmd/spo/term/term-group-get.md +2 -0
  239. package/docs/docs/cmd/spo/term/term-group-list.md +2 -0
  240. package/docs/docs/cmd/spo/term/term-list.md +3 -1
  241. package/docs/docs/cmd/spo/term/term-set-add.md +3 -3
  242. package/docs/docs/cmd/spo/term/term-set-get.md +2 -0
  243. package/docs/docs/cmd/spo/term/term-set-list.md +2 -0
  244. package/docs/docs/cmd/spo/theme/theme-apply.md +3 -3
  245. package/docs/docs/cmd/spo/theme/theme-get.md +2 -0
  246. package/docs/docs/cmd/spo/theme/theme-list.md +2 -0
  247. package/docs/docs/cmd/spo/theme/theme-remove.md +2 -0
  248. package/docs/docs/cmd/spo/theme/theme-set.md +3 -3
  249. package/docs/docs/cmd/spo/user/user-ensure.md +109 -0
  250. package/docs/docs/cmd/teams/channel/channel-get.md +1 -1
  251. package/docs/docs/cmd/teams/channel/channel-member-add.md +2 -2
  252. package/docs/docs/cmd/teams/message/message-get.md +39 -4
  253. package/docs/docs/cmd/teams/message/message-list.md +41 -6
  254. package/docs/docs/cmd/teams/message/message-reply-list.md +39 -4
  255. package/docs/docs/cmd/teams/messagingsettings/messagingsettings-list.md +20 -2
  256. package/docs/docs/cmd/teams/messagingsettings/messagingsettings-set.md +8 -8
  257. package/docs/docs/cmd/teams/report/report-deviceusagedistributionusercounts.md +12 -5
  258. package/docs/docs/cmd/teams/report/report-deviceusageusercounts.md +13 -6
  259. package/docs/docs/cmd/teams/report/report-deviceusageuserdetail.md +14 -7
  260. package/docs/docs/cmd/teams/report/report-directroutingcalls.md +13 -6
  261. package/docs/docs/cmd/teams/report/report-pstncalls.md +13 -6
  262. package/docs/docs/cmd/teams/report/report-useractivitycounts.md +13 -6
  263. package/docs/docs/cmd/teams/report/report-useractivityusercounts.md +13 -6
  264. package/docs/docs/cmd/teams/report/report-useractivityuserdetail.md +13 -6
  265. package/docs/docs/cmd/teams/tab/tab-add.md +16 -0
  266. package/docs/docs/cmd/teams/tab/tab-get.md +17 -0
  267. package/docs/docs/cmd/teams/tab/tab-list.md +19 -0
  268. package/docs/docs/cmd/teams/team/team-add.md +77 -8
  269. package/docs/docs/cmd/teams/team/team-app-list.md +18 -2
  270. package/docs/docs/cmd/teams/team/team-archive.md +2 -2
  271. package/docs/docs/cmd/teams/team/team-clone.md +8 -8
  272. package/docs/docs/cmd/teams/team/team-get.md +34 -4
  273. package/docs/docs/cmd/teams/team/team-list.md +34 -3
  274. package/docs/docs/cmd/teams/team/team-remove.md +3 -3
  275. package/docs/docs/cmd/teams/team/team-set.md +8 -8
  276. package/docs/docs/cmd/teams/team/team-unarchive.md +3 -2
  277. package/docs/docs/cmd/teams/user/user-app-add.md +3 -3
  278. package/docs/docs/cmd/teams/user/user-app-list.md +18 -2
  279. package/docs/docs/cmd/teams/user/user-app-remove.md +4 -4
  280. package/docs/docs/cmd/teams/user/user-list.md +21 -4
  281. package/docs/docs/cmd/todo/task/task-add.md +47 -2
  282. package/npm-shrinkwrap.json +280 -194
  283. package/package.json +15 -13
@@ -13,7 +13,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
13
13
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
14
14
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15
15
  };
16
- var _FlowEnvironmentGetCommand_instances, _FlowEnvironmentGetCommand_initOptions;
16
+ var _FlowEnvironmentGetCommand_instances, _FlowEnvironmentGetCommand_initOptions, _FlowEnvironmentGetCommand_initTelemetry;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  const request_1 = require("../../../../request");
19
19
  const formatting_1 = require("../../../../utils/formatting");
@@ -33,27 +33,36 @@ class FlowEnvironmentGetCommand extends AzmgmtCommand_1.default {
33
33
  super();
34
34
  _FlowEnvironmentGetCommand_instances.add(this);
35
35
  __classPrivateFieldGet(this, _FlowEnvironmentGetCommand_instances, "m", _FlowEnvironmentGetCommand_initOptions).call(this);
36
+ __classPrivateFieldGet(this, _FlowEnvironmentGetCommand_instances, "m", _FlowEnvironmentGetCommand_initTelemetry).call(this);
36
37
  }
37
38
  commandAction(logger, args) {
39
+ var _a;
38
40
  return __awaiter(this, void 0, void 0, function* () {
39
41
  if (this.verbose) {
40
- logger.logToStderr(`Retrieving information about Microsoft Flow environment ${args.options.name}...`);
42
+ logger.logToStderr(`Retrieving information about Microsoft Flow environment ${(_a = args.options.name) !== null && _a !== void 0 ? _a : ''}...`);
43
+ }
44
+ let requestUrl = `${this.resource}providers/Microsoft.ProcessSimple/environments/`;
45
+ if (args.options.name) {
46
+ requestUrl += `${formatting_1.formatting.encodeQueryParameter(args.options.name)}`;
47
+ }
48
+ else {
49
+ requestUrl += `~default`;
41
50
  }
42
51
  const requestOptions = {
43
- url: `${this.resource}providers/Microsoft.ProcessSimple/environments/${formatting_1.formatting.encodeQueryParameter(args.options.name)}?api-version=2016-11-01`,
52
+ url: `${requestUrl}?api-version=2016-11-01`,
44
53
  headers: {
45
54
  accept: 'application/json'
46
55
  },
47
56
  responseType: 'json'
48
57
  };
49
58
  try {
50
- const res = yield request_1.default.get(requestOptions);
51
- res.displayName = res.properties.displayName;
52
- res.provisioningState = res.properties.provisioningState;
53
- res.environmentSku = res.properties.environmentSku;
54
- res.azureRegionHint = res.properties.azureRegionHint;
55
- res.isDefault = res.properties.isDefault;
56
- logger.log(res);
59
+ const flowItem = yield request_1.default.get(requestOptions);
60
+ flowItem.displayName = flowItem.properties.displayName;
61
+ flowItem.provisioningState = flowItem.properties.provisioningState;
62
+ flowItem.environmentSku = flowItem.properties.environmentSku;
63
+ flowItem.azureRegionHint = flowItem.properties.azureRegionHint;
64
+ flowItem.isDefault = flowItem.properties.isDefault;
65
+ logger.log(flowItem);
57
66
  }
58
67
  catch (err) {
59
68
  this.handleRejectedODataJsonPromise(err);
@@ -63,7 +72,13 @@ class FlowEnvironmentGetCommand extends AzmgmtCommand_1.default {
63
72
  }
64
73
  _FlowEnvironmentGetCommand_instances = new WeakSet(), _FlowEnvironmentGetCommand_initOptions = function _FlowEnvironmentGetCommand_initOptions() {
65
74
  this.options.unshift({
66
- option: '-n, --name <name>'
75
+ option: '-n, --name [name]'
76
+ });
77
+ }, _FlowEnvironmentGetCommand_initTelemetry = function _FlowEnvironmentGetCommand_initTelemetry() {
78
+ this.telemetry.push((args) => {
79
+ Object.assign(this.telemetryProperties, {
80
+ name: typeof args.options.name !== 'undefined'
81
+ });
67
82
  });
68
83
  };
69
84
  module.exports = new FlowEnvironmentGetCommand();
@@ -13,7 +13,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
13
13
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
14
14
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15
15
  };
16
- var _FlowDisableCommand_instances, _FlowDisableCommand_initOptions;
16
+ var _FlowDisableCommand_instances, _FlowDisableCommand_initTelemetry, _FlowDisableCommand_initOptions;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  const request_1 = require("../../../request");
19
19
  const formatting_1 = require("../../../utils/formatting");
@@ -29,6 +29,7 @@ class FlowDisableCommand extends AzmgmtCommand_1.default {
29
29
  constructor() {
30
30
  super();
31
31
  _FlowDisableCommand_instances.add(this);
32
+ __classPrivateFieldGet(this, _FlowDisableCommand_instances, "m", _FlowDisableCommand_initTelemetry).call(this);
32
33
  __classPrivateFieldGet(this, _FlowDisableCommand_instances, "m", _FlowDisableCommand_initOptions).call(this);
33
34
  }
34
35
  commandAction(logger, args) {
@@ -52,7 +53,13 @@ class FlowDisableCommand extends AzmgmtCommand_1.default {
52
53
  });
53
54
  }
54
55
  }
55
- _FlowDisableCommand_instances = new WeakSet(), _FlowDisableCommand_initOptions = function _FlowDisableCommand_initOptions() {
56
+ _FlowDisableCommand_instances = new WeakSet(), _FlowDisableCommand_initTelemetry = function _FlowDisableCommand_initTelemetry() {
57
+ this.telemetry.push((args) => {
58
+ Object.assign(this.telemetryProperties, {
59
+ asAdmin: !!args.options.asAdmin
60
+ });
61
+ });
62
+ }, _FlowDisableCommand_initOptions = function _FlowDisableCommand_initOptions() {
56
63
  this.options.unshift({
57
64
  option: '-n, --name <name>'
58
65
  }, {
@@ -13,7 +13,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
13
13
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
14
14
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15
15
  };
16
- var _FlowEnableCommand_instances, _FlowEnableCommand_initOptions;
16
+ var _FlowEnableCommand_instances, _FlowEnableCommand_initTelemetry, _FlowEnableCommand_initOptions;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  const request_1 = require("../../../request");
19
19
  const formatting_1 = require("../../../utils/formatting");
@@ -29,6 +29,7 @@ class FlowEnableCommand extends AzmgmtCommand_1.default {
29
29
  constructor() {
30
30
  super();
31
31
  _FlowEnableCommand_instances.add(this);
32
+ __classPrivateFieldGet(this, _FlowEnableCommand_instances, "m", _FlowEnableCommand_initTelemetry).call(this);
32
33
  __classPrivateFieldGet(this, _FlowEnableCommand_instances, "m", _FlowEnableCommand_initOptions).call(this);
33
34
  }
34
35
  commandAction(logger, args) {
@@ -52,7 +53,13 @@ class FlowEnableCommand extends AzmgmtCommand_1.default {
52
53
  });
53
54
  }
54
55
  }
55
- _FlowEnableCommand_instances = new WeakSet(), _FlowEnableCommand_initOptions = function _FlowEnableCommand_initOptions() {
56
+ _FlowEnableCommand_instances = new WeakSet(), _FlowEnableCommand_initTelemetry = function _FlowEnableCommand_initTelemetry() {
57
+ this.telemetry.push((args) => {
58
+ Object.assign(this.telemetryProperties, {
59
+ asAdmin: !!args.options.asAdmin
60
+ });
61
+ });
62
+ }, _FlowEnableCommand_initOptions = function _FlowEnableCommand_initOptions() {
56
63
  this.options.unshift({
57
64
  option: '-n, --name <name>'
58
65
  }, {
@@ -13,7 +13,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
13
13
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
14
14
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15
15
  };
16
- var _FlowGetCommand_instances, _FlowGetCommand_initOptions;
16
+ var _FlowGetCommand_instances, _FlowGetCommand_initTelemetry, _FlowGetCommand_initOptions;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  const request_1 = require("../../../request");
19
19
  const formatting_1 = require("../../../utils/formatting");
@@ -32,6 +32,7 @@ class FlowGetCommand extends AzmgmtCommand_1.default {
32
32
  constructor() {
33
33
  super();
34
34
  _FlowGetCommand_instances.add(this);
35
+ __classPrivateFieldGet(this, _FlowGetCommand_instances, "m", _FlowGetCommand_initTelemetry).call(this);
35
36
  __classPrivateFieldGet(this, _FlowGetCommand_instances, "m", _FlowGetCommand_initOptions).call(this);
36
37
  }
37
38
  commandAction(logger, args) {
@@ -60,7 +61,13 @@ class FlowGetCommand extends AzmgmtCommand_1.default {
60
61
  });
61
62
  }
62
63
  }
63
- _FlowGetCommand_instances = new WeakSet(), _FlowGetCommand_initOptions = function _FlowGetCommand_initOptions() {
64
+ _FlowGetCommand_instances = new WeakSet(), _FlowGetCommand_initTelemetry = function _FlowGetCommand_initTelemetry() {
65
+ this.telemetry.push((args) => {
66
+ Object.assign(this.telemetryProperties, {
67
+ asAdmin: !!args.options.asAdmin
68
+ });
69
+ });
70
+ }, _FlowGetCommand_initOptions = function _FlowGetCommand_initOptions() {
64
71
  this.options.unshift({
65
72
  option: '-n, --name <name>'
66
73
  }, {
@@ -60,7 +60,7 @@ class FlowListCommand extends AzmgmtItemsListCommand_1.AzmgmtItemsListCommand {
60
60
  _FlowListCommand_instances = new WeakSet(), _FlowListCommand_initTelemetry = function _FlowListCommand_initTelemetry() {
61
61
  this.telemetry.push((args) => {
62
62
  Object.assign(this.telemetryProperties, {
63
- asAdmin: args.options.asAdmin === true
63
+ asAdmin: !!args.options.asAdmin
64
64
  });
65
65
  });
66
66
  }, _FlowListCommand_initOptions = function _FlowListCommand_initOptions() {
@@ -82,8 +82,8 @@ class FlowRemoveCommand extends AzmgmtCommand_1.default {
82
82
  _FlowRemoveCommand_instances = new WeakSet(), _FlowRemoveCommand_initTelemetry = function _FlowRemoveCommand_initTelemetry() {
83
83
  this.telemetry.push((args) => {
84
84
  Object.assign(this.telemetryProperties, {
85
- asAdmin: typeof args.options.asAdmin !== 'undefined',
86
- confirm: typeof args.options.confirm !== 'undefined'
85
+ asAdmin: !!args.options.asAdmin,
86
+ confirm: !!args.options.confirm
87
87
  });
88
88
  });
89
89
  }, _FlowRemoveCommand_initOptions = function _FlowRemoveCommand_initOptions() {
@@ -0,0 +1,147 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
12
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
13
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
14
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15
+ };
16
+ var _FlowOwnerEnsureCommand_instances, _FlowOwnerEnsureCommand_initTelemetry, _FlowOwnerEnsureCommand_initOptions, _FlowOwnerEnsureCommand_initOptionSets, _FlowOwnerEnsureCommand_initValidators;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const request_1 = require("../../../../request");
19
+ const aadGroup_1 = require("../../../../utils/aadGroup");
20
+ const aadUser_1 = require("../../../../utils/aadUser");
21
+ const formatting_1 = require("../../../../utils/formatting");
22
+ const validation_1 = require("../../../../utils/validation");
23
+ const AzmgmtCommand_1 = require("../../../base/AzmgmtCommand");
24
+ const commands_1 = require("../../commands");
25
+ class FlowOwnerEnsureCommand extends AzmgmtCommand_1.default {
26
+ get name() {
27
+ return commands_1.default.OWNER_ENSURE;
28
+ }
29
+ get description() {
30
+ return 'Assigns/updates permissions to a Power Automate flow';
31
+ }
32
+ constructor() {
33
+ super();
34
+ _FlowOwnerEnsureCommand_instances.add(this);
35
+ __classPrivateFieldGet(this, _FlowOwnerEnsureCommand_instances, "m", _FlowOwnerEnsureCommand_initTelemetry).call(this);
36
+ __classPrivateFieldGet(this, _FlowOwnerEnsureCommand_instances, "m", _FlowOwnerEnsureCommand_initOptions).call(this);
37
+ __classPrivateFieldGet(this, _FlowOwnerEnsureCommand_instances, "m", _FlowOwnerEnsureCommand_initValidators).call(this);
38
+ __classPrivateFieldGet(this, _FlowOwnerEnsureCommand_instances, "m", _FlowOwnerEnsureCommand_initOptionSets).call(this);
39
+ }
40
+ commandAction(logger, args) {
41
+ return __awaiter(this, void 0, void 0, function* () {
42
+ try {
43
+ if (this.verbose) {
44
+ logger.logToStderr(`Assigning permissions for ${args.options.userId || args.options.userName || args.options.groupId || args.options.groupName} with permissions ${args.options.roleName} to Power Automate flow ${args.options.flowName}`);
45
+ }
46
+ let id = '';
47
+ if (args.options.userId) {
48
+ id = args.options.userId;
49
+ }
50
+ else if (args.options.userName) {
51
+ id = yield aadUser_1.aadUser.getUserIdByUpn(args.options.userName);
52
+ }
53
+ else if (args.options.groupId) {
54
+ id = args.options.groupId;
55
+ }
56
+ else {
57
+ id = yield aadGroup_1.aadGroup.getGroupIdByDisplayName(args.options.groupName);
58
+ }
59
+ let type;
60
+ if (args.options.userId || args.options.userName) {
61
+ type = 'User';
62
+ }
63
+ else {
64
+ type = 'Group';
65
+ }
66
+ const requestOptions = {
67
+ url: `${this.resource}providers/Microsoft.ProcessSimple/${args.options.asAdmin ? 'scopes/admin/' : ''}environments/${formatting_1.formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting_1.formatting.encodeQueryParameter(args.options.flowName)}/modifyPermissions?api-version=2016-11-01`,
68
+ headers: {
69
+ accept: 'application/json'
70
+ },
71
+ data: {
72
+ put: [
73
+ {
74
+ properties: {
75
+ principal: {
76
+ id: id,
77
+ type: type
78
+ },
79
+ roleName: args.options.roleName
80
+ }
81
+ }
82
+ ]
83
+ },
84
+ responseType: 'json'
85
+ };
86
+ yield request_1.default.post(requestOptions);
87
+ }
88
+ catch (err) {
89
+ this.handleRejectedODataJsonPromise(err);
90
+ }
91
+ });
92
+ }
93
+ }
94
+ _FlowOwnerEnsureCommand_instances = new WeakSet(), _FlowOwnerEnsureCommand_initTelemetry = function _FlowOwnerEnsureCommand_initTelemetry() {
95
+ this.telemetry.push((args) => {
96
+ Object.assign(this.telemetryProperties, {
97
+ asAdmin: !!args.options.asAdmin,
98
+ userId: typeof args.options.userId !== 'undefined',
99
+ userName: typeof args.options.userName !== 'undefined',
100
+ groupId: typeof args.options.groupId !== 'undefined',
101
+ groupName: typeof args.options.groupName !== 'undefined'
102
+ });
103
+ });
104
+ }, _FlowOwnerEnsureCommand_initOptions = function _FlowOwnerEnsureCommand_initOptions() {
105
+ this.options.unshift({
106
+ option: '-e, --environmentName <environmentName>'
107
+ }, {
108
+ option: '-f, --flowName <flowName>'
109
+ }, {
110
+ option: '--userId [userId]'
111
+ }, {
112
+ option: '--userName [userName]'
113
+ }, {
114
+ option: '--groupId [groupId]'
115
+ }, {
116
+ option: '--groupName [groupName]'
117
+ }, {
118
+ option: '--roleName <roleName>',
119
+ autocomplete: FlowOwnerEnsureCommand.allowedRoleNames
120
+ }, {
121
+ option: '--asAdmin'
122
+ });
123
+ }, _FlowOwnerEnsureCommand_initOptionSets = function _FlowOwnerEnsureCommand_initOptionSets() {
124
+ this.optionSets.push({ options: ['userId', 'userName', 'groupId', 'groupName'] });
125
+ }, _FlowOwnerEnsureCommand_initValidators = function _FlowOwnerEnsureCommand_initValidators() {
126
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
127
+ if (!validation_1.validation.isValidGuid(args.options.flowName)) {
128
+ return `${args.options.flowName} is not a valid GUID.`;
129
+ }
130
+ if (args.options.userId && !validation_1.validation.isValidGuid(args.options.userId)) {
131
+ return `${args.options.userId} is not a valid GUID.`;
132
+ }
133
+ if (args.options.userName && !validation_1.validation.isValidUserPrincipalName(args.options.userName)) {
134
+ return `${args.options.userName} is not a valid userName.`;
135
+ }
136
+ if (args.options.groupId && !validation_1.validation.isValidGuid(args.options.groupId)) {
137
+ return `${args.options.groupId} is not a valid GUID.`;
138
+ }
139
+ if (FlowOwnerEnsureCommand.allowedRoleNames.indexOf(args.options.roleName) === -1) {
140
+ return `${args.options.roleName} is not a valid roleName. Valid values are: ${FlowOwnerEnsureCommand.allowedRoleNames.join(', ')}`;
141
+ }
142
+ return true;
143
+ }));
144
+ };
145
+ FlowOwnerEnsureCommand.allowedRoleNames = ['CanView', 'CanEdit'];
146
+ module.exports = new FlowOwnerEnsureCommand();
147
+ //# sourceMappingURL=owner-ensure.js.map
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
12
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
13
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
14
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15
+ };
16
+ var _FlowOwnerListCommand_instances, _FlowOwnerListCommand_initTelemetry, _FlowOwnerListCommand_initOptions, _FlowOwnerListCommand_initValidators;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const Cli_1 = require("../../../../cli/Cli");
19
+ const formatting_1 = require("../../../../utils/formatting");
20
+ const odata_1 = require("../../../../utils/odata");
21
+ const validation_1 = require("../../../../utils/validation");
22
+ const AzmgmtCommand_1 = require("../../../base/AzmgmtCommand");
23
+ const commands_1 = require("../../commands");
24
+ class FlowOwnerListCommand extends AzmgmtCommand_1.default {
25
+ get name() {
26
+ return commands_1.default.OWNER_LIST;
27
+ }
28
+ get description() {
29
+ return 'Lists all owners of a Power Automate flow';
30
+ }
31
+ defaultProperties() {
32
+ return ['roleName', 'id', 'type'];
33
+ }
34
+ constructor() {
35
+ super();
36
+ _FlowOwnerListCommand_instances.add(this);
37
+ __classPrivateFieldGet(this, _FlowOwnerListCommand_instances, "m", _FlowOwnerListCommand_initTelemetry).call(this);
38
+ __classPrivateFieldGet(this, _FlowOwnerListCommand_instances, "m", _FlowOwnerListCommand_initOptions).call(this);
39
+ __classPrivateFieldGet(this, _FlowOwnerListCommand_instances, "m", _FlowOwnerListCommand_initValidators).call(this);
40
+ }
41
+ commandAction(logger, args) {
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ try {
44
+ if (this.verbose) {
45
+ logger.logToStderr(`Listing owners for flow ${args.options.flowName} in environment ${args.options.environmentName}`);
46
+ }
47
+ const response = yield odata_1.odata.getAllItems(`${this.resource}providers/Microsoft.ProcessSimple/${args.options.asAdmin ? 'scopes/admin/' : ''}environments/${formatting_1.formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting_1.formatting.encodeQueryParameter(args.options.flowName)}/permissions?api-version=2016-11-01`);
48
+ if (!Cli_1.Cli.shouldTrimOutput(args.options.output)) {
49
+ logger.log(response);
50
+ }
51
+ else {
52
+ //converted to text friendly output
53
+ logger.log(response.map(res => ({
54
+ roleName: res.properties.roleName,
55
+ id: res.properties.principal.id,
56
+ type: res.properties.principal.type
57
+ })));
58
+ }
59
+ }
60
+ catch (err) {
61
+ this.handleRejectedODataJsonPromise(err);
62
+ }
63
+ });
64
+ }
65
+ }
66
+ _FlowOwnerListCommand_instances = new WeakSet(), _FlowOwnerListCommand_initTelemetry = function _FlowOwnerListCommand_initTelemetry() {
67
+ this.telemetry.push((args) => {
68
+ Object.assign(this.telemetryProperties, {
69
+ asAdmin: !!args.options.asAdmin
70
+ });
71
+ });
72
+ }, _FlowOwnerListCommand_initOptions = function _FlowOwnerListCommand_initOptions() {
73
+ this.options.unshift({
74
+ option: '-e, --environmentName <environmentName>'
75
+ }, {
76
+ option: '-f, --flowName <flowName>'
77
+ }, {
78
+ option: '--asAdmin'
79
+ });
80
+ }, _FlowOwnerListCommand_initValidators = function _FlowOwnerListCommand_initValidators() {
81
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
82
+ if (!validation_1.validation.isValidGuid(args.options.flowName)) {
83
+ return `${args.options.flowName} is not a valid GUID.`;
84
+ }
85
+ return true;
86
+ }));
87
+ };
88
+ module.exports = new FlowOwnerListCommand();
89
+ //# sourceMappingURL=owner-list.js.map
@@ -0,0 +1,147 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
12
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
13
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
14
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15
+ };
16
+ var _FlowOwnerRemoveCommand_instances, _FlowOwnerRemoveCommand_initTelemetry, _FlowOwnerRemoveCommand_initOptions, _FlowOwnerRemoveCommand_initValidators, _FlowOwnerRemoveCommand_initOptionSets;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const Cli_1 = require("../../../../cli/Cli");
19
+ const request_1 = require("../../../../request");
20
+ const aadGroup_1 = require("../../../../utils/aadGroup");
21
+ const aadUser_1 = require("../../../../utils/aadUser");
22
+ const formatting_1 = require("../../../../utils/formatting");
23
+ const validation_1 = require("../../../../utils/validation");
24
+ const AzmgmtCommand_1 = require("../../../base/AzmgmtCommand");
25
+ const commands_1 = require("../../commands");
26
+ class FlowOwnerRemoveCommand extends AzmgmtCommand_1.default {
27
+ get name() {
28
+ return commands_1.default.OWNER_REMOVE;
29
+ }
30
+ get description() {
31
+ return 'Removes owner permissions to a Power Automate flow';
32
+ }
33
+ constructor() {
34
+ super();
35
+ _FlowOwnerRemoveCommand_instances.add(this);
36
+ __classPrivateFieldGet(this, _FlowOwnerRemoveCommand_instances, "m", _FlowOwnerRemoveCommand_initTelemetry).call(this);
37
+ __classPrivateFieldGet(this, _FlowOwnerRemoveCommand_instances, "m", _FlowOwnerRemoveCommand_initOptions).call(this);
38
+ __classPrivateFieldGet(this, _FlowOwnerRemoveCommand_instances, "m", _FlowOwnerRemoveCommand_initValidators).call(this);
39
+ __classPrivateFieldGet(this, _FlowOwnerRemoveCommand_instances, "m", _FlowOwnerRemoveCommand_initOptionSets).call(this);
40
+ }
41
+ commandAction(logger, args) {
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ try {
44
+ if (this.verbose) {
45
+ logger.logToStderr(`Removing owner ${args.options.userId || args.options.userName || args.options.groupId || args.options.groupName} from flow ${args.options.flowName} in environment ${args.options.environmentName}`);
46
+ }
47
+ const removeFlowOwner = () => __awaiter(this, void 0, void 0, function* () {
48
+ let idToRemove = '';
49
+ if (args.options.userId) {
50
+ idToRemove = args.options.userId;
51
+ }
52
+ else if (args.options.userName) {
53
+ idToRemove = yield aadUser_1.aadUser.getUserIdByUpn(args.options.userName);
54
+ }
55
+ else if (args.options.groupId) {
56
+ idToRemove = args.options.groupId;
57
+ }
58
+ else {
59
+ idToRemove = yield aadGroup_1.aadGroup.getGroupIdByDisplayName(args.options.groupName);
60
+ }
61
+ const requestOptions = {
62
+ url: `${this.resource}providers/Microsoft.ProcessSimple/${args.options.asAdmin ? 'scopes/admin/' : ''}environments/${formatting_1.formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting_1.formatting.encodeQueryParameter(args.options.flowName)}/modifyPermissions?api-version=2016-11-01`,
63
+ headers: {
64
+ accept: 'application/json'
65
+ },
66
+ data: {
67
+ delete: [
68
+ {
69
+ id: idToRemove
70
+ }
71
+ ]
72
+ },
73
+ responseType: 'json'
74
+ };
75
+ yield request_1.default.post(requestOptions);
76
+ });
77
+ if (args.options.confirm) {
78
+ yield removeFlowOwner();
79
+ }
80
+ else {
81
+ const result = yield Cli_1.Cli.prompt({
82
+ type: 'confirm',
83
+ name: 'continue',
84
+ default: false,
85
+ message: `Are you sure you want to remove owner '${args.options.groupId || args.options.groupName || args.options.userId || args.options.userName}' from the specified flow?`
86
+ });
87
+ if (result.continue) {
88
+ yield removeFlowOwner();
89
+ }
90
+ }
91
+ }
92
+ catch (err) {
93
+ this.handleRejectedODataJsonPromise(err);
94
+ }
95
+ });
96
+ }
97
+ }
98
+ _FlowOwnerRemoveCommand_instances = new WeakSet(), _FlowOwnerRemoveCommand_initTelemetry = function _FlowOwnerRemoveCommand_initTelemetry() {
99
+ this.telemetry.push((args) => {
100
+ Object.assign(this.telemetryProperties, {
101
+ userId: typeof args.options.userId !== 'undefined',
102
+ userName: typeof args.options.userName !== 'undefined',
103
+ groupId: typeof args.options.groupId !== 'undefined',
104
+ groupName: typeof args.options.groupName !== 'undefined',
105
+ asAdmin: !!args.options.asAdmin,
106
+ confirm: !!args.options.confirm
107
+ });
108
+ });
109
+ }, _FlowOwnerRemoveCommand_initOptions = function _FlowOwnerRemoveCommand_initOptions() {
110
+ this.options.unshift({
111
+ option: '-e, --environmentName <environmentName>'
112
+ }, {
113
+ option: '-f, --flowName <flowName>'
114
+ }, {
115
+ option: '--userId [userId]'
116
+ }, {
117
+ option: '--userName [userName]'
118
+ }, {
119
+ option: '--groupId [groupId]'
120
+ }, {
121
+ option: '--groupName [groupName]'
122
+ }, {
123
+ option: '--asAdmin'
124
+ }, {
125
+ option: '--confirm'
126
+ });
127
+ }, _FlowOwnerRemoveCommand_initValidators = function _FlowOwnerRemoveCommand_initValidators() {
128
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
129
+ if (!validation_1.validation.isValidGuid(args.options.flowName)) {
130
+ return `${args.options.flowName} is not a valid GUID.`;
131
+ }
132
+ if (args.options.userId && !validation_1.validation.isValidGuid(args.options.userId)) {
133
+ return `${args.options.userId} is not a valid GUID.`;
134
+ }
135
+ if (args.options.userName && !validation_1.validation.isValidUserPrincipalName(args.options.userName)) {
136
+ return `${args.options.userName} is not a valid userName.`;
137
+ }
138
+ if (args.options.groupId && !validation_1.validation.isValidGuid(args.options.groupId)) {
139
+ return `${args.options.groupId} is not a valid GUID.`;
140
+ }
141
+ return true;
142
+ }));
143
+ }, _FlowOwnerRemoveCommand_initOptionSets = function _FlowOwnerRemoveCommand_initOptionSets() {
144
+ this.optionSets.push({ options: ['userId', 'userName', 'groupId', 'groupName'] });
145
+ };
146
+ module.exports = new FlowOwnerRemoveCommand();
147
+ //# sourceMappingURL=owner-remove.js.map
@@ -13,7 +13,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
13
13
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
14
14
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15
15
  };
16
- var _FlowRunCancelCommand_instances, _FlowRunCancelCommand_initOptions, _FlowRunCancelCommand_initValidators;
16
+ var _FlowRunCancelCommand_instances, _FlowRunCancelCommand_initTelemetry, _FlowRunCancelCommand_initOptions, _FlowRunCancelCommand_initValidators;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  const Cli_1 = require("../../../../cli/Cli");
19
19
  const request_1 = require("../../../../request");
@@ -31,6 +31,7 @@ class FlowRunCancelCommand extends AzmgmtCommand_1.default {
31
31
  constructor() {
32
32
  super();
33
33
  _FlowRunCancelCommand_instances.add(this);
34
+ __classPrivateFieldGet(this, _FlowRunCancelCommand_instances, "m", _FlowRunCancelCommand_initTelemetry).call(this);
34
35
  __classPrivateFieldGet(this, _FlowRunCancelCommand_instances, "m", _FlowRunCancelCommand_initOptions).call(this);
35
36
  __classPrivateFieldGet(this, _FlowRunCancelCommand_instances, "m", _FlowRunCancelCommand_initValidators).call(this);
36
37
  }
@@ -71,7 +72,13 @@ class FlowRunCancelCommand extends AzmgmtCommand_1.default {
71
72
  });
72
73
  }
73
74
  }
74
- _FlowRunCancelCommand_instances = new WeakSet(), _FlowRunCancelCommand_initOptions = function _FlowRunCancelCommand_initOptions() {
75
+ _FlowRunCancelCommand_instances = new WeakSet(), _FlowRunCancelCommand_initTelemetry = function _FlowRunCancelCommand_initTelemetry() {
76
+ this.telemetry.push((args) => {
77
+ Object.assign(this.telemetryProperties, {
78
+ confirm: !!args.options.confirm
79
+ });
80
+ });
81
+ }, _FlowRunCancelCommand_initOptions = function _FlowRunCancelCommand_initOptions() {
75
82
  this.options.unshift({
76
83
  option: '-n, --name <name>'
77
84
  }, {
@@ -42,7 +42,7 @@ class FlowRunListCommand extends AzmgmtItemsListCommand_1.AzmgmtItemsListCommand
42
42
  if (this.verbose) {
43
43
  logger.logToStderr(`Retrieving list of runs for Microsoft Flow ${args.options.flowName}...`);
44
44
  }
45
- let url = `${this.resource}providers/Microsoft.ProcessSimple/environments/${formatting_1.formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting_1.formatting.encodeQueryParameter(args.options.flowName)}/runs?api-version=2016-11-01`;
45
+ let url = `${this.resource}providers/Microsoft.ProcessSimple/${args.options.asAdmin ? 'scopes/admin/' : ''}environments/${formatting_1.formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting_1.formatting.encodeQueryParameter(args.options.flowName)}/runs?api-version=2016-11-01`;
46
46
  const filters = this.getFilters(args.options);
47
47
  if (filters.length > 0) {
48
48
  url += `&$filter=${filters.join(' and ')}`;
@@ -86,7 +86,8 @@ _FlowRunListCommand_instances = new WeakSet(), _FlowRunListCommand_initTelemetry
86
86
  Object.assign(this.telemetryProperties, {
87
87
  status: typeof args.options.status !== 'undefined',
88
88
  triggerStartTime: typeof args.options.triggerStartTime !== 'undefined',
89
- triggerEndTime: typeof args.options.triggerEndTime !== 'undefined'
89
+ triggerEndTime: typeof args.options.triggerEndTime !== 'undefined',
90
+ asAdmin: !!args.options.asAdmin
90
91
  });
91
92
  });
92
93
  }, _FlowRunListCommand_initOptions = function _FlowRunListCommand_initOptions() {
@@ -101,6 +102,8 @@ _FlowRunListCommand_instances = new WeakSet(), _FlowRunListCommand_initTelemetry
101
102
  option: '--triggerStartTime [triggerStartTime]'
102
103
  }, {
103
104
  option: '--triggerEndTime [triggerEndTime]'
105
+ }, {
106
+ option: '--asAdmin'
104
107
  });
105
108
  }, _FlowRunListCommand_initValidators = function _FlowRunListCommand_initValidators() {
106
109
  this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
@@ -11,6 +11,9 @@ exports.default = {
11
11
  EXPORT: `${prefix} export`,
12
12
  GET: `${prefix} get`,
13
13
  LIST: `${prefix} list`,
14
+ OWNER_ENSURE: `${prefix} owner ensure`,
15
+ OWNER_LIST: `${prefix} owner list`,
16
+ OWNER_REMOVE: `${prefix} owner remove`,
14
17
  REMOVE: `${prefix} remove`,
15
18
  RUN_CANCEL: `${prefix} run cancel`,
16
19
  RUN_GET: `${prefix} run get`,