@microsoft/teamsfx-core 3.0.10-alpha.445672d19.0 → 3.0.10-alpha.4748befd3.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 (111) hide show
  1. package/build/client/graphClient.d.ts +1 -0
  2. package/build/client/graphClient.d.ts.map +1 -1
  3. package/build/client/teamsDevPortalClient.d.ts +1 -0
  4. package/build/client/teamsDevPortalClient.d.ts.map +1 -1
  5. package/build/common/featureFlags.d.ts +5 -20
  6. package/build/common/featureFlags.d.ts.map +1 -1
  7. package/build/common/featureFlags.js +6 -21
  8. package/build/common/featureFlags.js.map +1 -1
  9. package/build/common/templates-config.json +1 -1
  10. package/build/component/coordinator/index.d.ts.map +1 -1
  11. package/build/component/coordinator/index.js +0 -11
  12. package/build/component/coordinator/index.js.map +1 -1
  13. package/build/component/deps-checker/internal/dotnetChecker.d.ts +5 -1
  14. package/build/component/deps-checker/internal/dotnetChecker.d.ts.map +1 -1
  15. package/build/component/deps-checker/internal/dotnetChecker.js +13 -1
  16. package/build/component/deps-checker/internal/dotnetChecker.js.map +1 -1
  17. package/build/component/driver/deploy/spfx/utility/spoClient.d.ts +1 -0
  18. package/build/component/driver/deploy/spfx/utility/spoClient.d.ts.map +1 -1
  19. package/build/component/driver/devTool/httpClient.d.ts +1 -0
  20. package/build/component/driver/devTool/httpClient.d.ts.map +1 -1
  21. package/build/component/driver/devTool/nodeInstaller.d.ts +1 -0
  22. package/build/component/driver/devTool/nodeInstaller.d.ts.map +1 -1
  23. package/build/component/driver/script/scriptDriver.d.ts +1 -0
  24. package/build/component/driver/script/scriptDriver.d.ts.map +1 -1
  25. package/build/component/driver/share/utils.d.ts.map +1 -1
  26. package/build/component/driver/share/utils.js +6 -0
  27. package/build/component/driver/share/utils.js.map +1 -1
  28. package/build/component/driver/teamsApp/constants.d.ts +1 -1
  29. package/build/component/driver/teamsApp/constants.d.ts.map +1 -1
  30. package/build/component/driver/teamsApp/constants.js +2 -2
  31. package/build/component/driver/teamsApp/constants.js.map +1 -1
  32. package/build/component/driver/teamsApp/copyAppPackageToSPFx.d.ts +1 -0
  33. package/build/component/driver/teamsApp/copyAppPackageToSPFx.d.ts.map +1 -1
  34. package/build/component/driver/teamsApp/interfaces/appdefinitions/appPackage.d.ts +1 -0
  35. package/build/component/driver/teamsApp/interfaces/appdefinitions/appPackage.d.ts.map +1 -1
  36. package/build/component/driver/teamsApp/utils/ManifestUtils.d.ts +1 -0
  37. package/build/component/driver/teamsApp/utils/ManifestUtils.d.ts.map +1 -1
  38. package/build/component/generator/declarativeAgent/generator.d.ts +5 -0
  39. package/build/component/generator/declarativeAgent/generator.d.ts.map +1 -1
  40. package/build/component/generator/declarativeAgent/generator.js +76 -36
  41. package/build/component/generator/declarativeAgent/generator.js.map +1 -1
  42. package/build/component/generator/generatorAction.d.ts +1 -0
  43. package/build/component/generator/generatorAction.d.ts.map +1 -1
  44. package/build/component/generator/openApiSpec/common.d.ts.map +1 -1
  45. package/build/component/generator/openApiSpec/common.js +11 -22
  46. package/build/component/generator/openApiSpec/common.js.map +1 -1
  47. package/build/component/generator/openApiSpec/kiota.d.ts +0 -6
  48. package/build/component/generator/openApiSpec/kiota.d.ts.map +1 -1
  49. package/build/component/generator/openApiSpec/kiota.js +2 -17
  50. package/build/component/generator/openApiSpec/kiota.js.map +1 -1
  51. package/build/component/generator/templates/templateInfo.d.ts +1 -1
  52. package/build/component/generator/templates/templateInfo.d.ts.map +1 -1
  53. package/build/component/generator/utils.d.ts +3 -2
  54. package/build/component/generator/utils.d.ts.map +1 -1
  55. package/build/component/generator/utils.js.map +1 -1
  56. package/build/component/m365/packageService.d.ts.map +1 -1
  57. package/build/component/m365/packageService.js +16 -20
  58. package/build/component/m365/packageService.js.map +1 -1
  59. package/build/component/middleware/envMW.d.ts.map +1 -1
  60. package/build/component/middleware/envMW.js +7 -0
  61. package/build/component/middleware/envMW.js.map +1 -1
  62. package/build/component/utils/envUtil.d.ts +1 -0
  63. package/build/component/utils/envUtil.d.ts.map +1 -1
  64. package/build/core/FxCore.d.ts.map +1 -1
  65. package/build/core/FxCore.js +29 -75
  66. package/build/core/FxCore.js.map +1 -1
  67. package/build/question/other.d.ts.map +1 -1
  68. package/build/question/other.js +0 -2
  69. package/build/question/other.js.map +1 -1
  70. package/build/question/questionNames.d.ts +0 -3
  71. package/build/question/questionNames.d.ts.map +1 -1
  72. package/build/question/questionNames.js +0 -3
  73. package/build/question/questionNames.js.map +1 -1
  74. package/build/question/scaffold/vsc/ProjectTypeOptions.d.ts +0 -1
  75. package/build/question/scaffold/vsc/ProjectTypeOptions.d.ts.map +1 -1
  76. package/build/question/scaffold/vsc/ProjectTypeOptions.js +1 -14
  77. package/build/question/scaffold/vsc/ProjectTypeOptions.js.map +1 -1
  78. package/build/question/scaffold/vsc/createRootNode.d.ts.map +1 -1
  79. package/build/question/scaffold/vsc/createRootNode.js +1 -5
  80. package/build/question/scaffold/vsc/createRootNode.js.map +1 -1
  81. package/build/question/scaffold/vsc/daProjectTypeNode.d.ts.map +1 -1
  82. package/build/question/scaffold/vsc/daProjectTypeNode.js +1 -2
  83. package/build/question/scaffold/vsc/daProjectTypeNode.js.map +1 -1
  84. package/build/question/scaffold/vsc/officeAddinProjectTypeNode.d.ts +0 -1
  85. package/build/question/scaffold/vsc/officeAddinProjectTypeNode.d.ts.map +1 -1
  86. package/build/question/scaffold/vsc/officeAddinProjectTypeNode.js +2 -51
  87. package/build/question/scaffold/vsc/officeAddinProjectTypeNode.js.map +1 -1
  88. package/build/question/scaffold/vsc/teamsProjectTypeNode.d.ts.map +1 -1
  89. package/build/question/scaffold/vsc/teamsProjectTypeNode.js +4 -15
  90. package/build/question/scaffold/vsc/teamsProjectTypeNode.js.map +1 -1
  91. package/package.json +5 -5
  92. package/resource/package.nls.cs.json +1 -0
  93. package/resource/package.nls.de.json +13 -12
  94. package/resource/package.nls.es.json +12 -11
  95. package/resource/package.nls.fr.json +1 -0
  96. package/resource/package.nls.it.json +1 -0
  97. package/resource/package.nls.ja.json +2 -1
  98. package/resource/package.nls.json +3 -4
  99. package/resource/package.nls.ko.json +12 -11
  100. package/resource/package.nls.pl.json +12 -11
  101. package/resource/package.nls.pt-BR.json +8 -7
  102. package/resource/package.nls.ru.json +3 -2
  103. package/resource/package.nls.tr.json +1 -0
  104. package/resource/package.nls.zh-Hans.json +1 -0
  105. package/resource/package.nls.zh-Hant.json +6 -5
  106. package/templates/fallback/common.zip +0 -0
  107. package/templates/fallback/csharp.zip +0 -0
  108. package/templates/fallback/js.zip +0 -0
  109. package/templates/fallback/python.zip +0 -0
  110. package/templates/fallback/ts.zip +0 -0
  111. package/templates/metadata.zip +0 -0
