@microsoft/m365-spec-parser 0.1.1-alpha.a277dba4e.0 → 0.1.1-alpha.b54a7ba8f.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/dist/index.esm2017.js +167 -93
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm2017.mjs +198 -121
- package/dist/index.esm2017.mjs.map +1 -1
- package/dist/index.esm5.js +167 -93
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +198 -121
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/src/interfaces.d.ts +30 -1
- package/dist/src/manifestUpdater.d.ts +2 -1
- package/dist/src/specParser.browser.d.ts +1 -0
- package/dist/src/specParser.d.ts +1 -1
- package/dist/src/utils.d.ts +9 -8
- package/package.json +3 -3
package/dist/src/interfaces.d.ts
CHANGED
|
@@ -78,6 +78,21 @@ export declare enum ErrorType {
|
|
|
78
78
|
GenerateFailed = "generate-failed",
|
|
79
79
|
ValidateFailed = "validate-failed",
|
|
80
80
|
GetSpecFailed = "get-spec-failed",
|
|
81
|
+
AuthTypeIsNotSupported = "auth-type-is-not-supported",
|
|
82
|
+
MissingOperationId = "missing-operation-id",
|
|
83
|
+
PostBodyContainMultipleMediaTypes = "post-body-contain-multiple-media-types",
|
|
84
|
+
ResponseContainMultipleMediaTypes = "response-contain-multiple-media-types",
|
|
85
|
+
ResponseJsonIsEmpty = "response-json-is-empty",
|
|
86
|
+
PostBodySchemaIsNotJson = "post-body-schema-is-not-json",
|
|
87
|
+
PostBodyContainsRequiredUnsupportedSchema = "post-body-contains-required-unsupported-schema",
|
|
88
|
+
ParamsContainRequiredUnsupportedSchema = "params-contain-required-unsupported-schema",
|
|
89
|
+
ParamsContainsNestedObject = "params-contains-nested-object",
|
|
90
|
+
RequestBodyContainsNestedObject = "request-body-contains-nested-object",
|
|
91
|
+
ExceededRequiredParamsLimit = "exceeded-required-params-limit",
|
|
92
|
+
NoParameter = "no-parameter",
|
|
93
|
+
NoAPIInfo = "no-api-info",
|
|
94
|
+
MethodNotAllowed = "method-not-allowed",
|
|
95
|
+
UrlPathNotExist = "url-path-not-exist",
|
|
81
96
|
Cancelled = "cancelled",
|
|
82
97
|
Unknown = "unknown"
|
|
83
98
|
}
|
|
@@ -141,6 +156,7 @@ export interface CheckParamResult {
|
|
|
141
156
|
requiredNum: number;
|
|
142
157
|
optionalNum: number;
|
|
143
158
|
isValid: boolean;
|
|
159
|
+
reason: ErrorType[];
|
|
144
160
|
}
|
|
145
161
|
export interface ParseOptions {
|
|
146
162
|
/**
|
|
@@ -195,12 +211,25 @@ export interface ListAPIInfo {
|
|
|
195
211
|
api: string;
|
|
196
212
|
server: string;
|
|
197
213
|
operationId: string;
|
|
214
|
+
isValid: boolean;
|
|
215
|
+
reason: ErrorType[];
|
|
198
216
|
auth?: AuthInfo;
|
|
199
217
|
}
|
|
218
|
+
export interface APIMap {
|
|
219
|
+
[key: string]: {
|
|
220
|
+
operation: OpenAPIV3.OperationObject;
|
|
221
|
+
isValid: boolean;
|
|
222
|
+
reason: ErrorType[];
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
export interface APIValidationResult {
|
|
226
|
+
isValid: boolean;
|
|
227
|
+
reason: ErrorType[];
|
|
228
|
+
}
|
|
200
229
|
export interface ListAPIResult {
|
|
201
230
|
allAPICount: number;
|
|
202
231
|
validAPICount: number;
|
|
203
|
-
|
|
232
|
+
APIs: ListAPIInfo[];
|
|
204
233
|
}
|
|
205
234
|
export interface AuthInfo {
|
|
206
235
|
authScheme: OpenAPIV3.SecuritySchemeObject;
|
|
@@ -5,8 +5,9 @@ export declare class ManifestUpdater {
|
|
|
5
5
|
static updateManifestWithAiPlugin(manifestPath: string, outputSpecPath: string, apiPluginFilePath: string, spec: OpenAPIV3.Document, options: ParseOptions): Promise<[TeamsAppManifest, PluginManifestSchema]>;
|
|
6
6
|
static updateManifestDescription(manifest: TeamsAppManifest, spec: OpenAPIV3.Document): void;
|
|
7
7
|
static mapOpenAPISchemaToFuncParam(schema: OpenAPIV3.SchemaObject, method: string, pathUrl: string): FunctionParameter;
|
|
8
|
-
static generatePluginManifestSchema(spec: OpenAPIV3.Document, specRelativePath: string, options: ParseOptions): PluginManifestSchema;
|
|
8
|
+
static generatePluginManifestSchema(spec: OpenAPIV3.Document, specRelativePath: string, appName: string, options: ParseOptions): PluginManifestSchema;
|
|
9
9
|
static updateManifest(manifestPath: string, outputSpecPath: string, spec: OpenAPIV3.Document, options: ParseOptions, adaptiveCardFolder?: string, authInfo?: AuthInfo): Promise<[TeamsAppManifest, WarningResult[]]>;
|
|
10
10
|
static generateCommands(spec: OpenAPIV3.Document, manifestPath: string, options: ParseOptions, adaptiveCardFolder?: string): Promise<[IMessagingExtensionCommand[], WarningResult[]]>;
|
|
11
11
|
static getRelativePath(from: string, to: string): string;
|
|
12
|
+
static removeEnvs(str: string): string;
|
|
12
13
|
}
|
|
@@ -56,4 +56,5 @@ export declare class SpecParser {
|
|
|
56
56
|
generate(manifestPath: string, filter: string[], outputSpecPath: string, adaptiveCardFolder?: string, signal?: AbortSignal): Promise<GenerateResult>;
|
|
57
57
|
private loadSpec;
|
|
58
58
|
private getAllSupportedAPIs;
|
|
59
|
+
private listSupportedAPIs;
|
|
59
60
|
}
|
package/dist/src/specParser.d.ts
CHANGED
|
@@ -54,5 +54,5 @@ export declare class SpecParser {
|
|
|
54
54
|
*/
|
|
55
55
|
generate(manifestPath: string, filter: string[], outputSpecPath: string, adaptiveCardFolder?: string, signal?: AbortSignal): Promise<GenerateResult>;
|
|
56
56
|
private loadSpec;
|
|
57
|
-
private
|
|
57
|
+
private getAPIs;
|
|
58
58
|
}
|
package/dist/src/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OpenAPIV3 } from "openapi-types";
|
|
2
2
|
import SwaggerParser from "@apidevtools/swagger-parser";
|
|
3
|
-
import { AuthInfo, CheckParamResult, ErrorResult, ParseOptions, ValidateResult, WarningResult } from "./interfaces";
|
|
3
|
+
import { APIMap, APIValidationResult, AuthInfo, CheckParamResult, ErrorResult, ParseOptions, ValidateResult, WarningResult } from "./interfaces";
|
|
4
4
|
import { IMessagingExtensionCommand, IParameter } from "@microsoft/teams-manifest";
|
|
5
5
|
export declare class Utils {
|
|
6
6
|
static hasNestedObjectInSchema(schema: OpenAPIV3.SchemaObject): boolean;
|
|
@@ -21,26 +21,27 @@ export declare class Utils {
|
|
|
21
21
|
* 5. response body should be “application/json” and not empty, and response code should be 20X
|
|
22
22
|
* 6. only support request body with “application/json” content type
|
|
23
23
|
*/
|
|
24
|
-
static isSupportedApi(method: string, path: string, spec: OpenAPIV3.Document, options: ParseOptions):
|
|
25
|
-
static isSupportedAuth(authSchemeArray: AuthInfo[][], options: ParseOptions):
|
|
24
|
+
static isSupportedApi(method: string, path: string, spec: OpenAPIV3.Document, options: ParseOptions): APIValidationResult;
|
|
25
|
+
static isSupportedAuth(authSchemeArray: AuthInfo[][], options: ParseOptions): APIValidationResult;
|
|
26
26
|
static isBearerTokenAuth(authScheme: OpenAPIV3.SecuritySchemeObject): boolean;
|
|
27
27
|
static isAPIKeyAuth(authScheme: OpenAPIV3.SecuritySchemeObject): boolean;
|
|
28
28
|
static isOAuthWithAuthCodeFlow(authScheme: OpenAPIV3.SecuritySchemeObject): boolean;
|
|
29
29
|
static getAuthArray(securities: OpenAPIV3.SecurityRequirementObject[] | undefined, spec: OpenAPIV3.Document): AuthInfo[][];
|
|
30
30
|
static updateFirstLetter(str: string): string;
|
|
31
|
-
static getResponseJson(operationObject: OpenAPIV3.OperationObject | undefined, isTeamsAiProject?: boolean):
|
|
31
|
+
static getResponseJson(operationObject: OpenAPIV3.OperationObject | undefined, isTeamsAiProject?: boolean): {
|
|
32
|
+
json: OpenAPIV3.MediaTypeObject;
|
|
33
|
+
multipleMediaType: boolean;
|
|
34
|
+
};
|
|
32
35
|
static convertPathToCamelCase(path: string): string;
|
|
33
36
|
static getUrlProtocol(urlString: string): string | undefined;
|
|
34
|
-
static
|
|
37
|
+
static resolveEnv(str: string): string;
|
|
35
38
|
static checkServerUrl(servers: OpenAPIV3.ServerObject[]): ErrorResult[];
|
|
36
39
|
static validateServer(spec: OpenAPIV3.Document, options: ParseOptions): ErrorResult[];
|
|
37
40
|
static isWellKnownName(name: string, wellknownNameList: string[]): boolean;
|
|
38
41
|
static generateParametersFromSchema(schema: OpenAPIV3.SchemaObject, name: string, allowMultipleParameters: boolean, isRequired?: boolean): [IParameter[], IParameter[]];
|
|
39
42
|
static updateParameterWithInputType(schema: OpenAPIV3.SchemaObject, param: IParameter): void;
|
|
40
43
|
static parseApiInfo(operationItem: OpenAPIV3.OperationObject, options: ParseOptions): [IMessagingExtensionCommand, WarningResult | undefined];
|
|
41
|
-
static
|
|
42
|
-
[key: string]: OpenAPIV3.OperationObject;
|
|
43
|
-
};
|
|
44
|
+
static listAPIs(spec: OpenAPIV3.Document, options: ParseOptions): APIMap;
|
|
44
45
|
static validateSpec(spec: OpenAPIV3.Document, parser: SwaggerParser, isSwaggerFile: boolean, options: ParseOptions): ValidateResult;
|
|
45
46
|
static format(str: string, ...args: string[]): string;
|
|
46
47
|
static getSafeRegistrationIdEnvName(authName: string): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/m365-spec-parser",
|
|
3
|
-
"version": "0.1.1-alpha.
|
|
3
|
+
"version": "0.1.1-alpha.b54a7ba8f.0",
|
|
4
4
|
"description": "OpenAPI specification files Parser for M365 Apps",
|
|
5
5
|
"main": "dist/index.node.cjs.js",
|
|
6
6
|
"browser": "dist/index.esm2017.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"sideEffects": false,
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@apidevtools/swagger-parser": "^10.1.0",
|
|
42
|
-
"@microsoft/teams-manifest": "0.1.4-alpha.
|
|
42
|
+
"@microsoft/teams-manifest": "0.1.4-alpha.b54a7ba8f.0",
|
|
43
43
|
"fs-extra": "^11.2.0",
|
|
44
44
|
"js-yaml": "^4.1.0",
|
|
45
45
|
"openapi-types": "^7.2.3",
|
|
@@ -148,5 +148,5 @@
|
|
|
148
148
|
"npx eslint --cache --fix --quiet"
|
|
149
149
|
]
|
|
150
150
|
},
|
|
151
|
-
"gitHead": "
|
|
151
|
+
"gitHead": "acaa9cd821c43780ba3eee6022058b627b625c87"
|
|
152
152
|
}
|