@microsoft/teamsfx-core 0.7.0 → 0.7.1-alpha.5e8f6dea.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/common/constants.d.ts +5 -0
- package/build/common/constants.d.ts.map +1 -1
- package/build/common/constants.js +6 -1
- package/build/common/constants.js.map +1 -1
- package/build/common/fileUtils.d.ts.map +1 -1
- package/build/common/fileUtils.js +12 -6
- package/build/common/fileUtils.js.map +1 -1
- package/build/common/localSettingsProvider.d.ts +4 -2
- package/build/common/localSettingsProvider.d.ts.map +1 -1
- package/build/common/localSettingsProvider.js +32 -1
- package/build/common/localSettingsProvider.js.map +1 -1
- package/build/common/templates.d.ts.map +1 -1
- package/build/common/templates.js +9 -9
- package/build/common/templates.js.map +1 -1
- package/build/common/templatesActions.d.ts +39 -0
- package/build/common/templatesActions.d.ts.map +1 -0
- package/build/common/templatesActions.js +120 -0
- package/build/common/templatesActions.js.map +1 -0
- package/build/common/templatesUtils.d.ts +14 -0
- package/build/common/templatesUtils.d.ts.map +1 -0
- package/build/common/templatesUtils.js +94 -0
- package/build/common/templatesUtils.js.map +1 -0
- package/build/common/tools.d.ts +12 -2
- package/build/common/tools.d.ts.map +1 -1
- package/build/common/tools.js +52 -7
- package/build/common/tools.js.map +1 -1
- package/build/core/SolutionPluginContainer.d.ts +15 -0
- package/build/core/SolutionPluginContainer.d.ts.map +1 -0
- package/build/core/SolutionPluginContainer.js +54 -0
- package/build/core/SolutionPluginContainer.js.map +1 -0
- package/build/core/callback.d.ts +9 -0
- package/build/core/callback.d.ts.map +1 -0
- package/build/core/callback.js +33 -0
- package/build/core/callback.js.map +1 -0
- package/build/core/environment.d.ts +7 -3
- package/build/core/environment.d.ts.map +1 -1
- package/build/core/environment.js +68 -13
- package/build/core/environment.js.map +1 -1
- package/build/core/error.d.ts +19 -2
- package/build/core/error.d.ts.map +1 -1
- package/build/core/error.js +72 -34
- package/build/core/error.js.map +1 -1
- package/build/core/index.d.ts +24 -12
- package/build/core/index.d.ts.map +1 -1
- package/build/core/index.js +604 -309
- package/build/core/index.js.map +1 -1
- package/build/core/middleware/concurrentLocker.d.ts.map +1 -1
- package/build/core/middleware/concurrentLocker.js +13 -6
- package/build/core/middleware/concurrentLocker.js.map +1 -1
- package/build/core/middleware/contextInjector.d.ts +3 -0
- package/build/core/middleware/contextInjector.d.ts.map +1 -0
- package/build/core/middleware/{contextInjecter.js → contextInjector.js} +4 -4
- package/build/core/middleware/contextInjector.js.map +1 -0
- package/build/core/middleware/envInfoLoader.d.ts +8 -4
- package/build/core/middleware/envInfoLoader.d.ts.map +1 -1
- package/build/core/middleware/envInfoLoader.js +77 -40
- package/build/core/middleware/envInfoLoader.js.map +1 -1
- package/build/core/middleware/envInfoWriter.d.ts +1 -1
- package/build/core/middleware/envInfoWriter.d.ts.map +1 -1
- package/build/core/middleware/envInfoWriter.js +30 -13
- package/build/core/middleware/envInfoWriter.js.map +1 -1
- package/build/core/middleware/localSettingsLoader.d.ts.map +1 -1
- package/build/core/middleware/localSettingsLoader.js +18 -8
- 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 +14 -5
- package/build/core/middleware/localSettingsWriter.js.map +1 -1
- package/build/core/middleware/projectMigrator.d.ts +5 -0
- package/build/core/middleware/projectMigrator.d.ts.map +1 -0
- package/build/core/middleware/projectMigrator.js +382 -0
- package/build/core/middleware/projectMigrator.js.map +1 -0
- package/build/core/middleware/projectSettingsLoader.d.ts +2 -2
- package/build/core/middleware/projectSettingsLoader.d.ts.map +1 -1
- package/build/core/middleware/projectSettingsLoader.js +13 -9
- package/build/core/middleware/projectSettingsLoader.js.map +1 -1
- package/build/core/middleware/projectSettingsWriter.d.ts.map +1 -1
- package/build/core/middleware/projectSettingsWriter.js +6 -7
- package/build/core/middleware/projectSettingsWriter.js.map +1 -1
- package/build/core/middleware/projectUpgrader.d.ts.map +1 -1
- package/build/core/middleware/projectUpgrader.js +15 -7
- package/build/core/middleware/projectUpgrader.js.map +1 -1
- package/build/core/middleware/questionModel.d.ts.map +1 -1
- package/build/core/middleware/questionModel.js +25 -17
- package/build/core/middleware/questionModel.js.map +1 -1
- package/build/core/middleware/solutionLoader.d.ts +1 -2
- package/build/core/middleware/solutionLoader.d.ts.map +1 -1
- package/build/core/middleware/solutionLoader.js +24 -4
- package/build/core/middleware/solutionLoader.js.map +1 -1
- package/build/core/question.d.ts +2 -0
- package/build/core/question.d.ts.map +1 -1
- package/build/core/question.js +12 -1
- package/build/core/question.js.map +1 -1
- package/build/core/tools.d.ts +2 -2
- package/build/core/tools.d.ts.map +1 -1
- package/build/core/tools.js +15 -5
- package/build/core/tools.js.map +1 -1
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/build/plugins/resource/aad/appStudio.js +1 -1
- package/build/plugins/resource/aad/appStudio.js.map +1 -1
- package/build/plugins/resource/aad/errors.d.ts.map +1 -1
- package/build/plugins/resource/aad/errors.js +1 -0
- package/build/plugins/resource/aad/errors.js.map +1 -1
- package/build/plugins/resource/aad/index.d.ts +1 -0
- package/build/plugins/resource/aad/index.d.ts.map +1 -1
- package/build/plugins/resource/aad/index.js +2 -1
- package/build/plugins/resource/aad/index.js.map +1 -1
- package/build/plugins/resource/aad/utils/configs.d.ts.map +1 -1
- package/build/plugins/resource/aad/utils/configs.js +9 -10
- package/build/plugins/resource/aad/utils/configs.js.map +1 -1
- package/build/plugins/resource/aad/utils/telemetry.js +1 -1
- package/build/plugins/resource/aad/utils/telemetry.js.map +1 -1
- package/build/plugins/resource/aad/v2/index.d.ts +7 -7
- package/build/plugins/resource/aad/v2/index.d.ts.map +1 -1
- package/build/plugins/resource/aad/v2/index.js +6 -6
- package/build/plugins/resource/aad/v2/index.js.map +1 -1
- package/build/plugins/resource/apim/config.d.ts +1 -0
- package/build/plugins/resource/apim/config.d.ts.map +1 -1
- package/build/plugins/resource/apim/config.js.map +1 -1
- package/build/plugins/resource/apim/constants.d.ts +3 -0
- package/build/plugins/resource/apim/constants.d.ts.map +1 -1
- package/build/plugins/resource/apim/constants.js +5 -1
- package/build/plugins/resource/apim/constants.js.map +1 -1
- package/build/plugins/resource/apim/factory.d.ts +2 -1
- package/build/plugins/resource/apim/factory.d.ts.map +1 -1
- package/build/plugins/resource/apim/factory.js +19 -8
- package/build/plugins/resource/apim/factory.js.map +1 -1
- package/build/plugins/resource/apim/index.d.ts +2 -0
- package/build/plugins/resource/apim/index.d.ts.map +1 -1
- package/build/plugins/resource/apim/index.js +15 -8
- package/build/plugins/resource/apim/index.js.map +1 -1
- package/build/plugins/resource/apim/questions/vscodeQuestion.js +1 -1
- package/build/plugins/resource/apim/questions/vscodeQuestion.js.map +1 -1
- package/build/plugins/resource/apim/v2/index.d.ts +9 -11
- package/build/plugins/resource/apim/v2/index.d.ts.map +1 -1
- package/build/plugins/resource/apim/v2/index.js +25 -29
- package/build/plugins/resource/apim/v2/index.js.map +1 -1
- package/build/plugins/resource/appstudio/appStudio.d.ts.map +1 -1
- package/build/plugins/resource/appstudio/appStudio.js +9 -8
- package/build/plugins/resource/appstudio/appStudio.js.map +1 -1
- package/build/plugins/resource/appstudio/constants.d.ts +6 -2
- package/build/plugins/resource/appstudio/constants.d.ts.map +1 -1
- package/build/plugins/resource/appstudio/constants.js +124 -13
- package/build/plugins/resource/appstudio/constants.js.map +1 -1
- package/build/plugins/resource/appstudio/errors.d.ts +4 -0
- package/build/plugins/resource/appstudio/errors.d.ts.map +1 -1
- package/build/plugins/resource/appstudio/errors.js +8 -0
- package/build/plugins/resource/appstudio/errors.js.map +1 -1
- package/build/plugins/resource/appstudio/index.d.ts +1 -0
- package/build/plugins/resource/appstudio/index.d.ts.map +1 -1
- package/build/plugins/resource/appstudio/index.js +23 -5
- package/build/plugins/resource/appstudio/index.js.map +1 -1
- package/build/plugins/resource/appstudio/interfaces/IAppDefinition.d.ts +1 -0
- package/build/plugins/resource/appstudio/interfaces/IAppDefinition.d.ts.map +1 -1
- package/build/plugins/resource/appstudio/plugin.d.ts +2 -1
- package/build/plugins/resource/appstudio/plugin.d.ts.map +1 -1
- package/build/plugins/resource/appstudio/plugin.js +197 -68
- package/build/plugins/resource/appstudio/plugin.js.map +1 -1
- package/build/plugins/resource/appstudio/utils/telemetry.d.ts +2 -1
- package/build/plugins/resource/appstudio/utils/telemetry.d.ts.map +1 -1
- package/build/plugins/resource/appstudio/utils/telemetry.js +17 -12
- package/build/plugins/resource/appstudio/utils/telemetry.js.map +1 -1
- package/build/plugins/resource/appstudio/v2/index.d.ts +10 -13
- package/build/plugins/resource/appstudio/v2/index.d.ts.map +1 -1
- package/build/plugins/resource/appstudio/v2/index.js +25 -20
- package/build/plugins/resource/appstudio/v2/index.js.map +1 -1
- package/build/plugins/resource/bot/appStudio/appStudio.js +2 -2
- package/build/plugins/resource/bot/appStudio/appStudio.js.map +1 -1
- package/build/plugins/resource/bot/configs/localDebugConfig.d.ts +1 -1
- package/build/plugins/resource/bot/configs/localDebugConfig.d.ts.map +1 -1
- package/build/plugins/resource/bot/configs/localDebugConfig.js +3 -3
- package/build/plugins/resource/bot/configs/localDebugConfig.js.map +1 -1
- package/build/plugins/resource/bot/configs/provisionConfig.js +21 -20
- package/build/plugins/resource/bot/configs/provisionConfig.js.map +1 -1
- package/build/plugins/resource/bot/configs/scaffoldConfig.d.ts +1 -3
- package/build/plugins/resource/bot/configs/scaffoldConfig.d.ts.map +1 -1
- package/build/plugins/resource/bot/configs/scaffoldConfig.js +9 -10
- package/build/plugins/resource/bot/configs/scaffoldConfig.js.map +1 -1
- package/build/plugins/resource/bot/configs/teamsBotConfig.d.ts.map +1 -1
- package/build/plugins/resource/bot/configs/teamsBotConfig.js +5 -5
- package/build/plugins/resource/bot/configs/teamsBotConfig.js.map +1 -1
- package/build/plugins/resource/bot/constants.d.ts +0 -2
- package/build/plugins/resource/bot/constants.d.ts.map +1 -1
- package/build/plugins/resource/bot/constants.js +2 -14
- package/build/plugins/resource/bot/constants.js.map +1 -1
- package/build/plugins/resource/bot/index.d.ts +2 -3
- package/build/plugins/resource/bot/index.d.ts.map +1 -1
- package/build/plugins/resource/bot/index.js +1 -7
- package/build/plugins/resource/bot/index.js.map +1 -1
- package/build/plugins/resource/bot/plugin.d.ts +1 -4
- package/build/plugins/resource/bot/plugin.d.ts.map +1 -1
- package/build/plugins/resource/bot/plugin.js +21 -80
- package/build/plugins/resource/bot/plugin.js.map +1 -1
- package/build/plugins/resource/bot/resources/messages.d.ts +0 -1
- package/build/plugins/resource/bot/resources/messages.d.ts.map +1 -1
- package/build/plugins/resource/bot/resources/messages.js +0 -1
- package/build/plugins/resource/bot/resources/messages.js.map +1 -1
- package/build/plugins/resource/bot/resources/strings.d.ts +1 -1
- package/build/plugins/resource/bot/resources/strings.d.ts.map +1 -1
- package/build/plugins/resource/bot/resources/strings.js +1 -1
- package/build/plugins/resource/bot/resources/strings.js.map +1 -1
- package/build/plugins/resource/bot/utils/telemetry-helper.d.ts.map +1 -1
- package/build/plugins/resource/bot/utils/telemetry-helper.js +1 -1
- package/build/plugins/resource/bot/utils/telemetry-helper.js.map +1 -1
- package/build/plugins/resource/bot/v2/index.d.ts +9 -13
- package/build/plugins/resource/bot/v2/index.d.ts.map +1 -1
- package/build/plugins/resource/bot/v2/index.js +7 -7
- package/build/plugins/resource/bot/v2/index.js.map +1 -1
- package/build/plugins/resource/frontend/configs.d.ts +7 -2
- package/build/plugins/resource/frontend/configs.d.ts.map +1 -1
- package/build/plugins/resource/frontend/configs.js +49 -29
- package/build/plugins/resource/frontend/configs.js.map +1 -1
- package/build/plugins/resource/frontend/constants.d.ts +3 -2
- package/build/plugins/resource/frontend/constants.d.ts.map +1 -1
- package/build/plugins/resource/frontend/constants.js +4 -3
- package/build/plugins/resource/frontend/constants.js.map +1 -1
- package/build/plugins/resource/frontend/index.d.ts +1 -1
- package/build/plugins/resource/frontend/index.d.ts.map +1 -1
- package/build/plugins/resource/frontend/index.js +6 -5
- package/build/plugins/resource/frontend/index.js.map +1 -1
- package/build/plugins/resource/frontend/ops/deploy.d.ts.map +1 -1
- package/build/plugins/resource/frontend/ops/deploy.js +1 -0
- package/build/plugins/resource/frontend/ops/deploy.js.map +1 -1
- package/build/plugins/resource/frontend/plugin.d.ts +4 -1
- package/build/plugins/resource/frontend/plugin.d.ts.map +1 -1
- package/build/plugins/resource/frontend/plugin.js +32 -32
- package/build/plugins/resource/frontend/plugin.js.map +1 -1
- package/build/plugins/resource/frontend/resources/errors.d.ts +1 -1
- package/build/plugins/resource/frontend/resources/errors.d.ts.map +1 -1
- package/build/plugins/resource/frontend/resources/errors.js +5 -2
- package/build/plugins/resource/frontend/resources/errors.js.map +1 -1
- package/build/plugins/resource/frontend/utils/telemetry-helper.js +1 -1
- package/build/plugins/resource/frontend/utils/telemetry-helper.js.map +1 -1
- package/build/plugins/resource/frontend/v2/index.d.ts +6 -9
- package/build/plugins/resource/frontend/v2/index.d.ts.map +1 -1
- package/build/plugins/resource/frontend/v2/index.js +5 -2
- package/build/plugins/resource/frontend/v2/index.js.map +1 -1
- package/build/plugins/resource/function/constants.d.ts +2 -6
- package/build/plugins/resource/function/constants.d.ts.map +1 -1
- package/build/plugins/resource/function/constants.js +3 -8
- package/build/plugins/resource/function/constants.js.map +1 -1
- package/build/plugins/resource/function/enums.d.ts +2 -0
- package/build/plugins/resource/function/enums.d.ts.map +1 -1
- package/build/plugins/resource/function/enums.js +2 -0
- package/build/plugins/resource/function/enums.js.map +1 -1
- package/build/plugins/resource/function/index.d.ts +1 -0
- package/build/plugins/resource/function/index.d.ts.map +1 -1
- package/build/plugins/resource/function/index.js +1 -0
- package/build/plugins/resource/function/index.js.map +1 -1
- package/build/plugins/resource/function/ops/deploy.d.ts +1 -1
- package/build/plugins/resource/function/ops/deploy.d.ts.map +1 -1
- package/build/plugins/resource/function/ops/deploy.js +13 -5
- package/build/plugins/resource/function/ops/deploy.js.map +1 -1
- package/build/plugins/resource/function/ops/scaffold.d.ts +4 -7
- package/build/plugins/resource/function/ops/scaffold.d.ts.map +1 -1
- package/build/plugins/resource/function/ops/scaffold.js +42 -40
- package/build/plugins/resource/function/ops/scaffold.js.map +1 -1
- package/build/plugins/resource/function/plugin.d.ts +4 -0
- package/build/plugins/resource/function/plugin.d.ts.map +1 -1
- package/build/plugins/resource/function/plugin.js +57 -41
- package/build/plugins/resource/function/plugin.js.map +1 -1
- package/build/plugins/resource/function/resources/errors.d.ts +2 -5
- package/build/plugins/resource/function/resources/errors.d.ts.map +1 -1
- package/build/plugins/resource/function/resources/errors.js +5 -13
- package/build/plugins/resource/function/resources/errors.js.map +1 -1
- package/build/plugins/resource/function/resources/message.d.ts +1 -0
- package/build/plugins/resource/function/resources/message.d.ts.map +1 -1
- package/build/plugins/resource/function/resources/message.js +1 -0
- package/build/plugins/resource/function/resources/message.js.map +1 -1
- package/build/plugins/resource/function/utils/telemetry-helper.js +1 -1
- package/build/plugins/resource/function/utils/telemetry-helper.js.map +1 -1
- package/build/plugins/resource/function/v2/index.d.ts +8 -11
- package/build/plugins/resource/function/v2/index.d.ts.map +1 -1
- package/build/plugins/resource/function/v2/index.js +9 -17
- package/build/plugins/resource/function/v2/index.js.map +1 -1
- package/build/plugins/resource/identity/index.d.ts +1 -0
- package/build/plugins/resource/identity/index.d.ts.map +1 -1
- package/build/plugins/resource/identity/index.js +7 -9
- package/build/plugins/resource/identity/index.js.map +1 -1
- package/build/plugins/resource/identity/utils/contextUtils.js +1 -1
- package/build/plugins/resource/identity/utils/contextUtils.js.map +1 -1
- package/build/plugins/resource/identity/utils/telemetryUtil.d.ts.map +1 -1
- package/build/plugins/resource/identity/utils/telemetryUtil.js +1 -1
- package/build/plugins/resource/identity/utils/telemetryUtil.js.map +1 -1
- package/build/plugins/resource/identity/v2/index.d.ts +3 -3
- package/build/plugins/resource/identity/v2/index.d.ts.map +1 -1
- package/build/plugins/resource/identity/v2/index.js +2 -2
- package/build/plugins/resource/identity/v2/index.js.map +1 -1
- package/build/plugins/resource/localdebug/constants.d.ts +4 -0
- package/build/plugins/resource/localdebug/constants.d.ts.map +1 -1
- package/build/plugins/resource/localdebug/constants.js +6 -1
- package/build/plugins/resource/localdebug/constants.js.map +1 -1
- package/build/plugins/resource/localdebug/index.d.ts +1 -0
- package/build/plugins/resource/localdebug/index.d.ts.map +1 -1
- package/build/plugins/resource/localdebug/index.js +12 -6
- package/build/plugins/resource/localdebug/index.js.map +1 -1
- package/build/plugins/resource/localdebug/launch.d.ts +1 -0
- package/build/plugins/resource/localdebug/launch.d.ts.map +1 -1
- package/build/plugins/resource/localdebug/launch.js +66 -1
- package/build/plugins/resource/localdebug/launch.js.map +1 -1
- package/build/plugins/resource/localdebug/legacyPlugin.js +4 -4
- package/build/plugins/resource/localdebug/legacyPlugin.js.map +1 -1
- package/build/plugins/resource/localdebug/tasks.d.ts.map +1 -1
- package/build/plugins/resource/localdebug/tasks.js +12 -2
- package/build/plugins/resource/localdebug/tasks.js.map +1 -1
- package/build/plugins/resource/localdebug/util/telemetry.js +1 -1
- package/build/plugins/resource/localdebug/util/telemetry.js.map +1 -1
- package/build/plugins/resource/localdebug/v2/index.d.ts +6 -8
- package/build/plugins/resource/localdebug/v2/index.d.ts.map +1 -1
- package/build/plugins/resource/localdebug/v2/index.js +2 -2
- package/build/plugins/resource/localdebug/v2/index.js.map +1 -1
- package/build/plugins/resource/simpleauth/index.d.ts +1 -0
- package/build/plugins/resource/simpleauth/index.d.ts.map +1 -1
- package/build/plugins/resource/simpleauth/index.js +1 -0
- package/build/plugins/resource/simpleauth/index.js.map +1 -1
- package/build/plugins/resource/simpleauth/plugin.d.ts.map +1 -1
- package/build/plugins/resource/simpleauth/plugin.js +1 -6
- package/build/plugins/resource/simpleauth/plugin.js.map +1 -1
- package/build/plugins/resource/simpleauth/utils/common.js +1 -1
- package/build/plugins/resource/simpleauth/utils/common.js.map +1 -1
- package/build/plugins/resource/simpleauth/utils/telemetry.d.ts.map +1 -1
- package/build/plugins/resource/simpleauth/utils/telemetry.js +2 -1
- package/build/plugins/resource/simpleauth/utils/telemetry.js.map +1 -1
- package/build/plugins/resource/simpleauth/v2/index.d.ts +4 -4
- package/build/plugins/resource/simpleauth/v2/index.d.ts.map +1 -1
- package/build/plugins/resource/simpleauth/v2/index.js.map +1 -1
- package/build/plugins/resource/spfx/index.d.ts +1 -0
- package/build/plugins/resource/spfx/index.d.ts.map +1 -1
- package/build/plugins/resource/spfx/index.js +1 -0
- package/build/plugins/resource/spfx/index.js.map +1 -1
- package/build/plugins/resource/spfx/v2/index.d.ts +4 -8
- package/build/plugins/resource/spfx/v2/index.d.ts.map +1 -1
- package/build/plugins/resource/spfx/v2/index.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/errors.d.ts +4 -0
- package/build/plugins/resource/sql/errors.d.ts.map +1 -1
- package/build/plugins/resource/sql/errors.js +4 -0
- package/build/plugins/resource/sql/errors.js.map +1 -1
- package/build/plugins/resource/sql/index.d.ts +1 -0
- package/build/plugins/resource/sql/index.d.ts.map +1 -1
- package/build/plugins/resource/sql/index.js +1 -0
- package/build/plugins/resource/sql/index.js.map +1 -1
- package/build/plugins/resource/sql/plugin.d.ts +4 -0
- package/build/plugins/resource/sql/plugin.d.ts.map +1 -1
- package/build/plugins/resource/sql/plugin.js +68 -69
- package/build/plugins/resource/sql/plugin.js.map +1 -1
- package/build/plugins/resource/sql/utils/contextUtils.js +1 -1
- package/build/plugins/resource/sql/utils/contextUtils.js.map +1 -1
- package/build/plugins/resource/sql/utils/telemetryUtils.d.ts.map +1 -1
- package/build/plugins/resource/sql/utils/telemetryUtils.js +2 -1
- package/build/plugins/resource/sql/utils/telemetryUtils.js.map +1 -1
- package/build/plugins/resource/sql/v2/index.d.ts +5 -4
- package/build/plugins/resource/sql/v2/index.d.ts.map +1 -1
- package/build/plugins/resource/sql/v2/index.js +18 -16
- package/build/plugins/resource/sql/v2/index.js.map +1 -1
- package/build/plugins/resource/utils4v2.d.ts +16 -14
- package/build/plugins/resource/utils4v2.d.ts.map +1 -1
- package/build/plugins/resource/utils4v2.js +127 -92
- package/build/plugins/resource/utils4v2.js.map +1 -1
- package/build/plugins/solution/fx-solution/ResourcePluginContainer.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/ResourcePluginContainer.js +4 -2
- package/build/plugins/solution/fx-solution/ResourcePluginContainer.js.map +1 -1
- package/build/plugins/solution/fx-solution/arm.d.ts +11 -0
- package/build/plugins/solution/fx-solution/arm.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/arm.js +118 -40
- package/build/plugins/solution/fx-solution/arm.js.map +1 -1
- package/build/plugins/solution/fx-solution/commonQuestions.d.ts +2 -2
- package/build/plugins/solution/fx-solution/commonQuestions.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/commonQuestions.js +120 -47
- package/build/plugins/solution/fx-solution/commonQuestions.js.map +1 -1
- package/build/plugins/solution/fx-solution/constants.d.ts +16 -2
- package/build/plugins/solution/fx-solution/constants.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/constants.js +15 -1
- package/build/plugins/solution/fx-solution/constants.js.map +1 -1
- package/build/plugins/solution/fx-solution/executor.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/executor.js +39 -21
- package/build/plugins/solution/fx-solution/executor.js.map +1 -1
- package/build/plugins/solution/fx-solution/index.d.ts +2 -0
- package/build/plugins/solution/fx-solution/index.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/index.js +2 -0
- package/build/plugins/solution/fx-solution/index.js.map +1 -1
- package/build/plugins/solution/fx-solution/question.d.ts +2 -1
- package/build/plugins/solution/fx-solution/question.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/question.js +18 -1
- package/build/plugins/solution/fx-solution/question.js.map +1 -1
- package/build/plugins/solution/fx-solution/solution.d.ts +3 -6
- package/build/plugins/solution/fx-solution/solution.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/solution.js +406 -379
- package/build/plugins/solution/fx-solution/solution.js.map +1 -1
- package/build/plugins/solution/fx-solution/utils/util.js +1 -1
- package/build/plugins/solution/fx-solution/utils/util.js.map +1 -1
- package/build/plugins/solution/fx-solution/v2/adaptor.d.ts +3 -0
- package/build/plugins/solution/fx-solution/v2/adaptor.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/v2/adaptor.js +37 -3
- package/build/plugins/solution/fx-solution/v2/adaptor.js.map +1 -1
- package/build/plugins/solution/fx-solution/v2/createEnv.d.ts +3 -0
- package/build/plugins/solution/fx-solution/v2/createEnv.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/v2/createEnv.js +28 -0
- package/build/plugins/solution/fx-solution/v2/createEnv.js.map +1 -0
- package/build/plugins/solution/fx-solution/v2/deploy.d.ts +2 -4
- package/build/plugins/solution/fx-solution/v2/deploy.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/v2/deploy.js +19 -14
- package/build/plugins/solution/fx-solution/v2/deploy.js.map +1 -1
- package/build/plugins/solution/fx-solution/v2/executeUserTask.d.ts +2 -2
- package/build/plugins/solution/fx-solution/v2/executeUserTask.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/v2/executeUserTask.js +20 -4
- package/build/plugins/solution/fx-solution/v2/executeUserTask.js.map +1 -1
- package/build/plugins/solution/fx-solution/v2/executor.d.ts +2 -2
- package/build/plugins/solution/fx-solution/v2/executor.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/v2/executor.js +27 -3
- package/build/plugins/solution/fx-solution/v2/executor.js.map +1 -1
- package/build/plugins/solution/fx-solution/v2/generateResourceTemplate.d.ts +2 -2
- package/build/plugins/solution/fx-solution/v2/generateResourceTemplate.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/v2/generateResourceTemplate.js +8 -2
- package/build/plugins/solution/fx-solution/v2/generateResourceTemplate.js.map +1 -1
- package/build/plugins/solution/fx-solution/v2/getQuestions.d.ts +8 -0
- package/build/plugins/solution/fx-solution/v2/getQuestions.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/v2/getQuestions.js +393 -0
- package/build/plugins/solution/fx-solution/v2/getQuestions.js.map +1 -0
- package/build/plugins/solution/fx-solution/v2/package.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/v2/package.js +12 -2
- package/build/plugins/solution/fx-solution/v2/package.js.map +1 -1
- package/build/plugins/solution/fx-solution/v2/provision.d.ts +4 -0
- package/build/plugins/solution/fx-solution/v2/provision.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/v2/provision.js +153 -0
- package/build/plugins/solution/fx-solution/v2/provision.js.map +1 -0
- package/build/plugins/solution/fx-solution/v2/provisionLocal.d.ts +3 -0
- package/build/plugins/solution/fx-solution/v2/provisionLocal.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/v2/provisionLocal.js +73 -0
- package/build/plugins/solution/fx-solution/v2/provisionLocal.js.map +1 -0
- package/build/plugins/solution/fx-solution/v2/publish.d.ts +2 -2
- package/build/plugins/solution/fx-solution/v2/publish.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/v2/publish.js +11 -11
- package/build/plugins/solution/fx-solution/v2/publish.js.map +1 -1
- package/build/plugins/solution/fx-solution/v2/scaffolding.d.ts +3 -7
- package/build/plugins/solution/fx-solution/v2/scaffolding.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/v2/scaffolding.js +21 -6
- package/build/plugins/solution/fx-solution/v2/scaffolding.js.map +1 -1
- package/build/plugins/solution/fx-solution/v2/solution.d.ts +18 -0
- package/build/plugins/solution/fx-solution/v2/solution.d.ts.map +1 -0
- package/build/plugins/solution/fx-solution/v2/solution.js +38 -0
- package/build/plugins/solution/fx-solution/v2/solution.js.map +1 -0
- package/build/plugins/solution/fx-solution/v2/utils.d.ts +11 -9
- package/build/plugins/solution/fx-solution/v2/utils.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/v2/utils.js +81 -1
- package/build/plugins/solution/fx-solution/v2/utils.js.map +1 -1
- package/package.json +8 -5
- package/resource/strings.json +2 -1
- package/templates/plugins/resource/bot/bicep/botConfiguration.template.bicep +0 -4
- package/templates/plugins/resource/bot/bicep/botProvision.template.bicep +0 -6
- package/templates/plugins/resource/bot/bicep/module.template.bicep +0 -4
- package/templates/plugins/resource/bot/bicep/output.template.bicep +0 -2
- package/templates/plugins/resource/bot/bicep/param.template.bicep +0 -2
- package/templates/plugins/resource/bot/bot-msgext.js.default.zip +0 -0
- package/templates/plugins/resource/bot/bot-msgext.ts.default.zip +0 -0
- package/templates/plugins/resource/bot/bot.js.default.zip +0 -0
- package/templates/plugins/resource/bot/bot.ts.default.zip +0 -0
- package/templates/plugins/resource/bot/msgext.js.default.zip +0 -0
- package/templates/plugins/resource/bot/msgext.ts.default.zip +0 -0
- package/templates/plugins/resource/frontend/bicep/frontendHosting.bicep +1 -1
- package/templates/plugins/resource/frontend/bicep/output.template.bicep +1 -1
- package/templates/plugins/resource/frontend/tab.js.default.zip +0 -0
- package/templates/plugins/resource/frontend/tab.ts.default.zip +0 -0
- package/templates/plugins/resource/function/bicep/functionProvision.template.bicep +1 -3
- package/templates/plugins/resource/function/bicep/output.template.bicep +1 -3
- package/templates/plugins/resource/function/function-base.js.default.zip +0 -0
- package/templates/plugins/resource/function/function-base.ts.default.zip +0 -0
- package/templates/plugins/resource/function/function-triggers.js.HTTPTrigger.zip +0 -0
- package/templates/plugins/resource/function/function-triggers.ts.HTTPTrigger.zip +0 -0
- package/templates/plugins/resource/spfx/solution/manifest_multi_env.json +62 -0
- package/build/core/loader.d.ts +0 -11
- package/build/core/loader.d.ts.map +0 -1
- package/build/core/loader.js +0 -17
- package/build/core/loader.js.map +0 -1
- package/build/core/middleware/contextInjecter.d.ts +0 -3
- package/build/core/middleware/contextInjecter.d.ts.map +0 -1
- package/build/core/middleware/contextInjecter.js.map +0 -1
- package/build/plugins/resource/bot/enums/wayToRegisterBot.d.ts +0 -5
- package/build/plugins/resource/bot/enums/wayToRegisterBot.d.ts.map +0 -1
- package/build/plugins/resource/bot/enums/wayToRegisterBot.js +0 -11
- package/build/plugins/resource/bot/enums/wayToRegisterBot.js.map +0 -1
- package/build/plugins/resource/bot/questions.d.ts +0 -4
- package/build/plugins/resource/bot/questions.d.ts.map +0 -1
- package/build/plugins/resource/bot/questions.js +0 -65
- package/build/plugins/resource/bot/questions.js.map +0 -1
- package/build/plugins/resource/function/utils/templates-fetch.d.ts +0 -10
- package/build/plugins/resource/function/utils/templates-fetch.d.ts.map +0 -1
- package/build/plugins/resource/function/utils/templates-fetch.js +0 -107
- package/build/plugins/resource/function/utils/templates-fetch.js.map +0 -1
|
@@ -8,30 +8,33 @@ const tslib_1 = require("tslib");
|
|
|
8
8
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
9
9
|
// Copyright (c) Microsoft Corporation.
|
|
10
10
|
// Licensed under the MIT license.
|
|
11
|
+
const lib_1 = require("@feathersjs/hooks/lib");
|
|
11
12
|
const teamsfx_api_1 = require("@microsoft/teamsfx-api");
|
|
12
|
-
const
|
|
13
|
-
const executor_1 = require("./executor");
|
|
14
|
-
const util_1 = require("./utils/util");
|
|
13
|
+
const axios_1 = tslib_1.__importDefault(require("axios"));
|
|
15
14
|
const fs = tslib_1.__importStar(require("fs-extra"));
|
|
16
|
-
const constants_1 = require("./constants");
|
|
17
|
-
const question_1 = require("./question");
|
|
18
15
|
const mustache_1 = tslib_1.__importDefault(require("mustache"));
|
|
19
16
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
17
|
+
const typedi_1 = require("typedi");
|
|
20
18
|
const util = tslib_1.__importStar(require("util"));
|
|
19
|
+
const constants_1 = require("../../../common/constants");
|
|
20
|
+
const localSettingsConstants_1 = require("../../../common/localSettingsConstants");
|
|
21
21
|
const tools_1 = require("../../../common/tools");
|
|
22
|
-
const
|
|
23
|
-
const resource_1 = require("../../resource");
|
|
22
|
+
const core_1 = require("../../../core");
|
|
24
23
|
const errorHandler_1 = require("../../../core/middleware/errorHandler");
|
|
25
|
-
const lib_1 = require("@feathersjs/hooks/lib");
|
|
26
|
-
const typedi_1 = require("typedi");
|
|
27
|
-
const arm_1 = require("./arm");
|
|
28
|
-
const constants_2 = require("../../../common/constants");
|
|
29
|
-
const localSettingsConstants_1 = require("../../../common/localSettingsConstants");
|
|
30
|
-
const scaffolding_1 = require("./v2/scaffolding");
|
|
31
24
|
const permissionRequest_1 = require("../../../core/permissionRequest");
|
|
32
|
-
const
|
|
25
|
+
const SolutionPluginContainer_1 = require("../../../core/SolutionPluginContainer");
|
|
26
|
+
const resource_1 = require("../../resource");
|
|
27
|
+
const arm_1 = require("./arm");
|
|
28
|
+
const commonQuestions_1 = require("./commonQuestions");
|
|
29
|
+
const constants_2 = require("./constants");
|
|
30
|
+
const executor_1 = require("./executor");
|
|
31
|
+
const question_1 = require("./question");
|
|
32
|
+
const ResourcePluginContainer_1 = require("./ResourcePluginContainer");
|
|
33
|
+
const util_1 = require("./utils/util");
|
|
33
34
|
const executeUserTask_1 = require("./v2/executeUserTask");
|
|
34
|
-
const
|
|
35
|
+
const utils_1 = require("./v2/utils");
|
|
36
|
+
const provision_1 = require("./v2/provision");
|
|
37
|
+
const scaffolding_1 = require("./v2/scaffolding");
|
|
35
38
|
// Maybe we need a state machine to track state transition.
|
|
36
39
|
var SolutionRunningState;
|
|
37
40
|
(function (SolutionRunningState) {
|
|
@@ -63,56 +66,10 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
63
66
|
}
|
|
64
67
|
assertSettingsNotEmpty(settings, key) {
|
|
65
68
|
if (!settings) {
|
|
66
|
-
return teamsfx_api_1.err(teamsfx_api_1.returnSystemError(new Error(`${key} is undefined`), "Solution",
|
|
69
|
+
return teamsfx_api_1.err(teamsfx_api_1.returnSystemError(new Error(`${key} is undefined`), "Solution", constants_2.SolutionError.InternelError));
|
|
67
70
|
}
|
|
68
71
|
return teamsfx_api_1.ok(settings);
|
|
69
72
|
}
|
|
70
|
-
fillInSolutionSettings(ctx) {
|
|
71
|
-
var _a;
|
|
72
|
-
const assertList = [
|
|
73
|
-
this.assertSettingsNotEmpty(ctx.answers, "answers"),
|
|
74
|
-
this.assertSettingsNotEmpty(ctx.projectSettings, "projectSettings"),
|
|
75
|
-
this.assertSettingsNotEmpty((_a = ctx === null || ctx === void 0 ? void 0 : ctx.projectSettings) === null || _a === void 0 ? void 0 : _a.solutionSettings, "solutionSettings"),
|
|
76
|
-
];
|
|
77
|
-
const assertRes = teamsfx_api_1.combine(assertList);
|
|
78
|
-
if (assertRes.isErr()) {
|
|
79
|
-
return teamsfx_api_1.err(assertRes.error);
|
|
80
|
-
}
|
|
81
|
-
const [answers, projectSettings, solutionSettingsSource] = assertRes.value;
|
|
82
|
-
const capabilities = answers[question_1.AzureSolutionQuestionNames.Capabilities] || [];
|
|
83
|
-
if (!capabilities || capabilities.length === 0) {
|
|
84
|
-
return teamsfx_api_1.err(teamsfx_api_1.returnSystemError(new Error("capabilities is empty"), "Solution", constants_1.SolutionError.InternelError));
|
|
85
|
-
}
|
|
86
|
-
let hostType = answers[question_1.AzureSolutionQuestionNames.HostType];
|
|
87
|
-
if (capabilities.includes(question_1.BotOptionItem.id) || capabilities.includes(question_1.MessageExtensionItem.id))
|
|
88
|
-
hostType = question_1.HostTypeOptionAzure.id;
|
|
89
|
-
if (!hostType) {
|
|
90
|
-
return teamsfx_api_1.err(teamsfx_api_1.returnSystemError(new Error("hostType is undefined"), "Solution", constants_1.SolutionError.InternelError));
|
|
91
|
-
}
|
|
92
|
-
let azureResources;
|
|
93
|
-
if (hostType === question_1.HostTypeOptionAzure.id && capabilities.includes(question_1.TabOptionItem.id)) {
|
|
94
|
-
azureResources = answers[question_1.AzureSolutionQuestionNames.AzureResources];
|
|
95
|
-
if (azureResources) {
|
|
96
|
-
if ((azureResources.includes(question_1.AzureResourceSQL.id) ||
|
|
97
|
-
azureResources.includes(question_1.AzureResourceApim.id)) &&
|
|
98
|
-
!azureResources.includes(question_1.AzureResourceFunction.id)) {
|
|
99
|
-
azureResources.push(question_1.AzureResourceFunction.id);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
else
|
|
103
|
-
azureResources = [];
|
|
104
|
-
}
|
|
105
|
-
const solutionSettings = {
|
|
106
|
-
name: solutionSettingsSource.name,
|
|
107
|
-
version: solutionSettingsSource.version,
|
|
108
|
-
hostType: hostType,
|
|
109
|
-
capabilities: capabilities,
|
|
110
|
-
azureResources: azureResources || [],
|
|
111
|
-
activeResourcePlugins: [],
|
|
112
|
-
};
|
|
113
|
-
projectSettings.solutionSettings = solutionSettings;
|
|
114
|
-
return teamsfx_api_1.ok(solutionSettings);
|
|
115
|
-
}
|
|
116
73
|
async fillInV1SolutionSettings(ctx) {
|
|
117
74
|
var _a;
|
|
118
75
|
const assertList = [
|
|
@@ -129,7 +86,7 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
129
86
|
projectSettings.programmingLanguage = isTypescriptProject ? "typescript" : "javascript";
|
|
130
87
|
const capability = answers[question_1.AzureSolutionQuestionNames.V1Capability];
|
|
131
88
|
if (!capability) {
|
|
132
|
-
return teamsfx_api_1.err(teamsfx_api_1.returnSystemError(new Error("capabilities is empty"), "Solution",
|
|
89
|
+
return teamsfx_api_1.err(teamsfx_api_1.returnSystemError(new Error("capabilities is empty"), "Solution", constants_2.SolutionError.InternelError));
|
|
133
90
|
}
|
|
134
91
|
const solutionSettings = {
|
|
135
92
|
name: solutionSettingsSource.name,
|
|
@@ -147,56 +104,59 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
147
104
|
* create
|
|
148
105
|
*/
|
|
149
106
|
async create(ctx) {
|
|
150
|
-
var _a, _b;
|
|
151
|
-
(_a = ctx.telemetryReporter) === null || _a === void 0 ? void 0 : _a.sendTelemetryEvent(
|
|
152
|
-
[
|
|
107
|
+
var _a, _b, _c, _d;
|
|
108
|
+
(_a = ctx.telemetryReporter) === null || _a === void 0 ? void 0 : _a.sendTelemetryEvent(constants_2.SolutionTelemetryEvent.CreateStart, {
|
|
109
|
+
[constants_2.SolutionTelemetryProperty.Component]: constants_2.SolutionTelemetryComponentName,
|
|
153
110
|
});
|
|
111
|
+
if (!ctx.projectSettings)
|
|
112
|
+
return teamsfx_api_1.err(new teamsfx_api_1.SystemError(constants_2.SolutionError.InternelError, "projectSettings undefined", "Solution"));
|
|
154
113
|
// ensure that global namespace is present
|
|
155
|
-
if (!ctx.envInfo.profile.has(
|
|
156
|
-
ctx.envInfo.profile.set(
|
|
114
|
+
if (!ctx.envInfo.profile.has(constants_2.GLOBAL_CONFIG)) {
|
|
115
|
+
ctx.envInfo.profile.set(constants_2.GLOBAL_CONFIG, new teamsfx_api_1.ConfigMap());
|
|
157
116
|
}
|
|
158
117
|
// Only non-SPFx project will ask this question.
|
|
159
118
|
const lang = ctx.answers[question_1.AzureSolutionQuestionNames.ProgrammingLanguage];
|
|
160
119
|
if (lang) {
|
|
161
120
|
ctx.projectSettings.programmingLanguage = lang;
|
|
162
121
|
}
|
|
163
|
-
const
|
|
122
|
+
const solutionSettings = ctx.projectSettings.solutionSettings;
|
|
123
|
+
const settingsRes = utils_1.fillInSolutionSettings(solutionSettings, ctx.answers);
|
|
164
124
|
if (settingsRes.isErr()) {
|
|
165
|
-
return teamsfx_api_1.err(util_1.sendErrorTelemetryThenReturnError(
|
|
125
|
+
return teamsfx_api_1.err(util_1.sendErrorTelemetryThenReturnError(constants_2.SolutionTelemetryEvent.Create, settingsRes.error, ctx.telemetryReporter));
|
|
166
126
|
}
|
|
167
|
-
const solutionSettings = settingsRes.value;
|
|
168
127
|
//Reload plugins according to user answers
|
|
169
128
|
await this.reloadPlugins(solutionSettings);
|
|
170
129
|
if (this.isAzureProject(ctx)) {
|
|
171
|
-
await fs.writeJSON(`${ctx.root}/permissions.json`,
|
|
172
|
-
(_b = ctx.telemetryReporter) === null || _b === void 0 ? void 0 : _b.sendTelemetryEvent(
|
|
173
|
-
[
|
|
174
|
-
[
|
|
175
|
-
[
|
|
176
|
-
[
|
|
130
|
+
await fs.writeJSON(`${ctx.root}/permissions.json`, constants_2.DEFAULT_PERMISSION_REQUEST, { spaces: 4 });
|
|
131
|
+
(_b = ctx.telemetryReporter) === null || _b === void 0 ? void 0 : _b.sendTelemetryEvent(constants_2.SolutionTelemetryEvent.Create, {
|
|
132
|
+
[constants_2.SolutionTelemetryProperty.Component]: constants_2.SolutionTelemetryComponentName,
|
|
133
|
+
[constants_2.SolutionTelemetryProperty.Success]: constants_2.SolutionTelemetrySuccess.Yes,
|
|
134
|
+
[constants_2.SolutionTelemetryProperty.Resources]: solutionSettings.azureResources.join(";"),
|
|
135
|
+
[constants_2.SolutionTelemetryProperty.Capabilities]: solutionSettings.capabilities.join(";"),
|
|
136
|
+
[constants_2.SolutionTelemetryProperty.ProgrammingLanguage]: (_d = (_c = ctx.projectSettings) === null || _c === void 0 ? void 0 : _c.programmingLanguage) !== null && _d !== void 0 ? _d : "",
|
|
177
137
|
});
|
|
178
138
|
}
|
|
179
|
-
return teamsfx_api_1.ok(
|
|
139
|
+
return teamsfx_api_1.ok(constants_2.Void);
|
|
180
140
|
}
|
|
181
141
|
// Migrate
|
|
182
142
|
async migrate(ctx) {
|
|
183
143
|
var _a, _b, _c, _d, _e;
|
|
184
|
-
(_a = ctx.telemetryReporter) === null || _a === void 0 ? void 0 : _a.sendTelemetryEvent(
|
|
185
|
-
[
|
|
144
|
+
(_a = ctx.telemetryReporter) === null || _a === void 0 ? void 0 : _a.sendTelemetryEvent(constants_2.SolutionTelemetryEvent.MigrateStart, {
|
|
145
|
+
[constants_2.SolutionTelemetryProperty.Component]: constants_2.SolutionTelemetryComponentName,
|
|
186
146
|
});
|
|
187
147
|
// ensure that global namespace is present
|
|
188
|
-
if (!ctx.envInfo.profile.has(
|
|
189
|
-
ctx.envInfo.profile.set(
|
|
148
|
+
if (!ctx.envInfo.profile.has(constants_2.GLOBAL_CONFIG)) {
|
|
149
|
+
ctx.envInfo.profile.set(constants_2.GLOBAL_CONFIG, new teamsfx_api_1.ConfigMap());
|
|
190
150
|
}
|
|
191
151
|
const settingsRes = await this.fillInV1SolutionSettings(ctx);
|
|
192
152
|
if (settingsRes.isErr()) {
|
|
193
|
-
return teamsfx_api_1.err(util_1.sendErrorTelemetryThenReturnError(
|
|
153
|
+
return teamsfx_api_1.err(util_1.sendErrorTelemetryThenReturnError(constants_2.SolutionTelemetryEvent.Migrate, settingsRes.error, ctx.telemetryReporter));
|
|
194
154
|
}
|
|
195
155
|
const solutionSettings = settingsRes.value;
|
|
196
156
|
const selectedPlugins = await this.reloadPlugins(solutionSettings);
|
|
197
157
|
const results = await Promise.all(selectedPlugins.map((migratePlugin) => {
|
|
198
158
|
return this.executeUserTask({
|
|
199
|
-
namespace: `${
|
|
159
|
+
namespace: `${constants_2.PluginNames.SOLUTION}/${migratePlugin.name}`,
|
|
200
160
|
method: "migrateV1Project",
|
|
201
161
|
params: {},
|
|
202
162
|
}, ctx);
|
|
@@ -212,12 +172,12 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
212
172
|
const azureResources = ((_c = ctx.projectSettings) === null || _c === void 0 ? void 0 : _c.solutionSettings)
|
|
213
173
|
.azureResources;
|
|
214
174
|
await scaffolding_1.scaffoldReadmeAndLocalSettings(capabilities, azureResources, ctx.root, true);
|
|
215
|
-
(_d = ctx.telemetryReporter) === null || _d === void 0 ? void 0 : _d.sendTelemetryEvent(
|
|
216
|
-
[
|
|
217
|
-
[
|
|
175
|
+
(_d = ctx.telemetryReporter) === null || _d === void 0 ? void 0 : _d.sendTelemetryEvent(constants_2.SolutionTelemetryEvent.Migrate, {
|
|
176
|
+
[constants_2.SolutionTelemetryProperty.Component]: constants_2.SolutionTelemetryComponentName,
|
|
177
|
+
[constants_2.SolutionTelemetryProperty.Success]: constants_2.SolutionTelemetrySuccess.Yes,
|
|
218
178
|
});
|
|
219
179
|
(_e = ctx.ui) === null || _e === void 0 ? void 0 : _e.showMessage("info", `Success: ${tools_1.getStrings().solution.MigrateSuccessNotice}`, false);
|
|
220
|
-
return teamsfx_api_1.ok(
|
|
180
|
+
return teamsfx_api_1.ok(constants_2.Void);
|
|
221
181
|
}
|
|
222
182
|
reloadPlugins(solutionSettings) {
|
|
223
183
|
const res = ResourcePluginContainer_1.getActivatedResourcePlugins(solutionSettings);
|
|
@@ -237,7 +197,7 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
237
197
|
}
|
|
238
198
|
async update(ctx) {
|
|
239
199
|
var _a;
|
|
240
|
-
const v1Blocked =
|
|
200
|
+
const v1Blocked = utils_1.blockV1Project((_a = ctx.projectSettings) === null || _a === void 0 ? void 0 : _a.solutionSettings);
|
|
241
201
|
if (v1Blocked.isErr()) {
|
|
242
202
|
return v1Blocked;
|
|
243
203
|
}
|
|
@@ -288,29 +248,29 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
288
248
|
.azureResources;
|
|
289
249
|
await scaffolding_1.scaffoldReadmeAndLocalSettings(capabilities, azureResources, ctx.root);
|
|
290
250
|
}
|
|
291
|
-
if (tools_1.isArmSupportEnabled() && generateResourceTemplate) {
|
|
251
|
+
if (tools_1.isArmSupportEnabled() && generateResourceTemplate && this.isAzureProject(ctx)) {
|
|
292
252
|
return await arm_1.generateArmTemplate(ctx);
|
|
293
253
|
}
|
|
294
254
|
else {
|
|
295
255
|
return res;
|
|
296
256
|
}
|
|
297
257
|
}
|
|
298
|
-
async
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
258
|
+
async createEnv(ctx) {
|
|
259
|
+
if (tools_1.isArmSupportEnabled() &&
|
|
260
|
+
utils_1.isAzureProject(ctx.projectSettings.solutionSettings)) {
|
|
261
|
+
try {
|
|
262
|
+
if (ctx.answers.copy === true) {
|
|
263
|
+
await arm_1.copyParameterJson(ctx, ctx.answers.targetEnvName, ctx.answers.sourceEnvName);
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
await arm_1.getParameterJson(ctx);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
catch (e) {
|
|
270
|
+
return teamsfx_api_1.err(core_1.CopyFileError(e));
|
|
271
|
+
}
|
|
312
272
|
}
|
|
313
|
-
return teamsfx_api_1.ok(
|
|
273
|
+
return teamsfx_api_1.ok(constants_2.Void);
|
|
314
274
|
}
|
|
315
275
|
/**
|
|
316
276
|
* Checks whether solution's state is idle
|
|
@@ -318,24 +278,18 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
318
278
|
checkWhetherSolutionIsIdle() {
|
|
319
279
|
switch (this.runningState) {
|
|
320
280
|
case SolutionRunningState.Idle:
|
|
321
|
-
return teamsfx_api_1.ok(
|
|
281
|
+
return teamsfx_api_1.ok(constants_2.Void);
|
|
322
282
|
case SolutionRunningState.ProvisionInProgress:
|
|
323
|
-
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error("Provision in progress. Please wait for its completion."), "Solution",
|
|
283
|
+
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error("Provision in progress. Please wait for its completion."), "Solution", constants_2.SolutionError.ProvisionInProgress));
|
|
324
284
|
case SolutionRunningState.DeployInProgress:
|
|
325
|
-
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error("Deployment in progress. Please wait for its completion."), "Solution",
|
|
285
|
+
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error("Deployment in progress. Please wait for its completion."), "Solution", constants_2.SolutionError.DeploymentInProgress));
|
|
326
286
|
case SolutionRunningState.PublishInProgress:
|
|
327
|
-
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error("Publish in progress. Please wait for its completion."), "Solution",
|
|
287
|
+
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error("Publish in progress. Please wait for its completion."), "Solution", constants_2.SolutionError.PublishInProgress));
|
|
328
288
|
}
|
|
329
289
|
}
|
|
330
290
|
checkWetherProvisionSucceeded(solutionConfig) {
|
|
331
291
|
var _a;
|
|
332
|
-
return !!((_a = solutionConfig.get(
|
|
333
|
-
}
|
|
334
|
-
blockV1Project(solutionSettings) {
|
|
335
|
-
if (solutionSettings === null || solutionSettings === void 0 ? void 0 : solutionSettings.migrateFromV1) {
|
|
336
|
-
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error("Command is not supported in Teams Toolkit V1 Project"), "Solution", constants_1.SolutionError.V1ProjectNotSupported));
|
|
337
|
-
}
|
|
338
|
-
return teamsfx_api_1.ok(null);
|
|
292
|
+
return !!((_a = solutionConfig.get(constants_2.GLOBAL_CONFIG)) === null || _a === void 0 ? void 0 : _a.getBoolean(constants_2.SOLUTION_PROVISION_SUCCEEDED));
|
|
339
293
|
}
|
|
340
294
|
/**
|
|
341
295
|
* Provision resources. It can only run in a non-SPFx project when solution's running state is Idle.
|
|
@@ -343,8 +297,8 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
343
297
|
*
|
|
344
298
|
*/
|
|
345
299
|
async provision(ctx) {
|
|
346
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
347
|
-
const v1Blocked =
|
|
300
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
301
|
+
const v1Blocked = utils_1.blockV1Project((_a = ctx.projectSettings) === null || _a === void 0 ? void 0 : _a.solutionSettings);
|
|
348
302
|
if (v1Blocked.isErr()) {
|
|
349
303
|
return v1Blocked;
|
|
350
304
|
}
|
|
@@ -359,23 +313,26 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
359
313
|
await ((_b = ctx.appStudioToken) === null || _b === void 0 ? void 0 : _b.getAccessToken());
|
|
360
314
|
this.runningState = SolutionRunningState.ProvisionInProgress;
|
|
361
315
|
if (this.isAzureProject(ctx)) {
|
|
362
|
-
|
|
316
|
+
if (ctx.permissionRequestProvider === undefined) {
|
|
317
|
+
ctx.permissionRequestProvider = new permissionRequest_1.PermissionRequestFileProvider(ctx.root);
|
|
318
|
+
}
|
|
319
|
+
const result = await utils_1.ensurePermissionRequest((_c = ctx.projectSettings) === null || _c === void 0 ? void 0 : _c.solutionSettings, ctx.permissionRequestProvider);
|
|
363
320
|
if (result.isErr()) {
|
|
364
321
|
return result;
|
|
365
322
|
}
|
|
366
323
|
}
|
|
367
324
|
const provisionResult = await this.doProvision(ctx);
|
|
368
325
|
if (provisionResult.isOk()) {
|
|
369
|
-
const msg = util.format(`Success: ${tools_1.getStrings().solution.ProvisionSuccessNotice}`, (
|
|
370
|
-
(
|
|
371
|
-
(
|
|
372
|
-
(
|
|
326
|
+
const msg = util.format(`Success: ${tools_1.getStrings().solution.ProvisionSuccessNotice}`, (_d = ctx.projectSettings) === null || _d === void 0 ? void 0 : _d.appName);
|
|
327
|
+
(_e = ctx.logProvider) === null || _e === void 0 ? void 0 : _e.info(msg);
|
|
328
|
+
(_f = ctx.ui) === null || _f === void 0 ? void 0 : _f.showMessage("info", msg, false);
|
|
329
|
+
(_g = ctx.envInfo.profile.get(constants_2.GLOBAL_CONFIG)) === null || _g === void 0 ? void 0 : _g.set(constants_2.SOLUTION_PROVISION_SUCCEEDED, true);
|
|
373
330
|
}
|
|
374
331
|
else {
|
|
375
332
|
if (!tools_1.isUserCancelError(provisionResult.error)) {
|
|
376
|
-
const msg = util.format(tools_1.getStrings().solution.ProvisionFailNotice, (
|
|
377
|
-
(
|
|
378
|
-
(
|
|
333
|
+
const msg = util.format(tools_1.getStrings().solution.ProvisionFailNotice, (_h = ctx.projectSettings) === null || _h === void 0 ? void 0 : _h.appName);
|
|
334
|
+
(_j = ctx.logProvider) === null || _j === void 0 ? void 0 : _j.error(msg);
|
|
335
|
+
(_k = ctx.envInfo.profile.get(constants_2.GLOBAL_CONFIG)) === null || _k === void 0 ? void 0 : _k.set(constants_2.SOLUTION_PROVISION_SUCCEEDED, false);
|
|
379
336
|
}
|
|
380
337
|
}
|
|
381
338
|
return provisionResult;
|
|
@@ -388,7 +345,7 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
388
345
|
* provision
|
|
389
346
|
*/
|
|
390
347
|
async doProvision(ctx) {
|
|
391
|
-
var _a
|
|
348
|
+
var _a;
|
|
392
349
|
const maybeSelectedPlugins = this.getSelectedPlugins(ctx);
|
|
393
350
|
if (maybeSelectedPlugins.isErr()) {
|
|
394
351
|
return maybeSelectedPlugins;
|
|
@@ -401,34 +358,9 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
401
358
|
if (res.isErr()) {
|
|
402
359
|
return res;
|
|
403
360
|
}
|
|
404
|
-
const
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
const subscriptionInfo = await ((_c = ctx.azureAccountProvider) === null || _c === void 0 ? void 0 : _c.getSelectedSubscription());
|
|
408
|
-
const subscriptionId = subscriptionInfo === null || subscriptionInfo === void 0 ? void 0 : subscriptionInfo.subscriptionId;
|
|
409
|
-
const subscriptionName = subscriptionInfo === null || subscriptionInfo === void 0 ? void 0 : subscriptionInfo.subscriptionName;
|
|
410
|
-
const msg = util.format(tools_1.getStrings().solution.ProvisionConfirmNotice, username, subscriptionName ? subscriptionName : subscriptionId);
|
|
411
|
-
let confirmRes = undefined;
|
|
412
|
-
if (tools_1.isMultiEnvEnabled()) {
|
|
413
|
-
const msgNew = util.format(tools_1.getStrings().solution.ProvisionConfirmEnvNotice, ctx.projectSettings.activeEnvironment, username, subscriptionName ? subscriptionName : subscriptionId);
|
|
414
|
-
confirmRes = await ((_d = ctx.ui) === null || _d === void 0 ? void 0 : _d.showMessage("warn", msgNew, true, "Provision", "Switch environment", "Pricing calculator"));
|
|
415
|
-
}
|
|
416
|
-
else {
|
|
417
|
-
confirmRes = await ((_e = ctx.ui) === null || _e === void 0 ? void 0 : _e.showMessage("warn", msg, true, "Provision", "Pricing calculator"));
|
|
418
|
-
}
|
|
419
|
-
const confirm = (confirmRes === null || confirmRes === void 0 ? void 0 : confirmRes.isOk()) ? confirmRes.value : undefined;
|
|
420
|
-
if (confirm !== "Provision") {
|
|
421
|
-
if (confirm === "Pricing calculator") {
|
|
422
|
-
(_f = ctx.ui) === null || _f === void 0 ? void 0 : _f.openUrl("https://azure.microsoft.com/en-us/pricing/calculator/");
|
|
423
|
-
}
|
|
424
|
-
else if (confirm === "Switch environment") {
|
|
425
|
-
const envName = await envInfoLoader_1.askTargetEnvironment(ctx, ctx.answers);
|
|
426
|
-
if (envName) {
|
|
427
|
-
ctx.projectSettings.activeEnvironment = envName;
|
|
428
|
-
(_g = ctx.ui) === null || _g === void 0 ? void 0 : _g.showMessage("info", `[${envName}] is activated.`, false);
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error(tools_1.getStrings().solution.CancelProvision), "Solution", tools_1.getStrings().solution.CancelProvision));
|
|
361
|
+
const consentResult = await provision_1.askForProvisionConsent(ctx);
|
|
362
|
+
if (consentResult.isErr()) {
|
|
363
|
+
return consentResult;
|
|
432
364
|
}
|
|
433
365
|
}
|
|
434
366
|
const pluginsWithCtx = this.getPluginAndContextArray(ctx, selectedPlugins);
|
|
@@ -446,21 +378,23 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
446
378
|
});
|
|
447
379
|
return executor_1.executeLifecycles(preProvisionWithCtx, provisionWithCtx, postProvisionWithCtx, async () => {
|
|
448
380
|
var _a;
|
|
449
|
-
(_a = ctx.logProvider) === null || _a === void 0 ? void 0 : _a.info(util.format(tools_1.getStrings().solution.ProvisionStartNotice,
|
|
381
|
+
(_a = ctx.logProvider) === null || _a === void 0 ? void 0 : _a.info(util.format(tools_1.getStrings().solution.ProvisionStartNotice, constants_1.PluginDisplayName.Solution));
|
|
450
382
|
return teamsfx_api_1.ok(undefined);
|
|
451
383
|
}, async (provisionResults) => {
|
|
452
384
|
var _a;
|
|
453
|
-
if (
|
|
454
|
-
provisionWithCtx.
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
(
|
|
460
|
-
|
|
385
|
+
if (!tools_1.isMultiEnvEnabled()) {
|
|
386
|
+
if (provisionWithCtx.length === (provisionResults === null || provisionResults === void 0 ? void 0 : provisionResults.length)) {
|
|
387
|
+
provisionWithCtx.map(function (plugin, index) {
|
|
388
|
+
var _a;
|
|
389
|
+
if (plugin[2] === constants_2.PluginNames.APPST) {
|
|
390
|
+
const teamsAppResult = provisionResults[index];
|
|
391
|
+
if (teamsAppResult.isOk()) {
|
|
392
|
+
(_a = ctx.envInfo.profile
|
|
393
|
+
.get(constants_2.GLOBAL_CONFIG)) === null || _a === void 0 ? void 0 : _a.set(constants_2.REMOTE_TEAMS_APP_ID, teamsAppResult.value);
|
|
394
|
+
}
|
|
461
395
|
}
|
|
462
|
-
}
|
|
463
|
-
}
|
|
396
|
+
});
|
|
397
|
+
}
|
|
464
398
|
}
|
|
465
399
|
if (provisionResults) {
|
|
466
400
|
for (const result of provisionResults) {
|
|
@@ -469,7 +403,7 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
469
403
|
}
|
|
470
404
|
}
|
|
471
405
|
}
|
|
472
|
-
(_a = ctx.logProvider) === null || _a === void 0 ? void 0 : _a.info(util.format(tools_1.getStrings().solution.ProvisionFinishNotice,
|
|
406
|
+
(_a = ctx.logProvider) === null || _a === void 0 ? void 0 : _a.info(util.format(tools_1.getStrings().solution.ProvisionFinishNotice, constants_1.PluginDisplayName.Solution));
|
|
473
407
|
if (tools_1.isArmSupportEnabled() && this.isAzureProject(ctx)) {
|
|
474
408
|
const armDeploymentResult = await arm_1.deployArmTemplates(ctx);
|
|
475
409
|
if (armDeploymentResult.isErr()) {
|
|
@@ -479,7 +413,7 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
479
413
|
const aadPlugin = this.AadPlugin;
|
|
480
414
|
if (selectedPlugins.some((plugin) => plugin.name === aadPlugin.name)) {
|
|
481
415
|
return await aadPlugin.executeUserTask({
|
|
482
|
-
namespace: `${
|
|
416
|
+
namespace: `${constants_2.PluginNames.SOLUTION}/${constants_2.PluginNames.AAD}`,
|
|
483
417
|
method: "setApplicationInContext",
|
|
484
418
|
params: { isLocal: false },
|
|
485
419
|
}, util_1.getPluginContext(ctx, aadPlugin.name));
|
|
@@ -487,21 +421,21 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
487
421
|
return teamsfx_api_1.ok(undefined);
|
|
488
422
|
}, async () => {
|
|
489
423
|
var _a, _b;
|
|
490
|
-
(_a = ctx.envInfo.profile.get(
|
|
491
|
-
(_b = ctx.logProvider) === null || _b === void 0 ? void 0 : _b.info(util.format(tools_1.getStrings().solution.ConfigurationFinishNotice,
|
|
424
|
+
(_a = ctx.envInfo.profile.get(constants_2.GLOBAL_CONFIG)) === null || _a === void 0 ? void 0 : _a.delete(constants_2.ARM_TEMPLATE_OUTPUT);
|
|
425
|
+
(_b = ctx.logProvider) === null || _b === void 0 ? void 0 : _b.info(util.format(tools_1.getStrings().solution.ConfigurationFinishNotice, constants_1.PluginDisplayName.Solution));
|
|
492
426
|
return teamsfx_api_1.ok(undefined);
|
|
493
427
|
});
|
|
494
428
|
}
|
|
495
429
|
async deploy(ctx) {
|
|
496
430
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
497
|
-
const v1Blocked =
|
|
431
|
+
const v1Blocked = utils_1.blockV1Project((_a = ctx.projectSettings) === null || _a === void 0 ? void 0 : _a.solutionSettings);
|
|
498
432
|
if (v1Blocked.isErr()) {
|
|
499
433
|
return v1Blocked;
|
|
500
434
|
}
|
|
501
435
|
const isAzureProject = this.isAzureProject(ctx);
|
|
502
436
|
const provisioned = this.checkWetherProvisionSucceeded(ctx.envInfo.profile);
|
|
503
437
|
if (isAzureProject && !provisioned) {
|
|
504
|
-
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error(util.format(tools_1.getStrings().solution.NotProvisionedNotice, (_b = ctx.projectSettings) === null || _b === void 0 ? void 0 : _b.appName)), "Solution",
|
|
438
|
+
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error(util.format(tools_1.getStrings().solution.NotProvisionedNotice, (_b = ctx.projectSettings) === null || _b === void 0 ? void 0 : _b.appName)), "Solution", constants_2.SolutionError.CannotDeployBeforeProvision));
|
|
505
439
|
}
|
|
506
440
|
try {
|
|
507
441
|
if (this.isAzureProject(ctx)) {
|
|
@@ -540,7 +474,7 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
540
474
|
}
|
|
541
475
|
const optionsToDeploy = ctx.answers[question_1.AzureSolutionQuestionNames.PluginSelectionDeploy];
|
|
542
476
|
if (optionsToDeploy === undefined || optionsToDeploy.length === 0) {
|
|
543
|
-
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error(`No plugin selected`), "Solution",
|
|
477
|
+
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error(`No plugin selected`), "Solution", constants_2.SolutionError.NoResourcePluginSelected));
|
|
544
478
|
}
|
|
545
479
|
const pluginMap = ResourcePluginContainer_1.getAllResourcePluginMap();
|
|
546
480
|
const pluginsToDeploy = [];
|
|
@@ -550,7 +484,7 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
550
484
|
pluginsToDeploy.push(filtered);
|
|
551
485
|
}
|
|
552
486
|
}
|
|
553
|
-
(_a = ctx.logProvider) === null || _a === void 0 ? void 0 : _a.info(util.format(tools_1.getStrings().solution.SelectedPluginsToDeployNotice,
|
|
487
|
+
(_a = ctx.logProvider) === null || _a === void 0 ? void 0 : _a.info(util.format(tools_1.getStrings().solution.SelectedPluginsToDeployNotice, constants_1.PluginDisplayName.Solution, JSON.stringify(pluginsToDeploy.map((p) => p.name))));
|
|
554
488
|
if (this.isAzureProject(ctx)) {
|
|
555
489
|
//make sure sub is selected
|
|
556
490
|
await ((_b = ctx.azureAccountProvider) === null || _b === void 0 ? void 0 : _b.getSelectedSubscription(true));
|
|
@@ -568,12 +502,12 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
568
502
|
var _a;
|
|
569
503
|
return [(_a = plugin === null || plugin === void 0 ? void 0 : plugin.postDeploy) === null || _a === void 0 ? void 0 : _a.bind(plugin), context, plugin.name];
|
|
570
504
|
});
|
|
571
|
-
(_c = ctx.logProvider) === null || _c === void 0 ? void 0 : _c.info(util.format(tools_1.getStrings().solution.DeployStartNotice,
|
|
505
|
+
(_c = ctx.logProvider) === null || _c === void 0 ? void 0 : _c.info(util.format(tools_1.getStrings().solution.DeployStartNotice, constants_1.PluginDisplayName.Solution));
|
|
572
506
|
return executor_1.executeLifecycles(preDeployWithCtx, deployWithCtx, postDeployWithCtx);
|
|
573
507
|
}
|
|
574
508
|
async publish(ctx) {
|
|
575
509
|
var _a, _b, _c, _d, _e;
|
|
576
|
-
const v1Blocked =
|
|
510
|
+
const v1Blocked = utils_1.blockV1Project((_a = ctx.projectSettings) === null || _a === void 0 ? void 0 : _a.solutionSettings);
|
|
577
511
|
if (v1Blocked.isErr()) {
|
|
578
512
|
return v1Blocked;
|
|
579
513
|
}
|
|
@@ -583,7 +517,7 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
583
517
|
const isAzureProject = this.isAzureProject(ctx);
|
|
584
518
|
const provisioned = this.checkWetherProvisionSucceeded(ctx.envInfo.profile);
|
|
585
519
|
if (!provisioned) {
|
|
586
|
-
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error(util.format(tools_1.getStrings().solution.NotProvisionedNotice, (_b = ctx.projectSettings) === null || _b === void 0 ? void 0 : _b.appName)), "Solution",
|
|
520
|
+
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error(util.format(tools_1.getStrings().solution.NotProvisionedNotice, (_b = ctx.projectSettings) === null || _b === void 0 ? void 0 : _b.appName)), "Solution", constants_2.SolutionError.CannotPublishBeforeProvision));
|
|
587
521
|
}
|
|
588
522
|
try {
|
|
589
523
|
this.runningState = SolutionRunningState.PublishInProgress;
|
|
@@ -594,7 +528,7 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
594
528
|
var _a;
|
|
595
529
|
return [(_a = plugin === null || plugin === void 0 ? void 0 : plugin.publish) === null || _a === void 0 ? void 0 : _a.bind(plugin), context, plugin.name];
|
|
596
530
|
});
|
|
597
|
-
(_c = ctx.logProvider) === null || _c === void 0 ? void 0 : _c.info(util.format(tools_1.getStrings().solution.PublishStartNotice,
|
|
531
|
+
(_c = ctx.logProvider) === null || _c === void 0 ? void 0 : _c.info(util.format(tools_1.getStrings().solution.PublishStartNotice, constants_1.PluginDisplayName.Solution));
|
|
598
532
|
const results = await executor_1.executeConcurrently("", publishWithCtx);
|
|
599
533
|
for (const result of results) {
|
|
600
534
|
if (result.isErr()) {
|
|
@@ -728,9 +662,9 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
728
662
|
}
|
|
729
663
|
else if (stage === teamsfx_api_1.Stage.provision) {
|
|
730
664
|
if (isDynamicQuestion) {
|
|
731
|
-
const v1Blocked =
|
|
665
|
+
const v1Blocked = utils_1.blockV1Project((_a = ctx.projectSettings) === null || _a === void 0 ? void 0 : _a.solutionSettings);
|
|
732
666
|
if (v1Blocked.isErr()) {
|
|
733
|
-
return v1Blocked;
|
|
667
|
+
return teamsfx_api_1.err(v1Blocked.error);
|
|
734
668
|
}
|
|
735
669
|
const provisioned = this.checkWetherProvisionSucceeded(ctx.envInfo.profile);
|
|
736
670
|
if (provisioned)
|
|
@@ -765,21 +699,21 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
765
699
|
}
|
|
766
700
|
else if (stage === teamsfx_api_1.Stage.deploy) {
|
|
767
701
|
if (isDynamicQuestion) {
|
|
768
|
-
const v1Blocked =
|
|
702
|
+
const v1Blocked = utils_1.blockV1Project((_b = ctx.projectSettings) === null || _b === void 0 ? void 0 : _b.solutionSettings);
|
|
769
703
|
if (v1Blocked.isErr()) {
|
|
770
|
-
return v1Blocked;
|
|
704
|
+
return teamsfx_api_1.err(v1Blocked.error);
|
|
771
705
|
}
|
|
772
706
|
const isAzureProject = this.isAzureProject(ctx);
|
|
773
707
|
const provisioned = this.checkWetherProvisionSucceeded(ctx.envInfo.profile);
|
|
774
708
|
if (isAzureProject && !provisioned) {
|
|
775
|
-
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error(tools_1.getStrings().solution.FailedToDeployBeforeProvision), "Solution",
|
|
709
|
+
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error(tools_1.getStrings().solution.FailedToDeployBeforeProvision), "Solution", constants_2.SolutionError.CannotDeployBeforeProvision));
|
|
776
710
|
}
|
|
777
711
|
}
|
|
778
712
|
let pluginsToDeploy;
|
|
779
713
|
if (isDynamicQuestion) {
|
|
780
714
|
const res = this.getSelectedPlugins(ctx);
|
|
781
715
|
if (res.isErr()) {
|
|
782
|
-
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error("No resource to deploy"), "Solution",
|
|
716
|
+
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error("No resource to deploy"), "Solution", constants_2.SolutionError.NoResourceToDeploy));
|
|
783
717
|
}
|
|
784
718
|
pluginsToDeploy = res.value.filter((plugin) => !!plugin.deploy);
|
|
785
719
|
}
|
|
@@ -788,7 +722,7 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
788
722
|
pluginsToDeploy = allPlugins.filter((plugin) => !!plugin.deploy);
|
|
789
723
|
}
|
|
790
724
|
if (pluginsToDeploy.length === 0) {
|
|
791
|
-
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error("No resource to deploy"), "Solution",
|
|
725
|
+
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error("No resource to deploy"), "Solution", constants_2.SolutionError.NoResourceToDeploy));
|
|
792
726
|
}
|
|
793
727
|
const pluginPrefix = "fx-resource-";
|
|
794
728
|
const options = pluginsToDeploy.map((plugin) => {
|
|
@@ -821,22 +755,22 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
821
755
|
}
|
|
822
756
|
else if (stage === teamsfx_api_1.Stage.publish) {
|
|
823
757
|
if (isDynamicQuestion) {
|
|
824
|
-
const v1Blocked =
|
|
758
|
+
const v1Blocked = utils_1.blockV1Project((_c = ctx.projectSettings) === null || _c === void 0 ? void 0 : _c.solutionSettings);
|
|
825
759
|
if (v1Blocked.isErr()) {
|
|
826
|
-
return v1Blocked;
|
|
760
|
+
return teamsfx_api_1.err(v1Blocked.error);
|
|
827
761
|
}
|
|
828
762
|
const isAzureProject = this.isAzureProject(ctx);
|
|
829
763
|
const provisioned = this.checkWetherProvisionSucceeded(ctx.envInfo.profile);
|
|
830
764
|
if (isAzureProject && !provisioned) {
|
|
831
|
-
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error(tools_1.getStrings().solution.FailedToPublishBeforeProvision), "Solution",
|
|
765
|
+
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error(tools_1.getStrings().solution.FailedToPublishBeforeProvision), "Solution", constants_2.SolutionError.CannotPublishBeforeProvision));
|
|
832
766
|
}
|
|
833
767
|
if (!provisioned && this.spfxSelected(ctx)) {
|
|
834
768
|
if (((_d = ctx.answers) === null || _d === void 0 ? void 0 : _d.platform) === teamsfx_api_1.Platform.VSCode) {
|
|
835
769
|
(_e = ctx.ui) === null || _e === void 0 ? void 0 : _e.showMessage("error", tools_1.getStrings().solution.SPFxAskProvisionBeforePublish, false);
|
|
836
|
-
throw
|
|
770
|
+
throw constants_2.CancelError;
|
|
837
771
|
}
|
|
838
772
|
else {
|
|
839
|
-
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error(tools_1.getStrings().solution.SPFxAskProvisionBeforePublish), "Solution",
|
|
773
|
+
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error(tools_1.getStrings().solution.SPFxAskProvisionBeforePublish), "Solution", constants_2.SolutionError.CannotPublishBeforeProvision));
|
|
840
774
|
}
|
|
841
775
|
}
|
|
842
776
|
}
|
|
@@ -854,95 +788,143 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
854
788
|
}
|
|
855
789
|
}
|
|
856
790
|
}
|
|
791
|
+
else if (stage === teamsfx_api_1.Stage.grantPermission) {
|
|
792
|
+
node.addChild(new teamsfx_api_1.QTreeNode(question_1.GetUserEmailQuestion));
|
|
793
|
+
}
|
|
857
794
|
return teamsfx_api_1.ok(node);
|
|
858
795
|
}
|
|
859
796
|
async localDebug(ctx) {
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
797
|
+
var _a;
|
|
798
|
+
try {
|
|
799
|
+
if (!this.spfxSelected(ctx)) {
|
|
800
|
+
if (ctx.permissionRequestProvider === undefined) {
|
|
801
|
+
ctx.permissionRequestProvider = new permissionRequest_1.PermissionRequestFileProvider(ctx.root);
|
|
802
|
+
}
|
|
803
|
+
const result = await utils_1.ensurePermissionRequest((_a = ctx.projectSettings) === null || _a === void 0 ? void 0 : _a.solutionSettings, ctx.permissionRequestProvider);
|
|
804
|
+
if (result.isErr()) {
|
|
805
|
+
return result;
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
catch (e) {
|
|
810
|
+
if (e instanceof teamsfx_api_1.UserError || e instanceof teamsfx_api_1.SystemError) {
|
|
811
|
+
return teamsfx_api_1.err(e);
|
|
812
|
+
}
|
|
813
|
+
return teamsfx_api_1.err(new teamsfx_api_1.SystemError("UnknownError", "check point 1 - " + JSON.stringify(e), "Solution"));
|
|
863
814
|
}
|
|
864
815
|
return await this.doLocalDebug(ctx);
|
|
865
816
|
}
|
|
866
817
|
async doLocalDebug(ctx) {
|
|
867
818
|
var _a, _b;
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
819
|
+
let checkPoint = 1;
|
|
820
|
+
try {
|
|
821
|
+
//check point 2
|
|
822
|
+
const maybeSelectedPlugins = this.getSelectedPlugins(ctx);
|
|
823
|
+
if (maybeSelectedPlugins.isErr()) {
|
|
824
|
+
return maybeSelectedPlugins;
|
|
825
|
+
}
|
|
826
|
+
const selectedPlugins = maybeSelectedPlugins.value;
|
|
827
|
+
checkPoint = 2;
|
|
828
|
+
//check point 3
|
|
829
|
+
// Just to trigger M365 login before the concurrent execution of localDebug.
|
|
830
|
+
// Because concurrent exectution of localDebug may getAccessToken() concurrently, which
|
|
831
|
+
// causes 2 M365 logins before the token caching in common lib takes effect.
|
|
832
|
+
await ((_a = ctx.appStudioToken) === null || _a === void 0 ? void 0 : _a.getAccessToken());
|
|
833
|
+
checkPoint = 3;
|
|
834
|
+
//check point 4
|
|
835
|
+
const pluginsWithCtx = this.getPluginAndContextArray(ctx, selectedPlugins);
|
|
836
|
+
const localDebugWithCtx = pluginsWithCtx.map(([plugin, context]) => {
|
|
837
|
+
var _a;
|
|
838
|
+
return [(_a = plugin === null || plugin === void 0 ? void 0 : plugin.localDebug) === null || _a === void 0 ? void 0 : _a.bind(plugin), context, plugin.name];
|
|
839
|
+
});
|
|
840
|
+
const postLocalDebugWithCtx = pluginsWithCtx.map(([plugin, context]) => {
|
|
841
|
+
var _a;
|
|
842
|
+
return [(_a = plugin === null || plugin === void 0 ? void 0 : plugin.postLocalDebug) === null || _a === void 0 ? void 0 : _a.bind(plugin), context, plugin.name];
|
|
843
|
+
});
|
|
844
|
+
const localDebugResults = await executor_1.executeConcurrently("", localDebugWithCtx);
|
|
845
|
+
for (const localDebugResult of localDebugResults) {
|
|
846
|
+
if (localDebugResult.isErr()) {
|
|
847
|
+
return localDebugResult;
|
|
848
|
+
}
|
|
890
849
|
}
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
850
|
+
checkPoint = 4;
|
|
851
|
+
//check point 5
|
|
852
|
+
if (!this.spfxSelected(ctx)) {
|
|
853
|
+
const aadPlugin = this.AadPlugin;
|
|
854
|
+
if (selectedPlugins.some((plugin) => plugin.name === aadPlugin.name)) {
|
|
855
|
+
const result = await aadPlugin.executeUserTask({
|
|
856
|
+
namespace: `${constants_2.PluginNames.SOLUTION}/${constants_2.PluginNames.AAD}`,
|
|
857
|
+
method: "setApplicationInContext",
|
|
858
|
+
params: { isLocal: true },
|
|
859
|
+
}, util_1.getPluginContext(ctx, aadPlugin.name));
|
|
860
|
+
if (result.isErr()) {
|
|
861
|
+
return result;
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
checkPoint = 5;
|
|
866
|
+
// check point 6
|
|
867
|
+
// set local debug Teams app tenant id in context.
|
|
868
|
+
const result = this.loadTeamsAppTenantId(ctx, true, await ((_b = ctx.appStudioToken) === null || _b === void 0 ? void 0 : _b.getJsonObject()));
|
|
899
869
|
if (result.isErr()) {
|
|
900
870
|
return result;
|
|
901
871
|
}
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
.get(constants_1.GLOBAL_CONFIG)) === null || _b === void 0 ? void 0 : _b.set(constants_1.LOCAL_DEBUG_TEAMS_APP_ID, combinedPostLocalDebugResults.value[index]);
|
|
872
|
+
checkPoint = 6;
|
|
873
|
+
//check point 7
|
|
874
|
+
const postLocalDebugResults = await executor_1.executeConcurrently("post", postLocalDebugWithCtx);
|
|
875
|
+
const combinedPostLocalDebugResults = teamsfx_api_1.combine(postLocalDebugResults);
|
|
876
|
+
if (combinedPostLocalDebugResults.isErr()) {
|
|
877
|
+
return combinedPostLocalDebugResults;
|
|
878
|
+
}
|
|
879
|
+
checkPoint = 7;
|
|
880
|
+
//check point 8
|
|
881
|
+
// set local debug Teams app id in context.
|
|
882
|
+
if (postLocalDebugWithCtx.length === combinedPostLocalDebugResults.value.length) {
|
|
883
|
+
postLocalDebugWithCtx.map(function (plugin, index) {
|
|
884
|
+
var _a, _b;
|
|
885
|
+
if (plugin[2] === constants_2.PluginNames.APPST) {
|
|
886
|
+
if (tools_1.isMultiEnvEnabled()) {
|
|
887
|
+
(_a = ctx.localSettings) === null || _a === void 0 ? void 0 : _a.teamsApp.set(localSettingsConstants_1.LocalSettingsTeamsAppKeys.TeamsAppId, combinedPostLocalDebugResults.value[index]);
|
|
888
|
+
}
|
|
889
|
+
else {
|
|
890
|
+
(_b = ctx.envInfo.profile
|
|
891
|
+
.get(constants_2.GLOBAL_CONFIG)) === null || _b === void 0 ? void 0 : _b.set(constants_2.LOCAL_DEBUG_TEAMS_APP_ID, combinedPostLocalDebugResults.value[index]);
|
|
892
|
+
}
|
|
924
893
|
}
|
|
925
|
-
}
|
|
926
|
-
}
|
|
894
|
+
});
|
|
895
|
+
}
|
|
896
|
+
checkPoint = 8;
|
|
897
|
+
return teamsfx_api_1.ok(constants_2.Void);
|
|
898
|
+
}
|
|
899
|
+
catch (e) {
|
|
900
|
+
if (e instanceof teamsfx_api_1.UserError || e instanceof teamsfx_api_1.SystemError) {
|
|
901
|
+
return teamsfx_api_1.err(e);
|
|
902
|
+
}
|
|
903
|
+
return teamsfx_api_1.err(new teamsfx_api_1.SystemError("UnknownError", `check point ${checkPoint} - ${JSON.stringify(e)}`, "Solution"));
|
|
927
904
|
}
|
|
928
|
-
return teamsfx_api_1.ok(constants_1.Void);
|
|
929
905
|
}
|
|
930
906
|
async grantPermission(ctx) {
|
|
931
907
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
932
|
-
(_a = ctx.telemetryReporter) === null || _a === void 0 ? void 0 : _a.sendTelemetryEvent(
|
|
933
|
-
[
|
|
908
|
+
(_a = ctx.telemetryReporter) === null || _a === void 0 ? void 0 : _a.sendTelemetryEvent(constants_2.SolutionTelemetryEvent.GrantPermissionStart, {
|
|
909
|
+
[constants_2.SolutionTelemetryProperty.Component]: constants_2.SolutionTelemetryComponentName,
|
|
934
910
|
});
|
|
911
|
+
const progressBar = (_b = ctx.ui) === null || _b === void 0 ? void 0 : _b.createProgressBar("Granting permission", 1);
|
|
935
912
|
try {
|
|
936
913
|
const result = await this.checkAndGetCurrentUserInfo(ctx);
|
|
937
914
|
if (result.isErr()) {
|
|
938
|
-
return teamsfx_api_1.err(util_1.sendErrorTelemetryThenReturnError(
|
|
915
|
+
return teamsfx_api_1.err(util_1.sendErrorTelemetryThenReturnError(constants_2.SolutionTelemetryEvent.GrantPermission, result.error, ctx.telemetryReporter));
|
|
939
916
|
}
|
|
940
917
|
const email = ctx.answers["email"];
|
|
918
|
+
if (!email || email === result.value.userPrincipalName) {
|
|
919
|
+
return teamsfx_api_1.err(util_1.sendErrorTelemetryThenReturnError(constants_2.SolutionTelemetryEvent.GrantPermission, teamsfx_api_1.returnUserError(new Error("Collaborator's email cannot be null or same as current user"), "Solution", constants_2.SolutionError.EmailCannotBeEmptyOrSame), ctx.telemetryReporter));
|
|
920
|
+
}
|
|
941
921
|
const userInfo = await this.getUserInfo(ctx, email);
|
|
942
922
|
if (!userInfo) {
|
|
943
|
-
return teamsfx_api_1.err(util_1.sendErrorTelemetryThenReturnError(
|
|
923
|
+
return teamsfx_api_1.err(util_1.sendErrorTelemetryThenReturnError(constants_2.SolutionTelemetryEvent.GrantPermission, teamsfx_api_1.returnUserError(new Error("Cannot find user in current tenant, please check whether your email address is correct"), "Solution", constants_2.SolutionError.CannotFindUserInCurrentTenant), ctx.telemetryReporter));
|
|
944
924
|
}
|
|
945
|
-
|
|
925
|
+
progressBar === null || progressBar === void 0 ? void 0 : progressBar.start();
|
|
926
|
+
progressBar === null || progressBar === void 0 ? void 0 : progressBar.next(`Grant permission for user ${email}`);
|
|
927
|
+
(_c = ctx.envInfo.profile.get(constants_2.GLOBAL_CONFIG)) === null || _c === void 0 ? void 0 : _c.set(constants_2.USER_INFO, JSON.stringify(userInfo));
|
|
946
928
|
const pluginsWithCtx = this.getPluginAndContextArray(ctx, [
|
|
947
929
|
this.AadPlugin,
|
|
948
930
|
this.AppStudioPlugin,
|
|
@@ -951,11 +933,21 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
951
933
|
var _a;
|
|
952
934
|
return [(_a = plugin === null || plugin === void 0 ? void 0 : plugin.grantPermission) === null || _a === void 0 ? void 0 : _a.bind(plugin), context, plugin.name];
|
|
953
935
|
});
|
|
954
|
-
if (((
|
|
955
|
-
const aadAppTenantId = (
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
936
|
+
if (((_d = ctx.answers) === null || _d === void 0 ? void 0 : _d.platform) === teamsfx_api_1.Platform.CLI) {
|
|
937
|
+
const aadAppTenantId = (_f = (_e = ctx.envInfo.profile) === null || _e === void 0 ? void 0 : _e.get(constants_2.PluginNames.AAD)) === null || _f === void 0 ? void 0 : _f.get(constants_2.REMOTE_TENANT_ID);
|
|
938
|
+
const message = [
|
|
939
|
+
{ content: `Account to grant permission: `, color: teamsfx_api_1.Colors.BRIGHT_WHITE },
|
|
940
|
+
{ content: userInfo.userPrincipalName + "\n", color: teamsfx_api_1.Colors.BRIGHT_MAGENTA },
|
|
941
|
+
{
|
|
942
|
+
content: `Starting grant permission for environment: `,
|
|
943
|
+
color: teamsfx_api_1.Colors.BRIGHT_WHITE,
|
|
944
|
+
},
|
|
945
|
+
// Todo, when multi-environment is ready, we will update to current environment
|
|
946
|
+
{ content: "default\n", color: teamsfx_api_1.Colors.BRIGHT_MAGENTA },
|
|
947
|
+
{ content: `Tenant ID: `, color: teamsfx_api_1.Colors.BRIGHT_WHITE },
|
|
948
|
+
{ content: aadAppTenantId + "\n", color: teamsfx_api_1.Colors.BRIGHT_MAGENTA },
|
|
949
|
+
];
|
|
950
|
+
(_g = ctx.ui) === null || _g === void 0 ? void 0 : _g.showMessage("info", message, false);
|
|
959
951
|
}
|
|
960
952
|
const results = await executor_1.executeConcurrently("", grantPermissionWithCtx);
|
|
961
953
|
const permissions = [];
|
|
@@ -980,9 +972,16 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
980
972
|
}
|
|
981
973
|
if (((_h = ctx.answers) === null || _h === void 0 ? void 0 : _h.platform) === teamsfx_api_1.Platform.CLI) {
|
|
982
974
|
for (const permission of permissions) {
|
|
983
|
-
|
|
975
|
+
const message = [
|
|
976
|
+
{ content: `${(_j = permission.roles) === null || _j === void 0 ? void 0 : _j.join(",")} `, color: teamsfx_api_1.Colors.BRIGHT_MAGENTA },
|
|
977
|
+
{ content: "permission has been granted to ", color: teamsfx_api_1.Colors.BRIGHT_WHITE },
|
|
978
|
+
{ content: permission.name, color: teamsfx_api_1.Colors.BRIGHT_MAGENTA },
|
|
979
|
+
{ content: ", Resource ID: ", color: teamsfx_api_1.Colors.BRIGHT_WHITE },
|
|
980
|
+
{ content: `${permission.resourceId}`, color: teamsfx_api_1.Colors.BRIGHT_MAGENTA },
|
|
981
|
+
];
|
|
982
|
+
(_k = ctx.ui) === null || _k === void 0 ? void 0 : _k.showMessage("info", message, false);
|
|
984
983
|
}
|
|
985
|
-
(_l = ctx.ui) === null || _l === void 0 ? void 0 : _l.showMessage("info",
|
|
984
|
+
(_l = ctx.ui) === null || _l === void 0 ? void 0 : _l.showMessage("info", `\nSkip grant permission for Azure resources. You may want to handle that via Azure portal. `, false);
|
|
986
985
|
if (errorMsg) {
|
|
987
986
|
for (const fxError of errors) {
|
|
988
987
|
(_m = ctx.ui) === null || _m === void 0 ? void 0 : _m.showMessage("error", errorMsg, false);
|
|
@@ -990,31 +989,32 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
990
989
|
}
|
|
991
990
|
}
|
|
992
991
|
if (errorMsg) {
|
|
993
|
-
return teamsfx_api_1.err(util_1.sendErrorTelemetryThenReturnError(
|
|
992
|
+
return teamsfx_api_1.err(util_1.sendErrorTelemetryThenReturnError(constants_2.SolutionTelemetryEvent.GrantPermission, teamsfx_api_1.returnUserError(new Error(errorMsg), "Solution", constants_2.SolutionError.FailedToGrantPermission), ctx.telemetryReporter));
|
|
994
993
|
}
|
|
995
|
-
(_o = ctx.telemetryReporter) === null || _o === void 0 ? void 0 : _o.sendTelemetryEvent(
|
|
996
|
-
[
|
|
997
|
-
[
|
|
994
|
+
(_o = ctx.telemetryReporter) === null || _o === void 0 ? void 0 : _o.sendTelemetryEvent(constants_2.SolutionTelemetryEvent.GrantPermission, {
|
|
995
|
+
[constants_2.SolutionTelemetryProperty.Component]: constants_2.SolutionTelemetryComponentName,
|
|
996
|
+
[constants_2.SolutionTelemetryProperty.Success]: constants_2.SolutionTelemetrySuccess.Yes,
|
|
998
997
|
});
|
|
999
998
|
return teamsfx_api_1.ok(permissions);
|
|
1000
999
|
}
|
|
1001
1000
|
finally {
|
|
1002
|
-
|
|
1001
|
+
await (progressBar === null || progressBar === void 0 ? void 0 : progressBar.end(true));
|
|
1002
|
+
(_p = ctx.envInfo.profile.get(constants_2.GLOBAL_CONFIG)) === null || _p === void 0 ? void 0 : _p.delete(constants_2.USER_INFO);
|
|
1003
1003
|
this.runningState = SolutionRunningState.Idle;
|
|
1004
1004
|
}
|
|
1005
1005
|
}
|
|
1006
1006
|
async checkPermission(ctx) {
|
|
1007
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l
|
|
1008
|
-
(_a = ctx.telemetryReporter) === null || _a === void 0 ? void 0 : _a.sendTelemetryEvent(
|
|
1009
|
-
[
|
|
1007
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
1008
|
+
(_a = ctx.telemetryReporter) === null || _a === void 0 ? void 0 : _a.sendTelemetryEvent(constants_2.SolutionTelemetryEvent.CheckPermissionStart, {
|
|
1009
|
+
[constants_2.SolutionTelemetryProperty.Component]: constants_2.SolutionTelemetryComponentName,
|
|
1010
1010
|
});
|
|
1011
1011
|
try {
|
|
1012
1012
|
const result = await this.checkAndGetCurrentUserInfo(ctx);
|
|
1013
1013
|
if (result.isErr()) {
|
|
1014
|
-
return teamsfx_api_1.err(util_1.sendErrorTelemetryThenReturnError(
|
|
1014
|
+
return teamsfx_api_1.err(util_1.sendErrorTelemetryThenReturnError(constants_2.SolutionTelemetryEvent.CheckPermission, result.error, ctx.telemetryReporter));
|
|
1015
1015
|
}
|
|
1016
1016
|
const userInfo = result.value;
|
|
1017
|
-
(_b = ctx.envInfo.profile.get(
|
|
1017
|
+
(_b = ctx.envInfo.profile.get(constants_2.GLOBAL_CONFIG)) === null || _b === void 0 ? void 0 : _b.set(constants_2.USER_INFO, JSON.stringify(userInfo));
|
|
1018
1018
|
const pluginsWithCtx = this.getPluginAndContextArray(ctx, [
|
|
1019
1019
|
this.AadPlugin,
|
|
1020
1020
|
this.AppStudioPlugin,
|
|
@@ -1024,11 +1024,20 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
1024
1024
|
return [(_a = plugin === null || plugin === void 0 ? void 0 : plugin.checkPermission) === null || _a === void 0 ? void 0 : _a.bind(plugin), context, plugin.name];
|
|
1025
1025
|
});
|
|
1026
1026
|
if (((_c = ctx.answers) === null || _c === void 0 ? void 0 : _c.platform) === teamsfx_api_1.Platform.CLI) {
|
|
1027
|
-
const aadAppTenantId = (_e = (_d = ctx.envInfo.profile) === null || _d === void 0 ? void 0 : _d.get(
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1027
|
+
const aadAppTenantId = (_e = (_d = ctx.envInfo.profile) === null || _d === void 0 ? void 0 : _d.get(constants_2.PluginNames.AAD)) === null || _e === void 0 ? void 0 : _e.get(constants_2.REMOTE_TENANT_ID);
|
|
1028
|
+
const message = [
|
|
1029
|
+
{ content: `Account used to check: `, color: teamsfx_api_1.Colors.BRIGHT_WHITE },
|
|
1030
|
+
{ content: userInfo.userPrincipalName + "\n", color: teamsfx_api_1.Colors.BRIGHT_MAGENTA },
|
|
1031
|
+
{
|
|
1032
|
+
content: `Starting check permission for environment: `,
|
|
1033
|
+
color: teamsfx_api_1.Colors.BRIGHT_WHITE,
|
|
1034
|
+
},
|
|
1035
|
+
// Todo, when multi-environment is ready, we will update to current environment
|
|
1036
|
+
{ content: "default\n", color: teamsfx_api_1.Colors.BRIGHT_MAGENTA },
|
|
1037
|
+
{ content: `Tenant ID: `, color: teamsfx_api_1.Colors.BRIGHT_WHITE },
|
|
1038
|
+
{ content: aadAppTenantId + "\n", color: teamsfx_api_1.Colors.BRIGHT_MAGENTA },
|
|
1039
|
+
];
|
|
1040
|
+
(_f = ctx.ui) === null || _f === void 0 ? void 0 : _f.showMessage("info", message, false);
|
|
1032
1041
|
}
|
|
1033
1042
|
const results = await executor_1.executeConcurrently("", checkPermissionWithCtx);
|
|
1034
1043
|
const permissions = [];
|
|
@@ -1051,42 +1060,53 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
1051
1060
|
errorMsg += fxError.error.message + "\n";
|
|
1052
1061
|
}
|
|
1053
1062
|
}
|
|
1054
|
-
if (((
|
|
1063
|
+
if (((_g = ctx.answers) === null || _g === void 0 ? void 0 : _g.platform) === teamsfx_api_1.Platform.CLI) {
|
|
1055
1064
|
for (const permission of permissions) {
|
|
1056
|
-
|
|
1065
|
+
const message = [
|
|
1066
|
+
{ content: `Resource ID: `, color: teamsfx_api_1.Colors.BRIGHT_WHITE },
|
|
1067
|
+
{ content: (_h = permission.resourceId) !== null && _h !== void 0 ? _h : "undefined", color: teamsfx_api_1.Colors.BRIGHT_MAGENTA },
|
|
1068
|
+
{ content: `, Resource Name: `, color: teamsfx_api_1.Colors.BRIGHT_WHITE },
|
|
1069
|
+
{ content: permission.name, color: teamsfx_api_1.Colors.BRIGHT_MAGENTA },
|
|
1070
|
+
{ content: `, Permission: `, color: teamsfx_api_1.Colors.BRIGHT_WHITE },
|
|
1071
|
+
{
|
|
1072
|
+
content: permission.roles ? permission.roles.toString() : "undefined" + "\n",
|
|
1073
|
+
color: teamsfx_api_1.Colors.BRIGHT_MAGENTA,
|
|
1074
|
+
},
|
|
1075
|
+
];
|
|
1076
|
+
(_j = ctx.ui) === null || _j === void 0 ? void 0 : _j.showMessage("info", message, false);
|
|
1057
1077
|
}
|
|
1058
1078
|
}
|
|
1059
1079
|
if (errorMsg) {
|
|
1060
|
-
return teamsfx_api_1.err(util_1.sendErrorTelemetryThenReturnError(
|
|
1080
|
+
return teamsfx_api_1.err(util_1.sendErrorTelemetryThenReturnError(constants_2.SolutionTelemetryEvent.CheckPermission, teamsfx_api_1.returnUserError(new Error(errorMsg), "Solution", constants_2.SolutionError.FailedToCheckPermission), ctx.telemetryReporter));
|
|
1061
1081
|
}
|
|
1062
1082
|
const aadPermission = permissions.find((permission) => permission.name === "Azure AD App");
|
|
1063
1083
|
const teamsAppPermission = permissions.find((permission) => permission.name === "Teams App");
|
|
1064
|
-
(
|
|
1065
|
-
[
|
|
1066
|
-
[
|
|
1067
|
-
[
|
|
1084
|
+
(_k = ctx.telemetryReporter) === null || _k === void 0 ? void 0 : _k.sendTelemetryEvent(constants_2.SolutionTelemetryEvent.CheckPermission, {
|
|
1085
|
+
[constants_2.SolutionTelemetryProperty.Component]: constants_2.SolutionTelemetryComponentName,
|
|
1086
|
+
[constants_2.SolutionTelemetryProperty.Success]: constants_2.SolutionTelemetrySuccess.Yes,
|
|
1087
|
+
[constants_2.SolutionTelemetryProperty.AadPermission]: (aadPermission === null || aadPermission === void 0 ? void 0 : aadPermission.roles)
|
|
1068
1088
|
? aadPermission.roles.join(";")
|
|
1069
1089
|
: "undefined",
|
|
1070
|
-
[
|
|
1090
|
+
[constants_2.SolutionTelemetryProperty.TeamsAppPermission]: (teamsAppPermission === null || teamsAppPermission === void 0 ? void 0 : teamsAppPermission.roles)
|
|
1071
1091
|
? teamsAppPermission.roles.join(";")
|
|
1072
1092
|
: "undefined",
|
|
1073
1093
|
});
|
|
1074
1094
|
return teamsfx_api_1.ok(permissions);
|
|
1075
1095
|
}
|
|
1076
1096
|
finally {
|
|
1077
|
-
(
|
|
1097
|
+
(_l = ctx.envInfo.profile.get(constants_2.GLOBAL_CONFIG)) === null || _l === void 0 ? void 0 : _l.delete(constants_2.USER_INFO);
|
|
1078
1098
|
this.runningState = SolutionRunningState.Idle;
|
|
1079
1099
|
}
|
|
1080
1100
|
}
|
|
1081
1101
|
async listCollaborator(ctx) {
|
|
1082
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k
|
|
1083
|
-
(_a = ctx.telemetryReporter) === null || _a === void 0 ? void 0 : _a.sendTelemetryEvent(
|
|
1084
|
-
[
|
|
1102
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
1103
|
+
(_a = ctx.telemetryReporter) === null || _a === void 0 ? void 0 : _a.sendTelemetryEvent(constants_2.SolutionTelemetryEvent.ListCollaboratorStart, {
|
|
1104
|
+
[constants_2.SolutionTelemetryProperty.Component]: constants_2.SolutionTelemetryComponentName,
|
|
1085
1105
|
});
|
|
1086
1106
|
try {
|
|
1087
1107
|
const result = await this.checkAndGetCurrentUserInfo(ctx);
|
|
1088
1108
|
if (result.isErr()) {
|
|
1089
|
-
return teamsfx_api_1.err(util_1.sendErrorTelemetryThenReturnError(
|
|
1109
|
+
return teamsfx_api_1.err(util_1.sendErrorTelemetryThenReturnError(constants_2.SolutionTelemetryEvent.ListCollaborator, result.error, ctx.telemetryReporter));
|
|
1090
1110
|
}
|
|
1091
1111
|
const userInfo = result.value;
|
|
1092
1112
|
const pluginsWithCtx = this.getPluginAndContextArray(ctx, [
|
|
@@ -1098,11 +1118,20 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
1098
1118
|
return [(_a = plugin === null || plugin === void 0 ? void 0 : plugin.listCollaborator) === null || _a === void 0 ? void 0 : _a.bind(plugin), context, plugin.name];
|
|
1099
1119
|
});
|
|
1100
1120
|
if (((_b = ctx.answers) === null || _b === void 0 ? void 0 : _b.platform) === teamsfx_api_1.Platform.CLI) {
|
|
1101
|
-
const aadAppTenantId = (_d = (_c = ctx.envInfo.profile) === null || _c === void 0 ? void 0 : _c.get(
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1121
|
+
const aadAppTenantId = (_d = (_c = ctx.envInfo.profile) === null || _c === void 0 ? void 0 : _c.get(constants_2.PluginNames.AAD)) === null || _d === void 0 ? void 0 : _d.get(constants_2.REMOTE_TENANT_ID);
|
|
1122
|
+
const message = [
|
|
1123
|
+
{ content: `Account used to check: `, color: teamsfx_api_1.Colors.BRIGHT_WHITE },
|
|
1124
|
+
{ content: userInfo.userPrincipalName + "\n", color: teamsfx_api_1.Colors.BRIGHT_MAGENTA },
|
|
1125
|
+
{
|
|
1126
|
+
content: `Starting list all collaborators for environment: `,
|
|
1127
|
+
color: teamsfx_api_1.Colors.BRIGHT_WHITE,
|
|
1128
|
+
},
|
|
1129
|
+
// Todo, when multi-environment is ready, we will update to current environment
|
|
1130
|
+
{ content: "default\n", color: teamsfx_api_1.Colors.BRIGHT_MAGENTA },
|
|
1131
|
+
{ content: `Tenant ID: `, color: teamsfx_api_1.Colors.BRIGHT_WHITE },
|
|
1132
|
+
{ content: aadAppTenantId + "\n", color: teamsfx_api_1.Colors.BRIGHT_MAGENTA },
|
|
1133
|
+
];
|
|
1134
|
+
(_e = ctx.ui) === null || _e === void 0 ? void 0 : _e.showMessage("info", message, false);
|
|
1106
1135
|
}
|
|
1107
1136
|
const results = await executor_1.executeConcurrently("", listCollaboratorWithCtx);
|
|
1108
1137
|
const errors = [];
|
|
@@ -1119,7 +1148,7 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
1119
1148
|
}
|
|
1120
1149
|
}
|
|
1121
1150
|
if (errorMsg) {
|
|
1122
|
-
return teamsfx_api_1.err(util_1.sendErrorTelemetryThenReturnError(
|
|
1151
|
+
return teamsfx_api_1.err(util_1.sendErrorTelemetryThenReturnError(constants_2.SolutionTelemetryEvent.ListCollaborator, teamsfx_api_1.returnUserError(new Error(errorMsg), "Solution", constants_2.SolutionError.FailedToListCollaborator), ctx.telemetryReporter));
|
|
1123
1152
|
}
|
|
1124
1153
|
const teamsAppOwners = results[0].isErr() ? [] : results[0].value;
|
|
1125
1154
|
const aadOwners = results[1].isErr() ? [] : results[1].value;
|
|
@@ -1128,28 +1157,38 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
1128
1157
|
const aadOwner = aadOwners.find((owner) => owner.userObjectId === teamsAppOwner.userObjectId);
|
|
1129
1158
|
collaborators.push({
|
|
1130
1159
|
// Sometimes app studio will return null as userPrincipalName, thus using aad's instead.
|
|
1131
|
-
userPrincipalName: (
|
|
1160
|
+
userPrincipalName: (_g = (_f = teamsAppOwner.userPrincipalName) !== null && _f !== void 0 ? _f : aadOwner === null || aadOwner === void 0 ? void 0 : aadOwner.userPrincipalName) !== null && _g !== void 0 ? _g : teamsAppOwner.userObjectId,
|
|
1132
1161
|
userObjectId: teamsAppOwner.userObjectId,
|
|
1133
1162
|
isAadOwner: aadOwner ? true : false,
|
|
1134
1163
|
aadResourceId: aadOwner ? aadOwner.resourceId : undefined,
|
|
1135
1164
|
teamsAppResourceId: teamsAppOwner.resourceId,
|
|
1136
1165
|
});
|
|
1137
1166
|
}
|
|
1138
|
-
if (((
|
|
1167
|
+
if (((_h = ctx.answers) === null || _h === void 0 ? void 0 : _h.platform) === teamsfx_api_1.Platform.CLI) {
|
|
1139
1168
|
for (const collaborator of collaborators) {
|
|
1140
|
-
|
|
1141
|
-
|
|
1169
|
+
const message = [
|
|
1170
|
+
{ content: `Account: `, color: teamsfx_api_1.Colors.BRIGHT_WHITE },
|
|
1171
|
+
{ content: collaborator.userPrincipalName + "\n", color: teamsfx_api_1.Colors.BRIGHT_MAGENTA },
|
|
1172
|
+
{ content: `Resource ID: `, color: teamsfx_api_1.Colors.BRIGHT_WHITE },
|
|
1173
|
+
{ content: collaborator.teamsAppResourceId, color: teamsfx_api_1.Colors.BRIGHT_MAGENTA },
|
|
1174
|
+
{ content: `, Resource Name: `, color: teamsfx_api_1.Colors.BRIGHT_WHITE },
|
|
1175
|
+
{ content: `Teams App`, color: teamsfx_api_1.Colors.BRIGHT_MAGENTA },
|
|
1176
|
+
{ content: `, Permission: `, color: teamsfx_api_1.Colors.BRIGHT_WHITE },
|
|
1177
|
+
{ content: `Administrator`, color: teamsfx_api_1.Colors.BRIGHT_MAGENTA },
|
|
1178
|
+
];
|
|
1142
1179
|
if (collaborator.aadResourceId) {
|
|
1143
|
-
(
|
|
1180
|
+
message.push({ content: `\nResource ID: `, color: teamsfx_api_1.Colors.BRIGHT_WHITE }, { content: collaborator.aadResourceId, color: teamsfx_api_1.Colors.BRIGHT_MAGENTA }, { content: `, Resource Name: `, color: teamsfx_api_1.Colors.BRIGHT_WHITE }, { content: `AAD App`, color: teamsfx_api_1.Colors.BRIGHT_MAGENTA }, { content: `, Permission: `, color: teamsfx_api_1.Colors.BRIGHT_WHITE }, { content: `Owner`, color: teamsfx_api_1.Colors.BRIGHT_MAGENTA });
|
|
1144
1181
|
}
|
|
1182
|
+
message.push({ content: "\n", color: teamsfx_api_1.Colors.BRIGHT_WHITE });
|
|
1183
|
+
(_j = ctx.ui) === null || _j === void 0 ? void 0 : _j.showMessage("info", message, false);
|
|
1145
1184
|
}
|
|
1146
1185
|
}
|
|
1147
1186
|
const aadOwnerCount = collaborators.filter((collaborator) => collaborator.aadResourceId && collaborator.isAadOwner).length;
|
|
1148
|
-
(
|
|
1149
|
-
[
|
|
1150
|
-
[
|
|
1151
|
-
[
|
|
1152
|
-
[
|
|
1187
|
+
(_k = ctx.telemetryReporter) === null || _k === void 0 ? void 0 : _k.sendTelemetryEvent(constants_2.SolutionTelemetryEvent.ListCollaborator, {
|
|
1188
|
+
[constants_2.SolutionTelemetryProperty.Component]: constants_2.SolutionTelemetryComponentName,
|
|
1189
|
+
[constants_2.SolutionTelemetryProperty.Success]: constants_2.SolutionTelemetrySuccess.Yes,
|
|
1190
|
+
[constants_2.SolutionTelemetryProperty.CollaboratorCount]: collaborators.length.toString(),
|
|
1191
|
+
[constants_2.SolutionTelemetryProperty.AadOwnerCount]: aadOwnerCount.toString(),
|
|
1153
1192
|
});
|
|
1154
1193
|
return teamsfx_api_1.ok(collaborators);
|
|
1155
1194
|
}
|
|
@@ -1165,38 +1204,26 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
1165
1204
|
}
|
|
1166
1205
|
const provisioned = this.checkWetherProvisionSucceeded(ctx.envInfo.profile);
|
|
1167
1206
|
if (!provisioned) {
|
|
1168
|
-
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error("Failed to process because the resources have not been provisioned yet. Make sure you do the provision first."), "Solution",
|
|
1207
|
+
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error("Failed to process because the resources have not been provisioned yet. Make sure you do the provision first."), "Solution", constants_2.SolutionError.CannotProcessBeforeProvision));
|
|
1169
1208
|
}
|
|
1170
1209
|
const user = await this.getUserInfo(ctx);
|
|
1171
1210
|
if (!user) {
|
|
1172
|
-
return teamsfx_api_1.err(teamsfx_api_1.returnSystemError(new Error("Failed to retrieve current user info from graph token"), "Solution",
|
|
1211
|
+
return teamsfx_api_1.err(teamsfx_api_1.returnSystemError(new Error("Failed to retrieve current user info from graph token"), "Solution", constants_2.SolutionError.FailedToRetrieveUserInfo));
|
|
1173
1212
|
}
|
|
1174
|
-
const aadAppTenantId = (_b = (_a = ctx.envInfo.profile) === null || _a === void 0 ? void 0 : _a.get(
|
|
1213
|
+
const aadAppTenantId = (_b = (_a = ctx.envInfo.profile) === null || _a === void 0 ? void 0 : _a.get(constants_2.PluginNames.AAD)) === null || _b === void 0 ? void 0 : _b.get(constants_2.REMOTE_TENANT_ID);
|
|
1175
1214
|
if (!aadAppTenantId || user.tenantId != aadAppTenantId) {
|
|
1176
|
-
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error("Tenant id of your account and the provisioned Azure AD app does not match. Please check whether you logined with wrong account."), "Solution",
|
|
1215
|
+
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error("Tenant id of your account and the provisioned Azure AD app does not match. Please check whether you logined with wrong account."), "Solution", constants_2.SolutionError.M365AccountNotMatch));
|
|
1177
1216
|
}
|
|
1178
1217
|
return teamsfx_api_1.ok(user);
|
|
1179
1218
|
}
|
|
1180
|
-
parseTeamsAppTenantId(appStudioToken) {
|
|
1181
|
-
if (appStudioToken === undefined) {
|
|
1182
|
-
return teamsfx_api_1.err(teamsfx_api_1.returnSystemError(new Error("Graph token json is undefined"), "Solution", constants_1.SolutionError.NoAppStudioToken));
|
|
1183
|
-
}
|
|
1184
|
-
const teamsAppTenantId = appStudioToken.tid;
|
|
1185
|
-
if (teamsAppTenantId === undefined ||
|
|
1186
|
-
!(typeof teamsAppTenantId === "string") ||
|
|
1187
|
-
teamsAppTenantId.length === 0) {
|
|
1188
|
-
return teamsfx_api_1.err(teamsfx_api_1.returnSystemError(new Error("Cannot find teams app tenant id"), "Solution", constants_1.SolutionError.NoTeamsAppTenantId));
|
|
1189
|
-
}
|
|
1190
|
-
return teamsfx_api_1.ok(teamsAppTenantId);
|
|
1191
|
-
}
|
|
1192
1219
|
loadTeamsAppTenantId(ctx, isLocalDebug, appStudioToken) {
|
|
1193
|
-
return
|
|
1220
|
+
return utils_1.parseTeamsAppTenantId(appStudioToken).andThen((teamsAppTenantId) => {
|
|
1194
1221
|
var _a, _b;
|
|
1195
1222
|
if (isLocalDebug && tools_1.isMultiEnvEnabled()) {
|
|
1196
1223
|
(_a = ctx.localSettings) === null || _a === void 0 ? void 0 : _a.teamsApp.set(localSettingsConstants_1.LocalSettingsTeamsAppKeys.TenantId, teamsAppTenantId);
|
|
1197
1224
|
}
|
|
1198
1225
|
else {
|
|
1199
|
-
(_b = ctx.envInfo.profile.get(
|
|
1226
|
+
(_b = ctx.envInfo.profile.get(constants_2.GLOBAL_CONFIG)) === null || _b === void 0 ? void 0 : _b.set("teamsAppTenantId", teamsAppTenantId);
|
|
1200
1227
|
}
|
|
1201
1228
|
return teamsfx_api_1.ok(ctx);
|
|
1202
1229
|
});
|
|
@@ -1207,9 +1234,9 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
1207
1234
|
}
|
|
1208
1235
|
async getQuestionsForAddResource(func, ctx) {
|
|
1209
1236
|
var _a;
|
|
1210
|
-
const v1Blocked =
|
|
1237
|
+
const v1Blocked = utils_1.blockV1Project((_a = ctx.projectSettings) === null || _a === void 0 ? void 0 : _a.solutionSettings);
|
|
1211
1238
|
if (v1Blocked.isErr()) {
|
|
1212
|
-
return v1Blocked;
|
|
1239
|
+
return teamsfx_api_1.err(v1Blocked.error);
|
|
1213
1240
|
}
|
|
1214
1241
|
const isDynamicQuestion = teamsfx_api_1.DynamicPlatforms.includes(ctx.answers.platform);
|
|
1215
1242
|
const settings = this.getAzureSolutionSettings(ctx);
|
|
@@ -1217,11 +1244,11 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
1217
1244
|
!(settings.hostType === question_1.HostTypeOptionAzure.id &&
|
|
1218
1245
|
settings.capabilities &&
|
|
1219
1246
|
settings.capabilities.includes(question_1.TabOptionItem.id))) {
|
|
1220
|
-
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error("Add resource is only supported for Tab app hosted in Azure."), "Solution",
|
|
1247
|
+
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error("Add resource is only supported for Tab app hosted in Azure."), "Solution", constants_2.SolutionError.AddResourceNotSupport));
|
|
1221
1248
|
}
|
|
1222
1249
|
const selectedPlugins = settings.activeResourcePlugins || [];
|
|
1223
1250
|
if (!selectedPlugins) {
|
|
1224
|
-
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error("selectedPlugins is empty"), "Solution",
|
|
1251
|
+
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error("selectedPlugins is empty"), "Solution", constants_2.SolutionError.InternelError));
|
|
1225
1252
|
}
|
|
1226
1253
|
const functionPlugin = this.FunctionPlugin;
|
|
1227
1254
|
const sqlPlugin = this.SqlPlugin;
|
|
@@ -1295,14 +1322,14 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
1295
1322
|
}
|
|
1296
1323
|
async getQuestionsForAddCapability(ctx) {
|
|
1297
1324
|
var _a, _b;
|
|
1298
|
-
const v1Blocked =
|
|
1325
|
+
const v1Blocked = utils_1.blockV1Project((_a = ctx.projectSettings) === null || _a === void 0 ? void 0 : _a.solutionSettings);
|
|
1299
1326
|
if (v1Blocked.isErr()) {
|
|
1300
|
-
return v1Blocked;
|
|
1327
|
+
return teamsfx_api_1.err(v1Blocked.error);
|
|
1301
1328
|
}
|
|
1302
1329
|
const isDynamicQuestion = teamsfx_api_1.DynamicPlatforms.includes(ctx.answers.platform);
|
|
1303
1330
|
const settings = this.getAzureSolutionSettings(ctx);
|
|
1304
1331
|
if (!(settings.hostType === question_1.HostTypeOptionAzure.id) && isDynamicQuestion) {
|
|
1305
|
-
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error("Add capability is not supported for SPFx project"), "Solution",
|
|
1332
|
+
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error("Add capability is not supported for SPFx project"), "Solution", constants_2.SolutionError.AddResourceNotSupport));
|
|
1306
1333
|
}
|
|
1307
1334
|
const capabilities = settings.capabilities || [];
|
|
1308
1335
|
const alreadyHaveTab = capabilities.includes(question_1.TabOptionItem.id);
|
|
@@ -1372,11 +1399,11 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
1372
1399
|
}
|
|
1373
1400
|
async executeAddResource(ctx) {
|
|
1374
1401
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
1375
|
-
(_a = ctx.telemetryReporter) === null || _a === void 0 ? void 0 : _a.sendTelemetryEvent(
|
|
1376
|
-
[
|
|
1402
|
+
(_a = ctx.telemetryReporter) === null || _a === void 0 ? void 0 : _a.sendTelemetryEvent(constants_2.SolutionTelemetryEvent.AddResourceStart, {
|
|
1403
|
+
[constants_2.SolutionTelemetryProperty.Component]: constants_2.SolutionTelemetryComponentName,
|
|
1377
1404
|
});
|
|
1378
1405
|
if (!ctx.answers) {
|
|
1379
|
-
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error(`answer is empty!`), "Solution",
|
|
1406
|
+
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error(`answer is empty!`), "Solution", constants_2.SolutionError.InternelError));
|
|
1380
1407
|
}
|
|
1381
1408
|
const settings = this.getAzureSolutionSettings(ctx);
|
|
1382
1409
|
const originalSettings = tools_1.deepCopy(settings);
|
|
@@ -1393,14 +1420,14 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
1393
1420
|
const alreadyHaveApim = selectedPlugins === null || selectedPlugins === void 0 ? void 0 : selectedPlugins.includes(apimPlugin.name);
|
|
1394
1421
|
const addResourcesAnswer = ctx.answers[question_1.AzureSolutionQuestionNames.AddResources];
|
|
1395
1422
|
if (!addResourcesAnswer) {
|
|
1396
|
-
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error(`answer of ${question_1.AzureSolutionQuestionNames.AddResources} is empty!`), "Solution",
|
|
1423
|
+
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error(`answer of ${question_1.AzureSolutionQuestionNames.AddResources} is empty!`), "Solution", constants_2.SolutionError.InvalidInput));
|
|
1397
1424
|
}
|
|
1398
1425
|
const addSQL = addResourcesAnswer.includes(question_1.AzureResourceSQL.id);
|
|
1399
1426
|
const addFunc = addResourcesAnswer.includes(question_1.AzureResourceFunction.id);
|
|
1400
1427
|
const addApim = addResourcesAnswer.includes(question_1.AzureResourceApim.id);
|
|
1401
1428
|
if ((alreadyHaveSql && addSQL) || (alreadyHaveApim && addApim)) {
|
|
1402
|
-
const e = teamsfx_api_1.returnUserError(new Error("SQL/APIM is already added."), "Solution",
|
|
1403
|
-
return teamsfx_api_1.err(util_1.sendErrorTelemetryThenReturnError(
|
|
1429
|
+
const e = teamsfx_api_1.returnUserError(new Error("SQL/APIM is already added."), "Solution", constants_2.SolutionError.AddResourceNotSupport);
|
|
1430
|
+
return teamsfx_api_1.err(util_1.sendErrorTelemetryThenReturnError(constants_2.SolutionTelemetryEvent.AddResource, e, ctx.telemetryReporter));
|
|
1404
1431
|
}
|
|
1405
1432
|
let addNewResoruceToProvision = false;
|
|
1406
1433
|
const notifications = [];
|
|
@@ -1430,7 +1457,7 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
1430
1457
|
if (tools_1.isArmSupportEnabled() && addNewResoruceToProvision) {
|
|
1431
1458
|
const confirmed = await executeUserTask_1.confirmRegenerateArmTemplate(ctx.ui);
|
|
1432
1459
|
if (!confirmed) {
|
|
1433
|
-
return teamsfx_api_1.ok(
|
|
1460
|
+
return teamsfx_api_1.ok(constants_2.Void);
|
|
1434
1461
|
}
|
|
1435
1462
|
}
|
|
1436
1463
|
settings.azureResources = azureResource;
|
|
@@ -1440,29 +1467,29 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
1440
1467
|
if (scaffoldRes.isErr()) {
|
|
1441
1468
|
(_c = ctx.logProvider) === null || _c === void 0 ? void 0 : _c.info(`failed to scaffold ${notifications.join(",")}!`);
|
|
1442
1469
|
ctx.projectSettings.solutionSettings = originalSettings;
|
|
1443
|
-
return teamsfx_api_1.err(util_1.sendErrorTelemetryThenReturnError(
|
|
1470
|
+
return teamsfx_api_1.err(util_1.sendErrorTelemetryThenReturnError(constants_2.SolutionTelemetryEvent.AddResource, scaffoldRes.error, ctx.telemetryReporter));
|
|
1444
1471
|
}
|
|
1445
1472
|
(_d = ctx.logProvider) === null || _d === void 0 ? void 0 : _d.info(`finish scaffolding ${notifications.join(",")}!`);
|
|
1446
1473
|
if (addNewResoruceToProvision)
|
|
1447
|
-
(_e = ctx.envInfo.profile.get(
|
|
1474
|
+
(_e = ctx.envInfo.profile.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
|
|
1448
1475
|
(_f = ctx.ui) === null || _f === void 0 ? void 0 : _f.showMessage("info", util.format(ctx.answers.platform === teamsfx_api_1.Platform.CLI
|
|
1449
1476
|
? tools_1.getStrings().solution.AddResourceNoticeForCli
|
|
1450
1477
|
: tools_1.getStrings().solution.AddResourceNotice, notifications.join(",")), false);
|
|
1451
1478
|
}
|
|
1452
|
-
(_g = ctx.telemetryReporter) === null || _g === void 0 ? void 0 : _g.sendTelemetryEvent(
|
|
1453
|
-
[
|
|
1454
|
-
[
|
|
1455
|
-
[
|
|
1479
|
+
(_g = ctx.telemetryReporter) === null || _g === void 0 ? void 0 : _g.sendTelemetryEvent(constants_2.SolutionTelemetryEvent.AddResource, {
|
|
1480
|
+
[constants_2.SolutionTelemetryProperty.Component]: constants_2.SolutionTelemetryComponentName,
|
|
1481
|
+
[constants_2.SolutionTelemetryProperty.Success]: constants_2.SolutionTelemetrySuccess.Yes,
|
|
1482
|
+
[constants_2.SolutionTelemetryProperty.Resources]: addResourcesAnswer.join(";"),
|
|
1456
1483
|
});
|
|
1457
|
-
return teamsfx_api_1.ok(
|
|
1484
|
+
return teamsfx_api_1.ok(constants_2.Void);
|
|
1458
1485
|
}
|
|
1459
1486
|
async executeAddCapability(ctx) {
|
|
1460
1487
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
1461
|
-
(_a = ctx.telemetryReporter) === null || _a === void 0 ? void 0 : _a.sendTelemetryEvent(
|
|
1462
|
-
[
|
|
1488
|
+
(_a = ctx.telemetryReporter) === null || _a === void 0 ? void 0 : _a.sendTelemetryEvent(constants_2.SolutionTelemetryEvent.AddCapabilityStart, {
|
|
1489
|
+
[constants_2.SolutionTelemetryProperty.Component]: constants_2.SolutionTelemetryComponentName,
|
|
1463
1490
|
});
|
|
1464
1491
|
if (!ctx.answers) {
|
|
1465
|
-
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error(`answer is empty!`), "Solution",
|
|
1492
|
+
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error(`answer is empty!`), "Solution", constants_2.SolutionError.InternelError));
|
|
1466
1493
|
}
|
|
1467
1494
|
const settings = this.getAzureSolutionSettings(ctx);
|
|
1468
1495
|
const originalSettings = tools_1.deepCopy(settings);
|
|
@@ -1472,19 +1499,19 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
1472
1499
|
}
|
|
1473
1500
|
const capabilitiesAnswer = ctx.answers[question_1.AzureSolutionQuestionNames.Capabilities];
|
|
1474
1501
|
if (!capabilitiesAnswer || capabilitiesAnswer.length === 0) {
|
|
1475
|
-
(_b = ctx.telemetryReporter) === null || _b === void 0 ? void 0 : _b.sendTelemetryEvent(
|
|
1476
|
-
[
|
|
1477
|
-
[
|
|
1478
|
-
[
|
|
1502
|
+
(_b = ctx.telemetryReporter) === null || _b === void 0 ? void 0 : _b.sendTelemetryEvent(constants_2.SolutionTelemetryEvent.AddCapability, {
|
|
1503
|
+
[constants_2.SolutionTelemetryProperty.Component]: constants_2.SolutionTelemetryComponentName,
|
|
1504
|
+
[constants_2.SolutionTelemetryProperty.Success]: constants_2.SolutionTelemetrySuccess.Yes,
|
|
1505
|
+
[constants_2.SolutionTelemetryProperty.Capabilities]: [].join(";"),
|
|
1479
1506
|
});
|
|
1480
|
-
return teamsfx_api_1.ok(
|
|
1507
|
+
return teamsfx_api_1.ok(constants_2.Void);
|
|
1481
1508
|
}
|
|
1482
1509
|
if ((((_c = settings.capabilities) === null || _c === void 0 ? void 0 : _c.includes(question_1.BotOptionItem.id)) ||
|
|
1483
1510
|
((_d = settings.capabilities) === null || _d === void 0 ? void 0 : _d.includes(question_1.MessageExtensionItem.id))) &&
|
|
1484
1511
|
(capabilitiesAnswer.includes(question_1.BotOptionItem.id) ||
|
|
1485
1512
|
capabilitiesAnswer.includes(question_1.MessageExtensionItem.id))) {
|
|
1486
|
-
const e = teamsfx_api_1.returnUserError(new Error("Application already contains a Bot and/or Messaging Extension"), "Solution",
|
|
1487
|
-
return teamsfx_api_1.err(util_1.sendErrorTelemetryThenReturnError(
|
|
1513
|
+
const e = teamsfx_api_1.returnUserError(new Error("Application already contains a Bot and/or Messaging Extension"), "Solution", constants_2.SolutionError.FailedToAddCapability);
|
|
1514
|
+
return teamsfx_api_1.err(util_1.sendErrorTelemetryThenReturnError(constants_2.SolutionTelemetryEvent.AddCapability, e, ctx.telemetryReporter));
|
|
1488
1515
|
}
|
|
1489
1516
|
let change = false;
|
|
1490
1517
|
const notifications = [];
|
|
@@ -1509,7 +1536,7 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
1509
1536
|
if (tools_1.isArmSupportEnabled()) {
|
|
1510
1537
|
const confirmed = await executeUserTask_1.confirmRegenerateArmTemplate(ctx.ui);
|
|
1511
1538
|
if (!confirmed) {
|
|
1512
|
-
return teamsfx_api_1.ok(
|
|
1539
|
+
return teamsfx_api_1.ok(constants_2.Void);
|
|
1513
1540
|
}
|
|
1514
1541
|
}
|
|
1515
1542
|
settings.capabilities = capabilities;
|
|
@@ -1519,27 +1546,27 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
1519
1546
|
if (scaffoldRes.isErr()) {
|
|
1520
1547
|
(_f = ctx.logProvider) === null || _f === void 0 ? void 0 : _f.info(`failed to scaffold ${notifications.join(",")}!`);
|
|
1521
1548
|
ctx.projectSettings.solutionSettings = originalSettings;
|
|
1522
|
-
return teamsfx_api_1.err(util_1.sendErrorTelemetryThenReturnError(
|
|
1549
|
+
return teamsfx_api_1.err(util_1.sendErrorTelemetryThenReturnError(constants_2.SolutionTelemetryEvent.AddCapability, scaffoldRes.error, ctx.telemetryReporter));
|
|
1523
1550
|
}
|
|
1524
1551
|
(_g = ctx.logProvider) === null || _g === void 0 ? void 0 : _g.info(`finish scaffolding ${notifications.join(",")}!`);
|
|
1525
|
-
(_h = ctx.envInfo.profile.get(
|
|
1552
|
+
(_h = ctx.envInfo.profile.get(constants_2.GLOBAL_CONFIG)) === null || _h === void 0 ? void 0 : _h.set(constants_2.SOLUTION_PROVISION_SUCCEEDED, false);
|
|
1526
1553
|
const msg = util.format(ctx.answers.platform === teamsfx_api_1.Platform.CLI
|
|
1527
1554
|
? tools_1.getStrings().solution.AddCapabilityNoticeForCli
|
|
1528
1555
|
: tools_1.getStrings().solution.AddCapabilityNotice, notifications.join(","));
|
|
1529
1556
|
(_j = ctx.ui) === null || _j === void 0 ? void 0 : _j.showMessage("info", msg, false);
|
|
1530
|
-
(_k = ctx.telemetryReporter) === null || _k === void 0 ? void 0 : _k.sendTelemetryEvent(
|
|
1531
|
-
[
|
|
1532
|
-
[
|
|
1533
|
-
[
|
|
1557
|
+
(_k = ctx.telemetryReporter) === null || _k === void 0 ? void 0 : _k.sendTelemetryEvent(constants_2.SolutionTelemetryEvent.AddCapability, {
|
|
1558
|
+
[constants_2.SolutionTelemetryProperty.Component]: constants_2.SolutionTelemetryComponentName,
|
|
1559
|
+
[constants_2.SolutionTelemetryProperty.Success]: constants_2.SolutionTelemetrySuccess.Yes,
|
|
1560
|
+
[constants_2.SolutionTelemetryProperty.Capabilities]: capabilitiesAnswer.join(";"),
|
|
1534
1561
|
});
|
|
1535
1562
|
return teamsfx_api_1.ok({});
|
|
1536
1563
|
}
|
|
1537
1564
|
const cannotAddCapWarnMsg = "Add nothing";
|
|
1538
1565
|
(_l = ctx.ui) === null || _l === void 0 ? void 0 : _l.showMessage("warn", cannotAddCapWarnMsg, false);
|
|
1539
|
-
(_m = ctx.telemetryReporter) === null || _m === void 0 ? void 0 : _m.sendTelemetryEvent(
|
|
1540
|
-
[
|
|
1541
|
-
[
|
|
1542
|
-
[
|
|
1566
|
+
(_m = ctx.telemetryReporter) === null || _m === void 0 ? void 0 : _m.sendTelemetryEvent(constants_2.SolutionTelemetryEvent.AddCapability, {
|
|
1567
|
+
[constants_2.SolutionTelemetryProperty.Component]: constants_2.SolutionTelemetryComponentName,
|
|
1568
|
+
[constants_2.SolutionTelemetryProperty.Success]: constants_2.SolutionTelemetrySuccess.Yes,
|
|
1569
|
+
[constants_2.SolutionTelemetryProperty.Capabilities]: [].join(";"),
|
|
1543
1570
|
});
|
|
1544
1571
|
return teamsfx_api_1.ok({});
|
|
1545
1572
|
}
|
|
@@ -1549,7 +1576,7 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
1549
1576
|
async executeUserTask(func, ctx) {
|
|
1550
1577
|
var _a, _b;
|
|
1551
1578
|
if (!ctx.answers)
|
|
1552
|
-
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error(`answer is empty!`), "Solution",
|
|
1579
|
+
return teamsfx_api_1.err(teamsfx_api_1.returnUserError(new Error(`answer is empty!`), "Solution", constants_2.SolutionError.InternelError));
|
|
1553
1580
|
const namespace = func.namespace;
|
|
1554
1581
|
const method = func.method;
|
|
1555
1582
|
const array = namespace.split("/");
|
|
@@ -1572,7 +1599,7 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
1572
1599
|
// It's teamsfx init followed by teamsfx publish without running provision.
|
|
1573
1600
|
// Using executeUserTask here could bypass the fx project check.
|
|
1574
1601
|
if (((_a = ctx.answers) === null || _a === void 0 ? void 0 : _a.platform) !== "vs") {
|
|
1575
|
-
return teamsfx_api_1.err(teamsfx_api_1.returnSystemError(new Error(`VS publish is not supposed to run on platform ${(_b = ctx.answers) === null || _b === void 0 ? void 0 : _b.platform}`), "Solution",
|
|
1602
|
+
return teamsfx_api_1.err(teamsfx_api_1.returnSystemError(new Error(`VS publish is not supposed to run on platform ${(_b = ctx.answers) === null || _b === void 0 ? void 0 : _b.platform}`), "Solution", constants_2.SolutionError.UnsupportedPlatform));
|
|
1576
1603
|
}
|
|
1577
1604
|
const appStudioPlugin = this.AppStudioPlugin;
|
|
1578
1605
|
const pluginCtx = util_1.getPluginContext(ctx, appStudioPlugin.name);
|
|
@@ -1603,8 +1630,8 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
1603
1630
|
prepareConfigForRegisterTeamsAppAndAad(config, params) {
|
|
1604
1631
|
const endpoint = params.endpoint;
|
|
1605
1632
|
const domain = new URL(endpoint).hostname;
|
|
1606
|
-
if (config.get(
|
|
1607
|
-
config.set(
|
|
1633
|
+
if (config.get(constants_2.GLOBAL_CONFIG) == undefined) {
|
|
1634
|
+
config.set(constants_2.GLOBAL_CONFIG, new teamsfx_api_1.ConfigMap());
|
|
1608
1635
|
}
|
|
1609
1636
|
const aadPlugin = this.AadPlugin;
|
|
1610
1637
|
if (config.get(aadPlugin.name) == undefined) {
|
|
@@ -1617,19 +1644,19 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
1617
1644
|
extractConfigForRegisterTeamsAppAndAad(config, isLocal) {
|
|
1618
1645
|
var _a, _b, _c;
|
|
1619
1646
|
const aadPlugin = this.AadPlugin;
|
|
1620
|
-
const aadId = (_a = config.get(aadPlugin.name)) === null || _a === void 0 ? void 0 : _a.get(isLocal ?
|
|
1647
|
+
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);
|
|
1621
1648
|
if (aadId === undefined || typeof aadId !== "string") {
|
|
1622
|
-
return teamsfx_api_1.err(teamsfx_api_1.returnSystemError(new Error(`config ${
|
|
1649
|
+
return teamsfx_api_1.err(teamsfx_api_1.returnSystemError(new Error(`config ${constants_2.LOCAL_DEBUG_AAD_ID} is missing`), "Solution", constants_2.SolutionError.RegisterTeamsAppAndAadError));
|
|
1623
1650
|
}
|
|
1624
1651
|
const applicationIdUri = (_b = config
|
|
1625
|
-
.get(aadPlugin.name)) === null || _b === void 0 ? void 0 : _b.get(isLocal ?
|
|
1652
|
+
.get(aadPlugin.name)) === null || _b === void 0 ? void 0 : _b.get(isLocal ? constants_2.LOCAL_APPLICATION_ID_URIS : constants_2.REMOTE_APPLICATION_ID_URIS);
|
|
1626
1653
|
if (applicationIdUri === undefined || typeof applicationIdUri !== "string") {
|
|
1627
|
-
return teamsfx_api_1.err(teamsfx_api_1.returnSystemError(new Error(`config ${
|
|
1654
|
+
return teamsfx_api_1.err(teamsfx_api_1.returnSystemError(new Error(`config ${constants_2.LOCAL_APPLICATION_ID_URIS} is missing`), "Solution", constants_2.SolutionError.RegisterTeamsAppAndAadError));
|
|
1628
1655
|
}
|
|
1629
1656
|
const clientSecret = (_c = config
|
|
1630
|
-
.get(aadPlugin.name)) === null || _c === void 0 ? void 0 : _c.get(isLocal ?
|
|
1657
|
+
.get(aadPlugin.name)) === null || _c === void 0 ? void 0 : _c.get(isLocal ? constants_2.LOCAL_CLIENT_SECRET : constants_2.REMOTE_CLIENT_SECRET);
|
|
1631
1658
|
if (clientSecret === undefined || typeof clientSecret !== "string") {
|
|
1632
|
-
return teamsfx_api_1.err(teamsfx_api_1.returnSystemError(new Error(`config ${
|
|
1659
|
+
return teamsfx_api_1.err(teamsfx_api_1.returnSystemError(new Error(`config ${constants_2.LOCAL_CLIENT_SECRET} is missing`), "Solution", constants_2.SolutionError.RegisterTeamsAppAndAadError));
|
|
1633
1660
|
}
|
|
1634
1661
|
return teamsfx_api_1.ok({
|
|
1635
1662
|
aadId,
|
|
@@ -1657,7 +1684,7 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
1657
1684
|
return teamsfx_api_1.ok(undefined);
|
|
1658
1685
|
},
|
|
1659
1686
|
async getPermissionRequest() {
|
|
1660
|
-
return teamsfx_api_1.ok(JSON.stringify(
|
|
1687
|
+
return teamsfx_api_1.ok(JSON.stringify(constants_2.DEFAULT_PERMISSION_REQUEST));
|
|
1661
1688
|
},
|
|
1662
1689
|
};
|
|
1663
1690
|
}
|
|
@@ -1668,7 +1695,7 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
1668
1695
|
return provisionResult;
|
|
1669
1696
|
}
|
|
1670
1697
|
await aadPlugin.executeUserTask({
|
|
1671
|
-
namespace: `${
|
|
1698
|
+
namespace: `${constants_2.PluginNames.SOLUTION}/${constants_2.PluginNames.AAD}`,
|
|
1672
1699
|
method: "setApplicationInContext",
|
|
1673
1700
|
params: { isLocal: isLocal },
|
|
1674
1701
|
}, aadPluginCtx);
|
|
@@ -1696,7 +1723,7 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
1696
1723
|
await fs.writeFile(manifestPath, manifestStr);
|
|
1697
1724
|
const appStudioPlugin = this.AppStudioPlugin;
|
|
1698
1725
|
const func = {
|
|
1699
|
-
namespace: `${
|
|
1726
|
+
namespace: `${constants_2.PluginNames.SOLUTION}/${constants_2.PluginNames.APPST}`,
|
|
1700
1727
|
method: "getAppDefinitionAndUpdate",
|
|
1701
1728
|
params: {
|
|
1702
1729
|
type: "remote",
|
|
@@ -1709,7 +1736,7 @@ let TeamsAppSolution = class TeamsAppSolution {
|
|
|
1709
1736
|
}
|
|
1710
1737
|
const teamsAppId = maybeTeamsAppId.value;
|
|
1711
1738
|
const appSettingsJSONTpl = (await fs.readFile(appSettingsJSONPath)).toString();
|
|
1712
|
-
const maybeTenantId =
|
|
1739
|
+
const maybeTenantId = utils_1.parseTeamsAppTenantId(await ((_a = ctx.appStudioToken) === null || _a === void 0 ? void 0 : _a.getJsonObject()));
|
|
1713
1740
|
if (maybeTenantId.isErr()) {
|
|
1714
1741
|
return teamsfx_api_1.err(maybeTenantId.error);
|
|
1715
1742
|
}
|
|
@@ -1824,7 +1851,7 @@ tslib_1.__decorate([
|
|
|
1824
1851
|
tslib_1.__metadata("design:returntype", Promise)
|
|
1825
1852
|
], TeamsAppSolution.prototype, "executeUserTask", null);
|
|
1826
1853
|
TeamsAppSolution = tslib_1.__decorate([
|
|
1827
|
-
typedi_1.Service(),
|
|
1854
|
+
typedi_1.Service(SolutionPluginContainer_1.SolutionPlugins.AzureTeamsSolution),
|
|
1828
1855
|
tslib_1.__metadata("design:paramtypes", [])
|
|
1829
1856
|
], TeamsAppSolution);
|
|
1830
1857
|
exports.TeamsAppSolution = TeamsAppSolution;
|