@microsoft/teamsfx-core 1.1.1 → 1.1.2-alpha.6397ec59.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 (578) hide show
  1. package/build/common/armInterface.d.ts +1 -1
  2. package/build/common/armInterface.d.ts.map +1 -1
  3. package/build/common/constants.d.ts +3 -2
  4. package/build/common/constants.d.ts.map +1 -1
  5. package/build/common/constants.js +3 -2
  6. package/build/common/constants.js.map +1 -1
  7. package/build/common/deps-checker/checkerFactory.d.ts +8 -0
  8. package/build/common/deps-checker/checkerFactory.d.ts.map +1 -0
  9. package/build/common/deps-checker/checkerFactory.js +32 -0
  10. package/build/common/deps-checker/checkerFactory.js.map +1 -0
  11. package/build/common/deps-checker/constant/helpLink.d.ts +11 -0
  12. package/build/common/deps-checker/constant/helpLink.d.ts.map +1 -0
  13. package/build/common/deps-checker/constant/helpLink.js +16 -0
  14. package/build/common/deps-checker/constant/helpLink.js.map +1 -0
  15. package/build/common/deps-checker/constant/message.d.ts +29 -0
  16. package/build/common/deps-checker/constant/message.d.ts.map +1 -0
  17. package/build/common/deps-checker/constant/message.js +57 -0
  18. package/build/common/deps-checker/constant/message.js.map +1 -0
  19. package/build/common/deps-checker/constant/telemetry.d.ts +41 -0
  20. package/build/common/deps-checker/constant/telemetry.d.ts.map +1 -0
  21. package/build/common/deps-checker/constant/telemetry.js +49 -0
  22. package/build/common/deps-checker/constant/telemetry.js.map +1 -0
  23. package/build/common/deps-checker/depsChecker.d.ts +24 -0
  24. package/build/common/deps-checker/depsChecker.d.ts.map +1 -0
  25. package/build/common/deps-checker/depsChecker.js +13 -0
  26. package/build/common/deps-checker/depsChecker.js.map +1 -0
  27. package/build/common/deps-checker/depsError.d.ts +17 -0
  28. package/build/common/deps-checker/depsError.d.ts.map +1 -0
  29. package/build/common/deps-checker/depsError.js +42 -0
  30. package/build/common/deps-checker/depsError.js.map +1 -0
  31. package/build/common/deps-checker/depsLogger.d.ts +11 -0
  32. package/build/common/deps-checker/depsLogger.d.ts.map +1 -0
  33. package/build/common/deps-checker/depsLogger.js +5 -0
  34. package/build/common/deps-checker/depsLogger.js.map +1 -0
  35. package/build/common/deps-checker/depsManager.d.ts +35 -0
  36. package/build/common/deps-checker/depsManager.d.ts.map +1 -0
  37. package/build/common/deps-checker/depsManager.js +82 -0
  38. package/build/common/deps-checker/depsManager.js.map +1 -0
  39. package/build/common/deps-checker/depsTelemetry.d.ts +10 -0
  40. package/build/common/deps-checker/depsTelemetry.d.ts.map +1 -0
  41. package/build/common/deps-checker/depsTelemetry.js +5 -0
  42. package/build/common/deps-checker/depsTelemetry.js.map +1 -0
  43. package/build/common/deps-checker/internal/dotnetChecker.d.ts +50 -0
  44. package/build/common/deps-checker/internal/dotnetChecker.d.ts.map +1 -0
  45. package/build/common/deps-checker/internal/dotnetChecker.js +406 -0
  46. package/build/common/deps-checker/internal/dotnetChecker.js.map +1 -0
  47. package/build/common/deps-checker/internal/funcToolChecker.d.ts +40 -0
  48. package/build/common/deps-checker/internal/funcToolChecker.d.ts.map +1 -0
  49. package/build/common/deps-checker/internal/funcToolChecker.js +279 -0
  50. package/build/common/deps-checker/internal/funcToolChecker.js.map +1 -0
  51. package/build/common/deps-checker/internal/ngrokChecker.d.ts +28 -0
  52. package/build/common/deps-checker/internal/ngrokChecker.d.ts.map +1 -0
  53. package/build/common/deps-checker/internal/ngrokChecker.js +183 -0
  54. package/build/common/deps-checker/internal/ngrokChecker.js.map +1 -0
  55. package/build/common/deps-checker/internal/nodeChecker.d.ts +40 -0
  56. package/build/common/deps-checker/internal/nodeChecker.d.ts.map +1 -0
  57. package/build/common/deps-checker/internal/nodeChecker.js +144 -0
  58. package/build/common/deps-checker/internal/nodeChecker.js.map +1 -0
  59. package/build/common/deps-checker/util/cpUtils.d.ts +24 -0
  60. package/build/common/deps-checker/util/cpUtils.d.ts.map +1 -0
  61. package/build/common/deps-checker/util/cpUtils.js +99 -0
  62. package/build/common/deps-checker/util/cpUtils.js.map +1 -0
  63. package/build/common/deps-checker/util/progressIndicator.d.ts +3 -0
  64. package/build/common/deps-checker/util/progressIndicator.d.ts.map +1 -0
  65. package/build/common/deps-checker/util/progressIndicator.js +18 -0
  66. package/build/common/deps-checker/util/progressIndicator.js.map +1 -0
  67. package/build/common/deps-checker/util/system.d.ts +5 -0
  68. package/build/common/deps-checker/util/system.d.ts.map +1 -0
  69. package/build/common/deps-checker/util/system.js +24 -0
  70. package/build/common/deps-checker/util/system.js.map +1 -0
  71. package/build/common/index.d.ts +1 -0
  72. package/build/common/index.d.ts.map +1 -1
  73. package/build/common/index.js +1 -0
  74. package/build/common/index.js.map +1 -1
  75. package/build/common/local/constants.d.ts +108 -0
  76. package/build/common/local/constants.d.ts.map +1 -0
  77. package/build/common/local/constants.js +114 -0
  78. package/build/common/local/constants.js.map +1 -0
  79. package/build/common/local/localEnvManager.d.ts +19 -0
  80. package/build/common/local/localEnvManager.d.ts.map +1 -0
  81. package/build/common/local/localEnvManager.js +82 -0
  82. package/build/common/local/localEnvManager.js.map +1 -0
  83. package/build/{plugins/resource/localdebug/localEnvMulti.d.ts → common/local/localEnvProvider.d.ts} +2 -2
  84. package/build/common/local/localEnvProvider.d.ts.map +1 -0
  85. package/build/{plugins/resource/localdebug/localEnvMulti.js → common/local/localEnvProvider.js} +12 -12
  86. package/build/common/local/localEnvProvider.js.map +1 -0
  87. package/build/common/local/localSettingsHelper.d.ts +3 -0
  88. package/build/common/local/localSettingsHelper.d.ts.map +1 -0
  89. package/build/common/local/localSettingsHelper.js +125 -0
  90. package/build/common/local/localSettingsHelper.js.map +1 -0
  91. package/build/common/local/npmLogHelper.d.ts +11 -0
  92. package/build/common/local/npmLogHelper.d.ts.map +1 -0
  93. package/build/common/local/npmLogHelper.js +82 -0
  94. package/build/common/local/npmLogHelper.js.map +1 -0
  95. package/build/common/local/projectSettingsHelper.d.ts +10 -0
  96. package/build/common/local/projectSettingsHelper.d.ts.map +1 -0
  97. package/build/common/local/projectSettingsHelper.js +34 -0
  98. package/build/common/local/projectSettingsHelper.js.map +1 -0
  99. package/build/common/localSettingsProvider.d.ts +3 -3
  100. package/build/common/localSettingsProvider.d.ts.map +1 -1
  101. package/build/common/localSettingsProvider.js +12 -10
  102. package/build/common/localSettingsProvider.js.map +1 -1
  103. package/build/common/samples-config.json +14 -0
  104. package/build/common/templatesActions.d.ts +2 -0
  105. package/build/common/templatesActions.d.ts.map +1 -1
  106. package/build/common/templatesActions.js +33 -1
  107. package/build/common/templatesActions.js.map +1 -1
  108. package/build/common/tools.d.ts +11 -1
  109. package/build/common/tools.d.ts.map +1 -1
  110. package/build/common/tools.js +30 -27
  111. package/build/common/tools.js.map +1 -1
  112. package/build/core/SolutionPluginContainer.d.ts +2 -1
  113. package/build/core/SolutionPluginContainer.d.ts.map +1 -1
  114. package/build/core/SolutionPluginContainer.js +9 -1
  115. package/build/core/SolutionPluginContainer.js.map +1 -1
  116. package/build/core/dependencyChecker.d.ts +1 -0
  117. package/build/core/dependencyChecker.d.ts.map +1 -0
  118. package/build/core/dependencyChecker.js +2 -0
  119. package/build/core/dependencyChecker.js.map +1 -0
  120. package/build/core/environment.d.ts +5 -5
  121. package/build/core/environment.d.ts.map +1 -1
  122. package/build/core/environment.js +40 -25
  123. package/build/core/environment.js.map +1 -1
  124. package/build/core/error.d.ts +2 -1
  125. package/build/core/error.d.ts.map +1 -1
  126. package/build/core/error.js +7 -3
  127. package/build/core/error.js.map +1 -1
  128. package/build/core/index.d.ts +53 -15
  129. package/build/core/index.d.ts.map +1 -1
  130. package/build/core/index.js +704 -518
  131. package/build/core/index.js.map +1 -1
  132. package/build/core/middleware/concurrentLocker.d.ts.map +1 -1
  133. package/build/core/middleware/concurrentLocker.js +23 -12
  134. package/build/core/middleware/concurrentLocker.js.map +1 -1
  135. package/build/core/middleware/envInfoLoader.d.ts +5 -1
  136. package/build/core/middleware/envInfoLoader.d.ts.map +1 -1
  137. package/build/core/middleware/envInfoLoader.js +52 -46
  138. package/build/core/middleware/envInfoLoader.js.map +1 -1
  139. package/build/core/middleware/envInfoLoaderV3.d.ts +3 -0
  140. package/build/core/middleware/envInfoLoaderV3.d.ts.map +1 -0
  141. package/build/core/middleware/envInfoLoaderV3.js +64 -0
  142. package/build/core/middleware/envInfoLoaderV3.js.map +1 -0
  143. package/build/core/middleware/envInfoWriter.js +14 -31
  144. package/build/core/middleware/envInfoWriter.js.map +1 -1
  145. package/build/core/middleware/envInfoWriterV3.d.ts +6 -0
  146. package/build/core/middleware/envInfoWriterV3.d.ts.map +1 -0
  147. package/build/core/middleware/envInfoWriterV3.js +63 -0
  148. package/build/core/middleware/envInfoWriterV3.js.map +1 -0
  149. package/build/core/middleware/errorHandler.d.ts.map +1 -1
  150. package/build/core/middleware/errorHandler.js +3 -5
  151. package/build/core/middleware/errorHandler.js.map +1 -1
  152. package/build/core/middleware/localSettingsLoader.d.ts.map +1 -1
  153. package/build/core/middleware/localSettingsLoader.js +1 -2
  154. package/build/core/middleware/localSettingsLoader.js.map +1 -1
  155. package/build/core/middleware/localSettingsWriter.d.ts.map +1 -1
  156. package/build/core/middleware/localSettingsWriter.js +7 -18
  157. package/build/core/middleware/localSettingsWriter.js.map +1 -1
  158. package/build/core/middleware/projectMigrator.d.ts.map +1 -1
  159. package/build/core/middleware/projectMigrator.js +25 -57
  160. package/build/core/middleware/projectMigrator.js.map +1 -1
  161. package/build/core/middleware/projectSettingsLoader.d.ts.map +1 -1
  162. package/build/core/middleware/projectSettingsLoader.js +3 -6
  163. package/build/core/middleware/projectSettingsLoader.js.map +1 -1
  164. package/build/core/middleware/projectSettingsLoaderV3.d.ts +4 -0
  165. package/build/core/middleware/projectSettingsLoaderV3.d.ts.map +1 -0
  166. package/build/core/middleware/projectSettingsLoaderV3.js +49 -0
  167. package/build/core/middleware/projectSettingsLoaderV3.js.map +1 -0
  168. package/build/core/middleware/projectSettingsWriter.d.ts.map +1 -1
  169. package/build/core/middleware/projectSettingsWriter.js +5 -12
  170. package/build/core/middleware/projectSettingsWriter.js.map +1 -1
  171. package/build/core/middleware/projectUpgrader.d.ts.map +1 -1
  172. package/build/core/middleware/projectUpgrader.js +7 -15
  173. package/build/core/middleware/projectUpgrader.js.map +1 -1
  174. package/build/core/middleware/questionModel.d.ts +14 -1
  175. package/build/core/middleware/questionModel.d.ts.map +1 -1
  176. package/build/core/middleware/questionModel.js +319 -23
  177. package/build/core/middleware/questionModel.js.map +1 -1
  178. package/build/core/middleware/solutionLoader.d.ts +3 -2
  179. package/build/core/middleware/solutionLoader.d.ts.map +1 -1
  180. package/build/core/middleware/solutionLoader.js +21 -23
  181. package/build/core/middleware/solutionLoader.js.map +1 -1
  182. package/build/core/middleware/solutionLoaderV3.d.ts +4 -0
  183. package/build/core/middleware/solutionLoaderV3.d.ts.map +1 -0
  184. package/build/core/middleware/solutionLoaderV3.js +19 -0
  185. package/build/core/middleware/solutionLoaderV3.js.map +1 -0
  186. package/build/core/question.d.ts +9 -1
  187. package/build/core/question.d.ts.map +1 -1
  188. package/build/core/question.js +113 -3
  189. package/build/core/question.js.map +1 -1
  190. package/build/core/tools.d.ts +2 -1
  191. package/build/core/tools.d.ts.map +1 -1
  192. package/build/core/tools.js +19 -10
  193. package/build/core/tools.js.map +1 -1
  194. package/build/plugins/resource/aad/plugin.d.ts.map +1 -1
  195. package/build/plugins/resource/aad/plugin.js +1 -10
  196. package/build/plugins/resource/aad/plugin.js.map +1 -1
  197. package/build/plugins/resource/apim/managers/apimManager.d.ts.map +1 -1
  198. package/build/plugins/resource/apim/managers/apimManager.js +5 -7
  199. package/build/plugins/resource/apim/managers/apimManager.js.map +1 -1
  200. package/build/plugins/resource/appstudio/appStudio.d.ts +1 -1
  201. package/build/plugins/resource/appstudio/appStudio.d.ts.map +1 -1
  202. package/build/plugins/resource/appstudio/appStudio.js +106 -85
  203. package/build/plugins/resource/appstudio/appStudio.js.map +1 -1
  204. package/build/plugins/resource/appstudio/constants.d.ts +6 -1
  205. package/build/plugins/resource/appstudio/constants.d.ts.map +1 -1
  206. package/build/plugins/resource/appstudio/constants.js +6 -1
  207. package/build/plugins/resource/appstudio/constants.js.map +1 -1
  208. package/build/plugins/resource/appstudio/errors.d.ts +1 -1
  209. package/build/plugins/resource/appstudio/errors.d.ts.map +1 -1
  210. package/build/plugins/resource/appstudio/errors.js +2 -1
  211. package/build/plugins/resource/appstudio/errors.js.map +1 -1
  212. package/build/plugins/resource/appstudio/index.d.ts.map +1 -1
  213. package/build/plugins/resource/appstudio/index.js +15 -12
  214. package/build/plugins/resource/appstudio/index.js.map +1 -1
  215. package/build/plugins/resource/appstudio/plugin.d.ts +2 -3
  216. package/build/plugins/resource/appstudio/plugin.d.ts.map +1 -1
  217. package/build/plugins/resource/appstudio/plugin.js +233 -443
  218. package/build/plugins/resource/appstudio/plugin.js.map +1 -1
  219. package/build/plugins/resource/appstudio/utils/telemetry.d.ts.map +1 -1
  220. package/build/plugins/resource/appstudio/utils/telemetry.js +12 -16
  221. package/build/plugins/resource/appstudio/utils/telemetry.js.map +1 -1
  222. package/build/plugins/resource/appstudio/v3/index.d.ts +19 -0
  223. package/build/plugins/resource/appstudio/v3/index.d.ts.map +1 -0
  224. package/build/plugins/resource/appstudio/v3/index.js +35 -0
  225. package/build/plugins/resource/appstudio/v3/index.js.map +1 -0
  226. package/build/plugins/resource/bot/index.d.ts.map +1 -1
  227. package/build/plugins/resource/bot/index.js +5 -1
  228. package/build/plugins/resource/bot/index.js.map +1 -1
  229. package/build/plugins/resource/bot/plugin.d.ts.map +1 -1
  230. package/build/plugins/resource/bot/plugin.js +9 -11
  231. package/build/plugins/resource/bot/plugin.js.map +1 -1
  232. package/build/plugins/resource/frontend/constants.d.ts +1 -7
  233. package/build/plugins/resource/frontend/constants.d.ts.map +1 -1
  234. package/build/plugins/resource/frontend/constants.js +2 -9
  235. package/build/plugins/resource/frontend/constants.js.map +1 -1
  236. package/build/plugins/resource/frontend/env.d.ts +21 -0
  237. package/build/plugins/resource/frontend/env.d.ts.map +1 -0
  238. package/build/plugins/resource/frontend/env.js +82 -0
  239. package/build/plugins/resource/frontend/env.js.map +1 -0
  240. package/build/plugins/resource/frontend/ops/deploy.d.ts +2 -1
  241. package/build/plugins/resource/frontend/ops/deploy.d.ts.map +1 -1
  242. package/build/plugins/resource/frontend/ops/deploy.js +2 -2
  243. package/build/plugins/resource/frontend/ops/deploy.js.map +1 -1
  244. package/build/plugins/resource/frontend/plugin.d.ts +2 -0
  245. package/build/plugins/resource/frontend/plugin.d.ts.map +1 -1
  246. package/build/plugins/resource/frontend/plugin.js +28 -16
  247. package/build/plugins/resource/frontend/plugin.js.map +1 -1
  248. package/build/plugins/resource/frontend/utils/environment-utils.d.ts.map +1 -1
  249. package/build/plugins/resource/frontend/utils/environment-utils.js +4 -2
  250. package/build/plugins/resource/frontend/utils/environment-utils.js.map +1 -1
  251. package/build/plugins/resource/frontend/utils.d.ts +6 -1
  252. package/build/plugins/resource/frontend/utils.d.ts.map +1 -1
  253. package/build/plugins/resource/frontend/utils.js +17 -6
  254. package/build/plugins/resource/frontend/utils.js.map +1 -1
  255. package/build/plugins/resource/function/plugin.d.ts.map +1 -1
  256. package/build/plugins/resource/function/plugin.js +7 -9
  257. package/build/plugins/resource/function/plugin.js.map +1 -1
  258. package/build/plugins/resource/function/utils/depsChecker/checker.d.ts +0 -1
  259. package/build/plugins/resource/function/utils/depsChecker/checker.d.ts.map +1 -1
  260. package/build/plugins/resource/function/utils/depsChecker/checker.js +2 -2
  261. package/build/plugins/resource/function/utils/depsChecker/checker.js.map +1 -1
  262. package/build/plugins/resource/function/utils/depsChecker/common.d.ts +2 -2
  263. package/build/plugins/resource/function/utils/depsChecker/common.d.ts.map +1 -1
  264. package/build/plugins/resource/function/utils/depsChecker/common.js +6 -6
  265. package/build/plugins/resource/function/utils/depsChecker/common.js.map +1 -1
  266. package/build/plugins/resource/function/utils/depsChecker/dotnetChecker.d.ts +3 -2
  267. package/build/plugins/resource/function/utils/depsChecker/dotnetChecker.d.ts.map +1 -1
  268. package/build/plugins/resource/function/utils/depsChecker/dotnetChecker.js +3 -2
  269. package/build/plugins/resource/function/utils/depsChecker/dotnetChecker.js.map +1 -1
  270. package/build/plugins/resource/function/utils/depsChecker/funcPluginAdapter.d.ts +0 -1
  271. package/build/plugins/resource/function/utils/depsChecker/funcPluginAdapter.d.ts.map +1 -1
  272. package/build/plugins/resource/function/utils/depsChecker/funcPluginAdapter.js +1 -23
  273. package/build/plugins/resource/function/utils/depsChecker/funcPluginAdapter.js.map +1 -1
  274. package/build/plugins/resource/identity/index.d.ts.map +1 -1
  275. package/build/plugins/resource/identity/index.js +11 -13
  276. package/build/plugins/resource/identity/index.js.map +1 -1
  277. package/build/plugins/resource/keyvault/plugin.d.ts.map +1 -1
  278. package/build/plugins/resource/keyvault/plugin.js +7 -9
  279. package/build/plugins/resource/keyvault/plugin.js.map +1 -1
  280. package/build/plugins/resource/localdebug/index.d.ts +0 -7
  281. package/build/plugins/resource/localdebug/index.d.ts.map +1 -1
  282. package/build/plugins/resource/localdebug/index.js +4 -499
  283. package/build/plugins/resource/localdebug/index.js.map +1 -1
  284. package/build/plugins/resource/localdebug/util/error.d.ts.map +1 -1
  285. package/build/plugins/resource/localdebug/util/error.js +1 -1
  286. package/build/plugins/resource/localdebug/util/error.js.map +1 -1
  287. package/build/plugins/resource/localdebug/util/localService.d.ts +0 -1
  288. package/build/plugins/resource/localdebug/util/localService.d.ts.map +1 -1
  289. package/build/plugins/resource/localdebug/util/localService.js +1 -40
  290. package/build/plugins/resource/localdebug/util/localService.js.map +1 -1
  291. package/build/plugins/resource/localdebug/v2/index.d.ts.map +1 -1
  292. package/build/plugins/resource/localdebug/v2/index.js +39 -1
  293. package/build/plugins/resource/localdebug/v2/index.js.map +1 -1
  294. package/build/plugins/resource/simpleauth/plugin.d.ts.map +1 -1
  295. package/build/plugins/resource/simpleauth/plugin.js +7 -9
  296. package/build/plugins/resource/simpleauth/plugin.js.map +1 -1
  297. package/build/plugins/resource/simpleauth/utils/common.d.ts.map +1 -1
  298. package/build/plugins/resource/simpleauth/utils/common.js +3 -1
  299. package/build/plugins/resource/simpleauth/utils/common.js.map +1 -1
  300. package/build/plugins/resource/sql/config.d.ts +0 -1
  301. package/build/plugins/resource/sql/config.d.ts.map +1 -1
  302. package/build/plugins/resource/sql/config.js +0 -1
  303. package/build/plugins/resource/sql/config.js.map +1 -1
  304. package/build/plugins/resource/sql/constants.d.ts +1 -0
  305. package/build/plugins/resource/sql/constants.d.ts.map +1 -1
  306. package/build/plugins/resource/sql/constants.js +1 -0
  307. package/build/plugins/resource/sql/constants.js.map +1 -1
  308. package/build/plugins/resource/sql/errors.d.ts +1 -0
  309. package/build/plugins/resource/sql/errors.d.ts.map +1 -1
  310. package/build/plugins/resource/sql/errors.js +1 -0
  311. package/build/plugins/resource/sql/errors.js.map +1 -1
  312. package/build/plugins/resource/sql/managementClient.d.ts +3 -1
  313. package/build/plugins/resource/sql/managementClient.d.ts.map +1 -1
  314. package/build/plugins/resource/sql/managementClient.js +11 -2
  315. package/build/plugins/resource/sql/managementClient.js.map +1 -1
  316. package/build/plugins/resource/sql/plugin.d.ts +3 -0
  317. package/build/plugins/resource/sql/plugin.d.ts.map +1 -1
  318. package/build/plugins/resource/sql/plugin.js +37 -27
  319. package/build/plugins/resource/sql/plugin.js.map +1 -1
  320. package/build/plugins/resource/sql/sqlClient.d.ts +1 -1
  321. package/build/plugins/resource/sql/sqlClient.d.ts.map +1 -1
  322. package/build/plugins/resource/sql/sqlClient.js +15 -24
  323. package/build/plugins/resource/sql/sqlClient.js.map +1 -1
  324. package/build/plugins/resource/sql/utils/checkInput.js +2 -2
  325. package/build/plugins/resource/sql/utils/checkInput.js.map +1 -1
  326. package/build/plugins/resource/sql/utils/message.d.ts +0 -1
  327. package/build/plugins/resource/sql/utils/message.d.ts.map +1 -1
  328. package/build/plugins/resource/sql/utils/message.js +0 -1
  329. package/build/plugins/resource/sql/utils/message.js.map +1 -1
  330. package/build/plugins/resource/utils4v2.d.ts.map +1 -1
  331. package/build/plugins/resource/utils4v2.js +0 -4
  332. package/build/plugins/resource/utils4v2.js.map +1 -1
  333. package/build/plugins/solution/fx-solution/arm.d.ts +18 -11
  334. package/build/plugins/solution/fx-solution/arm.d.ts.map +1 -1
  335. package/build/plugins/solution/fx-solution/arm.js +390 -131
  336. package/build/plugins/solution/fx-solution/arm.js.map +1 -1
  337. package/build/plugins/solution/fx-solution/commonQuestions.d.ts +13 -2
  338. package/build/plugins/solution/fx-solution/commonQuestions.d.ts.map +1 -1
  339. package/build/plugins/solution/fx-solution/commonQuestions.js +24 -26
  340. package/build/plugins/solution/fx-solution/commonQuestions.js.map +1 -1
  341. package/build/plugins/solution/fx-solution/debug/constants.d.ts +14 -0
  342. package/build/plugins/solution/fx-solution/debug/constants.d.ts.map +1 -0
  343. package/build/plugins/solution/fx-solution/debug/constants.js +22 -0
  344. package/build/plugins/solution/fx-solution/debug/constants.js.map +1 -0
  345. package/build/plugins/solution/fx-solution/debug/error.d.ts +8 -0
  346. package/build/plugins/solution/fx-solution/debug/error.d.ts.map +1 -0
  347. package/build/plugins/solution/fx-solution/debug/error.js +32 -0
  348. package/build/plugins/solution/fx-solution/debug/error.js.map +1 -0
  349. package/build/plugins/solution/fx-solution/debug/provisionLocal.d.ts +4 -0
  350. package/build/plugins/solution/fx-solution/debug/provisionLocal.d.ts.map +1 -0
  351. package/build/plugins/solution/fx-solution/debug/provisionLocal.js +227 -0
  352. package/build/plugins/solution/fx-solution/debug/provisionLocal.js.map +1 -0
  353. package/build/plugins/solution/fx-solution/debug/scaffolding.d.ts +3 -0
  354. package/build/plugins/solution/fx-solution/debug/scaffolding.d.ts.map +1 -0
  355. package/build/plugins/solution/fx-solution/debug/scaffolding.js +153 -0
  356. package/build/plugins/solution/fx-solution/debug/scaffolding.js.map +1 -0
  357. package/build/plugins/{resource/localdebug → solution/fx-solution/debug/util}/certificate.d.ts +2 -2
  358. package/build/plugins/solution/fx-solution/debug/util/certificate.d.ts.map +1 -0
  359. package/build/plugins/{resource/localdebug → solution/fx-solution/debug/util}/certificate.js +8 -9
  360. package/build/plugins/solution/fx-solution/debug/util/certificate.js.map +1 -0
  361. package/build/plugins/{resource/localdebug → solution/fx-solution/debug}/util/codespace.d.ts +0 -0
  362. package/build/plugins/solution/fx-solution/debug/util/codespace.d.ts.map +1 -0
  363. package/build/plugins/{resource/localdebug → solution/fx-solution/debug}/util/codespace.js +0 -0
  364. package/build/plugins/solution/fx-solution/debug/util/codespace.js.map +1 -0
  365. package/build/plugins/{resource/localdebug → solution/fx-solution/debug/util}/launch.d.ts +0 -0
  366. package/build/plugins/solution/fx-solution/debug/util/launch.d.ts.map +1 -0
  367. package/build/plugins/{resource/localdebug → solution/fx-solution/debug/util}/launch.js +1 -1
  368. package/build/plugins/solution/fx-solution/debug/util/launch.js.map +1 -0
  369. package/build/plugins/solution/fx-solution/debug/util/localService.d.ts +3 -0
  370. package/build/plugins/solution/fx-solution/debug/util/localService.d.ts.map +1 -0
  371. package/build/plugins/solution/fx-solution/debug/util/localService.js +52 -0
  372. package/build/plugins/solution/fx-solution/debug/util/localService.js.map +1 -0
  373. package/build/plugins/{resource/localdebug → solution/fx-solution/debug}/util/ngrok.d.ts +0 -0
  374. package/build/plugins/solution/fx-solution/debug/util/ngrok.d.ts.map +1 -0
  375. package/build/plugins/{resource/localdebug → solution/fx-solution/debug}/util/ngrok.js +2 -2
  376. package/build/plugins/solution/fx-solution/debug/util/ngrok.js.map +1 -0
  377. package/build/plugins/{resource/localdebug → solution/fx-solution/debug}/util/process.d.ts +0 -0
  378. package/build/plugins/solution/fx-solution/debug/util/process.d.ts.map +1 -0
  379. package/build/plugins/{resource/localdebug → solution/fx-solution/debug}/util/process.js +0 -0
  380. package/build/plugins/solution/fx-solution/debug/util/process.js.map +1 -0
  381. package/build/plugins/solution/fx-solution/debug/util/settings.d.ts +2 -0
  382. package/build/plugins/solution/fx-solution/debug/util/settings.d.ts.map +1 -0
  383. package/build/plugins/solution/fx-solution/debug/util/settings.js +22 -0
  384. package/build/plugins/solution/fx-solution/debug/util/settings.js.map +1 -0
  385. package/build/plugins/{resource/localdebug → solution/fx-solution/debug/util}/tasks.d.ts +0 -0
  386. package/build/plugins/solution/fx-solution/debug/util/tasks.d.ts.map +1 -0
  387. package/build/plugins/{resource/localdebug → solution/fx-solution/debug/util}/tasks.js +11 -11
  388. package/build/plugins/solution/fx-solution/debug/util/tasks.js.map +1 -0
  389. package/build/plugins/{resource/localdebug → solution/fx-solution/debug}/util/telemetry.d.ts +6 -6
  390. package/build/plugins/solution/fx-solution/debug/util/telemetry.d.ts.map +1 -0
  391. package/build/plugins/{resource/localdebug → solution/fx-solution/debug}/util/telemetry.js +12 -12
  392. package/build/plugins/solution/fx-solution/debug/util/telemetry.js.map +1 -0
  393. package/build/plugins/solution/fx-solution/index.d.ts +1 -0
  394. package/build/plugins/solution/fx-solution/index.d.ts.map +1 -1
  395. package/build/plugins/solution/fx-solution/index.js +1 -0
  396. package/build/plugins/solution/fx-solution/index.js.map +1 -1
  397. package/build/plugins/solution/fx-solution/question.d.ts +2 -2
  398. package/build/plugins/solution/fx-solution/question.d.ts.map +1 -1
  399. package/build/plugins/solution/fx-solution/question.js +2 -32
  400. package/build/plugins/solution/fx-solution/question.js.map +1 -1
  401. package/build/plugins/solution/fx-solution/solution.d.ts.map +1 -1
  402. package/build/plugins/solution/fx-solution/solution.js +9 -5
  403. package/build/plugins/solution/fx-solution/solution.js.map +1 -1
  404. package/build/plugins/solution/fx-solution/utils/depsChecker/bicepChecker.d.ts +2 -2
  405. package/build/plugins/solution/fx-solution/utils/depsChecker/bicepChecker.d.ts.map +1 -1
  406. package/build/plugins/solution/fx-solution/utils/depsChecker/bicepChecker.js +13 -14
  407. package/build/plugins/solution/fx-solution/utils/depsChecker/bicepChecker.js.map +1 -1
  408. package/build/plugins/solution/fx-solution/utils/progressHelper.d.ts +2 -2
  409. package/build/plugins/solution/fx-solution/utils/progressHelper.d.ts.map +1 -1
  410. package/build/plugins/solution/fx-solution/utils/progressHelper.js +4 -4
  411. package/build/plugins/solution/fx-solution/utils/progressHelper.js.map +1 -1
  412. package/build/plugins/solution/fx-solution/v2/constants.d.ts +2 -0
  413. package/build/plugins/solution/fx-solution/v2/constants.d.ts.map +1 -0
  414. package/build/plugins/solution/fx-solution/v2/constants.js +7 -0
  415. package/build/plugins/solution/fx-solution/v2/constants.js.map +1 -0
  416. package/build/plugins/solution/fx-solution/v2/createEnv.d.ts.map +1 -1
  417. package/build/plugins/solution/fx-solution/v2/createEnv.js +1 -1
  418. package/build/plugins/solution/fx-solution/v2/createEnv.js.map +1 -1
  419. package/build/plugins/solution/fx-solution/v2/executeUserTask.d.ts.map +1 -1
  420. package/build/plugins/solution/fx-solution/v2/executeUserTask.js +7 -4
  421. package/build/plugins/solution/fx-solution/v2/executeUserTask.js.map +1 -1
  422. package/build/plugins/solution/fx-solution/v2/getQuestions.d.ts.map +1 -1
  423. package/build/plugins/solution/fx-solution/v2/getQuestions.js +67 -25
  424. package/build/plugins/solution/fx-solution/v2/getQuestions.js.map +1 -1
  425. package/build/plugins/solution/fx-solution/v2/listAllCollaborators.js.map +1 -1
  426. package/build/plugins/solution/fx-solution/v2/provision.d.ts.map +1 -1
  427. package/build/plugins/solution/fx-solution/v2/provision.js +9 -1
  428. package/build/plugins/solution/fx-solution/v2/provision.js.map +1 -1
  429. package/build/plugins/solution/fx-solution/v2/provisionLocal.d.ts.map +1 -1
  430. package/build/plugins/solution/fx-solution/v2/provisionLocal.js +9 -0
  431. package/build/plugins/solution/fx-solution/v2/provisionLocal.js.map +1 -1
  432. package/build/plugins/solution/fx-solution/v2/scaffolding.d.ts.map +1 -1
  433. package/build/plugins/solution/fx-solution/v2/scaffolding.js +5 -0
  434. package/build/plugins/solution/fx-solution/v2/scaffolding.js.map +1 -1
  435. package/build/plugins/solution/fx-solution/v2/solution.d.ts.map +1 -1
  436. package/build/plugins/solution/fx-solution/v2/solution.js +2 -1
  437. package/build/plugins/solution/fx-solution/v2/solution.js.map +1 -1
  438. package/build/plugins/solution/fx-solution/v3/addModule.d.ts +6 -0
  439. package/build/plugins/solution/fx-solution/v3/addModule.d.ts.map +1 -0
  440. package/build/plugins/solution/fx-solution/v3/addModule.js +35 -0
  441. package/build/plugins/solution/fx-solution/v3/addModule.js.map +1 -0
  442. package/build/plugins/solution/fx-solution/v3/addResource.d.ts +37 -0
  443. package/build/plugins/solution/fx-solution/v3/addResource.d.ts.map +1 -0
  444. package/build/plugins/solution/fx-solution/v3/addResource.js +260 -0
  445. package/build/plugins/solution/fx-solution/v3/addResource.js.map +1 -0
  446. package/build/plugins/solution/fx-solution/v3/constants.d.ts +20 -0
  447. package/build/plugins/solution/fx-solution/v3/constants.d.ts.map +1 -0
  448. package/build/plugins/solution/fx-solution/v3/constants.js +25 -0
  449. package/build/plugins/solution/fx-solution/v3/constants.js.map +1 -0
  450. package/build/plugins/solution/fx-solution/v3/deploy.d.ts +6 -0
  451. package/build/plugins/solution/fx-solution/v3/deploy.d.ts.map +1 -0
  452. package/build/plugins/solution/fx-solution/v3/deploy.js +78 -0
  453. package/build/plugins/solution/fx-solution/v3/deploy.js.map +1 -0
  454. package/build/plugins/solution/fx-solution/v3/error.d.ts +11 -0
  455. package/build/plugins/solution/fx-solution/v3/error.d.ts.map +1 -0
  456. package/build/plugins/solution/fx-solution/v3/error.js +23 -0
  457. package/build/plugins/solution/fx-solution/v3/error.js.map +1 -0
  458. package/build/plugins/solution/fx-solution/v3/init.d.ts +4 -0
  459. package/build/plugins/solution/fx-solution/v3/init.d.ts.map +1 -0
  460. package/build/plugins/solution/fx-solution/v3/init.js +35 -0
  461. package/build/plugins/solution/fx-solution/v3/init.js.map +1 -0
  462. package/build/plugins/solution/fx-solution/v3/provision.d.ts +4 -0
  463. package/build/plugins/solution/fx-solution/v3/provision.d.ts.map +1 -0
  464. package/build/plugins/solution/fx-solution/v3/provision.js +124 -0
  465. package/build/plugins/solution/fx-solution/v3/provision.js.map +1 -0
  466. package/build/plugins/solution/fx-solution/v3/provisionLocal.d.ts +4 -0
  467. package/build/plugins/solution/fx-solution/v3/provisionLocal.d.ts.map +1 -0
  468. package/build/plugins/solution/fx-solution/v3/provisionLocal.js +13 -0
  469. package/build/plugins/solution/fx-solution/v3/provisionLocal.js.map +1 -0
  470. package/build/plugins/solution/fx-solution/v3/publish.d.ts +4 -0
  471. package/build/plugins/solution/fx-solution/v3/publish.d.ts.map +1 -0
  472. package/build/plugins/solution/fx-solution/v3/publish.js +15 -0
  473. package/build/plugins/solution/fx-solution/v3/publish.js.map +1 -0
  474. package/build/plugins/solution/fx-solution/v3/questions.d.ts +16 -0
  475. package/build/plugins/solution/fx-solution/v3/questions.d.ts.map +1 -0
  476. package/build/plugins/solution/fx-solution/v3/questions.js +86 -0
  477. package/build/plugins/solution/fx-solution/v3/questions.js.map +1 -0
  478. package/build/plugins/solution/fx-solution/v3/scaffold.d.ts +27 -0
  479. package/build/plugins/solution/fx-solution/v3/scaffold.d.ts.map +1 -0
  480. package/build/plugins/solution/fx-solution/v3/scaffold.js +241 -0
  481. package/build/plugins/solution/fx-solution/v3/scaffold.js.map +1 -0
  482. package/build/plugins/solution/fx-solution/v3/solution.d.ts +32 -0
  483. package/build/plugins/solution/fx-solution/v3/solution.d.ts.map +1 -0
  484. package/build/plugins/solution/fx-solution/v3/solution.js +45 -0
  485. package/build/plugins/solution/fx-solution/v3/solution.js.map +1 -0
  486. package/build/plugins/solution/fx-solution/v3/userTask.d.ts +4 -0
  487. package/build/plugins/solution/fx-solution/v3/userTask.d.ts.map +1 -0
  488. package/build/plugins/solution/fx-solution/v3/userTask.js +15 -0
  489. package/build/plugins/solution/fx-solution/v3/userTask.js.map +1 -0
  490. package/build/plugins/solution/fx-solution/v3/utils.d.ts +3 -0
  491. package/build/plugins/solution/fx-solution/v3/utils.d.ts.map +1 -0
  492. package/build/plugins/solution/fx-solution/v3/utils.js +16 -0
  493. package/build/plugins/solution/fx-solution/v3/utils.js.map +1 -0
  494. package/build/plugins/solution/index.d.ts +1 -0
  495. package/build/plugins/solution/index.d.ts.map +1 -1
  496. package/build/plugins/solution/index.js +1 -0
  497. package/build/plugins/solution/index.js.map +1 -1
  498. package/build/plugins/solution/spfx-solution/constants.d.ts +2 -0
  499. package/build/plugins/solution/spfx-solution/constants.d.ts.map +1 -0
  500. package/build/plugins/solution/spfx-solution/constants.js +7 -0
  501. package/build/plugins/solution/spfx-solution/constants.js.map +1 -0
  502. package/build/plugins/solution/spfx-solution/index.d.ts +2 -0
  503. package/build/plugins/solution/spfx-solution/index.d.ts.map +1 -0
  504. package/build/plugins/solution/spfx-solution/index.js +5 -0
  505. package/build/plugins/solution/spfx-solution/index.js.map +1 -0
  506. package/build/plugins/solution/spfx-solution/init.d.ts +3 -0
  507. package/build/plugins/solution/spfx-solution/init.d.ts.map +1 -0
  508. package/build/plugins/solution/spfx-solution/init.js +20 -0
  509. package/build/plugins/solution/spfx-solution/init.js.map +1 -0
  510. package/build/plugins/solution/spfx-solution/questions.d.ts +6 -0
  511. package/build/plugins/solution/spfx-solution/questions.d.ts.map +1 -0
  512. package/build/plugins/solution/spfx-solution/questions.js +36 -0
  513. package/build/plugins/solution/spfx-solution/questions.js.map +1 -0
  514. package/build/plugins/solution/spfx-solution/scaffolding.d.ts +17 -0
  515. package/build/plugins/solution/spfx-solution/scaffolding.d.ts.map +1 -0
  516. package/build/plugins/solution/spfx-solution/scaffolding.js +29 -0
  517. package/build/plugins/solution/spfx-solution/scaffolding.js.map +1 -0
  518. package/build/plugins/solution/spfx-solution/solution.d.ts +23 -0
  519. package/build/plugins/solution/spfx-solution/solution.d.ts.map +1 -0
  520. package/build/plugins/solution/spfx-solution/solution.js +29 -0
  521. package/build/plugins/solution/spfx-solution/solution.js.map +1 -0
  522. package/package.json +14 -4
  523. package/resource/deps-checker/dotnet-install.ps1 +1095 -0
  524. package/resource/deps-checker/dotnet-install.sh +1222 -0
  525. package/resource/strings.json +0 -1
  526. package/templates/plugins/resource/apim/bicep/apimConfiguration.bicep +16 -16
  527. package/templates/plugins/resource/apim/bicep/config.template.bicep +1 -1
  528. package/templates/plugins/resource/apim/bicep/provision.template.bicep +1 -1
  529. package/templates/plugins/resource/bot/bicep/botConfiguration.template.bicep +28 -29
  530. package/templates/plugins/resource/bot/bicep/config.template.bicep +1 -1
  531. package/templates/plugins/resource/bot/bicep/provision.template.bicep +2 -2
  532. package/templates/plugins/resource/frontend/bicep/provision.template.bicep +1 -1
  533. package/templates/plugins/resource/function/bicep/config.template.bicep +1 -1
  534. package/templates/plugins/resource/function/bicep/functionConfiguration.template.bicep +33 -31
  535. package/templates/plugins/resource/function/bicep/provision.template.bicep +2 -2
  536. package/templates/plugins/resource/identity/bicep/provision.template.bicep +1 -1
  537. package/templates/plugins/resource/keyvault/bicep/provision.template.bicep +3 -2
  538. package/templates/plugins/resource/simpleauth/bicep/config.template.bicep +1 -1
  539. package/templates/plugins/resource/simpleauth/bicep/provision.template.bicep +2 -2
  540. package/templates/plugins/resource/simpleauth/bicep/simpleAuthConfiguration.template.bicep +20 -24
  541. package/templates/plugins/resource/simpleauth/version.txt +2 -1
  542. package/templates/plugins/resource/sql/bicep/provision.template.bicep +1 -1
  543. package/build/plugins/resource/localdebug/certificate.d.ts.map +0 -1
  544. package/build/plugins/resource/localdebug/certificate.js.map +0 -1
  545. package/build/plugins/resource/localdebug/launch.d.ts.map +0 -1
  546. package/build/plugins/resource/localdebug/launch.js.map +0 -1
  547. package/build/plugins/resource/localdebug/legacyPlugin.d.ts +0 -6
  548. package/build/plugins/resource/localdebug/legacyPlugin.d.ts.map +0 -1
  549. package/build/plugins/resource/localdebug/legacyPlugin.js +0 -208
  550. package/build/plugins/resource/localdebug/legacyPlugin.js.map +0 -1
  551. package/build/plugins/resource/localdebug/localEnvMulti.d.ts.map +0 -1
  552. package/build/plugins/resource/localdebug/localEnvMulti.js.map +0 -1
  553. package/build/plugins/resource/localdebug/settings.d.ts +0 -2
  554. package/build/plugins/resource/localdebug/settings.d.ts.map +0 -1
  555. package/build/plugins/resource/localdebug/settings.js +0 -18
  556. package/build/plugins/resource/localdebug/settings.js.map +0 -1
  557. package/build/plugins/resource/localdebug/tasks.d.ts.map +0 -1
  558. package/build/plugins/resource/localdebug/tasks.js.map +0 -1
  559. package/build/plugins/resource/localdebug/util/codespace.d.ts.map +0 -1
  560. package/build/plugins/resource/localdebug/util/codespace.js.map +0 -1
  561. package/build/plugins/resource/localdebug/util/ngrok.d.ts.map +0 -1
  562. package/build/plugins/resource/localdebug/util/ngrok.js.map +0 -1
  563. package/build/plugins/resource/localdebug/util/process.d.ts.map +0 -1
  564. package/build/plugins/resource/localdebug/util/process.js.map +0 -1
  565. package/build/plugins/resource/localdebug/util/telemetry.d.ts.map +0 -1
  566. package/build/plugins/resource/localdebug/util/telemetry.js.map +0 -1
  567. package/templates/azure/config.bicep +0 -25
  568. package/templates/azure/main.bicep +0 -20
  569. package/templates/azure/provision/azureSql.bicep +0 -39
  570. package/templates/azure/provision/frontendHosting.bicep +0 -23
  571. package/templates/azure/provision/function.bicep +0 -79
  572. package/templates/azure/provision/simpleAuth.bicep +0 -44
  573. package/templates/azure/provision.bicep +0 -58
  574. package/templates/azure/teamsFx/bot.bicep +0 -34
  575. package/templates/azure/teamsFx/function.bicep +0 -71
  576. package/templates/azure/teamsFx/simpleAuth.bicep +0 -40
  577. package/templates/plugins/resource/aad/bicep/param.template.bicep +0 -6
  578. package/templates/plugins/resource/aad/bicep/variables.template.bicep +0 -13
