@pnp/cli-microsoft365 6.3.0-beta.c3dc921 → 6.3.0-beta.cefe20e

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 (259) hide show
  1. package/.eslintrc.js +8 -0
  2. package/dist/Auth.js +0 -18
  3. package/dist/Command.js +12 -1
  4. package/dist/appInsights.js +2 -1
  5. package/dist/cli/Cli.js +74 -3
  6. package/dist/m365/aad/commands/group/group-list.js +2 -1
  7. package/dist/m365/aad/commands/license/license-list.js +41 -0
  8. package/dist/m365/aad/commands/user/user-add.js +223 -0
  9. package/dist/m365/aad/commands/user/user-license-add.js +88 -0
  10. package/dist/m365/aad/commands/user/user-license-list.js +99 -0
  11. package/dist/m365/aad/commands/user/user-license-remove.js +114 -0
  12. package/dist/m365/aad/commands/user/user-recyclebinitem-clear.js +103 -0
  13. package/dist/m365/aad/commands/user/user-recyclebinitem-list.js +41 -0
  14. package/dist/m365/aad/commands/user/user-recyclebinitem-remove.js +92 -0
  15. package/dist/m365/aad/commands/user/user-recyclebinitem-restore.js +77 -0
  16. package/dist/m365/aad/commands/user/user-remove.js +107 -0
  17. package/dist/m365/aad/commands.js +10 -0
  18. package/dist/m365/base/O365MgmtCommand.js +10 -0
  19. package/dist/m365/context/commands/option/option-list.js +54 -0
  20. package/dist/m365/context/commands.js +1 -0
  21. package/dist/m365/file/commands/convert/convert-pdf.js +7 -6
  22. package/dist/m365/flow/commands/environment/FlowEnvironmentDetails.js +3 -0
  23. package/dist/m365/flow/commands/environment/environment-get.js +26 -11
  24. package/dist/m365/flow/commands/run/run-list.js +55 -3
  25. package/dist/m365/graph/commands/changelog/changelog-list.js +3 -2
  26. package/dist/m365/onenote/commands/notebook/notebook-list.js +50 -53
  27. package/dist/m365/onenote/commands/page/page-list.js +2 -16
  28. package/dist/m365/outlook/commands/mail/mail-send.js +3 -2
  29. package/dist/m365/outlook/commands/message/message-get.js +4 -3
  30. package/dist/m365/pa/commands/environment/environment-get.js +13 -5
  31. package/dist/m365/planner/commands/plan/plan-add.js +20 -6
  32. package/dist/m365/planner/commands/plan/plan-get.js +40 -26
  33. package/dist/m365/planner/commands/plan/plan-list.js +24 -14
  34. package/dist/m365/planner/commands/plan/plan-remove.js +1 -1
  35. package/dist/m365/planner/commands/plan/plan-set.js +21 -10
  36. package/dist/m365/planner/commands/roster/roster-add.js +47 -0
  37. package/dist/m365/planner/commands/roster/roster-get.js +61 -0
  38. package/dist/m365/planner/commands/roster/roster-member-add.js +113 -0
  39. package/dist/m365/planner/commands/roster/roster-member-list.js +54 -0
  40. package/dist/m365/planner/commands/roster/roster-member-remove.js +140 -0
  41. package/dist/m365/planner/commands/roster/roster-remove.js +88 -0
  42. package/dist/m365/planner/commands/task/task-add.js +3 -0
  43. package/dist/m365/planner/commands/task/task-checklistitem-add.js +2 -1
  44. package/dist/m365/planner/commands/task/task-checklistitem-list.js +2 -1
  45. package/dist/m365/planner/commands.js +6 -0
  46. package/dist/m365/pp/commands/environment/environment-get.js +18 -9
  47. package/dist/m365/pp/commands/solution/solution-get.js +2 -1
  48. package/dist/m365/pp/commands/solution/solution-list.js +2 -1
  49. package/dist/m365/purview/commands/auditlog/auditlog-list.js +205 -0
  50. package/dist/m365/purview/commands/retentionevent/retentionevent-get.js +75 -0
  51. package/dist/m365/purview/commands/retentionevent/retentionevent-list.js +46 -0
  52. package/dist/m365/purview/commands/retentionevent/retentionevent-remove.js +97 -0
  53. package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-add.js +77 -0
  54. package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-get.js +75 -0
  55. package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-list.js +43 -0
  56. package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-remove.js +97 -0
  57. package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-set.js +90 -0
  58. package/dist/m365/purview/commands/retentionlabel/retentionlabel-add.js +5 -0
  59. package/dist/m365/purview/commands/retentionlabel/retentionlabel-get.js +5 -0
  60. package/dist/m365/purview/commands/retentionlabel/retentionlabel-list.js +5 -0
  61. package/dist/m365/purview/commands/retentionlabel/retentionlabel-remove.js +5 -0
  62. package/dist/m365/purview/commands/retentionlabel/retentionlabel-set.js +11 -1
  63. package/dist/m365/purview/commands.js +9 -0
  64. package/dist/m365/spfx/commands/project/WebApiPermissionRequests.js +3 -0
  65. package/dist/m365/spfx/commands/project/project-permissions-grant.js +81 -0
  66. package/dist/m365/spfx/commands.js +3 -2
  67. package/dist/m365/spo/commands/app/app-add.js +2 -1
  68. package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-add.js +95 -0
  69. package/dist/m365/spo/commands/customaction/customaction-get.js +17 -66
  70. package/dist/m365/spo/commands/customaction/customaction-list.js +2 -36
  71. package/dist/m365/spo/commands/customaction/customaction-remove.js +11 -18
  72. package/dist/m365/spo/commands/file/GraphFileDetails.js +0 -1
  73. package/dist/m365/spo/commands/file/file-move.js +0 -2
  74. package/dist/m365/spo/commands/file/file-sharinginfo-get.js +2 -1
  75. package/dist/m365/spo/commands/file/file-sharinglink-add.js +2 -22
  76. package/dist/m365/spo/commands/file/file-sharinglink-clear.js +137 -0
  77. package/dist/m365/spo/commands/file/file-sharinglink-get.js +2 -25
  78. package/dist/m365/spo/commands/file/file-sharinglink-list.js +9 -29
  79. package/dist/m365/spo/commands/file/file-sharinglink-remove.js +2 -25
  80. package/dist/m365/spo/commands/file/file-sharinglink-set.js +104 -0
  81. package/dist/m365/spo/commands/folder/folder-copy.js +0 -2
  82. package/dist/m365/spo/commands/folder/folder-move.js +0 -2
  83. package/dist/m365/spo/commands/group/group-list.js +2 -1
  84. package/dist/m365/spo/commands/hubsite/hubsite-get.js +1 -1
  85. package/dist/m365/spo/commands/listitem/listitem-add.js +2 -1
  86. package/dist/m365/spo/commands/listitem/listitem-list.js +2 -1
  87. package/dist/m365/spo/commands/navigation/navigation-node-add.js +17 -3
  88. package/dist/m365/spo/commands/navigation/navigation-node-get.js +73 -0
  89. package/dist/m365/spo/commands/navigation/navigation-node-list.js +4 -7
  90. package/dist/m365/spo/commands/navigation/navigation-node-set.js +118 -0
  91. package/dist/m365/spo/commands/page/page-column-get.js +2 -1
  92. package/dist/m365/spo/commands/page/page-column-list.js +2 -1
  93. package/dist/m365/spo/commands/page/page-section-get.js +2 -1
  94. package/dist/m365/spo/commands/page/page-section-list.js +2 -1
  95. package/dist/m365/spo/commands/site/site-add.js +0 -3
  96. package/dist/m365/spo/commands/site/site-apppermission-add.js +2 -14
  97. package/dist/m365/spo/commands/site/site-apppermission-get.js +2 -14
  98. package/dist/m365/spo/commands/site/site-apppermission-list.js +2 -14
  99. package/dist/m365/spo/commands/site/site-apppermission-remove.js +2 -14
  100. package/dist/m365/spo/commands/site/site-apppermission-set.js +2 -14
  101. package/dist/m365/spo/commands/site/site-remove.js +0 -3
  102. package/dist/m365/spo/commands/site/site-set.js +0 -2
  103. package/dist/m365/spo/commands/sitedesign/sitedesign-add.js +6 -0
  104. package/dist/m365/spo/commands/spo-search.js +2 -1
  105. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-add.js +179 -0
  106. package/dist/m365/spo/commands/tenant/tenant-recyclebinitem-remove.js +0 -1
  107. package/dist/m365/spo/commands/term/term-list.js +2 -1
  108. package/dist/m365/spo/commands/userprofile/userprofile-get.js +2 -2
  109. package/dist/m365/spo/commands/web/web-set.js +11 -4
  110. package/dist/m365/spo/commands.js +6 -0
  111. package/dist/m365/teams/commands/chat/chat-list.js +4 -4
  112. package/dist/m365/teams/commands/meeting/meeting-attendancereport-list.js +5 -5
  113. package/dist/m365/teams/commands/meeting/meeting-get.js +5 -5
  114. package/dist/m365/teams/commands/meeting/meeting-list.js +5 -4
  115. package/dist/m365/teams/commands/team/team-add.js +3 -8
  116. package/dist/m365/teams/commands/team/team-app-list.js +1 -1
  117. package/dist/m365/teams/commands/user/user-app-list.js +2 -1
  118. package/dist/m365/todo/commands/task/task-get.js +2 -1
  119. package/dist/m365/todo/commands/task/task-list.js +2 -1
  120. package/dist/m365/yammer/commands/yammer-search.js +2 -1
  121. package/dist/utils/aadUser.js +38 -0
  122. package/dist/utils/accessToken.js +1 -1
  123. package/dist/utils/planner.js +16 -5
  124. package/dist/utils/session.js +18 -0
  125. package/dist/utils/spo.js +119 -12
  126. package/docs/docs/cmd/aad/app/app-list.md +3 -0
  127. package/docs/docs/cmd/aad/license/license-list.md +87 -0
  128. package/docs/docs/cmd/aad/user/user-add.md +168 -0
  129. package/docs/docs/cmd/aad/user/user-license-add.md +108 -0
  130. package/docs/docs/cmd/aad/user/user-license-list.md +98 -0
  131. package/docs/docs/cmd/aad/user/user-license-remove.md +43 -0
  132. package/docs/docs/cmd/aad/user/user-recyclebinitem-clear.md +42 -0
  133. package/docs/docs/cmd/aad/user/user-recyclebinitem-list.md +82 -0
  134. package/docs/docs/cmd/aad/user/user-recyclebinitem-remove.md +45 -0
  135. package/docs/docs/cmd/aad/user/user-recyclebinitem-restore.md +99 -0
  136. package/docs/docs/cmd/aad/user/user-remove.md +51 -0
  137. package/docs/docs/cmd/aad/user/user-set.md +2 -2
  138. package/docs/docs/cmd/context/option/option-list.md +63 -0
  139. package/docs/docs/cmd/flow/environment/environment-get.md +31 -3
  140. package/docs/docs/cmd/flow/run/run-list.md +21 -0
  141. package/docs/docs/cmd/login.md +26 -0
  142. package/docs/docs/cmd/logout.md +4 -0
  143. package/docs/docs/cmd/pa/app/app-get.md +24 -0
  144. package/docs/docs/cmd/pa/app/app-list.md +21 -0
  145. package/docs/docs/cmd/pa/connector/connector-list.md +17 -0
  146. package/docs/docs/cmd/pa/environment/environment-get.md +26 -2
  147. package/docs/docs/cmd/pa/environment/environment-list.md +19 -0
  148. package/docs/docs/cmd/planner/plan/plan-add.md +17 -6
  149. package/docs/docs/cmd/planner/plan/plan-get.md +21 -7
  150. package/docs/docs/cmd/planner/plan/plan-list.md +16 -2
  151. package/docs/docs/cmd/planner/plan/plan-remove.md +4 -0
  152. package/docs/docs/cmd/planner/plan/plan-set.md +10 -4
  153. package/docs/docs/cmd/planner/roster/roster-add.md +60 -0
  154. package/docs/docs/cmd/planner/roster/roster-get.md +73 -0
  155. package/docs/docs/cmd/planner/roster/roster-member-add.md +87 -0
  156. package/docs/docs/cmd/planner/roster/roster-member-list.md +76 -0
  157. package/docs/docs/cmd/planner/roster/roster-member-remove.md +51 -0
  158. package/docs/docs/cmd/planner/roster/roster-remove.md +48 -0
  159. package/docs/docs/cmd/pp/aibuildermodel/aibuildermodel-get.md +43 -0
  160. package/docs/docs/cmd/pp/aibuildermodel/aibuildermodel-list.md +43 -0
  161. package/docs/docs/cmd/pp/card/card-clone.md +12 -0
  162. package/docs/docs/cmd/pp/card/card-get.md +49 -0
  163. package/docs/docs/cmd/pp/card/card-list.md +49 -0
  164. package/docs/docs/cmd/pp/chatbot/chatbot-get.md +55 -0
  165. package/docs/docs/cmd/pp/chatbot/chatbot-list.md +36 -0
  166. package/docs/docs/cmd/pp/dataverse/dataverse-table-get.md +30 -0
  167. package/docs/docs/cmd/pp/dataverse/dataverse-table-list.md +30 -0
  168. package/docs/docs/cmd/pp/dataverse/dataverse-table-row-list.md +30 -0
  169. package/docs/docs/cmd/pp/environment/environment-get.md +19 -0
  170. package/docs/docs/cmd/pp/environment/environment-list.md +19 -0
  171. package/docs/docs/cmd/pp/gateway/gateway-get.md +19 -0
  172. package/docs/docs/cmd/pp/gateway/gateway-list.md +19 -0
  173. package/docs/docs/cmd/pp/managementapp/managementapp-add.md +12 -0
  174. package/docs/docs/cmd/pp/managementapp/managementapp-list.md +12 -0
  175. package/docs/docs/cmd/pp/solution/solution-get.md +14 -0
  176. package/docs/docs/cmd/pp/solution/solution-list.md +14 -0
  177. package/docs/docs/cmd/pp/solution/solution-publisher-get.md +20 -1
  178. package/docs/docs/cmd/pp/solution/solution-publisher-list.md +18 -0
  179. package/docs/docs/cmd/pp/tenant/tenant-settings-list.md +21 -0
  180. package/docs/docs/cmd/purview/auditlog/auditlog-list.md +123 -0
  181. package/docs/docs/cmd/purview/retentionevent/retentionevent-get.md +132 -0
  182. package/docs/docs/cmd/purview/retentionevent/retentionevent-list.md +107 -0
  183. package/docs/docs/cmd/purview/retentionevent/retentionevent-remove.md +45 -0
  184. package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-add.md +106 -0
  185. package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-get.md +103 -0
  186. package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-list.md +97 -0
  187. package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-remove.md +43 -0
  188. package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-set.md +43 -0
  189. package/docs/docs/cmd/purview/retentionlabel/retentionlabel-add.md +3 -0
  190. package/docs/docs/cmd/purview/retentionlabel/retentionlabel-get.md +3 -0
  191. package/docs/docs/cmd/purview/retentionlabel/retentionlabel-list.md +3 -0
  192. package/docs/docs/cmd/purview/retentionlabel/retentionlabel-remove.md +3 -0
  193. package/docs/docs/cmd/purview/retentionlabel/retentionlabel-set.md +3 -0
  194. package/docs/docs/cmd/request.md +74 -0
  195. package/docs/docs/cmd/spfx/project/project-permissions-grant.md +65 -0
  196. package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-add.md +56 -0
  197. package/docs/docs/cmd/spo/file/file-sharinglink-clear.md +46 -0
  198. package/docs/docs/cmd/spo/file/file-sharinglink-list.md +1 -1
  199. package/docs/docs/cmd/spo/file/file-sharinglink-set.md +104 -0
  200. package/docs/docs/cmd/spo/homesite/homesite-get.md +20 -1
  201. package/docs/docs/cmd/spo/homesite/homesite-remove.md +8 -2
  202. package/docs/docs/cmd/spo/homesite/homesite-set.md +8 -2
  203. package/docs/docs/cmd/spo/hubsite/hubsite-connect.md +9 -9
  204. package/docs/docs/cmd/spo/hubsite/hubsite-data-get.md +34 -5
  205. package/docs/docs/cmd/spo/hubsite/hubsite-disconnect.md +6 -6
  206. package/docs/docs/cmd/spo/hubsite/hubsite-get.md +36 -19
  207. package/docs/docs/cmd/spo/hubsite/hubsite-list.md +59 -1
  208. package/docs/docs/cmd/spo/hubsite/hubsite-register.md +30 -1
  209. package/docs/docs/cmd/spo/hubsite/hubsite-rights-grant.md +6 -6
  210. package/docs/docs/cmd/spo/hubsite/hubsite-rights-revoke.md +4 -4
  211. package/docs/docs/cmd/spo/hubsite/hubsite-set.md +40 -15
  212. package/docs/docs/cmd/spo/hubsite/hubsite-unregister.md +4 -4
  213. package/docs/docs/cmd/spo/knowledgehub/knowledgehub-get.md +7 -1
  214. package/docs/docs/cmd/spo/knowledgehub/knowledgehub-remove.md +9 -3
  215. package/docs/docs/cmd/spo/knowledgehub/knowledgehub-set.md +8 -2
  216. package/docs/docs/cmd/spo/list/list-add.md +123 -57
  217. package/docs/docs/cmd/spo/list/list-contenttype-add.md +50 -5
  218. package/docs/docs/cmd/spo/list/list-contenttype-default-set.md +4 -4
  219. package/docs/docs/cmd/spo/list/list-contenttype-list.md +49 -4
  220. package/docs/docs/cmd/spo/list/list-contenttype-remove.md +6 -6
  221. package/docs/docs/cmd/spo/list/list-get.md +70 -4
  222. package/docs/docs/cmd/spo/list/list-list.md +70 -2
  223. package/docs/docs/cmd/spo/list/list-remove.md +6 -6
  224. package/docs/docs/cmd/spo/list/list-retentionlabel-ensure.md +2 -2
  225. package/docs/docs/cmd/spo/list/list-retentionlabel-get.md +36 -3
  226. package/docs/docs/cmd/spo/list/list-retentionlabel-remove.md +3 -3
  227. package/docs/docs/cmd/spo/list/list-roleassignment-add.md +6 -6
  228. package/docs/docs/cmd/spo/list/list-roleassignment-remove.md +3 -3
  229. package/docs/docs/cmd/spo/list/list-roleinheritance-break.md +9 -9
  230. package/docs/docs/cmd/spo/list/list-roleinheritance-reset.md +7 -7
  231. package/docs/docs/cmd/spo/list/list-set.md +61 -61
  232. package/docs/docs/cmd/spo/list/list-sitescript-get.md +35 -3
  233. package/docs/docs/cmd/spo/list/list-view-add.md +66 -5
  234. package/docs/docs/cmd/spo/list/list-view-field-add.md +10 -10
  235. package/docs/docs/cmd/spo/list/list-view-get.md +61 -0
  236. package/docs/docs/cmd/spo/list/list-view-list.md +61 -0
  237. package/docs/docs/cmd/spo/list/list-view-set.md +1 -1
  238. package/docs/docs/cmd/spo/list/list-webhook-add.md +19 -0
  239. package/docs/docs/cmd/spo/list/list-webhook-get.md +19 -0
  240. package/docs/docs/cmd/spo/list/list-webhook-list.md +19 -0
  241. package/docs/docs/cmd/spo/listitem/listitem-add.md +29 -0
  242. package/docs/docs/cmd/spo/listitem/listitem-attachment-list.md +19 -4
  243. package/docs/docs/cmd/spo/listitem/listitem-get.md +57 -0
  244. package/docs/docs/cmd/spo/listitem/listitem-isrecord.md +8 -2
  245. package/docs/docs/cmd/spo/listitem/listitem-list.md +28 -0
  246. package/docs/docs/cmd/spo/listitem/listitem-record-declare.md +15 -0
  247. package/docs/docs/cmd/spo/listitem/listitem-set.md +30 -0
  248. package/docs/docs/cmd/spo/navigation/navigation-node-add.md +40 -3
  249. package/docs/docs/cmd/spo/navigation/navigation-node-get.md +91 -0
  250. package/docs/docs/cmd/spo/navigation/navigation-node-list.md +30 -0
  251. package/docs/docs/cmd/spo/navigation/navigation-node-remove.md +1 -1
  252. package/docs/docs/cmd/spo/navigation/navigation-node-set.md +59 -0
  253. package/docs/docs/cmd/spo/sitedesign/sitedesign-add.md +3 -0
  254. package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-add.md +59 -0
  255. package/docs/docs/cmd/spo/web/web-set.md +9 -0
  256. package/docs/docs/cmd/status.md +46 -0
  257. package/docs/docs/cmd/version.md +26 -0
  258. package/npm-shrinkwrap.json +912 -876
  259. package/package.json +13 -12
