@pnp/cli-microsoft365 5.1.0-beta.ffd9bc8 → 5.2.0-beta.119724d

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 (213) hide show
  1. package/.eslintrc.js +2 -0
  2. package/Dockerfile +7 -4
  3. package/dist/Auth.js +10 -0
  4. package/dist/Command.js +3 -0
  5. package/dist/cli/Cli.js +14 -17
  6. package/dist/m365/app/commands/app-get.js +30 -0
  7. package/dist/m365/app/commands.js +1 -0
  8. package/dist/m365/cli/commands/config/config-set.js +3 -2
  9. package/dist/m365/spfx/commands/project/{project-upgrade/rules/JsonRule.js → JsonRule.js} +0 -0
  10. package/dist/m365/spfx/commands/project/{project-upgrade/rules/Rule.js → Rule.js} +0 -0
  11. package/dist/m365/spfx/commands/project/base-project-command.js +3 -3
  12. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.0.0.js +9 -0
  13. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.0.1.js +9 -0
  14. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.0.2.js +9 -0
  15. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.1.0.js +17 -0
  16. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.1.1.js +17 -0
  17. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.1.3.js +17 -0
  18. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.10.0.js +23 -0
  19. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.11.0.js +23 -0
  20. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.12.0.js +23 -0
  21. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.12.1.js +23 -0
  22. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.13.0.js +23 -0
  23. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.13.1.js +23 -0
  24. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.14.0.js +23 -0
  25. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.2.0.js +17 -0
  26. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.3.0.js +17 -0
  27. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.3.1.js +17 -0
  28. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.3.2.js +17 -0
  29. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.3.4.js +19 -0
  30. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.4.0.js +19 -0
  31. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.4.1.js +19 -0
  32. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.5.0.js +19 -0
  33. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.5.1.js +19 -0
  34. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.6.0.js +19 -0
  35. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.7.0.js +19 -0
  36. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.7.1.js +19 -0
  37. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.8.0.js +21 -0
  38. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.8.1.js +21 -0
  39. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.8.2.js +23 -0
  40. package/dist/m365/spfx/commands/project/project-doctor/doctor-1.9.1.js +23 -0
  41. package/dist/m365/spfx/commands/project/project-doctor/generic-rules.js +30 -0
  42. package/dist/m365/spfx/commands/project/project-doctor/rules/DependencyRule.js +76 -0
  43. package/dist/m365/spfx/commands/project/project-doctor/rules/FN001008_DEP_react.js +18 -0
  44. package/dist/m365/spfx/commands/project/project-doctor/rules/FN001009_DEP_react_dom.js +18 -0
  45. package/dist/m365/spfx/commands/project/project-doctor/rules/FN001022_DEP_office_ui_fabric_react.js +18 -0
  46. package/dist/m365/spfx/commands/project/project-doctor/rules/FN002004_DEVDEP_gulp.js +17 -0
  47. package/dist/m365/spfx/commands/project/project-doctor/rules/FN002007_DEVDEP_ajv.js +17 -0
  48. package/dist/m365/spfx/commands/project/project-doctor/rules/FN002013_DEVDEP_types_webpack_env.js +14 -0
  49. package/dist/m365/spfx/commands/project/project-doctor/rules/FN002015_DEVDEP_types_react.js +18 -0
  50. package/dist/m365/spfx/commands/project/project-doctor/rules/FN002016_DEVDEP_types_react_dom.js +18 -0
  51. package/dist/m365/spfx/commands/project/project-doctor/rules/FN002019_DEVDEP_microsoft_rush_stack_compiler.js +68 -0
  52. package/dist/m365/spfx/commands/project/project-doctor/rules/FN021001_PKG_spfx_deps_versions_match_project_version.js +74 -0
  53. package/dist/m365/spfx/commands/project/project-doctor/rules/FN021002_PKG_spfx_deps_use_exact_version.js +71 -0
  54. package/dist/m365/spfx/commands/project/project-doctor/rules/FN021003_PKG_spfx_deps_installed_as_deps.js +46 -0
  55. package/dist/m365/spfx/commands/project/project-doctor/rules/FN021004_PKG_spfx_devdeps_installed_as_devdeps.js +46 -0
  56. package/dist/m365/spfx/commands/project/project-doctor/rules/FN021005_PKG_types_installed_as_devdep.js +45 -0
  57. package/dist/m365/spfx/commands/project/project-doctor/rules/FN021006_PKG_rush_stack_compiler_installed_as_devdep.js +45 -0
  58. package/dist/m365/spfx/commands/project/project-doctor/rules/FN021007_PKG_only_one_rush_stack_compiler_installed.js +69 -0
  59. package/dist/m365/spfx/commands/project/project-doctor/rules/FN021008_PKG_no_duplicate_deps.js +59 -0
  60. package/dist/m365/spfx/commands/project/project-doctor/rules/FN021009_PKG_no_duplicate_oui_deps.js +57 -0
  61. package/dist/m365/spfx/commands/project/project-doctor/rules/FN021010_PKG_gulp_installed_as_devdep.js +45 -0
  62. package/dist/m365/spfx/commands/project/project-doctor/rules/FN021011_PKG_ajv_installed_as_devdep.js +45 -0
  63. package/dist/m365/spfx/commands/project/project-doctor/rules/FN021012_PKG_no_duplicate_pnpjs_deps.js +57 -0
  64. package/dist/m365/spfx/commands/project/project-doctor/spfx-deps.js +29 -0
  65. package/dist/m365/spfx/commands/project/project-doctor.js +341 -0
  66. package/dist/m365/spfx/commands/project/project-externalize/rules/DynamicRule.js +3 -2
  67. package/dist/m365/spfx/commands/project/project-externalize/rules/PnPJsRule.js +2 -1
  68. package/dist/m365/spfx/commands/project/{model → project-model}/ConfigJson.js +0 -0
  69. package/dist/m365/spfx/commands/project/{model → project-model}/CopyAssetsJson.js +0 -0
  70. package/dist/m365/spfx/commands/project/{model → project-model}/DeployAzureStorageJson.js +0 -0
  71. package/dist/m365/spfx/commands/project/{model → project-model}/Gitignore.js +0 -0
  72. package/dist/m365/spfx/commands/project/{model → project-model}/GulpfileJs.js +0 -0
  73. package/dist/m365/spfx/commands/project/{model → project-model}/JsonFile.js +0 -0
  74. package/dist/m365/spfx/commands/project/{model → project-model}/Manifest.js +0 -0
  75. package/dist/m365/spfx/commands/project/{model → project-model}/Npmignore.js +0 -0
  76. package/dist/m365/spfx/commands/project/{model → project-model}/PackageJson.js +0 -0
  77. package/dist/m365/spfx/commands/project/{model → project-model}/PackageSolutionJson.js +0 -0
  78. package/dist/m365/spfx/commands/project/{model → project-model}/Project.js +0 -0
  79. package/dist/m365/spfx/commands/project/{model → project-model}/ScssFile.js +0 -0
  80. package/dist/m365/spfx/commands/project/{model → project-model}/ServeJson.js +0 -0
  81. package/dist/m365/spfx/commands/project/{model → project-model}/TsConfigJson.js +0 -0
  82. package/dist/m365/spfx/commands/project/{model → project-model}/TsFile.js +0 -0
  83. package/dist/m365/spfx/commands/project/{model → project-model}/TsLintJson.js +0 -0
  84. package/dist/m365/spfx/commands/project/{model → project-model}/VsCode.js +0 -0
  85. package/dist/m365/spfx/commands/project/{model → project-model}/VsCodeExtensionsJson.js +0 -0
  86. package/dist/m365/spfx/commands/project/{model → project-model}/VsCodeLaunchJson.js +0 -0
  87. package/dist/m365/spfx/commands/project/{model → project-model}/VsCodeSettingsJson.js +0 -0
  88. package/dist/m365/spfx/commands/project/{model → project-model}/WriteManifestsJson.js +0 -0
  89. package/dist/m365/spfx/commands/project/{model → project-model}/YoRcJson.js +0 -0
  90. package/dist/m365/spfx/commands/project/{model → project-model}/index.js +2 -1
  91. package/dist/m365/spfx/commands/project/project-upgrade/rules/DependencyRule.js +1 -1
  92. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN001021_DEP_microsoft_sp_property_pane.js +1 -0
  93. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN003001_CFG_schema.js +1 -1
  94. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN003002_CFG_version.js +1 -1
  95. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN003003_CFG_bundles.js +1 -1
  96. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN003004_CFG_entries.js +1 -1
  97. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN003005_CFG_localizedResource_pathLib.js +1 -1
  98. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN004001_CFG_CA_schema.js +1 -1
  99. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN004002_CFG_CA_deployCdnPath.js +1 -1
  100. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN005001_CFG_DAS_schema.js +1 -1
  101. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN005002_CFG_DAS_workingDir.js +1 -1
  102. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN006001_CFG_PS_schema.js +1 -1
  103. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN006002_CFG_PS_includeClientSideAssets.js +1 -1
  104. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN006003_CFG_PS_isDomainIsolated.js +1 -1
  105. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN006004_CFG_PS_developer.js +1 -1
  106. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN006005_CFG_PS_metadata.js +1 -1
  107. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN006006_CFG_PS_features.js +1 -1
  108. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN007001_CFG_S_schema.js +1 -1
  109. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN007002_CFG_S_initialPage.js +1 -1
  110. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN007003_CFG_S_api.js +1 -1
  111. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN008001_CFG_TSL_schema.js +1 -1
  112. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN008002_CFG_TSL_removeRule.js +1 -1
  113. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN008003_CFG_TSL_preferConst.js +1 -1
  114. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN009001_CFG_WM_schema.js +1 -1
  115. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010001_YORC_version.js +1 -1
  116. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010002_YORC_isCreatingSolution.js +1 -1
  117. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010003_YORC_packageManager.js +1 -1
  118. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010004_YORC_componentType.js +1 -1
  119. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010005_YORC_environment.js +1 -1
  120. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010006_YORC_framework.js +1 -1
  121. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010007_YORC_isDomainIsolated.js +1 -1
  122. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN012001_TSC_module.js +1 -1
  123. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN012002_TSC_moduleResolution.js +1 -1
  124. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN012003_TSC_skipLibCheck.js +1 -1
  125. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN012004_TSC_typeRoots_types.js +1 -1
  126. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN012005_TSC_typeRoots_microsoft.js +1 -1
  127. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN012006_TSC_types_es6_collections.js +1 -1
  128. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN012007_TSC_lib_es5.js +1 -1
  129. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN012008_TSC_lib_dom.js +1 -1
  130. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN012009_TSC_lib_es2015_collection.js +1 -1
  131. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN012010_TSC_experimentalDecorators.js +1 -1
  132. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN012011_TSC_outDir.js +1 -1
  133. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN012012_TSC_include.js +1 -1
  134. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN012013_TSC_exclude.js +1 -1
  135. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN012014_TSC_inlineSources.js +1 -1
  136. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN012015_TSC_strictNullChecks.js +1 -1
  137. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN012016_TSC_noUnusedLocals.js +1 -1
  138. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN012017_TSC_extends.js +1 -1
  139. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN012018_TSC_lib_es2015_promise.js +1 -1
  140. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN012019_TSC_types_es6_promise.js +1 -1
  141. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN013001_GULP_msGridSassSuppression.js +1 -1
  142. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN013002_GULP_serveTask.js +1 -1
  143. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN014001_CODE_settings_jsonSchemas.js +1 -1
  144. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN014002_CODE_extensions.js +1 -1
  145. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN014003_CODE_launch.js +1 -1
  146. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN014004_CODE_settings_jsonSchemas_configJson_url.js +1 -1
  147. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN014005_CODE_settingsfile.js +1 -1
  148. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN014006_CODE_launch_sourceMapPathOverrides.js +1 -1
  149. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN014007_CODE_launch_localWorkbench.js +1 -1
  150. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN014008_CODE_launch_hostedWorkbench_type.js +1 -1
  151. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN017001_MISC_npm_dedupe.js +1 -1
  152. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN018001_TEAMS_folder.js +1 -1
  153. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN018002_TEAMS_manifest.js +1 -1
  154. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN018003_TEAMS_tab20x20_png.js +1 -1
  155. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN018004_TEAMS_tab96x96_png.js +1 -1
  156. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN018005_TEAMS_deprecated_manifest.js +1 -1
  157. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN019001_TSL_rulesDirectory.js +1 -1
  158. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN019002_TSL_extends.js +1 -1
  159. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN023001_GITIGNORE_release.js +1 -1
  160. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN023002_GITIGNORE_heft.js +1 -1
  161. package/dist/m365/spfx/commands/project/project-upgrade/rules/FN024001_NPMIGNORE_file.js +1 -1
  162. package/dist/m365/spfx/commands/project/project-upgrade/rules/FileAddRemoveRule.js +1 -1
  163. package/dist/m365/spfx/commands/project/project-upgrade/rules/ManifestRule.js +1 -1
  164. package/dist/m365/spfx/commands/project/project-upgrade/rules/PackageRule.js +1 -1
  165. package/dist/m365/spfx/commands/project/project-upgrade/rules/ResolutionRule.js +1 -1
  166. package/dist/m365/spfx/commands/project/project-upgrade/rules/ScssRule.js +1 -1
  167. package/dist/m365/spfx/commands/project/project-upgrade/rules/TsRule.js +1 -1
  168. package/dist/m365/spfx/commands/project/project-upgrade.js +37 -153
  169. package/dist/m365/spfx/commands/project/{project-upgrade → report-model}/Finding.js +0 -0
  170. package/dist/m365/spfx/commands/project/{project-upgrade → report-model}/FindingToReport.js +0 -0
  171. package/dist/m365/spfx/commands/project/{project-upgrade → report-model}/FindingTour.js +0 -0
  172. package/dist/m365/spfx/commands/project/{project-upgrade → report-model}/FindingTourStep.js +0 -0
  173. package/dist/m365/spfx/commands/project/{project-upgrade → report-model}/Occurrence.js +0 -0
  174. package/dist/m365/spfx/commands/project/{ReportData.js → report-model/ReportData.js} +0 -0
  175. package/dist/m365/spfx/commands/project/{project-upgrade → report-model}/index.js +2 -3
  176. package/dist/m365/spfx/commands/spfx-doctor.js +6 -0
  177. package/dist/m365/spfx/commands.js +1 -0
  178. package/dist/m365/spo/commands/app/app-teamspackage-download.js +180 -0
  179. package/dist/m365/spo/commands/tenant/tenant-recyclebinitem-restore.js +10 -44
  180. package/dist/m365/spo/commands.js +1 -0
  181. package/dist/m365/teams/commands/channel/channel-membership-list.js +150 -0
  182. package/dist/m365/teams/commands/chat/chat-get.js +143 -0
  183. package/dist/m365/teams/commands/chat/chat-message-send.js +5 -30
  184. package/dist/m365/teams/commands/chat/chatUtil.js +62 -0
  185. package/dist/m365/teams/commands.js +2 -0
  186. package/dist/m365/tenant/commands.js +1 -6
  187. package/dist/settingsNames.js +1 -0
  188. package/dist/utils/fsUtil.js +70 -0
  189. package/dist/utils/index.js +3 -0
  190. package/dist/utils/md.js +81 -0
  191. package/dist/utils/packageManager.js +66 -0
  192. package/dist/utils/spfx.js +6 -5
  193. package/dist/{m365/spfx/commands/project/project-upgrade/Hash.js → utils/types.js} +1 -1
  194. package/docs/docs/cmd/app/app-get.md +36 -0
  195. package/docs/docs/cmd/spfx/project/project-doctor.md +64 -0
  196. package/docs/docs/cmd/spfx/spfx-doctor.md +4 -1
  197. package/docs/docs/cmd/spo/app/app-teamspackage-download.md +56 -0
  198. package/docs/docs/cmd/teams/channel/channel-membership-list.md +48 -0
  199. package/docs/docs/cmd/teams/chat/chat-get.md +53 -0
  200. package/npm-shrinkwrap.json +292 -740
  201. package/package.json +2 -2
  202. package/dist/m365/spfx/commands/project/project-upgrade/DependencyInformation.js +0 -3
  203. package/dist/m365/spfx/commands/project/project-upgrade/Dictionary.js +0 -3
  204. package/dist/m365/tenant/commands/auditlog/auditlog-report.js +0 -231
  205. package/dist/m365/tenant/commands/service/service-list.js +0 -41
  206. package/dist/m365/tenant/commands/service/service-message-list.js +0 -55
  207. package/dist/m365/tenant/commands/service/service-report-historicalservicestatus.js +0 -54
  208. package/dist/m365/tenant/commands/status/status-list.js +0 -55
  209. package/docs/docs/cmd/tenant/auditlog/auditlog-report.md +0 -61
  210. package/docs/docs/cmd/tenant/service/service-list.md +0 -25
  211. package/docs/docs/cmd/tenant/service/service-message-list.md +0 -34
  212. package/docs/docs/cmd/tenant/service/service-report-historicalservicestatus.md +0 -38
  213. package/docs/docs/cmd/tenant/status/status-list.md +0 -34