@@ -2,14 +2,16 @@
2
2
  // Copyright (c) Microsoft Corporation.
3
3
  // Licensed under the MIT license.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.getProjectSettingsVersion = exports.undefinedName = exports.createV2Context = exports.newProjectSettings = exports.downloadSample = exports.createBasicFolderStructure = exports.FxCore = exports.TOOLS = exports.currentStage = exports.telemetryReporter = exports.Logger = exports.isVsCallingCli = exports.isV2 = void 0;
5
+ exports.getProjectSettingsVersion = exports.undefinedName = exports.createV2Context = exports.newProjectSettings = exports.downloadSample = exports.createBasicFolderStructure = exports.FxCore = exports.setTools = exports.TOOLS = exports.currentStage = exports.telemetryReporter = exports.Logger = exports.isVsCallingCli = exports.isV3 = void 0;
6
6
  const tslib_1 = require("tslib");
7
7
  const hooks_1 = require("@feathersjs/hooks");
8
8
  const teamsfx_api_1 = require("@microsoft/teamsfx-api");
9
9
  const adm_zip_1 = tslib_1.__importDefault(require("adm-zip"));
10
10
  const fs = tslib_1.__importStar(require("fs-extra"));
11
11
  const jsonschema = tslib_1.__importStar(require("jsonschema"));
