@microsoft/teamsfx-core 0.7.0 → 0.7.1-alpha.5e8f6dea.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 (494) hide show
  1. package/build/common/constants.d.ts +5 -0
  2. package/build/common/constants.d.ts.map +1 -1
  3. package/build/common/constants.js +6 -1
  4. package/build/common/constants.js.map +1 -1
  5. package/build/common/fileUtils.d.ts.map +1 -1
  6. package/build/common/fileUtils.js +12 -6
  7. package/build/common/fileUtils.js.map +1 -1
  8. package/build/common/localSettingsProvider.d.ts +4 -2
  9. package/build/common/localSettingsProvider.d.ts.map +1 -1
  10. package/build/common/localSettingsProvider.js +32 -1
  11. package/build/common/localSettingsProvider.js.map +1 -1
  12. package/build/common/templates.d.ts.map +1 -1
  13. package/build/common/templates.js +9 -9
  14. package/build/common/templates.js.map +1 -1
  15. package/build/common/templatesActions.d.ts +39 -0
  16. package/build/common/templatesActions.d.ts.map +1 -0
  17. package/build/common/templatesActions.js +120 -0
  18. package/build/common/templatesActions.js.map +1 -0
  19. package/build/common/templatesUtils.d.ts +14 -0
  20. package/build/common/templatesUtils.d.ts.map +1 -0
  21. package/build/common/templatesUtils.js +94 -0
  22. package/build/common/templatesUtils.js.map +1 -0
  23. package/build/common/tools.d.ts +12 -2
  24. package/build/common/tools.d.ts.map +1 -1
  25. package/build/common/tools.js +52 -7
  26. package/build/common/tools.js.map +1 -1
  27. package/build/core/SolutionPluginContainer.d.ts +15 -0
  28. package/build/core/SolutionPluginContainer.d.ts.map +1 -0
  29. package/build/core/SolutionPluginContainer.js +54 -0
  30. package/build/core/SolutionPluginContainer.js.map +1 -0
  31. package/build/core/callback.d.ts +9 -0
  32. package/build/core/callback.d.ts.map +1 -0
  33. package/build/core/callback.js +33 -0
  34. package/build/core/callback.js.map +1 -0
  35. package/build/core/environment.d.ts +7 -3
  36. package/build/core/environment.d.ts.map +1 -1
  37. package/build/core/environment.js +68 -13
  38. package/build/core/environment.js.map +1 -1
  39. package/build/core/error.d.ts +19 -2
  40. package/build/core/error.d.ts.map +1 -1
  41. package/build/core/error.js +72 -34
  42. package/build/core/error.js.map +1 -1
  43. package/build/core/index.d.ts +24 -12
  44. package/build/core/index.d.ts.map +1 -1
  45. package/build/core/index.js +604 -309
  46. package/build/core/index.js.map +1 -1
  47. package/build/core/middleware/concurrentLocker.d.ts.map +1 -1
  48. package/build/core/middleware/concurrentLocker.js +13 -6
  49. package/build/core/middleware/concurrentLocker.js.map +1 -1
  50. package/build/core/middleware/contextInjector.d.ts +3 -0
  51. package/build/core/middleware/contextInjector.d.ts.map +1 -0
  52. package/build/core/middleware/{contextInjecter.js → contextInjector.js} +4 -4
  53. package/build/core/middleware/contextInjector.js.map +1 -0
  54. package/build/core/middleware/envInfoLoader.d.ts +8 -4
  55. package/build/core/middleware/envInfoLoader.d.ts.map +1 -1
  56. package/build/core/middleware/envInfoLoader.js +77 -40
  57. package/build/core/middleware/envInfoLoader.js.map +1 -1
  58. package/build/core/middleware/envInfoWriter.d.ts +1 -1
  59. package/build/core/middleware/envInfoWriter.d.ts.map +1 -1
  60. package/build/core/middleware/envInfoWriter.js +30 -13
  61. package/build/core/middleware/envInfoWriter.js.map +1 -1
  62. package/build/core/middleware/localSettingsLoader.d.ts.map +1 -1
  63. package/build/core/middleware/localSettingsLoader.js +18 -8
  64. package/build/core/middleware/localSettingsLoader.js.map +1 -1
  65. package/build/core/middleware/localSettingsWriter.d.ts.map +1 -1
  66. package/build/core/middleware/localSettingsWriter.js +14 -5
  67. package/build/core/middleware/localSettingsWriter.js.map +1 -1
  68. package/build/core/middleware/projectMigrator.d.ts +5 -0
  69. package/build/core/middleware/projectMigrator.d.ts.map +1 -0
  70. package/build/core/middleware/projectMigrator.js +382 -0
  71. package/build/core/middleware/projectMigrator.js.map +1 -0
  72. package/build/core/middleware/projectSettingsLoader.d.ts +2 -2
  73. package/build/core/middleware/projectSettingsLoader.d.ts.map +1 -1
  74. package/build/core/middleware/projectSettingsLoader.js +13 -9
  75. package/build/core/middleware/projectSettingsLoader.js.map +1 -1
  76. package/build/core/middleware/projectSettingsWriter.d.ts.map +1 -1
  77. package/build/core/middleware/projectSettingsWriter.js +6 -7
  78. package/build/core/middleware/projectSettingsWriter.js.map +1 -1
  79. package/build/core/middleware/projectUpgrader.d.ts.map +1 -1
  80. package/build/core/middleware/projectUpgrader.js +15 -7
  81. package/build/core/middleware/projectUpgrader.js.map +1 -1
  82. package/build/core/middleware/questionModel.d.ts.map +1 -1
  83. package/build/core/middleware/questionModel.js +25 -17
  84. package/build/core/middleware/questionModel.js.map +1 -1
  85. package/build/core/middleware/solutionLoader.d.ts +1 -2
  86. package/build/core/middleware/solutionLoader.d.ts.map +1 -1
  87. package/build/core/middleware/solutionLoader.js +24 -4
  88. package/build/core/middleware/solutionLoader.js.map +1 -1
  89. package/build/core/question.d.ts +2 -0
  90. package/build/core/question.d.ts.map +1 -1
  91. package/build/core/question.js +12 -1
  92. package/build/core/question.js.map +1 -1
  93. package/build/core/tools.d.ts +2 -2
  94. package/build/core/tools.d.ts.map +1 -1
  95. package/build/core/tools.js +15 -5
  96. package/build/core/tools.js.map +1 -1
  97. package/build/index.d.ts +1 -0
  98. package/build/index.d.ts.map +1 -1
  99. package/build/index.js +1 -0
  100. package/build/index.js.map +1 -1
  101. package/build/plugins/resource/aad/appStudio.js +1 -1
  102. package/build/plugins/resource/aad/appStudio.js.map +1 -1
  103. package/build/plugins/resource/aad/errors.d.ts.map +1 -1
  104. package/build/plugins/resource/aad/errors.js +1 -0
  105. package/build/plugins/resource/aad/errors.js.map +1 -1
  106. package/build/plugins/resource/aad/index.d.ts +1 -0
  107. package/build/plugins/resource/aad/index.d.ts.map +1 -1
  108. package/build/plugins/resource/aad/index.js +2 -1
  109. package/build/plugins/resource/aad/index.js.map +1 -1
  110. package/build/plugins/resource/aad/utils/configs.d.ts.map +1 -1
  111. package/build/plugins/resource/aad/utils/configs.js +9 -10
  112. package/build/plugins/resource/aad/utils/configs.js.map +1 -1
  113. package/build/plugins/resource/aad/utils/telemetry.js +1 -1
  114. package/build/plugins/resource/aad/utils/telemetry.js.map +1 -1
  115. package/build/plugins/resource/aad/v2/index.d.ts +7 -7
  116. package/build/plugins/resource/aad/v2/index.d.ts.map +1 -1
  117. package/build/plugins/resource/aad/v2/index.js +6 -6
  118. package/build/plugins/resource/aad/v2/index.js.map +1 -1
  119. package/build/plugins/resource/apim/config.d.ts +1 -0
  120. package/build/plugins/resource/apim/config.d.ts.map +1 -1
  121. package/build/plugins/resource/apim/config.js.map +1 -1
  122. package/build/plugins/resource/apim/constants.d.ts +3 -0
  123. package/build/plugins/resource/apim/constants.d.ts.map +1 -1
  124. package/build/plugins/resource/apim/constants.js +5 -1
  125. package/build/plugins/resource/apim/constants.js.map +1 -1
  126. package/build/plugins/resource/apim/factory.d.ts +2 -1
  127. package/build/plugins/resource/apim/factory.d.ts.map +1 -1
  128. package/build/plugins/resource/apim/factory.js +19 -8
  129. package/build/plugins/resource/apim/factory.js.map +1 -1
  130. package/build/plugins/resource/apim/index.d.ts +2 -0
  131. package/build/plugins/resource/apim/index.d.ts.map +1 -1
  132. package/build/plugins/resource/apim/index.js +15 -8
  133. package/build/plugins/resource/apim/index.js.map +1 -1
  134. package/build/plugins/resource/apim/questions/vscodeQuestion.js +1 -1
  135. package/build/plugins/resource/apim/questions/vscodeQuestion.js.map +1 -1
  136. package/build/plugins/resource/apim/v2/index.d.ts +9 -11
  137. package/build/plugins/resource/apim/v2/index.d.ts.map +1 -1
  138. package/build/plugins/resource/apim/v2/index.js +25 -29
  139. package/build/plugins/resource/apim/v2/index.js.map +1 -1
  140. package/build/plugins/resource/appstudio/appStudio.d.ts.map +1 -1
  141. package/build/plugins/resource/appstudio/appStudio.js +9 -8
  142. package/build/plugins/resource/appstudio/appStudio.js.map +1 -1
  143. package/build/plugins/resource/appstudio/constants.d.ts +6 -2
  144. package/build/plugins/resource/appstudio/constants.d.ts.map +1 -1
  145. package/build/plugins/resource/appstudio/constants.js +124 -13
  146. package/build/plugins/resource/appstudio/constants.js.map +1 -1
  147. package/build/plugins/resource/appstudio/errors.d.ts +4 -0
  148. package/build/plugins/resource/appstudio/errors.d.ts.map +1 -1
  149. package/build/plugins/resource/appstudio/errors.js +8 -0
  150. package/build/plugins/resource/appstudio/errors.js.map +1 -1
  151. package/build/plugins/resource/appstudio/index.d.ts +1 -0
  152. package/build/plugins/resource/appstudio/index.d.ts.map +1 -1
  153. package/build/plugins/resource/appstudio/index.js +23 -5
  154. package/build/plugins/resource/appstudio/index.js.map +1 -1
  155. package/build/plugins/resource/appstudio/interfaces/IAppDefinition.d.ts +1 -0
  156. package/build/plugins/resource/appstudio/interfaces/IAppDefinition.d.ts.map +1 -1
  157. package/build/plugins/resource/appstudio/plugin.d.ts +2 -1
  158. package/build/plugins/resource/appstudio/plugin.d.ts.map +1 -1
  159. package/build/plugins/resource/appstudio/plugin.js +197 -68
  160. package/build/plugins/resource/appstudio/plugin.js.map +1 -1
  161. package/build/plugins/resource/appstudio/utils/telemetry.d.ts +2 -1
  162. package/build/plugins/resource/appstudio/utils/telemetry.d.ts.map +1 -1
  163. package/build/plugins/resource/appstudio/utils/telemetry.js +17 -12
  164. package/build/plugins/resource/appstudio/utils/telemetry.js.map +1 -1
  165. package/build/plugins/resource/appstudio/v2/index.d.ts +10 -13
  166. package/build/plugins/resource/appstudio/v2/index.d.ts.map +1 -1
  167. package/build/plugins/resource/appstudio/v2/index.js +25 -20
  168. package/build/plugins/resource/appstudio/v2/index.js.map +1 -1
  169. package/build/plugins/resource/bot/appStudio/appStudio.js +2 -2
  170. package/build/plugins/resource/bot/appStudio/appStudio.js.map +1 -1
  171. package/build/plugins/resource/bot/configs/localDebugConfig.d.ts +1 -1
  172. package/build/plugins/resource/bot/configs/localDebugConfig.d.ts.map +1 -1
  173. package/build/plugins/resource/bot/configs/localDebugConfig.js +3 -3
  174. package/build/plugins/resource/bot/configs/localDebugConfig.js.map +1 -1
  175. package/build/plugins/resource/bot/configs/provisionConfig.js +21 -20
  176. package/build/plugins/resource/bot/configs/provisionConfig.js.map +1 -1
  177. package/build/plugins/resource/bot/configs/scaffoldConfig.d.ts +1 -3
  178. package/build/plugins/resource/bot/configs/scaffoldConfig.d.ts.map +1 -1
  179. package/build/plugins/resource/bot/configs/scaffoldConfig.js +9 -10
  180. package/build/plugins/resource/bot/configs/scaffoldConfig.js.map +1 -1
  181. package/build/plugins/resource/bot/configs/teamsBotConfig.d.ts.map +1 -1
  182. package/build/plugins/resource/bot/configs/teamsBotConfig.js +5 -5
  183. package/build/plugins/resource/bot/configs/teamsBotConfig.js.map +1 -1
  184. package/build/plugins/resource/bot/constants.d.ts +0 -2
  185. package/build/plugins/resource/bot/constants.d.ts.map +1 -1
  186. package/build/plugins/resource/bot/constants.js +2 -14
  187. package/build/plugins/resource/bot/constants.js.map +1 -1
  188. package/build/plugins/resource/bot/index.d.ts +2 -3
  189. package/build/plugins/resource/bot/index.d.ts.map +1 -1
  190. package/build/plugins/resource/bot/index.js +1 -7
  191. package/build/plugins/resource/bot/index.js.map +1 -1
  192. package/build/plugins/resource/bot/plugin.d.ts +1 -4
  193. package/build/plugins/resource/bot/plugin.d.ts.map +1 -1
  194. package/build/plugins/resource/bot/plugin.js +21 -80
  195. package/build/plugins/resource/bot/plugin.js.map +1 -1
  196. package/build/plugins/resource/bot/resources/messages.d.ts +0 -1
  197. package/build/plugins/resource/bot/resources/messages.d.ts.map +1 -1
  198. package/build/plugins/resource/bot/resources/messages.js +0 -1
  199. package/build/plugins/resource/bot/resources/messages.js.map +1 -1
  200. package/build/plugins/resource/bot/resources/strings.d.ts +1 -1
  201. package/build/plugins/resource/bot/resources/strings.d.ts.map +1 -1
  202. package/build/plugins/resource/bot/resources/strings.js +1 -1
  203. package/build/plugins/resource/bot/resources/strings.js.map +1 -1
  204. package/build/plugins/resource/bot/utils/telemetry-helper.d.ts.map +1 -1
  205. package/build/plugins/resource/bot/utils/telemetry-helper.js +1 -1
  206. package/build/plugins/resource/bot/utils/telemetry-helper.js.map +1 -1
  207. package/build/plugins/resource/bot/v2/index.d.ts +9 -13
  208. package/build/plugins/resource/bot/v2/index.d.ts.map +1 -1
  209. package/build/plugins/resource/bot/v2/index.js +7 -7
  210. package/build/plugins/resource/bot/v2/index.js.map +1 -1
  211. package/build/plugins/resource/frontend/configs.d.ts +7 -2
  212. package/build/plugins/resource/frontend/configs.d.ts.map +1 -1
  213. package/build/plugins/resource/frontend/configs.js +49 -29
  214. package/build/plugins/resource/frontend/configs.js.map +1 -1
  215. package/build/plugins/resource/frontend/constants.d.ts +3 -2
  216. package/build/plugins/resource/frontend/constants.d.ts.map +1 -1
  217. package/build/plugins/resource/frontend/constants.js +4 -3
  218. package/build/plugins/resource/frontend/constants.js.map +1 -1
  219. package/build/plugins/resource/frontend/index.d.ts +1 -1
  220. package/build/plugins/resource/frontend/index.d.ts.map +1 -1
  221. package/build/plugins/resource/frontend/index.js +6 -5
  222. package/build/plugins/resource/frontend/index.js.map +1 -1
  223. package/build/plugins/resource/frontend/ops/deploy.d.ts.map +1 -1
  224. package/build/plugins/resource/frontend/ops/deploy.js +1 -0
  225. package/build/plugins/resource/frontend/ops/deploy.js.map +1 -1
  226. package/build/plugins/resource/frontend/plugin.d.ts +4 -1
  227. package/build/plugins/resource/frontend/plugin.d.ts.map +1 -1
  228. package/build/plugins/resource/frontend/plugin.js +32 -32
  229. package/build/plugins/resource/frontend/plugin.js.map +1 -1
  230. package/build/plugins/resource/frontend/resources/errors.d.ts +1 -1
  231. package/build/plugins/resource/frontend/resources/errors.d.ts.map +1 -1
  232. package/build/plugins/resource/frontend/resources/errors.js +5 -2
  233. package/build/plugins/resource/frontend/resources/errors.js.map +1 -1
  234. package/build/plugins/resource/frontend/utils/telemetry-helper.js +1 -1
  235. package/build/plugins/resource/frontend/utils/telemetry-helper.js.map +1 -1
  236. package/build/plugins/resource/frontend/v2/index.d.ts +6 -9
  237. package/build/plugins/resource/frontend/v2/index.d.ts.map +1 -1
  238. package/build/plugins/resource/frontend/v2/index.js +5 -2
  239. package/build/plugins/resource/frontend/v2/index.js.map +1 -1
  240. package/build/plugins/resource/function/constants.d.ts +2 -6
  241. package/build/plugins/resource/function/constants.d.ts.map +1 -1
  242. package/build/plugins/resource/function/constants.js +3 -8
  243. package/build/plugins/resource/function/constants.js.map +1 -1
  244. package/build/plugins/resource/function/enums.d.ts +2 -0
  245. package/build/plugins/resource/function/enums.d.ts.map +1 -1
  246. package/build/plugins/resource/function/enums.js +2 -0
  247. package/build/plugins/resource/function/enums.js.map +1 -1
  248. package/build/plugins/resource/function/index.d.ts +1 -0
  249. package/build/plugins/resource/function/index.d.ts.map +1 -1
  250. package/build/plugins/resource/function/index.js +1 -0
  251. package/build/plugins/resource/function/index.js.map +1 -1
  252. package/build/plugins/resource/function/ops/deploy.d.ts +1 -1
  253. package/build/plugins/resource/function/ops/deploy.d.ts.map +1 -1
  254. package/build/plugins/resource/function/ops/deploy.js +13 -5
  255. package/build/plugins/resource/function/ops/deploy.js.map +1 -1
  256. package/build/plugins/resource/function/ops/scaffold.d.ts +4 -7
  257. package/build/plugins/resource/function/ops/scaffold.d.ts.map +1 -1
  258. package/build/plugins/resource/function/ops/scaffold.js +42 -40
  259. package/build/plugins/resource/function/ops/scaffold.js.map +1 -1
  260. package/build/plugins/resource/function/plugin.d.ts +4 -0
  261. package/build/plugins/resource/function/plugin.d.ts.map +1 -1
  262. package/build/plugins/resource/function/plugin.js +57 -41
  263. package/build/plugins/resource/function/plugin.js.map +1 -1
  264. package/build/plugins/resource/function/resources/errors.d.ts +2 -5
  265. package/build/plugins/resource/function/resources/errors.d.ts.map +1 -1
  266. package/build/plugins/resource/function/resources/errors.js +5 -13
  267. package/build/plugins/resource/function/resources/errors.js.map +1 -1
  268. package/build/plugins/resource/function/resources/message.d.ts +1 -0
  269. package/build/plugins/resource/function/resources/message.d.ts.map +1 -1
  270. package/build/plugins/resource/function/resources/message.js +1 -0
  271. package/build/plugins/resource/function/resources/message.js.map +1 -1
  272. package/build/plugins/resource/function/utils/telemetry-helper.js +1 -1
  273. package/build/plugins/resource/function/utils/telemetry-helper.js.map +1 -1
  274. package/build/plugins/resource/function/v2/index.d.ts +8 -11
  275. package/build/plugins/resource/function/v2/index.d.ts.map +1 -1
  276. package/build/plugins/resource/function/v2/index.js +9 -17
  277. package/build/plugins/resource/function/v2/index.js.map +1 -1
  278. package/build/plugins/resource/identity/index.d.ts +1 -0
  279. package/build/plugins/resource/identity/index.d.ts.map +1 -1
  280. package/build/plugins/resource/identity/index.js +7 -9
  281. package/build/plugins/resource/identity/index.js.map +1 -1
  282. package/build/plugins/resource/identity/utils/contextUtils.js +1 -1
  283. package/build/plugins/resource/identity/utils/contextUtils.js.map +1 -1
  284. package/build/plugins/resource/identity/utils/telemetryUtil.d.ts.map +1 -1
  285. package/build/plugins/resource/identity/utils/telemetryUtil.js +1 -1
  286. package/build/plugins/resource/identity/utils/telemetryUtil.js.map +1 -1
  287. package/build/plugins/resource/identity/v2/index.d.ts +3 -3
  288. package/build/plugins/resource/identity/v2/index.d.ts.map +1 -1
  289. package/build/plugins/resource/identity/v2/index.js +2 -2
  290. package/build/plugins/resource/identity/v2/index.js.map +1 -1
  291. package/build/plugins/resource/localdebug/constants.d.ts +4 -0
  292. package/build/plugins/resource/localdebug/constants.d.ts.map +1 -1
  293. package/build/plugins/resource/localdebug/constants.js +6 -1
  294. package/build/plugins/resource/localdebug/constants.js.map +1 -1
  295. package/build/plugins/resource/localdebug/index.d.ts +1 -0
  296. package/build/plugins/resource/localdebug/index.d.ts.map +1 -1
  297. package/build/plugins/resource/localdebug/index.js +12 -6
  298. package/build/plugins/resource/localdebug/index.js.map +1 -1
  299. package/build/plugins/resource/localdebug/launch.d.ts +1 -0
  300. package/build/plugins/resource/localdebug/launch.d.ts.map +1 -1
  301. package/build/plugins/resource/localdebug/launch.js +66 -1
  302. package/build/plugins/resource/localdebug/launch.js.map +1 -1
  303. package/build/plugins/resource/localdebug/legacyPlugin.js +4 -4
  304. package/build/plugins/resource/localdebug/legacyPlugin.js.map +1 -1
  305. package/build/plugins/resource/localdebug/tasks.d.ts.map +1 -1
  306. package/build/plugins/resource/localdebug/tasks.js +12 -2
  307. package/build/plugins/resource/localdebug/tasks.js.map +1 -1
  308. package/build/plugins/resource/localdebug/util/telemetry.js +1 -1
  309. package/build/plugins/resource/localdebug/util/telemetry.js.map +1 -1
  310. package/build/plugins/resource/localdebug/v2/index.d.ts +6 -8
  311. package/build/plugins/resource/localdebug/v2/index.d.ts.map +1 -1
  312. package/build/plugins/resource/localdebug/v2/index.js +2 -2
  313. package/build/plugins/resource/localdebug/v2/index.js.map +1 -1
  314. package/build/plugins/resource/simpleauth/index.d.ts +1 -0
  315. package/build/plugins/resource/simpleauth/index.d.ts.map +1 -1
  316. package/build/plugins/resource/simpleauth/index.js +1 -0
  317. package/build/plugins/resource/simpleauth/index.js.map +1 -1
  318. package/build/plugins/resource/simpleauth/plugin.d.ts.map +1 -1
  319. package/build/plugins/resource/simpleauth/plugin.js +1 -6
  320. package/build/plugins/resource/simpleauth/plugin.js.map +1 -1
  321. package/build/plugins/resource/simpleauth/utils/common.js +1 -1
  322. package/build/plugins/resource/simpleauth/utils/common.js.map +1 -1
  323. package/build/plugins/resource/simpleauth/utils/telemetry.d.ts.map +1 -1
  324. package/build/plugins/resource/simpleauth/utils/telemetry.js +2 -1
  325. package/build/plugins/resource/simpleauth/utils/telemetry.js.map +1 -1
  326. package/build/plugins/resource/simpleauth/v2/index.d.ts +4 -4
  327. package/build/plugins/resource/simpleauth/v2/index.d.ts.map +1 -1
  328. package/build/plugins/resource/simpleauth/v2/index.js.map +1 -1
  329. package/build/plugins/resource/spfx/index.d.ts +1 -0
  330. package/build/plugins/resource/spfx/index.d.ts.map +1 -1
  331. package/build/plugins/resource/spfx/index.js +1 -0
  332. package/build/plugins/resource/spfx/index.js.map +1 -1
  333. package/build/plugins/resource/spfx/v2/index.d.ts +4 -8
  334. package/build/plugins/resource/spfx/v2/index.d.ts.map +1 -1
  335. package/build/plugins/resource/spfx/v2/index.js.map +1 -1
  336. package/build/plugins/resource/sql/config.d.ts +0 -1
  337. package/build/plugins/resource/sql/config.d.ts.map +1 -1
  338. package/build/plugins/resource/sql/config.js +0 -1
  339. package/build/plugins/resource/sql/config.js.map +1 -1
  340. package/build/plugins/resource/sql/errors.d.ts +4 -0
  341. package/build/plugins/resource/sql/errors.d.ts.map +1 -1
  342. package/build/plugins/resource/sql/errors.js +4 -0
  343. package/build/plugins/resource/sql/errors.js.map +1 -1
  344. package/build/plugins/resource/sql/index.d.ts +1 -0
  345. package/build/plugins/resource/sql/index.d.ts.map +1 -1
  346. package/build/plugins/resource/sql/index.js +1 -0
  347. package/build/plugins/resource/sql/index.js.map +1 -1
  348. package/build/plugins/resource/sql/plugin.d.ts +4 -0
  349. package/build/plugins/resource/sql/plugin.d.ts.map +1 -1
  350. package/build/plugins/resource/sql/plugin.js +68 -69
  351. package/build/plugins/resource/sql/plugin.js.map +1 -1
  352. package/build/plugins/resource/sql/utils/contextUtils.js +1 -1
  353. package/build/plugins/resource/sql/utils/contextUtils.js.map +1 -1
  354. package/build/plugins/resource/sql/utils/telemetryUtils.d.ts.map +1 -1
  355. package/build/plugins/resource/sql/utils/telemetryUtils.js +2 -1
  356. package/build/plugins/resource/sql/utils/telemetryUtils.js.map +1 -1
  357. package/build/plugins/resource/sql/v2/index.d.ts +5 -4
  358. package/build/plugins/resource/sql/v2/index.d.ts.map +1 -1
  359. package/build/plugins/resource/sql/v2/index.js +18 -16
  360. package/build/plugins/resource/sql/v2/index.js.map +1 -1
  361. package/build/plugins/resource/utils4v2.d.ts +16 -14
  362. package/build/plugins/resource/utils4v2.d.ts.map +1 -1
  363. package/build/plugins/resource/utils4v2.js +127 -92
  364. package/build/plugins/resource/utils4v2.js.map +1 -1
  365. package/build/plugins/solution/fx-solution/ResourcePluginContainer.d.ts.map +1 -1
  366. package/build/plugins/solution/fx-solution/ResourcePluginContainer.js +4 -2
  367. package/build/plugins/solution/fx-solution/ResourcePluginContainer.js.map +1 -1
  368. package/build/plugins/solution/fx-solution/arm.d.ts +11 -0
  369. package/build/plugins/solution/fx-solution/arm.d.ts.map +1 -1
  370. package/build/plugins/solution/fx-solution/arm.js +118 -40
  371. package/build/plugins/solution/fx-solution/arm.js.map +1 -1
  372. package/build/plugins/solution/fx-solution/commonQuestions.d.ts +2 -2
  373. package/build/plugins/solution/fx-solution/commonQuestions.d.ts.map +1 -1
  374. package/build/plugins/solution/fx-solution/commonQuestions.js +120 -47
  375. package/build/plugins/solution/fx-solution/commonQuestions.js.map +1 -1
  376. package/build/plugins/solution/fx-solution/constants.d.ts +16 -2
  377. package/build/plugins/solution/fx-solution/constants.d.ts.map +1 -1
  378. package/build/plugins/solution/fx-solution/constants.js +15 -1
  379. package/build/plugins/solution/fx-solution/constants.js.map +1 -1
  380. package/build/plugins/solution/fx-solution/executor.d.ts.map +1 -1
  381. package/build/plugins/solution/fx-solution/executor.js +39 -21
  382. package/build/plugins/solution/fx-solution/executor.js.map +1 -1
  383. package/build/plugins/solution/fx-solution/index.d.ts +2 -0
  384. package/build/plugins/solution/fx-solution/index.d.ts.map +1 -1
  385. package/build/plugins/solution/fx-solution/index.js +2 -0
  386. package/build/plugins/solution/fx-solution/index.js.map +1 -1
  387. package/build/plugins/solution/fx-solution/question.d.ts +2 -1
  388. package/build/plugins/solution/fx-solution/question.d.ts.map +1 -1
  389. package/build/plugins/solution/fx-solution/question.js +18 -1
  390. package/build/plugins/solution/fx-solution/question.js.map +1 -1
  391. package/build/plugins/solution/fx-solution/solution.d.ts +3 -6
  392. package/build/plugins/solution/fx-solution/solution.d.ts.map +1 -1
  393. package/build/plugins/solution/fx-solution/solution.js +406 -379
  394. package/build/plugins/solution/fx-solution/solution.js.map +1 -1
  395. package/build/plugins/solution/fx-solution/utils/util.js +1 -1
  396. package/build/plugins/solution/fx-solution/utils/util.js.map +1 -1
  397. package/build/plugins/solution/fx-solution/v2/adaptor.d.ts +3 -0
  398. package/build/plugins/solution/fx-solution/v2/adaptor.d.ts.map +1 -1
  399. package/build/plugins/solution/fx-solution/v2/adaptor.js +37 -3
  400. package/build/plugins/solution/fx-solution/v2/adaptor.js.map +1 -1
  401. package/build/plugins/solution/fx-solution/v2/createEnv.d.ts +3 -0
  402. package/build/plugins/solution/fx-solution/v2/createEnv.d.ts.map +1 -0
  403. package/build/plugins/solution/fx-solution/v2/createEnv.js +28 -0
  404. package/build/plugins/solution/fx-solution/v2/createEnv.js.map +1 -0
  405. package/build/plugins/solution/fx-solution/v2/deploy.d.ts +2 -4
  406. package/build/plugins/solution/fx-solution/v2/deploy.d.ts.map +1 -1
  407. package/build/plugins/solution/fx-solution/v2/deploy.js +19 -14
  408. package/build/plugins/solution/fx-solution/v2/deploy.js.map +1 -1
  409. package/build/plugins/solution/fx-solution/v2/executeUserTask.d.ts +2 -2
  410. package/build/plugins/solution/fx-solution/v2/executeUserTask.d.ts.map +1 -1
  411. package/build/plugins/solution/fx-solution/v2/executeUserTask.js +20 -4
  412. package/build/plugins/solution/fx-solution/v2/executeUserTask.js.map +1 -1
  413. package/build/plugins/solution/fx-solution/v2/executor.d.ts +2 -2
  414. package/build/plugins/solution/fx-solution/v2/executor.d.ts.map +1 -1
  415. package/build/plugins/solution/fx-solution/v2/executor.js +27 -3
  416. package/build/plugins/solution/fx-solution/v2/executor.js.map +1 -1
  417. package/build/plugins/solution/fx-solution/v2/generateResourceTemplate.d.ts +2 -2
  418. package/build/plugins/solution/fx-solution/v2/generateResourceTemplate.d.ts.map +1 -1
  419. package/build/plugins/solution/fx-solution/v2/generateResourceTemplate.js +8 -2
  420. package/build/plugins/solution/fx-solution/v2/generateResourceTemplate.js.map +1 -1
  421. package/build/plugins/solution/fx-solution/v2/getQuestions.d.ts +8 -0
  422. package/build/plugins/solution/fx-solution/v2/getQuestions.d.ts.map +1 -0
  423. package/build/plugins/solution/fx-solution/v2/getQuestions.js +393 -0
  424. package/build/plugins/solution/fx-solution/v2/getQuestions.js.map +1 -0
  425. package/build/plugins/solution/fx-solution/v2/package.d.ts.map +1 -1
  426. package/build/plugins/solution/fx-solution/v2/package.js +12 -2
  427. package/build/plugins/solution/fx-solution/v2/package.js.map +1 -1
  428. package/build/plugins/solution/fx-solution/v2/provision.d.ts +4 -0
  429. package/build/plugins/solution/fx-solution/v2/provision.d.ts.map +1 -0
  430. package/build/plugins/solution/fx-solution/v2/provision.js +153 -0
  431. package/build/plugins/solution/fx-solution/v2/provision.js.map +1 -0
  432. package/build/plugins/solution/fx-solution/v2/provisionLocal.d.ts +3 -0
  433. package/build/plugins/solution/fx-solution/v2/provisionLocal.d.ts.map +1 -0
  434. package/build/plugins/solution/fx-solution/v2/provisionLocal.js +73 -0
  435. package/build/plugins/solution/fx-solution/v2/provisionLocal.js.map +1 -0
  436. package/build/plugins/solution/fx-solution/v2/publish.d.ts +2 -2
  437. package/build/plugins/solution/fx-solution/v2/publish.d.ts.map +1 -1
  438. package/build/plugins/solution/fx-solution/v2/publish.js +11 -11
  439. package/build/plugins/solution/fx-solution/v2/publish.js.map +1 -1
  440. package/build/plugins/solution/fx-solution/v2/scaffolding.d.ts +3 -7
  441. package/build/plugins/solution/fx-solution/v2/scaffolding.d.ts.map +1 -1
  442. package/build/plugins/solution/fx-solution/v2/scaffolding.js +21 -6
  443. package/build/plugins/solution/fx-solution/v2/scaffolding.js.map +1 -1
  444. package/build/plugins/solution/fx-solution/v2/solution.d.ts +18 -0
  445. package/build/plugins/solution/fx-solution/v2/solution.d.ts.map +1 -0
  446. package/build/plugins/solution/fx-solution/v2/solution.js +38 -0
  447. package/build/plugins/solution/fx-solution/v2/solution.js.map +1 -0
  448. package/build/plugins/solution/fx-solution/v2/utils.d.ts +11 -9
  449. package/build/plugins/solution/fx-solution/v2/utils.d.ts.map +1 -1
  450. package/build/plugins/solution/fx-solution/v2/utils.js +81 -1
  451. package/build/plugins/solution/fx-solution/v2/utils.js.map +1 -1
  452. package/package.json +8 -5
  453. package/resource/strings.json +2 -1
  454. package/templates/plugins/resource/bot/bicep/botConfiguration.template.bicep +0 -4
  455. package/templates/plugins/resource/bot/bicep/botProvision.template.bicep +0 -6
  456. package/templates/plugins/resource/bot/bicep/module.template.bicep +0 -4
  457. package/templates/plugins/resource/bot/bicep/output.template.bicep +0 -2
  458. package/templates/plugins/resource/bot/bicep/param.template.bicep +0 -2
  459. package/templates/plugins/resource/bot/bot-msgext.js.default.zip +0 -0
  460. package/templates/plugins/resource/bot/bot-msgext.ts.default.zip +0 -0
  461. package/templates/plugins/resource/bot/bot.js.default.zip +0 -0
  462. package/templates/plugins/resource/bot/bot.ts.default.zip +0 -0
  463. package/templates/plugins/resource/bot/msgext.js.default.zip +0 -0
  464. package/templates/plugins/resource/bot/msgext.ts.default.zip +0 -0
  465. package/templates/plugins/resource/frontend/bicep/frontendHosting.bicep +1 -1
  466. package/templates/plugins/resource/frontend/bicep/output.template.bicep +1 -1
  467. package/templates/plugins/resource/frontend/tab.js.default.zip +0 -0
  468. package/templates/plugins/resource/frontend/tab.ts.default.zip +0 -0
  469. package/templates/plugins/resource/function/bicep/functionProvision.template.bicep +1 -3
  470. package/templates/plugins/resource/function/bicep/output.template.bicep +1 -3
  471. package/templates/plugins/resource/function/function-base.js.default.zip +0 -0
  472. package/templates/plugins/resource/function/function-base.ts.default.zip +0 -0
  473. package/templates/plugins/resource/function/function-triggers.js.HTTPTrigger.zip +0 -0
  474. package/templates/plugins/resource/function/function-triggers.ts.HTTPTrigger.zip +0 -0
  475. package/templates/plugins/resource/spfx/solution/manifest_multi_env.json +62 -0
  476. package/build/core/loader.d.ts +0 -11
  477. package/build/core/loader.d.ts.map +0 -1
  478. package/build/core/loader.js +0 -17
  479. package/build/core/loader.js.map +0 -1
  480. package/build/core/middleware/contextInjecter.d.ts +0 -3
  481. package/build/core/middleware/contextInjecter.d.ts.map +0 -1
  482. package/build/core/middleware/contextInjecter.js.map +0 -1
  483. package/build/plugins/resource/bot/enums/wayToRegisterBot.d.ts +0 -5
  484. package/build/plugins/resource/bot/enums/wayToRegisterBot.d.ts.map +0 -1
  485. package/build/plugins/resource/bot/enums/wayToRegisterBot.js +0 -11
  486. package/build/plugins/resource/bot/enums/wayToRegisterBot.js.map +0 -1
  487. package/build/plugins/resource/bot/questions.d.ts +0 -4
  488. package/build/plugins/resource/bot/questions.d.ts.map +0 -1
  489. package/build/plugins/resource/bot/questions.js +0 -65
  490. package/build/plugins/resource/bot/questions.js.map +0 -1
  491. package/build/plugins/resource/function/utils/templates-fetch.d.ts +0 -10
  492. package/build/plugins/resource/function/utils/templates-fetch.d.ts.map +0 -1
  493. package/build/plugins/resource/function/utils/templates-fetch.js +0 -107
  494. package/build/plugins/resource/function/utils/templates-fetch.js.map +0 -1
