@pnp/cli-microsoft365 6.8.0-beta.e41be56 → 6.8.0

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 (290) hide show
  1. package/.eslintrc.js +2 -0
  2. package/.mocharc.json +1 -0
  3. package/README.md +6 -1
  4. package/dist/Command.js +6 -0
  5. package/dist/chili/chili.js +298 -0
  6. package/dist/chili/index.js +20 -0
  7. package/dist/cli/Cli.js +2 -2
  8. package/dist/m365/aad/commands/user/user-add.js +30 -21
  9. package/dist/m365/app/commands/permission/permission-add.js +279 -0
  10. package/dist/m365/app/commands.js +1 -0
  11. package/dist/m365/commands/commands.js +2 -0
  12. package/dist/m365/commands/docs.js +42 -0
  13. package/dist/m365/commands/login.js +1 -1
  14. package/dist/m365/commands/setup.js +180 -0
  15. package/dist/m365/commands/setupPresets.js +25 -0
  16. package/dist/m365/pa/commands/app/app-consent-set.js +101 -0
  17. package/dist/m365/pa/commands.js +1 -0
  18. package/dist/m365/planner/commands/roster/roster-plan-list.js +102 -0
  19. package/dist/m365/planner/commands.js +1 -0
  20. package/dist/m365/purview/commands/sensitivitylabel/sensitivitylabel-get.js +97 -0
  21. package/dist/m365/purview/commands/sensitivitylabel/sensitivitylabel-list.js +85 -0
  22. package/dist/m365/purview/commands/sensitivitylabel/sensitivitylabel-policysettings-list.js +89 -0
  23. package/dist/m365/purview/commands.js +3 -0
  24. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.17.2.js +25 -0
  25. package/dist/m365/spfx/commands/project/project-doctor/rules/FN001035_DEP_fluentui_react.js +18 -0
  26. package/dist/m365/spfx/commands/project/project-doctor/rules/FN021009_PKG_no_duplicate_oui_deps.js +11 -4
  27. package/dist/m365/spfx/commands/project/project-doctor.js +2 -1
  28. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN001035_DEP_fluentui_react.js +18 -0
  29. package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.15.2.js +2 -0
  30. package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.17.2.js +61 -0
  31. package/dist/m365/spfx/commands/project/project-upgrade.js +2 -1
  32. package/dist/m365/spfx/commands/spfx-doctor.js +29 -30
  33. package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-remove.js +146 -0
  34. package/dist/m365/spo/commands/file/file-checkin.js +8 -3
  35. package/dist/m365/spo/commands/file/file-checkout.js +8 -3
  36. package/dist/m365/spo/commands/file/file-copy.js +4 -4
  37. package/dist/m365/spo/commands/file/file-get.js +3 -1
  38. package/dist/m365/spo/commands/file/file-list.js +17 -6
  39. package/dist/m365/spo/commands/file/file-move.js +6 -7
  40. package/dist/m365/spo/commands/file/file-remove.js +6 -12
  41. package/dist/m365/spo/commands/file/file-rename.js +3 -3
  42. package/dist/m365/spo/commands/file/file-roleassignment-add.js +2 -1
  43. package/dist/m365/spo/commands/file/file-roleassignment-remove.js +3 -3
  44. package/dist/m365/spo/commands/file/file-roleinheritance-break.js +2 -1
  45. package/dist/m365/spo/commands/file/file-roleinheritance-reset.js +2 -1
  46. package/dist/m365/spo/commands/file/file-sharinginfo-get.js +4 -2
  47. package/dist/m365/spo/commands/file/file-version-clear.js +3 -1
  48. package/dist/m365/spo/commands/file/file-version-get.js +3 -1
  49. package/dist/m365/spo/commands/file/file-version-remove.js +3 -1
  50. package/dist/m365/spo/commands/file/file-version-restore.js +3 -1
  51. package/dist/m365/spo/commands/folder/folder-copy.js +4 -4
  52. package/dist/m365/spo/commands/folder/folder-get.js +5 -2
  53. package/dist/m365/spo/commands/folder/folder-move.js +3 -2
  54. package/dist/m365/spo/commands/folder/folder-rename.js +5 -2
  55. package/dist/m365/spo/commands/list/list-get.js +30 -3
  56. package/dist/m365/spo/commands/list/list-list.js +39 -2
  57. package/dist/m365/spo/commands/listitem/listitem-batch-set.js +308 -0
  58. package/dist/m365/spo/commands/page/page-section-add.js +2 -3
  59. package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-permissionrequest-list.js +46 -1
  60. package/dist/m365/spo/commands/site/site-recyclebinitem-move.js +119 -0
  61. package/dist/m365/spo/commands/site/site-recyclebinitem-remove.js +106 -0
  62. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-get.js +30 -39
  63. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-list.js +47 -0
  64. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-remove.js +151 -0
  65. package/dist/m365/spo/commands/tenant/tenant-commandset-remove.js +152 -0
  66. package/dist/m365/spo/commands/tenant/tenant-commandset-set.js +203 -0
  67. package/dist/m365/spo/commands/tenant/tenant-settings-set.js +4 -0
  68. package/dist/m365/spo/commands/term/term-add.js +13 -4
  69. package/dist/m365/spo/commands/term/term-get.js +14 -5
  70. package/dist/m365/spo/commands/term/term-group-get.js +12 -3
  71. package/dist/m365/spo/commands/term/term-group-list.js +39 -4
  72. package/dist/m365/spo/commands/term/term-list.js +18 -9
  73. package/dist/m365/spo/commands/term/term-set-add.js +13 -4
  74. package/dist/m365/spo/commands/term/term-set-get.js +12 -3
  75. package/dist/m365/spo/commands/term/term-set-list.js +12 -3
  76. package/dist/m365/spo/commands.js +9 -0
  77. package/dist/m365/teams/commands/chat/chat-member-remove.js +137 -0
  78. package/dist/m365/teams/commands/meeting/meeting-transcript-list.js +124 -0
  79. package/dist/m365/teams/commands.js +2 -0
  80. package/dist/utils/formatting.js +35 -11
  81. package/dist/utils/pid.js +5 -0
  82. package/dist/utils/spo.js +1 -1
  83. package/docs/docs/cmd/aad/o365group/o365group-get.md +0 -12
  84. package/docs/docs/cmd/aad/user/user-add.md +4 -0
  85. package/docs/docs/cmd/aad/user/user-set.md +2 -2
  86. package/docs/docs/cmd/adaptivecard/adaptivecard-send.md +13 -13
  87. package/docs/docs/cmd/app/app-get.md +25 -6
  88. package/docs/docs/cmd/app/app-open.md +8 -2
  89. package/docs/docs/cmd/app/permission/permission-add.md +53 -0
  90. package/docs/docs/cmd/app/permission/permission-list.md +19 -19
  91. package/docs/docs/cmd/booking/business/business-get.md +30 -8
  92. package/docs/docs/cmd/booking/business/business-list.md +17 -8
  93. package/docs/docs/cmd/cli/cli-consent.md +6 -0
  94. package/docs/docs/cmd/cli/cli-doctor.md +17 -0
  95. package/docs/docs/cmd/cli/cli-issue.md +6 -0
  96. package/docs/docs/cmd/cli/cli-reconsent.md +6 -0
  97. package/docs/docs/cmd/cli/completion/completion-sh-setup.md +6 -0
  98. package/docs/docs/cmd/cli/config/config-get.md +6 -0
  99. package/docs/docs/cmd/docs.md +51 -0
  100. package/docs/docs/cmd/flow/environment/environment-list.md +18 -0
  101. package/docs/docs/cmd/flow/flow-get.md +20 -0
  102. package/docs/docs/cmd/flow/flow-list.md +17 -0
  103. package/docs/docs/cmd/graph/changelog/changelog-list.md +52 -0
  104. package/docs/docs/cmd/graph/schemaextension/schemaextension-add.md +61 -0
  105. package/docs/docs/cmd/graph/schemaextension/schemaextension-get.md +61 -0
  106. package/docs/docs/cmd/graph/schemaextension/schemaextension-list.md +61 -0
  107. package/docs/docs/cmd/graph/schemaextension/schemaextension-remove.md +4 -0
  108. package/docs/docs/cmd/graph/schemaextension/schemaextension-set.md +4 -0
  109. package/docs/docs/cmd/graph/subscription/subscription-add.md +73 -0
  110. package/docs/docs/cmd/login.md +1 -1
  111. package/docs/docs/cmd/onedrive/onedrive-list.md +225 -0
  112. package/docs/docs/cmd/onedrive/report/report-activityfilecounts.md +39 -0
  113. package/docs/docs/cmd/onedrive/report/report-activityusercounts.md +39 -0
  114. package/docs/docs/cmd/onedrive/report/report-activityuserdetail.md +43 -0
  115. package/docs/docs/cmd/onedrive/report/report-usageaccountcounts.md +38 -0
  116. package/docs/docs/cmd/onedrive/report/report-usageaccountdetail.md +43 -0
  117. package/docs/docs/cmd/onedrive/report/report-usagefilecounts.md +38 -0
  118. package/docs/docs/cmd/onedrive/report/report-usagestorage.md +37 -0
  119. package/docs/docs/cmd/onenote/notebook/notebook-list.md +79 -0
  120. package/docs/docs/cmd/pa/app/app-consent-set.md +47 -0
  121. package/docs/docs/cmd/planner/plan/plan-get.md +1 -1
  122. package/docs/docs/cmd/planner/plan/plan-list.md +1 -1
  123. package/docs/docs/cmd/planner/roster/roster-add.md +2 -1
  124. package/docs/docs/cmd/planner/roster/roster-get.md +1 -1
  125. package/docs/docs/cmd/planner/roster/roster-plan-list.md +109 -0
  126. package/docs/docs/cmd/planner/roster/roster-remove.md +2 -1
  127. package/docs/docs/cmd/planner/task/task-get.md +0 -6
  128. package/docs/docs/cmd/planner/task/task-set.md +1 -1
  129. package/docs/docs/cmd/purview/retentionevent/retentionevent-add.md +6 -7
  130. package/docs/docs/cmd/purview/retentionevent/retentionevent-get.md +6 -7
  131. package/docs/docs/cmd/purview/retentionevent/retentionevent-list.md +4 -4
  132. package/docs/docs/cmd/purview/retentionevent/retentionevent-remove.md +4 -4
  133. package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-add.md +10 -10
  134. package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-get.md +11 -11
  135. package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-list.md +10 -10
  136. package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-remove.md +10 -10
  137. package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-set.md +10 -10
  138. package/docs/docs/cmd/purview/retentionlabel/retentionlabel-add.md +12 -12
  139. package/docs/docs/cmd/purview/retentionlabel/retentionlabel-get.md +8 -9
  140. package/docs/docs/cmd/purview/retentionlabel/retentionlabel-list.md +8 -9
  141. package/docs/docs/cmd/purview/retentionlabel/retentionlabel-remove.md +8 -8
  142. package/docs/docs/cmd/purview/retentionlabel/retentionlabel-set.md +8 -8
  143. package/docs/docs/cmd/purview/sensitivitylabel/sensitivitylabel-get.md +118 -0
  144. package/docs/docs/cmd/purview/sensitivitylabel/sensitivitylabel-list.md +111 -0
  145. package/docs/docs/cmd/purview/sensitivitylabel/sensitivitylabel-policysettings-list.md +97 -0
  146. package/docs/docs/cmd/search/externalconnection/externalconnection-get.md +17 -0
  147. package/docs/docs/cmd/search/externalconnection/externalconnection-list.md +17 -0
  148. package/docs/docs/cmd/setup.md +86 -0
  149. package/docs/docs/cmd/spfx/project/project-doctor.md +1 -1
  150. package/docs/docs/cmd/spfx/project/project-upgrade.md +1 -1
  151. package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-add.md +1 -1
  152. package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-remove.md +77 -0
  153. package/docs/docs/cmd/spo/commandset/commandset-set.md +1 -1
  154. package/docs/docs/cmd/spo/contenttype/contenttype-set.md +2 -2
  155. package/docs/docs/cmd/spo/customaction/customaction-add.md +1 -1
  156. package/docs/docs/cmd/spo/customaction/customaction-set.md +1 -1
  157. package/docs/docs/cmd/spo/feature/feature-enable.md +2 -2
  158. package/docs/docs/cmd/spo/file/file-add.md +1 -1
  159. package/docs/docs/cmd/spo/file/file-checkin.md +1 -1
  160. package/docs/docs/cmd/spo/file/file-checkout.md +1 -1
  161. package/docs/docs/cmd/spo/file/file-copy.md +1 -1
  162. package/docs/docs/cmd/spo/file/file-get.md +1 -1
  163. package/docs/docs/cmd/spo/file/file-list.md +9 -6
  164. package/docs/docs/cmd/spo/file/file-move.md +3 -3
  165. package/docs/docs/cmd/spo/file/file-remove.md +12 -0
  166. package/docs/docs/cmd/spo/file/file-rename.md +1 -1
  167. package/docs/docs/cmd/spo/file/file-retentionlabel-ensure.md +3 -3
  168. package/docs/docs/cmd/spo/file/file-retentionlabel-remove.md +2 -2
  169. package/docs/docs/cmd/spo/file/file-roleassignment-add.md +1 -1
  170. package/docs/docs/cmd/spo/file/file-roleassignment-remove.md +1 -1
  171. package/docs/docs/cmd/spo/file/file-roleinheritance-break.md +1 -1
  172. package/docs/docs/cmd/spo/file/file-roleinheritance-reset.md +1 -1
  173. package/docs/docs/cmd/spo/file/file-sharinginfo-get.md +1 -1
  174. package/docs/docs/cmd/spo/file/file-sharinglink-add.md +1 -1
  175. package/docs/docs/cmd/spo/file/file-sharinglink-clear.md +1 -1
  176. package/docs/docs/cmd/spo/file/file-sharinglink-get.md +1 -1
  177. package/docs/docs/cmd/spo/file/file-sharinglink-list.md +1 -1
  178. package/docs/docs/cmd/spo/file/file-sharinglink-remove.md +1 -1
  179. package/docs/docs/cmd/spo/file/file-sharinglink-set.md +1 -1
  180. package/docs/docs/cmd/spo/file/file-version-clear.md +2 -2
  181. package/docs/docs/cmd/spo/file/file-version-get.md +1 -1
  182. package/docs/docs/cmd/spo/file/file-version-list.md +1 -1
  183. package/docs/docs/cmd/spo/file/file-version-remove.md +1 -1
  184. package/docs/docs/cmd/spo/file/file-version-restore.md +1 -1
  185. package/docs/docs/cmd/spo/folder/folder-add.md +9 -3
  186. package/docs/docs/cmd/spo/folder/folder-copy.md +2 -2
  187. package/docs/docs/cmd/spo/folder/folder-get.md +7 -7
  188. package/docs/docs/cmd/spo/folder/folder-list.md +11 -11
  189. package/docs/docs/cmd/spo/folder/folder-move.md +1 -1
  190. package/docs/docs/cmd/spo/folder/folder-remove.md +7 -7
  191. package/docs/docs/cmd/spo/folder/folder-rename.md +11 -5
  192. package/docs/docs/cmd/spo/folder/folder-retentionlabel-ensure.md +3 -3
  193. package/docs/docs/cmd/spo/folder/folder-retentionlabel-remove.md +1 -1
  194. package/docs/docs/cmd/spo/folder/folder-roleinheritance-break.md +1 -1
  195. package/docs/docs/cmd/spo/folder/folder-roleinheritance-reset.md +4 -4
  196. package/docs/docs/cmd/spo/list/list-get.md +10 -0
  197. package/docs/docs/cmd/spo/list/list-list.md +28 -0
  198. package/docs/docs/cmd/spo/listitem/listitem-batch-set.md +67 -0
  199. package/docs/docs/cmd/spo/listitem/listitem-list.md +1 -1
  200. package/docs/docs/cmd/spo/orgassetslibrary/orgassetslibrary-list.md +19 -0
  201. package/docs/docs/cmd/spo/orgassetslibrary/orgassetslibrary-remove.md +12 -0
  202. package/docs/docs/cmd/spo/orgnewssite/orgnewssite-list.md +6 -0
  203. package/docs/docs/cmd/spo/page/page-column-get.md +15 -0
  204. package/docs/docs/cmd/spo/page/page-column-list.md +16 -0
  205. package/docs/docs/cmd/spo/page/page-control-get.md +18 -0
  206. package/docs/docs/cmd/spo/page/page-control-list.md +18 -0
  207. package/docs/docs/cmd/spo/page/page-copy.md +35 -0
  208. package/docs/docs/cmd/spo/page/page-get.md +39 -0
  209. package/docs/docs/cmd/spo/page/page-list.md +53 -0
  210. package/docs/docs/cmd/spo/page/page-section-get.md +12 -0
  211. package/docs/docs/cmd/spo/page/page-section-list.md +13 -0
  212. package/docs/docs/cmd/spo/page/page-template-list.md +31 -0
  213. package/docs/docs/cmd/spo/propertybag/propertybag-get.md +6 -0
  214. package/docs/docs/cmd/spo/propertybag/propertybag-list.md +13 -0
  215. package/docs/docs/cmd/spo/report/report-activityfilecounts.md +7 -0
  216. package/docs/docs/cmd/spo/report/report-activitypages.md +7 -0
  217. package/docs/docs/cmd/spo/report/report-activityusercounts.md +7 -0
  218. package/docs/docs/cmd/spo/report/report-activityuserdetail.md +7 -0
  219. package/docs/docs/cmd/spo/report/report-siteusagedetail.md +7 -0
  220. package/docs/docs/cmd/spo/report/report-siteusagefilecounts.md +7 -0
  221. package/docs/docs/cmd/spo/report/report-siteusagepages.md +7 -0
  222. package/docs/docs/cmd/spo/report/report-siteusagesitecounts.md +7 -0
  223. package/docs/docs/cmd/spo/report/report-siteusagestorage.md +7 -0
  224. package/docs/docs/cmd/spo/roledefinition/roledefinition-get.md +20 -0
  225. package/docs/docs/cmd/spo/roledefinition/roledefinition-list.md +20 -0
  226. package/docs/docs/cmd/spo/serviceprincipal/serviceprincipal-grant-add.md +20 -0
  227. package/docs/docs/cmd/spo/serviceprincipal/serviceprincipal-grant-list.md +18 -0
  228. package/docs/docs/cmd/spo/serviceprincipal/serviceprincipal-permissionrequest-approve.md +20 -0
  229. package/docs/docs/cmd/spo/serviceprincipal/serviceprincipal-permissionrequest-list.md +17 -0
  230. package/docs/docs/cmd/spo/serviceprincipal/serviceprincipal-set.md +13 -0
  231. package/docs/docs/cmd/spo/site/site-recyclebinitem-move.md +43 -0
  232. package/docs/docs/cmd/spo/site/site-recyclebinitem-remove.md +45 -0
  233. package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-add.md +1 -1
  234. package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-list.md +103 -0
  235. package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-remove.md +49 -0
  236. package/docs/docs/cmd/spo/tenant/tenant-commandset-remove.md +49 -0
  237. package/docs/docs/cmd/spo/tenant/tenant-commandset-set.md +57 -0
  238. package/docs/docs/cmd/spo/tenant/tenant-settings-set.md +57 -54
  239. package/docs/docs/cmd/spo/term/term-add.md +107 -6
  240. package/docs/docs/cmd/spo/term/term-get.md +111 -10
  241. package/docs/docs/cmd/spo/term/term-group-get.md +71 -5
  242. package/docs/docs/cmd/spo/term/term-group-list.md +70 -2
  243. package/docs/docs/cmd/spo/term/term-list.md +80 -8
  244. package/docs/docs/cmd/spo/term/term-set-add.md +95 -11
  245. package/docs/docs/cmd/spo/term/term-set-get.md +92 -8
  246. package/docs/docs/cmd/spo/term/term-set-list.md +85 -5
  247. package/docs/docs/cmd/teams/app/app-list.md +17 -0
  248. package/docs/docs/cmd/teams/app/app-publish.md +18 -1
  249. package/docs/docs/cmd/teams/channel/channel-add.md +20 -0
  250. package/docs/docs/cmd/teams/channel/channel-get.md +21 -0
  251. package/docs/docs/cmd/teams/channel/channel-list.md +21 -0
  252. package/docs/docs/cmd/teams/channel/channel-member-list.md +20 -0
  253. package/docs/docs/cmd/teams/channel/channel-member-set.md +21 -0
  254. package/docs/docs/cmd/teams/chat/chat-get.md +22 -0
  255. package/docs/docs/cmd/teams/chat/chat-list.md +22 -0
  256. package/docs/docs/cmd/teams/chat/chat-member-list.md +20 -0
  257. package/docs/docs/cmd/teams/chat/chat-member-remove.md +52 -0
  258. package/docs/docs/cmd/teams/chat/chat-message-list.md +23 -0
  259. package/docs/docs/cmd/teams/funsettings/funsettings-list.md +15 -0
  260. package/docs/docs/cmd/teams/guestsettings/guestsettings-list.md +13 -0
  261. package/docs/docs/cmd/teams/meeting/meeting-transcript-list.md +96 -0
  262. package/docs/docs/cmd/teams/membersettings/membersettings-list.md +17 -0
  263. package/docs/docs/cmd/teams/tab/tab-remove.md +1 -1
  264. package/docs/docs/cmd/todo/list/list-add.md +18 -0
  265. package/docs/docs/cmd/todo/list/list-get.md +18 -0
  266. package/docs/docs/cmd/todo/list/list-list.md +18 -0
  267. package/docs/docs/cmd/todo/task/task-get.md +21 -0
  268. package/docs/docs/cmd/todo/task/task-list.md +21 -0
  269. package/docs/docs/cmd/util/accesstoken/accesstoken-get.md +6 -0
  270. package/docs/docs/cmd/version.md +1 -1
  271. package/docs/docs/cmd/viva/connections/connections-app-create.md +3 -3
  272. package/docs/docs/cmd/yammer/group/group-list.md +42 -0
  273. package/docs/docs/cmd/yammer/message/message-add.md +32 -0
  274. package/docs/docs/cmd/yammer/message/message-get.md +32 -0
  275. package/docs/docs/cmd/yammer/message/message-list.md +34 -0
  276. package/docs/docs/cmd/yammer/network/network-list.md +70 -0
  277. package/docs/docs/cmd/yammer/report/report-activitycounts.md +7 -0
  278. package/docs/docs/cmd/yammer/report/report-activityusercounts.md +7 -0
  279. package/docs/docs/cmd/yammer/report/report-activityuserdetail.md +7 -0
  280. package/docs/docs/cmd/yammer/report/report-deviceusagedistributionusercounts.md +7 -0
  281. package/docs/docs/cmd/yammer/report/report-deviceusageusercounts.md +7 -0
  282. package/docs/docs/cmd/yammer/report/report-deviceusageuserdetail.md +7 -0
  283. package/docs/docs/cmd/yammer/report/report-groupsactivitycounts.md +7 -0
  284. package/docs/docs/cmd/yammer/report/report-groupsactivitydetail.md +7 -0
  285. package/docs/docs/cmd/yammer/report/report-groupsactivitygroupcounts.md +7 -0
  286. package/docs/docs/cmd/yammer/user/user-get.md +55 -0
  287. package/docs/docs/cmd/yammer/user/user-list.md +55 -0
  288. package/docs/docs/cmd/yammer/yammer-search.md +15 -3
  289. package/npm-shrinkwrap.json +267 -334
  290. package/package.json +15 -13