12
+ const lodash_1 = require("lodash");
12
13
  const path = tslib_1.__importStar(require("path"));
14
+ const typedi_1 = require("typedi");
13
15
  const uuid = tslib_1.__importStar(require("uuid"));
14
16
  const __1 = require("..");
15
17
  const constants_1 = require("../common/constants");
@@ -17,14 +19,16 @@ const globalState_1 = require("../common/globalState");
17
19
  const localSettingsProvider_1 = require("../common/localSettingsProvider");
18
20
  const telemetry_1 = require("../common/telemetry");
19
21
  const tools_1 = require("../common/tools");
20
- const plugins_1 = require("../plugins");
21
- const ResourcePluginContainer_1 = require("../plugins/solution/fx-solution/ResourcePluginContainer");
22
+ const question_1 = require("../plugins/solution/fx-solution/question");
23
+ const constants_2 = require("../plugins/solution/fx-solution/v3/constants");
22
24
  const callback_1 = require("./callback");
25
+ const crypto_1 = require("./crypto");
23
26
  const error_1 = require("./error");
24
27
  const concurrentLocker_1 = require("./middleware/concurrentLocker");
25
28
  const contextInjector_1 = require("./middleware/contextInjector");
26
29
  const envInfoLoader_1 = require("./middleware/envInfoLoader");
27
30
  const envInfoWriter_1 = require("./middleware/envInfoWriter");
31
+ const envInfoWriterV3_1 = require("./middleware/envInfoWriterV3");
28
32
  const errorHandler_1 = require("./middleware/errorHandler");
29
33
  const localSettingsLoader_1 = require("./middleware/localSettingsLoader");
30
34
  const localSettingsWriter_1 = require("./middleware/localSettingsWriter");
@@ -35,12 +39,13 @@ const projectSettingsWriter_1 = require("./middleware/projectSettingsWriter");
35
39
  const projectUpgrader_1 = require("./middleware/projectUpgrader");
36
40
  const questionModel_1 = require("./middleware/questionModel");
37
41
  const solutionLoader_1 = require("./middleware/solutionLoader");
38
- const question_1 = require("./question");
42
+ const question_2 = require("./question");
39
43
  const SolutionPluginContainer_1 = require("./SolutionPluginContainer");
40
44
  const tools_2 = require("./tools");
41
- const crypto_1 = require("./crypto");
42
45
  const supportV1ConditionHandler_1 = require("./middleware/supportV1ConditionHandler");
43
- const lodash_1 = require("lodash");
46
+ const projectSettingsLoaderV3_1 = require("./middleware/projectSettingsLoaderV3");
47
+ const solutionLoaderV3_1 = require("./middleware/solutionLoaderV3");
48
+ const envInfoLoaderV3_1 = require("./middleware/envInfoLoaderV3");
44
49
  // TODO: For package.json,
45
50
  // use require instead of import because of core building/packaging method.
46
51
  // Using import will cause the build folder structure to change.
@@ -54,18 +59,36 @@ function featureFlagEnabled(flagName) {
54
59
  return false;
55
60
  }
56
61
  }