@@ -6,6 +6,7 @@ const path = require("path");
6
6
  // uncomment to support upgrading to preview releases
7
7
  const semver_1 = require("semver");
8
8
  const Command_1 = require("../../../../Command");
9
+ const utils_1 = require("../../../../utils");
9
10
  const commands_1 = require("../../commands");
10
11
  const base_project_command_1 = require("./base-project-command");
11
12
  const FN017001_MISC_npm_dedupe_1 = require("./project-upgrade/rules/FN017001_MISC_npm_dedupe");
@@ -97,7 +98,7 @@ class SpfxProjectUpgradeCommand extends base_project_command_1.BaseProjectComman
97
98
  }
98
99
  const pos = this.supportedVersions.indexOf(this.projectVersion);
99
100
  if (pos < 0) {
100
- cb(new Command_1.CommandError(`CLI for Microsoft 365 doesn't support upgrading projects build on SharePoint Framework v${this.projectVersion}`, SpfxProjectUpgradeCommand.ERROR_UNSUPPORTED_FROM_VERSION));
101
+ cb(new Command_1.CommandError(`CLI for Microsoft 365 doesn't support upgrading projects built using SharePoint Framework v${this.projectVersion}`, SpfxProjectUpgradeCommand.ERROR_UNSUPPORTED_FROM_VERSION));
101
102
  return;
102
103
  }