@@ -15,19 +15,11 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
15
15
  };
16
16
  var _SpfxDoctorCommand_instances, _SpfxDoctorCommand_initTelemetry, _SpfxDoctorCommand_initOptions, _SpfxDoctorCommand_initValidators;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- const chalk = require("chalk");
19
18
  const child_process = require("child_process");
20
19
  const semver_1 = require("semver");
20
+ const formatting_1 = require("../../../utils/formatting");
21
21
  const commands_1 = require("../commands");
22
22
  const base_project_command_1 = require("./project/base-project-command");
23
- /**
24
- * Has the particular check passed or failed
25
- */
26
- var CheckStatus;
27
- (function (CheckStatus) {
28
- CheckStatus[CheckStatus["Success"] = 0] = "Success";
29
- CheckStatus[CheckStatus["Failure"] = 1] = "Failure";
30
- })(CheckStatus || (CheckStatus = {}));
31
23
  /**
32
24
  * Where to search for the particular npm package: only in the current project,
33
25
  * in global packages or both
@@ -497,6 +489,21 @@ class SpfxDoctorCommand extends base_project_command_1.BaseProjectCommand {
497
489
  range: '^4',
498
490
  fix: 'npm i -g yo@4'
499
491
  }
492
+ },
493
+ '1.17.2': {
494
+ gulpCli: {
495
+ range: '^1 || ^2',
496
+ fix: 'npm i -g gulp-cli@2'
497
+ },
498
+ node: {
499
+ range: '>=16.13.0 <17.0.0',
500
+ fix: 'Install Node.js >=16.13.0 <17.0.0'
501
+ },
502
+ sp: SharePointVersion.SPO,
503
+ yo: {
504
+ range: '^4',
505
+ fix: 'npm i -g yo@4'
506
+ }
500
507
  }
501
508
  };
502
509
  __classPrivateFieldGet(this, _SpfxDoctorCommand_instances, "m", _SpfxDoctorCommand_initTelemetry).call(this);
@@ -520,12 +527,12 @@ class SpfxDoctorCommand extends base_project_command_1.BaseProjectCommand {
520
527
  try {
521
528
  spfxVersion = (_a = args.options.spfxVersion) !== null && _a !== void 0 ? _a : yield this.getSharePointFrameworkVersion(logger);
522
529
  if (!spfxVersion) {
523
- logger.log(this.getStatus(CheckStatus.Failure, `SharePoint Framework`));
530
+ logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Failure, `SharePoint Framework`));
524
531
  throw `SharePoint Framework not found`;
525
532
  }
526
533
  prerequisites = this.versions[spfxVersion];
527
534
  if (!prerequisites) {
528
- logger.log(this.getStatus(CheckStatus.Failure, `SharePoint Framework v${spfxVersion}`));
535
+ logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Failure, `SharePoint Framework v${spfxVersion}`));
529
536
  throw `spfx doctor doesn't support SPFx v${spfxVersion} at this moment`;
530
537
  }
531
538
  if (args.options.spfxVersion) {
@@ -533,7 +540,7 @@ class SpfxDoctorCommand extends base_project_command_1.BaseProjectCommand {
533
540
  }
534
541
  else {
535
542
  // spfx was detected and if we are here, it means that we support it
536
- logger.log(this.getStatus(CheckStatus.Success, `SharePoint Framework v${spfxVersion}`));
543
+ logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Success, `SharePoint Framework v${spfxVersion}`));
537
544
  }
538
545
  yield this.checkSharePointCompatibility(spfxVersion, prerequisites, args, fixes, logger);
539
546
  yield this.checkNodeVersion(prerequisites, fixes, logger);
@@ -566,11 +573,11 @@ class SpfxDoctorCommand extends base_project_command_1.BaseProjectCommand {
566
573
  if (args.options.env) {
567
574
  const sp = this.spVersionStringToEnum(args.options.env);
568
575
  if ((prerequisites.sp & sp) === sp) {
569
- logger.log(this.getStatus(CheckStatus.Success, `Supported in ${SharePointVersion[sp]}`));
576
+ logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Success, `Supported in ${SharePointVersion[sp]}`));
570
577
  resolve();
571
578
  }
572
579
  else {
573
- logger.log(this.getStatus(CheckStatus.Failure, `Not supported in ${SharePointVersion[sp]}`));
580
+ logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Failure, `Not supported in ${SharePointVersion[sp]}`));
574
581
  fixes.push(`Use SharePoint Framework v${(sp === SharePointVersion.SP2016 ? '1.1' : '1.4.1')}`);
575
582
  reject(`SharePoint Framework v${spfxVersion} is not supported in ${SharePointVersion[sp]}`);
576
583
  }
@@ -601,7 +608,7 @@ class SpfxDoctorCommand extends base_project_command_1.BaseProjectCommand {
601
608
  this.checkStatus(`SharePoint Framework`, spfxVersionDetected, versionCheck, OptionalOrRequired.Required, fixes, logger);
602
609
  }
603
610
  else {
604
- logger.log(this.getStatus(CheckStatus.Failure, `SharePoint Framework v${spfxVersionRequested} not found`));
611
+ logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Failure, `SharePoint Framework v${spfxVersionRequested} not found`));
605
612
  fixes.push(versionCheck.fix);
606
613
  }
607
614
  });
@@ -614,7 +621,7 @@ class SpfxDoctorCommand extends base_project_command_1.BaseProjectCommand {
614
621
  this.checkStatus('yo', yoVersion, prerequisites.yo, OptionalOrRequired.Required, fixes, logger);
615
622
  }
616
623
  else {
617
- logger.log(this.getStatus(CheckStatus.Failure, `yo not found`));
624
+ logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Failure, `yo not found`));
618
625
  fixes.push(prerequisites.yo.fix);
619
626
  }
620
627
  });
@@ -627,7 +634,7 @@ class SpfxDoctorCommand extends base_project_command_1.BaseProjectCommand {
627
634
  this.checkStatus('gulp-cli', gulpCliVersion, prerequisites.gulpCli, OptionalOrRequired.Required, fixes, logger);
628
635
  }
629
636
  else {
630
- logger.log(this.getStatus(CheckStatus.Failure, `gulp-cli not found`));
637
+ logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Failure, `gulp-cli not found`));
631
638
  fixes.push(prerequisites.gulpCli.fix);
632
639
  }
633
640
  });
@@ -637,7 +644,7 @@ class SpfxDoctorCommand extends base_project_command_1.BaseProjectCommand {
637
644
  .getPackageVersion('gulp', PackageSearchMode.GlobalOnly, HandlePromise.Continue, logger)
638
645
  .then((gulpVersion) => {
639
646
  if (gulpVersion) {
640
- logger.log(this.getStatus(CheckStatus.Failure, `gulp should be removed`));
647
+ logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Failure, `gulp should be removed`));
641
648
  fixes.push('npm un -g gulp');
642
649
  }
643
650
  });
@@ -647,11 +654,11 @@ class SpfxDoctorCommand extends base_project_command_1.BaseProjectCommand {
647
654
  .getPackageVersion('typescript', PackageSearchMode.LocalOnly, HandlePromise.Continue, logger)
648
655
  .then((typeScriptVersion) => {
649
656
  if (typeScriptVersion) {
650
- logger.log(this.getStatus(CheckStatus.Failure, `typescript v${typeScriptVersion} installed in the project`));
657
+ logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Failure, `typescript v${typeScriptVersion} installed in the project`));
651
658
  fixes.push('npm un typescript');
652
659
  }
653
660
  else {
654
- logger.log(this.getStatus(CheckStatus.Success, `bundled typescript used`));
661
+ logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Success, `bundled typescript used`));
655
662
  }
656
663
  });
657
664
  }
@@ -775,22 +782,14 @@ class SpfxDoctorCommand extends base_project_command_1.BaseProjectCommand {
775
782
  checkStatus(what, versionFound, versionCheck, optionalOrRequired, fixes, logger) {
776
783
  if (versionFound) {
777
784
  if ((0, semver_1.satisfies)(versionFound, versionCheck.range)) {
778
- logger.log(this.getStatus(CheckStatus.Success, `${what} v${versionFound}`));
785
+ logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Success, `${what} v${versionFound}`));
779
786
  }
780
787
  else {
781
- logger.log(this.getStatus(CheckStatus.Failure, `${what} v${versionFound} found, v${versionCheck.range} required`));
788
+ logger.log(formatting_1.formatting.getStatus(formatting_1.CheckStatus.Failure, `${what} v${versionFound} found, v${versionCheck.range} required`));
782
789
  fixes.push(versionCheck.fix);
783
790
  }
784
791
  }
785
792
  }
786
- getStatus(result, message) {
787
- const primarySupported = process.platform !== 'win32' ||
788
- process.env.CI === 'true' ||
789
- process.env.TERM === 'xterm-256color';
790
- const success = primarySupported ? '✔' : '√';
791
- const failure = primarySupported ? '✖' : '×';
792
- return `${result === CheckStatus.Success ? chalk.green(success) : chalk.red(failure)} ${message}`;
793
- }
794
793
  }
795
794
  _SpfxDoctorCommand_instances = new WeakSet(), _SpfxDoctorCommand_initTelemetry = function _SpfxDoctorCommand_initTelemetry() {
796
795
  this.telemetry.push((args) => {
@@ -0,0 +1,146 @@
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 _SpoApplicationCustomizerRemoveCommand_instances, _SpoApplicationCustomizerRemoveCommand_initOptions, _SpoApplicationCustomizerRemoveCommand_initTelemetry, _SpoApplicationCustomizerRemoveCommand_initValidators, _SpoApplicationCustomizerRemoveCommand_initOptionSets;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const Cli_1 = require("../../../../cli/Cli");
19
+ const request_1 = require("../../../../request");
20
+ const validation_1 = require("../../../../utils/validation");
21
+ const SpoCommand_1 = require("../../../base/SpoCommand");
22
+ const commands_1 = require("../../commands");
23
+ const spo_1 = require("../../../../utils/spo");
24
+ const formatting_1 = require("../../../../utils/formatting");
25
+ const os = require("os");
26
+ class SpoApplicationCustomizerRemoveCommand extends SpoCommand_1.default {
27
+ get name() {
28
+ return commands_1.default.APPLICATIONCUSTOMIZER_REMOVE;
29
+ }
30
+ get description() {
31
+ return 'Removes an application customizer that is added to a site';
32
+ }
33
+ constructor() {
34
+ super();
35
+ _SpoApplicationCustomizerRemoveCommand_instances.add(this);
36
+ this.allowedScopes = ['Site', 'Web', 'All'];
37
+ __classPrivateFieldGet(this, _SpoApplicationCustomizerRemoveCommand_instances, "m", _SpoApplicationCustomizerRemoveCommand_initTelemetry).call(this);
38
+ __classPrivateFieldGet(this, _SpoApplicationCustomizerRemoveCommand_instances, "m", _SpoApplicationCustomizerRemoveCommand_initOptions).call(this);
39
+ __classPrivateFieldGet(this, _SpoApplicationCustomizerRemoveCommand_instances, "m", _SpoApplicationCustomizerRemoveCommand_initValidators).call(this);
40
+ __classPrivateFieldGet(this, _SpoApplicationCustomizerRemoveCommand_instances, "m", _SpoApplicationCustomizerRemoveCommand_initOptionSets).call(this);
41
+ }
42
+ commandAction(logger, args) {
43
+ return __awaiter(this, void 0, void 0, function* () {
44
+ try {
45
+ if (args.options.confirm) {
46
+ return yield this.removeApplicationCustomizer(logger, args.options);
47
+ }
48
+ const result = yield Cli_1.Cli.prompt({
49
+ type: 'confirm',
50
+ name: 'continue',
51
+ default: false,
52
+ message: `Are you sure you want to remove the application customizer '${args.options.clientSideComponentId || args.options.title || args.options.id}'?`
53
+ });
54
+ if (result.continue) {
55
+ yield this.removeApplicationCustomizer(logger, args.options);
56
+ }
57
+ }
58
+ catch (err) {
59
+ this.handleRejectedODataJsonPromise(err);
60
+ }
61
+ });
62
+ }
63
+ removeApplicationCustomizer(logger, options) {
64
+ return __awaiter(this, void 0, void 0, function* () {
65
+ const applicationCustomizer = yield this.getApplicationCustomizer(options);
66
+ if (this.verbose) {
67
+ logger.logToStderr(`Removing application customizer '${options.clientSideComponentId || options.title || options.id}' from the site '${options.webUrl}'...`);
68
+ }
69
+ const requestOptions = {
70
+ url: `${options.webUrl}/_api/${applicationCustomizer.Scope.toString() === '2' ? 'Site' : 'Web'}/UserCustomActions('${applicationCustomizer.Id}')`,
71
+ headers: {
72
+ accept: 'application/json;odata=nometadata'
73
+ },
74
+ responseType: 'json'
75
+ };
76
+ yield request_1.default.delete(requestOptions);
77
+ });
78
+ }
79
+ getApplicationCustomizer(options) {
80
+ return __awaiter(this, void 0, void 0, function* () {
81
+ const resolvedScope = options.scope || 'All';
82
+ let appCustomizers = [];
83
+ if (options.id) {
84
+ const appCustomizer = yield spo_1.spo.getCustomActionById(options.webUrl, options.id, resolvedScope);
85
+ if (appCustomizer) {
86
+ appCustomizers.push(appCustomizer);
87
+ }
88
+ }
89
+ else if (options.title) {
90
+ appCustomizers = yield spo_1.spo.getCustomActions(options.webUrl, resolvedScope, `(Title eq '${formatting_1.formatting.encodeQueryParameter(options.title)}') and (startswith(Location,'ClientSideExtension.ApplicationCustomizer'))`);
91
+ }
92
+ else {
93
+ appCustomizers = yield spo_1.spo.getCustomActions(options.webUrl, resolvedScope, `(ClientSideComponentId eq guid'${options.clientSideComponentId}') and (startswith(Location,'ClientSideExtension.ApplicationCustomizer'))`);
94
+ }
95
+ if (appCustomizers.length === 0) {
96
+ throw `No application customizer with ${options.title && `title '${options.title}'` || options.clientSideComponentId && `ClientSideComponentId '${options.clientSideComponentId}'` || options.id && `id '${options.id}'`} found`;
97
+ }
98
+ if (appCustomizers.length > 1) {
99
+ throw `Multiple application customizer with ${options.title ? `title '${options.title}'` : `ClientSideComponentId '${options.clientSideComponentId}'`} found. Please disambiguate using IDs: ${os.EOL}${appCustomizers.map(a => `- ${a.Id}`).join(os.EOL)}`;
100
+ }
101
+ return appCustomizers[0];
102
+ });
103
+ }
104
+ }
105
+ _SpoApplicationCustomizerRemoveCommand_instances = new WeakSet(), _SpoApplicationCustomizerRemoveCommand_initOptions = function _SpoApplicationCustomizerRemoveCommand_initOptions() {
106
+ this.options.unshift({
107
+ option: '-u, --webUrl <webUrl>'
108
+ }, {
109
+ option: '-t, --title [title]'
110
+ }, {
111
+ option: '-i, --id [id]'
112
+ }, {
113
+ option: '-c, --clientSideComponentId [clientSideComponentId]'
114
+ }, {
115
+ option: '-s, --scope [scope]', autocomplete: this.allowedScopes
116
+ }, {
117
+ option: '--confirm'
118
+ });
119
+ }, _SpoApplicationCustomizerRemoveCommand_initTelemetry = function _SpoApplicationCustomizerRemoveCommand_initTelemetry() {
120
+ this.telemetry.push((args) => {
121
+ Object.assign(this.telemetryProperties, {
122
+ title: typeof args.options.title !== 'undefined',
123
+ id: typeof args.options.id !== 'undefined',
124
+ clientSideComponentId: typeof args.options.clientSideComponentId !== 'undefined',
125
+ scope: typeof args.options.scope !== 'undefined',
126
+ confirm: !!args.options.confirm
127
+ });
128
+ });
129
+ }, _SpoApplicationCustomizerRemoveCommand_initValidators = function _SpoApplicationCustomizerRemoveCommand_initValidators() {
130
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
131
+ if (args.options.id && !validation_1.validation.isValidGuid(args.options.id)) {
132
+ return `${args.options.id} is not a valid GUID`;
133
+ }
134
+ if (args.options.clientSideComponentId && !validation_1.validation.isValidGuid(args.options.clientSideComponentId)) {
135
+ return `${args.options.clientSideComponentId} is not a valid GUID`;
136
+ }
137
+ if (args.options.scope && this.allowedScopes.indexOf(args.options.scope) === -1) {
138
+ return `'${args.options.scope}' is not a valid application customizer scope. Allowed values are: ${this.allowedScopes.join(',')}`;
139
+ }
140
+ return validation_1.validation.isValidSharePointUrl(args.options.webUrl);
141
+ }));
142
+ }, _SpoApplicationCustomizerRemoveCommand_initOptionSets = function _SpoApplicationCustomizerRemoveCommand_initOptionSets() {
143
+ this.optionSets.push({ options: ['id', 'title', 'clientSideComponentId'] });
144
+ };
145
+ module.exports = new SpoApplicationCustomizerRemoveCommand();
146
+ //# sourceMappingURL=applicationcustomizer-remove.js.map
@@ -17,6 +17,7 @@ var _SpoFileCheckinCommand_instances, _SpoFileCheckinCommand_initTelemetry, _Spo
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  const request_1 = require("../../../../request");
19
19
  const formatting_1 = require("../../../../utils/formatting");
20
+ const urlUtil_1 = require("../../../../utils/urlUtil");
20
21
  const validation_1 = require("../../../../utils/validation");
21
22
  const SpoCommand_1 = require("../../../base/SpoCommand");
22
23
  const commands_1 = require("../../commands");
@@ -41,6 +42,9 @@ class SpoFileCheckinCommand extends SpoCommand_1.default {
41
42
  __classPrivateFieldGet(this, _SpoFileCheckinCommand_instances, "m", _SpoFileCheckinCommand_initValidators).call(this);
42
43
  __classPrivateFieldGet(this, _SpoFileCheckinCommand_instances, "m", _SpoFileCheckinCommand_initOptionSets).call(this);
43
44
  }
45
+ getExcludedOptionsWithUrls() {
46
+ return ['url'];
47
+ }
44
48
  commandAction(logger, args) {
45
49
  return __awaiter(this, void 0, void 0, function* () {
46
50
  let type = CheckinType.Major;
@@ -62,7 +66,8 @@ class SpoFileCheckinCommand extends SpoCommand_1.default {
62
66
  requestUrl = `${args.options.webUrl}/_api/web/GetFileById('${formatting_1.formatting.encodeQueryParameter(args.options.id)}')/checkin(comment='${comment}',checkintype=${type})`;
63
67
  }
64
68
  if (args.options.url) {
65
- requestUrl = `${args.options.webUrl}/_api/web/GetFileByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(args.options.url)}')/checkin(comment='${comment}',checkintype=${type})`;
69
+ const serverRelativePath = urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.url);
70
+ requestUrl = `${args.options.webUrl}/_api/web/GetFileByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(serverRelativePath)}')/checkin(comment='${comment}',checkintype=${type})`;
66
71
  }
67
72
  const requestOptions = {
68
73
  url: requestUrl,
@@ -83,8 +88,8 @@ class SpoFileCheckinCommand extends SpoCommand_1.default {
83
88
  _SpoFileCheckinCommand_instances = new WeakSet(), _SpoFileCheckinCommand_initTelemetry = function _SpoFileCheckinCommand_initTelemetry() {
84
89
  this.telemetry.push((args) => {
85
90
  Object.assign(this.telemetryProperties, {
86
- id: (!(!args.options.id)).toString(),
87
- url: (!(!args.options.url)).toString(),
91
+ id: typeof args.options.id !== 'undefined',
92
+ url: typeof args.options.url !== 'undefined',
88
93
  type: args.options.type || 'Major',
89
94
  comment: typeof args.options.comment !== 'undefined'
90
95
  });
@@ -17,6 +17,7 @@ var _SpoFileCheckoutCommand_instances, _SpoFileCheckoutCommand_initTelemetry, _S
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  const request_1 = require("../../../../request");
19
19
  const formatting_1 = require("../../../../utils/formatting");
20
+ const urlUtil_1 = require("../../../../utils/urlUtil");
20
21
  const validation_1 = require("../../../../utils/validation");
21
22
  const SpoCommand_1 = require("../../../base/SpoCommand");
22
23
  const commands_1 = require("../../commands");
@@ -35,6 +36,9 @@ class SpoFileCheckoutCommand extends SpoCommand_1.default {
35
36
  __classPrivateFieldGet(this, _SpoFileCheckoutCommand_instances, "m", _SpoFileCheckoutCommand_initValidators).call(this);
36
37
  __classPrivateFieldGet(this, _SpoFileCheckoutCommand_instances, "m", _SpoFileCheckoutCommand_initOptionSets).call(this);
37
38
  }
39
+ getExcludedOptionsWithUrls() {
40
+ return ['url'];
41
+ }
38
42
  commandAction(logger, args) {
39
43
  return __awaiter(this, void 0, void 0, function* () {
40
44
  let requestUrl = '';
@@ -42,7 +46,8 @@ class SpoFileCheckoutCommand extends SpoCommand_1.default {
42
46
  requestUrl = `${args.options.webUrl}/_api/web/GetFileById('${formatting_1.formatting.encodeQueryParameter(args.options.id)}')/checkout`;
43
47
  }
44
48
  if (args.options.url) {
45
- requestUrl = `${args.options.webUrl}/_api/web/GetFileByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(args.options.url)}')/checkout`;
49
+ const serverRelativePath = urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.url);
50
+ requestUrl = `${args.options.webUrl}/_api/web/GetFileByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(serverRelativePath)}')/checkout`;
46
51
  }
47
52
  const requestOptions = {
48
53
  url: requestUrl,
@@ -63,8 +68,8 @@ class SpoFileCheckoutCommand extends SpoCommand_1.default {
63
68
  _SpoFileCheckoutCommand_instances = new WeakSet(), _SpoFileCheckoutCommand_initTelemetry = function _SpoFileCheckoutCommand_initTelemetry() {
64
69
  this.telemetry.push((args) => {
65
70
  Object.assign(this.telemetryProperties, {
66
- id: (!(!args.options.id)).toString(),
67
- url: (!(!args.options.url)).toString()
71
+ id: typeof args.options.id !== 'undefined',
72
+ url: typeof args.options.url !== 'undefined'
68
73
  });
69
74
  });
70
75
  }, _SpoFileCheckoutCommand_initOptions = function _SpoFileCheckoutCommand_initOptions() {
@@ -38,10 +38,7 @@ class SpoFileCopyCommand extends SpoCommand_1.default {
38
38
  commandAction(logger, args) {
39
39
  return __awaiter(this, void 0, void 0, function* () {
40
40
  try {
41
- if (this.verbose) {
42
- logger.logToStderr(`Copying file '${args.options.sourceUrl}' to '${args.options.targetUrl}'...`);
43
- }
44
- const sourcePath = this.getAbsoluteUrl(args.options.webUrl, args.options.sourceUrl);
41
+ const sourcePath = this.getAbsoluteUrl(args.options.webUrl, urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.sourceUrl));
45
42
  let destinationPath = this.getAbsoluteUrl(args.options.webUrl, args.options.targetUrl) + '/';
46
43
  if (args.options.newName) {
47
44
  destinationPath += args.options.newName;
@@ -50,6 +47,9 @@ class SpoFileCopyCommand extends SpoCommand_1.default {
50
47
  // Keep the original file name
51
48
  destinationPath += sourcePath.substring(sourcePath.lastIndexOf('/') + 1);
52
49
  }
50
+ if (this.verbose) {
51
+ logger.logToStderr(`Copying file '${sourcePath}' to '${destinationPath}'...`);
52
+ }
53
53
  const requestOptions = {
54
54
  url: `${args.options.webUrl}/_api/SP.MoveCopyUtil.CopyFileByPath`,
55
55
  headers: {
@@ -19,6 +19,7 @@ const fs = require("fs");
19
19
  const path = require("path");
20
20
  const request_1 = require("../../../../request");
21
21
  const formatting_1 = require("../../../../utils/formatting");
22
+ const urlUtil_1 = require("../../../../utils/urlUtil");
22
23
  const validation_1 = require("../../../../utils/validation");
23
24
  const SpoCommand_1 = require("../../../base/SpoCommand");
24
25
  const commands_1 = require("../../commands");
@@ -66,7 +67,8 @@ class SpoFileGetCommand extends SpoCommand_1.default {
66
67
  else {
67
68
  options += '&';
68
69
  }
69
- options += `@f='${formatting_1.formatting.encodeQueryParameter(args.options.url)}'`;
70
+ const serverRelativePath = urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.url);
71
+ options += `@f='${formatting_1.formatting.encodeQueryParameter(serverRelativePath)}'`;
70
72
  }
71
73
  const requestOptions = {
72
74
  url: requestUrl + options,
@@ -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 _SpoFileListCommand_instances, _SpoFileListCommand_initTelemetry, _SpoFileListCommand_initOptions, _SpoFileListCommand_initValidators;
16
+ var _SpoFileListCommand_instances, _SpoFileListCommand_initTelemetry, _SpoFileListCommand_initOptions, _SpoFileListCommand_initValidators, _SpoFileListCommand_initOptionSets;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  const request_1 = require("../../../../request");
19
19
  const formatting_1 = require("../../../../utils/formatting");
@@ -34,6 +34,7 @@ class SpoFileListCommand extends SpoCommand_1.default {
34
34
  __classPrivateFieldGet(this, _SpoFileListCommand_instances, "m", _SpoFileListCommand_initTelemetry).call(this);
35
35
  __classPrivateFieldGet(this, _SpoFileListCommand_instances, "m", _SpoFileListCommand_initOptions).call(this);
36
36
  __classPrivateFieldGet(this, _SpoFileListCommand_instances, "m", _SpoFileListCommand_initValidators).call(this);
37
+ __classPrivateFieldGet(this, _SpoFileListCommand_instances, "m", _SpoFileListCommand_initOptionSets).call(this);
37
38
  }
38
39
  commandAction(logger, args) {
39
40
  return __awaiter(this, void 0, void 0, function* () {
@@ -41,11 +42,15 @@ class SpoFileListCommand extends SpoCommand_1.default {
41
42
  logger.logToStderr(`Retrieving all files in folder '${args.options.folder}' at site '${args.options.webUrl}'${args.options.recursive ? ' (recursive)' : ''}...`);
42
43
  }
43
44
  try {
45
+ if (args.options.folder) {
46
+ args.options.folderUrl = args.options.folder;
47
+ this.warn(logger, `Option 'folder' is deprecated. Please use 'folderUrl' instead`);
48
+ }
44
49
  const fieldProperties = this.formatSelectProperties(args.options.fields, args.options.output);
45
50
  const allFiles = [];
46
51
  const allFolders = args.options.recursive
47
- ? [...yield this.getFolders(args.options.folder, args, logger), args.options.folder]
48
- : [args.options.folder];
52
+ ? [...yield this.getFolders(args.options.folderUrl, args, logger), args.options.folderUrl]
53
+ : [args.options.folderUrl];
49
54
  for (const folder of allFolders) {
50
55
  const files = yield this.getFiles(folder, fieldProperties, args, logger);
51
56
  files.forEach((file) => allFiles.push(file));
@@ -69,8 +74,8 @@ class SpoFileListCommand extends SpoCommand_1.default {
69
74
  logger.logToStderr(`Retrieving files in folder '${folderUrl}'${page > 1 ? ', page ' + page : ''}...`);
70
75
  }
71
76
  const allFiles = [];
72
- const serverRelativeUrl = urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, folderUrl);
73
- const requestUrl = `${args.options.webUrl}/_api/web/GetFolderByServerRelativeUrl(@url)/Files?@url='${formatting_1.formatting.encodeQueryParameter(serverRelativeUrl)}'`;
77
+ const serverRelativePath = urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, folderUrl);
78
+ const requestUrl = `${args.options.webUrl}/_api/web/GetFolderByServerRelativeUrl(@url)/Files?@url='${formatting_1.formatting.encodeQueryParameter(serverRelativePath)}'`;
74
79
  const queryParams = [`$skip=${skip}`, `$top=${SpoFileListCommand.pageSize}`];
75
80
  if (fieldProperties.expandProperties.length > 0) {
76
81
  queryParams.push(`$expand=${fieldProperties.expandProperties.join(',')}`);
@@ -152,6 +157,8 @@ class SpoFileListCommand extends SpoCommand_1.default {
152
157
  _SpoFileListCommand_instances = new WeakSet(), _SpoFileListCommand_initTelemetry = function _SpoFileListCommand_initTelemetry() {
153
158
  this.telemetry.push((args) => {
154
159
  Object.assign(this.telemetryProperties, {
160
+ folder: typeof args.options.folder !== 'undefined',
161
+ folderUrl: typeof args.options.folderUrl !== 'undefined',
155
162
  recursive: args.options.recursive,
156
163
  fields: typeof args.options.fields !== 'undefined',
157
164
  filter: typeof args.options.filter !== 'undefined'
@@ -161,7 +168,9 @@ _SpoFileListCommand_instances = new WeakSet(), _SpoFileListCommand_initTelemetry
161
168
  this.options.unshift({
162
169
  option: '-u, --webUrl <webUrl>'
163
170
  }, {
164
- option: '-f, --folder <folder>'
171
+ option: '-f, --folder [folder]'
172
+ }, {
173
+ option: '-f, --folderUrl [folderUrl]'
165
174
  }, {
166
175
  option: '--fields [fields]'
167
176
  }, {
@@ -171,6 +180,8 @@ _SpoFileListCommand_instances = new WeakSet(), _SpoFileListCommand_initTelemetry
171
180
  });
172
181
  }, _SpoFileListCommand_initValidators = function _SpoFileListCommand_initValidators() {
173
182
  this.validators.push((args) => __awaiter(this, void 0, void 0, function* () { return validation_1.validation.isValidSharePointUrl(args.options.webUrl); }));
183
+ }, _SpoFileListCommand_initOptionSets = function _SpoFileListCommand_initOptionSets() {
184
+ this.optionSets.push({ options: ['folder', 'folderUrl'] });
174
185
  };
175
186
  SpoFileListCommand.pageSize = 5000;
176
187
  module.exports = new SpoFileListCommand();
@@ -40,7 +40,7 @@ class SpoFileMoveCommand extends SpoCommand_1.default {
40
40
  __classPrivateFieldGet(this, _SpoFileMoveCommand_instances, "m", _SpoFileMoveCommand_initValidators).call(this);
41
41
  }
42
42
  getExcludedOptionsWithUrls() {
43
- return ['targetUrl'];
43
+ return ['targetUrl', 'sourceUrl'];
44
44
  }
45
45
  commandAction(logger, args) {
46
46
  return __awaiter(this, void 0, void 0, function* () {
@@ -48,6 +48,7 @@ class SpoFileMoveCommand extends SpoCommand_1.default {
48
48
  const parsedUrl = url.parse(webUrl);
49
49
  const tenantUrl = `${parsedUrl.protocol}//${parsedUrl.hostname}`;
50
50
  try {
51
+ const serverRelativePath = urlUtil_1.urlUtil.getServerRelativePath(webUrl, args.options.sourceUrl);
51
52
  // Check if the source file exists.
52
53
  // Called on purpose, we explicitly check if user specified file
53
54
  // in the sourceUrl option.
@@ -55,14 +56,14 @@ class SpoFileMoveCommand extends SpoCommand_1.default {
55
56
  // A user might enter folder instead of file as source url by mistake
56
57
  // then there are edge cases when deleteIfAlreadyExists flag is set
57
58
  // the user can receive misleading error message.
58
- yield this.fileExists(tenantUrl, webUrl, args.options.sourceUrl);
59
+ yield this.fileExists(webUrl, serverRelativePath);
59
60
  if (args.options.deleteIfAlreadyExists) {
60
61
  // try delete target file, if deleteIfAlreadyExists flag is set
61
62
  const filename = args.options.sourceUrl.replace(/^.*[\\\/]/, '');
62
63
  yield this.recycleFile(tenantUrl, args.options.targetUrl, filename, logger);
63
64
  }
64
65
  // all preconditions met, now create copy job
65
- const sourceAbsoluteUrl = urlUtil_1.urlUtil.urlCombine(webUrl, args.options.sourceUrl);
66
+ const sourceAbsoluteUrl = urlUtil_1.urlUtil.urlCombine(tenantUrl, serverRelativePath);
66
67
  const allowSchemaMismatch = args.options.allowSchemaMismatch || false;
67
68
  const requestUrl = urlUtil_1.urlUtil.urlCombine(webUrl, '/_api/site/CreateCopyJobs');
68
69
  const requestOptions = {
@@ -107,10 +108,8 @@ class SpoFileMoveCommand extends SpoCommand_1.default {
107
108
  /**
108
109
  * Checks if a file exists on the server relative url
109
110
  */
