@microsoft/teamsfx-core 1.16.1 → 1.16.3-alpha.311dfaffe.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 (758) hide show
  1. package/build/common/azure-hosting/azureHosting.d.ts.map +1 -1
  2. package/build/common/azure-hosting/azureHosting.js +3 -3
  3. package/build/common/azure-hosting/azureHosting.js.map +1 -1
  4. package/build/common/constants.d.ts +2 -1
  5. package/build/common/constants.d.ts.map +1 -1
  6. package/build/common/constants.js +2 -1
  7. package/build/common/constants.js.map +1 -1
  8. package/build/common/featureFlags.d.ts +1 -0
  9. package/build/common/featureFlags.d.ts.map +1 -1
  10. package/build/common/featureFlags.js +5 -1
  11. package/build/common/featureFlags.js.map +1 -1
  12. package/build/common/local/localEnvManager.d.ts.map +1 -1
  13. package/build/common/local/localEnvManager.js +1 -4
  14. package/build/common/local/localEnvManager.js.map +1 -1
  15. package/build/common/local/projectSettingsHelper.d.ts.map +1 -1
  16. package/build/common/local/projectSettingsHelper.js +11 -51
  17. package/build/common/local/projectSettingsHelper.js.map +1 -1
  18. package/build/common/localStateProvider.d.ts.map +1 -1
  19. package/build/common/localStateProvider.js +1 -2
  20. package/build/common/localStateProvider.js.map +1 -1
  21. package/build/common/samples-config.json +12 -0
  22. package/build/common/templates-config.json +2 -2
  23. package/build/common/tools.d.ts +1 -0
  24. package/build/common/tools.d.ts.map +1 -1
  25. package/build/common/tools.js +9 -6
  26. package/build/common/tools.js.map +1 -1
  27. package/build/component/code/appSettingUtils.js +2 -2
  28. package/build/component/code/appSettingUtils.js.map +1 -1
  29. package/build/component/code/spfxTabCode.d.ts.map +1 -1
  30. package/build/component/code/spfxTabCode.js +10 -10
  31. package/build/component/code/spfxTabCode.js.map +1 -1
  32. package/build/component/core.js +9 -9
  33. package/build/component/core.js.map +1 -1
  34. package/build/component/debug.d.ts.map +1 -1
  35. package/build/component/debug.js +65 -51
  36. package/build/component/debug.js.map +1 -1
  37. package/build/component/debugHandler/appManifest.d.ts +1 -1
  38. package/build/component/debugHandler/appManifest.d.ts.map +1 -1
  39. package/build/component/debugHandler/appManifest.js +27 -25
  40. package/build/component/debugHandler/appManifest.js.map +1 -1
  41. package/build/component/debugHandler/bot.d.ts +0 -1
  42. package/build/component/debugHandler/bot.d.ts.map +1 -1
  43. package/build/component/debugHandler/bot.js +36 -31
  44. package/build/component/debugHandler/bot.js.map +1 -1
  45. package/build/component/debugHandler/error.d.ts +3 -3
  46. package/build/component/debugHandler/error.d.ts.map +1 -1
  47. package/build/component/debugHandler/error.js +14 -14
  48. package/build/component/debugHandler/error.js.map +1 -1
  49. package/build/component/debugHandler/index.d.ts +1 -0
  50. package/build/component/debugHandler/index.d.ts.map +1 -1
  51. package/build/component/debugHandler/index.js +1 -0
  52. package/build/component/debugHandler/index.js.map +1 -1
  53. package/build/component/debugHandler/localEnvProvider.js +1 -1
  54. package/build/component/debugHandler/localEnvProvider.js.map +1 -1
  55. package/build/component/debugHandler/sso.d.ts +0 -1
  56. package/build/component/debugHandler/sso.d.ts.map +1 -1
  57. package/build/component/debugHandler/sso.js +80 -69
  58. package/build/component/debugHandler/sso.js.map +1 -1
  59. package/build/component/debugHandler/tab.d.ts.map +1 -1
  60. package/build/component/debugHandler/tab.js +11 -12
  61. package/build/component/debugHandler/tab.js.map +1 -1
  62. package/build/component/error.d.ts +3 -0
  63. package/build/component/error.d.ts.map +1 -1
  64. package/build/component/error.js +11 -1
  65. package/build/component/error.js.map +1 -1
  66. package/build/component/feature/api.js +3 -3
  67. package/build/component/feature/api.js.map +1 -1
  68. package/build/component/feature/apiconnector/sampleHandler.d.ts.map +1 -1
  69. package/build/component/feature/apiconnector/sampleHandler.js +2 -2
  70. package/build/component/feature/apiconnector/sampleHandler.js.map +1 -1
  71. package/build/component/feature/apiconnector/telemetry.js +2 -2
  72. package/build/component/feature/apiconnector/telemetry.js.map +1 -1
  73. package/build/component/feature/apim.d.ts.map +1 -1
  74. package/build/component/feature/apim.js +3 -3
  75. package/build/component/feature/apim.js.map +1 -1
  76. package/build/component/feature/bot.d.ts.map +1 -1
  77. package/build/component/feature/bot.js +5 -4
  78. package/build/component/feature/bot.js.map +1 -1
  79. package/build/component/feature/keyVault.js +2 -2
  80. package/build/component/feature/keyVault.js.map +1 -1
  81. package/build/component/feature/spfx.d.ts.map +1 -1
  82. package/build/component/feature/spfx.js +5 -12
  83. package/build/component/feature/spfx.js.map +1 -1
  84. package/build/component/feature/sql.d.ts.map +1 -1
  85. package/build/component/feature/sql.js +3 -3
  86. package/build/component/feature/sql.js.map +1 -1
  87. package/build/component/feature/sso.d.ts.map +1 -1
  88. package/build/component/feature/sso.js +45 -44
  89. package/build/component/feature/sso.js.map +1 -1
  90. package/build/component/feature/tab.js +2 -2
  91. package/build/component/feature/tab.js.map +1 -1
  92. package/build/component/migrate.d.ts.map +1 -1
  93. package/build/component/migrate.js +41 -47
  94. package/build/component/migrate.js.map +1 -1
  95. package/build/component/provisionUtils.js +2 -2
  96. package/build/component/provisionUtils.js.map +1 -1
  97. package/build/component/questionV3.d.ts +3 -0
  98. package/build/component/questionV3.d.ts.map +1 -1
  99. package/build/component/questionV3.js +27 -4
  100. package/build/component/questionV3.js.map +1 -1
  101. package/build/component/resource/aadApp/aadApp.d.ts +5 -0
  102. package/build/component/resource/aadApp/aadApp.d.ts.map +1 -1
  103. package/build/component/resource/aadApp/aadApp.js +60 -13
  104. package/build/component/resource/aadApp/aadApp.js.map +1 -1
  105. package/build/{plugins/resource/aad → component/resource/aadApp}/aadAppClient.d.ts +0 -0
  106. package/build/component/resource/aadApp/aadAppClient.d.ts.map +1 -0
  107. package/build/{plugins/resource/aad → component/resource/aadApp}/aadAppClient.js +2 -2
  108. package/build/component/resource/aadApp/aadAppClient.js.map +1 -0
  109. package/build/{plugins/resource/aad/plugin.d.ts → component/resource/aadApp/aadAppForTeamsImpl.d.ts} +6 -9
  110. package/build/component/resource/aadApp/aadAppForTeamsImpl.d.ts.map +1 -0
  111. package/build/{plugins/resource/aad/plugin.js → component/resource/aadApp/aadAppForTeamsImpl.js} +44 -119
  112. package/build/component/resource/aadApp/aadAppForTeamsImpl.js.map +1 -0
  113. package/build/{plugins/resource/aad → component/resource/aadApp}/aadAppManifestManager.d.ts +0 -0
  114. package/build/component/resource/aadApp/aadAppManifestManager.d.ts.map +1 -0
  115. package/build/{plugins/resource/aad → component/resource/aadApp}/aadAppManifestManager.js +0 -0
  116. package/build/component/resource/aadApp/aadAppManifestManager.js.map +1 -0
  117. package/build/{plugins/resource/aad → component/resource/aadApp}/appStudio.d.ts +0 -0
  118. package/build/component/resource/aadApp/appStudio.d.ts.map +1 -0
  119. package/build/{plugins/resource/aad → component/resource/aadApp}/appStudio.js +1 -1
  120. package/build/component/resource/aadApp/appStudio.js.map +1 -0
  121. package/build/{plugins/resource/aad → component/resource/aadApp}/constants.d.ts +0 -0
  122. package/build/component/resource/aadApp/constants.d.ts.map +1 -0
  123. package/build/{plugins/resource/aad → component/resource/aadApp}/constants.js +0 -0
  124. package/build/component/resource/aadApp/constants.js.map +1 -0
  125. package/build/{plugins/resource/aad → component/resource/aadApp}/errorCodes.d.ts +0 -0
  126. package/build/component/resource/aadApp/errorCodes.d.ts.map +1 -0
  127. package/build/{plugins/resource/aad → component/resource/aadApp}/errorCodes.js +0 -0
  128. package/build/component/resource/aadApp/errorCodes.js.map +1 -0
  129. package/build/{plugins/resource/aad → component/resource/aadApp}/errors.d.ts +0 -0
  130. package/build/component/resource/aadApp/errors.d.ts.map +1 -0
  131. package/build/{plugins/resource/aad → component/resource/aadApp}/errors.js +0 -0
  132. package/build/component/resource/aadApp/errors.js.map +1 -0
  133. package/build/{plugins/resource/aad → component/resource/aadApp}/graph.d.ts +0 -0
  134. package/build/component/resource/aadApp/graph.d.ts.map +1 -0
  135. package/build/{plugins/resource/aad → component/resource/aadApp}/graph.js +0 -0
  136. package/build/component/resource/aadApp/graph.js.map +1 -0
  137. package/build/{plugins/resource/aad → component/resource/aadApp}/interfaces/AADApplication.d.ts +0 -0
  138. package/build/component/resource/aadApp/interfaces/AADApplication.d.ts.map +1 -0
  139. package/build/{plugins/resource/aad → component/resource/aadApp}/interfaces/AADApplication.js +0 -0
  140. package/build/component/resource/aadApp/interfaces/AADApplication.js.map +1 -0
  141. package/build/{plugins/resource/aad → component/resource/aadApp}/interfaces/AADManifest.d.ts +0 -0
  142. package/build/component/resource/aadApp/interfaces/AADManifest.d.ts.map +1 -0
  143. package/build/{plugins/resource/aad → component/resource/aadApp}/interfaces/AADManifest.js +0 -0
  144. package/build/component/resource/aadApp/interfaces/AADManifest.js.map +1 -0
  145. package/build/{plugins/resource/aad → component/resource/aadApp}/interfaces/IAADApplication.d.ts +0 -0
  146. package/build/component/resource/aadApp/interfaces/IAADApplication.d.ts.map +1 -0
  147. package/build/{plugins/resource/aad → component/resource/aadApp}/interfaces/IAADApplication.js +0 -0
  148. package/build/component/resource/aadApp/interfaces/IAADApplication.js.map +1 -0
  149. package/build/{plugins/resource/aad → component/resource/aadApp}/interfaces/IAADDefinition.d.ts +0 -0
  150. package/build/component/resource/aadApp/interfaces/IAADDefinition.d.ts.map +1 -0
  151. package/build/{plugins/resource/aad → component/resource/aadApp}/interfaces/IAADDefinition.js +0 -0
  152. package/build/component/resource/aadApp/interfaces/IAADDefinition.js.map +1 -0
  153. package/build/{plugins/resource/aad → component/resource/aadApp}/interfaces/IPermission.d.ts +0 -0
  154. package/build/component/resource/aadApp/interfaces/IPermission.d.ts.map +1 -0
  155. package/build/{plugins/resource/aad → component/resource/aadApp}/interfaces/IPermission.js +0 -0
  156. package/build/component/resource/aadApp/interfaces/IPermission.js.map +1 -0
  157. package/build/{plugins/resource/aad → component/resource/aadApp}/interfaces/IPermissionList.d.ts +0 -0
  158. package/build/component/resource/aadApp/interfaces/IPermissionList.d.ts.map +1 -0
  159. package/build/{plugins/resource/aad → component/resource/aadApp}/interfaces/IPermissionList.js +0 -0
  160. package/build/component/resource/aadApp/interfaces/IPermissionList.js.map +1 -0
  161. package/build/{plugins/resource/aad → component/resource/aadApp}/interfaces/models.d.ts +0 -0
  162. package/build/component/resource/aadApp/interfaces/models.d.ts.map +1 -0
  163. package/build/{plugins/resource/aad → component/resource/aadApp}/interfaces/models.js +0 -0
  164. package/build/component/resource/aadApp/interfaces/models.js.map +1 -0
  165. package/build/{plugins/resource/aad → component/resource/aadApp}/permissions/index.d.ts +0 -0
  166. package/build/component/resource/aadApp/permissions/index.d.ts.map +1 -0
  167. package/build/{plugins/resource/aad → component/resource/aadApp}/permissions/index.js +1 -1
  168. package/build/component/resource/aadApp/permissions/index.js.map +1 -0
  169. package/build/{plugins/resource/aad → component/resource/aadApp}/permissions/permissions.json +0 -0
  170. package/build/{plugins/resource/aad → component/resource/aadApp}/results.d.ts +0 -0
  171. package/build/component/resource/aadApp/results.d.ts.map +1 -0
  172. package/build/{plugins/resource/aad → component/resource/aadApp}/results.js +0 -0
  173. package/build/component/resource/aadApp/results.js.map +1 -0
  174. package/build/{plugins/resource/aad → component/resource/aadApp}/utils/aadManifestHelper.d.ts +0 -0
  175. package/build/component/resource/aadApp/utils/aadManifestHelper.d.ts.map +1 -0
  176. package/build/{plugins/resource/aad → component/resource/aadApp}/utils/aadManifestHelper.js +0 -0
  177. package/build/component/resource/aadApp/utils/aadManifestHelper.js.map +1 -0
  178. package/build/{plugins/resource/aad → component/resource/aadApp}/utils/configs.d.ts +0 -0
  179. package/build/component/resource/aadApp/utils/configs.d.ts.map +1 -0
  180. package/build/{plugins/resource/aad → component/resource/aadApp}/utils/configs.js +9 -11
  181. package/build/component/resource/aadApp/utils/configs.js.map +1 -0
  182. package/build/{plugins/resource/aad → component/resource/aadApp}/utils/dialog.d.ts +0 -0
  183. package/build/component/resource/aadApp/utils/dialog.d.ts.map +1 -0
  184. package/build/{plugins/resource/aad → component/resource/aadApp}/utils/dialog.js +0 -0
  185. package/build/component/resource/aadApp/utils/dialog.js.map +1 -0
  186. package/build/{plugins/resource/aad → component/resource/aadApp}/utils/format.d.ts +0 -0
  187. package/build/component/resource/aadApp/utils/format.d.ts.map +1 -0
  188. package/build/{plugins/resource/aad → component/resource/aadApp}/utils/format.js +0 -0
  189. package/build/component/resource/aadApp/utils/format.js.map +1 -0
  190. package/build/{plugins/resource/aad → component/resource/aadApp}/utils/telemetry.d.ts +0 -0
  191. package/build/component/resource/aadApp/utils/telemetry.d.ts.map +1 -0
  192. package/build/{plugins/resource/aad → component/resource/aadApp}/utils/telemetry.js +1 -1
  193. package/build/component/resource/aadApp/utils/telemetry.js.map +1 -0
  194. package/build/{plugins/resource/aad → component/resource/aadApp}/utils/tokenProvider.d.ts +0 -0
  195. package/build/component/resource/aadApp/utils/tokenProvider.d.ts.map +1 -0
  196. package/build/{plugins/resource/aad → component/resource/aadApp}/utils/tokenProvider.js +5 -5
  197. package/build/component/resource/aadApp/utils/tokenProvider.js.map +1 -0
  198. package/build/component/resource/aadApp/utils.d.ts +3 -1
  199. package/build/component/resource/aadApp/utils.d.ts.map +1 -1
  200. package/build/component/resource/aadApp/utils.js +165 -1
  201. package/build/component/resource/aadApp/utils.js.map +1 -1
  202. package/build/component/resource/apim/config.d.ts.map +1 -1
  203. package/build/component/resource/apim/config.js +5 -6
  204. package/build/component/resource/apim/config.js.map +1 -1
  205. package/build/component/resource/apim/factory.js +2 -2
  206. package/build/component/resource/apim/factory.js.map +1 -1
  207. package/build/component/resource/appManifest/appManifest.d.ts +1 -1
  208. package/build/component/resource/appManifest/appManifest.d.ts.map +1 -1
  209. package/build/component/resource/appManifest/appManifest.js +3 -3
  210. package/build/component/resource/appManifest/appManifest.js.map +1 -1
  211. package/build/component/resource/appManifest/constants.d.ts +1 -0
  212. package/build/component/resource/appManifest/constants.d.ts.map +1 -1
  213. package/build/component/resource/appManifest/constants.js +28 -8
  214. package/build/component/resource/appManifest/constants.js.map +1 -1
  215. package/build/component/resource/appManifest/utils.d.ts +1 -1
  216. package/build/component/resource/appManifest/utils.d.ts.map +1 -1
  217. package/build/component/resource/appManifest/utils.js +4 -6
  218. package/build/component/resource/appManifest/utils.js.map +1 -1
  219. package/build/component/resource/azureSql/config.js +3 -3
  220. package/build/component/resource/azureSql/config.js.map +1 -1
  221. package/build/component/resource/keyVault.d.ts +2 -0
  222. package/build/component/resource/keyVault.d.ts.map +1 -1
  223. package/build/component/resource/keyVault.js +18 -0
  224. package/build/component/resource/keyVault.js.map +1 -1
  225. package/build/{plugins/resource/simpleauth → component/resource/simpleAuth}/constants.d.ts +0 -0
  226. package/build/component/resource/simpleAuth/constants.d.ts.map +1 -0
  227. package/build/{plugins/resource/simpleauth → component/resource/simpleAuth}/constants.js +0 -0
  228. package/build/component/resource/simpleAuth/constants.js.map +1 -0
  229. package/build/{plugins/resource/simpleauth → component/resource/simpleAuth}/errors.d.ts +0 -0
  230. package/build/component/resource/simpleAuth/errors.d.ts.map +1 -0
  231. package/build/{plugins/resource/simpleauth → component/resource/simpleAuth}/errors.js +0 -0
  232. package/build/component/resource/simpleAuth/errors.js.map +1 -0
  233. package/build/component/resource/{simpleAuth.d.ts → simpleAuth/index.d.ts} +1 -1
  234. package/build/component/resource/simpleAuth/index.d.ts.map +1 -0
  235. package/build/component/resource/{simpleAuth.js → simpleAuth/index.js} +10 -10
  236. package/build/component/resource/simpleAuth/index.js.map +1 -0
  237. package/build/{plugins/resource/simpleauth → component/resource/simpleAuth}/result.d.ts +0 -0
  238. package/build/component/resource/simpleAuth/result.d.ts.map +1 -0
  239. package/build/{plugins/resource/simpleauth → component/resource/simpleAuth}/result.js +0 -0
  240. package/build/component/resource/simpleAuth/result.js.map +1 -0
  241. package/build/{plugins/resource/simpleauth → component/resource/simpleAuth}/utils/common.d.ts +0 -0
  242. package/build/component/resource/simpleAuth/utils/common.d.ts.map +1 -0
  243. package/build/{plugins/resource/simpleauth → component/resource/simpleAuth}/utils/common.js +0 -0
  244. package/build/component/resource/simpleAuth/utils/common.js.map +1 -0
  245. package/build/{plugins/resource/simpleauth → component/resource/simpleAuth}/utils/dialog.d.ts +0 -0
  246. package/build/component/resource/simpleAuth/utils/dialog.d.ts.map +1 -0
  247. package/build/{plugins/resource/simpleauth → component/resource/simpleAuth}/utils/dialog.js +0 -0
  248. package/build/component/resource/simpleAuth/utils/dialog.js.map +1 -0
  249. package/build/{plugins/resource/keyvault → component/resource/simpleAuth}/utils/telemetry.d.ts +0 -0
  250. package/build/component/resource/simpleAuth/utils/telemetry.d.ts.map +1 -0
  251. package/build/{plugins/resource/simpleauth → component/resource/simpleAuth}/utils/telemetry.js +0 -0
  252. package/build/component/resource/simpleAuth/utils/telemetry.js.map +1 -0
  253. package/build/{plugins → component}/resource/spfx/depsChecker/dependencyChecker.d.ts +0 -0
  254. package/build/component/resource/spfx/depsChecker/dependencyChecker.d.ts.map +1 -0
  255. package/build/{plugins → component}/resource/spfx/depsChecker/dependencyChecker.js +0 -0
  256. package/build/component/resource/spfx/depsChecker/dependencyChecker.js.map +1 -0
  257. package/build/{plugins → component}/resource/spfx/depsChecker/generatorChecker.d.ts +0 -0
  258. package/build/component/resource/spfx/depsChecker/generatorChecker.d.ts.map +1 -0
  259. package/build/{plugins → component}/resource/spfx/depsChecker/generatorChecker.js +16 -7
  260. package/build/component/resource/spfx/depsChecker/generatorChecker.js.map +1 -0
  261. package/build/{plugins → component}/resource/spfx/depsChecker/yoChecker.d.ts +0 -0
  262. package/build/component/resource/spfx/depsChecker/yoChecker.d.ts.map +1 -0
  263. package/build/{plugins → component}/resource/spfx/depsChecker/yoChecker.js +0 -0
  264. package/build/component/resource/spfx/depsChecker/yoChecker.js.map +1 -0
  265. package/build/{plugins → component}/resource/spfx/error.d.ts +0 -0
  266. package/build/component/resource/spfx/error.d.ts.map +1 -0
  267. package/build/{plugins → component}/resource/spfx/error.js +5 -4
  268. package/build/component/resource/spfx/error.js.map +1 -0
  269. package/build/component/resource/spfx/index.d.ts.map +1 -1
  270. package/build/component/resource/spfx/index.js +9 -9
  271. package/build/component/resource/spfx/index.js.map +1 -1
  272. package/build/{plugins → component}/resource/spfx/spoClient.d.ts +0 -0
  273. package/build/component/resource/spfx/spoClient.d.ts.map +1 -0
  274. package/build/{plugins → component}/resource/spfx/spoClient.js +0 -0
  275. package/build/component/resource/spfx/spoClient.js.map +1 -0
  276. package/build/{plugins → component}/resource/spfx/utils/constants.d.ts +3 -0
  277. package/build/component/resource/spfx/utils/constants.d.ts.map +1 -0
  278. package/build/{plugins → component}/resource/spfx/utils/constants.js +3 -0
  279. package/build/component/resource/spfx/utils/constants.js.map +1 -0
  280. package/build/{plugins → component}/resource/spfx/utils/progress-helper.d.ts +0 -0
  281. package/build/component/resource/spfx/utils/progress-helper.d.ts.map +1 -0
  282. package/build/{plugins → component}/resource/spfx/utils/progress-helper.js +0 -0
  283. package/build/component/resource/spfx/utils/progress-helper.js.map +1 -0
  284. package/build/{plugins → component}/resource/spfx/utils/questions.d.ts +0 -0
  285. package/build/component/resource/spfx/utils/questions.d.ts.map +1 -0
  286. package/build/{plugins → component}/resource/spfx/utils/questions.js +8 -2
  287. package/build/component/resource/spfx/utils/questions.js.map +1 -0
  288. package/build/{plugins → component}/resource/spfx/utils/telemetry-helper.d.ts +0 -0
  289. package/build/component/resource/spfx/utils/telemetry-helper.d.ts.map +1 -0
  290. package/build/{plugins → component}/resource/spfx/utils/telemetry-helper.js +0 -0
  291. package/build/component/resource/spfx/utils/telemetry-helper.js.map +1 -0
  292. package/build/{plugins → component}/resource/spfx/utils/telemetryEvents.d.ts +0 -0
  293. package/build/component/resource/spfx/utils/telemetryEvents.d.ts.map +1 -0
  294. package/build/{plugins → component}/resource/spfx/utils/telemetryEvents.js +0 -0
  295. package/build/component/resource/spfx/utils/telemetryEvents.js.map +1 -0
  296. package/build/{plugins → component}/resource/spfx/utils/utils.d.ts +2 -1
  297. package/build/component/resource/spfx/utils/utils.d.ts.map +1 -0
  298. package/build/{plugins → component}/resource/spfx/utils/utils.js +9 -4
  299. package/build/component/resource/spfx/utils/utils.js.map +1 -0
  300. package/build/core/FxCore.d.ts +10 -44
  301. package/build/core/FxCore.d.ts.map +1 -1
  302. package/build/core/FxCore.js +54 -696
  303. package/build/core/FxCore.js.map +1 -1
  304. package/build/core/collaborator.d.ts +6 -1
  305. package/build/core/collaborator.d.ts.map +1 -1
  306. package/build/core/collaborator.js +75 -23
  307. package/build/core/collaborator.js.map +1 -1
  308. package/build/core/environment.d.ts.map +1 -1
  309. package/build/core/environment.js +2 -7
  310. package/build/core/environment.js.map +1 -1
  311. package/build/core/generateAadManifestTemplate.d.ts +1 -1
  312. package/build/core/generateAadManifestTemplate.d.ts.map +1 -1
  313. package/build/core/generateAadManifestTemplate.js +11 -14
  314. package/build/core/generateAadManifestTemplate.js.map +1 -1
  315. package/build/core/globalVars.d.ts +0 -1
  316. package/build/core/globalVars.d.ts.map +1 -1
  317. package/build/core/globalVars.js +1 -5
  318. package/build/core/globalVars.js.map +1 -1
  319. package/build/core/index.d.ts +0 -5
  320. package/build/core/index.d.ts.map +1 -1
  321. package/build/core/index.js +0 -7
  322. package/build/core/index.js.map +1 -1
  323. package/build/core/middleware/MigrationUtils.d.ts +1 -1
  324. package/build/core/middleware/MigrationUtils.d.ts.map +1 -1
  325. package/build/core/middleware/MigrationUtils.js +2 -2
  326. package/build/core/middleware/MigrationUtils.js.map +1 -1
  327. package/build/core/middleware/consolidateLocalRemote.js +1 -1
  328. package/build/core/middleware/consolidateLocalRemote.js.map +1 -1
  329. package/build/core/middleware/envInfoLoader.d.ts.map +1 -1
  330. package/build/core/middleware/envInfoLoader.js +1 -4
  331. package/build/core/middleware/envInfoLoader.js.map +1 -1
  332. package/build/core/middleware/envInfoLoaderV3.d.ts.map +1 -1
  333. package/build/core/middleware/envInfoLoaderV3.js +1 -4
  334. package/build/core/middleware/envInfoLoaderV3.js.map +1 -1
  335. package/build/core/middleware/projectMigrator.js +2 -2
  336. package/build/core/middleware/projectMigrator.js.map +1 -1
  337. package/build/core/middleware/projectSettingsLoader.d.ts.map +1 -1
  338. package/build/core/middleware/projectSettingsLoader.js +1 -10
  339. package/build/core/middleware/projectSettingsLoader.js.map +1 -1
  340. package/build/core/middleware/projectSettingsWriter.d.ts.map +1 -1
  341. package/build/core/middleware/projectSettingsWriter.js +1 -3
  342. package/build/core/middleware/projectSettingsWriter.js.map +1 -1
  343. package/build/core/middleware/questionModel.d.ts +1 -10
  344. package/build/core/middleware/questionModel.d.ts.map +1 -1
  345. package/build/core/middleware/questionModel.js +26 -225
  346. package/build/core/middleware/questionModel.js.map +1 -1
  347. package/build/index.d.ts +2 -8
  348. package/build/index.d.ts.map +1 -1
  349. package/build/index.js +4 -8
  350. package/build/index.js.map +1 -1
  351. package/build/plugins/resource/appstudio/appStudio.d.ts.map +1 -1
  352. package/build/plugins/resource/appstudio/appStudio.js +8 -1
  353. package/build/plugins/resource/appstudio/appStudio.js.map +1 -1
  354. package/build/plugins/resource/appstudio/errors.d.ts +4 -0
  355. package/build/plugins/resource/appstudio/errors.d.ts.map +1 -1
  356. package/build/plugins/resource/appstudio/errors.js +7 -0
  357. package/build/plugins/resource/appstudio/errors.js.map +1 -1
  358. package/build/plugins/resource/appstudio/index.js +2 -2
  359. package/build/plugins/resource/appstudio/index.js.map +1 -1
  360. package/build/plugins/resource/appstudio/plugin.d.ts.map +1 -1
  361. package/build/plugins/resource/appstudio/plugin.js +21 -21
  362. package/build/plugins/resource/appstudio/plugin.js.map +1 -1
  363. package/build/plugins/resource/appstudio/v2/index.js +2 -2
  364. package/build/plugins/resource/appstudio/v2/index.js.map +1 -1
  365. package/build/plugins/resource/bot/configs/teamsBotConfig.js +2 -2
  366. package/build/plugins/resource/bot/configs/teamsBotConfig.js.map +1 -1
  367. package/build/plugins/resource/bot/errors.d.ts.map +1 -1
  368. package/build/plugins/resource/bot/errors.js +2 -2
  369. package/build/plugins/resource/bot/errors.js.map +1 -1
  370. package/build/plugins/resource/bot/functionsHostedBot/plugin.js +8 -8
  371. package/build/plugins/resource/bot/functionsHostedBot/plugin.js.map +1 -1
  372. package/build/plugins/resource/bot/index.d.ts.map +1 -1
  373. package/build/plugins/resource/bot/index.js +9 -7
  374. package/build/plugins/resource/bot/index.js.map +1 -1
  375. package/build/plugins/resource/bot/plugin.d.ts.map +1 -1
  376. package/build/plugins/resource/bot/plugin.js +16 -15
  377. package/build/plugins/resource/bot/plugin.js.map +1 -1
  378. package/build/plugins/resource/bot/question.d.ts.map +1 -1
  379. package/build/plugins/resource/bot/question.js +9 -10
  380. package/build/plugins/resource/bot/question.js.map +1 -1
  381. package/build/plugins/resource/function/plugin.js +3 -4
  382. package/build/plugins/resource/function/plugin.js.map +1 -1
  383. package/build/plugins/resource/function/utils/depsChecker/funcHelper.d.ts +1 -1
  384. package/build/plugins/resource/function/utils/depsChecker/funcHelper.d.ts.map +1 -1
  385. package/build/plugins/resource/index.d.ts +0 -5
  386. package/build/plugins/resource/index.d.ts.map +1 -1
  387. package/build/plugins/resource/index.js +0 -5
  388. package/build/plugins/resource/index.js.map +1 -1
  389. package/build/plugins/solution/fx-solution/ResourcePluginContainer.d.ts +0 -10
  390. package/build/plugins/solution/fx-solution/ResourcePluginContainer.d.ts.map +1 -1
  391. package/build/plugins/solution/fx-solution/ResourcePluginContainer.js +0 -10
  392. package/build/plugins/solution/fx-solution/ResourcePluginContainer.js.map +1 -1
  393. package/build/plugins/solution/fx-solution/arm.d.ts.map +1 -1
  394. package/build/plugins/solution/fx-solution/arm.js +15 -15
  395. package/build/plugins/solution/fx-solution/arm.js.map +1 -1
  396. package/build/plugins/solution/fx-solution/debug/scaffolding.d.ts +4 -0
  397. package/build/plugins/solution/fx-solution/debug/scaffolding.d.ts.map +1 -1
  398. package/build/plugins/solution/fx-solution/debug/scaffolding.js +47 -1
  399. package/build/plugins/solution/fx-solution/debug/scaffolding.js.map +1 -1
  400. package/build/plugins/solution/fx-solution/debug/util/launchTransparency.d.ts +7 -0
  401. package/build/plugins/solution/fx-solution/debug/util/launchTransparency.d.ts.map +1 -0
  402. package/build/plugins/solution/fx-solution/debug/util/launchTransparency.js +52 -0
  403. package/build/plugins/solution/fx-solution/debug/util/launchTransparency.js.map +1 -0
  404. package/build/plugins/solution/fx-solution/debug/util/ngrok.d.ts.map +1 -1
  405. package/build/plugins/solution/fx-solution/debug/util/ngrok.js +2 -4
  406. package/build/plugins/solution/fx-solution/debug/util/ngrok.js.map +1 -1
  407. package/build/plugins/solution/fx-solution/debug/util/settings.js +2 -2
  408. package/build/plugins/solution/fx-solution/debug/util/settings.js.map +1 -1
  409. package/build/plugins/solution/fx-solution/debug/util/tasksTransparency.d.ts +7 -0
  410. package/build/plugins/solution/fx-solution/debug/util/tasksTransparency.d.ts.map +1 -0
  411. package/build/plugins/solution/fx-solution/debug/util/tasksTransparency.js +553 -0
  412. package/build/plugins/solution/fx-solution/debug/util/tasksTransparency.js.map +1 -0
  413. package/build/plugins/solution/fx-solution/utils/backupFiles.js +2 -2
  414. package/build/plugins/solution/fx-solution/utils/backupFiles.js.map +1 -1
  415. package/build/plugins/solution/fx-solution/v2/utils.d.ts.map +1 -1
  416. package/build/plugins/solution/fx-solution/v2/utils.js.map +1 -1
  417. package/package.json +9 -23
  418. package/resource/package.nls.json +8 -6
  419. package/templates/debug/ngrok.yml +4 -0
  420. package/templates/fallback/bot.csharp.command-and-response.zip +0 -0
  421. package/templates/fallback/bot.csharp.default.zip +0 -0
  422. package/templates/fallback/bot.csharp.notification-function-base.zip +0 -0
  423. package/templates/fallback/bot.csharp.notification-trigger-http.zip +0 -0
  424. package/templates/fallback/bot.csharp.notification-trigger-timer.zip +0 -0
  425. package/templates/fallback/bot.csharp.notification-webapi.zip +0 -0
  426. package/templates/fallback/bot.csharp.workflow.zip +0 -0
  427. package/templates/fallback/bot.js.command-and-response.zip +0 -0
  428. package/templates/fallback/bot.js.default.zip +0 -0
  429. package/templates/fallback/bot.js.m365.zip +0 -0
  430. package/templates/fallback/bot.js.notification-function-base.zip +0 -0
  431. package/templates/fallback/bot.js.notification-restify.zip +0 -0
  432. package/templates/fallback/bot.js.notification-trigger-http.zip +0 -0
  433. package/templates/fallback/bot.js.notification-trigger-timer.zip +0 -0
  434. package/templates/fallback/bot.js.workflow.zip +0 -0
  435. package/templates/fallback/bot.ts.command-and-response.zip +0 -0
  436. package/templates/fallback/bot.ts.default.zip +0 -0
  437. package/templates/fallback/bot.ts.m365.zip +0 -0
  438. package/templates/fallback/bot.ts.notification-function-base.zip +0 -0
  439. package/templates/fallback/bot.ts.notification-restify.zip +0 -0
  440. package/templates/fallback/bot.ts.notification-trigger-http.zip +0 -0
  441. package/templates/fallback/bot.ts.notification-trigger-timer.zip +0 -0
  442. package/templates/fallback/bot.ts.workflow.zip +0 -0
  443. package/templates/fallback/function-base.js.default.zip +0 -0
  444. package/templates/fallback/function-base.ts.default.zip +0 -0
  445. package/templates/fallback/function-triggers.js.HTTPTrigger.zip +0 -0
  446. package/templates/fallback/function-triggers.ts.HTTPTrigger.zip +0 -0
  447. package/templates/fallback/tab.csharp.default.zip +0 -0
  448. package/templates/fallback/tab.csharp.non-sso.zip +0 -0
  449. package/templates/fallback/tab.js.default.zip +0 -0
  450. package/templates/fallback/tab.js.m365.zip +0 -0
  451. package/templates/fallback/tab.js.non-sso.zip +0 -0
  452. package/templates/fallback/tab.ts.default.zip +0 -0
  453. package/templates/fallback/tab.ts.m365.zip +0 -0
  454. package/templates/fallback/tab.ts.non-sso.zip +0 -0
  455. package/templates/plugins/resource/aad/auth/bot/README.md +202 -124
  456. package/templates/plugins/resource/aad/auth/bot/js/sso/profileSsoCommandHandler.js +30 -0
  457. package/templates/plugins/resource/aad/auth/bot/ts/sso/profileSsoCommandHandler.ts +38 -0
  458. package/templates/plugins/resource/spfx/solution/prereleaseREADME.md +82 -0
  459. package/build/common/index.d.ts +0 -10
  460. package/build/common/index.d.ts.map +0 -1
  461. package/build/common/index.js +0 -15
  462. package/build/common/index.js.map +0 -1
  463. package/build/component/resource/simpleAuth.d.ts.map +0 -1
  464. package/build/component/resource/simpleAuth.js.map +0 -1
  465. package/build/core/middleware/index.d.ts +0 -11
  466. package/build/core/middleware/index.d.ts.map +0 -1
  467. package/build/core/middleware/index.js +0 -14
  468. package/build/core/middleware/index.js.map +0 -1
  469. package/build/core/middleware/solutionLoader.d.ts +0 -4
  470. package/build/core/middleware/solutionLoader.d.ts.map +0 -1
  471. package/build/core/middleware/solutionLoader.js +0 -34
  472. package/build/core/middleware/solutionLoader.js.map +0 -1
  473. package/build/plugins/index.d.ts +0 -3
  474. package/build/plugins/index.d.ts.map +0 -1
  475. package/build/plugins/index.js +0 -8
  476. package/build/plugins/index.js.map +0 -1
  477. package/build/plugins/resource/aad/aadAppClient.d.ts.map +0 -1
  478. package/build/plugins/resource/aad/aadAppClient.js.map +0 -1
  479. package/build/plugins/resource/aad/aadAppManifestManager.d.ts.map +0 -1
  480. package/build/plugins/resource/aad/aadAppManifestManager.js.map +0 -1
  481. package/build/plugins/resource/aad/appStudio.d.ts.map +0 -1
  482. package/build/plugins/resource/aad/appStudio.js.map +0 -1
  483. package/build/plugins/resource/aad/constants.d.ts.map +0 -1
  484. package/build/plugins/resource/aad/constants.js.map +0 -1
  485. package/build/plugins/resource/aad/errorCodes.d.ts.map +0 -1
  486. package/build/plugins/resource/aad/errorCodes.js.map +0 -1
  487. package/build/plugins/resource/aad/errors.d.ts.map +0 -1
  488. package/build/plugins/resource/aad/errors.js.map +0 -1
  489. package/build/plugins/resource/aad/graph.d.ts.map +0 -1
  490. package/build/plugins/resource/aad/graph.js.map +0 -1
  491. package/build/plugins/resource/aad/index.d.ts +0 -32
  492. package/build/plugins/resource/aad/index.d.ts.map +0 -1
  493. package/build/plugins/resource/aad/index.js +0 -154
  494. package/build/plugins/resource/aad/index.js.map +0 -1
  495. package/build/plugins/resource/aad/interfaces/AADApplication.d.ts.map +0 -1
  496. package/build/plugins/resource/aad/interfaces/AADApplication.js.map +0 -1
  497. package/build/plugins/resource/aad/interfaces/AADManifest.d.ts.map +0 -1
  498. package/build/plugins/resource/aad/interfaces/AADManifest.js.map +0 -1
  499. package/build/plugins/resource/aad/interfaces/IAADApplication.d.ts.map +0 -1
  500. package/build/plugins/resource/aad/interfaces/IAADApplication.js.map +0 -1
  501. package/build/plugins/resource/aad/interfaces/IAADDefinition.d.ts.map +0 -1
  502. package/build/plugins/resource/aad/interfaces/IAADDefinition.js.map +0 -1
  503. package/build/plugins/resource/aad/interfaces/IPermission.d.ts.map +0 -1
  504. package/build/plugins/resource/aad/interfaces/IPermission.js.map +0 -1
  505. package/build/plugins/resource/aad/interfaces/IPermissionList.d.ts.map +0 -1
  506. package/build/plugins/resource/aad/interfaces/IPermissionList.js.map +0 -1
  507. package/build/plugins/resource/aad/interfaces/models.d.ts.map +0 -1
  508. package/build/plugins/resource/aad/interfaces/models.js.map +0 -1
  509. package/build/plugins/resource/aad/permissions/index.d.ts.map +0 -1
  510. package/build/plugins/resource/aad/permissions/index.js.map +0 -1
  511. package/build/plugins/resource/aad/plugin.d.ts.map +0 -1
  512. package/build/plugins/resource/aad/plugin.js.map +0 -1
  513. package/build/plugins/resource/aad/results.d.ts.map +0 -1
  514. package/build/plugins/resource/aad/results.js.map +0 -1
  515. package/build/plugins/resource/aad/utils/aadManifestHelper.d.ts.map +0 -1
  516. package/build/plugins/resource/aad/utils/aadManifestHelper.js.map +0 -1
  517. package/build/plugins/resource/aad/utils/configs.d.ts.map +0 -1
  518. package/build/plugins/resource/aad/utils/configs.js.map +0 -1
  519. package/build/plugins/resource/aad/utils/dialog.d.ts.map +0 -1
  520. package/build/plugins/resource/aad/utils/dialog.js.map +0 -1
  521. package/build/plugins/resource/aad/utils/format.d.ts.map +0 -1
  522. package/build/plugins/resource/aad/utils/format.js.map +0 -1
  523. package/build/plugins/resource/aad/utils/telemetry.d.ts.map +0 -1
  524. package/build/plugins/resource/aad/utils/telemetry.js.map +0 -1
  525. package/build/plugins/resource/aad/utils/tokenProvider.d.ts.map +0 -1
  526. package/build/plugins/resource/aad/utils/tokenProvider.js.map +0 -1
  527. package/build/plugins/resource/aad/v2/index.d.ts +0 -22
  528. package/build/plugins/resource/aad/v2/index.d.ts.map +0 -1
  529. package/build/plugins/resource/aad/v2/index.js +0 -65
  530. package/build/plugins/resource/aad/v2/index.js.map +0 -1
  531. package/build/plugins/resource/aad/v3/index.d.ts +0 -22
  532. package/build/plugins/resource/aad/v3/index.d.ts.map +0 -1
  533. package/build/plugins/resource/aad/v3/index.js +0 -283
  534. package/build/plugins/resource/aad/v3/index.js.map +0 -1
  535. package/build/plugins/resource/keyvault/constants.d.ts +0 -36
  536. package/build/plugins/resource/keyvault/constants.d.ts.map +0 -1
  537. package/build/plugins/resource/keyvault/constants.js +0 -43
  538. package/build/plugins/resource/keyvault/constants.js.map +0 -1
  539. package/build/plugins/resource/keyvault/index.d.ts +0 -16
  540. package/build/plugins/resource/keyvault/index.d.ts.map +0 -1
  541. package/build/plugins/resource/keyvault/index.js +0 -65
  542. package/build/plugins/resource/keyvault/index.js.map +0 -1
  543. package/build/plugins/resource/keyvault/plugin.d.ts +0 -7
  544. package/build/plugins/resource/keyvault/plugin.d.ts.map +0 -1
  545. package/build/plugins/resource/keyvault/plugin.js +0 -44
  546. package/build/plugins/resource/keyvault/plugin.js.map +0 -1
  547. package/build/plugins/resource/keyvault/result.d.ts +0 -9
  548. package/build/plugins/resource/keyvault/result.d.ts.map +0 -1
  549. package/build/plugins/resource/keyvault/result.js +0 -35
  550. package/build/plugins/resource/keyvault/result.js.map +0 -1
  551. package/build/plugins/resource/keyvault/utils/telemetry.d.ts.map +0 -1
  552. package/build/plugins/resource/keyvault/utils/telemetry.js +0 -45
  553. package/build/plugins/resource/keyvault/utils/telemetry.js.map +0 -1
  554. package/build/plugins/resource/keyvault/v2/index.d.ts +0 -12
  555. package/build/plugins/resource/keyvault/v2/index.d.ts.map +0 -1
  556. package/build/plugins/resource/keyvault/v2/index.js +0 -38
  557. package/build/plugins/resource/keyvault/v2/index.js.map +0 -1
  558. package/build/plugins/resource/simpleauth/constants.d.ts.map +0 -1
  559. package/build/plugins/resource/simpleauth/constants.js.map +0 -1
  560. package/build/plugins/resource/simpleauth/errors.d.ts.map +0 -1
  561. package/build/plugins/resource/simpleauth/errors.js.map +0 -1
  562. package/build/plugins/resource/simpleauth/index.d.ts +0 -20
  563. package/build/plugins/resource/simpleauth/index.d.ts.map +0 -1
  564. package/build/plugins/resource/simpleauth/index.js +0 -78
  565. package/build/plugins/resource/simpleauth/index.js.map +0 -1
  566. package/build/plugins/resource/simpleauth/plugin.d.ts +0 -14
  567. package/build/plugins/resource/simpleauth/plugin.d.ts.map +0 -1
  568. package/build/plugins/resource/simpleauth/plugin.js +0 -141
  569. package/build/plugins/resource/simpleauth/plugin.js.map +0 -1
  570. package/build/plugins/resource/simpleauth/result.d.ts.map +0 -1
  571. package/build/plugins/resource/simpleauth/result.js.map +0 -1
  572. package/build/plugins/resource/simpleauth/utils/common.d.ts.map +0 -1
  573. package/build/plugins/resource/simpleauth/utils/common.js.map +0 -1
  574. package/build/plugins/resource/simpleauth/utils/dialog.d.ts.map +0 -1
  575. package/build/plugins/resource/simpleauth/utils/dialog.js.map +0 -1
  576. package/build/plugins/resource/simpleauth/utils/telemetry.d.ts +0 -17
  577. package/build/plugins/resource/simpleauth/utils/telemetry.d.ts.map +0 -1
  578. package/build/plugins/resource/simpleauth/utils/telemetry.js.map +0 -1
  579. package/build/plugins/resource/simpleauth/v2/index.d.ts +0 -15
  580. package/build/plugins/resource/simpleauth/v2/index.d.ts.map +0 -1
  581. package/build/plugins/resource/simpleauth/v2/index.js +0 -47
  582. package/build/plugins/resource/simpleauth/v2/index.js.map +0 -1
  583. package/build/plugins/resource/simpleauth/webAppClient.d.ts +0 -31
  584. package/build/plugins/resource/simpleauth/webAppClient.d.ts.map +0 -1
  585. package/build/plugins/resource/simpleauth/webAppClient.js +0 -136
  586. package/build/plugins/resource/simpleauth/webAppClient.js.map +0 -1
  587. package/build/plugins/resource/spfx/depsChecker/dependencyChecker.d.ts.map +0 -1
  588. package/build/plugins/resource/spfx/depsChecker/dependencyChecker.js.map +0 -1
  589. package/build/plugins/resource/spfx/depsChecker/generatorChecker.d.ts.map +0 -1
  590. package/build/plugins/resource/spfx/depsChecker/generatorChecker.js.map +0 -1
  591. package/build/plugins/resource/spfx/depsChecker/yoChecker.d.ts.map +0 -1
  592. package/build/plugins/resource/spfx/depsChecker/yoChecker.js.map +0 -1
  593. package/build/plugins/resource/spfx/error.d.ts.map +0 -1
  594. package/build/plugins/resource/spfx/error.js.map +0 -1
  595. package/build/plugins/resource/spfx/index.d.ts +0 -18
  596. package/build/plugins/resource/spfx/index.d.ts.map +0 -1
  597. package/build/plugins/resource/spfx/index.js +0 -96
  598. package/build/plugins/resource/spfx/index.js.map +0 -1
  599. package/build/plugins/resource/spfx/plugin.d.ts +0 -12
  600. package/build/plugins/resource/spfx/plugin.d.ts.map +0 -1
  601. package/build/plugins/resource/spfx/plugin.js +0 -216
  602. package/build/plugins/resource/spfx/plugin.js.map +0 -1
  603. package/build/plugins/resource/spfx/spoClient.d.ts.map +0 -1
  604. package/build/plugins/resource/spfx/spoClient.js.map +0 -1
  605. package/build/plugins/resource/spfx/utils/constants.d.ts.map +0 -1
  606. package/build/plugins/resource/spfx/utils/constants.js.map +0 -1
  607. package/build/plugins/resource/spfx/utils/progress-helper.d.ts.map +0 -1
  608. package/build/plugins/resource/spfx/utils/progress-helper.js.map +0 -1
  609. package/build/plugins/resource/spfx/utils/questions.d.ts.map +0 -1
  610. package/build/plugins/resource/spfx/utils/questions.js.map +0 -1
  611. package/build/plugins/resource/spfx/utils/telemetry-helper.d.ts.map +0 -1
  612. package/build/plugins/resource/spfx/utils/telemetry-helper.js.map +0 -1
  613. package/build/plugins/resource/spfx/utils/telemetryEvents.d.ts.map +0 -1
  614. package/build/plugins/resource/spfx/utils/telemetryEvents.js.map +0 -1
  615. package/build/plugins/resource/spfx/utils/utils.d.ts.map +0 -1
  616. package/build/plugins/resource/spfx/utils/utils.js.map +0 -1
  617. package/build/plugins/resource/spfx/v2/index.d.ts +0 -14
  618. package/build/plugins/resource/spfx/v2/index.d.ts.map +0 -1
  619. package/build/plugins/resource/spfx/v2/index.js +0 -41
  620. package/build/plugins/resource/spfx/v2/index.js.map +0 -1
  621. package/build/plugins/resource/sql/config.d.ts +0 -22
  622. package/build/plugins/resource/sql/config.d.ts.map +0 -1
  623. package/build/plugins/resource/sql/config.js +0 -30
  624. package/build/plugins/resource/sql/config.js.map +0 -1
  625. package/build/plugins/resource/sql/constants.d.ts +0 -82
  626. package/build/plugins/resource/sql/constants.d.ts.map +0 -1
  627. package/build/plugins/resource/sql/constants.js +0 -92
  628. package/build/plugins/resource/sql/constants.js.map +0 -1
  629. package/build/plugins/resource/sql/errors.d.ts +0 -63
  630. package/build/plugins/resource/sql/errors.d.ts.map +0 -1
  631. package/build/plugins/resource/sql/errors.js +0 -107
  632. package/build/plugins/resource/sql/errors.js.map +0 -1
  633. package/build/plugins/resource/sql/index.d.ts +0 -20
  634. package/build/plugins/resource/sql/index.d.ts.map +0 -1
  635. package/build/plugins/resource/sql/index.js +0 -92
  636. package/build/plugins/resource/sql/index.js.map +0 -1
  637. package/build/plugins/resource/sql/managementClient.d.ts +0 -18
  638. package/build/plugins/resource/sql/managementClient.d.ts.map +0 -1
  639. package/build/plugins/resource/sql/managementClient.js +0 -123
  640. package/build/plugins/resource/sql/managementClient.js.map +0 -1
  641. package/build/plugins/resource/sql/plugin.d.ts +0 -30
  642. package/build/plugins/resource/sql/plugin.d.ts.map +0 -1
  643. package/build/plugins/resource/sql/plugin.js +0 -340
  644. package/build/plugins/resource/sql/plugin.js.map +0 -1
  645. package/build/plugins/resource/sql/questions.d.ts +0 -5
  646. package/build/plugins/resource/sql/questions.d.ts.map +0 -1
  647. package/build/plugins/resource/sql/questions.js +0 -46
  648. package/build/plugins/resource/sql/questions.js.map +0 -1
  649. package/build/plugins/resource/sql/results.d.ts +0 -10
  650. package/build/plugins/resource/sql/results.d.ts.map +0 -1
  651. package/build/plugins/resource/sql/results.js +0 -32
  652. package/build/plugins/resource/sql/results.js.map +0 -1
  653. package/build/plugins/resource/sql/sqlClient.d.ts +0 -13
  654. package/build/plugins/resource/sql/sqlClient.d.ts.map +0 -1
  655. package/build/plugins/resource/sql/sqlClient.js +0 -153
  656. package/build/plugins/resource/sql/sqlClient.js.map +0 -1
  657. package/build/plugins/resource/sql/utils/checkInput.d.ts +0 -10
  658. package/build/plugins/resource/sql/utils/checkInput.d.ts.map +0 -1
  659. package/build/plugins/resource/sql/utils/checkInput.js +0 -87
  660. package/build/plugins/resource/sql/utils/checkInput.js.map +0 -1
  661. package/build/plugins/resource/sql/utils/commonUtils.d.ts +0 -13
  662. package/build/plugins/resource/sql/utils/commonUtils.d.ts.map +0 -1
  663. package/build/plugins/resource/sql/utils/commonUtils.js +0 -51
  664. package/build/plugins/resource/sql/utils/commonUtils.js.map +0 -1
  665. package/build/plugins/resource/sql/utils/contextUtils.d.ts +0 -5
  666. package/build/plugins/resource/sql/utils/contextUtils.d.ts.map +0 -1
  667. package/build/plugins/resource/sql/utils/contextUtils.js +0 -11
  668. package/build/plugins/resource/sql/utils/contextUtils.js.map +0 -1
  669. package/build/plugins/resource/sql/utils/dialogUtils.d.ts +0 -13
  670. package/build/plugins/resource/sql/utils/dialogUtils.d.ts.map +0 -1
  671. package/build/plugins/resource/sql/utils/dialogUtils.js +0 -21
  672. package/build/plugins/resource/sql/utils/dialogUtils.js.map +0 -1
  673. package/build/plugins/resource/sql/utils/message.d.ts +0 -16
  674. package/build/plugins/resource/sql/utils/message.d.ts.map +0 -1
  675. package/build/plugins/resource/sql/utils/message.js +0 -23
  676. package/build/plugins/resource/sql/utils/message.js.map +0 -1
  677. package/build/plugins/resource/sql/utils/telemetryUtils.d.ts +0 -17
  678. package/build/plugins/resource/sql/utils/telemetryUtils.d.ts.map +0 -1
  679. package/build/plugins/resource/sql/utils/telemetryUtils.js +0 -45
  680. package/build/plugins/resource/sql/utils/telemetryUtils.js.map +0 -1
  681. package/build/plugins/resource/sql/v2/index.d.ts +0 -15
  682. package/build/plugins/resource/sql/v2/index.d.ts.map +0 -1
  683. package/build/plugins/resource/sql/v2/index.js +0 -44
  684. package/build/plugins/resource/sql/v2/index.js.map +0 -1
  685. package/build/plugins/solution/fx-solution/index.d.ts +0 -5
  686. package/build/plugins/solution/fx-solution/index.d.ts.map +0 -1
  687. package/build/plugins/solution/fx-solution/index.js +0 -8
  688. package/build/plugins/solution/fx-solution/index.js.map +0 -1
  689. package/build/plugins/solution/fx-solution/solution.d.ts +0 -94
  690. package/build/plugins/solution/fx-solution/solution.d.ts.map +0 -1
  691. package/build/plugins/solution/fx-solution/solution.js +0 -1530
  692. package/build/plugins/solution/fx-solution/solution.js.map +0 -1
  693. package/build/plugins/solution/fx-solution/v2/checkPermission.d.ts +0 -5
  694. package/build/plugins/solution/fx-solution/v2/checkPermission.d.ts.map +0 -1
  695. package/build/plugins/solution/fx-solution/v2/checkPermission.js +0 -196
  696. package/build/plugins/solution/fx-solution/v2/checkPermission.js.map +0 -1
  697. package/build/plugins/solution/fx-solution/v2/collaborationUtil.d.ts +0 -28
  698. package/build/plugins/solution/fx-solution/v2/collaborationUtil.d.ts.map +0 -1
  699. package/build/plugins/solution/fx-solution/v2/collaborationUtil.js +0 -131
  700. package/build/plugins/solution/fx-solution/v2/collaborationUtil.js.map +0 -1
  701. package/build/plugins/solution/fx-solution/v2/createEnv.d.ts +0 -3
  702. package/build/plugins/solution/fx-solution/v2/createEnv.d.ts.map +0 -1
  703. package/build/plugins/solution/fx-solution/v2/createEnv.js +0 -37
  704. package/build/plugins/solution/fx-solution/v2/createEnv.js.map +0 -1
  705. package/build/plugins/solution/fx-solution/v2/deploy.d.ts +0 -3
  706. package/build/plugins/solution/fx-solution/v2/deploy.d.ts.map +0 -1
  707. package/build/plugins/solution/fx-solution/v2/deploy.js +0 -143
  708. package/build/plugins/solution/fx-solution/v2/deploy.js.map +0 -1
  709. package/build/plugins/solution/fx-solution/v2/executeUserTask.d.ts +0 -22
  710. package/build/plugins/solution/fx-solution/v2/executeUserTask.d.ts.map +0 -1
  711. package/build/plugins/solution/fx-solution/v2/executeUserTask.js +0 -850
  712. package/build/plugins/solution/fx-solution/v2/executeUserTask.js.map +0 -1
  713. package/build/plugins/solution/fx-solution/v2/generateResourceTemplate.d.ts +0 -4
  714. package/build/plugins/solution/fx-solution/v2/generateResourceTemplate.d.ts.map +0 -1
  715. package/build/plugins/solution/fx-solution/v2/generateResourceTemplate.js +0 -31
  716. package/build/plugins/solution/fx-solution/v2/generateResourceTemplate.js.map +0 -1
  717. package/build/plugins/solution/fx-solution/v2/getQuestions.d.ts +0 -15
  718. package/build/plugins/solution/fx-solution/v2/getQuestions.d.ts.map +0 -1
  719. package/build/plugins/solution/fx-solution/v2/getQuestions.js +0 -847
  720. package/build/plugins/solution/fx-solution/v2/getQuestions.js.map +0 -1
  721. package/build/plugins/solution/fx-solution/v2/grantPermission.d.ts +0 -5
  722. package/build/plugins/solution/fx-solution/v2/grantPermission.d.ts.map +0 -1
  723. package/build/plugins/solution/fx-solution/v2/grantPermission.js +0 -209
  724. package/build/plugins/solution/fx-solution/v2/grantPermission.js.map +0 -1
  725. package/build/plugins/solution/fx-solution/v2/listCollaborator.d.ts +0 -8
  726. package/build/plugins/solution/fx-solution/v2/listCollaborator.d.ts.map +0 -1
  727. package/build/plugins/solution/fx-solution/v2/listCollaborator.js +0 -226
  728. package/build/plugins/solution/fx-solution/v2/listCollaborator.js.map +0 -1
  729. package/build/plugins/solution/fx-solution/v2/provision.d.ts +0 -3
  730. package/build/plugins/solution/fx-solution/v2/provision.d.ts.map +0 -1
  731. package/build/plugins/solution/fx-solution/v2/provision.js +0 -262
  732. package/build/plugins/solution/fx-solution/v2/provision.js.map +0 -1
  733. package/build/plugins/solution/fx-solution/v2/provisionLocal.d.ts +0 -3
  734. package/build/plugins/solution/fx-solution/v2/provisionLocal.d.ts.map +0 -1
  735. package/build/plugins/solution/fx-solution/v2/provisionLocal.js +0 -117
  736. package/build/plugins/solution/fx-solution/v2/provisionLocal.js.map +0 -1
  737. package/build/plugins/solution/fx-solution/v2/publish.d.ts +0 -3
  738. package/build/plugins/solution/fx-solution/v2/publish.d.ts.map +0 -1
  739. package/build/plugins/solution/fx-solution/v2/publish.js +0 -46
  740. package/build/plugins/solution/fx-solution/v2/publish.js.map +0 -1
  741. package/build/plugins/solution/fx-solution/v2/scaffolding.d.ts +0 -5
  742. package/build/plugins/solution/fx-solution/v2/scaffolding.d.ts.map +0 -1
  743. package/build/plugins/solution/fx-solution/v2/scaffolding.js +0 -161
  744. package/build/plugins/solution/fx-solution/v2/scaffolding.js.map +0 -1
  745. package/build/plugins/solution/fx-solution/v2/solution.d.ts +0 -22
  746. package/build/plugins/solution/fx-solution/v2/solution.d.ts.map +0 -1
  747. package/build/plugins/solution/fx-solution/v2/solution.js +0 -48
  748. package/build/plugins/solution/fx-solution/v2/solution.js.map +0 -1
  749. package/build/plugins/solution/index.d.ts +0 -2
  750. package/build/plugins/solution/index.d.ts.map +0 -1
  751. package/build/plugins/solution/index.js +0 -7
  752. package/build/plugins/solution/index.js.map +0 -1
  753. package/templates/plugins/resource/aad/auth/bot/js/sso/showUserInfo.js +0 -36
  754. package/templates/plugins/resource/aad/auth/bot/js/sso/ssoDialog.js +0 -201
  755. package/templates/plugins/resource/aad/auth/bot/js/sso/teamsSsoBot.js +0 -63
  756. package/templates/plugins/resource/aad/auth/bot/ts/sso/showUserInfo.ts +0 -38
  757. package/templates/plugins/resource/aad/auth/bot/ts/sso/ssoDialog.ts +0 -213
  758. package/templates/plugins/resource/aad/auth/bot/ts/sso/teamsSsoBot.ts +0 -75