@@ -11,7 +11,6 @@ const constants_1 = require("../../solution/fx-solution/constants");
11
11
  const errors_1 = require("./errors");
12
12
  const results_1 = require("./results");
13
13
  const constants_2 = require("./constants");
14
- const constants_3 = require("../../solution/fx-solution/constants");
15
14
  const adm_zip_1 = tslib_1.__importDefault(require("adm-zip"));
16
15
  const fs = tslib_1.__importStar(require("fs-extra"));
17
16
  const __1 = require("../../..");
@@ -21,11 +20,12 @@ const common_1 = require("../../../common");
21
20
  const localSettingsConstants_1 = require("../../../common/localSettingsConstants");
22
21
  const uuid_1 = require("uuid");
23
22
  const isUUID_1 = tslib_1.__importDefault(require("validator/lib/isUUID"));
23
+ const mustache_1 = tslib_1.__importDefault(require("mustache"));
24
24
  class AppStudioPluginImpl {
25
25
  async getAppDefinitionAndUpdate(ctx, type, manifest) {
26
26
  var _a, _b;
27
27
  let appDefinition;
28
- let maybeTeamsAppId;
28
+ let teamsAppId;
29
29
  const appDirectory = await common_1.getAppDirectory(ctx.root);
30
30
  const appStudioToken = await ((_a = ctx.appStudioToken) === null || _a === void 0 ? void 0 : _a.getAccessToken());
31
31
  if (type == "localDebug") {
@@ -48,14 +48,52 @@ class AppStudioPluginImpl {
48
48
  createIfNotExist = true;
49
49
  }
50
50
  }
51
- maybeTeamsAppId = await this.updateApp(ctx, appDefinition, appStudioToken, type, createIfNotExist, createIfNotExist ? undefined : localTeamsAppID, ctx.logProvider, appDirectory);
52
- return maybeTeamsAppId;
51
+ teamsAppId = await this.updateApp(ctx, appDefinition, appStudioToken, type, createIfNotExist, appDirectory, createIfNotExist ? undefined : localTeamsAppID, ctx.logProvider);
52
+ return teamsAppId;
53
53
  }
54
54
  else {
55
55
  appDefinition = this.convertToAppDefinition(manifest, true);
56
- maybeTeamsAppId = await this.updateApp(ctx, appDefinition, appStudioToken, type, true, undefined, ctx.logProvider, appDirectory);
57
- return maybeTeamsAppId;
56
+ teamsAppId = await this.updateApp(ctx, appDefinition, appStudioToken, type, true, appDirectory, undefined, ctx.logProvider);
57
+ return teamsAppId;
58
+ }
59
+ }
60
+ async getSPFxLocalDebugAppDefinitionAndUpdate(ctx, manifest) {
61
+ var _a, _b, _c;
62
+ const appDirectory = await common_1.getAppDirectory(ctx.root);
63
+ const appStudioToken = await ((_a = ctx.appStudioToken) === null || _a === void 0 ? void 0 : _a.getAccessToken());
64
+ const localTeamsAppID = this.getTeamsAppId(ctx, true);
65
+ let createIfNotExist = false;
66
+ if (localTeamsAppID) {
67
+ manifest.id = localTeamsAppID;
68
+ }
69
+ else {
70
+ manifest.id = "";
71
+ createIfNotExist = true;
72
+ }
73
+ if (manifest.configurableTabs) {
74
+ for (const tab of manifest.configurableTabs) {
75
+ const reg = /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/;
76
+ const result = tab.configurationUrl.match(reg);
77
+ if (result && result.length > 0) {
78
+ const componentID = result[0];
79
+ tab.configurationUrl = `https://{teamSiteDomain}{teamSitePath}/_layouts/15/TeamsLogon.aspx?SPFX=true&dest={teamSitePath}/_layouts/15/TeamsWorkBench.aspx%3FcomponentId=${componentID}%26openPropertyPane=true%26teams%26forceLocale={locale}%26loadSPFX%3Dtrue%26debugManifestsFile%3Dhttps%3A%2F%2Flocalhost%3A4321%2Ftemp%2Fmanifests.js`;
80
+ }
81
+ else {
82
+ const message = "Cannot find componentID in configurableTabs[0].configrationUrl, local debug may fail.";
83
+ (_b = ctx.logProvider) === null || _b === void 0 ? void 0 : _b.error(message);
84
+ (_c = ctx.ui) === null || _c === void 0 ? void 0 : _c.showMessage("warn", message, false);
85
+ }
86
+ }
58
87
  }
88
+ if (manifest.staticTabs) {
89
+ for (const tab of manifest.staticTabs) {
90
+ const componentID = tab.entityId;
91
+ tab.contentUrl = `https://{teamSiteDomain}/_layouts/15/TeamsLogon.aspx?SPFX=true&dest={teamSitePath}/_layouts/15/TeamsWorkBench.aspx%3FcomponentId=${componentID}%26teams%26personal%26forceLocale={locale}%26loadSPFX%3Dtrue%26debugManifestsFile%3Dhttps%3A%2F%2Flocalhost%3A4321%2Ftemp%2Fmanifests.js`;
92
+ }
93
+ }
94
+ const appDefinition = this.convertToAppDefinition(manifest, false);
95
+ const teamsAppId = await this.updateApp(ctx, appDefinition, appStudioToken, "localDebug", createIfNotExist, appDirectory, createIfNotExist ? undefined : localTeamsAppID, ctx.logProvider);
96
+ return teamsAppId;
59
97
  }