110
- fileExists(tenantUrl, webUrl, sourceUrl) {
111
- const webServerRelativeUrl = webUrl.replace(tenantUrl, '');
112
- const fileServerRelativeUrl = `${webServerRelativeUrl}${sourceUrl}`;
113
- const requestUrl = `${webUrl}/_api/web/GetFileByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(fileServerRelativeUrl)}')/`;
111
+ fileExists(webUrl, sourceUrl) {
112
+ const requestUrl = `${webUrl}/_api/web/GetFileByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(sourceUrl)}')/`;
114
113
  const requestOptions = {
115
114
  url: requestUrl,
116
115
  method: 'GET',
@@ -18,6 +18,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  const Cli_1 = require("../../../../cli/Cli");
19
19
  const request_1 = require("../../../../request");
20
20
  const formatting_1 = require("../../../../utils/formatting");
21
+ const urlUtil_1 = require("../../../../utils/urlUtil");
21
22
  const validation_1 = require("../../../../utils/validation");
22
23
  const SpoCommand_1 = require("../../../base/SpoCommand");
23
24
  const commands_1 = require("../../commands");
@@ -28,6 +29,9 @@ class SpoFileRemoveCommand extends SpoCommand_1.default {
28
29
  get description() {
29
30
  return 'Removes the specified file';
30
31
  }
32
+ alias() {
33
+ return [commands_1.default.PAGE_TEMPLATE_REMOVE];
34
+ }
31
35
  constructor() {
32
36
  super();
33
37
  _SpoFileRemoveCommand_instances.add(this);
@@ -50,18 +54,8 @@ class SpoFileRemoveCommand extends SpoCommand_1.default {
50
54
  requestUrl = `${args.options.webUrl}/_api/web/GetFileById(guid'${formatting_1.formatting.encodeQueryParameter(args.options.id)}')`;
51
55
  }
52
56
  else {
53
- // concatenate trailing '/' if not provided
54
- // so if the provided url is for the root site, the substr bellow will get the right value
55
- let serverRelativeSiteUrl = args.options.webUrl;
56
- if (!serverRelativeSiteUrl.endsWith('/')) {
57
- serverRelativeSiteUrl = `${serverRelativeSiteUrl}/`;
58
- }
59
- serverRelativeSiteUrl = serverRelativeSiteUrl.substr(serverRelativeSiteUrl.indexOf('/', 8));
60
- let fileUrl = args.options.url;
61
- if (!fileUrl.startsWith(serverRelativeSiteUrl)) {
62
- fileUrl = `${serverRelativeSiteUrl}${fileUrl}`;
63
- }
64
- requestUrl = `${args.options.webUrl}/_api/web/GetFileByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(fileUrl)}')`;
57
+ const serverRelativePath = urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.url);
58
+ requestUrl = `${args.options.webUrl}/_api/web/GetFileByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(serverRelativePath)}')`;
65
59
  }
66
60
  if (args.options.recycle) {
67
61
  requestUrl += `/recycle()`;
@@ -40,9 +40,9 @@ class SpoFileRenameCommand extends SpoCommand_1.default {
40
40
  commandAction(logger, args) {
41
41
  return __awaiter(this, void 0, void 0, function* () {
42
42
  const webUrl = args.options.webUrl;
43
- const originalFileServerRelativeUrl = urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.sourceUrl);
43
+ const originalFileServerRelativePath = urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.sourceUrl);
44
44
  try {
45
- yield this.getFile(originalFileServerRelativeUrl, webUrl);
45
+ yield this.getFile(originalFileServerRelativePath, webUrl);
46
46
  if (args.options.force) {
47
47
  yield this.deleteFile(webUrl, args.options.sourceUrl, args.options.targetFileName);
48
48
  }
@@ -53,7 +53,7 @@ class SpoFileRenameCommand extends SpoCommand_1.default {
53
53
  }]
54
54
  };
55
55
  const requestOptions = {
56
- url: `${webUrl}/_api/web/GetFileByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(originalFileServerRelativeUrl)}')/ListItemAllFields/ValidateUpdateListItem()`,
56
+ url: `${webUrl}/_api/web/GetFileByServerRelativeUrl('${formatting_1.formatting.encodeQueryParameter(originalFileServerRelativePath)}')/ListItemAllFields/ValidateUpdateListItem()`,
57
57
  headers: {
58
58
  'accept': 'application/json;odata=nometadata'
59
59
  },
@@ -25,6 +25,7 @@ const validation_1 = require("../../../../utils/validation");
25
25
  const formatting_1 = require("../../../../utils/formatting");
26
26
  const SpoCommand_1 = require("../../../base/SpoCommand");
27
27
  const commands_1 = require("../../commands");
28
+ const urlUtil_1 = require("../../../../utils/urlUtil");
28
29
  class SpoFileRoleAssignmentAddCommand extends SpoCommand_1.default {
29
30
  get name() {
30
31
  return commands_1.default.FILE_ROLEASSIGNMENT_ADD;
@@ -148,7 +149,7 @@ class SpoFileRoleAssignmentAddCommand extends SpoCommand_1.default {
148
149
  getFileURL(args) {
149
150
  return __awaiter(this, void 0, void 0, function* () {
150
151
  if (args.options.fileUrl) {
151
- return args.options.fileUrl;
152
+ return urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.fileUrl);
152
153
  }
153
154
  const options = {
154
155
  webUrl: args.options.webUrl,