103
104
  const posTo = this.supportedVersions.indexOf(this.toVersion);
@@ -188,33 +189,33 @@ class SpfxProjectUpgradeCommand extends base_project_command_1.BaseProjectComman
188
189
  // matches must be in this particular order to avoid false matches, eg.
189
190
  // uninstallDev contains install
190
191
  if (f.resolution.startsWith('uninstallDev')) {
191
- f.resolution = f.resolution.replace('uninstallDev', this.getPackageManagerCommand('uninstallDev'));
192
+ f.resolution = f.resolution.replace('uninstallDev', utils_1.packageManager.getPackageManagerCommand('uninstallDev', this.packageManager));
192
193
  return;
193
194
  }
194
195
  if (f.resolution.startsWith('installDev')) {
195
- f.resolution = f.resolution.replace('installDev', this.getPackageManagerCommand('installDev'));
196
+ f.resolution = f.resolution.replace('installDev', utils_1.packageManager.getPackageManagerCommand('installDev', this.packageManager));
196
197
  return;
197
198
  }
198
199
  if (f.resolution.startsWith('uninstall')) {
199
- f.resolution = f.resolution.replace('uninstall', this.getPackageManagerCommand('uninstall'));
200
+ f.resolution = f.resolution.replace('uninstall', utils_1.packageManager.getPackageManagerCommand('uninstall', this.packageManager));
200
201
  return;
201
202
  }
