@microsoft/teamsfx-core 2.0.0 → 2.0.1-alpha.22d101afe.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/build/common/armInterface.d.ts +0 -5
  2. package/build/common/armInterface.d.ts.map +1 -1
  3. package/build/common/deps-checker/checkerFactory.d.ts.map +1 -1
  4. package/build/common/deps-checker/checkerFactory.js +0 -7
  5. package/build/common/deps-checker/checkerFactory.js.map +1 -1
  6. package/build/common/deps-checker/constant/helpLink.d.ts +0 -4
  7. package/build/common/deps-checker/constant/helpLink.d.ts.map +1 -1
  8. package/build/common/deps-checker/constant/helpLink.js +1 -9
  9. package/build/common/deps-checker/constant/helpLink.js.map +1 -1
  10. package/build/common/deps-checker/constant/message.d.ts +0 -5
  11. package/build/common/deps-checker/constant/message.d.ts.map +1 -1
  12. package/build/common/deps-checker/constant/message.js +0 -6
  13. package/build/common/deps-checker/constant/message.js.map +1 -1
  14. package/build/common/deps-checker/constant/telemetry.d.ts +2 -33
  15. package/build/common/deps-checker/constant/telemetry.d.ts.map +1 -1
  16. package/build/common/deps-checker/constant/telemetry.js +0 -31
  17. package/build/common/deps-checker/constant/telemetry.js.map +1 -1
  18. package/build/common/deps-checker/depsChecker.d.ts +0 -3
  19. package/build/common/deps-checker/depsChecker.d.ts.map +1 -1
  20. package/build/common/deps-checker/depsChecker.js +0 -3
  21. package/build/common/deps-checker/depsChecker.js.map +1 -1
  22. package/build/common/deps-checker/depsError.d.ts +0 -9
  23. package/build/common/deps-checker/depsError.d.ts.map +1 -1
  24. package/build/common/deps-checker/depsError.js +1 -22
  25. package/build/common/deps-checker/depsError.js.map +1 -1
  26. package/build/common/deps-checker/depsManager.d.ts.map +1 -1
  27. package/build/common/deps-checker/depsManager.js +0 -3
  28. package/build/common/deps-checker/depsManager.js.map +1 -1
  29. package/build/common/deps-checker/internal/funcToolChecker.d.ts +2 -2
  30. package/build/common/deps-checker/internal/funcToolChecker.d.ts.map +1 -1
  31. package/build/common/deps-checker/internal/funcToolChecker.js +4 -2
  32. package/build/common/deps-checker/internal/funcToolChecker.js.map +1 -1
  33. package/build/common/deps-checker/internal/nodeChecker.d.ts +0 -20
  34. package/build/common/deps-checker/internal/nodeChecker.d.ts.map +1 -1
  35. package/build/common/deps-checker/internal/nodeChecker.js +1 -51
  36. package/build/common/deps-checker/internal/nodeChecker.js.map +1 -1
  37. package/build/common/local/localEnvManager.d.ts +0 -9
  38. package/build/common/local/localEnvManager.d.ts.map +1 -1
  39. package/build/common/local/localEnvManager.js +0 -59
  40. package/build/common/local/localEnvManager.js.map +1 -1
  41. package/build/common/templates-config.json +2 -2
  42. package/build/component/code/utils.d.ts +1 -1
  43. package/build/component/code/utils.d.ts.map +1 -1
  44. package/build/component/code/utils.js +3 -3
  45. package/build/component/code/utils.js.map +1 -1
  46. package/build/component/constants.d.ts +3 -0
  47. package/build/component/constants.d.ts.map +1 -1
  48. package/build/component/constants.js +13 -2
  49. package/build/component/constants.js.map +1 -1
  50. package/build/component/debug/error.d.ts +0 -1
  51. package/build/component/debug/error.d.ts.map +1 -1
  52. package/build/component/debug/error.js +1 -11
  53. package/build/component/debug/error.js.map +1 -1
  54. package/build/component/debug/index.d.ts.map +1 -1
  55. package/build/component/debug/index.js +1 -25
  56. package/build/component/debug/index.js.map +1 -1
  57. package/build/component/driver/aad/create.js +2 -2
  58. package/build/component/driver/aad/create.js.map +1 -1
  59. package/build/component/driver/aad/update.d.ts.map +1 -1
  60. package/build/component/driver/aad/update.js +6 -20
  61. package/build/component/driver/aad/update.js.map +1 -1
  62. package/build/component/driver/devTool/error/dotnetInstallationUserError.d.ts +1 -1
  63. package/build/component/driver/devTool/error/dotnetInstallationUserError.d.ts.map +1 -1
  64. package/build/component/driver/devTool/error/dotnetInstallationUserError.js +4 -2
  65. package/build/component/driver/devTool/error/dotnetInstallationUserError.js.map +1 -1
  66. package/build/component/driver/devTool/error/funcInstallationUserError.d.ts +1 -1
  67. package/build/component/driver/devTool/error/funcInstallationUserError.d.ts.map +1 -1
  68. package/build/component/driver/devTool/error/funcInstallationUserError.js +4 -2
  69. package/build/component/driver/devTool/error/funcInstallationUserError.js.map +1 -1
  70. package/build/component/driver/devTool/installDriver.d.ts +1 -0
  71. package/build/component/driver/devTool/installDriver.d.ts.map +1 -1
  72. package/build/component/driver/devTool/installDriver.js +17 -24
  73. package/build/component/driver/devTool/installDriver.js.map +1 -1
  74. package/build/component/driver/teamsApp/createAppPackage.d.ts +0 -1
  75. package/build/component/driver/teamsApp/createAppPackage.d.ts.map +1 -1
  76. package/build/component/driver/teamsApp/createAppPackage.js +1 -11
  77. package/build/component/driver/teamsApp/createAppPackage.js.map +1 -1
  78. package/build/component/driver/teamsApp/validate.d.ts +0 -1
  79. package/build/component/driver/teamsApp/validate.d.ts.map +1 -1
  80. package/build/component/driver/teamsApp/validate.js +34 -18
  81. package/build/component/driver/teamsApp/validate.js.map +1 -1
  82. package/build/component/question.d.ts +1 -0
  83. package/build/component/question.d.ts.map +1 -1
  84. package/build/component/question.js +14 -1
  85. package/build/component/question.js.map +1 -1
  86. package/build/component/resource/appManifest/appStudio.js +1 -1
  87. package/build/component/resource/appManifest/appStudio.js.map +1 -1
  88. package/build/component/resource/appManifest/utils/ManifestUtils.d.ts +1 -1
  89. package/build/component/resource/appManifest/utils/ManifestUtils.d.ts.map +1 -1
  90. package/build/component/resource/appManifest/utils/ManifestUtils.js +1 -9
  91. package/build/component/resource/appManifest/utils/ManifestUtils.js.map +1 -1
  92. package/build/component/utils/envUtil.d.ts.map +1 -1
  93. package/build/component/utils/envUtil.js +4 -1
  94. package/build/component/utils/envUtil.js.map +1 -1
  95. package/build/component/utils/metadataUtil.d.ts.map +1 -1
  96. package/build/component/utils/metadataUtil.js +9 -7
  97. package/build/component/utils/metadataUtil.js.map +1 -1
  98. package/build/component/utils/pathUtils.d.ts.map +1 -1
  99. package/build/component/utils/pathUtils.js +8 -7
  100. package/build/component/utils/pathUtils.js.map +1 -1
  101. package/build/component/utils/settingsUtil.js +3 -3
  102. package/build/component/utils/settingsUtil.js.map +1 -1
  103. package/build/core/FxCore.d.ts +30 -33
  104. package/build/core/FxCore.d.ts.map +1 -1
  105. package/build/core/FxCore.js +96 -622
  106. package/build/core/FxCore.js.map +1 -1
  107. package/build/core/FxCoreImplementV3.d.ts +13 -5
  108. package/build/core/FxCoreImplementV3.d.ts.map +1 -1
  109. package/build/core/FxCoreImplementV3.js +52 -21
  110. package/build/core/FxCoreImplementV3.js.map +1 -1
  111. package/build/core/middleware/envInfoLoaderV3.d.ts +1 -10
  112. package/build/core/middleware/envInfoLoaderV3.d.ts.map +1 -1
  113. package/build/core/middleware/envInfoLoaderV3.js +1 -207
  114. package/build/core/middleware/envInfoLoaderV3.js.map +1 -1
  115. package/build/core/middleware/projectMigratorV3.js +3 -3
  116. package/build/core/middleware/projectMigratorV3.js.map +1 -1
  117. package/build/core/middleware/projectSettingsLoader.d.ts +1 -4
  118. package/build/core/middleware/projectSettingsLoader.d.ts.map +1 -1
  119. package/build/core/middleware/projectSettingsLoader.js +4 -58
  120. package/build/core/middleware/projectSettingsLoader.js.map +1 -1
  121. package/build/core/question.d.ts +1 -0
  122. package/build/core/question.d.ts.map +1 -1
  123. package/build/core/question.js +1 -0
  124. package/build/core/question.js.map +1 -1
  125. package/build/core/types.d.ts +3 -3
  126. package/build/core/types.d.ts.map +1 -1
  127. package/build/error/common.d.ts +3 -0
  128. package/build/error/common.d.ts.map +1 -1
  129. package/build/error/common.js +14 -1
  130. package/build/error/common.js.map +1 -1
  131. package/build/error/script.d.ts +1 -1
  132. package/build/error/script.d.ts.map +1 -1
  133. package/build/error/script.js +3 -3
  134. package/build/error/script.js.map +1 -1
  135. package/package.json +10 -27
  136. package/resource/package.nls.json +8 -9
  137. package/templates/fallback/common.zip +0 -0
  138. package/templates/fallback/csharp.zip +0 -0
  139. package/templates/fallback/js.zip +0 -0
  140. package/templates/fallback/ts.zip +0 -0
  141. package/build/common/deps-checker/internal/ngrokChecker.d.ts +0 -27
  142. package/build/common/deps-checker/internal/ngrokChecker.d.ts.map +0 -1
  143. package/build/common/deps-checker/internal/ngrokChecker.js +0 -222
  144. package/build/common/deps-checker/internal/ngrokChecker.js.map +0 -1
  145. package/build/component/debug/util/ngrok.d.ts +0 -6
  146. package/build/component/debug/util/ngrok.d.ts.map +0 -1
  147. package/build/component/debug/util/ngrok.js +0 -65
  148. package/build/component/debug/util/ngrok.js.map +0 -1
  149. package/build/core/middleware/envInfoWriter.d.ts +0 -8
  150. package/build/core/middleware/envInfoWriter.d.ts.map +0 -1
  151. package/build/core/middleware/envInfoWriter.js +0 -76
  152. package/build/core/middleware/envInfoWriter.js.map +0 -1
  153. package/build/core/middleware/envInfoWriterV3.d.ts +0 -6
  154. package/build/core/middleware/envInfoWriterV3.d.ts.map +0 -1
  155. package/build/core/middleware/envInfoWriterV3.js +0 -67
  156. package/build/core/middleware/envInfoWriterV3.js.map +0 -1
  157. package/build/core/middleware/projectSettingsWriter.d.ts +0 -6
  158. package/build/core/middleware/projectSettingsWriter.d.ts.map +0 -1
  159. package/build/core/middleware/projectSettingsWriter.js +0 -52
  160. package/build/core/middleware/projectSettingsWriter.js.map +0 -1