@@ -1,1530 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.askForProvisionConsent = exports.TeamsAppSolution = void 0;
4
- const tslib_1 = require("tslib");
5
- /* eslint-disable @typescript-eslint/ban-types */
6
- /* eslint-disable @typescript-eslint/no-unused-vars */
7
- /* eslint-disable @typescript-eslint/no-explicit-any */
8
- /* eslint-disable @typescript-eslint/no-non-null-assertion */
9
- // Copyright (c) Microsoft Corporation.
10
- // Licensed under the MIT license.
11
- const lib_1 = require("@feathersjs/hooks/lib");
12
- const teamsfx_api_1 = require("@microsoft/teamsfx-api");
13
- const fs = tslib_1.__importStar(require("fs-extra"));
14
- const mustache_1 = tslib_1.__importDefault(require("mustache"));
15
- const path_1 = tslib_1.__importDefault(require("path"));
16
- const typedi_1 = require("typedi");
17
- const util = tslib_1.__importStar(require("util"));
18
- const constants_1 = require("../../../common/constants");
19
- const localSettingsConstants_1 = require("../../../common/localSettingsConstants");
20
- const tools_1 = require("../../../common/tools");
21
- const errorHandler_1 = require("../../../core/middleware/errorHandler");
22
- const permissionRequest_1 = require("../../../core/permissionRequest");
23
- const SolutionPluginContainer_1 = require("../../../core/SolutionPluginContainer");
24
- const arm_1 = require("./arm");
25
- const commonQuestions_1 = require("./commonQuestions");
26
- const constants_2 = require("./constants");
27
- const executor_1 = require("./executor");
28
- const question_1 = require("./question");
29
- const ResourcePluginContainer_1 = require("./ResourcePluginContainer");
30
- const util_1 = require("./utils/util");
31
- const executeUserTask_1 = require("./v2/executeUserTask");
32
- const utils_1 = require("./v2/utils");
33
- const grantPermission_1 = require("./v2/grantPermission");
34
- const checkPermission_1 = require("./v2/checkPermission");
35
- const listCollaborator_1 = require("./v2/listCollaborator");
36
- const scaffolding_1 = require("./v2/scaffolding");
37
- const telemetry_1 = require("../../../common/telemetry");
38
- const error_1 = require("../../../core/error");
39
- const globalVars_1 = require("../../../core/globalVars");
40
- const types_1 = require("./types");
41
- const localizeUtils_1 = require("../../../common/localizeUtils");
42
- const question_2 = require("../../../core/question");
43
- let TeamsAppSolution = class TeamsAppSolution {
44
- constructor() {
45
- this.name = "fx-solution-azure";
46
- this.SpfxPlugin = typedi_1.Container.get(ResourcePluginContainer_1.ResourcePlugins.SpfxPlugin);
47
- this.AppStudioPlugin = typedi_1.Container.get(ResourcePluginContainer_1.ResourcePlugins.AppStudioPlugin);
48
- this.BotPlugin = typedi_1.Container.get(ResourcePluginContainer_1.ResourcePlugins.BotPlugin);
49
- this.AadPlugin = typedi_1.Container.get(ResourcePluginContainer_1.ResourcePlugins.AadPlugin);
50
- this.FrontendPlugin = typedi_1.Container.get(ResourcePluginContainer_1.ResourcePlugins.FrontendPlugin);
51
- this.FunctionPlugin = typedi_1.Container.get(ResourcePluginContainer_1.ResourcePlugins.FunctionPlugin);
52
- this.SqlPlugin = typedi_1.Container.get(ResourcePluginContainer_1.ResourcePlugins.SqlPlugin);
53
- this.ApimPlugin = typedi_1.Container.get(ResourcePluginContainer_1.ResourcePlugins.ApimPlugin);
54
- this.KeyVaultPlugin = typedi_1.Container.get(ResourcePluginContainer_1.ResourcePlugins.KeyVaultPlugin);
55
- this.LocalDebugPlugin = typedi_1.Container.get(ResourcePluginContainer_1.ResourcePlugins.LocalDebugPlugin);
56
- this.runningState = types_1.SolutionRunningState.Idle;
57
- }
58
- getPluginAndContextArray(ctx, selectedPlugins) {
59
- // let pluginContextConstructor = getPluginContextConstructor(ctx);
60
- return selectedPlugins.map((plugin) => [plugin, util_1.getPluginContext(ctx, plugin.name)]);
61
- }
62
- async init(ctx) {
63
- return teamsfx_api_1.ok({});
64
- }
65
- assertSettingsNotEmpty(settings, key) {
66
- if (!settings) {
67
- return teamsfx_api_1.err(new teamsfx_api_1.SystemError(constants_2.SolutionSource, constants_2.SolutionError.InternelError, `${key} is undefined`));
68
- }
69
- return teamsfx_api_1.ok(settings);
70
- }
71
- /**
72
- * create
73
- */
74
- async create(ctx) {
75
- var _a, _b, _c, _d;
76
- (_a = ctx.telemetryReporter) === null || _a === void 0 ? void 0 : _a.sendTelemetryEvent(constants_2.SolutionTelemetryEvent.CreateStart, {
77
- [constants_2.SolutionTelemetryProperty.Component]: constants_2.SolutionTelemetryComponentName,
78
- });
79
- if (!ctx.projectSettings)
80
- return teamsfx_api_1.err(new teamsfx_api_1.SystemError(constants_2.SolutionSource, constants_2.SolutionError.InternelError, "projectSettings undefined"));
81
- // ensure that global namespace is present
82
- if (!ctx.envInfo.state.has(constants_2.GLOBAL_CONFIG)) {
83
- ctx.envInfo.state.set(constants_2.GLOBAL_CONFIG, new teamsfx_api_1.ConfigMap());
84
- }
85
- // Only non-SPFx project will ask this question.
86
- const lang = ctx.answers[question_1.AzureSolutionQuestionNames.ProgrammingLanguage];
87
- if (lang) {
88
- ctx.projectSettings.programmingLanguage = lang;
89
- }
90
- const solutionSettings = ctx.projectSettings.solutionSettings;
91
- const settingsRes = utils_1.fillInSolutionSettings(ctx.projectSettings, ctx.answers);
92
- if (settingsRes.isErr()) {
93
- return teamsfx_api_1.err(util_1.sendErrorTelemetryThenReturnError(constants_2.SolutionTelemetryEvent.Create, settingsRes.error, ctx.telemetryReporter));
94
- }
95
- //Reload plugins according to user answers
96
- await this.reloadPlugins(solutionSettings);
97
- if (this.isAzureProject(ctx)) {
98
- await fs.writeJSON(`${ctx.root}/permissions.json`, constants_2.DEFAULT_PERMISSION_REQUEST, { spaces: 4 });
99
- (_b = ctx.telemetryReporter) === null || _b === void 0 ? void 0 : _b.sendTelemetryEvent(constants_2.SolutionTelemetryEvent.Create, {
100
- [constants_2.SolutionTelemetryProperty.Component]: constants_2.SolutionTelemetryComponentName,
101
- [constants_2.SolutionTelemetryProperty.Success]: constants_2.SolutionTelemetrySuccess.Yes,
102
- [constants_2.SolutionTelemetryProperty.Resources]: solutionSettings.azureResources.join(";"),
103
- [constants_2.SolutionTelemetryProperty.Capabilities]: solutionSettings.capabilities.join(";"),
104
- [constants_2.SolutionTelemetryProperty.ProgrammingLanguage]: (_d = (_c = ctx.projectSettings) === null || _c === void 0 ? void 0 : _c.programmingLanguage) !== null && _d !== void 0 ? _d : "",
105
- });
106
- }
107
- return teamsfx_api_1.ok(constants_2.Void);
108
- }
109
- reloadPlugins(solutionSettings) {
110
- const res = ResourcePluginContainer_1.getActivatedResourcePlugins(solutionSettings);
111
- solutionSettings.activeResourcePlugins = res.map((p) => p.name);
112
- return res;
113
- }
114
- spfxSelected(ctx) {
115
- // Generally, if SPFx is selected, there should be no other plugins. But we don't check this invariant here.
116
- const spfxExists = this.getAzureSolutionSettings(ctx).activeResourcePlugins.some((pluginName) => pluginName === this.SpfxPlugin.name);
117
- return spfxExists === undefined ? false : spfxExists;
118
- }
119
- isAzureProject(ctx) {
120
- if (!ctx)
121
- return true;
122
- const settings = this.getAzureSolutionSettings(ctx);
123
- return question_1.HostTypeOptionAzure.id === settings.hostType;
124
- }
125
- async update(ctx) {
126
- return await this.executeAddResource(ctx);
127
- }
128
- getSelectedPlugins(ctx) {
129
- const settings = this.getAzureSolutionSettings(ctx);
130
- const plugins = ResourcePluginContainer_1.getActivatedResourcePlugins(settings);
131
- settings.activeResourcePlugins = plugins.map((p) => p.name);
132
- return teamsfx_api_1.ok(plugins);
133
- }
134
- /**
135
- * scaffold
136
- */
137
- async scaffold(ctx) {
138
- var _a;
139
- const maybeSelectedPlugins = this.getSelectedPlugins(ctx);
140
- if (maybeSelectedPlugins.isErr()) {
141
- return maybeSelectedPlugins;
142
- }
143
- const selectedPlugins = maybeSelectedPlugins.value;
144
- const result = await this.doScaffold(ctx, selectedPlugins, true);
145
- if (result.isOk()) {
146
- (_a = ctx.ui) === null || _a === void 0 ? void 0 : _a.showMessage("info", `Success: ${localizeUtils_1.getLocalizedString("core.create.successNotice")}`, false);
147
- }
148
- return result;
149
- }
150
- async doScaffold(ctx, pluginsToScaffold, generateResourceTemplate, pluginsToDoArm) {
151
- var _a, _b;
152
- const pluginsWithCtx = this.getPluginAndContextArray(ctx, pluginsToScaffold);
153
- const preScaffoldWithCtx = pluginsWithCtx.map(([plugin, context]) => {
154
- var _a;
155
- return [(_a = plugin === null || plugin === void 0 ? void 0 : plugin.preScaffold) === null || _a === void 0 ? void 0 : _a.bind(plugin), context, plugin.name];
156
- });
157
- const scaffoldWithCtx = pluginsWithCtx.map(([plugin, context]) => {
158
- var _a;
159
- return [(_a = plugin === null || plugin === void 0 ? void 0 : plugin.scaffold) === null || _a === void 0 ? void 0 : _a.bind(plugin), context, plugin.name];
160
- });
161
- const postScaffoldWithCtx = pluginsWithCtx.map(([plugin, context]) => {
162
- var _a;
163
- return [(_a = plugin === null || plugin === void 0 ? void 0 : plugin.postScaffold) === null || _a === void 0 ? void 0 : _a.bind(plugin), context, plugin.name];
164
- });
165
- const res = await executor_1.executeLifecycles(preScaffoldWithCtx, scaffoldWithCtx, postScaffoldWithCtx);
166
- if (res.isOk()) {
167
- const capabilities = ((_a = ctx.projectSettings) === null || _a === void 0 ? void 0 : _a.solutionSettings)
168
- .capabilities;
169
- const azureResources = ((_b = ctx.projectSettings) === null || _b === void 0 ? void 0 : _b.solutionSettings)
170
- .azureResources;
171
- await scaffolding_1.scaffoldReadme(capabilities, azureResources, ctx.root);
172
- }
173
- if (generateResourceTemplate && this.isAzureProject(ctx)) {
174
- return await arm_1.generateArmTemplate(ctx, pluginsToDoArm ? pluginsToDoArm : pluginsToScaffold);
175
- }
176
- else {
177
- return res;
178
- }
179
- }
180
- async createEnv(ctx) {
181
- var _a;
182
- if (utils_1.isAzureProject(ctx.projectSettings.solutionSettings)) {
183
- try {
184
- if (ctx.answers.copy === true) {
185
- await arm_1.copyParameterJson(ctx.root, ctx.projectSettings.appName, ctx.answers.targetEnvName, ctx.answers.sourceEnvName);
186
- }
187
- else {
188
- await arm_1.getParameterJson(ctx);
189
- }
190
- }
191
- catch (e) {
192
- return teamsfx_api_1.err(error_1.CopyFileError(e));
193
- }
194
- return teamsfx_api_1.ok(ctx.answers.copy ? ctx.answers.targetEnvName : (_a = ctx.envInfo) === null || _a === void 0 ? void 0 : _a.envName);
195
- }
196
- return teamsfx_api_1.ok(constants_2.Void);
197
- }
198
- /**
199
- * Checks whether solution's state is idle
200
- */
201
- checkWhetherSolutionIsIdle() {
202
- switch (this.runningState) {
203
- case types_1.SolutionRunningState.Idle:
204
- return teamsfx_api_1.ok(constants_2.Void);
205
- case types_1.SolutionRunningState.ProvisionInProgress:
206
- return teamsfx_api_1.err(new teamsfx_api_1.UserError(constants_2.SolutionSource, constants_2.SolutionError.ProvisionInProgress, "Provision in progress. Please wait for its completion."));
207
- case types_1.SolutionRunningState.DeployInProgress:
208
- return teamsfx_api_1.err(new teamsfx_api_1.UserError(constants_2.SolutionSource, constants_2.SolutionError.DeploymentInProgress, "Deployment in progress. Please wait for its completion."));
209
- case types_1.SolutionRunningState.PublishInProgress:
210
- return teamsfx_api_1.err(new teamsfx_api_1.UserError(constants_2.SolutionSource, constants_2.SolutionError.PublishInProgress, "Publish in progress. Please wait for its completion."));
211
- }
212
- }
213
- checkWetherProvisionSucceeded(solutionConfig) {
214
- var _a;
215
- return !!((_a = solutionConfig.get(constants_2.GLOBAL_CONFIG)) === null || _a === void 0 ? void 0 : _a.getBoolean(constants_2.SOLUTION_PROVISION_SUCCEEDED));
216
- }
217
- /**
218
- * Provision resources. It can only run in a non-SPFx project when solution's running state is Idle.
219
- * Solution's provisionSucceeded config value will be set to true if provision succeeds, to false otherwise.
220
- *
221
- */
222
- async provision(ctx) {
223
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
224
- const canProvision = this.checkWhetherSolutionIsIdle();
225
- if (canProvision.isErr()) {
226
- return canProvision;
227
- }
228
- try {
229
- // Just to trigger M365 login before the concurrent execution of provision.
230
- // Because concurrent exectution of provision may getAccessToken() concurrently, which
231
- // causes 2 M365 logins before the token caching in common lib takes effect.
232
- const appStudioTokenRes = await ctx.m365TokenProvider.getAccessToken({
233
- scopes: tools_1.AppStudioScopes,
234
- });
235
- if (appStudioTokenRes === null || appStudioTokenRes === void 0 ? void 0 : appStudioTokenRes.isErr()) {
236
- return teamsfx_api_1.err(appStudioTokenRes.error);
237
- }
238
- this.runningState = types_1.SolutionRunningState.ProvisionInProgress;
239
- if (this.isAzureProject(ctx)) {
240
- if (ctx.permissionRequestProvider === undefined) {
241
- ctx.permissionRequestProvider = new permissionRequest_1.PermissionRequestFileProvider(ctx.root);
242
- }
243
- const result = await utils_1.ensurePermissionRequest((_a = ctx.projectSettings) === null || _a === void 0 ? void 0 : _a.solutionSettings, ctx.permissionRequestProvider);
244
- if (result.isErr()) {
245
- return result;
246
- }
247
- }
248
- const provisionResult = await this.doProvision(ctx);
249
- if (provisionResult.isOk()) {
250
- const url = tools_1.getResourceGroupInPortal((_b = ctx.envInfo.state.get(constants_2.GLOBAL_CONFIG)) === null || _b === void 0 ? void 0 : _b.getString(constants_2.SUBSCRIPTION_ID), (_c = ctx.envInfo.state.get(constants_2.GLOBAL_CONFIG)) === null || _c === void 0 ? void 0 : _c.getString("tenantId"), (_d = ctx.envInfo.state.get(constants_2.GLOBAL_CONFIG)) === null || _d === void 0 ? void 0 : _d.getString(constants_2.RESOURCE_GROUP_NAME));
251
- const msg = localizeUtils_1.getLocalizedString("core.provision.successNotice", (_e = ctx.projectSettings) === null || _e === void 0 ? void 0 : _e.appName);
252
- (_f = ctx.logProvider) === null || _f === void 0 ? void 0 : _f.info(msg);
253
- if (url) {
254
- const title = "View Provisioned Resources";
255
- (_g = ctx.ui) === null || _g === void 0 ? void 0 : _g.showMessage("info", msg, false, title).then((result) => {
256
- const userSelected = result.isOk() ? result.value : undefined;
257
- if (userSelected === title) {
258
- ctx.ui.openUrl(url);
259
- }
260
- });
261
- }
262
- else {
263
- (_h = ctx.ui) === null || _h === void 0 ? void 0 : _h.showMessage("info", msg, false);
264
- }
265
- (_j = ctx.envInfo.state.get(constants_2.GLOBAL_CONFIG)) === null || _j === void 0 ? void 0 : _j.set(constants_2.SOLUTION_PROVISION_SUCCEEDED, true);
266
- if (!this.isAzureProject(ctx)) {
267
- const appStudioTokenJsonRes = await ((_k = ctx.m365TokenProvider) === null || _k === void 0 ? void 0 : _k.getJsonObject({
268
- scopes: tools_1.AppStudioScopes,
269
- }));
270
- const appStudioTokenJson = (appStudioTokenJsonRes === null || appStudioTokenJsonRes === void 0 ? void 0 : appStudioTokenJsonRes.isOk())
271
- ? appStudioTokenJsonRes.value
272
- : undefined;
273
- (_l = ctx.envInfo.state
274
- .get(constants_2.GLOBAL_CONFIG)) === null || _l === void 0 ? void 0 : _l.set(constants_2.REMOTE_TEAMS_APP_TENANT_ID, appStudioTokenJson.tid);
275
- }
276
- }
277
- else {
278
- if (!tools_1.isUserCancelError(provisionResult.error) &&
279
- !tools_1.isCheckAccountError(provisionResult.error)) {
280
- const msg = localizeUtils_1.getLocalizedString("core.provision.failNotice", (_m = ctx.projectSettings) === null || _m === void 0 ? void 0 : _m.appName);
281
- (_o = ctx.logProvider) === null || _o === void 0 ? void 0 : _o.error(msg);
282
- (_p = ctx.envInfo.state.get(constants_2.GLOBAL_CONFIG)) === null || _p === void 0 ? void 0 : _p.set(constants_2.SOLUTION_PROVISION_SUCCEEDED, false);
283
- }
284
- }
285
- return provisionResult;
286
- }
287
- finally {
288
- this.runningState = types_1.SolutionRunningState.Idle;
289
- }
290
- }
291
- /**
292
- * provision
293
- */
294
- async doProvision(ctx) {
295
- var _a, _b;
296
- const maybeSelectedPlugins = this.getSelectedPlugins(ctx);
297
- if (maybeSelectedPlugins.isErr()) {
298
- return maybeSelectedPlugins;
299
- }
300
- const selectedPlugins = maybeSelectedPlugins.value;
301
- // Send config telemetry before actually doing anything.
302
- // If something fails, we can know whether it is related to the config.
303
- const redactedEnvConfig = tools_1.redactObject(ctx.envInfo.config, teamsfx_api_1.EnvConfigSchema);
304
- (_a = ctx.telemetryReporter) === null || _a === void 0 ? void 0 : _a.sendTelemetryEvent(telemetry_1.TelemetryEvent.EnvConfig, {
305
- [telemetry_1.TelemetryProperty.Env]: tools_1.getHashedEnv(ctx.envInfo.envName),
306
- [telemetry_1.TelemetryProperty.EnvConfig]: JSON.stringify(redactedEnvConfig),
307
- });
308
- if (this.isAzureProject(ctx)) {
309
- //1. ask common questions for azure resources.
310
- const appName = ctx.projectSettings.appName;
311
- const appStudioTokenJsonRes = await ((_b = ctx.m365TokenProvider) === null || _b === void 0 ? void 0 : _b.getJsonObject({
312
- scopes: tools_1.AppStudioScopes,
313
- }));
314
- const appStudioTokenJson = (appStudioTokenJsonRes === null || appStudioTokenJsonRes === void 0 ? void 0 : appStudioTokenJsonRes.isOk())
315
- ? appStudioTokenJsonRes.value
316
- : undefined;
317
- const res = await commonQuestions_1.fillInCommonQuestions(ctx, appName, ctx.envInfo.state, ctx.azureAccountProvider, appStudioTokenJson);
318
- if (res.isErr()) {
319
- return res;
320
- }
321
- const consentResult = await askForProvisionConsent(ctx);
322
- if (consentResult.isErr()) {
323
- return consentResult;
324
- }
325
- // create resource group if needed
326
- const commonQuestionResult = res.value;
327
- if (commonQuestionResult.needCreateResourceGroup) {
328
- const maybeRgName = await commonQuestions_1.createNewResourceGroup(ctx.azureAccountProvider, commonQuestionResult.subscriptionId, commonQuestionResult.subscriptionName, commonQuestionResult.resourceGroupName, commonQuestionResult.location, ctx.logProvider);
329
- if (maybeRgName.isErr()) {
330
- return teamsfx_api_1.err(maybeRgName.error);
331
- }
332
- }
333
- }
334
- const pluginsWithCtx = this.getPluginAndContextArray(ctx, selectedPlugins);
335
- const preProvisionWithCtx = pluginsWithCtx.map(([plugin, context]) => {
336
- var _a;
337
- return [(_a = plugin === null || plugin === void 0 ? void 0 : plugin.preProvision) === null || _a === void 0 ? void 0 : _a.bind(plugin), context, plugin.name];
338
- });
339
- const provisionWithCtx = pluginsWithCtx.map(([plugin, context]) => {
340
- var _a;
341
- return [(_a = plugin === null || plugin === void 0 ? void 0 : plugin.provision) === null || _a === void 0 ? void 0 : _a.bind(plugin), context, plugin.name];
342
- });
343
- const postProvisionWithCtx = pluginsWithCtx.map(([plugin, context]) => {
344
- var _a;
345
- return [(_a = plugin === null || plugin === void 0 ? void 0 : plugin.postProvision) === null || _a === void 0 ? void 0 : _a.bind(plugin), context, plugin.name];
346
- });
347
- return executor_1.executeLifecycles(preProvisionWithCtx, provisionWithCtx, postProvisionWithCtx, async () => {
348
- var _a;
349
- (_a = ctx.logProvider) === null || _a === void 0 ? void 0 : _a.info(localizeUtils_1.getLocalizedString("core.provision.StartNotice", constants_1.PluginDisplayName.Solution));
350
- return teamsfx_api_1.ok(undefined);
351
- }, async (provisionResults) => {
352
- var _a;
353
- if (provisionResults) {
354
- for (const result of provisionResults) {
355
- if (result.isErr()) {
356
- return result;
357
- }
358
- }
359
- }
360
- if (this.isAzureProject(ctx)) {
361
- const armDeploymentResult = await arm_1.deployArmTemplates(ctx);
362
- if (armDeploymentResult.isErr()) {
363
- return armDeploymentResult;
364
- }
365
- }
366
- (_a = ctx.logProvider) === null || _a === void 0 ? void 0 : _a.info(localizeUtils_1.getLocalizedString("core.provision.ProvisionFinishNotice", constants_1.PluginDisplayName.Solution));
367
- const aadPlugin = this.AadPlugin;
368
- if (selectedPlugins.some((plugin) => plugin.name === aadPlugin.name)) {
369
- return await aadPlugin.executeUserTask({
370
- namespace: `${constants_2.PluginNames.SOLUTION}/${constants_2.PluginNames.AAD}`,
371
- method: "setApplicationInContext",
372
- params: { isLocal: false },
373
- }, util_1.getPluginContext(ctx, aadPlugin.name));
374
- }
375
- return teamsfx_api_1.ok(undefined);
376
- }, async () => {
377
- var _a;
378
- (_a = ctx.logProvider) === null || _a === void 0 ? void 0 : _a.info(localizeUtils_1.getLocalizedString("core.provision.configurationFinishNotice", constants_1.PluginDisplayName.Solution));
379
- return teamsfx_api_1.ok(undefined);
380
- });
381
- }
382
- async deploy(ctx) {
383
- var _a, _b, _c, _d, _e, _f, _g;
384
- const isAzureProject = this.isAzureProject(ctx);
385
- const provisioned = this.checkWetherProvisionSucceeded(ctx.envInfo.state);
386
- if (isAzureProject && !provisioned) {
387
- return teamsfx_api_1.err(new teamsfx_api_1.UserError(constants_2.SolutionSource, constants_2.SolutionError.CannotDeployBeforeProvision, localizeUtils_1.getDefaultString("core.NotProvisionedNotice", (_a = ctx.projectSettings) === null || _a === void 0 ? void 0 : _a.appName), localizeUtils_1.getLocalizedString("core.NotProvisionedNotice", (_b = ctx.projectSettings) === null || _b === void 0 ? void 0 : _b.appName)));
388
- }
389
- try {
390
- if (this.isAzureProject(ctx)) {
391
- // Just to trigger M365 login before the concurrent execution of deploy.
392
- // Because concurrent exectution of deploy may getAccessToken() concurrently, which
393
- // causes 2 M365 logins before the token caching in common lib takes effect.
394
- const appStudioTokenJsonRes = await ctx.m365TokenProvider.getJsonObject({
395
- scopes: tools_1.AppStudioScopes,
396
- });
397
- if (appStudioTokenJsonRes.isErr()) {
398
- return teamsfx_api_1.err(appStudioTokenJsonRes.error);
399
- }
400
- const checkM365 = await commonQuestions_1.checkM365Tenant({ version: 1, data: ctx.envInfo }, appStudioTokenJsonRes.value);
401
- if (checkM365.isErr()) {
402
- return checkM365;
403
- }
404
- const checkAzure = await commonQuestions_1.checkSubscription({ version: 1, data: ctx.envInfo }, ctx.azureAccountProvider);
405
- if (checkAzure.isErr()) {
406
- return checkAzure;
407
- }
408
- }
409
- this.runningState = types_1.SolutionRunningState.DeployInProgress;
410
- const result = await this.doDeploy(ctx);
411
- if (result.isOk()) {
412
- if (this.isAzureProject(ctx)) {
413
- const msg = localizeUtils_1.getLocalizedString("core.deploy.successNotice", (_c = ctx.projectSettings) === null || _c === void 0 ? void 0 : _c.appName);
414
- (_d = ctx.logProvider) === null || _d === void 0 ? void 0 : _d.info(msg);
415
- (_e = ctx.ui) === null || _e === void 0 ? void 0 : _e.showMessage("info", msg, false);
416
- }
417
- }
418
- else {
419
- const msg = localizeUtils_1.getLocalizedString("core.deploy.failNotice", (_f = ctx.projectSettings) === null || _f === void 0 ? void 0 : _f.appName);
420
- (_g = ctx.logProvider) === null || _g === void 0 ? void 0 : _g.info(msg);
421
- }
422
- return result;
423
- }
424
- finally {
425
- this.runningState = types_1.SolutionRunningState.Idle;
426
- }
427
- }
428
- /**
429
- * deploy
430
- */
431
- async doDeploy(ctx) {
432
- var _a, _b, _c;
433
- const res = this.getSelectedPlugins(ctx);
434
- if (res.isErr()) {
435
- return res;
436
- }
437
- const optionsToDeploy = ctx.answers[question_1.AzureSolutionQuestionNames.PluginSelectionDeploy];
438
- if (optionsToDeploy === undefined || optionsToDeploy.length === 0) {
439
- return teamsfx_api_1.err(new teamsfx_api_1.UserError(constants_2.SolutionSource, constants_2.SolutionError.NoResourcePluginSelected, "No plugin selected"));
440
- }
441
- const pluginMap = ResourcePluginContainer_1.getAllResourcePluginMap();
442
- const pluginsToDeploy = [];
443
- for (const optionId of optionsToDeploy) {
444
- const filtered = pluginMap.get(optionId);
445
- if (filtered && res.value.find((p) => p.name === filtered.name)) {
446
- pluginsToDeploy.push(filtered);
447
- }
448
- }
449
- (_a = ctx.logProvider) === null || _a === void 0 ? void 0 : _a.info(localizeUtils_1.getLocalizedString("core.deploy.selectedPluginsToDeployNotice", constants_1.PluginDisplayName.Solution, JSON.stringify(pluginsToDeploy.map((p) => p.name))));
450
- if (this.isAzureProject(ctx)) {
451
- //make sure sub is selected
452
- await ((_b = ctx.azureAccountProvider) === null || _b === void 0 ? void 0 : _b.getSelectedSubscription(true));
453
- }
454
- const pluginsWithCtx = this.getPluginAndContextArray(ctx, pluginsToDeploy);
455
- const preDeployWithCtx = pluginsWithCtx.map(([plugin, context]) => {
456
- var _a;
457
- return [(_a = plugin === null || plugin === void 0 ? void 0 : plugin.preDeploy) === null || _a === void 0 ? void 0 : _a.bind(plugin), context, plugin.name];
458
- });
459
- const deployWithCtx = pluginsWithCtx.map(([plugin, context]) => {
460
- var _a;
461
- return [(_a = plugin === null || plugin === void 0 ? void 0 : plugin.deploy) === null || _a === void 0 ? void 0 : _a.bind(plugin), context, plugin.name];
462
- });
463
- const postDeployWithCtx = pluginsWithCtx.map(([plugin, context]) => {
464
- var _a;
465
- return [(_a = plugin === null || plugin === void 0 ? void 0 : plugin.postDeploy) === null || _a === void 0 ? void 0 : _a.bind(plugin), context, plugin.name];
466
- });
467
- (_c = ctx.logProvider) === null || _c === void 0 ? void 0 : _c.info(localizeUtils_1.getLocalizedString("core.deploy.startNotice", constants_1.PluginDisplayName.Solution));
468
- return executor_1.executeLifecycles(preDeployWithCtx, deployWithCtx, postDeployWithCtx);
469
- }
470
- async publish(ctx) {
471
- var _a, _b, _c, _d, _e, _f;
472
- const checkRes = this.checkWhetherSolutionIsIdle();
473
- if (checkRes.isErr())
474
- return teamsfx_api_1.err(checkRes.error);
475
- const isAzureProject = this.isAzureProject(ctx);
476
- const provisioned = this.checkWetherProvisionSucceeded(ctx.envInfo.state);
477
- if (!provisioned) {
478
- return teamsfx_api_1.err(new teamsfx_api_1.UserError(constants_2.SolutionSource, constants_2.SolutionError.CannotPublishBeforeProvision, localizeUtils_1.getDefaultString("core.NotProvisionedNotice", (_a = ctx.projectSettings) === null || _a === void 0 ? void 0 : _a.appName), localizeUtils_1.getLocalizedString("core.NotProvisionedNotice", (_b = ctx.projectSettings) === null || _b === void 0 ? void 0 : _b.appName)));
479
- }
480
- try {
481
- const appStudioTokenJsonRes = await ((_c = ctx.m365TokenProvider) === null || _c === void 0 ? void 0 : _c.getJsonObject({
482
- scopes: tools_1.AppStudioScopes,
483
- }));
484
- const appStudioTokenJson = (appStudioTokenJsonRes === null || appStudioTokenJsonRes === void 0 ? void 0 : appStudioTokenJsonRes.isOk())
485
- ? appStudioTokenJsonRes.value
486
- : undefined;
487
- const checkM365 = await commonQuestions_1.checkM365Tenant({ version: 1, data: ctx.envInfo }, appStudioTokenJson);
488
- if (checkM365.isErr()) {
489
- return checkM365;
490
- }
491
- this.runningState = types_1.SolutionRunningState.PublishInProgress;
492
- const pluginsWithCtx = this.getPluginAndContextArray(ctx, [
493
- this.AppStudioPlugin,
494
- ]);
495
- const publishWithCtx = pluginsWithCtx.map(([plugin, context]) => {
496
- var _a;
497
- return [(_a = plugin === null || plugin === void 0 ? void 0 : plugin.publish) === null || _a === void 0 ? void 0 : _a.bind(plugin), context, plugin.name];
498
- });
499
- (_d = ctx.logProvider) === null || _d === void 0 ? void 0 : _d.info(localizeUtils_1.getLocalizedString("core.publish.startNotice", constants_1.PluginDisplayName.Solution));
500
- const results = await executor_1.executeConcurrently("", publishWithCtx);
501
- for (const result of results) {
502
- if (result.isErr()) {
503
- const msg = localizeUtils_1.getLocalizedString("core.publish.failNotice", (_e = ctx.projectSettings) === null || _e === void 0 ? void 0 : _e.appName);
504
- (_f = ctx.logProvider) === null || _f === void 0 ? void 0 : _f.info(msg);
505
- return result;
506
- }
507
- }
508
- return teamsfx_api_1.ok(undefined);
509
- }
510
- finally {
511
- this.runningState = types_1.SolutionRunningState.Idle;
512
- }
513
- }
514
- async getTabScaffoldQuestions(ctx, addAzureResource) {
515
- const tabNode = new teamsfx_api_1.QTreeNode({ type: "group" });
516
- //Frontend plugin
517
- const fehostPlugin = this.FrontendPlugin;
518
- if (fehostPlugin.getQuestions) {
519
- const pluginCtx = util_1.getPluginContext(ctx, fehostPlugin.name);
520
- const res = await fehostPlugin.getQuestions(teamsfx_api_1.Stage.create, pluginCtx);
521
- if (res.isErr())
522
- return res;
523
- if (res.value) {
524
- const frontendNode = res.value;
525
- if (frontendNode.data)
526
- tabNode.addChild(frontendNode);
527
- }
528
- }
529
- if (addAzureResource) {
530
- const azureResourceNode = new teamsfx_api_1.QTreeNode(question_1.AzureResourcesQuestion);
531
- tabNode.addChild(azureResourceNode);
532
- const functionPlugin = this.FunctionPlugin;
533
- //Azure Function
534
- if (functionPlugin.getQuestions) {
535
- const pluginCtx = util_1.getPluginContext(ctx, functionPlugin.name);
536
- const res = await functionPlugin.getQuestions(teamsfx_api_1.Stage.create, pluginCtx);
537
- if (res.isErr())
538
- return res;
539
- if (res.value) {
540
- const azure_function = res.value;
541
- azure_function.condition = { minItems: 1 };
542
- if (azure_function.data)
543
- azureResourceNode.addChild(azure_function);
544
- }
545
- }
546
- const sqlPlugin = this.SqlPlugin;
547
- //Azure SQL
548
- if (sqlPlugin.getQuestions) {
549
- const pluginCtx = util_1.getPluginContext(ctx, sqlPlugin.name);
550
- const res = await sqlPlugin.getQuestions(teamsfx_api_1.Stage.create, pluginCtx);
551
- if (res.isErr())
552
- return res;
553
- if (res.value) {
554
- const azure_sql = res.value;
555
- azure_sql.condition = { contains: question_1.AzureResourceSQL.id };
556
- if (azure_sql.data)
557
- azureResourceNode.addChild(azure_sql);
558
- }
559
- }
560
- }
561
- return teamsfx_api_1.ok(tabNode);
562
- }
563
- /**
564
- * collect solution level question
565
- * @param ctx
566
- */
567
- async getQuestions(stage, ctx) {
568
- var _a, _b, _c;
569
- const isDynamicQuestion = teamsfx_api_1.DynamicPlatforms.includes(ctx.answers.platform);
570
- const node = new teamsfx_api_1.QTreeNode({ type: "group" });
571
- if (stage !== teamsfx_api_1.Stage.create && isDynamicQuestion) {
572
- const checkRes = this.checkWhetherSolutionIsIdle();
573
- if (checkRes.isErr())
574
- return teamsfx_api_1.err(checkRes.error);
575
- }
576
- if (stage === teamsfx_api_1.Stage.create) {
577
- // 1. capabilities
578
- const capQuestion = question_2.createCapabilityQuestion();
579
- const capNode = new teamsfx_api_1.QTreeNode(capQuestion);
580
- node.addChild(capNode);
581
- // 1.1.1 SPFX Tab
582
- const spfxPlugin = this.SpfxPlugin;
583
- if (spfxPlugin.getQuestions) {
584
- const pluginCtx = util_1.getPluginContext(ctx, spfxPlugin.name);
585
- const res = await spfxPlugin.getQuestions(teamsfx_api_1.Stage.create, pluginCtx);
586
- if (res.isErr())
587
- return res;
588
- if (res.value) {
589
- const spfxNode = res.value;
590
- spfxNode.condition = { contains: question_1.TabSPFxItem.id };
591
- if (spfxNode.data)
592
- capNode.addChild(spfxNode);
593
- }
594
- }
595
- // 1.1.2 Azure Tab
596
- const tabRes = await this.getTabScaffoldQuestions(ctx, ((_a = ctx.answers) === null || _a === void 0 ? void 0 : _a.platform) === teamsfx_api_1.Platform.VSCode ? false : true);
597
- if (tabRes.isErr())
598
- return tabRes;
599
- if (tabRes.value) {
600
- const tabNode = tabRes.value;
601
- tabNode.condition = { contains: question_1.TabOptionItem.id };
602
- capNode.addChild(tabNode);
603
- }
604
- // 1.2 Bot
605
- const botPlugin = this.BotPlugin;
606
- if (botPlugin.getQuestions) {
607
- const pluginCtx = util_1.getPluginContext(ctx, botPlugin.name);
608
- const res = await botPlugin.getQuestions(stage, pluginCtx);
609
- if (res.isErr())
610
- return res;
611
- if (res.value) {
612
- const botGroup = res.value;
613
- botGroup.condition = { containsAny: [question_1.BotOptionItem.id, question_1.MessageExtensionItem.id] };
614
- capNode.addChild(botGroup);
615
- }
616
- }
617
- }
618
- else if (stage === teamsfx_api_1.Stage.provision) {
619
- if (isDynamicQuestion) {
620
- const provisioned = this.checkWetherProvisionSucceeded(ctx.envInfo.state);
621
- if (provisioned)
622
- return teamsfx_api_1.ok(undefined);
623
- }
624
- let pluginsToProvision;
625
- if (isDynamicQuestion) {
626
- const res = this.getSelectedPlugins(ctx);
627
- if (res.isErr()) {
628
- return teamsfx_api_1.err(res.error);
629
- }
630
- pluginsToProvision = res.value;
631
- }
632
- else {
633
- pluginsToProvision = ResourcePluginContainer_1.getAllResourcePlugins();
634
- }
635
- if (!isDynamicQuestion) {
636
- node.addChild(new teamsfx_api_1.QTreeNode(question_1.AskSubscriptionQuestion));
637
- }
638
- for (const plugin of pluginsToProvision) {
639
- if (plugin.getQuestions) {
640
- const pluginCtx = util_1.getPluginContext(ctx, plugin.name);
641
- const getQuestionRes = await plugin.getQuestions(stage, pluginCtx);
642
- if (getQuestionRes.isErr())
643
- return getQuestionRes;
644
- if (getQuestionRes.value) {
645
- const subnode = getQuestionRes.value;
646
- node.addChild(subnode);
647
- }
648
- }
649
- }
650
- }
651
- else if (stage === teamsfx_api_1.Stage.deploy) {
652
- if (isDynamicQuestion) {
653
- const isAzureProject = this.isAzureProject(ctx);
654
- const provisioned = this.checkWetherProvisionSucceeded(ctx.envInfo.state);
655
- if (isAzureProject && !provisioned) {
656
- return teamsfx_api_1.err(new teamsfx_api_1.UserError({
657
- source: constants_2.SolutionSource,
658
- name: constants_2.SolutionError.CannotDeployBeforeProvision,
659
- message: localizeUtils_1.getDefaultString("core.deploy.FailedToDeployBeforeProvision"),
660
- displayMessage: localizeUtils_1.getLocalizedString("core.deploy.FailedToDeployBeforeProvision"),
661
- helpLink: constants_1.HelpLinks.WhyNeedProvision,
662
- }));
663
- }
664
- }
665
- let pluginsToDeploy;
666
- if (isDynamicQuestion) {
667
- const res = this.getSelectedPlugins(ctx);
668
- if (res.isErr()) {
669
- return teamsfx_api_1.err(new teamsfx_api_1.UserError(constants_2.SolutionSource, constants_2.SolutionError.NoResourceToDeploy, "No resource to deploy"));
670
- }
671
- pluginsToDeploy = res.value.filter((plugin) => !!plugin.deploy);
672
- }
673
- else {
674
- const allPlugins = ResourcePluginContainer_1.getAllResourcePlugins();
675
- pluginsToDeploy = allPlugins.filter((plugin) => !!plugin.deploy);
676
- }
677
- if (pluginsToDeploy.length === 0) {
678
- return teamsfx_api_1.err(new teamsfx_api_1.UserError(constants_2.SolutionSource, constants_2.SolutionError.NoResourceToDeploy, "No resource to deploy"));
679
- }
680
- const pluginPrefix = "fx-resource-";
681
- const options = pluginsToDeploy.map((plugin) => {
682
- const item = {
683
- id: plugin.name,
684
- label: plugin.displayName,
685
- cliName: plugin.name.replace(pluginPrefix, ""),
686
- };
687
- return item;
688
- });
689
- const selectQuestion = question_1.DeployPluginSelectQuestion;
690
- selectQuestion.staticOptions = options;
691
- selectQuestion.default = options.map((i) => i.id);
692
- const pluginSelection = new teamsfx_api_1.QTreeNode(selectQuestion);
693
- node.addChild(pluginSelection);
694
- for (const plugin of pluginsToDeploy) {
695
- if (plugin.getQuestions) {
696
- const pluginCtx = util_1.getPluginContext(ctx, plugin.name);
697
- const getQuestionRes = await plugin.getQuestions(stage, pluginCtx);
698
- if (getQuestionRes.isErr())
699
- return getQuestionRes;
700
- if (getQuestionRes.value) {
701
- const subnode = getQuestionRes.value;
702
- subnode.condition = { contains: plugin.name };
703
- if (subnode.data)
704
- pluginSelection.addChild(subnode);
705
- }
706
- }
707
- }
708
- }
709
- else if (stage === teamsfx_api_1.Stage.publish) {
710
- if (isDynamicQuestion) {
711
- const isAzureProject = this.isAzureProject(ctx);
712
- const provisioned = this.checkWetherProvisionSucceeded(ctx.envInfo.state);
713
- if (!provisioned) {
714
- const errorMsg = isAzureProject
715
- ? localizeUtils_1.getLocalizedString("core.publish.FailedToPublishBeforeProvision")
716
- : localizeUtils_1.getLocalizedString("core.publish.SPFxAskProvisionBeforePublish");
717
- return teamsfx_api_1.err(new teamsfx_api_1.UserError({
718
- source: constants_2.SolutionSource,
719
- name: constants_2.SolutionError.CannotPublishBeforeProvision,
720
- message: errorMsg,
721
- helpLink: constants_1.HelpLinks.WhyNeedProvision,
722
- }));
723
- }
724
- }
725
- const pluginsToPublish = [this.AppStudioPlugin];
726
- for (const plugin of pluginsToPublish) {
727
- const pluginCtx = util_1.getPluginContext(ctx, plugin.name);
728
- if (plugin.getQuestions) {
729
- const getQuestionRes = await plugin.getQuestions(stage, pluginCtx);
730
- if (getQuestionRes.isErr())
731
- return getQuestionRes;
732
- if (getQuestionRes.value) {
733
- const subnode = getQuestionRes.value;
734
- node.addChild(subnode);
735
- }
736
- }
737
- }
738
- }
739
- else if (stage === teamsfx_api_1.Stage.grantPermission) {
740
- if (isDynamicQuestion) {
741
- const appStudioTokenJsonRes = await ((_b = ctx.m365TokenProvider) === null || _b === void 0 ? void 0 : _b.getJsonObject({
742
- scopes: tools_1.AppStudioScopes,
743
- }));
744
- const appStudioTokenJson = (appStudioTokenJsonRes === null || appStudioTokenJsonRes === void 0 ? void 0 : appStudioTokenJsonRes.isOk())
745
- ? appStudioTokenJsonRes.value
746
- : undefined;
747
- node.addChild(new teamsfx_api_1.QTreeNode(question_1.getUserEmailQuestion((_c = appStudioTokenJson) === null || _c === void 0 ? void 0 : _c.upn)));
748
- }
749
- }
750
- return teamsfx_api_1.ok(node);
751
- }
752
- async localDebug(ctx) {
753
- var _a;
754
- try {
755
- if (!this.spfxSelected(ctx)) {
756
- if (ctx.permissionRequestProvider === undefined) {
757
- ctx.permissionRequestProvider = new permissionRequest_1.PermissionRequestFileProvider(ctx.root);
758
- }
759
- const result = await utils_1.ensurePermissionRequest((_a = ctx.projectSettings) === null || _a === void 0 ? void 0 : _a.solutionSettings, ctx.permissionRequestProvider);
760
- if (result.isErr()) {
761
- return result;
762
- }
763
- }
764
- }
765
- catch (e) {
766
- if (e instanceof teamsfx_api_1.UserError || e instanceof teamsfx_api_1.SystemError) {
767
- return teamsfx_api_1.err(e);
768
- }
769
- return teamsfx_api_1.err(new teamsfx_api_1.SystemError(constants_2.SolutionSource, "UnknownError", "check point 1 - " + JSON.stringify(e)));
770
- }
771
- return await this.doLocalDebug(ctx);
772
- }
773
- async doLocalDebug(ctx) {
774
- var _a, _b, _c;
775
- let checkPoint = 1;
776
- try {
777
- //check point 2
778
- const maybeSelectedPlugins = this.getSelectedPlugins(ctx);
779
- if (maybeSelectedPlugins.isErr()) {
780
- return maybeSelectedPlugins;
781
- }
782
- const selectedPlugins = maybeSelectedPlugins.value;
783
- checkPoint = 2;
784
- //check point 3
785
- // Just to trigger M365 login before the concurrent execution of localDebug.
786
- // Because concurrent exectution of localDebug may getAccessToken() concurrently, which
787
- // causes 2 M365 logins before the token caching in common lib takes effect.
788
- const appStudioTokenRes = await ctx.m365TokenProvider.getAccessToken({
789
- scopes: tools_1.AppStudioScopes,
790
- });
791
- if (appStudioTokenRes === null || appStudioTokenRes === void 0 ? void 0 : appStudioTokenRes.isErr()) {
792
- return teamsfx_api_1.err(appStudioTokenRes.error);
793
- }
794
- // Pop-up window to confirm if local debug in another tenant
795
- const localDebugTenantId = (_b = (_a = ctx.localSettings) === null || _a === void 0 ? void 0 : _a.teamsApp) === null || _b === void 0 ? void 0 : _b.get(localSettingsConstants_1.LocalSettingsTeamsAppKeys.TenantId);
796
- const m365TenantMatches = await utils_1.checkWhetherLocalDebugM365TenantMatches(ctx.envInfo, ctx.telemetryReporter, false, // legacy code
797
- localDebugTenantId, ctx.m365TokenProvider, ctx.root, true);
798
- if (m365TenantMatches.isErr()) {
799
- return m365TenantMatches;
800
- }
801
- checkPoint = 3;
802
- //check point 4
803
- const pluginsWithCtx = this.getPluginAndContextArray(ctx, selectedPlugins);
804
- const localDebugWithCtx = pluginsWithCtx.map(([plugin, context]) => {
805
- var _a;
806
- return [(_a = plugin === null || plugin === void 0 ? void 0 : plugin.localDebug) === null || _a === void 0 ? void 0 : _a.bind(plugin), context, plugin.name];
807
- });
808
- const postLocalDebugWithCtx = pluginsWithCtx.map(([plugin, context]) => {
809
- var _a;
810
- return [(_a = plugin === null || plugin === void 0 ? void 0 : plugin.postLocalDebug) === null || _a === void 0 ? void 0 : _a.bind(plugin), context, plugin.name];
811
- });
812
- const localDebugResults = await executor_1.executeConcurrently("", localDebugWithCtx);
813
- for (const localDebugResult of localDebugResults) {
814
- if (localDebugResult.isErr()) {
815
- return localDebugResult;
816
- }
817
- }
818
- checkPoint = 4;
819
- //check point 5
820
- if (!this.spfxSelected(ctx)) {
821
- const aadPlugin = this.AadPlugin;
822
- if (selectedPlugins.some((plugin) => plugin.name === aadPlugin.name)) {
823
- const result = await aadPlugin.executeUserTask({
824
- namespace: `${constants_2.PluginNames.SOLUTION}/${constants_2.PluginNames.AAD}`,
825
- method: "setApplicationInContext",
826
- params: { isLocal: true },
827
- }, util_1.getPluginContext(ctx, aadPlugin.name));
828
- if (result.isErr()) {
829
- return result;
830
- }
831
- }
832
- }
833
- checkPoint = 5;
834
- // check point 6
835
- // set local debug Teams app tenant id in context.
836
- const appStudioTokenJsonRes = await ((_c = ctx.m365TokenProvider) === null || _c === void 0 ? void 0 : _c.getJsonObject({
837
- scopes: tools_1.AppStudioScopes,
838
- }));
839
- const appStudioTokenJson = (appStudioTokenJsonRes === null || appStudioTokenJsonRes === void 0 ? void 0 : appStudioTokenJsonRes.isOk())
840
- ? appStudioTokenJsonRes.value
841
- : undefined;
842
- const result = this.loadTeamsAppTenantId(ctx, true, appStudioTokenJson);
843
- if (result.isErr()) {
844
- return result;
845
- }
846
- checkPoint = 6;
847
- //check point 7
848
- const postLocalDebugResults = await executor_1.executeConcurrently("post", postLocalDebugWithCtx);
849
- const combinedPostLocalDebugResults = teamsfx_api_1.combine(postLocalDebugResults);
850
- if (combinedPostLocalDebugResults.isErr()) {
851
- return combinedPostLocalDebugResults;
852
- }
853
- checkPoint = 7;
854
- //check point 8
855
- // set local debug Teams app id in context.
856
- if (postLocalDebugWithCtx.length === combinedPostLocalDebugResults.value.length) {
857
- postLocalDebugWithCtx.map(function (plugin, index) {
858
- var _a;
859
- if (plugin[2] === constants_2.PluginNames.APPST) {
860
- (_a = ctx.envInfo.state
861
- .get(constants_2.GLOBAL_CONFIG)) === null || _a === void 0 ? void 0 : _a.set(constants_2.LOCAL_DEBUG_TEAMS_APP_ID, combinedPostLocalDebugResults.value[index]);
862
- }
863
- });
864
- }
865
- checkPoint = 8;
866
- return teamsfx_api_1.ok(constants_2.Void);
867
- }
868
- catch (e) {
869
- if (e instanceof teamsfx_api_1.UserError || e instanceof teamsfx_api_1.SystemError) {
870
- return teamsfx_api_1.err(e);
871
- }
872
- return teamsfx_api_1.err(new teamsfx_api_1.SystemError(constants_2.SolutionSource, "UnknownError", `check point ${checkPoint} - ${JSON.stringify(e)}`));
873
- }
874
- }
875
- async grantPermission(ctx) {
876
- return grantPermission_1.grantPermission({ apiVersion: 1, ctx });
877
- }
878
- async checkPermission(ctx) {
879
- return checkPermission_1.checkPermission({ apiVersion: 1, ctx });
880
- }
881
- async listCollaborator(ctx) {
882
- return listCollaborator_1.listCollaborator({ apiVersion: 1, ctx });
883
- }
884
- loadTeamsAppTenantId(ctx, isLocalDebug, appStudioToken) {
885
- return utils_1.parseTeamsAppTenantId(appStudioToken).andThen((teamsAppTenantId) => {
886
- var _a, _b, _c;
887
- if (isLocalDebug) {
888
- (_b = (_a = ctx.localSettings) === null || _a === void 0 ? void 0 : _a.teamsApp) === null || _b === void 0 ? void 0 : _b.set(localSettingsConstants_1.LocalSettingsTeamsAppKeys.TenantId, teamsAppTenantId);
889
- }
890
- else {
891
- (_c = ctx.envInfo.state.get(constants_2.GLOBAL_CONFIG)) === null || _c === void 0 ? void 0 : _c.set("teamsAppTenantId", teamsAppTenantId);
892
- }
893
- return teamsfx_api_1.ok(ctx);
894
- });
895
- }
896
- getAzureSolutionSettings(ctx) {
897
- var _a;
898
- return (_a = ctx.projectSettings) === null || _a === void 0 ? void 0 : _a.solutionSettings;
899
- }
900
- async getQuestionsForAddResource(func, ctx) {
901
- const isDynamicQuestion = teamsfx_api_1.DynamicPlatforms.includes(ctx.answers.platform);
902
- const settings = this.getAzureSolutionSettings(ctx);
903
- if (isDynamicQuestion &&
904
- !(settings.hostType === question_1.HostTypeOptionAzure.id &&
905
- settings.capabilities &&
906
- settings.capabilities.includes(question_1.TabOptionItem.id))) {
907
- return teamsfx_api_1.err(new teamsfx_api_1.UserError(constants_2.SolutionSource, constants_2.SolutionError.AddResourceNotSupport, localizeUtils_1.getDefaultString("core.addResource.onlySupportAzure"), localizeUtils_1.getLocalizedString("core.addResource.onlySupportAzure")));
908
- }
909
- const selectedPlugins = settings.activeResourcePlugins || [];
910
- if (!selectedPlugins) {
911
- return teamsfx_api_1.err(new teamsfx_api_1.UserError(constants_2.SolutionSource, constants_2.SolutionError.InternelError, "selectedPlugins is empty"));
912
- }
913
- const functionPlugin = this.FunctionPlugin;
914
- const sqlPlugin = this.SqlPlugin;
915
- const apimPlugin = this.ApimPlugin;
916
- const keyVaultPlugin = this.KeyVaultPlugin;
917
- const alreadyHaveFunction = selectedPlugins.includes(functionPlugin.name);
918
- const alreadyHaveSQL = selectedPlugins.includes(sqlPlugin.name);
919
- const alreadyHaveAPIM = selectedPlugins.includes(apimPlugin.name);
920
- const alreadyHavekeyVault = selectedPlugins.includes(keyVaultPlugin.name);
921
- const addQuestion = question_1.createAddAzureResourceQuestion(alreadyHaveFunction, alreadyHaveSQL, alreadyHaveAPIM, alreadyHavekeyVault);
922
- const addAzureResourceNode = new teamsfx_api_1.QTreeNode(addQuestion);
923
- // there two cases to add function re-scaffold: 1. select add function 2. select add sql and function is not selected when creating
924
- if (functionPlugin.getQuestionsForUserTask) {
925
- const pluginCtx = util_1.getPluginContext(ctx, functionPlugin.name);
926
- const res = await functionPlugin.getQuestionsForUserTask(func, pluginCtx);
927
- if (res.isErr())
928
- return res;
929
- if (res.value) {
930
- const azure_function = res.value;
931
- if (alreadyHaveFunction) {
932
- // if already has function, the question will appear depends on whether user select function, otherwise, the question will always show
933
- azure_function.condition = { contains: question_1.AzureResourceFunction.id };
934
- }
935
- else {
936
- // if not function activated, select any option will trigger function question
937
- azure_function.condition = {
938
- containsAny: [question_1.AzureResourceApim.id, question_1.AzureResourceFunction.id, question_1.AzureResourceSQL.id],
939
- };
940
- }
941
- if (azure_function.data)
942
- addAzureResourceNode.addChild(azure_function);
943
- }
944
- }
945
- //Azure SQL
946
- if (sqlPlugin.getQuestionsForUserTask && !alreadyHaveSQL) {
947
- const pluginCtx = util_1.getPluginContext(ctx, sqlPlugin.name);
948
- const res = await sqlPlugin.getQuestionsForUserTask(func, pluginCtx);
949
- if (res.isErr())
950
- return res;
951
- if (res.value) {
952
- const azure_sql = res.value;
953
- azure_sql.condition = { contains: question_1.AzureResourceSQL.id };
954
- if (azure_sql.data)
955
- addAzureResourceNode.addChild(azure_sql);
956
- }
957
- }
958
- //APIM
959
- if (apimPlugin.getQuestionsForUserTask && (!alreadyHaveAPIM || !isDynamicQuestion)) {
960
- const pluginCtx = util_1.getPluginContext(ctx, apimPlugin.name);
961
- const res = await apimPlugin.getQuestionsForUserTask(func, pluginCtx);
962
- if (res.isErr())
963
- return res;
964
- if (res.value) {
965
- const apim = res.value;
966
- if (apim.data.type !== "group" || (apim.children && apim.children.length > 0)) {
967
- const groupNode = new teamsfx_api_1.QTreeNode({ type: "group" });
968
- groupNode.condition = { contains: question_1.AzureResourceApim.id };
969
- addAzureResourceNode.addChild(groupNode);
970
- const funcNode = new teamsfx_api_1.QTreeNode(question_1.AskSubscriptionQuestion);
971
- question_1.AskSubscriptionQuestion.func = async (inputs) => {
972
- if (!ctx.azureAccountProvider) {
973
- return teamsfx_api_1.err(new teamsfx_api_1.SystemError("Solution", constants_2.SolutionError.InternelError, "azureAccountProvider is undefined"));
974
- }
975
- const res = await commonQuestions_1.checkSubscription({ version: 1, data: ctx.envInfo }, ctx.azureAccountProvider);
976
- if (res.isOk()) {
977
- const sub = res.value;
978
- inputs.subscriptionId = sub.subscriptionId;
979
- inputs.tenantId = sub.tenantId;
980
- }
981
- return res;
982
- };
983
- groupNode.addChild(funcNode);
984
- groupNode.addChild(apim);
985
- }
986
- }
987
- }
988
- return teamsfx_api_1.ok(addAzureResourceNode);
989
- }
990
- async getQuestionsForAddCapability(ctx) {
991
- var _a;
992
- const isDynamicQuestion = teamsfx_api_1.DynamicPlatforms.includes(ctx.answers.platform);
993
- const settings = this.getAzureSolutionSettings(ctx);
994
- if (!(settings.hostType === question_1.HostTypeOptionAzure.id) && isDynamicQuestion) {
995
- return teamsfx_api_1.err(new teamsfx_api_1.UserError(constants_2.SolutionSource, constants_2.SolutionError.AddResourceNotSupport, localizeUtils_1.getDefaultString("core.addCapability.onlySupportAzure"), localizeUtils_1.getLocalizedString("core.addCapability.onlySupportAzure")));
996
- }
997
- const capabilities = settings.capabilities || [];
998
- const alreadyHaveTab = capabilities.includes(question_1.TabOptionItem.id);
999
- const alreadyHaveBotOrMe = capabilities.includes(question_1.BotOptionItem.id) || capabilities.includes(question_1.MessageExtensionItem.id);
1000
- if (alreadyHaveBotOrMe && alreadyHaveTab) {
1001
- const cannotAddCapWarnMsg = "Your App already has both Tab and Bot/Messaging extension, can not Add Capability.";
1002
- (_a = ctx.ui) === null || _a === void 0 ? void 0 : _a.showMessage("error", cannotAddCapWarnMsg, false);
1003
- return teamsfx_api_1.ok(undefined);
1004
- }
1005
- const addCapQuestion = question_1.addCapabilityQuestion(alreadyHaveTab, alreadyHaveBotOrMe);
1006
- const addCapNode = new teamsfx_api_1.QTreeNode(addCapQuestion);
1007
- //Tab sub tree
1008
- if (!alreadyHaveTab || !isDynamicQuestion) {
1009
- const tabRes = await this.getTabScaffoldQuestions(ctx, false);
1010
- if (tabRes.isErr())
1011
- return tabRes;
1012
- if (tabRes.value) {
1013
- const tabNode = tabRes.value;
1014
- tabNode.condition = { contains: question_1.TabOptionItem.id };
1015
- addCapNode.addChild(tabNode);
1016
- }
1017
- }
1018
- //Bot sub tree
1019
- const botPlugin = this.BotPlugin;
1020
- if ((!alreadyHaveBotOrMe || !isDynamicQuestion) && botPlugin.getQuestions) {
1021
- const pluginCtx = util_1.getPluginContext(ctx, botPlugin.name);
1022
- const res = await botPlugin.getQuestions(teamsfx_api_1.Stage.create, pluginCtx);
1023
- if (res.isErr())
1024
- return res;
1025
- if (res.value) {
1026
- const child = res.value;
1027
- child.condition = { containsAny: [question_1.BotOptionItem.id, question_1.MessageExtensionItem.id] };
1028
- if (child.data)
1029
- addCapNode.addChild(child);
1030
- }
1031
- }
1032
- return teamsfx_api_1.ok(addCapNode);
1033
- }
1034
- /**
1035
- * user questions for customized task
1036
- */
1037
- async getQuestionsForUserTask(func, ctx) {
1038
- const isDynamicQuestion = teamsfx_api_1.DynamicPlatforms.includes(ctx.answers.platform);
1039
- const namespace = func.namespace;
1040
- const array = namespace.split("/");
1041
- if (func.method === "addCapability") {
1042
- return await this.getQuestionsForAddCapability(ctx);
1043
- }
1044
- if (func.method === "addResource") {
1045
- return await this.getQuestionsForAddResource(func, ctx);
1046
- }
1047
- if (array.length == 2) {
1048
- const pluginName = array[1];
1049
- const pluginMap = ResourcePluginContainer_1.getAllResourcePluginMap();
1050
- const plugin = pluginMap.get(pluginName);
1051
- if (plugin) {
1052
- if (plugin.getQuestionsForUserTask) {
1053
- const pctx = util_1.getPluginContext(ctx, plugin.name);
1054
- return await plugin.getQuestionsForUserTask(func, pctx);
1055
- }
1056
- else {
1057
- return teamsfx_api_1.ok(undefined);
1058
- }
1059
- }
1060
- }
1061
- return teamsfx_api_1.ok(undefined);
1062
- }
1063
- async executeAddResource(ctx) {
1064
- var _a, _b, _c, _d, _e, _f, _g;
1065
- (_a = ctx.telemetryReporter) === null || _a === void 0 ? void 0 : _a.sendTelemetryEvent(constants_2.SolutionTelemetryEvent.AddResourceStart, {
1066
- [constants_2.SolutionTelemetryProperty.Component]: constants_2.SolutionTelemetryComponentName,
1067
- });
1068
- if (!ctx.answers) {
1069
- return teamsfx_api_1.err(new teamsfx_api_1.UserError(constants_2.SolutionSource, constants_2.SolutionError.InternelError, "answer is empty!"));
1070
- }
1071
- const settings = this.getAzureSolutionSettings(ctx);
1072
- const originalSettings = tools_1.deepCopy(settings);
1073
- const canProceed = executeUserTask_1.canAddResource(ctx.projectSettings, ctx.telemetryReporter);
1074
- if (canProceed.isErr()) {
1075
- return canProceed;
1076
- }
1077
- const selectedPlugins = settings.activeResourcePlugins;
1078
- const functionPlugin = this.FunctionPlugin;
1079
- const sqlPlugin = this.SqlPlugin;
1080
- const apimPlugin = this.ApimPlugin;
1081
- const keyVaultPlugin = this.KeyVaultPlugin;
1082
- const alreadyHaveFunction = selectedPlugins === null || selectedPlugins === void 0 ? void 0 : selectedPlugins.includes(functionPlugin.name);
1083
- const alreadyHaveSql = selectedPlugins === null || selectedPlugins === void 0 ? void 0 : selectedPlugins.includes(sqlPlugin.name);
1084
- const alreadyHaveApim = selectedPlugins === null || selectedPlugins === void 0 ? void 0 : selectedPlugins.includes(apimPlugin.name);
1085
- const alreadyHaveKeyVault = selectedPlugins === null || selectedPlugins === void 0 ? void 0 : selectedPlugins.includes(keyVaultPlugin.name);
1086
- const addResourcesAnswer = ctx.answers[question_1.AzureSolutionQuestionNames.AddResources];
1087
- if (!addResourcesAnswer) {
1088
- return teamsfx_api_1.err(new teamsfx_api_1.UserError(constants_2.SolutionSource, constants_2.SolutionError.InvalidInput, `answer of ${question_1.AzureSolutionQuestionNames.AddResources} is empty!`));
1089
- }
1090
- const addSQL = addResourcesAnswer.includes(question_1.AzureResourceSQL.id);
1091
- const addFunc = addResourcesAnswer.includes(question_1.AzureResourceFunction.id);
1092
- const addApim = addResourcesAnswer.includes(question_1.AzureResourceApim.id);
1093
- const addKeyVault = addResourcesAnswer.includes(question_1.AzureResourceKeyVault.id);
1094
- if ((alreadyHaveSql && addSQL) ||
1095
- (alreadyHaveApim && addApim) ||
1096
- (alreadyHaveKeyVault && addKeyVault)) {
1097
- const e = new teamsfx_api_1.UserError(constants_2.SolutionSource, constants_2.SolutionError.AddResourceNotSupport, "SQL/APIM/KeyVault is already added.");
1098
- return teamsfx_api_1.err(util_1.sendErrorTelemetryThenReturnError(constants_2.SolutionTelemetryEvent.AddResource, e, ctx.telemetryReporter));
1099
- }
1100
- let addNewResourceToProvision = false;
1101
- const notifications = [];
1102
- const pluginsToScaffold = [this.LocalDebugPlugin];
1103
- const pluginsToDoArm = [];
1104
- const azureResource = Array.from(settings.azureResources || []);
1105
- if (addFunc || ((addSQL || addApim) && !alreadyHaveFunction)) {
1106
- pluginsToScaffold.push(functionPlugin);
1107
- if (!azureResource.includes(question_1.AzureResourceFunction.id)) {
1108
- azureResource.push(question_1.AzureResourceFunction.id);
1109
- addNewResourceToProvision = true;
1110
- pluginsToDoArm.push(functionPlugin);
1111
- }
1112
- notifications.push(question_1.AzureResourceFunction.label);
1113
- }
1114
- if (addSQL && !alreadyHaveSql) {
1115
- pluginsToScaffold.push(sqlPlugin);
1116
- pluginsToDoArm.push(sqlPlugin);
1117
- azureResource.push(question_1.AzureResourceSQL.id);
1118
- notifications.push(question_1.AzureResourceSQL.label);
1119
- addNewResourceToProvision = true;
1120
- }
1121
- if (addApim && !alreadyHaveApim) {
1122
- pluginsToScaffold.push(apimPlugin);
1123
- pluginsToDoArm.push(apimPlugin);
1124
- azureResource.push(question_1.AzureResourceApim.id);
1125
- notifications.push(question_1.AzureResourceApim.label);
1126
- addNewResourceToProvision = true;
1127
- }
1128
- if (addKeyVault && !alreadyHaveKeyVault) {
1129
- pluginsToScaffold.push(keyVaultPlugin);
1130
- pluginsToDoArm.push(keyVaultPlugin);
1131
- azureResource.push(question_1.AzureResourceKeyVault.id);
1132
- notifications.push(question_1.AzureResourceKeyVault.label);
1133
- addNewResourceToProvision = true;
1134
- }
1135
- if (notifications.length > 0) {
1136
- if (addNewResourceToProvision) {
1137
- executeUserTask_1.showUpdateArmTemplateNotice(ctx.ui);
1138
- }
1139
- settings.azureResources = azureResource;
1140
- await this.reloadPlugins(settings);
1141
- (_b = ctx.logProvider) === null || _b === void 0 ? void 0 : _b.info(`start scaffolding ${notifications.join(",")}.....`);
1142
- const scaffoldRes = await this.doScaffold(ctx, pluginsToScaffold, addNewResourceToProvision, pluginsToDoArm);
1143
- if (scaffoldRes.isErr()) {
1144
- (_c = ctx.logProvider) === null || _c === void 0 ? void 0 : _c.info(`failed to scaffold ${notifications.join(",")}!`);
1145
- ctx.projectSettings.solutionSettings = originalSettings;
1146
- return teamsfx_api_1.err(util_1.sendErrorTelemetryThenReturnError(constants_2.SolutionTelemetryEvent.AddResource, scaffoldRes.error, ctx.telemetryReporter));
1147
- }
1148
- (_d = ctx.logProvider) === null || _d === void 0 ? void 0 : _d.info(`finish scaffolding ${notifications.join(",")}!`);
1149
- if (addNewResourceToProvision)
1150
- (_e = ctx.envInfo.state.get(constants_2.GLOBAL_CONFIG)) === null || _e === void 0 ? void 0 : _e.set(constants_2.SOLUTION_PROVISION_SUCCEEDED, false); //if selected plugin changed, we need to re-do provision
1151
- (_f = ctx.ui) === null || _f === void 0 ? void 0 : _f.showMessage("info", util.format(ctx.answers.platform === teamsfx_api_1.Platform.CLI
1152
- ? localizeUtils_1.getLocalizedString("core.addResource.addResourceNoticeForCli")
1153
- : localizeUtils_1.getLocalizedString("core.addResource.addResourceNotice"), notifications.join(",")), false);
1154
- }
1155
- (_g = ctx.telemetryReporter) === null || _g === void 0 ? void 0 : _g.sendTelemetryEvent(constants_2.SolutionTelemetryEvent.AddResource, {
1156
- [constants_2.SolutionTelemetryProperty.Component]: constants_2.SolutionTelemetryComponentName,
1157
- [constants_2.SolutionTelemetryProperty.Success]: constants_2.SolutionTelemetrySuccess.Yes,
1158
- [constants_2.SolutionTelemetryProperty.Resources]: addResourcesAnswer.join(";"),
1159
- });
1160
- return teamsfx_api_1.ok(constants_2.Void);
1161
- }
1162
- async executeAddCapability(ctx) {
1163
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
1164
- (_a = ctx.telemetryReporter) === null || _a === void 0 ? void 0 : _a.sendTelemetryEvent(constants_2.SolutionTelemetryEvent.AddCapabilityStart, {
1165
- [constants_2.SolutionTelemetryProperty.Component]: constants_2.SolutionTelemetryComponentName,
1166
- });
1167
- if (!ctx.answers) {
1168
- return teamsfx_api_1.err(new teamsfx_api_1.UserError(constants_2.SolutionSource, constants_2.SolutionError.InternelError, "answer is empty!"));
1169
- }
1170
- const settings = this.getAzureSolutionSettings(ctx);
1171
- const originalSettings = tools_1.deepCopy(settings);
1172
- const canProceed = executeUserTask_1.canAddCapability(settings, ctx.telemetryReporter);
1173
- if (canProceed.isErr()) {
1174
- return canProceed;
1175
- }
1176
- const capabilitiesAnswer = ctx.answers[question_1.AzureSolutionQuestionNames.Capabilities];
1177
- if (!capabilitiesAnswer || capabilitiesAnswer.length === 0) {
1178
- (_b = ctx.telemetryReporter) === null || _b === void 0 ? void 0 : _b.sendTelemetryEvent(constants_2.SolutionTelemetryEvent.AddCapability, {
1179
- [constants_2.SolutionTelemetryProperty.Component]: constants_2.SolutionTelemetryComponentName,
1180
- [constants_2.SolutionTelemetryProperty.Success]: constants_2.SolutionTelemetrySuccess.Yes,
1181
- [constants_2.SolutionTelemetryProperty.Capabilities]: [].join(";"),
1182
- });
1183
- return teamsfx_api_1.ok(constants_2.Void);
1184
- }
1185
- const alreadyHaveBotAndAddBot = (((_c = settings.capabilities) === null || _c === void 0 ? void 0 : _c.includes(question_1.BotOptionItem.id)) ||
1186
- ((_d = settings.capabilities) === null || _d === void 0 ? void 0 : _d.includes(question_1.MessageExtensionItem.id))) &&
1187
- (capabilitiesAnswer.includes(question_1.BotOptionItem.id) ||
1188
- capabilitiesAnswer.includes(question_1.MessageExtensionItem.id));
1189
- const alreadyHaveTabAndAddTab = ((_e = settings.capabilities) === null || _e === void 0 ? void 0 : _e.includes(question_1.TabOptionItem.id)) &&
1190
- capabilitiesAnswer.includes(question_1.TabOptionItem.id);
1191
- if (alreadyHaveBotAndAddBot || alreadyHaveTabAndAddTab) {
1192
- const e = new teamsfx_api_1.UserError(constants_2.SolutionSource, constants_2.SolutionError.FailedToAddCapability, "There are no additional capabilities you can add to your project.");
1193
- return teamsfx_api_1.err(util_1.sendErrorTelemetryThenReturnError(constants_2.SolutionTelemetryEvent.AddCapability, e, ctx.telemetryReporter));
1194
- }
1195
- let change = false;
1196
- const pluginsToScaffold = [this.LocalDebugPlugin, this.AppStudioPlugin];
1197
- const capabilities = Array.from(settings.capabilities);
1198
- for (const cap of capabilitiesAnswer) {
1199
- if (!capabilities.includes(cap)) {
1200
- capabilities.push(cap);
1201
- change = true;
1202
- if (cap === question_1.TabOptionItem.id) {
1203
- pluginsToScaffold.push(this.FrontendPlugin);
1204
- pluginsToScaffold.push(typedi_1.Container.get(ResourcePluginContainer_1.ResourcePlugins.SimpleAuthPlugin));
1205
- }
1206
- else if ((cap === question_1.BotOptionItem.id || cap === question_1.MessageExtensionItem.id) &&
1207
- !pluginsToScaffold.includes(this.BotPlugin)) {
1208
- pluginsToScaffold.push(this.BotPlugin);
1209
- }
1210
- }
1211
- }
1212
- if (change) {
1213
- executeUserTask_1.showUpdateArmTemplateNotice(ctx.ui);
1214
- settings.capabilities = capabilities;
1215
- await this.reloadPlugins(settings);
1216
- const pluginNames = pluginsToScaffold.map((p) => p.name).join(",");
1217
- (_f = ctx.logProvider) === null || _f === void 0 ? void 0 : _f.info(`start scaffolding ${pluginNames}.....`);
1218
- const scaffoldRes = await this.doScaffold(ctx, pluginsToScaffold, true);
1219
- if (scaffoldRes.isErr()) {
1220
- (_g = ctx.logProvider) === null || _g === void 0 ? void 0 : _g.info(`failed to scaffold ${pluginNames}!`);
1221
- ctx.projectSettings.solutionSettings = originalSettings;
1222
- return teamsfx_api_1.err(util_1.sendErrorTelemetryThenReturnError(constants_2.SolutionTelemetryEvent.AddCapability, scaffoldRes.error, ctx.telemetryReporter));
1223
- }
1224
- (_h = ctx.logProvider) === null || _h === void 0 ? void 0 : _h.info(`finish scaffolding ${pluginNames}!`);
1225
- (_j = ctx.envInfo.state.get(constants_2.GLOBAL_CONFIG)) === null || _j === void 0 ? void 0 : _j.set(constants_2.SOLUTION_PROVISION_SUCCEEDED, false);
1226
- const addNames = capabilitiesAnswer.map((c) => `'${c}'`).join(" and ");
1227
- const single = capabilitiesAnswer.length === 1;
1228
- const template = ctx.answers.platform === teamsfx_api_1.Platform.CLI
1229
- ? single
1230
- ? localizeUtils_1.getLocalizedString("core.addCapability.addCapabilityNoticeForCli")
1231
- : localizeUtils_1.getLocalizedString("core.addCapability.addCapabilitiesNoticeForCli")
1232
- : single
1233
- ? localizeUtils_1.getLocalizedString("core.addCapability.addCapabilityNotice")
1234
- : localizeUtils_1.getLocalizedString("core.addCapability.addCapabilitiesNotice");
1235
- const msg = util.format(template, addNames);
1236
- (_k = ctx.ui) === null || _k === void 0 ? void 0 : _k.showMessage("info", msg, false);
1237
- (_l = ctx.telemetryReporter) === null || _l === void 0 ? void 0 : _l.sendTelemetryEvent(constants_2.SolutionTelemetryEvent.AddCapability, {
1238
- [constants_2.SolutionTelemetryProperty.Component]: constants_2.SolutionTelemetryComponentName,
1239
- [constants_2.SolutionTelemetryProperty.Success]: constants_2.SolutionTelemetrySuccess.Yes,
1240
- [constants_2.SolutionTelemetryProperty.Capabilities]: capabilitiesAnswer.join(";"),
1241
- });
1242
- return teamsfx_api_1.ok({});
1243
- }
1244
- const cannotAddCapWarnMsg = "Add nothing";
1245
- (_m = ctx.ui) === null || _m === void 0 ? void 0 : _m.showMessage("warn", cannotAddCapWarnMsg, false);
1246
- (_o = ctx.telemetryReporter) === null || _o === void 0 ? void 0 : _o.sendTelemetryEvent(constants_2.SolutionTelemetryEvent.AddCapability, {
1247
- [constants_2.SolutionTelemetryProperty.Component]: constants_2.SolutionTelemetryComponentName,
1248
- [constants_2.SolutionTelemetryProperty.Success]: constants_2.SolutionTelemetrySuccess.Yes,
1249
- [constants_2.SolutionTelemetryProperty.Capabilities]: [].join(";"),
1250
- });
1251
- return teamsfx_api_1.ok({});
1252
- }
1253
- /**
1254
- * execute user task
1255
- */
1256
- async executeUserTask(func, ctx) {
1257
- var _a;
1258
- if (!ctx.answers)
1259
- return teamsfx_api_1.err(new teamsfx_api_1.UserError(constants_2.SolutionSource, constants_2.SolutionError.InternelError, "answer is empty!"));
1260
- const namespace = func.namespace;
1261
- const method = func.method;
1262
- const array = namespace.split("/");
1263
- if (method === "addCapability") {
1264
- return this.executeAddCapability(ctx);
1265
- }
1266
- if (method === "addResource") {
1267
- return this.executeAddResource(ctx);
1268
- }
1269
- if (namespace.includes("solution")) {
1270
- if (method === "registerTeamsAppAndAad") {
1271
- const maybeParams = executeUserTask_1.extractParamForRegisterTeamsAppAndAad(ctx.answers);
1272
- if (maybeParams.isErr()) {
1273
- return maybeParams;
1274
- }
1275
- return this.registerTeamsAppAndAad(ctx, maybeParams.value);
1276
- }
1277
- else if (method === "VSpublish") {
1278
- // VSpublish means VS calling cli to do publish. It is different than normal cli work flow
1279
- // It's teamsfx init followed by teamsfx publish without running provision.
1280
- // Using executeUserTask here could bypass the fx project check.
1281
- if (((_a = ctx.answers) === null || _a === void 0 ? void 0 : _a.platform) !== "vs") {
1282
- return teamsfx_api_1.err(new teamsfx_api_1.SystemError(constants_2.SolutionSource, constants_2.SolutionError.UnsupportedPlatform, localizeUtils_1.getDefaultString("error.UnsupportedPlatformVS"), localizeUtils_1.getLocalizedString("error.UnsupportedPlatformVS")));
1283
- }
1284
- const appStudioPlugin = this.AppStudioPlugin;
1285
- const pluginCtx = util_1.getPluginContext(ctx, appStudioPlugin.name);
1286
- return appStudioPlugin.publish(pluginCtx);
1287
- }
1288
- else if (method === "validateManifest") {
1289
- const appStudioPlugin = this.AppStudioPlugin;
1290
- const pluginCtx = util_1.getPluginContext(ctx, appStudioPlugin.name);
1291
- return await appStudioPlugin.executeUserTask(func, pluginCtx);
1292
- }
1293
- else if (method === "buildPackage") {
1294
- const appStudioPlugin = this.AppStudioPlugin;
1295
- const pluginCtx = util_1.getPluginContext(ctx, appStudioPlugin.name);
1296
- return await appStudioPlugin.executeUserTask(func, pluginCtx);
1297
- }
1298
- else if (array.length == 2) {
1299
- const pluginName = array[1];
1300
- const pluginMap = ResourcePluginContainer_1.getAllResourcePluginMap();
1301
- const plugin = pluginMap.get(pluginName);
1302
- if (plugin && plugin.executeUserTask) {
1303
- const pctx = util_1.getPluginContext(ctx, plugin.name);
1304
- return plugin.executeUserTask(func, pctx);
1305
- }
1306
- }
1307
- }
1308
- return teamsfx_api_1.err(new teamsfx_api_1.UserError(constants_2.SolutionSource, `executeUserTaskRouteFailed`, localizeUtils_1.getDefaultString("error.appstudio.executeUserTaskRouteFailed", JSON.stringify(func)), localizeUtils_1.getLocalizedString("error.appstudio.executeUserTaskRouteFailed", JSON.stringify(func))));
1309
- }
1310
- prepareConfigForRegisterTeamsAppAndAad(config, params) {
1311
- const endpoint = params.endpoint;
1312
- const domain = new URL(endpoint).hostname;
1313
- if (config.get(constants_2.GLOBAL_CONFIG) == undefined) {
1314
- config.set(constants_2.GLOBAL_CONFIG, new teamsfx_api_1.ConfigMap());
1315
- }
1316
- const aadPlugin = this.AadPlugin;
1317
- if (config.get(aadPlugin.name) == undefined) {
1318
- config.set(aadPlugin.name, new teamsfx_api_1.ConfigMap());
1319
- }
1320
- config.get(aadPlugin.name).set("domain", domain);
1321
- config.get(aadPlugin.name).set("endpoint", endpoint);
1322
- return domain;
1323
- }
1324
- extractConfigForRegisterTeamsAppAndAad(config, isLocal) {
1325
- var _a, _b, _c;
1326
- const aadPlugin = this.AadPlugin;
1327
- const aadId = (_a = config.get(aadPlugin.name)) === null || _a === void 0 ? void 0 : _a.get(isLocal ? constants_2.LOCAL_DEBUG_AAD_ID : constants_2.REMOTE_AAD_ID);
1328
- if (aadId === undefined || typeof aadId !== "string") {
1329
- return teamsfx_api_1.err(new teamsfx_api_1.SystemError(constants_2.SolutionSource, constants_2.SolutionError.RegisterTeamsAppAndAadError, `config ${constants_2.LOCAL_DEBUG_AAD_ID} is missing`));
1330
- }
1331
- const applicationIdUri = (_b = config
1332
- .get(aadPlugin.name)) === null || _b === void 0 ? void 0 : _b.get(isLocal ? constants_2.LOCAL_APPLICATION_ID_URIS : constants_2.REMOTE_APPLICATION_ID_URIS);
1333
- if (applicationIdUri === undefined || typeof applicationIdUri !== "string") {
1334
- return teamsfx_api_1.err(new teamsfx_api_1.SystemError(constants_2.SolutionSource, constants_2.SolutionError.RegisterTeamsAppAndAadError, `config ${constants_2.LOCAL_APPLICATION_ID_URIS} is missing`));
1335
- }
1336
- const clientSecret = (_c = config
1337
- .get(aadPlugin.name)) === null || _c === void 0 ? void 0 : _c.get(isLocal ? constants_2.LOCAL_CLIENT_SECRET : constants_2.REMOTE_CLIENT_SECRET);
1338
- if (clientSecret === undefined || typeof clientSecret !== "string") {
1339
- return teamsfx_api_1.err(new teamsfx_api_1.SystemError(constants_2.SolutionSource, constants_2.SolutionError.RegisterTeamsAppAndAadError, `config ${constants_2.LOCAL_CLIENT_SECRET} is missing`));
1340
- }
1341
- return teamsfx_api_1.ok({
1342
- aadId,
1343
- applicationIdUri,
1344
- clientSecret,
1345
- });
1346
- }
1347
- /**
1348
- * This function is only called by cli: teamsfx init. The context may be different from that of vsc: no .${ConfigFolderName} folder, no permissions.json
1349
- * In order to reuse aad plugin, we need to pretend we are still in vsc context. Currently, we don't support icons, because icons are not included in the
1350
- * current contract.
1351
- */
1352
- async registerTeamsAppAndAad(ctx, params) {
1353
- var _a;
1354
- const rootPath = params["root-path"];
1355
- const isLocal = params.environment === "local";
1356
- const mockedManifest = new teamsfx_api_1.TeamsAppManifest();
1357
- mockedManifest.name.short = params["app-name"];
1358
- const domain = this.prepareConfigForRegisterTeamsAppAndAad(ctx.envInfo.state, params);
1359
- const aadPlugin = this.AadPlugin;
1360
- const aadPluginCtx = util_1.getPluginContext(ctx, aadPlugin.name);
1361
- if (ctx.permissionRequestProvider === undefined) {
1362
- ctx.permissionRequestProvider = {
1363
- async checkPermissionRequest() {
1364
- return teamsfx_api_1.ok(undefined);
1365
- },
1366
- async getPermissionRequest() {
1367
- return teamsfx_api_1.ok(JSON.stringify(constants_2.DEFAULT_PERMISSION_REQUEST));
1368
- },
1369
- };
1370
- }
1371
- const provisionResult = isLocal
1372
- ? await aadPlugin.localDebug(aadPluginCtx)
1373
- : await aadPlugin.provision(aadPluginCtx);
1374
- if (provisionResult.isErr()) {
1375
- return provisionResult;
1376
- }
1377
- await aadPlugin.executeUserTask({
1378
- namespace: `${constants_2.PluginNames.SOLUTION}/${constants_2.PluginNames.AAD}`,
1379
- method: "setApplicationInContext",
1380
- params: { isLocal: isLocal },
1381
- }, aadPluginCtx);
1382
- const postProvisionResult = isLocal
1383
- ? await aadPlugin.postLocalDebug(aadPluginCtx)
1384
- : await aadPlugin.postProvision(aadPluginCtx);
1385
- if (postProvisionResult.isErr()) {
1386
- return postProvisionResult;
1387
- }
1388
- const configResult = this.extractConfigForRegisterTeamsAppAndAad(ctx.envInfo.state, isLocal);
1389
- if (configResult.isErr()) {
1390
- return teamsfx_api_1.err(configResult.error);
1391
- }
1392
- const manifestPath = path_1.default.join(rootPath, "manifest", isLocal ? "local" : "remote", "manifest.json");
1393
- const appSettingsJSONPath = path_1.default.join(rootPath, isLocal ? "appsettings.Development.json" : "appsettings.json");
1394
- const manifestTpl = (await fs.readFile(manifestPath)).toString();
1395
- const manifestStr = mustache_1.default.render(manifestTpl, {
1396
- "client-id": configResult.value.aadId,
1397
- "app-name": params["app-name"],
1398
- endpoint: params.endpoint,
1399
- domain: domain,
1400
- "application-id-uri": configResult.value.applicationIdUri,
1401
- });
1402
- const manifest = JSON.parse(manifestStr);
1403
- await fs.writeFile(manifestPath, manifestStr);
1404
- const appStudioPlugin = this.AppStudioPlugin;
1405
- const func = {
1406
- namespace: `${constants_2.PluginNames.SOLUTION}/${constants_2.PluginNames.APPST}`,
1407
- method: "updateManifest",
1408
- params: {
1409
- type: "remote",
1410
- manifest: manifest,
1411
- },
1412
- };
1413
- const maybeTeamsAppId = await appStudioPlugin.executeUserTask(func, util_1.getPluginContext(ctx, this.AppStudioPlugin.name));
1414
- if (maybeTeamsAppId.isErr()) {
1415
- return teamsfx_api_1.err(maybeTeamsAppId.error);
1416
- }
1417
- const teamsAppId = maybeTeamsAppId.value;
1418
- const appSettingsJSONTpl = (await fs.readFile(appSettingsJSONPath)).toString();
1419
- const appStudioTokenJsonRes = await ((_a = ctx.m365TokenProvider) === null || _a === void 0 ? void 0 : _a.getJsonObject({
1420
- scopes: tools_1.AppStudioScopes,
1421
- }));
1422
- const appStudioTokenJson = (appStudioTokenJsonRes === null || appStudioTokenJsonRes === void 0 ? void 0 : appStudioTokenJsonRes.isOk())
1423
- ? appStudioTokenJsonRes.value
1424
- : undefined;
1425
- const maybeTenantId = utils_1.parseTeamsAppTenantId(appStudioTokenJson);
1426
- if (maybeTenantId.isErr()) {
1427
- return teamsfx_api_1.err(maybeTenantId.error);
1428
- }
1429
- const appSettingsJSON = mustache_1.default.render(appSettingsJSONTpl, {
1430
- "client-id": configResult.value.aadId,
1431
- "client-secret": configResult.value.clientSecret,
1432
- "application-id-uri": configResult.value.applicationIdUri,
1433
- endpoint: params.endpoint,
1434
- "tenant-id": maybeTenantId.value,
1435
- });
1436
- await fs.writeFile(appSettingsJSONPath, appSettingsJSON);
1437
- if (isLocal) {
1438
- const launchSettingsJSONPath = path_1.default.join(rootPath, "Properties", "launchSettings.json");
1439
- const launchSettingsJSONTpl = (await fs.readFile(launchSettingsJSONPath)).toString();
1440
- const launchSettingsJSON = mustache_1.default.render(launchSettingsJSONTpl, {
1441
- "teams-app-id": teamsAppId,
1442
- });
1443
- await fs.writeFile(launchSettingsJSONPath, launchSettingsJSON);
1444
- }
1445
- return teamsfx_api_1.ok({
1446
- teamsAppId: teamsAppId,
1447
- clientId: configResult.value.aadId,
1448
- clientSecret: configResult.value.clientSecret,
1449
- tenantId: maybeTenantId.value,
1450
- applicationIdUri: configResult.value.applicationIdUri,
1451
- });
1452
- }
1453
- };
1454
- tslib_1.__decorate([
1455
- lib_1.hooks([errorHandler_1.ErrorHandlerMW]),
1456
- tslib_1.__metadata("design:type", Function),
1457
- tslib_1.__metadata("design:paramtypes", [Object]),
1458
- tslib_1.__metadata("design:returntype", Promise)
1459
- ], TeamsAppSolution.prototype, "scaffold", null);
1460
- tslib_1.__decorate([
1461
- lib_1.hooks([errorHandler_1.ErrorHandlerMW]),
1462
- tslib_1.__metadata("design:type", Function),
1463
- tslib_1.__metadata("design:paramtypes", [Object]),
1464
- tslib_1.__metadata("design:returntype", Promise)
1465
- ], TeamsAppSolution.prototype, "provision", null);
1466
- tslib_1.__decorate([
1467
- lib_1.hooks([errorHandler_1.ErrorHandlerMW]),
1468
- tslib_1.__metadata("design:type", Function),
1469
- tslib_1.__metadata("design:paramtypes", [Object]),
1470
- tslib_1.__metadata("design:returntype", Promise)
1471
- ], TeamsAppSolution.prototype, "deploy", null);
1472
- tslib_1.__decorate([
1473
- lib_1.hooks([errorHandler_1.ErrorHandlerMW]),
1474
- tslib_1.__metadata("design:type", Function),
1475
- tslib_1.__metadata("design:paramtypes", [Object]),
1476
- tslib_1.__metadata("design:returntype", Promise)
1477
- ], TeamsAppSolution.prototype, "publish", null);
1478
- tslib_1.__decorate([
1479
- lib_1.hooks([errorHandler_1.ErrorHandlerMW]),
1480
- tslib_1.__metadata("design:type", Function),
1481
- tslib_1.__metadata("design:paramtypes", [Object]),
1482
- tslib_1.__metadata("design:returntype", Promise)
1483
- ], TeamsAppSolution.prototype, "grantPermission", null);
1484
- tslib_1.__decorate([
1485
- lib_1.hooks([errorHandler_1.ErrorHandlerMW]),
1486
- tslib_1.__metadata("design:type", Function),
1487
- tslib_1.__metadata("design:paramtypes", [Object]),
1488
- tslib_1.__metadata("design:returntype", Promise)
1489
- ], TeamsAppSolution.prototype, "checkPermission", null);
1490
- tslib_1.__decorate([
1491
- lib_1.hooks([errorHandler_1.ErrorHandlerMW]),
1492
- tslib_1.__metadata("design:type", Function),
1493
- tslib_1.__metadata("design:paramtypes", [Object]),
1494
- tslib_1.__metadata("design:returntype", Promise)
1495
- ], TeamsAppSolution.prototype, "listCollaborator", null);
1496
- tslib_1.__decorate([
1497
- lib_1.hooks([errorHandler_1.ErrorHandlerMW]),
1498
- tslib_1.__metadata("design:type", Function),
1499
- tslib_1.__metadata("design:paramtypes", [Object, Object]),
1500
- tslib_1.__metadata("design:returntype", Promise)
1501
- ], TeamsAppSolution.prototype, "executeUserTask", null);
1502
- TeamsAppSolution = tslib_1.__decorate([
1503
- typedi_1.Service(SolutionPluginContainer_1.SolutionPlugins.AzureTeamsSolution),
1504
- tslib_1.__metadata("design:paramtypes", [])
1505
- ], TeamsAppSolution);
1506
- exports.TeamsAppSolution = TeamsAppSolution;
1507
- async function askForProvisionConsent(ctx) {
1508
- var _a, _b, _c, _d, _e;
1509
- if (globalVars_1.isVsCallingCli()) {
1510
- // Skip asking users for input on VS calling CLI to simplify user interaction.
1511
- return teamsfx_api_1.ok(constants_2.Void);
1512
- }
1513
- const azureToken = await ((_a = ctx.azureAccountProvider) === null || _a === void 0 ? void 0 : _a.getAccountCredentialAsync());
1514
- // Only Azure project requires this confirm dialog
1515
- const username = azureToken.username ? azureToken.username : "";
1516
- const subscriptionId = (_b = ctx.envInfo.state.get(constants_2.GLOBAL_CONFIG)) === null || _b === void 0 ? void 0 : _b.get(constants_2.SUBSCRIPTION_ID);
1517
- const subscriptionName = (_c = ctx.envInfo.state.get(constants_2.GLOBAL_CONFIG)) === null || _c === void 0 ? void 0 : _c.get(constants_2.SUBSCRIPTION_NAME);
1518
- const msg = localizeUtils_1.getLocalizedString("core.provision.confirmEnvNotice", ctx.envInfo.envName, username, subscriptionName ? subscriptionName : subscriptionId);
1519
- const confirmRes = await ((_d = ctx.ui) === null || _d === void 0 ? void 0 : _d.showMessage("warn", msg, true, "Provision"));
1520
- const confirm = (confirmRes === null || confirmRes === void 0 ? void 0 : confirmRes.isOk()) ? confirmRes.value : undefined;
1521
- if (confirm !== "Provision") {
1522
- if (confirm === "Pricing calculator") {
1523
- (_e = ctx.ui) === null || _e === void 0 ? void 0 : _e.openUrl("https://azure.microsoft.com/en-us/pricing/calculator/");
1524
- }
1525
- return teamsfx_api_1.err(new teamsfx_api_1.UserError(constants_2.SolutionSource, "CancelProvision", "CancelProvision"));
1526
- }
1527
- return teamsfx_api_1.ok(constants_2.Void);
1528
- }
1529
- exports.askForProvisionConsent = askForProvisionConsent;
1530
- //# sourceMappingURL=solution.js.map