202
203
  if (f.resolution.startsWith('install')) {
203
- f.resolution = f.resolution.replace('install', this.getPackageManagerCommand('install'));
204
+ f.resolution = f.resolution.replace('install', utils_1.packageManager.getPackageManagerCommand('install', this.packageManager));
204
205
  return;
205
206
  }
206
207
  // copy support for multiple shells
207
208
  if (f.resolution.startsWith('copy_cmd')) {
208
- f.resolution = f.resolution.replace('copy_cmd', this.getCopyCommand('copyCommand'));
209
- f.resolution = f.resolution.replace('DestinationParam', this.getCopyCommand('copyDestinationParam'));
209
+ f.resolution = f.resolution.replace('copy_cmd', utils_1.fsUtil.getCopyCommand('copyCommand', this.shell));
210
+ f.resolution = f.resolution.replace('DestinationParam', utils_1.fsUtil.getCopyCommand('copyDestinationParam', this.shell));
210
211
  return;
211
212
  }
212
213
  // createdir support for multiple shells
213
214
  if (f.resolution.startsWith('create_dir_cmd')) {
214
- f.resolution = f.resolution.replace('create_dir_cmd', this.getDirectoryCommand('createDirectoryCommand'));
215
- f.resolution = f.resolution.replace('NameParam', this.getDirectoryCommand('createDirectoryNameParam'));
216
- f.resolution = f.resolution.replace('PathParam', this.getDirectoryCommand('createDirectoryPathParam'));
217
- f.resolution = f.resolution.replace('ItemTypeParam', this.getDirectoryCommand('createDirectoryItemTypeParam'));
215
+ f.resolution = f.resolution.replace('create_dir_cmd', utils_1.fsUtil.getDirectoryCommand('createDirectoryCommand', this.shell));
216
+ f.resolution = f.resolution.replace('NameParam', utils_1.fsUtil.getDirectoryCommand('createDirectoryNameParam', this.shell));
217
+ f.resolution = f.resolution.replace('PathParam', utils_1.fsUtil.getDirectoryCommand('createDirectoryPathParam', this.shell));
218
+ f.resolution = f.resolution.replace('ItemTypeParam', utils_1.fsUtil.getDirectoryCommand('createDirectoryItemTypeParam', this.shell));
218
219
  return;
219
220
  }
220
221
  // 'Add' support for multiple shells
@@ -225,7 +226,7 @@ class SpfxProjectUpgradeCommand extends base_project_command_1.BaseProjectComman
225
226
  const contentStart = f.resolution.indexOf('[BEFORECONTENT]') + '[BEFORECONTENT]'.length;
226
227
  const contentEnd = f.resolution.indexOf('[AFTERCONTENT]');
227
228
  const fileContent = f.resolution.substring(contentStart, contentEnd);
228
- f.resolution = this.getAddCommand('addFileCommand');
229
+ f.resolution = utils_1.fsUtil.getAddCommand('addFileCommand', this.shell);
229
230
  f.resolution = f.resolution.replace('[FILECONTENT]', fileContent);
230
231
  f.resolution = f.resolution.replace('[FILEPATH]', filePath);
231
232
  f.resolution = f.resolution.replace('[BEFOREPATH]', ' ');
@@ -236,7 +237,7 @@ class SpfxProjectUpgradeCommand extends base_project_command_1.BaseProjectComman
236
237
  }
237
238
  // 'Remove' support for multiple shells
238
239
  if (f.resolution.startsWith('remove_cmd')) {
239
- f.resolution = f.resolution.replace('remove_cmd', this.getRemoveCommand('removeFileCommand'));
240
+ f.resolution = f.resolution.replace('remove_cmd', utils_1.fsUtil.getRemoveCommand('removeFileCommand', this.shell));
240
241
  return;
241
242
  }
242
243
  });
@@ -270,10 +271,10 @@ class SpfxProjectUpgradeCommand extends base_project_command_1.BaseProjectComman
270
271
  '-----------------------', os.EOL,
