@microsoft/teamsfx-core 2.0.7-alpha.409a3da2f.0 → 2.0.7-alpha.48b9eab36.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 +5 -1
- package/build/common/constants.d.ts.map +1 -1
- package/build/common/constants.js +5 -1
- package/build/common/constants.js.map +1 -1
- package/build/common/featureFlags.d.ts +3 -0
- package/build/common/featureFlags.d.ts.map +1 -1
- package/build/common/featureFlags.js +14 -1
- package/build/common/featureFlags.js.map +1 -1
- package/build/common/local/packageJsonHelper.d.ts.map +1 -1
- package/build/common/local/packageJsonHelper.js +1 -2
- package/build/common/local/packageJsonHelper.js.map +1 -1
- package/build/common/m365/packageService.d.ts +1 -0
- package/build/common/m365/packageService.d.ts.map +1 -1
- package/build/common/m365/packageService.js +15 -2
- package/build/common/m365/packageService.js.map +1 -1
- package/build/common/projectTypeChecker.d.ts.map +1 -1
- package/build/common/projectTypeChecker.js +1 -2
- package/build/common/projectTypeChecker.js.map +1 -1
- package/build/common/samples.d.ts +3 -2
- package/build/common/samples.d.ts.map +1 -1
- package/build/common/samples.js +84 -40
- package/build/common/samples.js.map +1 -1
- package/build/common/telemetry.d.ts +3 -1
- package/build/common/telemetry.d.ts.map +1 -1
- package/build/common/telemetry.js +2 -0
- package/build/common/telemetry.js.map +1 -1
- package/build/common/templates-config.json +1 -0
- 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/common/wrappedAxiosClient.d.ts +59 -0
- package/build/common/wrappedAxiosClient.d.ts.map +1 -0
- package/build/common/wrappedAxiosClient.js +247 -0
- package/build/common/wrappedAxiosClient.js.map +1 -0
- package/build/component/configManager/lifecycle.js +1 -1
- package/build/component/configManager/lifecycle.js.map +1 -1
- package/build/component/constant/commonConstant.d.ts +5 -0
- package/build/component/constant/commonConstant.d.ts.map +1 -1
- package/build/component/constant/commonConstant.js +7 -1
- package/build/component/constant/commonConstant.js.map +1 -1
- package/build/component/coordinator/index.d.ts +8 -1
- package/build/component/coordinator/index.d.ts.map +1 -1
- package/build/component/coordinator/index.js +63 -8
- package/build/component/coordinator/index.js.map +1 -1
- package/build/component/developerPortalScaffoldUtils.d.ts.map +1 -1
- package/build/component/developerPortalScaffoldUtils.js +0 -2
- package/build/component/developerPortalScaffoldUtils.js.map +1 -1
- package/build/component/driver/aad/utility/aadAppClient.d.ts +1 -0
- package/build/component/driver/aad/utility/aadAppClient.d.ts.map +1 -1
- package/build/component/driver/aad/utility/aadAppClient.js +16 -2
- package/build/component/driver/aad/utility/aadAppClient.js.map +1 -1
- package/build/component/driver/apiKey/create.d.ts.map +1 -1
- package/build/component/driver/apiKey/create.js +2 -4
- package/build/component/driver/apiKey/create.js.map +1 -1
- package/build/component/driver/botFramework/createOrUpdateBot.d.ts.map +1 -1
- package/build/component/driver/botFramework/createOrUpdateBot.js +0 -2
- package/build/component/driver/botFramework/createOrUpdateBot.js.map +1 -1
- package/build/component/driver/deploy/azure/impl/AzureZipDeployImpl.d.ts.map +1 -1
- package/build/component/driver/deploy/azure/impl/AzureZipDeployImpl.js +5 -5
- package/build/component/driver/deploy/azure/impl/AzureZipDeployImpl.js.map +1 -1
- package/build/component/driver/middleware/addSWADeployTelemetry.js +1 -2
- package/build/component/driver/middleware/addSWADeployTelemetry.js.map +1 -1
- package/build/component/driver/teamsApp/appStudio.d.ts.map +1 -1
- package/build/component/driver/teamsApp/appStudio.js +0 -2
- package/build/component/driver/teamsApp/appStudio.js.map +1 -1
- package/build/component/driver/teamsApp/clients/appStudioClient.d.ts +31 -9
- package/build/component/driver/teamsApp/clients/appStudioClient.d.ts.map +1 -1
- package/build/component/driver/teamsApp/clients/appStudioClient.js +86 -111
- package/build/component/driver/teamsApp/clients/appStudioClient.js.map +1 -1
- package/build/component/driver/teamsApp/clients/authSvcClient.d.ts.map +1 -1
- package/build/component/driver/teamsApp/clients/authSvcClient.js +3 -24
- package/build/component/driver/teamsApp/clients/authSvcClient.js.map +1 -1
- package/build/component/driver/teamsApp/configure.d.ts.map +1 -1
- package/build/component/driver/teamsApp/configure.js +0 -2
- package/build/component/driver/teamsApp/configure.js.map +1 -1
- package/build/component/driver/teamsApp/constants.d.ts +3 -0
- package/build/component/driver/teamsApp/constants.d.ts.map +1 -1
- package/build/component/driver/teamsApp/constants.js +3 -0
- package/build/component/driver/teamsApp/constants.js.map +1 -1
- package/build/component/driver/teamsApp/create.d.ts.map +1 -1
- package/build/component/driver/teamsApp/create.js +0 -2
- package/build/component/driver/teamsApp/create.js.map +1 -1
- package/build/component/driver/teamsApp/createAppPackage.d.ts +3 -0
- package/build/component/driver/teamsApp/createAppPackage.d.ts.map +1 -1
- package/build/component/driver/teamsApp/createAppPackage.js +63 -14
- package/build/component/driver/teamsApp/createAppPackage.js.map +1 -1
- package/build/component/driver/teamsApp/errors.d.ts +4 -0
- package/build/component/driver/teamsApp/errors.d.ts.map +1 -1
- package/build/component/driver/teamsApp/errors.js +7 -0
- package/build/component/driver/teamsApp/errors.js.map +1 -1
- package/build/component/driver/teamsApp/interfaces/AsyncAppValidationDetailsResponse.d.ts +21 -0
- package/build/component/driver/teamsApp/interfaces/AsyncAppValidationDetailsResponse.d.ts.map +1 -0
- package/build/component/driver/teamsApp/interfaces/AsyncAppValidationDetailsResponse.js +5 -0
- package/build/component/driver/teamsApp/interfaces/AsyncAppValidationDetailsResponse.js.map +1 -0
- package/build/component/driver/teamsApp/interfaces/AsyncAppValidationResponse.d.ts +17 -0
- package/build/component/driver/teamsApp/interfaces/AsyncAppValidationResponse.d.ts.map +1 -0
- package/build/component/driver/teamsApp/interfaces/AsyncAppValidationResponse.js +16 -0
- package/build/component/driver/teamsApp/interfaces/AsyncAppValidationResponse.js.map +1 -0
- package/build/component/driver/teamsApp/interfaces/AsyncAppValidationResultsResponse.d.ts +41 -0
- package/build/component/driver/teamsApp/interfaces/AsyncAppValidationResultsResponse.d.ts.map +1 -0
- package/build/component/driver/teamsApp/interfaces/AsyncAppValidationResultsResponse.js +5 -0
- package/build/component/driver/teamsApp/interfaces/AsyncAppValidationResultsResponse.js.map +1 -0
- package/build/component/driver/teamsApp/publishAppPackage.d.ts.map +1 -1
- package/build/component/driver/teamsApp/publishAppPackage.js +3 -5
- package/build/component/driver/teamsApp/publishAppPackage.js.map +1 -1
- package/build/component/driver/teamsApp/utils/ManifestUtils.d.ts +1 -0
- package/build/component/driver/teamsApp/utils/ManifestUtils.d.ts.map +1 -1
- package/build/component/driver/teamsApp/utils/ManifestUtils.js +17 -0
- package/build/component/driver/teamsApp/utils/ManifestUtils.js.map +1 -1
- package/build/component/driver/teamsApp/utils/PluginManifestUtils.d.ts +8 -0
- package/build/component/driver/teamsApp/utils/PluginManifestUtils.d.ts.map +1 -0
- package/build/component/driver/teamsApp/utils/PluginManifestUtils.js +63 -0
- package/build/component/driver/teamsApp/utils/PluginManifestUtils.js.map +1 -0
- package/build/component/driver/teamsApp/utils/telemetry.d.ts +0 -31
- package/build/component/driver/teamsApp/utils/telemetry.d.ts.map +1 -1
- package/build/component/driver/teamsApp/utils/telemetry.js +1 -53
- package/build/component/driver/teamsApp/utils/telemetry.js.map +1 -1
- package/build/component/driver/teamsApp/validate.d.ts.map +1 -1
- package/build/component/driver/teamsApp/validate.js +0 -1
- 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 +0 -1
- package/build/component/driver/teamsApp/validateAppPackage.js.map +1 -1
- package/build/component/feature/collaboration.d.ts +1 -1
- package/build/component/feature/collaboration.d.ts.map +1 -1
- package/build/component/feature/collaboration.js +2 -4
- package/build/component/feature/collaboration.js.map +1 -1
- package/build/component/generator/copilotPlugin/generator.d.ts +4 -2
- package/build/component/generator/copilotPlugin/generator.d.ts.map +1 -1
- package/build/component/generator/copilotPlugin/generator.js +50 -18
- package/build/component/generator/copilotPlugin/generator.js.map +1 -1
- package/build/component/generator/copilotPlugin/helper.d.ts +5 -3
- package/build/component/generator/copilotPlugin/helper.d.ts.map +1 -1
- package/build/component/generator/copilotPlugin/helper.js +67 -25
- package/build/component/generator/copilotPlugin/helper.js.map +1 -1
- package/build/component/generator/error.d.ts +1 -1
- package/build/component/generator/error.d.ts.map +1 -1
- package/build/component/generator/error.js +4 -4
- package/build/component/generator/error.js.map +1 -1
- package/build/component/generator/generator.d.ts +5 -0
- package/build/component/generator/generator.d.ts.map +1 -1
- package/build/component/generator/generator.js +28 -26
- package/build/component/generator/generator.js.map +1 -1
- package/build/component/generator/generatorAction.d.ts +5 -16
- package/build/component/generator/generatorAction.d.ts.map +1 -1
- package/build/component/generator/generatorAction.js +46 -87
- package/build/component/generator/generatorAction.js.map +1 -1
- package/build/component/generator/officeAddin/config/projectProperties.d.ts +1 -0
- package/build/component/generator/officeAddin/config/projectProperties.d.ts.map +1 -1
- package/build/component/generator/officeAddin/config/projectProperties.js +1 -0
- package/build/component/generator/officeAddin/config/projectProperties.js.map +1 -1
- package/build/component/generator/officeAddin/config/projectsJsonData.d.ts +1 -4
- package/build/component/generator/officeAddin/config/projectsJsonData.d.ts.map +1 -1
- package/build/component/generator/officeAddin/config/projectsJsonData.js +4 -11
- package/build/component/generator/officeAddin/config/projectsJsonData.js.map +1 -1
- package/build/component/generator/officeAddin/generator.d.ts.map +1 -1
- package/build/component/generator/officeAddin/generator.js +13 -7
- package/build/component/generator/officeAddin/generator.js.map +1 -1
- package/build/component/generator/officeAddin/helperMethods.d.ts +2 -1
- package/build/component/generator/officeAddin/helperMethods.d.ts.map +1 -1
- package/build/component/generator/officeAddin/helperMethods.js +21 -10
- package/build/component/generator/officeAddin/helperMethods.js.map +1 -1
- package/build/component/generator/officeXMLAddin/generator.d.ts +9 -0
- package/build/component/generator/officeXMLAddin/generator.d.ts.map +1 -0
- package/build/component/generator/officeXMLAddin/generator.js +90 -0
- package/build/component/generator/officeXMLAddin/generator.js.map +1 -0
- package/build/component/generator/officeXMLAddin/projectConfig.d.ts +36 -0
- package/build/component/generator/officeXMLAddin/projectConfig.d.ts.map +1 -0
- package/build/component/generator/officeXMLAddin/projectConfig.js +127 -0
- package/build/component/generator/officeXMLAddin/projectConfig.js.map +1 -0
- package/build/component/generator/utils.d.ts +2 -1
- package/build/component/generator/utils.d.ts.map +1 -1
- package/build/component/generator/utils.js +32 -16
- package/build/component/generator/utils.js.map +1 -1
- package/build/component/resource/botService/appStudio/appStudioClient.d.ts.map +1 -1
- package/build/component/resource/botService/appStudio/appStudioClient.js +11 -39
- package/build/component/resource/botService/appStudio/appStudioClient.js.map +1 -1
- package/build/core/FxCore.d.ts.map +1 -1
- package/build/core/FxCore.js +21 -12
- package/build/core/FxCore.js.map +1 -1
- package/build/core/collaborator.js +3 -3
- package/build/core/collaborator.js.map +1 -1
- package/build/core/middleware/projectMigratorV3.d.ts.map +1 -1
- package/build/core/middleware/projectMigratorV3.js +6 -1
- package/build/core/middleware/projectMigratorV3.js.map +1 -1
- package/build/error/arm.d.ts.map +1 -1
- package/build/error/arm.js +0 -2
- package/build/error/arm.js.map +1 -1
- package/build/error/common.d.ts.map +1 -1
- package/build/error/common.js +1 -1
- package/build/error/common.js.map +1 -1
- package/build/error/deploy.d.ts.map +1 -1
- package/build/error/deploy.js +17 -6
- package/build/error/deploy.js.map +1 -1
- package/build/index.d.ts +0 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -3
- package/build/index.js.map +1 -1
- package/build/question/create.d.ts +25 -0
- package/build/question/create.d.ts.map +1 -1
- package/build/question/create.js +420 -46
- package/build/question/create.js.map +1 -1
- package/build/question/inputs/CreateProjectInputs.d.ts +19 -5
- package/build/question/inputs/CreateProjectInputs.d.ts.map +1 -1
- package/build/question/options/CreateProjectOptions.d.ts.map +1 -1
- package/build/question/options/CreateProjectOptions.js +61 -8
- package/build/question/options/CreateProjectOptions.js.map +1 -1
- package/build/question/questionNames.d.ts +10 -1
- package/build/question/questionNames.d.ts.map +1 -1
- package/build/question/questionNames.js +9 -0
- package/build/question/questionNames.js.map +1 -1
- package/package.json +8 -8
- package/resource/package.nls.json +157 -77
- 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/Enable SSO.txt +1 -1
- package/build/common/spec-parser/adaptiveCardGenerator.d.ts +0 -7
- package/build/common/spec-parser/adaptiveCardGenerator.d.ts.map +0 -1
- package/build/common/spec-parser/adaptiveCardGenerator.js +0 -168
- package/build/common/spec-parser/adaptiveCardGenerator.js.map +0 -1
- package/build/common/spec-parser/adaptiveCardWrapper.d.ts +0 -15
- package/build/common/spec-parser/adaptiveCardWrapper.d.ts.map +0 -1
- package/build/common/spec-parser/adaptiveCardWrapper.js +0 -98
- package/build/common/spec-parser/adaptiveCardWrapper.js.map +0 -1
- package/build/common/spec-parser/constants.d.ts +0 -41
- package/build/common/spec-parser/constants.d.ts.map +0 -1
- package/build/common/spec-parser/constants.js +0 -95
- package/build/common/spec-parser/constants.js.map +0 -1
- package/build/common/spec-parser/index.browser.d.ts +0 -6
- package/build/common/spec-parser/index.browser.d.ts.map +0 -1
- package/build/common/spec-parser/index.browser.js +0 -16
- package/build/common/spec-parser/index.browser.js.map +0 -1
- package/build/common/spec-parser/index.d.ts +0 -5
- package/build/common/spec-parser/index.d.ts.map +0 -1
- package/build/common/spec-parser/index.js +0 -16
- package/build/common/spec-parser/index.js.map +0 -1
- package/build/common/spec-parser/interfaces.d.ts +0 -180
- package/build/common/spec-parser/interfaces.d.ts.map +0 -1
- package/build/common/spec-parser/interfaces.js +0 -51
- package/build/common/spec-parser/interfaces.js.map +0 -1
- package/build/common/spec-parser/manifestUpdater.d.ts +0 -7
- package/build/common/spec-parser/manifestUpdater.d.ts.map +0 -1
- package/build/common/spec-parser/manifestUpdater.js +0 -98
- package/build/common/spec-parser/manifestUpdater.js.map +0 -1
- package/build/common/spec-parser/specFilter.d.ts +0 -3
- package/build/common/spec-parser/specFilter.d.ts.map +0 -1
- package/build/common/spec-parser/specFilter.js +0 -40
- package/build/common/spec-parser/specFilter.js.map +0 -1
- package/build/common/spec-parser/specParser.browser.d.ts +0 -46
- package/build/common/spec-parser/specParser.browser.d.ts.map +0 -1
- package/build/common/spec-parser/specParser.browser.js +0 -139
- package/build/common/spec-parser/specParser.browser.js.map +0 -1
- package/build/common/spec-parser/specParser.d.ts +0 -46
- package/build/common/spec-parser/specParser.d.ts.map +0 -1
- package/build/common/spec-parser/specParser.js +0 -244
- package/build/common/spec-parser/specParser.js.map +0 -1
- package/build/common/spec-parser/specParserError.d.ts +0 -6
- package/build/common/spec-parser/specParserError.d.ts.map +0 -1
- package/build/common/spec-parser/specParserError.js +0 -13
- package/build/common/spec-parser/specParserError.js.map +0 -1
- package/build/common/spec-parser/utils.d.ts +0 -43
- package/build/common/spec-parser/utils.d.ts.map +0 -1
- package/build/common/spec-parser/utils.js +0 -587
- package/build/common/spec-parser/utils.js.map +0 -1
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import { OpenAPIV3 } from "openapi-types";
|
|
2
|
-
/**
|
|
3
|
-
* An interface that represents the result of validating an OpenAPI specification file.
|
|
4
|
-
*/
|
|
5
|
-
export interface ValidateResult {
|
|
6
|
-
/**
|
|
7
|
-
* The validation status of the OpenAPI specification file.
|
|
8
|
-
*/
|
|
9
|
-
status: ValidationStatus;
|
|
10
|
-
/**
|
|
11
|
-
* An array of warning results generated during validation.
|
|
12
|
-
*/
|
|
13
|
-
warnings: WarningResult[];
|
|
14
|
-
/**
|
|
15
|
-
* An array of error results generated during validation.
|
|
16
|
-
*/
|
|
17
|
-
errors: ErrorResult[];
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* An interface that represents a warning result generated during validation.
|
|
21
|
-
*/
|
|
22
|
-
export interface WarningResult {
|
|
23
|
-
/**
|
|
24
|
-
* The type of warning.
|
|
25
|
-
*/
|
|
26
|
-
type: WarningType;
|
|
27
|
-
/**
|
|
28
|
-
* The content of the warning.
|
|
29
|
-
*/
|
|
30
|
-
content: string;
|
|
31
|
-
/**
|
|
32
|
-
* data of the warning.
|
|
33
|
-
*/
|
|
34
|
-
data?: any;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* An interface that represents an error result generated during validation.
|
|
38
|
-
*/
|
|
39
|
-
export interface ErrorResult {
|
|
40
|
-
/**
|
|
41
|
-
* The type of error.
|
|
42
|
-
*/
|
|
43
|
-
type: ErrorType;
|
|
44
|
-
/**
|
|
45
|
-
* The content of the error.
|
|
46
|
-
*/
|
|
47
|
-
content: string;
|
|
48
|
-
/**
|
|
49
|
-
* data of the error.
|
|
50
|
-
*/
|
|
51
|
-
data?: any;
|
|
52
|
-
}
|
|
53
|
-
export interface GenerateResult {
|
|
54
|
-
allSuccess: boolean;
|
|
55
|
-
warnings: WarningResult[];
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* An enum that represents the types of errors that can occur during validation.
|
|
59
|
-
*/
|
|
60
|
-
export declare enum ErrorType {
|
|
61
|
-
SpecNotValid = "spec-not-valid",
|
|
62
|
-
RemoteRefNotSupported = "remote-ref-not-supported",
|
|
63
|
-
NoServerInformation = "no-server-information",
|
|
64
|
-
UrlProtocolNotSupported = "url-protocol-not-supported",
|
|
65
|
-
RelativeServerUrlNotSupported = "relative-server-url-not-supported",
|
|
66
|
-
NoSupportedApi = "no-supported-api",
|
|
67
|
-
NoExtraAPICanBeAdded = "no-extra-api-can-be-added",
|
|
68
|
-
ResolveServerUrlFailed = "resolve-server-url-failed",
|
|
69
|
-
SwaggerNotSupported = "swagger-not-supported",
|
|
70
|
-
MultipleAPIKeyNotSupported = "multiple-api-key-not-supported",
|
|
71
|
-
ListFailed = "list-failed",
|
|
72
|
-
listSupportedAPIInfoFailed = "list-supported-api-info-failed",
|
|
73
|
-
FilterSpecFailed = "filter-spec-failed",
|
|
74
|
-
UpdateManifestFailed = "update-manifest-failed",
|
|
75
|
-
GenerateAdaptiveCardFailed = "generate-adaptive-card-failed",
|
|
76
|
-
GenerateFailed = "generate-failed",
|
|
77
|
-
ValidateFailed = "validate-failed",
|
|
78
|
-
Cancelled = "cancelled",
|
|
79
|
-
Unknown = "unknown"
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* An enum that represents the types of warnings that can occur during validation.
|
|
83
|
-
*/
|
|
84
|
-
export declare enum WarningType {
|
|
85
|
-
OperationIdMissing = "operationid-missing",
|
|
86
|
-
GenerateCardFailed = "generate-card-failed",
|
|
87
|
-
OperationOnlyContainsOptionalParam = "operation-only-contains-optional-param",
|
|
88
|
-
ConvertSwaggerToOpenAPI = "convert-swagger-to-openapi",
|
|
89
|
-
Unknown = "unknown"
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* An enum that represents the validation status of an OpenAPI specification file.
|
|
93
|
-
*/
|
|
94
|
-
export declare enum ValidationStatus {
|
|
95
|
-
Valid = 0,
|
|
96
|
-
Warning = 1,
|
|
97
|
-
Error = 2
|
|
98
|
-
}
|
|
99
|
-
export interface TextBlockElement {
|
|
100
|
-
type: string;
|
|
101
|
-
text: string;
|
|
102
|
-
wrap: boolean;
|
|
103
|
-
}
|
|
104
|
-
export interface ImageElement {
|
|
105
|
-
type: string;
|
|
106
|
-
url: string;
|
|
107
|
-
$when: string;
|
|
108
|
-
}
|
|
109
|
-
export interface ArrayElement {
|
|
110
|
-
type: string;
|
|
111
|
-
$data: string;
|
|
112
|
-
items: Array<TextBlockElement | ImageElement | ArrayElement>;
|
|
113
|
-
}
|
|
114
|
-
export interface AdaptiveCard {
|
|
115
|
-
type: string;
|
|
116
|
-
$schema: string;
|
|
117
|
-
version: string;
|
|
118
|
-
body: Array<TextBlockElement | ImageElement | ArrayElement>;
|
|
119
|
-
}
|
|
120
|
-
export interface PreviewCardTemplate {
|
|
121
|
-
title: string;
|
|
122
|
-
subtitle?: string;
|
|
123
|
-
image?: {
|
|
124
|
-
url: string;
|
|
125
|
-
alt?: string;
|
|
126
|
-
$when?: string;
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
export interface WrappedAdaptiveCard {
|
|
130
|
-
version: string;
|
|
131
|
-
$schema?: string;
|
|
132
|
-
jsonPath?: string;
|
|
133
|
-
responseLayout: string;
|
|
134
|
-
responseCardTemplate: AdaptiveCard;
|
|
135
|
-
previewCardTemplate: PreviewCardTemplate;
|
|
136
|
-
}
|
|
137
|
-
export interface ChoicesItem {
|
|
138
|
-
title: string;
|
|
139
|
-
value: string;
|
|
140
|
-
}
|
|
141
|
-
export interface Parameter {
|
|
142
|
-
name: string;
|
|
143
|
-
title: string;
|
|
144
|
-
description: string;
|
|
145
|
-
inputType?: "text" | "textarea" | "number" | "date" | "time" | "toggle" | "choiceset";
|
|
146
|
-
value?: string;
|
|
147
|
-
choices?: ChoicesItem[];
|
|
148
|
-
}
|
|
149
|
-
export interface CheckParamResult {
|
|
150
|
-
requiredNum: number;
|
|
151
|
-
optionalNum: number;
|
|
152
|
-
isValid: boolean;
|
|
153
|
-
}
|
|
154
|
-
export interface ParseOptions {
|
|
155
|
-
allowMissingId?: boolean;
|
|
156
|
-
allowSwagger?: boolean;
|
|
157
|
-
allowAPIKeyAuth?: boolean;
|
|
158
|
-
allowMultipleParameters?: boolean;
|
|
159
|
-
allowOauth2?: boolean;
|
|
160
|
-
}
|
|
161
|
-
export interface APIInfo {
|
|
162
|
-
method: string;
|
|
163
|
-
path: string;
|
|
164
|
-
title: string;
|
|
165
|
-
id: string;
|
|
166
|
-
parameters: Parameter[];
|
|
167
|
-
description: string;
|
|
168
|
-
warning?: WarningResult;
|
|
169
|
-
}
|
|
170
|
-
export interface ListAPIResult {
|
|
171
|
-
api: string;
|
|
172
|
-
server: string;
|
|
173
|
-
operationId: string;
|
|
174
|
-
auth?: OpenAPIV3.SecuritySchemeObject;
|
|
175
|
-
}
|
|
176
|
-
export interface AuthSchema {
|
|
177
|
-
authSchema: OpenAPIV3.SecuritySchemeObject;
|
|
178
|
-
name: string;
|
|
179
|
-
}
|
|
180
|
-
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/common/spec-parser/interfaces.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,MAAM,EAAE,gBAAgB,CAAC;IAEzB;;OAEG;IACH,QAAQ,EAAE,aAAa,EAAE,CAAC;IAE1B;;OAEG;IACH,MAAM,EAAE,WAAW,EAAE,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,IAAI,EAAE,WAAW,CAAC;IAElB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,IAAI,CAAC,EAAE,GAAG,CAAC;CACZ;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,IAAI,EAAE,SAAS,CAAC;IAEhB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,IAAI,CAAC,EAAE,GAAG,CAAC;CACZ;AAED,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,aAAa,EAAE,CAAC;CAC3B;AAED;;GAEG;AACH,oBAAY,SAAS;IACnB,YAAY,mBAAmB;IAC/B,qBAAqB,6BAA6B;IAClD,mBAAmB,0BAA0B;IAC7C,uBAAuB,+BAA+B;IACtD,6BAA6B,sCAAsC;IACnE,cAAc,qBAAqB;IACnC,oBAAoB,8BAA8B;IAClD,sBAAsB,8BAA8B;IACpD,mBAAmB,0BAA0B;IAC7C,0BAA0B,mCAAmC;IAE7D,UAAU,gBAAgB;IAC1B,0BAA0B,mCAAmC;IAC7D,gBAAgB,uBAAuB;IACvC,oBAAoB,2BAA2B;IAC/C,0BAA0B,k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AAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,SAAS,CAAC,oBAAoB,CAAC;CACvC;AAED,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,SAAS,CAAC,oBAAoB,CAAC;IAC3C,IAAI,EAAE,MAAM,CAAC;CACd"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT license.
|
|
3
|
-
"use strict";
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.ValidationStatus = exports.WarningType = exports.ErrorType = void 0;
|
|
6
|
-
/**
|
|
7
|
-
* An enum that represents the types of errors that can occur during validation.
|
|
8
|
-
*/
|
|
9
|
-
var ErrorType;
|
|
10
|
-
(function (ErrorType) {
|
|
11
|
-
ErrorType["SpecNotValid"] = "spec-not-valid";
|
|
12
|
-
ErrorType["RemoteRefNotSupported"] = "remote-ref-not-supported";
|
|
13
|
-
ErrorType["NoServerInformation"] = "no-server-information";
|
|
14
|
-
ErrorType["UrlProtocolNotSupported"] = "url-protocol-not-supported";
|
|
15
|
-
ErrorType["RelativeServerUrlNotSupported"] = "relative-server-url-not-supported";
|
|
16
|
-
ErrorType["NoSupportedApi"] = "no-supported-api";
|
|
17
|
-
ErrorType["NoExtraAPICanBeAdded"] = "no-extra-api-can-be-added";
|
|
18
|
-
ErrorType["ResolveServerUrlFailed"] = "resolve-server-url-failed";
|
|
19
|
-
ErrorType["SwaggerNotSupported"] = "swagger-not-supported";
|
|
20
|
-
ErrorType["MultipleAPIKeyNotSupported"] = "multiple-api-key-not-supported";
|
|
21
|
-
ErrorType["ListFailed"] = "list-failed";
|
|
22
|
-
ErrorType["listSupportedAPIInfoFailed"] = "list-supported-api-info-failed";
|
|
23
|
-
ErrorType["FilterSpecFailed"] = "filter-spec-failed";
|
|
24
|
-
ErrorType["UpdateManifestFailed"] = "update-manifest-failed";
|
|
25
|
-
ErrorType["GenerateAdaptiveCardFailed"] = "generate-adaptive-card-failed";
|
|
26
|
-
ErrorType["GenerateFailed"] = "generate-failed";
|
|
27
|
-
ErrorType["ValidateFailed"] = "validate-failed";
|
|
28
|
-
ErrorType["Cancelled"] = "cancelled";
|
|
29
|
-
ErrorType["Unknown"] = "unknown";
|
|
30
|
-
})(ErrorType = exports.ErrorType || (exports.ErrorType = {}));
|
|
31
|
-
/**
|
|
32
|
-
* An enum that represents the types of warnings that can occur during validation.
|
|
33
|
-
*/
|
|
34
|
-
var WarningType;
|
|
35
|
-
(function (WarningType) {
|
|
36
|
-
WarningType["OperationIdMissing"] = "operationid-missing";
|
|
37
|
-
WarningType["GenerateCardFailed"] = "generate-card-failed";
|
|
38
|
-
WarningType["OperationOnlyContainsOptionalParam"] = "operation-only-contains-optional-param";
|
|
39
|
-
WarningType["ConvertSwaggerToOpenAPI"] = "convert-swagger-to-openapi";
|
|
40
|
-
WarningType["Unknown"] = "unknown";
|
|
41
|
-
})(WarningType = exports.WarningType || (exports.WarningType = {}));
|
|
42
|
-
/**
|
|
43
|
-
* An enum that represents the validation status of an OpenAPI specification file.
|
|
44
|
-
*/
|
|
45
|
-
var ValidationStatus;
|
|
46
|
-
(function (ValidationStatus) {
|
|
47
|
-
ValidationStatus[ValidationStatus["Valid"] = 0] = "Valid";
|
|
48
|
-
ValidationStatus[ValidationStatus["Warning"] = 1] = "Warning";
|
|
49
|
-
ValidationStatus[ValidationStatus["Error"] = 2] = "Error";
|
|
50
|
-
})(ValidationStatus = exports.ValidationStatus || (exports.ValidationStatus = {}));
|
|
51
|
-
//# sourceMappingURL=interfaces.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/common/spec-parser/interfaces.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,YAAY,CAAC;;;AAqEb;;GAEG;AACH,IAAY,SAsBX;AAtBD,WAAY,SAAS;IACnB,4CAA+B,CAAA;IAC/B,+DAAkD,CAAA;IAClD,0DAA6C,CAAA;IAC7C,mEAAsD,CAAA;IACtD,gFAAmE,CAAA;IACnE,gDAAmC,CAAA;IACnC,+DAAkD,CAAA;IAClD,iEAAoD,CAAA;IACpD,0DAA6C,CAAA;IAC7C,0EAA6D,CAAA;IAE7D,uCAA0B,CAAA;IAC1B,0EAA6D,CAAA;IAC7D,oDAAuC,CAAA;IACvC,4DAA+C,CAAA;IAC/C,yEAA4D,CAAA;IAC5D,+CAAkC,CAAA;IAClC,+CAAkC,CAAA;IAElC,oCAAuB,CAAA;IACvB,gCAAmB,CAAA;AACrB,CAAC,EAtBW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAsBpB;AAED;;GAEG;AACH,IAAY,WAMX;AAND,WAAY,WAAW;IACrB,yDAA0C,CAAA;IAC1C,0DAA2C,CAAA;IAC3C,4FAA6E,CAAA;IAC7E,qEAAsD,CAAA;IACtD,kCAAmB,CAAA;AACrB,CAAC,EANW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAMtB;AAED;;GAEG;AACH,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,yDAAK,CAAA;IACL,6DAAO,CAAA;IACP,yDAAK,CAAA;AACP,CAAC,EAJW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAI3B"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { OpenAPIV3 } from "openapi-types";
|
|
2
|
-
import { WarningResult } from "./interfaces";
|
|
3
|
-
import { IMessagingExtensionCommand, TeamsAppManifest } from "@microsoft/teamsfx-api";
|
|
4
|
-
export declare function updateManifest(manifestPath: string, outputSpecPath: string, adaptiveCardFolder: string, spec: OpenAPIV3.Document, allowMultipleParameters: boolean, auth?: OpenAPIV3.SecuritySchemeObject): Promise<[TeamsAppManifest, WarningResult[]]>;
|
|
5
|
-
export declare function generateCommands(spec: OpenAPIV3.Document, adaptiveCardFolder: string, manifestPath: string, allowMultipleParameters: boolean): Promise<[IMessagingExtensionCommand[], WarningResult[]]>;
|
|
6
|
-
export declare function getRelativePath(from: string, to: string): string;
|
|
7
|
-
//# sourceMappingURL=manifestUpdater.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"manifestUpdater.d.ts","sourceRoot":"","sources":["../../../src/common/spec-parser/manifestUpdater.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG1C,OAAO,EAAa,aAAa,EAAE,MAAM,cAAc,CAAC;AASxD,OAAO,EAEL,0BAA0B,EAC1B,gBAAgB,EACjB,MAAM,wBAAwB,CAAC;AAEhC,wBAAsB,cAAc,CAClC,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,MAAM,EACtB,kBAAkB,EAAE,MAAM,EAC1B,IAAI,EAAE,SAAS,CAAC,QAAQ,EACxB,uBAAuB,EAAE,OAAO,EAChC,IAAI,CAAC,EAAE,SAAS,CAAC,oBAAoB,GACpC,OAAO,CAAC,CAAC,gBAAgB,EAAE,aAAa,EAAE,CAAC,CAAC,CA2D9C;AAED,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,SAAS,CAAC,QAAQ,EACxB,kBAAkB,EAAE,MAAM,EAC1B,YAAY,EAAE,MAAM,EACpB,uBAAuB,EAAE,OAAO,GAC/B,OAAO,CAAC,CAAC,0BAA0B,EAAE,EAAE,aAAa,EAAE,CAAC,CAAC,CAmC1D;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAGhE"}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT license.
|
|
3
|
-
"use strict";
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.getRelativePath = exports.generateCommands = exports.updateManifest = void 0;
|
|
6
|
-
const tslib_1 = require("tslib");
|
|
7
|
-
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
8
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
9
|
-
const interfaces_1 = require("./interfaces");
|
|
10
|
-
const utils_1 = require("./utils");
|
|
11
|
-
const specParserError_1 = require("./specParserError");
|
|
12
|
-
const constants_1 = require("./constants");
|
|
13
|
-
async function updateManifest(manifestPath, outputSpecPath, adaptiveCardFolder, spec, allowMultipleParameters, auth) {
|
|
14
|
-
var _a, _b;
|
|
15
|
-
try {
|
|
16
|
-
const originalManifest = await fs_extra_1.default.readJSON(manifestPath);
|
|
17
|
-
const updatedPart = {};
|
|
18
|
-
const [commands, warnings] = await generateCommands(spec, adaptiveCardFolder, manifestPath, allowMultipleParameters);
|
|
19
|
-
const composeExtension = {
|
|
20
|
-
composeExtensionType: "apiBased",
|
|
21
|
-
apiSpecificationFile: getRelativePath(manifestPath, outputSpecPath),
|
|
22
|
-
commands: commands,
|
|
23
|
-
};
|
|
24
|
-
if (auth) {
|
|
25
|
-
if (utils_1.isAPIKeyAuth(auth)) {
|
|
26
|
-
auth = auth;
|
|
27
|
-
const safeApiSecretRegistrationId = utils_1.getSafeRegistrationIdEnvName(`${auth.name}_${constants_1.ConstantString.RegistrationIdPostfix}`);
|
|
28
|
-
composeExtension.authorization = {
|
|
29
|
-
authType: "apiSecretServiceAuth",
|
|
30
|
-
apiSecretServiceAuthConfiguration: {
|
|
31
|
-
apiSecretRegistrationId: `\${{${safeApiSecretRegistrationId}}}`,
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
else if (utils_1.isBearerTokenAuth(auth)) {
|
|
36
|
-
composeExtension.authorization = {
|
|
37
|
-
authType: "microsoftEntra",
|
|
38
|
-
microsoftEntraConfiguration: {
|
|
39
|
-
supportsSingleSignOn: true,
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
updatedPart.webApplicationInfo = {
|
|
43
|
-
id: "${{AAD_APP_CLIENT_ID}}",
|
|
44
|
-
resource: "api://${{DOMAIN}}/${{AAD_APP_CLIENT_ID}}",
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
updatedPart.description = {
|
|
49
|
-
short: spec.info.title.slice(0, constants_1.ConstantString.ShortDescriptionMaxLens),
|
|
50
|
-
full: (_b = ((_a = spec.info.description) !== null && _a !== void 0 ? _a : originalManifest.description.full)) === null || _b === void 0 ? void 0 : _b.slice(0, constants_1.ConstantString.FullDescriptionMaxLens),
|
|
51
|
-
};
|
|
52
|
-
updatedPart.composeExtensions = [composeExtension];
|
|
53
|
-
const updatedManifest = Object.assign(Object.assign({}, originalManifest), updatedPart);
|
|
54
|
-
return [updatedManifest, warnings];
|
|
55
|
-
}
|
|
56
|
-
catch (err) {
|
|
57
|
-
throw new specParserError_1.SpecParserError(err.toString(), interfaces_1.ErrorType.UpdateManifestFailed);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
exports.updateManifest = updateManifest;
|
|
61
|
-
async function generateCommands(spec, adaptiveCardFolder, manifestPath, allowMultipleParameters) {
|
|
62
|
-
const paths = spec.paths;
|
|
63
|
-
const commands = [];
|
|
64
|
-
const warnings = [];
|
|
65
|
-
if (paths) {
|
|
66
|
-
for (const pathUrl in paths) {
|
|
67
|
-
const pathItem = paths[pathUrl];
|
|
68
|
-
if (pathItem) {
|
|
69
|
-
const operations = pathItem;
|
|
70
|
-
// Currently only support GET and POST method
|
|
71
|
-
for (const method in operations) {
|
|
72
|
-
if (method === constants_1.ConstantString.PostMethod || method === constants_1.ConstantString.GetMethod) {
|
|
73
|
-
const operationItem = operations[method];
|
|
74
|
-
if (operationItem) {
|
|
75
|
-
const [command, warning] = utils_1.parseApiInfo(operationItem, allowMultipleParameters);
|
|
76
|
-
const adaptiveCardPath = path_1.default.join(adaptiveCardFolder, command.id + ".json");
|
|
77
|
-
command.apiResponseRenderingTemplateFile = (await fs_extra_1.default.pathExists(adaptiveCardPath))
|
|
78
|
-
? getRelativePath(manifestPath, adaptiveCardPath)
|
|
79
|
-
: "";
|
|
80
|
-
if (warning) {
|
|
81
|
-
warnings.push(warning);
|
|
82
|
-
}
|
|
83
|
-
commands.push(command);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
return [commands, warnings];
|
|
91
|
-
}
|
|
92
|
-
exports.generateCommands = generateCommands;
|
|
93
|
-
function getRelativePath(from, to) {
|
|
94
|
-
const relativePath = path_1.default.relative(path_1.default.dirname(from), to);
|
|
95
|
-
return path_1.default.normalize(relativePath).replace(/\\/g, "/");
|
|
96
|
-
}
|
|
97
|
-
exports.getRelativePath = getRelativePath;
|
|
98
|
-
//# sourceMappingURL=manifestUpdater.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"manifestUpdater.js","sourceRoot":"","sources":["../../../src/common/spec-parser/manifestUpdater.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,YAAY,CAAC;;;;AAGb,gEAA0B;AAC1B,wDAAwB;AACxB,6CAAwD;AACxD,mCAKiB;AACjB,uDAAoD;AACpD,2CAA6C;AAOtC,KAAK,UAAU,cAAc,CAClC,YAAoB,EACpB,cAAsB,EACtB,kBAA0B,EAC1B,IAAwB,EACxB,uBAAgC,EAChC,IAAqC;;IAErC,IAAI;QACF,MAAM,gBAAgB,GAAqB,MAAM,kBAAE,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;QAC3E,MAAM,WAAW,GAAQ,EAAE,CAAC;QAC5B,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAAG,MAAM,gBAAgB,CACjD,IAAI,EACJ,kBAAkB,EAClB,YAAY,EACZ,uBAAuB,CACxB,CAAC;QACF,MAAM,gBAAgB,GAAsB;YAC1C,oBAAoB,EAAE,UAAU;YAChC,oBAAoB,EAAE,eAAe,CAAC,YAAY,EAAE,cAAc,CAAC;YACnE,QAAQ,EAAE,QAAQ;SACnB,CAAC;QA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F;SACF;KACF;IAED,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAC9B,CAAC;AAxCD,4CAwCC;AAED,SAAgB,eAAe,CAAC,IAAY,EAAE,EAAU;IACtD,MAAM,YAAY,GAAG,cAAI,CAAC,QAAQ,CAAC,cAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;IAC3D,OAAO,cAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AAC1D,CAAC;AAHD,0CAGC"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { OpenAPIV3 } from "openapi-types";
|
|
2
|
-
export declare function specFilter(filter: string[], unResolveSpec: OpenAPIV3.Document, resolvedSpec: OpenAPIV3.Document, allowMissingId: boolean, allowAPIKeyAuth: boolean, allowMultipleParameters: boolean, allowOauth2: boolean): OpenAPIV3.Document;
|
|
3
|
-
//# sourceMappingURL=specFilter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"specFilter.d.ts","sourceRoot":"","sources":["../../../src/common/spec-parser/specFilter.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAM1C,wBAAgB,UAAU,CACxB,MAAM,EAAE,MAAM,EAAE,EAChB,aAAa,EAAE,SAAS,CAAC,QAAQ,EACjC,YAAY,EAAE,SAAS,CAAC,QAAQ,EAChC,cAAc,EAAE,OAAO,EACvB,eAAe,EAAE,OAAO,EACxB,uBAAuB,EAAE,OAAO,EAChC,WAAW,EAAE,OAAO,GACnB,SAAS,CAAC,QAAQ,CA4CpB"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT license.
|
|
3
|
-
"use strict";
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.specFilter = void 0;
|
|
6
|
-
const utils_1 = require("./utils");
|
|
7
|
-
const specParserError_1 = require("./specParserError");
|
|
8
|
-
const interfaces_1 = require("./interfaces");
|
|
9
|
-
const constants_1 = require("./constants");
|
|
10
|
-
function specFilter(filter, unResolveSpec, resolvedSpec, allowMissingId, allowAPIKeyAuth, allowMultipleParameters, allowOauth2) {
|
|
11
|
-
try {
|
|
12
|
-
const newSpec = Object.assign({}, unResolveSpec);
|
|
13
|
-
const newPaths = {};
|
|
14
|
-
for (const filterItem of filter) {
|
|
15
|
-
const [method, path] = filterItem.split(" ");
|
|
16
|
-
const methodName = method.toLowerCase();
|
|
17
|
-
if (!utils_1.isSupportedApi(methodName, path, resolvedSpec, allowMissingId, allowAPIKeyAuth, allowMultipleParameters, allowOauth2)) {
|
|
18
|
-
continue;
|
|
19
|
-
}
|
|
20
|
-
if (!newPaths[path]) {
|
|
21
|
-
newPaths[path] = Object.assign({}, unResolveSpec.paths[path]);
|
|
22
|
-
for (const m of constants_1.ConstantString.AllOperationMethods) {
|
|
23
|
-
delete newPaths[path][m];
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
newPaths[path][methodName] = unResolveSpec.paths[path][methodName];
|
|
27
|
-
// Add the operationId if missing
|
|
28
|
-
if (!newPaths[path][methodName].operationId) {
|
|
29
|
-
newPaths[path][methodName].operationId = `${methodName}${utils_1.convertPathToCamelCase(path)}`;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
newSpec.paths = newPaths;
|
|
33
|
-
return newSpec;
|
|
34
|
-
}
|
|
35
|
-
catch (err) {
|
|
36
|
-
throw new specParserError_1.SpecParserError(err.toString(), interfaces_1.ErrorType.FilterSpecFailed);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
exports.specFilter = specFilter;
|
|
40
|
-
//# sourceMappingURL=specFilter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"specFilter.js","sourceRoot":"","sources":["../../../src/common/spec-parser/specFilter.ts"],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tF,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,46 +0,0 @@
|
|
|
1
|
-
import SwaggerParser from "@apidevtools/swagger-parser";
|
|
2
|
-
import { OpenAPIV3 } from "openapi-types";
|
|
3
|
-
import { APIInfo, GenerateResult, ParseOptions, ValidateResult, ListAPIResult } from "./interfaces";
|
|
4
|
-
/**
|
|
5
|
-
* A class that parses an OpenAPI specification file and provides methods to validate, list, and generate artifacts.
|
|
6
|
-
*/
|
|
7
|
-
export declare class SpecParser {
|
|
8
|
-
readonly pathOrSpec: string | OpenAPIV3.Document;
|
|
9
|
-
readonly parser: SwaggerParser;
|
|
10
|
-
readonly options: Required<ParseOptions>;
|
|
11
|
-
private apiMap;
|
|
12
|
-
private spec;
|
|
13
|
-
private unResolveSpec;
|
|
14
|
-
private isSwaggerFile;
|
|
15
|
-
private defaultOptions;
|
|
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: string | OpenAPIV3.Document, options?: ParseOptions);
|
|
22
|
-
/**
|
|
23
|
-
* Validates the OpenAPI specification file and returns a validation result.
|
|
24
|
-
*
|
|
25
|
-
* @returns A validation result object that contains information about any errors or warnings in the specification file.
|
|
26
|
-
*/
|
|
27
|
-
validate(): Promise<ValidateResult>;
|
|
28
|
-
listSupportedAPIInfo(): Promise<APIInfo[]>;
|
|
29
|
-
/**
|
|
30
|
-
* Lists all the OpenAPI operations in the specification file.
|
|
31
|
-
* @returns A string array that represents the HTTP method and path of each operation, such as ['GET /pets/{petId}', 'GET /user/{userId}']
|
|
32
|
-
* according to copilot plugin spec, only list get and post method without auth
|
|
33
|
-
*/
|
|
34
|
-
list(): Promise<ListAPIResult[]>;
|
|
35
|
-
/**
|
|
36
|
-
* Generates and update artifacts from the OpenAPI specification file. Generate Adaptive Cards, update Teams app manifest, and generate a new OpenAPI specification file.
|
|
37
|
-
* @param manifestPath A file path of the Teams app manifest file to update.
|
|
38
|
-
* @param filter An array of strings that represent the filters to apply when generating the artifacts. If filter is empty, it would process nothing.
|
|
39
|
-
* @param outputSpecPath File path of the new OpenAPI specification file to generate. If not specified or empty, no spec file will be generated.
|
|
40
|
-
* @param adaptiveCardFolder Folder path where the Adaptive Card files will be generated. If not specified or empty, Adaptive Card files will not be generated.
|
|
41
|
-
*/
|
|
42
|
-
generate(manifestPath: string, filter: string[], outputSpecPath: string, adaptiveCardFolder: string, signal?: AbortSignal): Promise<GenerateResult>;
|
|
43
|
-
private loadSpec;
|
|
44
|
-
private getAllSupportedAPIs;
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=specParser.browser.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,139 +0,0 @@
|
|
|
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
|
-
allowOauth2: false,
|
|
28
|
-
};
|
|
29
|
-
this.pathOrSpec = pathOrDoc;
|
|
30
|
-
this.parser = new swagger_parser_1.default();
|
|
31
|
-
this.options = Object.assign(Object.assign({}, this.defaultOptions), (options !== null && options !== void 0 ? options : {}));
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Validates the OpenAPI specification file and returns a validation result.
|
|
35
|
-
*
|
|
36
|
-
* @returns A validation result object that contains information about any errors or warnings in the specification file.
|
|
37
|
-
*/
|
|
38
|
-
async validate() {
|
|
39
|
-
try {
|
|
40
|
-
try {
|
|
41
|
-
await this.loadSpec();
|
|
42
|
-
await this.parser.validate(this.spec);
|
|
43
|
-
}
|
|
44
|
-
catch (e) {
|
|
45
|
-
return {
|
|
46
|
-
status: interfaces_1.ValidationStatus.Error,
|
|
47
|
-
warnings: [],
|
|
48
|
-
errors: [{ type: interfaces_1.ErrorType.SpecNotValid, content: e.toString() }],
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
if (!this.options.allowSwagger && this.isSwaggerFile) {
|
|
52
|
-
return {
|
|
53
|
-
status: interfaces_1.ValidationStatus.Error,
|
|
54
|
-
warnings: [],
|
|
55
|
-
errors: [
|
|
56
|
-
{ type: interfaces_1.ErrorType.SwaggerNotSupported, content: constants_1.ConstantString.SwaggerNotSupported },
|
|
57
|
-
],
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
return utils_1.validateSpec(this.spec, this.parser, !!this.isSwaggerFile, this.options.allowMissingId, this.options.allowAPIKeyAuth, this.options.allowMultipleParameters, this.options.allowOauth2);
|
|
61
|
-
}
|
|
62
|
-
catch (err) {
|
|
63
|
-
throw new specParserError_1.SpecParserError(err.toString(), interfaces_1.ErrorType.ValidateFailed);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
async listSupportedAPIInfo() {
|
|
67
|
-
try {
|
|
68
|
-
await this.loadSpec();
|
|
69
|
-
const apiMap = this.getAllSupportedAPIs(this.spec);
|
|
70
|
-
const apiInfos = [];
|
|
71
|
-
for (const key in apiMap) {
|
|
72
|
-
const pathObjectItem = apiMap[key];
|
|
73
|
-
const [method, path] = key.split(" ");
|
|
74
|
-
const operationId = pathObjectItem.operationId;
|
|
75
|
-
// In Browser environment, this api is by default not support api without operationId
|
|
76
|
-
if (!operationId) {
|
|
77
|
-
continue;
|
|
78
|
-
}
|
|
79
|
-
const [command, warning] = utils_1.parseApiInfo(pathObjectItem, this.options.allowMultipleParameters);
|
|
80
|
-
const apiInfo = {
|
|
81
|
-
method: method,
|
|
82
|
-
path: path,
|
|
83
|
-
title: command.title,
|
|
84
|
-
id: operationId,
|
|
85
|
-
parameters: command.parameters,
|
|
86
|
-
description: command.description,
|
|
87
|
-
};
|
|
88
|
-
if (warning) {
|
|
89
|
-
apiInfo.warning = warning;
|
|
90
|
-
}
|
|
91
|
-
apiInfos.push(apiInfo);
|
|
92
|
-
}
|
|
93
|
-
return apiInfos;
|
|
94
|
-
}
|
|
95
|
-
catch (err) {
|
|
96
|
-
throw new specParserError_1.SpecParserError(err.toString(), interfaces_1.ErrorType.listSupportedAPIInfoFailed);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Lists all the OpenAPI operations in the specification file.
|
|
101
|
-
* @returns A string array that represents the HTTP method and path of each operation, such as ['GET /pets/{petId}', 'GET /user/{userId}']
|
|
102
|
-
* according to copilot plugin spec, only list get and post method without auth
|
|
103
|
-
*/
|
|
104
|
-
// eslint-disable-next-line @typescript-eslint/require-await
|
|
105
|
-
async list() {
|
|
106
|
-
throw new Error("Method not implemented.");
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Generates and update artifacts from the OpenAPI specification file. Generate Adaptive Cards, update Teams app manifest, and generate a new OpenAPI specification file.
|
|
110
|
-
* @param manifestPath A file path of the Teams app manifest file to update.
|
|
111
|
-
* @param filter An array of strings that represent the filters to apply when generating the artifacts. If filter is empty, it would process nothing.
|
|
112
|
-
* @param outputSpecPath File path of the new OpenAPI specification file to generate. If not specified or empty, no spec file will be generated.
|
|
113
|
-
* @param adaptiveCardFolder Folder path where the Adaptive Card files will be generated. If not specified or empty, Adaptive Card files will not be generated.
|
|
114
|
-
*/
|
|
115
|
-
// eslint-disable-next-line @typescript-eslint/require-await
|
|
116
|
-
async generate(manifestPath, filter, outputSpecPath, adaptiveCardFolder, signal) {
|
|
117
|
-
throw new Error("Method not implemented.");
|
|
118
|
-
}
|
|
119
|
-
async loadSpec() {
|
|
120
|
-
if (!this.spec) {
|
|
121
|
-
this.unResolveSpec = (await this.parser.parse(this.pathOrSpec));
|
|
122
|
-
if (!this.unResolveSpec.openapi && this.unResolveSpec.swagger === "2.0") {
|
|
123
|
-
this.isSwaggerFile = true;
|
|
124
|
-
}
|
|
125
|
-
const clonedUnResolveSpec = JSON.parse(JSON.stringify(this.unResolveSpec));
|
|
126
|
-
this.spec = (await this.parser.dereference(clonedUnResolveSpec));
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
getAllSupportedAPIs(spec) {
|
|
130
|
-
if (this.apiMap !== undefined) {
|
|
131
|
-
return this.apiMap;
|
|
132
|
-
}
|
|
133
|
-
const result = utils_1.listSupportedAPIs(spec, this.options.allowMissingId, this.options.allowAPIKeyAuth, this.options.allowMultipleParameters, this.options.allowAPIKeyAuth);
|
|
134
|
-
this.apiMap = result;
|
|
135
|
-
return result;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
exports.SpecParser = SpecParser;
|
|
139
|
-
//# sourceMappingURL=specParser.browser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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;IAkBrB;;;;OAIG;IACH,YAAY,SAAsC,EAAE,OAAsB;QAblE,mBAAc,GAAiB;YACrC,cAAc,EAAE,KAAK;YACrB,YAAY,EAAE,KAAK;YACnB,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,cAAP,OAAO,GAAI,EAAE,CAAC,CACO,CAAC;IAC9B,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,QAAQ;QACZ,IAAI;YACF,IAAI;gBACF,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACtB,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAK,CAAC,CAAC;aACxC;YAAC,OAAO,CAAC,EAAE;gBACV,OAAO;oBACL,MAAM,EAAE,6BAAgB,CAAC,KAAK;oBAC9B,QAAQ,EAAE,EAAE;oBACZ,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,sBAAS,CAAC,YAAY,EAAE,OAAO,EAAG,CAAW,CAAC,QAAQ,EAAE,EAAE,CAAC;iBAC7E,CAAC;aACH;YAED,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,IAAI,IAAI,CAAC,aAAa,EAAE;g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