@microsoft/m365-spec-parser 0.1.1-alpha.7fe3da414.0 → 0.1.1-alpha.87f45d762.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 +537 -357
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm2017.mjs +611 -391
- package/dist/index.esm2017.mjs.map +1 -1
- package/dist/index.esm5.js +537 -357
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +767 -545
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/src/constants.d.ts +1 -0
- package/dist/src/index.d.ts +1 -1
- package/dist/src/interfaces.d.ts +14 -0
- package/dist/src/manifestUpdater.d.ts +1 -1
- package/dist/src/specParser.browser.d.ts +3 -2
- package/dist/src/specParser.d.ts +2 -0
- package/dist/src/utils.d.ts +4 -25
- package/package.json +3 -3
package/dist/src/constants.d.ts
CHANGED
package/dist/src/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { SpecParser } from "./specParser";
|
|
2
2
|
export { SpecParserError } from "./specParserError";
|
|
3
|
-
export { ValidationStatus, WarningType, ErrorType, WarningResult, ErrorResult, ListAPIResult, APIInfo, ValidateResult, ParseOptions, AdaptiveCard, ProjectType, } from "./interfaces";
|
|
3
|
+
export { ValidationStatus, WarningType, ErrorType, WarningResult, ErrorResult, ListAPIResult, APIInfo, ValidateResult, ParseOptions, AdaptiveCard, ProjectType, InvalidAPIInfo, } from "./interfaces";
|
|
4
4
|
export { ConstantString } from "./constants";
|
|
5
5
|
export { Utils } from "./utils";
|
|
6
6
|
export { AdaptiveCardGenerator } from "./adaptiveCardGenerator";
|
package/dist/src/interfaces.d.ts
CHANGED
|
@@ -17,6 +17,16 @@ export interface ValidateResult {
|
|
|
17
17
|
*/
|
|
18
18
|
errors: ErrorResult[];
|
|
19
19
|
}
|
|
20
|
+
export interface SpecValidationResult {
|
|
21
|
+
/**
|
|
22
|
+
* An array of warning results generated during validation.
|
|
23
|
+
*/
|
|
24
|
+
warnings: WarningResult[];
|
|
25
|
+
/**
|
|
26
|
+
* An array of error results generated during validation.
|
|
27
|
+
*/
|
|
28
|
+
errors: ErrorResult[];
|
|
29
|
+
}
|
|
20
30
|
/**
|
|
21
31
|
* An interface that represents a warning result generated during validation.
|
|
22
32
|
*/
|
|
@@ -235,3 +245,7 @@ export interface AuthInfo {
|
|
|
235
245
|
authScheme: OpenAPIV3.SecuritySchemeObject;
|
|
236
246
|
name: string;
|
|
237
247
|
}
|
|
248
|
+
export interface InvalidAPIInfo {
|
|
249
|
+
api: string;
|
|
250
|
+
reason: ErrorType[];
|
|
251
|
+
}
|
|
@@ -5,7 +5,7 @@ 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, appName: string, options: ParseOptions): PluginManifestSchema
|
|
8
|
+
static generatePluginManifestSchema(spec: OpenAPIV3.Document, specRelativePath: string, apiPluginFilePath: string, appName: string, options: ParseOptions): Promise<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;
|
|
@@ -10,6 +10,7 @@ export declare class SpecParser {
|
|
|
10
10
|
readonly options: Required<ParseOptions>;
|
|
11
11
|
private apiMap;
|
|
12
12
|
private spec;
|
|
13
|
+
private validator;
|
|
13
14
|
private unResolveSpec;
|
|
14
15
|
private isSwaggerFile;
|
|
15
16
|
private defaultOptions;
|
|
@@ -55,6 +56,6 @@ export declare class SpecParser {
|
|
|
55
56
|
*/
|
|
56
57
|
generate(manifestPath: string, filter: string[], outputSpecPath: string, adaptiveCardFolder?: string, signal?: AbortSignal): Promise<GenerateResult>;
|
|
57
58
|
private loadSpec;
|
|
58
|
-
private
|
|
59
|
-
private
|
|
59
|
+
private getAPIs;
|
|
60
|
+
private getValidator;
|
|
60
61
|
}
|
package/dist/src/specParser.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export declare class SpecParser {
|
|
|
9
9
|
readonly parser: SwaggerParser;
|
|
10
10
|
readonly options: Required<ParseOptions>;
|
|
11
11
|
private apiMap;
|
|
12
|
+
private validator;
|
|
12
13
|
private spec;
|
|
13
14
|
private unResolveSpec;
|
|
14
15
|
private isSwaggerFile;
|
|
@@ -55,4 +56,5 @@ export declare class SpecParser {
|
|
|
55
56
|
generate(manifestPath: string, filter: string[], outputSpecPath: string, adaptiveCardFolder?: string, signal?: AbortSignal): Promise<GenerateResult>;
|
|
56
57
|
private loadSpec;
|
|
57
58
|
private getAPIs;
|
|
59
|
+
private getValidator;
|
|
58
60
|
}
|
package/dist/src/utils.d.ts
CHANGED
|
@@ -1,34 +1,15 @@
|
|
|
1
1
|
import { OpenAPIV3 } from "openapi-types";
|
|
2
|
-
import
|
|
3
|
-
import { APIMap, APIValidationResult, AuthInfo, CheckParamResult, ErrorResult, ParseOptions, ValidateResult, WarningResult } from "./interfaces";
|
|
2
|
+
import { AuthInfo, ErrorResult, ParseOptions } from "./interfaces";
|
|
4
3
|
import { IMessagingExtensionCommand, IParameter } from "@microsoft/teams-manifest";
|
|
5
4
|
export declare class Utils {
|
|
6
5
|
static hasNestedObjectInSchema(schema: OpenAPIV3.SchemaObject): boolean;
|
|
7
|
-
static checkParameters(paramObject: OpenAPIV3.ParameterObject[], isCopilot: boolean): CheckParamResult;
|
|
8
|
-
static checkPostBody(schema: OpenAPIV3.SchemaObject, isRequired?: boolean, isCopilot?: boolean): CheckParamResult;
|
|
9
6
|
static containMultipleMediaTypes(bodyObject: OpenAPIV3.RequestBodyObject | OpenAPIV3.ResponseObject): boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Checks if the given API is supported.
|
|
12
|
-
* @param {string} method - The HTTP method of the API.
|
|
13
|
-
* @param {string} path - The path of the API.
|
|
14
|
-
* @param {OpenAPIV3.Document} spec - The OpenAPI specification document.
|
|
15
|
-
* @returns {boolean} - Returns true if the API is supported, false otherwise.
|
|
16
|
-
* @description The following APIs are supported:
|
|
17
|
-
* 1. only support Get/Post operation without auth property
|
|
18
|
-
* 2. parameter inside query or path only support string, number, boolean and integer
|
|
19
|
-
* 3. parameter inside post body only support string, number, boolean, integer and object
|
|
20
|
-
* 4. request body + required parameters <= 1
|
|
21
|
-
* 5. response body should be “application/json” and not empty, and response code should be 20X
|
|
22
|
-
* 6. only support request body with “application/json” content type
|
|
23
|
-
*/
|
|
24
|
-
static isSupportedApi(method: string, path: string, spec: OpenAPIV3.Document, options: ParseOptions): APIValidationResult;
|
|
25
|
-
static isSupportedAuth(authSchemeArray: AuthInfo[][], options: ParseOptions): APIValidationResult;
|
|
26
7
|
static isBearerTokenAuth(authScheme: OpenAPIV3.SecuritySchemeObject): boolean;
|
|
27
8
|
static isAPIKeyAuth(authScheme: OpenAPIV3.SecuritySchemeObject): boolean;
|
|
28
9
|
static isOAuthWithAuthCodeFlow(authScheme: OpenAPIV3.SecuritySchemeObject): boolean;
|
|
29
10
|
static getAuthArray(securities: OpenAPIV3.SecurityRequirementObject[] | undefined, spec: OpenAPIV3.Document): AuthInfo[][];
|
|
30
11
|
static updateFirstLetter(str: string): string;
|
|
31
|
-
static getResponseJson(operationObject: OpenAPIV3.OperationObject | undefined
|
|
12
|
+
static getResponseJson(operationObject: OpenAPIV3.OperationObject | undefined): {
|
|
32
13
|
json: OpenAPIV3.MediaTypeObject;
|
|
33
14
|
multipleMediaType: boolean;
|
|
34
15
|
};
|
|
@@ -40,10 +21,8 @@ export declare class Utils {
|
|
|
40
21
|
static isWellKnownName(name: string, wellknownNameList: string[]): boolean;
|
|
41
22
|
static generateParametersFromSchema(schema: OpenAPIV3.SchemaObject, name: string, allowMultipleParameters: boolean, isRequired?: boolean): [IParameter[], IParameter[]];
|
|
42
23
|
static updateParameterWithInputType(schema: OpenAPIV3.SchemaObject, param: IParameter): void;
|
|
43
|
-
static parseApiInfo(operationItem: OpenAPIV3.OperationObject, options: ParseOptions):
|
|
44
|
-
static listAPIs(spec: OpenAPIV3.Document, options: ParseOptions): APIMap;
|
|
45
|
-
static validateSpec(spec: OpenAPIV3.Document, parser: SwaggerParser, isSwaggerFile: boolean, options: ParseOptions): ValidateResult;
|
|
24
|
+
static parseApiInfo(operationItem: OpenAPIV3.OperationObject, options: ParseOptions): IMessagingExtensionCommand;
|
|
46
25
|
static format(str: string, ...args: string[]): string;
|
|
47
26
|
static getSafeRegistrationIdEnvName(authName: string): string;
|
|
48
|
-
static
|
|
27
|
+
static getServerObject(spec: OpenAPIV3.Document, method: string, path: string): OpenAPIV3.ServerObject | undefined;
|
|
49
28
|
}
|
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.87f45d762.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.87f45d762.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": "b33ed9f3cebaa48a501c531cb269403d16b67f7e"
|
|
152
152
|
}
|