@microsoft/teamsfx-core 2.0.6-alpha.e5db52f29.0 → 2.0.6-alpha.e662467a1.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 +3 -2
- package/build/common/constants.d.ts.map +1 -1
- package/build/common/constants.js +3 -2
- package/build/common/constants.js.map +1 -1
- package/build/common/deps-checker/internal/funcToolChecker.d.ts +1 -1
- package/build/common/deps-checker/internal/funcToolChecker.d.ts.map +1 -1
- package/build/common/deps-checker/internal/funcToolChecker.js.map +1 -1
- package/build/common/deps-checker/internal/testToolChecker.d.ts.map +1 -1
- package/build/common/deps-checker/internal/testToolChecker.js +9 -3
- package/build/common/deps-checker/internal/testToolChecker.js.map +1 -1
- package/build/common/featureFlags.d.ts +3 -4
- package/build/common/featureFlags.d.ts.map +1 -1
- package/build/common/featureFlags.js +10 -15
- package/build/common/featureFlags.js.map +1 -1
- package/build/common/local/localCertificateManager.d.ts +5 -4
- package/build/common/local/localCertificateManager.d.ts.map +1 -1
- package/build/common/local/localCertificateManager.js +9 -2
- package/build/common/local/localCertificateManager.js.map +1 -1
- package/build/common/m365/packageService.d.ts.map +1 -1
- package/build/common/m365/packageService.js +2 -1
- package/build/common/m365/packageService.js.map +1 -1
- package/build/common/samples.d.ts +8 -4
- package/build/common/samples.d.ts.map +1 -1
- package/build/common/samples.js +25 -26
- 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 +2 -4
- package/build/common/spec-parser/adaptiveCardGenerator.js.map +1 -1
- package/build/common/spec-parser/constants.d.ts +8 -0
- package/build/common/spec-parser/constants.d.ts.map +1 -1
- package/build/common/spec-parser/constants.js +8 -0
- package/build/common/spec-parser/constants.js.map +1 -1
- package/build/common/spec-parser/index.browser.d.ts +6 -0
- package/build/common/spec-parser/index.browser.d.ts.map +1 -0
- package/build/common/spec-parser/index.browser.js +16 -0
- package/build/common/spec-parser/index.browser.js.map +1 -0
- package/build/common/spec-parser/index.d.ts +1 -1
- package/build/common/spec-parser/index.d.ts.map +1 -1
- package/build/common/spec-parser/index.js.map +1 -1
- package/build/common/spec-parser/interfaces.d.ts +19 -1
- package/build/common/spec-parser/interfaces.d.ts.map +1 -1
- package/build/common/spec-parser/interfaces.js +2 -1
- package/build/common/spec-parser/interfaces.js.map +1 -1
- package/build/common/spec-parser/manifestUpdater.d.ts +3 -2
- package/build/common/spec-parser/manifestUpdater.d.ts.map +1 -1
- package/build/common/spec-parser/manifestUpdater.js +24 -10
- 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 +46 -0
- package/build/common/spec-parser/specParser.browser.d.ts.map +1 -0
- package/build/common/spec-parser/specParser.browser.js +138 -0
- package/build/common/spec-parser/specParser.browser.js.map +1 -0
- package/build/common/spec-parser/specParser.d.ts +3 -8
- package/build/common/spec-parser/specParser.d.ts.map +1 -1
- package/build/common/spec-parser/specParser.js +88 -49
- package/build/common/spec-parser/specParser.js.map +1 -1
- package/build/common/spec-parser/utils.d.ts +10 -7
- package/build/common/spec-parser/utils.d.ts.map +1 -1
- package/build/common/spec-parser/utils.js +119 -36
- package/build/common/spec-parser/utils.js.map +1 -1
- package/build/common/telemetry.d.ts +6 -1
- package/build/common/telemetry.d.ts.map +1 -1
- package/build/common/telemetry.js +5 -0
- package/build/common/telemetry.js.map +1 -1
- package/build/common/tools.d.ts.map +1 -1
- package/build/common/tools.js +1 -1
- package/build/common/tools.js.map +1 -1
- package/build/component/configManager/validator.d.ts.map +1 -1
- package/build/component/configManager/validator.js +2 -3
- package/build/component/configManager/validator.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 +3 -1
- package/build/component/coordinator/index.js.map +1 -1
- package/build/component/driver/aad/create.js +1 -1
- package/build/component/driver/aad/create.js.map +1 -1
- package/build/component/driver/aad/error/invalidFieldInManifestError.js +1 -1
- package/build/component/driver/aad/error/invalidFieldInManifestError.js.map +1 -1
- package/build/component/driver/aad/permissions/index.d.ts +3 -0
- package/build/component/driver/aad/permissions/index.d.ts.map +1 -1
- package/build/component/driver/aad/permissions/index.js +34 -1
- package/build/component/driver/aad/permissions/index.js.map +1 -1
- package/build/component/driver/aad/permissions/permissions.json +42 -42
- package/build/component/driver/aad/update.d.ts +1 -0
- package/build/component/driver/aad/update.d.ts.map +1 -1
- package/build/component/driver/aad/update.js +19 -17
- package/build/component/driver/aad/update.js.map +1 -1
- package/build/component/driver/aad/utility/aadAppClient.js +8 -8
- package/build/component/driver/aad/utility/aadAppClient.js.map +1 -1
- package/build/component/driver/aad/utility/constants.js +1 -1
- package/build/component/driver/aad/utility/constants.js.map +1 -1
- package/build/component/driver/apiKey/create.d.ts +17 -0
- package/build/component/driver/apiKey/create.d.ts.map +1 -0
- package/build/component/driver/apiKey/create.js +226 -0
- package/build/component/driver/apiKey/create.js.map +1 -0
- package/build/component/driver/apiKey/error/apiKeyClientSecretInvalid.d.ts +5 -0
- package/build/component/driver/apiKey/error/apiKeyClientSecretInvalid.d.ts.map +1 -0
- package/build/component/driver/apiKey/error/apiKeyClientSecretInvalid.js +22 -0
- package/build/component/driver/apiKey/error/apiKeyClientSecretInvalid.js.map +1 -0
- package/build/component/driver/apiKey/error/apiKeyDomainInvalid.d.ts +5 -0
- package/build/component/driver/apiKey/error/apiKeyDomainInvalid.d.ts.map +1 -0
- package/build/component/driver/apiKey/error/apiKeyDomainInvalid.js +22 -0
- package/build/component/driver/apiKey/error/apiKeyDomainInvalid.js.map +1 -0
- package/build/component/driver/apiKey/error/apiKeyFailedToGetDomain.d.ts +5 -0
- package/build/component/driver/apiKey/error/apiKeyFailedToGetDomain.d.ts.map +1 -0
- package/build/component/driver/apiKey/error/apiKeyFailedToGetDomain.js +21 -0
- package/build/component/driver/apiKey/error/apiKeyFailedToGetDomain.js.map +1 -0
- package/build/component/driver/apiKey/error/apiKeyNameTooLong.d.ts +5 -0
- package/build/component/driver/apiKey/error/apiKeyNameTooLong.d.ts.map +1 -0
- package/build/component/driver/apiKey/error/apiKeyNameTooLong.js +21 -0
- package/build/component/driver/apiKey/error/apiKeyNameTooLong.js.map +1 -0
- package/build/component/driver/apiKey/interface/createApiKeyArgs.d.ts +7 -0
- package/build/component/driver/apiKey/interface/createApiKeyArgs.d.ts.map +1 -0
- package/build/component/driver/apiKey/interface/createApiKeyArgs.js +5 -0
- package/build/component/driver/apiKey/interface/createApiKeyArgs.js.map +1 -0
- package/build/component/driver/apiKey/interface/createApiKeyOutputs.d.ts +7 -0
- package/build/component/driver/apiKey/interface/createApiKeyOutputs.d.ts.map +1 -0
- package/build/component/driver/apiKey/interface/createApiKeyOutputs.js +10 -0
- package/build/component/driver/apiKey/interface/createApiKeyOutputs.js.map +1 -0
- package/build/component/driver/apiKey/utility/constants.d.ts +10 -0
- package/build/component/driver/apiKey/utility/constants.d.ts.map +1 -0
- package/build/component/driver/apiKey/utility/constants.js +15 -0
- package/build/component/driver/apiKey/utility/constants.js.map +1 -0
- package/build/component/driver/deploy/azure/impl/azureDeployImpl.d.ts.map +1 -1
- package/build/component/driver/deploy/azure/impl/azureDeployImpl.js +6 -6
- package/build/component/driver/deploy/azure/impl/azureDeployImpl.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/script/scriptDriver.d.ts.map +1 -1
- package/build/component/driver/script/scriptDriver.js +2 -2
- package/build/component/driver/script/scriptDriver.js.map +1 -1
- package/build/component/driver/teamsApp/clients/appStudioClient.d.ts +13 -0
- package/build/component/driver/teamsApp/clients/appStudioClient.d.ts.map +1 -1
- package/build/component/driver/teamsApp/clients/appStudioClient.js +38 -0
- package/build/component/driver/teamsApp/clients/appStudioClient.js.map +1 -1
- package/build/component/driver/teamsApp/constants.d.ts +2 -0
- package/build/component/driver/teamsApp/constants.d.ts.map +1 -1
- package/build/component/driver/teamsApp/constants.js +2 -0
- package/build/component/driver/teamsApp/constants.js.map +1 -1
- package/build/component/driver/teamsApp/createAppPackage.d.ts.map +1 -1
- package/build/component/driver/teamsApp/createAppPackage.js +26 -6
- package/build/component/driver/teamsApp/createAppPackage.js.map +1 -1
- package/build/component/driver/teamsApp/interfaces/ApiSecretRegistration.d.ts +44 -0
- package/build/component/driver/teamsApp/interfaces/ApiSecretRegistration.d.ts.map +1 -0
- package/build/component/driver/teamsApp/interfaces/ApiSecretRegistration.js +21 -0
- package/build/component/driver/teamsApp/interfaces/ApiSecretRegistration.js.map +1 -0
- package/build/component/driver/teamsApp/interfaces/ApiSecretRegistrationClientSecret.d.ts +15 -0
- package/build/component/driver/teamsApp/interfaces/ApiSecretRegistrationClientSecret.d.ts.map +1 -0
- package/build/component/driver/teamsApp/interfaces/ApiSecretRegistrationClientSecret.js +5 -0
- package/build/component/driver/teamsApp/interfaces/ApiSecretRegistrationClientSecret.js.map +1 -0
- package/build/component/driver/teamsApp/interfaces/appdefinitions/IValidationResult.d.ts +1 -1
- package/build/component/driver/teamsApp/interfaces/appdefinitions/IValidationResult.d.ts.map +1 -1
- package/build/component/driver/teamsApp/teamsappMgr.js +7 -7
- package/build/component/driver/teamsApp/teamsappMgr.js.map +1 -1
- package/build/component/driver/teamsApp/validate.d.ts.map +1 -1
- package/build/component/driver/teamsApp/validate.js +7 -2
- package/build/component/driver/teamsApp/validate.js.map +1 -1
- package/build/component/driver/teamsApp/validateAppPackage.d.ts.map +1 -1
- package/build/component/driver/teamsApp/validateAppPackage.js +35 -7
- 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 +40 -20
- package/build/component/generator/copilotPlugin/generator.js.map +1 -1
- package/build/component/generator/copilotPlugin/helper.d.ts +1 -2
- package/build/component/generator/copilotPlugin/helper.d.ts.map +1 -1
- package/build/component/generator/copilotPlugin/helper.js +36 -21
- package/build/component/generator/copilotPlugin/helper.js.map +1 -1
- package/build/component/generator/error.d.ts +0 -6
- package/build/component/generator/error.d.ts.map +1 -1
- package/build/component/generator/error.js +1 -13
- package/build/component/generator/error.js.map +1 -1
- package/build/component/generator/generator.d.ts +5 -1
- package/build/component/generator/generator.d.ts.map +1 -1
- package/build/component/generator/generator.js +13 -8
- package/build/component/generator/generator.js.map +1 -1
- package/build/component/generator/generatorAction.d.ts +2 -0
- package/build/component/generator/generatorAction.d.ts.map +1 -1
- package/build/component/generator/generatorAction.js +6 -6
- package/build/component/generator/generatorAction.js.map +1 -1
- package/build/component/generator/officeAddin/helperMethods.d.ts.map +1 -1
- package/build/component/generator/officeAddin/helperMethods.js +19 -26
- package/build/component/generator/officeAddin/helperMethods.js.map +1 -1
- package/build/component/generator/spfx/spfxGenerator.d.ts.map +1 -1
- package/build/component/generator/spfx/spfxGenerator.js +7 -0
- package/build/component/generator/spfx/spfxGenerator.js.map +1 -1
- package/build/component/generator/spfx/utils/constants.d.ts +1 -14
- package/build/component/generator/spfx/utils/constants.d.ts.map +1 -1
- package/build/component/generator/spfx/utils/constants.js +1 -14
- package/build/component/generator/spfx/utils/constants.js.map +1 -1
- package/build/component/generator/utils.d.ts +2 -4
- package/build/component/generator/utils.d.ts.map +1 -1
- package/build/component/generator/utils.js +4 -14
- package/build/component/generator/utils.js.map +1 -1
- package/build/component/middleware/questionMW.d.ts +1 -1
- package/build/component/middleware/questionMW.d.ts.map +1 -1
- package/build/component/middleware/questionMW.js +4 -1
- package/build/component/middleware/questionMW.js.map +1 -1
- package/build/component/utils/ResourceGroupHelper.d.ts +1 -0
- package/build/component/utils/ResourceGroupHelper.d.ts.map +1 -1
- package/build/component/utils/ResourceGroupHelper.js +31 -1
- package/build/component/utils/ResourceGroupHelper.js.map +1 -1
- package/build/component/utils/envUtil.js +1 -1
- package/build/component/utils/envUtil.js.map +1 -1
- package/build/component/utils/metadataGraphPermssion.d.ts +16 -0
- package/build/component/utils/metadataGraphPermssion.d.ts.map +1 -0
- package/build/component/utils/metadataGraphPermssion.js +96 -0
- package/build/component/utils/metadataGraphPermssion.js.map +1 -0
- package/build/component/utils/metadataUtil.d.ts.map +1 -1
- package/build/component/utils/metadataUtil.js +2 -0
- package/build/component/utils/metadataUtil.js.map +1 -1
- package/build/core/FxCore.d.ts +2 -0
- package/build/core/FxCore.d.ts.map +1 -1
- package/build/core/FxCore.js +81 -5
- package/build/core/FxCore.js.map +1 -1
- package/build/core/middleware/projectMigratorV3.js +1 -1
- package/build/core/middleware/projectMigratorV3.js.map +1 -1
- package/build/core/middleware/utils/debug/taskMigrator.js +1 -1
- package/build/error/common.d.ts +9 -0
- package/build/error/common.d.ts.map +1 -1
- package/build/error/common.js +34 -1
- package/build/error/common.js.map +1 -1
- package/build/error/teamsApp.d.ts +4 -1
- package/build/error/teamsApp.d.ts.map +1 -1
- package/build/error/teamsApp.js +13 -1
- package/build/error/teamsApp.js.map +1 -1
- package/build/index.d.ts +3 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +7 -1
- package/build/index.js.map +1 -1
- package/build/question/create.d.ts +2 -1
- package/build/question/create.d.ts.map +1 -1
- package/build/question/create.js +66 -16
- package/build/question/create.js.map +1 -1
- package/build/question/generator.js +0 -2
- 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 +3 -0
- package/build/question/index.js.map +1 -1
- package/build/question/inputs/CreateProjectInputs.d.ts +1 -1
- package/build/question/inputs/CreateProjectInputs.d.ts.map +1 -1
- package/build/question/inputs/DeployAadManifestInputs.d.ts +1 -1
- package/build/question/inputs/DeployAadManifestInputs.d.ts.map +1 -1
- package/build/question/inputs/PermissionGrantInputs.d.ts +2 -2
- package/build/question/inputs/PermissionGrantInputs.d.ts.map +1 -1
- package/build/question/inputs/PermissionListInputs.d.ts +1 -1
- package/build/question/inputs/PermissionListInputs.d.ts.map +1 -1
- package/build/question/options/CreateProjectOptions.d.ts.map +1 -1
- package/build/question/options/CreateProjectOptions.js +2 -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 +2 -2
- package/build/question/options/DeployAadManifestOptions.js.map +1 -1
- package/build/question/options/PermissionGrantOptions.js +2 -2
- package/build/question/options/PermissionGrantOptions.js.map +1 -1
- package/build/question/options/PermissionListOptions.js +2 -2
- package/build/question/options/PermissionListOptions.js.map +1 -1
- package/build/question/other.d.ts +1 -0
- package/build/question/other.d.ts.map +1 -1
- package/build/question/other.js +66 -7
- 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 +1 -2
- package/build/ui/visitor.js.map +1 -1
- package/package.json +9 -18
- package/resource/package.nls.json +65 -44
- package/resource/yaml-schema/v1.3/yaml.schema.json +79 -32
- package/templates/core/v3Migration/csharp.app.local.yml +6 -6
- package/templates/core/v3Migration/csharp.app.yml +6 -6
- package/templates/core/v3Migration/js.ts.app.local.yml +11 -11
- package/templates/core/v3Migration/js.ts.app.yml +12 -12
- 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/V3/Enable SSO.txt +2 -2
- package/templates/plugins/resource/aad/auth/bot/README.md +13 -13
- package/templates/plugins/resource/aad/auth/bot/README.txt +7 -7
- 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/README.md +6 -6
- package/templates/plugins/resource/aad/auth/tab/README.txt +5 -5
- 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/js/sso/GetUserProfile.jsx +1 -1
- 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
- package/templates/plugins/resource/aad/auth/tab/ts/sso/GetUserProfile.tsx +1 -1
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
"use strict";
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.SpecParser = void 0;
|
|
6
|
+
const tslib_1 = require("tslib");
|
|
7
|
+
const swagger_parser_1 = tslib_1.__importDefault(require("@apidevtools/swagger-parser"));
|
|
8
|
+
const interfaces_1 = require("./interfaces");
|
|
9
|
+
const specParserError_1 = require("./specParserError");
|
|
10
|
+
const utils_1 = require("./utils");
|
|
11
|
+
const constants_1 = require("./constants");
|
|
12
|
+
/**
|
|
13
|
+
* A class that parses an OpenAPI specification file and provides methods to validate, list, and generate artifacts.
|
|
14
|
+
*/
|
|
15
|
+
class SpecParser {
|
|
16
|
+
/**
|
|
17
|
+
* Creates a new instance of the SpecParser class.
|
|
18
|
+
* @param pathOrDoc The path to the OpenAPI specification file or the OpenAPI specification object.
|
|
19
|
+
* @param options The options for parsing the OpenAPI specification file.
|
|
20
|
+
*/
|
|
21
|
+
constructor(pathOrDoc, options) {
|
|
22
|
+
this.defaultOptions = {
|
|
23
|
+
allowMissingId: false,
|
|
24
|
+
allowSwagger: false,
|
|
25
|
+
allowAPIKeyAuth: false,
|
|
26
|
+
allowMultipleParameters: false,
|
|
27
|
+
};
|
|
28
|
+
this.pathOrSpec = pathOrDoc;
|
|
29
|
+
this.parser = new swagger_parser_1.default();
|
|
30
|
+
this.options = Object.assign(Object.assign({}, this.defaultOptions), (options !== null && options !== void 0 ? options : {}));
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Validates the OpenAPI specification file and returns a validation result.
|
|
34
|
+
*
|
|
35
|
+
* @returns A validation result object that contains information about any errors or warnings in the specification file.
|
|
36
|
+
*/
|
|
37
|
+
async validate() {
|
|
38
|
+
try {
|
|
39
|
+
try {
|
|
40
|
+
await this.loadSpec();
|
|
41
|
+
await this.parser.validate(this.spec);
|
|
42
|
+
}
|
|
43
|
+
catch (e) {
|
|
44
|
+
return {
|
|
45
|
+
status: interfaces_1.ValidationStatus.Error,
|
|
46
|
+
warnings: [],
|
|
47
|
+
errors: [{ type: interfaces_1.ErrorType.SpecNotValid, content: e.toString() }],
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
if (!this.options.allowSwagger && this.isSwaggerFile) {
|
|
51
|
+
return {
|
|
52
|
+
status: interfaces_1.ValidationStatus.Error,
|
|
53
|
+
warnings: [],
|
|
54
|
+
errors: [
|
|
55
|
+
{ type: interfaces_1.ErrorType.SwaggerNotSupported, content: constants_1.ConstantString.SwaggerNotSupported },
|
|
56
|
+
],
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
return utils_1.validateSpec(this.spec, this.parser, !!this.isSwaggerFile, this.options.allowMissingId, this.options.allowAPIKeyAuth, this.options.allowMultipleParameters);
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
throw new specParserError_1.SpecParserError(err.toString(), interfaces_1.ErrorType.ValidateFailed);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
async listSupportedAPIInfo() {
|
|
66
|
+
try {
|
|
67
|
+
await this.loadSpec();
|
|
68
|
+
const apiMap = this.getAllSupportedAPIs(this.spec);
|
|
69
|
+
const apiInfos = [];
|
|
70
|
+
for (const key in apiMap) {
|
|
71
|
+
const pathObjectItem = apiMap[key];
|
|
72
|
+
const [method, path] = key.split(" ");
|
|
73
|
+
const operationId = pathObjectItem.operationId;
|
|
74
|
+
// In Browser environment, this api is by default not support api without operationId
|
|
75
|
+
if (!operationId) {
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
const [command, warning] = utils_1.parseApiInfo(pathObjectItem, this.options.allowMultipleParameters);
|
|
79
|
+
const apiInfo = {
|
|
80
|
+
method: method,
|
|
81
|
+
path: path,
|
|
82
|
+
title: command.title,
|
|
83
|
+
id: operationId,
|
|
84
|
+
parameters: command.parameters,
|
|
85
|
+
description: command.description,
|
|
86
|
+
};
|
|
87
|
+
if (warning) {
|
|
88
|
+
apiInfo.warning = warning;
|
|
89
|
+
}
|
|
90
|
+
apiInfos.push(apiInfo);
|
|
91
|
+
}
|
|
92
|
+
return apiInfos;
|
|
93
|
+
}
|
|
94
|
+
catch (err) {
|
|
95
|
+
throw new specParserError_1.SpecParserError(err.toString(), interfaces_1.ErrorType.listSupportedAPIInfoFailed);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Lists all the OpenAPI operations in the specification file.
|
|
100
|
+
* @returns A string array that represents the HTTP method and path of each operation, such as ['GET /pets/{petId}', 'GET /user/{userId}']
|
|
101
|
+
* according to copilot plugin spec, only list get and post method without auth
|
|
102
|
+
*/
|
|
103
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
104
|
+
async list() {
|
|
105
|
+
throw new Error("Method not implemented.");
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Generates and update artifacts from the OpenAPI specification file. Generate Adaptive Cards, update Teams app manifest, and generate a new OpenAPI specification file.
|
|
109
|
+
* @param manifestPath A file path of the Teams app manifest file to update.
|
|
110
|
+
* @param filter An array of strings that represent the filters to apply when generating the artifacts. If filter is empty, it would process nothing.
|
|
111
|
+
* @param outputSpecPath File path of the new OpenAPI specification file to generate. If not specified or empty, no spec file will be generated.
|
|
112
|
+
* @param adaptiveCardFolder Folder path where the Adaptive Card files will be generated. If not specified or empty, Adaptive Card files will not be generated.
|
|
113
|
+
*/
|
|
114
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
115
|
+
async generate(manifestPath, filter, outputSpecPath, adaptiveCardFolder, signal) {
|
|
116
|
+
throw new Error("Method not implemented.");
|
|
117
|
+
}
|
|
118
|
+
async loadSpec() {
|
|
119
|
+
if (!this.spec) {
|
|
120
|
+
this.unResolveSpec = (await this.parser.parse(this.pathOrSpec));
|
|
121
|
+
if (!this.unResolveSpec.openapi && this.unResolveSpec.swagger === "2.0") {
|
|
122
|
+
this.isSwaggerFile = true;
|
|
123
|
+
}
|
|
124
|
+
const clonedUnResolveSpec = JSON.parse(JSON.stringify(this.unResolveSpec));
|
|
125
|
+
this.spec = (await this.parser.dereference(clonedUnResolveSpec));
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
getAllSupportedAPIs(spec) {
|
|
129
|
+
if (this.apiMap !== undefined) {
|
|
130
|
+
return this.apiMap;
|
|
131
|
+
}
|
|
132
|
+
const result = utils_1.listSupportedAPIs(spec, this.options.allowMissingId, this.options.allowAPIKeyAuth, this.options.allowMultipleParameters);
|
|
133
|
+
this.apiMap = result;
|
|
134
|
+
return result;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
exports.SpecParser = SpecParser;
|
|
138
|
+
//# sourceMappingURL=specParser.browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"specParser.browser.js","sourceRoot":"","sources":["../../../src/common/spec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xF;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,CACrC,CAAC;QACF,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAzKD,gCAyKC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import SwaggerParser from "@apidevtools/swagger-parser";
|
|
2
2
|
import { OpenAPIV3 } from "openapi-types";
|
|
3
|
-
import { APIInfo, GenerateResult, ParseOptions, ValidateResult } from "./interfaces";
|
|
3
|
+
import { APIInfo, GenerateResult, ListAPIResult, ParseOptions, ValidateResult } from "./interfaces";
|
|
4
4
|
/**
|
|
5
5
|
* A class that parses an OpenAPI specification file and provides methods to validate, list, and generate artifacts.
|
|
6
6
|
*/
|
|
7
7
|
export declare class SpecParser {
|
|
8
8
|
readonly pathOrSpec: string | OpenAPIV3.Document;
|
|
9
9
|
readonly parser: SwaggerParser;
|
|
10
|
-
readonly options: ParseOptions
|
|
10
|
+
readonly options: Required<ParseOptions>;
|
|
11
11
|
private apiMap;
|
|
12
12
|
private spec;
|
|
13
13
|
private unResolveSpec;
|
|
@@ -31,12 +31,7 @@ export declare class SpecParser {
|
|
|
31
31
|
* @returns A string array that represents the HTTP method and path of each operation, such as ['GET /pets/{petId}', 'GET /user/{userId}']
|
|
32
32
|
* according to copilot plugin spec, only list get and post method without auth
|
|
33
33
|
*/
|
|
34
|
-
list(): Promise<
|
|
35
|
-
/**
|
|
36
|
-
* List all the OpenAPI operations in the specification file and return a map of operationId and operation path.
|
|
37
|
-
* @returns A map of operationId and operation path, such as [{'getPetById': 'GET /pets/{petId}'}, {'getUser': 'GET /user/{userId}'}]
|
|
38
|
-
*/
|
|
39
|
-
listOperationMap(): Promise<Map<string, string>>;
|
|
34
|
+
list(): Promise<ListAPIResult[]>;
|
|
40
35
|
/**
|
|
41
36
|
* Generates and update artifacts from the OpenAPI specification file. Generate Adaptive Cards, update Teams app manifest, and generate a new OpenAPI specification file.
|
|
42
37
|
* @param manifestPath A file path of the Teams app manifest file to update.
|
|
@@ -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,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;AActB;;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,CAKpB;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;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;CAe5B"}
|
|
@@ -30,6 +30,8 @@ class SpecParser {
|
|
|
30
30
|
this.defaultOptions = {
|
|
31
31
|
allowMissingId: true,
|
|
32
32
|
allowSwagger: true,
|
|
33
|
+
allowAPIKeyAuth: false,
|
|
34
|
+
allowMultipleParameters: false,
|
|
33
35
|
};
|
|
34
36
|
this.pathOrSpec = pathOrDoc;
|
|
35
37
|
this.parser = new swagger_parser_1.default();
|
|
@@ -62,7 +64,7 @@ class SpecParser {
|
|
|
62
64
|
],
|
|
63
65
|
};
|
|
64
66
|
}
|
|
65
|
-
return utils_1.validateSpec(this.spec, this.parser, !!this.isSwaggerFile);
|
|
67
|
+
return utils_1.validateSpec(this.spec, this.parser, !!this.isSwaggerFile, this.options.allowMissingId, this.options.allowAPIKeyAuth, this.options.allowMultipleParameters);
|
|
66
68
|
}
|
|
67
69
|
catch (err) {
|
|
68
70
|
throw new specParserError_1.SpecParserError(err.toString(), interfaces_1.ErrorType.ValidateFailed);
|
|
@@ -78,38 +80,50 @@ class SpecParser {
|
|
|
78
80
|
* according to copilot plugin spec, only list get and post method without auth
|
|
79
81
|
*/
|
|
80
82
|
async list() {
|
|
83
|
+
var _a;
|
|
81
84
|
try {
|
|
82
85
|
await this.loadSpec();
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
86
|
+
const spec = this.spec;
|
|
87
|
+
const apiMap = this.getAllSupportedAPIs(spec);
|
|
88
|
+
const result = [];
|
|
89
|
+
for (const apiKey in apiMap) {
|
|
90
|
+
const apiResult = {
|
|
91
|
+
api: "",
|
|
92
|
+
server: "",
|
|
93
|
+
operationId: "",
|
|
94
|
+
};
|
|
95
|
+
const [method, path] = apiKey.split(" ");
|
|
96
|
+
const operation = apiMap[apiKey];
|
|
97
|
+
const rootServer = spec.servers && spec.servers[0];
|
|
98
|
+
const methodServer = spec.paths[path].servers && ((_a = spec.paths[path]) === null || _a === void 0 ? void 0 : _a.servers[0]);
|
|
99
|
+
const operationServer = operation.servers && operation.servers[0];
|
|
100
|
+
const serverUrl = operationServer || methodServer || rootServer;
|
|
101
|
+
if (!serverUrl) {
|
|
102
|
+
throw new specParserError_1.SpecParserError(constants_1.ConstantString.NoServerInformation, interfaces_1.ErrorType.NoServerInformation);
|
|
103
|
+
}
|
|
104
|
+
apiResult.server = serverUrl.url;
|
|
105
|
+
let operationId = operation.operationId;
|
|
102
106
|
if (!operationId) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
107
|
+
operationId = `${method.toLowerCase()}${utils_1.convertPathToCamelCase(path)}`;
|
|
108
|
+
}
|
|
109
|
+
apiResult.operationId = operationId;
|
|
110
|
+
const apiKeyAuthArray = utils_1.getAPIKeyAuthArray(operation.security, spec);
|
|
111
|
+
for (const apiKeyAuth of apiKeyAuthArray) {
|
|
112
|
+
if (apiKeyAuth.length === 1) {
|
|
113
|
+
apiResult.auth = apiKeyAuth[0];
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
106
116
|
}
|
|
107
|
-
|
|
117
|
+
apiResult.api = apiKey;
|
|
118
|
+
result.push(apiResult);
|
|
108
119
|
}
|
|
109
|
-
return
|
|
120
|
+
return result;
|
|
110
121
|
}
|
|
111
122
|
catch (err) {
|
|
112
|
-
|
|
123
|
+
if (err instanceof specParserError_1.SpecParserError) {
|
|
124
|
+
throw err;
|
|
125
|
+
}
|
|
126
|
+
throw new specParserError_1.SpecParserError(err.toString(), interfaces_1.ErrorType.ListFailed);
|
|
113
127
|
}
|
|
114
128
|
}
|
|
115
129
|
/**
|
|
@@ -132,7 +146,38 @@ class SpecParser {
|
|
|
132
146
|
if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
|
|
133
147
|
throw new specParserError_1.SpecParserError(constants_1.ConstantString.CancelledMessage, interfaces_1.ErrorType.Cancelled);
|
|
134
148
|
}
|
|
135
|
-
const newUnResolvedSpec = specFilter_1.specFilter(filter, this.unResolveSpec, this.spec, this.options.allowMissingId);
|
|
149
|
+
const newUnResolvedSpec = specFilter_1.specFilter(filter, this.unResolveSpec, this.spec, this.options.allowMissingId, this.options.allowAPIKeyAuth, this.options.allowMultipleParameters);
|
|
150
|
+
if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
|
|
151
|
+
throw new specParserError_1.SpecParserError(constants_1.ConstantString.CancelledMessage, interfaces_1.ErrorType.Cancelled);
|
|
152
|
+
}
|
|
153
|
+
const newSpec = (await this.parser.dereference(newUnResolvedSpec));
|
|
154
|
+
const operationIdToAPIAuthKey = new Map();
|
|
155
|
+
let hasMultipleAPIKeyAuth = false;
|
|
156
|
+
let firstAuthKey;
|
|
157
|
+
for (const url in newSpec.paths) {
|
|
158
|
+
for (const method in newSpec.paths[url]) {
|
|
159
|
+
const operation = newSpec.paths[url][method];
|
|
160
|
+
const apiKeyAuthArr = utils_1.getAPIKeyAuthArray(operation.security, newSpec);
|
|
161
|
+
// Currently we don't support multiple apiKey auth
|
|
162
|
+
if (apiKeyAuthArr.length > 0 && apiKeyAuthArr.every((auths) => auths.length > 1)) {
|
|
163
|
+
hasMultipleAPIKeyAuth = true;
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
if (apiKeyAuthArr && apiKeyAuthArr.length > 0) {
|
|
167
|
+
if (!firstAuthKey) {
|
|
168
|
+
firstAuthKey = apiKeyAuthArr[0][0];
|
|
169
|
+
}
|
|
170
|
+
else if (firstAuthKey.name !== apiKeyAuthArr[0][0].name) {
|
|
171
|
+
hasMultipleAPIKeyAuth = true;
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
operationIdToAPIAuthKey.set(operation.operationId, apiKeyAuthArr[0][0]);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
if (hasMultipleAPIKeyAuth) {
|
|
179
|
+
throw new specParserError_1.SpecParserError(constants_1.ConstantString.MultipleAPIKeyNotSupported, interfaces_1.ErrorType.MultipleAPIKeyNotSupported);
|
|
180
|
+
}
|
|
136
181
|
let resultStr;
|
|
137
182
|
if (outputSpecPath.endsWith(".yaml") || outputSpecPath.endsWith(".yml")) {
|
|
138
183
|
resultStr = js_yaml_1.default.dump(newUnResolvedSpec);
|
|
@@ -141,35 +186,29 @@ class SpecParser {
|
|
|
141
186
|
resultStr = JSON.stringify(newUnResolvedSpec, null, 2);
|
|
142
187
|
}
|
|
143
188
|
await fs_extra_1.default.outputFile(outputSpecPath, resultStr);
|
|
144
|
-
if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
|
|
145
|
-
throw new specParserError_1.SpecParserError(constants_1.ConstantString.CancelledMessage, interfaces_1.ErrorType.Cancelled);
|
|
146
|
-
}
|
|
147
|
-
const newSpec = (await this.parser.dereference(newUnResolvedSpec));
|
|
148
189
|
for (const url in newSpec.paths) {
|
|
149
190
|
for (const method in newSpec.paths[url]) {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
});
|
|
165
|
-
}
|
|
191
|
+
const operation = newSpec.paths[url][method];
|
|
192
|
+
try {
|
|
193
|
+
const [card, jsonPath] = adaptiveCardGenerator_1.generateAdaptiveCard(operation);
|
|
194
|
+
const fileName = path_1.default.join(adaptiveCardFolder, `${operation.operationId}.json`);
|
|
195
|
+
const wrappedCard = adaptiveCardWrapper_1.wrapAdaptiveCard(card, jsonPath);
|
|
196
|
+
await fs_extra_1.default.outputJSON(fileName, wrappedCard, { spaces: 2 });
|
|
197
|
+
}
|
|
198
|
+
catch (err) {
|
|
199
|
+
result.allSuccess = false;
|
|
200
|
+
result.warnings.push({
|
|
201
|
+
type: interfaces_1.WarningType.GenerateCardFailed,
|
|
202
|
+
content: err.toString(),
|
|
203
|
+
data: operation.operationId,
|
|
204
|
+
});
|
|
166
205
|
}
|
|
167
206
|
}
|
|
168
207
|
}
|
|
169
208
|
if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
|
|
170
209
|
throw new specParserError_1.SpecParserError(constants_1.ConstantString.CancelledMessage, interfaces_1.ErrorType.Cancelled);
|
|
171
210
|
}
|
|
172
|
-
const [updatedManifest, warnings] = await manifestUpdater_1.updateManifest(manifestPath, outputSpecPath, adaptiveCardFolder, newSpec);
|
|
211
|
+
const [updatedManifest, warnings] = await manifestUpdater_1.updateManifest(manifestPath, outputSpecPath, adaptiveCardFolder, newSpec, this.options.allowMultipleParameters, firstAuthKey === null || firstAuthKey === void 0 ? void 0 : firstAuthKey.name);
|
|
173
212
|
await fs_extra_1.default.outputJSON(manifestPath, updatedManifest, { spaces: 2 });
|
|
174
213
|
result.warnings.push(...warnings);
|
|
175
214
|
}
|
|
@@ -198,7 +237,7 @@ class SpecParser {
|
|
|
198
237
|
if (this.apiMap !== undefined) {
|
|
199
238
|
return this.apiMap;
|
|
200
239
|
}
|
|
201
|
-
const result = utils_1.listSupportedAPIs(spec, this.options.allowMissingId);
|
|
240
|
+
const result = utils_1.listSupportedAPIs(spec, this.options.allowMissingId, this.options.allowAPIKeyAuth, this.options.allowMultipleParameters);
|
|
202
241
|
this.apiMap = result;
|
|
203
242
|
return result;
|
|
204
243
|
}
|
|
@@ -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,
|
|
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,mCAKiB;AACjB,uDAAmD;AACnD,mEAA+D;AAC/D,+DAAyD;AAEzD;;GAEG;AACH,MAAa,UAAU;IAiBrB;;;;OAIG;IACH,YAAY,SAAsC,EAAE,OAAsB;QAZlE,mBAAc,GAAiB;YACrC,cAAc,EAAE,IAAI;YACpB,YAAY,EAAE,IAAI;YAClB,eAAe,EAAE,KAAK;YACtB,uBAAuB,EAAE,KAAK;SAC/B,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,cAAP,OAAO,GAAI,EAAE,CAAC,CACO,CAAC;IAC9B,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,QAAQ;QACZ,IAAI;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IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;YACd,IAAI,CAAC,aAAa,GAAG,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAuB,CAAC;YACtF,qCAAqC;YACrC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,IAAK,IAAI,CAAC,aAAqB,CAAC,OAAO,KAAK,KAAK,EAAE;gBAChF,MAAM,OAAO,GAAG,MAAM,yBAAS,CAAC,OAAO,CAAC,IAAI,CAAC,aAAoB,EAAE,EAAE,CAAC,CAAC;gBACvE,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,OAA6B,CAAC;gBAC3D,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;aAC3B;YAED,MAAM,mBAAmB,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;YAC3E,IAAI,CAAC,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,mBAAmB,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,CACrC,CAAC;QACF,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA5SD,gCA4SC"}
|
|
@@ -18,20 +18,23 @@ 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): boolean;
|
|
21
|
+
export declare function isSupportedApi(method: string, path: string, spec: OpenAPIV3.Document, allowMissingId: boolean, allowAPIKeyAuth: boolean, allowMultipleParameters: boolean): boolean;
|
|
22
|
+
export declare function getAPIKeyAuthArray(securities: OpenAPIV3.SecurityRequirementObject[] | undefined, spec: OpenAPIV3.Document): OpenAPIV3.ApiKeySecurityScheme[][];
|
|
22
23
|
export declare function updateFirstLetter(str: string): string;
|
|
23
|
-
export declare function getRelativePath(from: string, to: string): string;
|
|
24
24
|
export declare function getResponseJson(operationObject: OpenAPIV3.OperationObject | undefined): OpenAPIV3.MediaTypeObject;
|
|
25
25
|
export declare function convertPathToCamelCase(path: string): string;
|
|
26
26
|
export declare function getUrlProtocol(urlString: string): string | undefined;
|
|
27
27
|
export declare function resolveServerUrl(url: string): string;
|
|
28
28
|
export declare function checkServerUrl(servers: OpenAPIV3.ServerObject[]): ErrorResult[];
|
|
29
|
-
export declare function validateServer(spec: OpenAPIV3.Document, allowMissingId: boolean): ErrorResult[];
|
|
29
|
+
export declare function validateServer(spec: OpenAPIV3.Document, allowMissingId: boolean, allowAPIKeyAuth: boolean, allowMultipleParameters: boolean): ErrorResult[];
|
|
30
30
|
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
|
|
31
|
+
export declare function generateParametersFromSchema(schema: OpenAPIV3.SchemaObject, name: string, allowMultipleParameters: boolean, isRequired?: boolean): [Parameter[], Parameter[]];
|
|
32
|
+
export declare function updateParameterWithInputType(schema: OpenAPIV3.SchemaObject, param: Parameter): void;
|
|
33
|
+
export declare function parseApiInfo(operationItem: OpenAPIV3.OperationObject, allowMultipleParameters: boolean): [IMessagingExtensionCommand, WarningResult | undefined];
|
|
34
|
+
export declare function listSupportedAPIs(spec: OpenAPIV3.Document, allowMissingId: boolean, allowAPIKeyAuth: boolean, allowMultipleParameters: boolean): {
|
|
34
35
|
[key: string]: OpenAPIV3.OperationObject;
|
|
35
36
|
};
|
|
36
|
-
export declare function validateSpec(spec: OpenAPIV3.Document, parser: SwaggerParser, isSwaggerFile: boolean): ValidateResult;
|
|
37
|
+
export declare function validateSpec(spec: OpenAPIV3.Document, parser: SwaggerParser, isSwaggerFile: boolean, allowMissingId: boolean, allowAPIKeyAuth: boolean, allowMultipleParameters: boolean): ValidateResult;
|
|
38
|
+
export declare function format(str: string, ...args: string[]): string;
|
|
39
|
+
export declare function getSafeRegistrationIdEnvName(authName: string): string;
|
|
37
40
|
//# 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;
|
|
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;;;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