@@ -4,57 +4,38 @@
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.grantPermissionFunc = exports.checkPermissionFunc = exports.listCollaboratorFunc = exports.ensureBasicFolderStructure = exports.FxCore = void 0;
6
6
  const tslib_1 = require("tslib");
7
+ const hooks_1 = require("@feathersjs/hooks");
8
+ const teamsfx_api_1 = require("@microsoft/teamsfx-api");
7
9
  const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
8
- const jsonschema = tslib_1.__importStar(require("jsonschema"));
9
10
  const path = tslib_1.__importStar(require("path"));
11
+ require("reflect-metadata");
10
12
  const typedi_1 = require("typedi");
11
13
  const uuid = tslib_1.__importStar(require("uuid"));
12
- const hooks_1 = require("@feathersjs/hooks");
13
- const teamsfx_api_1 = require("@microsoft/teamsfx-api");
14
- const localizeUtils_1 = require("../common/localizeUtils");
15
14
  const localSettingsProvider_1 = require("../common/localSettingsProvider");
16
- const projectSettingsHelper_1 = require("../common/projectSettingsHelper");
17
15
  const telemetry_1 = require("../common/telemetry");
18
- const tools_1 = require("../common/tools");
19
- const folder_1 = require("../folder");
16
+ const parser_1 = require("../component/configManager/parser");
20
17
  const constants_1 = require("../component/constants");
18
+ require("../component/driver/index");
19
+ require("../component/driver/script/scriptDriver");
20
+ const ApiConnectorImpl_1 = require("../component/feature/apiconnector/ApiConnectorImpl");
21
+ const cicd_1 = require("../component/feature/cicd/cicd");
22
+ const envMW_1 = require("../component/middleware/envMW");
23
+ const questionMW_1 = require("../component/middleware/questionMW");
24
+ const question_1 = require("../component/question");
25
+ const appManifest_1 = require("../component/resource/appManifest/appManifest");
26
+ const utils_1 = require("../component/utils");
27
+ const envUtil_1 = require("../component/utils/envUtil");
28
+ const settingsUtil_1 = require("../component/utils/settingsUtil");
21
29
  const callback_1 = require("./callback");
22
30
  const collaborator_1 = require("./collaborator");
23
31
  const crypto_1 = require("./crypto");
24
32
  const environment_1 = require("./environment");
25
33
  const error_1 = require("./error");
34
+ const FxCoreImplementV3_1 = require("./FxCoreImplementV3");
26
35
  const globalVars_1 = require("./globalVars");
27
- const aadManifestMigration_1 = require("./middleware/aadManifestMigration");
28
- const concurrentLocker_1 = require("./middleware/concurrentLocker");
29
- const consolidateLocalRemote_1 = require("./middleware/consolidateLocalRemote");
30
- const contextInjector_1 = require("./middleware/contextInjector");
31
- const envInfoLoaderV3_1 = require("./middleware/envInfoLoaderV3");
32
- const envInfoWriterV3_1 = require("./middleware/envInfoWriterV3");
33
36
  const errorHandler_1 = require("./middleware/errorHandler");
34
- const projectMigrator_1 = require("./middleware/projectMigrator");
35
- const projectSettingsLoader_1 = require("./middleware/projectSettingsLoader");
36
- const projectSettingsWriter_1 = require("./middleware/projectSettingsWriter");
37
37
  const questionModel_1 = require("./middleware/questionModel");
