@microsoft/m365-spec-parser 0.2.11 → 0.2.12-alpha.0a63a75aae.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 +1565 -1565
- package/dist/index.esm2017.mjs +2605 -2604
- package/dist/index.esm2017.mjs.map +1 -1
- package/dist/index.esm5.js +1572 -1612
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +2606 -2672
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/src/adaptiveCardGenerator.d.ts +10 -10
- package/dist/src/adaptiveCardWrapper.d.ts +16 -16
- package/dist/src/constants.d.ts +53 -53
- package/dist/src/index.browser.d.ts +7 -7
- package/dist/src/index.d.ts +6 -6
- package/dist/src/interfaces.d.ts +300 -300
- package/dist/src/jsonDataGenerator.d.ts +6 -6
- package/dist/src/manifestUpdater.d.ts +16 -16
- package/dist/src/specFilter.d.ts +5 -5
- package/dist/src/specOptimizer.d.ts +18 -18
- package/dist/src/specParser.browser.d.ts +60 -60
- package/dist/src/specParser.d.ts +71 -71
- package/dist/src/specParserError.d.ts +5 -5
- package/dist/src/utils.d.ts +34 -34
- package/package.json +21 -21
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { OpenAPIV3 } from "openapi-types";
|
|
2
|
-
export interface OptimizerOptions {
|
|
3
|
-
removeUnusedComponents: boolean;
|
|
4
|
-
removeUnusedTags: boolean;
|
|
5
|
-
removeUserDefinedRootProperty: boolean;
|
|
6
|
-
removeUnusedSecuritySchemas: boolean;
|
|
7
|
-
}
|
|
8
|
-
export declare class SpecOptimizer {
|
|
9
|
-
private static defaultOptions;
|
|
10
|
-
static optimize(spec: OpenAPIV3.Document, options?: OptimizerOptions): OpenAPIV3.Document;
|
|
11
|
-
private static removeUnusedSecuritySchemas;
|
|
12
|
-
private static removeUnusedTags;
|
|
13
|
-
private static removeUserDefinedRootProperty;
|
|
14
|
-
private static removeUnusedComponents;
|
|
15
|
-
private static getComponentReferences;
|
|
16
|
-
private static getComponent;
|
|
17
|
-
private static addComponent;
|
|
18
|
-
}
|
|
1
|
+
import { OpenAPIV3 } from "openapi-types";
|
|
2
|
+
export interface OptimizerOptions {
|
|
3
|
+
removeUnusedComponents: boolean;
|
|
4
|
+
removeUnusedTags: boolean;
|
|
5
|
+
removeUserDefinedRootProperty: boolean;
|
|
6
|
+
removeUnusedSecuritySchemas: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare class SpecOptimizer {
|
|
9
|
+
private static defaultOptions;
|
|
10
|
+
static optimize(spec: OpenAPIV3.Document, options?: OptimizerOptions): OpenAPIV3.Document;
|
|
11
|
+
private static removeUnusedSecuritySchemas;
|
|
12
|
+
private static removeUnusedTags;
|
|
13
|
+
private static removeUserDefinedRootProperty;
|
|
14
|
+
private static removeUnusedComponents;
|
|
15
|
+
private static getComponentReferences;
|
|
16
|
+
private static getComponent;
|
|
17
|
+
private static addComponent;
|
|
18
|
+
}
|
|
@@ -1,60 +1,60 @@
|
|
|
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 spec;
|
|
12
|
-
private validator;
|
|
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
|
-
* Generate specs according to the filters.
|
|
37
|
-
* @param filter An array of strings that represent the filters to apply when generating the artifacts. If filter is empty, it would process nothing.
|
|
38
|
-
*/
|
|
39
|
-
getFilteredSpecs(filter: string[], signal?: AbortSignal): Promise<[OpenAPIV3.Document, OpenAPIV3.Document]>;
|
|
40
|
-
/**
|
|
41
|
-
* Generates and update artifacts from the OpenAPI specification file. Generate Adaptive Cards, update Teams app manifest, and generate a new OpenAPI specification file.
|
|
42
|
-
* @param manifestPath A file path of the Teams app manifest file to update.
|
|
43
|
-
* @param filter An array of strings that represent the filters to apply when generating the artifacts. If filter is empty, it would process nothing.
|
|
44
|
-
* @param outputSpecPath File path of the new OpenAPI specification file to generate. If not specified or empty, no spec file will be generated.
|
|
45
|
-
* @param pluginFilePath File path of the api plugin file to generate.
|
|
46
|
-
*/
|
|
47
|
-
generateForCopilot(manifestPath: string, filter: string[], outputSpecPath: string, pluginFilePath: string, signal?: AbortSignal): Promise<GenerateResult>;
|
|
48
|
-
/**
|
|
49
|
-
* Generates and update artifacts from the OpenAPI specification file. Generate Adaptive Cards, update Teams app manifest, and generate a new OpenAPI specification file.
|
|
50
|
-
* @param manifestPath A file path of the Teams app manifest file to update.
|
|
51
|
-
* @param filter An array of strings that represent the filters to apply when generating the artifacts. If filter is empty, it would process nothing.
|
|
52
|
-
* @param outputSpecPath File path of the new OpenAPI specification file to generate. If not specified or empty, no spec file will be generated.
|
|
53
|
-
* @param adaptiveCardFolder Folder path where the Adaptive Card files will be generated. If not specified or empty, Adaptive Card files will not be generated.
|
|
54
|
-
* @param isMe Boolean that indicates whether the project is an Messaging Extension. For Messaging Extension, composeExtensions will be added in Teams app manifest.
|
|
55
|
-
*/
|
|
56
|
-
generate(manifestPath: string, filter: string[], outputSpecPath: string, adaptiveCardFolder?: string, signal?: AbortSignal): Promise<GenerateResult>;
|
|
57
|
-
private loadSpec;
|
|
58
|
-
private getAPIs;
|
|
59
|
-
private getValidator;
|
|
60
|
-
}
|
|
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 spec;
|
|
12
|
+
private validator;
|
|
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
|
+
* Generate specs according to the filters.
|
|
37
|
+
* @param filter An array of strings that represent the filters to apply when generating the artifacts. If filter is empty, it would process nothing.
|
|
38
|
+
*/
|
|
39
|
+
getFilteredSpecs(filter: string[], signal?: AbortSignal): Promise<[OpenAPIV3.Document, OpenAPIV3.Document]>;
|
|
40
|
+
/**
|
|
41
|
+
* Generates and update artifacts from the OpenAPI specification file. Generate Adaptive Cards, update Teams app manifest, and generate a new OpenAPI specification file.
|
|
42
|
+
* @param manifestPath A file path of the Teams app manifest file to update.
|
|
43
|
+
* @param filter An array of strings that represent the filters to apply when generating the artifacts. If filter is empty, it would process nothing.
|
|
44
|
+
* @param outputSpecPath File path of the new OpenAPI specification file to generate. If not specified or empty, no spec file will be generated.
|
|
45
|
+
* @param pluginFilePath File path of the api plugin file to generate.
|
|
46
|
+
*/
|
|
47
|
+
generateForCopilot(manifestPath: string, filter: string[], outputSpecPath: string, pluginFilePath: string, signal?: AbortSignal): Promise<GenerateResult>;
|
|
48
|
+
/**
|
|
49
|
+
* Generates and update artifacts from the OpenAPI specification file. Generate Adaptive Cards, update Teams app manifest, and generate a new OpenAPI specification file.
|
|
50
|
+
* @param manifestPath A file path of the Teams app manifest file to update.
|
|
51
|
+
* @param filter An array of strings that represent the filters to apply when generating the artifacts. If filter is empty, it would process nothing.
|
|
52
|
+
* @param outputSpecPath File path of the new OpenAPI specification file to generate. If not specified or empty, no spec file will be generated.
|
|
53
|
+
* @param adaptiveCardFolder Folder path where the Adaptive Card files will be generated. If not specified or empty, Adaptive Card files will not be generated.
|
|
54
|
+
* @param isMe Boolean that indicates whether the project is an Messaging Extension. For Messaging Extension, composeExtensions will be added in Teams app manifest.
|
|
55
|
+
*/
|
|
56
|
+
generate(manifestPath: string, filter: string[], outputSpecPath: string, adaptiveCardFolder?: string, signal?: AbortSignal): Promise<GenerateResult>;
|
|
57
|
+
private loadSpec;
|
|
58
|
+
private getAPIs;
|
|
59
|
+
private getValidator;
|
|
60
|
+
}
|
package/dist/src/specParser.d.ts
CHANGED
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
import SwaggerParser from "@apidevtools/swagger-parser";
|
|
2
|
-
import { OpenAPIV3 } from "openapi-types";
|
|
3
|
-
import { AdaptiveCardUpdateStrategy, APIInfo, GenerateResult, ListAPIResult, ParseOptions, ValidateResult } 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 validator;
|
|
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
|
-
addAuthScheme(authName: string, authType: string, authParameters: any, signal?: AbortSignal): Promise<void>;
|
|
30
|
-
/**
|
|
31
|
-
* Lists all the OpenAPI operations in the specification file.
|
|
32
|
-
* @returns A string array that represents the HTTP method and path of each operation, such as ['GET /pets/{petId}', 'GET /user/{userId}']
|
|
33
|
-
* according to copilot plugin spec, only list get and post method without auth
|
|
34
|
-
*/
|
|
35
|
-
list(): Promise<ListAPIResult>;
|
|
36
|
-
/**
|
|
37
|
-
* Generate specs according to the filters.
|
|
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
|
-
*/
|
|
40
|
-
getFilteredSpecs(filter: string[], signal?: AbortSignal): Promise<[OpenAPIV3.Document, OpenAPIV3.Document]>;
|
|
41
|
-
private deReferenceSpec;
|
|
42
|
-
/**
|
|
43
|
-
* Generates and update artifacts from the OpenAPI specification file. Generate Adaptive Cards, update Teams app manifest, and generate a new OpenAPI specification file.
|
|
44
|
-
* @param manifestPath A file path of the Teams app manifest file to update.
|
|
45
|
-
* @param filter An array of strings that represent the filters to apply when generating the artifacts. If filter is empty, it would process nothing.
|
|
46
|
-
* @param outputSpecPath File path of the new OpenAPI specification file to generate. If not specified or empty, no spec file will be generated.
|
|
47
|
-
* @param pluginFilePath File path of the api plugin file to generate.
|
|
48
|
-
*/
|
|
49
|
-
generateForCopilot(manifestPath: string, filter: string[], outputSpecPath: string, pluginFilePath: string, existingPluginFilePath?: string, signal?: AbortSignal, adaptiveCardUpdateStrategy?: AdaptiveCardUpdateStrategy): Promise<GenerateResult>;
|
|
50
|
-
/**
|
|
51
|
-
* Generates and update artifacts from the OpenAPI specification file. Generate Adaptive Cards, update Teams app manifest, and generate a new OpenAPI specification file.
|
|
52
|
-
* @param manifestPath A file path of the Teams app manifest file to update.
|
|
53
|
-
* @param filter An array of strings that represent the filters to apply when generating the artifacts. If filter is empty, it would process nothing.
|
|
54
|
-
* @param outputSpecPath File path of the new OpenAPI specification file to generate. If not specified or empty, no spec file will be generated.
|
|
55
|
-
* @param adaptiveCardFolder Folder path where the Adaptive Card files will be generated. If not specified or empty, Adaptive Card files will not be generated.
|
|
56
|
-
*/
|
|
57
|
-
generate(manifestPath: string, filter: string[], outputSpecPath: string, adaptiveCardFolder?: string, signal?: AbortSignal): Promise<GenerateResult>;
|
|
58
|
-
/**
|
|
59
|
-
* Generates and update artifacts from the OpenAPI specification file. Generate Adaptive Cards, update Teams app manifest, and generate a new OpenAPI specification file.
|
|
60
|
-
* @param pluginFilePath A file path of the plugin manifest file to update.
|
|
61
|
-
* @param filter An array of strings that represent the filters to apply when generating the artifacts. If filter is empty, it would process nothing.
|
|
62
|
-
*/
|
|
63
|
-
generateAdaptiveCardInPlugin(pluginFilePath: string, filter: string[], signal?: AbortSignal): Promise<void>;
|
|
64
|
-
private separateAdaptiveCards;
|
|
65
|
-
private loadSpec;
|
|
66
|
-
private getAPIs;
|
|
67
|
-
private getValidator;
|
|
68
|
-
private saveFilterSpec;
|
|
69
|
-
private resolveEnvForSpec;
|
|
70
|
-
private findUniqueCardName;
|
|
71
|
-
}
|
|
1
|
+
import SwaggerParser from "@apidevtools/swagger-parser";
|
|
2
|
+
import { OpenAPIV3 } from "openapi-types";
|
|
3
|
+
import { AdaptiveCardUpdateStrategy, APIInfo, GenerateResult, ListAPIResult, ParseOptions, ValidateResult } 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 validator;
|
|
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
|
+
addAuthScheme(authName: string, authType: string, authParameters: any, signal?: AbortSignal): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Lists all the OpenAPI operations in the specification file.
|
|
32
|
+
* @returns A string array that represents the HTTP method and path of each operation, such as ['GET /pets/{petId}', 'GET /user/{userId}']
|
|
33
|
+
* according to copilot plugin spec, only list get and post method without auth
|
|
34
|
+
*/
|
|
35
|
+
list(): Promise<ListAPIResult>;
|
|
36
|
+
/**
|
|
37
|
+
* Generate specs according to the filters.
|
|
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
|
+
*/
|
|
40
|
+
getFilteredSpecs(filter: string[], signal?: AbortSignal): Promise<[OpenAPIV3.Document, OpenAPIV3.Document]>;
|
|
41
|
+
private deReferenceSpec;
|
|
42
|
+
/**
|
|
43
|
+
* Generates and update artifacts from the OpenAPI specification file. Generate Adaptive Cards, update Teams app manifest, and generate a new OpenAPI specification file.
|
|
44
|
+
* @param manifestPath A file path of the Teams app manifest file to update.
|
|
45
|
+
* @param filter An array of strings that represent the filters to apply when generating the artifacts. If filter is empty, it would process nothing.
|
|
46
|
+
* @param outputSpecPath File path of the new OpenAPI specification file to generate. If not specified or empty, no spec file will be generated.
|
|
47
|
+
* @param pluginFilePath File path of the api plugin file to generate.
|
|
48
|
+
*/
|
|
49
|
+
generateForCopilot(manifestPath: string, filter: string[], outputSpecPath: string, pluginFilePath: string, existingPluginFilePath?: string, signal?: AbortSignal, adaptiveCardUpdateStrategy?: AdaptiveCardUpdateStrategy): Promise<GenerateResult>;
|
|
50
|
+
/**
|
|
51
|
+
* Generates and update artifacts from the OpenAPI specification file. Generate Adaptive Cards, update Teams app manifest, and generate a new OpenAPI specification file.
|
|
52
|
+
* @param manifestPath A file path of the Teams app manifest file to update.
|
|
53
|
+
* @param filter An array of strings that represent the filters to apply when generating the artifacts. If filter is empty, it would process nothing.
|
|
54
|
+
* @param outputSpecPath File path of the new OpenAPI specification file to generate. If not specified or empty, no spec file will be generated.
|
|
55
|
+
* @param adaptiveCardFolder Folder path where the Adaptive Card files will be generated. If not specified or empty, Adaptive Card files will not be generated.
|
|
56
|
+
*/
|
|
57
|
+
generate(manifestPath: string, filter: string[], outputSpecPath: string, adaptiveCardFolder?: string, signal?: AbortSignal): Promise<GenerateResult>;
|
|
58
|
+
/**
|
|
59
|
+
* Generates and update artifacts from the OpenAPI specification file. Generate Adaptive Cards, update Teams app manifest, and generate a new OpenAPI specification file.
|
|
60
|
+
* @param pluginFilePath A file path of the plugin manifest file to update.
|
|
61
|
+
* @param filter An array of strings that represent the filters to apply when generating the artifacts. If filter is empty, it would process nothing.
|
|
62
|
+
*/
|
|
63
|
+
generateAdaptiveCardInPlugin(pluginFilePath: string, filter: string[], signal?: AbortSignal): Promise<void>;
|
|
64
|
+
private separateAdaptiveCards;
|
|
65
|
+
private loadSpec;
|
|
66
|
+
private getAPIs;
|
|
67
|
+
private getValidator;
|
|
68
|
+
private saveFilterSpec;
|
|
69
|
+
private resolveEnvForSpec;
|
|
70
|
+
private findUniqueCardName;
|
|
71
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ErrorType } from "./interfaces";
|
|
2
|
-
export declare class SpecParserError extends Error {
|
|
3
|
-
readonly errorType: ErrorType;
|
|
4
|
-
constructor(message: string, errorType: ErrorType);
|
|
5
|
-
}
|
|
1
|
+
import { ErrorType } from "./interfaces";
|
|
2
|
+
export declare class SpecParserError extends Error {
|
|
3
|
+
readonly errorType: ErrorType;
|
|
4
|
+
constructor(message: string, errorType: ErrorType);
|
|
5
|
+
}
|
package/dist/src/utils.d.ts
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { OpenAPIV3 } from "openapi-types";
|
|
2
|
-
import { AuthInfo, AuthType, ErrorResult, OperationAuthInfoMap, ParseOptions } from "./interfaces";
|
|
3
|
-
import { IMessagingExtensionCommand, IParameter } from "@microsoft/app-manifest";
|
|
4
|
-
export declare class Utils {
|
|
5
|
-
static isObjectSchema(schema: OpenAPIV3.SchemaObject): boolean;
|
|
6
|
-
static containMultipleMediaTypes(bodyObject: OpenAPIV3.RequestBodyObject | OpenAPIV3.ResponseObject): boolean;
|
|
7
|
-
static isBearerTokenAuth(authScheme: AuthType): boolean;
|
|
8
|
-
static isAPIKeyAuth(authScheme: AuthType): boolean;
|
|
9
|
-
static isAPIKeyAuthButNotInCookie(authScheme: AuthType): boolean;
|
|
10
|
-
static isOAuthWithAuthCodeFlow(authScheme: AuthType): boolean;
|
|
11
|
-
static isNotSupportedAuth(authSchemeArray: AuthInfo[][]): boolean;
|
|
12
|
-
static getAuthArray(securities: OpenAPIV3.SecurityRequirementObject[] | undefined, spec: OpenAPIV3.Document): AuthInfo[][];
|
|
13
|
-
static getAuthMap(spec: OpenAPIV3.Document): OperationAuthInfoMap;
|
|
14
|
-
static getAuthInfo(spec: OpenAPIV3.Document): AuthInfo | undefined;
|
|
15
|
-
static updateFirstLetter(str: string): string;
|
|
16
|
-
static getResponseJson(operationObject: OpenAPIV3.OperationObject | undefined, allowMultipleMediaType?: boolean): {
|
|
17
|
-
json: OpenAPIV3.MediaTypeObject;
|
|
18
|
-
multipleMediaType: boolean;
|
|
19
|
-
};
|
|
20
|
-
static getJsonContentType(responseObject: OpenAPIV3.ResponseObject | OpenAPIV3.RequestBodyObject): OpenAPIV3.MediaTypeObject;
|
|
21
|
-
static convertPathToCamelCase(path: string): string;
|
|
22
|
-
static getUrlProtocol(urlString: string): string | undefined;
|
|
23
|
-
static resolveEnv(str: string): string;
|
|
24
|
-
static checkServerUrl(servers: OpenAPIV3.ServerObject[], allowHttp?: boolean): ErrorResult[];
|
|
25
|
-
static validateServer(spec: OpenAPIV3.Document, options: ParseOptions): ErrorResult[];
|
|
26
|
-
static isWellKnownName(name: string, wellknownNameList: string[]): boolean;
|
|
27
|
-
static generateParametersFromSchema(schema: OpenAPIV3.SchemaObject, name: string, allowMultipleParameters: boolean, isRequired?: boolean): [IParameter[], IParameter[]];
|
|
28
|
-
static updateParameterWithInputType(schema: OpenAPIV3.SchemaObject, param: IParameter): void;
|
|
29
|
-
static parseApiInfo(operationItem: OpenAPIV3.OperationObject, options: ParseOptions): IMessagingExtensionCommand;
|
|
30
|
-
static format(str: string, ...args: string[]): string;
|
|
31
|
-
static getSafeRegistrationIdEnvName(authName: string): string;
|
|
32
|
-
static getServerObject(spec: OpenAPIV3.Document, method: string, path: string): OpenAPIV3.ServerObject | undefined;
|
|
33
|
-
static getAuthSchemaObject(authType: string, authParameters: any): OpenAPIV3.SecuritySchemeObject;
|
|
34
|
-
}
|
|
1
|
+
import { OpenAPIV3 } from "openapi-types";
|
|
2
|
+
import { AuthInfo, AuthType, ErrorResult, OperationAuthInfoMap, ParseOptions } from "./interfaces";
|
|
3
|
+
import { IMessagingExtensionCommand, IParameter } from "@microsoft/app-manifest";
|
|
4
|
+
export declare class Utils {
|
|
5
|
+
static isObjectSchema(schema: OpenAPIV3.SchemaObject): boolean;
|
|
6
|
+
static containMultipleMediaTypes(bodyObject: OpenAPIV3.RequestBodyObject | OpenAPIV3.ResponseObject): boolean;
|
|
7
|
+
static isBearerTokenAuth(authScheme: AuthType): boolean;
|
|
8
|
+
static isAPIKeyAuth(authScheme: AuthType): boolean;
|
|
9
|
+
static isAPIKeyAuthButNotInCookie(authScheme: AuthType): boolean;
|
|
10
|
+
static isOAuthWithAuthCodeFlow(authScheme: AuthType): boolean;
|
|
11
|
+
static isNotSupportedAuth(authSchemeArray: AuthInfo[][]): boolean;
|
|
12
|
+
static getAuthArray(securities: OpenAPIV3.SecurityRequirementObject[] | undefined, spec: OpenAPIV3.Document): AuthInfo[][];
|
|
13
|
+
static getAuthMap(spec: OpenAPIV3.Document): OperationAuthInfoMap;
|
|
14
|
+
static getAuthInfo(spec: OpenAPIV3.Document): AuthInfo | undefined;
|
|
15
|
+
static updateFirstLetter(str: string): string;
|
|
16
|
+
static getResponseJson(operationObject: OpenAPIV3.OperationObject | undefined, allowMultipleMediaType?: boolean): {
|
|
17
|
+
json: OpenAPIV3.MediaTypeObject;
|
|
18
|
+
multipleMediaType: boolean;
|
|
19
|
+
};
|
|
20
|
+
static getJsonContentType(responseObject: OpenAPIV3.ResponseObject | OpenAPIV3.RequestBodyObject): OpenAPIV3.MediaTypeObject;
|
|
21
|
+
static convertPathToCamelCase(path: string): string;
|
|
22
|
+
static getUrlProtocol(urlString: string): string | undefined;
|
|
23
|
+
static resolveEnv(str: string): string;
|
|
24
|
+
static checkServerUrl(servers: OpenAPIV3.ServerObject[], allowHttp?: boolean): ErrorResult[];
|
|
25
|
+
static validateServer(spec: OpenAPIV3.Document, options: ParseOptions): ErrorResult[];
|
|
26
|
+
static isWellKnownName(name: string, wellknownNameList: string[]): boolean;
|
|
27
|
+
static generateParametersFromSchema(schema: OpenAPIV3.SchemaObject, name: string, allowMultipleParameters: boolean, isRequired?: boolean): [IParameter[], IParameter[]];
|
|
28
|
+
static updateParameterWithInputType(schema: OpenAPIV3.SchemaObject, param: IParameter): void;
|
|
29
|
+
static parseApiInfo(operationItem: OpenAPIV3.OperationObject, options: ParseOptions): IMessagingExtensionCommand;
|
|
30
|
+
static format(str: string, ...args: string[]): string;
|
|
31
|
+
static getSafeRegistrationIdEnvName(authName: string): string;
|
|
32
|
+
static getServerObject(spec: OpenAPIV3.Document, method: string, path: string): OpenAPIV3.ServerObject | undefined;
|
|
33
|
+
static getAuthSchemaObject(authType: string, authParameters: any): OpenAPIV3.SecuritySchemeObject;
|
|
34
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/m365-spec-parser",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.12-alpha.0a63a75aae.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",
|
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
"test:unit": "npm run test:unit:node && npm run test:unit:browser ",
|
|
15
15
|
"lint:staged": "lint-staged",
|
|
16
16
|
"lint": "eslint \"**/*.ts\"",
|
|
17
|
-
"
|
|
18
|
-
"precommit": "npm run check-sensitive && lint-staged",
|
|
17
|
+
"precommit": "lint-staged",
|
|
19
18
|
"check-format": "prettier --list-different \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"",
|
|
20
19
|
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\""
|
|
21
20
|
},
|
|
@@ -39,7 +38,7 @@
|
|
|
39
38
|
"sideEffects": false,
|
|
40
39
|
"dependencies": {
|
|
41
40
|
"@apidevtools/swagger-parser": "^10.1.1",
|
|
42
|
-
"@microsoft/app-manifest": "1.0.
|
|
41
|
+
"@microsoft/app-manifest": "1.0.5-alpha.0a63a75aae.0",
|
|
43
42
|
"fs-extra": "^11.2.0",
|
|
44
43
|
"js-yaml": "^4.1.0",
|
|
45
44
|
"openapi-types": "^7.2.3",
|
|
@@ -60,12 +59,10 @@
|
|
|
60
59
|
"@types/chai": "^4.2.22",
|
|
61
60
|
"@types/fs-extra": "^11.0.4",
|
|
62
61
|
"@types/js-yaml": "^4.0.9",
|
|
63
|
-
"@types/mocha": "^
|
|
64
|
-
"@types/node": "^
|
|
65
|
-
"@types/sinon": "^
|
|
62
|
+
"@types/mocha": "^10.0.10",
|
|
63
|
+
"@types/node": "^22.15.0",
|
|
64
|
+
"@types/sinon": "^17.0.0",
|
|
66
65
|
"@types/swagger2openapi": "^7.0.4",
|
|
67
|
-
"@typescript-eslint/eslint-plugin": "^4.19.0",
|
|
68
|
-
"@typescript-eslint/parser": "^4.19.0",
|
|
69
66
|
"ajv-draft-04": "1.0.0",
|
|
70
67
|
"assertion-error": "^2.0.0",
|
|
71
68
|
"available-typed-arrays": "1.0.6",
|
|
@@ -78,15 +75,17 @@
|
|
|
78
75
|
"define-data-property": "1.1.2",
|
|
79
76
|
"dotenv": "^16.4.1",
|
|
80
77
|
"es-errors": "1.3.0",
|
|
81
|
-
"eslint": "^
|
|
82
|
-
"eslint-
|
|
83
|
-
"eslint-plugin-
|
|
84
|
-
"eslint-plugin-
|
|
85
|
-
"eslint-plugin-
|
|
78
|
+
"eslint": "^9.0.0",
|
|
79
|
+
"eslint-config-prettier": "^10.1.0",
|
|
80
|
+
"eslint-plugin-headers": "^1.3.4",
|
|
81
|
+
"eslint-plugin-import-x": "^4.16.0",
|
|
82
|
+
"eslint-plugin-no-secrets": "^1.1.2",
|
|
83
|
+
"eslint-plugin-prettier": "^5.5.0",
|
|
86
84
|
"events": "3.3.0",
|
|
87
85
|
"for-each": "0.3.3",
|
|
88
86
|
"get-func-name": "2.0.2",
|
|
89
87
|
"get-intrinsic": "1.2.4",
|
|
88
|
+
"globals": "^16.2.0",
|
|
90
89
|
"gopd": "1.0.1",
|
|
91
90
|
"has-property-descriptors": "1.0.1",
|
|
92
91
|
"has-proto": "1.0.1",
|
|
@@ -110,12 +109,12 @@
|
|
|
110
109
|
"karma-webpack": "^5.0.0",
|
|
111
110
|
"lint-staged": "^10.5.4",
|
|
112
111
|
"lodash.get": "^4.4.2",
|
|
113
|
-
"mocha": "^
|
|
112
|
+
"mocha": "^11.0.0",
|
|
114
113
|
"mock-fs": "^5.2.0",
|
|
115
114
|
"mocked-env": "^1.3.5",
|
|
116
115
|
"nanoid": "3.2.0",
|
|
117
116
|
"nise": "^5.1.4",
|
|
118
|
-
"nyc": "^
|
|
117
|
+
"nyc": "^17.1.0",
|
|
119
118
|
"object-inspect": "1.13.1",
|
|
120
119
|
"path-browserify": "^1.0.1",
|
|
121
120
|
"pathval": "^2.0.0",
|
|
@@ -127,16 +126,17 @@
|
|
|
127
126
|
"rollup-plugin-typescript2": "^0.31.0",
|
|
128
127
|
"set-function-length": "1.2.0",
|
|
129
128
|
"side-channel": "1.0.4",
|
|
130
|
-
"sinon": "^
|
|
129
|
+
"sinon": "^19.0.0",
|
|
131
130
|
"source-map-loader": "^3.0.0",
|
|
132
131
|
"stream-browserify": "^3.0.0",
|
|
133
132
|
"stream-http": "^3.2.0",
|
|
134
133
|
"timers": "^0.1.1",
|
|
135
|
-
"ts-loader": "^9.2
|
|
136
|
-
"ts-node": "^10.
|
|
134
|
+
"ts-loader": "^9.5.2",
|
|
135
|
+
"ts-node": "^10.9.2",
|
|
137
136
|
"tslib": "^2.3.1",
|
|
138
137
|
"type-detect": "^4.0.8",
|
|
139
|
-
"typescript": "
|
|
138
|
+
"typescript": "~5.9.0",
|
|
139
|
+
"typescript-eslint": "^8.56.0",
|
|
140
140
|
"url": "^0.11.3",
|
|
141
141
|
"util": "^0.12.5",
|
|
142
142
|
"webpack": "^5.62.1",
|
|
@@ -147,5 +147,5 @@
|
|
|
147
147
|
"npx eslint --cache --fix --quiet"
|
|
148
148
|
]
|
|
149
149
|
},
|
|
150
|
-
"gitHead": "
|
|
150
|
+
"gitHead": "78deca78391cb155707e09b51e9c20483bcbba57"
|
|
151
151
|
}
|