60
98
  /**
61
99
  * ask app common questions to generate app manifest
@@ -81,14 +119,18 @@ class AppStudioPluginImpl {
81
119
  manifestString = this.replaceConfigValue(manifestString, "version", "1.0.0");
82
120
  const manifest = JSON.parse(manifestString);
83
121
  if (solutionSettings.capabilities.includes(question_1.TabOptionItem.id)) {
84
- manifest.staticTabs = constants_2.STATIC_TABS_TPL;
85
- manifest.configurableTabs = constants_2.CONFIGURABLE_TABS_TPL;
122
+ manifest.staticTabs = common_1.isMultiEnvEnabled() ? constants_2.STATIC_TABS_TPL_FOR_MULTI_ENV : constants_2.STATIC_TABS_TPL;
123
+ manifest.configurableTabs = common_1.isMultiEnvEnabled()
124
+ ? constants_2.CONFIGURABLE_TABS_TPL_FOR_MULTI_ENV
125
+ : constants_2.CONFIGURABLE_TABS_TPL;
86
126
  }
87
127
  if (solutionSettings.capabilities.includes(question_1.BotOptionItem.id)) {
88
- manifest.bots = constants_2.BOTS_TPL;
128
+ manifest.bots = common_1.isMultiEnvEnabled() ? constants_2.BOTS_TPL_FOR_MULTI_ENV : constants_2.BOTS_TPL;
89
129
  }
90
130
  if (solutionSettings.capabilities.includes(question_1.MessageExtensionItem.id)) {
91
- manifest.composeExtensions = constants_2.COMPOSE_EXTENSIONS_TPL;
131
+ manifest.composeExtensions = common_1.isMultiEnvEnabled()
132
+ ? constants_2.COMPOSE_EXTENSIONS_TPL_FOR_MULTI_ENV
133
+ : constants_2.COMPOSE_EXTENSIONS_TPL;
92
134
  }
93
135
  if ((_a = settings === null || settings === void 0 ? void 0 : settings.solutionSettings) === null || _a === void 0 ? void 0 : _a.migrateFromV1) {
94
136
  manifest.webApplicationInfo = undefined;
@@ -142,7 +184,7 @@ class AppStudioPluginImpl {
142
184
  });
143
185
  }
144
186
  async provision(ctx) {
145
- var _a, _b;
187
+ var _a, _b, _c;
146
188
  let remoteTeamsAppId = this.getTeamsAppId(ctx, false);
147
189
  let create = false;
148
190
  if (!remoteTeamsAppId) {
@@ -165,6 +207,9 @@ class AppStudioPluginImpl {
165
207
  remoteTeamsAppId = result.value.teamsAppId;
166
208
  (_b = ctx.logProvider) === null || _b === void 0 ? void 0 : _b.info(`Teams app created ${remoteTeamsAppId}`);
167
209
  }
210
+ if (common_1.isMultiEnvEnabled()) {
211
+ (_c = ctx.envInfo.profile.get(constants_1.PluginNames.APPST)) === null || _c === void 0 ? void 0 : _c.set(constants_2.Constants.TEAMS_APP_ID, remoteTeamsAppId);
212
+ }
168
213
  return teamsfx_api_1.ok(remoteTeamsAppId);
169
214
  }
170
215
  async postProvision(ctx) {
@@ -192,7 +237,7 @@ class AppStudioPluginImpl {
192
237
  [appDefinition] = remoteManifest.value;
193
238
  }
194
239
  const appStudioToken = await ((_a = ctx === null || ctx === void 0 ? void 0 : ctx.appStudioToken) === null || _a === void 0 ? void 0 : _a.getAccessToken());
195
- const result = await this.updateApp(ctx, appDefinition, appStudioToken, "remote", false, remoteTeamsAppId, ctx.logProvider, appDirectory);
240
+ const result = await this.updateApp(ctx, appDefinition, appStudioToken, "remote", false, appDirectory, remoteTeamsAppId, ctx.logProvider);
196
241
  if (result.isErr()) {
197
242
  throw result;
198
243
  }
@@ -205,13 +250,28 @@ class AppStudioPluginImpl {
205
250
  let manifestString = undefined;
206
251
  const appDirectory = await common_1.getAppDirectory(ctx.root);
207
252
  if (this.isSPFxProject(ctx)) {
208
- manifestString = (await fs.readFile(`${appDirectory}/${constants_2.REMOTE_MANIFEST}`)).toString();
253
+ manifestString = (await fs.readFile(await this.getManifestTemplatePath(ctx.root))).toString();
254
+ if (common_1.isMultiEnvEnabled()) {
255
+ const teamsAppId = this.getTeamsAppId(ctx, false);
256
+ if (!teamsAppId) {
257
+ return teamsfx_api_1.err(results_1.AppStudioResultFactory.UserError(errors_1.AppStudioError.GetRemoteConfigError.name, errors_1.AppStudioError.GetRemoteConfigError.message("Manifest validation failed")));
258
+ }
259
+ const view = {
260
+ config: ctx.envInfo.config,
261
+ profile: {
262
+ "fx-resource-appstudio": {
263
+ teamsAppId: teamsAppId,
264
+ },
265
+ },
266
+ };
267
+ manifestString = mustache_1.default.render(manifestString, view);
268
+ }
209
269
  }
210
270
  else {
211
271
  const appDefinitionAndManifest = await this.getAppDefinitionAndManifest(ctx, false);
212
272
  if (appDefinitionAndManifest.isErr()) {
213
273
  (_b = ctx.logProvider) === null || _b === void 0 ? void 0 : _b.error("[Teams Toolkit] Manifest Validation failed!");
214
- const isProvisionSucceeded = !!((_c = ctx.configOfOtherPlugins
274
+ const isProvisionSucceeded = !!((_c = ctx.envInfo.profile
215
275
  .get("solution")) === null || _c === void 0 ? void 0 : _c.get(constants_1.SOLUTION_PROVISION_SUCCEEDED));
216
276
  if (appDefinitionAndManifest.error.name === errors_1.AppStudioError.GetRemoteConfigError.name &&
217
277
  !isProvisionSucceeded) {
@@ -260,7 +320,9 @@ class AppStudioPluginImpl {
260
320
  const templatesFolder = __1.getTemplatesFolder();
261
321
  if (this.isSPFxProject(ctx)) {
262
322
  const templateManifestFolder = path_1.default.join(templatesFolder, "plugins", "resource", "spfx");
263
- const manifestFile = path_1.default.resolve(templateManifestFolder, "./solution/manifest.json");
323
+ const manifestFile = common_1.isMultiEnvEnabled()
324
+ ? path_1.default.resolve(templateManifestFolder, "./solution/manifest_multi_env.json")
325
+ : path_1.default.resolve(templateManifestFolder, "./solution/manifest.json");
264
326
  const manifestString = (await fs.readFile(manifestFile)).toString();
265
327
  manifest = JSON.parse(manifestString);
266
328
  }
@@ -296,6 +358,17 @@ class AppStudioPluginImpl {
296
358
  : `${ctx.root}/${teamsfx_api_1.AppPackageFolderName}/appPackage.zip`;
297
359
  if (this.isSPFxProject(ctx)) {
298
360
  manifestString = (await fs.readFile(await this.getManifestTemplatePath(ctx.root))).toString();
361
+ if (common_1.isMultiEnvEnabled()) {
362
+ const view = {
363
+ config: ctx.envInfo.config,
364
+ profile: {
365
+ "fx-resource-appstudio": {
366
+ teamsAppId: this.getTeamsAppId(ctx, false),
367
+ },
368
+ },
369
+ };
370
+ manifestString = mustache_1.default.render(manifestString, view);
371
+ }
299
372
  }
300
373
  else {
301
374
  const manifest = await this.getAppDefinitionAndManifest(ctx, false);
@@ -304,7 +377,7 @@ class AppStudioPluginImpl {
304
377
  }
305
378
  else {
306
379
  (_b = ctx.logProvider) === null || _b === void 0 ? void 0 : _b.error("[Teams Toolkit] Teams Package build failed!");
307
- const isProvisionSucceeded = !!((_c = ctx.configOfOtherPlugins
380
+ const isProvisionSucceeded = !!((_c = ctx.envInfo.profile
308
381
  .get("solution")) === null || _c === void 0 ? void 0 : _c.get(constants_1.SOLUTION_PROVISION_SUCCEEDED));
309
382
  if (manifest.error.name === errors_1.AppStudioError.GetRemoteConfigFailedError.name &&
310
383
  !isProvisionSucceeded) {
@@ -366,6 +439,9 @@ class AppStudioPluginImpl {
366
439
  const manifestTpl = await fs.readJSON(await this.getManifestTemplatePath(ctx.root));
367
440
  if (this.isSPFxProject(ctx)) {
368
441
  manifest = manifestTpl;
442
+ if (common_1.isMultiEnvEnabled()) {
443
+ manifest.id = this.getTeamsAppId(ctx, false);
444
+ }
369
445
  }
370
446
  else {
371
447
  const fillinRes = await this.getAppDefinitionAndManifest(ctx, false);
@@ -410,24 +486,34 @@ class AppStudioPluginImpl {
410
486
  const manifestPath = await this.getManifestTemplatePath(ctx.root);
411
487
  const manifest = await this.reloadManifestAndCheckRequiredFields(manifestPath);
412
488
  if (manifest.isErr()) {
413
- throw manifest;
489
+ return teamsfx_api_1.err(manifest.error);
490
+ }
491
+ let teamsAppId;
492
+ if (this.isSPFxProject(ctx)) {
493
+ teamsAppId = await this.getSPFxLocalDebugAppDefinitionAndUpdate(ctx, manifest.value);
494
+ }
495
+ else {
496
+ teamsAppId = await this.getAppDefinitionAndUpdate(ctx, "localDebug", manifest.value);
414
497
  }
415
- const teamsAppId = await this.getAppDefinitionAndUpdate(ctx, "localDebug", manifest.value);
416
498
  if (teamsAppId.isErr()) {
417
- throw teamsAppId;
499
+ return teamsAppId;
418
500
  }
419
- return teamsAppId.value;
501
+ return teamsfx_api_1.ok(teamsAppId.value);
420
502
  }
421
503
  async checkPermission(ctx) {
422
- var _a, _b, _c;
504
+ var _a, _b;
423
505
  let userInfoObject;
424
506
  const appStudioToken = await ((_a = ctx === null || ctx === void 0 ? void 0 : ctx.appStudioToken) === null || _a === void 0 ? void 0 : _a.getAccessToken());
425
- const teamsAppId = (await ((_b = ctx.configOfOtherPlugins
426
- .get(constants_2.SOLUTION)) === null || _b === void 0 ? void 0 : _b.get(constants_3.REMOTE_TEAMS_APP_ID)));
507
+ const teamsAppId = this.getTeamsAppId(ctx, false);
427
508
  if (!teamsAppId) {
428
- throw new Error(constants_2.ErrorMessages.GetConfigError(constants_3.REMOTE_TEAMS_APP_ID, constants_2.SOLUTION));
509
+ if (common_1.isMultiEnvEnabled()) {
510
+ throw new Error(constants_2.ErrorMessages.GetConfigError(constants_2.Constants.TEAMS_APP_ID, constants_1.PluginNames.APPST));
511
+ }
512
+ else {
513
+ throw new Error(constants_2.ErrorMessages.GetConfigError(constants_1.REMOTE_TEAMS_APP_ID, constants_2.SOLUTION));
514
+ }
429
515
  }
430
- const userInfo = (_c = ctx.configOfOtherPlugins.get(constants_2.SOLUTION)) === null || _c === void 0 ? void 0 : _c.get(constants_1.USER_INFO);
516
+ const userInfo = (_b = ctx.envInfo.profile.get(constants_2.SOLUTION)) === null || _b === void 0 ? void 0 : _b.get(constants_1.USER_INFO);
431
517
  if (!userInfo) {
432
518
  throw new Error(constants_2.ErrorMessages.GetConfigError(constants_1.USER_INFO, constants_2.SOLUTION));
433
519
  }
@@ -449,12 +535,16 @@ class AppStudioPluginImpl {
449
535
  return result;
450
536
  }
451
537
  async listCollaborator(ctx) {
452
- var _a, _b;
538
+ var _a;
453
539
  const appStudioToken = await ((_a = ctx === null || ctx === void 0 ? void 0 : ctx.appStudioToken) === null || _a === void 0 ? void 0 : _a.getAccessToken());
454
- const teamsAppId = (await ((_b = ctx.configOfOtherPlugins
455
- .get(constants_2.SOLUTION)) === null || _b === void 0 ? void 0 : _b.get(constants_3.REMOTE_TEAMS_APP_ID)));
540
+ const teamsAppId = this.getTeamsAppId(ctx, false);
456
541
  if (!teamsAppId) {
457
- throw new Error(constants_2.ErrorMessages.GetConfigError(constants_3.REMOTE_TEAMS_APP_ID, constants_2.SOLUTION));
542
+ if (common_1.isMultiEnvEnabled()) {
543
+ throw new Error(constants_2.ErrorMessages.GetConfigError(constants_2.Constants.TEAMS_APP_ID, constants_1.PluginNames.APPST));
544
+ }
545
+ else {
546
+ throw new Error(constants_2.ErrorMessages.GetConfigError(constants_1.REMOTE_TEAMS_APP_ID, constants_2.SOLUTION));
547
+ }
458
548
  }
459
549
  const userLists = await appStudio_1.AppStudioClient.getUserList(teamsAppId, appStudioToken);
460
550
  if (!userLists) {
@@ -475,15 +565,19 @@ class AppStudioPluginImpl {
475
565
  return teamsAppAdmin;
476
566
  }
477
567
  async grantPermission(ctx) {
478
- var _a, _b, _c;
568
+ var _a, _b;
479
569
  let userInfoObject;
480
570
  const appStudioToken = await ((_a = ctx === null || ctx === void 0 ? void 0 : ctx.appStudioToken) === null || _a === void 0 ? void 0 : _a.getAccessToken());
481
- const teamsAppId = (await ((_b = ctx.configOfOtherPlugins
482
- .get(constants_2.SOLUTION)) === null || _b === void 0 ? void 0 : _b.get(constants_3.REMOTE_TEAMS_APP_ID)));
571
+ const teamsAppId = this.getTeamsAppId(ctx, false);
483
572
  if (!teamsAppId) {
484
- throw new Error(errors_1.AppStudioError.GrantPermissionFailedError.message(constants_2.ErrorMessages.GetConfigError(constants_3.REMOTE_TEAMS_APP_ID, constants_2.SOLUTION)));
573
+ if (common_1.isMultiEnvEnabled()) {
574
+ throw new Error(errors_1.AppStudioError.GrantPermissionFailedError.message(constants_2.ErrorMessages.GetConfigError(constants_2.Constants.TEAMS_APP_ID, constants_1.PluginNames.APPST)));
575
+ }
576
+ else {
577
+ throw new Error(errors_1.AppStudioError.GrantPermissionFailedError.message(constants_2.ErrorMessages.GetConfigError(constants_1.REMOTE_TEAMS_APP_ID, constants_2.SOLUTION)));
578
+ }
485
579
  }
486
- const userInfo = (_c = ctx.configOfOtherPlugins.get(constants_2.SOLUTION)) === null || _c === void 0 ? void 0 : _c.get(constants_1.USER_INFO);
580
+ const userInfo = (_b = ctx.envInfo.profile.get(constants_2.SOLUTION)) === null || _b === void 0 ? void 0 : _b.get(constants_1.USER_INFO);
487
581
  if (!userInfo) {
488
582
  throw new Error(errors_1.AppStudioError.GrantPermissionFailedError.message(constants_2.ErrorMessages.GetConfigError(constants_1.USER_INFO, constants_2.SOLUTION), teamsAppId));
489
583
  }
@@ -687,23 +781,23 @@ class AppStudioPluginImpl {
687
781
  if (!((_b = (_a = ctx === null || ctx === void 0 ? void 0 : ctx.projectSettings) === null || _a === void 0 ? void 0 : _a.solutionSettings) === null || _b === void 0 ? void 0 : _b.migrateFromV1) && !webApplicationInfoResource) {
688
782
  return teamsfx_api_1.err(localDebug
689
783
  ? results_1.AppStudioResultFactory.SystemError(errors_1.AppStudioError.GetLocalDebugConfigFailedError.name, errors_1.AppStudioError.GetLocalDebugConfigFailedError.message("webApplicationInfoResource", true))
690
- : results_1.AppStudioResultFactory.SystemError(errors_1.AppStudioError.GetRemoteConfigFailedError.name, errors_1.AppStudioError.GetRemoteConfigFailedError.message("webApplicationInfoResource", true)));
784
+ : results_1.AppStudioResultFactory.UserError(errors_1.AppStudioError.GetRemoteConfigFailedError.name, errors_1.AppStudioError.GetRemoteConfigFailedError.message("webApplicationInfoResource", true)));
691
785
  }
692
786
  if (!((_d = (_c = ctx === null || ctx === void 0 ? void 0 : ctx.projectSettings) === null || _c === void 0 ? void 0 : _c.solutionSettings) === null || _d === void 0 ? void 0 : _d.migrateFromV1) && !aadId) {
693
787
  return teamsfx_api_1.err(localDebug
694
788
  ? results_1.AppStudioResultFactory.SystemError(errors_1.AppStudioError.GetLocalDebugConfigFailedError.name, errors_1.AppStudioError.GetLocalDebugConfigFailedError.message(constants_1.LOCAL_DEBUG_AAD_ID, true))
695
- : results_1.AppStudioResultFactory.SystemError(errors_1.AppStudioError.GetRemoteConfigFailedError.name, errors_1.AppStudioError.GetRemoteConfigFailedError.message(constants_1.LOCAL_DEBUG_AAD_ID, true)));
789
+ : results_1.AppStudioResultFactory.UserError(errors_1.AppStudioError.GetRemoteConfigFailedError.name, errors_1.AppStudioError.GetRemoteConfigFailedError.message(constants_1.REMOTE_AAD_ID, true)));
696
790
  }
697
791
  if (!tabEndpoint && !botId) {
698
792
  if (common_1.isArmSupportEnabled()) {
699
793
  return teamsfx_api_1.err(localDebug
700
794
  ? results_1.AppStudioResultFactory.SystemError(errors_1.AppStudioError.GetLocalDebugConfigFailedError.name, errors_1.AppStudioError.GetLocalDebugConfigFailedError.message(constants_1.LOCAL_DEBUG_TAB_ENDPOINT + ", " + constants_2.LOCAL_BOT_ID, false))
701
- : results_1.AppStudioResultFactory.SystemError(errors_1.AppStudioError.GetRemoteConfigFailedError.name, errors_1.AppStudioError.GetRemoteConfigFailedError.message(constants_2.FRONTEND_ENDPOINT_ARM + ", " + constants_2.BOT_ID, false)));
795
+ : results_1.AppStudioResultFactory.UserError(errors_1.AppStudioError.GetRemoteConfigFailedError.name, errors_1.AppStudioError.GetRemoteConfigFailedError.message(constants_2.FRONTEND_ENDPOINT_ARM + ", " + constants_2.BOT_ID, false)));
702
796
  }
703
797
  else {
704
798
  return teamsfx_api_1.err(localDebug
705
799
  ? results_1.AppStudioResultFactory.SystemError(errors_1.AppStudioError.GetLocalDebugConfigFailedError.name, errors_1.AppStudioError.GetLocalDebugConfigFailedError.message(constants_1.LOCAL_DEBUG_TAB_ENDPOINT + ", " + constants_2.LOCAL_BOT_ID, false))
706
- : results_1.AppStudioResultFactory.SystemError(errors_1.AppStudioError.GetRemoteConfigFailedError.name, errors_1.AppStudioError.GetRemoteConfigFailedError.message(constants_2.FRONTEND_ENDPOINT + ", " + constants_2.BOT_ID, false)));
800
+ : results_1.AppStudioResultFactory.UserError(errors_1.AppStudioError.GetRemoteConfigFailedError.name, errors_1.AppStudioError.GetRemoteConfigFailedError.message(constants_2.FRONTEND_ENDPOINT + ", " + constants_2.BOT_ID, false)));
707
801
  }
708
802
  }
709
803
  if ((tabEndpoint && !tabDomain) || (!tabEndpoint && tabDomain)) {
@@ -722,7 +816,7 @@ class AppStudioPluginImpl {
722
816
  if (!botDomain) {
723
817
  return teamsfx_api_1.err(localDebug
724
818
  ? results_1.AppStudioResultFactory.SystemError(errors_1.AppStudioError.GetLocalDebugConfigFailedError.name, errors_1.AppStudioError.GetLocalDebugConfigFailedError.message(constants_1.LOCAL_DEBUG_BOT_DOMAIN, false))
725
- : results_1.AppStudioResultFactory.SystemError(errors_1.AppStudioError.GetRemoteConfigFailedError.name, errors_1.AppStudioError.GetRemoteConfigFailedError.message(constants_1.BOT_DOMAIN, false)));
819
+ : results_1.AppStudioResultFactory.UserError(errors_1.AppStudioError.GetRemoteConfigFailedError.name, errors_1.AppStudioError.GetRemoteConfigFailedError.message(constants_1.BOT_DOMAIN, false)));
726
820
  }
727
821
  }
728
822
  return teamsfx_api_1.ok({
@@ -741,13 +835,12 @@ class AppStudioPluginImpl {
741
835
  if (common_1.isMultiEnvEnabled()) {
742
836
  tabEndpoint = isLocalDebug
743
837
  ? (_b = (_a = ctx.localSettings) === null || _a === void 0 ? void 0 : _a.frontend) === null || _b === void 0 ? void 0 : _b.get(localSettingsConstants_1.LocalSettingsFrontendKeys.TabEndpoint)
744
- : (_c = ctx.configOfOtherPlugins.get(constants_1.PluginNames.FE)) === null || _c === void 0 ? void 0 : _c.get(constants_2.FRONTEND_ENDPOINT);
838
+ : (_c = ctx.envInfo.profile.get(constants_1.PluginNames.FE)) === null || _c === void 0 ? void 0 : _c.get(constants_2.FRONTEND_ENDPOINT);
745
839
  }
746
840
  else {
747
841
  tabEndpoint = isLocalDebug
748
- ? (_d = ctx.configOfOtherPlugins
749
- .get(constants_1.PluginNames.LDEBUG)) === null || _d === void 0 ? void 0 : _d.get(constants_1.LOCAL_DEBUG_TAB_ENDPOINT)
750
- : (_e = ctx.configOfOtherPlugins.get(constants_1.PluginNames.FE)) === null || _e === void 0 ? void 0 : _e.get(constants_2.FRONTEND_ENDPOINT);
842
+ ? (_d = ctx.envInfo.profile.get(constants_1.PluginNames.LDEBUG)) === null || _d === void 0 ? void 0 : _d.get(constants_1.LOCAL_DEBUG_TAB_ENDPOINT)
843
+ : (_e = ctx.envInfo.profile.get(constants_1.PluginNames.FE)) === null || _e === void 0 ? void 0 : _e.get(constants_2.FRONTEND_ENDPOINT);
751
844
  }
752
845
  return tabEndpoint;
753
846
  }
@@ -757,12 +850,12 @@ class AppStudioPluginImpl {
757
850
  if (common_1.isMultiEnvEnabled()) {
758
851
  tabDomain = isLocalDebug
759
852
  ? (_b = (_a = ctx.localSettings) === null || _a === void 0 ? void 0 : _a.frontend) === null || _b === void 0 ? void 0 : _b.get(localSettingsConstants_1.LocalSettingsFrontendKeys.TabDomain)
760
- : (_c = ctx.configOfOtherPlugins.get(constants_1.PluginNames.FE)) === null || _c === void 0 ? void 0 : _c.get(constants_2.FRONTEND_DOMAIN);
853
+ : (_c = ctx.envInfo.profile.get(constants_1.PluginNames.FE)) === null || _c === void 0 ? void 0 : _c.get(constants_2.FRONTEND_DOMAIN);
761
854
  }
762
855
  else {
763
856
  tabDomain = isLocalDebug
764
- ? (_d = ctx.configOfOtherPlugins.get(constants_1.PluginNames.LDEBUG)) === null || _d === void 0 ? void 0 : _d.get(constants_1.LOCAL_DEBUG_TAB_DOMAIN)
765
- : (_e = ctx.configOfOtherPlugins.get(constants_1.PluginNames.FE)) === null || _e === void 0 ? void 0 : _e.get(constants_2.FRONTEND_DOMAIN);
857
+ ? (_d = ctx.envInfo.profile.get(constants_1.PluginNames.LDEBUG)) === null || _d === void 0 ? void 0 : _d.get(constants_1.LOCAL_DEBUG_TAB_DOMAIN)
858
+ : (_e = ctx.envInfo.profile.get(constants_1.PluginNames.FE)) === null || _e === void 0 ? void 0 : _e.get(constants_2.FRONTEND_DOMAIN);
766
859
  }
767
860
  return tabDomain;
768
861
  }
@@ -772,10 +865,10 @@ class AppStudioPluginImpl {
772
865
  if (common_1.isMultiEnvEnabled()) {
773
866
  clientId = isLocalDebug
774
867
  ? (_b = (_a = ctx.localSettings) === null || _a === void 0 ? void 0 : _a.auth) === null || _b === void 0 ? void 0 : _b.get(localSettingsConstants_1.LocalSettingsAuthKeys.ClientId)
775
- : (_c = ctx.configOfOtherPlugins.get(constants_1.PluginNames.AAD)) === null || _c === void 0 ? void 0 : _c.get(constants_1.REMOTE_AAD_ID);
868
+ : (_c = ctx.envInfo.profile.get(constants_1.PluginNames.AAD)) === null || _c === void 0 ? void 0 : _c.get(constants_1.REMOTE_AAD_ID);
776
869
  }
777
870
  else {
778
- clientId = (_d = ctx.configOfOtherPlugins
871
+ clientId = (_d = ctx.envInfo.profile
779
872
  .get(constants_1.PluginNames.AAD)) === null || _d === void 0 ? void 0 : _d.get(isLocalDebug ? constants_1.LOCAL_DEBUG_AAD_ID : constants_1.REMOTE_AAD_ID);
780
873
  }
781
874
  return clientId;
@@ -786,10 +879,10 @@ class AppStudioPluginImpl {
786
879
  if (common_1.isMultiEnvEnabled()) {
787
880
  botId = isLocalDebug
788
881
  ? (_b = (_a = ctx.localSettings) === null || _a === void 0 ? void 0 : _a.bot) === null || _b === void 0 ? void 0 : _b.get(localSettingsConstants_1.LocalSettingsBotKeys.BotId)
789
- : (_c = ctx.configOfOtherPlugins.get(constants_1.PluginNames.BOT)) === null || _c === void 0 ? void 0 : _c.get(constants_2.BOT_ID);
882
+ : (_c = ctx.envInfo.profile.get(constants_1.PluginNames.BOT)) === null || _c === void 0 ? void 0 : _c.get(constants_2.BOT_ID);
790
883
  }
791
884
  else {
792
- botId = (_d = ctx.configOfOtherPlugins
885
+ botId = (_d = ctx.envInfo.profile
793
886
  .get(constants_1.PluginNames.BOT)) === null || _d === void 0 ? void 0 : _d.get(isLocalDebug ? constants_2.LOCAL_BOT_ID : constants_2.BOT_ID);
794
887
  }
795
888
  return botId;
@@ -800,12 +893,12 @@ class AppStudioPluginImpl {
800
893
  if (common_1.isMultiEnvEnabled()) {
801
894
  botDomain = isLocalDebug
802
895
  ? (_b = (_a = ctx.localSettings) === null || _a === void 0 ? void 0 : _a.bot) === null || _b === void 0 ? void 0 : _b.get(localSettingsConstants_1.LocalSettingsBotKeys.BotDomain)
803
- : (_c = ctx.configOfOtherPlugins.get(constants_1.PluginNames.BOT)) === null || _c === void 0 ? void 0 : _c.get(constants_1.BOT_DOMAIN);
896
+ : (_c = ctx.envInfo.profile.get(constants_1.PluginNames.BOT)) === null || _c === void 0 ? void 0 : _c.get(constants_1.BOT_DOMAIN);
804
897
  }
805
898
  else {
806
899
  botDomain = isLocalDebug
807
- ? (_d = ctx.configOfOtherPlugins.get(constants_1.PluginNames.LDEBUG)) === null || _d === void 0 ? void 0 : _d.get(constants_1.LOCAL_DEBUG_BOT_DOMAIN)
808
- : (_e = ctx.configOfOtherPlugins.get(constants_1.PluginNames.BOT)) === null || _e === void 0 ? void 0 : _e.get(constants_1.BOT_DOMAIN);
900
+ ? (_d = ctx.envInfo.profile.get(constants_1.PluginNames.LDEBUG)) === null || _d === void 0 ? void 0 : _d.get(constants_1.LOCAL_DEBUG_BOT_DOMAIN)
901
+ : (_e = ctx.envInfo.profile.get(constants_1.PluginNames.BOT)) === null || _e === void 0 ? void 0 : _e.get(constants_1.BOT_DOMAIN);
809
902
  }
810
903
  return botDomain;
811
904
  }
@@ -815,25 +908,26 @@ class AppStudioPluginImpl {
815
908
  if (common_1.isMultiEnvEnabled()) {
816
909
  applicationIdUris = isLocalDebug
817
910
  ? (_b = (_a = ctx.localSettings) === null || _a === void 0 ? void 0 : _a.auth) === null || _b === void 0 ? void 0 : _b.get(localSettingsConstants_1.LocalSettingsAuthKeys.ApplicationIdUris)
818
- : (_c = ctx.configOfOtherPlugins
819
- .get(constants_1.PluginNames.AAD)) === null || _c === void 0 ? void 0 : _c.get(constants_1.WEB_APPLICATION_INFO_SOURCE);
911
+ : (_c = ctx.envInfo.profile.get(constants_1.PluginNames.AAD)) === null || _c === void 0 ? void 0 : _c.get(constants_1.WEB_APPLICATION_INFO_SOURCE);
820
912
  }
821
913
  else {
822
- applicationIdUris = (_d = ctx.configOfOtherPlugins
914
+ applicationIdUris = (_d = ctx.envInfo.profile
823
915
  .get(constants_1.PluginNames.AAD)) === null || _d === void 0 ? void 0 : _d.get(isLocalDebug ? constants_1.LOCAL_WEB_APPLICATION_INFO_SOURCE : constants_1.WEB_APPLICATION_INFO_SOURCE);
824
916
  }
825
917
  return applicationIdUris;
826
918
  }
827
919
  getTeamsAppId(ctx, isLocalDebug) {
828
- var _a, _b, _c;
920
+ var _a, _b, _c, _d;
829
921
  let teamsAppId;
830
922
  if (isLocalDebug) {
831
923
  teamsAppId = common_1.isMultiEnvEnabled()
832
924
  ? (_a = ctx.localSettings) === null || _a === void 0 ? void 0 : _a.teamsApp.get(localSettingsConstants_1.LocalSettingsTeamsAppKeys.TeamsAppId)
833
- : (_b = ctx.configOfOtherPlugins.get("solution")) === null || _b === void 0 ? void 0 : _b.get(constants_1.LOCAL_DEBUG_TEAMS_APP_ID);
925
+ : (_b = ctx.envInfo.profile.get("solution")) === null || _b === void 0 ? void 0 : _b.get(constants_1.LOCAL_DEBUG_TEAMS_APP_ID);
834
926
  }
835
927
  else {
836
- teamsAppId = (_c = ctx.configOfOtherPlugins.get("solution")) === null || _c === void 0 ? void 0 : _c.get(constants_3.REMOTE_TEAMS_APP_ID);
928
+ teamsAppId = common_1.isMultiEnvEnabled()
929
+ ? (_c = ctx.envInfo.profile.get(constants_1.PluginNames.APPST)) === null || _c === void 0 ? void 0 : _c.get(constants_2.Constants.TEAMS_APP_ID)
930
+ : (_d = ctx.envInfo.profile.get("solution")) === null || _d === void 0 ? void 0 : _d.get(constants_1.REMOTE_TEAMS_APP_ID);
837
931
  }
838
932
  return teamsAppId;
839
933
  }
@@ -851,6 +945,8 @@ class AppStudioPluginImpl {
851
945
  appDefinition.appId = appManifest.id;
852
946
  appDefinition.appName = appManifest.name.short;
853
947
  appDefinition.shortName = appManifest.name.short;
948
+ appDefinition.longName = appManifest.name.full;
949
+ appDefinition.manifestVersion = appManifest.manifestVersion;
854
950
  appDefinition.version = appManifest.version;
855
951
  appDefinition.packageName = appManifest.packageName;
856
952
  appDefinition.accentColor = appManifest.accentColor;
@@ -890,7 +986,6 @@ class AppStudioPluginImpl {
890
986
  const manifest = await fs.readJSON(await this.getManifestTemplatePath(ctx.root));
891
987
  manifest.bots = undefined;
892
988
  manifest.composeExtensions = undefined;
893
- // For SPFX remote teams app, manifest.id == componentId
894
989
  if (isLocalDebug || !isUUID_1.default(manifest.id)) {
895
990
  manifest.id = uuid_1.v4();
896
991
  }
@@ -918,7 +1013,7 @@ class AppStudioPluginImpl {
918
1013
  : results_1.AppStudioResultFactory.SystemError(errors_1.AppStudioError.RemoteAppIdCreateFailedError.name, errors_1.AppStudioError.RemoteAppIdCreateFailedError.message(e)));
919
1014
  }
920
1015
  }
921
- async updateApp(ctx, appDefinition, appStudioToken, type, createIfNotExist, teamsAppId, logProvider, appDirectory) {
1016
+ async updateApp(ctx, appDefinition, appStudioToken, type, createIfNotExist, appDirectory, teamsAppId, logProvider) {
922
1017
  if (appStudioToken === undefined || appStudioToken.length === 0) {
923
1018
  return teamsfx_api_1.err(results_1.AppStudioResultFactory.SystemError(errors_1.AppStudioError.AppStudioTokenGetFailedError.name, errors_1.AppStudioError.AppStudioTokenGetFailedError.message));
924
1019
  }
@@ -957,7 +1052,7 @@ class AppStudioPluginImpl {
957
1052
  }
958
1053
  }
959
1054
  async getAppDefinitionAndManifest(ctx, isLocalDebug) {
960
- var _a, _b, _c, _d;
1055
+ var _a, _b;
961
1056
  const configs = this.getConfigForCreatingManifest(ctx, isLocalDebug);
962
1057
  if (configs.isErr()) {
963
1058
  return teamsfx_api_1.err(configs.error);
@@ -971,14 +1066,31 @@ class AppStudioPluginImpl {
971
1066
  validDomains.push(botDomain);
972
1067
  }
973
1068
  let manifest = (await fs.readFile(await this.getManifestTemplatePath(ctx.root))).toString();
1069
+ if (common_1.isMultiEnvEnabled()) {
1070
+ const view = {
1071
+ config: ctx.envInfo.config,
1072
+ profile: {
1073
+ "fx-resource-frontend-hosting": {
1074
+ endpoint: tabEndpoint,
1075
+ },
1076
+ "fx-resource-aad-app-for-teams": {
1077
+ clientId: aadId,
1078
+ applicationIdUris: webApplicationInfoResource,
1079
+ },
1080
+ "fx-resource-appstudio": {
1081
+ teamsAppId: teamsAppId,
1082
+ },
1083
+ "fx-resource-bot": {
1084
+ botId: botId,
1085
+ },
1086
+ },
1087
+ };
1088
+ manifest = mustache_1.default.render(manifest, view);
1089
+ }
974
1090
  const appName = (_a = ctx.projectSettings) === null || _a === void 0 ? void 0 : _a.appName;
975
1091
  if (appName) {
976
1092
  manifest = this.replaceConfigValue(manifest, "appName", appName);
977
1093
  }
978
- const version = (_c = (_b = ctx.projectSettings) === null || _b === void 0 ? void 0 : _b.solutionSettings) === null || _c === void 0 ? void 0 : _c.version;
979
- if (version) {
980
- manifest = this.replaceConfigValue(manifest, "version", version);
981
- }
982
1094
  if (botId) {
983
1095
  manifest = this.replaceConfigValue(manifest, "botId", botId);
984
1096
  }
@@ -990,9 +1102,26 @@ class AppStudioPluginImpl {
990
1102
  if (webApplicationInfoResource) {
991
1103
  manifest = this.replaceConfigValue(manifest, "webApplicationInfoResource", webApplicationInfoResource);
992
1104
  }
993
- const updatedManifest = JSON.parse(manifest);
1105
+ let updatedManifest;
1106
+ try {
1107
+ updatedManifest = JSON.parse(manifest);
1108
+ }
1109
+ catch (error) {
1110
+ if (error.stack && error.stack.startsWith("SyntaxError")) {
1111
+ // teams app id in userData may be updated by user, result to invalid manifest
1112
+ const reg = /^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/;
1113
+ const result = teamsAppId.match(reg);
1114
+ if (!result) {
1115
+ return teamsfx_api_1.err(results_1.AppStudioResultFactory.UserError(errors_1.AppStudioError.InvalidManifestError.name, errors_1.AppStudioError.InvalidManifestError.message(error, "teamsAppId"), undefined, error.stack));
1116
+ }
1117
+ return teamsfx_api_1.err(results_1.AppStudioResultFactory.UserError(errors_1.AppStudioError.InvalidManifestError.name, errors_1.AppStudioError.InvalidManifestError.message(error), undefined, error.stack));
1118
+ }
1119
+ else {
1120
+ return teamsfx_api_1.err(error);
1121
+ }
1122
+ }
994
1123
  for (const domain of validDomains) {
995
- (_d = updatedManifest.validDomains) === null || _d === void 0 ? void 0 : _d.push(domain);
1124
+ (_b = updatedManifest.validDomains) === null || _b === void 0 ? void 0 : _b.push(domain);
996
1125
  }
997
1126
  if (!tabEndpoint && updatedManifest.developer) {
998
1127
  updatedManifest.developer.websiteUrl = constants_2.DEFAULT_DEVELOPER_WEBSITE_URL;