38
- const question_1 = require("./question");
39
- const utils_1 = require("../component/utils");
40
- const core_1 = require("../component/core");
41
- const question_2 = require("../component/question");
42
- const projectVersionChecker_1 = require("./middleware/projectVersionChecker");
43
- const cicd_1 = require("../component/feature/cicd/cicd");
44
- const appManifest_1 = require("../component/resource/appManifest/appManifest");
45
- const ApiConnectorImpl_1 = require("../component/feature/apiconnector/ApiConnectorImpl");
46
- const envManager_1 = require("../component/envManager");
47
- const utils_2 = require("../common/utils");
48
- const ManifestUtils_1 = require("../component/resource/appManifest/utils/ManifestUtils");
49
- const arm_1 = require("../component/arm");
50
- const local_1 = require("../common/local");
51
- require("../component/driver/index");
52
- require("../component/driver/script/scriptDriver");
53
- require("reflect-metadata");
54
- const envUtil_1 = require("../component/utils/envUtil");
55
- const parser_1 = require("../component/configManager/parser");
56
- const videoFilterAppBlocker_1 = require("./middleware/videoFilterAppBlocker");
57
- const FxCoreImplementV3_1 = require("./FxCoreImplementV3");
38
+ const question_2 = require("./question");
58
39
  class FxCore {
59
40
  constructor(tools) {
60
41
  this.tools = tools;
@@ -73,10 +54,7 @@ class FxCore {
73
54
  * lifecycle command: create new project
74
55
  */
75
56
  async createProject(inputs) {
76
- if (tools_1.isV3Enabled())
77
- return this.v3Implement.dispatch(this.createProject, inputs);
78
- else
79
- return this.createProjectOld(inputs);
57
+ return this.v3Implement.dispatch(this.createProject, inputs);
80
58
  }
81
59
  /**
82
60
  * @deprecated Not used any more but still referenced by CLI code
@@ -90,49 +68,11 @@ class FxCore {
90
68
  async initDebug(inputs) {
91
69
  return this.v3Implement.dispatch(this.initDebug, inputs);
92
70
  }
93
- async createProjectOld(inputs, ctx) {
94
- if (!ctx) {
95
- return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("ctx for createProject"));
96
- }
97
- globalVars_1.setCurrentStage(teamsfx_api_1.Stage.create);
98
- inputs.stage = teamsfx_api_1.Stage.create;
99
- const context = utils_1.createContextV3();
100
- const fx = typedi_1.Container.get("fx");
101
- const res = await fx.create(context, inputs);
102
- if (res.isErr())
103
- return teamsfx_api_1.err(res.error);
104
- ctx.projectSettings = context.projectSetting;
105
- inputs.projectPath = context.projectPath;
106
- return teamsfx_api_1.ok(context.projectPath);
107
- }
108
71
  /**
109
72
  * lifecycle commands: provision
110
73
  */
111
74
  async provisionResources(inputs) {
112
- if (tools_1.isV3Enabled()) {
113
- return this.v3Implement.dispatch(this.provisionResources, inputs);
114
- }
115
- else {
116
- return this.provisionResourcesOld(inputs);
117
- }
118
- }
119
- async provisionResourcesOld(inputs, ctx) {
120
- globalVars_1.setCurrentStage(teamsfx_api_1.Stage.provision);
121
- inputs.stage = teamsfx_api_1.Stage.provision;
122
- const context = utils_1.createContextV3();
123
- context.envInfo = ctx.envInfoV3;
124
- context.projectSetting = ctx.projectSettings;
125
- context.tokenProvider = globalVars_1.TOOLS.tokenProvider;
126
- if (context.envInfo.envName === "local") {
127
- context.envInfo.config.isLocalDebug = true;
128
- }
129
- const fx = typedi_1.Container.get("fx");
130
- const res = await fx.provision(context, inputs);
131
- if (res.isErr())
132
- return teamsfx_api_1.err(res.error);
133
- ctx.projectSettings = context.projectSetting;
134
- ctx.envInfoV3 = context.envInfo;
135
- return teamsfx_api_1.ok(teamsfx_api_1.Void);
75
+ return this.v3Implement.dispatch(this.provisionResources, inputs);
136
76
  }
137
77
  /**
138
78
  * Only used to provision Teams app with user provided app package in CLI
@@ -161,26 +101,7 @@ class FxCore {
161
101
  * lifecycle commands: deploy
162
102
  */
163
103
  async deployArtifacts(inputs) {
164
- if (tools_1.isV3Enabled()) {
165
- return this.v3Implement.dispatch(this.deployArtifacts, inputs);
166
- }
167
- else {
168
- return this.deployArtifactsOld(inputs);
169
- }
170
- }
171
- async deployArtifactsOld(inputs, ctx) {
172
- globalVars_1.setCurrentStage(teamsfx_api_1.Stage.deploy);
173
- inputs.stage = teamsfx_api_1.Stage.deploy;
174
- const context = utils_1.createContextV3();
175
- context.envInfo = ctx.envInfoV3;
176
- context.projectSetting = ctx.projectSettings;
177
- context.tokenProvider = globalVars_1.TOOLS.tokenProvider;
178
- const fx = typedi_1.Container.get("fx");
179
- const res = await fx.deploy(context, inputs);
180
- if (res.isErr())
181
- return teamsfx_api_1.err(res.error);
182
- ctx.projectSettings = context.projectSetting;
183
- return teamsfx_api_1.ok(teamsfx_api_1.Void);
104
+ return this.v3Implement.dispatch(this.deployArtifacts, inputs);
184
105
  }
185
106
  async localDebug(inputs) {
186
107
  inputs.env = environment_1.environmentManager.getLocalEnvName();
@@ -202,110 +123,13 @@ class FxCore {
202
123
  * lifecycle command: publish
203
124
  */
204
125
  async publishApplication(inputs) {
205
- if (tools_1.isV3Enabled()) {
206
- return this.v3Implement.dispatch(this.publishApplication, inputs);
207
- }
208
- else {
209
- return this.publishApplicationOld(inputs);
210
- }
211
- }
212
- async publishApplicationOld(inputs, ctx) {
213
- globalVars_1.setCurrentStage(teamsfx_api_1.Stage.publish);
214
- inputs.stage = teamsfx_api_1.Stage.publish;
215
- const context = utils_1.createContextV3();
216
- context.envInfo = ctx.envInfoV3;
217
- context.projectSetting = ctx.projectSettings;
218
- context.tokenProvider = globalVars_1.TOOLS.tokenProvider;
219
- const appManifest = typedi_1.Container.get(constants_1.ComponentNames.AppManifest);
220
- const res = await appManifest.publish(context, inputs);
221
- if (res.isErr())
222
- return teamsfx_api_1.err(res.error);
223
- ctx.projectSettings = context.projectSetting;
224
- return teamsfx_api_1.ok(teamsfx_api_1.Void);
225
- }
226
- /**
227
- * @deprecated not used in v3 any more
228
- */
229
- async addFeature(inputs, ctx) {
230
- inputs.stage = teamsfx_api_1.Stage.addFeature;
231
- const context = utils_1.createContextV3(ctx === null || ctx === void 0 ? void 0 : ctx.projectSettings);
232
- const fx = typedi_1.Container.get("fx");
233
- const res = await fx.addFeature(context, inputs);
234
- if (res.isErr())
235
- return teamsfx_api_1.err(res.error);
236
- ctx.projectSettings = context.projectSetting;
237
- return teamsfx_api_1.ok(res.value);
126
+ return this.v3Implement.dispatch(this.publishApplication, inputs);
238
127
  }
239
128
  /**
240
129
  * most commands will be deprecated in V3
241
130
  */
242
131
  async executeUserTask(func, inputs, ctx) {
243
- return tools_1.isV3Enabled()
244
- ? this.v3Implement.dispatchUserTask(this.executeUserTask, func, inputs)
245
- : this.executeUserTaskOld(func, inputs);
246
- }
247
- async executeUserTaskOld(func, inputs, ctx) {
248
- if (!ctx)
249
- return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("executeUserTask context"));
250
- let res = teamsfx_api_1.ok(undefined);
251
- const context = utils_1.createContextV3(ctx === null || ctx === void 0 ? void 0 : ctx.projectSettings);
252
- if (ctx === null || ctx === void 0 ? void 0 : ctx.envInfoV3) {
253
- context.envInfo = ctx.envInfoV3;
254
- if (context.envInfo.envName === "local") {
255
- context.envInfo.config.isLocalDebug = true;
256
- }
257
- }
258
- if (func.method === "addCICDWorkflows") {
259
- const component = typedi_1.Container.get("cicd");
260
- inputs[constants_1.AzureSolutionQuestionNames.Features] = constants_1.CicdOptionItem.id;
261
- res = await component.add(context, inputs);
262
- }
263
- else if (func.method === "connectExistingApi") {
264
- const component = typedi_1.Container.get("api-connector");
265
- inputs[constants_1.AzureSolutionQuestionNames.Features] = constants_1.ApiConnectionOptionItem.id;
266
- res = await component.add(context, inputs);
267
- }
268
- else if (func.method === "addSso") {
269
- inputs.stage = teamsfx_api_1.Stage.addFeature;
270
- inputs[constants_1.AzureSolutionQuestionNames.Features] = constants_1.SingleSignOnOptionItem.id;
271
- const component = typedi_1.Container.get("sso");
272
- res = await component.add(context, inputs);
273
- }
274
- else if (func.method === "addFeature") {
275
- inputs.stage = teamsfx_api_1.Stage.addFeature;
276
- const fx = typedi_1.Container.get("fx");
277
- res = await fx.addFeature(context, inputs);
278
- }
279
- else if (func.method === "getManifestTemplatePath") {
280
- const path = await ManifestUtils_1.manifestUtils.getTeamsAppManifestPath(inputs.projectPath);
281
- res = teamsfx_api_1.ok(path);
282
- }
283
- else if (func.method === "validateManifest") {
284
- const component = typedi_1.Container.get("app-manifest");
285
- res = await component.validate(context, inputs);
286
- }
287
- else if (func.method === "buildPackage") {
288
- const component = typedi_1.Container.get("app-manifest");
289
- res = await component.build(context, inputs);
290
- }
291
- else if (func.method === "updateManifest") {
292
- const component = typedi_1.Container.get("app-manifest");
293
- res = await component.deploy(context, inputs);
294
- }
295
- else if (func.method === "buildAadManifest") {
296
- const component = typedi_1.Container.get("aad-app");
297
- res = await component.buildAadManifest(context, inputs);
298
- }
299
- else {
300
- return teamsfx_api_1.err(new error_1.NotImplementedError(func.method));
301
- }
302
- if (res) {
303
- if (res.isErr())
304
- return teamsfx_api_1.err(res.error);
305
- ctx.projectSettings = context.projectSetting;
306
- return res;
307
- }
308
- return res;
132
+ return await this.v3Implement.dispatchUserTask(this.executeUserTask, func, inputs);
309
133
  }
310
134
  /**
311
135
  * v3 only none lifecycle command
@@ -323,7 +147,7 @@ class FxCore {
323
147
  * v3 only none lifecycle command
324
148
  */
325
149
  async validateApplication(inputs) {
326
- if (inputs.validateMethod === "validateAgainstSchema") {
150
+ if (inputs[question_2.CoreQuestionNames.ValidateMethod] === constants_1.validateSchemaOption.id) {
327
151
  return await this.validateManifest(inputs);
328
152
  }
329
153
  else {
@@ -371,35 +195,38 @@ class FxCore {
371
195
  return await questionModel_1.getQuestionsForCreateProjectV2(inputs);
372
196
  }
373
197
  else if (stage === teamsfx_api_1.Stage.deploy) {
374
- return await question_2.getQuestionsForDeployV3(context, inputs);
198
+ return await question_1.getQuestionsForDeployV3(context, inputs);
375
199
  }
376
200
  else if (stage === teamsfx_api_1.Stage.provision) {
377
- return await question_2.getQuestionsForProvisionV3(inputs);
201
+ return await question_1.getQuestionsForProvisionV3(inputs);
378
202
  }
379
203
  else if (stage === teamsfx_api_1.Stage.initDebug) {
380
- return await question_2.getQuestionsForInit("debug", inputs);
204
+ return await question_1.getQuestionsForInit("debug", inputs);
381
205
  }
382
206
  else if (stage === teamsfx_api_1.Stage.initInfra) {
383
- return await question_2.getQuestionsForInit("infra", inputs);
207
+ return await question_1.getQuestionsForInit("infra", inputs);
384
208
  }
385
209
  return teamsfx_api_1.ok(undefined);
386
210
  }
387
211
  /**
388
- * @deprecated
212
+ * @deprecated for V3
389
213
  */
390
214
  async getQuestionsForAddFeature(featureId, inputs) {
391
- const res = await question_2.getQuestionsForAddFeatureSubCommand(featureId, inputs);
215
+ const res = await question_1.getQuestionsForAddFeatureSubCommand(featureId, inputs);
392
216
  return res;
393
217
  }
218
+ /**
219
+ * @deprecated for V3
220
+ */
394
221
  async getQuestionsForUserTask(func, inputs) {
395
222
  inputs.stage = teamsfx_api_1.Stage.getQuestions;
396
223
  globalVars_1.setCurrentStage(teamsfx_api_1.Stage.getQuestions);
397
224
  const context = utils_1.createContextV3();
398
225
  if (func.method === "addFeature") {
399
- return await question_2.getQuestionsForAddFeatureV3(context, inputs);
226
+ return await question_1.getQuestionsForAddFeatureV3(context, inputs);
400
227
  }
401
228
  else if (func.method === "addResource") {
402
- return await question_2.getQuestionsForAddResourceV3(context, inputs);
229
+ return await question_1.getQuestionsForAddResourceV3(context, inputs);
403
230
  }
404
231
  else if (func.method === "addCICDWorkflows") {
405
232
  return await cicd_1.addCicdQuestion(context, inputs);
@@ -411,146 +238,81 @@ class FxCore {
411
238
  return teamsfx_api_1.ok(undefined);
412
239
  }
413
240
  /**
414
- * v3 only API, not command
241
+ * @deprecated
415
242
  */
416
- async getSettings(inputs) {
417
- return this.v3Implement.dispatch(this.getSettings, inputs);
243
+ async getDotEnv(inputs) {
244
+ return this.v3Implement.dispatch(this.getDotEnv, inputs);
418
245
  }
419
246
  /**
420
- * v3 only API, not command
247
+ * get all dot envs
421
248
  */
422
- async getDotEnv(inputs) {
423
- return this.v3Implement.dispatch(this.getDotEnv, inputs);
249
+ async getDotEnvs(inputs) {
250
+ return this.v3Implement.dispatch(this.getDotEnvs, inputs);
424
251
  }
425
252
  /**
426
253
  * @deprecated in V3
427
254
  */
428
- async getProjectConfig(inputs, ctx) {
429
- var _a;
430
- if (!ctx)
431
- return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("getProjectConfig input stuff"));
432
- inputs.stage = teamsfx_api_1.Stage.getProjectConfig;
433
- globalVars_1.setCurrentStage(teamsfx_api_1.Stage.getProjectConfig);
255
+ async getProjectConfig(inputs) {
434
256
  return teamsfx_api_1.ok({
435
- settings: ctx.projectSettings,
436
- config: (_a = ctx.envInfoV3) === null || _a === void 0 ? void 0 : _a.state,
257
+ settings: {},
258
+ config: {},
437
259
  });
438
260
  }
439
261
  /**
440
262
  * @deprecated in V3
441
263
  */
442
- async getProjectConfigV3(inputs, ctx) {
443
- if (!ctx || !ctx.projectSettings)
444
- return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("getProjectConfigV3 input stuff"));
445
- if (!inputs.projectPath)
446
- return teamsfx_api_1.ok(undefined);
447
- inputs.stage = teamsfx_api_1.Stage.getProjectConfig;
448
- globalVars_1.setCurrentStage(teamsfx_api_1.Stage.getProjectConfig);
449
- const config = {
450
- projectSettings: ctx.projectSettings,
451
- envInfos: {},
452
- };
453
- const envNamesRes = await environment_1.environmentManager.listAllEnvConfigs(inputs.projectPath);
454
- if (envNamesRes.isErr()) {
455
- return teamsfx_api_1.err(envNamesRes.error);
456
- }
457
- for (const env of envNamesRes.value) {
458
- const result = await envInfoLoaderV3_1.loadEnvInfoV3(inputs, ctx.projectSettings, env, false);
459
- if (result.isErr()) {
460
- return teamsfx_api_1.err(result.error);
461
- }
462
- config.envInfos[env] = result.value;
463
- }
464
- return teamsfx_api_1.ok(config);
264
+ async getProjectConfigV3(inputs) {
265
+ return teamsfx_api_1.ok({});
465
266
  }
466
267
  async grantPermission(inputs) {
467
- if (tools_1.isV3Enabled()) {
468
- return this.v3Implement.dispatch(this.grantPermission, inputs);
469
- }
470
- else {
471
- return this.grantPermissionOld(inputs);
472
- }
473
- }
474
- async grantPermissionOld(inputs, ctx) {
475
- return grantPermissionFunc(inputs, ctx);
268
+ return this.v3Implement.dispatch(this.grantPermission, inputs);
476
269
  }
477
270
  /**
478
271
  * none lifecycle command
479
272
  */
480
273
  async checkPermission(inputs) {
481
- if (tools_1.isV3Enabled()) {
482
- return this.v3Implement.dispatch(this.checkPermission, inputs);
483
- }
484
- else {
485
- return this.checkPermissionOld(inputs);
486
- }
487
- }
488
- async checkPermissionOld(inputs, ctx) {
489
- return checkPermissionFunc(inputs, ctx);
274
+ return this.v3Implement.dispatch(this.checkPermission, inputs);
490
275
  }
491
276
  /**
492
277
  * none lifecycle command
493
278
  */
494
279
  async listCollaborator(inputs) {
495
- if (tools_1.isV3Enabled()) {
496
- return this.v3Implement.dispatch(this.listCollaborator, inputs);
497
- }
498
- else {
499
- return this.listCollaboratorOld(inputs);
500
- }
501
- }
502
- async listCollaboratorOld(inputs, ctx) {
503
- return listCollaboratorFunc(inputs, ctx);
280
+ return this.v3Implement.dispatch(this.listCollaborator, inputs);
504
281
  }
505
- async getSelectedEnv(inputs, ctx) {
282
+ async getSelectedEnv(inputs) {
506
283
  return teamsfx_api_1.ok(inputs.env); //work for both v2 and v3
507
284
  }
508
- async encrypt(plaintext, inputs, ctx) {
509
- if (!ctx)
510
- return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("ctx"));
511
- if (!ctx.contextV2)
512
- return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("ctx.contextV2"));
513
- return ctx.contextV2.cryptoProvider.encrypt(plaintext);
514
- }
515
- async decrypt(ciphertext, inputs, ctx) {
516
- if (!ctx)
517
- return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("ctx"));
518
- if (!ctx.contextV2)
519
- return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("ctx.contextV2"));
520
- return ctx.contextV2.cryptoProvider.decrypt(ciphertext);
521
- }
522
- async createEnv(inputs) {
523
- if (tools_1.isV3Enabled()) {
524
- return this.v3Implement.dispatch(this.createEnv, inputs);
525
- }
526
- else {
527
- return this.createEnvOld(inputs);
285
+ async createLocalCrypto(projectPath) {
286
+ const settingsRes = await settingsUtil_1.settingsUtil.readSettings(projectPath);
287
+ if (settingsRes.isErr()) {
288
+ return teamsfx_api_1.err(settingsRes.error);
528
289
  }
290
+ const projectId = settingsRes.value.trackingId;
291
+ const cryptoProvider = new crypto_1.LocalCrypto(projectId);
292
+ return teamsfx_api_1.ok(cryptoProvider);
529
293
  }
530
- async createEnvOld(inputs, ctx) {
531
- if (!ctx || !inputs.projectPath)
532
- return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("createEnv input stuff"));
533
- const projectSettings = ctx.projectSettings;
534
- if (!projectSettings) {
535
- return teamsfx_api_1.ok(teamsfx_api_1.Void);
536
- }
537
- const core = ctx.self;
538
- const createEnvCopyInput = await envInfoLoaderV3_1.askNewEnvironment(ctx, inputs);
539
- if (!createEnvCopyInput ||
540
- !createEnvCopyInput.targetEnvName ||
541
- !createEnvCopyInput.sourceEnvName) {
542
- return teamsfx_api_1.err(teamsfx_api_1.UserCancelError);
543
- }
544
- const createEnvResult = await this.createEnvCopy(createEnvCopyInput.targetEnvName, createEnvCopyInput.sourceEnvName, inputs, core);
545
- if (createEnvResult.isErr()) {
546
- return createEnvResult;
294
+ /**
295
+ * only for vs code extension
296
+ */
297
+ async encrypt(plaintext, inputs) {
298
+ const res = await this.createLocalCrypto(inputs.projectPath);
299
+ if (res.isErr()) {
300
+ return teamsfx_api_1.err(res.error);
547
301
  }
548
- inputs.sourceEnvName = createEnvCopyInput.sourceEnvName;
549
- inputs.targetEnvName = createEnvCopyInput.targetEnvName;
550
- if (!local_1.ProjectSettingsHelper.isSpfx(ctx.projectSettings)) {
551
- await arm_1.copyParameterJson(inputs.projectPath, ctx.projectSettings.appName, inputs.targetEnvName, inputs.sourceEnvName);
302
+ return res.value.encrypt(plaintext);
303
+ }
304
+ /**
305
+ * only for vs code extension
306
+ */
307
+ async decrypt(ciphertext, inputs) {
308
+ const res = await this.createLocalCrypto(inputs.projectPath);
309
+ if (res.isErr()) {
310
+ return teamsfx_api_1.err(res.error);
552
311
  }
553
- return teamsfx_api_1.ok(teamsfx_api_1.Void);
312
+ return res.value.decrypt(ciphertext);
313
+ }
314
+ async createEnv(inputs) {
315
+ return this.v3Implement.dispatch(this.createEnv, inputs);
554
316
  }
555
317
  // a phantom migration method for V3
556
318
  async phantomMigrationV3(inputs) {
@@ -649,88 +411,6 @@ class FxCore {
649
411
  }
650
412
  }
651
413
  }
652
- async _init(inputs, ctx, isInitExistingApp = false) {
653
- if (!ctx) {
654
- return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("ctx for createProject"));
655
- }
656
- // validate app name
657
- const appName = inputs[question_1.CoreQuestionNames.AppName];
658
- const validateResult = jsonschema.validate(appName, {
659
- pattern: question_1.ProjectNamePattern,
660
- });
661
- if (validateResult.errors && validateResult.errors.length > 0) {
662
- return teamsfx_api_1.err(error_1.InvalidInputError("invalid app-name", inputs));
663
- }
664
- const projectPath = inputs.folder;
665
- if (!projectPath) {
666
- return teamsfx_api_1.err(error_1.InvalidInputError("projectPath is empty", inputs));
667
- }
668
- if (isInitExistingApp) {
669
- const folderExist = await fs_extra_1.default.pathExists(projectPath);
670
- if (folderExist) {
671
- return teamsfx_api_1.err(new error_1.ProjectFolderExistError(projectPath));
672
- }
673
- }
674
- else {
675
- const isValid = projectSettingsHelper_1.isValidProject(projectPath);
676
- if (isValid) {
677
- return teamsfx_api_1.err(new error_1.OperationNotPermittedError("initialize a project in existing teamsfx project"));
678
- }
679
- }
680
- await fs_extra_1.default.ensureDir(projectPath);
681
- inputs.projectPath = projectPath;
682
- // create ProjectSettings
683
- const projectSettings = projectSettingsHelper_1.newProjectSettings();
684
- projectSettings.appName = appName;
685
- projectSettings.components = [];
686
- ctx.projectSettings = projectSettings;
687
- // create folder structure
688
- await fs_extra_1.default.ensureDir(path.join(projectPath, `.${teamsfx_api_1.ConfigFolderName}`));
689
- await fs_extra_1.default.ensureDir(path.join(await utils_2.getProjectTemplatesFolderPath(projectPath), `${teamsfx_api_1.AppPackageFolderName}`));
690
- const basicFolderRes = await ensureBasicFolderStructure(inputs, false);
691
- if (basicFolderRes.isErr()) {
692
- return teamsfx_api_1.err(basicFolderRes.error);
693
- }
694
- // create contextV2
695
- const context = tools_1.createV2Context(projectSettings);
696
- ctx.contextV2 = context;
697
- const appStudioComponent = typedi_1.Container.get(constants_1.ComponentNames.AppManifest);
698
- // pre-check before initialize
699
- const preCheckResult = await core_1.preCheck(projectPath);
700
- if (preCheckResult.isErr()) {
701
- return teamsfx_api_1.err(preCheckResult.error);
702
- }
703
- // init manifest
704
- const manifestInitRes = await appStudioComponent.init(context, inputs, isInitExistingApp);
705
- if (manifestInitRes.isErr())
706
- return teamsfx_api_1.err(manifestInitRes.error);
707
- const manifestAddcapRes = await appStudioComponent.addCapability(inputs, [{ name: "staticTab", existingApp: true }]);
708
- if (manifestAddcapRes.isErr())
709
- return teamsfx_api_1.err(manifestAddcapRes.error);
710
- // create env config with existing tab's endpoint
711
- const endpoint = inputs[question_1.CoreQuestionNames.ExistingTabEndpoint];
712
- const createEnvResult = await envManager_1.createEnvWithName(environment_1.environmentManager.getDefaultEnvName(), projectSettings.appName, inputs, isInitExistingApp ? endpoint : undefined);
713
- if (createEnvResult.isErr()) {
714
- return teamsfx_api_1.err(createEnvResult.error);
715
- }
716
- const createLocalEnvResult = await envManager_1.createEnvWithName(environment_1.environmentManager.getLocalEnvName(), projectSettings.appName, inputs, isInitExistingApp ? endpoint : undefined);
717
- if (createLocalEnvResult.isErr()) {
718
- return teamsfx_api_1.err(createLocalEnvResult.error);
719
- }
720
- const sourceReadmePath = path.join(folder_1.getTemplatesFolder(), "core", teamsfx_api_1.DefaultReadme);
721
- if (await fs_extra_1.default.pathExists(sourceReadmePath)) {
722
- const targetReadmePath = path.join(projectPath, teamsfx_api_1.DefaultReadme);
723
- await fs_extra_1.default.copy(sourceReadmePath, targetReadmePath);
724
- }
725
- return teamsfx_api_1.ok(inputs.projectPath);
726
- }
727
- async init(inputs, ctx) {
728
- const result = await this._init(inputs, ctx);
729
- if (result.isOk()) {
730
- globalVars_1.TOOLS.ui.showMessage("info", localizeUtils_1.getLocalizedString("core.init.successNotice"), false);
731
- }
732
- return result;
733
- }
734
414
  async preProvisionForVS(inputs) {
735
415
  return this.v3Implement.dispatch(this.preProvisionForVS, inputs);
736
416
  }
@@ -739,105 +419,11 @@ class FxCore {
739
419
  }
740
420
  }
741
421
  tslib_1.__decorate([
742
- hooks_1.hooks([errorHandler_1.ErrorHandlerMW, contextInjector_1.ContextInjectorMW, projectSettingsWriter_1.ProjectSettingsWriterMW]),
743
- tslib_1.__metadata("design:type", Function),
744
- tslib_1.__metadata("design:paramtypes", [Object, Object]),
745
- tslib_1.__metadata("design:returntype", Promise)
746
- ], FxCore.prototype, "createProjectOld", null);
747
- tslib_1.__decorate([
748
- hooks_1.hooks([
749
- errorHandler_1.ErrorHandlerMW,
750
- concurrentLocker_1.ConcurrentLockerMW,
751
- projectMigrator_1.ProjectMigratorMW,
752
- consolidateLocalRemote_1.ProjectConsolidateMW,
753
- aadManifestMigration_1.AadManifestMigrationMW,
754
- projectVersionChecker_1.ProjectVersionCheckerMW,
755
- projectSettingsLoader_1.ProjectSettingsLoaderMW,
756
- videoFilterAppBlocker_1.VideoFilterAppBlockerMW,
757
- envInfoLoaderV3_1.EnvInfoLoaderMW_V3(false),
758
- contextInjector_1.ContextInjectorMW,
759
- projectSettingsWriter_1.ProjectSettingsWriterMW,
760
- envInfoWriterV3_1.EnvInfoWriterMW_V3(),
761
- ]),
762
- tslib_1.__metadata("design:type", Function),
763
- tslib_1.__metadata("design:paramtypes", [Object, Object]),
764
- tslib_1.__metadata("design:returntype", Promise)
765
- ], FxCore.prototype, "provisionResourcesOld", null);
766
- tslib_1.__decorate([
767
- hooks_1.hooks([
768
- errorHandler_1.ErrorHandlerMW,
769
- concurrentLocker_1.ConcurrentLockerMW,
770
- projectMigrator_1.ProjectMigratorMW,
771
- consolidateLocalRemote_1.ProjectConsolidateMW,
772
- aadManifestMigration_1.AadManifestMigrationMW,
773
- projectVersionChecker_1.ProjectVersionCheckerMW,
774
- projectSettingsLoader_1.ProjectSettingsLoaderMW,
775
- videoFilterAppBlocker_1.VideoFilterAppBlockerMW,
776
- envInfoLoaderV3_1.EnvInfoLoaderMW_V3(false),
777
- contextInjector_1.ContextInjectorMW,
778
- projectSettingsWriter_1.ProjectSettingsWriterMW,
779
- envInfoWriterV3_1.EnvInfoWriterMW_V3(),
780
- ]),
781
- tslib_1.__metadata("design:type", Function),
782
- tslib_1.__metadata("design:paramtypes", [Object, Object]),
783
- tslib_1.__metadata("design:returntype", Promise)
784
- ], FxCore.prototype, "deployArtifactsOld", null);
785
- tslib_1.__decorate([
786
- hooks_1.hooks([
787
- errorHandler_1.ErrorHandlerMW,
788
- concurrentLocker_1.ConcurrentLockerMW,
789
- projectMigrator_1.ProjectMigratorMW,
790
- consolidateLocalRemote_1.ProjectConsolidateMW,
791
- aadManifestMigration_1.AadManifestMigrationMW,
792
- projectVersionChecker_1.ProjectVersionCheckerMW,
793
- projectSettingsLoader_1.ProjectSettingsLoaderMW,
794
- videoFilterAppBlocker_1.VideoFilterAppBlockerMW,
795
- envInfoLoaderV3_1.EnvInfoLoaderMW_V3(false),
796
- contextInjector_1.ContextInjectorMW,
797
- projectSettingsWriter_1.ProjectSettingsWriterMW,
798
- envInfoWriterV3_1.EnvInfoWriterMW_V3(),
799
- ]),
422
+ hooks_1.hooks([questionMW_1.QuestionMW(question_1.getQuestionsForValidateMethod)]),
800
423
  tslib_1.__metadata("design:type", Function),
801
- tslib_1.__metadata("design:paramtypes", [Object, Object]),
802
- tslib_1.__metadata("design:returntype", Promise)
803
- ], FxCore.prototype, "publishApplicationOld", null);
804
- tslib_1.__decorate([
805
- hooks_1.hooks([
806
- errorHandler_1.ErrorHandlerMW,
807
- concurrentLocker_1.ConcurrentLockerMW,
808
- projectMigrator_1.ProjectMigratorMW,
809
- consolidateLocalRemote_1.ProjectConsolidateMW,
810
- aadManifestMigration_1.AadManifestMigrationMW,
811
- projectVersionChecker_1.ProjectVersionCheckerMW,
812
- projectSettingsLoader_1.ProjectSettingsLoaderMW,
813
- envInfoLoaderV3_1.EnvInfoLoaderMW_V3(false),
814
- contextInjector_1.ContextInjectorMW,
815
- projectSettingsWriter_1.ProjectSettingsWriterMW,
816
- envInfoWriterV3_1.EnvInfoWriterMW_V3(),
817
- ]),
818
- tslib_1.__metadata("design:type", Function),
819
- tslib_1.__metadata("design:paramtypes", [Object, Object]),
820
- tslib_1.__metadata("design:returntype", Promise)
821
- ], FxCore.prototype, "addFeature", null);
822
- tslib_1.__decorate([
823
- hooks_1.hooks([
824
- errorHandler_1.ErrorHandlerMW,
825
- concurrentLocker_1.ConcurrentLockerMW,
826
- projectMigrator_1.ProjectMigratorMW,
827
- consolidateLocalRemote_1.ProjectConsolidateMW,
828
- aadManifestMigration_1.AadManifestMigrationMW,
829
- projectVersionChecker_1.ProjectVersionCheckerMW,
830
- projectSettingsLoader_1.ProjectSettingsLoaderMW,
831
- videoFilterAppBlocker_1.VideoFilterAppBlockerMW,
832
- envInfoLoaderV3_1.EnvInfoLoaderMW_V3(false),
833
- contextInjector_1.ContextInjectorMW,
834
- projectSettingsWriter_1.ProjectSettingsWriterMW,
835
- envInfoWriterV3_1.EnvInfoWriterMW_V3(),
836
- ]),
837
- tslib_1.__metadata("design:type", Function),
838
- tslib_1.__metadata("design:paramtypes", [Object, Object, Object]),
424
+ tslib_1.__metadata("design:paramtypes", [Object]),
839
425
  tslib_1.__metadata("design:returntype", Promise)
840
- ], FxCore.prototype, "executeUserTaskOld", null);
426
+ ], FxCore.prototype, "validateApplication", null);
841
427
  tslib_1.__decorate([
842
428
  hooks_1.hooks([errorHandler_1.ErrorHandlerMW]),
843
429
  tslib_1.__metadata("design:type", Function),
@@ -851,123 +437,23 @@ tslib_1.__decorate([
851
437
  tslib_1.__metadata("design:returntype", Promise)
852
438
  ], FxCore.prototype, "getQuestionsForUserTask", null);
853
439
  tslib_1.__decorate([
854
- hooks_1.hooks([
855
- errorHandler_1.ErrorHandlerMW,
856
- concurrentLocker_1.ConcurrentLockerMW,
857
- projectMigrator_1.ProjectMigratorMW,
858
- consolidateLocalRemote_1.ProjectConsolidateMW,
859
- aadManifestMigration_1.AadManifestMigrationMW,
860
- projectVersionChecker_1.ProjectVersionCheckerMW,
861
- projectSettingsLoader_1.ProjectSettingsLoaderMW,
862
- envInfoLoaderV3_1.EnvInfoLoaderMW_V3(false),
863
- contextInjector_1.ContextInjectorMW,
864
- ]),
865
- tslib_1.__metadata("design:type", Function),
866
- tslib_1.__metadata("design:paramtypes", [Object, Object]),
867
- tslib_1.__metadata("design:returntype", Promise)
868
- ], FxCore.prototype, "getProjectConfig", null);
869
- tslib_1.__decorate([
870
- hooks_1.hooks([
871
- errorHandler_1.ErrorHandlerMW,
872
- concurrentLocker_1.ConcurrentLockerMW,
873
- projectMigrator_1.ProjectMigratorMW,
874
- consolidateLocalRemote_1.ProjectConsolidateMW,
875
- aadManifestMigration_1.AadManifestMigrationMW,
876
- projectVersionChecker_1.ProjectVersionCheckerMW,
877
- projectSettingsLoader_1.ProjectSettingsLoaderMW,
878
- contextInjector_1.ContextInjectorMW,
879
- ]),
440
+ hooks_1.hooks([errorHandler_1.ErrorHandlerMW, envMW_1.EnvLoaderMW(false)]),
880
441
  tslib_1.__metadata("design:type", Function),
881
- tslib_1.__metadata("design:paramtypes", [Object, Object]),
882
- tslib_1.__metadata("design:returntype", Promise)
883
- ], FxCore.prototype, "getProjectConfigV3", null);
884
- tslib_1.__decorate([
885
- hooks_1.hooks([
886
- errorHandler_1.ErrorHandlerMW,
887
- projectMigrator_1.ProjectMigratorMW,
888
- consolidateLocalRemote_1.ProjectConsolidateMW,
889
- aadManifestMigration_1.AadManifestMigrationMW,
890
- projectVersionChecker_1.ProjectVersionCheckerMW,
891
- projectSettingsLoader_1.ProjectSettingsLoaderMW,
892
- envInfoLoaderV3_1.EnvInfoLoaderMW_V3(false, true),
893
- questionModel_1.QuestionModelMW,
894
- concurrentLocker_1.ConcurrentLockerMW,
895
- contextInjector_1.ContextInjectorMW,
896
- ]),
897
- tslib_1.__metadata("design:type", Function),
898
- tslib_1.__metadata("design:paramtypes", [Object, Object]),
899
- tslib_1.__metadata("design:returntype", Promise)
900
- ], FxCore.prototype, "grantPermissionOld", null);
901
- tslib_1.__decorate([
902
- hooks_1.hooks([
903
- errorHandler_1.ErrorHandlerMW,
904
- concurrentLocker_1.ConcurrentLockerMW,
905
- projectMigrator_1.ProjectMigratorMW,
906
- consolidateLocalRemote_1.ProjectConsolidateMW,
907
- aadManifestMigration_1.AadManifestMigrationMW,
908
- projectVersionChecker_1.ProjectVersionCheckerMW,
909
- projectSettingsLoader_1.ProjectSettingsLoaderMW,
910
- envInfoLoaderV3_1.EnvInfoLoaderMW_V3(false, true),
911
- questionModel_1.QuestionModelMW,
912
- contextInjector_1.ContextInjectorMW,
913
- ]),
914
- tslib_1.__metadata("design:type", Function),
915
- tslib_1.__metadata("design:paramtypes", [Object, Object]),
916
- tslib_1.__metadata("design:returntype", Promise)
917
- ], FxCore.prototype, "checkPermissionOld", null);
918
- tslib_1.__decorate([
919
- hooks_1.hooks([
920
- errorHandler_1.ErrorHandlerMW,
921
- projectMigrator_1.ProjectMigratorMW,
922
- consolidateLocalRemote_1.ProjectConsolidateMW,
923
- aadManifestMigration_1.AadManifestMigrationMW,
924
- projectVersionChecker_1.ProjectVersionCheckerMW,
925
- projectSettingsLoader_1.ProjectSettingsLoaderMW,
926
- envInfoLoaderV3_1.EnvInfoLoaderMW_V3(false, true),
927
- questionModel_1.QuestionModelMW,
928
- concurrentLocker_1.ConcurrentLockerMW,
929
- contextInjector_1.ContextInjectorMW,
930
- ]),
931
- tslib_1.__metadata("design:type", Function),
932
- tslib_1.__metadata("design:paramtypes", [Object, Object]),
933
- tslib_1.__metadata("design:returntype", Promise)
934
- ], FxCore.prototype, "listCollaboratorOld", null);
935
- tslib_1.__decorate([
936
- hooks_1.hooks([
937
- errorHandler_1.ErrorHandlerMW,
938
- concurrentLocker_1.ConcurrentLockerMW,
939
- projectSettingsLoader_1.ProjectSettingsLoaderMW,
940
- envInfoLoaderV3_1.EnvInfoLoaderMW_V3(false),
941
- contextInjector_1.ContextInjectorMW,
942
- ]),
943
- tslib_1.__metadata("design:type", Function),
944
- tslib_1.__metadata("design:paramtypes", [Object, Object]),
442
+ tslib_1.__metadata("design:paramtypes", [Object]),
945
443
  tslib_1.__metadata("design:returntype", Promise)
946
444
  ], FxCore.prototype, "getSelectedEnv", null);
947
445
  tslib_1.__decorate([
948
- hooks_1.hooks([errorHandler_1.ErrorHandlerMW, concurrentLocker_1.ConcurrentLockerMW, projectSettingsLoader_1.ProjectSettingsLoaderMW, contextInjector_1.ContextInjectorMW]),
446
+ hooks_1.hooks([errorHandler_1.ErrorHandlerMW]),
949
447
  tslib_1.__metadata("design:type", Function),
950
- tslib_1.__metadata("design:paramtypes", [String, Object, Object]),
448
+ tslib_1.__metadata("design:paramtypes", [String, Object]),
951
449
  tslib_1.__metadata("design:returntype", Promise)
952
450
  ], FxCore.prototype, "encrypt", null);
953
451
  tslib_1.__decorate([
954
- hooks_1.hooks([errorHandler_1.ErrorHandlerMW, concurrentLocker_1.ConcurrentLockerMW, projectSettingsLoader_1.ProjectSettingsLoaderMW, contextInjector_1.ContextInjectorMW]),
452
+ hooks_1.hooks([errorHandler_1.ErrorHandlerMW]),
955
453
  tslib_1.__metadata("design:type", Function),
956
- tslib_1.__metadata("design:paramtypes", [String, Object, Object]),
454
+ tslib_1.__metadata("design:paramtypes", [String, Object]),
957
455
  tslib_1.__metadata("design:returntype", Promise)
958
456
  ], FxCore.prototype, "decrypt", null);
959
- tslib_1.__decorate([
960
- hooks_1.hooks([errorHandler_1.ErrorHandlerMW, concurrentLocker_1.ConcurrentLockerMW, projectSettingsLoader_1.ProjectSettingsLoaderMW, contextInjector_1.ContextInjectorMW]),
961
- tslib_1.__metadata("design:type", Function),
962
- tslib_1.__metadata("design:paramtypes", [Object, Object]),
963
- tslib_1.__metadata("design:returntype", Promise)
964
- ], FxCore.prototype, "createEnvOld", null);
965
- tslib_1.__decorate([
966
- hooks_1.hooks([errorHandler_1.ErrorHandlerMW, contextInjector_1.ContextInjectorMW, projectSettingsWriter_1.ProjectSettingsWriterMW]),
967
- tslib_1.__metadata("design:type", Function),
968
- tslib_1.__metadata("design:paramtypes", [Object, Object]),
969
- tslib_1.__metadata("design:returntype", Promise)
970
- ], FxCore.prototype, "init", null);
971
457
  exports.FxCore = FxCore;
972
458
  async function ensureBasicFolderStructure(inputs, createPackageJson = true) {
973
459
  if (!inputs.projectPath) {
@@ -975,7 +461,7 @@ async function ensureBasicFolderStructure(inputs, createPackageJson = true) {
975
461
  }
976
462
  try {
977
463
  if (createPackageJson) {
978
- const appName = inputs[question_1.CoreQuestionNames.AppName];
464
+ const appName = inputs[question_2.CoreQuestionNames.AppName];
979
465
  if (inputs.platform !== teamsfx_api_1.Platform.VS) {
980
466
  const packageJsonFilePath = path.join(inputs.projectPath, `package.json`);
981
467
  const exists = await fs_extra_1.default.pathExists(packageJsonFilePath);
@@ -1036,20 +522,16 @@ async function ensureBasicFolderStructure(inputs, createPackageJson = true) {
1036
522
  return teamsfx_api_1.ok(null);
1037
523
  }
1038
524
  exports.ensureBasicFolderStructure = ensureBasicFolderStructure;
1039
- async function listCollaboratorFunc(inputs, ctx) {
525
+ async function listCollaboratorFunc(inputs) {
1040
526
  globalVars_1.setCurrentStage(teamsfx_api_1.Stage.listCollaborator);
1041
527
  inputs.stage = teamsfx_api_1.Stage.listCollaborator;
1042
528
  const projectPath = inputs.projectPath;
1043
529
  if (!projectPath) {
1044
530
  return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("projectPath"));
1045
531
  }
1046
- if (ctx && ctx.contextV2 && (tools_1.isV3Enabled() || ctx.envInfoV3)) {
1047
- const context = utils_1.createContextV3(ctx === null || ctx === void 0 ? void 0 : ctx.projectSettings);
1048
- context.envInfo = ctx.envInfoV3;
1049
- const res = await collaborator_1.listCollaborator(context, inputs, ctx.envInfoV3, globalVars_1.TOOLS.tokenProvider);
1050
- return res;
1051
- }
1052
- return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("ctx, contextV2, envInfoV3"));
532
+ const context = utils_1.createContextV3();
533
+ const res = await collaborator_1.listCollaborator(context, inputs, undefined, globalVars_1.TOOLS.tokenProvider);
534
+ return res;
1053
535
  }
1054
536
  exports.listCollaboratorFunc = listCollaboratorFunc;
1055
537
  async function checkPermissionFunc(inputs, ctx) {
@@ -1059,13 +541,9 @@ async function checkPermissionFunc(inputs, ctx) {
1059
541
  if (!projectPath) {
1060
542
  return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("projectPath"));
1061
543
  }
1062
- if (ctx && ctx.contextV2 && (tools_1.isV3Enabled() || ctx.envInfoV3)) {
1063
- const context = utils_1.createContextV3(ctx === null || ctx === void 0 ? void 0 : ctx.projectSettings);
1064
- context.envInfo = ctx.envInfoV3;
1065
- const res = await collaborator_1.checkPermission(context, inputs, ctx.envInfoV3, globalVars_1.TOOLS.tokenProvider);
1066
- return res;
1067
- }
1068
- return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("ctx, contextV2, envInfoV3"));
544
+ const context = utils_1.createContextV3();
545
+ const res = await collaborator_1.checkPermission(context, inputs, undefined, globalVars_1.TOOLS.tokenProvider);
546
+ return res;
1069
547
  }
1070
548
  exports.checkPermissionFunc = checkPermissionFunc;
1071
549
  async function grantPermissionFunc(inputs, ctx) {
@@ -1075,13 +553,9 @@ async function grantPermissionFunc(inputs, ctx) {
1075
553
  if (!projectPath) {
1076
554
  return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("projectPath"));
1077
555
  }
1078
- if (ctx && ctx.contextV2 && (tools_1.isV3Enabled() || ctx.envInfoV3)) {
1079
- const context = utils_1.createContextV3(ctx === null || ctx === void 0 ? void 0 : ctx.projectSettings);
1080
- context.envInfo = ctx.envInfoV3;
1081
- const res = await collaborator_1.grantPermission(context, inputs, ctx.envInfoV3, globalVars_1.TOOLS.tokenProvider);
1082
- return res;
1083
- }
1084
- return teamsfx_api_1.err(new error_1.ObjectIsUndefinedError("ctx, contextV2, envInfoV3"));
556
+ const context = utils_1.createContextV3();
557
+ const res = await collaborator_1.grantPermission(context, inputs, undefined, globalVars_1.TOOLS.tokenProvider);
558
+ return res;
1085
559
  }
1086
560
  exports.grantPermissionFunc = grantPermissionFunc;
1087
561
  //# sourceMappingURL=FxCore.js.map