@microsoft/teamsfx-core 2.0.4-alpha.a99162fe0.0 → 2.0.4-alpha.aa8d93004.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/common/constants.d.ts +1 -0
- package/build/common/constants.d.ts.map +1 -1
- package/build/common/constants.js +1 -0
- package/build/common/constants.js.map +1 -1
- package/build/common/deps-checker/checkerFactory.d.ts +1 -2
- package/build/common/deps-checker/checkerFactory.d.ts.map +1 -1
- package/build/common/deps-checker/checkerFactory.js +2 -2
- package/build/common/deps-checker/checkerFactory.js.map +1 -1
- package/build/common/deps-checker/depsLogger.d.ts +14 -14
- package/build/common/deps-checker/depsLogger.d.ts.map +1 -1
- package/build/common/deps-checker/depsLogger.js +7 -21
- package/build/common/deps-checker/depsLogger.js.map +1 -1
- package/build/common/deps-checker/internal/dotnetChecker.d.ts.map +1 -1
- package/build/common/deps-checker/internal/dotnetChecker.js +40 -35
- package/build/common/deps-checker/internal/dotnetChecker.js.map +1 -1
- package/build/common/deps-checker/internal/nodeChecker.js +3 -3
- package/build/common/deps-checker/internal/nodeChecker.js.map +1 -1
- package/build/common/deps-checker/util/cpUtils.d.ts +1 -1
- package/build/common/deps-checker/util/cpUtils.d.ts.map +1 -1
- package/build/common/deps-checker/util/cpUtils.js +4 -4
- package/build/common/deps-checker/util/cpUtils.js.map +1 -1
- package/build/common/deps-checker/util/progressIndicator.js +2 -2
- package/build/common/deps-checker/util/progressIndicator.js.map +1 -1
- package/build/common/local/localCertificateManager.d.ts.map +1 -1
- package/build/common/local/localCertificateManager.js +3 -0
- package/build/common/local/localCertificateManager.js.map +1 -1
- package/build/common/local/packageJsonHelper.d.ts.map +1 -1
- package/build/common/local/packageJsonHelper.js +1 -0
- package/build/common/local/packageJsonHelper.js.map +1 -1
- package/build/common/local/portChecker.js.map +1 -1
- package/build/common/m365/launchHelper.d.ts +1 -1
- package/build/common/m365/launchHelper.d.ts.map +1 -1
- package/build/common/m365/launchHelper.js +20 -2
- package/build/common/m365/launchHelper.js.map +1 -1
- package/build/common/m365/packageService.d.ts.map +1 -1
- package/build/common/m365/packageService.js +66 -19
- package/build/common/m365/packageService.js.map +1 -1
- package/build/common/projectSettingsHelper.d.ts.map +1 -1
- package/build/common/projectSettingsHelper.js +1 -0
- package/build/common/projectSettingsHelper.js.map +1 -1
- package/build/common/samples.d.ts +7 -1
- package/build/common/samples.d.ts.map +1 -1
- package/build/common/samples.js +48 -21
- package/build/common/samples.js.map +1 -1
- package/build/common/spec-parser/adaptiveCardGenerator.d.ts.map +1 -1
- package/build/common/spec-parser/adaptiveCardGenerator.js +4 -4
- package/build/common/spec-parser/adaptiveCardGenerator.js.map +1 -1
- package/build/common/spec-parser/constants.d.ts +7 -0
- package/build/common/spec-parser/constants.d.ts.map +1 -1
- package/build/common/spec-parser/constants.js +31 -0
- package/build/common/spec-parser/constants.js.map +1 -1
- package/build/common/spec-parser/interfaces.d.ts +19 -6
- package/build/common/spec-parser/interfaces.d.ts.map +1 -1
- package/build/common/spec-parser/interfaces.js +7 -2
- package/build/common/spec-parser/interfaces.js.map +1 -1
- package/build/common/spec-parser/manifestUpdater.d.ts +4 -3
- package/build/common/spec-parser/manifestUpdater.d.ts.map +1 -1
- package/build/common/spec-parser/manifestUpdater.js +84 -33
- package/build/common/spec-parser/manifestUpdater.js.map +1 -1
- package/build/common/spec-parser/specFilter.d.ts +1 -1
- package/build/common/spec-parser/specFilter.d.ts.map +1 -1
- package/build/common/spec-parser/specFilter.js +5 -19
- package/build/common/spec-parser/specFilter.js.map +1 -1
- package/build/common/spec-parser/specParser.d.ts +8 -2
- package/build/common/spec-parser/specParser.d.ts.map +1 -1
- package/build/common/spec-parser/specParser.js +68 -35
- package/build/common/spec-parser/specParser.js.map +1 -1
- package/build/common/spec-parser/utils.d.ts +22 -0
- package/build/common/spec-parser/utils.d.ts.map +1 -1
- package/build/common/spec-parser/utils.js +251 -21
- package/build/common/spec-parser/utils.js.map +1 -1
- package/build/common/telemetry.d.ts +7 -4
- package/build/common/telemetry.d.ts.map +1 -1
- package/build/common/telemetry.js +43 -8
- package/build/common/telemetry.js.map +1 -1
- package/build/common/tools.d.ts.map +1 -1
- package/build/common/tools.js +5 -0
- package/build/common/tools.js.map +1 -1
- package/build/component/configManager/interface.d.ts +0 -1
- package/build/component/configManager/interface.d.ts.map +1 -1
- package/build/component/configManager/lifecycle.d.ts +1 -3
- package/build/component/configManager/lifecycle.d.ts.map +1 -1
- package/build/component/configManager/lifecycle.js +23 -51
- package/build/component/configManager/lifecycle.js.map +1 -1
- 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/constants.d.ts +6 -0
- package/build/component/constants.d.ts.map +1 -1
- package/build/component/constants.js +7 -1
- package/build/component/constants.js.map +1 -1
- package/build/component/coordinator/index.d.ts +6 -5
- package/build/component/coordinator/index.d.ts.map +1 -1
- package/build/component/coordinator/index.js +57 -61
- package/build/component/coordinator/index.js.map +1 -1
- package/build/component/coordinator/summary.d.ts.map +1 -1
- package/build/component/coordinator/summary.js +2 -1
- package/build/component/coordinator/summary.js.map +1 -1
- package/build/component/developerPortalScaffoldUtils.js +3 -3
- package/build/component/developerPortalScaffoldUtils.js.map +1 -1
- package/build/component/driver/aad/create.d.ts +1 -2
- package/build/component/driver/aad/create.d.ts.map +1 -1
- package/build/component/driver/aad/create.js +4 -11
- package/build/component/driver/aad/create.js.map +1 -1
- package/build/component/driver/aad/update.d.ts +1 -2
- package/build/component/driver/aad/update.d.ts.map +1 -1
- package/build/component/driver/aad/update.js +4 -11
- package/build/component/driver/aad/update.js.map +1 -1
- package/build/component/driver/aad/utility/aadAppClient.d.ts +1 -1
- package/build/component/driver/aad/utility/aadAppClient.d.ts.map +1 -1
- package/build/component/driver/aad/utility/aadAppClient.js +37 -4
- package/build/component/driver/aad/utility/aadAppClient.js.map +1 -1
- package/build/component/driver/add/addWebPart.d.ts.map +1 -1
- package/build/component/driver/add/addWebPart.js +9 -0
- package/build/component/driver/add/addWebPart.js.map +1 -1
- package/build/component/driver/arm/deploy.d.ts +1 -3
- package/build/component/driver/arm/deploy.d.ts.map +1 -1
- package/build/component/driver/arm/deploy.js +1 -14
- 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 +8 -0
- package/build/component/driver/arm/deployImpl.js.map +1 -1
- package/build/component/driver/arm/util/bicepChecker.js +7 -6
- package/build/component/driver/arm/util/bicepChecker.js.map +1 -1
- package/build/component/driver/arm/util/handleError.js.map +1 -1
- package/build/component/driver/botAadApp/create.d.ts +2 -1
- package/build/component/driver/botAadApp/create.d.ts.map +1 -1
- package/build/component/driver/botAadApp/create.js +5 -8
- package/build/component/driver/botAadApp/create.js.map +1 -1
- package/build/component/driver/botFramework/createOrUpdateBot.d.ts +1 -0
- package/build/component/driver/botFramework/createOrUpdateBot.d.ts.map +1 -1
- package/build/component/driver/botFramework/createOrUpdateBot.js +4 -10
- package/build/component/driver/botFramework/createOrUpdateBot.js.map +1 -1
- package/build/component/driver/deploy/azure/azureAppServiceDeployDriver.d.ts +0 -2
- package/build/component/driver/deploy/azure/azureAppServiceDeployDriver.d.ts.map +1 -1
- package/build/component/driver/deploy/azure/azureAppServiceDeployDriver.js +0 -10
- package/build/component/driver/deploy/azure/azureAppServiceDeployDriver.js.map +1 -1
- package/build/component/driver/deploy/azure/azureFunctionDeployDriver.d.ts +0 -2
- package/build/component/driver/deploy/azure/azureFunctionDeployDriver.d.ts.map +1 -1
- package/build/component/driver/deploy/azure/azureFunctionDeployDriver.js +0 -10
- package/build/component/driver/deploy/azure/azureFunctionDeployDriver.js.map +1 -1
- package/build/component/driver/deploy/azure/azureStorageDeployDriver.d.ts +0 -2
- package/build/component/driver/deploy/azure/azureStorageDeployDriver.d.ts.map +1 -1
- package/build/component/driver/deploy/azure/azureStorageDeployDriver.js +17 -19
- package/build/component/driver/deploy/azure/azureStorageDeployDriver.js.map +1 -1
- package/build/component/driver/deploy/azure/azureStorageStaticWebsiteConfigDriver.d.ts.map +1 -1
- package/build/component/driver/deploy/azure/azureStorageStaticWebsiteConfigDriver.js +10 -3
- package/build/component/driver/deploy/azure/azureStorageStaticWebsiteConfigDriver.js.map +1 -1
- package/build/component/driver/deploy/azure/impl/AzureZipDeployImpl.d.ts.map +1 -1
- package/build/component/driver/deploy/azure/impl/AzureZipDeployImpl.js +29 -16
- package/build/component/driver/deploy/azure/impl/AzureZipDeployImpl.js.map +1 -1
- package/build/component/driver/deploy/azure/impl/azureDeployImpl.d.ts.map +1 -1
- package/build/component/driver/deploy/azure/impl/azureDeployImpl.js +18 -15
- package/build/component/driver/deploy/azure/impl/azureDeployImpl.js.map +1 -1
- package/build/component/driver/deploy/azure/impl/baseDeployImpl.d.ts.map +1 -1
- package/build/component/driver/deploy/azure/impl/baseDeployImpl.js +4 -4
- package/build/component/driver/deploy/azure/impl/baseDeployImpl.js.map +1 -1
- package/build/component/driver/deploy/spfx/deployDriver.d.ts +1 -0
- package/build/component/driver/deploy/spfx/deployDriver.d.ts.map +1 -1
- package/build/component/driver/deploy/spfx/deployDriver.js +24 -2
- package/build/component/driver/deploy/spfx/deployDriver.js.map +1 -1
- package/build/component/driver/devTool/installDriver.d.ts +1 -0
- package/build/component/driver/devTool/installDriver.d.ts.map +1 -1
- package/build/component/driver/devTool/installDriver.js +34 -12
- package/build/component/driver/devTool/installDriver.js.map +1 -1
- package/build/component/driver/file/createOrUpdateEnvironmentFile.d.ts +1 -0
- package/build/component/driver/file/createOrUpdateEnvironmentFile.d.ts.map +1 -1
- package/build/component/driver/file/createOrUpdateEnvironmentFile.js +10 -16
- package/build/component/driver/file/createOrUpdateEnvironmentFile.js.map +1 -1
- package/build/component/driver/file/createOrUpdateJsonFile.d.ts +1 -0
- package/build/component/driver/file/createOrUpdateJsonFile.d.ts.map +1 -1
- package/build/component/driver/file/createOrUpdateJsonFile.js +3 -9
- package/build/component/driver/file/createOrUpdateJsonFile.js.map +1 -1
- package/build/component/driver/interface/stepDriver.d.ts +2 -7
- package/build/component/driver/interface/stepDriver.d.ts.map +1 -1
- package/build/component/driver/m365/acquire.d.ts +1 -0
- package/build/component/driver/m365/acquire.d.ts.map +1 -1
- package/build/component/driver/m365/acquire.js +4 -10
- package/build/component/driver/m365/acquire.js.map +1 -1
- package/build/component/driver/script/baseBuildDriver.d.ts.map +1 -1
- package/build/component/driver/script/baseBuildDriver.js +1 -0
- package/build/component/driver/script/baseBuildDriver.js.map +1 -1
- package/build/component/driver/script/baseBuildStepDriver.d.ts +0 -2
- package/build/component/driver/script/baseBuildStepDriver.d.ts.map +1 -1
- package/build/component/driver/script/baseBuildStepDriver.js +0 -4
- package/build/component/driver/script/baseBuildStepDriver.js.map +1 -1
- package/build/component/driver/script/dotnetBuildDriver.d.ts +0 -2
- package/build/component/driver/script/dotnetBuildDriver.d.ts.map +1 -1
- package/build/component/driver/script/dotnetBuildDriver.js +0 -9
- package/build/component/driver/script/dotnetBuildDriver.js.map +1 -1
- package/build/component/driver/script/npmBuildDriver.d.ts +0 -2
- package/build/component/driver/script/npmBuildDriver.d.ts.map +1 -1
- package/build/component/driver/script/npmBuildDriver.js +0 -9
- package/build/component/driver/script/npmBuildDriver.js.map +1 -1
- package/build/component/driver/script/npxBuildDriver.d.ts +0 -2
- package/build/component/driver/script/npxBuildDriver.d.ts.map +1 -1
- package/build/component/driver/script/npxBuildDriver.js +0 -9
- package/build/component/driver/script/npxBuildDriver.js.map +1 -1
- package/build/component/driver/script/scriptDriver.d.ts +10 -1
- package/build/component/driver/script/scriptDriver.d.ts.map +1 -1
- package/build/component/driver/script/scriptDriver.js +31 -30
- 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 +8 -8
- package/build/component/driver/teamsApp/appStudio.js.map +1 -1
- package/build/component/driver/teamsApp/clients/appStudioClient.d.ts +5 -5
- package/build/component/driver/teamsApp/clients/appStudioClient.d.ts.map +1 -1
- package/build/component/driver/teamsApp/clients/appStudioClient.js +31 -11
- package/build/component/driver/teamsApp/clients/appStudioClient.js.map +1 -1
- package/build/component/driver/teamsApp/clients/authSvcClient.d.ts.map +1 -1
- package/build/component/driver/teamsApp/clients/authSvcClient.js +2 -0
- package/build/component/driver/teamsApp/clients/authSvcClient.js.map +1 -1
- package/build/component/driver/teamsApp/configure.d.ts +1 -1
- package/build/component/driver/teamsApp/configure.d.ts.map +1 -1
- package/build/component/driver/teamsApp/configure.js +3 -11
- package/build/component/driver/teamsApp/configure.js.map +1 -1
- package/build/component/driver/teamsApp/copyAppPackageToSPFx.d.ts +1 -2
- package/build/component/driver/teamsApp/copyAppPackageToSPFx.d.ts.map +1 -1
- package/build/component/driver/teamsApp/copyAppPackageToSPFx.js +4 -11
- package/build/component/driver/teamsApp/copyAppPackageToSPFx.js.map +1 -1
- package/build/component/driver/teamsApp/create.d.ts +1 -1
- package/build/component/driver/teamsApp/create.d.ts.map +1 -1
- package/build/component/driver/teamsApp/create.js +6 -11
- package/build/component/driver/teamsApp/create.js.map +1 -1
- package/build/component/driver/teamsApp/createAppPackage.d.ts +4 -3
- package/build/component/driver/teamsApp/createAppPackage.d.ts.map +1 -1
- package/build/component/driver/teamsApp/createAppPackage.js +53 -43
- package/build/component/driver/teamsApp/createAppPackage.js.map +1 -1
- package/build/component/driver/teamsApp/errors.d.ts.map +1 -1
- package/build/component/driver/teamsApp/errors.js +2 -0
- package/build/component/driver/teamsApp/errors.js.map +1 -1
- package/build/component/driver/teamsApp/interfaces/appdefinitions/messagingExtension.d.ts +2 -3
- package/build/component/driver/teamsApp/interfaces/appdefinitions/messagingExtension.d.ts.map +1 -1
- package/build/component/driver/teamsApp/interfaces/appdefinitions/messagingExtensionCommand.d.ts +1 -1
- package/build/component/driver/teamsApp/interfaces/appdefinitions/messagingExtensionCommand.d.ts.map +1 -1
- package/build/component/driver/teamsApp/publishAppPackage.d.ts +1 -1
- package/build/component/driver/teamsApp/publishAppPackage.d.ts.map +1 -1
- package/build/component/driver/teamsApp/publishAppPackage.js +5 -13
- package/build/component/driver/teamsApp/publishAppPackage.js.map +1 -1
- package/build/component/driver/teamsApp/utils/ManifestUtils.d.ts +2 -1
- package/build/component/driver/teamsApp/utils/ManifestUtils.d.ts.map +1 -1
- package/build/component/driver/teamsApp/utils/ManifestUtils.js +7 -2
- package/build/component/driver/teamsApp/utils/ManifestUtils.js.map +1 -1
- package/build/component/driver/teamsApp/utils/telemetry.d.ts +1 -0
- package/build/component/driver/teamsApp/utils/telemetry.d.ts.map +1 -1
- package/build/component/driver/teamsApp/utils/telemetry.js +1 -0
- package/build/component/driver/teamsApp/utils/telemetry.js.map +1 -1
- package/build/component/driver/teamsApp/utils/utils.d.ts +2 -2
- package/build/component/driver/teamsApp/utils/utils.d.ts.map +1 -1
- package/build/component/driver/teamsApp/utils/utils.js +22 -10
- package/build/component/driver/teamsApp/utils/utils.js.map +1 -1
- package/build/component/driver/teamsApp/validate.d.ts +1 -1
- package/build/component/driver/teamsApp/validate.d.ts.map +1 -1
- package/build/component/driver/teamsApp/validate.js +18 -13
- package/build/component/driver/teamsApp/validate.js.map +1 -1
- package/build/component/driver/teamsApp/validateAppPackage.d.ts +1 -1
- package/build/component/driver/teamsApp/validateAppPackage.d.ts.map +1 -1
- package/build/component/driver/teamsApp/validateAppPackage.js +3 -11
- package/build/component/driver/teamsApp/validateAppPackage.js.map +1 -1
- package/build/component/feature/collaboration.d.ts.map +1 -1
- package/build/component/feature/collaboration.js +32 -13
- package/build/component/feature/collaboration.js.map +1 -1
- package/build/component/generator/copilotPlugin/generator.d.ts +3 -1
- package/build/component/generator/copilotPlugin/generator.d.ts.map +1 -1
- package/build/component/generator/copilotPlugin/generator.js +42 -16
- package/build/component/generator/copilotPlugin/generator.js.map +1 -1
- package/build/component/generator/copilotPlugin/helper.d.ts +1 -1
- package/build/component/generator/copilotPlugin/helper.d.ts.map +1 -1
- package/build/component/generator/copilotPlugin/helper.js +29 -27
- package/build/component/generator/copilotPlugin/helper.js.map +1 -1
- package/build/component/generator/error.d.ts +6 -0
- package/build/component/generator/error.d.ts.map +1 -1
- package/build/component/generator/error.js +13 -1
- 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 +28 -19
- package/build/component/generator/generator.js.map +1 -1
- package/build/component/generator/generatorAction.d.ts +2 -1
- package/build/component/generator/generatorAction.d.ts.map +1 -1
- package/build/component/generator/generatorAction.js +8 -2
- package/build/component/generator/generatorAction.js.map +1 -1
- package/build/component/generator/officeAddin/generator.js +3 -3
- package/build/component/generator/officeAddin/generator.js.map +1 -1
- package/build/component/generator/officeAddin/helperMethods.d.ts.map +1 -1
- package/build/component/generator/officeAddin/helperMethods.js +6 -2
- package/build/component/generator/officeAddin/helperMethods.js.map +1 -1
- package/build/component/generator/spfx/depsChecker/generatorChecker.d.ts.map +1 -1
- package/build/component/generator/spfx/depsChecker/generatorChecker.js +4 -2
- package/build/component/generator/spfx/depsChecker/generatorChecker.js.map +1 -1
- package/build/component/generator/spfx/depsChecker/yoChecker.d.ts.map +1 -1
- package/build/component/generator/spfx/depsChecker/yoChecker.js +3 -3
- package/build/component/generator/spfx/depsChecker/yoChecker.js.map +1 -1
- package/build/component/generator/spfx/spfxGenerator.d.ts.map +1 -1
- package/build/component/generator/spfx/spfxGenerator.js +2 -2
- package/build/component/generator/spfx/spfxGenerator.js.map +1 -1
- package/build/component/generator/spfx/utils/utils.js +3 -3
- package/build/component/generator/spfx/utils/utils.js.map +1 -1
- package/build/component/generator/utils.d.ts +2 -2
- package/build/component/generator/utils.d.ts.map +1 -1
- package/build/component/generator/utils.js +13 -13
- package/build/component/generator/utils.js.map +1 -1
- package/build/component/messages.d.ts +2 -3
- package/build/component/messages.d.ts.map +1 -1
- package/build/component/messages.js +3 -4
- package/build/component/messages.js.map +1 -1
- package/build/component/middleware/actionExecutionMW.d.ts +2 -2
- package/build/component/middleware/actionExecutionMW.d.ts.map +1 -1
- package/build/component/middleware/envMW.js +1 -1
- package/build/component/middleware/envMW.js.map +1 -1
- package/build/component/provisionUtils.d.ts +3 -3
- package/build/component/provisionUtils.d.ts.map +1 -1
- package/build/component/provisionUtils.js +3 -3
- package/build/component/provisionUtils.js.map +1 -1
- package/build/component/resource/botService/appStudio/appStudioClient.d.ts.map +1 -1
- package/build/component/resource/botService/appStudio/appStudioClient.js +24 -2
- package/build/component/resource/botService/appStudio/appStudioClient.js.map +1 -1
- package/build/component/resource/botService/botRegistration/botFrameworkRegistration.d.ts +2 -2
- package/build/component/resource/botService/botRegistration/botFrameworkRegistration.d.ts.map +1 -1
- package/build/component/resource/botService/botRegistration/botFrameworkRegistration.js +6 -1
- package/build/component/resource/botService/botRegistration/botFrameworkRegistration.js.map +1 -1
- package/build/component/telemetry.js +2 -2
- package/build/component/telemetry.js.map +1 -1
- package/build/component/utils/ResourceGroupHelper.d.ts +2 -2
- package/build/component/utils/ResourceGroupHelper.d.ts.map +1 -1
- package/build/component/utils/ResourceGroupHelper.js +1 -4
- package/build/component/utils/ResourceGroupHelper.js.map +1 -1
- package/build/component/utils/charsetUtils.js +3 -3
- package/build/component/utils/charsetUtils.js.map +1 -1
- package/build/component/utils/common.js +1 -1
- package/build/component/utils/common.js.map +1 -1
- package/build/component/utils/depsChecker/cpUtils.d.ts.map +1 -1
- package/build/component/utils/depsChecker/cpUtils.js +8 -4
- package/build/component/utils/depsChecker/cpUtils.js.map +1 -1
- package/build/component/utils/envUtil.js +2 -2
- package/build/component/utils/envUtil.js.map +1 -1
- package/build/component/utils/teamsFxTelemetryReporter.js +2 -2
- package/build/component/utils/teamsFxTelemetryReporter.js.map +1 -1
- package/build/core/FxCore.d.ts +15 -19
- package/build/core/FxCore.d.ts.map +1 -1
- package/build/core/FxCore.js +800 -60
- package/build/core/FxCore.js.map +1 -1
- package/build/core/globalVars.d.ts +16 -0
- package/build/core/globalVars.d.ts.map +1 -1
- package/build/core/globalVars.js +34 -1
- package/build/core/globalVars.js.map +1 -1
- package/build/core/middleware/concurrentLocker.d.ts.map +1 -1
- package/build/core/middleware/concurrentLocker.js +7 -3
- package/build/core/middleware/concurrentLocker.js.map +1 -1
- package/build/core/middleware/projectMigratorV3.d.ts.map +1 -1
- package/build/core/middleware/projectMigratorV3.js.map +1 -1
- package/build/core/middleware/projectVersionChecker.js +5 -5
- package/build/core/middleware/projectVersionChecker.js.map +1 -1
- package/build/core/middleware/utils/appYmlGenerator.d.ts.map +1 -1
- package/build/core/middleware/utils/appYmlGenerator.js +2 -1
- package/build/core/middleware/utils/appYmlGenerator.js.map +1 -1
- package/build/core/middleware/utils/debug/taskMigrator.d.ts.map +1 -1
- package/build/core/middleware/utils/debug/taskMigrator.js +3 -0
- package/build/core/middleware/utils/debug/taskMigrator.js.map +1 -1
- package/build/core/middleware/utils/v3MigrationUtils.js +1 -1
- package/build/core/middleware/utils/v3MigrationUtils.js.map +1 -1
- package/build/error/common.d.ts +2 -8
- package/build/error/common.d.ts.map +1 -1
- package/build/error/common.js +6 -31
- package/build/error/common.js.map +1 -1
- package/build/index.d.ts +3 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2 -0
- package/build/index.js.map +1 -1
- package/build/question/constants.d.ts +4 -2
- package/build/question/constants.d.ts.map +1 -1
- package/build/question/constants.js +9 -3
- package/build/question/constants.js.map +1 -1
- package/build/question/create.d.ts +11 -8
- package/build/question/create.d.ts.map +1 -1
- package/build/question/create.js +110 -120
- package/build/question/create.js.map +1 -1
- package/build/question/generator.d.ts.map +1 -1
- package/build/question/generator.js +11 -17
- package/build/question/generator.js.map +1 -1
- package/build/question/index.d.ts +1 -0
- package/build/question/index.d.ts.map +1 -1
- package/build/question/index.js +1 -0
- package/build/question/index.js.map +1 -1
- package/build/question/inputs/CreateProjectInputs.d.ts +4 -6
- package/build/question/inputs/CreateProjectInputs.d.ts.map +1 -1
- package/build/question/inputs/SPFxAddWebpartInputs.d.ts +1 -1
- package/build/question/inputs/SPFxAddWebpartInputs.d.ts.map +1 -1
- package/build/question/options/CreateProjectOptions.d.ts.map +1 -1
- package/build/question/options/CreateProjectOptions.js +18 -23
- package/build/question/options/CreateProjectOptions.js.map +1 -1
- package/build/question/options/CreateSampleProjectOptions.js +1 -1
- package/build/question/options/CreateSampleProjectOptions.js.map +1 -1
- package/build/question/options/DeployAadManifestOptions.js +2 -2
- package/build/question/options/DeployAadManifestOptions.js.map +1 -1
- package/build/question/options/PermissionGrantOptions.js +4 -4
- package/build/question/options/PermissionGrantOptions.js.map +1 -1
- package/build/question/options/PermissionListOptions.js +4 -4
- package/build/question/options/PermissionListOptions.js.map +1 -1
- package/build/question/options/PreviewTeamsAppOptions.js +3 -3
- package/build/question/options/PreviewTeamsAppOptions.js.map +1 -1
- package/build/question/options/SPFxAddWebpartOptions.d.ts.map +1 -1
- package/build/question/options/SPFxAddWebpartOptions.js +7 -6
- package/build/question/options/SPFxAddWebpartOptions.js.map +1 -1
- package/build/question/options/SelectTeamsManifestOptions.js +2 -2
- package/build/question/options/SelectTeamsManifestOptions.js.map +1 -1
- package/build/question/options/ValidateTeamsAppOptions.js +4 -4
- package/build/question/options/ValidateTeamsAppOptions.js.map +1 -1
- package/build/question/other.d.ts.map +1 -1
- package/build/question/other.js +13 -8
- package/build/question/other.js.map +1 -1
- package/build/question/questionNames.d.ts +5 -3
- package/build/question/questionNames.d.ts.map +1 -1
- package/build/question/questionNames.js +7 -4
- package/build/question/questionNames.js.map +1 -1
- package/build/ui/validationUtils.d.ts +17 -1
- package/build/ui/validationUtils.d.ts.map +1 -1
- package/build/ui/validationUtils.js +206 -17
- package/build/ui/validationUtils.js.map +1 -1
- package/build/ui/visitor.d.ts.map +1 -1
- package/build/ui/visitor.js +17 -17
- package/build/ui/visitor.js.map +1 -1
- package/package.json +15 -13
- package/resource/package.nls.json +12 -9
- package/templates/fallback/common.zip +0 -0
- package/templates/fallback/csharp.zip +0 -0
- package/templates/fallback/js.zip +0 -0
- package/templates/fallback/ts.zip +0 -0
- package/templates/plugins/resource/aad/auth/V3/Tab/GetUserProfile.razor +1 -2
- package/templates/plugins/resource/aad/auth/tab/csharp/GetUserProfile.razor +1 -2
- package/build/common/samples-config-v3.json +0 -446
- package/build/component/driver/middleware/updateProgress.d.ts +0 -6
- package/build/component/driver/middleware/updateProgress.d.ts.map +0 -1
- package/build/component/driver/middleware/updateProgress.js +0 -15
- package/build/component/driver/middleware/updateProgress.js.map +0 -1
- package/build/core/FxCoreImplementV3.d.ts +0 -51
- package/build/core/FxCoreImplementV3.d.ts.map +0 -1
- package/build/core/FxCoreImplementV3.js +0 -736
- package/build/core/FxCoreImplementV3.js.map +0 -1
|
@@ -6,27 +6,27 @@ exports.specFilter = void 0;
|
|
|
6
6
|
const utils_1 = require("./utils");
|
|
7
7
|
const specParserError_1 = require("./specParserError");
|
|
8
8
|
const interfaces_1 = require("./interfaces");
|
|
9
|
-
const
|
|
10
|
-
function specFilter(filter, unResolveSpec) {
|
|
9
|
+
const constants_1 = require("./constants");
|
|
10
|
+
function specFilter(filter, unResolveSpec, resolvedSpec) {
|
|
11
11
|
try {
|
|
12
12
|
const newSpec = Object.assign({}, unResolveSpec);
|
|
13
13
|
const newPaths = {};
|
|
14
14
|
for (const filterItem of filter) {
|
|
15
15
|
const [method, path] = filterItem.split(" ");
|
|
16
16
|
const methodName = method.toLowerCase();
|
|
17
|
-
if (!utils_1.isSupportedApi(methodName, path,
|
|
17
|
+
if (!utils_1.isSupportedApi(methodName, path, resolvedSpec)) {
|
|
18
18
|
continue;
|
|
19
19
|
}
|
|
20
20
|
if (!newPaths[path]) {
|
|
21
21
|
newPaths[path] = Object.assign({}, unResolveSpec.paths[path]);
|
|
22
|
-
for (const m of
|
|
22
|
+
for (const m of constants_1.ConstantString.AllOperationMethods) {
|
|
23
23
|
delete newPaths[path][m];
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
newPaths[path][methodName] = unResolveSpec.paths[path][methodName];
|
|
27
27
|
// Add the operationId if missing
|
|
28
28
|
if (!newPaths[path][methodName].operationId) {
|
|
29
|
-
newPaths[path][methodName].operationId = `${methodName}${convertPathToCamelCase(path)}`;
|
|
29
|
+
newPaths[path][methodName].operationId = `${methodName}${utils_1.convertPathToCamelCase(path)}`;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
newSpec.paths = newPaths;
|
|
@@ -37,18 +37,4 @@ function specFilter(filter, unResolveSpec) {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
exports.specFilter = specFilter;
|
|
40
|
-
function convertPathToCamelCase(path) {
|
|
41
|
-
const pathSegments = path.split("/");
|
|
42
|
-
const camelCaseSegments = pathSegments.map((segment) => {
|
|
43
|
-
if (segment.startsWith("{")) {
|
|
44
|
-
const name = segment.substring(1, segment.length - 1);
|
|
45
|
-
return name.charAt(0).toUpperCase() + name.slice(1);
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
return segment;
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
const camelCasePath = camelCaseSegments.join("");
|
|
52
|
-
return camelCasePath.charAt(0).toUpperCase() + camelCasePath.slice(1);
|
|
53
|
-
}
|
|
54
40
|
//# sourceMappingURL=specFilter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"specFilter.js","sourceRoot":"","sources":["../../../src/common/spec-parser/specFilter.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,YAAY,CAAC;;;AAGb,
|
|
1
|
+
{"version":3,"file":"specFilter.js","sourceRoot":"","sources":["../../../src/common/spec-parser/specFilter.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,YAAY,CAAC;;;AAGb,mCAAiE;AACjE,uDAAoD;AACpD,6CAAyC;AACzC,2CAA6C;AAE7C,SAAgB,UAAU,CACxB,MAAgB,EAChB,aAAiC,EACjC,YAAgC;IAEhC,IAAI;QACF,MAAM,OAAO,qBAAQ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@apidevtools/swagger-parser";
|
|
2
|
-
import { ValidateResult } from "./interfaces";
|
|
2
|
+
import { GenerateResult, ValidateResult } from "./interfaces";
|
|
3
3
|
/**
|
|
4
4
|
* A class that parses an OpenAPI specification file and provides methods to validate, list, and generate artifacts.
|
|
5
5
|
*/
|
|
@@ -9,6 +9,7 @@ export declare class SpecParser {
|
|
|
9
9
|
private apiMap;
|
|
10
10
|
private spec;
|
|
11
11
|
private unResolveSpec;
|
|
12
|
+
private isSwaggerFile;
|
|
12
13
|
/**
|
|
13
14
|
* Creates a new instance of the SpecParser class.
|
|
14
15
|
* @param path The URL or file path of the OpenAPI specification file. The OpenAPI specification file must have a version of 3.0 or higher.
|
|
@@ -26,6 +27,11 @@ export declare class SpecParser {
|
|
|
26
27
|
* according to copilot plugin spec, only list get and post method without auth
|
|
27
28
|
*/
|
|
28
29
|
list(): Promise<string[]>;
|
|
30
|
+
/**
|
|
31
|
+
* List all the OpenAPI operations in the specification file and return a map of operationId and operation path.
|
|
32
|
+
* @returns A map of operationId and operation path, such as [{'getPetById': 'GET /pets/{petId}'}, {'getUser': 'GET /user/{userId}'}]
|
|
33
|
+
*/
|
|
34
|
+
listOperationMap(): Promise<Map<string, string>>;
|
|
29
35
|
/**
|
|
30
36
|
* Generates and update artifacts from the OpenAPI specification file. Generate Adaptive Cards, update Teams app manifest, and generate a new OpenAPI specification file.
|
|
31
37
|
* @param manifestPath A file path of the Teams app manifest file to update.
|
|
@@ -33,7 +39,7 @@ export declare class SpecParser {
|
|
|
33
39
|
* @param outputSpecPath File path of the new OpenAPI specification file to generate. If not specified or empty, no spec file will be generated.
|
|
34
40
|
* @param adaptiveCardFolder Folder path where the Adaptive Card files will be generated. If not specified or empty, Adaptive Card files will not be generated.
|
|
35
41
|
*/
|
|
36
|
-
generate(manifestPath: string, filter: string[], outputSpecPath: string, adaptiveCardFolder: string, signal?: AbortSignal): Promise<
|
|
42
|
+
generate(manifestPath: string, filter: string[], outputSpecPath: string, adaptiveCardFolder: string, signal?: AbortSignal): Promise<GenerateResult>;
|
|
37
43
|
private loadSpec;
|
|
38
44
|
private getAllSupportedApi;
|
|
39
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"specParser.d.ts","sourceRoot":"","sources":["../../../src/common/spec-parser/specParser.ts"],"names":[],"mappings":"AAKA,OAAO,aAAa,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"specParser.d.ts","sourceRoot":"","sources":["../../../src/common/spec-parser/specParser.ts"],"names":[],"mappings":"AAKA,OAAO,aAAa,MAAM,6BAA6B,CAAC;AAIxD,OAAO,EAIL,cAAc,EACd,cAAc,EAIf,MAAM,cAAc,CAAC;AAUtB;;GAEG;AACH,qBAAa,UAAU;IACrB,SAAgB,QAAQ,EAAE,MAAM,CAAC;IACjC,SAAgB,MAAM,EAAE,aAAa,CAAC;IAEtC,OAAO,CAAC,MAAM,CAA0D;IACxE,OAAO,CAAC,IAAI,CAAiC;IAC7C,OAAO,CAAC,aAAa,CAAiC;IACtD,OAAO,CAAC,aAAa,CAAsB;IAE3C;;;OAGG;gBACS,IAAI,EAAE,MAAM;IAKxB;;;;OAIG;IACG,QAAQ,IAAI,OAAO,CAAC,cAAc,CAAC;IAsFzC;;;;OAIG;IACG,IAAI,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAU/B;;;OAGG;IACG,gBAAgB,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAqBtD;;;;;;OAMG;IACG,QAAQ,CACZ,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,EAAE,EAChB,cAAc,EAAE,MAAM,EACtB,kBAAkB,EAAE,MAAM,EAC1B,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,cAAc,CAAC;YA0EZ,QAAQ;IAetB,OAAO,CAAC,kBAAkB;CAqB3B"}
|
|
@@ -7,6 +7,7 @@ const tslib_1 = require("tslib");
|
|
|
7
7
|
const util = tslib_1.__importStar(require("util"));
|
|
8
8
|
const swagger_parser_1 = tslib_1.__importDefault(require("@apidevtools/swagger-parser"));
|
|
9
9
|
const specParserError_1 = require("./specParserError");
|
|
10
|
+
const swagger2openapi_1 = tslib_1.__importDefault(require("swagger2openapi"));
|
|
10
11
|
const interfaces_1 = require("./interfaces");
|
|
11
12
|
const constants_1 = require("./constants");
|
|
12
13
|
const js_yaml_1 = tslib_1.__importDefault(require("js-yaml"));
|
|
@@ -50,33 +51,15 @@ class SpecParser {
|
|
|
50
51
|
errors,
|
|
51
52
|
};
|
|
52
53
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
content: constants_1.ConstantString.SpecVersionNotSupported,
|
|
58
|
-
data: this.spec.openapi,
|
|
59
|
-
});
|
|
60
|
-
return {
|
|
61
|
-
status: interfaces_1.ValidationStatus.Error,
|
|
62
|
-
warnings,
|
|
63
|
-
errors,
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
// Server information invalid
|
|
67
|
-
if (!this.spec.servers || this.spec.servers.length === 0) {
|
|
68
|
-
errors.push({
|
|
69
|
-
type: interfaces_1.ErrorType.NoServerInformation,
|
|
70
|
-
content: constants_1.ConstantString.NoServerInformation,
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
else if (this.spec.servers.length > 1) {
|
|
74
|
-
errors.push({
|
|
75
|
-
type: interfaces_1.ErrorType.MultipleServerInformation,
|
|
76
|
-
content: constants_1.ConstantString.MultipleServerInformation,
|
|
77
|
-
data: this.spec.servers,
|
|
54
|
+
if (this.isSwaggerFile) {
|
|
55
|
+
warnings.push({
|
|
56
|
+
type: interfaces_1.WarningType.ConvertSwaggerToOpenAPI,
|
|
57
|
+
content: constants_1.ConstantString.ConvertSwaggerToOpenAPI,
|
|
78
58
|
});
|
|
79
59
|
}
|
|
60
|
+
// Server validation
|
|
61
|
+
const serverErrors = utils_1.validateServer(this.spec);
|
|
62
|
+
errors.push(...serverErrors);
|
|
80
63
|
// Remote reference not supported
|
|
81
64
|
const refPaths = this.parser.$refs.paths();
|
|
82
65
|
// refPaths [0] is the current spec file path
|
|
@@ -142,6 +125,31 @@ class SpecParser {
|
|
|
142
125
|
throw new specParserError_1.SpecParserError(err.toString(), interfaces_1.ErrorType.ListFailed);
|
|
143
126
|
}
|
|
144
127
|
}
|
|
128
|
+
/**
|
|
129
|
+
* List all the OpenAPI operations in the specification file and return a map of operationId and operation path.
|
|
130
|
+
* @returns A map of operationId and operation path, such as [{'getPetById': 'GET /pets/{petId}'}, {'getUser': 'GET /user/{userId}'}]
|
|
131
|
+
*/
|
|
132
|
+
async listOperationMap() {
|
|
133
|
+
try {
|
|
134
|
+
await this.loadSpec();
|
|
135
|
+
const apiMap = this.getAllSupportedApi(this.spec);
|
|
136
|
+
const operationMap = new Map();
|
|
137
|
+
for (const key in apiMap) {
|
|
138
|
+
const pathObjectItem = apiMap[key];
|
|
139
|
+
let operationId = pathObjectItem.operationId;
|
|
140
|
+
if (!operationId) {
|
|
141
|
+
const [method, path] = key.split(" ");
|
|
142
|
+
const methodName = method.toLowerCase();
|
|
143
|
+
operationId = `${methodName}${utils_1.convertPathToCamelCase(path)}`;
|
|
144
|
+
}
|
|
145
|
+
operationMap.set(operationId, key);
|
|
146
|
+
}
|
|
147
|
+
return operationMap;
|
|
148
|
+
}
|
|
149
|
+
catch (err) {
|
|
150
|
+
throw new specParserError_1.SpecParserError(err.toString(), interfaces_1.ErrorType.ListOperationMapFailed);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
145
153
|
/**
|
|
146
154
|
* Generates and update artifacts from the OpenAPI specification file. Generate Adaptive Cards, update Teams app manifest, and generate a new OpenAPI specification file.
|
|
147
155
|
* @param manifestPath A file path of the Teams app manifest file to update.
|
|
@@ -150,7 +158,10 @@ class SpecParser {
|
|
|
150
158
|
* @param adaptiveCardFolder Folder path where the Adaptive Card files will be generated. If not specified or empty, Adaptive Card files will not be generated.
|
|
151
159
|
*/
|
|
152
160
|
async generate(manifestPath, filter, outputSpecPath, adaptiveCardFolder, signal) {
|
|
153
|
-
|
|
161
|
+
const result = {
|
|
162
|
+
allSuccess: true,
|
|
163
|
+
warnings: [],
|
|
164
|
+
};
|
|
154
165
|
try {
|
|
155
166
|
if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
|
|
156
167
|
throw new specParserError_1.SpecParserError(constants_1.ConstantString.CancelledMessage, interfaces_1.ErrorType.Cancelled);
|
|
@@ -159,7 +170,7 @@ class SpecParser {
|
|
|
159
170
|
if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
|
|
160
171
|
throw new specParserError_1.SpecParserError(constants_1.ConstantString.CancelledMessage, interfaces_1.ErrorType.Cancelled);
|
|
161
172
|
}
|
|
162
|
-
const newUnResolvedSpec = specFilter_1.specFilter(filter, this.unResolveSpec);
|
|
173
|
+
const newUnResolvedSpec = specFilter_1.specFilter(filter, this.unResolveSpec, this.spec);
|
|
163
174
|
let resultStr;
|
|
164
175
|
if (outputSpecPath.endsWith(".yaml") || outputSpecPath.endsWith(".yml")) {
|
|
165
176
|
resultStr = js_yaml_1.default.dump(newUnResolvedSpec);
|
|
@@ -172,17 +183,32 @@ class SpecParser {
|
|
|
172
183
|
throw new specParserError_1.SpecParserError(constants_1.ConstantString.CancelledMessage, interfaces_1.ErrorType.Cancelled);
|
|
173
184
|
}
|
|
174
185
|
const newSpec = (await this.parser.dereference(newUnResolvedSpec));
|
|
175
|
-
|
|
176
|
-
|
|
186
|
+
for (const url in newSpec.paths) {
|
|
187
|
+
for (const method in newSpec.paths[url]) {
|
|
188
|
+
if (method === constants_1.ConstantString.GetMethod || method === constants_1.ConstantString.PostMethod) {
|
|
189
|
+
const operation = newSpec.paths[url][method];
|
|
190
|
+
try {
|
|
191
|
+
const card = adaptiveCardGenerator_1.generateAdaptiveCard(operation);
|
|
192
|
+
const fileName = path_1.default.join(adaptiveCardFolder, `${operation.operationId}.json`);
|
|
193
|
+
await fs_extra_1.default.outputJSON(fileName, card, { spaces: 2 });
|
|
194
|
+
}
|
|
195
|
+
catch (err) {
|
|
196
|
+
result.allSuccess = false;
|
|
197
|
+
result.warnings.push({
|
|
198
|
+
type: interfaces_1.WarningType.GenerateCardFailed,
|
|
199
|
+
content: err.toString(),
|
|
200
|
+
data: operation.operationId,
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
177
206
|
if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
|
|
178
207
|
throw new specParserError_1.SpecParserError(constants_1.ConstantString.CancelledMessage, interfaces_1.ErrorType.Cancelled);
|
|
179
208
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
const fileName = path_1.default.join(adaptiveCardFolder, `${getOperation.operationId}.json`);
|
|
184
|
-
await fs_extra_1.default.outputJSON(fileName, card, { spaces: 2 });
|
|
185
|
-
}
|
|
209
|
+
const [updatedManifest, warnings] = await manifestUpdater_1.updateManifest(manifestPath, outputSpecPath, adaptiveCardFolder, newSpec);
|
|
210
|
+
await fs_extra_1.default.outputJSON(manifestPath, updatedManifest, { spaces: 2 });
|
|
211
|
+
result.warnings.push(...warnings);
|
|
186
212
|
}
|
|
187
213
|
catch (err) {
|
|
188
214
|
if (err instanceof specParserError_1.SpecParserError) {
|
|
@@ -190,10 +216,17 @@ class SpecParser {
|
|
|
190
216
|
}
|
|
191
217
|
throw new specParserError_1.SpecParserError(err.toString(), interfaces_1.ErrorType.GenerateFailed);
|
|
192
218
|
}
|
|
219
|
+
return result;
|
|
193
220
|
}
|
|
194
221
|
async loadSpec() {
|
|
195
222
|
if (!this.spec) {
|
|
196
223
|
this.unResolveSpec = (await this.parser.parse(this.specPath));
|
|
224
|
+
// Convert swagger 2.0 to openapi 3.0
|
|
225
|
+
if (!this.unResolveSpec.openapi && this.unResolveSpec.swagger === "2.0") {
|
|
226
|
+
const specObj = await swagger2openapi_1.default.convert(this.unResolveSpec, {});
|
|
227
|
+
this.unResolveSpec = specObj.openapi;
|
|
228
|
+
this.isSwaggerFile = true;
|
|
229
|
+
}
|
|
197
230
|
const clonedUnResolveSpec = JSON.parse(JSON.stringify(this.unResolveSpec));
|
|
198
231
|
this.spec = (await this.parser.dereference(clonedUnResolveSpec));
|
|
199
232
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"specParser.js","sourceRoot":"","sources":["../../../src/common/spec-parser/specParser.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,YAAY,CAAC;;;;AAEb,mDAA6B;AAC7B,yFAAwD;AAExD,uDAAoD;AACpD,
|
|
1
|
+
{"version":3,"file":"specParser.js","sourceRoot":"","sources":["../../../src/common/spec-parser/specParser.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,YAAY,CAAC;;;;AAEb,mDAA6B;AAC7B,yFAAwD;AAExD,uDAAoD;AACpD,8EAAwC;AACxC,6CASsB;AACtB,2CAA6C;AAC7C,8DAA6B;AAC7B,gEAA0B;AAC1B,6CAA0C;AAC1C,mCAAiF;AACjF,uDAAmD;AACnD,mEAA+D;AAC/D,wDAAwB;AAExB;;GAEG;AACH,MAAa,UAAU;IASrB;;;OAGG;IACH,YAAY,IAAY;QACtB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,IAAI,wBAAa,EAAE,CAAC;IACpC,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,QAAQ;QACZ,IAAI;YACF,MAAM,MAAM,GAAkB,EAAE,CAAC;YACjC,MAAM,QAAQ,GAAoB,EAAE,CAAC;YACrC,IAAI;gBACF,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACtB,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAK,CAAC,CAAC;aACxC;YAAC,OAAO,CAAC,EAAE;gBACV,iBAAiB;gBACjB,MAAM,CAAC,IAAI,CAAC,E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,CAAC,CAAC;YAC5B,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;gBAC5B,uFAAuF;gBACvF,IAAI,sBAAc,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE;oBACtC,MAAM,eAAe,GAAI,OAAe,CAAC,MAAM,CAA8B,CAAC;oBAC9E,MAAM,CAAC,GAAG,MAAM,CAAC,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,GAAG,eAAe,CAAC;iBAC7D;aACF;SACF;QACD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAhRD,gCAgRC"}
|
|
@@ -1,7 +1,29 @@
|
|
|
1
1
|
import { OpenAPIV3 } from "openapi-types";
|
|
2
|
+
import { CheckParamResult, ErrorResult } from "./interfaces";
|
|
2
3
|
export declare function isYamlSpecFile(specPath: string): Promise<boolean>;
|
|
4
|
+
export declare function checkParameters(paramObject: OpenAPIV3.ParameterObject[]): CheckParamResult;
|
|
5
|
+
export declare function checkPostBody(schema: OpenAPIV3.SchemaObject): CheckParamResult;
|
|
6
|
+
/**
|
|
7
|
+
* Checks if the given API is supported.
|
|
8
|
+
* @param {string} method - The HTTP method of the API.
|
|
9
|
+
* @param {string} path - The path of the API.
|
|
10
|
+
* @param {OpenAPIV3.Document} spec - The OpenAPI specification document.
|
|
11
|
+
* @returns {boolean} - Returns true if the API is supported, false otherwise.
|
|
12
|
+
* @description The following APIs are supported:
|
|
13
|
+
* 1. only support Get/Post operation without auth property
|
|
14
|
+
* 2. parameter inside query or path only support string, number, boolean and integer
|
|
15
|
+
* 3. parameter inside post body only support string, number, boolean, integer and object
|
|
16
|
+
* 4. request body + required parameters <= 1
|
|
17
|
+
* 5. response body should be “application/json” and not empty, and response code should be 20X
|
|
18
|
+
* 6. only support request body with “application/json” content type
|
|
19
|
+
*/
|
|
3
20
|
export declare function isSupportedApi(method: string, path: string, spec: OpenAPIV3.Document): boolean;
|
|
4
21
|
export declare function updateFirstLetter(str: string): string;
|
|
5
22
|
export declare function getRelativePath(from: string, to: string): string;
|
|
6
23
|
export declare function getResponseJson(operationObject: OpenAPIV3.OperationObject | undefined): OpenAPIV3.MediaTypeObject;
|
|
24
|
+
export declare function convertPathToCamelCase(path: string): string;
|
|
25
|
+
export declare function getUrlProtocol(urlString: string): string | undefined;
|
|
26
|
+
export declare function resolveServerUrl(url: string): string;
|
|
27
|
+
export declare function checkServerUrl(servers: OpenAPIV3.ServerObject[]): ErrorResult[];
|
|
28
|
+
export declare function validateServer(spec: OpenAPIV3.Document): ErrorResult[];
|
|
7
29
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/common/spec-parser/utils.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG1C,wBAAsB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAiBvE;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,QAAQ,GAAG,OAAO,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/common/spec-parser/utils.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG1C,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAa,MAAM,cAAc,CAAC;AAGxE,wBAAsB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAiBvE;AAED,wBAAgB,eAAe,CAAC,WAAW,EAAE,SAAS,CAAC,eAAe,EAAE,GAAG,gBAAgB,CA2C1F;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,CAAC,YAAY,GAAG,gBAAgB,CAoC9E;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,QAAQ,GAAG,OAAO,CA0D9F;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAGhE;AAED,wBAAgB,eAAe,CAC7B,eAAe,EAAE,SAAS,CAAC,eAAe,GAAG,SAAS,GACrD,SAAS,CAAC,eAAe,CAY3B;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAU3D;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAOpE;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAepD;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,SAAS,CAAC,YAAY,EAAE,GAAG,WAAW,EAAE,CAiC/E;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,CAAC,QAAQ,GAAG,WAAW,EAAE,CA2CtE"}
|
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
3
|
"use strict";
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.getResponseJson = exports.getRelativePath = exports.updateFirstLetter = exports.isSupportedApi = exports.isYamlSpecFile = void 0;
|
|
5
|
+
exports.validateServer = exports.checkServerUrl = exports.resolveServerUrl = exports.getUrlProtocol = exports.convertPathToCamelCase = exports.getResponseJson = exports.getRelativePath = exports.updateFirstLetter = exports.isSupportedApi = exports.checkPostBody = exports.checkParameters = exports.isYamlSpecFile = void 0;
|
|
6
6
|
const tslib_1 = require("tslib");
|
|
7
7
|
const axios_1 = tslib_1.__importDefault(require("axios"));
|
|
8
8
|
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
9
9
|
const constants_1 = require("./constants");
|
|
10
10
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
11
|
+
const util = tslib_1.__importStar(require("util"));
|
|
12
|
+
const interfaces_1 = require("./interfaces");
|
|
13
|
+
const util_1 = require("util");
|
|
11
14
|
async function isYamlSpecFile(specPath) {
|
|
12
15
|
if (specPath.endsWith(".yaml") || specPath.endsWith(".yml")) {
|
|
13
16
|
return true;
|
|
@@ -28,30 +31,140 @@ async function isYamlSpecFile(specPath) {
|
|
|
28
31
|
}
|
|
29
32
|
}
|
|
30
33
|
exports.isYamlSpecFile = isYamlSpecFile;
|
|
34
|
+
function checkParameters(paramObject) {
|
|
35
|
+
const paramResult = {
|
|
36
|
+
requiredNum: 0,
|
|
37
|
+
optionalNum: 0,
|
|
38
|
+
isValid: true,
|
|
39
|
+
};
|
|
40
|
+
if (!paramObject) {
|
|
41
|
+
return paramResult;
|
|
42
|
+
}
|
|
43
|
+
for (let i = 0; i < paramObject.length; i++) {
|
|
44
|
+
const param = paramObject[i];
|
|
45
|
+
if (param.in === "header" || param.in === "cookie") {
|
|
46
|
+
if (param.required) {
|
|
47
|
+
paramResult.isValid = false;
|
|
48
|
+
}
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
const schema = param.schema;
|
|
52
|
+
if (schema.type !== "boolean" &&
|
|
53
|
+
schema.type !== "string" &&
|
|
54
|
+
schema.type !== "number" &&
|
|
55
|
+
schema.type !== "integer") {
|
|
56
|
+
if (param.required) {
|
|
57
|
+
paramResult.isValid = false;
|
|
58
|
+
}
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
if (param.in === "query" || param.in === "path") {
|
|
62
|
+
if (param.required) {
|
|
63
|
+
paramResult.requiredNum = paramResult.requiredNum + 1;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
paramResult.optionalNum = paramResult.optionalNum + 1;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return paramResult;
|
|
71
|
+
}
|
|
72
|
+
exports.checkParameters = checkParameters;
|
|
73
|
+
function checkPostBody(schema) {
|
|
74
|
+
const paramResult = {
|
|
75
|
+
requiredNum: 0,
|
|
76
|
+
optionalNum: 0,
|
|
77
|
+
isValid: true,
|
|
78
|
+
};
|
|
79
|
+
if (Object.keys(schema).length === 0) {
|
|
80
|
+
return paramResult;
|
|
81
|
+
}
|
|
82
|
+
if (schema.type === "string" ||
|
|
83
|
+
schema.type === "integer" ||
|
|
84
|
+
schema.type === "boolean" ||
|
|
85
|
+
schema.type === "number") {
|
|
86
|
+
if (schema.required) {
|
|
87
|
+
paramResult.requiredNum = paramResult.requiredNum + 1;
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
paramResult.optionalNum = paramResult.optionalNum + 1;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
else if (schema.type === "object") {
|
|
94
|
+
const { properties } = schema;
|
|
95
|
+
for (const property in properties) {
|
|
96
|
+
const result = checkPostBody(properties[property]);
|
|
97
|
+
paramResult.requiredNum += result.requiredNum;
|
|
98
|
+
paramResult.optionalNum += result.optionalNum;
|
|
99
|
+
paramResult.isValid = paramResult.isValid && result.isValid;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
if (schema.required) {
|
|
104
|
+
paramResult.isValid = false;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return paramResult;
|
|
108
|
+
}
|
|
109
|
+
exports.checkPostBody = checkPostBody;
|
|
110
|
+
/**
|
|
111
|
+
* Checks if the given API is supported.
|
|
112
|
+
* @param {string} method - The HTTP method of the API.
|
|
113
|
+
* @param {string} path - The path of the API.
|
|
114
|
+
* @param {OpenAPIV3.Document} spec - The OpenAPI specification document.
|
|
115
|
+
* @returns {boolean} - Returns true if the API is supported, false otherwise.
|
|
116
|
+
* @description The following APIs are supported:
|
|
117
|
+
* 1. only support Get/Post operation without auth property
|
|
118
|
+
* 2. parameter inside query or path only support string, number, boolean and integer
|
|
119
|
+
* 3. parameter inside post body only support string, number, boolean, integer and object
|
|
120
|
+
* 4. request body + required parameters <= 1
|
|
121
|
+
* 5. response body should be “application/json” and not empty, and response code should be 20X
|
|
122
|
+
* 6. only support request body with “application/json” content type
|
|
123
|
+
*/
|
|
31
124
|
function isSupportedApi(method, path, spec) {
|
|
32
125
|
var _a;
|
|
33
126
|
const pathObj = spec.paths[path];
|
|
34
127
|
method = method.toLocaleLowerCase();
|
|
35
128
|
if (pathObj) {
|
|
36
|
-
if (method === constants_1.ConstantString.
|
|
129
|
+
if ((method === constants_1.ConstantString.PostMethod || method === constants_1.ConstantString.GetMethod) &&
|
|
130
|
+
pathObj[method] &&
|
|
131
|
+
!((_a = pathObj[method]) === null || _a === void 0 ? void 0 : _a.security)) {
|
|
37
132
|
const operationObject = pathObj[method];
|
|
38
133
|
const paramObject = operationObject.parameters;
|
|
39
|
-
|
|
40
|
-
|
|
134
|
+
const requestBody = operationObject.requestBody;
|
|
135
|
+
const requestJsonBody = requestBody === null || requestBody === void 0 ? void 0 : requestBody.content["application/json"];
|
|
136
|
+
const responseJson = getResponseJson(operationObject);
|
|
137
|
+
if (Object.keys(responseJson).length === 0) {
|
|
138
|
+
return false;
|
|
41
139
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
140
|
+
let requestBodyParamResult = {
|
|
141
|
+
requiredNum: 0,
|
|
142
|
+
optionalNum: 0,
|
|
143
|
+
isValid: true,
|
|
144
|
+
};
|
|
145
|
+
if (requestJsonBody) {
|
|
146
|
+
const requestBodySchema = requestJsonBody.schema;
|
|
147
|
+
requestBodyParamResult = checkPostBody(requestBodySchema);
|
|
148
|
+
}
|
|
149
|
+
if (!requestBodyParamResult.isValid) {
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
const paramResult = checkParameters(paramObject);
|
|
153
|
+
if (!paramResult.isValid) {
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
if (requestBodyParamResult.requiredNum + paramResult.requiredNum > 1) {
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
else if (requestBodyParamResult.requiredNum +
|
|
160
|
+
requestBodyParamResult.optionalNum +
|
|
161
|
+
paramResult.requiredNum +
|
|
162
|
+
paramResult.optionalNum ===
|
|
163
|
+
0) {
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
return true;
|
|
55
168
|
}
|
|
56
169
|
}
|
|
57
170
|
}
|
|
@@ -68,12 +181,129 @@ function getRelativePath(from, to) {
|
|
|
68
181
|
}
|
|
69
182
|
exports.getRelativePath = getRelativePath;
|
|
70
183
|
function getResponseJson(operationObject) {
|
|
71
|
-
var _a, _b
|
|
72
|
-
let json =
|
|
73
|
-
|
|
74
|
-
|
|
184
|
+
var _a, _b;
|
|
185
|
+
let json = {};
|
|
186
|
+
for (const code of constants_1.ConstantString.ResponseCodeFor20X) {
|
|
187
|
+
const responseObject = (_a = operationObject === null || operationObject === void 0 ? void 0 : operationObject.responses) === null || _a === void 0 ? void 0 : _a[code];
|
|
188
|
+
if ((_b = responseObject === null || responseObject === void 0 ? void 0 : responseObject.content) === null || _b === void 0 ? void 0 : _b["application/json"]) {
|
|
189
|
+
json = responseObject.content["application/json"];
|
|
190
|
+
break;
|
|
191
|
+
}
|
|
75
192
|
}
|
|
76
193
|
return json;
|
|
77
194
|
}
|
|
78
195
|
exports.getResponseJson = getResponseJson;
|
|
196
|
+
function convertPathToCamelCase(path) {
|
|
197
|
+
const pathSegments = path.split("/");
|
|
198
|
+
const camelCaseSegments = pathSegments.map((segment) => {
|
|
199
|
+
if (segment.startsWith("{")) {
|
|
200
|
+
segment = segment.substring(1, segment.length - 1);
|
|
201
|
+
}
|
|
202
|
+
return segment.charAt(0).toUpperCase() + segment.slice(1);
|
|
203
|
+
});
|
|
204
|
+
const camelCasePath = camelCaseSegments.join("");
|
|
205
|
+
return camelCasePath;
|
|
206
|
+
}
|
|
207
|
+
exports.convertPathToCamelCase = convertPathToCamelCase;
|
|
208
|
+
function getUrlProtocol(urlString) {
|
|
209
|
+
try {
|
|
210
|
+
const url = new URL(urlString);
|
|
211
|
+
return url.protocol;
|
|
212
|
+
}
|
|
213
|
+
catch (err) {
|
|
214
|
+
return undefined;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
exports.getUrlProtocol = getUrlProtocol;
|
|
218
|
+
function resolveServerUrl(url) {
|
|
219
|
+
const placeHolderReg = /\${{\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*}}/g;
|
|
220
|
+
let matches = placeHolderReg.exec(url);
|
|
221
|
+
let newUrl = url;
|
|
222
|
+
while (matches != null) {
|
|
223
|
+
const envVar = matches[1];
|
|
224
|
+
const envVal = process.env[envVar];
|
|
225
|
+
if (!envVal) {
|
|
226
|
+
throw new Error(util_1.format(constants_1.ConstantString.ResolveServerUrlFailed, envVar));
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
newUrl = newUrl.replace(matches[0], envVal);
|
|
230
|
+
}
|
|
231
|
+
matches = placeHolderReg.exec(url);
|
|
232
|
+
}
|
|
233
|
+
return newUrl;
|
|
234
|
+
}
|
|
235
|
+
exports.resolveServerUrl = resolveServerUrl;
|
|
236
|
+
function checkServerUrl(servers) {
|
|
237
|
+
const errors = [];
|
|
238
|
+
let serverUrl;
|
|
239
|
+
try {
|
|
240
|
+
serverUrl = resolveServerUrl(servers[0].url);
|
|
241
|
+
}
|
|
242
|
+
catch (err) {
|
|
243
|
+
errors.push({
|
|
244
|
+
type: interfaces_1.ErrorType.ResolveServerUrlFailed,
|
|
245
|
+
content: err.message,
|
|
246
|
+
data: servers,
|
|
247
|
+
});
|
|
248
|
+
return errors;
|
|
249
|
+
}
|
|
250
|
+
const protocol = getUrlProtocol(serverUrl);
|
|
251
|
+
if (!protocol) {
|
|
252
|
+
// Relative server url is not supported
|
|
253
|
+
errors.push({
|
|
254
|
+
type: interfaces_1.ErrorType.RelativeServerUrlNotSupported,
|
|
255
|
+
content: constants_1.ConstantString.RelativeServerUrlNotSupported,
|
|
256
|
+
data: servers,
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
else if (protocol !== "https:") {
|
|
260
|
+
// Http server url is not supported
|
|
261
|
+
errors.push({
|
|
262
|
+
type: interfaces_1.ErrorType.UrlProtocolNotSupported,
|
|
263
|
+
content: util.format(constants_1.ConstantString.UrlProtocolNotSupported, protocol),
|
|
264
|
+
data: servers,
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
return errors;
|
|
268
|
+
}
|
|
269
|
+
exports.checkServerUrl = checkServerUrl;
|
|
270
|
+
function validateServer(spec) {
|
|
271
|
+
const errors = [];
|
|
272
|
+
let hasTopLevelServers = false;
|
|
273
|
+
let hasPathLevelServers = false;
|
|
274
|
+
let hasOperationLevelServers = false;
|
|
275
|
+
if (spec.servers && spec.servers.length >= 1) {
|
|
276
|
+
hasTopLevelServers = true;
|
|
277
|
+
// for multiple server, we only use the first url
|
|
278
|
+
const serverErrors = checkServerUrl(spec.servers);
|
|
279
|
+
errors.push(...serverErrors);
|
|
280
|
+
}
|
|
281
|
+
const paths = spec.paths;
|
|
282
|
+
for (const path in paths) {
|
|
283
|
+
const methods = paths[path];
|
|
284
|
+
if ((methods === null || methods === void 0 ? void 0 : methods.servers) && methods.servers.length >= 1) {
|
|
285
|
+
hasPathLevelServers = true;
|
|
286
|
+
const serverErrors = checkServerUrl(methods.servers);
|
|
287
|
+
errors.push(...serverErrors);
|
|
288
|
+
}
|
|
289
|
+
for (const method in methods) {
|
|
290
|
+
const operationObject = methods[method];
|
|
291
|
+
if (isSupportedApi(method, path, spec)) {
|
|
292
|
+
if ((operationObject === null || operationObject === void 0 ? void 0 : operationObject.servers) && operationObject.servers.length >= 1) {
|
|
293
|
+
hasOperationLevelServers = true;
|
|
294
|
+
const serverErrors = checkServerUrl(operationObject.servers);
|
|
295
|
+
errors.push(...serverErrors);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
if (!hasTopLevelServers && !hasPathLevelServers && !hasOperationLevelServers) {
|
|
301
|
+
errors.push({
|
|
302
|
+
type: interfaces_1.ErrorType.NoServerInformation,
|
|
303
|
+
content: constants_1.ConstantString.NoServerInformation,
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
return errors;
|
|
307
|
+
}
|
|
308
|
+
exports.validateServer = validateServer;
|
|
79
309
|
//# sourceMappingURL=utils.js.map
|