@microsoft/teamsfx-core 2.0.10-alpha.fa1ce1fbb.0 → 2.0.10-alpha.ff616a623.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/client/teamsDevPortalClient.d.ts +4 -5
- package/build/client/teamsDevPortalClient.d.ts.map +1 -1
- package/build/client/teamsDevPortalClient.js +67 -47
- package/build/client/teamsDevPortalClient.js.map +1 -1
- package/build/common/azureUtils.js +4 -4
- package/build/common/azureUtils.js.map +1 -1
- package/build/common/constants.d.ts +1 -19
- package/build/common/constants.d.ts.map +1 -1
- package/build/common/constants.js +10 -29
- package/build/common/constants.js.map +1 -1
- package/build/common/correlator.d.ts +1 -0
- package/build/common/correlator.d.ts.map +1 -1
- package/build/common/correlator.js +6 -1
- package/build/common/correlator.js.map +1 -1
- package/build/common/featureFlags.d.ts +49 -19
- package/build/common/featureFlags.d.ts.map +1 -1
- package/build/common/featureFlags.js +82 -62
- package/build/common/featureFlags.js.map +1 -1
- package/build/common/globalState.js +3 -3
- package/build/common/globalState.js.map +1 -1
- package/build/common/globalVars.d.ts +1 -0
- package/build/common/globalVars.d.ts.map +1 -1
- package/build/common/globalVars.js +2 -1
- package/build/common/globalVars.js.map +1 -1
- package/build/common/jsonUtils.js +10 -10
- package/build/common/jsonUtils.js.map +1 -1
- package/build/common/localizeUtils.js +2 -2
- package/build/common/localizeUtils.js.map +1 -1
- package/build/common/projectSettingsHelper.js +1 -1
- package/build/common/projectSettingsHelper.js.map +1 -1
- package/build/common/projectTypeChecker.js +3 -3
- package/build/common/projectTypeChecker.js.map +1 -1
- package/build/common/samples.js +5 -5
- package/build/common/samples.js.map +1 -1
- package/build/common/secretmasker/dict.d.ts +22 -0
- package/build/common/secretmasker/dict.d.ts.map +1 -0
- package/build/common/secretmasker/dict.js +83 -0
- package/build/common/secretmasker/dict.js.map +1 -0
- package/build/common/secretmasker/feature.d.ts +15 -0
- package/build/common/secretmasker/feature.d.ts.map +1 -0
- package/build/common/secretmasker/feature.js +148 -0
- package/build/common/secretmasker/feature.js.map +1 -0
- package/build/common/secretmasker/masker.d.ts +12 -0
- package/build/common/secretmasker/masker.d.ts.map +1 -0
- package/build/common/secretmasker/masker.js +54 -0
- package/build/common/secretmasker/masker.js.map +1 -0
- package/build/common/stringUtils.d.ts +3 -5
- package/build/common/stringUtils.d.ts.map +1 -1
- package/build/common/stringUtils.js +13 -105
- package/build/common/stringUtils.js.map +1 -1
- package/build/common/telemetry.d.ts +12 -2
- package/build/common/telemetry.d.ts.map +1 -1
- package/build/common/telemetry.js +20 -3
- package/build/common/telemetry.js.map +1 -1
- package/build/common/templates-config.json +1 -1
- package/build/common/tools.d.ts +1 -6
- package/build/common/tools.d.ts.map +1 -1
- package/build/common/tools.js +15 -28
- package/build/common/tools.js.map +1 -1
- package/build/common/utils.d.ts +4 -0
- package/build/common/utils.d.ts.map +1 -1
- package/build/common/utils.js +38 -1
- package/build/common/utils.js.map +1 -1
- package/build/common/wrappedAxiosClient.d.ts +1 -0
- package/build/common/wrappedAxiosClient.d.ts.map +1 -1
- package/build/common/wrappedAxiosClient.js +58 -29
- package/build/common/wrappedAxiosClient.js.map +1 -1
- package/build/component/configManager/actionInjector.js +2 -2
- package/build/component/configManager/actionInjector.js.map +1 -1
- package/build/component/configManager/lifecycle.js +9 -9
- package/build/component/configManager/lifecycle.js.map +1 -1
- package/build/component/configManager/parser.js +20 -20
- package/build/component/configManager/parser.js.map +1 -1
- package/build/component/configManager/validator.js +1 -1
- package/build/component/configManager/validator.js.map +1 -1
- package/build/component/constant/commonConstant.d.ts +1 -0
- package/build/component/constant/commonConstant.d.ts.map +1 -1
- package/build/component/constant/commonConstant.js +1 -0
- package/build/component/constant/commonConstant.js.map +1 -1
- package/build/component/constants.js +5 -5
- package/build/component/constants.js.map +1 -1
- package/build/component/coordinator/index.d.ts.map +1 -1
- package/build/component/coordinator/index.js +87 -212
- package/build/component/coordinator/index.js.map +1 -1
- package/build/component/coordinator/summary.js +10 -10
- package/build/component/coordinator/summary.js.map +1 -1
- package/build/component/deployUtils.js +4 -4
- package/build/component/deployUtils.js.map +1 -1
- package/build/component/deps-checker/constant/helpLink.d.ts +0 -3
- package/build/component/deps-checker/constant/helpLink.d.ts.map +1 -1
- package/build/component/deps-checker/constant/helpLink.js +1 -6
- package/build/component/deps-checker/constant/helpLink.js.map +1 -1
- package/build/component/deps-checker/constant/message.js +24 -24
- package/build/component/deps-checker/constant/message.js.map +1 -1
- package/build/component/deps-checker/internal/dotnetChecker.js +13 -13
- package/build/component/deps-checker/internal/dotnetChecker.js.map +1 -1
- package/build/component/deps-checker/internal/funcToolChecker.js +13 -13
- package/build/component/deps-checker/internal/funcToolChecker.js.map +1 -1
- package/build/component/deps-checker/internal/testToolChecker.js +21 -21
- package/build/component/deps-checker/internal/testToolChecker.js.map +1 -1
- package/build/component/deps-checker/internal/vxTestAppChecker.d.ts.map +1 -1
- package/build/component/deps-checker/internal/vxTestAppChecker.js +14 -8
- package/build/component/deps-checker/internal/vxTestAppChecker.js.map +1 -1
- package/build/component/developerPortalScaffoldUtils.js +15 -15
- package/build/component/developerPortalScaffoldUtils.js.map +1 -1
- package/build/component/driver/aad/create.d.ts.map +1 -1
- package/build/component/driver/aad/create.js +38 -23
- package/build/component/driver/aad/create.js.map +1 -1
- package/build/component/driver/aad/error/aadAppNameTooLongError.js +2 -2
- package/build/component/driver/aad/error/aadAppNameTooLongError.js.map +1 -1
- package/build/component/driver/aad/error/aadManifestError.js +27 -27
- package/build/component/driver/aad/error/aadManifestError.js.map +1 -1
- package/build/component/driver/aad/error/clientSecretNotAllowedError.js +2 -2
- package/build/component/driver/aad/error/clientSecretNotAllowedError.js.map +1 -1
- package/build/component/driver/aad/error/credentialInvalidLifetimeError.js +2 -2
- package/build/component/driver/aad/error/credentialInvalidLifetimeError.js.map +1 -1
- package/build/component/driver/aad/error/invalidFieldInManifestError.js +2 -2
- package/build/component/driver/aad/error/invalidFieldInManifestError.js.map +1 -1
- package/build/component/driver/aad/error/missingEnvError.js +2 -2
- package/build/component/driver/aad/error/missingEnvError.js.map +1 -1
- package/build/component/driver/aad/error/missingServiceManagamentReferenceError.d.ts +5 -0
- package/build/component/driver/aad/error/missingServiceManagamentReferenceError.d.ts.map +1 -0
- package/build/component/driver/aad/error/missingServiceManagamentReferenceError.js +23 -0
- package/build/component/driver/aad/error/missingServiceManagamentReferenceError.js.map +1 -0
- package/build/component/driver/aad/update.js +16 -16
- package/build/component/driver/aad/update.js.map +1 -1
- package/build/component/driver/aad/utility/aadAppClient.js +9 -9
- package/build/component/driver/aad/utility/aadAppClient.js.map +1 -1
- package/build/component/driver/aad/utility/aadManifestHelper.js +3 -3
- package/build/component/driver/aad/utility/aadManifestHelper.js.map +1 -1
- package/build/component/driver/aad/utility/buildAadManifest.js +5 -5
- package/build/component/driver/aad/utility/buildAadManifest.js.map +1 -1
- package/build/component/driver/aad/utility/constants.d.ts +2 -0
- package/build/component/driver/aad/utility/constants.d.ts.map +1 -1
- package/build/component/driver/aad/utility/constants.js +2 -0
- package/build/component/driver/aad/utility/constants.js.map +1 -1
- package/build/component/driver/add/addWebPart.js +6 -6
- package/build/component/driver/add/addWebPart.js.map +1 -1
- package/build/component/driver/add/error/noConfigurationError.js +2 -2
- package/build/component/driver/add/error/noConfigurationError.js.map +1 -1
- package/build/component/driver/apiKey/create.d.ts.map +1 -1
- package/build/component/driver/apiKey/create.js +23 -20
- package/build/component/driver/apiKey/create.js.map +1 -1
- package/build/component/driver/apiKey/error/apiKeyClientSecretInvalid.js +2 -2
- package/build/component/driver/apiKey/error/apiKeyClientSecretInvalid.js.map +1 -1
- package/build/component/driver/apiKey/error/apiKeyDomainInvalid.js +2 -2
- package/build/component/driver/apiKey/error/apiKeyDomainInvalid.js.map +1 -1
- package/build/component/driver/apiKey/error/apiKeyFailedToGetDomain.js +2 -2
- package/build/component/driver/apiKey/error/apiKeyFailedToGetDomain.js.map +1 -1
- package/build/component/driver/apiKey/error/apiKeyFromScratchClientSecretInvalid.d.ts +5 -0
- package/build/component/driver/apiKey/error/apiKeyFromScratchClientSecretInvalid.d.ts.map +1 -0
- package/build/component/driver/apiKey/error/apiKeyFromScratchClientSecretInvalid.js +21 -0
- package/build/component/driver/apiKey/error/apiKeyFromScratchClientSecretInvalid.js.map +1 -0
- package/build/component/driver/apiKey/error/apiKeyNameTooLong.js +2 -2
- package/build/component/driver/apiKey/error/apiKeyNameTooLong.js.map +1 -1
- package/build/component/driver/apiKey/update.d.ts.map +1 -1
- package/build/component/driver/apiKey/update.js +20 -20
- package/build/component/driver/apiKey/update.js.map +1 -1
- package/build/component/driver/apiKey/utility/constants.d.ts +1 -1
- package/build/component/driver/apiKey/utility/constants.js +1 -1
- package/build/component/driver/apiKey/utility/utility.js +1 -1
- package/build/component/driver/apiKey/utility/utility.js.map +1 -1
- package/build/component/driver/arm/deploy.js +4 -4
- package/build/component/driver/arm/deploy.js.map +1 -1
- package/build/component/driver/arm/deployImpl.d.ts.map +1 -1
- package/build/component/driver/arm/deployImpl.js +19 -17
- package/build/component/driver/arm/deployImpl.js.map +1 -1
- package/build/component/driver/arm/util/bicepChecker.js +5 -5
- package/build/component/driver/arm/util/bicepChecker.js.map +1 -1
- package/build/component/driver/arm/util/handleError.js +9 -9
- package/build/component/driver/arm/util/handleError.js.map +1 -1
- package/build/component/driver/arm/validator.js +3 -3
- package/build/component/driver/arm/validator.js.map +1 -1
- package/build/component/driver/botAadApp/create.d.ts.map +1 -1
- package/build/component/driver/botAadApp/create.js +38 -22
- package/build/component/driver/botAadApp/create.js.map +1 -1
- package/build/component/driver/botAadApp/error/unexpectedEmptyBotPasswordError.js +2 -2
- package/build/component/driver/botAadApp/error/unexpectedEmptyBotPasswordError.js.map +1 -1
- package/build/component/driver/botAadApp/utility/constants.d.ts +1 -0
- package/build/component/driver/botAadApp/utility/constants.d.ts.map +1 -1
- package/build/component/driver/botAadApp/utility/constants.js +1 -0
- package/build/component/driver/botAadApp/utility/constants.js.map +1 -1
- package/build/component/driver/botFramework/createOrUpdateBot.js +14 -14
- package/build/component/driver/botFramework/createOrUpdateBot.js.map +1 -1
- package/build/component/driver/botFramework/error/invalidBotIdError.js +2 -2
- package/build/component/driver/botFramework/error/invalidBotIdError.js.map +1 -1
- package/build/component/driver/deploy/azure/azureAppServiceDeployDriver.js +3 -3
- package/build/component/driver/deploy/azure/azureAppServiceDeployDriver.js.map +1 -1
- package/build/component/driver/deploy/azure/azureFunctionDeployDriver.js +3 -3
- package/build/component/driver/deploy/azure/azureFunctionDeployDriver.js.map +1 -1
- package/build/component/driver/deploy/azure/azureStaticWebAppGetDeploymentTokenDriver.d.ts.map +1 -1
- package/build/component/driver/deploy/azure/azureStaticWebAppGetDeploymentTokenDriver.js +16 -10
- package/build/component/driver/deploy/azure/azureStaticWebAppGetDeploymentTokenDriver.js.map +1 -1
- package/build/component/driver/deploy/azure/azureStorageDeployDriver.js +8 -8
- package/build/component/driver/deploy/azure/azureStorageDeployDriver.js.map +1 -1
- package/build/component/driver/deploy/azure/azureStorageStaticWebsiteConfigDriver.js +14 -14
- package/build/component/driver/deploy/azure/azureStorageStaticWebsiteConfigDriver.js.map +1 -1
- package/build/component/driver/deploy/azure/impl/AzureZipDeployImpl.js +6 -6
- package/build/component/driver/deploy/azure/impl/AzureZipDeployImpl.js.map +1 -1
- package/build/component/driver/deploy/azure/impl/azureDeployImpl.js +8 -8
- package/build/component/driver/deploy/azure/impl/azureDeployImpl.js.map +1 -1
- package/build/component/driver/deploy/azure/impl/baseDeployImpl.js +11 -11
- package/build/component/driver/deploy/azure/impl/baseDeployImpl.js.map +1 -1
- package/build/component/driver/deploy/spfx/deployDriver.js +15 -15
- package/build/component/driver/deploy/spfx/deployDriver.js.map +1 -1
- package/build/component/driver/deploy/spfx/error/createAppCatalogFailedError.js +2 -2
- package/build/component/driver/deploy/spfx/error/createAppCatalogFailedError.js.map +1 -1
- package/build/component/driver/deploy/spfx/error/getGraphTokenFailedError.js +2 -2
- package/build/component/driver/deploy/spfx/error/getGraphTokenFailedError.js.map +1 -1
- package/build/component/driver/deploy/spfx/error/getSPOTokenFailedError.js +2 -2
- package/build/component/driver/deploy/spfx/error/getSPOTokenFailedError.js.map +1 -1
- package/build/component/driver/deploy/spfx/error/getTenantFailedError.js +2 -2
- package/build/component/driver/deploy/spfx/error/getTenantFailedError.js.map +1 -1
- package/build/component/driver/deploy/spfx/error/insufficientPermissionError.js +2 -2
- package/build/component/driver/deploy/spfx/error/insufficientPermissionError.js.map +1 -1
- package/build/component/driver/deploy/spfx/error/noSPPackageError.js +2 -2
- package/build/component/driver/deploy/spfx/error/noSPPackageError.js.map +1 -1
- package/build/component/driver/deploy/spfx/error/noValidAppCatelogError.js +2 -2
- package/build/component/driver/deploy/spfx/error/noValidAppCatelogError.js.map +1 -1
- package/build/component/driver/deploy/spfx/error/uploadAppPackageFailedError.js +2 -2
- package/build/component/driver/deploy/spfx/error/uploadAppPackageFailedError.js.map +1 -1
- package/build/component/driver/deploy/spfx/utility/constants.js +5 -5
- package/build/component/driver/deploy/spfx/utility/constants.js.map +1 -1
- package/build/component/driver/devTool/constant.d.ts +8 -8
- package/build/component/driver/devTool/constant.d.ts.map +1 -1
- package/build/component/driver/devTool/constant.js +10 -10
- package/build/component/driver/devTool/constant.js.map +1 -1
- package/build/component/driver/devTool/error/dotnetInstallationUserError.js +3 -3
- package/build/component/driver/devTool/error/dotnetInstallationUserError.js.map +1 -1
- package/build/component/driver/devTool/error/funcInstallationUserError.js +3 -3
- package/build/component/driver/devTool/error/funcInstallationUserError.js.map +1 -1
- package/build/component/driver/devTool/error/testToolInstallationUserError.js +3 -3
- package/build/component/driver/devTool/error/testToolInstallationUserError.js.map +1 -1
- package/build/component/driver/devTool/installDriver.js +6 -6
- package/build/component/driver/devTool/installDriver.js.map +1 -1
- package/build/component/driver/error/outputEnvironmentVariableUndefinedError.js +2 -2
- package/build/component/driver/error/outputEnvironmentVariableUndefinedError.js.map +1 -1
- package/build/component/driver/file/createOrUpdateEnvironmentFile.js +11 -11
- package/build/component/driver/file/createOrUpdateEnvironmentFile.js.map +1 -1
- package/build/component/driver/file/createOrUpdateJsonFile.js +12 -12
- package/build/component/driver/file/createOrUpdateJsonFile.js.map +1 -1
- package/build/component/driver/index.d.ts +1 -0
- package/build/component/driver/index.d.ts.map +1 -1
- package/build/component/driver/index.js +1 -0
- package/build/component/driver/index.js.map +1 -1
- package/build/component/driver/m365/acquire.js +12 -12
- package/build/component/driver/m365/acquire.js.map +1 -1
- package/build/component/driver/middleware/addSWADeployTelemetry.js +2 -2
- package/build/component/driver/middleware/addSWADeployTelemetry.js.map +1 -1
- package/build/component/driver/oauth/create.d.ts.map +1 -1
- package/build/component/driver/oauth/create.js +51 -21
- package/build/component/driver/oauth/create.js.map +1 -1
- package/build/component/driver/oauth/error/oauthAuthInfoInvalid.js +2 -2
- package/build/component/driver/oauth/error/oauthAuthInfoInvalid.js.map +1 -1
- package/build/component/driver/oauth/error/oauthDisablePKCEError.d.ts +5 -0
- package/build/component/driver/oauth/error/oauthDisablePKCEError.d.ts.map +1 -0
- package/build/component/driver/oauth/error/oauthDisablePKCEError.js +21 -0
- package/build/component/driver/oauth/error/oauthDisablePKCEError.js.map +1 -0
- package/build/component/driver/oauth/error/oauthDomainInvalid.js +2 -2
- package/build/component/driver/oauth/error/oauthDomainInvalid.js.map +1 -1
- package/build/component/driver/oauth/error/oauthFailedToGetDomain.js +2 -2
- package/build/component/driver/oauth/error/oauthFailedToGetDomain.js.map +1 -1
- package/build/component/driver/oauth/error/oauthIdentityProviderInvalid.d.ts +5 -0
- package/build/component/driver/oauth/error/oauthIdentityProviderInvalid.d.ts.map +1 -0
- package/build/component/driver/oauth/error/oauthIdentityProviderInvalid.js +21 -0
- package/build/component/driver/oauth/error/oauthIdentityProviderInvalid.js.map +1 -0
- package/build/component/driver/oauth/error/oauthNameTooLong.js +2 -2
- package/build/component/driver/oauth/error/oauthNameTooLong.js.map +1 -1
- package/build/component/driver/oauth/interface/createOauthArgs.d.ts +2 -0
- package/build/component/driver/oauth/interface/createOauthArgs.d.ts.map +1 -1
- package/build/component/driver/oauth/interface/updateOauthArgs.d.ts +1 -0
- package/build/component/driver/oauth/interface/updateOauthArgs.d.ts.map +1 -1
- package/build/component/driver/oauth/update.d.ts.map +1 -1
- package/build/component/driver/oauth/update.js +30 -19
- package/build/component/driver/oauth/update.js.map +1 -1
- package/build/component/driver/oauth/utility/constants.d.ts +1 -1
- package/build/component/driver/oauth/utility/constants.js +1 -1
- package/build/component/driver/oauth/utility/utility.js +4 -5
- package/build/component/driver/oauth/utility/utility.js.map +1 -1
- package/build/component/driver/script/baseBuildDriver.js +8 -8
- package/build/component/driver/script/baseBuildDriver.js.map +1 -1
- package/build/component/driver/script/dotnetBuildDriver.js +3 -3
- package/build/component/driver/script/dotnetBuildDriver.js.map +1 -1
- package/build/component/driver/script/npmBuildDriver.js +3 -3
- package/build/component/driver/script/npmBuildDriver.js.map +1 -1
- package/build/component/driver/script/npxBuildDriver.js +5 -5
- package/build/component/driver/script/npxBuildDriver.js.map +1 -1
- package/build/component/driver/script/scriptDriver.d.ts +2 -0
- package/build/component/driver/script/scriptDriver.d.ts.map +1 -1
- package/build/component/driver/script/scriptDriver.js +28 -29
- package/build/component/driver/script/scriptDriver.js.map +1 -1
- package/build/component/driver/teamsApp/appStudio.d.ts.map +1 -1
- package/build/component/driver/teamsApp/appStudio.js +43 -54
- package/build/component/driver/teamsApp/appStudio.js.map +1 -1
- package/build/component/driver/teamsApp/clients/appStudioClient.js +20 -20
- package/build/component/driver/teamsApp/clients/appStudioClient.js.map +1 -1
- package/build/component/driver/teamsApp/configure.d.ts.map +1 -1
- package/build/component/driver/teamsApp/configure.js +23 -23
- package/build/component/driver/teamsApp/configure.js.map +1 -1
- package/build/component/driver/teamsApp/constants.d.ts +15 -1
- package/build/component/driver/teamsApp/constants.d.ts.map +1 -1
- package/build/component/driver/teamsApp/constants.js +132 -2
- package/build/component/driver/teamsApp/constants.js.map +1 -1
- package/build/component/driver/teamsApp/copyAppPackageToSPFx.js +8 -8
- package/build/component/driver/teamsApp/copyAppPackageToSPFx.js.map +1 -1
- package/build/component/driver/teamsApp/create.d.ts.map +1 -1
- package/build/component/driver/teamsApp/create.js +21 -21
- package/build/component/driver/teamsApp/create.js.map +1 -1
- package/build/component/driver/teamsApp/createAppPackage.d.ts.map +1 -1
- package/build/component/driver/teamsApp/createAppPackage.js +49 -49
- package/build/component/driver/teamsApp/createAppPackage.js.map +1 -1
- package/build/component/driver/teamsApp/errors.d.ts +6 -2
- package/build/component/driver/teamsApp/errors.d.ts.map +1 -1
- package/build/component/driver/teamsApp/errors.js +49 -42
- package/build/component/driver/teamsApp/errors.js.map +1 -1
- package/build/component/driver/teamsApp/interfaces/OauthRegistration.d.ts +2 -0
- package/build/component/driver/teamsApp/interfaces/OauthRegistration.d.ts.map +1 -1
- package/build/component/driver/teamsApp/interfaces/OauthRegistration.js.map +1 -1
- package/build/component/driver/teamsApp/interfaces/SyncManifest.d.ts +15 -0
- package/build/component/driver/teamsApp/interfaces/SyncManifest.d.ts.map +1 -0
- package/build/component/driver/teamsApp/interfaces/SyncManifest.js +5 -0
- package/build/component/driver/teamsApp/interfaces/SyncManifest.js.map +1 -0
- package/build/component/driver/teamsApp/interfaces/appdefinitions/IValidationResult.d.ts +1 -0
- package/build/component/driver/teamsApp/interfaces/appdefinitions/IValidationResult.d.ts.map +1 -1
- package/build/component/driver/teamsApp/publishAppPackage.d.ts.map +1 -1
- package/build/component/driver/teamsApp/publishAppPackage.js +35 -35
- package/build/component/driver/teamsApp/publishAppPackage.js.map +1 -1
- package/build/component/driver/teamsApp/syncManifest.d.ts +14 -0
- package/build/component/driver/teamsApp/syncManifest.d.ts.map +1 -0
- package/build/component/driver/teamsApp/syncManifest.js +226 -0
- package/build/component/driver/teamsApp/syncManifest.js.map +1 -0
- package/build/component/driver/teamsApp/teamsappMgr.js +38 -38
- package/build/component/driver/teamsApp/teamsappMgr.js.map +1 -1
- package/build/component/driver/teamsApp/utils/CopilotGptManifestUtils.d.ts +5 -3
- package/build/component/driver/teamsApp/utils/CopilotGptManifestUtils.d.ts.map +1 -1
- package/build/component/driver/teamsApp/utils/CopilotGptManifestUtils.js +45 -21
- package/build/component/driver/teamsApp/utils/CopilotGptManifestUtils.js.map +1 -1
- package/build/component/driver/teamsApp/utils/ManifestUtils.d.ts +3 -2
- package/build/component/driver/teamsApp/utils/ManifestUtils.d.ts.map +1 -1
- package/build/component/driver/teamsApp/utils/ManifestUtils.js +63 -39
- package/build/component/driver/teamsApp/utils/ManifestUtils.js.map +1 -1
- package/build/component/driver/teamsApp/utils/PluginManifestUtils.d.ts +4 -3
- package/build/component/driver/teamsApp/utils/PluginManifestUtils.d.ts.map +1 -1
- package/build/component/driver/teamsApp/utils/PluginManifestUtils.js +36 -18
- package/build/component/driver/teamsApp/utils/PluginManifestUtils.js.map +1 -1
- package/build/component/driver/teamsApp/utils/utils.d.ts +4 -4
- package/build/component/driver/teamsApp/utils/utils.d.ts.map +1 -1
- package/build/component/driver/teamsApp/utils/utils.js +45 -15
- package/build/component/driver/teamsApp/utils/utils.js.map +1 -1
- package/build/component/driver/teamsApp/validate.js +27 -27
- package/build/component/driver/teamsApp/validate.js.map +1 -1
- package/build/component/driver/teamsApp/validateAppPackage.d.ts +1 -0
- package/build/component/driver/teamsApp/validateAppPackage.d.ts.map +1 -1
- package/build/component/driver/teamsApp/validateAppPackage.js +52 -38
- package/build/component/driver/teamsApp/validateAppPackage.js.map +1 -1
- package/build/component/driver/teamsApp/validateTestCases.d.ts.map +1 -1
- package/build/component/driver/teamsApp/validateTestCases.js +36 -36
- package/build/component/driver/teamsApp/validateTestCases.js.map +1 -1
- package/build/component/driver/util/wrapUtil.js +6 -6
- package/build/component/driver/util/wrapUtil.js.map +1 -1
- package/build/component/error/componentError.js +8 -8
- package/build/component/error/componentError.js.map +1 -1
- package/build/component/feature/collaboration.d.ts.map +1 -1
- package/build/component/feature/collaboration.js +56 -56
- package/build/component/feature/collaboration.js.map +1 -1
- package/build/component/feature/createAuthFiles.js +8 -8
- package/build/component/feature/createAuthFiles.js.map +1 -1
- package/build/component/feature/sso.js +4 -4
- package/build/component/feature/sso.js.map +1 -1
- package/build/component/generator/apiSpec/generator.d.ts +15 -0
- package/build/component/generator/apiSpec/generator.d.ts.map +1 -0
- package/build/component/generator/apiSpec/generator.js +260 -0
- package/build/component/generator/apiSpec/generator.js.map +1 -0
- package/build/component/generator/{copilotPlugin → apiSpec}/helper.d.ts +23 -9
- package/build/component/generator/apiSpec/helper.d.ts.map +1 -0
- package/build/component/generator/{copilotPlugin → apiSpec}/helper.js +306 -127
- package/build/component/generator/apiSpec/helper.js.map +1 -0
- package/build/component/generator/constant.d.ts +1 -0
- package/build/component/generator/constant.d.ts.map +1 -1
- package/build/component/generator/constant.js +2 -1
- package/build/component/generator/constant.js.map +1 -1
- package/build/component/generator/{officeXMLAddin → copilotExtension}/generator.d.ts +8 -10
- package/build/component/generator/copilotExtension/generator.d.ts.map +1 -0
- package/build/component/generator/copilotExtension/generator.js +107 -0
- package/build/component/generator/copilotExtension/generator.js.map +1 -0
- package/build/component/generator/copilotExtension/helper.d.ts +4 -0
- package/build/component/generator/copilotExtension/helper.d.ts.map +1 -0
- package/build/component/generator/copilotExtension/helper.js +84 -0
- package/build/component/generator/copilotExtension/helper.js.map +1 -0
- package/build/component/generator/error.d.ts +1 -1
- package/build/component/generator/error.d.ts.map +1 -1
- package/build/component/generator/error.js +5 -5
- package/build/component/generator/error.js.map +1 -1
- package/build/component/generator/generator.d.ts.map +1 -1
- package/build/component/generator/generator.js +25 -19
- package/build/component/generator/generator.js.map +1 -1
- package/build/component/generator/generatorAction.js +7 -7
- package/build/component/generator/generatorAction.js.map +1 -1
- package/build/component/generator/generatorProvider.js +6 -6
- package/build/component/generator/generatorProvider.js.map +1 -1
- package/build/component/generator/officeAddin/generator.d.ts +1 -2
- package/build/component/generator/officeAddin/generator.d.ts.map +1 -1
- package/build/component/generator/officeAddin/generator.js +39 -41
- package/build/component/generator/officeAddin/generator.js.map +1 -1
- package/build/component/generator/officeAddin/helperMethods.js +5 -5
- package/build/component/generator/officeAddin/helperMethods.js.map +1 -1
- package/build/component/generator/officeXMLAddin/projectConfig.d.ts.map +1 -1
- package/build/component/generator/officeXMLAddin/projectConfig.js +0 -75
- package/build/component/generator/officeXMLAddin/projectConfig.js.map +1 -1
- package/build/component/generator/spfx/depsChecker/generatorChecker.js +4 -4
- package/build/component/generator/spfx/depsChecker/generatorChecker.js.map +1 -1
- package/build/component/generator/spfx/depsChecker/yoChecker.js +4 -4
- package/build/component/generator/spfx/depsChecker/yoChecker.js.map +1 -1
- package/build/component/generator/spfx/error.js +19 -19
- package/build/component/generator/spfx/error.js.map +1 -1
- package/build/component/generator/spfx/spfxGenerator.d.ts.map +1 -1
- package/build/component/generator/spfx/spfxGenerator.js +76 -76
- package/build/component/generator/spfx/spfxGenerator.js.map +1 -1
- package/build/component/generator/spfx/utils/constants.js +8 -8
- package/build/component/generator/spfx/utils/constants.js.map +1 -1
- package/build/component/generator/spfx/utils/telemetry-helper.js +1 -1
- package/build/component/generator/spfx/utils/telemetry-helper.js.map +1 -1
- package/build/component/generator/spfx/utils/utils.d.ts +1 -0
- package/build/component/generator/spfx/utils/utils.d.ts.map +1 -1
- package/build/component/generator/spfx/utils/utils.js +13 -9
- package/build/component/generator/spfx/utils/utils.js.map +1 -1
- package/build/component/generator/templates/ssrTabGenerator.js +1 -1
- package/build/component/generator/templates/ssrTabGenerator.js.map +1 -1
- package/build/component/generator/templates/templateGenerator.js +13 -13
- package/build/component/generator/templates/templateGenerator.js.map +1 -1
- package/build/component/generator/templates/templateNames.d.ts +1 -0
- package/build/component/generator/templates/templateNames.d.ts.map +1 -1
- package/build/component/generator/templates/templateNames.js +3 -9
- package/build/component/generator/templates/templateNames.js.map +1 -1
- package/build/component/generator/templates/templateReplaceMap.d.ts.map +1 -1
- package/build/component/generator/templates/templateReplaceMap.js +29 -9
- package/build/component/generator/templates/templateReplaceMap.js.map +1 -1
- package/build/component/generator/utils.js +6 -6
- package/build/component/generator/utils.js.map +1 -1
- package/build/component/local/constants.d.ts +108 -108
- package/build/component/local/localCertificateManager.d.ts.map +1 -1
- package/build/component/local/localCertificateManager.js +11 -9
- package/build/component/local/localCertificateManager.js.map +1 -1
- package/build/component/local/localEnvManager.js +2 -2
- package/build/component/local/localEnvManager.js.map +1 -1
- package/build/component/local/localTelemetryReporter.js +3 -3
- package/build/component/local/localTelemetryReporter.js.map +1 -1
- package/build/component/local/portChecker.js +4 -4
- package/build/component/local/portChecker.js.map +1 -1
- package/build/component/local/taskDefinition.js +3 -3
- package/build/component/local/taskDefinition.js.map +1 -1
- package/build/component/m365/constants.d.ts +3 -0
- package/build/component/m365/constants.d.ts.map +1 -1
- package/build/component/m365/constants.js +4 -1
- package/build/component/m365/constants.js.map +1 -1
- package/build/component/m365/errors.js +2 -2
- package/build/component/m365/errors.js.map +1 -1
- package/build/component/m365/launchHelper.d.ts +2 -2
- package/build/component/m365/launchHelper.d.ts.map +1 -1
- package/build/component/m365/launchHelper.js +25 -17
- package/build/component/m365/launchHelper.js.map +1 -1
- package/build/component/m365/packageService.js +19 -19
- package/build/component/m365/packageService.js.map +1 -1
- package/build/component/messages.js +7 -7
- package/build/component/messages.js.map +1 -1
- package/build/component/middleware/actionExecutionMW.js +8 -8
- package/build/component/middleware/actionExecutionMW.js.map +1 -1
- package/build/component/middleware/envMW.js +6 -6
- package/build/component/middleware/envMW.js.map +1 -1
- package/build/component/middleware/questionMW.js +3 -3
- package/build/component/middleware/questionMW.js.map +1 -1
- package/build/component/migrate.js +4 -4
- package/build/component/migrate.js.map +1 -1
- package/build/component/provisionUtils.js +24 -24
- package/build/component/provisionUtils.js.map +1 -1
- package/build/component/resource/botService/appStudio/appStudioClient.js +11 -11
- package/build/component/resource/botService/appStudio/appStudioClient.js.map +1 -1
- package/build/component/resource/botService/botRegistration/botFrameworkRegistration.d.ts.map +1 -1
- package/build/component/resource/botService/botRegistration/botFrameworkRegistration.js +7 -7
- package/build/component/resource/botService/botRegistration/botFrameworkRegistration.js.map +1 -1
- package/build/component/resource/botService/errors.js +2 -2
- package/build/component/resource/botService/errors.js.map +1 -1
- package/build/component/resource/botService/messages.js +6 -6
- package/build/component/resource/botService/messages.js.map +1 -1
- package/build/component/resource/botService/strings.js +1 -1
- package/build/component/resource/botService/strings.js.map +1 -1
- package/build/component/utils/ResourceGroupHelper.js +28 -28
- package/build/component/utils/ResourceGroupHelper.js.map +1 -1
- package/build/component/utils/azureResourceOperation.js +2 -2
- package/build/component/utils/azureResourceOperation.js.map +1 -1
- package/build/component/utils/common.d.ts +2 -2
- package/build/component/utils/common.d.ts.map +1 -1
- package/build/component/utils/common.js +5 -5
- package/build/component/utils/common.js.map +1 -1
- package/build/component/utils/depsChecker/common.js +2 -2
- package/build/component/utils/depsChecker/common.js.map +1 -1
- package/build/component/utils/envFunctionUtils.d.ts +12 -0
- package/build/component/utils/envFunctionUtils.d.ts.map +1 -0
- package/build/component/utils/envFunctionUtils.js +185 -0
- package/build/component/utils/envFunctionUtils.js.map +1 -0
- package/build/component/utils/envUtil.d.ts +1 -0
- package/build/component/utils/envUtil.d.ts.map +1 -1
- package/build/component/utils/envUtil.js +19 -19
- package/build/component/utils/envUtil.js.map +1 -1
- package/build/component/utils/fileOperation.js +3 -4
- package/build/component/utils/fileOperation.js.map +1 -1
- package/build/component/utils/metadataGraphPermssion.js +3 -3
- package/build/component/utils/metadataGraphPermssion.js.map +1 -1
- package/build/component/utils/metadataUtil.js +2 -2
- package/build/component/utils/metadataUtil.js.map +1 -1
- package/build/component/utils/pathUtils.js +5 -5
- package/build/component/utils/pathUtils.js.map +1 -1
- package/build/component/utils/settingsUtil.js +7 -7
- package/build/component/utils/settingsUtil.js.map +1 -1
- package/build/component/utils/teamsFxTelemetryReporter.js +1 -1
- package/build/component/utils/teamsFxTelemetryReporter.js.map +1 -1
- package/build/core/FxCore.d.ts +34 -0
- package/build/core/FxCore.d.ts.map +1 -1
- package/build/core/FxCore.js +671 -351
- package/build/core/FxCore.js.map +1 -1
- package/build/core/collaborator.js +65 -65
- package/build/core/collaborator.js.map +1 -1
- package/build/core/crypto.js +4 -4
- package/build/core/crypto.js.map +1 -1
- package/build/core/environment.js +7 -7
- package/build/core/environment.js.map +1 -1
- package/build/core/environmentName.d.ts +0 -1
- package/build/core/environmentName.d.ts.map +1 -1
- package/build/core/environmentName.js +0 -2
- package/build/core/environmentName.js.map +1 -1
- package/build/core/middleware/concurrentLocker.js +13 -13
- package/build/core/middleware/concurrentLocker.js.map +1 -1
- package/build/core/middleware/errorHandler.js +4 -4
- package/build/core/middleware/errorHandler.js.map +1 -1
- package/build/core/middleware/projectMigratorV3.js +78 -78
- package/build/core/middleware/projectMigratorV3.js.map +1 -1
- package/build/core/middleware/projectSettingsLoader.js +3 -3
- package/build/core/middleware/projectSettingsLoader.js.map +1 -1
- package/build/core/middleware/projectVersionChecker.js +9 -9
- package/build/core/middleware/projectVersionChecker.js.map +1 -1
- package/build/core/middleware/utils/MigrationUtils.js +4 -4
- package/build/core/middleware/utils/MigrationUtils.js.map +1 -1
- package/build/core/middleware/utils/appYmlGenerator.js +4 -4
- package/build/core/middleware/utils/appYmlGenerator.js.map +1 -1
- package/build/core/middleware/utils/debug/debugV3MigrationUtils.js +10 -10
- package/build/core/middleware/utils/debug/debugV3MigrationUtils.js.map +1 -1
- package/build/core/middleware/utils/debug/taskMigrator.js +72 -72
- package/build/core/middleware/utils/debug/taskMigrator.js.map +1 -1
- package/build/core/middleware/utils/migrationContext.js +1 -1
- package/build/core/middleware/utils/migrationContext.js.map +1 -1
- package/build/core/middleware/utils/v3MigrationUtils.js +9 -9
- package/build/core/middleware/utils/v3MigrationUtils.js.map +1 -1
- package/build/core/middleware/videoFilterAppBlocker.js +4 -4
- package/build/core/middleware/videoFilterAppBlocker.js.map +1 -1
- package/build/core/telemetry.js +1 -1
- package/build/core/telemetry.js.map +1 -1
- package/build/error/arm.js +10 -10
- package/build/error/arm.js.map +1 -1
- package/build/error/azure.js +20 -20
- package/build/error/azure.js.map +1 -1
- package/build/error/common.d.ts +4 -1
- package/build/error/common.d.ts.map +1 -1
- package/build/error/common.js +87 -75
- package/build/error/common.js.map +1 -1
- package/build/error/deploy.js +24 -24
- package/build/error/deploy.js.map +1 -1
- package/build/error/m365.js +6 -6
- package/build/error/m365.js.map +1 -1
- package/build/error/script.d.ts +2 -2
- package/build/error/script.d.ts.map +1 -1
- package/build/error/script.js +14 -8
- package/build/error/script.js.map +1 -1
- package/build/error/teamsApp.d.ts.map +1 -1
- package/build/error/teamsApp.js +10 -8
- package/build/error/teamsApp.js.map +1 -1
- package/build/error/upgrade.js +2 -2
- package/build/error/upgrade.js.map +1 -1
- package/build/error/yml.js +12 -12
- package/build/error/yml.js.map +1 -1
- package/build/index.d.ts +10 -7
- package/build/index.d.ts.map +1 -1
- package/build/index.js +17 -16
- package/build/index.js.map +1 -1
- package/build/question/constants.d.ts +38 -21
- package/build/question/constants.d.ts.map +1 -1
- package/build/question/constants.js +285 -270
- package/build/question/constants.js.map +1 -1
- package/build/question/create.d.ts +4 -3
- package/build/question/create.d.ts.map +1 -1
- package/build/question/create.js +315 -228
- package/build/question/create.js.map +1 -1
- package/build/question/generator.js +6 -2
- package/build/question/generator.js.map +1 -1
- package/build/question/index.d.ts +2 -0
- package/build/question/index.d.ts.map +1 -1
- package/build/question/index.js +21 -15
- package/build/question/index.js.map +1 -1
- package/build/question/inputs/AddPluginInputs.d.ts +1 -1
- package/build/question/inputs/AddPluginInputs.d.ts.map +1 -1
- package/build/question/inputs/CreateProjectInputs.d.ts +11 -5
- package/build/question/inputs/CreateProjectInputs.d.ts.map +1 -1
- package/build/question/inputs/SyncManifestInputs.d.ts +16 -0
- package/build/question/inputs/SyncManifestInputs.d.ts.map +1 -0
- package/build/question/inputs/SyncManifestInputs.js +5 -0
- package/build/question/inputs/SyncManifestInputs.js.map +1 -0
- package/build/question/inputs/UninstallInputs.d.ts +22 -0
- package/build/question/inputs/UninstallInputs.d.ts.map +1 -0
- package/build/question/inputs/UninstallInputs.js +5 -0
- package/build/question/inputs/UninstallInputs.js.map +1 -0
- package/build/question/inputs/index.d.ts +2 -0
- package/build/question/inputs/index.d.ts.map +1 -1
- package/build/question/inputs/index.js +2 -0
- package/build/question/inputs/index.js.map +1 -1
- package/build/question/options/AddPluginOptions.js +1 -1
- package/build/question/options/AddPluginOptions.js.map +1 -1
- package/build/question/options/CreateProjectOptions.d.ts.map +1 -1
- package/build/question/options/CreateProjectOptions.js +27 -24
- package/build/question/options/CreateProjectOptions.js.map +1 -1
- package/build/question/options/SyncManifestOptions.d.ts +10 -0
- package/build/question/options/SyncManifestOptions.d.ts.map +1 -0
- package/build/question/options/SyncManifestOptions.js +28 -0
- package/build/question/options/SyncManifestOptions.js.map +1 -0
- package/build/question/options/UninstallOptions.d.ts +10 -0
- package/build/question/options/UninstallOptions.d.ts.map +1 -0
- package/build/question/options/UninstallOptions.js +44 -0
- package/build/question/options/UninstallOptions.js.map +1 -0
- package/build/question/options/index.d.ts +2 -0
- package/build/question/options/index.d.ts.map +1 -1
- package/build/question/options/index.js +2 -0
- package/build/question/options/index.js.map +1 -1
- package/build/question/other.d.ts +2 -0
- package/build/question/other.d.ts.map +1 -1
- package/build/question/other.js +210 -48
- package/build/question/other.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -0
- package/build/ui/visitor.d.ts.map +1 -1
- package/build/ui/visitor.js +41 -27
- package/build/ui/visitor.js.map +1 -1
- package/package.json +15 -10
- package/resource/dict.zip +0 -0
- package/resource/package.nls.json +175 -127
- package/resource/yaml-schema/v1.6/yaml.schema.json +13 -0
- package/resource/yaml-schema/yaml.schema.json +13 -0
- package/templates/fallback/common.zip +0 -0
- package/templates/fallback/csharp.zip +0 -0
- package/templates/fallback/js.zip +0 -0
- package/templates/fallback/python.zip +0 -0
- package/templates/fallback/ts.zip +0 -0
- package/build/component/generator/copilotPlugin/generator.d.ts +0 -21
- package/build/component/generator/copilotPlugin/generator.d.ts.map +0 -1
- package/build/component/generator/copilotPlugin/generator.js +0 -399
- package/build/component/generator/copilotPlugin/generator.js.map +0 -1
- package/build/component/generator/copilotPlugin/helper.d.ts.map +0 -1
- package/build/component/generator/copilotPlugin/helper.js.map +0 -1
- package/build/component/generator/officeXMLAddin/generator.d.ts.map +0 -1
- package/build/component/generator/officeXMLAddin/generator.js +0 -173
- package/build/component/generator/officeXMLAddin/generator.js.map +0 -1
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
3
|
// Licensed under the MIT license.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.getEnvName = exports.updateForCustomApi = exports.formatValidationErrors = exports.
|
|
5
|
+
exports.getEnvName = exports.updateForCustomApi = exports.formatValidationErrors = exports.convertSpecParserErrorToFxError = exports.generateScaffoldingSummary = exports.logValidationResults = exports.generateFromApiSpec = exports.listPluginExistingOperations = exports.listOperations = exports.invalidApiSpecErrorName = exports.specParserGenerateResultWarningsTelemetryProperty = exports.specParserGenerateResultAllSuccessTelemetryProperty = exports.specParserGenerateResultTelemetryEvent = exports.getParserOptions = void 0;
|
|
6
6
|
const tslib_1 = require("tslib");
|
|
7
7
|
/**
|
|
8
8
|
* @author yuqzho@microsoft.com
|
|
9
9
|
*/
|
|
10
10
|
const m365_spec_parser_1 = require("@microsoft/m365-spec-parser");
|
|
11
11
|
const teamsfx_api_1 = require("@microsoft/teamsfx-api");
|
|
12
|
-
const axios_1 = tslib_1.__importDefault(require("axios"));
|
|
13
12
|
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
14
13
|
const os_1 = require("os");
|
|
15
14
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
@@ -20,55 +19,84 @@ const constants_1 = require("../../../question/constants");
|
|
|
20
19
|
const constant_1 = require("../../configManager/constant");
|
|
21
20
|
const ManifestUtils_1 = require("../../driver/teamsApp/utils/ManifestUtils");
|
|
22
21
|
const PluginManifestUtils_1 = require("../../driver/teamsApp/utils/PluginManifestUtils");
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
22
|
+
const telemetry_1 = require("../../../common/telemetry");
|
|
23
|
+
const util = tslib_1.__importStar(require("util"));
|
|
24
|
+
const constants_2 = require("../../../common/constants");
|
|
25
|
+
function getParserOptions(type, isDeclarativeCopilot) {
|
|
26
|
+
return type === m365_spec_parser_1.ProjectType.Copilot
|
|
27
|
+
? {
|
|
28
|
+
isGptPlugin: isDeclarativeCopilot,
|
|
29
|
+
allowAPIKeyAuth: false,
|
|
30
|
+
allowBearerTokenAuth: true,
|
|
31
|
+
allowMultipleParameters: true,
|
|
32
|
+
allowOauth2: true,
|
|
33
|
+
projectType: m365_spec_parser_1.ProjectType.Copilot,
|
|
34
|
+
allowMissingId: true,
|
|
35
|
+
allowSwagger: true,
|
|
36
|
+
allowMethods: [
|
|
37
|
+
"get",
|
|
38
|
+
"post",
|
|
39
|
+
"put",
|
|
40
|
+
"delete",
|
|
41
|
+
"patch",
|
|
42
|
+
"head",
|
|
43
|
+
"connect",
|
|
44
|
+
"options",
|
|
45
|
+
"trace",
|
|
46
|
+
],
|
|
47
|
+
allowResponseSemantics: true,
|
|
48
|
+
allowConversationStarters: true,
|
|
49
|
+
allowConfirmation: false, // confirmation is not stable for public preview in Sydney, so it's temporarily set to false
|
|
50
|
+
}
|
|
51
|
+
: {
|
|
52
|
+
projectType: type,
|
|
53
|
+
allowBearerTokenAuth: true,
|
|
54
|
+
allowMultipleParameters: true,
|
|
55
|
+
allowOauth2: featureFlags_1.featureFlagManager.getBooleanValue(featureFlags_1.FeatureFlags.SMEOAuth),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
exports.getParserOptions = getParserOptions;
|
|
36
59
|
exports.specParserGenerateResultTelemetryEvent = "spec-parser-generate-result";
|
|
37
60
|
exports.specParserGenerateResultAllSuccessTelemetryProperty = "all-success";
|
|
38
61
|
exports.specParserGenerateResultWarningsTelemetryProperty = "warnings";
|
|
39
62
|
exports.invalidApiSpecErrorName = "invalid-api-spec";
|
|
40
63
|
const apiSpecNotUsedInPlugin = "api-spec-not-used-in-plugin";
|
|
41
|
-
exports.defaultApiSpecFolderName = "apiSpecificationFile";
|
|
42
|
-
exports.defaultApiSpecYamlFileName = "openapi.yaml";
|
|
43
|
-
exports.defaultApiSpecJsonFileName = "openapi.json";
|
|
44
|
-
exports.defaultPluginManifestFileName = "ai-plugin.json";
|
|
45
64
|
async function listOperations(context, apiSpecUrl, inputs, includeExistingAPIs = true, shouldLogWarning = true, existingCorrelationId) {
|
|
46
|
-
const isPlugin = inputs[constants_1.QuestionNames.
|
|
65
|
+
const isPlugin = inputs[constants_1.QuestionNames.ApiPluginType] === constants_1.apiPluginApiSpecOptionId ||
|
|
66
|
+
!!inputs[constants_1.QuestionNames.PluginAvailability];
|
|
47
67
|
const isCustomApi = inputs[constants_1.QuestionNames.CustomCopilotRag] === constants_1.CustomCopilotRagOptions.customApi().id;
|
|
68
|
+
const projectType = isPlugin
|
|
69
|
+
? m365_spec_parser_1.ProjectType.Copilot
|
|
70
|
+
: isCustomApi
|
|
71
|
+
? m365_spec_parser_1.ProjectType.TeamsAi
|
|
72
|
+
: m365_spec_parser_1.ProjectType.SME;
|
|
48
73
|
try {
|
|
49
|
-
const specParser = new m365_spec_parser_1.SpecParser(apiSpecUrl,
|
|
50
|
-
? exports.copilotPluginParserOptions
|
|
51
|
-
: isCustomApi
|
|
52
|
-
? {
|
|
53
|
-
projectType: m365_spec_parser_1.ProjectType.TeamsAi,
|
|
54
|
-
}
|
|
55
|
-
: {
|
|
56
|
-
allowBearerTokenAuth: true,
|
|
57
|
-
allowMultipleParameters: true,
|
|
58
|
-
allowOauth2: featureFlags_1.featureFlagManager.getBooleanValue(featureFlags_1.FeatureFlags.SMEOAuth),
|
|
59
|
-
});
|
|
74
|
+
const specParser = new m365_spec_parser_1.SpecParser(apiSpecUrl, getParserOptions(projectType));
|
|
60
75
|
const validationRes = await specParser.validate();
|
|
61
76
|
validationRes.errors = formatValidationErrors(validationRes.errors, inputs);
|
|
62
|
-
logValidationResults(validationRes.errors, validationRes.warnings, context, shouldLogWarning, false, existingCorrelationId);
|
|
77
|
+
logValidationResults(projectType, validationRes.errors, validationRes.warnings, context, shouldLogWarning, false, existingCorrelationId);
|
|
63
78
|
if (validationRes.status === m365_spec_parser_1.ValidationStatus.Error) {
|
|
64
|
-
return teamsfx_api_1.err(validationRes.errors);
|
|
79
|
+
return (0, teamsfx_api_1.err)(validationRes.errors);
|
|
65
80
|
}
|
|
66
81
|
const listResult = await specParser.list();
|
|
82
|
+
const invalidAPIs = listResult.APIs.filter((value) => !value.isValid);
|
|
83
|
+
for (const invalidAPI of invalidAPIs) {
|
|
84
|
+
context.logProvider.warning(`${invalidAPI.api} ${(0, localizeUtils_1.getLocalizedString)("core.copilotPlugin.list.unsupportedBecause")} ${invalidAPI.reason.map(mapInvalidReasonToMessage).join(", ")}`);
|
|
85
|
+
}
|
|
86
|
+
const bearerTokenAuthAPIs = listResult.APIs.filter((api) => api.auth && m365_spec_parser_1.Utils.isBearerTokenAuth(api.auth.authScheme));
|
|
87
|
+
const oauth2AuthAPIs = listResult.APIs.filter((api) => api.auth && m365_spec_parser_1.Utils.isOAuthWithAuthCodeFlow(api.auth.authScheme));
|
|
88
|
+
const otherAuthAPIs = listResult.APIs.filter((api) => api.auth &&
|
|
89
|
+
!m365_spec_parser_1.Utils.isOAuthWithAuthCodeFlow(api.auth.authScheme) &&
|
|
90
|
+
!m365_spec_parser_1.Utils.isBearerTokenAuth(api.auth.authScheme));
|
|
67
91
|
let operations = listResult.APIs.filter((value) => value.isValid);
|
|
68
|
-
context.telemetryReporter.sendTelemetryEvent("spec-parser-list-apis-result" /* listApis */, {
|
|
69
|
-
["
|
|
70
|
-
["
|
|
71
|
-
["
|
|
92
|
+
context.telemetryReporter.sendTelemetryEvent("spec-parser-list-apis-result" /* telemetryEvents.listApis */, {
|
|
93
|
+
["generate-type" /* telemetryProperties.generateType */]: projectType.toString(),
|
|
94
|
+
["valid-apis-count" /* telemetryProperties.validApisCount */]: listResult.validAPICount.toString(),
|
|
95
|
+
["all-apis-count" /* telemetryProperties.allApisCount */]: listResult.allAPICount.toString(),
|
|
96
|
+
["is-from-adding-api" /* telemetryProperties.isFromAddingApi */]: (!includeExistingAPIs).toString(),
|
|
97
|
+
["bearer-token-auth-count" /* telemetryProperties.bearerTokenAuthCount */]: bearerTokenAuthAPIs.length.toString(),
|
|
98
|
+
["oauth2-auth-count" /* telemetryProperties.oauth2AuthCount */]: oauth2AuthAPIs.length.toString(),
|
|
99
|
+
["other-auth-count" /* telemetryProperties.otherAuthCount */]: otherAuthAPIs.length.toString(),
|
|
72
100
|
});
|
|
73
101
|
// Filter out exsiting APIs
|
|
74
102
|
if (!includeExistingAPIs) {
|
|
@@ -99,8 +127,8 @@ async function listOperations(context, apiSpecUrl, inputs, includeExistingAPIs =
|
|
|
99
127
|
content: "",
|
|
100
128
|
},
|
|
101
129
|
], inputs);
|
|
102
|
-
logValidationResults(errors, [], context, true, false, existingCorrelationId);
|
|
103
|
-
return teamsfx_api_1.err(errors);
|
|
130
|
+
logValidationResults(projectType, errors, [], context, true, false, existingCorrelationId);
|
|
131
|
+
return (0, teamsfx_api_1.err)(errors);
|
|
104
132
|
}
|
|
105
133
|
operations = operations.filter((operation) => !existingOperations.includes(operation.api));
|
|
106
134
|
// No extra API can be added
|
|
@@ -111,8 +139,8 @@ async function listOperations(context, apiSpecUrl, inputs, includeExistingAPIs =
|
|
|
111
139
|
content: "",
|
|
112
140
|
},
|
|
113
141
|
], inputs);
|
|
114
|
-
logValidationResults(errors, [], context, true, false, existingCorrelationId);
|
|
115
|
-
return teamsfx_api_1.err(errors);
|
|
142
|
+
logValidationResults(projectType, errors, [], context, true, false, existingCorrelationId);
|
|
143
|
+
return (0, teamsfx_api_1.err)(errors);
|
|
116
144
|
}
|
|
117
145
|
}
|
|
118
146
|
else {
|
|
@@ -120,7 +148,7 @@ async function listOperations(context, apiSpecUrl, inputs, includeExistingAPIs =
|
|
|
120
148
|
}
|
|
121
149
|
}
|
|
122
150
|
const sortedOperations = sortOperations(operations);
|
|
123
|
-
return teamsfx_api_1.ok(sortedOperations);
|
|
151
|
+
return (0, teamsfx_api_1.ok)(sortedOperations);
|
|
124
152
|
}
|
|
125
153
|
catch (e) {
|
|
126
154
|
if (e instanceof m365_spec_parser_1.SpecParserError) {
|
|
@@ -141,11 +169,11 @@ function sortOperations(operations) {
|
|
|
141
169
|
label: operation.api,
|
|
142
170
|
groupName: arr[0],
|
|
143
171
|
detail: !operation.auth
|
|
144
|
-
? localizeUtils_1.getLocalizedString("core.copilotPlugin.api.noAuth")
|
|
172
|
+
? (0, localizeUtils_1.getLocalizedString)("core.copilotPlugin.api.noAuth")
|
|
145
173
|
: m365_spec_parser_1.Utils.isBearerTokenAuth(operation.auth.authScheme)
|
|
146
|
-
? localizeUtils_1.getLocalizedString("core.copilotPlugin.api.apiKeyAuth")
|
|
174
|
+
? (0, localizeUtils_1.getLocalizedString)("core.copilotPlugin.api.apiKeyAuth")
|
|
147
175
|
: m365_spec_parser_1.Utils.isOAuthWithAuthCodeFlow(operation.auth.authScheme)
|
|
148
|
-
? localizeUtils_1.getLocalizedString("core.copilotPlugin.api.oauth")
|
|
176
|
+
? (0, localizeUtils_1.getLocalizedString)("core.copilotPlugin.api.oauth")
|
|
149
177
|
: "",
|
|
150
178
|
data: {
|
|
151
179
|
serverUrl: operation.server,
|
|
@@ -186,28 +214,97 @@ async function listPluginExistingOperations(manifest, teamsManifestPath, destina
|
|
|
186
214
|
}
|
|
187
215
|
}
|
|
188
216
|
if (!apiSpecFilePath) {
|
|
189
|
-
throw new teamsfx_api_1.UserError("listPluginExistingOperations", apiSpecNotUsedInPlugin, localizeUtils_1.getLocalizedString("error.copilotPlugin.apiSpecNotUsedInPlugin", destinationApiSpecFilePath), localizeUtils_1.getLocalizedString("error.copilotPlugin.apiSpecNotUsedInPlugin", destinationApiSpecFilePath));
|
|
217
|
+
throw new teamsfx_api_1.UserError("listPluginExistingOperations", apiSpecNotUsedInPlugin, (0, localizeUtils_1.getLocalizedString)("error.copilotPlugin.apiSpecNotUsedInPlugin", destinationApiSpecFilePath), (0, localizeUtils_1.getLocalizedString)("error.copilotPlugin.apiSpecNotUsedInPlugin", destinationApiSpecFilePath));
|
|
190
218
|
}
|
|
191
|
-
const specParser = new m365_spec_parser_1.SpecParser(apiSpecFilePath,
|
|
219
|
+
const specParser = new m365_spec_parser_1.SpecParser(apiSpecFilePath, getParserOptions(m365_spec_parser_1.ProjectType.Copilot));
|
|
192
220
|
const listResult = await specParser.list();
|
|
193
221
|
return listResult.APIs.map((o) => o.api);
|
|
194
222
|
}
|
|
195
223
|
exports.listPluginExistingOperations = listPluginExistingOperations;
|
|
196
|
-
function
|
|
224
|
+
async function generateFromApiSpec(specParser, teamsManifestPath, inputs, context, sourceComponent, projectType, outputFilePath) {
|
|
225
|
+
const operations = featureFlags_1.featureFlagManager.getBooleanValue(featureFlags_1.FeatureFlags.KiotaIntegration) &&
|
|
226
|
+
inputs[constants_1.QuestionNames.ApiPluginManifestPath]
|
|
227
|
+
? (await specParser.list()).APIs.filter((value) => value.isValid).map((value) => value.api)
|
|
228
|
+
: inputs[constants_1.QuestionNames.ApiOperation];
|
|
229
|
+
const validationRes = await specParser.validate();
|
|
230
|
+
const warnings = validationRes.warnings;
|
|
231
|
+
const operationIdWarning = warnings.find((w) => w.type === m365_spec_parser_1.WarningType.OperationIdMissing);
|
|
232
|
+
if (operationIdWarning && operationIdWarning.data) {
|
|
233
|
+
const apisMissingOperationId = operationIdWarning.data.filter((api) => operations.includes(api));
|
|
234
|
+
if (apisMissingOperationId.length > 0) {
|
|
235
|
+
operationIdWarning.content = util.format((0, localizeUtils_1.getLocalizedString)("core.common.MissingOperationId"), apisMissingOperationId.join(", "));
|
|
236
|
+
delete operationIdWarning.data;
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
warnings.splice(warnings.indexOf(operationIdWarning), 1);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
const specVersionWarning = warnings.find((w) => w.type === m365_spec_parser_1.WarningType.ConvertSwaggerToOpenAPI);
|
|
243
|
+
if (specVersionWarning) {
|
|
244
|
+
specVersionWarning.content = ""; // We don't care content of this warning
|
|
245
|
+
}
|
|
246
|
+
if (validationRes.status === m365_spec_parser_1.ValidationStatus.Error) {
|
|
247
|
+
logValidationResults(projectType, validationRes.errors, warnings, context, false, true);
|
|
248
|
+
const errorMessage = inputs.platform === teamsfx_api_1.Platform.VSCode
|
|
249
|
+
? (0, localizeUtils_1.getLocalizedString)("core.createProjectQuestion.apiSpec.multipleValidationErrors.vscode.message")
|
|
250
|
+
: (0, localizeUtils_1.getLocalizedString)("core.createProjectQuestion.apiSpec.multipleValidationErrors.message");
|
|
251
|
+
return (0, teamsfx_api_1.err)(new teamsfx_api_1.UserError(sourceComponent, exports.invalidApiSpecErrorName, errorMessage, errorMessage));
|
|
252
|
+
}
|
|
253
|
+
try {
|
|
254
|
+
const generateResult = projectType === m365_spec_parser_1.ProjectType.Copilot
|
|
255
|
+
? await specParser.generateForCopilot(teamsManifestPath, operations, outputFilePath.destinationApiSpecFilePath, outputFilePath.pluginManifestFilePath, inputs[constants_1.QuestionNames.ApiPluginManifestPath])
|
|
256
|
+
: await specParser.generate(teamsManifestPath, operations, outputFilePath.destinationApiSpecFilePath, projectType === m365_spec_parser_1.ProjectType.TeamsAi ? undefined : outputFilePath.responseTemplateFolder);
|
|
257
|
+
// Send SpecParser.generate() warnings
|
|
258
|
+
context.telemetryReporter.sendTelemetryEvent(exports.specParserGenerateResultTelemetryEvent, {
|
|
259
|
+
["generate-type" /* telemetryProperties.generateType */]: projectType.toString(),
|
|
260
|
+
[exports.specParserGenerateResultAllSuccessTelemetryProperty]: generateResult.allSuccess.toString(),
|
|
261
|
+
[exports.specParserGenerateResultWarningsTelemetryProperty]: generateResult.warnings
|
|
262
|
+
.map((w) => w.type.toString() + ": " + w.content)
|
|
263
|
+
.join(";"),
|
|
264
|
+
[telemetry_1.TelemetryProperty.Component]: sourceComponent,
|
|
265
|
+
});
|
|
266
|
+
if (generateResult.warnings && generateResult.warnings.length > 0) {
|
|
267
|
+
generateResult.warnings.find((o) => {
|
|
268
|
+
if (o.type === m365_spec_parser_1.WarningType.OperationOnlyContainsOptionalParam) {
|
|
269
|
+
o.content = ""; // We don't care content of this warning
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
warnings.push(...generateResult.warnings);
|
|
273
|
+
}
|
|
274
|
+
return (0, teamsfx_api_1.ok)({ warnings });
|
|
275
|
+
}
|
|
276
|
+
catch (e) {
|
|
277
|
+
let error;
|
|
278
|
+
if (e instanceof m365_spec_parser_1.SpecParserError) {
|
|
279
|
+
error = convertSpecParserErrorToFxError(e);
|
|
280
|
+
}
|
|
281
|
+
else {
|
|
282
|
+
error = (0, error_1.assembleError)(e, sourceComponent);
|
|
283
|
+
}
|
|
284
|
+
return (0, teamsfx_api_1.err)(error);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
exports.generateFromApiSpec = generateFromApiSpec;
|
|
288
|
+
function logValidationResults(projectType, errors, warnings, context, shouldLogWarning, shouldSkipTelemetry, existingCorrelationId) {
|
|
197
289
|
if (!shouldSkipTelemetry) {
|
|
198
290
|
const properties = {
|
|
199
|
-
["validation-status" /* validationStatus */]: errors.length !== 0 ? "error" : warnings.length !== 0 ? "warning" : "success",
|
|
200
|
-
["validation-errors" /* validationErrors */]: errors
|
|
291
|
+
["validation-status" /* telemetryProperties.validationStatus */]: errors.length !== 0 ? "error" : warnings.length !== 0 ? "warning" : "success",
|
|
292
|
+
["validation-errors" /* telemetryProperties.validationErrors */]: errors
|
|
201
293
|
.map((error) => formatTelemetryValidationProperty(error))
|
|
202
294
|
.join(";"),
|
|
203
|
-
["validation-warnings" /* validationWarnings */]: warnings
|
|
295
|
+
["validation-warnings" /* telemetryProperties.validationWarnings */]: warnings
|
|
204
296
|
.map((warn) => formatTelemetryValidationProperty(warn))
|
|
205
297
|
.join(";"),
|
|
298
|
+
["project-type" /* telemetryProperties.projectType */]: projectType.toString(),
|
|
206
299
|
};
|
|
300
|
+
const specNotValidError = errors.find((error) => error.type === m365_spec_parser_1.ErrorType.SpecNotValid);
|
|
301
|
+
if (specNotValidError) {
|
|
302
|
+
properties[telemetry_1.ApiSpecTelemetryPropertis.SpecNotValidDetails] = specNotValidError.content;
|
|
303
|
+
}
|
|
207
304
|
if (existingCorrelationId) {
|
|
208
305
|
properties["correlation-id"] = existingCorrelationId;
|
|
209
306
|
}
|
|
210
|
-
context.telemetryReporter.sendTelemetryEvent("validate-api-spec" /* validateApiSpec */, properties);
|
|
307
|
+
context.telemetryReporter.sendTelemetryEvent("validate-api-spec" /* telemetryEvents.validateApiSpec */, properties);
|
|
211
308
|
}
|
|
212
309
|
if (errors.length === 0 && (warnings.length === 0 || !shouldLogWarning)) {
|
|
213
310
|
return;
|
|
@@ -229,23 +326,41 @@ function logValidationResults(errors, warnings, context, shouldLogWarning, shoul
|
|
|
229
326
|
const warns = warnings.length;
|
|
230
327
|
const summaryStr = [];
|
|
231
328
|
if (failed > 0) {
|
|
232
|
-
summaryStr.push(localizeUtils_1.getLocalizedString("core.copilotPlugin.validate.summary.validate.failed", failed));
|
|
329
|
+
summaryStr.push((0, localizeUtils_1.getLocalizedString)("core.copilotPlugin.validate.summary.validate.failed", failed));
|
|
233
330
|
}
|
|
234
331
|
if (warns > 0 && shouldLogWarning) {
|
|
235
|
-
summaryStr.push(localizeUtils_1.getLocalizedString("core.copilotPlugin.validate.summary.validate.warning", warns));
|
|
332
|
+
summaryStr.push((0, localizeUtils_1.getLocalizedString)("core.copilotPlugin.validate.summary.validate.warning", warns));
|
|
236
333
|
}
|
|
237
334
|
const outputMessage = os_1.EOL +
|
|
238
|
-
localizeUtils_1.getLocalizedString("core.copilotPlugin.validate.apiSpec.summary", summaryStr.join(", "), errorMessage, warningMessage);
|
|
335
|
+
(0, localizeUtils_1.getLocalizedString)("core.copilotPlugin.validate.apiSpec.summary", summaryStr.join(", "), errorMessage, warningMessage);
|
|
239
336
|
void context.logProvider.info(outputMessage);
|
|
240
337
|
}
|
|
241
338
|
exports.logValidationResults = logValidationResults;
|
|
242
|
-
|
|
339
|
+
/**
|
|
340
|
+
* Generate scaffolding warning summary.
|
|
341
|
+
* @param warnings warnings returned from spec-parser.
|
|
342
|
+
* @param teamsManifest Teams manifest.
|
|
343
|
+
* @param apiSpecFilePath API spec path relative of project path.
|
|
344
|
+
* @param pluginManifestPath Plugin manifest path relative of project path.
|
|
345
|
+
* @param projectPath Project path.
|
|
346
|
+
* @returns Warning message.
|
|
347
|
+
*/
|
|
348
|
+
async function generateScaffoldingSummary(warnings, teamsManifest, apiSpecFilePath, pluginManifestPath, projectPath) {
|
|
243
349
|
const apiSpecWarningMessage = formatApiSpecValidationWarningMessage(warnings, apiSpecFilePath, teamsManifest);
|
|
244
350
|
const manifestWarningResult = validateTeamsManifestLength(teamsManifest, warnings);
|
|
245
351
|
const manifestWarningMessage = manifestWarningResult.map((warn) => {
|
|
246
352
|
return `${constant_1.SummaryConstant.NotExecuted} ${warn}`;
|
|
247
353
|
});
|
|
248
|
-
|
|
354
|
+
let pluginWarningMessage = [];
|
|
355
|
+
if (pluginManifestPath) {
|
|
356
|
+
const pluginManifestWarningResult = await validatePluginManifestLength(pluginManifestPath, projectPath, warnings);
|
|
357
|
+
pluginWarningMessage = pluginManifestWarningResult.map((warn) => {
|
|
358
|
+
return `${constant_1.SummaryConstant.NotExecuted} ${warn}`;
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
if (apiSpecWarningMessage.length ||
|
|
362
|
+
manifestWarningMessage.length ||
|
|
363
|
+
pluginWarningMessage.length) {
|
|
249
364
|
let details = "";
|
|
250
365
|
if (apiSpecWarningMessage.length) {
|
|
251
366
|
details += os_1.EOL + apiSpecWarningMessage.join(os_1.EOL);
|
|
@@ -253,7 +368,10 @@ function generateScaffoldingSummary(warnings, teamsManifest, apiSpecFilePath) {
|
|
|
253
368
|
if (manifestWarningMessage.length) {
|
|
254
369
|
details += os_1.EOL + manifestWarningMessage.join(os_1.EOL);
|
|
255
370
|
}
|
|
256
|
-
|
|
371
|
+
if (pluginWarningMessage.length) {
|
|
372
|
+
details += os_1.EOL + pluginWarningMessage.join(os_1.EOL);
|
|
373
|
+
}
|
|
374
|
+
return (0, localizeUtils_1.getLocalizedString)("core.copilotPlugin.scaffold.summary", details);
|
|
257
375
|
}
|
|
258
376
|
else {
|
|
259
377
|
return "";
|
|
@@ -265,12 +383,12 @@ function formatApiSpecValidationWarningMessage(specWarnings, apiSpecFileName, te
|
|
|
265
383
|
const operationIdWarning = specWarnings.find((w) => w.type === m365_spec_parser_1.WarningType.OperationIdMissing);
|
|
266
384
|
if (operationIdWarning) {
|
|
267
385
|
const isApiMe = teamsfx_api_1.ManifestUtil.parseCommonProperties(teamsManifest).isApiME;
|
|
268
|
-
resultWarnings.push(localizeUtils_1.getLocalizedString("core.copilotPlugin.scaffold.summary.warning.operationId", `${constant_1.SummaryConstant.NotExecuted} ${operationIdWarning.content}`, isApiMe ? teamsfx_api_1.ManifestTemplateFileName : apiSpecFileName));
|
|
386
|
+
resultWarnings.push((0, localizeUtils_1.getLocalizedString)("core.copilotPlugin.scaffold.summary.warning.operationId", `${constant_1.SummaryConstant.NotExecuted} ${operationIdWarning.content}`, isApiMe ? teamsfx_api_1.ManifestTemplateFileName : apiSpecFileName));
|
|
269
387
|
}
|
|
270
388
|
const swaggerWarning = specWarnings.find((w) => w.type === m365_spec_parser_1.WarningType.ConvertSwaggerToOpenAPI);
|
|
271
389
|
if (swaggerWarning) {
|
|
272
390
|
resultWarnings.push(`${constant_1.SummaryConstant.NotExecuted} ` +
|
|
273
|
-
localizeUtils_1.getLocalizedString("core.copilotPlugin.scaffold.summary.warning.swaggerVersion", apiSpecFileName));
|
|
391
|
+
(0, localizeUtils_1.getLocalizedString)("core.copilotPlugin.scaffold.summary.warning.swaggerVersion", apiSpecFileName));
|
|
274
392
|
}
|
|
275
393
|
return resultWarnings;
|
|
276
394
|
}
|
|
@@ -298,8 +416,8 @@ function validateTeamsManifestLength(teamsManifest, warnings) {
|
|
|
298
416
|
resultWarnings.push(formatLengthExceedingErrorMessage("/description/short", descriptionShortLimit));
|
|
299
417
|
}
|
|
300
418
|
if (!((_b = teamsManifest.description.full) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
301
|
-
resultWarnings.push(localizeUtils_1.getLocalizedString("core.copilotPlugin.scaffold.summary.warning.teamsManifest.missingFullDescription") +
|
|
302
|
-
localizeUtils_1.getLocalizedString("core.copilotPlugin.scaffold.summary.warning.teamsManifest.mitigation", "full/description", path_1.default.join(teamsfx_api_1.AppPackageFolderName, teamsfx_api_1.ManifestTemplateFileName)));
|
|
419
|
+
resultWarnings.push((0, localizeUtils_1.getLocalizedString)("core.copilotPlugin.scaffold.summary.warning.teamsManifest.missingFullDescription") +
|
|
420
|
+
(0, localizeUtils_1.getLocalizedString)("core.copilotPlugin.scaffold.summary.warning.teamsManifest.mitigation", "full/description", path_1.default.join(teamsfx_api_1.AppPackageFolderName, teamsfx_api_1.ManifestTemplateFileName)));
|
|
303
421
|
}
|
|
304
422
|
if (teamsManifest.description.full.length > descriptionFullLimit) {
|
|
305
423
|
resultWarnings.push(formatLengthExceedingErrorMessage("/description/full", descriptionFullLimit));
|
|
@@ -309,8 +427,8 @@ function validateTeamsManifestLength(teamsManifest, warnings) {
|
|
|
309
427
|
const optionalParamsOnlyWarnings = warnings.filter((o) => o.type === m365_spec_parser_1.WarningType.OperationOnlyContainsOptionalParam);
|
|
310
428
|
if (optionalParamsOnlyWarnings) {
|
|
311
429
|
for (const optionalParamsOnlyWarning of optionalParamsOnlyWarnings) {
|
|
312
|
-
resultWarnings.push(localizeUtils_1.getLocalizedString("core.copilotPlugin.scaffold.summary.warning.api.optionalParametersOnly", optionalParamsOnlyWarning.data.commandId, optionalParamsOnlyWarning.data.commandId) +
|
|
313
|
-
localizeUtils_1.getLocalizedString("core.copilotPlugin.scaffold.summary.warning.api.optionalParametersOnly.mitigation", optionalParamsOnlyWarning.data.parameterName, optionalParamsOnlyWarning.data.commandId, path_1.default.join(teamsfx_api_1.AppPackageFolderName, teamsfx_api_1.ManifestTemplateFileName), path_1.default.join(teamsfx_api_1.AppPackageFolderName, (_c = teamsManifest.composeExtensions[0].apiSpecificationFile) !== null && _c !== void 0 ? _c : "")));
|
|
430
|
+
resultWarnings.push((0, localizeUtils_1.getLocalizedString)("core.copilotPlugin.scaffold.summary.warning.api.optionalParametersOnly", optionalParamsOnlyWarning.data.commandId, optionalParamsOnlyWarning.data.commandId) +
|
|
431
|
+
(0, localizeUtils_1.getLocalizedString)("core.copilotPlugin.scaffold.summary.warning.api.optionalParametersOnly.mitigation", optionalParamsOnlyWarning.data.parameterName, optionalParamsOnlyWarning.data.commandId, path_1.default.join(teamsfx_api_1.AppPackageFolderName, teamsfx_api_1.ManifestTemplateFileName), path_1.default.join(teamsfx_api_1.AppPackageFolderName, (_c = teamsManifest.composeExtensions[0].apiSpecificationFile) !== null && _c !== void 0 ? _c : "")));
|
|
314
432
|
}
|
|
315
433
|
}
|
|
316
434
|
const commands = teamsManifest.composeExtensions[0].commands;
|
|
@@ -318,8 +436,8 @@ function validateTeamsManifestLength(teamsManifest, warnings) {
|
|
|
318
436
|
if (command.type === "query") {
|
|
319
437
|
if (!command.apiResponseRenderingTemplateFile) {
|
|
320
438
|
const errorDetail = (_d = warnings.find((w) => w.type === m365_spec_parser_1.WarningType.GenerateCardFailed && w.data === command.id)) === null || _d === void 0 ? void 0 : _d.content;
|
|
321
|
-
resultWarnings.push(localizeUtils_1.getLocalizedString("core.copilotPlugin.scaffold.summary.warning.teamsManifest.missingCardTemlate", "apiResponseRenderingTemplateFile", command.id) +
|
|
322
|
-
localizeUtils_1.getLocalizedString("core.copilotPlugin.scaffold.summary.warning.teamsManifest.missingCardTemlate.mitigation", teamsfx_api_1.AppPackageFolderName, `composeExtensions/commands/${command.id}/apiResponseRenderingTemplateFile`, path_1.default.join(teamsfx_api_1.AppPackageFolderName, teamsfx_api_1.ManifestTemplateFileName)) +
|
|
439
|
+
resultWarnings.push((0, localizeUtils_1.getLocalizedString)("core.copilotPlugin.scaffold.summary.warning.teamsManifest.missingCardTemlate", "apiResponseRenderingTemplateFile", command.id) +
|
|
440
|
+
(0, localizeUtils_1.getLocalizedString)("core.copilotPlugin.scaffold.summary.warning.teamsManifest.missingCardTemlate.mitigation", teamsfx_api_1.AppPackageFolderName, `composeExtensions/commands/${command.id}/apiResponseRenderingTemplateFile`, path_1.default.join(teamsfx_api_1.AppPackageFolderName, teamsfx_api_1.ManifestTemplateFileName)) +
|
|
323
441
|
(errorDetail ? os_1.EOL + errorDetail : ""));
|
|
324
442
|
}
|
|
325
443
|
}
|
|
@@ -327,34 +445,41 @@ function validateTeamsManifestLength(teamsManifest, warnings) {
|
|
|
327
445
|
}
|
|
328
446
|
return resultWarnings;
|
|
329
447
|
}
|
|
448
|
+
async function validatePluginManifestLength(pluginManifestPath, projectPath, warnings) {
|
|
449
|
+
const functionDescriptionLimit = 100;
|
|
450
|
+
const resultWarnings = [];
|
|
451
|
+
const manifestRes = await PluginManifestUtils_1.pluginManifestUtils.readPluginManifestFile(path_1.default.join(projectPath, pluginManifestPath));
|
|
452
|
+
if (manifestRes.isErr()) {
|
|
453
|
+
(0, telemetry_1.sendTelemetryErrorEvent)("spec-generator", "failed-to-get-generate-warning" /* telemetryEvents.failedToGetGenerateWarning */, manifestRes.error);
|
|
454
|
+
return [];
|
|
455
|
+
}
|
|
456
|
+
// validate function description
|
|
457
|
+
const functions = manifestRes.value.functions;
|
|
458
|
+
const functionDescriptionWarnings = warnings
|
|
459
|
+
.filter((w) => w.type === m365_spec_parser_1.WarningType.FuncDescriptionTooLong)
|
|
460
|
+
.map((w) => w.data);
|
|
461
|
+
if (functions) {
|
|
462
|
+
functions.forEach((func) => {
|
|
463
|
+
if (!func.description) {
|
|
464
|
+
resultWarnings.push((0, localizeUtils_1.getLocalizedString)("core.copilotPlugin.scaffold.summary.warning.pluginManifest.missingFunctionDescription", func.name) +
|
|
465
|
+
(0, localizeUtils_1.getLocalizedString)("core.copilotPlugin.scaffold.summary.warning.pluginManifest.missingFunctionDescription.mitigation", func.name, pluginManifestPath));
|
|
466
|
+
}
|
|
467
|
+
else if (functionDescriptionWarnings.includes(func.name)) {
|
|
468
|
+
resultWarnings.push((0, localizeUtils_1.getLocalizedString)("core.copilotPlugin.scaffold.summary.warning.pluginManifest.functionDescription.lengthExceeding", func.name, functionDescriptionLimit) +
|
|
469
|
+
(0, localizeUtils_1.getLocalizedString)("core.copilotPlugin.scaffold.summary.warning.pluginManifest.functionDescription.lengthExceeding.mitigation", func.name, pluginManifestPath));
|
|
470
|
+
}
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
return resultWarnings;
|
|
474
|
+
}
|
|
330
475
|
function formatLengthExceedingErrorMessage(field, limit) {
|
|
331
|
-
return (localizeUtils_1.getLocalizedString("core.copilotPlugin.scaffold.summary.warning.teamsManifest.lengthExceeding", field, limit.toString()) +
|
|
332
|
-
localizeUtils_1.getLocalizedString("core.copilotPlugin.scaffold.summary.warning.teamsManifest.mitigation", field, path_1.default.join(teamsfx_api_1.AppPackageFolderName, teamsfx_api_1.ManifestTemplateFileName)));
|
|
476
|
+
return ((0, localizeUtils_1.getLocalizedString)("core.copilotPlugin.scaffold.summary.warning.teamsManifest.lengthExceeding", field, limit.toString()) +
|
|
477
|
+
(0, localizeUtils_1.getLocalizedString)("core.copilotPlugin.scaffold.summary.warning.teamsManifest.mitigation", field, path_1.default.join(teamsfx_api_1.AppPackageFolderName, teamsfx_api_1.ManifestTemplateFileName)));
|
|
333
478
|
}
|
|
334
479
|
function convertSpecParserErrorToFxError(error) {
|
|
335
|
-
return new teamsfx_api_1.SystemError(
|
|
480
|
+
return new teamsfx_api_1.SystemError(constants_2.SpecParserSource, error.errorType.toString(), error.message, error.message);
|
|
336
481
|
}
|
|
337
482
|
exports.convertSpecParserErrorToFxError = convertSpecParserErrorToFxError;
|
|
338
|
-
async function isYamlSpecFile(specPath) {
|
|
339
|
-
if (specPath.endsWith(".yaml") || specPath.endsWith(".yml")) {
|
|
340
|
-
return true;
|
|
341
|
-
}
|
|
342
|
-
else if (specPath.endsWith(".json")) {
|
|
343
|
-
return false;
|
|
344
|
-
}
|
|
345
|
-
const isRemoteFile = specPath.startsWith("http:") || specPath.startsWith("https:");
|
|
346
|
-
const fileContent = isRemoteFile
|
|
347
|
-
? (await axios_1.default.get(specPath)).data
|
|
348
|
-
: await fs_extra_1.default.readFile(specPath, "utf-8");
|
|
349
|
-
try {
|
|
350
|
-
JSON.parse(fileContent);
|
|
351
|
-
return false;
|
|
352
|
-
}
|
|
353
|
-
catch (error) {
|
|
354
|
-
return true;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
exports.isYamlSpecFile = isYamlSpecFile;
|
|
358
483
|
function formatValidationErrors(errors, inputs) {
|
|
359
484
|
return errors.map((error) => {
|
|
360
485
|
return {
|
|
@@ -368,43 +493,43 @@ exports.formatValidationErrors = formatValidationErrors;
|
|
|
368
493
|
function mapInvalidReasonToMessage(reason) {
|
|
369
494
|
switch (reason) {
|
|
370
495
|
case m365_spec_parser_1.ErrorType.AuthTypeIsNotSupported:
|
|
371
|
-
return localizeUtils_1.getLocalizedString("core.common.invalidReason.AuthTypeIsNotSupported");
|
|
496
|
+
return (0, localizeUtils_1.getLocalizedString)("core.common.invalidReason.AuthTypeIsNotSupported");
|
|
372
497
|
case m365_spec_parser_1.ErrorType.MissingOperationId:
|
|
373
|
-
return localizeUtils_1.getLocalizedString("core.common.invalidReason.MissingOperationId");
|
|
498
|
+
return (0, localizeUtils_1.getLocalizedString)("core.common.invalidReason.MissingOperationId");
|
|
374
499
|
case m365_spec_parser_1.ErrorType.PostBodyContainMultipleMediaTypes:
|
|
375
|
-
return localizeUtils_1.getLocalizedString("core.common.invalidReason.PostBodyContainMultipleMediaTypes");
|
|
500
|
+
return (0, localizeUtils_1.getLocalizedString)("core.common.invalidReason.PostBodyContainMultipleMediaTypes");
|
|
376
501
|
case m365_spec_parser_1.ErrorType.ResponseContainMultipleMediaTypes:
|
|
377
|
-
return localizeUtils_1.getLocalizedString("core.common.invalidReason.ResponseContainMultipleMediaTypes");
|
|
502
|
+
return (0, localizeUtils_1.getLocalizedString)("core.common.invalidReason.ResponseContainMultipleMediaTypes");
|
|
378
503
|
case m365_spec_parser_1.ErrorType.ResponseJsonIsEmpty:
|
|
379
|
-
return localizeUtils_1.getLocalizedString("core.common.invalidReason.ResponseJsonIsEmpty");
|
|
504
|
+
return (0, localizeUtils_1.getLocalizedString)("core.common.invalidReason.ResponseJsonIsEmpty");
|
|
380
505
|
case m365_spec_parser_1.ErrorType.PostBodySchemaIsNotJson:
|
|
381
|
-
return localizeUtils_1.getLocalizedString("core.common.invalidReason.PostBodySchemaIsNotJson");
|
|
506
|
+
return (0, localizeUtils_1.getLocalizedString)("core.common.invalidReason.PostBodySchemaIsNotJson");
|
|
382
507
|
case m365_spec_parser_1.ErrorType.PostBodyContainsRequiredUnsupportedSchema:
|
|
383
|
-
return localizeUtils_1.getLocalizedString("core.common.invalidReason.PostBodyContainsRequiredUnsupportedSchema");
|
|
508
|
+
return (0, localizeUtils_1.getLocalizedString)("core.common.invalidReason.PostBodyContainsRequiredUnsupportedSchema");
|
|
384
509
|
case m365_spec_parser_1.ErrorType.ParamsContainRequiredUnsupportedSchema:
|
|
385
|
-
return localizeUtils_1.getLocalizedString("core.common.invalidReason.ParamsContainRequiredUnsupportedSchema");
|
|
510
|
+
return (0, localizeUtils_1.getLocalizedString)("core.common.invalidReason.ParamsContainRequiredUnsupportedSchema");
|
|
386
511
|
case m365_spec_parser_1.ErrorType.ParamsContainsNestedObject:
|
|
387
|
-
return localizeUtils_1.getLocalizedString("core.common.invalidReason.ParamsContainsNestedObject");
|
|
512
|
+
return (0, localizeUtils_1.getLocalizedString)("core.common.invalidReason.ParamsContainsNestedObject");
|
|
388
513
|
case m365_spec_parser_1.ErrorType.RequestBodyContainsNestedObject:
|
|
389
|
-
return localizeUtils_1.getLocalizedString("core.common.invalidReason.RequestBodyContainsNestedObject");
|
|
514
|
+
return (0, localizeUtils_1.getLocalizedString)("core.common.invalidReason.RequestBodyContainsNestedObject");
|
|
390
515
|
case m365_spec_parser_1.ErrorType.ExceededRequiredParamsLimit:
|
|
391
|
-
return localizeUtils_1.getLocalizedString("core.common.invalidReason.ExceededRequiredParamsLimit");
|
|
516
|
+
return (0, localizeUtils_1.getLocalizedString)("core.common.invalidReason.ExceededRequiredParamsLimit");
|
|
392
517
|
case m365_spec_parser_1.ErrorType.NoParameter:
|
|
393
|
-
return localizeUtils_1.getLocalizedString("core.common.invalidReason.NoParameter");
|
|
518
|
+
return (0, localizeUtils_1.getLocalizedString)("core.common.invalidReason.NoParameter");
|
|
394
519
|
case m365_spec_parser_1.ErrorType.NoAPIInfo:
|
|
395
|
-
return localizeUtils_1.getLocalizedString("core.common.invalidReason.NoAPIInfo");
|
|
520
|
+
return (0, localizeUtils_1.getLocalizedString)("core.common.invalidReason.NoAPIInfo");
|
|
396
521
|
case m365_spec_parser_1.ErrorType.MethodNotAllowed:
|
|
397
|
-
return localizeUtils_1.getLocalizedString("core.common.invalidReason.MethodNotAllowed");
|
|
522
|
+
return (0, localizeUtils_1.getLocalizedString)("core.common.invalidReason.MethodNotAllowed");
|
|
398
523
|
case m365_spec_parser_1.ErrorType.UrlPathNotExist:
|
|
399
|
-
return localizeUtils_1.getLocalizedString("core.common.invalidReason.UrlPathNotExist");
|
|
524
|
+
return (0, localizeUtils_1.getLocalizedString)("core.common.invalidReason.UrlPathNotExist");
|
|
400
525
|
case m365_spec_parser_1.ErrorType.CircularReferenceNotSupported:
|
|
401
|
-
return localizeUtils_1.getLocalizedString("core.common.invalidReason.CircularReference");
|
|
526
|
+
return (0, localizeUtils_1.getLocalizedString)("core.common.invalidReason.CircularReference");
|
|
402
527
|
default:
|
|
403
528
|
return reason.toString();
|
|
404
529
|
}
|
|
405
530
|
}
|
|
406
531
|
function formatValidationErrorContent(error, inputs) {
|
|
407
|
-
const isPlugin = inputs[constants_1.QuestionNames.
|
|
532
|
+
const isPlugin = inputs[constants_1.QuestionNames.ApiPluginType] === constants_1.apiPluginApiSpecOptionId;
|
|
408
533
|
try {
|
|
409
534
|
switch (error.type) {
|
|
410
535
|
case m365_spec_parser_1.ErrorType.SpecNotValid: {
|
|
@@ -414,18 +539,18 @@ function formatValidationErrorContent(error, inputs) {
|
|
|
414
539
|
.split("\n")
|
|
415
540
|
.map((o) => o.trim())
|
|
416
541
|
.join(". ");
|
|
417
|
-
content = `${content}. ${localizeUtils_1.getLocalizedString("core.common.ErrorFetchApiSpec")}`;
|
|
542
|
+
content = `${content}. ${(0, localizeUtils_1.getLocalizedString)("core.common.ErrorFetchApiSpec")}`;
|
|
418
543
|
}
|
|
419
544
|
return content;
|
|
420
545
|
}
|
|
421
546
|
case m365_spec_parser_1.ErrorType.RemoteRefNotSupported:
|
|
422
|
-
return localizeUtils_1.getLocalizedString("core.common.RemoteRefNotSupported", error.data.join(", "));
|
|
547
|
+
return (0, localizeUtils_1.getLocalizedString)("core.common.RemoteRefNotSupported", error.data.join(", "));
|
|
423
548
|
case m365_spec_parser_1.ErrorType.NoServerInformation:
|
|
424
|
-
return localizeUtils_1.getLocalizedString("core.common.NoServerInformation");
|
|
549
|
+
return (0, localizeUtils_1.getLocalizedString)("core.common.NoServerInformation");
|
|
425
550
|
case m365_spec_parser_1.ErrorType.UrlProtocolNotSupported:
|
|
426
|
-
return localizeUtils_1.getLocalizedString("core.common.UrlProtocolNotSupported", error.data);
|
|
551
|
+
return (0, localizeUtils_1.getLocalizedString)("core.common.UrlProtocolNotSupported", error.data);
|
|
427
552
|
case m365_spec_parser_1.ErrorType.RelativeServerUrlNotSupported:
|
|
428
|
-
return localizeUtils_1.getLocalizedString("core.common.RelativeServerUrlNotSupported");
|
|
553
|
+
return (0, localizeUtils_1.getLocalizedString)("core.common.RelativeServerUrlNotSupported");
|
|
429
554
|
case m365_spec_parser_1.ErrorType.NoSupportedApi:
|
|
430
555
|
const messages = [];
|
|
431
556
|
const invalidAPIInfo = error.data;
|
|
@@ -435,25 +560,25 @@ function formatValidationErrorContent(error, inputs) {
|
|
|
435
560
|
messages.push(mes);
|
|
436
561
|
}
|
|
437
562
|
if (messages.length === 0) {
|
|
438
|
-
messages.push(localizeUtils_1.getLocalizedString("core.common.invalidReason.NoAPIs"));
|
|
563
|
+
messages.push((0, localizeUtils_1.getLocalizedString)("core.common.invalidReason.NoAPIs"));
|
|
439
564
|
}
|
|
440
565
|
return isPlugin
|
|
441
|
-
? localizeUtils_1.getLocalizedString("core.common.NoSupportedApiCopilot", messages.join("\n"))
|
|
442
|
-
: localizeUtils_1.getLocalizedString("core.common.NoSupportedApi", messages.join("\n"));
|
|
566
|
+
? (0, localizeUtils_1.getLocalizedString)("core.common.NoSupportedApiCopilot", messages.join("\n"))
|
|
567
|
+
: (0, localizeUtils_1.getLocalizedString)("core.common.NoSupportedApi", messages.join("\n"));
|
|
443
568
|
case m365_spec_parser_1.ErrorType.NoExtraAPICanBeAdded:
|
|
444
569
|
return isPlugin
|
|
445
|
-
? localizeUtils_1.getLocalizedString("error.copilot.noExtraAPICanBeAdded")
|
|
446
|
-
: localizeUtils_1.getLocalizedString("error.apime.noExtraAPICanBeAdded");
|
|
570
|
+
? (0, localizeUtils_1.getLocalizedString)("error.copilot.noExtraAPICanBeAdded")
|
|
571
|
+
: (0, localizeUtils_1.getLocalizedString)("error.apime.noExtraAPICanBeAdded");
|
|
447
572
|
case m365_spec_parser_1.ErrorType.ResolveServerUrlFailed:
|
|
448
573
|
return error.content;
|
|
449
574
|
case m365_spec_parser_1.ErrorType.Cancelled:
|
|
450
|
-
return localizeUtils_1.getLocalizedString("core.common.CancelledMessage");
|
|
575
|
+
return (0, localizeUtils_1.getLocalizedString)("core.common.CancelledMessage");
|
|
451
576
|
case m365_spec_parser_1.ErrorType.SwaggerNotSupported:
|
|
452
|
-
return localizeUtils_1.getLocalizedString("core.common.SwaggerNotSupported");
|
|
577
|
+
return (0, localizeUtils_1.getLocalizedString)("core.common.SwaggerNotSupported");
|
|
453
578
|
case m365_spec_parser_1.ErrorType.SpecVersionNotSupported:
|
|
454
|
-
return localizeUtils_1.getLocalizedString("core.common.SpecVersionNotSupported", error.data);
|
|
579
|
+
return (0, localizeUtils_1.getLocalizedString)("core.common.SpecVersionNotSupported", error.data);
|
|
455
580
|
case m365_spec_parser_1.ErrorType.AddedAPINotInOriginalSpec:
|
|
456
|
-
return localizeUtils_1.getLocalizedString("core.common.AddedAPINotInOriginalSpec");
|
|
581
|
+
return (0, localizeUtils_1.getLocalizedString)("core.common.AddedAPINotInOriginalSpec");
|
|
457
582
|
default:
|
|
458
583
|
return error.content;
|
|
459
584
|
}
|
|
@@ -494,20 +619,24 @@ function parseSpec(spec) {
|
|
|
494
619
|
}
|
|
495
620
|
return [res, needAuth];
|
|
496
621
|
}
|
|
622
|
+
const commonLanguages = [constants_1.ProgrammingLanguage.TS, constants_1.ProgrammingLanguage.JS, constants_1.ProgrammingLanguage.PY];
|
|
497
623
|
async function updatePromptForCustomApi(spec, language, chatFolder) {
|
|
498
|
-
if (
|
|
624
|
+
if (commonLanguages.includes(language)) {
|
|
499
625
|
const promptFilePath = path_1.default.join(chatFolder, "skprompt.txt");
|
|
500
626
|
const prompt = `The following is a conversation with an AI assistant.\nThe assistant can help to call APIs for the open api spec file${spec.info.description ? ". " + spec.info.description : "."}\nIf the API doesn't require parameters, invoke it with default JSON object { "path": null, "body": null, "query": null }.\n\ncontext:\nAvailable actions: {{getAction}}.`;
|
|
501
627
|
await fs_extra_1.default.writeFile(promptFilePath, prompt, { encoding: "utf-8", flag: "w" });
|
|
502
628
|
}
|
|
503
629
|
}
|
|
504
630
|
async function updateAdaptiveCardForCustomApi(specItems, language, destinationPath) {
|
|
505
|
-
if (
|
|
631
|
+
if (commonLanguages.includes(language)) {
|
|
506
632
|
const adaptiveCardsFolderPath = path_1.default.join(destinationPath, "src", "adaptiveCards");
|
|
507
633
|
await fs_extra_1.default.ensureDir(adaptiveCardsFolderPath);
|
|
508
634
|
for (const item of specItems) {
|
|
509
|
-
const name = item.item.operationId;
|
|
510
|
-
const [card] = m365_spec_parser_1.AdaptiveCardGenerator.generateAdaptiveCard(item.item, true);
|
|
635
|
+
const name = item.item.operationId.replace(/[^a-zA-Z0-9]/g, "_");
|
|
636
|
+
const [card, jsonPath] = m365_spec_parser_1.AdaptiveCardGenerator.generateAdaptiveCard(item.item, true);
|
|
637
|
+
if (jsonPath !== "$" && card.body && card.body[0] && card.body[0].$data) {
|
|
638
|
+
card.body[0].$data = `\${${jsonPath}}`;
|
|
639
|
+
}
|
|
511
640
|
const cardFilePath = path_1.default.join(adaptiveCardsFolderPath, `${name}.json`);
|
|
512
641
|
await fs_extra_1.default.writeFile(cardFilePath, JSON.stringify(card, null, 2));
|
|
513
642
|
}
|
|
@@ -515,7 +644,7 @@ async function updateAdaptiveCardForCustomApi(specItems, language, destinationPa
|
|
|
515
644
|
}
|
|
516
645
|
async function updateActionForCustomApi(specItems, language, chatFolder) {
|
|
517
646
|
var _a, _b;
|
|
518
|
-
if (
|
|
647
|
+
if (commonLanguages.includes(language)) {
|
|
519
648
|
const actionsFilePath = path_1.default.join(chatFolder, "actions.json");
|
|
520
649
|
const actions = [];
|
|
521
650
|
for (const item of specItems) {
|
|
@@ -567,7 +696,8 @@ app.ai.action("{{operationId}}", async (context, state, parameter) => {
|
|
|
567
696
|
const result = await path.{{method}}(parameter.path, parameter.body, {
|
|
568
697
|
params: parameter.query,
|
|
569
698
|
});
|
|
570
|
-
const
|
|
699
|
+
const cardName = "{{operationId}}".replace(/[^a-zA-Z0-9]/g, "_");
|
|
700
|
+
const card = generateAdaptiveCard("../adaptiveCards/" + cardName + ".json", result);
|
|
571
701
|
await context.sendActivity({ attachments: [card] });
|
|
572
702
|
} else {
|
|
573
703
|
await context.sendActivity("no result");
|
|
@@ -584,13 +714,44 @@ app.ai.action("{{operationId}}", async (context: TurnContext, state: Application
|
|
|
584
714
|
const result = await path.{{method}}(parameter.path, parameter.body, {
|
|
585
715
|
params: parameter.query,
|
|
586
716
|
});
|
|
587
|
-
const
|
|
717
|
+
const cardName = "{{operationId}}".replace(/[^a-zA-Z0-9]/g, "_");
|
|
718
|
+
const card = generateAdaptiveCard("../adaptiveCards/" + cardName + ".json", result);
|
|
588
719
|
await context.sendActivity({ attachments: [card] });
|
|
589
720
|
} else {
|
|
590
721
|
await context.sendActivity("no result");
|
|
591
722
|
}
|
|
592
723
|
return "result";
|
|
593
724
|
});
|
|
725
|
+
`,
|
|
726
|
+
python: `
|
|
727
|
+
@bot_app.ai.action("{{operationId}}")
|
|
728
|
+
async def {{operationId}}(
|
|
729
|
+
context: ActionTurnContext[Dict[str, Any]],
|
|
730
|
+
state: AppTurnState,
|
|
731
|
+
):
|
|
732
|
+
parameters = context.data
|
|
733
|
+
path = parameters.get("path", {})
|
|
734
|
+
body = parameters.get("body", None)
|
|
735
|
+
query = parameters.get("query", {})
|
|
736
|
+
resp = client.{{operationId}}(**path, json=body, _headers={}, _params=query, _cookies={})
|
|
737
|
+
|
|
738
|
+
if resp.status_code != 200:
|
|
739
|
+
await context.send_activity(resp.reason)
|
|
740
|
+
else:
|
|
741
|
+
card_template_path = os.path.join(current_dir, 'adaptiveCards/{{operationId}}.json')
|
|
742
|
+
with open(card_template_path) as card_template_file:
|
|
743
|
+
adaptive_card_template = card_template_file.read()
|
|
744
|
+
|
|
745
|
+
renderer = AdaptiveCardRenderer(adaptive_card_template)
|
|
746
|
+
|
|
747
|
+
json_resoponse_str = resp.text
|
|
748
|
+
rendered_card_str = renderer.render(json_resoponse_str)
|
|
749
|
+
rendered_card_json = json.loads(rendered_card_str)
|
|
750
|
+
card = CardFactory.adaptive_card(rendered_card_json)
|
|
751
|
+
message = MessageFactory.attachment(card)
|
|
752
|
+
|
|
753
|
+
await context.send_activity(message)
|
|
754
|
+
return "success"
|
|
594
755
|
`,
|
|
595
756
|
};
|
|
596
757
|
const AuthCode = {
|
|
@@ -626,6 +787,24 @@ async function updateCodeForCustomApi(specItems, language, destinationPath, open
|
|
|
626
787
|
.replace("// Replace with action code", actionsCode.join("\n"));
|
|
627
788
|
await fs_extra_1.default.writeFile(indexFilePath, updateIndexFileContent);
|
|
628
789
|
}
|
|
790
|
+
else if (language === constants_1.ProgrammingLanguage.PY) {
|
|
791
|
+
// Update code in bot.py
|
|
792
|
+
const actionsCode = [];
|
|
793
|
+
const codeTemplate = ActionCode["python"];
|
|
794
|
+
for (const item of specItems) {
|
|
795
|
+
const code = codeTemplate
|
|
796
|
+
.replace(/{{operationId}}/g, item.item.operationId)
|
|
797
|
+
.replace(/{{pathUrl}}/g, item.pathUrl)
|
|
798
|
+
.replace(/{{method}}/g, item.method);
|
|
799
|
+
actionsCode.push(code);
|
|
800
|
+
}
|
|
801
|
+
const botFilePath = path_1.default.join(destinationPath, "src", "bot.py");
|
|
802
|
+
const botFileContent = (await fs_extra_1.default.readFile(botFilePath)).toString();
|
|
803
|
+
const updateBotFileContent = botFileContent
|
|
804
|
+
.replace("{{OPENAPI_SPEC_PATH}}", openapiSpecFileName)
|
|
805
|
+
.replace("# Replace with action code", actionsCode.join("\n"));
|
|
806
|
+
await fs_extra_1.default.writeFile(botFilePath, updateBotFileContent);
|
|
807
|
+
}
|
|
629
808
|
}
|
|
630
809
|
async function updateForCustomApi(spec, language, destinationPath, openapiSpecFileName) {
|
|
631
810
|
const chatFolder = path_1.default.join(destinationPath, "src", "prompts", "chat");
|