@@ -22,6 +22,7 @@ exports.default = {
22
22
  GROUPSETTING_SET: `${prefix} groupsetting set`,
23
23
  GROUPSETTINGTEMPLATE_GET: `${prefix} groupsettingtemplate get`,
24
24
  GROUPSETTINGTEMPLATE_LIST: `${prefix} groupsettingtemplate list`,
25
+ LICENSE_LIST: `${prefix} license list`,
25
26
  O365GROUP_ADD: `${prefix} o365group add`,
26
27
  O365GROUP_GET: `${prefix} o365group get`,
27
28
  O365GROUP_LIST: `${prefix} o365group list`,
@@ -55,11 +56,20 @@ exports.default = {
55
56
  SITECLASSIFICATION_SET: `${prefix} siteclassification set`,
56
57
  SP_ADD: `${prefix} sp add`,
57
58
  SP_GET: `${prefix} sp get`,
59
+ USER_ADD: `${prefix} user add`,
58
60
  USER_GET: `${prefix} user get`,
59
61
  USER_GUEST_ADD: `${prefix} user guest add`,
60
62
  USER_HIBP: `${prefix} user hibp`,
63
+ USER_LICENSE_ADD: `${prefix} user license add`,
64
+ USER_LICENSE_LIST: `${prefix} user license list`,
65
+ USER_LICENSE_REMOVE: `${prefix} user license remove`,
61
66
  USER_LIST: `${prefix} user list`,
62
67
  USER_PASSWORD_VALIDATE: `${prefix} user password validate`,
68
+ USER_RECYCLEBINITEM_CLEAR: `${prefix} user recyclebinitem clear`,
69
+ USER_RECYCLEBINITEM_LIST: `${prefix} user recyclebinitem list`,
70
+ USER_RECYCLEBINITEM_REMOVE: `${prefix} user recyclebinitem remove`,
71
+ USER_REMOVE: `${prefix} user remove`,
72
+ USER_RECYCLEBINITEM_RESTORE: `${prefix} user recyclebinitem restore`,
63
73
  USER_SET: `${prefix} user set`,
64
74
  USER_SIGNIN_LIST: `${prefix} user signin list`
65
75
  };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const Command_1 = require("../../Command");
4
+ class O365MgmtCommand extends Command_1.default {
5
+ get resource() {
6
+ return 'https://manage.office.com';
7
+ }
8
+ }
9
+ exports.default = O365MgmtCommand;
10
+ //# sourceMappingURL=O365MgmtCommand.js.map
@@ -0,0 +1,54 @@
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 fs = require("fs");
13
+ const Command_1 = require("../../../../Command");
14
+ const ContextCommand_1 = require("../../../base/ContextCommand");
15
+ const commands_1 = require("../../commands");
16
+ class ContextOptionListCommand extends ContextCommand_1.default {
17
+ get name() {
18
+ return commands_1.default.OPTION_LIST;
19
+ }
20
+ get description() {
21
+ return 'List all options added to the context';
22
+ }
23
+ commandAction(logger) {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ if (this.verbose) {
26
+ logger.logToStderr(`Retrieving context options...`);
27
+ }
28
+ const filePath = '.m365rc.json';
29
+ let m365rc = {};
30
+ if (fs.existsSync(filePath)) {
31
+ try {
32
+ if (this.verbose) {
33
+ logger.logToStderr(`Reading context file...`);
34
+ }
35
+ const fileContents = fs.readFileSync(filePath, 'utf8');
36
+ if (fileContents) {
37
+ m365rc = JSON.parse(fileContents);
38
+ }
39
+ }
40
+ catch (e) {
41
+ throw new Command_1.CommandError(`Error reading ${filePath}: ${e}. Please retrieve context options from ${filePath} manually.`);
42
+ }
43
+ }
44
+ if (!m365rc.context) {
45
+ throw new Command_1.CommandError(`No context present`);
46
+ }
47
+ else {
48
+ logger.log(m365rc.context);
49
+ }
50
+ });
51
+ }
52
+ }
53
+ module.exports = new ContextOptionListCommand();
54
+ //# sourceMappingURL=option-list.js.map
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const prefix = 'context';
4
4
  exports.default = {
5
5
  INIT: `${prefix} init`,
6
+ OPTION_LIST: `${prefix} option list`,
6
7
  OPTION_REMOVE: `${prefix} option remove`,
7
8
  OPTION_SET: `${prefix} option set`,
8
9
  REMOVE: `${prefix} remove`
@@ -23,6 +23,7 @@ const uuid_1 = require("uuid");
23
23
  const Auth_1 = require("../../../../Auth");
24
24
  const Command_1 = require("../../../../Command");
25
25
  const request_1 = require("../../../../request");
26
+ const accessToken_1 = require("../../../../utils/accessToken");
26
27
  const GraphCommand_1 = require("../../../base/GraphCommand");
27
28
  const commands_1 = require("../../commands");
28
29
  class FileConvertPdfCommand extends GraphCommand_1.default {
@@ -46,8 +47,8 @@ class FileConvertPdfCommand extends GraphCommand_1.default {
46
47
  let sourceIsLocalFile = true;
47
48
  let targetIsLocalFile = true;
48
49
  let error;
49
- const isAppOnlyAuth = Auth_1.Auth.isAppOnlyAuth(Auth_1.default.service.accessTokens[Auth_1.default.defaultResource].accessToken);
50
- if (typeof isAppOnlyAuth === 'undefined') {
50
+ const isAppOnlyAccessToken = accessToken_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[Auth_1.default.defaultResource].accessToken);
51
+ if (typeof isAppOnlyAccessToken === 'undefined') {
51
52
  throw 'Unable to determine authentication type';
52
53
  }
53
54
  if (args.options.sourceFile.toLowerCase().startsWith('https://')) {
@@ -62,7 +63,7 @@ class FileConvertPdfCommand extends GraphCommand_1.default {
62
63
  }
63
64
  try {
64
65
  try {
65
- sourceFileUrl = yield this.getSourceFileUrl(logger, args, isAppOnlyAuth);
66
+ sourceFileUrl = yield this.getSourceFileUrl(logger, args, isAppOnlyAccessToken);
66
67
  const graphFileUrl = yield this.getGraphFileUrl(logger, sourceFileUrl, this.sourceFileGraphUrl);
67
68
  const fileResponse = yield this.convertFile(logger, graphFileUrl);
68
69
  yield this.writeFileToDisk(logger, fileResponse, localTargetFilePath);
@@ -114,17 +115,17 @@ class FileConvertPdfCommand extends GraphCommand_1.default {
114
115
  * file to the user's OneDrive for Business
115
116
  * @param logger Logger instance
116
117
  * @param args Command args
117
- * @param isAppOnlyAuth True if CLI is authenticated in app-only mode
118
+ * @param isAppOnlyAccessToken True if CLI is authenticated in app-only mode
118
119
  * @returns Web URL of the file to upload
119
120
  */
120
- getSourceFileUrl(logger, args, isAppOnlyAuth) {
121
+ getSourceFileUrl(logger, args, isAppOnlyAccessToken) {
121
122
  if (args.options.sourceFile.toLowerCase().startsWith('https://')) {
122
123
  return Promise.resolve(args.options.sourceFile);
123
124
  }
124
125
  if (this.verbose) {
125
126
  logger.logToStderr('Uploading local file temporarily for conversion...');
126
127
  }
127
- const driveUrl = `${this.resource}/v1.0/${isAppOnlyAuth ? 'drive/root' : 'me/drive/root'}`;
128
+ const driveUrl = `${this.resource}/v1.0/${isAppOnlyAccessToken ? 'drive/root' : 'me/drive/root'}`;
128
129
  // we need the original file extension because otherwise Graph won't be able
129
130
  // to convert the file to PDF
130
131
  this.sourceFileGraphUrl = `${driveUrl}:/${(0, uuid_1.v4)()}${path.extname(args.options.sourceFile)}`;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=FlowEnvironmentDetails.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 _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,9 +13,10 @@ 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 _FlowRunListCommand_instances, _FlowRunListCommand_initOptions;
16
+ var _FlowRunListCommand_instances, _FlowRunListCommand_initTelemetry, _FlowRunListCommand_initOptions, _FlowRunListCommand_initValidators;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  const formatting_1 = require("../../../../utils/formatting");
19
+ const validation_1 = require("../../../../utils/validation");
19
20
  const AzmgmtItemsListCommand_1 = require("../../../base/AzmgmtItemsListCommand");
20
21
  const commands_1 = require("../../commands");
21
22
  class FlowRunListCommand extends AzmgmtItemsListCommand_1.AzmgmtItemsListCommand {
@@ -31,14 +32,21 @@ class FlowRunListCommand extends AzmgmtItemsListCommand_1.AzmgmtItemsListCommand
31
32
  constructor() {
32
33
  super();
33
34
  _FlowRunListCommand_instances.add(this);
35
+ this.allowedStatusses = ['Succeeded', 'Running', 'Failed', 'Cancelled'];
36
+ __classPrivateFieldGet(this, _FlowRunListCommand_instances, "m", _FlowRunListCommand_initTelemetry).call(this);
34
37
  __classPrivateFieldGet(this, _FlowRunListCommand_instances, "m", _FlowRunListCommand_initOptions).call(this);
38
+ __classPrivateFieldGet(this, _FlowRunListCommand_instances, "m", _FlowRunListCommand_initValidators).call(this);
35
39
  }
36
40
  commandAction(logger, args) {
37
41
  return __awaiter(this, void 0, void 0, function* () {
38
42
  if (this.verbose) {
39
43
  logger.logToStderr(`Retrieving list of runs for Microsoft Flow ${args.options.flowName}...`);
40
44
  }
41
- const 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/environments/${formatting_1.formatting.encodeQueryParameter(args.options.environmentName)}/flows/${formatting_1.formatting.encodeQueryParameter(args.options.flowName)}/runs?api-version=2016-11-01`;
46
+ const filters = this.getFilters(args.options);
47
+ if (filters.length > 0) {
48
+ url += `&$filter=${filters.join(' and ')}`;
49
+ }
42
50
  try {
43
51
  yield this.getAllItems(url, logger, true);
44
52
  if (this.items.length > 0) {
@@ -59,13 +67,57 @@ class FlowRunListCommand extends AzmgmtItemsListCommand_1.AzmgmtItemsListCommand
59
67
  }
60
68
  });
61
69
  }
70
+ getFilters(options) {
71
+ const filters = [];
72
+ if (options.status) {
73
+ filters.push(`status eq '${options.status}'`);
74
+ }
75
+ if (options.triggerStartTime) {
76
+ filters.push(`startTime ge ${options.triggerStartTime}`);
77
+ }
78
+ if (options.triggerEndTime) {
79
+ filters.push(`startTime lt ${options.triggerEndTime}`);
80
+ }
81
+ return filters;
82
+ }
62
83
  }
63
- _FlowRunListCommand_instances = new WeakSet(), _FlowRunListCommand_initOptions = function _FlowRunListCommand_initOptions() {
84
+ _FlowRunListCommand_instances = new WeakSet(), _FlowRunListCommand_initTelemetry = function _FlowRunListCommand_initTelemetry() {
85
+ this.telemetry.push((args) => {
86
+ Object.assign(this.telemetryProperties, {
87
+ status: typeof args.options.status !== 'undefined',
88
+ triggerStartTime: typeof args.options.triggerStartTime !== 'undefined',
89
+ triggerEndTime: typeof args.options.triggerEndTime !== 'undefined'
90
+ });
91
+ });
92
+ }, _FlowRunListCommand_initOptions = function _FlowRunListCommand_initOptions() {
64
93
  this.options.unshift({
65
94
  option: '-f, --flowName <flowName>'
66
95
  }, {
67
96
  option: '-e, --environmentName <environmentName>'
97
+ }, {
98
+ option: '--status [status]',
99
+ autocomplete: this.allowedStatusses
100
+ }, {
101
+ option: '--triggerStartTime [triggerStartTime]'
102
+ }, {
103
+ option: '--triggerEndTime [triggerEndTime]'
68
104
  });
105
+ }, _FlowRunListCommand_initValidators = function _FlowRunListCommand_initValidators() {
106
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
107
+ if (!validation_1.validation.isValidGuid(args.options.flowName)) {
108
+ return `${args.options.flowName} is not a valid GUID`;
109
+ }
110
+ if (args.options.status && this.allowedStatusses.indexOf(args.options.status) === -1) {
111
+ return `'${args.options.status}' is not a valid status. Allowed values are: ${this.allowedStatusses.join(',')}`;
112
+ }
113
+ if (args.options.triggerStartTime && !validation_1.validation.isValidISODateTime(args.options.triggerStartTime)) {
114
+ return `'${args.options.triggerStartTime}' is not a valid datetime.`;
115
+ }
116
+ if (args.options.triggerEndTime && !validation_1.validation.isValidISODateTime(args.options.triggerEndTime)) {
117
+ return `'${args.options.triggerEndTime}' is not a valid datetime.`;
118
+ }
119
+ return true;
120
+ }));
69
121
  };
70
122
  module.exports = new FlowRunListCommand();
71
123
  //# sourceMappingURL=run-list.js.map
@@ -21,6 +21,7 @@ const AnonymousCommand_1 = require("../../../base/AnonymousCommand");
21
21
  const commands_1 = require("../../commands");
22
22
  const request_1 = require("../../../../request");
23
23
  const xmldom_1 = require("@xmldom/xmldom");
24
+ const Cli_1 = require("../../../../cli/Cli");
24
25
  class GraphChangelogListCommand extends AnonymousCommand_1.default {
25
26
  get name() {
26
27
  return commands_1.default.CHANGELOG_LIST;
@@ -106,14 +107,14 @@ class GraphChangelogListCommand extends AnonymousCommand_1.default {
106
107
  items: []
107
108
  };
108
109
  Array.from(xmlDoc.getElementsByTagName('item')).forEach((item) => {
109
- const description = args.options.output === 'text' ?
110
+ const description = Cli_1.Cli.shouldTrimOutput(args.options.output) ?
110
111
  md_1.md.md2plain(item.getElementsByTagName('description').item(0).textContent, '') :
111
112
  item.getElementsByTagName('description').item(0).textContent;
112
113
  changelog.items.push({
113
114
  guid: item.getElementsByTagName('guid').item(0).textContent,
114
115
  category: item.getElementsByTagName('category').item(1).textContent,
115
116
  title: item.getElementsByTagName('title').item(0).textContent,
116
- description: args.options.output === 'text' ?
117
+ description: Cli_1.Cli.shouldTrimOutput(args.options.output) ?
117
118
  description.length > 50 ? `${description.substring(0, 47)}...` : description :
118
119
  description,
119
120
  pubDate: new Date(item.getElementsByTagName('pubDate').item(0).textContent)
@@ -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 _OneNoteNotebookListCommand_instances, _OneNoteNotebookListCommand_initTelemetry, _OneNoteNotebookListCommand_initOptions, _OneNoteNotebookListCommand_initValidators;
16
+ var _OneNoteNotebookListCommand_instances, _OneNoteNotebookListCommand_initTelemetry, _OneNoteNotebookListCommand_initOptions, _OneNoteNotebookListCommand_initValidators, _OneNoteNotebookListCommand_initOptionSets;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  const request_1 = require("../../../../request");
19
19
  const odata_1 = require("../../../../utils/odata");
@@ -28,75 +28,63 @@ class OneNoteNotebookListCommand extends GraphCommand_1.default {
28
28
  get description() {
29
29
  return 'Retrieve a list of notebooks';
30
30
  }
31
+ defaultProperties() {
32
+ return ['createdDateTime', 'displayName', 'id'];
33
+ }
31
34
  constructor() {
32
35
  super();
33
36
  _OneNoteNotebookListCommand_instances.add(this);
34
37
  __classPrivateFieldGet(this, _OneNoteNotebookListCommand_instances, "m", _OneNoteNotebookListCommand_initTelemetry).call(this);
35
38
  __classPrivateFieldGet(this, _OneNoteNotebookListCommand_instances, "m", _OneNoteNotebookListCommand_initOptions).call(this);
36
39
  __classPrivateFieldGet(this, _OneNoteNotebookListCommand_instances, "m", _OneNoteNotebookListCommand_initValidators).call(this);
40
+ __classPrivateFieldGet(this, _OneNoteNotebookListCommand_instances, "m", _OneNoteNotebookListCommand_initOptionSets).call(this);
37
41
  }
38
42
  getEndpointUrl(args) {
39
- return new Promise((resolve, reject) => {
40
- let endpoint = `${this.resource}/v1.0/me/onenote/notebooks`;
43
+ return __awaiter(this, void 0, void 0, function* () {
44
+ let endpoint = `${this.resource}/v1.0/`;
41
45
  if (args.options.userId) {
42
- endpoint = `${this.resource}/v1.0/users/${args.options.userId}/onenote/notebooks`;
43
- return resolve(endpoint);
46
+ endpoint += `users/${args.options.userId}`;
44
47
  }
45
48
  else if (args.options.userName) {
46
- endpoint = `${this.resource}/v1.0/users/${args.options.userName}/onenote/notebooks`;
47
- return resolve(endpoint);
49
+ endpoint += `users/${args.options.userName}`;
48
50
  }
49
51
  else if (args.options.groupId) {
50
- endpoint = `${this.resource}/v1.0/groups/${args.options.groupId}/onenote/notebooks`;
51
- return resolve(endpoint);
52
+ endpoint += `groups/${args.options.groupId}`;
52
53
  }
53
54
  else if (args.options.groupName) {
54
- this
55
- .getGroupId(args)
56
- .then((retrievedgroupId) => {
57
- endpoint = `${this.resource}/v1.0/groups/${retrievedgroupId}/onenote/notebooks`;
58
- return resolve(endpoint);
59
- })
60
- .catch((err) => {
61
- reject(err);
62
- });
55
+ const groupId = yield this.getGroupId(args.options.groupName);
56
+ endpoint += `groups/${groupId}`;
63
57
  }
64
58
  else if (args.options.webUrl) {
65
- this
66
- .getSpoSiteId(args)
67
- .then((siteId) => {
68
- endpoint = `${this.resource}/v1.0/sites/${siteId}/onenote/notebooks`;
69
- return resolve(endpoint);
70
- })
71
- .catch((err) => {
72
- reject(err);
73
- });
59
+ const siteId = yield this.getSpoSiteId(args.options.webUrl);
60
+ endpoint += `sites/${siteId}`;
74
61
  }
75
62
  else {
76
- return resolve(endpoint);
63
+ endpoint += 'me';
77
64
  }
65
+ endpoint += '/onenote/notebooks';
66
+ return endpoint;
78
67
  });
79
68
  }
80
- defaultProperties() {
81
- return ['createdDateTime', 'displayName', 'id'];
82
- }
83
- getGroupId(args) {
84
- return aadGroup_1.aadGroup
85
- .getGroupByDisplayName(args.options.groupName)
86
- .then(group => group.id);
69
+ getGroupId(groupName) {
70
+ return __awaiter(this, void 0, void 0, function* () {
71
+ const group = yield aadGroup_1.aadGroup.getGroupByDisplayName(groupName);
72
+ return group.id;
73
+ });
87
74
  }
88
- getSpoSiteId(args) {
89
- const url = new URL(args.options.webUrl);
90
- const requestOptions = {
91
- url: `${this.resource}/v1.0/sites/${url.hostname}:${url.pathname}`,
92
- headers: {
93
- accept: 'application/json;odata.metadata=none'
94
- },
95
- responseType: 'json'
96
- };
97
- return request_1.default
98
- .get(requestOptions)
99
- .then((site) => site.id);
75
+ getSpoSiteId(webUrl) {
76
+ return __awaiter(this, void 0, void 0, function* () {
77
+ const url = new URL(webUrl);
78
+ const requestOptions = {
79
+ url: `${this.resource}/v1.0/sites/${url.hostname}:${url.pathname}`,
80
+ headers: {
81
+ accept: 'application/json;odata.metadata=none'
82
+ },
83
+ responseType: 'json'
84
+ };
85
+ const site = yield request_1.default.get(requestOptions);
86
+ return site.id;
87
+ });
100
88
  }
101
89
  commandAction(logger, args) {
102
90
  return __awaiter(this, void 0, void 0, function* () {
@@ -114,7 +102,11 @@ class OneNoteNotebookListCommand extends GraphCommand_1.default {
114
102
  _OneNoteNotebookListCommand_instances = new WeakSet(), _OneNoteNotebookListCommand_initTelemetry = function _OneNoteNotebookListCommand_initTelemetry() {
115
103
  this.telemetry.push((args) => {
116
104
  Object.assign(this.telemetryProperties, {
117
- joined: args.options.joined
105
+ userId: typeof args.options.userId !== 'undefined',
106
+ userName: typeof args.options.userName !== 'undefined',
107
+ groupId: typeof args.options.groupId !== 'undefined',
108
+ groupName: typeof args.options.groupName !== 'undefined',
109
+ webUrl: typeof args.options.webUrl !== 'undefined'
118
110
  });
119
111
  });
120
112
  }, _OneNoteNotebookListCommand_initOptions = function _OneNoteNotebookListCommand_initOptions() {
@@ -127,14 +119,19 @@ _OneNoteNotebookListCommand_instances = new WeakSet(), _OneNoteNotebookListComma
127
119
  if (args.options.groupId && !validation_1.validation.isValidGuid(args.options.groupId)) {
128
120
  return `${args.options.groupId} is not a valid GUID`;
129
121
  }
130
- if (args.options.userId && args.options.userName) {
131
- return 'Specify either userId or userName, but not both';
132
- }
133
- if (args.options.groupId && args.options.groupName) {
134
- return 'Specify either groupId or groupName, but not both';
122
+ if (args.options.webUrl) {
123
+ return validation_1.validation.isValidSharePointUrl(args.options.webUrl);
135
124
  }
136
125
  return true;
137
126
  }));
127
+ }, _OneNoteNotebookListCommand_initOptionSets = function _OneNoteNotebookListCommand_initOptionSets() {
128
+ this.optionSets.push({
129
+ options: ['userId', 'userName', 'groupId', 'groupName', 'webUrl'],
130
+ runsWhen: (args) => {
131
+ const options = [args.options.userId, args.options.userName, args.options.groupId, args.options.groupName, args.options.webUrl];
132
+ return options.some(item => item !== undefined);
133
+ }
134
+ });
138
135
  };
139
136
  module.exports = new OneNoteNotebookListCommand();
140
137
  //# sourceMappingURL=notebook-list.js.map
@@ -15,12 +15,12 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
15
15
  };
16
16
  var _OneNotePageListCommand_instances, _OneNotePageListCommand_initTelemetry, _OneNotePageListCommand_initOptions, _OneNotePageListCommand_initValidators, _OneNotePageListCommand_initOptionSets;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- const request_1 = require("../../../../request");
19
18
  const odata_1 = require("../../../../utils/odata");
20
19
  const validation_1 = require("../../../../utils/validation");
21
20
  const aadGroup_1 = require("../../../../utils/aadGroup");
22
21
  const GraphCommand_1 = require("../../../base/GraphCommand");
23
22
  const commands_1 = require("../../commands");
23
+ const spo_1 = require("../../../../utils/spo");
24
24
  class OneNotePageListCommand extends GraphCommand_1.default {
25
25
  get name() {
26
26
  return commands_1.default.PAGE_LIST;
@@ -56,7 +56,7 @@ class OneNotePageListCommand extends GraphCommand_1.default {
56
56
  endpoint += `groups/${groupId}`;
57
57
  }
58
58
  else if (args.options.webUrl) {
59
- const siteId = yield this.getSpoSiteId(args.options.webUrl);
59
+ const siteId = yield spo_1.spo.getSpoGraphSiteId(args.options.webUrl);
60
60
  endpoint += `sites/${siteId}`;
61
61
  }
62
62
  else {
@@ -72,20 +72,6 @@ class OneNotePageListCommand extends GraphCommand_1.default {
72
72
  return group.id;
73
73
  });
74
74
  }
75
- getSpoSiteId(webUrl) {
76
- return __awaiter(this, void 0, void 0, function* () {
77
- const url = new URL(webUrl);
78
- const requestOptions = {
79
- url: `${this.resource}/v1.0/sites/${url.hostname}:${url.pathname}`,
80
- headers: {
81
- accept: 'application/json;odata.metadata=none'
82
- },
83
- responseType: 'json'
84
- };
85
- const site = yield request_1.default.get(requestOptions);
86
- return site.id;
87
- });
88
- }
89
75
  commandAction(logger, args) {
90
76
  return __awaiter(this, void 0, void 0, function* () {
91
77
  try {
@@ -22,6 +22,7 @@ const request_1 = require("../../../../request");
22
22
  const GraphCommand_1 = require("../../../base/GraphCommand");
23
23
  const commands_1 = require("../../commands");
24
24
  const formatting_1 = require("../../../../utils/formatting");
25
+ const accessToken_1 = require("../../../../utils/accessToken");
25
26
  class OutlookMailSendCommand extends GraphCommand_1.default {
26
27
  get name() {
27
28
  return commands_1.default.MAIL_SEND;
@@ -40,8 +41,8 @@ class OutlookMailSendCommand extends GraphCommand_1.default {
40
41
  commandAction(logger, args) {
41
42
  return __awaiter(this, void 0, void 0, function* () {
42
43
  try {
43
- const isAppOnlyAuth = Auth_1.Auth.isAppOnlyAuth(Auth_1.default.service.accessTokens[this.resource].accessToken);
44
- if (isAppOnlyAuth === true && !args.options.sender) {
44
+ const isAppOnlyAccessToken = accessToken_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken);
45
+ if (isAppOnlyAccessToken === true && !args.options.sender) {
45
46
  throw `Specify a upn or user id in the 'sender' option when using app only authentication.`;
46
47
  }
47
48
  const requestOptions = {
@@ -17,6 +17,7 @@ var _OutlookMessageGetCommand_instances, _OutlookMessageGetCommand_initTelemetry
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  const Auth_1 = require("../../../../Auth");
19
19
  const request_1 = require("../../../../request");
20
+ const accessToken_1 = require("../../../../utils/accessToken");
20
21
  const GraphCommand_1 = require("../../../base/GraphCommand");
21
22
  const commands_1 = require("../../commands");
22
23
  class OutlookMessageGetCommand extends GraphCommand_1.default {
@@ -35,12 +36,12 @@ class OutlookMessageGetCommand extends GraphCommand_1.default {
35
36
  commandAction(logger, args) {
36
37
  return __awaiter(this, void 0, void 0, function* () {
37
38
  try {
38
- const isAppOnlyAuth = Auth_1.Auth.isAppOnlyAuth(Auth_1.default.service.accessTokens[this.resource].accessToken);
39
+ const isAppOnlyAccessToken = accessToken_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken);
39
40
  if (this.verbose) {
40
- logger.logToStderr(`Retrieving message with id ${args.options.id} using ${isAppOnlyAuth ? 'app only permissions' : 'delegated permissions'}`);
41
+ logger.logToStderr(`Retrieving message with id ${args.options.id} using ${isAppOnlyAccessToken ? 'app only permissions' : 'delegated permissions'}`);
41
42
  }
42
43
  let requestUrl = '';
43
- if (isAppOnlyAuth) {
44
+ if (isAppOnlyAccessToken) {
44
45
  if (!args.options.userId && !args.options.userPrincipalName) {
45
46
  throw `The option 'userId' or 'userPrincipalName' is required when retrieving an email using app only credentials`;
46
47
  }
@@ -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 _PaEnvironmentGetCommand_instances, _PaEnvironmentGetCommand_initOptions;
16
+ var _PaEnvironmentGetCommand_instances, _PaEnvironmentGetCommand_initTelemetry, _PaEnvironmentGetCommand_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,15 +32,17 @@ class PaEnvironmentGetCommand extends PowerAppsCommand_1.default {
32
32
  constructor() {
33
33
  super();
34
34
  _PaEnvironmentGetCommand_instances.add(this);
35
+ __classPrivateFieldGet(this, _PaEnvironmentGetCommand_instances, "m", _PaEnvironmentGetCommand_initTelemetry).call(this);
35
36
  __classPrivateFieldGet(this, _PaEnvironmentGetCommand_instances, "m", _PaEnvironmentGetCommand_initOptions).call(this);
36
37
  }
37
38
  commandAction(logger, args) {
38
39
  return __awaiter(this, void 0, void 0, function* () {
39
40
  if (this.verbose) {
40
- logger.logToStderr(`Retrieving information about Microsoft Power Apps environment ${args.options.name}...`);
41
+ logger.logToStderr(`Retrieving information about Microsoft Power Apps environment ${args.options.name || 'default'}...`);
41
42
  }
43
+ const environmentName = args.options.name ? formatting_1.formatting.encodeQueryParameter(args.options.name) : '~default';
42
44
  const requestOptions = {
43
- url: `${this.resource}/providers/Microsoft.PowerApps/environments/${formatting_1.formatting.encodeQueryParameter(args.options.name)}?api-version=2016-11-01`,
45
+ url: `${this.resource}/providers/Microsoft.PowerApps/environments/${environmentName}?api-version=2016-11-01`,
44
46
  headers: {
45
47
  accept: 'application/json'
46
48
  },
@@ -61,9 +63,15 @@ class PaEnvironmentGetCommand extends PowerAppsCommand_1.default {
61
63
  });
62
64
  }
63
65
  }
64
- _PaEnvironmentGetCommand_instances = new WeakSet(), _PaEnvironmentGetCommand_initOptions = function _PaEnvironmentGetCommand_initOptions() {
66
+ _PaEnvironmentGetCommand_instances = new WeakSet(), _PaEnvironmentGetCommand_initTelemetry = function _PaEnvironmentGetCommand_initTelemetry() {
67
+ this.telemetry.push((args) => {
68
+ Object.assign(this.telemetryProperties, {
69
+ name: typeof args.options.name !== 'undefined'
70
+ });
71
+ });
72
+ }, _PaEnvironmentGetCommand_initOptions = function _PaEnvironmentGetCommand_initOptions() {
65
73
  this.options.unshift({
66
- option: '-n, --name <name>'
74
+ option: '-n, --name [name]'
67
75
  });
68
76
  };
69
77
  module.exports = new PaEnvironmentGetCommand();