@@ -18,7 +18,6 @@ const url_1 = require("url");
18
18
  const teamsDevPortalClient_1 = require("../client/teamsDevPortalClient");
19
19
  const constants_1 = require("../common/constants");
20
20
  const daSpecParser_1 = require("../common/daSpecParser");
21
- const featureFlags_1 = require("../common/featureFlags");
22
21
  const globalVars_1 = require("../common/globalVars");
23
22
  const localizeUtils_1 = require("../common/localizeUtils");
24
23
  const projectSettingsHelper_1 = require("../common/projectSettingsHelper");
@@ -1056,7 +1055,7 @@ class FxCore {
1056
1055
  .toString()
1057
1056
  .split(/\r?\n/)
1058
1057
  .forEach((line) => {
1059
- const reg = /^([a-zA-Z_][a-zA-Z0-9_]*=)/g;
1058
+ const reg = /^([a-zA-Z_][a-zA-Z0-9_]*=)(.*)/g;
1060
1059
  const match = reg.exec(line);
1061
1060
  if (match) {
1062
1061
  if (match[1].startsWith("TEAMSFX_ENV=")) {
@@ -1066,7 +1065,7 @@ class FxCore {
1066
1065
  writeStream.write(`APP_NAME_SUFFIX=${targetEnvName}${os.EOL}`);
1067
1066
  }
1068
1067
  else if (match[1].startsWith("AGENT_SCOPE=")) {
1069
- writeStream.write(`AGENT_SCOPE=shared${os.EOL}`);
1068
+ writeStream.write(`AGENT_SCOPE=${match[2]}${os.EOL}`);
1070
1069
  }
1071
1070
  else {
1072
1071
  writeStream.write(`${match[1]}${os.EOL}`);
@@ -1349,24 +1348,10 @@ class FxCore {
1349
1348
  if (!inputs.projectPath) {
1350
1349
  throw new Error("projectPath is undefined"); // should never happen
1351
1350
  }
1352
- // Call Kiota to select the OpenAPI spec file
1353
- if (inputs.platform === teamsfx_api_1.Platform.VSCode &&
1354
- featureFlags_1.featureFlagManager.getBooleanValue(featureFlags_1.FeatureFlags.KiotaIntegration) &&
1355
- inputs[constants_3.QuestionNames.ActionType] === constants_3.ActionStartOptions.apiSpec().id &&
1356
- !!!inputs[constants_3.QuestionNames.ActionManifestPath]) {
1357
- return (0, teamsfx_api_1.ok)({
1358
- projectPath: inputs.projectPath,
1359
- lastCommand: constants_2.KiotaLastCommands.addPlugin,
1360
- manifestPath: inputs[constants_3.QuestionNames.ManifestPath],
1361
- });
1362
- }
1363
1351
  const context = (0, globalVars_1.createContext)();
1364
1352
  const teamsManifestPath = inputs[constants_3.QuestionNames.ManifestPath];
1365
1353
  const appPackageFolder = path.dirname(teamsManifestPath);
1366
1354
  const isGenerateFromApiSpec = inputs[constants_3.QuestionNames.ActionType] === constants_3.ActionStartOptions.apiSpec().id;
1367
- const isKiotaIntegration = inputs.platform === teamsfx_api_1.Platform.VSCode &&
1368
- featureFlags_1.featureFlagManager.getBooleanValue(featureFlags_1.FeatureFlags.KiotaIntegration) &&
1369
- !!inputs[constants_3.QuestionNames.ActionManifestPath];
1370
1355
  // validate the project is valid for adding plugin
1371
1356
  const manifestRes = await ManifestUtils_1.manifestUtils._readAppManifest(teamsManifestPath);
1372
1357
  if (manifestRes.isErr()) {
@@ -1393,15 +1378,9 @@ class FxCore {
1393
1378
  // Will be used if generating from API spec
1394
1379
  let specParser = undefined;
1395
1380
  let authNameAndSchemes = [];
1396
- if (isGenerateFromApiSpec && !isKiotaIntegration) {
1381
+ if (isGenerateFromApiSpec) {
1397
1382
  specParser = new m365_spec_parser_1.SpecParser(inputs[constants_3.QuestionNames.ApiSpecLocation].trim(), (0, helper_2.getParserOptions)(m365_spec_parser_1.ProjectType.Copilot, true));
1398
1383
  const listResult = await (0, daSpecParser_1.listAPIInfo)(inputs[constants_3.QuestionNames.ApiSpecLocation].trim());
1399
- if (inputs.platform === teamsfx_api_1.Platform.VSCode &&
1400
- featureFlags_1.featureFlagManager.getBooleanValue(featureFlags_1.FeatureFlags.KiotaIntegration) &&
1401
- inputs[constants_3.QuestionNames.ActionType] === constants_3.ActionStartOptions.apiSpec().id &&
1402
- !!inputs[constants_3.QuestionNames.ActionManifestPath]) {
1403
- inputs[constants_3.QuestionNames.ApiOperation] = listResult.APIs.filter((value) => value.isValid).map((value) => value.api);
1404
- }
1405
1384
  authNameAndSchemes = this.parseAuthNameAndScheme(listResult, inputs);
1406
1385
  if (authNameAndSchemes.length > 0) {
1407
1386
  const doesLocalYamlPathExists = await fs_extra_1.default.pathExists(path.join(inputs.projectPath, versionMetadata_1.MetadataV3.localConfigFile));
@@ -1428,64 +1407,39 @@ class FxCore {
1428
1407
  actionId = `action_${suffix}`;
1429
1408
  }
1430
1409
  let destinationPluginManifestPath;
1431
- if (isKiotaIntegration) {
1432
- // 1. Copy openapi spec file
1433
- const openapiSpecFileName = path.basename(inputs[constants_3.QuestionNames.ApiSpecLocation]);
1434
- const openapiSpecPath = path.join(appPackageFolder, openapiSpecFileName);
1435
- await fs_extra_1.default.copyFile(inputs[constants_3.QuestionNames.ApiSpecLocation].trim(), openapiSpecPath);
1436
- // 2. Copy plugin manifest file
1437
- const pluginManifestPath = path.join(inputs.projectPath, teamsfx_api_1.AppPackageFolderName, path.basename(inputs[constants_3.QuestionNames.ActionManifestPath]));
1438
- destinationPluginManifestPath = pluginManifestPath;
1439
- await fs_extra_1.default.copyFile(inputs[constants_3.QuestionNames.ActionManifestPath], pluginManifestPath);
1440
- // 2.1 Need to update the plugin manifest file
1441
- const authData = await (0, daSpecParser_1.parseAndUpdatePluginManifestForKiota)(pluginManifestPath, true);
1442
- // 3. Update teamsapp.local.yaml and teamsapp.yaml if need to add auth action
1443
- for (const authInfo of authData) {
1444
- await (0, helper_2.injectAuthAction)(inputs.projectPath, authInfo.authName, undefined, openapiSpecPath, false, authInfo.authType === "apiKey" ? "ApiKeyPluginVault" : "OAuthPluginVault", false, authInfo.registrationId);
1445
- }
1446
- // 4. Add action in plugin manifest
1410
+ // generate files
1411
+ if (isGenerateFromApiSpec && specParser) {
1412
+ destinationPluginManifestPath =
1413
+ await CopilotGptManifestUtils_1.copilotGptManifestUtils.getDefaultNextAvailablePluginManifestPath(appPackageFolder, undefined);
1414
+ const destinationApiSpecPath = await PluginManifestUtils_1.pluginManifestUtils.getDefaultNextAvailableApiSpecPath(inputs[constants_3.QuestionNames.ApiSpecLocation].trim(), path.join(appPackageFolder, teamsfx_api_1.DefaultApiSpecFolderName));
1415
+ const generateRes = await (0, helper_2.generateFromApiSpec)(specParser, teamsManifestPath, inputs, context, teamsfx_api_1.Stage.addPlugin, m365_spec_parser_1.ProjectType.Copilot, {
1416
+ destinationApiSpecFilePath: destinationApiSpecPath,
1417
+ pluginManifestFilePath: destinationPluginManifestPath,
1418
+ }, inputs[constants_3.QuestionNames.ApiSpecLocation].trim());
1419
+ if (generateRes.isErr()) {
1420
+ return (0, teamsfx_api_1.err)(generateRes.error);
1421
+ }
1422
+ const warnings = generateRes.value.warnings;
1423
+ if (warnings && warnings.length > 0) {
1424
+ const warnSummary = await (0, helper_2.generateScaffoldingSummary)(warnings, manifestRes.value, path.relative(inputs.projectPath, destinationApiSpecPath), path.relative(inputs.projectPath, destinationPluginManifestPath), inputs.projectPath);
1425
+ context.logProvider.info(warnSummary + "\n");
1426
+ }
1447
1427
  const addActionRes = await CopilotGptManifestUtils_1.copilotGptManifestUtils.addAction(declarativeCopilotManifestPath, actionId, (0, utils_3.normalizePath)(path.relative(appPackageFolder, destinationPluginManifestPath), true));
1448
1428
  if (addActionRes.isErr()) {
1449
1429
  return (0, teamsfx_api_1.err)(addActionRes.error);
1450
1430
  }
1451
- // 5. Update plugin manifest to add ac info (optional)
1452
- await (0, helper_2.generateAdaptiveCardInPluginManifestForKiota)(pluginManifestPath, openapiSpecPath, context);
1431
+ for (const authNameAndScheme of authNameAndSchemes) {
1432
+ await this.updateAuthActionInYaml(authNameAndScheme.authName, authNameAndScheme.authScheme, inputs.projectPath, destinationApiSpecPath, destinationPluginManifestPath);
1433
+ }
1453
1434
  }
1454
1435
  else {
1455
- // generate files
1456
- if (isGenerateFromApiSpec && specParser) {
1457
- destinationPluginManifestPath =
1458
- await CopilotGptManifestUtils_1.copilotGptManifestUtils.getDefaultNextAvailablePluginManifestPath(appPackageFolder, undefined);
1459
- const destinationApiSpecPath = await PluginManifestUtils_1.pluginManifestUtils.getDefaultNextAvailableApiSpecPath(inputs[constants_3.QuestionNames.ApiSpecLocation].trim(), path.join(appPackageFolder, teamsfx_api_1.DefaultApiSpecFolderName));
1460
- const generateRes = await (0, helper_2.generateFromApiSpec)(specParser, teamsManifestPath, inputs, context, teamsfx_api_1.Stage.addPlugin, m365_spec_parser_1.ProjectType.Copilot, {
1461
- destinationApiSpecFilePath: destinationApiSpecPath,
1462
- pluginManifestFilePath: destinationPluginManifestPath,
1463
- }, inputs[constants_3.QuestionNames.ApiSpecLocation].trim());
1464
- if (generateRes.isErr()) {
1465
- return (0, teamsfx_api_1.err)(generateRes.error);
1466
- }
1467
- const warnings = generateRes.value.warnings;
1468
- if (warnings && warnings.length > 0) {
1469
- const warnSummary = await (0, helper_2.generateScaffoldingSummary)(warnings, manifestRes.value, path.relative(inputs.projectPath, destinationApiSpecPath), path.relative(inputs.projectPath, destinationPluginManifestPath), inputs.projectPath);
1470
- context.logProvider.info(warnSummary + "\n");
1471
- }
1472
- const addActionRes = await CopilotGptManifestUtils_1.copilotGptManifestUtils.addAction(declarativeCopilotManifestPath, actionId, (0, utils_3.normalizePath)(path.relative(appPackageFolder, destinationPluginManifestPath), true));
1473
- if (addActionRes.isErr()) {
1474
- return (0, teamsfx_api_1.err)(addActionRes.error);
1475
- }
1476
- for (const authNameAndScheme of authNameAndSchemes) {
1477
- await this.updateAuthActionInYaml(authNameAndScheme.authName, authNameAndScheme.authScheme, inputs.projectPath, destinationApiSpecPath, destinationPluginManifestPath);
1478
- }
1479
- }
1480
- else {
1481
- const addPluginRes = await (0, helper_1.addExistingPlugin)(declarativeCopilotManifestPath, inputs[constants_3.QuestionNames.PluginManifestFilePath].trim(), inputs[constants_3.QuestionNames.PluginOpenApiSpecFilePath].trim(), actionId, context, teamsfx_api_1.Stage.addPlugin);
1482
- if (addPluginRes.isErr()) {
1483
- return (0, teamsfx_api_1.err)(addPluginRes.error);
1484
- }
1485
- destinationPluginManifestPath = addPluginRes.value.destinationPluginManifestPath;
1486
- const warningMessage = (0, common_1.outputScaffoldingWarningMessage)(addPluginRes.value.warnings);
1487
- context.logProvider.info(warningMessage);
1436
+ const addPluginRes = await (0, helper_1.addExistingPlugin)(declarativeCopilotManifestPath, inputs[constants_3.QuestionNames.PluginManifestFilePath].trim(), inputs[constants_3.QuestionNames.PluginOpenApiSpecFilePath].trim(), actionId, context, teamsfx_api_1.Stage.addPlugin);
1437
+ if (addPluginRes.isErr()) {
1438
+ return (0, teamsfx_api_1.err)(addPluginRes.error);
1488
1439
  }
1440
+ destinationPluginManifestPath = addPluginRes.value.destinationPluginManifestPath;
1441
+ const warningMessage = (0, common_1.outputScaffoldingWarningMessage)(addPluginRes.value.warnings);
1442
+ context.logProvider.info(warningMessage);
1489
1443
  }
1490
1444
  if (inputs.platform === teamsfx_api_1.Platform.VSCode) {
1491
1445
  const successMessage = (0, localizeUtils_1.getLocalizedString)("core.addPlugin.success.vsc", actionId);