@microsoft/teamsfx-core 3.0.13 → 3.0.14-alpha.1ba1d62e58.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 (297) hide show
  1. package/build/client/teamsGraphClient.d.ts +3 -0
  2. package/build/client/teamsGraphClient.d.ts.map +1 -1
  3. package/build/client/teamsGraphClient.js +17 -0
  4. package/build/client/teamsGraphClient.js.map +1 -1
  5. package/build/common/featureFlags.d.ts +12 -2
  6. package/build/common/featureFlags.d.ts.map +1 -1
  7. package/build/common/featureFlags.js +15 -3
  8. package/build/common/featureFlags.js.map +1 -1
  9. package/build/common/projectSettingsHelper.d.ts +0 -2
  10. package/build/common/projectSettingsHelper.d.ts.map +1 -1
  11. package/build/common/projectSettingsHelper.js +1 -56
  12. package/build/common/projectSettingsHelper.js.map +1 -1
  13. package/build/common/telemetry.d.ts +4 -15
  14. package/build/common/telemetry.d.ts.map +1 -1
  15. package/build/common/telemetry.js +5 -18
  16. package/build/common/telemetry.js.map +1 -1
  17. package/build/common/templates-config.json +8 -2
  18. package/build/component/configManager/validator.d.ts.map +1 -1
  19. package/build/component/configManager/validator.js +2 -0
  20. package/build/component/configManager/validator.js.map +1 -1
  21. package/build/component/coordinator/index.d.ts.map +1 -1
  22. package/build/component/coordinator/index.js +5 -1
  23. package/build/component/coordinator/index.js.map +1 -1
  24. package/build/component/driver/copilotAgent/interfaces/PublishArgs.d.ts +14 -0
  25. package/build/component/driver/copilotAgent/interfaces/PublishArgs.d.ts.map +1 -0
  26. package/build/component/driver/copilotAgent/interfaces/PublishArgs.js +5 -0
  27. package/build/component/driver/copilotAgent/interfaces/PublishArgs.js.map +1 -0
  28. package/build/component/driver/copilotAgent/publish.d.ts +16 -0
  29. package/build/component/driver/copilotAgent/publish.d.ts.map +1 -0
  30. package/build/component/driver/copilotAgent/publish.js +175 -0
  31. package/build/component/driver/copilotAgent/publish.js.map +1 -0
  32. package/build/component/driver/dcr/create.d.ts +10 -0
  33. package/build/component/driver/dcr/create.d.ts.map +1 -0
  34. package/build/component/driver/dcr/create.js +142 -0
  35. package/build/component/driver/dcr/create.js.map +1 -0
  36. package/build/component/driver/dcr/error/dcrNameTooLong.d.ts +5 -0
  37. package/build/component/driver/dcr/error/dcrNameTooLong.d.ts.map +1 -0
  38. package/build/component/driver/dcr/error/dcrNameTooLong.js +21 -0
  39. package/build/component/driver/dcr/error/dcrNameTooLong.js.map +1 -0
  40. package/build/component/driver/dcr/error/dcrWellKnownInvalid.d.ts +5 -0
  41. package/build/component/driver/dcr/error/dcrWellKnownInvalid.d.ts.map +1 -0
  42. package/build/component/driver/dcr/error/dcrWellKnownInvalid.js +21 -0
  43. package/build/component/driver/dcr/error/dcrWellKnownInvalid.js.map +1 -0
  44. package/build/component/driver/dcr/interface/createDcrArgs.d.ts +9 -0
  45. package/build/component/driver/dcr/interface/createDcrArgs.d.ts.map +1 -0
  46. package/build/component/driver/dcr/interface/createDcrArgs.js +5 -0
  47. package/build/component/driver/dcr/interface/createDcrArgs.js.map +1 -0
  48. package/build/component/driver/dcr/interface/createDcrOutputs.d.ts +7 -0
  49. package/build/component/driver/dcr/interface/createDcrOutputs.d.ts.map +1 -0
  50. package/build/component/driver/dcr/interface/createDcrOutputs.js +10 -0
  51. package/build/component/driver/dcr/interface/createDcrOutputs.js.map +1 -0
  52. package/build/component/driver/dcr/utility/constants.d.ts +7 -0
  53. package/build/component/driver/dcr/utility/constants.d.ts.map +1 -0
  54. package/build/component/driver/dcr/utility/constants.js +12 -0
  55. package/build/component/driver/dcr/utility/constants.js.map +1 -0
  56. package/build/component/driver/index.d.ts +2 -0
  57. package/build/component/driver/index.d.ts.map +1 -1
  58. package/build/component/driver/index.js +2 -0
  59. package/build/component/driver/index.js.map +1 -1
  60. package/build/component/driver/teamsApp/constants.d.ts +1 -0
  61. package/build/component/driver/teamsApp/constants.d.ts.map +1 -1
  62. package/build/component/driver/teamsApp/constants.js +1 -0
  63. package/build/component/driver/teamsApp/constants.js.map +1 -1
  64. package/build/component/driver/teamsApp/createAppPackage.d.ts +2 -0
  65. package/build/component/driver/teamsApp/createAppPackage.d.ts.map +1 -1
  66. package/build/component/driver/teamsApp/createAppPackage.js +51 -6
  67. package/build/component/driver/teamsApp/createAppPackage.js.map +1 -1
  68. package/build/component/driver/teamsApp/interfaces/DcrRegistration.d.ts +10 -0
  69. package/build/component/driver/teamsApp/interfaces/DcrRegistration.d.ts.map +1 -0
  70. package/build/component/driver/teamsApp/interfaces/DcrRegistration.js +5 -0
  71. package/build/component/driver/teamsApp/interfaces/DcrRegistration.js.map +1 -0
  72. package/build/component/driver/teamsApp/publishAppPackage.d.ts +0 -2
  73. package/build/component/driver/teamsApp/publishAppPackage.d.ts.map +1 -1
  74. package/build/component/driver/teamsApp/publishAppPackage.js +2 -51
  75. package/build/component/driver/teamsApp/publishAppPackage.js.map +1 -1
  76. package/build/component/driver/teamsApp/utils/ManifestUtils.d.ts +1 -1
  77. package/build/component/driver/teamsApp/utils/ManifestUtils.d.ts.map +1 -1
  78. package/build/component/driver/teamsApp/utils/ManifestUtils.js +10 -2
  79. package/build/component/driver/teamsApp/utils/ManifestUtils.js.map +1 -1
  80. package/build/component/driver/teamsApp/utils/McpCertVerification.d.ts +13 -0
  81. package/build/component/driver/teamsApp/utils/McpCertVerification.d.ts.map +1 -0
  82. package/build/component/driver/teamsApp/utils/McpCertVerification.js +65 -0
  83. package/build/component/driver/teamsApp/utils/McpCertVerification.js.map +1 -0
  84. package/build/component/driver/teamsApp/validate.js +1 -1
  85. package/build/component/driver/teamsApp/validate.js.map +1 -1
  86. package/build/component/generator/declarativeAgent/generator.d.ts.map +1 -1
  87. package/build/component/generator/declarativeAgent/generator.js +1 -2
  88. package/build/component/generator/declarativeAgent/generator.js.map +1 -1
  89. package/build/component/generator/defaultGenerator.d.ts.map +1 -1
  90. package/build/component/generator/defaultGenerator.js +14 -1
  91. package/build/component/generator/defaultGenerator.js.map +1 -1
  92. package/build/component/generator/error.d.ts +3 -0
  93. package/build/component/generator/error.d.ts.map +1 -1
  94. package/build/component/generator/error.js +7 -1
  95. package/build/component/generator/error.js.map +1 -1
  96. package/build/component/generator/officeAddin/generator.d.ts +8 -0
  97. package/build/component/generator/officeAddin/generator.d.ts.map +1 -1
  98. package/build/component/generator/officeAddin/generator.js +47 -0
  99. package/build/component/generator/officeAddin/generator.js.map +1 -1
  100. package/build/component/generator/openPlugin/authorParser.d.ts +8 -0
  101. package/build/component/generator/openPlugin/authorParser.d.ts.map +1 -0
  102. package/build/component/generator/openPlugin/authorParser.js +49 -0
  103. package/build/component/generator/openPlugin/authorParser.js.map +1 -0
  104. package/build/component/generator/openPlugin/deterministicId.d.ts +6 -0
  105. package/build/component/generator/openPlugin/deterministicId.d.ts.map +1 -0
  106. package/build/component/generator/openPlugin/deterministicId.js +31 -0
  107. package/build/component/generator/openPlugin/deterministicId.js.map +1 -0
  108. package/build/component/generator/openPlugin/exporter.d.ts +18 -0
  109. package/build/component/generator/openPlugin/exporter.d.ts.map +1 -0
  110. package/build/component/generator/openPlugin/exporter.js +233 -0
  111. package/build/component/generator/openPlugin/exporter.js.map +1 -0
  112. package/build/component/generator/openPlugin/iconStrategy.d.ts +8 -0
  113. package/build/component/generator/openPlugin/iconStrategy.d.ts.map +1 -0
  114. package/build/component/generator/openPlugin/iconStrategy.js +62 -0
  115. package/build/component/generator/openPlugin/iconStrategy.js.map +1 -0
  116. package/build/component/generator/openPlugin/importer.d.ts +25 -0
  117. package/build/component/generator/openPlugin/importer.d.ts.map +1 -0
  118. package/build/component/generator/openPlugin/importer.js +140 -0
  119. package/build/component/generator/openPlugin/importer.js.map +1 -0
  120. package/build/component/generator/openPlugin/mapper.d.ts +6 -0
  121. package/build/component/generator/openPlugin/mapper.d.ts.map +1 -0
  122. package/build/component/generator/openPlugin/mapper.js +141 -0
  123. package/build/component/generator/openPlugin/mapper.js.map +1 -0
  124. package/build/component/generator/openPlugin/parser.d.ts +3 -0
  125. package/build/component/generator/openPlugin/parser.d.ts.map +1 -0
  126. package/build/component/generator/openPlugin/parser.js +153 -0
  127. package/build/component/generator/openPlugin/parser.js.map +1 -0
  128. package/build/component/generator/openPlugin/placeholderPng.d.ts +6 -0
  129. package/build/component/generator/openPlugin/placeholderPng.d.ts.map +1 -0
  130. package/build/component/generator/openPlugin/placeholderPng.js +71 -0
  131. package/build/component/generator/openPlugin/placeholderPng.js.map +1 -0
  132. package/build/component/generator/openPlugin/textUtils.d.ts +12 -0
  133. package/build/component/generator/openPlugin/textUtils.d.ts.map +1 -0
  134. package/build/component/generator/openPlugin/textUtils.js +43 -0
  135. package/build/component/generator/openPlugin/textUtils.js.map +1 -0
  136. package/build/component/generator/openPlugin/types.d.ts +128 -0
  137. package/build/component/generator/openPlugin/types.d.ts.map +1 -0
  138. package/build/component/generator/openPlugin/types.js.map +1 -0
  139. package/build/component/generator/templates/templateNames.d.ts +2 -1
  140. package/build/component/generator/templates/templateNames.d.ts.map +1 -1
  141. package/build/component/generator/templates/templateNames.js +2 -0
  142. package/build/component/generator/templates/templateNames.js.map +1 -1
  143. package/build/component/generator/templates/templateReplaceMap.d.ts.map +1 -1
  144. package/build/component/generator/templates/templateReplaceMap.js +4 -1
  145. package/build/component/generator/templates/templateReplaceMap.js.map +1 -1
  146. package/build/component/generator/v4TemplateBridge.d.ts +29 -0
  147. package/build/component/generator/v4TemplateBridge.d.ts.map +1 -0
  148. package/build/component/generator/v4TemplateBridge.js +114 -0
  149. package/build/component/generator/v4TemplateBridge.js.map +1 -0
  150. package/build/component/m365/packageService.d.ts +5 -0
  151. package/build/component/m365/packageService.d.ts.map +1 -1
  152. package/build/component/m365/packageService.js +23 -1
  153. package/build/component/m365/packageService.js.map +1 -1
  154. package/build/core/FxCore.d.ts +2 -4
  155. package/build/core/FxCore.d.ts.map +1 -1
  156. package/build/core/FxCore.js +3 -62
  157. package/build/core/FxCore.js.map +1 -1
  158. package/build/core/FxCore.openPlugin.d.ts +23 -0
  159. package/build/core/FxCore.openPlugin.d.ts.map +1 -0
  160. package/build/core/FxCore.openPlugin.js +131 -0
  161. package/build/core/FxCore.openPlugin.js.map +1 -0
  162. package/build/core/middleware/concurrentLocker.d.ts.map +1 -1
  163. package/build/core/middleware/concurrentLocker.js +0 -3
  164. package/build/core/middleware/concurrentLocker.js.map +1 -1
  165. package/build/core/middleware/errorHandler.d.ts.map +1 -1
  166. package/build/core/middleware/errorHandler.js +9 -0
  167. package/build/core/middleware/errorHandler.js.map +1 -1
  168. package/build/core/middleware/utils/v3MigrationUtils.d.ts +1 -34
  169. package/build/core/middleware/utils/v3MigrationUtils.d.ts.map +1 -1
  170. package/build/core/middleware/utils/v3MigrationUtils.js +6 -245
  171. package/build/core/middleware/utils/v3MigrationUtils.js.map +1 -1
  172. package/build/question/constants.d.ts.map +1 -1
  173. package/build/question/constants.js +1 -6
  174. package/build/question/constants.js.map +1 -1
  175. package/build/question/inputs/ExportOpenPluginInputs.d.ts +10 -0
  176. package/build/question/inputs/ExportOpenPluginInputs.d.ts.map +1 -0
  177. package/build/question/inputs/ExportOpenPluginInputs.js +5 -0
  178. package/build/question/inputs/ExportOpenPluginInputs.js.map +1 -0
  179. package/build/question/inputs/ImportOpenPluginInputs.d.ts +28 -0
  180. package/build/question/inputs/ImportOpenPluginInputs.d.ts.map +1 -0
  181. package/build/question/inputs/ImportOpenPluginInputs.js +5 -0
  182. package/build/question/inputs/ImportOpenPluginInputs.js.map +1 -0
  183. package/build/question/inputs/index.d.ts +2 -0
  184. package/build/question/inputs/index.d.ts.map +1 -1
  185. package/build/question/inputs/index.js +2 -0
  186. package/build/question/inputs/index.js.map +1 -1
  187. package/build/question/options/ExportOpenPluginOptions.d.ts +4 -0
  188. package/build/question/options/ExportOpenPluginOptions.d.ts.map +1 -0
  189. package/build/question/options/ExportOpenPluginOptions.js +29 -0
  190. package/build/question/options/ExportOpenPluginOptions.js.map +1 -0
  191. package/build/question/options/ImportOpenPluginOptions.d.ts +4 -0
  192. package/build/question/options/ImportOpenPluginOptions.d.ts.map +1 -0
  193. package/build/question/options/ImportOpenPluginOptions.js +54 -0
  194. package/build/question/options/ImportOpenPluginOptions.js.map +1 -0
  195. package/build/question/options/index.d.ts +2 -0
  196. package/build/question/options/index.d.ts.map +1 -1
  197. package/build/question/options/index.js +2 -0
  198. package/build/question/options/index.js.map +1 -1
  199. package/build/question/scaffold/vsc/daProjectTypeNode.d.ts.map +1 -1
  200. package/build/question/scaffold/vsc/daProjectTypeNode.js +1 -3
  201. package/build/question/scaffold/vsc/daProjectTypeNode.js.map +1 -1
  202. package/build/v4/distribution/bundledFloor.d.ts +12 -0
  203. package/build/v4/distribution/bundledFloor.d.ts.map +1 -0
  204. package/build/v4/distribution/bundledFloor.js +80 -0
  205. package/build/v4/distribution/bundledFloor.js.map +1 -0
  206. package/build/v4/distribution/templateConfig.d.ts +53 -0
  207. package/build/v4/distribution/templateConfig.d.ts.map +1 -0
  208. package/build/v4/distribution/templateConfig.js +43 -0
  209. package/build/v4/distribution/templateConfig.js.map +1 -0
  210. package/build/v4/distribution/templatePackage.d.ts +29 -0
  211. package/build/v4/distribution/templatePackage.d.ts.map +1 -0
  212. package/build/v4/distribution/templatePackage.js +82 -0
  213. package/build/v4/distribution/templatePackage.js.map +1 -0
  214. package/build/v4/distribution/templateSource.d.ts +67 -0
  215. package/build/v4/distribution/templateSource.d.ts.map +1 -0
  216. package/build/v4/distribution/templateSource.js +220 -0
  217. package/build/v4/distribution/templateSource.js.map +1 -0
  218. package/build/v4/distribution/templateSourcePort.d.ts +50 -0
  219. package/build/v4/distribution/templateSourcePort.d.ts.map +1 -0
  220. package/build/v4/distribution/templateSourcePort.js +207 -0
  221. package/build/v4/distribution/templateSourcePort.js.map +1 -0
  222. package/build/v4/index.d.ts +13 -0
  223. package/build/v4/index.d.ts.map +1 -0
  224. package/build/v4/index.js +18 -0
  225. package/build/v4/index.js.map +1 -0
  226. package/package.json +4 -4
  227. package/resource/package.nls.cs.json +9 -1
  228. package/resource/package.nls.de.json +10 -2
  229. package/resource/package.nls.es.json +9 -1
  230. package/resource/package.nls.fr.json +9 -1
  231. package/resource/package.nls.it.json +10 -2
  232. package/resource/package.nls.ja.json +9 -1
  233. package/resource/package.nls.json +10 -13
  234. package/resource/package.nls.ko.json +9 -1
  235. package/resource/package.nls.pl.json +10 -2
  236. package/resource/package.nls.pt-BR.json +9 -1
  237. package/resource/package.nls.ru.json +10 -2
  238. package/resource/package.nls.tr.json +11 -3
  239. package/resource/package.nls.zh-Hans.json +9 -1
  240. package/resource/package.nls.zh-Hant.json +9 -1
  241. package/resource/yaml-schema/v1.12/yaml.schema.json +2132 -0
  242. package/resource/yaml-schema/v1.13/yaml.schema.json +2193 -0
  243. package/resource/yaml-schema/yaml.schema.json +124 -2
  244. package/templates/fallback/common.zip +0 -0
  245. package/templates/fallback/csharp.zip +0 -0
  246. package/templates/fallback/js.zip +0 -0
  247. package/templates/fallback/python.zip +0 -0
  248. package/templates/fallback/ts.zip +0 -0
  249. package/templates/metadata.zip +0 -0
  250. package/templates/ui/tdpNode.json +1 -2
  251. package/templates/ui/wizardNode.json +1 -2
  252. package/templates/v4/floor.json +3 -0
  253. package/templates/v4/templates.zip +0 -0
  254. package/build/core/middleware/projectMigratorV3.d.ts +0 -39
  255. package/build/core/middleware/projectMigratorV3.d.ts.map +0 -1
  256. package/build/core/middleware/projectMigratorV3.js +0 -694
  257. package/build/core/middleware/projectMigratorV3.js.map +0 -1
  258. package/build/core/middleware/projectVersionChecker.d.ts +0 -3
  259. package/build/core/middleware/projectVersionChecker.d.ts.map +0 -1
  260. package/build/core/middleware/projectVersionChecker.js +0 -60
  261. package/build/core/middleware/projectVersionChecker.js.map +0 -1
  262. package/build/core/middleware/types.d.ts +0 -9
  263. package/build/core/middleware/types.d.ts.map +0 -1
  264. package/build/core/middleware/types.js.map +0 -1
  265. package/build/core/middleware/utils/MigrationUtils.d.ts +0 -13
  266. package/build/core/middleware/utils/MigrationUtils.d.ts.map +0 -1
  267. package/build/core/middleware/utils/MigrationUtils.js +0 -212
  268. package/build/core/middleware/utils/MigrationUtils.js.map +0 -1
  269. package/build/core/middleware/utils/appYmlGenerator.d.ts +0 -34
  270. package/build/core/middleware/utils/appYmlGenerator.d.ts.map +0 -1
  271. package/build/core/middleware/utils/appYmlGenerator.js +0 -158
  272. package/build/core/middleware/utils/appYmlGenerator.js.map +0 -1
  273. package/build/core/middleware/utils/debug/appLocalYmlGenerator.d.ts +0 -65
  274. package/build/core/middleware/utils/debug/appLocalYmlGenerator.d.ts.map +0 -1
  275. package/build/core/middleware/utils/debug/appLocalYmlGenerator.js +0 -61
  276. package/build/core/middleware/utils/debug/appLocalYmlGenerator.js.map +0 -1
  277. package/build/core/middleware/utils/debug/constants.d.ts +0 -20
  278. package/build/core/middleware/utils/debug/constants.d.ts.map +0 -1
  279. package/build/core/middleware/utils/debug/constants.js +0 -28
  280. package/build/core/middleware/utils/debug/constants.js.map +0 -1
  281. package/build/core/middleware/utils/debug/debugMigrationContext.d.ts +0 -14
  282. package/build/core/middleware/utils/debug/debugMigrationContext.d.ts.map +0 -1
  283. package/build/core/middleware/utils/debug/debugMigrationContext.js +0 -23
  284. package/build/core/middleware/utils/debug/debugMigrationContext.js.map +0 -1
  285. package/build/core/middleware/utils/debug/debugV3MigrationUtils.d.ts +0 -37
  286. package/build/core/middleware/utils/debug/debugV3MigrationUtils.d.ts.map +0 -1
  287. package/build/core/middleware/utils/debug/debugV3MigrationUtils.js +0 -291
  288. package/build/core/middleware/utils/debug/debugV3MigrationUtils.js.map +0 -1
  289. package/build/core/middleware/utils/debug/taskMigrator.d.ts +0 -22
  290. package/build/core/middleware/utils/debug/taskMigrator.d.ts.map +0 -1
  291. package/build/core/middleware/utils/debug/taskMigrator.js +0 -935
  292. package/build/core/middleware/utils/debug/taskMigrator.js.map +0 -1
  293. package/build/core/middleware/utils/migrationContext.d.ts +0 -32
  294. package/build/core/middleware/utils/migrationContext.d.ts.map +0 -1
  295. package/build/core/middleware/utils/migrationContext.js +0 -104
  296. package/build/core/middleware/utils/migrationContext.js.map +0 -1
  297. /package/build/{core/middleware → component/generator/openPlugin}/types.js +0 -0