57
- // API V2 feature flag
58
- function isV2() {
59
- return tools_1.isMultiEnvEnabled();
62
+ function isV3() {
63
+ return featureFlagEnabled(constants_1.FeatureFlagName.APIV3);
60
64
  }
61
- exports.isV2 = isV2;
65
+ exports.isV3 = isV3;
62
66
  // On VS calling CLI, interactive questions need to be skipped.
63
67
  function isVsCallingCli() {
64
68
  return featureFlagEnabled(constants_1.FeatureFlagName.VSCallingCLI);
65
69
  }
66
70
  exports.isVsCallingCli = isVsCallingCli;
71
+ function setTools(tools) {
72
+ exports.TOOLS = tools;
73
+ }
74
+ exports.setTools = setTools;
67
75
  class FxCore {
68
76
  constructor(tools) {
77
+ //V1,V2 questions
78
+ this._getQuestionsForCreateProjectV2 = questionModel_1.getQuestionsForCreateProjectV2;
79
+ this._getQuestionsForCreateProjectV3 = questionModel_1.getQuestionsForCreateProjectV3;
80
+ this._getQuestionsForUserTask = questionModel_1.getQuestionsForUserTaskV2;
81
+ this._getQuestions = questionModel_1.getQuestionsV2;
82
+ this._getQuestionsForMigrateV1Project = questionModel_1.getQuestionsForMigrateV1Project;
83
+ //v3 questions
84
+ this._getQuestionsForScaffold = questionModel_1.getQuestionsForScaffold;
85
+ this._getQuestionsForAddModule = questionModel_1.getQuestionsForAddModule;
86
+ this._getQuestionsForAddResource = questionModel_1.getQuestionsForAddResource;
87
+ this._getQuestionsForProvision = questionModel_1.getQuestionsForProvision;
88
+ this._getQuestionsForDeploy = questionModel_1.getQuestionsForDeploy;
89
+ this._getQuestionsForLocalProvision = questionModel_1.getQuestionsForLocalProvision;
90
+ this._getQuestionsForPublish = questionModel_1.getQuestionsForPublish;
91
+ this._getQuestionsForInit = questionModel_1.getQuestionsForInit;
69
92
  this.tools = tools;
70
93
  exports.TOOLS = tools;
71
94
  exports.Logger = tools.logProvider;
@@ -78,24 +101,36 @@ class FxCore {
78
101
  on(event, callback) {
79
102
  return callback_1.CallbackRegistry.set(event, callback);
80
103
  }
81
- async createProject(inputs, ctx) {
104
+ async createProject(inputs) {
105
+ if (isV3()) {
106
+ return this.createProjectV3(inputs);
107
+ }
108
+ else {
109
+ return this.createProjectV2(inputs);
110
+ }
111
+ }
112
+ async createProjectV2(inputs, ctx) {
82
113
  if (!ctx) {
83
114
  return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("ctx for createProject"));
84
115
  }
85
116
  exports.currentStage = teamsfx_api_1.Stage.create;
86
117
  inputs.stage = teamsfx_api_1.Stage.create;
87
- let folder = inputs[question_1.QuestionRootFolder.name];
118
+ let folder = inputs[question_2.QuestionRootFolder.name];
88
119
  if (inputs.platform === teamsfx_api_1.Platform.VSCode) {
89
120
  folder = tools_1.getRootDirectory();
90
- await fs.ensureDir(folder);
121
+ try {
122
+ await fs.ensureDir(folder);
123
+ }
124
+ catch (e) {
125
+ throw error_1.ProjectFolderInvalidError(folder);
126
+ }
91
127
  }
92
- const scratch = inputs[question_1.CoreQuestionNames.CreateFromScratch];
128
+ const scratch = inputs[question_2.CoreQuestionNames.CreateFromScratch];
93
129
  let projectPath;
94
130
  let globalStateDescription = "openReadme";
95
- const multiEnv = tools_1.isMultiEnvEnabled();
96
- if (scratch === question_1.ScratchOptionNo.id) {
131
+ if (scratch === question_2.ScratchOptionNo.id) {
97
132
  // create from sample
98
- const downloadRes = await downloadSample(this, inputs, ctx);
133
+ const downloadRes = await downloadSample(inputs, ctx);
99
134
  if (downloadRes.isErr()) {
100
135
  return teamsfx_api_1.err(downloadRes.error);
101
136
  }
@@ -104,11 +139,11 @@ class FxCore {
104
139
  }
105
140
  else {
106
141
  // create from new
107
- const appName = inputs[question_1.QuestionAppName.name];
142
+ const appName = inputs[question_2.QuestionAppName.name];
108
143
  if (undefined === appName)
109
144
  return teamsfx_api_1.err(error_1.InvalidInputError(`App Name is empty`, inputs));
110
145
  const validateResult = jsonschema.validate(appName, {
111
- pattern: question_1.ProjectNamePattern,
146
+ pattern: question_2.ProjectNamePattern,
112
147
  });
113
148
  if (validateResult.errors && validateResult.errors.length > 0) {
114
149
  return teamsfx_api_1.err(error_1.InvalidInputError(`${validateResult.errors[0].message}`, inputs));
@@ -121,7 +156,7 @@ class FxCore {
121
156
  }
122
157
  await fs.ensureDir(projectPath);
123
158
  await fs.ensureDir(path.join(projectPath, `.${teamsfx_api_1.ConfigFolderName}`));
124
- await fs.ensureDir(path.join(projectPath, multiEnv ? path.join("templates", `${teamsfx_api_1.AppPackageFolderName}`) : `${teamsfx_api_1.AppPackageFolderName}`));
159
+ await fs.ensureDir(path.join(projectPath, path.join("templates", `${teamsfx_api_1.AppPackageFolderName}`)));
125
160
  const basicFolderRes = await createBasicFolderStructure(inputs);
126
161
  if (basicFolderRes.isErr()) {
127
162
  return teamsfx_api_1.err(basicFolderRes.error);
@@ -137,77 +172,211 @@ class FxCore {
137
172
  isFromSample: false,
138
173
  };
139
174
  ctx.projectSettings = projectSettings;
140
- if (multiEnv) {
141
- const createEnvResult = await this.createEnvWithName(__1.environmentManager.getDefaultEnvName(), projectSettings, inputs);
142
- if (createEnvResult.isErr()) {
143
- return teamsfx_api_1.err(createEnvResult.error);
144
- }
175
+ const createEnvResult = await this.createEnvWithName(__1.environmentManager.getDefaultEnvName(), projectSettings, inputs);
176
+ if (createEnvResult.isErr()) {
177
+ return teamsfx_api_1.err(createEnvResult.error);
145
178
  }
146
- if (isV2()) {
147
- const solution = await SolutionPluginContainer_1.getSolutionPluginV2ByName(inputs[question_1.CoreQuestionNames.Solution]);
148
- if (!solution) {
149
- return teamsfx_api_1.err(new error_1.LoadSolutionError());
150
- }
151
- ctx.solutionV2 = solution;
152
- projectSettings.solutionSettings.name = solution.name;
153
- const contextV2 = createV2Context(this, projectSettings);
154
- ctx.contextV2 = contextV2;
155
- const scaffoldSourceCodeRes = await solution.scaffoldSourceCode(contextV2, inputs);
156
- if (scaffoldSourceCodeRes.isErr()) {
157
- return teamsfx_api_1.err(scaffoldSourceCodeRes.error);
179
+ const solution = await SolutionPluginContainer_1.getSolutionPluginV2ByName(inputs[question_2.CoreQuestionNames.Solution]);
180
+ if (!solution) {
181
+ return teamsfx_api_1.err(new error_1.LoadSolutionError());
182
+ }
183
+ ctx.solutionV2 = solution;
184
+ projectSettings.solutionSettings.name = solution.name;
185
+ const contextV2 = createV2Context(projectSettings);
186
+ ctx.contextV2 = contextV2;
187
+ const scaffoldSourceCodeRes = await solution.scaffoldSourceCode(contextV2, inputs);
188
+ if (scaffoldSourceCodeRes.isErr()) {
189
+ return teamsfx_api_1.err(scaffoldSourceCodeRes.error);
190
+ }
191
+ const generateResourceTemplateRes = await solution.generateResourceTemplate(contextV2, inputs);
192
+ if (generateResourceTemplateRes.isErr()) {
193
+ return teamsfx_api_1.err(generateResourceTemplateRes.error);
194
+ }
195
+ // ctx.provisionInputConfig = generateResourceTemplateRes.value;
196
+ if (solution.createEnv) {
197
+ inputs.copy = false;
198
+ const createEnvRes = await solution.createEnv(contextV2, inputs);
199
+ if (createEnvRes.isErr()) {
200
+ return teamsfx_api_1.err(createEnvRes.error);
158
201
  }
159
- const generateResourceTemplateRes = await solution.generateResourceTemplate(contextV2, inputs);
160
- if (generateResourceTemplateRes.isErr()) {
161
- return teamsfx_api_1.err(generateResourceTemplateRes.error);
202
+ }
203
+ }
204
+ if (inputs.platform === teamsfx_api_1.Platform.VSCode) {
205
+ await globalState_1.globalStateUpdate(globalStateDescription, true);
206
+ }
207
+ return teamsfx_api_1.ok(projectPath);
208
+ }
209
+ async createProjectV3(inputs, ctx) {
210
+ if (!ctx) {
211
+ return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("ctx for createProject"));
212
+ }
213
+ exports.currentStage = teamsfx_api_1.Stage.create;
214
+ inputs.stage = teamsfx_api_1.Stage.create;
215
+ let folder = inputs[question_2.QuestionRootFolder.name];
216
+ if (inputs.platform === teamsfx_api_1.Platform.VSCode || inputs.platform === teamsfx_api_1.Platform.VS) {
217
+ folder = tools_1.getRootDirectory();
218
+ try {
219
+ await fs.ensureDir(folder);
220
+ }
221
+ catch (e) {
222
+ throw error_1.ProjectFolderInvalidError(folder);
223
+ }
224
+ }
225
+ const scratch = inputs[question_2.CoreQuestionNames.CreateFromScratch];
226
+ let projectPath;
227
+ let globalStateDescription = "openReadme";
228
+ if (scratch === question_2.ScratchOptionNo.id) {
229
+ // create from sample
230
+ const downloadRes = await downloadSample(inputs, ctx);
231
+ if (downloadRes.isErr()) {
232
+ return teamsfx_api_1.err(downloadRes.error);
233
+ }
234
+ projectPath = downloadRes.value;
235
+ globalStateDescription = "openSampleReadme";
236
+ }
237
+ else {
238
+ // create from new
239
+ const appName = inputs[question_2.QuestionAppName.name];
240
+ if (undefined === appName)
241
+ return teamsfx_api_1.err(error_1.InvalidInputError(`App Name is empty`, inputs));
242
+ const validateResult = jsonschema.validate(appName, {
243
+ pattern: question_2.ProjectNamePattern,
244
+ });
245
+ if (validateResult.errors && validateResult.errors.length > 0) {
246
+ return teamsfx_api_1.err(error_1.InvalidInputError(`${validateResult.errors[0].message}`, inputs));
247
+ }
248
+ projectPath = path.join(folder, appName);
249
+ inputs.projectPath = projectPath;
250
+ const folderExist = await fs.pathExists(projectPath);
251
+ if (folderExist) {
252
+ return teamsfx_api_1.err(error_1.ProjectFolderExistError(projectPath));
253
+ }
254
+ await fs.ensureDir(projectPath);
255
+ await fs.ensureDir(path.join(projectPath, `.${teamsfx_api_1.ConfigFolderName}`));
256
+ let capabilities = inputs[question_2.CoreQuestionNames.Capabilities];
257
+ let projectType = "";
258
+ if (capabilities.includes(question_2.TabSPFxItem.id))
259
+ projectType = "spfx";
260
+ else if (capabilities.includes(question_2.TabOptionItem.id) && capabilities.length === 1)
261
+ projectType = "tab";
262
+ else if ((capabilities.includes(question_2.BotOptionItem.id) ||
263
+ capabilities.includes(question_1.MessageExtensionItem.id)) &&
264
+ !capabilities.includes(question_2.TabOptionItem.id))
265
+ projectType = "bot";
266
+ else if ((capabilities.includes(question_2.BotOptionItem.id) ||
267
+ capabilities.includes(question_1.MessageExtensionItem.id)) &&
268
+ capabilities.includes(question_2.TabOptionItem.id))
269
+ projectType = "tab+bot";
270
+ const programmingLanguage = inputs[question_2.CoreQuestionNames.ProgrammingLanguage];
271
+ // const solution = capabilities.includes(TabSPFxItem.id)
272
+ // ? BuiltInSolutionNames.spfx
273
+ // : BuiltInSolutionNames.azure;
274
+ // init
275
+ const initInputs = Object.assign(Object.assign({}, inputs), { projectPath: projectPath });
276
+ const initRes = await this._init(initInputs, ctx);
277
+ if (initRes.isErr()) {
278
+ return teamsfx_api_1.err(initRes.error);
279
+ }
280
+ // addModule, scaffold and addResource
281
+ if (inputs.platform === teamsfx_api_1.Platform.VS) {
282
+ // addModule
283
+ const addModuleInputs = Object.assign(Object.assign({}, inputs), { projectPath: projectPath, capabilities: capabilities });
284
+ const addModuleRes = await this._addModule(addModuleInputs, ctx);
285
+ if (addModuleRes.isErr()) {
286
+ return teamsfx_api_1.err(addModuleRes.error);
162
287
  }
163
- // ctx.provisionInputConfig = generateResourceTemplateRes.value;
164
- if (multiEnv) {
165
- if (solution.createEnv) {
166
- inputs.copy = false;
167
- const createEnvRes = await solution.createEnv(contextV2, inputs);
168
- if (createEnvRes.isErr()) {
169
- return teamsfx_api_1.err(createEnvRes.error);
170
- }
171
- }
288
+ // addResource
289
+ const addResourceInputs = Object.assign(Object.assign({}, inputs), { projectPath: projectPath, module: "0", resource: constants_2.BuiltInResourcePluginNames.webApp });
290
+ const addResourceRes = await this._addResource(addResourceInputs, ctx);
291
+ if (addResourceRes.isErr()) {
292
+ return teamsfx_api_1.err(addResourceRes.error);
172
293
  }
173
- else {
174
- //TODO lagacy env.default.json
175
- const state = { solution: {} };
176
- for (const plugin of ResourcePluginContainer_1.getAllV2ResourcePlugins()) {
177
- state[plugin.name] = {};
178
- }
179
- state[plugins_1.PluginNames.LDEBUG]["trustDevCert"] = "true";
180
- ctx.envInfoV2 = {
181
- envName: __1.environmentManager.getDefaultEnvName(),
182
- config: {},
183
- state: state,
184
- };
294
+ // scaffold
295
+ let templateName = "";
296
+ if (projectType === "tab")
297
+ templateName = "BlazorTab";
298
+ else if (projectType === "bot")
299
+ templateName = "BlazorBot";
300
+ else if (projectType === "tabbot")
301
+ templateName = "BlazorTabBot";
302
+ const scaffoldInputs = Object.assign(Object.assign({}, inputs), { projectPath: projectPath, module: "0", template: {
303
+ id: `${constants_2.BuiltInScaffoldPluginNames.blazor}/${templateName}`,
304
+ label: `${constants_2.BuiltInScaffoldPluginNames.blazor}/${templateName}`,
305
+ data: {
306
+ pluginName: constants_2.BuiltInScaffoldPluginNames.blazor,
307
+ templateName: templateName,
308
+ },
309
+ } });
310
+ const scaffoldRes = await this._scaffold(scaffoldInputs, ctx);
311
+ if (scaffoldRes.isErr()) {
312
+ return teamsfx_api_1.err(scaffoldRes.error);
185
313
  }
186
314
  }
187
315
  else {
188
- const solution = await SolutionPluginContainer_1.getSolutionPluginByName(inputs[question_1.CoreQuestionNames.Solution]);
189
- if (!solution) {
190
- return teamsfx_api_1.err(new error_1.LoadSolutionError());
191
- }
192
- ctx.solution = solution;
193
- projectSettings.solutionSettings.name = solution.name;
194
- const solutionContext = Object.assign(Object.assign(Object.assign({ projectSettings: projectSettings, envInfo: tools_2.newEnvInfo(), root: projectPath }, this.tools), this.tools.tokenProvider), { answers: inputs, cryptoProvider: new crypto_1.LocalCrypto(projectSettings.projectId) });
195
- ctx.solutionContext = solutionContext;
196
- const createRes = await solution.create(solutionContext);
197
- if (createRes.isErr()) {
198
- return createRes;
199
- }
200
- const scaffoldRes = await solution.scaffold(solutionContext);
201
- if (scaffoldRes.isErr()) {
202
- return scaffoldRes;
316
+ if (capabilities.includes(question_2.TabOptionItem.id) || capabilities.includes(question_2.TabSPFxItem.id)) {
317
+ const addModuleInputs = Object.assign(Object.assign({}, inputs), { projectPath: projectPath, capabilities: capabilities.includes(question_2.TabOptionItem.id)
318
+ ? [question_2.TabOptionItem.id]
319
+ : [question_2.TabSPFxItem.id] });
320
+ const addModuleRes = await this._addModule(addModuleInputs, ctx);
321
+ if (addModuleRes.isErr()) {
322
+ return teamsfx_api_1.err(addModuleRes.error);
323
+ }
324
+ // addResource
325
+ const addResourceInputs = Object.assign(Object.assign({}, inputs), { projectPath: projectPath, module: "0", resource: capabilities.includes(question_2.TabOptionItem.id)
326
+ ? constants_2.BuiltInResourcePluginNames.storage
327
+ : constants_2.BuiltInResourcePluginNames.spfx });
328
+ const addResourceRes = await this._addResource(addResourceInputs, ctx);
329
+ if (addResourceRes.isErr()) {
330
+ return teamsfx_api_1.err(addResourceRes.error);
331
+ }
332
+ // scaffold
333
+ const pluginName = capabilities.includes(question_2.TabOptionItem.id)
334
+ ? constants_2.BuiltInScaffoldPluginNames.tab
335
+ : constants_2.BuiltInScaffoldPluginNames.spfx;
336
+ const templateName = capabilities.includes(question_2.TabOptionItem.id)
337
+ ? programmingLanguage === "javascript"
338
+ ? "ReactTab_JS"
339
+ : "ReactTab_TS"
340
+ : "SPFxTab";
341
+ const scaffoldInputs = Object.assign(Object.assign({}, inputs), { projectPath: projectPath, module: "0", template: {
342
+ id: `${pluginName}/${templateName}`,
343
+ label: `${pluginName}/${templateName}`,
344
+ data: {
345
+ pluginName: pluginName,
346
+ templateName: templateName, //TODO
347
+ },
348
+ } });
349
+ const scaffoldRes = await this._scaffold(scaffoldInputs, ctx);
350
+ if (scaffoldRes.isErr()) {
351
+ return teamsfx_api_1.err(scaffoldRes.error);
352
+ }
203
353
  }
204
- if (multiEnv) {
205
- if (solution.createEnv) {
206
- solutionContext.answers.copy = false;
207
- const createEnvRes = await solution.createEnv(solutionContext);
208
- if (createEnvRes.isErr()) {
209
- return teamsfx_api_1.err(createEnvRes.error);
210
- }
354
+ capabilities = capabilities.filter((c) => c !== question_2.TabOptionItem.id && c !== question_2.TabSPFxItem.id);
355
+ if (capabilities.length > 0) {
356
+ const addModuleInputs = Object.assign(Object.assign({}, inputs), { projectPath: projectPath, capabilities: capabilities });
357
+ const addModuleRes = await this._addModule(addModuleInputs, ctx);
358
+ if (addModuleRes.isErr()) {
359
+ return teamsfx_api_1.err(addModuleRes.error);
360
+ }
361
+ // addResource
362
+ const addResourceInputs = Object.assign(Object.assign({}, inputs), { projectPath: projectPath, module: "1", resource: constants_2.BuiltInResourcePluginNames.bot });
363
+ const addResourceRes = await this._addResource(addResourceInputs, ctx);
364
+ if (addResourceRes.isErr()) {
365
+ return teamsfx_api_1.err(addResourceRes.error);
366
+ }
367
+ // scaffold
368
+ const templateName = programmingLanguage === "javascript" ? "NodejsBot_JS" : "NodejsBot_TS";
369
+ const scaffoldInputs = Object.assign(Object.assign({}, inputs), { projectPath: projectPath, module: "1", resource: constants_2.BuiltInScaffoldPluginNames.bot, template: {
370
+ id: `${constants_2.BuiltInScaffoldPluginNames.bot}/${templateName}`,
371
+ label: `${constants_2.BuiltInScaffoldPluginNames.bot}/${templateName}`,
372
+ data: {
373
+ pluginName: constants_2.BuiltInScaffoldPluginNames.bot,
374
+ templateName: templateName, //TODO
375
+ },
376
+ } });
377
+ const scaffoldRes = await this._scaffold(scaffoldInputs, ctx);
378
+ if (scaffoldRes.isErr()) {
379
+ return teamsfx_api_1.err(scaffoldRes.error);
211
380
  }
212
381
  }
213
382
  }
@@ -222,11 +391,11 @@ class FxCore {
222
391
  exports.currentStage = teamsfx_api_1.Stage.migrateV1;
223
392
  inputs.stage = teamsfx_api_1.Stage.migrateV1;
224
393
  const globalStateDescription = "openReadme";
225
- const appName = ((_a = inputs[question_1.DefaultAppNameFunc.name]) !== null && _a !== void 0 ? _a : inputs[question_1.QuestionV1AppName.name]);
394
+ const appName = ((_a = inputs[question_2.DefaultAppNameFunc.name]) !== null && _a !== void 0 ? _a : inputs[question_2.QuestionV1AppName.name]);
226
395
  if (undefined === appName)
227
396
  return teamsfx_api_1.err(error_1.InvalidInputError(`App Name is empty`, inputs));
228
397
  const validateResult = jsonschema.validate(appName, {
229
- pattern: question_1.ProjectNamePattern,
398
+ pattern: question_2.ProjectNamePattern,
230
399
  });
231
400
  if (validateResult.errors && validateResult.errors.length > 0) {
232
401
  return teamsfx_api_1.err(error_1.InvalidInputError(`${validateResult.errors[0].message}`, inputs));
@@ -302,104 +471,131 @@ class FxCore {
302
471
  return teamsfx_api_1.err(error_1.ArchiveProjectError(e.message));
303
472
  }
304
473
  }
305
- async provisionResources(inputs, ctx) {
474
+ /**
475
+ * switch to different versions of provisionResources
476
+ */
477
+ async provisionResources(inputs) {
478
+ if (isV3()) {
479
+ return this.provisionResourcesV3(inputs);
480
+ }
481
+ else {
482
+ return this.provisionResourcesV2(inputs);
483
+ }
484
+ }
485
+ async provisionResourcesV2(inputs, ctx) {
306
486
  exports.currentStage = teamsfx_api_1.Stage.provision;
307
487
  inputs.stage = teamsfx_api_1.Stage.provision;
308
- // provision is not ready yet, so use API v1
309
- if (isV2()) {
310
- if (!ctx || !ctx.solutionV2 || !ctx.contextV2 || !ctx.envInfoV2) {
311
- return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("Provision input stuff"));
312
- }
313
- const envInfo = ctx.envInfoV2;
314
- const result = await ctx.solutionV2.provisionResources(ctx.contextV2, inputs, envInfo, this.tools.tokenProvider);
315
- if (result.kind === "success") {
316
- ctx.envInfoV2.state = lodash_1.assign(ctx.envInfoV2.state, result.output);
317
- return teamsfx_api_1.ok(teamsfx_api_1.Void);
318
- }
319
- else if (result.kind === "partialSuccess") {
320
- ctx.envInfoV2.state = lodash_1.assign(ctx.envInfoV2.state, result.output);
321
- return teamsfx_api_1.err(result.error);
322
- }
323
- else {
324
- return teamsfx_api_1.err(result.error);
325
- }
488
+ if (!ctx || !ctx.solutionV2 || !ctx.contextV2 || !ctx.envInfoV2) {
489
+ return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("Provision input stuff"));
490
+ }
491
+ const envInfo = ctx.envInfoV2;
492
+ const result = await ctx.solutionV2.provisionResources(ctx.contextV2, inputs, envInfo, this.tools.tokenProvider);
493
+ if (result.kind === "success") {
494
+ ctx.envInfoV2.state = lodash_1.assign(ctx.envInfoV2.state, result.output);
495
+ return teamsfx_api_1.ok(teamsfx_api_1.Void);
496
+ }
497
+ else if (result.kind === "partialSuccess") {
498
+ ctx.envInfoV2.state = lodash_1.assign(ctx.envInfoV2.state, result.output);
499
+ return teamsfx_api_1.err(result.error);
326
500
  }
327
501
  else {
328
- if (!ctx || !ctx.solution || !ctx.solutionContext) {
329
- const name = undefinedName([ctx, ctx === null || ctx === void 0 ? void 0 : ctx.solution, ctx === null || ctx === void 0 ? void 0 : ctx.solutionContext], ["ctx", "ctx.solution", "ctx.solutionContext"]);
330
- return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError(`Provision input stuff: ${name}`));
331
- }
332
- const provisionRes = await ctx.solution.provision(ctx.solutionContext);
333
- if (provisionRes.isErr()) {
334
- return provisionRes;
502
+ return teamsfx_api_1.err(result.error);
503
+ }
504
+ }
505
+ async provisionResourcesV3(inputs, ctx) {
506
+ exports.currentStage = teamsfx_api_1.Stage.provision;
507
+ inputs.stage = teamsfx_api_1.Stage.provision;
508
+ if (ctx &&
509
+ ctx.solutionV3 &&
510
+ ctx.contextV2 &&
511
+ ctx.envInfoV3 &&
512
+ ctx.solutionV3.provisionResources) {
513
+ const res = await ctx.solutionV3.provisionResources(ctx.contextV2, inputs, ctx.envInfoV3, exports.TOOLS.tokenProvider);
514
+ if (res.isOk()) {
515
+ ctx.envInfoV3 = res.value;
335
516
  }
336
- this._setEnvInfoV2(ctx);
337
- return provisionRes;
517
+ return res;
338
518
  }
519
+ return teamsfx_api_1.ok(teamsfx_api_1.Void);
339
520
  }
340
- async deployArtifacts(inputs, ctx) {
521
+ async deployArtifacts(inputs) {
522
+ if (isV3())
523
+ return this.deployArtifactsV3(inputs);
524
+ else
525
+ return this.deployArtifactsV2(inputs);
526
+ }
527
+ async deployArtifactsV2(inputs, ctx) {
341
528
  exports.currentStage = teamsfx_api_1.Stage.deploy;
342
529
  inputs.stage = teamsfx_api_1.Stage.deploy;
343
- if (isV2()) {
344
- if (!ctx || !ctx.solutionV2 || !ctx.contextV2 || !ctx.envInfoV2) {
345
- const name = undefinedName([ctx, ctx === null || ctx === void 0 ? void 0 : ctx.solutionV2, ctx === null || ctx === void 0 ? void 0 : ctx.contextV2, ctx === null || ctx === void 0 ? void 0 : ctx.envInfoV2], ["ctx", "ctx.solutionV2", "ctx.contextV2", "ctx.envInfoV2"]);
346
- return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError(`Deploy input stuff: ${name}`));
347
- }
348
- if (ctx.solutionV2.deploy)
349
- return await ctx.solutionV2.deploy(ctx.contextV2, inputs, ctx.envInfoV2, this.tools.tokenProvider);
350
- else
530
+ if (!ctx || !ctx.solutionV2 || !ctx.contextV2 || !ctx.envInfoV2) {
531
+ const name = undefinedName([ctx, ctx === null || ctx === void 0 ? void 0 : ctx.solutionV2, ctx === null || ctx === void 0 ? void 0 : ctx.contextV2, ctx === null || ctx === void 0 ? void 0 : ctx.envInfoV2], ["ctx", "ctx.solutionV2", "ctx.contextV2", "ctx.envInfoV2"]);
532
+ return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError(`Deploy input stuff: ${name}`));
533
+ }
534
+ if (ctx.solutionV2.deploy)
535
+ return await ctx.solutionV2.deploy(ctx.contextV2, inputs, ctx.envInfoV2, this.tools.tokenProvider);
536
+ else
537
+ return teamsfx_api_1.ok(teamsfx_api_1.Void);
538
+ }
539
+ async deployArtifactsV3(inputs, ctx) {
540
+ exports.currentStage = teamsfx_api_1.Stage.deploy;
541
+ inputs.stage = teamsfx_api_1.Stage.deploy;
542
+ if (ctx && ctx.solutionV3 && ctx.contextV2 && ctx.envInfoV3 && ctx.solutionV3.deploy) {
543
+ const res = await ctx.solutionV3.deploy(ctx.contextV2, inputs, ctx.envInfoV3, exports.TOOLS.tokenProvider);
544
+ return res;
545
+ }
546
+ return teamsfx_api_1.ok(teamsfx_api_1.Void);
547
+ }
548
+ async localDebug(inputs) {
549
+ if (isV3())
550
+ return this.localDebugV3(inputs);
551
+ else
552
+ return this.localDebugV2(inputs);
553
+ }
554
+ async localDebugV2(inputs, ctx) {
555
+ exports.currentStage = teamsfx_api_1.Stage.debug;
556
+ inputs.stage = teamsfx_api_1.Stage.debug;
557
+ if (!ctx || !ctx.solutionV2 || !ctx.contextV2) {
558
+ const name = undefinedName([ctx, ctx === null || ctx === void 0 ? void 0 : ctx.solutionV2, ctx === null || ctx === void 0 ? void 0 : ctx.contextV2], ["ctx", "ctx.solutionV2", "ctx.contextV2"]);
559
+ return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError(`localDebug input stuff (${name})`));
560
+ }
561
+ if (!ctx.localSettings)
562
+ ctx.localSettings = {};
563
+ if (ctx.solutionV2.provisionLocalResource) {
564
+ const res = await ctx.solutionV2.provisionLocalResource(ctx.contextV2, inputs, ctx.localSettings, this.tools.tokenProvider);
565
+ if (res.kind === "success") {
566
+ ctx.localSettings = res.output;
351
567
  return teamsfx_api_1.ok(teamsfx_api_1.Void);
568
+ }
569
+ else if (res.kind === "partialSuccess") {
570
+ ctx.localSettings = res.output;
571
+ return teamsfx_api_1.err(res.error);
572
+ }
573
+ else {
574
+ return teamsfx_api_1.err(res.error);
575
+ }
352
576
  }
353
577
  else {
354
- if (!ctx || !ctx.solution || !ctx.solutionContext) {
355
- const name = undefinedName([ctx, ctx === null || ctx === void 0 ? void 0 : ctx.solution, ctx === null || ctx === void 0 ? void 0 : ctx.solutionContext], ["ctx", "ctx.solution", "ctx.solutionContext"]);
356
- return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError(`Deploy input stuff: ${name}`));
357
- }
358
- return await ctx.solution.deploy(ctx.solutionContext);
578
+ return teamsfx_api_1.ok(teamsfx_api_1.Void);
359
579
  }
360
580
  }
361
- async localDebug(inputs, ctx) {
581
+ async localDebugV3(inputs, ctx) {
362
582
  exports.currentStage = teamsfx_api_1.Stage.debug;
363
583
  inputs.stage = teamsfx_api_1.Stage.debug;
364
- if (isV2()) {
365
- if (tools_1.isMultiEnvEnabled()) {
366
- if (!ctx || !ctx.solutionV2 || !ctx.contextV2) {
367
- const name = undefinedName([ctx, ctx === null || ctx === void 0 ? void 0 : ctx.solutionV2, ctx === null || ctx === void 0 ? void 0 : ctx.contextV2], ["ctx", "ctx.solutionV2", "ctx.contextV2"]);
368
- return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError(`localDebug input stuff (${name})`));
369
- }
370
- if (!ctx.localSettings)
371
- ctx.localSettings = {};
372
- if (ctx.solutionV2.provisionLocalResource) {
373
- const res = await ctx.solutionV2.provisionLocalResource(ctx.contextV2, inputs, ctx.localSettings, this.tools.tokenProvider);
374
- if (res.kind === "success") {
375
- ctx.localSettings = res.output;
376
- return teamsfx_api_1.ok(teamsfx_api_1.Void);
377
- }
378
- else if (res.kind === "partialSuccess") {
379
- ctx.localSettings = res.output;
380
- return teamsfx_api_1.err(res.error);
381
- }
382
- else {
383
- return teamsfx_api_1.err(res.error);
384
- }
385
- }
386
- else {
387
- return teamsfx_api_1.ok(teamsfx_api_1.Void);
388
- }
584
+ if (ctx &&
585
+ ctx.solutionV3 &&
586
+ ctx.contextV2 &&
587
+ ctx.localSettings &&
588
+ ctx.solutionV3.provisionLocalResources) {
589
+ const res = await ctx.solutionV3.provisionLocalResources(ctx.contextV2, inputs, ctx.localSettings, exports.TOOLS.tokenProvider);
590
+ if (res.isOk()) {
591
+ ctx.localSettings = res.value;
389
592
  }
593
+ return res;
390
594
  }
391
- if (!ctx || !ctx.solution || !ctx.solutionContext || !ctx.projectSettings) {
392
- const name = undefinedName([ctx, ctx === null || ctx === void 0 ? void 0 : ctx.solution, ctx === null || ctx === void 0 ? void 0 : ctx.solutionContext, ctx === null || ctx === void 0 ? void 0 : ctx.projectSettings], ["ctx", "ctx.solution", "ctx.solutionContext", "ctx.projectSettings"]);
393
- return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError(`localDebug input stuff (${name})`));
394
- }
395
- envInfoLoader_1.upgradeProgrammingLanguage(ctx.solutionContext.envInfo.state, ctx.projectSettings);
396
- envInfoLoader_1.upgradeDefaultFunctionName(ctx.solutionContext.envInfo.state, ctx.projectSettings);
397
- const res = await ctx.solution.localDebug(ctx.solutionContext);
398
- this._setEnvInfoV2(ctx);
399
- return res;
595
+ return teamsfx_api_1.ok(teamsfx_api_1.Void);
400
596
  }
401
597
  _setEnvInfoV2(ctx) {
402
- if (isV2() && ctx && ctx.solutionContext) {
598
+ if (ctx && ctx.solutionContext) {
403
599
  //workaround, compatible to api v2
404
600
  ctx.envInfoV2 = {
405
601
  envName: ctx.solutionContext.envInfo.envName,
@@ -409,23 +605,33 @@ class FxCore {
409
605
  ctx.envInfoV2.state = tools_1.mapToJson(ctx.solutionContext.envInfo.state);
410
606
  }
411
607
  }
412
- async publishApplication(inputs, ctx) {
608
+ async publishApplication(inputs) {
609
+ if (isV3())
610
+ return this.publishApplicationV3(inputs);
611
+ else
612
+ return this.publishApplicationV2(inputs);
613
+ }
614
+ async publishApplicationV2(inputs, ctx) {
413
615
  exports.currentStage = teamsfx_api_1.Stage.publish;
414
616
  inputs.stage = teamsfx_api_1.Stage.publish;
415
- if (isV2()) {
416
- if (!ctx || !ctx.solutionV2 || !ctx.contextV2 || !ctx.envInfoV2) {
417
- const name = undefinedName([ctx, ctx === null || ctx === void 0 ? void 0 : ctx.solutionV2, ctx === null || ctx === void 0 ? void 0 : ctx.contextV2, ctx === null || ctx === void 0 ? void 0 : ctx.envInfoV2], ["ctx", "ctx.solutionV2", "ctx.contextV2", "ctx.envInfoV2"]);
418
- return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError(`publish input stuff: ${name}`));
419
- }
420
- return await ctx.solutionV2.publishApplication(ctx.contextV2, inputs, ctx.envInfoV2, this.tools.tokenProvider.appStudioToken);
617
+ if (!ctx || !ctx.solutionV2 || !ctx.contextV2 || !ctx.envInfoV2) {
618
+ const name = undefinedName([ctx, ctx === null || ctx === void 0 ? void 0 : ctx.solutionV2, ctx === null || ctx === void 0 ? void 0 : ctx.contextV2, ctx === null || ctx === void 0 ? void 0 : ctx.envInfoV2], ["ctx", "ctx.solutionV2", "ctx.contextV2", "ctx.envInfoV2"]);
619
+ return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError(`publish input stuff: ${name}`));
421
620
  }
422
- else {
423
- if (!ctx || !ctx.solution || !ctx.solutionContext) {
424
- const name = undefinedName([ctx, ctx === null || ctx === void 0 ? void 0 : ctx.solution, ctx === null || ctx === void 0 ? void 0 : ctx.solutionContext], ["ctx", "ctx.solution", "ctx.solutionContext"]);
425
- return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError(`publish input stuff: ${name}`));
426
- }
427
- return await ctx.solution.publish(ctx.solutionContext);
621
+ return await ctx.solutionV2.publishApplication(ctx.contextV2, inputs, ctx.envInfoV2, this.tools.tokenProvider.appStudioToken);
622
+ }
623
+ async publishApplicationV3(inputs, ctx) {
624
+ exports.currentStage = teamsfx_api_1.Stage.publish;
625
+ inputs.stage = teamsfx_api_1.Stage.publish;
626
+ if (ctx &&
627
+ ctx.solutionV3 &&
628
+ ctx.contextV2 &&
629
+ ctx.envInfoV3 &&
630
+ ctx.solutionV3.publishApplication) {
631
+ const res = await ctx.solutionV3.publishApplication(ctx.contextV2, inputs, ctx.envInfoV3, exports.TOOLS.tokenProvider.appStudioToken);
632
+ return res;
428
633
  }
634
+ return teamsfx_api_1.ok(teamsfx_api_1.Void);
429
635
  }
430
636
  async executeUserTask(func, inputs, ctx) {
431
637
  exports.currentStage = teamsfx_api_1.Stage.userTask;
@@ -433,32 +639,20 @@ class FxCore {
433
639
  const namespace = func.namespace;
434
640
  const array = namespace ? namespace.split("/") : [];
435
641
  if ("" !== namespace && array.length > 0) {
436
- if (isV2()) {
437
- if (!ctx || !ctx.solutionV2 || !ctx.envInfoV2) {
438
- const name = undefinedName([ctx, ctx === null || ctx === void 0 ? void 0 : ctx.solutionV2, ctx === null || ctx === void 0 ? void 0 : ctx.envInfoV2], ["ctx", "ctx.solutionV2", "ctx.envInfoV2"]);
439
- return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError(`executeUserTask input stuff: ${name}`));
440
- }
441
- if (!ctx.contextV2)
442
- ctx.contextV2 = createV2Context(this, newProjectSettings());
443
- if (ctx.solutionV2.executeUserTask) {
444
- if (!ctx.localSettings)
445
- ctx.localSettings = {};
446
- const res = await ctx.solutionV2.executeUserTask(ctx.contextV2, inputs, func, ctx.localSettings, ctx.envInfoV2, this.tools.tokenProvider);
447
- return res;
448
- }
449
- else
450
- return teamsfx_api_1.err(error_1.FunctionRouterError(func));
642
+ if (!ctx || !ctx.solutionV2 || !ctx.envInfoV2) {
643
+ const name = undefinedName([ctx, ctx === null || ctx === void 0 ? void 0 : ctx.solutionV2, ctx === null || ctx === void 0 ? void 0 : ctx.envInfoV2], ["ctx", "ctx.solutionV2", "ctx.envInfoV2"]);
644
+ return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError(`executeUserTask input stuff: ${name}`));
451
645
  }
452
- else {
453
- if (!ctx || !ctx.solution)
454
- return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("executeUserTask input stuff"));
455
- if (!ctx.solutionContext)
456
- ctx.solutionContext = await projectSettingsLoader_1.newSolutionContext(this.tools, inputs);
457
- if (ctx.solution.executeUserTask)
458
- return await ctx.solution.executeUserTask(func, ctx.solutionContext);
459
- else
460
- return teamsfx_api_1.err(error_1.FunctionRouterError(func));
646
+ if (!ctx.contextV2)
647
+ ctx.contextV2 = createV2Context(newProjectSettings());
648
+ if (ctx.solutionV2.executeUserTask) {
649
+ if (!ctx.localSettings)
650
+ ctx.localSettings = {};
651
+ const res = await ctx.solutionV2.executeUserTask(ctx.contextV2, inputs, func, ctx.localSettings, ctx.envInfoV2, this.tools.tokenProvider);
652
+ return res;
461
653
  }
654
+ else
655
+ return teamsfx_api_1.err(error_1.FunctionRouterError(func));
462
656
  }
463
657
  return teamsfx_api_1.err(error_1.FunctionRouterError(func));
464
658
  }
@@ -469,27 +663,16 @@ class FxCore {
469
663
  exports.currentStage = teamsfx_api_1.Stage.getQuestions;
470
664
  if (stage === teamsfx_api_1.Stage.create) {
471
665
  delete inputs.projectPath;
472
- return await this._getQuestionsForCreateProject(inputs);
666
+ return await this._getQuestionsForCreateProjectV2(inputs);
473
667
  }
474
668
  else {
475
- if (isV2()) {
476
- const contextV2 = ctx.contextV2
477
- ? ctx.contextV2
478
- : createV2Context(this, newProjectSettings());
479
- const solutionV2 = ctx.solutionV2 ? ctx.solutionV2 : await SolutionPluginContainer_1.getAllSolutionPluginsV2()[0];
480
- const envInfoV2 = ctx.envInfoV2
481
- ? ctx.envInfoV2
482
- : { envName: __1.environmentManager.getDefaultEnvName(), config: {}, state: {} };
483
- inputs.stage = stage;
484
- return await this._getQuestions(contextV2, solutionV2, stage, inputs, envInfoV2);
485
- }
486
- else {
487
- const solutionContext = ctx.solutionContext
488
- ? ctx.solutionContext
489
- : await projectSettingsLoader_1.newSolutionContext(this.tools, inputs);
490
- const solution = ctx.solution ? ctx.solution : SolutionPluginContainer_1.getAllSolutionPlugins()[0];
491
- return await this._getQuestions(solutionContext, solution, stage, inputs);
492
- }
669
+ const contextV2 = ctx.contextV2 ? ctx.contextV2 : createV2Context(newProjectSettings());
670
+ const solutionV2 = ctx.solutionV2 ? ctx.solutionV2 : await SolutionPluginContainer_1.getAllSolutionPluginsV2()[0];
671
+ const envInfoV2 = ctx.envInfoV2
672
+ ? ctx.envInfoV2
673
+ : { envName: __1.environmentManager.getDefaultEnvName(), config: {}, state: {} };
674
+ inputs.stage = stage;
675
+ return await this._getQuestions(contextV2, solutionV2, stage, inputs, envInfoV2);
493
676
  }
494
677
  }
495
678
  async getQuestionsForUserTask(func, inputs, ctx) {
@@ -497,21 +680,12 @@ class FxCore {
497
680
  return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("getQuestionsForUserTask input stuff"));
498
681
  inputs.stage = teamsfx_api_1.Stage.getQuestions;
499
682
  exports.currentStage = teamsfx_api_1.Stage.getQuestions;
500
- if (isV2()) {
501
- const contextV2 = ctx.contextV2 ? ctx.contextV2 : createV2Context(this, newProjectSettings());
502
- const solutionV2 = ctx.solutionV2 ? ctx.solutionV2 : await SolutionPluginContainer_1.getAllSolutionPluginsV2()[0];
503
- const envInfoV2 = ctx.envInfoV2
504
- ? ctx.envInfoV2
505
- : { envName: __1.environmentManager.getDefaultEnvName(), config: {}, state: {} };
506
- return await this._getQuestionsForUserTask(contextV2, solutionV2, func, inputs, envInfoV2);
507
- }
508
- else {
509
- const solutionContext = ctx.solutionContext
510
- ? ctx.solutionContext
511
- : await projectSettingsLoader_1.newSolutionContext(this.tools, inputs);
512
- const solution = ctx.solution ? ctx.solution : SolutionPluginContainer_1.getAllSolutionPlugins()[0];
513
- return await this._getQuestionsForUserTask(solutionContext, solution, func, inputs);
514
- }
683
+ const contextV2 = ctx.contextV2 ? ctx.contextV2 : createV2Context(newProjectSettings());
684
+ const solutionV2 = ctx.solutionV2 ? ctx.solutionV2 : await SolutionPluginContainer_1.getAllSolutionPluginsV2()[0];
685
+ const envInfoV2 = ctx.envInfoV2
686
+ ? ctx.envInfoV2
687
+ : { envName: __1.environmentManager.getDefaultEnvName(), config: {}, state: {} };
688
+ return await this._getQuestionsForUserTask(contextV2, solutionV2, func, inputs, envInfoV2);
515
689
  }
516
690
  async getProjectConfig(inputs, ctx) {
517
691
  var _a, _b;
@@ -528,175 +702,56 @@ class FxCore {
528
702
  async grantPermission(inputs, ctx) {
529
703
  exports.currentStage = teamsfx_api_1.Stage.grantPermission;
530
704
  inputs.stage = teamsfx_api_1.Stage.grantPermission;
531
- if (!isV2()) {
532
- return ctx.solution.grantPermission(ctx.solutionContext);
533
- }
534
- else {
535
- const projectPath = inputs.projectPath;
536
- if (!projectPath) {
537
- return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("projectPath"));
538
- }
539
- return ctx.solutionV2.grantPermission(ctx.contextV2, Object.assign(Object.assign({}, inputs), { projectPath: projectPath }), ctx.envInfoV2, this.tools.tokenProvider);
705
+ const projectPath = inputs.projectPath;
706
+ if (!projectPath) {
707
+ return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("projectPath"));
540
708
  }
709
+ return ctx.solutionV2.grantPermission(ctx.contextV2, Object.assign(Object.assign({}, inputs), { projectPath: projectPath }), ctx.envInfoV2, this.tools.tokenProvider);
541
710
  }
542
711
  async checkPermission(inputs, ctx) {
543
712
  exports.currentStage = teamsfx_api_1.Stage.checkPermission;
544
713
  inputs.stage = teamsfx_api_1.Stage.checkPermission;
545
- if (!isV2()) {
546
- return ctx.solution.checkPermission(ctx.solutionContext);
547
- }
548
- else {
549
- const projectPath = inputs.projectPath;
550
- if (!projectPath) {
551
- return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("projectPath"));
552
- }
553
- return ctx.solutionV2.checkPermission(ctx.contextV2, Object.assign(Object.assign({}, inputs), { projectPath: projectPath }), ctx.envInfoV2, this.tools.tokenProvider);
714
+ const projectPath = inputs.projectPath;
715
+ if (!projectPath) {
716
+ return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("projectPath"));
554
717
  }
718
+ return ctx.solutionV2.checkPermission(ctx.contextV2, Object.assign(Object.assign({}, inputs), { projectPath: projectPath }), ctx.envInfoV2, this.tools.tokenProvider);
555
719
  }
556
720
  async listCollaborator(inputs, ctx) {
557
721
  exports.currentStage = teamsfx_api_1.Stage.listCollaborator;
558
722
  inputs.stage = teamsfx_api_1.Stage.listCollaborator;
559
- if (!isV2()) {
560
- return ctx.solution.listCollaborator(ctx.solutionContext);
561
- }
562
- else {
563
- const projectPath = inputs.projectPath;
564
- if (!projectPath) {
565
- return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("projectPath"));
566
- }
567
- return ctx.solutionV2.listCollaborator(ctx.contextV2, Object.assign(Object.assign({}, inputs), { projectPath: projectPath }), ctx.envInfoV2, this.tools.tokenProvider);
723
+ const projectPath = inputs.projectPath;
724
+ if (!projectPath) {
725
+ return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("projectPath"));
568
726
  }
727
+ return ctx.solutionV2.listCollaborator(ctx.contextV2, Object.assign(Object.assign({}, inputs), { projectPath: projectPath }), ctx.envInfoV2, this.tools.tokenProvider);
569
728
  }
570
729
  async listAllCollaborators(inputs, ctx) {
571
730
  exports.currentStage = teamsfx_api_1.Stage.listAllCollaborators;
572
731
  inputs.stage = teamsfx_api_1.Stage.listAllCollaborators;
573
- if (!isV2()) {
574
- return ctx.solution.listAllCollaborators(ctx.solutionContext);
575
- }
576
- else {
577
- const projectPath = inputs.projectPath;
578
- if (!projectPath) {
579
- return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("projectPath"));
580
- }
581
- return ctx.solutionV2.listAllCollaborators(ctx.contextV2, Object.assign(Object.assign({}, inputs), { projectPath: projectPath }), ctx.envInfoV2, this.tools.tokenProvider);
732
+ const projectPath = inputs.projectPath;
733
+ if (!projectPath) {
734
+ return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("projectPath"));
582
735
  }
736
+ return ctx.solutionV2.listAllCollaborators(ctx.contextV2, Object.assign(Object.assign({}, inputs), { projectPath: projectPath }), ctx.envInfoV2, this.tools.tokenProvider);
583
737
  }
584
738
  async getSelectedEnv(inputs, ctx) {
585
- var _a, _b;
586
- if (!tools_1.isMultiEnvEnabled()) {
587
- return teamsfx_api_1.err(new error_1.TaskNotSupportError("getSelectedEnv"));
588
- }
589
- if (isV2()) {
590
- return teamsfx_api_1.ok((_a = ctx === null || ctx === void 0 ? void 0 : ctx.envInfoV2) === null || _a === void 0 ? void 0 : _a.envName);
591
- }
592
- else {
593
- return teamsfx_api_1.ok((_b = ctx === null || ctx === void 0 ? void 0 : ctx.solutionContext) === null || _b === void 0 ? void 0 : _b.envInfo.envName);
594
- }
595
- }
596
- async _getQuestionsForUserTask(ctx, solution, func, inputs, envInfo) {
597
- const namespace = func.namespace;
598
- const array = namespace ? namespace.split("/") : [];
599
- if (namespace && "" !== namespace && array.length > 0) {
600
- let res = teamsfx_api_1.ok(undefined);
601
- if (isV2()) {
602
- const solutionV2 = solution;
603
- if (solutionV2.getQuestionsForUserTask) {
604
- res = await solutionV2.getQuestionsForUserTask(ctx, inputs, func, envInfo, this.tools.tokenProvider);
605
- }
606
- }
607
- else {
608
- const solutionv1 = solution;
609
- if (solutionv1.getQuestionsForUserTask) {
610
- res = await solutionv1.getQuestionsForUserTask(func, ctx);
611
- }
612
- }
613
- if (res.isOk()) {
614
- if (res.value) {
615
- const node = res.value.trim();
616
- return teamsfx_api_1.ok(node);
617
- }
618
- }
619
- return res;
620
- }
621
- return teamsfx_api_1.err(error_1.FunctionRouterError(func));
622
- }
623
- async _getQuestionsForMigrateV1Project(inputs) {
624
- const node = new teamsfx_api_1.QTreeNode({ type: "group" });
625
- const globalSolutions = await SolutionPluginContainer_1.getAllSolutionPlugins();
626
- const solutionContext = await projectSettingsLoader_1.newSolutionContext(this.tools, inputs);
627
- for (const v of globalSolutions) {
628
- if (v.getQuestions) {
629
- const res = await v.getQuestions(teamsfx_api_1.Stage.migrateV1, solutionContext);
630
- if (res.isErr())
631
- return res;
632
- if (res.value) {
633
- const solutionNode = res.value;
634
- solutionNode.condition = { equals: v.name };
635
- if (solutionNode.data)
636
- node.addChild(solutionNode);
637
- }
638
- }
639
- }
640
- const defaultAppNameFunc = new teamsfx_api_1.QTreeNode(question_1.DefaultAppNameFunc);
641
- node.addChild(defaultAppNameFunc);
642
- const appNameQuestion = new teamsfx_api_1.QTreeNode(question_1.QuestionV1AppName);
643
- appNameQuestion.condition = {
644
- validFunc: (input) => (!input ? undefined : "App name is auto generated."),
645
- };
646
- defaultAppNameFunc.addChild(appNameQuestion);
647
- return teamsfx_api_1.ok(node.trim());
648
- }
649
- async _getQuestions(ctx, solution, stage, inputs, envInfo) {
650
- if (stage !== teamsfx_api_1.Stage.create) {
651
- let res = teamsfx_api_1.ok(undefined);
652
- if (isV2()) {
653
- const solutionV2 = solution;
654
- if (solutionV2.getQuestions) {
655
- inputs.stage = stage;
656
- res = await solutionV2.getQuestions(ctx, inputs, envInfo, this.tools.tokenProvider);
657
- }
658
- }
659
- else {
660
- res = await solution.getQuestions(stage, ctx);
661
- }
662
- if (res.isErr())
663
- return res;
664
- if (res.value) {
665
- const node = res.value;
666
- if (node.data) {
667
- return teamsfx_api_1.ok(node.trim());
668
- }
669
- }
670
- }
671
- return teamsfx_api_1.ok(undefined);
739
+ var _a;
740
+ return teamsfx_api_1.ok((_a = ctx === null || ctx === void 0 ? void 0 : ctx.envInfoV2) === null || _a === void 0 ? void 0 : _a.envName);
672
741
  }
673
742
  async encrypt(plaintext, inputs, ctx) {
674
743
  if (!ctx)
675
744
  return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("ctx"));
676
- if (isV2()) {
677
- if (!ctx.contextV2)
678
- return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("ctx.contextV2"));
679
- return ctx.contextV2.cryptoProvider.encrypt(plaintext);
680
- }
681
- else {
682
- if (!ctx.solutionContext)
683
- return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("ctx.solutionContext"));
684
- return ctx.solutionContext.cryptoProvider.encrypt(plaintext);
685
- }
745
+ if (!ctx.contextV2)
746
+ return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("ctx.contextV2"));
747
+ return ctx.contextV2.cryptoProvider.encrypt(plaintext);
686
748
  }
687
749
  async decrypt(ciphertext, inputs, ctx) {
688
750
  if (!ctx)
689
751
  return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("ctx"));
690
- if (isV2()) {
691
- if (!ctx.contextV2)
692
- return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("ctx.contextV2"));
693
- return ctx.contextV2.cryptoProvider.decrypt(ciphertext);
694
- }
695
- else {
696
- if (!ctx.solutionContext)
697
- return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("ctx.solutionContext"));
698
- return ctx.solutionContext.cryptoProvider.decrypt(ciphertext);
699
- }
752
+ if (!ctx.contextV2)
753
+ return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("ctx.contextV2"));
754
+ return ctx.contextV2.cryptoProvider.decrypt(ciphertext);
700
755
  }
701
756
  async buildArtifacts(inputs) {
702
757
  throw new error_1.TaskNotSupportError(teamsfx_api_1.Stage.build);
@@ -705,7 +760,7 @@ class FxCore {
705
760
  if (!ctx)
706
761
  return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("createEnv input stuff"));
707
762
  const projectSettings = ctx.projectSettings;
708
- if (!tools_1.isMultiEnvEnabled() || !projectSettings) {
763
+ if (!projectSettings) {
709
764
  return teamsfx_api_1.ok(teamsfx_api_1.Void);
710
765
  }
711
766
  const core = ctx.self;
@@ -721,21 +776,11 @@ class FxCore {
721
776
  }
722
777
  inputs.sourceEnvName = createEnvCopyInput.sourceEnvName;
723
778
  inputs.targetEnvName = createEnvCopyInput.targetEnvName;
724
- if (isV2()) {
725
- if (!ctx.solutionV2 || !ctx.contextV2)
726
- return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("ctx.solutionV2, ctx.contextV2"));
727
- if (ctx.solutionV2.createEnv) {
728
- inputs.copy = true;
729
- return await ctx.solutionV2.createEnv(ctx.contextV2, inputs);
730
- }
731
- }
732
- else {
733
- if (!ctx.solution || !ctx.solutionContext)
734
- return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("ctx.solution, ctx.solutionContext"));
735
- if (ctx.solution.createEnv) {
736
- ctx.solutionContext.answers.copy = true;
737
- return await ctx.solution.createEnv(ctx.solutionContext);
738
- }
779
+ if (!ctx.solutionV2 || !ctx.contextV2)
780
+ return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("ctx.solutionV2, ctx.contextV2"));
781
+ if (ctx.solutionV2.createEnv) {
782
+ inputs.copy = true;
783
+ return await ctx.solutionV2.createEnv(ctx.contextV2, inputs);
739
784
  }
740
785
  return teamsfx_api_1.ok(teamsfx_api_1.Void);
741
786
  }
@@ -759,7 +804,7 @@ class FxCore {
759
804
  catch (e) {
760
805
  return teamsfx_api_1.err(error_1.CopyFileError(e));
761
806
  }
762
- core.tools.logProvider.debug(`[core] copy env config file for ${targetEnvName} environment to path ${targetEnvConfigFilePath}`);
807
+ exports.TOOLS.logProvider.debug(`[core] copy env config file for ${targetEnvName} environment to path ${targetEnvConfigFilePath}`);
763
808
  return teamsfx_api_1.ok(teamsfx_api_1.Void);
764
809
  }
765
810
  // deprecated
@@ -768,7 +813,7 @@ class FxCore {
768
813
  if (!env) {
769
814
  return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("env"));
770
815
  }
771
- if (!tools_1.isMultiEnvEnabled() || !ctx.projectSettings) {
816
+ if (!ctx.projectSettings) {
772
817
  return teamsfx_api_1.ok(teamsfx_api_1.Void);
773
818
  }
774
819
  const envConfigs = await __1.environmentManager.listEnvConfigs(inputs.projectPath);
@@ -779,73 +824,78 @@ class FxCore {
779
824
  return teamsfx_api_1.err(error_1.NonExistEnvNameError(env));
780
825
  }
781
826
  const core = ctx.self;
782
- const solutionContext = await envInfoLoader_1.loadSolutionContext(core.tools, inputs, ctx.projectSettings, env);
827
+ const solutionContext = await envInfoLoader_1.loadSolutionContext(inputs, ctx.projectSettings, env);
783
828
  if (!solutionContext.isErr()) {
784
- if (isV2()) {
785
- //TODO core should not know the details of envInfo
786
- ctx.provisionInputConfig = solutionContext.value.envInfo.config;
787
- ctx.provisionOutputs = solutionContext.value.envInfo.state;
788
- ctx.envName = solutionContext.value.envInfo.envName;
789
- }
790
- else {
791
- ctx.solutionContext = solutionContext.value;
792
- }
829
+ ctx.provisionInputConfig = solutionContext.value.envInfo.config;
830
+ ctx.provisionOutputs = solutionContext.value.envInfo.state;
831
+ ctx.envName = solutionContext.value.envInfo.envName;
793
832
  }
794
833
  this.tools.ui.showMessage("info", `[${env}] is activated.`, false);
795
834
  return teamsfx_api_1.ok(teamsfx_api_1.Void);
796
835
  }
797
- async _getQuestionsForCreateProject(inputs) {
798
- const node = new teamsfx_api_1.QTreeNode(question_1.getCreateNewOrFromSampleQuestion(inputs.platform));
799
- // create new
800
- const createNew = new teamsfx_api_1.QTreeNode({ type: "group" });
801
- node.addChild(createNew);
802
- createNew.condition = { equals: question_1.ScratchOptionYes.id };
803
- const globalSolutions = isV2()
804
- ? await SolutionPluginContainer_1.getAllSolutionPluginsV2()
805
- : await SolutionPluginContainer_1.getAllSolutionPlugins();
806
- const solutionNames = globalSolutions.map((s) => s.name);
807
- const selectSolution = question_1.QuestionSelectSolution;
808
- selectSolution.staticOptions = solutionNames;
809
- const solutionSelectNode = new teamsfx_api_1.QTreeNode(selectSolution);
810
- createNew.addChild(solutionSelectNode);
811
- const context = isV2()
812
- ? createV2Context(this, newProjectSettings())
813
- : await projectSettingsLoader_1.newSolutionContext(this.tools, inputs);
814
- for (const solutionPlugin of globalSolutions) {
815
- let res = teamsfx_api_1.ok(undefined);
816
- if (isV2()) {
817
- const v2plugin = solutionPlugin;
818
- res = v2plugin.getQuestionsForScaffolding
819
- ? await v2plugin.getQuestionsForScaffolding(context, inputs)
820
- : teamsfx_api_1.ok(undefined);
821
- }
822
- else {
823
- const v1plugin = solutionPlugin;
824
- res = v1plugin.getQuestions
825
- ? await v1plugin.getQuestions(teamsfx_api_1.Stage.create, context)
826
- : teamsfx_api_1.ok(undefined);
827
- }
828
- if (res.isErr())
829
- return res;
830
- if (res.value) {
831
- const solutionNode = res.value;
832
- solutionNode.condition = { equals: solutionPlugin.name };
833
- if (solutionNode.data)
834
- solutionSelectNode.addChild(solutionNode);
835
- }
836
+ async _init(inputs, ctx) {
837
+ if (!ctx) {
838
+ return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("ctx for createProject"));
836
839
  }
837
- if (inputs.platform !== teamsfx_api_1.Platform.VSCode) {
838
- createNew.addChild(new teamsfx_api_1.QTreeNode(question_1.QuestionRootFolder));
840
+ const appName = inputs[question_2.QuestionAppName.name];
841
+ const validateResult = jsonschema.validate(appName, {
842
+ pattern: question_2.ProjectNamePattern,
843
+ });
844
+ if (validateResult.errors && validateResult.errors.length > 0) {
845
+ return teamsfx_api_1.err(error_1.InvalidInputError("invalid app-name", inputs));
839
846
  }
840
- createNew.addChild(new teamsfx_api_1.QTreeNode(question_1.QuestionAppName));
841
- // create from sample
842
- const sampleNode = new teamsfx_api_1.QTreeNode(question_1.SampleSelect);
843
- node.addChild(sampleNode);
844
- sampleNode.condition = { equals: question_1.ScratchOptionNo.id };
845
- if (inputs.platform !== teamsfx_api_1.Platform.VSCode) {
846
- sampleNode.addChild(new teamsfx_api_1.QTreeNode(question_1.QuestionRootFolder));
847
+ const projectSettings = newProjectSettings();
848
+ projectSettings.appName = appName;
849
+ ctx.projectSettings = projectSettings;
850
+ if (!inputs.solution) {
851
+ return teamsfx_api_1.err(error_1.InvalidInputError("solution is undefined", inputs));
847
852
  }
848
- return teamsfx_api_1.ok(node.trim());
853
+ const createEnvResult = await this.createEnvWithName(__1.environmentManager.getDefaultEnvName(), projectSettings, inputs);
854
+ if (createEnvResult.isErr()) {
855
+ return teamsfx_api_1.err(createEnvResult.error);
856
+ }
857
+ await fs.ensureDir(path.join(inputs.projectPath, `.${teamsfx_api_1.ConfigFolderName}`));
858
+ await fs.ensureDir(path.join(inputs.projectPath, "templates", `${teamsfx_api_1.AppPackageFolderName}`));
859
+ const basicFolderRes = await createBasicFolderStructure(inputs);
860
+ if (basicFolderRes.isErr()) {
861
+ return teamsfx_api_1.err(basicFolderRes.error);
862
+ }
863
+ const solution = typedi_1.Container.get(inputs.solution);
864
+ projectSettings.solutionSettings.name = inputs.solution;
865
+ const context = createV2Context(projectSettings);
866
+ ctx.contextV2 = context;
867
+ ctx.solutionV3 = solution;
868
+ return await solution.init(context, inputs);
869
+ }
870
+ async init(inputs, ctx) {
871
+ return this._init(inputs, ctx);
872
+ }
873
+ async _addModule(inputs, ctx) {
874
+ if (ctx && ctx.solutionV3 && ctx.contextV2) {
875
+ return await ctx.solutionV3.addModule(ctx.contextV2, {}, inputs);
876
+ }
877
+ return teamsfx_api_1.ok(teamsfx_api_1.Void);
878
+ }
879
+ async addModule(inputs, ctx) {
880
+ return this._addModule(inputs, ctx);
881
+ }
882
+ async scaffold(inputs, ctx) {
883
+ return this._scaffold(inputs, ctx);
884
+ }
885
+ async _scaffold(inputs, ctx) {
886
+ if (ctx && ctx.solutionV3 && ctx.contextV2) {
887
+ return await ctx.solutionV3.scaffold(ctx.contextV2, inputs);
888
+ }
889
+ return teamsfx_api_1.ok(teamsfx_api_1.Void);
890
+ }
891
+ async addResource(inputs, ctx) {
892
+ return this._addResource(inputs, ctx);
893
+ }
894
+ async _addResource(inputs, ctx) {
895
+ if (ctx && ctx.solutionV3 && ctx.contextV2) {
896
+ return await ctx.solutionV3.addResource(ctx.contextV2, inputs);
897
+ }
898
+ return teamsfx_api_1.ok(teamsfx_api_1.Void);
849
899
  }
850
900
  }
851
901
  tslib_1.__decorate([
@@ -860,7 +910,20 @@ tslib_1.__decorate([
860
910
  tslib_1.__metadata("design:type", Function),
861
911
  tslib_1.__metadata("design:paramtypes", [Object, Object]),
862
912
  tslib_1.__metadata("design:returntype", Promise)
863
- ], FxCore.prototype, "createProject", null);
913
+ ], FxCore.prototype, "createProjectV2", null);
914
+ tslib_1.__decorate([
915
+ hooks_1.hooks([
916
+ errorHandler_1.ErrorHandlerMW,
917
+ supportV1ConditionHandler_1.SupportV1ConditionMW(true),
918
+ questionModel_1.QuestionModelMW,
919
+ contextInjector_1.ContextInjectorMW,
920
+ projectSettingsWriter_1.ProjectSettingsWriterMW,
921
+ envInfoWriterV3_1.EnvInfoWriterMW_V3(true),
922
+ ]),
923
+ tslib_1.__metadata("design:type", Function),
924
+ tslib_1.__metadata("design:paramtypes", [Object, Object]),
925
+ tslib_1.__metadata("design:returntype", Promise)
926
+ ], FxCore.prototype, "createProjectV3", null);
864
927
  tslib_1.__decorate([
865
928
  hooks_1.hooks([
866
929
  errorHandler_1.ErrorHandlerMW,
@@ -883,7 +946,7 @@ tslib_1.__decorate([
883
946
  projectMigrator_1.ProjectMigratorMW,
884
947
  projectSettingsLoader_1.ProjectSettingsLoaderMW,
885
948
  envInfoLoader_1.EnvInfoLoaderMW(false),
886
- solutionLoader_1.SolutionLoaderMW(),
949
+ solutionLoader_1.SolutionLoaderMW,
887
950
  questionModel_1.QuestionModelMW,
888
951
  contextInjector_1.ContextInjectorMW,
889
952
  projectSettingsWriter_1.ProjectSettingsWriterMW,
@@ -892,7 +955,25 @@ tslib_1.__decorate([
892
955
  tslib_1.__metadata("design:type", Function),
893
956
  tslib_1.__metadata("design:paramtypes", [Object, Object]),
894
957
  tslib_1.__metadata("design:returntype", Promise)
895
- ], FxCore.prototype, "provisionResources", null);
958
+ ], FxCore.prototype, "provisionResourcesV2", null);
959
+ tslib_1.__decorate([
960
+ hooks_1.hooks([
961
+ errorHandler_1.ErrorHandlerMW,
962
+ concurrentLocker_1.ConcurrentLockerMW,
963
+ supportV1ConditionHandler_1.SupportV1ConditionMW(false),
964
+ projectMigrator_1.ProjectMigratorMW,
965
+ projectSettingsLoaderV3_1.ProjectSettingsLoaderMW_V3,
966
+ envInfoLoaderV3_1.EnvInfoLoaderMW_V3(false),
967
+ solutionLoaderV3_1.SolutionLoaderMW_V3,
968
+ questionModel_1.QuestionModelMW,
969
+ contextInjector_1.ContextInjectorMW,
970
+ projectSettingsWriter_1.ProjectSettingsWriterMW,
971
+ envInfoWriterV3_1.EnvInfoWriterMW_V3(),
972
+ ]),
973
+ tslib_1.__metadata("design:type", Function),
974
+ tslib_1.__metadata("design:paramtypes", [Object, Object]),
975
+ tslib_1.__metadata("design:returntype", Promise)
976
+ ], FxCore.prototype, "provisionResourcesV3", null);
896
977
  tslib_1.__decorate([
897
978
  hooks_1.hooks([
898
979
  errorHandler_1.ErrorHandlerMW,
@@ -901,7 +982,7 @@ tslib_1.__decorate([
901
982
  projectMigrator_1.ProjectMigratorMW,
902
983
  projectSettingsLoader_1.ProjectSettingsLoaderMW,
903
984
  envInfoLoader_1.EnvInfoLoaderMW(false),
904
- solutionLoader_1.SolutionLoaderMW(),
985
+ solutionLoader_1.SolutionLoaderMW,
905
986
  questionModel_1.QuestionModelMW,
906
987
  contextInjector_1.ContextInjectorMW,
907
988
  projectSettingsWriter_1.ProjectSettingsWriterMW,
@@ -910,7 +991,25 @@ tslib_1.__decorate([
910
991
  tslib_1.__metadata("design:type", Function),
911
992
  tslib_1.__metadata("design:paramtypes", [Object, Object]),
912
993
  tslib_1.__metadata("design:returntype", Promise)
913
- ], FxCore.prototype, "deployArtifacts", null);
994
+ ], FxCore.prototype, "deployArtifactsV2", null);
995
+ tslib_1.__decorate([
996
+ hooks_1.hooks([
997
+ errorHandler_1.ErrorHandlerMW,
998
+ concurrentLocker_1.ConcurrentLockerMW,
999
+ supportV1ConditionHandler_1.SupportV1ConditionMW(false),
1000
+ projectMigrator_1.ProjectMigratorMW,
1001
+ projectSettingsLoaderV3_1.ProjectSettingsLoaderMW_V3,
1002
+ envInfoLoaderV3_1.EnvInfoLoaderMW_V3(false),
1003
+ solutionLoaderV3_1.SolutionLoaderMW_V3,
1004
+ questionModel_1.QuestionModelMW,
1005
+ contextInjector_1.ContextInjectorMW,
1006
+ projectSettingsWriter_1.ProjectSettingsWriterMW,
1007
+ envInfoWriterV3_1.EnvInfoWriterMW_V3(),
1008
+ ]),
1009
+ tslib_1.__metadata("design:type", Function),
1010
+ tslib_1.__metadata("design:paramtypes", [Object, Object]),
1011
+ tslib_1.__metadata("design:returntype", Promise)
1012
+ ], FxCore.prototype, "deployArtifactsV3", null);
914
1013
  tslib_1.__decorate([
915
1014
  hooks_1.hooks([
916
1015
  errorHandler_1.ErrorHandlerMW,
@@ -921,7 +1020,7 @@ tslib_1.__decorate([
921
1020
  projectSettingsLoader_1.ProjectSettingsLoaderMW,
922
1021
  envInfoLoader_1.EnvInfoLoaderMW(true),
923
1022
  localSettingsLoader_1.LocalSettingsLoaderMW,
924
- solutionLoader_1.SolutionLoaderMW(),
1023
+ solutionLoader_1.SolutionLoaderMW,
925
1024
  questionModel_1.QuestionModelMW,
926
1025
  contextInjector_1.ContextInjectorMW,
927
1026
  projectSettingsWriter_1.ProjectSettingsWriterMW,
@@ -931,7 +1030,44 @@ tslib_1.__decorate([
931
1030
  tslib_1.__metadata("design:type", Function),
932
1031
  tslib_1.__metadata("design:paramtypes", [Object, Object]),
933
1032
  tslib_1.__metadata("design:returntype", Promise)
934
- ], FxCore.prototype, "localDebug", null);
1033
+ ], FxCore.prototype, "localDebugV2", null);
1034
+ tslib_1.__decorate([
1035
+ hooks_1.hooks([
1036
+ errorHandler_1.ErrorHandlerMW,
1037
+ concurrentLocker_1.ConcurrentLockerMW,
1038
+ supportV1ConditionHandler_1.SupportV1ConditionMW(true),
1039
+ projectMigrator_1.ProjectMigratorMW,
1040
+ projectUpgrader_1.ProjectUpgraderMW,
1041
+ projectSettingsLoaderV3_1.ProjectSettingsLoaderMW_V3,
1042
+ localSettingsLoader_1.LocalSettingsLoaderMW,
1043
+ solutionLoaderV3_1.SolutionLoaderMW_V3,
1044
+ questionModel_1.QuestionModelMW,
1045
+ contextInjector_1.ContextInjectorMW,
1046
+ projectSettingsWriter_1.ProjectSettingsWriterMW,
1047
+ localSettingsWriter_1.LocalSettingsWriterMW,
1048
+ ]),
1049
+ tslib_1.__metadata("design:type", Function),
1050
+ tslib_1.__metadata("design:paramtypes", [Object, Object]),
1051
+ tslib_1.__metadata("design:returntype", Promise)
1052
+ ], FxCore.prototype, "localDebugV3", null);
1053
+ tslib_1.__decorate([
1054
+ hooks_1.hooks([
1055
+ errorHandler_1.ErrorHandlerMW,
1056
+ concurrentLocker_1.ConcurrentLockerMW,
1057
+ supportV1ConditionHandler_1.SupportV1ConditionMW(false),
1058
+ projectMigrator_1.ProjectMigratorMW,
1059
+ projectSettingsLoader_1.ProjectSettingsLoaderMW,
1060
+ envInfoLoader_1.EnvInfoLoaderMW(false),
1061
+ solutionLoader_1.SolutionLoaderMW,
1062
+ questionModel_1.QuestionModelMW,
1063
+ contextInjector_1.ContextInjectorMW,
1064
+ projectSettingsWriter_1.ProjectSettingsWriterMW,
1065
+ envInfoWriter_1.EnvInfoWriterMW(),
1066
+ ]),
1067
+ tslib_1.__metadata("design:type", Function),
1068
+ tslib_1.__metadata("design:paramtypes", [Object, Object]),
1069
+ tslib_1.__metadata("design:returntype", Promise)
1070
+ ], FxCore.prototype, "publishApplicationV2", null);
935
1071
  tslib_1.__decorate([
936
1072
  hooks_1.hooks([
937
1073
  errorHandler_1.ErrorHandlerMW,
@@ -940,7 +1076,7 @@ tslib_1.__decorate([
940
1076
  projectMigrator_1.ProjectMigratorMW,
941
1077
  projectSettingsLoader_1.ProjectSettingsLoaderMW,
942
1078
  envInfoLoader_1.EnvInfoLoaderMW(false),
943
- solutionLoader_1.SolutionLoaderMW(),
1079
+ solutionLoader_1.SolutionLoaderMW,
944
1080
  questionModel_1.QuestionModelMW,
945
1081
  contextInjector_1.ContextInjectorMW,
946
1082
  projectSettingsWriter_1.ProjectSettingsWriterMW,
@@ -949,7 +1085,7 @@ tslib_1.__decorate([
949
1085
  tslib_1.__metadata("design:type", Function),
950
1086
  tslib_1.__metadata("design:paramtypes", [Object, Object]),
951
1087
  tslib_1.__metadata("design:returntype", Promise)
952
- ], FxCore.prototype, "publishApplication", null);
1088
+ ], FxCore.prototype, "publishApplicationV3", null);
953
1089
  tslib_1.__decorate([
954
1090
  hooks_1.hooks([
955
1091
  errorHandler_1.ErrorHandlerMW,
@@ -959,7 +1095,7 @@ tslib_1.__decorate([
959
1095
  projectSettingsLoader_1.ProjectSettingsLoaderMW,
960
1096
  envInfoLoader_1.EnvInfoLoaderMW(false),
961
1097
  localSettingsLoader_1.LocalSettingsLoaderMW,
962
- solutionLoader_1.SolutionLoaderMW(),
1098
+ solutionLoader_1.SolutionLoaderMW,
963
1099
  questionModel_1.QuestionModelMW,
964
1100
  contextInjector_1.ContextInjectorMW,
965
1101
  projectSettingsWriter_1.ProjectSettingsWriterMW,
@@ -976,7 +1112,7 @@ tslib_1.__decorate([
976
1112
  supportV1ConditionHandler_1.SupportV1ConditionMW(true),
977
1113
  projectSettingsLoader_1.ProjectSettingsLoaderMW,
978
1114
  envInfoLoader_1.EnvInfoLoaderMW(true),
979
- solutionLoader_1.SolutionLoaderMW(),
1115
+ solutionLoader_1.SolutionLoaderMW,
980
1116
  contextInjector_1.ContextInjectorMW,
981
1117
  envInfoWriter_1.EnvInfoWriterMW(),
982
1118
  ]),
@@ -991,7 +1127,7 @@ tslib_1.__decorate([
991
1127
  supportV1ConditionHandler_1.SupportV1ConditionMW(true),
992
1128
  projectSettingsLoader_1.ProjectSettingsLoaderMW,
993
1129
  envInfoLoader_1.EnvInfoLoaderMW(true),
994
- solutionLoader_1.SolutionLoaderMW(),
1130
+ solutionLoader_1.SolutionLoaderMW,
995
1131
  contextInjector_1.ContextInjectorMW,
996
1132
  envInfoWriter_1.EnvInfoWriterMW(),
997
1133
  ]),
@@ -1022,7 +1158,7 @@ tslib_1.__decorate([
1022
1158
  projectMigrator_1.ProjectMigratorMW,
1023
1159
  projectSettingsLoader_1.ProjectSettingsLoaderMW,
1024
1160
  envInfoLoader_1.EnvInfoLoaderMW(false),
1025
- solutionLoader_1.SolutionLoaderMW(),
1161
+ solutionLoader_1.SolutionLoaderMW,
1026
1162
  questionModel_1.QuestionModelMW,
1027
1163
  contextInjector_1.ContextInjectorMW,
1028
1164
  ]),
@@ -1038,7 +1174,7 @@ tslib_1.__decorate([
1038
1174
  projectMigrator_1.ProjectMigratorMW,
1039
1175
  projectSettingsLoader_1.ProjectSettingsLoaderMW,
1040
1176
  envInfoLoader_1.EnvInfoLoaderMW(false),
1041
- solutionLoader_1.SolutionLoaderMW(),
1177
+ solutionLoader_1.SolutionLoaderMW,
1042
1178
  questionModel_1.QuestionModelMW,
1043
1179
  contextInjector_1.ContextInjectorMW,
1044
1180
  ]),
@@ -1054,7 +1190,7 @@ tslib_1.__decorate([
1054
1190
  projectMigrator_1.ProjectMigratorMW,
1055
1191
  projectSettingsLoader_1.ProjectSettingsLoaderMW,
1056
1192
  envInfoLoader_1.EnvInfoLoaderMW(false),
1057
- solutionLoader_1.SolutionLoaderMW(),
1193
+ solutionLoader_1.SolutionLoaderMW,
1058
1194
  questionModel_1.QuestionModelMW,
1059
1195
  contextInjector_1.ContextInjectorMW,
1060
1196
  ]),
@@ -1069,7 +1205,7 @@ tslib_1.__decorate([
1069
1205
  supportV1ConditionHandler_1.SupportV1ConditionMW(true),
1070
1206
  projectSettingsLoader_1.ProjectSettingsLoaderMW,
1071
1207
  envInfoLoader_1.EnvInfoLoaderMW(true),
1072
- solutionLoader_1.SolutionLoaderMW(),
1208
+ solutionLoader_1.SolutionLoaderMW,
1073
1209
  questionModel_1.QuestionModelMW,
1074
1210
  contextInjector_1.ContextInjectorMW,
1075
1211
  ]),
@@ -1121,7 +1257,7 @@ tslib_1.__decorate([
1121
1257
  concurrentLocker_1.ConcurrentLockerMW,
1122
1258
  supportV1ConditionHandler_1.SupportV1ConditionMW(false),
1123
1259
  projectSettingsLoader_1.ProjectSettingsLoaderMW,
1124
- solutionLoader_1.SolutionLoaderMW(),
1260
+ solutionLoader_1.SolutionLoaderMW,
1125
1261
  envInfoLoader_1.EnvInfoLoaderMW(true),
1126
1262
  contextInjector_1.ContextInjectorMW,
1127
1263
  ]),
@@ -1136,7 +1272,7 @@ tslib_1.__decorate([
1136
1272
  supportV1ConditionHandler_1.SupportV1ConditionMW(true),
1137
1273
  projectMigrator_1.ProjectMigratorMW,
1138
1274
  projectSettingsLoader_1.ProjectSettingsLoaderMW,
1139
- solutionLoader_1.SolutionLoaderMW(),
1275
+ solutionLoader_1.SolutionLoaderMW,
1140
1276
  contextInjector_1.ContextInjectorMW,
1141
1277
  projectSettingsWriter_1.ProjectSettingsWriterMW,
1142
1278
  ]),
@@ -1144,39 +1280,84 @@ tslib_1.__decorate([
1144
1280
  tslib_1.__metadata("design:paramtypes", [Object, Object]),
1145
1281
  tslib_1.__metadata("design:returntype", Promise)
1146
1282
  ], FxCore.prototype, "activateEnv", null);
1283
+ tslib_1.__decorate([
1284
+ hooks_1.hooks([errorHandler_1.ErrorHandlerMW, questionModel_1.QuestionModelMW, contextInjector_1.ContextInjectorMW, projectSettingsWriter_1.ProjectSettingsWriterMW]),
1285
+ tslib_1.__metadata("design:type", Function),
1286
+ tslib_1.__metadata("design:paramtypes", [Object, Object]),
1287
+ tslib_1.__metadata("design:returntype", Promise)
1288
+ ], FxCore.prototype, "init", null);
1289
+ tslib_1.__decorate([
1290
+ hooks_1.hooks([
1291
+ errorHandler_1.ErrorHandlerMW,
1292
+ projectSettingsLoaderV3_1.ProjectSettingsLoaderMW_V3,
1293
+ solutionLoaderV3_1.SolutionLoaderMW_V3,
1294
+ questionModel_1.QuestionModelMW,
1295
+ contextInjector_1.ContextInjectorMW,
1296
+ projectSettingsWriter_1.ProjectSettingsWriterMW,
1297
+ ]),
1298
+ tslib_1.__metadata("design:type", Function),
1299
+ tslib_1.__metadata("design:paramtypes", [Object, Object]),
1300
+ tslib_1.__metadata("design:returntype", Promise)
1301
+ ], FxCore.prototype, "addModule", null);
1302
+ tslib_1.__decorate([
1303
+ hooks_1.hooks([
1304
+ errorHandler_1.ErrorHandlerMW,
1305
+ projectSettingsLoaderV3_1.ProjectSettingsLoaderMW_V3,
1306
+ solutionLoaderV3_1.SolutionLoaderMW_V3,
1307
+ questionModel_1.QuestionModelMW,
1308
+ contextInjector_1.ContextInjectorMW,
1309
+ projectSettingsWriter_1.ProjectSettingsWriterMW,
1310
+ ]),
1311
+ tslib_1.__metadata("design:type", Function),
1312
+ tslib_1.__metadata("design:paramtypes", [Object, Object]),
1313
+ tslib_1.__metadata("design:returntype", Promise)
1314
+ ], FxCore.prototype, "scaffold", null);
1315
+ tslib_1.__decorate([
1316
+ hooks_1.hooks([
1317
+ errorHandler_1.ErrorHandlerMW,
1318
+ projectSettingsLoaderV3_1.ProjectSettingsLoaderMW_V3,
1319
+ solutionLoaderV3_1.SolutionLoaderMW_V3,
1320
+ questionModel_1.QuestionModelMW,
1321
+ contextInjector_1.ContextInjectorMW,
1322
+ projectSettingsWriter_1.ProjectSettingsWriterMW,
1323
+ ]),
1324
+ tslib_1.__metadata("design:type", Function),
1325
+ tslib_1.__metadata("design:paramtypes", [Object, Object]),
1326
+ tslib_1.__metadata("design:returntype", Promise)
1327
+ ], FxCore.prototype, "addResource", null);
1147
1328
  exports.FxCore = FxCore;
1148
1329
  async function createBasicFolderStructure(inputs) {
1149
1330
  if (!inputs.projectPath) {
1150
1331
  return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("projectPath"));
1151
1332
  }
1152
1333
  try {
1153
- const appName = inputs[question_1.QuestionAppName.name];
1154
- await fs.writeFile(path.join(inputs.projectPath, `package.json`), JSON.stringify({
1155
- name: appName,
1156
- version: "0.0.1",
1157
- description: "",
1158
- author: "",
1159
- scripts: {
1160
- test: 'echo "Error: no test specified" && exit 1',
1161
- },
1162
- devDependencies: {
1163
- "@microsoft/teamsfx-cli": "0.*",
1164
- },
1165
- license: "MIT",
1166
- }, null, 4));
1167
- await fs.writeFile(path.join(inputs.projectPath, `.gitignore`), tools_1.isMultiEnvEnabled()
1168
- ? [
1169
- "node_modules",
1170
- `.${teamsfx_api_1.ConfigFolderName}/${teamsfx_api_1.InputConfigsFolderName}/${localSettingsProvider_1.localSettingsFileName}`,
1171
- `.${teamsfx_api_1.ConfigFolderName}/${teamsfx_api_1.StatesFolderName}/*.userdata`,
1172
- ".DS_Store",
1173
- `${teamsfx_api_1.ArchiveFolderName}`,
1174
- `${teamsfx_api_1.ArchiveLogFileName}`,
1175
- ".env.teamsfx.local",
1176
- "subscriptionInfo.json",
1177
- teamsfx_api_1.BuildFolderName,
1178
- ].join("\n")
1179
- : `node_modules\n/.${teamsfx_api_1.ConfigFolderName}/*.env\n/.${teamsfx_api_1.ConfigFolderName}/*.userdata\n.DS_Store\n${teamsfx_api_1.ArchiveFolderName}\n${teamsfx_api_1.ArchiveLogFileName}`);
1334
+ const appName = inputs[question_2.QuestionAppName.name];
1335
+ if (inputs.platform !== teamsfx_api_1.Platform.VS) {
1336
+ await fs.writeFile(path.join(inputs.projectPath, `package.json`), JSON.stringify({
1337
+ name: appName,
1338
+ version: "0.0.1",
1339
+ description: "",
1340
+ author: "",
1341
+ scripts: {
1342
+ test: 'echo "Error: no test specified" && exit 1',
1343
+ },
1344
+ devDependencies: {
1345
+ "@microsoft/teamsfx-cli": "0.*",
1346
+ },
1347
+ license: "MIT",
1348
+ }, null, 4));
1349
+ }
1350
+ await fs.writeFile(path.join(inputs.projectPath, `.gitignore`), [
1351
+ "node_modules",
1352
+ `.${teamsfx_api_1.ConfigFolderName}/${teamsfx_api_1.InputConfigsFolderName}/${localSettingsProvider_1.localSettingsFileName}`,
1353
+ `.${teamsfx_api_1.ConfigFolderName}/${teamsfx_api_1.StatesFolderName}/*.userdata`,
1354
+ ".DS_Store",
1355
+ `${teamsfx_api_1.ArchiveFolderName}`,
1356
+ `${teamsfx_api_1.ArchiveLogFileName}`,
1357
+ ".env.teamsfx.local",
1358
+ "subscriptionInfo.json",
1359
+ teamsfx_api_1.BuildFolderName,
1360
+ ].join("\n"));
1180
1361
  }
1181
1362
  catch (e) {
1182
1363
  return teamsfx_api_1.err(error_1.WriteFileError(e));
@@ -1184,23 +1365,23 @@ async function createBasicFolderStructure(inputs) {
1184
1365
  return teamsfx_api_1.ok(null);
1185
1366
  }
1186
1367
  exports.createBasicFolderStructure = createBasicFolderStructure;
1187
- async function downloadSample(fxCore, inputs, ctx) {
1368
+ async function downloadSample(inputs, ctx) {
1188
1369
  let fxError;
1189
- const progress = fxCore.tools.ui.createProgressBar("Fetch sample app", 3);
1370
+ const progress = exports.TOOLS.ui.createProgressBar("Fetch sample app", 3);
1190
1371
  progress.start();
1191
1372
  const telemetryProperties = {
1192
1373
  [telemetry_1.TelemetryProperty.Success]: telemetry_1.TelemetrySuccess.Yes,
1193
1374
  module: "fx-core",
1194
1375
  };
1195
1376
  try {
1196
- let folder = inputs[question_1.QuestionRootFolder.name];
1377
+ let folder = inputs[question_2.QuestionRootFolder.name];
1197
1378
  if (inputs.platform === teamsfx_api_1.Platform.VSCode) {
1198
1379
  folder = tools_1.getRootDirectory();
1199
1380
  await fs.ensureDir(folder);
1200
1381
  }
1201
- const sampleId = inputs[question_1.CoreQuestionNames.Samples];
1382
+ const sampleId = inputs[question_2.CoreQuestionNames.Samples];
1202
1383
  if (!(sampleId && folder)) {
1203
- throw error_1.InvalidInputError(`invalid answer for '${question_1.CoreQuestionNames.Samples}'`, inputs);
1384
+ throw error_1.InvalidInputError(`invalid answer for '${question_2.CoreQuestionNames.Samples}'`, inputs);
1204
1385
  }
1205
1386
  telemetryProperties[telemetry_1.TelemetryProperty.SampleAppName] = sampleId;
1206
1387
  const samples = __1.sampleProvider.SampleCollection.samples.filter((sample) => sample.id.toLowerCase() === sampleId.toLowerCase());
@@ -1217,24 +1398,32 @@ async function downloadSample(fxCore, inputs, ctx) {
1217
1398
  }
1218
1399
  }
1219
1400
  progress.next(`Downloading from ${url}`);
1220
- const fetchRes = await tools_1.fetchCodeZip(url);
1221
- if (fetchRes === undefined) {
1222
- throw new teamsfx_api_1.SystemError("FetchSampleError", "Fetch sample app error: empty zip file", error_1.CoreSource);
1401
+ const fetchRes = await tools_1.fetchCodeZip(url, sample.id);
1402
+ if (fetchRes.isErr()) {
1403
+ throw fetchRes.error;
1404
+ }
1405
+ else if (!fetchRes.value) {
1406
+ throw error_1.FetchSampleError(sample.id);
1223
1407
  }
1224
1408
  progress.next("Unzipping the sample package");
1225
- await tools_1.saveFilesRecursively(new adm_zip_1.default(fetchRes.data), sampleId, sampleAppPath);
1409
+ await tools_1.saveFilesRecursively(new adm_zip_1.default(fetchRes.value.data), sampleId, sampleAppPath);
1226
1410
  await tools_1.downloadSampleHook(sampleId, sampleAppPath);
1227
1411
  progress.next("Update project settings");
1228
1412
  const loadInputs = Object.assign(Object.assign({}, inputs), { projectPath: sampleAppPath });
1229
- const projectSettingsRes = await projectSettingsLoader_1.loadProjectSettings(loadInputs, tools_1.isMultiEnvEnabled());
1413
+ const projectSettingsRes = await projectSettingsLoader_1.loadProjectSettings(loadInputs, true);
1230
1414
  if (projectSettingsRes.isOk()) {
1231
1415
  const projectSettings = projectSettingsRes.value;
1232
1416
  projectSettings.projectId = inputs.projectId ? inputs.projectId : uuid.v4();
1417
+ projectSettings.isFromSample = true;
1233
1418
  inputs.projectId = projectSettings.projectId;
1234
1419
  telemetryProperties[telemetry_1.TelemetryProperty.ProjectId] = projectSettings.projectId;
1235
1420
  ctx.projectSettings = projectSettings;
1236
1421
  inputs.projectPath = sampleAppPath;
1237
1422
  }
1423
+ else {
1424
+ telemetryProperties[telemetry_1.TelemetryProperty.ProjectId] =
1425
+ "unknown, failed to set projectId in projectSettings.json";
1426
+ }
1238
1427
  progress.end(true);
1239
1428
  telemetry_1.sendTelemetryEvent(telemetry_1.Component.core, telemetry_1.TelemetryEvent.DownloadSample, telemetryProperties);
1240
1429
  return teamsfx_api_1.ok(sampleAppPath);
@@ -1260,13 +1449,13 @@ function newProjectSettings() {
1260
1449
  return projectSettings;
1261
1450
  }
1262
1451
  exports.newProjectSettings = newProjectSettings;
1263
- function createV2Context(core, projectSettings) {
1452
+ function createV2Context(projectSettings) {
1264
1453
  const context = {
1265
- userInteraction: core.tools.ui,
1266
- logProvider: core.tools.logProvider,
1267
- telemetryReporter: core.tools.telemetryReporter,
1454
+ userInteraction: exports.TOOLS.ui,
1455
+ logProvider: exports.TOOLS.logProvider,
1456
+ telemetryReporter: exports.TOOLS.telemetryReporter,
1268
1457
  cryptoProvider: new crypto_1.LocalCrypto(projectSettings.projectId),
1269
- permissionRequestProvider: core.tools.permissionRequest,
1458
+ permissionRequestProvider: exports.TOOLS.permissionRequest,
1270
1459
  projectSetting: projectSettings,
1271
1460
  };
1272
1461
  return context;
@@ -1282,10 +1471,7 @@ function undefinedName(objs, names) {
1282
1471
  }
1283
1472
  exports.undefinedName = undefinedName;
1284
1473
  function getProjectSettingsVersion() {
1285
- if (tools_1.isMultiEnvEnabled())
1286
- return "2.0.0";
1287
- else
1288
- return "1.0.0";
1474
+ return "2.0.0";
1289
1475
  }
1290
1476
  exports.getProjectSettingsVersion = getProjectSettingsVersion;
1291
1477
  tslib_1.__exportStar(require("./error"), exports);