271
272
  (reportData.packageManagerCommands
272
273
  .concat(reportData.commandsToExecute
273
- .filter((command) => command.indexOf(this.getPackageManagerCommand('install')) === -1 &&
274
- command.indexOf(this.getPackageManagerCommand('installDev')) === -1 &&
275
- command.indexOf(this.getPackageManagerCommand('uninstall')) === -1 &&
276
- command.indexOf(this.getPackageManagerCommand('uninstallDev')) === -1))).join(os.EOL), os.EOL,
274
+ .filter((command) => command.indexOf(utils_1.packageManager.getPackageManagerCommand('install', this.packageManager)) === -1 &&
275
+ command.indexOf(utils_1.packageManager.getPackageManagerCommand('installDev', this.packageManager)) === -1 &&
276
+ command.indexOf(utils_1.packageManager.getPackageManagerCommand('uninstall', this.packageManager)) === -1 &&
277
+ command.indexOf(utils_1.packageManager.getPackageManagerCommand('uninstallDev', this.packageManager)) === -1))).join(os.EOL), os.EOL,
277
278
  os.EOL,
278
279
  Object.keys(reportData.modificationPerFile).map(file => {
279
280
  return [
@@ -329,10 +330,10 @@ ${f.resolution}
329
330
  '```sh', os.EOL,
330
331
  (reportData.packageManagerCommands
331
332
  .concat(reportData.commandsToExecute
332
- .filter((command) => command.indexOf(this.getPackageManagerCommand('install')) === -1 &&
333
- command.indexOf(this.getPackageManagerCommand('installDev')) === -1 &&
334
- command.indexOf(this.getPackageManagerCommand('uninstall')) === -1 &&
335
- command.indexOf(this.getPackageManagerCommand('uninstallDev')) === -1))).join(os.EOL), os.EOL,
333
+ .filter((command) => command.indexOf(utils_1.packageManager.getPackageManagerCommand('install', this.packageManager)) === -1 &&
334
+ command.indexOf(utils_1.packageManager.getPackageManagerCommand('installDev', this.packageManager)) === -1 &&
335
+ command.indexOf(utils_1.packageManager.getPackageManagerCommand('uninstall', this.packageManager)) === -1 &&
336
+ command.indexOf(utils_1.packageManager.getPackageManagerCommand('uninstallDev', this.packageManager)) === -1))).join(os.EOL), os.EOL,
336
337
  '```', os.EOL,
337
338
  os.EOL,
338
339
  '### Modify files', os.EOL,
@@ -412,7 +413,14 @@ ${f.resolution}
412
413
  if (f.resolutionType === 'cmd') {
413
414
  if (f.resolution.indexOf('npm') > -1 ||
414
415
  f.resolution.indexOf('yarn') > -1) {
415
- this.mapPackageManagerCommand(f.resolution, packagesDevExact, packagesDepExact, packagesDepUn, packagesDevUn);
416
+ utils_1.packageManager.mapPackageManagerCommand({
417
+ command: f.resolution,
418
+ packagesDevExact,
419
+ packagesDepExact,
420
+ packagesDepUn,
421
+ packagesDevUn,
422
+ packageMgr: this.packageManager
423
+ });
416
424
  }
417
425
  else {
418
426
  commandsToExecute.push(f.resolution);
@@ -431,7 +439,13 @@ ${f.resolution}
431
439
  });
432
440
  }
433
441
  });
434
- const packageManagerCommands = this.reducePackageManagerCommand(packagesDepExact, packagesDevExact, packagesDepUn, packagesDevUn);
442
+ const packageManagerCommands = utils_1.packageManager.reducePackageManagerCommand({
443
+ packagesDepExact,
444
+ packagesDevExact,
445
+ packagesDepUn,
446
+ packagesDevUn,
447
+ packageMgr: this.packageManager
448
+ });
435
449
  if (this.packageManager === 'npm') {
436
450
  const dedupeFinding = findings.filter(f => f.id === 'FN017001');
437
451
  if (dedupeFinding.length > 0) {
@@ -445,58 +459,6 @@ ${f.resolution}
445
459
  modificationTypePerFile: modificationTypePerFile
446
460
  };
447
461
  }
