@microsoft/teamsfx-core 1.1.1 → 1.1.2-alpha.30d0724a.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.
- package/build/common/armInterface.d.ts +1 -1
- package/build/common/armInterface.d.ts.map +1 -1
- package/build/common/constants.d.ts +3 -2
- package/build/common/constants.d.ts.map +1 -1
- package/build/common/constants.js +3 -2
- package/build/common/constants.js.map +1 -1
- package/build/common/local/localEnvManager.d.ts +17 -0
- package/build/common/local/localEnvManager.d.ts.map +1 -0
- package/build/common/local/localEnvManager.js +72 -0
- package/build/common/local/localEnvManager.js.map +1 -0
- package/build/common/localSettingsProvider.d.ts +3 -3
- package/build/common/localSettingsProvider.d.ts.map +1 -1
- package/build/common/localSettingsProvider.js +11 -6
- package/build/common/localSettingsProvider.js.map +1 -1
- package/build/common/samples-config.json +14 -0
- package/build/common/tools.d.ts +11 -1
- package/build/common/tools.d.ts.map +1 -1
- package/build/common/tools.js +23 -10
- package/build/common/tools.js.map +1 -1
- package/build/core/SolutionPluginContainer.d.ts +2 -1
- package/build/core/SolutionPluginContainer.d.ts.map +1 -1
- package/build/core/SolutionPluginContainer.js +9 -1
- package/build/core/SolutionPluginContainer.js.map +1 -1
- package/build/core/environment.d.ts +4 -3
- package/build/core/environment.d.ts.map +1 -1
- package/build/core/environment.js +37 -7
- package/build/core/environment.js.map +1 -1
- package/build/core/error.d.ts +2 -1
- package/build/core/error.d.ts.map +1 -1
- package/build/core/error.js +7 -3
- package/build/core/error.js.map +1 -1
- package/build/core/index.d.ts +52 -14
- package/build/core/index.d.ts.map +1 -1
- package/build/core/index.js +699 -485
- package/build/core/index.js.map +1 -1
- package/build/core/middleware/concurrentLocker.d.ts.map +1 -1
- package/build/core/middleware/concurrentLocker.js +23 -12
- package/build/core/middleware/concurrentLocker.js.map +1 -1
- package/build/core/middleware/envInfoLoader.d.ts +5 -1
- package/build/core/middleware/envInfoLoader.d.ts.map +1 -1
- package/build/core/middleware/envInfoLoader.js +51 -44
- package/build/core/middleware/envInfoLoader.js.map +1 -1
- package/build/core/middleware/envInfoLoaderV3.d.ts +3 -0
- package/build/core/middleware/envInfoLoaderV3.d.ts.map +1 -0
- package/build/core/middleware/envInfoLoaderV3.js +64 -0
- package/build/core/middleware/envInfoLoaderV3.js.map +1 -0
- package/build/core/middleware/envInfoWriter.js +13 -30
- package/build/core/middleware/envInfoWriter.js.map +1 -1
- package/build/core/middleware/envInfoWriterV3.d.ts +6 -0
- package/build/core/middleware/envInfoWriterV3.d.ts.map +1 -0
- package/build/core/middleware/envInfoWriterV3.js +63 -0
- package/build/core/middleware/envInfoWriterV3.js.map +1 -0
- package/build/core/middleware/errorHandler.d.ts.map +1 -1
- package/build/core/middleware/errorHandler.js +3 -5
- package/build/core/middleware/errorHandler.js.map +1 -1
- package/build/core/middleware/localSettingsLoader.js.map +1 -1
- package/build/core/middleware/localSettingsWriter.d.ts.map +1 -1
- package/build/core/middleware/localSettingsWriter.js +6 -16
- package/build/core/middleware/localSettingsWriter.js.map +1 -1
- package/build/core/middleware/projectMigrator.d.ts.map +1 -1
- package/build/core/middleware/projectMigrator.js +22 -54
- package/build/core/middleware/projectMigrator.js.map +1 -1
- package/build/core/middleware/projectSettingsLoader.d.ts.map +1 -1
- package/build/core/middleware/projectSettingsLoader.js +2 -4
- package/build/core/middleware/projectSettingsLoader.js.map +1 -1
- package/build/core/middleware/projectSettingsLoaderV3.d.ts +4 -0
- package/build/core/middleware/projectSettingsLoaderV3.d.ts.map +1 -0
- package/build/core/middleware/projectSettingsLoaderV3.js +49 -0
- package/build/core/middleware/projectSettingsLoaderV3.js.map +1 -0
- package/build/core/middleware/projectSettingsWriter.d.ts.map +1 -1
- package/build/core/middleware/projectSettingsWriter.js +2 -2
- package/build/core/middleware/projectSettingsWriter.js.map +1 -1
- package/build/core/middleware/questionModel.d.ts +14 -1
- package/build/core/middleware/questionModel.d.ts.map +1 -1
- package/build/core/middleware/questionModel.js +319 -23
- package/build/core/middleware/questionModel.js.map +1 -1
- package/build/core/middleware/solutionLoader.d.ts +3 -2
- package/build/core/middleware/solutionLoader.d.ts.map +1 -1
- package/build/core/middleware/solutionLoader.js +21 -23
- package/build/core/middleware/solutionLoader.js.map +1 -1
- package/build/core/middleware/solutionLoaderV3.d.ts +4 -0
- package/build/core/middleware/solutionLoaderV3.d.ts.map +1 -0
- package/build/core/middleware/solutionLoaderV3.js +19 -0
- package/build/core/middleware/solutionLoaderV3.js.map +1 -0
- package/build/core/question.d.ts +9 -1
- package/build/core/question.d.ts.map +1 -1
- package/build/core/question.js +113 -3
- package/build/core/question.js.map +1 -1
- package/build/core/tools.d.ts +2 -1
- package/build/core/tools.d.ts.map +1 -1
- package/build/core/tools.js +15 -1
- package/build/core/tools.js.map +1 -1
- package/build/plugins/resource/aad/plugin.d.ts.map +1 -1
- package/build/plugins/resource/aad/plugin.js +1 -10
- package/build/plugins/resource/aad/plugin.js.map +1 -1
- package/build/plugins/resource/apim/managers/apimManager.d.ts.map +1 -1
- package/build/plugins/resource/apim/managers/apimManager.js +5 -7
- package/build/plugins/resource/apim/managers/apimManager.js.map +1 -1
- package/build/plugins/resource/appstudio/appStudio.d.ts +1 -1
- package/build/plugins/resource/appstudio/appStudio.d.ts.map +1 -1
- package/build/plugins/resource/appstudio/appStudio.js +106 -85
- package/build/plugins/resource/appstudio/appStudio.js.map +1 -1
- package/build/plugins/resource/appstudio/constants.d.ts +6 -1
- package/build/plugins/resource/appstudio/constants.d.ts.map +1 -1
- package/build/plugins/resource/appstudio/constants.js +6 -1
- package/build/plugins/resource/appstudio/constants.js.map +1 -1
- package/build/plugins/resource/appstudio/errors.d.ts +1 -1
- package/build/plugins/resource/appstudio/errors.d.ts.map +1 -1
- package/build/plugins/resource/appstudio/errors.js +2 -1
- package/build/plugins/resource/appstudio/errors.js.map +1 -1
- package/build/plugins/resource/appstudio/index.d.ts.map +1 -1
- package/build/plugins/resource/appstudio/index.js +10 -2
- package/build/plugins/resource/appstudio/index.js.map +1 -1
- package/build/plugins/resource/appstudio/plugin.d.ts +2 -3
- package/build/plugins/resource/appstudio/plugin.d.ts.map +1 -1
- package/build/plugins/resource/appstudio/plugin.js +93 -119
- package/build/plugins/resource/appstudio/plugin.js.map +1 -1
- package/build/plugins/resource/bot/index.d.ts.map +1 -1
- package/build/plugins/resource/bot/index.js +5 -1
- package/build/plugins/resource/bot/index.js.map +1 -1
- package/build/plugins/resource/bot/plugin.d.ts.map +1 -1
- package/build/plugins/resource/bot/plugin.js +9 -11
- package/build/plugins/resource/bot/plugin.js.map +1 -1
- package/build/plugins/resource/frontend/constants.d.ts +1 -7
- package/build/plugins/resource/frontend/constants.d.ts.map +1 -1
- package/build/plugins/resource/frontend/constants.js +2 -9
- package/build/plugins/resource/frontend/constants.js.map +1 -1
- package/build/plugins/resource/frontend/env.d.ts +21 -0
- package/build/plugins/resource/frontend/env.d.ts.map +1 -0
- package/build/plugins/resource/frontend/env.js +82 -0
- package/build/plugins/resource/frontend/env.js.map +1 -0
- package/build/plugins/resource/frontend/ops/deploy.d.ts +2 -1
- package/build/plugins/resource/frontend/ops/deploy.d.ts.map +1 -1
- package/build/plugins/resource/frontend/ops/deploy.js +2 -2
- package/build/plugins/resource/frontend/ops/deploy.js.map +1 -1
- package/build/plugins/resource/frontend/plugin.d.ts +2 -0
- package/build/plugins/resource/frontend/plugin.d.ts.map +1 -1
- package/build/plugins/resource/frontend/plugin.js +28 -16
- package/build/plugins/resource/frontend/plugin.js.map +1 -1
- package/build/plugins/resource/frontend/utils/environment-utils.d.ts.map +1 -1
- package/build/plugins/resource/frontend/utils/environment-utils.js +4 -2
- package/build/plugins/resource/frontend/utils/environment-utils.js.map +1 -1
- package/build/plugins/resource/frontend/utils.d.ts +6 -1
- package/build/plugins/resource/frontend/utils.d.ts.map +1 -1
- package/build/plugins/resource/frontend/utils.js +17 -6
- package/build/plugins/resource/frontend/utils.js.map +1 -1
- package/build/plugins/resource/function/plugin.d.ts.map +1 -1
- package/build/plugins/resource/function/plugin.js +7 -9
- package/build/plugins/resource/function/plugin.js.map +1 -1
- package/build/plugins/resource/function/utils/depsChecker/checker.d.ts +0 -1
- package/build/plugins/resource/function/utils/depsChecker/checker.d.ts.map +1 -1
- package/build/plugins/resource/function/utils/depsChecker/checker.js +2 -2
- package/build/plugins/resource/function/utils/depsChecker/checker.js.map +1 -1
- package/build/plugins/resource/function/utils/depsChecker/common.d.ts +2 -2
- package/build/plugins/resource/function/utils/depsChecker/common.d.ts.map +1 -1
- package/build/plugins/resource/function/utils/depsChecker/common.js +6 -6
- package/build/plugins/resource/function/utils/depsChecker/common.js.map +1 -1
- package/build/plugins/resource/function/utils/depsChecker/dotnetChecker.d.ts +3 -2
- package/build/plugins/resource/function/utils/depsChecker/dotnetChecker.d.ts.map +1 -1
- package/build/plugins/resource/function/utils/depsChecker/dotnetChecker.js +3 -2
- package/build/plugins/resource/function/utils/depsChecker/dotnetChecker.js.map +1 -1
- package/build/plugins/resource/function/utils/depsChecker/funcPluginAdapter.d.ts +0 -1
- package/build/plugins/resource/function/utils/depsChecker/funcPluginAdapter.d.ts.map +1 -1
- package/build/plugins/resource/function/utils/depsChecker/funcPluginAdapter.js +1 -23
- package/build/plugins/resource/function/utils/depsChecker/funcPluginAdapter.js.map +1 -1
- package/build/plugins/resource/identity/index.d.ts.map +1 -1
- package/build/plugins/resource/identity/index.js +11 -13
- package/build/plugins/resource/identity/index.js.map +1 -1
- package/build/plugins/resource/keyvault/plugin.d.ts.map +1 -1
- package/build/plugins/resource/keyvault/plugin.js +7 -9
- package/build/plugins/resource/keyvault/plugin.js.map +1 -1
- package/build/plugins/resource/localdebug/certificate.js +3 -3
- package/build/plugins/resource/localdebug/certificate.js.map +1 -1
- package/build/plugins/resource/localdebug/index.d.ts +0 -1
- package/build/plugins/resource/localdebug/index.d.ts.map +1 -1
- package/build/plugins/resource/localdebug/index.js +3 -280
- package/build/plugins/resource/localdebug/index.js.map +1 -1
- package/build/plugins/resource/localdebug/util/error.d.ts.map +1 -1
- package/build/plugins/resource/localdebug/util/error.js +1 -1
- package/build/plugins/resource/localdebug/util/error.js.map +1 -1
- package/build/plugins/resource/localdebug/v2/index.d.ts.map +1 -1
- package/build/plugins/resource/localdebug/v2/index.js +34 -1
- package/build/plugins/resource/localdebug/v2/index.js.map +1 -1
- package/build/plugins/resource/simpleauth/plugin.d.ts.map +1 -1
- package/build/plugins/resource/simpleauth/plugin.js +7 -9
- package/build/plugins/resource/simpleauth/plugin.js.map +1 -1
- package/build/plugins/resource/simpleauth/utils/common.d.ts.map +1 -1
- package/build/plugins/resource/simpleauth/utils/common.js +3 -1
- package/build/plugins/resource/simpleauth/utils/common.js.map +1 -1
- package/build/plugins/resource/sql/config.d.ts +0 -1
- package/build/plugins/resource/sql/config.d.ts.map +1 -1
- package/build/plugins/resource/sql/config.js +0 -1
- package/build/plugins/resource/sql/config.js.map +1 -1
- package/build/plugins/resource/sql/constants.d.ts +1 -0
- package/build/plugins/resource/sql/constants.d.ts.map +1 -1
- package/build/plugins/resource/sql/constants.js +1 -0
- package/build/plugins/resource/sql/constants.js.map +1 -1
- package/build/plugins/resource/sql/errors.d.ts +1 -0
- package/build/plugins/resource/sql/errors.d.ts.map +1 -1
- package/build/plugins/resource/sql/errors.js +1 -0
- package/build/plugins/resource/sql/errors.js.map +1 -1
- package/build/plugins/resource/sql/managementClient.d.ts +3 -1
- package/build/plugins/resource/sql/managementClient.d.ts.map +1 -1
- package/build/plugins/resource/sql/managementClient.js +11 -2
- package/build/plugins/resource/sql/managementClient.js.map +1 -1
- package/build/plugins/resource/sql/plugin.d.ts +3 -0
- package/build/plugins/resource/sql/plugin.d.ts.map +1 -1
- package/build/plugins/resource/sql/plugin.js +37 -27
- package/build/plugins/resource/sql/plugin.js.map +1 -1
- package/build/plugins/resource/sql/sqlClient.d.ts +1 -1
- package/build/plugins/resource/sql/sqlClient.d.ts.map +1 -1
- package/build/plugins/resource/sql/sqlClient.js +15 -24
- package/build/plugins/resource/sql/sqlClient.js.map +1 -1
- package/build/plugins/resource/sql/utils/checkInput.js +2 -2
- package/build/plugins/resource/sql/utils/checkInput.js.map +1 -1
- package/build/plugins/resource/sql/utils/message.d.ts +0 -1
- package/build/plugins/resource/sql/utils/message.d.ts.map +1 -1
- package/build/plugins/resource/sql/utils/message.js +0 -1
- package/build/plugins/resource/sql/utils/message.js.map +1 -1
- package/build/plugins/solution/fx-solution/arm.d.ts +18 -11
- package/build/plugins/solution/fx-solution/arm.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/arm.js +387 -120
- package/build/plugins/solution/fx-solution/arm.js.map +1 -1
- package/build/plugins/solution/fx-solution/commonQuestions.d.ts +13 -2
- package/build/plugins/solution/fx-solution/commonQuestions.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/commonQuestions.js +24 -26
- package/build/plugins/solution/fx-solution/commonQuestions.js.map +1 -1
- package/build/plugins/solution/fx-solution/debug/constants.d.ts +9 -0
- package/build/plugins/solution/fx-solution/debug/constants.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/debug/constants.js +16 -0
- package/build/plugins/solution/fx-solution/debug/constants.js.map +1 -0
- package/build/plugins/solution/fx-solution/debug/error.d.ts +7 -0
- package/build/plugins/solution/fx-solution/debug/error.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/debug/error.js +28 -0
- package/build/plugins/solution/fx-solution/debug/error.js.map +1 -0
- package/build/plugins/solution/fx-solution/debug/provisionLocal.d.ts +3 -0
- package/build/plugins/solution/fx-solution/debug/provisionLocal.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/debug/provisionLocal.js +107 -0
- package/build/plugins/solution/fx-solution/debug/provisionLocal.js.map +1 -0
- package/build/plugins/solution/fx-solution/debug/scaffolding.d.ts +3 -0
- package/build/plugins/solution/fx-solution/debug/scaffolding.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/debug/scaffolding.js +153 -0
- package/build/plugins/solution/fx-solution/debug/scaffolding.js.map +1 -0
- package/build/plugins/{resource/localdebug → solution/fx-solution/debug}/util/codespace.d.ts +0 -0
- package/build/plugins/solution/fx-solution/debug/util/codespace.d.ts.map +1 -0
- package/build/plugins/{resource/localdebug → solution/fx-solution/debug}/util/codespace.js +0 -0
- package/build/plugins/solution/fx-solution/debug/util/codespace.js.map +1 -0
- package/build/plugins/solution/fx-solution/debug/util/contextHelper.d.ts +10 -0
- package/build/plugins/solution/fx-solution/debug/util/contextHelper.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/debug/util/contextHelper.js +34 -0
- package/build/plugins/solution/fx-solution/debug/util/contextHelper.js.map +1 -0
- package/build/plugins/{resource/localdebug → solution/fx-solution/debug/util}/launch.d.ts +0 -0
- package/build/plugins/solution/fx-solution/debug/util/launch.d.ts.map +1 -0
- package/build/plugins/{resource/localdebug → solution/fx-solution/debug/util}/launch.js +1 -1
- package/build/plugins/solution/fx-solution/debug/util/launch.js.map +1 -0
- package/build/plugins/{resource/localdebug → solution/fx-solution/debug}/util/ngrok.d.ts +0 -0
- package/build/plugins/solution/fx-solution/debug/util/ngrok.d.ts.map +1 -0
- package/build/plugins/{resource/localdebug → solution/fx-solution/debug}/util/ngrok.js +2 -2
- package/build/plugins/solution/fx-solution/debug/util/ngrok.js.map +1 -0
- package/build/plugins/solution/fx-solution/debug/util/settings.d.ts +2 -0
- package/build/plugins/solution/fx-solution/debug/util/settings.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/debug/util/settings.js +22 -0
- package/build/plugins/solution/fx-solution/debug/util/settings.js.map +1 -0
- package/build/plugins/{resource/localdebug → solution/fx-solution/debug/util}/tasks.d.ts +0 -0
- package/build/plugins/solution/fx-solution/debug/util/tasks.d.ts.map +1 -0
- package/build/plugins/{resource/localdebug → solution/fx-solution/debug/util}/tasks.js +6 -6
- package/build/plugins/solution/fx-solution/debug/util/tasks.js.map +1 -0
- package/build/plugins/solution/fx-solution/debug/util/telemetry.d.ts +27 -0
- package/build/plugins/solution/fx-solution/debug/util/telemetry.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/debug/util/telemetry.js +81 -0
- package/build/plugins/solution/fx-solution/debug/util/telemetry.js.map +1 -0
- package/build/plugins/solution/fx-solution/index.d.ts +1 -0
- package/build/plugins/solution/fx-solution/index.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/index.js +1 -0
- package/build/plugins/solution/fx-solution/index.js.map +1 -1
- package/build/plugins/solution/fx-solution/question.d.ts +2 -2
- package/build/plugins/solution/fx-solution/question.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/question.js +2 -32
- package/build/plugins/solution/fx-solution/question.js.map +1 -1
- package/build/plugins/solution/fx-solution/solution.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/solution.js +9 -5
- package/build/plugins/solution/fx-solution/solution.js.map +1 -1
- package/build/plugins/solution/fx-solution/utils/depsChecker/bicepChecker.d.ts +2 -2
- package/build/plugins/solution/fx-solution/utils/depsChecker/bicepChecker.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/utils/depsChecker/bicepChecker.js +13 -14
- package/build/plugins/solution/fx-solution/utils/depsChecker/bicepChecker.js.map +1 -1
- package/build/plugins/solution/fx-solution/utils/progressHelper.d.ts +2 -2
- package/build/plugins/solution/fx-solution/utils/progressHelper.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/utils/progressHelper.js +4 -4
- package/build/plugins/solution/fx-solution/utils/progressHelper.js.map +1 -1
- package/build/plugins/solution/fx-solution/v2/constants.d.ts +2 -0
- package/build/plugins/solution/fx-solution/v2/constants.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/v2/constants.js +7 -0
- package/build/plugins/solution/fx-solution/v2/constants.js.map +1 -0
- package/build/plugins/solution/fx-solution/v2/createEnv.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/v2/createEnv.js +1 -1
- package/build/plugins/solution/fx-solution/v2/createEnv.js.map +1 -1
- package/build/plugins/solution/fx-solution/v2/executeUserTask.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/v2/executeUserTask.js +7 -4
- package/build/plugins/solution/fx-solution/v2/executeUserTask.js.map +1 -1
- package/build/plugins/solution/fx-solution/v2/getQuestions.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/v2/getQuestions.js +67 -25
- package/build/plugins/solution/fx-solution/v2/getQuestions.js.map +1 -1
- package/build/plugins/solution/fx-solution/v2/listAllCollaborators.js.map +1 -1
- package/build/plugins/solution/fx-solution/v2/provision.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/v2/provision.js +9 -1
- package/build/plugins/solution/fx-solution/v2/provision.js.map +1 -1
- package/build/plugins/solution/fx-solution/v2/provisionLocal.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/v2/provisionLocal.js +5 -0
- package/build/plugins/solution/fx-solution/v2/provisionLocal.js.map +1 -1
- package/build/plugins/solution/fx-solution/v2/scaffolding.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/v2/scaffolding.js +5 -0
- package/build/plugins/solution/fx-solution/v2/scaffolding.js.map +1 -1
- package/build/plugins/solution/fx-solution/v2/solution.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/v2/solution.js +2 -1
- package/build/plugins/solution/fx-solution/v2/solution.js.map +1 -1
- package/build/plugins/solution/fx-solution/v3/addModule.d.ts +6 -0
- package/build/plugins/solution/fx-solution/v3/addModule.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/v3/addModule.js +35 -0
- package/build/plugins/solution/fx-solution/v3/addModule.js.map +1 -0
- package/build/plugins/solution/fx-solution/v3/addResource.d.ts +37 -0
- package/build/plugins/solution/fx-solution/v3/addResource.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/v3/addResource.js +260 -0
- package/build/plugins/solution/fx-solution/v3/addResource.js.map +1 -0
- package/build/plugins/solution/fx-solution/v3/constants.d.ts +20 -0
- package/build/plugins/solution/fx-solution/v3/constants.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/v3/constants.js +25 -0
- package/build/plugins/solution/fx-solution/v3/constants.js.map +1 -0
- package/build/plugins/solution/fx-solution/v3/deploy.d.ts +6 -0
- package/build/plugins/solution/fx-solution/v3/deploy.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/v3/deploy.js +78 -0
- package/build/plugins/solution/fx-solution/v3/deploy.js.map +1 -0
- package/build/plugins/solution/fx-solution/v3/error.d.ts +11 -0
- package/build/plugins/solution/fx-solution/v3/error.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/v3/error.js +23 -0
- package/build/plugins/solution/fx-solution/v3/error.js.map +1 -0
- package/build/plugins/solution/fx-solution/v3/init.d.ts +4 -0
- package/build/plugins/solution/fx-solution/v3/init.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/v3/init.js +35 -0
- package/build/plugins/solution/fx-solution/v3/init.js.map +1 -0
- package/build/plugins/solution/fx-solution/v3/provision.d.ts +4 -0
- package/build/plugins/solution/fx-solution/v3/provision.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/v3/provision.js +124 -0
- package/build/plugins/solution/fx-solution/v3/provision.js.map +1 -0
- package/build/plugins/solution/fx-solution/v3/provisionLocal.d.ts +4 -0
- package/build/plugins/solution/fx-solution/v3/provisionLocal.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/v3/provisionLocal.js +13 -0
- package/build/plugins/solution/fx-solution/v3/provisionLocal.js.map +1 -0
- package/build/plugins/solution/fx-solution/v3/publish.d.ts +4 -0
- package/build/plugins/solution/fx-solution/v3/publish.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/v3/publish.js +15 -0
- package/build/plugins/solution/fx-solution/v3/publish.js.map +1 -0
- package/build/plugins/solution/fx-solution/v3/questions.d.ts +16 -0
- package/build/plugins/solution/fx-solution/v3/questions.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/v3/questions.js +86 -0
- package/build/plugins/solution/fx-solution/v3/questions.js.map +1 -0
- package/build/plugins/solution/fx-solution/v3/scaffold.d.ts +27 -0
- package/build/plugins/solution/fx-solution/v3/scaffold.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/v3/scaffold.js +241 -0
- package/build/plugins/solution/fx-solution/v3/scaffold.js.map +1 -0
- package/build/plugins/solution/fx-solution/v3/solution.d.ts +32 -0
- package/build/plugins/solution/fx-solution/v3/solution.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/v3/solution.js +45 -0
- package/build/plugins/solution/fx-solution/v3/solution.js.map +1 -0
- package/build/plugins/solution/fx-solution/v3/userTask.d.ts +4 -0
- package/build/plugins/solution/fx-solution/v3/userTask.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/v3/userTask.js +15 -0
- package/build/plugins/solution/fx-solution/v3/userTask.js.map +1 -0
- package/build/plugins/solution/fx-solution/v3/utils.d.ts +3 -0
- package/build/plugins/solution/fx-solution/v3/utils.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/v3/utils.js +16 -0
- package/build/plugins/solution/fx-solution/v3/utils.js.map +1 -0
- package/build/plugins/solution/index.d.ts +1 -0
- package/build/plugins/solution/index.d.ts.map +1 -1
- package/build/plugins/solution/index.js +1 -0
- package/build/plugins/solution/index.js.map +1 -1
- package/build/plugins/solution/spfx-solution/constants.d.ts +2 -0
- package/build/plugins/solution/spfx-solution/constants.d.ts.map +1 -0
- package/build/plugins/solution/spfx-solution/constants.js +7 -0
- package/build/plugins/solution/spfx-solution/constants.js.map +1 -0
- package/build/plugins/solution/spfx-solution/index.d.ts +2 -0
- package/build/plugins/solution/spfx-solution/index.d.ts.map +1 -0
- package/build/plugins/solution/spfx-solution/index.js +5 -0
- package/build/plugins/solution/spfx-solution/index.js.map +1 -0
- package/build/plugins/solution/spfx-solution/init.d.ts +3 -0
- package/build/plugins/solution/spfx-solution/init.d.ts.map +1 -0
- package/build/plugins/solution/spfx-solution/init.js +20 -0
- package/build/plugins/solution/spfx-solution/init.js.map +1 -0
- package/build/plugins/solution/spfx-solution/questions.d.ts +6 -0
- package/build/plugins/solution/spfx-solution/questions.d.ts.map +1 -0
- package/build/plugins/solution/spfx-solution/questions.js +36 -0
- package/build/plugins/solution/spfx-solution/questions.js.map +1 -0
- package/build/plugins/solution/spfx-solution/scaffolding.d.ts +17 -0
- package/build/plugins/solution/spfx-solution/scaffolding.d.ts.map +1 -0
- package/build/plugins/solution/spfx-solution/scaffolding.js +29 -0
- package/build/plugins/solution/spfx-solution/scaffolding.js.map +1 -0
- package/build/plugins/solution/spfx-solution/solution.d.ts +23 -0
- package/build/plugins/solution/spfx-solution/solution.d.ts.map +1 -0
- package/build/plugins/solution/spfx-solution/solution.js +29 -0
- package/build/plugins/solution/spfx-solution/solution.js.map +1 -0
- package/package.json +9 -4
- package/resource/strings.json +0 -1
- package/templates/plugins/resource/apim/bicep/apimConfiguration.bicep +16 -16
- package/templates/plugins/resource/apim/bicep/config.template.bicep +1 -1
- package/templates/plugins/resource/apim/bicep/provision.template.bicep +1 -1
- package/templates/plugins/resource/bot/bicep/botConfiguration.template.bicep +28 -29
- package/templates/plugins/resource/bot/bicep/config.template.bicep +1 -1
- package/templates/plugins/resource/bot/bicep/provision.template.bicep +2 -2
- package/templates/plugins/resource/frontend/bicep/provision.template.bicep +1 -1
- package/templates/plugins/resource/function/bicep/config.template.bicep +1 -1
- package/templates/plugins/resource/function/bicep/functionConfiguration.template.bicep +33 -31
- package/templates/plugins/resource/function/bicep/provision.template.bicep +2 -2
- package/templates/plugins/resource/identity/bicep/provision.template.bicep +1 -1
- package/templates/plugins/resource/keyvault/bicep/provision.template.bicep +3 -2
- package/templates/plugins/resource/simpleauth/bicep/config.template.bicep +1 -1
- package/templates/plugins/resource/simpleauth/bicep/provision.template.bicep +2 -2
- package/templates/plugins/resource/simpleauth/bicep/simpleAuthConfiguration.template.bicep +20 -24
- package/templates/plugins/resource/simpleauth/version.txt +2 -1
- package/templates/plugins/resource/sql/bicep/provision.template.bicep +1 -1
- package/build/plugins/resource/localdebug/launch.d.ts.map +0 -1
- package/build/plugins/resource/localdebug/launch.js.map +0 -1
- package/build/plugins/resource/localdebug/legacyPlugin.d.ts +0 -6
- package/build/plugins/resource/localdebug/legacyPlugin.d.ts.map +0 -1
- package/build/plugins/resource/localdebug/legacyPlugin.js +0 -208
- package/build/plugins/resource/localdebug/legacyPlugin.js.map +0 -1
- package/build/plugins/resource/localdebug/settings.d.ts +0 -2
- package/build/plugins/resource/localdebug/settings.d.ts.map +0 -1
- package/build/plugins/resource/localdebug/settings.js +0 -18
- package/build/plugins/resource/localdebug/settings.js.map +0 -1
- package/build/plugins/resource/localdebug/tasks.d.ts.map +0 -1
- package/build/plugins/resource/localdebug/tasks.js.map +0 -1
- package/build/plugins/resource/localdebug/util/codespace.d.ts.map +0 -1
- package/build/plugins/resource/localdebug/util/codespace.js.map +0 -1
- package/build/plugins/resource/localdebug/util/ngrok.d.ts.map +0 -1
- package/build/plugins/resource/localdebug/util/ngrok.js.map +0 -1
- package/templates/azure/config.bicep +0 -25
- package/templates/azure/main.bicep +0 -20
- package/templates/azure/provision/azureSql.bicep +0 -39
- package/templates/azure/provision/frontendHosting.bicep +0 -23
- package/templates/azure/provision/function.bicep +0 -79
- package/templates/azure/provision/simpleAuth.bicep +0 -44
- package/templates/azure/provision.bicep +0 -58
- package/templates/azure/teamsFx/bot.bicep +0 -34
- package/templates/azure/teamsFx/function.bicep +0 -71
- package/templates/azure/teamsFx/simpleAuth.bicep +0 -40
- package/templates/plugins/resource/aad/bicep/param.template.bicep +0 -6
- package/templates/plugins/resource/aad/bicep/variables.template.bicep +0 -13
|
@@ -2,26 +2,26 @@
|
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
3
|
// Licensed under the MIT license.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.formattedDeploymentError = exports.ArmTemplateRenderContext = exports.getParameterJson = exports.copyParameterJson = exports.deployArmTemplates = exports.doDeployArmTemplates = exports.pollDeploymentStatus = exports.getRequiredOperation = exports.generateArmTemplate = void 0;
|
|
5
|
+
exports.formattedDeploymentError = exports.ArmTemplateRenderContext = exports.getParameterJsonV3 = exports.getParameterJson = exports.copyParameterJson = exports.deployArmTemplatesV3 = exports.deployArmTemplates = exports.doDeployArmTemplatesV3 = exports.doDeployArmTemplates = exports.pollDeploymentStatus = exports.getRequiredOperation = exports.generateArmTemplateV3 = exports.generateArmTemplate = void 0;
|
|
6
6
|
const tslib_1 = require("tslib");
|
|
7
|
+
const arm_resources_1 = require("@azure/arm-resources");
|
|
7
8
|
const teamsfx_api_1 = require("@microsoft/teamsfx-api");
|
|
8
|
-
const ResourcePluginContainer_1 = require("./ResourcePluginContainer");
|
|
9
|
-
const util_1 = require("./utils/util");
|
|
10
|
-
const util_2 = require("util");
|
|
11
|
-
const common_1 = require("../../../common");
|
|
12
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
13
9
|
const fs = tslib_1.__importStar(require("fs-extra"));
|
|
14
|
-
const
|
|
10
|
+
const os_1 = tslib_1.__importDefault(require("os"));
|
|
11
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
12
|
+
const typedi_1 = require("typedi");
|
|
13
|
+
const util_1 = require("util");
|
|
14
|
+
const constants_1 = require("./constants");
|
|
15
|
+
const environment_1 = require("../../../core/environment");
|
|
16
|
+
const common_1 = require("../../../common");
|
|
17
|
+
const constants_2 = require("../../../common/constants");
|
|
18
|
+
const cpUtils_1 = require("../../../common/cpUtils");
|
|
15
19
|
const tools_1 = require("../../../common/tools");
|
|
16
|
-
const __1 = require("../../..");
|
|
17
|
-
const constants_2 = require("./constants");
|
|
18
|
-
const arm_resources_1 = require("@azure/arm-resources");
|
|
19
|
-
const progressHelper_1 = require("./utils/progressHelper");
|
|
20
20
|
const folder_1 = require("../../../folder");
|
|
21
|
+
const ResourcePluginContainer_1 = require("./ResourcePluginContainer");
|
|
21
22
|
const bicepChecker_1 = require("./utils/depsChecker/bicepChecker");
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const os_1 = tslib_1.__importDefault(require("os"));
|
|
23
|
+
const progressHelper_1 = require("./utils/progressHelper");
|
|
24
|
+
const util_2 = require("./utils/util");
|
|
25
25
|
const adaptor_1 = require("./v2/adaptor");
|
|
26
26
|
const bicepOrchestrationFileName = "main.bicep";
|
|
27
27
|
const bicepOrchestrationProvisionFileName = "provision.bicep";
|
|
@@ -38,28 +38,53 @@ const InvalidTemplateErrorCode = "InvalidTemplate";
|
|
|
38
38
|
async function generateArmTemplate(ctx, selectedPlugins = []) {
|
|
39
39
|
var _a, _b;
|
|
40
40
|
let result;
|
|
41
|
-
(_a = ctx.telemetryReporter) === null || _a === void 0 ? void 0 : _a.sendTelemetryEvent(
|
|
42
|
-
[
|
|
41
|
+
(_a = ctx.telemetryReporter) === null || _a === void 0 ? void 0 : _a.sendTelemetryEvent(constants_1.SolutionTelemetryEvent.GenerateArmTemplateStart, {
|
|
42
|
+
[constants_1.SolutionTelemetryProperty.Component]: constants_1.SolutionTelemetryComponentName,
|
|
43
43
|
});
|
|
44
44
|
try {
|
|
45
45
|
result = await doGenerateArmTemplate(ctx, selectedPlugins);
|
|
46
46
|
if (result.isOk()) {
|
|
47
|
-
(_b = ctx.telemetryReporter) === null || _b === void 0 ? void 0 : _b.sendTelemetryEvent(
|
|
48
|
-
[
|
|
49
|
-
[
|
|
47
|
+
(_b = ctx.telemetryReporter) === null || _b === void 0 ? void 0 : _b.sendTelemetryEvent(constants_1.SolutionTelemetryEvent.GenerateArmTemplate, {
|
|
48
|
+
[constants_1.SolutionTelemetryProperty.Component]: constants_1.SolutionTelemetryComponentName,
|
|
49
|
+
[constants_1.SolutionTelemetryProperty.Success]: constants_1.SolutionTelemetrySuccess.Yes,
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
else {
|
|
53
|
-
|
|
53
|
+
util_2.sendErrorTelemetryThenReturnError(constants_1.SolutionTelemetryEvent.GenerateArmTemplate, result.error, ctx.telemetryReporter);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
catch (error) {
|
|
57
|
-
result = teamsfx_api_1.err(teamsfx_api_1.returnSystemError(error,
|
|
58
|
-
|
|
57
|
+
result = teamsfx_api_1.err(teamsfx_api_1.returnSystemError(error, constants_1.SolutionSource, constants_1.SolutionError.FailedToGenerateArmTemplates));
|
|
58
|
+
util_2.sendErrorTelemetryThenReturnError(constants_1.SolutionTelemetryEvent.GenerateArmTemplate, result.error, ctx.telemetryReporter);
|
|
59
59
|
}
|
|
60
60
|
return result;
|
|
61
61
|
}
|
|
62
62
|
exports.generateArmTemplate = generateArmTemplate;
|
|
63
|
+
async function generateArmTemplateV3(ctx, inputs, activatedPlugins, addedPlugins) {
|
|
64
|
+
var _a, _b;
|
|
65
|
+
let result;
|
|
66
|
+
(_a = ctx.telemetryReporter) === null || _a === void 0 ? void 0 : _a.sendTelemetryEvent(constants_1.SolutionTelemetryEvent.GenerateArmTemplateStart, {
|
|
67
|
+
[constants_1.SolutionTelemetryProperty.Component]: constants_1.SolutionTelemetryComponentName,
|
|
68
|
+
});
|
|
69
|
+
try {
|
|
70
|
+
result = await doGenerateArmTemplateV3(ctx, inputs, activatedPlugins, addedPlugins);
|
|
71
|
+
if (result.isOk()) {
|
|
72
|
+
(_b = ctx.telemetryReporter) === null || _b === void 0 ? void 0 : _b.sendTelemetryEvent(constants_1.SolutionTelemetryEvent.GenerateArmTemplate, {
|
|
73
|
+
[constants_1.SolutionTelemetryProperty.Component]: constants_1.SolutionTelemetryComponentName,
|
|
74
|
+
[constants_1.SolutionTelemetryProperty.Success]: constants_1.SolutionTelemetrySuccess.Yes,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
util_2.sendErrorTelemetryThenReturnError(constants_1.SolutionTelemetryEvent.GenerateArmTemplate, result.error, ctx.telemetryReporter);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
result = teamsfx_api_1.err(teamsfx_api_1.returnSystemError(error, constants_1.SolutionSource, constants_1.SolutionError.FailedToGenerateArmTemplates));
|
|
83
|
+
util_2.sendErrorTelemetryThenReturnError(constants_1.SolutionTelemetryEvent.GenerateArmTemplate, result.error, ctx.telemetryReporter);
|
|
84
|
+
}
|
|
85
|
+
return result;
|
|
86
|
+
}
|
|
87
|
+
exports.generateArmTemplateV3 = generateArmTemplateV3;
|
|
63
88
|
function getRequiredOperation(operation, deployCtx) {
|
|
64
89
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
65
90
|
if (((_b = (_a = operation.properties) === null || _a === void 0 ? void 0 : _a.targetResource) === null || _b === void 0 ? void 0 : _b.resourceName) &&
|
|
@@ -92,7 +117,7 @@ async function pollDeploymentStatus(deployCtx) {
|
|
|
92
117
|
let tryCount = 0;
|
|
93
118
|
let previousStatus = {};
|
|
94
119
|
let polledOperations = [];
|
|
95
|
-
(_a = deployCtx.
|
|
120
|
+
(_a = deployCtx.logProvider) === null || _a === void 0 ? void 0 : _a.info(util_1.format(common_1.getStrings().solution.DeployArmTemplates.PollDeploymentStatusNotice, constants_2.PluginDisplayName.Solution));
|
|
96
121
|
while (!deployCtx.finished) {
|
|
97
122
|
await tools_1.waitSeconds(10);
|
|
98
123
|
try {
|
|
@@ -110,7 +135,7 @@ async function pollDeploymentStatus(deployCtx) {
|
|
|
110
135
|
polledOperations.push(operation.resourceName);
|
|
111
136
|
let client = deployCtx.client;
|
|
112
137
|
if (operation.subscriptionId !== deployCtx.client.subscriptionId) {
|
|
113
|
-
const azureToken = await ((_a = deployCtx.
|
|
138
|
+
const azureToken = await ((_a = deployCtx.azureAccountProvider) === null || _a === void 0 ? void 0 : _a.getAccountCredentialAsync());
|
|
114
139
|
client = new arm_resources_1.ResourceManagementClient(azureToken, operation.subscriptionId);
|
|
115
140
|
}
|
|
116
141
|
const subOperations = await client.deploymentOperations.list(operation.resourceGroupName, operation.resourceName);
|
|
@@ -125,7 +150,7 @@ async function pollDeploymentStatus(deployCtx) {
|
|
|
125
150
|
}));
|
|
126
151
|
for (const key in currentStatus) {
|
|
127
152
|
if (currentStatus[key] !== previousStatus[key]) {
|
|
128
|
-
(_b = deployCtx.
|
|
153
|
+
(_b = deployCtx.logProvider) === null || _b === void 0 ? void 0 : _b.info(`[${constants_2.PluginDisplayName.Solution}] ${key} -> ${currentStatus[key]}`);
|
|
129
154
|
}
|
|
130
155
|
}
|
|
131
156
|
previousStatus = currentStatus;
|
|
@@ -136,30 +161,31 @@ async function pollDeploymentStatus(deployCtx) {
|
|
|
136
161
|
if (tryCount > failedCount) {
|
|
137
162
|
throw error;
|
|
138
163
|
}
|
|
139
|
-
(_c = deployCtx.
|
|
164
|
+
(_c = deployCtx.logProvider) === null || _c === void 0 ? void 0 : _c.warning(`[${constants_2.PluginDisplayName.Solution}] ${deployCtx.deploymentName} -> waiting to get deplomyment status [${tryCount}]`);
|
|
140
165
|
}
|
|
141
166
|
}
|
|
142
167
|
}
|
|
143
168
|
exports.pollDeploymentStatus = pollDeploymentStatus;
|
|
144
169
|
async function doDeployArmTemplates(ctx) {
|
|
145
|
-
var _a, _b, _c;
|
|
146
|
-
const progressHandler = await progressHelper_1.ProgressHelper.startDeployArmTemplatesProgressHandler(
|
|
170
|
+
var _a, _b, _c, _d;
|
|
171
|
+
const progressHandler = await progressHelper_1.ProgressHelper.startDeployArmTemplatesProgressHandler(ctx.ui);
|
|
147
172
|
await (progressHandler === null || progressHandler === void 0 ? void 0 : progressHandler.next(progressHelper_1.DeployArmTemplatesSteps.ExecuteDeployment));
|
|
148
173
|
// update parameters
|
|
149
174
|
const parameterJson = await getParameterJson(ctx);
|
|
150
|
-
const resourceGroupName = (_a = ctx.envInfo.state.get(
|
|
175
|
+
const resourceGroupName = (_a = ctx.envInfo.state.get(constants_1.GLOBAL_CONFIG)) === null || _a === void 0 ? void 0 : _a.getString(constants_1.RESOURCE_GROUP_NAME);
|
|
151
176
|
if (!resourceGroupName) {
|
|
152
|
-
return teamsfx_api_1.err(teamsfx_api_1.returnSystemError(new Error("Failed to get resource group from project solution settings."),
|
|
177
|
+
return teamsfx_api_1.err(teamsfx_api_1.returnSystemError(new Error("Failed to get resource group from project solution settings."), constants_1.SolutionSource, "NoResourceGroupFound"));
|
|
153
178
|
}
|
|
154
|
-
const bicepCommand = await bicepChecker_1.ensureBicep(ctx);
|
|
179
|
+
const bicepCommand = await bicepChecker_1.ensureBicep(ctx, ctx.answers);
|
|
155
180
|
// Compile bicep file to json
|
|
156
181
|
const templateDir = path_1.default.join(ctx.root, templatesFolder);
|
|
157
182
|
const bicepOrchestrationFilePath = path_1.default.join(templateDir, bicepOrchestrationFileName);
|
|
158
183
|
const armTemplateJson = await compileBicepToJson(bicepCommand, bicepOrchestrationFilePath, ctx.logProvider);
|
|
159
|
-
(_b = ctx.logProvider) === null || _b === void 0 ? void 0 : _b.info(
|
|
184
|
+
(_b = ctx.logProvider) === null || _b === void 0 ? void 0 : _b.info(util_1.format(common_1.getStrings().solution.DeployArmTemplates.CompileBicepSuccessNotice, constants_2.PluginDisplayName.Solution));
|
|
160
185
|
// deploy arm templates to azure
|
|
161
|
-
const
|
|
162
|
-
const
|
|
186
|
+
const subscriptionId = (_c = ctx.envInfo.state.get(constants_1.GLOBAL_CONFIG)) === null || _c === void 0 ? void 0 : _c.get(constants_1.SUBSCRIPTION_ID);
|
|
187
|
+
const client = await getResourceManagementClientForArmDeployment(ctx.azureAccountProvider, subscriptionId);
|
|
188
|
+
const deploymentName = `${constants_2.PluginDisplayName.Solution}_deployment`.replace(" ", "_").toLowerCase();
|
|
163
189
|
const deploymentParameters = {
|
|
164
190
|
properties: {
|
|
165
191
|
parameters: parameterJson.parameters,
|
|
@@ -168,7 +194,8 @@ async function doDeployArmTemplates(ctx) {
|
|
|
168
194
|
},
|
|
169
195
|
};
|
|
170
196
|
const deployCtx = {
|
|
171
|
-
|
|
197
|
+
azureAccountProvider: ctx.azureAccountProvider,
|
|
198
|
+
logProvider: ctx.logProvider,
|
|
172
199
|
finished: false,
|
|
173
200
|
deploymentStartTime: Date.now(),
|
|
174
201
|
client: client,
|
|
@@ -180,8 +207,8 @@ async function doDeployArmTemplates(ctx) {
|
|
|
180
207
|
.createOrUpdate(resourceGroupName, deploymentName, deploymentParameters)
|
|
181
208
|
.then((result) => {
|
|
182
209
|
var _a, _b;
|
|
183
|
-
(_a = ctx.logProvider) === null || _a === void 0 ? void 0 : _a.info(
|
|
184
|
-
syncArmOutput(ctx, (_b = result.properties) === null || _b === void 0 ? void 0 : _b.outputs);
|
|
210
|
+
(_a = ctx.logProvider) === null || _a === void 0 ? void 0 : _a.info(util_1.format(common_1.getStrings().solution.DeployArmTemplates.SuccessNotice, constants_2.PluginDisplayName.Solution, resourceGroupName, deploymentName));
|
|
211
|
+
syncArmOutput(ctx.envInfo, (_b = result.properties) === null || _b === void 0 ? void 0 : _b.outputs);
|
|
185
212
|
return result;
|
|
186
213
|
})
|
|
187
214
|
.finally(() => {
|
|
@@ -194,7 +221,7 @@ async function doDeployArmTemplates(ctx) {
|
|
|
194
221
|
catch (error) {
|
|
195
222
|
// return the error if the template is invalid
|
|
196
223
|
if (error.code === InvalidTemplateErrorCode) {
|
|
197
|
-
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(error,
|
|
224
|
+
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(error, constants_1.SolutionSource, constants_1.SolutionError.FailedToValidateArmTemplates));
|
|
198
225
|
}
|
|
199
226
|
// try to get deployment error
|
|
200
227
|
const result = await wrapGetDeploymentError(deployCtx, resourceGroupName, deploymentName);
|
|
@@ -202,13 +229,13 @@ async function doDeployArmTemplates(ctx) {
|
|
|
202
229
|
const deploymentError = result.value;
|
|
203
230
|
// return thrown error if deploymentError is empty
|
|
204
231
|
if (!deploymentError) {
|
|
205
|
-
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(error,
|
|
232
|
+
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(error, constants_1.SolutionSource, constants_1.SolutionError.FailedToDeployArmTemplatesToAzure));
|
|
206
233
|
}
|
|
207
234
|
const deploymentErrorObj = formattedDeploymentError(deploymentError);
|
|
208
235
|
const deploymentErrorMessage = JSON.stringify(deploymentErrorObj, undefined, 2);
|
|
209
|
-
const errorMessage =
|
|
210
|
-
(
|
|
211
|
-
`\nError message: ${error.message}\nDetailed message: \n${deploymentErrorMessage}\nGet toolkit help from ${
|
|
236
|
+
const errorMessage = util_1.format(common_1.getStrings().solution.DeployArmTemplates.FailNotice, constants_2.PluginDisplayName.Solution, resourceGroupName, deploymentName);
|
|
237
|
+
(_d = ctx.logProvider) === null || _d === void 0 ? void 0 : _d.error(errorMessage +
|
|
238
|
+
`\nError message: ${error.message}\nDetailed message: \n${deploymentErrorMessage}\nGet toolkit help from ${constants_2.HelpLinks.ArmHelpLink}.`);
|
|
212
239
|
let failedDeployments = [];
|
|
213
240
|
if (deploymentError.subErrors) {
|
|
214
241
|
failedDeployments = Object.keys(deploymentError.subErrors);
|
|
@@ -226,7 +253,94 @@ async function doDeployArmTemplates(ctx) {
|
|
|
226
253
|
}
|
|
227
254
|
}
|
|
228
255
|
exports.doDeployArmTemplates = doDeployArmTemplates;
|
|
229
|
-
function
|
|
256
|
+
async function doDeployArmTemplatesV3(ctx, inputs, envInfo, azureAccountProvider) {
|
|
257
|
+
var _a, _b;
|
|
258
|
+
const progressHandler = await progressHelper_1.ProgressHelper.startDeployArmTemplatesProgressHandler(ctx.userInteraction);
|
|
259
|
+
await (progressHandler === null || progressHandler === void 0 ? void 0 : progressHandler.next(progressHelper_1.DeployArmTemplatesSteps.ExecuteDeployment));
|
|
260
|
+
// update parameters
|
|
261
|
+
const parameterJson = await getParameterJsonV3(ctx, inputs.projectPath, envInfo);
|
|
262
|
+
const envState = envInfo.state;
|
|
263
|
+
const resourceGroupName = envState.solution.resourceGroupName;
|
|
264
|
+
if (!resourceGroupName) {
|
|
265
|
+
return teamsfx_api_1.err(teamsfx_api_1.returnSystemError(new Error("Failed to get resource group from project solution settings."), constants_1.SolutionSource, "NoResourceGroupFound"));
|
|
266
|
+
}
|
|
267
|
+
const bicepCommand = await bicepChecker_1.ensureBicep(ctx, inputs);
|
|
268
|
+
// Compile bicep file to json
|
|
269
|
+
const templateDir = path_1.default.join(inputs.projectPath, templatesFolder);
|
|
270
|
+
const bicepOrchestrationFilePath = path_1.default.join(templateDir, bicepOrchestrationFileName);
|
|
271
|
+
const armTemplateJson = await compileBicepToJson(bicepCommand, bicepOrchestrationFilePath, ctx.logProvider);
|
|
272
|
+
(_a = ctx.logProvider) === null || _a === void 0 ? void 0 : _a.info(util_1.format(common_1.getStrings().solution.DeployArmTemplates.CompileBicepSuccessNotice, constants_2.PluginDisplayName.Solution));
|
|
273
|
+
// deploy arm templates to azure
|
|
274
|
+
const client = await getResourceManagementClientForArmDeployment(azureAccountProvider, envState.solution.subscriptionId);
|
|
275
|
+
const deploymentName = `${constants_2.PluginDisplayName.Solution}_deployment`.replace(" ", "_").toLowerCase();
|
|
276
|
+
const deploymentParameters = {
|
|
277
|
+
properties: {
|
|
278
|
+
parameters: parameterJson.parameters,
|
|
279
|
+
template: armTemplateJson,
|
|
280
|
+
mode: "Incremental",
|
|
281
|
+
},
|
|
282
|
+
};
|
|
283
|
+
const deployCtx = {
|
|
284
|
+
azureAccountProvider: azureAccountProvider,
|
|
285
|
+
logProvider: ctx.logProvider,
|
|
286
|
+
finished: false,
|
|
287
|
+
deploymentStartTime: Date.now(),
|
|
288
|
+
client: client,
|
|
289
|
+
resourceGroupName: resourceGroupName,
|
|
290
|
+
deploymentName: deploymentName,
|
|
291
|
+
};
|
|
292
|
+
try {
|
|
293
|
+
const result = client.deployments
|
|
294
|
+
.createOrUpdate(resourceGroupName, deploymentName, deploymentParameters)
|
|
295
|
+
.then((result) => {
|
|
296
|
+
var _a, _b;
|
|
297
|
+
(_a = ctx.logProvider) === null || _a === void 0 ? void 0 : _a.info(util_1.format(common_1.getStrings().solution.DeployArmTemplates.SuccessNotice, constants_2.PluginDisplayName.Solution, resourceGroupName, deploymentName));
|
|
298
|
+
syncArmOutput(envInfo, (_b = result.properties) === null || _b === void 0 ? void 0 : _b.outputs);
|
|
299
|
+
return result;
|
|
300
|
+
})
|
|
301
|
+
.finally(() => {
|
|
302
|
+
deployCtx.finished = true;
|
|
303
|
+
});
|
|
304
|
+
await pollDeploymentStatus(deployCtx);
|
|
305
|
+
await result;
|
|
306
|
+
return teamsfx_api_1.ok(undefined);
|
|
307
|
+
}
|
|
308
|
+
catch (error) {
|
|
309
|
+
// return the error if the template is invalid
|
|
310
|
+
if (error.code === InvalidTemplateErrorCode) {
|
|
311
|
+
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(error, constants_1.SolutionSource, constants_1.SolutionError.FailedToValidateArmTemplates));
|
|
312
|
+
}
|
|
313
|
+
// try to get deployment error
|
|
314
|
+
const result = await wrapGetDeploymentError(deployCtx, resourceGroupName, deploymentName);
|
|
315
|
+
if (result.isOk()) {
|
|
316
|
+
const deploymentError = result.value;
|
|
317
|
+
// return thrown error if deploymentError is empty
|
|
318
|
+
if (!deploymentError) {
|
|
319
|
+
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(error, constants_1.SolutionSource, constants_1.SolutionError.FailedToDeployArmTemplatesToAzure));
|
|
320
|
+
}
|
|
321
|
+
const deploymentErrorObj = formattedDeploymentError(deploymentError);
|
|
322
|
+
const deploymentErrorMessage = JSON.stringify(deploymentErrorObj, undefined, 2);
|
|
323
|
+
const errorMessage = util_1.format(common_1.getStrings().solution.DeployArmTemplates.FailNotice, constants_2.PluginDisplayName.Solution, resourceGroupName, deploymentName);
|
|
324
|
+
(_b = ctx.logProvider) === null || _b === void 0 ? void 0 : _b.error(errorMessage +
|
|
325
|
+
`\nError message: ${error.message}\nDetailed message: \n${deploymentErrorMessage}\nGet toolkit help from ${constants_2.HelpLinks.ArmHelpLink}.`);
|
|
326
|
+
let failedDeployments = [];
|
|
327
|
+
if (deploymentError.subErrors) {
|
|
328
|
+
failedDeployments = Object.keys(deploymentError.subErrors);
|
|
329
|
+
}
|
|
330
|
+
else {
|
|
331
|
+
failedDeployments.push(deploymentName);
|
|
332
|
+
}
|
|
333
|
+
const returnError = formattedDeploymentName(failedDeployments);
|
|
334
|
+
returnError.innerError = JSON.stringify(deploymentErrorObj);
|
|
335
|
+
return teamsfx_api_1.err(returnError);
|
|
336
|
+
}
|
|
337
|
+
else {
|
|
338
|
+
return result;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
exports.doDeployArmTemplatesV3 = doDeployArmTemplatesV3;
|
|
343
|
+
function syncArmOutput(envInfo, armOutput) {
|
|
230
344
|
var _a;
|
|
231
345
|
if (armOutput instanceof Object) {
|
|
232
346
|
const armOutputKeys = Object.keys(armOutput);
|
|
@@ -237,13 +351,19 @@ function syncArmOutput(ctx, armOutput) {
|
|
|
237
351
|
for (const moduleOutputKey of moduleOutputKeys) {
|
|
238
352
|
const pluginOutput = moduleOutput[moduleOutputKey].value;
|
|
239
353
|
if (pluginOutput instanceof Object) {
|
|
240
|
-
const pluginId = pluginOutput[
|
|
354
|
+
const pluginId = pluginOutput[constants_1.TEAMS_FX_RESOURCE_ID_KEY];
|
|
241
355
|
if (pluginId) {
|
|
242
356
|
const pluginOutputKeys = Object.keys(pluginOutput);
|
|
243
357
|
for (const pluginOutputKey of pluginOutputKeys) {
|
|
244
|
-
if (pluginOutputKey !=
|
|
245
|
-
(
|
|
246
|
-
|
|
358
|
+
if (pluginOutputKey != constants_1.TEAMS_FX_RESOURCE_ID_KEY) {
|
|
359
|
+
if (envInfo.state instanceof Map) {
|
|
360
|
+
(_a = envInfo.state
|
|
361
|
+
.get(pluginId)) === null || _a === void 0 ? void 0 : _a.set(pluginOutputKey, pluginOutput[pluginOutputKey]);
|
|
362
|
+
}
|
|
363
|
+
else {
|
|
364
|
+
envInfo.state[pluginId][pluginOutputKey] =
|
|
365
|
+
pluginOutput[pluginOutputKey];
|
|
366
|
+
}
|
|
247
367
|
}
|
|
248
368
|
}
|
|
249
369
|
}
|
|
@@ -255,53 +375,83 @@ function syncArmOutput(ctx, armOutput) {
|
|
|
255
375
|
}
|
|
256
376
|
async function deployArmTemplates(ctx) {
|
|
257
377
|
var _a, _b, _c;
|
|
258
|
-
(_a = ctx.logProvider) === null || _a === void 0 ? void 0 : _a.info(
|
|
378
|
+
(_a = ctx.logProvider) === null || _a === void 0 ? void 0 : _a.info(util_1.format(common_1.getStrings().solution.DeployArmTemplates.StartNotice, constants_2.PluginDisplayName.Solution));
|
|
259
379
|
let result;
|
|
260
|
-
(_b = ctx.telemetryReporter) === null || _b === void 0 ? void 0 : _b.sendTelemetryEvent(
|
|
261
|
-
[
|
|
380
|
+
(_b = ctx.telemetryReporter) === null || _b === void 0 ? void 0 : _b.sendTelemetryEvent(constants_1.SolutionTelemetryEvent.ArmDeploymentStart, {
|
|
381
|
+
[constants_1.SolutionTelemetryProperty.Component]: constants_1.SolutionTelemetryComponentName,
|
|
262
382
|
});
|
|
263
383
|
try {
|
|
264
384
|
result = await doDeployArmTemplates(ctx);
|
|
265
385
|
if (result.isOk()) {
|
|
266
|
-
(_c = ctx.telemetryReporter) === null || _c === void 0 ? void 0 : _c.sendTelemetryEvent(
|
|
267
|
-
[
|
|
268
|
-
[
|
|
386
|
+
(_c = ctx.telemetryReporter) === null || _c === void 0 ? void 0 : _c.sendTelemetryEvent(constants_1.SolutionTelemetryEvent.ArmDeployment, {
|
|
387
|
+
[constants_1.SolutionTelemetryProperty.Component]: constants_1.SolutionTelemetryComponentName,
|
|
388
|
+
[constants_1.SolutionTelemetryProperty.Success]: constants_1.SolutionTelemetrySuccess.Yes,
|
|
269
389
|
});
|
|
270
390
|
}
|
|
271
391
|
else {
|
|
272
392
|
const errorProperties = {};
|
|
273
393
|
if (result.error.innerError) {
|
|
274
|
-
errorProperties[
|
|
394
|
+
errorProperties[constants_1.SolutionTelemetryProperty.ArmDeploymentError] = result.error.innerError;
|
|
275
395
|
}
|
|
276
|
-
|
|
396
|
+
util_2.sendErrorTelemetryThenReturnError(constants_1.SolutionTelemetryEvent.ArmDeployment, result.error, ctx.telemetryReporter, errorProperties);
|
|
277
397
|
}
|
|
278
398
|
}
|
|
279
399
|
catch (error) {
|
|
280
|
-
result = teamsfx_api_1.err(teamsfx_api_1.returnUserError(error,
|
|
281
|
-
|
|
400
|
+
result = teamsfx_api_1.err(teamsfx_api_1.returnUserError(error, constants_1.SolutionSource, constants_1.SolutionError.FailedToDeployArmTemplatesToAzure));
|
|
401
|
+
util_2.sendErrorTelemetryThenReturnError(constants_1.SolutionTelemetryEvent.ArmDeployment, result.error, ctx.telemetryReporter);
|
|
282
402
|
}
|
|
283
403
|
await progressHelper_1.ProgressHelper.endDeployArmTemplatesProgress(result.isOk());
|
|
284
404
|
return result;
|
|
285
405
|
}
|
|
286
406
|
exports.deployArmTemplates = deployArmTemplates;
|
|
287
|
-
async function
|
|
407
|
+
async function deployArmTemplatesV3(ctx, inputs, envInfo, azureAccountProvider) {
|
|
408
|
+
var _a, _b, _c;
|
|
409
|
+
(_a = ctx.logProvider) === null || _a === void 0 ? void 0 : _a.info(util_1.format(common_1.getStrings().solution.DeployArmTemplates.StartNotice, constants_2.PluginDisplayName.Solution));
|
|
410
|
+
let result;
|
|
411
|
+
(_b = ctx.telemetryReporter) === null || _b === void 0 ? void 0 : _b.sendTelemetryEvent(constants_1.SolutionTelemetryEvent.ArmDeploymentStart, {
|
|
412
|
+
[constants_1.SolutionTelemetryProperty.Component]: constants_1.SolutionTelemetryComponentName,
|
|
413
|
+
});
|
|
414
|
+
try {
|
|
415
|
+
result = await doDeployArmTemplatesV3(ctx, inputs, envInfo, azureAccountProvider);
|
|
416
|
+
if (result.isOk()) {
|
|
417
|
+
(_c = ctx.telemetryReporter) === null || _c === void 0 ? void 0 : _c.sendTelemetryEvent(constants_1.SolutionTelemetryEvent.ArmDeployment, {
|
|
418
|
+
[constants_1.SolutionTelemetryProperty.Component]: constants_1.SolutionTelemetryComponentName,
|
|
419
|
+
[constants_1.SolutionTelemetryProperty.Success]: constants_1.SolutionTelemetrySuccess.Yes,
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
else {
|
|
423
|
+
const errorProperties = {};
|
|
424
|
+
if (result.error.innerError) {
|
|
425
|
+
errorProperties[constants_1.SolutionTelemetryProperty.ArmDeploymentError] = result.error.innerError;
|
|
426
|
+
}
|
|
427
|
+
util_2.sendErrorTelemetryThenReturnError(constants_1.SolutionTelemetryEvent.ArmDeployment, result.error, ctx.telemetryReporter, errorProperties);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
catch (error) {
|
|
431
|
+
result = teamsfx_api_1.err(teamsfx_api_1.returnUserError(error, constants_1.SolutionSource, constants_1.SolutionError.FailedToDeployArmTemplatesToAzure));
|
|
432
|
+
util_2.sendErrorTelemetryThenReturnError(constants_1.SolutionTelemetryEvent.ArmDeployment, result.error, ctx.telemetryReporter);
|
|
433
|
+
}
|
|
434
|
+
await progressHelper_1.ProgressHelper.endDeployArmTemplatesProgress(result.isOk());
|
|
435
|
+
return result;
|
|
436
|
+
}
|
|
437
|
+
exports.deployArmTemplatesV3 = deployArmTemplatesV3;
|
|
438
|
+
async function copyParameterJson(projectPath, appName, targetEnvName, sourceEnvName) {
|
|
288
439
|
var _a, _b, _c;
|
|
289
440
|
if (!targetEnvName || !sourceEnvName) {
|
|
290
441
|
return;
|
|
291
442
|
}
|
|
292
|
-
const parameterFolderPath = path_1.default.join(
|
|
443
|
+
const parameterFolderPath = path_1.default.join(projectPath, configsFolder);
|
|
293
444
|
const targetParameterFileName = parameterFileNameTemplate.replace(teamsfx_api_1.EnvNamePlaceholder, targetEnvName);
|
|
294
445
|
const sourceParameterFileName = parameterFileNameTemplate.replace(teamsfx_api_1.EnvNamePlaceholder, sourceEnvName);
|
|
295
446
|
const targetParameterFilePath = path_1.default.join(parameterFolderPath, targetParameterFileName);
|
|
296
447
|
const sourceParameterFilePath = path_1.default.join(parameterFolderPath, sourceParameterFileName);
|
|
297
448
|
const targetParameterContent = await fs.readJson(sourceParameterFilePath);
|
|
298
449
|
if ((_c = (_b = (_a = targetParameterContent[parameterName]) === null || _a === void 0 ? void 0 : _a.provisionParameters) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.resourceBaseName) {
|
|
299
|
-
const appName = ctx.projectSettings.appName;
|
|
300
450
|
targetParameterContent[parameterName].provisionParameters.value.resourceBaseName =
|
|
301
451
|
generateResourceBaseName(appName, targetEnvName);
|
|
302
452
|
}
|
|
303
453
|
await fs.ensureDir(parameterFolderPath);
|
|
304
|
-
await fs.writeFile(targetParameterFilePath, JSON.stringify(targetParameterContent, undefined, 4));
|
|
454
|
+
await fs.writeFile(targetParameterFilePath, JSON.stringify(targetParameterContent, undefined, 4).replace(/\r?\n/g, os_1.default.EOL));
|
|
305
455
|
}
|
|
306
456
|
exports.copyParameterJson = copyParameterJson;
|
|
307
457
|
async function getParameterJson(ctx) {
|
|
@@ -316,14 +466,34 @@ async function getParameterJson(ctx) {
|
|
|
316
466
|
await fs.stat(parameterFilePath);
|
|
317
467
|
}
|
|
318
468
|
catch (err) {
|
|
319
|
-
(_b = ctx.logProvider) === null || _b === void 0 ? void 0 : _b.error(`[${
|
|
320
|
-
const returnError = new Error(`[${
|
|
321
|
-
throw teamsfx_api_1.returnUserError(returnError,
|
|
469
|
+
(_b = ctx.logProvider) === null || _b === void 0 ? void 0 : _b.error(`[${constants_2.PluginDisplayName.Solution}] ${parameterFilePath} does not exist.`);
|
|
470
|
+
const returnError = new Error(`[${constants_2.PluginDisplayName.Solution}] ${parameterFilePath} does not exist.`);
|
|
471
|
+
throw teamsfx_api_1.returnUserError(returnError, constants_1.SolutionSource, "ParameterFileNotExist");
|
|
322
472
|
}
|
|
323
473
|
const parameterJson = await getExpandedParameter(ctx, parameterFilePath); // only expand secrets in memory
|
|
324
474
|
return parameterJson;
|
|
325
475
|
}
|
|
326
476
|
exports.getParameterJson = getParameterJson;
|
|
477
|
+
async function getParameterJsonV3(ctx, projectPath, envInfo) {
|
|
478
|
+
var _a;
|
|
479
|
+
if (!(envInfo === null || envInfo === void 0 ? void 0 : envInfo.envName)) {
|
|
480
|
+
throw new Error("Failed to get target environment name from solution context.");
|
|
481
|
+
}
|
|
482
|
+
const parameterFileName = parameterFileNameTemplate.replace(teamsfx_api_1.EnvNamePlaceholder, envInfo.envName);
|
|
483
|
+
const parameterFolderPath = path_1.default.join(projectPath, configsFolder);
|
|
484
|
+
const parameterFilePath = path_1.default.join(parameterFolderPath, parameterFileName);
|
|
485
|
+
try {
|
|
486
|
+
await fs.stat(parameterFilePath);
|
|
487
|
+
}
|
|
488
|
+
catch (err) {
|
|
489
|
+
(_a = ctx.logProvider) === null || _a === void 0 ? void 0 : _a.error(`[${constants_2.PluginDisplayName.Solution}] ${parameterFilePath} does not exist.`);
|
|
490
|
+
const returnError = new Error(`[${constants_2.PluginDisplayName.Solution}] ${parameterFilePath} does not exist.`);
|
|
491
|
+
throw teamsfx_api_1.returnUserError(returnError, constants_1.SolutionSource, "ParameterFileNotExist");
|
|
492
|
+
}
|
|
493
|
+
const parameterJson = await getExpandedParameterV3(ctx, envInfo, parameterFilePath); // only expand secrets in memory
|
|
494
|
+
return parameterJson;
|
|
495
|
+
}
|
|
496
|
+
exports.getParameterJsonV3 = getParameterJsonV3;
|
|
327
497
|
function generateArmFromResult(result, bicepOrchestrationTemplate, pluginWithArm, moduleProvisionFiles, moduleConfigFiles) {
|
|
328
498
|
var _a, _b;
|
|
329
499
|
bicepOrchestrationTemplate.applyTemplate(pluginWithArm.name, result);
|
|
@@ -346,16 +516,14 @@ async function doGenerateArmTemplate(ctx, selectedPlugins) {
|
|
|
346
516
|
var _a, _b, _c;
|
|
347
517
|
const azureSolutionSettings = (_a = ctx.projectSettings) === null || _a === void 0 ? void 0 : _a.solutionSettings;
|
|
348
518
|
const baseName = generateResourceBaseName(ctx.projectSettings.appName, ctx.envInfo.envName);
|
|
349
|
-
const plugins =
|
|
350
|
-
? ResourcePluginContainer_1.getActivatedV2ResourcePlugins(azureSolutionSettings).map((p) => new adaptor_1.NamedArmResourcePluginAdaptor(p))
|
|
351
|
-
: ResourcePluginContainer_1.getActivatedResourcePlugins(azureSolutionSettings); // This function ensures return result won't be empty
|
|
519
|
+
const plugins = ResourcePluginContainer_1.getActivatedV2ResourcePlugins(azureSolutionSettings).map((p) => new adaptor_1.NamedArmResourcePluginAdaptor(p)); // This function ensures return result won't be empty
|
|
352
520
|
const bicepOrchestrationTemplate = new BicepOrchestrationContent(plugins.map((p) => p.name), baseName);
|
|
353
521
|
const moduleProvisionFiles = new Map();
|
|
354
522
|
const moduleConfigFiles = new Map();
|
|
355
523
|
// Get bicep content from each resource plugin
|
|
356
524
|
for (const plugin of plugins) {
|
|
357
525
|
const pluginWithArm = plugin; // Temporary solution before adding it to teamsfx-api
|
|
358
|
-
const pluginContext =
|
|
526
|
+
const pluginContext = util_2.getPluginContext(ctx, pluginWithArm.name);
|
|
359
527
|
let result;
|
|
360
528
|
let errMessage = "";
|
|
361
529
|
if (pluginWithArm.updateArmTemplates &&
|
|
@@ -375,19 +543,60 @@ async function doGenerateArmTemplate(ctx, selectedPlugins) {
|
|
|
375
543
|
generateArmFromResult(result.value, bicepOrchestrationTemplate, pluginWithArm, moduleProvisionFiles, moduleConfigFiles);
|
|
376
544
|
}
|
|
377
545
|
else {
|
|
378
|
-
const msg =
|
|
546
|
+
const msg = util_1.format(errMessage, (_b = ctx.projectSettings) === null || _b === void 0 ? void 0 : _b.appName);
|
|
379
547
|
(_c = ctx.logProvider) === null || _c === void 0 ? void 0 : _c.error(msg);
|
|
380
548
|
return result;
|
|
381
549
|
}
|
|
382
550
|
}
|
|
551
|
+
await persistBicepTemplates(bicepOrchestrationTemplate, moduleProvisionFiles, moduleConfigFiles, ctx.root);
|
|
552
|
+
return teamsfx_api_1.ok(undefined); // Nothing to return when success
|
|
553
|
+
}
|
|
554
|
+
async function doGenerateArmTemplateV3(ctx, inputs, activatedPlugins, addedPlugins) {
|
|
555
|
+
var _a;
|
|
556
|
+
const baseName = generateResourceBaseName(ctx.projectSetting.appName, "");
|
|
557
|
+
const bicepOrchestrationTemplate = new BicepOrchestrationContent(activatedPlugins.map((p) => p.name), baseName);
|
|
558
|
+
const moduleProvisionFiles = new Map();
|
|
559
|
+
const moduleConfigFiles = new Map();
|
|
560
|
+
for (const plugin of activatedPlugins) {
|
|
561
|
+
let result;
|
|
562
|
+
let errMessage = "";
|
|
563
|
+
if (plugin.updateResourceTemplate &&
|
|
564
|
+
!addedPlugins.find((pluginItem) => pluginItem.name === plugin.name)) {
|
|
565
|
+
result = await plugin.updateResourceTemplate(ctx, inputs);
|
|
566
|
+
errMessage = common_1.getStrings().solution.UpdateArmTemplateFailNotice;
|
|
567
|
+
}
|
|
568
|
+
else if (plugin.generateResourceTemplate &&
|
|
569
|
+
addedPlugins.find((pluginItem) => pluginItem.name === plugin.name)) {
|
|
570
|
+
result = await plugin.generateResourceTemplate(ctx, inputs);
|
|
571
|
+
errMessage = common_1.getStrings().solution.GenerateArmTemplateFailNotice;
|
|
572
|
+
}
|
|
573
|
+
else {
|
|
574
|
+
continue;
|
|
575
|
+
}
|
|
576
|
+
if (result.isOk()) {
|
|
577
|
+
if (result.value.kind === "bicep") {
|
|
578
|
+
const armTemplate = result.value.template;
|
|
579
|
+
generateArmFromResult(armTemplate, bicepOrchestrationTemplate, plugin, moduleProvisionFiles, moduleConfigFiles);
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
else {
|
|
583
|
+
const msg = util_1.format(errMessage, ctx.projectSetting.appName);
|
|
584
|
+
(_a = ctx.logProvider) === null || _a === void 0 ? void 0 : _a.error(msg);
|
|
585
|
+
return result;
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
await persistBicepTemplates(bicepOrchestrationTemplate, moduleProvisionFiles, moduleConfigFiles, inputs.projectPath);
|
|
589
|
+
return teamsfx_api_1.ok(undefined); // Nothing to return when success
|
|
590
|
+
}
|
|
591
|
+
async function persistBicepTemplates(bicepOrchestrationTemplate, moduleProvisionFiles, moduleConfigFiles, projectaPath) {
|
|
383
592
|
// Write bicep content to project folder
|
|
384
593
|
if (bicepOrchestrationTemplate.needsGenerateTemplate()) {
|
|
385
594
|
// Output parameter file
|
|
386
|
-
const envListResult = await
|
|
595
|
+
const envListResult = await environment_1.environmentManager.listEnvConfigs(projectaPath);
|
|
387
596
|
if (envListResult.isErr()) {
|
|
388
597
|
return teamsfx_api_1.err(envListResult.error);
|
|
389
598
|
}
|
|
390
|
-
const parameterEnvFolderPath = path_1.default.join(
|
|
599
|
+
const parameterEnvFolderPath = path_1.default.join(projectaPath, configsFolder);
|
|
391
600
|
await fs.ensureDir(parameterEnvFolderPath);
|
|
392
601
|
for (const env of envListResult.value) {
|
|
393
602
|
const parameterFileName = parameterFileNameTemplate.replace(teamsfx_api_1.EnvNamePlaceholder, env);
|
|
@@ -401,33 +610,33 @@ async function doGenerateArmTemplate(ctx, selectedPlugins) {
|
|
|
401
610
|
const duplicateParam = Object.keys(parameterObj).filter((val) => Object.keys(appendParam).includes(val));
|
|
402
611
|
if (duplicateParam && duplicateParam.length != 0) {
|
|
403
612
|
const duplicateParamError = new Error(`There are some duplicate parameters in ${parameterEnvFilePath}, to avoid the conflict, please modify these parameter names: ${duplicateParam}`);
|
|
404
|
-
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(duplicateParamError,
|
|
613
|
+
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(duplicateParamError, constants_1.SolutionSource, constants_1.SolutionError.FailedToUpdateArmParameters, constants_2.HelpLinks.ArmHelpLink));
|
|
405
614
|
}
|
|
406
615
|
parameterFile.parameters.provisionParameters.value = Object.assign(parameterObj, appendParam);
|
|
407
616
|
parameterFileContent = JSON.stringify(parameterFile, undefined, 2);
|
|
408
617
|
}
|
|
409
618
|
catch (error) {
|
|
410
619
|
const parameterFileError = new Error(`There are some errors in ${parameterEnvFilePath}, please make sure this file is valid. The error message is ${error.message}`);
|
|
411
|
-
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(parameterFileError,
|
|
620
|
+
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(parameterFileError, constants_1.SolutionSource, constants_1.SolutionError.FailedToUpdateArmParameters, constants_2.HelpLinks.ArmHelpLink));
|
|
412
621
|
}
|
|
413
622
|
}
|
|
414
623
|
else {
|
|
415
624
|
parameterFileContent = bicepOrchestrationTemplate.getParameterFileContent();
|
|
416
625
|
}
|
|
417
|
-
await fs.writeFile(parameterEnvFilePath, parameterFileContent);
|
|
626
|
+
await fs.writeFile(parameterEnvFilePath, parameterFileContent.replace(/\r?\n/g, os_1.default.EOL));
|
|
418
627
|
}
|
|
419
628
|
// Generate main.bicep, config.bicep, provision.bicep
|
|
420
|
-
const templateFolderPath = path_1.default.join(
|
|
629
|
+
const templateFolderPath = path_1.default.join(projectaPath, templatesFolder);
|
|
421
630
|
await fs.ensureDir(templateFolderPath);
|
|
422
631
|
await fs.ensureDir(path_1.default.join(templateFolderPath, "teamsFx"));
|
|
423
632
|
await fs.ensureDir(path_1.default.join(templateFolderPath, "provision"));
|
|
424
633
|
let bicepOrchestrationProvisionContent = "";
|
|
425
634
|
let bicepOrchestrationConfigContent = "";
|
|
426
635
|
if (!(await fs.pathExists(path_1.default.join(templateFolderPath, bicepOrchestrationProvisionFileName)))) {
|
|
427
|
-
bicepOrchestrationProvisionContent = await fs.readFile(path_1.default.join(folder_1.getTemplatesFolder(), "plugins", "solution", "provision.bicep"),
|
|
636
|
+
bicepOrchestrationProvisionContent = await fs.readFile(path_1.default.join(folder_1.getTemplatesFolder(), "plugins", "solution", "provision.bicep"), constants_2.ConstantString.UTF8Encoding);
|
|
428
637
|
}
|
|
429
638
|
if (!(await fs.pathExists(path_1.default.join(templateFolderPath, bicepOrchestrationConfigFileName)))) {
|
|
430
|
-
bicepOrchestrationConfigContent = await fs.readFile(path_1.default.join(folder_1.getTemplatesFolder(), "plugins", "solution", "config.bicep"),
|
|
639
|
+
bicepOrchestrationConfigContent = await fs.readFile(path_1.default.join(folder_1.getTemplatesFolder(), "plugins", "solution", "config.bicep"), constants_2.ConstantString.UTF8Encoding);
|
|
431
640
|
}
|
|
432
641
|
bicepOrchestrationProvisionContent +=
|
|
433
642
|
os_1.default.EOL + bicepOrchestrationTemplate.getOrchestractionProvisionContent();
|
|
@@ -437,42 +646,51 @@ async function doGenerateArmTemplate(ctx, selectedPlugins) {
|
|
|
437
646
|
if (!(await fs.pathExists(path_1.default.join(templateFolderPath, bicepOrchestrationFileName)))) {
|
|
438
647
|
await fs.copyFile(path_1.default.join(templateSolitionPath, bicepOrchestrationFileName), path_1.default.join(templateFolderPath, bicepOrchestrationFileName));
|
|
439
648
|
}
|
|
440
|
-
await fs.appendFile(path_1.default.join(templateFolderPath, bicepOrchestrationProvisionFileName), bicepOrchestrationProvisionContent);
|
|
441
|
-
await fs.appendFile(path_1.default.join(templateFolderPath, bicepOrchestrationConfigFileName), bicepOrchestrationConfigContent);
|
|
649
|
+
await fs.appendFile(path_1.default.join(templateFolderPath, bicepOrchestrationProvisionFileName), bicepOrchestrationProvisionContent.replace(/\r?\n/g, os_1.default.EOL));
|
|
650
|
+
await fs.appendFile(path_1.default.join(templateFolderPath, bicepOrchestrationConfigFileName), bicepOrchestrationConfigContent.replace(/\r?\n/g, os_1.default.EOL));
|
|
442
651
|
// Generate module provision bicep files
|
|
443
652
|
for (const module of moduleProvisionFiles) {
|
|
444
653
|
const res = bicepOrchestrationTemplate.applyReference(module[1]);
|
|
445
|
-
await fs.appendFile(path_1.default.join(templateFolderPath, module[0]), res);
|
|
654
|
+
await fs.appendFile(path_1.default.join(templateFolderPath, module[0]), res.replace(/\r?\n/g, os_1.default.EOL));
|
|
446
655
|
}
|
|
447
656
|
// Generate module configuration bicep files
|
|
448
657
|
for (const module of moduleConfigFiles) {
|
|
449
658
|
const res = bicepOrchestrationTemplate.applyReference(module[1]);
|
|
450
|
-
await fs.writeFile(path_1.default.join(templateFolderPath, module[0]), res);
|
|
659
|
+
await fs.writeFile(path_1.default.join(templateFolderPath, module[0]), res.replace(/\r?\n/g, os_1.default.EOL));
|
|
451
660
|
}
|
|
452
661
|
}
|
|
453
|
-
return teamsfx_api_1.ok(undefined); // Nothing to return when success
|
|
454
662
|
}
|
|
455
663
|
async function getExpandedParameter(ctx, filePath) {
|
|
456
664
|
var _a;
|
|
457
665
|
try {
|
|
458
|
-
const parameterTemplate = await fs.readFile(filePath,
|
|
666
|
+
const parameterTemplate = await fs.readFile(filePath, constants_2.ConstantString.UTF8Encoding);
|
|
459
667
|
const parameterJsonString = expandParameterPlaceholders(ctx, parameterTemplate);
|
|
460
668
|
return JSON.parse(parameterJsonString);
|
|
461
669
|
}
|
|
462
670
|
catch (err) {
|
|
463
|
-
(_a = ctx.logProvider) === null || _a === void 0 ? void 0 : _a.error(`[${
|
|
671
|
+
(_a = ctx.logProvider) === null || _a === void 0 ? void 0 : _a.error(`[${constants_2.PluginDisplayName.Solution}] Failed to get expanded parameter from ${filePath}.`);
|
|
464
672
|
throw err;
|
|
465
673
|
}
|
|
466
674
|
}
|
|
467
|
-
async function
|
|
468
|
-
var _a
|
|
469
|
-
|
|
675
|
+
async function getExpandedParameterV3(ctx, envInfo, filePath) {
|
|
676
|
+
var _a;
|
|
677
|
+
try {
|
|
678
|
+
const parameterTemplate = await fs.readFile(filePath, constants_2.ConstantString.UTF8Encoding);
|
|
679
|
+
const parameterJsonString = expandParameterPlaceholdersV3(ctx, envInfo, parameterTemplate);
|
|
680
|
+
return JSON.parse(parameterJsonString);
|
|
681
|
+
}
|
|
682
|
+
catch (err) {
|
|
683
|
+
(_a = ctx.logProvider) === null || _a === void 0 ? void 0 : _a.error(`[${constants_2.PluginDisplayName.Solution}] Failed to get expanded parameter from ${filePath}.`);
|
|
684
|
+
throw err;
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
async function getResourceManagementClientForArmDeployment(azureAccountProvider, subscriptionId) {
|
|
688
|
+
const azureToken = await azureAccountProvider.getAccountCredentialAsync();
|
|
470
689
|
if (!azureToken) {
|
|
471
|
-
throw teamsfx_api_1.returnSystemError(new Error("Azure Credential is invalid."),
|
|
690
|
+
throw teamsfx_api_1.returnSystemError(new Error("Azure Credential is invalid."), constants_2.PluginDisplayName.Solution, constants_1.SolutionError.FailedToGetAzureCredential);
|
|
472
691
|
}
|
|
473
|
-
const subscriptionId = (_b = ctx.envInfo.state.get(constants_2.GLOBAL_CONFIG)) === null || _b === void 0 ? void 0 : _b.get(constants_2.SUBSCRIPTION_ID);
|
|
474
692
|
if (!subscriptionId) {
|
|
475
|
-
throw teamsfx_api_1.returnSystemError(new Error(`Failed to get subscription id.`),
|
|
693
|
+
throw teamsfx_api_1.returnSystemError(new Error(`Failed to get subscription id.`), constants_2.PluginDisplayName.Solution, constants_1.SolutionError.NoSubscriptionSelected);
|
|
476
694
|
}
|
|
477
695
|
return new arm_resources_1.ResourceManagementClient(azureToken, subscriptionId);
|
|
478
696
|
}
|
|
@@ -488,32 +706,34 @@ async function compileBicepToJson(bicepCommand, bicepOrchestrationFilePath, logg
|
|
|
488
706
|
// Context used by handlebars to render the main.bicep file
|
|
489
707
|
class ArmTemplateRenderContext {
|
|
490
708
|
constructor(pluginNames) {
|
|
491
|
-
this.Plugins =
|
|
492
|
-
|
|
709
|
+
this.Plugins = {};
|
|
710
|
+
for (const plugin of pluginNames) {
|
|
711
|
+
this.Plugins[plugin] = {};
|
|
712
|
+
}
|
|
493
713
|
}
|
|
494
714
|
addPluginOutput(pluginName, armResult) {
|
|
495
|
-
var _a, _b
|
|
496
|
-
const
|
|
715
|
+
var _a, _b;
|
|
716
|
+
const PluginContext = {
|
|
497
717
|
Provision: {},
|
|
498
718
|
Configuration: {},
|
|
499
719
|
References: {},
|
|
500
720
|
};
|
|
501
721
|
const provision = (_a = armResult.Provision) === null || _a === void 0 ? void 0 : _a.Modules;
|
|
502
|
-
const references =
|
|
503
|
-
const configs = (
|
|
722
|
+
const references = armResult.Reference;
|
|
723
|
+
const configs = (_b = armResult.Configuration) === null || _b === void 0 ? void 0 : _b.Modules;
|
|
504
724
|
if (provision) {
|
|
505
725
|
for (const module of Object.entries(provision)) {
|
|
506
726
|
const moduleFileName = module[0];
|
|
507
|
-
|
|
508
|
-
|
|
727
|
+
PluginContext.Provision[moduleFileName] = {
|
|
728
|
+
path: generateBicepModuleProvisionFilePath(moduleFileName),
|
|
509
729
|
};
|
|
510
730
|
}
|
|
511
731
|
}
|
|
512
732
|
if (configs) {
|
|
513
733
|
for (const module of Object.entries(configs)) {
|
|
514
734
|
const moduleFileName = module[0];
|
|
515
|
-
|
|
516
|
-
|
|
735
|
+
PluginContext.Configuration[moduleFileName] = {
|
|
736
|
+
path: generateBicepModuleConfigFilePath(moduleFileName),
|
|
517
737
|
};
|
|
518
738
|
}
|
|
519
739
|
}
|
|
@@ -521,10 +741,10 @@ class ArmTemplateRenderContext {
|
|
|
521
741
|
for (const output of Object.entries(references)) {
|
|
522
742
|
const outputKey = output[0];
|
|
523
743
|
const outputValue = output[1];
|
|
524
|
-
|
|
744
|
+
PluginContext.References[outputKey] = outputValue;
|
|
525
745
|
}
|
|
526
746
|
}
|
|
527
|
-
this.
|
|
747
|
+
this.Plugins[pluginName] = PluginContext;
|
|
528
748
|
}
|
|
529
749
|
}
|
|
530
750
|
exports.ArmTemplateRenderContext = ArmTemplateRenderContext;
|
|
@@ -536,25 +756,25 @@ class BicepOrchestrationContent {
|
|
|
536
756
|
this.ProvisionTemplate = "";
|
|
537
757
|
this.ConfigTemplate = "";
|
|
538
758
|
this.ParameterJsonTemplate[resourceBaseName] = baseName;
|
|
539
|
-
this.
|
|
759
|
+
this.RenderContext = new ArmTemplateRenderContext(pluginNames);
|
|
540
760
|
}
|
|
541
761
|
applyTemplate(pluginName, armResult) {
|
|
542
762
|
var _a, _b;
|
|
543
763
|
this.ProvisionTemplate += this.normalizeTemplateSnippet((_a = armResult.Provision) === null || _a === void 0 ? void 0 : _a.Orchestration);
|
|
544
764
|
this.ConfigTemplate += this.normalizeTemplateSnippet((_b = armResult.Configuration) === null || _b === void 0 ? void 0 : _b.Orchestration);
|
|
545
|
-
this.
|
|
765
|
+
this.RenderContext.addPluginOutput(pluginName, armResult);
|
|
546
766
|
Object.assign(this.ParameterJsonTemplate, armResult.Parameters);
|
|
547
767
|
}
|
|
548
768
|
applyReference(configContent) {
|
|
549
|
-
return common_1.compileHandlebarsTemplateString(configContent, this.
|
|
769
|
+
return common_1.compileHandlebarsTemplateString(configContent, this.RenderContext.Plugins);
|
|
550
770
|
}
|
|
551
771
|
getOrchestractionProvisionContent() {
|
|
552
|
-
const orchestrationTemplate = this.normalizeTemplateSnippet(this.ProvisionTemplate, false) +
|
|
553
|
-
return common_1.compileHandlebarsTemplateString(orchestrationTemplate, this.
|
|
772
|
+
const orchestrationTemplate = this.normalizeTemplateSnippet(this.ProvisionTemplate, false) + os_1.default.EOL;
|
|
773
|
+
return common_1.compileHandlebarsTemplateString(orchestrationTemplate, this.RenderContext.Plugins).trim();
|
|
554
774
|
}
|
|
555
775
|
getOrchestractionConfigContent() {
|
|
556
|
-
const orchestrationTemplate = this.normalizeTemplateSnippet(this.ConfigTemplate, false) +
|
|
557
|
-
return common_1.compileHandlebarsTemplateString(orchestrationTemplate, this.
|
|
776
|
+
const orchestrationTemplate = this.normalizeTemplateSnippet(this.ConfigTemplate, false) + os_1.default.EOL;
|
|
777
|
+
return common_1.compileHandlebarsTemplateString(orchestrationTemplate, this.RenderContext.Plugins).trim();
|
|
558
778
|
}
|
|
559
779
|
getParameterFileContent() {
|
|
560
780
|
const parameterObject = {
|
|
@@ -579,7 +799,7 @@ class BicepOrchestrationContent {
|
|
|
579
799
|
if (updateTemplateChangeFlag) {
|
|
580
800
|
this.TemplateAdded = true;
|
|
581
801
|
}
|
|
582
|
-
return snippet.trim() +
|
|
802
|
+
return snippet.trim() + os_1.default.EOL;
|
|
583
803
|
}
|
|
584
804
|
return "";
|
|
585
805
|
}
|
|
@@ -593,14 +813,12 @@ function generateBicepModuleConfigFilePath(moduleFileName) {
|
|
|
593
813
|
function expandParameterPlaceholders(ctx, parameterContent) {
|
|
594
814
|
var _a;
|
|
595
815
|
const azureSolutionSettings = (_a = ctx.projectSettings) === null || _a === void 0 ? void 0 : _a.solutionSettings;
|
|
596
|
-
const plugins =
|
|
597
|
-
? ResourcePluginContainer_1.getActivatedV2ResourcePlugins(azureSolutionSettings).map((p) => new adaptor_1.NamedArmResourcePluginAdaptor(p))
|
|
598
|
-
: ResourcePluginContainer_1.getActivatedResourcePlugins(azureSolutionSettings); // This function ensures return result won't be empty
|
|
816
|
+
const plugins = ResourcePluginContainer_1.getActivatedV2ResourcePlugins(azureSolutionSettings).map((p) => new adaptor_1.NamedArmResourcePluginAdaptor(p)); // This function ensures return result won't be empty
|
|
599
817
|
const stateVariables = {};
|
|
600
818
|
const availableVariables = { state: stateVariables };
|
|
601
819
|
// Add plugin contexts to available variables
|
|
602
820
|
for (const plugin of plugins) {
|
|
603
|
-
const pluginContext =
|
|
821
|
+
const pluginContext = util_2.getPluginContext(ctx, plugin.name);
|
|
604
822
|
const pluginVariables = {};
|
|
605
823
|
for (const configItem of pluginContext.config) {
|
|
606
824
|
if (typeof configItem[1] === "string") {
|
|
@@ -611,7 +829,7 @@ function expandParameterPlaceholders(ctx, parameterContent) {
|
|
|
611
829
|
stateVariables[plugin.name] = pluginVariables;
|
|
612
830
|
}
|
|
613
831
|
// Add solution config to available variables
|
|
614
|
-
const solutionConfig = ctx.envInfo.state.get(
|
|
832
|
+
const solutionConfig = ctx.envInfo.state.get(constants_1.GLOBAL_CONFIG);
|
|
615
833
|
if (solutionConfig) {
|
|
616
834
|
const solutionVariables = {};
|
|
617
835
|
for (const configItem of solutionConfig) {
|
|
@@ -630,6 +848,45 @@ function expandParameterPlaceholders(ctx, parameterContent) {
|
|
|
630
848
|
availableVariables["$env"] = processVariables;
|
|
631
849
|
return common_1.compileHandlebarsTemplateString(parameterContent, availableVariables);
|
|
632
850
|
}
|
|
851
|
+
function expandParameterPlaceholdersV3(ctx, envInfo, parameterContent) {
|
|
852
|
+
const azureSolutionSettings = ctx.projectSetting.solutionSettings;
|
|
853
|
+
const plugins = azureSolutionSettings.activeResourcePlugins.map((p) => typedi_1.Container.get(p));
|
|
854
|
+
const stateVariables = {};
|
|
855
|
+
const availableVariables = { state: stateVariables };
|
|
856
|
+
const envState = envInfo.state;
|
|
857
|
+
// Add plugin contexts to available variables
|
|
858
|
+
for (const plugin of plugins) {
|
|
859
|
+
const resourceState = envState[plugin.name] || {};
|
|
860
|
+
// const pluginContext = getPluginContext(ctx, plugin.name);
|
|
861
|
+
const pluginVariables = {};
|
|
862
|
+
for (const key of Object.keys(resourceState)) {
|
|
863
|
+
if (typeof resourceState[key] === "string") {
|
|
864
|
+
// Currently we only config with string type
|
|
865
|
+
pluginVariables[key] = resourceState[key];
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
stateVariables[plugin.name] = pluginVariables;
|
|
869
|
+
}
|
|
870
|
+
// Add solution config to available variables
|
|
871
|
+
const solutionConfig = envState.solution;
|
|
872
|
+
if (solutionConfig) {
|
|
873
|
+
const solutionVariables = {};
|
|
874
|
+
for (const key of Object.keys(solutionConfig)) {
|
|
875
|
+
if (typeof solutionConfig[key] === "string") {
|
|
876
|
+
// Currently we only config with string type
|
|
877
|
+
solutionVariables[key] = solutionConfig[key];
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
stateVariables[solutionName] = solutionVariables;
|
|
881
|
+
}
|
|
882
|
+
// Add environment variable to available variables
|
|
883
|
+
const processVariables = Object.keys(process.env).reduce((obj, key) => {
|
|
884
|
+
obj[key] = process.env[key];
|
|
885
|
+
return obj;
|
|
886
|
+
}, {});
|
|
887
|
+
availableVariables["$env"] = processVariables;
|
|
888
|
+
return common_1.compileHandlebarsTemplateString(parameterContent, availableVariables);
|
|
889
|
+
}
|
|
633
890
|
function generateResourceBaseName(appName, envName) {
|
|
634
891
|
const maxAppNameLength = 10;
|
|
635
892
|
const maxEnvNameLength = 4;
|
|
@@ -646,9 +903,9 @@ async function wrapGetDeploymentError(deployCtx, resourceGroupName, deploymentNa
|
|
|
646
903
|
return teamsfx_api_1.ok(deploymentError);
|
|
647
904
|
}
|
|
648
905
|
catch (error) {
|
|
649
|
-
(_a = deployCtx.
|
|
906
|
+
(_a = deployCtx.logProvider) === null || _a === void 0 ? void 0 : _a.error(`[${constants_2.PluginDisplayName.Solution}] Failed to get deployment error for ${error.message}.`);
|
|
650
907
|
const returnError = new Error(`resource deployments (${deployCtx.deploymentName} module) for your project failed and get the error message failed. Please refer to the resource group ${deployCtx.resourceGroupName} in portal for deployment error.`);
|
|
651
|
-
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(returnError,
|
|
908
|
+
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(returnError, constants_1.SolutionSource, "GetDeploymentErrorFailed"));
|
|
652
909
|
}
|
|
653
910
|
}
|
|
654
911
|
async function getDeploymentError(deployCtx, resourceGroupName, deploymentName) {
|
|
@@ -659,7 +916,7 @@ async function getDeploymentError(deployCtx, resourceGroupName, deploymentName)
|
|
|
659
916
|
}
|
|
660
917
|
catch (error) {
|
|
661
918
|
if (deploymentName !== deployCtx.deploymentName &&
|
|
662
|
-
error.code ===
|
|
919
|
+
error.code === constants_2.ConstantString.DeploymentNotFound) {
|
|
663
920
|
return undefined;
|
|
664
921
|
}
|
|
665
922
|
throw error;
|
|
@@ -681,7 +938,7 @@ async function getDeploymentError(deployCtx, resourceGroupName, deploymentName)
|
|
|
681
938
|
error: operation.properties.statusMessage.error,
|
|
682
939
|
};
|
|
683
940
|
if (((_g = operation.properties.targetResource) === null || _g === void 0 ? void 0 : _g.resourceType) ===
|
|
684
|
-
|
|
941
|
+
constants_2.ConstantString.DeploymentResourceType &&
|
|
685
942
|
((_h = operation.properties.targetResource) === null || _h === void 0 ? void 0 : _h.resourceName) &&
|
|
686
943
|
((_j = operation.properties.targetResource) === null || _j === void 0 ? void 0 : _j.id)) {
|
|
687
944
|
const resourceGroupName = tools_1.getResourceGroupNameFromResourceId(operation.properties.targetResource.id);
|
|
@@ -697,7 +954,7 @@ async function getDeploymentError(deployCtx, resourceGroupName, deploymentName)
|
|
|
697
954
|
function formattedDeploymentName(failedDeployments) {
|
|
698
955
|
const format = failedDeployments.map((deployment) => deployment + " module");
|
|
699
956
|
const returnError = new Error(`resource deployments (${format.join(", ")}) for your project failed. Please refer to output channel for more error details.`);
|
|
700
|
-
return teamsfx_api_1.returnUserError(returnError,
|
|
957
|
+
return teamsfx_api_1.returnUserError(returnError, constants_1.SolutionSource, constants_1.SolutionError.FailedToDeployArmTemplatesToAzure, constants_2.HelpLinks.ArmHelpLink);
|
|
701
958
|
}
|
|
702
959
|
function formattedDeploymentError(deploymentError) {
|
|
703
960
|
var _a, _b, _c;
|
|
@@ -723,4 +980,14 @@ function formattedDeploymentError(deploymentError) {
|
|
|
723
980
|
}
|
|
724
981
|
}
|
|
725
982
|
exports.formattedDeploymentError = formattedDeploymentError;
|
|
983
|
+
class Arm {
|
|
984
|
+
async generateArmTemplate(ctx, inputs, activatedPlugins, addedPlugins) {
|
|
985
|
+
return generateArmTemplateV3(ctx, inputs, activatedPlugins, addedPlugins);
|
|
986
|
+
}
|
|
987
|
+
async deployArmTemplates(ctx, inputs, envInfo, azureAccountProvider) {
|
|
988
|
+
return deployArmTemplatesV3(ctx, inputs, envInfo, azureAccountProvider);
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
const arm = new Arm();
|
|
992
|
+
exports.default = arm;
|
|
726
993
|
//# sourceMappingURL=arm.js.map
|