@microsoft/teamsfx-core 2.0.6 → 2.0.7-alpha.1935862db.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.map +1 -1
- package/build/common/deps-checker/checkerFactory.js +3 -0
- package/build/common/deps-checker/checkerFactory.js.map +1 -1
- package/build/common/deps-checker/constant/telemetry.d.ts +1 -0
- package/build/common/deps-checker/constant/telemetry.d.ts.map +1 -1
- package/build/common/deps-checker/constant/telemetry.js +1 -0
- package/build/common/deps-checker/constant/telemetry.js.map +1 -1
- package/build/common/deps-checker/coreDepsLoggerAdapter.d.ts +17 -0
- package/build/common/deps-checker/coreDepsLoggerAdapter.d.ts.map +1 -0
- package/build/common/deps-checker/coreDepsLoggerAdapter.js +47 -0
- package/build/common/deps-checker/coreDepsLoggerAdapter.js.map +1 -0
- package/build/common/deps-checker/coreDepsTelemetryAdapter.d.ts +16 -0
- package/build/common/deps-checker/coreDepsTelemetryAdapter.d.ts.map +1 -0
- package/build/common/deps-checker/coreDepsTelemetryAdapter.js +53 -0
- package/build/common/deps-checker/coreDepsTelemetryAdapter.js.map +1 -0
- package/build/common/deps-checker/depsChecker.d.ts +6 -1
- package/build/common/deps-checker/depsChecker.d.ts.map +1 -1
- package/build/common/deps-checker/depsChecker.js +6 -1
- package/build/common/deps-checker/depsChecker.js.map +1 -1
- package/build/common/deps-checker/index.d.ts +2 -0
- package/build/common/deps-checker/index.d.ts.map +1 -1
- package/build/common/deps-checker/index.js +2 -0
- package/build/common/deps-checker/index.js.map +1 -1
- package/build/common/deps-checker/internal/testToolChecker.d.ts +14 -3
- package/build/common/deps-checker/internal/testToolChecker.d.ts.map +1 -1
- package/build/common/deps-checker/internal/testToolChecker.js +178 -75
- package/build/common/deps-checker/internal/testToolChecker.js.map +1 -1
- package/build/common/deps-checker/internal/vxTestAppChecker.d.ts.map +1 -1
- package/build/common/deps-checker/internal/vxTestAppChecker.js +3 -45
- package/build/common/deps-checker/internal/vxTestAppChecker.js.map +1 -1
- package/build/common/deps-checker/util/downloadHelper.d.ts +15 -0
- package/build/common/deps-checker/util/downloadHelper.d.ts.map +1 -0
- package/build/common/deps-checker/util/downloadHelper.js +59 -0
- package/build/common/deps-checker/util/downloadHelper.js.map +1 -0
- package/build/common/featureFlags.d.ts +1 -2
- package/build/common/featureFlags.d.ts.map +1 -1
- package/build/common/featureFlags.js +5 -9
- package/build/common/featureFlags.js.map +1 -1
- package/build/common/local/packageJsonHelper.d.ts +0 -1
- package/build/common/local/packageJsonHelper.d.ts.map +1 -1
- package/build/common/local/packageJsonHelper.js +1 -29
- package/build/common/local/packageJsonHelper.js.map +1 -1
- package/build/common/m365/packageService.d.ts +2 -2
- package/build/common/m365/packageService.d.ts.map +1 -1
- package/build/common/m365/packageService.js +43 -19
- package/build/common/m365/packageService.js.map +1 -1
- package/build/common/projectTypeChecker.d.ts +38 -0
- package/build/common/projectTypeChecker.d.ts.map +1 -0
- package/build/common/projectTypeChecker.js +217 -0
- package/build/common/projectTypeChecker.js.map +1 -0
- package/build/common/samples.d.ts +7 -5
- package/build/common/samples.d.ts.map +1 -1
- package/build/common/samples.js +65 -30
- package/build/common/samples.js.map +1 -1
- package/build/common/spec-parser/interfaces.d.ts +14 -1
- package/build/common/spec-parser/interfaces.d.ts.map +1 -1
- package/build/common/spec-parser/manifestUpdater.d.ts +2 -2
- package/build/common/spec-parser/manifestUpdater.d.ts.map +1 -1
- package/build/common/spec-parser/manifestUpdater.js +33 -19
- 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 +2 -2
- package/build/common/spec-parser/specFilter.js.map +1 -1
- package/build/common/spec-parser/specParser.browser.d.ts.map +1 -1
- package/build/common/spec-parser/specParser.browser.js +5 -3
- package/build/common/spec-parser/specParser.browser.js.map +1 -1
- package/build/common/spec-parser/specParser.d.ts.map +1 -1
- package/build/common/spec-parser/specParser.js +36 -37
- package/build/common/spec-parser/specParser.js.map +1 -1
- package/build/common/spec-parser/utils.d.ts +12 -8
- package/build/common/spec-parser/utils.d.ts.map +1 -1
- package/build/common/spec-parser/utils.js +97 -34
- package/build/common/spec-parser/utils.js.map +1 -1
- package/build/common/telemetry.d.ts +17 -1
- package/build/common/telemetry.d.ts.map +1 -1
- package/build/common/telemetry.js +35 -1
- package/build/common/telemetry.js.map +1 -1
- package/build/common/templates-config.json +1 -1
- package/build/common/tools.d.ts +1 -1
- package/build/common/tools.d.ts.map +1 -1
- package/build/common/tools.js +2 -2
- package/build/common/tools.js.map +1 -1
- package/build/component/configManager/lifecycle.d.ts.map +1 -1
- package/build/component/configManager/lifecycle.js +1 -1
- package/build/component/configManager/lifecycle.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 +2 -0
- package/build/component/constant/commonConstant.js.map +1 -1
- package/build/component/coordinator/index.d.ts +2 -1
- package/build/component/coordinator/index.d.ts.map +1 -1
- package/build/component/coordinator/index.js +12 -2
- package/build/component/coordinator/index.js.map +1 -1
- package/build/component/driver/aad/error/aadManifestError.d.ts +9 -0
- package/build/component/driver/aad/error/aadManifestError.d.ts.map +1 -1
- package/build/component/driver/aad/error/aadManifestError.js +37 -1
- package/build/component/driver/aad/error/aadManifestError.js.map +1 -1
- package/build/component/driver/aad/utility/aadAppClient.d.ts.map +1 -1
- package/build/component/driver/aad/utility/aadAppClient.js +9 -6
- package/build/component/driver/aad/utility/aadAppClient.js.map +1 -1
- package/build/component/driver/aad/utility/aadManifestHelper.d.ts.map +1 -1
- package/build/component/driver/aad/utility/aadManifestHelper.js +6 -0
- package/build/component/driver/aad/utility/aadManifestHelper.js.map +1 -1
- package/build/component/driver/aad/utility/constants.d.ts +1 -0
- package/build/component/driver/aad/utility/constants.d.ts.map +1 -1
- package/build/component/driver/aad/utility/constants.js +1 -0
- package/build/component/driver/aad/utility/constants.js.map +1 -1
- package/build/component/driver/apiKey/create.d.ts.map +1 -1
- package/build/component/driver/apiKey/create.js +7 -3
- package/build/component/driver/apiKey/create.js.map +1 -1
- package/build/component/driver/deploy/azure/azureFunctionDeployDriver.d.ts.map +1 -1
- package/build/component/driver/deploy/azure/azureFunctionDeployDriver.js.map +1 -1
- package/build/component/driver/deploy/azure/azureStaticWebAppGetDeploymentTokenDriver.d.ts +12 -0
- package/build/component/driver/deploy/azure/azureStaticWebAppGetDeploymentTokenDriver.d.ts.map +1 -0
- package/build/component/driver/deploy/azure/azureStaticWebAppGetDeploymentTokenDriver.js +71 -0
- package/build/component/driver/deploy/azure/azureStaticWebAppGetDeploymentTokenDriver.js.map +1 -0
- package/build/component/driver/deploy/azure/impl/AzureZipDeployImpl.d.ts +3 -2
- package/build/component/driver/deploy/azure/impl/AzureZipDeployImpl.d.ts.map +1 -1
- package/build/component/driver/deploy/azure/impl/AzureZipDeployImpl.js +5 -1
- package/build/component/driver/deploy/azure/impl/AzureZipDeployImpl.js.map +1 -1
- package/build/component/driver/deploy/azure/impl/azureDeployImpl.d.ts +5 -0
- package/build/component/driver/deploy/azure/impl/azureDeployImpl.d.ts.map +1 -1
- package/build/component/driver/deploy/azure/impl/azureDeployImpl.js +21 -0
- package/build/component/driver/deploy/azure/impl/azureDeployImpl.js.map +1 -1
- package/build/component/driver/devTool/installDriver.d.ts +2 -1
- package/build/component/driver/devTool/installDriver.d.ts.map +1 -1
- package/build/component/driver/devTool/installDriver.js +5 -2
- package/build/component/driver/devTool/installDriver.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/interface/provisionArgs.d.ts +3 -0
- package/build/component/driver/interface/provisionArgs.d.ts.map +1 -1
- package/build/component/driver/interface/stepDriver.d.ts +2 -1
- package/build/component/driver/interface/stepDriver.d.ts.map +1 -1
- package/build/component/driver/middleware/addSWADeployTelemetry.d.ts +7 -0
- package/build/component/driver/middleware/addSWADeployTelemetry.d.ts.map +1 -0
- package/build/component/driver/middleware/addSWADeployTelemetry.js +52 -0
- package/build/component/driver/middleware/addSWADeployTelemetry.js.map +1 -0
- package/build/component/driver/middleware/addStartAndEndTelemetry.d.ts +3 -0
- package/build/component/driver/middleware/addStartAndEndTelemetry.d.ts.map +1 -1
- package/build/component/driver/middleware/addStartAndEndTelemetry.js +2 -1
- package/build/component/driver/middleware/addStartAndEndTelemetry.js.map +1 -1
- package/build/component/driver/script/npxBuildDriver.d.ts.map +1 -1
- package/build/component/driver/script/npxBuildDriver.js +5 -1
- package/build/component/driver/script/npxBuildDriver.js.map +1 -1
- package/build/component/driver/script/scriptDriver.d.ts +12 -8
- package/build/component/driver/script/scriptDriver.d.ts.map +1 -1
- package/build/component/driver/script/scriptDriver.js +54 -36
- package/build/component/driver/script/scriptDriver.js.map +1 -1
- package/build/component/driver/teamsApp/clients/appStudioClient.d.ts.map +1 -1
- package/build/component/driver/teamsApp/clients/appStudioClient.js +52 -33
- package/build/component/driver/teamsApp/clients/appStudioClient.js.map +1 -1
- package/build/component/driver/teamsApp/utils/telemetry.d.ts +7 -0
- package/build/component/driver/teamsApp/utils/telemetry.d.ts.map +1 -1
- package/build/component/driver/teamsApp/utils/telemetry.js +3 -2
- package/build/component/driver/teamsApp/utils/telemetry.js.map +1 -1
- package/build/component/driver/teamsApp/validateAppPackage.d.ts.map +1 -1
- package/build/component/driver/teamsApp/validateAppPackage.js +14 -8
- package/build/component/driver/teamsApp/validateAppPackage.js.map +1 -1
- package/build/component/generator/copilotPlugin/generator.d.ts.map +1 -1
- package/build/component/generator/copilotPlugin/generator.js +5 -4
- package/build/component/generator/copilotPlugin/generator.js.map +1 -1
- package/build/component/generator/copilotPlugin/helper.d.ts.map +1 -1
- package/build/component/generator/copilotPlugin/helper.js +6 -2
- package/build/component/generator/copilotPlugin/helper.js.map +1 -1
- package/build/component/generator/error.d.ts +5 -8
- package/build/component/generator/error.d.ts.map +1 -1
- package/build/component/generator/error.js +16 -16
- package/build/component/generator/error.js.map +1 -1
- package/build/component/generator/generator.d.ts +1 -1
- package/build/component/generator/generator.d.ts.map +1 -1
- package/build/component/generator/generator.js +16 -25
- package/build/component/generator/generator.js.map +1 -1
- package/build/component/generator/generatorAction.d.ts +4 -1
- package/build/component/generator/generatorAction.d.ts.map +1 -1
- package/build/component/generator/generatorAction.js +24 -6
- package/build/component/generator/generatorAction.js.map +1 -1
- package/build/component/generator/officeAddin/helperMethods.js +21 -20
- package/build/component/generator/officeAddin/helperMethods.js.map +1 -1
- package/build/component/generator/spfx/depsChecker/dependencyChecker.d.ts +1 -1
- package/build/component/generator/spfx/depsChecker/dependencyChecker.d.ts.map +1 -1
- package/build/component/generator/spfx/depsChecker/generatorChecker.d.ts +4 -3
- package/build/component/generator/spfx/depsChecker/generatorChecker.d.ts.map +1 -1
- package/build/component/generator/spfx/depsChecker/generatorChecker.js +30 -20
- package/build/component/generator/spfx/depsChecker/generatorChecker.js.map +1 -1
- package/build/component/generator/spfx/depsChecker/yoChecker.d.ts +3 -2
- package/build/component/generator/spfx/depsChecker/yoChecker.d.ts.map +1 -1
- package/build/component/generator/spfx/depsChecker/yoChecker.js +27 -18
- package/build/component/generator/spfx/depsChecker/yoChecker.js.map +1 -1
- package/build/component/generator/spfx/error.d.ts +2 -0
- package/build/component/generator/spfx/error.d.ts.map +1 -1
- package/build/component/generator/spfx/error.js +16 -1
- package/build/component/generator/spfx/error.js.map +1 -1
- package/build/component/generator/spfx/spfxGenerator.d.ts +3 -0
- package/build/component/generator/spfx/spfxGenerator.d.ts.map +1 -1
- package/build/component/generator/spfx/spfxGenerator.js +149 -20
- package/build/component/generator/spfx/spfxGenerator.js.map +1 -1
- package/build/component/generator/spfx/utils/constants.d.ts +3 -0
- package/build/component/generator/spfx/utils/constants.d.ts.map +1 -1
- package/build/component/generator/spfx/utils/constants.js +3 -0
- package/build/component/generator/spfx/utils/constants.js.map +1 -1
- package/build/component/generator/spfx/utils/telemetryEvents.d.ts +7 -8
- package/build/component/generator/spfx/utils/telemetryEvents.d.ts.map +1 -1
- package/build/component/generator/spfx/utils/telemetryEvents.js +5 -6
- package/build/component/generator/spfx/utils/telemetryEvents.js.map +1 -1
- package/build/component/generator/spfx/utils/utils.js +1 -1
- package/build/component/generator/utils.d.ts +5 -2
- package/build/component/generator/utils.d.ts.map +1 -1
- package/build/component/generator/utils.js +32 -12
- package/build/component/generator/utils.js.map +1 -1
- package/build/component/utils/common.d.ts +4 -1
- package/build/component/utils/common.d.ts.map +1 -1
- package/build/component/utils/common.js +21 -17
- package/build/component/utils/common.js.map +1 -1
- 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 +14 -2
- package/build/component/utils/envUtil.js.map +1 -1
- package/build/component/utils/fileOperation.d.ts +1 -1
- package/build/component/utils/fileOperation.d.ts.map +1 -1
- package/build/component/utils/fileOperation.js +34 -48
- package/build/component/utils/fileOperation.js.map +1 -1
- package/build/core/FxCore.d.ts +5 -0
- package/build/core/FxCore.d.ts.map +1 -1
- package/build/core/FxCore.js +48 -24
- package/build/core/FxCore.js.map +1 -1
- package/build/core/middleware/projectMigratorV3.d.ts +1 -1
- package/build/core/middleware/projectMigratorV3.d.ts.map +1 -1
- package/build/core/middleware/projectMigratorV3.js +10 -9
- package/build/core/middleware/projectMigratorV3.js.map +1 -1
- package/build/core/middleware/projectVersionChecker.js +4 -4
- package/build/core/middleware/projectVersionChecker.js.map +1 -1
- package/build/error/deploy.d.ts +6 -0
- package/build/error/deploy.d.ts.map +1 -1
- package/build/error/deploy.js +25 -1
- package/build/error/deploy.js.map +1 -1
- package/build/error/teamsApp.js +1 -1
- package/build/error/teamsApp.js.map +1 -1
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/build/question/create.d.ts.map +1 -1
- package/build/question/create.js +14 -5
- package/build/question/create.js.map +1 -1
- package/build/question/generator.js +1 -3
- package/build/question/generator.js.map +1 -1
- package/build/question/options/CreateProjectOptions.js +1 -1
- package/build/question/options/CreateProjectOptions.js.map +1 -1
- package/build/question/options/CreateSampleProjectOptions.d.ts.map +1 -1
- package/build/question/options/CreateSampleProjectOptions.js +5 -1
- package/build/question/options/CreateSampleProjectOptions.js.map +1 -1
- package/build/question/options/DeployAadManifestOptions.js +1 -1
- package/build/question/options/DeployAadManifestOptions.js.map +1 -1
- package/build/question/options/PermissionGrantOptions.js +1 -1
- package/build/question/options/PermissionGrantOptions.js.map +1 -1
- package/build/question/options/PermissionListOptions.js +1 -1
- package/build/question/options/PermissionListOptions.js.map +1 -1
- package/build/question/other.d.ts +2 -1
- package/build/question/other.d.ts.map +1 -1
- package/build/question/other.js +22 -8
- package/build/question/other.js.map +1 -1
- package/build/question/questionNames.d.ts +1 -0
- package/build/question/questionNames.d.ts.map +1 -1
- package/build/question/questionNames.js +1 -0
- package/build/question/questionNames.js.map +1 -1
- package/build/ui/visitor.d.ts.map +1 -1
- package/build/ui/visitor.js +11 -2
- package/build/ui/visitor.js.map +1 -1
- package/package.json +14 -22
- package/resource/package.nls.json +27 -7
- package/resource/yaml-schema/v1.3/yaml.schema.json +42 -5
- 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/Bot/Pages/BotAuthorizeEndPage.cshtml +55 -51
- package/templates/plugins/resource/aad/auth/bot/csharp/Pages/BotAuthorizeEndPage.cshtml +55 -51
- package/templates/plugins/resource/aad/auth/bot/js/public/auth-end.html +6 -2
- package/templates/plugins/resource/aad/auth/bot/ts/public/auth-end.html +5 -1
- package/templates/plugins/resource/aad/auth/tab/js/public/auth-end.html +16 -9
- package/templates/plugins/resource/aad/auth/tab/js/public/auth-start.html +11 -7
- package/templates/plugins/resource/aad/auth/tab/ts/public/auth-end.html +16 -9
- package/templates/plugins/resource/aad/auth/tab/ts/public/auth-start.html +11 -7
|
@@ -7,14 +7,14 @@ const utils_1 = require("./utils");
|
|
|
7
7
|
const specParserError_1 = require("./specParserError");
|
|
8
8
|
const interfaces_1 = require("./interfaces");
|
|
9
9
|
const constants_1 = require("./constants");
|
|
10
|
-
function specFilter(filter, unResolveSpec, resolvedSpec, allowMissingId, allowAPIKeyAuth) {
|
|
10
|
+
function specFilter(filter, unResolveSpec, resolvedSpec, allowMissingId, allowAPIKeyAuth, allowMultipleParameters, allowOauth2) {
|
|
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, resolvedSpec, allowMissingId, allowAPIKeyAuth)) {
|
|
17
|
+
if (!utils_1.isSupportedApi(methodName, path, resolvedSpec, allowMissingId, allowAPIKeyAuth, allowMultipleParameters, allowOauth2)) {
|
|
18
18
|
continue;
|
|
19
19
|
}
|
|
20
20
|
if (!newPaths[path]) {
|
|
@@ -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,mCAAiE;AACjE,uDAAoD;AACpD,6CAAyC;AACzC,2CAA6C;AAE7C,SAAgB,UAAU,CACxB,MAAgB,EAChB,aAAiC,EACjC,YAAgC,EAChC,cAAuB,EACvB,eAAwB;
|
|
1
|
+
{"version":3,"file":"specFilter.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AC,WAAW,GAAG,GAAG,UAAU,GAAG,8BAAsB,CACtF,IAAI,CACL,EAAE,CAAC;aACL;SACF;QAED,OAAO,CAAC,KAAK,GAAG,QAAQ,CAAC;QACzB,OAAO,OAAO,CAAC;KAChB;IAAC,OAAO,GAAG,EAAE;QACZ,MAAM,IAAI,iCAAe,CAAE,GAAa,CAAC,QAAQ,EAAE,EAAE,sBAAS,CAAC,gBAAgB,CAAC,CAAC;KAClF;AACH,CAAC;AApDD,gCAoDC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"specParser.browser.d.ts","sourceRoot":"","sources":["../../../src/common/spec-parser/specParser.browser.ts"],"names":[],"mappings":"AAIA,OAAO,aAAa,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EACL,OAAO,EAEP,cAAc,EACd,YAAY,EACZ,cAAc,EAGd,aAAa,EACd,MAAM,cAAc,CAAC;AAKtB;;GAEG;AACH,qBAAa,UAAU;IACrB,SAAgB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC;IACxD,SAAgB,MAAM,EAAE,aAAa,CAAC;IACtC,SAAgB,OAAO,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC;IAEhD,OAAO,CAAC,MAAM,CAA0D;IACxE,OAAO,CAAC,IAAI,CAAiC;IAC7C,OAAO,CAAC,aAAa,CAAiC;IACtD,OAAO,CAAC,aAAa,CAAsB;IAE3C,OAAO,CAAC,cAAc,
|
|
1
|
+
{"version":3,"file":"specParser.browser.d.ts","sourceRoot":"","sources":["../../../src/common/spec-parser/specParser.browser.ts"],"names":[],"mappings":"AAIA,OAAO,aAAa,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EACL,OAAO,EAEP,cAAc,EACd,YAAY,EACZ,cAAc,EAGd,aAAa,EACd,MAAM,cAAc,CAAC;AAKtB;;GAEG;AACH,qBAAa,UAAU;IACrB,SAAgB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC;IACxD,SAAgB,MAAM,EAAE,aAAa,CAAC;IACtC,SAAgB,OAAO,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC;IAEhD,OAAO,CAAC,MAAM,CAA0D;IACxE,OAAO,CAAC,IAAI,CAAiC;IAC7C,OAAO,CAAC,aAAa,CAAiC;IACtD,OAAO,CAAC,aAAa,CAAsB;IAE3C,OAAO,CAAC,cAAc,CAMpB;IAEF;;;;OAIG;gBACS,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,YAAY;IAS1E;;;;OAIG;IACG,QAAQ,IAAI,OAAO,CAAC,cAAc,CAAC;IAqCnC,oBAAoB,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IA0ChD;;;;OAIG;IAEG,IAAI,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;IAItC;;;;;;OAMG;IAEG,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;YAIZ,QAAQ;IAYtB,OAAO,CAAC,mBAAmB;CAgB5B"}
|
|
@@ -23,6 +23,8 @@ class SpecParser {
|
|
|
23
23
|
allowMissingId: false,
|
|
24
24
|
allowSwagger: false,
|
|
25
25
|
allowAPIKeyAuth: false,
|
|
26
|
+
allowMultipleParameters: false,
|
|
27
|
+
allowOauth2: false,
|
|
26
28
|
};
|
|
27
29
|
this.pathOrSpec = pathOrDoc;
|
|
28
30
|
this.parser = new swagger_parser_1.default();
|
|
@@ -55,7 +57,7 @@ class SpecParser {
|
|
|
55
57
|
],
|
|
56
58
|
};
|
|
57
59
|
}
|
|
58
|
-
return utils_1.validateSpec(this.spec, this.parser, !!this.isSwaggerFile, this.options.allowMissingId, this.options.allowAPIKeyAuth);
|
|
60
|
+
return utils_1.validateSpec(this.spec, this.parser, !!this.isSwaggerFile, this.options.allowMissingId, this.options.allowAPIKeyAuth, this.options.allowMultipleParameters, this.options.allowOauth2);
|
|
59
61
|
}
|
|
60
62
|
catch (err) {
|
|
61
63
|
throw new specParserError_1.SpecParserError(err.toString(), interfaces_1.ErrorType.ValidateFailed);
|
|
@@ -74,7 +76,7 @@ class SpecParser {
|
|
|
74
76
|
if (!operationId) {
|
|
75
77
|
continue;
|
|
76
78
|
}
|
|
77
|
-
const [command, warning] = utils_1.parseApiInfo(pathObjectItem);
|
|
79
|
+
const [command, warning] = utils_1.parseApiInfo(pathObjectItem, this.options.allowMultipleParameters);
|
|
78
80
|
const apiInfo = {
|
|
79
81
|
method: method,
|
|
80
82
|
path: path,
|
|
@@ -128,7 +130,7 @@ class SpecParser {
|
|
|
128
130
|
if (this.apiMap !== undefined) {
|
|
129
131
|
return this.apiMap;
|
|
130
132
|
}
|
|
131
|
-
const result = utils_1.listSupportedAPIs(spec, this.options.allowMissingId, this.options.allowAPIKeyAuth);
|
|
133
|
+
const result = utils_1.listSupportedAPIs(spec, this.options.allowMissingId, this.options.allowAPIKeyAuth, this.options.allowMultipleParameters, this.options.allowAPIKeyAuth);
|
|
132
134
|
this.apiMap = result;
|
|
133
135
|
return result;
|
|
134
136
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"specParser.browser.js","sourceRoot":"","sources":["../../../src/common/spec-parser/specParser.browser.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,YAAY,CAAC;;;;AAEb,yFAAwD;AAExD,6CASsB;AACtB,uDAAoD;AACpD,mCAAwE;AACxE,2CAA6C;AAE7C;;GAEG;AACH,MAAa,UAAU;
|
|
1
|
+
{"version":3,"file":"specParser.browser.js","sourceRoot":"","sources":["../../../src/common/spec-parser/specParser.browser.ts"],"names":[],"mappings":"AA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mB,CAAC,CAAuB,CAAC;SACxF;IACH,CAAC;IAEO,mBAAmB,CAAC,IAAwB;QAGlD,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE;YAC7B,OAAO,IAAI,CAAC,MAAM,CAAC;SACpB;QACD,MAAM,MAAM,GAAG,yBAAiB,CAC9B,IAAI,EACJ,IAAI,CAAC,OAAO,CAAC,cAAc,EAC3B,IAAI,CAAC,OAAO,CAAC,eAAe,EAC5B,IAAI,CAAC,OAAO,CAAC,uBAAuB,EACpC,IAAI,CAAC,OAAO,CAAC,eAAe,CAC7B,CAAC;QACF,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA5KD,gCA4KC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"specParser.d.ts","sourceRoot":"","sources":["../../../src/common/spec-parser/specParser.ts"],"names":[],"mappings":"AAIA,OAAO,aAAa,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAK1C,OAAO,EACL,OAAO,EAEP,cAAc,EACd,aAAa,EACb,YAAY,EACZ,cAAc,EAGf,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"specParser.d.ts","sourceRoot":"","sources":["../../../src/common/spec-parser/specParser.ts"],"names":[],"mappings":"AAIA,OAAO,aAAa,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAK1C,OAAO,EACL,OAAO,EAEP,cAAc,EACd,aAAa,EACb,YAAY,EACZ,cAAc,EAGf,MAAM,cAAc,CAAC;AAetB;;GAEG;AACH,qBAAa,UAAU;IACrB,SAAgB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC;IACxD,SAAgB,MAAM,EAAE,aAAa,CAAC;IACtC,SAAgB,OAAO,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC;IAEhD,OAAO,CAAC,MAAM,CAA0D;IACxE,OAAO,CAAC,IAAI,CAAiC;IAC7C,OAAO,CAAC,aAAa,CAAiC;IACtD,OAAO,CAAC,aAAa,CAAsB;IAE3C,OAAO,CAAC,cAAc,CAMpB;IAEF;;;;OAIG;gBACS,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,YAAY;IAS1E;;;;OAIG;IACG,QAAQ,IAAI,OAAO,CAAC,cAAc,CAAC;IAsCnC,oBAAoB,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAIhD;;;;OAIG;IACG,IAAI,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;IAwDtC;;;;;;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;YAuHZ,QAAQ;IAetB,OAAO,CAAC,mBAAmB;CAgB5B"}
|
|
@@ -31,6 +31,8 @@ class SpecParser {
|
|
|
31
31
|
allowMissingId: true,
|
|
32
32
|
allowSwagger: true,
|
|
33
33
|
allowAPIKeyAuth: false,
|
|
34
|
+
allowMultipleParameters: false,
|
|
35
|
+
allowOauth2: false,
|
|
34
36
|
};
|
|
35
37
|
this.pathOrSpec = pathOrDoc;
|
|
36
38
|
this.parser = new swagger_parser_1.default();
|
|
@@ -63,7 +65,7 @@ class SpecParser {
|
|
|
63
65
|
],
|
|
64
66
|
};
|
|
65
67
|
}
|
|
66
|
-
return utils_1.validateSpec(this.spec, this.parser, !!this.isSwaggerFile, this.options.allowMissingId, this.options.allowAPIKeyAuth);
|
|
68
|
+
return utils_1.validateSpec(this.spec, this.parser, !!this.isSwaggerFile, this.options.allowMissingId, this.options.allowAPIKeyAuth, this.options.allowMultipleParameters, this.options.allowOauth2);
|
|
67
69
|
}
|
|
68
70
|
catch (err) {
|
|
69
71
|
throw new specParserError_1.SpecParserError(err.toString(), interfaces_1.ErrorType.ValidateFailed);
|
|
@@ -100,16 +102,16 @@ class SpecParser {
|
|
|
100
102
|
if (!serverUrl) {
|
|
101
103
|
throw new specParserError_1.SpecParserError(constants_1.ConstantString.NoServerInformation, interfaces_1.ErrorType.NoServerInformation);
|
|
102
104
|
}
|
|
103
|
-
apiResult.server = serverUrl.url;
|
|
105
|
+
apiResult.server = utils_1.resolveServerUrl(serverUrl.url);
|
|
104
106
|
let operationId = operation.operationId;
|
|
105
107
|
if (!operationId) {
|
|
106
108
|
operationId = `${method.toLowerCase()}${utils_1.convertPathToCamelCase(path)}`;
|
|
107
109
|
}
|
|
108
110
|
apiResult.operationId = operationId;
|
|
109
|
-
const
|
|
110
|
-
for (const
|
|
111
|
-
if (
|
|
112
|
-
apiResult.auth =
|
|
111
|
+
const authArray = utils_1.getAuthArray(operation.security, spec);
|
|
112
|
+
for (const auths of authArray) {
|
|
113
|
+
if (auths.length === 1) {
|
|
114
|
+
apiResult.auth = auths[0].authSchema;
|
|
113
115
|
break;
|
|
114
116
|
}
|
|
115
117
|
}
|
|
@@ -145,32 +147,23 @@ class SpecParser {
|
|
|
145
147
|
if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
|
|
146
148
|
throw new specParserError_1.SpecParserError(constants_1.ConstantString.CancelledMessage, interfaces_1.ErrorType.Cancelled);
|
|
147
149
|
}
|
|
148
|
-
const newUnResolvedSpec = specFilter_1.specFilter(filter, this.unResolveSpec, this.spec, this.options.allowMissingId, this.options.allowAPIKeyAuth);
|
|
150
|
+
const newUnResolvedSpec = specFilter_1.specFilter(filter, this.unResolveSpec, this.spec, this.options.allowMissingId, this.options.allowAPIKeyAuth, this.options.allowMultipleParameters, this.options.allowOauth2);
|
|
149
151
|
if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
|
|
150
152
|
throw new specParserError_1.SpecParserError(constants_1.ConstantString.CancelledMessage, interfaces_1.ErrorType.Cancelled);
|
|
151
153
|
}
|
|
152
154
|
const newSpec = (await this.parser.dereference(newUnResolvedSpec));
|
|
153
|
-
const
|
|
155
|
+
const AuthSet = new Set();
|
|
154
156
|
let hasMultipleAPIKeyAuth = false;
|
|
155
|
-
let firstAuthKey;
|
|
156
157
|
for (const url in newSpec.paths) {
|
|
157
158
|
for (const method in newSpec.paths[url]) {
|
|
158
159
|
const operation = newSpec.paths[url][method];
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
break;
|
|
164
|
-
}
|
|
165
|
-
if (apiKeyAuthArr && apiKeyAuthArr.length > 0) {
|
|
166
|
-
if (!firstAuthKey) {
|
|
167
|
-
firstAuthKey = apiKeyAuthArr[0][0];
|
|
168
|
-
}
|
|
169
|
-
else if (firstAuthKey.name !== apiKeyAuthArr[0][0].name) {
|
|
160
|
+
const authArray = utils_1.getAuthArray(operation.security, newSpec);
|
|
161
|
+
if (authArray && authArray.length > 0) {
|
|
162
|
+
AuthSet.add(authArray[0][0].authSchema);
|
|
163
|
+
if (AuthSet.size > 1) {
|
|
170
164
|
hasMultipleAPIKeyAuth = true;
|
|
171
165
|
break;
|
|
172
166
|
}
|
|
173
|
-
operationIdToAPIAuthKey.set(operation.operationId, apiKeyAuthArr[0][0]);
|
|
174
167
|
}
|
|
175
168
|
}
|
|
176
169
|
}
|
|
@@ -187,27 +180,33 @@ class SpecParser {
|
|
|
187
180
|
await fs_extra_1.default.outputFile(outputSpecPath, resultStr);
|
|
188
181
|
for (const url in newSpec.paths) {
|
|
189
182
|
for (const method in newSpec.paths[url]) {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
const
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
183
|
+
// paths object may contain description/summary, so we need to check if it is a operation object
|
|
184
|
+
if (method === constants_1.ConstantString.PostMethod || method === constants_1.ConstantString.GetMethod) {
|
|
185
|
+
const operation = newSpec.paths[url][method];
|
|
186
|
+
try {
|
|
187
|
+
const [card, jsonPath] = adaptiveCardGenerator_1.generateAdaptiveCard(operation);
|
|
188
|
+
const fileName = path_1.default.join(adaptiveCardFolder, `${operation.operationId}.json`);
|
|
189
|
+
const wrappedCard = adaptiveCardWrapper_1.wrapAdaptiveCard(card, jsonPath);
|
|
190
|
+
await fs_extra_1.default.outputJSON(fileName, wrappedCard, { spaces: 2 });
|
|
191
|
+
const dataFileName = path_1.default.join(adaptiveCardFolder, `${operation.operationId}.data.json`);
|
|
192
|
+
await fs_extra_1.default.outputJSON(dataFileName, {}, { spaces: 2 });
|
|
193
|
+
}
|
|
194
|
+
catch (err) {
|
|
195
|
+
result.allSuccess = false;
|
|
196
|
+
result.warnings.push({
|
|
197
|
+
type: interfaces_1.WarningType.GenerateCardFailed,
|
|
198
|
+
content: err.toString(),
|
|
199
|
+
data: operation.operationId,
|
|
200
|
+
});
|
|
201
|
+
}
|
|
204
202
|
}
|
|
205
203
|
}
|
|
206
204
|
}
|
|
207
205
|
if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
|
|
208
206
|
throw new specParserError_1.SpecParserError(constants_1.ConstantString.CancelledMessage, interfaces_1.ErrorType.Cancelled);
|
|
209
207
|
}
|
|
210
|
-
const
|
|
208
|
+
const auth = Array.from(AuthSet)[0];
|
|
209
|
+
const [updatedManifest, warnings] = await manifestUpdater_1.updateManifest(manifestPath, outputSpecPath, adaptiveCardFolder, newSpec, this.options.allowMultipleParameters, auth);
|
|
211
210
|
await fs_extra_1.default.outputJSON(manifestPath, updatedManifest, { spaces: 2 });
|
|
212
211
|
result.warnings.push(...warnings);
|
|
213
212
|
}
|
|
@@ -236,7 +235,7 @@ class SpecParser {
|
|
|
236
235
|
if (this.apiMap !== undefined) {
|
|
237
236
|
return this.apiMap;
|
|
238
237
|
}
|
|
239
|
-
const result = utils_1.listSupportedAPIs(spec, this.options.allowMissingId, this.options.allowAPIKeyAuth);
|
|
238
|
+
const result = utils_1.listSupportedAPIs(spec, this.options.allowMissingId, this.options.allowAPIKeyAuth, this.options.allowMultipleParameters, this.options.allowOauth2);
|
|
240
239
|
this.apiMap = result;
|
|
241
240
|
return result;
|
|
242
241
|
}
|
|
@@ -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,yFAAwD;AAExD,8EAAwC;AACxC,8DAA6B;AAC7B,gEAA0B;AAC1B,wDAAwB;AACxB,6CASsB;AACtB,2CAA6C;AAC7C,uDAAoD;AACpD,6CAA0C;AAC1C,
|
|
1
|
+
{"version":3,"file":"specParser.js","sourceRoot":"","sources":["../../../src/common/spec-parser/specParser.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,YAAY,CAAC;;;;AAEb,yFAAwD;AAExD,8EAAwC;AACxC,8DAA6B;AAC7B,gEAA0B;AAC1B,wDAAwB;AACxB,6CASsB;AACtB,2CAA6C;AAC7C,uDAAoD;AACpD,6CAA0C;AAC1C,mCAMiB;AACjB,uDAAmD;AACnD,mEAA+D;AAC/D,+DAAyD;AAEzD;;GAEG;AACH,MAAa,UAAU;IAkBrB;;;;OAIG;IACH,YAAY,SAAsC,EAAE,OAAsB;QAblE,mBAAc,GAAiB;YACrC,cAAc,EAAE,IAAI;YACpB,YAAY,EAAE,IAAI;YAClB,eAAe,EAAE,KAAK;YACtB,uBAAuB,EAAE,KAAK;YAC9B,WAAW,EAAE,KAAK;SACnB,CAAC;QAQA,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,MAAM,GAAG,IAAI,wBAAa,EAAE,CAAC;QAClC,IAAI,CAAC,OAAO,GAAG,gCACV,IAAI,CAAC,cAAc,GACnB,CAAC,OAAO,aAAP,OAAO,cA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QACrB,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA/SD,gCA+SC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OpenAPIV3 } from "openapi-types";
|
|
2
2
|
import SwaggerParser from "@apidevtools/swagger-parser";
|
|
3
|
-
import { CheckParamResult, ErrorResult, Parameter, ValidateResult, WarningResult } from "./interfaces";
|
|
3
|
+
import { AuthSchema, CheckParamResult, ErrorResult, Parameter, ValidateResult, WarningResult } from "./interfaces";
|
|
4
4
|
import { IMessagingExtensionCommand } from "@microsoft/teamsfx-api";
|
|
5
5
|
export declare function checkParameters(paramObject: OpenAPIV3.ParameterObject[]): CheckParamResult;
|
|
6
6
|
export declare function checkPostBody(schema: OpenAPIV3.SchemaObject, isRequired?: boolean): CheckParamResult;
|
|
@@ -18,22 +18,26 @@ export declare function checkPostBody(schema: OpenAPIV3.SchemaObject, isRequired
|
|
|
18
18
|
* 5. response body should be “application/json” and not empty, and response code should be 20X
|
|
19
19
|
* 6. only support request body with “application/json” content type
|
|
20
20
|
*/
|
|
21
|
-
export declare function isSupportedApi(method: string, path: string, spec: OpenAPIV3.Document, allowMissingId: boolean, allowAPIKeyAuth: boolean): boolean;
|
|
22
|
-
export declare function
|
|
21
|
+
export declare function isSupportedApi(method: string, path: string, spec: OpenAPIV3.Document, allowMissingId: boolean, allowAPIKeyAuth: boolean, allowMultipleParameters: boolean, allowOauth2: boolean): boolean;
|
|
22
|
+
export declare function isSupportedAuth(authSchemaArray: AuthSchema[][], allowAPIKeyAuth: boolean, allowOauth2: boolean): boolean;
|
|
23
|
+
export declare function isAPIKeyAuth(authSchema: OpenAPIV3.SecuritySchemeObject): boolean;
|
|
24
|
+
export declare function isBearerTokenAuth(authSchema: OpenAPIV3.SecuritySchemeObject): boolean;
|
|
25
|
+
export declare function getAuthArray(securities: OpenAPIV3.SecurityRequirementObject[] | undefined, spec: OpenAPIV3.Document): AuthSchema[][];
|
|
23
26
|
export declare function updateFirstLetter(str: string): string;
|
|
24
27
|
export declare function getResponseJson(operationObject: OpenAPIV3.OperationObject | undefined): OpenAPIV3.MediaTypeObject;
|
|
25
28
|
export declare function convertPathToCamelCase(path: string): string;
|
|
26
29
|
export declare function getUrlProtocol(urlString: string): string | undefined;
|
|
27
30
|
export declare function resolveServerUrl(url: string): string;
|
|
28
31
|
export declare function checkServerUrl(servers: OpenAPIV3.ServerObject[]): ErrorResult[];
|
|
29
|
-
export declare function validateServer(spec: OpenAPIV3.Document, allowMissingId: boolean, allowAPIKeyAuth: boolean): ErrorResult[];
|
|
32
|
+
export declare function validateServer(spec: OpenAPIV3.Document, allowMissingId: boolean, allowAPIKeyAuth: boolean, allowMultipleParameters: boolean, allowOauth2: boolean): ErrorResult[];
|
|
30
33
|
export declare function isWellKnownName(name: string, wellknownNameList: string[]): boolean;
|
|
31
|
-
export declare function generateParametersFromSchema(schema: OpenAPIV3.SchemaObject, name: string, isRequired?: boolean): [Parameter[], Parameter[]];
|
|
32
|
-
export declare function
|
|
33
|
-
export declare function
|
|
34
|
+
export declare function generateParametersFromSchema(schema: OpenAPIV3.SchemaObject, name: string, allowMultipleParameters: boolean, isRequired?: boolean): [Parameter[], Parameter[]];
|
|
35
|
+
export declare function updateParameterWithInputType(schema: OpenAPIV3.SchemaObject, param: Parameter): void;
|
|
36
|
+
export declare function parseApiInfo(operationItem: OpenAPIV3.OperationObject, allowMultipleParameters: boolean): [IMessagingExtensionCommand, WarningResult | undefined];
|
|
37
|
+
export declare function listSupportedAPIs(spec: OpenAPIV3.Document, allowMissingId: boolean, allowAPIKeyAuth: boolean, allowMultipleParameters: boolean, allowOauth2: boolean): {
|
|
34
38
|
[key: string]: OpenAPIV3.OperationObject;
|
|
35
39
|
};
|
|
36
|
-
export declare function validateSpec(spec: OpenAPIV3.Document, parser: SwaggerParser, isSwaggerFile: boolean, allowMissingId: boolean, allowAPIKeyAuth: boolean): ValidateResult;
|
|
40
|
+
export declare function validateSpec(spec: OpenAPIV3.Document, parser: SwaggerParser, isSwaggerFile: boolean, allowMissingId: boolean, allowAPIKeyAuth: boolean, allowMultipleParameters: boolean, allowOauth2: boolean): ValidateResult;
|
|
37
41
|
export declare function format(str: string, ...args: string[]): string;
|
|
38
42
|
export declare function getSafeRegistrationIdEnvName(authName: string): string;
|
|
39
43
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/common/spec-parser/utils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,aAAa,MAAM,6BAA6B,CAAC;AAExD,OAAO,EACL,gBAAgB,EAChB,WAAW,EAEX,SAAS,EACT,cAAc,EAEd,aAAa,EAEd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAEpE,wBAAgB,eAAe,CAAC,WAAW,EAAE,SAAS,CAAC,eAAe,EAAE,GAAG,gBAAgB,CA6C1F;AAED,wBAAgB,aAAa,CAC3B,MAAM,EAAE,SAAS,CAAC,YAAY,EAC9B,UAAU,UAAQ,GACjB,gBAAgB,CA0ClB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,SAAS,CAAC,QAAQ,EACxB,cAAc,EAAE,OAAO,EACvB,eAAe,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/common/spec-parser/utils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,aAAa,MAAM,6BAA6B,CAAC;AAExD,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,WAAW,EAEX,SAAS,EACT,cAAc,EAEd,aAAa,EAEd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,0BAA0B,EAAE,MAAM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ChC,WAAW,EAAE,OAAO,GACnB,cAAc,CA6EhB;AAED,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAM7D;AAED,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAYrE"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
3
|
"use strict";
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.getSafeRegistrationIdEnvName = exports.format = exports.validateSpec = exports.listSupportedAPIs = exports.parseApiInfo = exports.generateParametersFromSchema = exports.isWellKnownName = exports.validateServer = exports.checkServerUrl = exports.resolveServerUrl = exports.getUrlProtocol = exports.convertPathToCamelCase = exports.getResponseJson = exports.updateFirstLetter = exports.
|
|
5
|
+
exports.getSafeRegistrationIdEnvName = exports.format = exports.validateSpec = exports.listSupportedAPIs = exports.parseApiInfo = exports.updateParameterWithInputType = exports.generateParametersFromSchema = exports.isWellKnownName = exports.validateServer = exports.checkServerUrl = exports.resolveServerUrl = exports.getUrlProtocol = exports.convertPathToCamelCase = exports.getResponseJson = exports.updateFirstLetter = exports.getAuthArray = exports.isBearerTokenAuth = exports.isAPIKeyAuth = exports.isSupportedAuth = exports.isSupportedApi = exports.checkPostBody = exports.checkParameters = void 0;
|
|
6
6
|
const constants_1 = require("./constants");
|
|
7
7
|
const interfaces_1 = require("./interfaces");
|
|
8
8
|
function checkParameters(paramObject) {
|
|
@@ -102,22 +102,15 @@ exports.checkPostBody = checkPostBody;
|
|
|
102
102
|
* 5. response body should be “application/json” and not empty, and response code should be 20X
|
|
103
103
|
* 6. only support request body with “application/json” content type
|
|
104
104
|
*/
|
|
105
|
-
function isSupportedApi(method, path, spec, allowMissingId, allowAPIKeyAuth) {
|
|
105
|
+
function isSupportedApi(method, path, spec, allowMissingId, allowAPIKeyAuth, allowMultipleParameters, allowOauth2) {
|
|
106
106
|
const pathObj = spec.paths[path];
|
|
107
107
|
method = method.toLocaleLowerCase();
|
|
108
108
|
if (pathObj) {
|
|
109
109
|
if ((method === constants_1.ConstantString.PostMethod || method === constants_1.ConstantString.GetMethod) &&
|
|
110
110
|
pathObj[method]) {
|
|
111
111
|
const securities = pathObj[method].security;
|
|
112
|
-
const
|
|
113
|
-
if (!allowAPIKeyAuth
|
|
114
|
-
return false;
|
|
115
|
-
}
|
|
116
|
-
if (allowAPIKeyAuth && securities && apiKeyAuthArr.length === 0) {
|
|
117
|
-
return false;
|
|
118
|
-
}
|
|
119
|
-
// Currently we don't support multiple apiKey auth
|
|
120
|
-
if (apiKeyAuthArr.length > 0 && apiKeyAuthArr.every((auths) => auths.length > 1)) {
|
|
112
|
+
const authArray = getAuthArray(securities, spec);
|
|
113
|
+
if (!isSupportedAuth(authArray, allowAPIKeyAuth, allowOauth2)) {
|
|
121
114
|
return false;
|
|
122
115
|
}
|
|
123
116
|
const operationObject = pathObj[method];
|
|
@@ -148,6 +141,10 @@ function isSupportedApi(method, path, spec, allowMissingId, allowAPIKeyAuth) {
|
|
|
148
141
|
return false;
|
|
149
142
|
}
|
|
150
143
|
if (requestBodyParamResult.requiredNum + paramResult.requiredNum > 1) {
|
|
144
|
+
if (allowMultipleParameters &&
|
|
145
|
+
requestBodyParamResult.requiredNum + paramResult.requiredNum <= 5) {
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
151
148
|
return false;
|
|
152
149
|
}
|
|
153
150
|
else if (requestBodyParamResult.requiredNum +
|
|
@@ -165,33 +162,68 @@ function isSupportedApi(method, path, spec, allowMissingId, allowAPIKeyAuth) {
|
|
|
165
162
|
return false;
|
|
166
163
|
}
|
|
167
164
|
exports.isSupportedApi = isSupportedApi;
|
|
168
|
-
function
|
|
165
|
+
function isSupportedAuth(authSchemaArray, allowAPIKeyAuth, allowOauth2) {
|
|
166
|
+
if (authSchemaArray.length === 0) {
|
|
167
|
+
return true;
|
|
168
|
+
}
|
|
169
|
+
if (allowAPIKeyAuth || allowOauth2) {
|
|
170
|
+
// Currently we don't support multiple auth in one operation
|
|
171
|
+
if (authSchemaArray.length > 0 && authSchemaArray.every((auths) => auths.length > 1)) {
|
|
172
|
+
return false;
|
|
173
|
+
}
|
|
174
|
+
for (const auths of authSchemaArray) {
|
|
175
|
+
if (auths.length === 1) {
|
|
176
|
+
if (!allowOauth2 && allowAPIKeyAuth && isAPIKeyAuth(auths[0].authSchema)) {
|
|
177
|
+
return true;
|
|
178
|
+
}
|
|
179
|
+
else if (!allowAPIKeyAuth && allowOauth2 && isBearerTokenAuth(auths[0].authSchema)) {
|
|
180
|
+
return true;
|
|
181
|
+
}
|
|
182
|
+
else if (allowAPIKeyAuth &&
|
|
183
|
+
allowOauth2 &&
|
|
184
|
+
(isAPIKeyAuth(auths[0].authSchema) || isBearerTokenAuth(auths[0].authSchema))) {
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
exports.isSupportedAuth = isSupportedAuth;
|
|
193
|
+
function isAPIKeyAuth(authSchema) {
|
|
194
|
+
return authSchema.type === "apiKey";
|
|
195
|
+
}
|
|
196
|
+
exports.isAPIKeyAuth = isAPIKeyAuth;
|
|
197
|
+
function isBearerTokenAuth(authSchema) {
|
|
198
|
+
return (authSchema.type === "oauth2" ||
|
|
199
|
+
authSchema.type === "openIdConnect" ||
|
|
200
|
+
(authSchema.type === "http" && authSchema.scheme === "bearer"));
|
|
201
|
+
}
|
|
202
|
+
exports.isBearerTokenAuth = isBearerTokenAuth;
|
|
203
|
+
function getAuthArray(securities, spec) {
|
|
169
204
|
var _a;
|
|
170
205
|
const result = [];
|
|
171
206
|
const securitySchemas = (_a = spec.components) === null || _a === void 0 ? void 0 : _a.securitySchemes;
|
|
172
207
|
if (securities && securitySchemas) {
|
|
173
208
|
for (let i = 0; i < securities.length; i++) {
|
|
174
209
|
const security = securities[i];
|
|
175
|
-
|
|
210
|
+
const authArray = [];
|
|
176
211
|
for (const name in security) {
|
|
177
212
|
const auth = securitySchemas[name];
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
apiKeyAuthArray = [];
|
|
183
|
-
break;
|
|
184
|
-
}
|
|
213
|
+
authArray.push({
|
|
214
|
+
authSchema: auth,
|
|
215
|
+
name: name,
|
|
216
|
+
});
|
|
185
217
|
}
|
|
186
|
-
if (
|
|
187
|
-
result.push(
|
|
218
|
+
if (authArray.length > 0) {
|
|
219
|
+
result.push(authArray);
|
|
188
220
|
}
|
|
189
221
|
}
|
|
190
222
|
}
|
|
191
223
|
result.sort((a, b) => a[0].name.localeCompare(b[0].name));
|
|
192
224
|
return result;
|
|
193
225
|
}
|
|
194
|
-
exports.
|
|
226
|
+
exports.getAuthArray = getAuthArray;
|
|
195
227
|
function updateFirstLetter(str) {
|
|
196
228
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
197
229
|
}
|
|
@@ -282,7 +314,7 @@ function checkServerUrl(servers) {
|
|
|
282
314
|
return errors;
|
|
283
315
|
}
|
|
284
316
|
exports.checkServerUrl = checkServerUrl;
|
|
285
|
-
function validateServer(spec, allowMissingId, allowAPIKeyAuth) {
|
|
317
|
+
function validateServer(spec, allowMissingId, allowAPIKeyAuth, allowMultipleParameters, allowOauth2) {
|
|
286
318
|
const errors = [];
|
|
287
319
|
let hasTopLevelServers = false;
|
|
288
320
|
let hasPathLevelServers = false;
|
|
@@ -303,7 +335,7 @@ function validateServer(spec, allowMissingId, allowAPIKeyAuth) {
|
|
|
303
335
|
}
|
|
304
336
|
for (const method in methods) {
|
|
305
337
|
const operationObject = methods[method];
|
|
306
|
-
if (isSupportedApi(method, path, spec, allowMissingId, allowAPIKeyAuth)) {
|
|
338
|
+
if (isSupportedApi(method, path, spec, allowMissingId, allowAPIKeyAuth, allowMultipleParameters, allowOauth2)) {
|
|
307
339
|
if ((operationObject === null || operationObject === void 0 ? void 0 : operationObject.servers) && operationObject.servers.length >= 1) {
|
|
308
340
|
hasOperationLevelServers = true;
|
|
309
341
|
const serverErrors = checkServerUrl(operationObject.servers);
|
|
@@ -331,7 +363,7 @@ function isWellKnownName(name, wellknownNameList) {
|
|
|
331
363
|
return false;
|
|
332
364
|
}
|
|
333
365
|
exports.isWellKnownName = isWellKnownName;
|
|
334
|
-
function generateParametersFromSchema(schema, name, isRequired = false) {
|
|
366
|
+
function generateParametersFromSchema(schema, name, allowMultipleParameters, isRequired = false) {
|
|
335
367
|
var _a, _b;
|
|
336
368
|
const requiredParams = [];
|
|
337
369
|
const optionalParams = [];
|
|
@@ -344,6 +376,9 @@ function generateParametersFromSchema(schema, name, isRequired = false) {
|
|
|
344
376
|
title: updateFirstLetter(name).slice(0, constants_1.ConstantString.ParameterTitleMaxLens),
|
|
345
377
|
description: ((_a = schema.description) !== null && _a !== void 0 ? _a : "").slice(0, constants_1.ConstantString.ParameterDescriptionMaxLens),
|
|
346
378
|
};
|
|
379
|
+
if (allowMultipleParameters) {
|
|
380
|
+
updateParameterWithInputType(schema, parameter);
|
|
381
|
+
}
|
|
347
382
|
if (isRequired && schema.default === undefined) {
|
|
348
383
|
requiredParams.push(parameter);
|
|
349
384
|
}
|
|
@@ -358,7 +393,7 @@ function generateParametersFromSchema(schema, name, isRequired = false) {
|
|
|
358
393
|
if (schema.required && ((_b = schema.required) === null || _b === void 0 ? void 0 : _b.indexOf(property)) >= 0) {
|
|
359
394
|
isRequired = true;
|
|
360
395
|
}
|
|
361
|
-
const [requiredP, optionalP] = generateParametersFromSchema(properties[property], property, isRequired);
|
|
396
|
+
const [requiredP, optionalP] = generateParametersFromSchema(properties[property], property, allowMultipleParameters, isRequired);
|
|
362
397
|
requiredParams.push(...requiredP);
|
|
363
398
|
optionalParams.push(...optionalP);
|
|
364
399
|
}
|
|
@@ -366,7 +401,32 @@ function generateParametersFromSchema(schema, name, isRequired = false) {
|
|
|
366
401
|
return [requiredParams, optionalParams];
|
|
367
402
|
}
|
|
368
403
|
exports.generateParametersFromSchema = generateParametersFromSchema;
|
|
369
|
-
function
|
|
404
|
+
function updateParameterWithInputType(schema, param) {
|
|
405
|
+
if (schema.enum) {
|
|
406
|
+
param.inputType = "choiceset";
|
|
407
|
+
param.choices = [];
|
|
408
|
+
for (let i = 0; i < schema.enum.length; i++) {
|
|
409
|
+
param.choices.push({
|
|
410
|
+
title: schema.enum[i],
|
|
411
|
+
value: schema.enum[i],
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
else if (schema.type === "string") {
|
|
416
|
+
param.inputType = "text";
|
|
417
|
+
}
|
|
418
|
+
else if (schema.type === "integer" || schema.type === "number") {
|
|
419
|
+
param.inputType = "number";
|
|
420
|
+
}
|
|
421
|
+
else if (schema.type === "boolean") {
|
|
422
|
+
param.inputType = "toggle";
|
|
423
|
+
}
|
|
424
|
+
if (schema.default) {
|
|
425
|
+
param.value = schema.default;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
exports.updateParameterWithInputType = updateParameterWithInputType;
|
|
429
|
+
function parseApiInfo(operationItem, allowMultipleParameters) {
|
|
370
430
|
var _a, _b;
|
|
371
431
|
const requiredParams = [];
|
|
372
432
|
const optionalParams = [];
|
|
@@ -380,6 +440,9 @@ function parseApiInfo(operationItem) {
|
|
|
380
440
|
description: ((_a = param.description) !== null && _a !== void 0 ? _a : "").slice(0, constants_1.ConstantString.ParameterDescriptionMaxLens),
|
|
381
441
|
};
|
|
382
442
|
const schema = param.schema;
|
|
443
|
+
if (allowMultipleParameters && schema) {
|
|
444
|
+
updateParameterWithInputType(schema, parameter);
|
|
445
|
+
}
|
|
383
446
|
if (param.in !== "header" && param.in !== "cookie") {
|
|
384
447
|
if (param.required && (schema === null || schema === void 0 ? void 0 : schema.default) === undefined) {
|
|
385
448
|
requiredParams.push(parameter);
|
|
@@ -395,7 +458,7 @@ function parseApiInfo(operationItem) {
|
|
|
395
458
|
const requestJson = requestBody.content["application/json"];
|
|
396
459
|
if (Object.keys(requestJson).length !== 0) {
|
|
397
460
|
const schema = requestJson.schema;
|
|
398
|
-
const [requiredP, optionalP] = generateParametersFromSchema(schema, "requestBody", requestBody.required);
|
|
461
|
+
const [requiredP, optionalP] = generateParametersFromSchema(schema, "requestBody", allowMultipleParameters, requestBody.required);
|
|
399
462
|
requiredParams.push(...requiredP);
|
|
400
463
|
optionalParams.push(...optionalP);
|
|
401
464
|
}
|
|
@@ -427,14 +490,14 @@ function parseApiInfo(operationItem) {
|
|
|
427
490
|
return [command, warning];
|
|
428
491
|
}
|
|
429
492
|
exports.parseApiInfo = parseApiInfo;
|
|
430
|
-
function listSupportedAPIs(spec, allowMissingId, allowAPIKeyAuth) {
|
|
493
|
+
function listSupportedAPIs(spec, allowMissingId, allowAPIKeyAuth, allowMultipleParameters, allowOauth2) {
|
|
431
494
|
const paths = spec.paths;
|
|
432
495
|
const result = {};
|
|
433
496
|
for (const path in paths) {
|
|
434
497
|
const methods = paths[path];
|
|
435
498
|
for (const method in methods) {
|
|
436
499
|
// For developer preview, only support GET operation with only 1 parameter without auth
|
|
437
|
-
if (isSupportedApi(method, path, spec, allowMissingId, allowAPIKeyAuth)) {
|
|
500
|
+
if (isSupportedApi(method, path, spec, allowMissingId, allowAPIKeyAuth, allowMultipleParameters, allowOauth2)) {
|
|
438
501
|
const operationObject = methods[method];
|
|
439
502
|
result[`${method.toUpperCase()} ${path}`] = operationObject;
|
|
440
503
|
}
|
|
@@ -443,7 +506,7 @@ function listSupportedAPIs(spec, allowMissingId, allowAPIKeyAuth) {
|
|
|
443
506
|
return result;
|
|
444
507
|
}
|
|
445
508
|
exports.listSupportedAPIs = listSupportedAPIs;
|
|
446
|
-
function validateSpec(spec, parser, isSwaggerFile, allowMissingId, allowAPIKeyAuth) {
|
|
509
|
+
function validateSpec(spec, parser, isSwaggerFile, allowMissingId, allowAPIKeyAuth, allowMultipleParameters, allowOauth2) {
|
|
447
510
|
const errors = [];
|
|
448
511
|
const warnings = [];
|
|
449
512
|
if (isSwaggerFile) {
|
|
@@ -453,7 +516,7 @@ function validateSpec(spec, parser, isSwaggerFile, allowMissingId, allowAPIKeyAu
|
|
|
453
516
|
});
|
|
454
517
|
}
|
|
455
518
|
// Server validation
|
|
456
|
-
const serverErrors = validateServer(spec, allowMissingId, allowAPIKeyAuth);
|
|
519
|
+
const serverErrors = validateServer(spec, allowMissingId, allowAPIKeyAuth, allowMultipleParameters, allowOauth2);
|
|
457
520
|
errors.push(...serverErrors);
|
|
458
521
|
// Remote reference not supported
|
|
459
522
|
const refPaths = parser.$refs.paths();
|
|
@@ -466,7 +529,7 @@ function validateSpec(spec, parser, isSwaggerFile, allowMissingId, allowAPIKeyAu
|
|
|
466
529
|
});
|
|
467
530
|
}
|
|
468
531
|
// No supported API
|
|
469
|
-
const apiMap = listSupportedAPIs(spec, allowMissingId, allowAPIKeyAuth);
|
|
532
|
+
const apiMap = listSupportedAPIs(spec, allowMissingId, allowAPIKeyAuth, allowMultipleParameters, allowOauth2);
|
|
470
533
|
if (Object.keys(apiMap).length === 0) {
|
|
471
534
|
errors.push({
|
|
472
535
|
type: interfaces_1.ErrorType.NoSupportedApi,
|