448
- mapPackageManagerCommand(command, packagesDevExact, packagesDepExact, packagesDepUn, packagesDevUn) {
449
- // matches must be in this particular order to avoid false matches, eg.
450
- // uninstallDev contains install
451
- if (command.startsWith(`${this.getPackageManagerCommand('uninstallDev')} `)) {
452
- packagesDevUn.push(command.replace(this.getPackageManagerCommand('uninstallDev'), '').trim());
453
- return;
454
- }
455
- if (command.startsWith(`${this.getPackageManagerCommand('installDev')} `)) {
456
- packagesDevExact.push(command.replace(this.getPackageManagerCommand('installDev'), '').trim());
457
- return;
458
- }
459
- if (command.startsWith(`${this.getPackageManagerCommand('uninstall')} `)) {
460
- packagesDepUn.push(command.replace(this.getPackageManagerCommand('uninstall'), '').trim());
461
- return;
462
- }
463
- if (command.startsWith(`${this.getPackageManagerCommand('install')} `)) {
464
- packagesDepExact.push(command.replace(this.getPackageManagerCommand('install'), '').trim());
465
- }
466
- }
467
- reducePackageManagerCommand(packagesDepExact, packagesDevExact, packagesDepUn, packagesDevUn) {
468
- const commandsToExecute = [];
469
- // uninstall commands must come first otherwise there is a chance that
470
- // whatever we recommended to install, will be immediately uninstalled
471
- if (packagesDepUn.length > 0) {
472
- commandsToExecute.push(`${this.getPackageManagerCommand('uninstall')} ${packagesDepUn.join(' ')}`);
473
- }
474
- if (packagesDevUn.length > 0) {
475
- commandsToExecute.push(`${this.getPackageManagerCommand('uninstallDev')} ${packagesDevUn.join(' ')}`);
476
- }
477
- if (packagesDepExact.length > 0) {
478
- commandsToExecute.push(`${this.getPackageManagerCommand('install')} ${packagesDepExact.join(' ')}`);
479
- }
480
- if (packagesDevExact.length > 0) {
481
- commandsToExecute.push(`${this.getPackageManagerCommand('installDev')} ${packagesDevExact.join(' ')}`);
482
- }
483
- return commandsToExecute;
484
- }
485
- getPackageManagerCommand(command) {
486
- return SpfxProjectUpgradeCommand.packageCommands[this.packageManager][command];
487
- }
488
- getCopyCommand(command) {
489
- return SpfxProjectUpgradeCommand.copyCommands[this.shell][command];
490
- }
491
- getDirectoryCommand(command) {
492
- return SpfxProjectUpgradeCommand.createDirectoryCommands[this.shell][command];
493
- }
494
- getAddCommand(command) {
495
- return SpfxProjectUpgradeCommand.addFileCommands[this.shell][command];
496
- }
497
- getRemoveCommand(command) {
498
- return SpfxProjectUpgradeCommand.removeFileCommands[this.shell][command];
499
- }
500
462
  options() {
501
463
  const options = [
502
464
  {
@@ -538,84 +500,6 @@ ${f.resolution}
538
500
  }
539
501
  SpfxProjectUpgradeCommand.packageManagers = ['npm', 'pnpm', 'yarn'];
540
502
  SpfxProjectUpgradeCommand.shells = ['bash', 'powershell', 'cmd'];
541
- SpfxProjectUpgradeCommand.packageCommands = {
542
- npm: {
543
- install: 'npm i -SE',
544
- installDev: 'npm i -DE',
545
- uninstall: 'npm un -S',
546
- uninstallDev: 'npm un -D'
547
- },
548
- pnpm: {
549
- install: 'pnpm i -E',
550
- installDev: 'pnpm i -DE',
551
- uninstall: 'pnpm un',
552
- uninstallDev: 'pnpm un'
553
- },
554
- yarn: {
555
- install: 'yarn add -E',
556
- installDev: 'yarn add -DE',
557
- uninstall: 'yarn remove',
558
- uninstallDev: 'yarn remove'
559
- }
560
- };
561
- SpfxProjectUpgradeCommand.copyCommands = {
562
- bash: {
563
- copyCommand: 'cp',
564
- copyDestinationParam: ' '
565
- },
566
- powershell: {
567
- copyCommand: 'Copy-Item',
568
- copyDestinationParam: ' -Destination '
569
- },
570
- cmd: {
571
- copyCommand: 'copy',
572
- copyDestinationParam: ' '
573
- }
574
- };
575
- SpfxProjectUpgradeCommand.createDirectoryCommands = {
576
- bash: {
577
- createDirectoryCommand: 'mkdir',
578
- createDirectoryPathParam: ' "',
579
- createDirectoryNameParam: '/',
580
- createDirectoryItemTypeParam: '"'
581
- },
582
- powershell: {
583
- createDirectoryCommand: 'New-Item',
584
- createDirectoryPathParam: ' -Path "',
585
- createDirectoryNameParam: '" -Name "',
586
- createDirectoryItemTypeParam: '" -ItemType "directory"'
587
- },
588
- cmd: {
589
- createDirectoryCommand: 'mkdir',
590
- createDirectoryPathParam: ' "',
591
- createDirectoryNameParam: '\\',
592
- createDirectoryItemTypeParam: '"'
593
- }
594
- };
595
- SpfxProjectUpgradeCommand.addFileCommands = {
596
- bash: {
597
- addFileCommand: 'cat > [FILEPATH] << EOF [FILECONTENT]EOF'
598
- },
599
- powershell: {
600
- addFileCommand: `@"[FILECONTENT]"@ | Out-File -FilePath "[FILEPATH]"
601
- `
602
- },
603
- cmd: {
604
- addFileCommand: `echo [FILECONTENT] > "[FILEPATH]"
605
- `
606
- }
607
- };
608
- SpfxProjectUpgradeCommand.removeFileCommands = {
609
- bash: {
610
- removeFileCommand: 'rm'
611
- },
612
- powershell: {
613
- removeFileCommand: 'Remove-Item'
614
- },
615
- cmd: {
616
- removeFileCommand: 'del'
617
- }
618
- };
619
503
  SpfxProjectUpgradeCommand.ERROR_NO_PROJECT_ROOT_FOLDER = 1;
620
504
  SpfxProjectUpgradeCommand.ERROR_UNSUPPORTED_TO_VERSION = 2;
621
505
  SpfxProjectUpgradeCommand.ERROR_NO_VERSION = 3;
@@ -14,10 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./DependencyInformation"), exports);
18
- __exportStar(require("./Dictionary"), exports);
19
17
  __exportStar(require("./Finding"), exports);
20
18
  __exportStar(require("./FindingToReport"), exports);
21
- __exportStar(require("./Hash"), exports);
19
+ __exportStar(require("./FindingTour"), exports);
20
+ __exportStar(require("./FindingTourStep"), exports);
22
21
  __exportStar(require("./Occurrence"), exports);
23
22
  //# sourceMappingURL=index.js.map
@@ -481,6 +481,9 @@ class SpfxDoctorCommand extends AnonymousCommand_1.default {
481
481
  return 'Verifies environment configuration for using the specific version of the SharePoint Framework';
482
482
  }
483
483
  commandAction(logger, args, cb) {
484
+ if (!args.options.output) {
485
+ args.options.output = 'text';
486
+ }
484
487
  logger.log(' ');
485
488
  logger.log('CLI for Microsoft 365 SharePoint Framework doctor');
486
489
  logger.log('Verifying configuration of your system for working with the SharePoint Framework');
@@ -758,6 +761,9 @@ class SpfxDoctorCommand extends AnonymousCommand_1.default {
758
761
  return `${args.options.env} is not a valid SharePoint version. Valid versions are sp2016, sp2019 or spo`;
759
762
  }
760
763
  }
764
+ if (args.options.output && args.options.output !== 'text') {
765
+ return `The output option only accepts the type 'text'`;
766
+ }
761
767
  return true;
762
768
  }
763
769
  }