@@ -1,935 +0,0 @@
1
- "use strict";
2
- // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT license.
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.migrateTransparentPrerequisite = migrateTransparentPrerequisite;
6
- exports.migrateTransparentLocalTunnel = migrateTransparentLocalTunnel;
7
- exports.migrateTransparentNpmInstall = migrateTransparentNpmInstall;
8
- exports.migrateSetUpTab = migrateSetUpTab;
9
- exports.migrateSetUpBot = migrateSetUpBot;
10
- exports.migrateSetUpSSO = migrateSetUpSSO;
11
- exports.migratePrepareManifest = migratePrepareManifest;
12
- exports.migrateInstallAppInTeams = migrateInstallAppInTeams;
13
- exports.migrateValidateDependencies = migrateValidateDependencies;
14
- exports.migrateBackendExtensionsInstall = migrateBackendExtensionsInstall;
15
- exports.migrateFrontendStart = migrateFrontendStart;
16
- exports.migrateAuthStart = migrateAuthStart;
17
- exports.migrateBotStart = migrateBotStart;
18
- exports.migrateBackendWatch = migrateBackendWatch;
19
- exports.migrateBackendStart = migrateBackendStart;
20
- exports.migrateValidateLocalPrerequisites = migrateValidateLocalPrerequisites;
21
- exports.migratePreDebugCheck = migratePreDebugCheck;
22
- exports.migrateNgrokStartTask = migrateNgrokStartTask;
23
- exports.migrateNgrokStartCommand = migrateNgrokStartCommand;
24
- exports.migrateGetFuncPathCommand = migrateGetFuncPathCommand;
25
- const tslib_1 = require("tslib");
26
- const comment_json_1 = require("comment-json");
27
- const local_1 = require("../../../../component/local");
28
- const debugV3MigrationUtils_1 = require("./debugV3MigrationUtils");
29
- const crypto_1 = require("../../../crypto");
30
- const os = tslib_1.__importStar(require("os"));
31
- const path = tslib_1.__importStar(require("path"));
32
- const nodeChecker_1 = require("../../../../component/deps-checker/internal/nodeChecker");
33
- async function migrateTransparentPrerequisite(context) {
34
- for (const task of context.tasks) {
35
- if (!(0, debugV3MigrationUtils_1.isCommentObject)(task) ||
36
- !(task["type"] === "teamsfx") ||
37
- !(task["command"] === local_1.TaskCommand.checkPrerequisites)) {
38
- continue;
39
- }
40
- if ((0, debugV3MigrationUtils_1.isCommentObject)(task["args"]) && (0, debugV3MigrationUtils_1.isCommentArray)(task["args"]["prerequisites"])) {
41
- const newPrerequisites = [];
42
- const toolsArgs = {};
43
- for (const prerequisite of task["args"]["prerequisites"]) {
44
- if (prerequisite === local_1.Prerequisite.nodejs) {
45
- newPrerequisites.push(`"${local_1.Prerequisite.nodejs}", // Validate if Node.js is installed.`);
46
- }
47
- else if (prerequisite === local_1.Prerequisite.m365Account) {
48
- newPrerequisites.push(`"${local_1.Prerequisite.m365Account}", // Sign-in prompt for Microsoft 365 account, then validate if the account enables the sideloading permission.`);
49
- }
50
- else if (prerequisite === local_1.Prerequisite.portOccupancy) {
51
- newPrerequisites.push(`"${local_1.Prerequisite.portOccupancy}", // Validate available ports to ensure those debug ones are not occupied.`);
52
- }
53
- else if (prerequisite === local_1.Prerequisite.func) {
54
- toolsArgs.func = {
55
- version: await getFuncVersion(),
56
- symlinkDir: debugV3MigrationUtils_1.defaultFuncSymlinkDir,
57
- };
58
- }
59
- else if (prerequisite === local_1.Prerequisite.devCert) {
60
- toolsArgs.devCert = { trust: true };
61
- }
62
- else if (prerequisite === local_1.Prerequisite.dotnet) {
63
- toolsArgs.dotnet = true;
64
- }
65
- }
66
- task["args"]["prerequisites"] = (0, comment_json_1.parse)(`[
67
- ${newPrerequisites.join("\n ")}
68
- ]`);
69
- if (Object.keys(toolsArgs).length > 0) {
70
- if (!context.appYmlConfig.deploy) {
71
- context.appYmlConfig.deploy = {};
72
- }
73
- context.appYmlConfig.deploy.tools = toolsArgs;
74
- }
75
- }
76
- }
77
- }
78
- function migrateTransparentLocalTunnel(context) {
79
- let index = 0;
80
- while (index < context.tasks.length) {
81
- const task = context.tasks[index];
82
- if (!(0, debugV3MigrationUtils_1.isCommentObject)(task) ||
83
- !(task["type"] === "teamsfx") ||
84
- !(task["command"] === local_1.TaskCommand.startLocalTunnel)) {
85
- ++index;
86
- continue;
87
- }
88
- if ((0, debugV3MigrationUtils_1.isCommentObject)(task["args"])) {
89
- if (typeof task["args"]["ngrokArgs"] === "string") {
90
- const portNumber = getNgrokPort(task["args"]["ngrokArgs"]);
91
- if (portNumber) {
92
- task["args"] = generateLocalTunnelTaskArgs(context, portNumber);
93
- const comment = `{
94
- // Start the local tunnel service to forward public URL to local port and inspect traffic.
95
- // See https://aka.ms/teamsfx-tasks/local-tunnel for the detailed args definitions.
96
- }`;
97
- const comments = task[Symbol.for("before:label")];
98
- comments?.splice(0, comments?.length ?? 0);
99
- (0, comment_json_1.assign)(task, (0, comment_json_1.parse)(comment));
100
- ++index;
101
- continue;
102
- }
103
- }
104
- }
105
- const comment = `{
106
- // Microsoft 365 Agents Toolkit now uses Dev Tunnel as default tunnel solution.
107
- // See https://aka.ms/teamsfx-tasks/local-tunnel for more details.
108
- // If you still prefer to use ngrok, please refer to https://aka.ms/teamsfx-tasks/customize-tunnel-service to learn how to use your own tunnel service.
109
- }`;
110
- const newTask = (0, comment_json_1.assign)((0, comment_json_1.parse)(comment), {
111
- label: task["label"],
112
- type: "shell",
113
- command: "echo 'Microsoft 365 Agents Toolkit now uses Dev Tunnel as default tunnel solution. For manual updates, see https://aka.ms/teamsfx-tasks/local-tunnel.' && exit 1",
114
- windows: {
115
- options: {
116
- shell: {
117
- executable: "cmd.exe",
118
- args: ["/d", "/c"],
119
- },
120
- },
121
- },
122
- });
123
- context.tasks.splice(index, 1, newTask);
124
- ++index;
125
- }
126
- return Promise.resolve();
127
- }
128
- function getNgrokPort(ngrokCommand) {
129
- const regex = /http\s+(?<port>\d+)\s+--log=stdout\s+--log-format=logfmt\s?/gm;
130
- const match = regex.exec(ngrokCommand);
131
- if (!match) {
132
- return undefined;
133
- }
134
- const portNumber = Number.parseInt(match.groups?.port ?? "");
135
- return Number.isInteger(portNumber) ? portNumber : undefined;
136
- }
137
- function migrateTransparentNpmInstall(context) {
138
- let index = 0;
139
- while (index < context.tasks.length) {
140
- const task = context.tasks[index];
141
- if (!(0, debugV3MigrationUtils_1.isCommentObject)(task) ||
142
- !(task["type"] === "teamsfx") ||
143
- !(task["command"] === local_1.TaskCommand.npmInstall)) {
144
- ++index;
145
- continue;
146
- }
147
- if ((0, debugV3MigrationUtils_1.isCommentObject)(task["args"]) && (0, debugV3MigrationUtils_1.isCommentArray)(task["args"]["projects"])) {
148
- for (const npmArgs of task["args"]["projects"]) {
149
- if (!(0, debugV3MigrationUtils_1.isCommentObject)(npmArgs) || !(typeof npmArgs["cwd"] === "string")) {
150
- continue;
151
- }
152
- const npmInstallArg = { args: "install" };
153
- npmInstallArg.workingDirectory = npmArgs["cwd"].replace("${workspaceFolder}", ".");
154
- if (typeof npmArgs["npmInstallArgs"] === "string") {
155
- npmInstallArg.args = `install ${npmArgs["npmInstallArgs"]}`;
156
- }
157
- else if ((0, debugV3MigrationUtils_1.isCommentArray)(npmArgs["npmInstallArgs"]) &&
158
- npmArgs["npmInstallArgs"].length > 0) {
159
- npmInstallArg.args = `install ${npmArgs["npmInstallArgs"].join(" ")}`;
160
- }
161
- if (!context.appYmlConfig.deploy) {
162
- context.appYmlConfig.deploy = {};
163
- }
164
- if (!context.appYmlConfig.deploy.npmCommands) {
165
- context.appYmlConfig.deploy.npmCommands = [];
166
- }
167
- context.appYmlConfig.deploy.npmCommands.push(npmInstallArg);
168
- }
169
- }
170
- if (typeof task["label"] === "string") {
171
- // TODO: remove preLaunchTask in launch.json
172
- replaceInDependsOn(task["label"], context.tasks);
173
- }
174
- context.tasks.splice(index, 1);
175
- }
176
- return Promise.resolve();
177
- }
178
- function migrateSetUpTab(context) {
179
- let index = 0;
180
- while (index < context.tasks.length) {
181
- const task = context.tasks[index];
182
- if (!(0, debugV3MigrationUtils_1.isCommentObject)(task) ||
183
- !(task["type"] === "teamsfx") ||
184
- !(task["command"] === local_1.TaskCommand.setUpTab)) {
185
- ++index;
186
- continue;
187
- }
188
- let url = new URL("https://localhost:53000");
189
- if ((0, debugV3MigrationUtils_1.isCommentObject)(task["args"]) && typeof task["args"]["baseUrl"] === "string") {
190
- try {
191
- url = new URL(task["args"]["baseUrl"]);
192
- }
193
- catch { }
194
- }
195
- if (!context.appYmlConfig.provision.configureApp) {
196
- context.appYmlConfig.provision.configureApp = {};
197
- }
198
- if (!context.appYmlConfig.provision.configureApp.tab) {
199
- context.appYmlConfig.provision.configureApp.tab = {};
200
- }
201
- context.appYmlConfig.provision.configureApp.tab.domain = url.host;
202
- context.appYmlConfig.provision.configureApp.tab.endpoint = url.origin;
203
- if (!context.appYmlConfig.deploy) {
204
- context.appYmlConfig.deploy = {};
205
- }
206
- if (!context.appYmlConfig.deploy.tab) {
207
- context.appYmlConfig.deploy.tab = {};
208
- }
209
- context.appYmlConfig.deploy.tab.port = parseInt(url.port);
210
- const label = task["label"];
211
- index = handleProvisionAndDeploy(context, index, label);
212
- }
213
- return Promise.resolve();
214
- }
215
- async function migrateSetUpBot(context) {
216
- let index = 0;
217
- while (index < context.tasks.length) {
218
- const task = context.tasks[index];
219
- if (!(0, debugV3MigrationUtils_1.isCommentObject)(task) ||
220
- !(task["type"] === "teamsfx") ||
221
- !(task["command"] === local_1.TaskCommand.setUpBot)) {
222
- ++index;
223
- continue;
224
- }
225
- context.appYmlConfig.provision.bot = {
226
- messagingEndpoint: `$\{{${context.placeholderMapping.botEndpoint}}}/api/messages`,
227
- };
228
- if (!context.appYmlConfig.deploy) {
229
- context.appYmlConfig.deploy = {};
230
- }
231
- context.appYmlConfig.deploy.bot = true;
232
- const envs = {};
233
- if ((0, debugV3MigrationUtils_1.isCommentObject)(task["args"])) {
234
- if (task["args"]["botId"] && typeof task["args"]["botId"] === "string") {
235
- envs["BOT_ID"] = task["args"]["botId"];
236
- }
237
- if (task["args"]["botPassword"] && typeof task["args"]["botPassword"] === "string") {
238
- const envReferencePattern = /^\$\{env:(.*)\}$/;
239
- const matchResult = task["args"]["botPassword"].match(envReferencePattern);
240
- const botPassword = matchResult ? process.env[matchResult[1]] : task["args"]["botPassword"];
241
- if (botPassword) {
242
- const cryptoProvider = new crypto_1.LocalCrypto(context.oldProjectSettings.projectId);
243
- const result = cryptoProvider.encrypt(botPassword);
244
- if (result.isOk()) {
245
- envs["SECRET_BOT_PASSWORD"] = result.value;
246
- }
247
- }
248
- }
249
- if (task["args"]["botMessagingEndpoint"] &&
250
- typeof task["args"]["botMessagingEndpoint"] === "string") {
251
- if (task["args"]["botMessagingEndpoint"].startsWith("http")) {
252
- context.appYmlConfig.provision.bot.messagingEndpoint =
253
- task["args"]["botMessagingEndpoint"];
254
- }
255
- else if (task["args"]["botMessagingEndpoint"].startsWith("/")) {
256
- context.appYmlConfig.provision.bot.messagingEndpoint = `$\{{${context.placeholderMapping.botEndpoint}}}${task["args"]["botMessagingEndpoint"]}`;
257
- }
258
- }
259
- }
260
- await (0, debugV3MigrationUtils_1.updateLocalEnv)(context.migrationContext, envs);
261
- const label = task["label"];
262
- index = handleProvisionAndDeploy(context, index, label);
263
- }
264
- }
265
- async function migrateSetUpSSO(context) {
266
- let index = 0;
267
- while (index < context.tasks.length) {
268
- const task = context.tasks[index];
269
- if (!(0, debugV3MigrationUtils_1.isCommentObject)(task) ||
270
- !(task["type"] === "teamsfx") ||
271
- !(task["command"] === local_1.TaskCommand.setUpSSO)) {
272
- ++index;
273
- continue;
274
- }
275
- if (!context.appYmlConfig.provision.registerApp) {
276
- context.appYmlConfig.provision.registerApp = {};
277
- }
278
- context.appYmlConfig.provision.registerApp.aad = true;
279
- if (!context.appYmlConfig.provision.configureApp) {
280
- context.appYmlConfig.provision.configureApp = {};
281
- }
282
- context.appYmlConfig.provision.configureApp.aad = true;
283
- if (!context.appYmlConfig.deploy) {
284
- context.appYmlConfig.deploy = {};
285
- }
286
- context.appYmlConfig.deploy.sso = true;
287
- const envs = {};
288
- if ((0, debugV3MigrationUtils_1.isCommentObject)(task["args"])) {
289
- if (task["args"]["objectId"] && typeof task["args"]["objectId"] === "string") {
290
- envs["AAD_APP_OBJECT_ID"] = task["args"]["objectId"];
291
- }
292
- if (task["args"]["clientId"] && typeof task["args"]["clientId"] === "string") {
293
- envs["AAD_APP_CLIENT_ID"] = task["args"]["clientId"];
294
- }
295
- if (task["args"]["clientSecret"] && typeof task["args"]["clientSecret"] === "string") {
296
- const envReferencePattern = /^\$\{env:(.*)\}$/;
297
- const matchResult = task["args"]["clientSecret"].match(envReferencePattern);
298
- const clientSecret = matchResult
299
- ? process.env[matchResult[1]]
300
- : task["args"]["clientSecret"];
301
- if (clientSecret) {
302
- const cryptoProvider = new crypto_1.LocalCrypto(context.oldProjectSettings.projectId);
303
- const result = cryptoProvider.encrypt(clientSecret);
304
- if (result.isOk()) {
305
- envs["SECRET_AAD_APP_CLIENT_SECRET"] = result.value;
306
- }
307
- }
308
- }
309
- if (task["args"]["accessAsUserScopeId"] &&
310
- typeof task["args"]["accessAsUserScopeId"] === "string") {
311
- envs["AAD_APP_ACCESS_AS_USER_PERMISSION_ID"] = task["args"]["accessAsUserScopeId"];
312
- }
313
- }
314
- await (0, debugV3MigrationUtils_1.updateLocalEnv)(context.migrationContext, envs);
315
- const label = task["label"];
316
- index = handleProvisionAndDeploy(context, index, label);
317
- }
318
- }
319
- function migratePrepareManifest(context) {
320
- let index = 0;
321
- while (index < context.tasks.length) {
322
- const task = context.tasks[index];
323
- if (!(0, debugV3MigrationUtils_1.isCommentObject)(task) ||
324
- !(task["type"] === "teamsfx") ||
325
- !(task["command"] === local_1.TaskCommand.prepareManifest)) {
326
- ++index;
327
- continue;
328
- }
329
- let appPackagePath = undefined;
330
- if ((0, debugV3MigrationUtils_1.isCommentObject)(task["args"]) && typeof task["args"]["appPackagePath"] === "string") {
331
- appPackagePath = task["args"]["appPackagePath"];
332
- }
333
- if (!appPackagePath) {
334
- if (!context.appYmlConfig.provision.registerApp) {
335
- context.appYmlConfig.provision.registerApp = {};
336
- }
337
- context.appYmlConfig.provision.registerApp.teamsApp = true;
338
- }
339
- if (!context.appYmlConfig.provision.configureApp) {
340
- context.appYmlConfig.provision.configureApp = {};
341
- }
342
- if (!context.appYmlConfig.provision.configureApp.teamsApp) {
343
- context.appYmlConfig.provision.configureApp.teamsApp = {};
344
- }
345
- context.appYmlConfig.provision.configureApp.teamsApp.appPackagePath = appPackagePath;
346
- const label = task["label"];
347
- index = handleProvisionAndDeploy(context, index, label);
348
- }
349
- return Promise.resolve();
350
- }
351
- function migrateInstallAppInTeams(context) {
352
- let index = 0;
353
- while (index < context.tasks.length) {
354
- const task = context.tasks[index];
355
- if (!(0, debugV3MigrationUtils_1.isCommentObject)(task) ||
356
- !(task["type"] === "shell") ||
357
- !(typeof task["command"] === "string") ||
358
- !task["command"].includes("${command:fx-extension.install-app-in-teams}")) {
359
- ++index;
360
- continue;
361
- }
362
- const label = task["label"];
363
- if (typeof label === "string") {
364
- replaceInDependsOn(label, context.tasks);
365
- }
366
- context.tasks.splice(index, 1);
367
- }
368
- return Promise.resolve();
369
- }
370
- async function migrateValidateDependencies(context) {
371
- let index = 0;
372
- while (index < context.tasks.length) {
373
- const task = context.tasks[index];
374
- if (!(0, debugV3MigrationUtils_1.isCommentObject)(task) ||
375
- !(task["type"] === "shell") ||
376
- !(typeof task["command"] === "string") ||
377
- !task["command"].includes("${command:fx-extension.validate-dependencies}")) {
378
- ++index;
379
- continue;
380
- }
381
- const newTask = generatePrerequisiteTask(task, context);
382
- context.tasks.splice(index, 1, newTask);
383
- ++index;
384
- const toolsArgs = {};
385
- if (debugV3MigrationUtils_1.OldProjectSettingsHelper.includeTab(context.oldProjectSettings)) {
386
- toolsArgs.devCert = {
387
- trust: true,
388
- };
389
- if (debugV3MigrationUtils_1.OldProjectSettingsHelper.includeSSO(context.oldProjectSettings)) {
390
- toolsArgs.dotnet = true;
391
- }
392
- }
393
- if (debugV3MigrationUtils_1.OldProjectSettingsHelper.includeFunction(context.oldProjectSettings)) {
394
- toolsArgs.func = {
395
- version: await getFuncVersion(),
396
- symlinkDir: debugV3MigrationUtils_1.defaultFuncSymlinkDir,
397
- };
398
- toolsArgs.dotnet = true;
399
- }
400
- if (Object.keys(toolsArgs).length > 0) {
401
- if (!context.appYmlConfig.deploy) {
402
- context.appYmlConfig.deploy = {};
403
- }
404
- context.appYmlConfig.deploy.tools = toolsArgs;
405
- }
406
- }
407
- }
408
- function migrateBackendExtensionsInstall(context) {
409
- let index = 0;
410
- while (index < context.tasks.length) {
411
- const task = context.tasks[index];
412
- if (!(0, debugV3MigrationUtils_1.isCommentObject)(task) ||
413
- !(task["type"] === "shell") ||
414
- !(typeof task["command"] === "string" &&
415
- task["command"].includes("${command:fx-extension.backend-extensions-install}"))) {
416
- ++index;
417
- continue;
418
- }
419
- if (!context.appYmlConfig.deploy) {
420
- context.appYmlConfig.deploy = {};
421
- }
422
- context.appYmlConfig.deploy.dotnetCommand = {
423
- args: "build extensions.csproj -o ./bin --ignore-failed-sources",
424
- workingDirectory: `${local_1.FolderName.Function}`,
425
- execPath: "${{DOTNET_PATH}}",
426
- };
427
- const label = task["label"];
428
- if (typeof label === "string") {
429
- replaceInDependsOn(label, context.tasks);
430
- }
431
- context.tasks.splice(index, 1);
432
- }
433
- return Promise.resolve();
434
- }
435
- function migrateFrontendStart(context) {
436
- let index = 0;
437
- while (index < context.tasks.length) {
438
- const task = context.tasks[index];
439
- if ((0, debugV3MigrationUtils_1.isCommentObject)(task) &&
440
- ((typeof task["dependsOn"] === "string" && task["dependsOn"] === "teamsfx: frontend start") ||
441
- ((0, debugV3MigrationUtils_1.isCommentArray)(task["dependsOn"]) &&
442
- task["dependsOn"].includes("teamsfx: frontend start")))) {
443
- const newLabel = (0, debugV3MigrationUtils_1.generateLabel)("Start frontend", getLabels(context.tasks));
444
- const newTask = (0, debugV3MigrationUtils_1.startFrontendTask)(newLabel);
445
- context.tasks.splice(index + 1, 0, newTask);
446
- replaceInDependsOn("teamsfx: frontend start", context.tasks, newLabel);
447
- if (!context.appYmlConfig.deploy) {
448
- context.appYmlConfig.deploy = {};
449
- }
450
- context.appYmlConfig.deploy.frontendStart = {
451
- sso: debugV3MigrationUtils_1.OldProjectSettingsHelper.includeSSO(context.oldProjectSettings),
452
- functionName: debugV3MigrationUtils_1.OldProjectSettingsHelper.getFunctionName(context.oldProjectSettings),
453
- };
454
- if (!context.appYmlConfig.deploy.npmCommands) {
455
- context.appYmlConfig.deploy.npmCommands = [];
456
- }
457
- const existing = context.appYmlConfig.deploy.npmCommands.find((value) => value.args === "install -D env-cmd");
458
- if (!existing) {
459
- context.appYmlConfig.deploy.npmCommands.push({
460
- args: "install -D env-cmd",
461
- workingDirectory: ".",
462
- });
463
- }
464
- break;
465
- }
466
- else {
467
- ++index;
468
- }
469
- }
470
- return Promise.resolve();
471
- }
472
- function migrateAuthStart(context) {
473
- let index = 0;
474
- while (index < context.tasks.length) {
475
- const task = context.tasks[index];
476
- if ((0, debugV3MigrationUtils_1.isCommentObject)(task) &&
477
- ((typeof task["dependsOn"] === "string" && task["dependsOn"] === "teamsfx: auth start") ||
478
- ((0, debugV3MigrationUtils_1.isCommentArray)(task["dependsOn"]) && task["dependsOn"].includes("teamsfx: auth start")))) {
479
- const newLabel = (0, debugV3MigrationUtils_1.generateLabel)("Start auth", getLabels(context.tasks));
480
- const newTask = (0, debugV3MigrationUtils_1.startAuthTask)(newLabel);
481
- context.tasks.splice(index + 1, 0, newTask);
482
- replaceInDependsOn("teamsfx: auth start", context.tasks, newLabel);
483
- if (!context.appYmlConfig.deploy) {
484
- context.appYmlConfig.deploy = {};
485
- }
486
- context.appYmlConfig.deploy.authStart = {
487
- appsettingsPath: path.join(os.homedir(), ".fx", "localauth", "appsettings.Development.json"),
488
- };
489
- break;
490
- }
491
- else {
492
- ++index;
493
- }
494
- }
495
- return Promise.resolve();
496
- }
497
- function migrateBotStart(context) {
498
- let index = 0;
499
- while (index < context.tasks.length) {
500
- const task = context.tasks[index];
501
- if ((0, debugV3MigrationUtils_1.isCommentObject)(task) &&
502
- ((typeof task["dependsOn"] === "string" && task["dependsOn"] === "teamsfx: bot start") ||
503
- ((0, debugV3MigrationUtils_1.isCommentArray)(task["dependsOn"]) && task["dependsOn"].includes("teamsfx: bot start")))) {
504
- const newLabel = (0, debugV3MigrationUtils_1.generateLabel)("Start bot", getLabels(context.tasks));
505
- const newTask = (0, debugV3MigrationUtils_1.startBotTask)(newLabel, context.oldProjectSettings.programmingLanguage);
506
- context.tasks.splice(index + 1, 0, newTask);
507
- replaceInDependsOn("teamsfx: bot start", context.tasks, newLabel);
508
- if (!context.appYmlConfig.deploy) {
509
- context.appYmlConfig.deploy = {};
510
- }
511
- context.appYmlConfig.deploy.botStart = {
512
- tab: debugV3MigrationUtils_1.OldProjectSettingsHelper.includeTab(context.oldProjectSettings),
513
- function: debugV3MigrationUtils_1.OldProjectSettingsHelper.includeFunction(context.oldProjectSettings),
514
- sso: debugV3MigrationUtils_1.OldProjectSettingsHelper.includeSSO(context.oldProjectSettings),
515
- };
516
- if (!context.appYmlConfig.deploy.npmCommands) {
517
- context.appYmlConfig.deploy.npmCommands = [];
518
- }
519
- const existing = context.appYmlConfig.deploy.npmCommands.find((value) => value.args === "install -D env-cmd");
520
- if (!existing) {
521
- context.appYmlConfig.deploy.npmCommands.push({
522
- args: "install -D env-cmd",
523
- workingDirectory: ".",
524
- });
525
- }
526
- break;
527
- }
528
- else {
529
- ++index;
530
- }
531
- }
532
- return Promise.resolve();
533
- }
534
- function migrateBackendWatch(context) {
535
- let index = 0;
536
- while (index < context.tasks.length) {
537
- const task = context.tasks[index];
538
- if ((0, debugV3MigrationUtils_1.isCommentObject)(task) &&
539
- ((typeof task["dependsOn"] === "string" && task["dependsOn"] === "teamsfx: backend watch") ||
540
- ((0, debugV3MigrationUtils_1.isCommentArray)(task["dependsOn"]) && task["dependsOn"].includes("teamsfx: backend watch")))) {
541
- const newLabel = (0, debugV3MigrationUtils_1.generateLabel)("Watch backend", getLabels(context.tasks));
542
- const newTask = (0, debugV3MigrationUtils_1.watchBackendTask)(newLabel);
543
- context.tasks.splice(index + 1, 0, newTask);
544
- replaceInDependsOn("teamsfx: backend watch", context.tasks, newLabel);
545
- break;
546
- }
547
- else {
548
- ++index;
549
- }
550
- }
551
- return Promise.resolve();
552
- }
553
- function migrateBackendStart(context) {
554
- let index = 0;
555
- while (index < context.tasks.length) {
556
- const task = context.tasks[index];
557
- if ((0, debugV3MigrationUtils_1.isCommentObject)(task) &&
558
- ((typeof task["dependsOn"] === "string" && task["dependsOn"] === "teamsfx: backend start") ||
559
- ((0, debugV3MigrationUtils_1.isCommentArray)(task["dependsOn"]) && task["dependsOn"].includes("teamsfx: backend start")))) {
560
- const newLabel = (0, debugV3MigrationUtils_1.generateLabel)("Start backend", getLabels(context.tasks));
561
- const newTask = (0, debugV3MigrationUtils_1.startBackendTask)(newLabel, context.oldProjectSettings.programmingLanguage);
562
- context.tasks.splice(index + 1, 0, newTask);
563
- replaceInDependsOn("teamsfx: backend start", context.tasks, newLabel);
564
- if (!context.appYmlConfig.deploy) {
565
- context.appYmlConfig.deploy = {};
566
- }
567
- context.appYmlConfig.deploy.backendStart = true;
568
- if (!context.appYmlConfig.deploy.npmCommands) {
569
- context.appYmlConfig.deploy.npmCommands = [];
570
- }
571
- const existing = context.appYmlConfig.deploy.npmCommands.find((value) => value.args === "install -D env-cmd");
572
- if (!existing) {
573
- context.appYmlConfig.deploy.npmCommands.push({
574
- args: "install -D env-cmd",
575
- workingDirectory: ".",
576
- });
577
- }
578
- break;
579
- }
580
- else {
581
- ++index;
582
- }
583
- }
584
- return Promise.resolve();
585
- }
586
- async function migrateValidateLocalPrerequisites(context) {
587
- let index = 0;
588
- while (index < context.tasks.length) {
589
- const task = context.tasks[index];
590
- if (!(0, debugV3MigrationUtils_1.isCommentObject)(task) ||
591
- !(task["type"] === "shell") ||
592
- !(typeof task["command"] === "string" &&
593
- task["command"].includes("${command:fx-extension.validate-local-prerequisites}"))) {
594
- ++index;
595
- continue;
596
- }
597
- const newTask = generatePrerequisiteTask(task, context);
598
- context.tasks.splice(index, 1, newTask);
599
- ++index;
600
- const toolsArgs = {};
601
- const npmCommands = [];
602
- let dotnetCommand;
603
- if (debugV3MigrationUtils_1.OldProjectSettingsHelper.includeTab(context.oldProjectSettings)) {
604
- toolsArgs.devCert = {
605
- trust: true,
606
- };
607
- npmCommands.push({
608
- args: `install ${local_1.defaultNpmInstallArg}`,
609
- workingDirectory: `${local_1.FolderName.Frontend}`,
610
- });
611
- }
612
- if (debugV3MigrationUtils_1.OldProjectSettingsHelper.includeFunction(context.oldProjectSettings)) {
613
- toolsArgs.func = {
614
- version: await getFuncVersion(),
615
- symlinkDir: debugV3MigrationUtils_1.defaultFuncSymlinkDir,
616
- };
617
- toolsArgs.dotnet = true;
618
- npmCommands.push({
619
- args: `install ${local_1.defaultNpmInstallArg}`,
620
- workingDirectory: `${local_1.FolderName.Function}`,
621
- });
622
- dotnetCommand = {
623
- args: "build extensions.csproj -o ./bin --ignore-failed-sources",
624
- workingDirectory: `${local_1.FolderName.Function}`,
625
- execPath: "${{DOTNET_PATH}}",
626
- };
627
- }
628
- if (debugV3MigrationUtils_1.OldProjectSettingsHelper.includeBot(context.oldProjectSettings)) {
629
- if (debugV3MigrationUtils_1.OldProjectSettingsHelper.includeFuncHostedBot(context.oldProjectSettings)) {
630
- toolsArgs.func = {
631
- version: await getFuncVersion(),
632
- symlinkDir: debugV3MigrationUtils_1.defaultFuncSymlinkDir,
633
- };
634
- }
635
- npmCommands.push({
636
- args: `install ${local_1.defaultNpmInstallArg}`,
637
- workingDirectory: `${local_1.FolderName.Bot}`,
638
- });
639
- }
640
- if (Object.keys(toolsArgs).length > 0 || npmCommands.length > 0 || dotnetCommand) {
641
- if (!context.appYmlConfig.deploy) {
642
- context.appYmlConfig.deploy = {};
643
- }
644
- if (Object.keys(toolsArgs).length > 0) {
645
- context.appYmlConfig.deploy.tools = toolsArgs;
646
- }
647
- if (npmCommands.length > 0) {
648
- context.appYmlConfig.deploy.npmCommands = npmCommands;
649
- }
650
- context.appYmlConfig.deploy.dotnetCommand = dotnetCommand;
651
- }
652
- }
653
- }
654
- function migratePreDebugCheck(context) {
655
- let index = 0;
656
- while (index < context.tasks.length) {
657
- const task = context.tasks[index];
658
- if (!(0, debugV3MigrationUtils_1.isCommentObject)(task) ||
659
- !(task["type"] === "shell") ||
660
- !(typeof task["command"] === "string" &&
661
- task["command"].includes("${command:fx-extension.pre-debug-check}"))) {
662
- ++index;
663
- continue;
664
- }
665
- if (!context.appYmlConfig.provision.registerApp) {
666
- context.appYmlConfig.provision.registerApp = {};
667
- }
668
- if (debugV3MigrationUtils_1.OldProjectSettingsHelper.includeSSO(context.oldProjectSettings)) {
669
- context.appYmlConfig.provision.registerApp.aad = true;
670
- }
671
- context.appYmlConfig.provision.registerApp.teamsApp = true;
672
- if (debugV3MigrationUtils_1.OldProjectSettingsHelper.includeBot(context.oldProjectSettings)) {
673
- context.appYmlConfig.provision.bot = {
674
- messagingEndpoint: `$\{{${context.placeholderMapping.botEndpoint}}}/api/messages`,
675
- };
676
- }
677
- if (!context.appYmlConfig.provision.configureApp) {
678
- context.appYmlConfig.provision.configureApp = {};
679
- }
680
- if (debugV3MigrationUtils_1.OldProjectSettingsHelper.includeTab(context.oldProjectSettings)) {
681
- context.appYmlConfig.provision.configureApp.tab = {
682
- domain: "localhost:53000",
683
- endpoint: "https://localhost:53000",
684
- };
685
- }
686
- if (debugV3MigrationUtils_1.OldProjectSettingsHelper.includeSSO(context.oldProjectSettings)) {
687
- context.appYmlConfig.provision.configureApp.aad = true;
688
- }
689
- if (!context.appYmlConfig.provision.configureApp.teamsApp) {
690
- context.appYmlConfig.provision.configureApp.teamsApp = {};
691
- }
692
- const validateLocalPrerequisitesTask = context.tasks.find((_task) => (0, debugV3MigrationUtils_1.isCommentObject)(_task) &&
693
- _task["type"] === "shell" &&
694
- typeof _task["command"] === "string" &&
695
- _task["command"].includes("${command:fx-extension.validate-local-prerequisites}"));
696
- if (validateLocalPrerequisitesTask) {
697
- if (!context.appYmlConfig.deploy) {
698
- context.appYmlConfig.deploy = {};
699
- }
700
- if (debugV3MigrationUtils_1.OldProjectSettingsHelper.includeTab(context.oldProjectSettings)) {
701
- context.appYmlConfig.deploy.tab = {
702
- port: 53000,
703
- };
704
- }
705
- if (debugV3MigrationUtils_1.OldProjectSettingsHelper.includeBot(context.oldProjectSettings)) {
706
- context.appYmlConfig.deploy.bot = true;
707
- }
708
- if (debugV3MigrationUtils_1.OldProjectSettingsHelper.includeSSO(context.oldProjectSettings)) {
709
- context.appYmlConfig.deploy.sso = true;
710
- }
711
- }
712
- const existingLabels = getLabels(context.tasks);
713
- const createResourcesLabel = (0, debugV3MigrationUtils_1.generateLabel)("Provision", existingLabels);
714
- const setUpLocalProjectsLabel = (0, debugV3MigrationUtils_1.generateLabel)("Deploy", existingLabels);
715
- task["dependsOn"] = new comment_json_1.CommentArray(createResourcesLabel, setUpLocalProjectsLabel);
716
- task["dependsOrder"] = "sequence";
717
- const createResources = (0, debugV3MigrationUtils_1.createResourcesTask)(createResourcesLabel);
718
- context.tasks.splice(index + 1, 0, createResources);
719
- const setUpLocalProjects = (0, debugV3MigrationUtils_1.setUpLocalProjectsTask)(setUpLocalProjectsLabel);
720
- context.tasks.splice(index + 2, 0, setUpLocalProjects);
721
- delete task["type"];
722
- delete task["command"];
723
- delete task["presentation"];
724
- break;
725
- }
726
- return Promise.resolve();
727
- }
728
- function migrateNgrokStartTask(context) {
729
- let index = 0;
730
- while (index < context.tasks.length) {
731
- const task = context.tasks[index];
732
- if ((0, debugV3MigrationUtils_1.isCommentObject)(task) &&
733
- ((typeof task["dependsOn"] === "string" && task["dependsOn"] === "teamsfx: ngrok start") ||
734
- ((0, debugV3MigrationUtils_1.isCommentArray)(task["dependsOn"]) && task["dependsOn"].includes("teamsfx: ngrok start")))) {
735
- const newTask = generateLocalTunnelTask(context);
736
- context.tasks.splice(index + 1, 0, newTask);
737
- break;
738
- }
739
- else {
740
- ++index;
741
- }
742
- }
743
- replaceInDependsOn("teamsfx: ngrok start", context.tasks, local_1.TaskLabel.StartLocalTunnel);
744
- return Promise.resolve();
745
- }
746
- function migrateNgrokStartCommand(context) {
747
- let index = 0;
748
- while (index < context.tasks.length) {
749
- const task = context.tasks[index];
750
- if (!(0, debugV3MigrationUtils_1.isCommentObject)(task) ||
751
- !(task["type"] === "teamsfx") ||
752
- !(task["command"] === "ngrok start")) {
753
- ++index;
754
- continue;
755
- }
756
- const newTask = generateLocalTunnelTask(context, task);
757
- context.tasks.splice(index, 1, newTask);
758
- ++index;
759
- }
760
- return Promise.resolve();
761
- }
762
- function migrateGetFuncPathCommand(context) {
763
- const getFuncPathCommand = "${command:fx-extension.get-func-path}";
764
- const getFuncPathDelimiterCommand = "${command:fx-extension.get-path-delimiter}";
765
- for (const task of context.tasks) {
766
- if (!(0, debugV3MigrationUtils_1.isCommentObject)(task)) {
767
- continue;
768
- }
769
- const generateNewValue = (oldStr) => {
770
- const newStr = oldStr.startsWith(getFuncPathCommand)
771
- ? oldStr.replace(getFuncPathCommand, `\${workspaceFolder}/devTools/func${getFuncPathDelimiterCommand}`)
772
- : oldStr;
773
- return newStr.replace(/\${command:fx-extension.get-func-path}/g, `${getFuncPathDelimiterCommand}\${workspaceFolder}/devTools/func${getFuncPathDelimiterCommand}`);
774
- };
775
- if ((0, debugV3MigrationUtils_1.isCommentObject)(task["options"]) && (0, debugV3MigrationUtils_1.isCommentObject)(task["options"]["env"])) {
776
- for (const [key, value] of Object.entries(task["options"]["env"])) {
777
- if (typeof value === "string") {
778
- task["options"]["env"][key] = generateNewValue(value);
779
- }
780
- }
781
- }
782
- const platforms = ["windows", "linux", "osx"];
783
- platforms.forEach((platform) => {
784
- if ((0, debugV3MigrationUtils_1.isCommentObject)(task[platform]) &&
785
- (0, debugV3MigrationUtils_1.isCommentObject)(task[platform]["options"]) &&
786
- (0, debugV3MigrationUtils_1.isCommentObject)(task[platform]["options"]["env"])) {
787
- const envObj = task[platform]["options"]["env"];
788
- for (const [key, value] of Object.entries(envObj)) {
789
- if (typeof value === "string") {
790
- envObj[key] = generateNewValue(value);
791
- }
792
- }
793
- }
794
- });
795
- }
796
- return Promise.resolve();
797
- }
798
- function generatePrerequisiteTask(task, context) {
799
- const comment = `{
800
- // Check if all required prerequisites are installed and will install them if not.
801
- // See https://aka.ms/teamsfx-check-prerequisites-task to know the details and how to customize the args.
802
- }`;
803
- const newTask = (0, comment_json_1.assign)((0, comment_json_1.parse)(comment), task);
804
- newTask["type"] = "teamsfx";
805
- newTask["command"] = "debug-check-prerequisites";
806
- const prerequisites = [
807
- `"${local_1.Prerequisite.nodejs}", // Validate if Node.js is installed.`,
808
- `"${local_1.Prerequisite.m365Account}", // Sign-in prompt for Microsoft 365 account, then validate if the account enables the sideloading permission.`,
809
- `"${local_1.Prerequisite.portOccupancy}", // Validate available ports to ensure those debug ones are not occupied.`,
810
- ];
811
- const prerequisitesComment = `
812
- [
813
- ${prerequisites.join("\n ")}
814
- ]`;
815
- const ports = [];
816
- if (debugV3MigrationUtils_1.OldProjectSettingsHelper.includeTab(context.oldProjectSettings)) {
817
- ports.push(`${local_1.TaskDefaultValue.checkPrerequisites.ports.tabService}, // tab service port`);
818
- }
819
- if (debugV3MigrationUtils_1.OldProjectSettingsHelper.includeBot(context.oldProjectSettings)) {
820
- ports.push(`${local_1.TaskDefaultValue.checkPrerequisites.ports.botService}, // bot service port`);
821
- ports.push(`${local_1.TaskDefaultValue.checkPrerequisites.ports.botDebug}, // bot inspector port for Node.js debugger`);
822
- }
823
- if (debugV3MigrationUtils_1.OldProjectSettingsHelper.includeFunction(context.oldProjectSettings)) {
824
- ports.push(`${local_1.TaskDefaultValue.checkPrerequisites.ports.backendService}, // backend service port`);
825
- ports.push(`${local_1.TaskDefaultValue.checkPrerequisites.ports.backendDebug}, // backend inspector port for Node.js debugger`);
826
- }
827
- const portsComment = `
828
- [
829
- ${ports.join("\n ")}
830
- ]
831
- `;
832
- const args = {
833
- prerequisites: (0, comment_json_1.parse)(prerequisitesComment),
834
- portOccupancy: (0, comment_json_1.parse)(portsComment),
835
- };
836
- newTask["args"] = args;
837
- return newTask;
838
- }
839
- function generateLocalTunnelTask(context, task) {
840
- const comment = `{
841
- // Start the local tunnel service to forward public URL to local port and inspect traffic.
842
- // See https://aka.ms/teamsfx-tasks/local-tunnel for the detailed args definitions.
843
- }`;
844
- const newTask = (0, comment_json_1.assign)(task ?? (0, comment_json_1.parse)(`{"label": "${local_1.TaskLabel.StartLocalTunnel}"}`), {
845
- type: "teamsfx",
846
- command: local_1.TaskCommand.startLocalTunnel,
847
- args: generateLocalTunnelTaskArgs(context),
848
- isBackground: true,
849
- problemMatcher: "$teamsfx-local-tunnel-watch",
850
- });
851
- return (0, comment_json_1.assign)((0, comment_json_1.parse)(comment), newTask);
852
- }
853
- function generateLocalTunnelTaskArgs(context, portNumnber = local_1.TaskDefaultValue.startLocalTunnel.devTunnel.bot.port) {
854
- const placeholderComment = `
855
- {
856
- // Keep consistency with upgraded configuration.
857
- }
858
- `;
859
- return (0, comment_json_1.assign)((0, comment_json_1.parse)("{}"), {
860
- type: local_1.TunnelType.devTunnel,
861
- ports: [
862
- {
863
- portNumber: portNumnber,
864
- protocol: local_1.TaskDefaultValue.startLocalTunnel.devTunnel.bot.protocol,
865
- access: local_1.TaskDefaultValue.startLocalTunnel.devTunnel.bot.access,
866
- writeToEnvironmentFile: (0, comment_json_1.assign)((0, comment_json_1.parse)(placeholderComment), {
867
- endpoint: context.placeholderMapping.botEndpoint,
868
- domain: context.placeholderMapping.botDomain,
869
- }),
870
- },
871
- ],
872
- env: "local",
873
- });
874
- }
875
- function handleProvisionAndDeploy(context, index, label) {
876
- context.tasks.splice(index, 1);
877
- const existingLabels = getLabels(context.tasks);
878
- const generatedBefore = context.generatedLabels.find((value) => value.startsWith("Provision"));
879
- const createResourcesLabel = generatedBefore || (0, debugV3MigrationUtils_1.generateLabel)("Provision", existingLabels);
880
- const setUpLocalProjectsLabel = context.generatedLabels.find((value) => value.startsWith("Deploy")) ||
881
- (0, debugV3MigrationUtils_1.generateLabel)("Deploy", existingLabels);
882
- if (!generatedBefore) {
883
- context.generatedLabels.push(createResourcesLabel);
884
- const createResources = (0, debugV3MigrationUtils_1.createResourcesTask)(createResourcesLabel);
885
- context.tasks.splice(index, 0, createResources);
886
- ++index;
887
- context.generatedLabels.push(setUpLocalProjectsLabel);
888
- const setUpLocalProjects = (0, debugV3MigrationUtils_1.setUpLocalProjectsTask)(setUpLocalProjectsLabel);
889
- context.tasks.splice(index, 0, setUpLocalProjects);
890
- ++index;
891
- }
892
- replaceInDependsOn(label, context.tasks, createResourcesLabel, setUpLocalProjectsLabel);
893
- return index;
894
- }
895
- function replaceInDependsOn(label, tasks, ...replacements) {
896
- for (const task of tasks) {
897
- if ((0, debugV3MigrationUtils_1.isCommentObject)(task) && task["dependsOn"]) {
898
- if (typeof task["dependsOn"] === "string") {
899
- if (task["dependsOn"] === label) {
900
- if (replacements.length > 0) {
901
- task["dependsOn"] = new comment_json_1.CommentArray(...replacements);
902
- }
903
- else {
904
- delete task["dependsOn"];
905
- }
906
- }
907
- }
908
- else if (Array.isArray(task["dependsOn"])) {
909
- const index = task["dependsOn"].findIndex((value) => value === label);
910
- if (index !== -1) {
911
- if (replacements.length > 0 && !task["dependsOn"].includes(replacements[0])) {
912
- task["dependsOn"].splice(index, 1, ...replacements);
913
- }
914
- else {
915
- task["dependsOn"].splice(index, 1);
916
- }
917
- }
918
- }
919
- }
920
- }
921
- }
922
- function getLabels(tasks) {
923
- const labels = [];
924
- for (const task of tasks) {
925
- if ((0, debugV3MigrationUtils_1.isCommentObject)(task) && typeof task["label"] === "string") {
926
- labels.push(task["label"]);
927
- }
928
- }
929
- return labels;
930
- }
931
- async function getFuncVersion() {
932
- const nodeVersion = (await nodeChecker_1.NodeChecker.getInstalledNodeVersion())?.majorVersion;
933
- return !nodeVersion || Number.parseInt(nodeVersion) >= 18 ? "^4.0.5174" : "4";
934
- }
935
- //# sourceMappingURL=taskMigrator.js.map