@microsoft/teamsfx-core 1.4.0 → 1.4.1-alpha.313131ea.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 +1 -0
- package/build/common/constants.d.ts.map +1 -1
- package/build/common/constants.js +1 -0
- package/build/common/constants.js.map +1 -1
- package/build/common/local/localEnvProvider.d.ts +4 -8
- package/build/common/local/localEnvProvider.d.ts.map +1 -1
- package/build/common/local/localEnvProvider.js +21 -33
- package/build/common/local/localEnvProvider.js.map +1 -1
- package/build/common/local/localSettingsHelper.d.ts.map +1 -1
- package/build/common/local/localSettingsHelper.js +12 -21
- package/build/common/local/localSettingsHelper.js.map +1 -1
- package/build/common/projectSettingsValidator.d.ts.map +1 -1
- package/build/common/projectSettingsValidator.js +1 -0
- package/build/common/projectSettingsValidator.js.map +1 -1
- package/build/common/template-utils/templates.d.ts +1 -0
- package/build/common/template-utils/templates.d.ts.map +1 -1
- package/build/common/template-utils/templates.js +5 -1
- package/build/common/template-utils/templates.js.map +1 -1
- package/build/common/templates-config.json +2 -2
- package/build/common/tools.d.ts.map +1 -1
- package/build/common/tools.js +2 -18
- package/build/common/tools.js.map +1 -1
- package/build/core/SolutionPluginContainer.js +1 -1
- package/build/core/SolutionPluginContainer.js.map +1 -1
- package/build/core/collaborator.d.ts +10 -0
- package/build/core/collaborator.d.ts.map +1 -0
- package/build/core/collaborator.js +381 -0
- package/build/core/collaborator.js.map +1 -0
- package/build/core/environment.d.ts.map +1 -1
- package/build/core/environment.js +7 -2
- package/build/core/environment.js.map +1 -1
- package/build/core/index.d.ts +10 -4
- package/build/core/index.d.ts.map +1 -1
- package/build/core/index.js +138 -52
- package/build/core/index.js.map +1 -1
- package/build/core/middleware/envInfoLoaderV3.js +1 -0
- package/build/core/middleware/envInfoLoaderV3.js.map +1 -1
- package/build/core/middleware/questionModel.d.ts.map +1 -1
- package/build/core/middleware/questionModel.js +49 -35
- package/build/core/middleware/questionModel.js.map +1 -1
- package/build/core/middleware/solutionLoaderV3.d.ts +1 -1
- package/build/core/middleware/solutionLoaderV3.d.ts.map +1 -1
- package/build/core/middleware/solutionLoaderV3.js +1 -8
- package/build/core/middleware/solutionLoaderV3.js.map +1 -1
- package/build/plugins/resource/aad/aadAppClient.d.ts +4 -4
- package/build/plugins/resource/aad/aadAppClient.d.ts.map +1 -1
- package/build/plugins/resource/aad/aadAppClient.js +3 -3
- package/build/plugins/resource/aad/aadAppClient.js.map +1 -1
- package/build/plugins/resource/aad/index.d.ts.map +1 -1
- package/build/plugins/resource/aad/index.js +0 -3
- package/build/plugins/resource/aad/index.js.map +1 -1
- package/build/plugins/resource/aad/plugin.d.ts.map +1 -1
- package/build/plugins/resource/aad/plugin.js +13 -8
- package/build/plugins/resource/aad/plugin.js.map +1 -1
- package/build/plugins/resource/aad/v2/index.d.ts +3 -2
- package/build/plugins/resource/aad/v2/index.d.ts.map +1 -1
- package/build/plugins/resource/aad/v2/index.js +4 -4
- package/build/plugins/resource/aad/v2/index.js.map +1 -1
- package/build/plugins/resource/aad/v3/index.d.ts +7 -1
- package/build/plugins/resource/aad/v3/index.d.ts.map +1 -1
- package/build/plugins/resource/aad/v3/index.js +150 -48
- package/build/plugins/resource/aad/v3/index.js.map +1 -1
- package/build/plugins/resource/apim/config.js +2 -1
- package/build/plugins/resource/apim/config.js.map +1 -1
- package/build/plugins/resource/apim/v3/index.d.ts +4 -4
- package/build/plugins/resource/apim/v3/index.d.ts.map +1 -1
- package/build/plugins/resource/apim/v3/index.js +51 -37
- package/build/plugins/resource/apim/v3/index.js.map +1 -1
- package/build/plugins/resource/appstudio/errors.d.ts +8 -16
- package/build/plugins/resource/appstudio/errors.d.ts.map +1 -1
- package/build/plugins/resource/appstudio/errors.js +8 -16
- package/build/plugins/resource/appstudio/errors.js.map +1 -1
- package/build/plugins/resource/appstudio/index.d.ts +0 -4
- package/build/plugins/resource/appstudio/index.d.ts.map +1 -1
- package/build/plugins/resource/appstudio/index.js +0 -21
- package/build/plugins/resource/appstudio/index.js.map +1 -1
- package/build/plugins/resource/appstudio/manifestTemplate.d.ts +3 -1
- package/build/plugins/resource/appstudio/manifestTemplate.d.ts.map +1 -1
- package/build/plugins/resource/appstudio/manifestTemplate.js +111 -1
- package/build/plugins/resource/appstudio/manifestTemplate.js.map +1 -1
- package/build/plugins/resource/appstudio/plugin.d.ts +2 -13
- package/build/plugins/resource/appstudio/plugin.d.ts.map +1 -1
- package/build/plugins/resource/appstudio/plugin.js +31 -117
- package/build/plugins/resource/appstudio/plugin.js.map +1 -1
- package/build/plugins/resource/appstudio/utils/telemetry.d.ts +0 -1
- package/build/plugins/resource/appstudio/utils/telemetry.d.ts.map +1 -1
- package/build/plugins/resource/appstudio/utils/telemetry.js +0 -1
- package/build/plugins/resource/appstudio/utils/telemetry.js.map +1 -1
- package/build/plugins/resource/appstudio/v2/index.d.ts +2 -2
- package/build/plugins/resource/appstudio/v2/index.d.ts.map +1 -1
- package/build/plugins/resource/appstudio/v2/index.js +2 -2
- package/build/plugins/resource/appstudio/v2/index.js.map +1 -1
- package/build/plugins/resource/appstudio/v3/index.d.ts +22 -2
- package/build/plugins/resource/appstudio/v3/index.d.ts.map +1 -1
- package/build/plugins/resource/appstudio/v3/index.js +105 -0
- package/build/plugins/resource/appstudio/v3/index.js.map +1 -1
- package/build/plugins/resource/bot/configs/deployConfig.js.map +1 -1
- package/build/plugins/resource/bot/index.d.ts +1 -1
- package/build/plugins/resource/bot/index.d.ts.map +1 -1
- package/build/plugins/resource/bot/index.js +5 -9
- package/build/plugins/resource/bot/index.js.map +1 -1
- package/build/plugins/resource/bot/progressBars.d.ts +2 -2
- package/build/plugins/resource/bot/progressBars.d.ts.map +1 -1
- package/build/plugins/resource/bot/progressBars.js +4 -3
- package/build/plugins/resource/bot/progressBars.js.map +1 -1
- package/build/plugins/resource/bot/v3/error.d.ts +15 -0
- package/build/plugins/resource/bot/v3/error.d.ts.map +1 -0
- package/build/plugins/resource/bot/v3/error.js +46 -0
- package/build/plugins/resource/bot/v3/error.js.map +1 -0
- package/build/plugins/resource/bot/v3/index.d.ts +20 -0
- package/build/plugins/resource/bot/v3/index.d.ts.map +1 -0
- package/build/plugins/resource/bot/v3/index.js +384 -0
- package/build/plugins/resource/bot/v3/index.js.map +1 -0
- package/build/plugins/resource/frontend/index.d.ts +1 -3
- package/build/plugins/resource/frontend/index.d.ts.map +1 -1
- package/build/plugins/resource/frontend/index.js +3 -11
- package/build/plugins/resource/frontend/index.js.map +1 -1
- package/build/plugins/resource/frontend/interface.d.ts +1 -2
- package/build/plugins/resource/frontend/interface.d.ts.map +1 -1
- package/build/plugins/resource/frontend/plugin.d.ts +1 -2
- package/build/plugins/resource/frontend/plugin.d.ts.map +1 -1
- package/build/plugins/resource/frontend/plugin.js +9 -25
- package/build/plugins/resource/frontend/plugin.js.map +1 -1
- package/build/plugins/resource/frontend/resources/errors.d.ts +0 -7
- package/build/plugins/resource/frontend/resources/errors.d.ts.map +1 -1
- package/build/plugins/resource/frontend/resources/errors.js +1 -14
- package/build/plugins/resource/frontend/resources/errors.js.map +1 -1
- package/build/plugins/resource/frontend/resources/messages.d.ts +0 -2
- package/build/plugins/resource/frontend/resources/messages.d.ts.map +1 -1
- package/build/plugins/resource/frontend/resources/messages.js +0 -2
- package/build/plugins/resource/frontend/resources/messages.js.map +1 -1
- package/build/plugins/resource/frontend/resources/steps.d.ts +0 -1
- package/build/plugins/resource/frontend/resources/steps.d.ts.map +1 -1
- package/build/plugins/resource/frontend/resources/steps.js +1 -7
- package/build/plugins/resource/frontend/resources/steps.js.map +1 -1
- package/build/plugins/resource/frontend/v2/index.d.ts +2 -2
- package/build/plugins/resource/frontend/v2/index.d.ts.map +1 -1
- package/build/plugins/resource/frontend/v2/index.js +2 -2
- package/build/plugins/resource/frontend/v2/index.js.map +1 -1
- package/build/plugins/resource/frontend/v3/index.d.ts +4 -4
- package/build/plugins/resource/frontend/v3/index.d.ts.map +1 -1
- package/build/plugins/resource/frontend/v3/index.js +2 -3
- package/build/plugins/resource/frontend/v3/index.js.map +1 -1
- package/build/plugins/resource/function/v3/index.d.ts +5 -5
- package/build/plugins/resource/function/v3/index.d.ts.map +1 -1
- package/build/plugins/resource/function/v3/index.js +5 -7
- package/build/plugins/resource/function/v3/index.js.map +1 -1
- package/build/plugins/resource/identity/index.d.ts.map +1 -1
- package/build/plugins/resource/identity/index.js +0 -3
- package/build/plugins/resource/identity/index.js.map +1 -1
- package/build/plugins/resource/identity/v3/index.d.ts +2 -2
- package/build/plugins/resource/identity/v3/index.d.ts.map +1 -1
- package/build/plugins/resource/identity/v3/index.js +1 -2
- package/build/plugins/resource/identity/v3/index.js.map +1 -1
- package/build/plugins/resource/keyvault/v3/index.d.ts +2 -2
- package/build/plugins/resource/keyvault/v3/index.d.ts.map +1 -1
- package/build/plugins/resource/keyvault/v3/index.js +1 -2
- package/build/plugins/resource/keyvault/v3/index.js.map +1 -1
- package/build/plugins/resource/localdebug/constants.d.ts +0 -4
- package/build/plugins/resource/localdebug/constants.d.ts.map +1 -1
- package/build/plugins/resource/localdebug/constants.js +1 -5
- package/build/plugins/resource/localdebug/constants.js.map +1 -1
- package/build/plugins/resource/localdebug/localEnv.d.ts +2 -2
- package/build/plugins/resource/localdebug/localEnv.d.ts.map +1 -1
- package/build/plugins/resource/localdebug/localEnv.js +4 -6
- package/build/plugins/resource/localdebug/localEnv.js.map +1 -1
- package/build/plugins/resource/localdebug/projectSettingLoader.d.ts +0 -1
- package/build/plugins/resource/localdebug/projectSettingLoader.d.ts.map +1 -1
- package/build/plugins/resource/localdebug/projectSettingLoader.js +0 -1
- package/build/plugins/resource/localdebug/projectSettingLoader.js.map +1 -1
- package/build/plugins/resource/spfx/index.d.ts +1 -5
- package/build/plugins/resource/spfx/index.d.ts.map +1 -1
- package/build/plugins/resource/spfx/index.js +6 -10
- package/build/plugins/resource/spfx/index.js.map +1 -1
- package/build/plugins/resource/spfx/plugin.js +6 -6
- package/build/plugins/resource/spfx/plugin.js.map +1 -1
- package/build/plugins/resource/spfx/utils/constants.d.ts +9 -0
- package/build/plugins/resource/spfx/utils/constants.d.ts.map +1 -1
- package/build/plugins/resource/spfx/utils/constants.js +11 -1
- package/build/plugins/resource/spfx/utils/constants.js.map +1 -1
- package/build/plugins/resource/spfx/utils/progress-helper.d.ts +3 -3
- package/build/plugins/resource/spfx/utils/progress-helper.d.ts.map +1 -1
- package/build/plugins/resource/spfx/utils/progress-helper.js +8 -8
- package/build/plugins/resource/spfx/utils/progress-helper.js.map +1 -1
- package/build/plugins/resource/spfx/utils/questions.d.ts +10 -0
- package/build/plugins/resource/spfx/utils/questions.d.ts.map +1 -0
- package/build/plugins/resource/spfx/utils/questions.js +39 -0
- package/build/plugins/resource/spfx/utils/questions.js.map +1 -0
- package/build/plugins/resource/spfx/v3/error.d.ts +5 -0
- package/build/plugins/resource/spfx/v3/error.d.ts.map +1 -0
- package/build/plugins/resource/spfx/v3/error.js +20 -0
- package/build/plugins/resource/spfx/v3/error.js.map +1 -0
- package/build/plugins/resource/spfx/v3/index.d.ts +13 -0
- package/build/plugins/resource/spfx/v3/index.d.ts.map +1 -0
- package/build/plugins/resource/spfx/v3/index.js +123 -0
- package/build/plugins/resource/spfx/v3/index.js.map +1 -0
- package/build/plugins/resource/spfx/v3/plugin.d.ts +11 -0
- package/build/plugins/resource/spfx/v3/plugin.d.ts.map +1 -0
- package/build/plugins/resource/spfx/v3/plugin.js +290 -0
- package/build/plugins/resource/spfx/v3/plugin.js.map +1 -0
- package/build/plugins/resource/sql/v3/index.d.ts +6 -3
- package/build/plugins/resource/sql/v3/index.d.ts.map +1 -1
- package/build/plugins/resource/sql/v3/index.js +67 -6
- package/build/plugins/resource/sql/v3/index.js.map +1 -1
- package/build/plugins/resource/utils4v2.d.ts +3 -2
- package/build/plugins/resource/utils4v2.d.ts.map +1 -1
- package/build/plugins/resource/utils4v2.js +24 -7
- package/build/plugins/resource/utils4v2.js.map +1 -1
- package/build/plugins/solution/fx-solution/arm.d.ts +2 -2
- package/build/plugins/solution/fx-solution/arm.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/arm.js +51 -51
- package/build/plugins/solution/fx-solution/arm.js.map +1 -1
- package/build/plugins/solution/fx-solution/debug/error.d.ts +0 -1
- package/build/plugins/solution/fx-solution/debug/error.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/debug/error.js +1 -5
- package/build/plugins/solution/fx-solution/debug/error.js.map +1 -1
- package/build/plugins/solution/fx-solution/debug/provisionLocal.d.ts +3 -0
- package/build/plugins/solution/fx-solution/debug/provisionLocal.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/debug/provisionLocal.js +216 -27
- package/build/plugins/solution/fx-solution/debug/provisionLocal.js.map +1 -1
- package/build/plugins/solution/fx-solution/debug/scaffolding.d.ts +1 -2
- package/build/plugins/solution/fx-solution/debug/scaffolding.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/debug/scaffolding.js +10 -15
- package/build/plugins/solution/fx-solution/debug/scaffolding.js.map +1 -1
- package/build/plugins/solution/fx-solution/debug/util/launch.d.ts +1 -1
- package/build/plugins/solution/fx-solution/debug/util/launch.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/debug/util/launch.js +109 -290
- package/build/plugins/solution/fx-solution/debug/util/launch.js.map +1 -1
- package/build/plugins/solution/fx-solution/debug/util/launchNext.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/debug/util/launchNext.js +102 -236
- package/build/plugins/solution/fx-solution/debug/util/launchNext.js.map +1 -1
- package/build/plugins/solution/fx-solution/debug/util/tasks.d.ts +1 -1
- package/build/plugins/solution/fx-solution/debug/util/tasks.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/debug/util/tasks.js +12 -18
- package/build/plugins/solution/fx-solution/debug/util/tasks.js.map +1 -1
- package/build/plugins/solution/fx-solution/debug/util/tasksNext.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/debug/util/tasksNext.js +5 -5
- package/build/plugins/solution/fx-solution/debug/util/tasksNext.js.map +1 -1
- package/build/plugins/solution/fx-solution/solution.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/solution.js +0 -5
- package/build/plugins/solution/fx-solution/solution.js.map +1 -1
- package/build/plugins/solution/fx-solution/v2/provisionLocal.d.ts +2 -0
- package/build/plugins/solution/fx-solution/v2/provisionLocal.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/v2/provisionLocal.js +52 -11
- package/build/plugins/solution/fx-solution/v2/provisionLocal.js.map +1 -1
- package/build/plugins/solution/fx-solution/v2/scaffolding.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/v2/scaffolding.js +4 -1
- package/build/plugins/solution/fx-solution/v2/scaffolding.js.map +1 -1
- package/build/plugins/solution/fx-solution/v3/addFeature.d.ts +4 -3
- package/build/plugins/solution/fx-solution/v3/addFeature.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/v3/addFeature.js +28 -26
- package/build/plugins/solution/fx-solution/v3/addFeature.js.map +1 -1
- package/build/plugins/solution/fx-solution/v3/deploy.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/v3/deploy.js +21 -11
- package/build/plugins/solution/fx-solution/v3/deploy.js.map +1 -1
- package/build/plugins/solution/fx-solution/v3/provision.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/v3/provision.js +10 -3
- package/build/plugins/solution/fx-solution/v3/provision.js.map +1 -1
- package/build/plugins/solution/fx-solution/v3/userTask.d.ts.map +1 -1
- package/build/plugins/solution/fx-solution/v3/userTask.js +52 -56
- package/build/plugins/solution/fx-solution/v3/userTask.js.map +1 -1
- package/build/plugins/solution/spfx-solution/addFeature.d.ts.map +1 -1
- package/build/plugins/solution/spfx-solution/addFeature.js +0 -8
- package/build/plugins/solution/spfx-solution/addFeature.js.map +1 -1
- package/build/plugins/solution/utils/questions.d.ts +3 -3
- package/build/plugins/solution/utils/questions.d.ts.map +1 -1
- package/build/plugins/solution/utils/questions.js +6 -6
- package/build/plugins/solution/utils/questions.js.map +1 -1
- package/package.json +4 -3
- package/resource/strings.json +1 -0
- 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/tab.js.default.zip +0 -0
- package/templates/plugins/resource/frontend/tab.ts.default.zip +0 -0
- 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/storage/bicep/azureStorageProvision.bicep +0 -25
- package/templates/plugins/resource/storage/bicep/provision.template.bicep +0 -15
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var TeamsBot_1;
|
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
3
|
exports.TeamsBot = void 0;
|
|
5
4
|
const tslib_1 = require("tslib");
|
|
@@ -16,10 +15,11 @@ const telemetry_helper_1 = require("./utils/telemetry-helper");
|
|
|
16
15
|
const question_1 = require("../../solution/fx-solution/question");
|
|
17
16
|
const typedi_1 = require("typedi");
|
|
18
17
|
const ResourcePluginContainer_1 = require("../../solution/fx-solution/ResourcePluginContainer");
|
|
18
|
+
const core_1 = require("../../../core");
|
|
19
19
|
require("./v2");
|
|
20
|
+
require("./v3");
|
|
20
21
|
const plugin_2 = require("./dotnet/plugin");
|
|
21
|
-
|
|
22
|
-
let TeamsBot = TeamsBot_1 = class TeamsBot {
|
|
22
|
+
let TeamsBot = class TeamsBot {
|
|
23
23
|
constructor() {
|
|
24
24
|
this.name = "fx-resource-bot";
|
|
25
25
|
this.displayName = "Bot";
|
|
@@ -31,11 +31,7 @@ let TeamsBot = TeamsBot_1 = class TeamsBot {
|
|
|
31
31
|
return cap.includes(question_1.BotOptionItem.id) || cap.includes(question_1.MessageExtensionItem.id);
|
|
32
32
|
}
|
|
33
33
|
getImpl(context) {
|
|
34
|
-
return
|
|
35
|
-
}
|
|
36
|
-
static isVsPlatform(context) {
|
|
37
|
-
var _a;
|
|
38
|
-
return ((_a = context.projectSettings) === null || _a === void 0 ? void 0 : _a.programmingLanguage) === programmingLanguage_1.ProgrammingLanguage.Csharp;
|
|
34
|
+
return core_1.isVSProject(context.projectSettings) ? this.dotnetBotImpl : this.teamsBotImpl;
|
|
39
35
|
}
|
|
40
36
|
async scaffold(context) {
|
|
41
37
|
logger_1.Logger.setLogger(context.logProvider);
|
|
@@ -141,7 +137,7 @@ let TeamsBot = TeamsBot_1 = class TeamsBot {
|
|
|
141
137
|
}
|
|
142
138
|
}
|
|
143
139
|
};
|
|
144
|
-
TeamsBot =
|
|
140
|
+
TeamsBot = tslib_1.__decorate([
|
|
145
141
|
typedi_1.Service(ResourcePluginContainer_1.ResourcePlugins.BotPlugin)
|
|
146
142
|
], TeamsBot);
|
|
147
143
|
exports.TeamsBot = TeamsBot;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/plugins/resource/bot/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/plugins/resource/bot/index.ts"],"names":[],"mappings":";;;;AAAA,uCAAuC;AACvC,kCAAkC;AAClC,wDASgC;AAEhC,qCAA+E;AAC/E,qCAAwC;AACxC,iDAAoD;AACpD,2CAAuE;AACvE,qCAAkD;AAClD,qCAAkC;AAClC,+DAA2D;AAC3D,kEAA0F;AAC1F,mCAAiC;AACjC,gGAAqF;AACrF,wCAA4C;AAC5C,gBAAc;AACd,gBAAc;AACd,4CAAgD;AAKhD,IAAa,QAAQ,GAArB,MAAa,QAAQ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AAM,kBAAkB,GAAG,gBAAgB,CAAC;YAC5C,aAAa;gBACX,kCAAe,CAAC,eAAe,CAC7B,OAAO,EACP,IAAI,EACJ,iCAAa,CAAC,WAAW,CACvB,kBAAkB,EAClB,2BAA2B,CAAC,CAAC,OAAO,EAAE,EACtC,CAAC,CAAC,UAAU,CACb,CACF,CAAC;YACJ,OAAO,iCAAa,CAAC,WAAW,CAAC,kBAAkB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC;SAC/E;IACH,CAAC;IAEO,KAAK,CAAC,wBAAwB,CACpC,OAAsB,EACtB,EAA2B,EAC3B,aAAsB,EACtB,IAAY;QAEZ,IAAI;YACF,aAAa,IAAI,kCAAe,CAAC,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;YAC/D,MAAM,GAAG,GAAa,MAAM,EAAE,EAAE,CAAC;YACjC,aAAa,IAAI,kCAAe,CAAC,eAAe,CAAC,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;YACrE,OAAO,GAAG,CAAC;SACZ;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,iCAAkB,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,2BAA2B;YAC7E,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,IAAI,CAAC,CAAC;SACxD;IACH,CAAC;CACF,CAAA;AAhOY,QAAQ;IADpB,gBAAO,CAAC,yCAAe,CAAC,SAAS,CAAC;GACtB,QAAQ,CAgOpB;AAhOY,4BAAQ;AAkOrB,kBAAe,IAAI,QAAQ,EAAE,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { IProgressHandler, PluginContext } from "@microsoft/teamsfx-api";
|
|
1
|
+
import { IProgressHandler, PluginContext, v2 } from "@microsoft/teamsfx-api";
|
|
2
2
|
export declare class ProgressBarFactory {
|
|
3
3
|
private static progressBars;
|
|
4
|
-
static newProgressBar(name: string, steps_num: number, context: PluginContext): Promise<IProgressHandler | undefined>;
|
|
4
|
+
static newProgressBar(name: string, steps_num: number, context: PluginContext | v2.Context): Promise<IProgressHandler | undefined>;
|
|
5
5
|
static closeProgressBar(success: boolean, name?: string): Promise<void>;
|
|
6
6
|
}
|
|
7
7
|
//# sourceMappingURL=progressBars.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progressBars.d.ts","sourceRoot":"","sources":["../../../../src/plugins/resource/bot/progressBars.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"progressBars.d.ts","sourceRoot":"","sources":["../../../../src/plugins/resource/bot/progressBars.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAE7E,qBAAa,kBAAkB;IAE7B,OAAO,CAAC,MAAM,CAAC,YAAY,CAAwD;WAE/D,cAAc,CAChC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,aAAa,GAAG,EAAE,CAAC,OAAO,GAClC,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;WAqBpB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CASrF"}
|
|
@@ -5,15 +5,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
5
5
|
exports.ProgressBarFactory = void 0;
|
|
6
6
|
class ProgressBarFactory {
|
|
7
7
|
static async newProgressBar(name, steps_num, context) {
|
|
8
|
-
var _a, _b;
|
|
8
|
+
var _a, _b, _c;
|
|
9
9
|
if (ProgressBarFactory.progressBars.has(name)) {
|
|
10
10
|
const handler = ProgressBarFactory.progressBars.get(name);
|
|
11
11
|
await (handler === null || handler === void 0 ? void 0 : handler.end(true));
|
|
12
12
|
return handler;
|
|
13
13
|
}
|
|
14
|
-
const handler = (_a = context.ui) === null || _a === void 0 ? void 0 : _a.createProgressBar(name, steps_num)
|
|
14
|
+
const handler = ((_a = context.ui) === null || _a === void 0 ? void 0 : _a.createProgressBar(name, steps_num)) ||
|
|
15
|
+
((_b = context.userInteraction) === null || _b === void 0 ? void 0 : _b.createProgressBar(name, steps_num));
|
|
15
16
|
if (!handler) {
|
|
16
|
-
(
|
|
17
|
+
(_c = context.logProvider) === null || _c === void 0 ? void 0 : _c.warning(`Fail to create progress bar for ${name}.`);
|
|
17
18
|
}
|
|
18
19
|
ProgressBarFactory.progressBars.set(name, handler);
|
|
19
20
|
return handler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progressBars.js","sourceRoot":"","sources":["../../../../src/plugins/resource/bot/progressBars.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAIlC,MAAa,kBAAkB;IAItB,MAAM,CAAC,KAAK,CAAC,cAAc,CAChC,IAAY,EACZ,SAAiB,EACjB,
|
|
1
|
+
{"version":3,"file":"progressBars.js","sourceRoot":"","sources":["../../../../src/plugins/resource/bot/progressBars.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAIlC,MAAa,kBAAkB;IAItB,MAAM,CAAC,KAAK,CAAC,cAAc,CAChC,IAAY,EACZ,SAAiB,EACjB,OAAmC;;QAEnC,IAAI,kBAAkB,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YAC7C,MAAM,OAAO,GAAG,kBAAkB,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAE1D,MAAM,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,GAAG,CAAC,IAAI,CAAC,CAAA,CAAC;YAEzB,OAAO,OAAO,CAAC;SAChB;QAED,MAAM,OAAO,GACX,CAAA,MAAC,OAAyB,CAAC,EAAE,0CAAE,iBAAiB,CAAC,IAAI,EAAE,SAAS,CAAC;aACjE,MAAC,OAAsB,CAAC,eAAe,0CAAE,iBAAiB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAA,CAAC;QAC9E,IAAI,CAAC,OAAO,EAAE;YACZ,MAAA,OAAO,CAAC,WAAW,0CAAE,OAAO,CAAC,mCAAmC,IAAI,GAAG,CAAC,CAAC;SAC1E;QAED,kBAAkB,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAEnD,OAAO,OAAO,CAAC;IACjB,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,OAAgB,EAAE,IAAa;;QAClE,IAAI,IAAI,EAAE;YACR,MAAM,CAAA,MAAA,kBAAkB,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,0CAAE,GAAG,CAAC,OAAO,CAAC,CAAA,CAAC;SAC/D;aAAM;YACL,KAAK,MAAM,GAAG,IAAI,kBAAkB,CAAC,YAAY,CAAC,IAAI,EAAE,EAAE;gBACxD,MAAM,CAAA,MAAA,kBAAkB,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,0CAAE,GAAG,CAAC,OAAO,CAAC,CAAA,CAAC;aAC9D;SACF;IACH,CAAC;;AArCH,gDAsCC;AArCC,kCAAkC;AACnB,+BAAY,GAA8C,IAAI,GAAG,EAAE,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { UserError } from "@microsoft/teamsfx-api";
|
|
2
|
+
export declare class PreconditionError extends UserError {
|
|
3
|
+
constructor(message: string, suggestions: string[]);
|
|
4
|
+
}
|
|
5
|
+
export declare class TemplateZipFallbackError extends UserError {
|
|
6
|
+
constructor();
|
|
7
|
+
}
|
|
8
|
+
export declare class UnzipError extends UserError {
|
|
9
|
+
constructor(path?: string);
|
|
10
|
+
}
|
|
11
|
+
export declare function CheckThrowSomethingMissing(name: string, value: any): void;
|
|
12
|
+
export declare class PackDirectoryExistenceError extends UserError {
|
|
13
|
+
constructor();
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/resource/bot/v3/error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAInD,qBAAa,iBAAkB,SAAQ,SAAS;gBAClC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE;CAOnD;AAED,qBAAa,wBAAyB,SAAQ,SAAS;;CAWtD;AAED,qBAAa,UAAW,SAAQ,SAAS;gBAC3B,IAAI,CAAC,EAAE,MAAM;CAW1B;AAED,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI,CAIzE;AAED,qBAAa,2BAA4B,SAAQ,SAAS;;CAUzD"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PackDirectoryExistenceError = exports.CheckThrowSomethingMissing = exports.UnzipError = exports.TemplateZipFallbackError = exports.PreconditionError = void 0;
|
|
4
|
+
const teamsfx_api_1 = require("@microsoft/teamsfx-api");
|
|
5
|
+
const messages_1 = require("../resources/messages");
|
|
6
|
+
const result_1 = require("../result");
|
|
7
|
+
class PreconditionError extends teamsfx_api_1.UserError {
|
|
8
|
+
constructor(message, suggestions) {
|
|
9
|
+
super(new.target.name, `${message}. Suggestions: ${suggestions.join(" ")}`, result_1.FxBotPluginResultFactory.source);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.PreconditionError = PreconditionError;
|
|
13
|
+
class TemplateZipFallbackError extends teamsfx_api_1.UserError {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(new.target.name, `Failed to download zip package and open local zip package. Suggestions: ${[
|
|
16
|
+
messages_1.Messages.CheckOutputLogAndTryToFix,
|
|
17
|
+
messages_1.Messages.RetryTheCurrentStep,
|
|
18
|
+
].join(" ")}`, result_1.FxBotPluginResultFactory.source);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.TemplateZipFallbackError = TemplateZipFallbackError;
|
|
22
|
+
class UnzipError extends teamsfx_api_1.UserError {
|
|
23
|
+
constructor(path) {
|
|
24
|
+
super(new.target.name, `Failed to unzip templates and write to disk. Suggestions: ${[
|
|
25
|
+
messages_1.Messages.CheckOutputLogAndTryToFix,
|
|
26
|
+
messages_1.Messages.ReopenWorkingDir(path),
|
|
27
|
+
messages_1.Messages.RetryTheCurrentStep,
|
|
28
|
+
].join(" ")}`, result_1.FxBotPluginResultFactory.source);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.UnzipError = UnzipError;
|
|
32
|
+
function CheckThrowSomethingMissing(name, value) {
|
|
33
|
+
if (!value) {
|
|
34
|
+
throw new PreconditionError(messages_1.Messages.SomethingIsMissing(name), [messages_1.Messages.RetryTheCurrentStep]);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.CheckThrowSomethingMissing = CheckThrowSomethingMissing;
|
|
38
|
+
class PackDirectoryExistenceError extends teamsfx_api_1.UserError {
|
|
39
|
+
constructor() {
|
|
40
|
+
super(new.target.name, `${messages_1.Messages.SomethingIsNotExisting("pack directory")} Suggestions: ${[
|
|
41
|
+
messages_1.Messages.RecreateTheProject,
|
|
42
|
+
].join(" ")}`, result_1.FxBotPluginResultFactory.source);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.PackDirectoryExistenceError = PackDirectoryExistenceError;
|
|
46
|
+
//# sourceMappingURL=error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../../../../src/plugins/resource/bot/v3/error.ts"],"names":[],"mappings":";;;AAAA,wDAAmD;AACnD,oDAAiD;AACjD,sCAAqD;AAErD,MAAa,iBAAkB,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C5B,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EACb,iCAAwB,CAAC,MAAM,CAChC,CAAC;IACJ,CAAC;CACF;AAVD,kEAUC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FxError, Inputs, Result, TokenProvider, v2, v3, Void } from "@microsoft/teamsfx-api";
|
|
2
|
+
import { ProgrammingLanguage } from "../enums/programmingLanguage";
|
|
3
|
+
export declare class NodeJSBotPluginV3 implements v3.FeaturePlugin {
|
|
4
|
+
name: string;
|
|
5
|
+
displayName: string;
|
|
6
|
+
pluginDependencies(ctx: v2.Context, inputs: Inputs): Promise<Result<string[], FxError>>;
|
|
7
|
+
getProgrammingLanguage(ctx: v2.Context): ProgrammingLanguage;
|
|
8
|
+
getLangKey(ctx: v2.Context): string;
|
|
9
|
+
scaffold(ctx: v3.ContextWithManifestProvider, inputs: v2.InputsWithProjectPath): Promise<Result<Void, FxError>>;
|
|
10
|
+
generateResourceTemplate(ctx: v3.ContextWithManifestProvider, inputs: v3.AddFeatureInputs): Promise<Result<v2.ResourceTemplate[], FxError>>;
|
|
11
|
+
addFeature(ctx: v3.ContextWithManifestProvider, inputs: v3.AddFeatureInputs): Promise<Result<v2.ResourceTemplate[], FxError>>;
|
|
12
|
+
afterOtherFeaturesAdded(ctx: v3.ContextWithManifestProvider, inputs: v3.OtherFeaturesAddedInputs): Promise<Result<v2.ResourceTemplate[], FxError>>;
|
|
13
|
+
private getAzureAccountCredential;
|
|
14
|
+
private createOrGetBotAppRegistration;
|
|
15
|
+
provisionResource(ctx: v2.Context, inputs: v2.InputsWithProjectPath, envInfo: v3.EnvInfoV3, tokenProvider: TokenProvider): Promise<Result<Void, FxError>>;
|
|
16
|
+
private updateMessageEndpointOnAppStudio;
|
|
17
|
+
configureResource(ctx: v2.Context, inputs: v2.InputsWithProjectPath, envInfo: v3.EnvInfoV3, tokenProvider: TokenProvider): Promise<Result<Void, FxError>>;
|
|
18
|
+
deploy(ctx: v2.Context, inputs: v2.InputsWithProjectPath, envInfo: v2.DeepReadonly<v3.EnvInfoV3>, tokenProvider: TokenProvider): Promise<Result<Void, FxError>>;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/resource/bot/v3/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAKL,OAAO,EACP,MAAM,EAEN,MAAM,EACN,aAAa,EACb,EAAE,EACF,EAAE,EACF,IAAI,EACL,MAAM,wBAAwB,CAAC;AAmDhC,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAUnE,qBACa,iBAAkB,YAAW,EAAE,CAAC,aAAa;IACxD,IAAI,SAAiC;IACrC,WAAW,SAAgB;IACrB,kBAAkB,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,OAAO,CAAC,CAAC;IAG7F,sBAAsB,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,GAAG,mBAAmB;IAU5D,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,GAAG,MAAM;IAa7B,QAAQ,CACZ,GAAG,EAAE,EAAE,CAAC,2BAA2B,EACnC,MAAM,EAAE,EAAE,CAAC,qBAAqB,GAC/B,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IA8C3B,wBAAwB,CAC5B,GAAG,EAAE,EAAE,CAAC,2BAA2B,EACnC,MAAM,EAAE,EAAE,CAAC,gBAAgB,GAC1B,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,EAAE,OAAO,CAAC,CAAC;IA2C5C,UAAU,CACd,GAAG,EAAE,EAAE,CAAC,2BAA2B,EACnC,MAAM,EAAE,EAAE,CAAC,gBAAgB,GAC1B,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,EAAE,OAAO,CAAC,CAAC;IAsC5C,uBAAuB,CAC3B,GAAG,EAAE,EAAE,CAAC,2BAA2B,EACnC,MAAM,EAAE,EAAE,CAAC,wBAAwB,GAClC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,EAAE,OAAO,CAAC,CAAC;YAmBpC,yBAAyB;YAUzB,6BAA6B;IAsDrC,iBAAiB,CACrB,GAAG,EAAE,EAAE,CAAC,OAAO,EACf,MAAM,EAAE,EAAE,CAAC,qBAAqB,EAChC,OAAO,EAAE,EAAE,CAAC,SAAS,EACrB,aAAa,EAAE,aAAa,GAC3B,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YA2CnB,gCAAgC;IAuBxC,iBAAiB,CACrB,GAAG,EAAE,EAAE,CAAC,OAAO,EACf,MAAM,EAAE,EAAE,CAAC,qBAAqB,EAChC,OAAO,EAAE,EAAE,CAAC,SAAS,EACrB,aAAa,EAAE,aAAa,GAC3B,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAe3B,MAAM,CACV,GAAG,EAAE,EAAE,CAAC,OAAO,EACf,MAAM,EAAE,EAAE,CAAC,qBAAqB,EAChC,OAAO,EAAE,EAAE,CAAC,YAAY,CAAC,EAAE,CAAC,SAAS,CAAC,EACtC,aAAa,EAAE,aAAa,GAC3B,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;CAgGlC"}
|
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) Microsoft Corporation.
|
|
3
|
+
// Licensed under the MIT license.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.NodeJSBotPluginV3 = void 0;
|
|
6
|
+
const tslib_1 = require("tslib");
|
|
7
|
+
const hooks_1 = require("@feathersjs/hooks");
|
|
8
|
+
const teamsfx_api_1 = require("@microsoft/teamsfx-api");
|
|
9
|
+
const path = tslib_1.__importStar(require("path"));
|
|
10
|
+
const typedi_1 = require("typedi");
|
|
11
|
+
const constants_1 = require("../../../../common/constants");
|
|
12
|
+
const tools_1 = require("../../../../common/tools");
|
|
13
|
+
const CommonErrorHandlerMW_1 = require("../../../../core/middleware/CommonErrorHandlerMW");
|
|
14
|
+
const folder_1 = require("../../../../folder");
|
|
15
|
+
const question_1 = require("../../../solution/fx-solution/question");
|
|
16
|
+
const constants_2 = require("../../../solution/fx-solution/v3/constants");
|
|
17
|
+
const constants_3 = require("../constants");
|
|
18
|
+
const languageStrategy_1 = require("../languageStrategy");
|
|
19
|
+
const progressBars_1 = require("../progressBars");
|
|
20
|
+
const messages_1 = require("../resources/messages");
|
|
21
|
+
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
22
|
+
const strings_1 = require("../resources/strings");
|
|
23
|
+
const factory = tslib_1.__importStar(require("../clientFactory"));
|
|
24
|
+
const resourceNameFactory_1 = require("../utils/resourceNameFactory");
|
|
25
|
+
const aadRegistration_1 = require("../aadRegistration");
|
|
26
|
+
const appStudio_1 = require("../appStudio/appStudio");
|
|
27
|
+
const deployMgr_1 = require("../deployMgr");
|
|
28
|
+
const utils = tslib_1.__importStar(require("../utils/common"));
|
|
29
|
+
const appService = tslib_1.__importStar(require("@azure/arm-appservice"));
|
|
30
|
+
const azureOps_1 = require("../azureOps");
|
|
31
|
+
const zipDeploy_1 = require("../utils/zipDeploy");
|
|
32
|
+
const templatesActions_1 = require("../../../../common/template-utils/templatesActions");
|
|
33
|
+
const programmingLanguage_1 = require("../enums/programmingLanguage");
|
|
34
|
+
const error_1 = require("./error");
|
|
35
|
+
const solutionSettingsHelper_1 = require("../../../solution/fx-solution/utils/solutionSettingsHelper");
|
|
36
|
+
let NodeJSBotPluginV3 = class NodeJSBotPluginV3 {
|
|
37
|
+
constructor() {
|
|
38
|
+
this.name = constants_2.BuiltInFeaturePluginNames.bot;
|
|
39
|
+
this.displayName = "NodeJS Bot";
|
|
40
|
+
}
|
|
41
|
+
async pluginDependencies(ctx, inputs) {
|
|
42
|
+
return teamsfx_api_1.ok([constants_2.BuiltInFeaturePluginNames.identity]);
|
|
43
|
+
}
|
|
44
|
+
getProgrammingLanguage(ctx) {
|
|
45
|
+
const rawProgrammingLanguage = ctx.projectSetting.programmingLanguage;
|
|
46
|
+
if (rawProgrammingLanguage &&
|
|
47
|
+
utils.existsInEnumValues(rawProgrammingLanguage, programmingLanguage_1.ProgrammingLanguage)) {
|
|
48
|
+
return rawProgrammingLanguage;
|
|
49
|
+
}
|
|
50
|
+
return programmingLanguage_1.ProgrammingLanguage.JavaScript;
|
|
51
|
+
}
|
|
52
|
+
getLangKey(ctx) {
|
|
53
|
+
const rawProgrammingLanguage = ctx.projectSetting.programmingLanguage;
|
|
54
|
+
if (rawProgrammingLanguage &&
|
|
55
|
+
utils.existsInEnumValues(rawProgrammingLanguage, programmingLanguage_1.ProgrammingLanguage)) {
|
|
56
|
+
const programmingLanguage = rawProgrammingLanguage;
|
|
57
|
+
return utils.convertToLangKey(programmingLanguage);
|
|
58
|
+
}
|
|
59
|
+
return "js";
|
|
60
|
+
}
|
|
61
|
+
async scaffold(ctx, inputs) {
|
|
62
|
+
ctx.logProvider.info(messages_1.Messages.ScaffoldingBot);
|
|
63
|
+
const handler = await progressBars_1.ProgressBarFactory.newProgressBar(constants_3.ProgressBarConstants.SCAFFOLD_TITLE, constants_3.ProgressBarConstants.SCAFFOLD_STEPS_NUM, ctx);
|
|
64
|
+
await (handler === null || handler === void 0 ? void 0 : handler.start(constants_3.ProgressBarConstants.SCAFFOLD_STEP_START));
|
|
65
|
+
const group_name = constants_3.TemplateProjectsConstants.GROUP_NAME_BOT_MSGEXT;
|
|
66
|
+
const lang = this.getLangKey(ctx);
|
|
67
|
+
const workingDir = path.join(inputs.projectPath, strings_1.CommonStrings.BOT_WORKING_DIR_NAME);
|
|
68
|
+
await (handler === null || handler === void 0 ? void 0 : handler.next(constants_3.ProgressBarConstants.SCAFFOLD_STEP_FETCH_ZIP));
|
|
69
|
+
await templatesActions_1.scaffoldFromTemplates({
|
|
70
|
+
group: group_name,
|
|
71
|
+
lang: lang,
|
|
72
|
+
scenario: constants_3.TemplateProjectsConstants.DEFAULT_SCENARIO_NAME,
|
|
73
|
+
templatesFolderName: constants_3.TemplateProjectsConstants.TEMPLATE_FOLDER_NAME,
|
|
74
|
+
dst: workingDir,
|
|
75
|
+
onActionEnd: async (action, context) => {
|
|
76
|
+
var _a;
|
|
77
|
+
if (action.name === templatesActions_1.ScaffoldActionName.FetchTemplatesUrlWithTag) {
|
|
78
|
+
ctx.logProvider.info(messages_1.Messages.SuccessfullyRetrievedTemplateZip((_a = context.zipUrl) !== null && _a !== void 0 ? _a : ""));
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
onActionError: async (action, context, error) => {
|
|
82
|
+
ctx.logProvider.info(error.toString());
|
|
83
|
+
switch (action.name) {
|
|
84
|
+
case templatesActions_1.ScaffoldActionName.FetchTemplatesUrlWithTag:
|
|
85
|
+
case templatesActions_1.ScaffoldActionName.FetchTemplatesZipFromUrl:
|
|
86
|
+
ctx.logProvider.info(messages_1.Messages.FallingBackToUseLocalTemplateZip);
|
|
87
|
+
break;
|
|
88
|
+
case templatesActions_1.ScaffoldActionName.FetchTemplateZipFromLocal:
|
|
89
|
+
throw new error_1.TemplateZipFallbackError();
|
|
90
|
+
case templatesActions_1.ScaffoldActionName.Unzip:
|
|
91
|
+
throw new error_1.UnzipError(context.dst);
|
|
92
|
+
default:
|
|
93
|
+
throw new Error(error.message);
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
ctx.logProvider.info(messages_1.Messages.SuccessfullyScaffoldedBot);
|
|
98
|
+
handler === null || handler === void 0 ? void 0 : handler.end(true);
|
|
99
|
+
return teamsfx_api_1.ok(teamsfx_api_1.Void);
|
|
100
|
+
}
|
|
101
|
+
async generateResourceTemplate(ctx, inputs) {
|
|
102
|
+
const pluginCtx = { plugins: inputs.allPluginsAfterAdd };
|
|
103
|
+
const bicepTemplateDir = path.join(folder_1.getTemplatesFolder(), constants_3.PathInfo.BicepTemplateRelativeDir);
|
|
104
|
+
const provisionOrchestration = await tools_1.generateBicepFromFile(path.join(bicepTemplateDir, constants_1.Bicep.ProvisionFileName), pluginCtx);
|
|
105
|
+
const provisionModules = await tools_1.generateBicepFromFile(path.join(bicepTemplateDir, constants_3.PathInfo.ProvisionModuleTemplateFileName), pluginCtx);
|
|
106
|
+
const configOrchestration = await tools_1.generateBicepFromFile(path.join(bicepTemplateDir, constants_1.Bicep.ConfigFileName), pluginCtx);
|
|
107
|
+
const configModule = await tools_1.generateBicepFromFile(path.join(bicepTemplateDir, constants_3.PathInfo.ConfigurationModuleTemplateFileName), pluginCtx);
|
|
108
|
+
const result = {
|
|
109
|
+
Provision: {
|
|
110
|
+
Orchestration: provisionOrchestration,
|
|
111
|
+
Modules: { bot: provisionModules },
|
|
112
|
+
},
|
|
113
|
+
Configuration: {
|
|
114
|
+
Orchestration: configOrchestration,
|
|
115
|
+
Modules: { bot: configModule },
|
|
116
|
+
},
|
|
117
|
+
Reference: {
|
|
118
|
+
resourceId: constants_3.BotBicep.resourceId,
|
|
119
|
+
hostName: constants_3.BotBicep.hostName,
|
|
120
|
+
webAppEndpoint: constants_3.BotBicep.webAppEndpoint,
|
|
121
|
+
},
|
|
122
|
+
Parameters: JSON.parse(await fs_extra_1.default.readFile(path.join(bicepTemplateDir, constants_1.Bicep.ParameterFileName), constants_1.ConstantString.UTF8Encoding)),
|
|
123
|
+
};
|
|
124
|
+
return teamsfx_api_1.ok([{ kind: "bicep", template: result }]);
|
|
125
|
+
}
|
|
126
|
+
async addFeature(ctx, inputs) {
|
|
127
|
+
solutionSettingsHelper_1.ensureSolutionSettings(ctx.projectSetting);
|
|
128
|
+
const solutionSettings = ctx.projectSetting.solutionSettings;
|
|
129
|
+
const capabilities = solutionSettings.capabilities;
|
|
130
|
+
const newCapabilitySet = new Set();
|
|
131
|
+
capabilities.forEach((c) => newCapabilitySet.add(c));
|
|
132
|
+
const activeResourcePlugins = solutionSettings.activeResourcePlugins;
|
|
133
|
+
let templates = [];
|
|
134
|
+
if (!activeResourcePlugins.includes(this.name)) {
|
|
135
|
+
// bot plugin is added for first time, scaffold and generate resource template
|
|
136
|
+
const scaffoldRes = await this.scaffold(ctx, inputs);
|
|
137
|
+
if (scaffoldRes.isErr())
|
|
138
|
+
return teamsfx_api_1.err(scaffoldRes.error);
|
|
139
|
+
const armRes = await this.generateResourceTemplate(ctx, inputs);
|
|
140
|
+
if (armRes.isErr())
|
|
141
|
+
return teamsfx_api_1.err(armRes.error);
|
|
142
|
+
templates = armRes.value;
|
|
143
|
+
}
|
|
144
|
+
const capabilitiesToAddManifest = [];
|
|
145
|
+
const capabilitiesAnswer = inputs[question_1.AzureSolutionQuestionNames.Capabilities];
|
|
146
|
+
if (capabilitiesAnswer.includes(question_1.BotOptionItem.id)) {
|
|
147
|
+
capabilitiesToAddManifest.push({ name: "Bot" });
|
|
148
|
+
newCapabilitySet.add(question_1.BotOptionItem.id);
|
|
149
|
+
}
|
|
150
|
+
if (capabilitiesAnswer.includes(question_1.MessageExtensionItem.id)) {
|
|
151
|
+
capabilitiesToAddManifest.push({ name: "MessageExtension" });
|
|
152
|
+
newCapabilitySet.add(question_1.MessageExtensionItem.id);
|
|
153
|
+
}
|
|
154
|
+
const update = await ctx.appManifestProvider.addCapabilities(ctx, inputs, capabilitiesToAddManifest);
|
|
155
|
+
if (update.isErr())
|
|
156
|
+
return teamsfx_api_1.err(update.error);
|
|
157
|
+
solutionSettings.capabilities = Array.from(newCapabilitySet);
|
|
158
|
+
if (!activeResourcePlugins.includes(this.name))
|
|
159
|
+
activeResourcePlugins.push(this.name);
|
|
160
|
+
return teamsfx_api_1.ok(templates);
|
|
161
|
+
}
|
|
162
|
+
async afterOtherFeaturesAdded(ctx, inputs) {
|
|
163
|
+
const pluginCtx = { plugins: inputs.allPluginsAfterAdd };
|
|
164
|
+
const bicepTemplateDir = path.join(folder_1.getTemplatesFolder(), constants_3.PathInfo.BicepTemplateRelativeDir);
|
|
165
|
+
const configModule = await tools_1.generateBicepFromFile(path.join(bicepTemplateDir, constants_3.PathInfo.ConfigurationModuleTemplateFileName), pluginCtx);
|
|
166
|
+
const result = {
|
|
167
|
+
Reference: {
|
|
168
|
+
resourceId: constants_3.BotBicep.resourceId,
|
|
169
|
+
hostName: constants_3.BotBicep.hostName,
|
|
170
|
+
webAppEndpoint: constants_3.BotBicep.webAppEndpoint,
|
|
171
|
+
},
|
|
172
|
+
Configuration: {
|
|
173
|
+
Modules: { bot: configModule },
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
return teamsfx_api_1.ok([{ kind: "bicep", template: result }]);
|
|
177
|
+
}
|
|
178
|
+
async getAzureAccountCredential(tokenProvider) {
|
|
179
|
+
const serviceClientCredentials = await tokenProvider.getAccountCredentialAsync();
|
|
180
|
+
if (!serviceClientCredentials) {
|
|
181
|
+
throw new error_1.PreconditionError(messages_1.Messages.FailToGetAzureCreds, [messages_1.Messages.TryLoginAzure]);
|
|
182
|
+
}
|
|
183
|
+
return serviceClientCredentials;
|
|
184
|
+
}
|
|
185
|
+
async createOrGetBotAppRegistration(ctx, envInfo, tokenProvider) {
|
|
186
|
+
const token = await tokenProvider.graphTokenProvider.getAccessToken();
|
|
187
|
+
error_1.CheckThrowSomethingMissing(strings_1.ConfigNames.GRAPH_TOKEN, token);
|
|
188
|
+
error_1.CheckThrowSomethingMissing(strings_1.CommonStrings.SHORT_APP_NAME, ctx.projectSetting.appName);
|
|
189
|
+
let botConfig = envInfo.state[this.name];
|
|
190
|
+
if (!botConfig)
|
|
191
|
+
botConfig = {};
|
|
192
|
+
botConfig = botConfig;
|
|
193
|
+
const botAADCreated = (botConfig === null || botConfig === void 0 ? void 0 : botConfig.botId) !== undefined && (botConfig === null || botConfig === void 0 ? void 0 : botConfig.botPassword) !== undefined;
|
|
194
|
+
if (!botAADCreated) {
|
|
195
|
+
const solutionConfig = envInfo === null || envInfo === void 0 ? void 0 : envInfo.state.solution;
|
|
196
|
+
const resourceNameSuffix = solutionConfig.resourceNameSuffix
|
|
197
|
+
? solutionConfig.resourceNameSuffix
|
|
198
|
+
: utils.genUUID();
|
|
199
|
+
const aadDisplayName = resourceNameFactory_1.ResourceNameFactory.createCommonName(resourceNameSuffix, ctx.projectSetting.appName, constants_3.MaxLengths.AAD_DISPLAY_NAME);
|
|
200
|
+
const botAuthCreds = await aadRegistration_1.AADRegistration.registerAADAppAndGetSecretByGraph(token, aadDisplayName, botConfig.objectId, botConfig.botId);
|
|
201
|
+
botConfig.botId = botAuthCreds.clientId;
|
|
202
|
+
botConfig.botPassword = botAuthCreds.clientSecret;
|
|
203
|
+
botConfig.objectId = botAuthCreds.objectId;
|
|
204
|
+
ctx.logProvider.info(messages_1.Messages.SuccessfullyCreatedBotAadApp);
|
|
205
|
+
}
|
|
206
|
+
if (envInfo.envName === "local") {
|
|
207
|
+
// 2. Register bot by app studio.
|
|
208
|
+
const botReg = {
|
|
209
|
+
botId: botConfig.botId,
|
|
210
|
+
name: ctx.projectSetting.appName + strings_1.PluginLocalDebug.LOCAL_DEBUG_SUFFIX,
|
|
211
|
+
description: "",
|
|
212
|
+
iconUrl: "",
|
|
213
|
+
messagingEndpoint: "",
|
|
214
|
+
callingEndpoint: "",
|
|
215
|
+
};
|
|
216
|
+
ctx.logProvider.info(messages_1.Messages.ProvisioningBotRegistration);
|
|
217
|
+
const appStudioToken = await tokenProvider.appStudioToken.getAccessToken();
|
|
218
|
+
error_1.CheckThrowSomethingMissing(strings_1.ConfigNames.APPSTUDIO_TOKEN, appStudioToken);
|
|
219
|
+
await appStudio_1.AppStudio.createBotRegistration(appStudioToken, botReg);
|
|
220
|
+
ctx.logProvider.info(messages_1.Messages.SuccessfullyProvisionedBotRegistration);
|
|
221
|
+
}
|
|
222
|
+
return teamsfx_api_1.ok(teamsfx_api_1.Void);
|
|
223
|
+
}
|
|
224
|
+
async provisionResource(ctx, inputs, envInfo, tokenProvider) {
|
|
225
|
+
const botState = envInfo.state[this.name];
|
|
226
|
+
if (!botState.secretFields)
|
|
227
|
+
botState.secretFields = ["botPassword"];
|
|
228
|
+
if (envInfo.envName === "local") {
|
|
229
|
+
const handler = await progressBars_1.ProgressBarFactory.newProgressBar(constants_3.ProgressBarConstants.LOCAL_DEBUG_TITLE, constants_3.ProgressBarConstants.LOCAL_DEBUG_STEPS_NUM, ctx);
|
|
230
|
+
await (handler === null || handler === void 0 ? void 0 : handler.start(constants_3.ProgressBarConstants.LOCAL_DEBUG_STEP_START));
|
|
231
|
+
await (handler === null || handler === void 0 ? void 0 : handler.next(constants_3.ProgressBarConstants.LOCAL_DEBUG_STEP_BOT_REG));
|
|
232
|
+
await this.createOrGetBotAppRegistration(ctx, envInfo, tokenProvider);
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
ctx.logProvider.info(messages_1.Messages.ProvisioningBot);
|
|
236
|
+
// Create and register progress bar for cleanup.
|
|
237
|
+
const handler = await progressBars_1.ProgressBarFactory.newProgressBar(constants_3.ProgressBarConstants.PROVISION_TITLE, 1, ctx);
|
|
238
|
+
await (handler === null || handler === void 0 ? void 0 : handler.start(constants_3.ProgressBarConstants.PROVISION_STEP_START));
|
|
239
|
+
// 0. Check Resource Provider
|
|
240
|
+
const azureCredential = await this.getAzureAccountCredential(tokenProvider.azureAccountProvider);
|
|
241
|
+
const solutionConfig = envInfo.state.solution;
|
|
242
|
+
const rpClient = factory.createResourceProviderClient(azureCredential, solutionConfig.subscriptionId);
|
|
243
|
+
await factory.ensureResourceProvider(rpClient, constants_3.AzureConstants.requiredResourceProviders);
|
|
244
|
+
// 1. Do bot registration.
|
|
245
|
+
await (handler === null || handler === void 0 ? void 0 : handler.next(constants_3.ProgressBarConstants.PROVISION_STEP_BOT_REG));
|
|
246
|
+
await this.createOrGetBotAppRegistration(ctx, envInfo, tokenProvider);
|
|
247
|
+
await (handler === null || handler === void 0 ? void 0 : handler.end(true));
|
|
248
|
+
}
|
|
249
|
+
return teamsfx_api_1.ok(teamsfx_api_1.Void);
|
|
250
|
+
}
|
|
251
|
+
async updateMessageEndpointOnAppStudio(appName, tokenProvider, botId, endpoint) {
|
|
252
|
+
const appStudioToken = await tokenProvider.appStudioToken.getAccessToken();
|
|
253
|
+
error_1.CheckThrowSomethingMissing(strings_1.ConfigNames.APPSTUDIO_TOKEN, appStudioToken);
|
|
254
|
+
error_1.CheckThrowSomethingMissing(strings_1.ConfigNames.LOCAL_BOT_ID, botId);
|
|
255
|
+
const botReg = {
|
|
256
|
+
botId: botId,
|
|
257
|
+
name: appName + strings_1.PluginLocalDebug.LOCAL_DEBUG_SUFFIX,
|
|
258
|
+
description: "",
|
|
259
|
+
iconUrl: "",
|
|
260
|
+
messagingEndpoint: endpoint,
|
|
261
|
+
callingEndpoint: "",
|
|
262
|
+
};
|
|
263
|
+
await appStudio_1.AppStudio.updateMessageEndpoint(appStudioToken, botReg.botId, botReg);
|
|
264
|
+
}
|
|
265
|
+
async configureResource(ctx, inputs, envInfo, tokenProvider) {
|
|
266
|
+
if (envInfo.envName === "local") {
|
|
267
|
+
const botConfig = envInfo.state[this.name];
|
|
268
|
+
error_1.CheckThrowSomethingMissing(strings_1.ConfigNames.LOCAL_ENDPOINT, botConfig.siteEndpoint);
|
|
269
|
+
await this.updateMessageEndpointOnAppStudio(ctx.projectSetting.appName, tokenProvider, botConfig.botId, `${botConfig.siteEndpoint}${strings_1.CommonStrings.MESSAGE_ENDPOINT_SUFFIX}`);
|
|
270
|
+
}
|
|
271
|
+
return teamsfx_api_1.ok(teamsfx_api_1.Void);
|
|
272
|
+
}
|
|
273
|
+
async deploy(ctx, inputs, envInfo, tokenProvider) {
|
|
274
|
+
var _a;
|
|
275
|
+
ctx.logProvider.info(messages_1.Messages.PreDeployingBot);
|
|
276
|
+
// Preconditions checking.
|
|
277
|
+
const workingDir = path.join(inputs.projectPath, strings_1.CommonStrings.BOT_WORKING_DIR_NAME);
|
|
278
|
+
if (!workingDir) {
|
|
279
|
+
throw new error_1.PreconditionError(messages_1.Messages.WorkingDirIsMissing, []);
|
|
280
|
+
}
|
|
281
|
+
const packDirExisted = await fs_extra_1.default.pathExists(workingDir);
|
|
282
|
+
if (!packDirExisted) {
|
|
283
|
+
throw new error_1.PackDirectoryExistenceError();
|
|
284
|
+
}
|
|
285
|
+
const botConfig = envInfo.state[this.name];
|
|
286
|
+
const programmingLanguage = this.getProgrammingLanguage(ctx);
|
|
287
|
+
error_1.CheckThrowSomethingMissing(strings_1.ConfigNames.SITE_ENDPOINT, botConfig.siteEndpoint);
|
|
288
|
+
error_1.CheckThrowSomethingMissing(strings_1.ConfigNames.PROGRAMMING_LANGUAGE, programmingLanguage);
|
|
289
|
+
error_1.CheckThrowSomethingMissing(strings_1.ConfigNames.BOT_SERVICE_RESOURCE_ID, botConfig.botWebAppResourceId);
|
|
290
|
+
const subscriptionId = tools_1.getSubscriptionIdFromResourceId(botConfig.botWebAppResourceId);
|
|
291
|
+
const resourceGroup = tools_1.getResourceGroupNameFromResourceId(botConfig.botWebAppResourceId);
|
|
292
|
+
const siteName = tools_1.getSiteNameFromResourceId(botConfig.botWebAppResourceId);
|
|
293
|
+
error_1.CheckThrowSomethingMissing(strings_1.ConfigNames.SUBSCRIPTION_ID, subscriptionId);
|
|
294
|
+
error_1.CheckThrowSomethingMissing(strings_1.ConfigNames.RESOURCE_GROUP, resourceGroup);
|
|
295
|
+
ctx.logProvider.info(messages_1.Messages.DeployingBot);
|
|
296
|
+
const deployTimeCandidate = Date.now();
|
|
297
|
+
const deployMgr = new deployMgr_1.DeployMgr(workingDir, envInfo.envName);
|
|
298
|
+
await deployMgr.init();
|
|
299
|
+
if (!(await deployMgr.needsToRedeploy())) {
|
|
300
|
+
ctx.logProvider.debug(messages_1.Messages.SkipDeployNoUpdates);
|
|
301
|
+
return teamsfx_api_1.ok(teamsfx_api_1.Void);
|
|
302
|
+
}
|
|
303
|
+
const handler = await progressBars_1.ProgressBarFactory.newProgressBar(constants_3.ProgressBarConstants.DEPLOY_TITLE, constants_3.ProgressBarConstants.DEPLOY_STEPS_NUM, ctx);
|
|
304
|
+
await (handler === null || handler === void 0 ? void 0 : handler.start(constants_3.ProgressBarConstants.DEPLOY_STEP_START));
|
|
305
|
+
await (handler === null || handler === void 0 ? void 0 : handler.next(constants_3.ProgressBarConstants.DEPLOY_STEP_NPM_INSTALL));
|
|
306
|
+
const unPackFlag = (_a = envInfo.config.bot) === null || _a === void 0 ? void 0 : _a.unPackFlag;
|
|
307
|
+
await languageStrategy_1.LanguageStrategy.localBuild(programmingLanguage, workingDir, unPackFlag === "false" ? false : true);
|
|
308
|
+
await (handler === null || handler === void 0 ? void 0 : handler.next(constants_3.ProgressBarConstants.DEPLOY_STEP_ZIP_FOLDER));
|
|
309
|
+
const zipBuffer = utils.zipAFolder(workingDir, constants_3.DeployConfigs.UN_PACK_DIRS, [
|
|
310
|
+
`${constants_3.FolderNames.NODE_MODULES}/${constants_3.FolderNames.KEYTAR}`,
|
|
311
|
+
]);
|
|
312
|
+
// 2.2 Retrieve publishing credentials.
|
|
313
|
+
const webSiteMgmtClient = new appService.WebSiteManagementClient(await this.getAzureAccountCredential(tokenProvider.azureAccountProvider), subscriptionId);
|
|
314
|
+
const listResponse = await azureOps_1.AzureOperations.ListPublishingCredentials(webSiteMgmtClient, resourceGroup, siteName);
|
|
315
|
+
const publishingUserName = listResponse.publishingUserName
|
|
316
|
+
? listResponse.publishingUserName
|
|
317
|
+
: "";
|
|
318
|
+
const publishingPassword = listResponse.publishingPassword
|
|
319
|
+
? listResponse.publishingPassword
|
|
320
|
+
: "";
|
|
321
|
+
const encryptedCreds = utils.toBase64(`${publishingUserName}:${publishingPassword}`);
|
|
322
|
+
const config = {
|
|
323
|
+
headers: {
|
|
324
|
+
Authorization: `Basic ${encryptedCreds}`,
|
|
325
|
+
},
|
|
326
|
+
maxContentLength: Infinity,
|
|
327
|
+
maxBodyLength: Infinity,
|
|
328
|
+
};
|
|
329
|
+
const zipDeployEndpoint = zipDeploy_1.getZipDeployEndpoint(botConfig.siteName);
|
|
330
|
+
await (handler === null || handler === void 0 ? void 0 : handler.next(constants_3.ProgressBarConstants.DEPLOY_STEP_ZIP_DEPLOY));
|
|
331
|
+
await azureOps_1.AzureOperations.ZipDeployPackage(zipDeployEndpoint, zipBuffer, config);
|
|
332
|
+
await deployMgr.updateLastDeployTime(deployTimeCandidate);
|
|
333
|
+
await (handler === null || handler === void 0 ? void 0 : handler.end(true));
|
|
334
|
+
ctx.logProvider.info(messages_1.Messages.SuccessfullyDeployedBot);
|
|
335
|
+
return teamsfx_api_1.ok(teamsfx_api_1.Void);
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
tslib_1.__decorate([
|
|
339
|
+
hooks_1.hooks([CommonErrorHandlerMW_1.CommonErrorHandlerMW({ telemetry: { component: constants_2.BuiltInFeaturePluginNames.bot } })]),
|
|
340
|
+
tslib_1.__metadata("design:type", Function),
|
|
341
|
+
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
342
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
343
|
+
], NodeJSBotPluginV3.prototype, "scaffold", null);
|
|
344
|
+
tslib_1.__decorate([
|
|
345
|
+
hooks_1.hooks([CommonErrorHandlerMW_1.CommonErrorHandlerMW({ telemetry: { component: constants_2.BuiltInFeaturePluginNames.bot } })]),
|
|
346
|
+
tslib_1.__metadata("design:type", Function),
|
|
347
|
+
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
348
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
349
|
+
], NodeJSBotPluginV3.prototype, "generateResourceTemplate", null);
|
|
350
|
+
tslib_1.__decorate([
|
|
351
|
+
hooks_1.hooks([CommonErrorHandlerMW_1.CommonErrorHandlerMW({ telemetry: { component: constants_2.BuiltInFeaturePluginNames.bot } })]),
|
|
352
|
+
tslib_1.__metadata("design:type", Function),
|
|
353
|
+
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
354
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
355
|
+
], NodeJSBotPluginV3.prototype, "addFeature", null);
|
|
356
|
+
tslib_1.__decorate([
|
|
357
|
+
hooks_1.hooks([CommonErrorHandlerMW_1.CommonErrorHandlerMW({ telemetry: { component: constants_2.BuiltInFeaturePluginNames.bot } })]),
|
|
358
|
+
tslib_1.__metadata("design:type", Function),
|
|
359
|
+
tslib_1.__metadata("design:paramtypes", [Object, Object]),
|
|
360
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
361
|
+
], NodeJSBotPluginV3.prototype, "afterOtherFeaturesAdded", null);
|
|
362
|
+
tslib_1.__decorate([
|
|
363
|
+
hooks_1.hooks([CommonErrorHandlerMW_1.CommonErrorHandlerMW({ telemetry: { component: constants_2.BuiltInFeaturePluginNames.bot } })]),
|
|
364
|
+
tslib_1.__metadata("design:type", Function),
|
|
365
|
+
tslib_1.__metadata("design:paramtypes", [Object, Object, Object, Object]),
|
|
366
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
367
|
+
], NodeJSBotPluginV3.prototype, "provisionResource", null);
|
|
368
|
+
tslib_1.__decorate([
|
|
369
|
+
hooks_1.hooks([CommonErrorHandlerMW_1.CommonErrorHandlerMW({ telemetry: { component: constants_2.BuiltInFeaturePluginNames.bot } })]),
|
|
370
|
+
tslib_1.__metadata("design:type", Function),
|
|
371
|
+
tslib_1.__metadata("design:paramtypes", [Object, Object, Object, Object]),
|
|
372
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
373
|
+
], NodeJSBotPluginV3.prototype, "configureResource", null);
|
|
374
|
+
tslib_1.__decorate([
|
|
375
|
+
hooks_1.hooks([CommonErrorHandlerMW_1.CommonErrorHandlerMW({ telemetry: { component: constants_2.BuiltInFeaturePluginNames.bot } })]),
|
|
376
|
+
tslib_1.__metadata("design:type", Function),
|
|
377
|
+
tslib_1.__metadata("design:paramtypes", [Object, Object, Object, Object]),
|
|
378
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
379
|
+
], NodeJSBotPluginV3.prototype, "deploy", null);
|
|
380
|
+
NodeJSBotPluginV3 = tslib_1.__decorate([
|
|
381
|
+
typedi_1.Service(constants_2.BuiltInFeaturePluginNames.bot)
|
|
382
|
+
], NodeJSBotPluginV3);
|
|
383
|
+
exports.NodeJSBotPluginV3 = NodeJSBotPluginV3;
|
|
384
|
+
//# sourceMappingURL=index.js.map
|