@@ -4,6 +4,7 @@ const prefix = 'spfx';
4
4
  exports.default = {
5
5
  DOCTOR: `${prefix} doctor`,
6
6
  PACKAGE_GENERATE: `${prefix} package generate`,
7
+ PROJECT_DOCTOR: `${prefix} project doctor`,
7
8
  PROJECT_UPGRADE: `${prefix} project upgrade`,
8
9
  PROJECT_EXTERNALIZE: `${prefix} project externalize`,
9
10
  PROJECT_RENAME: `${prefix} project rename`
@@ -0,0 +1,180 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const fs = require("fs");
4
+ const path = require("path");
5
+ const request_1 = require("../../../../request");
6
+ const urlUtil_1 = require("../../../../utils/urlUtil");
7
+ const spo_1 = require("../../../../utils/spo");
8
+ const validation_1 = require("../../../../utils/validation");
9
+ const commands_1 = require("../../commands");
10
+ const SpoAppBaseCommand_1 = require("./SpoAppBaseCommand");
11
+ class SpoAppTeamsPackageDownloadCommand extends SpoAppBaseCommand_1.SpoAppBaseCommand {
12
+ get name() {
13
+ return commands_1.default.APP_TEAMSPACKAGE_DOWNLOAD;
14
+ }
15
+ get description() {
16
+ return 'Downloads Teams app package for an SPFx solution deployed to tenant app catalog';
17
+ }
18
+ getTelemetryProperties(args) {
19
+ const telemetryProps = super.getTelemetryProperties(args);
20
+ telemetryProps.appCatalogUrl = typeof args.options.appCatalogUrl !== 'undefined';
21
+ telemetryProps.appItemUniqueId = typeof args.options.appItemUniqueId !== 'undefined';
22
+ telemetryProps.appItemId = typeof args.options.appItemId !== 'undefined';
23
+ telemetryProps.appName = typeof args.options.appName !== 'undefined';
24
+ telemetryProps.fileName = typeof args.options.fileName !== 'undefined';
25
+ return telemetryProps;
26
+ }
27
+ commandAction(logger, args, cb) {
28
+ var _a, _b;
29
+ this.appCatalogUrl = args.options.appCatalogUrl;
30
+ const appInfo = {
31
+ id: (_a = args.options.appItemId) !== null && _a !== void 0 ? _a : undefined,
32
+ packageFileName: (_b = args.options.fileName) !== null && _b !== void 0 ? _b : undefined
33
+ };
34
+ if (this.debug) {
35
+ logger.logToStderr(`appInfo: ${JSON.stringify(appInfo)}`);
36
+ }
37
+ this
38
+ .ensureAppInfo(logger, args, appInfo)
39
+ .then(_ => {
40
+ if (this.debug) {
41
+ logger.logToStderr(`ensureAppInfo: ${JSON.stringify(appInfo)}`);
42
+ }
43
+ return this.loadAppCatalogUrl(logger, args);
44
+ })
45
+ .then(_ => {
46
+ const requestOptions = {
47
+ url: `${this.appCatalogUrl}/_api/web/tenantappcatalog/downloadteamssolution(${appInfo.id})/$value`,
48
+ headers: {
49
+ accept: 'application/json;odata=nometadata'
50
+ },
51
+ responseType: 'stream'
52
+ };
53
+ return request_1.default.get(requestOptions);
54
+ })
55
+ .then((file) => {
56
+ return new Promise((resolve, reject) => {
57
+ const writer = fs.createWriteStream(appInfo.packageFileName);
58
+ file.data.pipe(writer);
59
+ writer.on('error', err => {
60
+ reject(err);
61
+ });
62
+ writer.on('close', () => {
63
+ resolve(appInfo.packageFileName);
64
+ });
65
+ });
66
+ })
67
+ .then((file) => {
68
+ if (this.verbose) {
69
+ logger.logToStderr(`Package saved to ${file}`);
70
+ }
71
+ cb();
72
+ }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
73
+ }
74
+ ensureAppInfo(logger, args, appInfo) {
75
+ if (appInfo.id && appInfo.packageFileName) {
76
+ return Promise.resolve();
77
+ }
78
+ if (args.options.appName && !appInfo.packageFileName) {
79
+ appInfo.packageFileName = this.getPackageNameFromFileName(args.options.appName);
80
+ }
81
+ return this
82
+ .loadAppCatalogUrl(logger, args)
83
+ .then(_ => {
84
+ const appCatalogListName = 'AppCatalog';
85
+ const serverRelativeAppCatalogListUrl = `${urlUtil_1.urlUtil.getServerRelativeSiteUrl(this.appCatalogUrl)}/${appCatalogListName}`;
86
+ let url = `${this.appCatalogUrl}/_api/web/`;
87
+ if (args.options.appItemUniqueId) {
88
+ url += `GetList('${serverRelativeAppCatalogListUrl}')/GetItemByUniqueId('${args.options.appItemUniqueId}')?$expand=File&$select=Id,File/Name`;
89
+ }
90
+ else if (args.options.appItemId) {
91
+ url += `GetList('${serverRelativeAppCatalogListUrl}')/GetItemById(${args.options.appItemId})?$expand=File&$select=File/Name`;
92
+ }
93
+ else if (args.options.appName) {
94
+ url += `getfolderbyserverrelativeurl('${appCatalogListName}')/files('${encodeURIComponent(args.options.appName)}')/ListItemAllFields?$select=Id`;
95
+ }
96
+ const requestOptions = {
97
+ url,
98
+ headers: {
99
+ accept: 'application/json;odata=nometadata'
100
+ },
101
+ responseType: 'json'
102
+ };
103
+ return request_1.default.get(requestOptions);
104
+ })
105
+ .then(res => {
106
+ if (args.options.appItemUniqueId) {
107
+ appInfo.id = parseInt(res.Id);
108
+ if (!appInfo.packageFileName) {
109
+ appInfo.packageFileName = this.getPackageNameFromFileName(res.File.Name);
110
+ }
111
+ return Promise.resolve();
112
+ }
113
+ if (args.options.appItemId) {
114
+ if (!appInfo.packageFileName) {
115
+ appInfo.packageFileName = this.getPackageNameFromFileName(res.File.Name);
116
+ }
117
+ return Promise.resolve();
118
+ }
119
+ // if (args.options.appName)
120
+ // skipped 'if' clause to provide a default code branch
121
+ appInfo.id = parseInt(res.Id);
122
+ return Promise.resolve();
123
+ });
124
+ }
125
+ getPackageNameFromFileName(fileName) {
126
+ return `${path.basename(fileName, path.extname(fileName))}.zip`;
127
+ }
128
+ loadAppCatalogUrl(logger, args) {
129
+ if (this.appCatalogUrl) {
130
+ return Promise.resolve();
131
+ }
132
+ return spo_1.spo
133
+ .getSpoUrl(logger, this.debug)
134
+ .then(spoUrl => this.getAppCatalogSiteUrl(logger, spoUrl, args))
135
+ .then(appCatalogUrl => {
136
+ this.appCatalogUrl = appCatalogUrl;
137
+ });
138
+ }
139
+ options() {
140
+ const options = [
141
+ { option: '--appItemId [appItemId]' },
142
+ { option: '--appItemUniqueId [appItemUniqueId]' },
143
+ { option: '--appName [appName]' },
144
+ { option: '--fileName [fileName]' },
145
+ { option: '-u, --appCatalogUrl [appCatalogUrl]' }
146
+ ];
147
+ const parentOptions = super.options();
148
+ return options.concat(parentOptions);
149
+ }
150
+ validate(args) {
151
+ if (!args.options.appItemUniqueId &&
152
+ !args.options.appItemId &&
153
+ !args.options.appName) {
154
+ return `Specify appItemUniqueId, appItemId or appName`;
155
+ }
156
+ if ((args.options.appItemUniqueId && args.options.appItemId) ||
157
+ (args.options.appItemUniqueId && args.options.appName) ||
158
+ (args.options.appItemId && args.options.appName)) {
159
+ return `Specify appItemUniqueId, appItemId or appName but not multiple`;
160
+ }
161
+ if (args.options.appItemUniqueId &&
162
+ !validation_1.validation.isValidGuid(args.options.appItemUniqueId)) {
163
+ return `${args.options.appItemUniqueId} is not a valid GUID`;
164
+ }
165
+ if (args.options.appItemId &&
166
+ isNaN(args.options.appItemId)) {
167
+ return `${args.options.appItemId} is not a number`;
168
+ }
169
+ if (args.options.fileName &&
170
+ fs.existsSync(args.options.fileName)) {
171
+ return `File ${args.options.fileName} already exists`;
172
+ }
173
+ if (args.options.appCatalogUrl) {
174
+ return validation_1.validation.isValidSharePointUrl(args.options.appCatalogUrl);
175
+ }
176
+ return true;
177
+ }
178
+ }
179
+ module.exports = new SpoAppTeamsPackageDownloadCommand();
180
+ //# sourceMappingURL=app-teamspackage-download.js.map
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const config_1 = require("../../../../config");
4
3
  const request_1 = require("../../../../request");
5
4
  const utils_1 = require("../../../../utils");
6
5
  const SpoCommand_1 = require("../../../base/SpoCommand");
@@ -18,58 +17,25 @@ class SpoTenantRecycleBinItemRestoreCommand extends SpoCommand_1.default {
18
17
  return telemetryProps;
19
18
  }
20
19
  commandAction(logger, args, cb) {
21
- this.dots = '';
22
20
  utils_1.spo
23
21
  .getSpoAdminUrl(logger, this.debug)
24
22
  .then((adminUrl) => {
25
- this.spoAdminUrl = adminUrl;
26
- return utils_1.spo.ensureFormDigest(this.spoAdminUrl, logger, this.context, this.debug);
27
- })
28
- .then((res) => {
29
- this.context = res;
30
- if (this.verbose) {
31
- logger.logToStderr(`Restoring deleted site collection ${args.options.url}...`);
32
- }
33
23
  const requestOptions = {
34
- url: `${this.spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
24
+ url: `${adminUrl}/_api/SPOInternalUseOnly.Tenant/RestoreDeletedSite`,
35
25
  headers: {
36
- 'X-RequestDigest': this.context.FormDigestValue
26
+ accept: 'application/json;odata=nometadata',
27
+ 'content-type': 'application/json;charset=utf-8'
37
28
  },
38
- data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config_1.default.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="2" ObjectPathId="1" /><ObjectPath Id="4" ObjectPathId="3" /><Query Id="5" ObjectPathId="3"><Query SelectAllProperties="false"><Properties><Property Name="PollingInterval" ScalarProperty="true" /><Property Name="IsComplete" ScalarProperty="true" /></Properties></Query></Query></Actions><ObjectPaths><Constructor Id="1" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /><Method Id="3" ParentId="1" Name="RestoreDeletedSite"><Parameters><Parameter Type="String">${utils_1.formatting.escapeXml(args.options.url)}</Parameter></Parameters></Method></ObjectPaths></Request>`
29
+ data: {
30
+ siteUrl: args.options.url
31
+ }
39
32
  };
40
33
  return request_1.default.post(requestOptions);
41
34
  })
42
- .then((res) => {
43
- return new Promise((resolve, reject) => {
44
- const json = JSON.parse(res);
45
- const response = json[0];
46
- if (response.ErrorInfo) {
47
- reject(response.ErrorInfo.ErrorMessage);
48
- }
49
- else {
50
- const operation = json[json.length - 1];
51
- const isComplete = operation.IsComplete;
52
- if (!args.options.wait || isComplete) {
53
- resolve();
54
- return;
55
- }
56
- setTimeout(() => {
57
- utils_1.spo.waitUntilFinished({
58
- operationId: JSON.stringify(operation._ObjectIdentity_),
59
- siteUrl: this.spoAdminUrl,
60
- resolve,
61
- reject,
62
- logger,
63
- currentContext: this.context,
64
- dots: this.dots,
65
- debug: this.debug,
66
- verbose: this.verbose
67
- });
68
- }, operation.PollingInterval);
69
- }
70
- });
71
- })
72
- .then(_ => cb(), (err) => this.handleRejectedPromise(err, logger, cb));
35
+ .then(res => {
36
+ logger.log(JSON.parse(res));
37
+ cb();
38
+ }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
73
39
  }
74
40
  options() {
75
41
  const options = [
@@ -10,6 +10,7 @@ exports.default = {
10
10
  APP_LIST: `${prefix} app list`,
11
11
  APP_REMOVE: `${prefix} app remove`,
12
12
  APP_RETRACT: `${prefix} app retract`,
13
+ APP_TEAMSPACKAGE_DOWNLOAD: `${prefix} app teamspackage download`,
13
14
  APP_UNINSTALL: `${prefix} app uninstall`,
14
15
  APP_UPGRADE: `${prefix} app upgrade`,
15
16
  APPPAGE_ADD: `${prefix} apppage add`,