@microsoft/m365-spec-parser 0.1.0 → 0.1.1-alpha.0de595af8.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 +691 -259
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm2017.mjs +845 -354
- package/dist/index.esm2017.mjs.map +1 -1
- package/dist/index.esm5.js +695 -259
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +859 -361
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/src/constants.d.ts +5 -1
- package/dist/src/index.browser.d.ts +2 -1
- package/dist/src/index.d.ts +2 -1
- package/dist/src/interfaces.d.ts +76 -18
- package/dist/src/manifestUpdater.d.ts +9 -4
- package/dist/src/specFilter.d.ts +2 -1
- package/dist/src/specParser.browser.d.ts +17 -2
- package/dist/src/specParser.d.ts +17 -3
- package/dist/src/utils.d.ts +19 -33
- package/package.json +62 -18
package/dist/src/constants.d.ts
CHANGED
|
@@ -13,7 +13,9 @@ export declare class ConstantString {
|
|
|
13
13
|
static readonly OperationOnlyContainsOptionalParam = "Operation %s contains multiple optional parameters. The first optional parameter is used for this command.";
|
|
14
14
|
static readonly ConvertSwaggerToOpenAPI = "The Swagger 2.0 file has been converted to OpenAPI 3.0.";
|
|
15
15
|
static readonly SwaggerNotSupported = "Swagger 2.0 is not supported. Please convert to OpenAPI 3.0 manually before proceeding.";
|
|
16
|
-
static readonly
|
|
16
|
+
static readonly SpecVersionNotSupported = "Unsupported OpenAPI version %s. Please use version 3.0.x.";
|
|
17
|
+
static readonly MultipleAuthNotSupported = "Multiple authentication methods are unsupported. Ensure all selected APIs use identical authentication.";
|
|
18
|
+
static readonly UnsupportedSchema = "Unsupported schema in %s %s: %s";
|
|
17
19
|
static readonly WrappedCardVersion = "devPreview";
|
|
18
20
|
static readonly WrappedCardSchema = "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.ResponseRenderingTemplate.schema.json";
|
|
19
21
|
static readonly WrappedCardResponseLayout = "list";
|
|
@@ -25,6 +27,7 @@ export declare class ConstantString {
|
|
|
25
27
|
static readonly TextBlockType = "TextBlock";
|
|
26
28
|
static readonly ContainerType = "Container";
|
|
27
29
|
static readonly RegistrationIdPostfix = "REGISTRATION_ID";
|
|
30
|
+
static readonly OAuthRegistrationIdPostFix = "OAUTH_REGISTRATION_ID";
|
|
28
31
|
static readonly ResponseCodeFor20X: string[];
|
|
29
32
|
static readonly AllOperationMethods: string[];
|
|
30
33
|
static readonly WellknownResultNames: string[];
|
|
@@ -37,4 +40,5 @@ export declare class ConstantString {
|
|
|
37
40
|
static readonly ParameterDescriptionMaxLens = 128;
|
|
38
41
|
static readonly CommandTitleMaxLens = 32;
|
|
39
42
|
static readonly ParameterTitleMaxLens = 32;
|
|
43
|
+
static readonly SMERequiredParamsMaxNum = 5;
|
|
40
44
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { SpecParser } from "./specParser.browser";
|
|
2
2
|
export { SpecParserError } from "./specParserError";
|
|
3
3
|
export { ValidationStatus, WarningType, ErrorType, ListAPIResult } from "./interfaces";
|
|
4
|
-
export type { ErrorResult, APIInfo, ValidateResult, WarningResult, ParseOptions, } from "./interfaces";
|
|
4
|
+
export type { ErrorResult, APIInfo, ValidateResult, WarningResult, ParseOptions, AdaptiveCard, ProjectType, } from "./interfaces";
|
|
5
5
|
export { ConstantString } from "./constants";
|
|
6
6
|
export { Utils } from "./utils";
|
|
7
|
+
export { AdaptiveCardGenerator } from "./adaptiveCardGenerator";
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,5 +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, } from "./interfaces";
|
|
3
|
+
export { ValidationStatus, WarningType, ErrorType, WarningResult, ErrorResult, ListAPIResult, APIInfo, ValidateResult, ParseOptions, AdaptiveCard, ProjectType, } from "./interfaces";
|
|
4
4
|
export { ConstantString } from "./constants";
|
|
5
5
|
export { Utils } from "./utils";
|
|
6
|
+
export { AdaptiveCardGenerator } from "./adaptiveCardGenerator";
|
package/dist/src/interfaces.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IParameter } from "@microsoft/teams-manifest";
|
|
1
2
|
import { OpenAPIV3 } from "openapi-types";
|
|
2
3
|
/**
|
|
3
4
|
* An interface that represents the result of validating an OpenAPI specification file.
|
|
@@ -67,7 +68,8 @@ export declare enum ErrorType {
|
|
|
67
68
|
NoExtraAPICanBeAdded = "no-extra-api-can-be-added",
|
|
68
69
|
ResolveServerUrlFailed = "resolve-server-url-failed",
|
|
69
70
|
SwaggerNotSupported = "swagger-not-supported",
|
|
70
|
-
|
|
71
|
+
MultipleAuthNotSupported = "multiple-auth-not-supported",
|
|
72
|
+
SpecVersionNotSupported = "spec-version-not-supported",
|
|
71
73
|
ListFailed = "list-failed",
|
|
72
74
|
listSupportedAPIInfoFailed = "list-supported-api-info-failed",
|
|
73
75
|
FilterSpecFailed = "filter-spec-failed",
|
|
@@ -75,6 +77,22 @@ export declare enum ErrorType {
|
|
|
75
77
|
GenerateAdaptiveCardFailed = "generate-adaptive-card-failed",
|
|
76
78
|
GenerateFailed = "generate-failed",
|
|
77
79
|
ValidateFailed = "validate-failed",
|
|
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",
|
|
78
96
|
Cancelled = "cancelled",
|
|
79
97
|
Unknown = "unknown"
|
|
80
98
|
}
|
|
@@ -134,46 +152,86 @@ export interface WrappedAdaptiveCard {
|
|
|
134
152
|
responseCardTemplate: AdaptiveCard;
|
|
135
153
|
previewCardTemplate: PreviewCardTemplate;
|
|
136
154
|
}
|
|
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
155
|
export interface CheckParamResult {
|
|
150
156
|
requiredNum: number;
|
|
151
157
|
optionalNum: number;
|
|
152
158
|
isValid: boolean;
|
|
159
|
+
reason: ErrorType[];
|
|
153
160
|
}
|
|
154
161
|
export interface ParseOptions {
|
|
162
|
+
/**
|
|
163
|
+
* If true, the parser will not throw an error if an ID is missing the spec file.
|
|
164
|
+
*/
|
|
155
165
|
allowMissingId?: boolean;
|
|
166
|
+
/**
|
|
167
|
+
* If true, the parser will allow parsing of Swagger specifications.
|
|
168
|
+
*/
|
|
156
169
|
allowSwagger?: boolean;
|
|
170
|
+
/**
|
|
171
|
+
* If true, the parser will allow API Key authentication in the spec file.
|
|
172
|
+
*/
|
|
157
173
|
allowAPIKeyAuth?: boolean;
|
|
174
|
+
/**
|
|
175
|
+
* If true, the parser will allow Bearer Token authentication in the spec file.
|
|
176
|
+
*/
|
|
177
|
+
allowBearerTokenAuth?: boolean;
|
|
178
|
+
/**
|
|
179
|
+
* If true, the parser will allow multiple parameters in the spec file. Teams AI project would ignore this parameters and always true
|
|
180
|
+
*/
|
|
158
181
|
allowMultipleParameters?: boolean;
|
|
182
|
+
/**
|
|
183
|
+
* If true, the parser will allow OAuth2 authentication in the spec file. Currently only support OAuth2 with auth code flow.
|
|
184
|
+
*/
|
|
159
185
|
allowOauth2?: boolean;
|
|
186
|
+
/**
|
|
187
|
+
* An array of HTTP methods that the parser will allow in the spec file.
|
|
188
|
+
*/
|
|
189
|
+
allowMethods?: string[];
|
|
190
|
+
/**
|
|
191
|
+
* The type of project that the parser is being used for.
|
|
192
|
+
* Project can be SME/Copilot/TeamsAi
|
|
193
|
+
*/
|
|
194
|
+
projectType?: ProjectType;
|
|
195
|
+
}
|
|
196
|
+
export declare enum ProjectType {
|
|
197
|
+
Copilot = 0,
|
|
198
|
+
SME = 1,
|
|
199
|
+
TeamsAi = 2
|
|
160
200
|
}
|
|
161
201
|
export interface APIInfo {
|
|
162
202
|
method: string;
|
|
163
203
|
path: string;
|
|
164
204
|
title: string;
|
|
165
205
|
id: string;
|
|
166
|
-
parameters:
|
|
206
|
+
parameters: IParameter[];
|
|
167
207
|
description: string;
|
|
168
208
|
warning?: WarningResult;
|
|
169
209
|
}
|
|
170
|
-
export interface
|
|
210
|
+
export interface ListAPIInfo {
|
|
171
211
|
api: string;
|
|
172
212
|
server: string;
|
|
173
213
|
operationId: string;
|
|
174
|
-
|
|
214
|
+
isValid: boolean;
|
|
215
|
+
reason: ErrorType[];
|
|
216
|
+
auth?: AuthInfo;
|
|
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
|
+
}
|
|
229
|
+
export interface ListAPIResult {
|
|
230
|
+
allAPICount: number;
|
|
231
|
+
validAPICount: number;
|
|
232
|
+
APIs: ListAPIInfo[];
|
|
175
233
|
}
|
|
176
|
-
export interface
|
|
177
|
-
|
|
234
|
+
export interface AuthInfo {
|
|
235
|
+
authScheme: OpenAPIV3.SecuritySchemeObject;
|
|
178
236
|
name: string;
|
|
179
237
|
}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { OpenAPIV3 } from "openapi-types";
|
|
2
|
-
import { WarningResult } from "./interfaces";
|
|
3
|
-
import { IMessagingExtensionCommand, TeamsAppManifest } from "@microsoft/teams-manifest";
|
|
2
|
+
import { AuthInfo, ParseOptions, WarningResult } from "./interfaces";
|
|
3
|
+
import { IMessagingExtensionCommand, TeamsAppManifest, PluginManifestSchema, FunctionParameter } from "@microsoft/teams-manifest";
|
|
4
4
|
export declare class ManifestUpdater {
|
|
5
|
-
static
|
|
6
|
-
static
|
|
5
|
+
static updateManifestWithAiPlugin(manifestPath: string, outputSpecPath: string, apiPluginFilePath: string, spec: OpenAPIV3.Document, options: ParseOptions): Promise<[TeamsAppManifest, PluginManifestSchema]>;
|
|
6
|
+
static updateManifestDescription(manifest: TeamsAppManifest, spec: OpenAPIV3.Document): void;
|
|
7
|
+
static mapOpenAPISchemaToFuncParam(schema: OpenAPIV3.SchemaObject, method: string, pathUrl: string): FunctionParameter;
|
|
8
|
+
static generatePluginManifestSchema(spec: OpenAPIV3.Document, specRelativePath: string, appName: string, options: ParseOptions): PluginManifestSchema;
|
|
9
|
+
static updateManifest(manifestPath: string, outputSpecPath: string, spec: OpenAPIV3.Document, options: ParseOptions, adaptiveCardFolder?: string, authInfo?: AuthInfo): Promise<[TeamsAppManifest, WarningResult[]]>;
|
|
10
|
+
static generateCommands(spec: OpenAPIV3.Document, manifestPath: string, options: ParseOptions, adaptiveCardFolder?: string): Promise<[IMessagingExtensionCommand[], WarningResult[]]>;
|
|
7
11
|
static getRelativePath(from: string, to: string): string;
|
|
12
|
+
static removeEnvs(str: string): string;
|
|
8
13
|
}
|
package/dist/src/specFilter.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OpenAPIV3 } from "openapi-types";
|
|
2
|
+
import { ParseOptions } from "./interfaces";
|
|
2
3
|
export declare class SpecFilter {
|
|
3
|
-
static specFilter(filter: string[], unResolveSpec: OpenAPIV3.Document, resolvedSpec: OpenAPIV3.Document,
|
|
4
|
+
static specFilter(filter: string[], unResolveSpec: OpenAPIV3.Document, resolvedSpec: OpenAPIV3.Document, options: ParseOptions): OpenAPIV3.Document;
|
|
4
5
|
}
|
|
@@ -32,14 +32,29 @@ export declare class SpecParser {
|
|
|
32
32
|
* according to copilot plugin spec, only list get and post method without auth
|
|
33
33
|
*/
|
|
34
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>;
|
|
35
48
|
/**
|
|
36
49
|
* Generates and update artifacts from the OpenAPI specification file. Generate Adaptive Cards, update Teams app manifest, and generate a new OpenAPI specification file.
|
|
37
50
|
* @param manifestPath A file path of the Teams app manifest file to update.
|
|
38
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.
|
|
39
52
|
* @param outputSpecPath File path of the new OpenAPI specification file to generate. If not specified or empty, no spec file will be generated.
|
|
40
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.
|
|
41
55
|
*/
|
|
42
|
-
generate(manifestPath: string, filter: string[], outputSpecPath: string, adaptiveCardFolder
|
|
56
|
+
generate(manifestPath: string, filter: string[], outputSpecPath: string, adaptiveCardFolder?: string, signal?: AbortSignal): Promise<GenerateResult>;
|
|
43
57
|
private loadSpec;
|
|
44
|
-
private
|
|
58
|
+
private getAPIs;
|
|
59
|
+
private listAPIs;
|
|
45
60
|
}
|
package/dist/src/specParser.d.ts
CHANGED
|
@@ -31,7 +31,20 @@ export declare class SpecParser {
|
|
|
31
31
|
* @returns A string array that represents the HTTP method and path of each operation, such as ['GET /pets/{petId}', 'GET /user/{userId}']
|
|
32
32
|
* according to copilot plugin spec, only list get and post method without auth
|
|
33
33
|
*/
|
|
34
|
-
list(): Promise<ListAPIResult
|
|
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>;
|
|
35
48
|
/**
|
|
36
49
|
* Generates and update artifacts from the OpenAPI specification file. Generate Adaptive Cards, update Teams app manifest, and generate a new OpenAPI specification file.
|
|
37
50
|
* @param manifestPath A file path of the Teams app manifest file to update.
|
|
@@ -39,7 +52,8 @@ export declare class SpecParser {
|
|
|
39
52
|
* @param outputSpecPath File path of the new OpenAPI specification file to generate. If not specified or empty, no spec file will be generated.
|
|
40
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.
|
|
41
54
|
*/
|
|
42
|
-
generate(manifestPath: string, filter: string[], outputSpecPath: string, adaptiveCardFolder
|
|
55
|
+
generate(manifestPath: string, filter: string[], outputSpecPath: string, adaptiveCardFolder?: string, signal?: AbortSignal): Promise<GenerateResult>;
|
|
43
56
|
private loadSpec;
|
|
44
|
-
private
|
|
57
|
+
private getAPIs;
|
|
58
|
+
private listAPIs;
|
|
45
59
|
}
|
package/dist/src/utils.d.ts
CHANGED
|
@@ -1,44 +1,30 @@
|
|
|
1
1
|
import { OpenAPIV3 } from "openapi-types";
|
|
2
2
|
import SwaggerParser from "@apidevtools/swagger-parser";
|
|
3
|
-
import {
|
|
4
|
-
import { IMessagingExtensionCommand } from "@microsoft/teams-manifest";
|
|
3
|
+
import { APIMap, AuthInfo, ErrorResult, ParseOptions, ValidateResult } from "./interfaces";
|
|
4
|
+
import { IMessagingExtensionCommand, IParameter } from "@microsoft/teams-manifest";
|
|
5
5
|
export declare class Utils {
|
|
6
|
-
static
|
|
7
|
-
static
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
* @param {OpenAPIV3.Document} spec - The OpenAPI specification document.
|
|
13
|
-
* @returns {boolean} - Returns true if the API is supported, false otherwise.
|
|
14
|
-
* @description The following APIs are supported:
|
|
15
|
-
* 1. only support Get/Post operation without auth property
|
|
16
|
-
* 2. parameter inside query or path only support string, number, boolean and integer
|
|
17
|
-
* 3. parameter inside post body only support string, number, boolean, integer and object
|
|
18
|
-
* 4. request body + required parameters <= 1
|
|
19
|
-
* 5. response body should be “application/json” and not empty, and response code should be 20X
|
|
20
|
-
* 6. only support request body with “application/json” content type
|
|
21
|
-
*/
|
|
22
|
-
static isSupportedApi(method: string, path: string, spec: OpenAPIV3.Document, allowMissingId: boolean, allowAPIKeyAuth: boolean, allowMultipleParameters: boolean, allowOauth2: boolean): boolean;
|
|
23
|
-
static isSupportedAuth(authSchemaArray: AuthSchema[][], allowAPIKeyAuth: boolean, allowOauth2: boolean): boolean;
|
|
24
|
-
static isAPIKeyAuth(authSchema: OpenAPIV3.SecuritySchemeObject): boolean;
|
|
25
|
-
static isBearerTokenAuth(authSchema: OpenAPIV3.SecuritySchemeObject): boolean;
|
|
26
|
-
static getAuthArray(securities: OpenAPIV3.SecurityRequirementObject[] | undefined, spec: OpenAPIV3.Document): AuthSchema[][];
|
|
6
|
+
static hasNestedObjectInSchema(schema: OpenAPIV3.SchemaObject): boolean;
|
|
7
|
+
static containMultipleMediaTypes(bodyObject: OpenAPIV3.RequestBodyObject | OpenAPIV3.ResponseObject): boolean;
|
|
8
|
+
static isBearerTokenAuth(authScheme: OpenAPIV3.SecuritySchemeObject): boolean;
|
|
9
|
+
static isAPIKeyAuth(authScheme: OpenAPIV3.SecuritySchemeObject): boolean;
|
|
10
|
+
static isOAuthWithAuthCodeFlow(authScheme: OpenAPIV3.SecuritySchemeObject): boolean;
|
|
11
|
+
static getAuthArray(securities: OpenAPIV3.SecurityRequirementObject[] | undefined, spec: OpenAPIV3.Document): AuthInfo[][];
|
|
27
12
|
static updateFirstLetter(str: string): string;
|
|
28
|
-
static getResponseJson(operationObject: OpenAPIV3.OperationObject | undefined):
|
|
13
|
+
static getResponseJson(operationObject: OpenAPIV3.OperationObject | undefined): {
|
|
14
|
+
json: OpenAPIV3.MediaTypeObject;
|
|
15
|
+
multipleMediaType: boolean;
|
|
16
|
+
};
|
|
29
17
|
static convertPathToCamelCase(path: string): string;
|
|
30
18
|
static getUrlProtocol(urlString: string): string | undefined;
|
|
31
|
-
static
|
|
19
|
+
static resolveEnv(str: string): string;
|
|
32
20
|
static checkServerUrl(servers: OpenAPIV3.ServerObject[]): ErrorResult[];
|
|
33
|
-
static validateServer(spec: OpenAPIV3.Document,
|
|
21
|
+
static validateServer(spec: OpenAPIV3.Document, options: ParseOptions): ErrorResult[];
|
|
34
22
|
static isWellKnownName(name: string, wellknownNameList: string[]): boolean;
|
|
35
|
-
static generateParametersFromSchema(schema: OpenAPIV3.SchemaObject, name: string, allowMultipleParameters: boolean, isRequired?: boolean): [
|
|
36
|
-
static updateParameterWithInputType(schema: OpenAPIV3.SchemaObject, param:
|
|
37
|
-
static parseApiInfo(operationItem: OpenAPIV3.OperationObject,
|
|
38
|
-
static
|
|
39
|
-
[key: string]: OpenAPIV3.OperationObject;
|
|
40
|
-
};
|
|
41
|
-
static validateSpec(spec: OpenAPIV3.Document, parser: SwaggerParser, isSwaggerFile: boolean, allowMissingId: boolean, allowAPIKeyAuth: boolean, allowMultipleParameters: boolean, allowOauth2: boolean): ValidateResult;
|
|
23
|
+
static generateParametersFromSchema(schema: OpenAPIV3.SchemaObject, name: string, allowMultipleParameters: boolean, isRequired?: boolean): [IParameter[], IParameter[]];
|
|
24
|
+
static updateParameterWithInputType(schema: OpenAPIV3.SchemaObject, param: IParameter): void;
|
|
25
|
+
static parseApiInfo(operationItem: OpenAPIV3.OperationObject, options: ParseOptions): IMessagingExtensionCommand;
|
|
26
|
+
static validateSpec(spec: OpenAPIV3.Document, parser: SwaggerParser, apiMap: APIMap, isSwaggerFile: boolean, options: ParseOptions): ValidateResult;
|
|
42
27
|
static format(str: string, ...args: string[]): string;
|
|
43
28
|
static getSafeRegistrationIdEnvName(authName: string): string;
|
|
29
|
+
static getAllAPICount(spec: OpenAPIV3.Document): number;
|
|
44
30
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/m365-spec-parser",
|
|
3
|
-
"version": "0.1.0",
|
|
3
|
+
"version": "0.1.1-alpha.0de595af8.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",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"types": "dist/src/index.d.ts",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "rollup -c",
|
|
12
|
-
"test:unit:node": "nyc --no-clean -- mocha
|
|
12
|
+
"test:unit:node": "nyc --no-clean -- mocha -r config/mocha.env.ts --config config/.mocharc.json",
|
|
13
13
|
"test:unit:browser": "karma start karma.conf.cjs --single-run --unit",
|
|
14
14
|
"test:unit": "npm run test:unit:node && npm run test:unit:browser ",
|
|
15
15
|
"lint:staged": "lint-staged",
|
|
@@ -39,42 +39,67 @@
|
|
|
39
39
|
"sideEffects": false,
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@apidevtools/swagger-parser": "^10.1.0",
|
|
42
|
-
"@microsoft/teams-manifest": "
|
|
43
|
-
"@types/webpack": "^5.28.5",
|
|
44
|
-
"c8": "^9.1.0",
|
|
45
|
-
"dotenv": "^16.4.1",
|
|
42
|
+
"@microsoft/teams-manifest": "0.1.4-alpha.0de595af8.0",
|
|
46
43
|
"fs-extra": "^11.2.0",
|
|
47
|
-
"http": "^0.0.1-security",
|
|
48
|
-
"https-browserify": "^1.0.0",
|
|
49
44
|
"js-yaml": "^4.1.0",
|
|
50
45
|
"openapi-types": "^7.2.3",
|
|
51
|
-
"
|
|
52
|
-
"stream-browserify": "^3.0.0",
|
|
53
|
-
"stream-http": "^3.2.0",
|
|
54
|
-
"swagger2openapi": "^7.0.8",
|
|
55
|
-
"url": "^0.11.3",
|
|
56
|
-
"webpack": "^5.90.0"
|
|
46
|
+
"swagger2openapi": "^7.0.8"
|
|
57
47
|
},
|
|
58
48
|
"publishConfig": {
|
|
59
49
|
"access": "public"
|
|
60
50
|
},
|
|
61
51
|
"devDependencies": {
|
|
52
|
+
"@apidevtools/json-schema-ref-parser": "^9.0.6",
|
|
53
|
+
"@apidevtools/openapi-schemas": "2.1.0",
|
|
54
|
+
"@apidevtools/swagger-methods": "3.0.2",
|
|
62
55
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
|
56
|
+
"@jsdevtools/ono": "^7.1.3",
|
|
63
57
|
"@rollup/plugin-json": "^6.1.0",
|
|
58
|
+
"@sinonjs/commons": "^3.0.0",
|
|
59
|
+
"@sinonjs/fake-timers": "^11.1.0",
|
|
60
|
+
"@sinonjs/samsam": "^8.0.0",
|
|
64
61
|
"@types/chai": "^4.2.22",
|
|
65
62
|
"@types/fs-extra": "^11.0.4",
|
|
66
63
|
"@types/js-yaml": "^4.0.9",
|
|
67
64
|
"@types/mocha": "^9.0.0",
|
|
68
|
-
"@types/
|
|
65
|
+
"@types/node": "^16.11.7",
|
|
66
|
+
"@types/sinon": "^10.0.6",
|
|
69
67
|
"@types/swagger2openapi": "^7.0.4",
|
|
70
68
|
"@typescript-eslint/eslint-plugin": "^4.19.0",
|
|
71
69
|
"@typescript-eslint/parser": "^4.19.0",
|
|
70
|
+
"ajv-draft-04": "1.0.0",
|
|
71
|
+
"assertion-error": "^2.0.0",
|
|
72
|
+
"available-typed-arrays": "1.0.6",
|
|
73
|
+
"browser-stdout": "1.3.1",
|
|
74
|
+
"call-bind": "1.0.6",
|
|
75
|
+
"call-me-maybe": "^1.0.2",
|
|
72
76
|
"chai": "^4.3.4",
|
|
73
|
-
"
|
|
77
|
+
"check-error": "1.0.3",
|
|
78
|
+
"deep-eql": "3.0.1",
|
|
79
|
+
"define-data-property": "1.1.2",
|
|
80
|
+
"dotenv": "^16.4.1",
|
|
81
|
+
"es-errors": "1.3.0",
|
|
82
|
+
"eslint": "^7.29.0",
|
|
74
83
|
"eslint-plugin-header": "^3.1.1",
|
|
75
84
|
"eslint-plugin-import": "^2.25.2",
|
|
76
85
|
"eslint-plugin-no-secrets": "^0.8.9",
|
|
77
86
|
"eslint-plugin-prettier": "^4.0.0",
|
|
87
|
+
"events": "3.3.0",
|
|
88
|
+
"for-each": "0.3.3",
|
|
89
|
+
"get-func-name": "2.0.2",
|
|
90
|
+
"get-intrinsic": "1.2.4",
|
|
91
|
+
"gopd": "1.0.1",
|
|
92
|
+
"has-property-descriptors": "1.0.1",
|
|
93
|
+
"has-proto": "1.0.1",
|
|
94
|
+
"has-symbols": "1.0.3",
|
|
95
|
+
"has-tostringtag": "1.0.2",
|
|
96
|
+
"he": "1.2.0",
|
|
97
|
+
"http": "^0.0.1-security",
|
|
98
|
+
"https-browserify": "^1.0.0",
|
|
99
|
+
"is-arguments": "1.1.1",
|
|
100
|
+
"is-callable": "1.2.7",
|
|
101
|
+
"is-generator-function": "1.0.10",
|
|
102
|
+
"is-typed-array": "1.1.13",
|
|
78
103
|
"karma": "^6.3.8",
|
|
79
104
|
"karma-chrome-launcher": "^3.1.0",
|
|
80
105
|
"karma-cli": "^2.0.0",
|
|
@@ -86,23 +111,42 @@
|
|
|
86
111
|
"karma-sourcemap-loader": "^0.3.8",
|
|
87
112
|
"karma-webpack": "^5.0.0",
|
|
88
113
|
"lint-staged": "^10.5.4",
|
|
114
|
+
"lodash.get": "^4.4.2",
|
|
89
115
|
"mocha": "^9.2.0",
|
|
90
116
|
"mock-fs": "^5.2.0",
|
|
91
117
|
"mocked-env": "^1.3.5",
|
|
118
|
+
"nanoid": "3.2.0",
|
|
119
|
+
"nise": "^5.1.4",
|
|
120
|
+
"nyc": "^15.1.0",
|
|
121
|
+
"object-inspect": "1.13.1",
|
|
122
|
+
"pathval": "^2.0.0",
|
|
92
123
|
"prettier": "^2.4.1",
|
|
124
|
+
"process": "^0.11.10",
|
|
93
125
|
"puppeteer": "^13.1.3",
|
|
126
|
+
"qs": "6.11.0",
|
|
94
127
|
"rollup": "^2.41.0",
|
|
95
128
|
"rollup-plugin-typescript2": "^0.31.0",
|
|
129
|
+
"set-function-length": "1.2.0",
|
|
130
|
+
"side-channel": "1.0.4",
|
|
96
131
|
"sinon": "^12.0.1",
|
|
97
132
|
"source-map-loader": "^3.0.0",
|
|
133
|
+
"stream-browserify": "^3.0.0",
|
|
134
|
+
"stream-http": "^3.2.0",
|
|
135
|
+
"timers": "^0.1.1",
|
|
98
136
|
"ts-loader": "^9.2.6",
|
|
99
137
|
"ts-node": "^10.4.0",
|
|
138
|
+
"tslib": "^2.3.1",
|
|
139
|
+
"type-detect": "^4.0.8",
|
|
100
140
|
"typescript": "^4.4.4",
|
|
101
|
-
"
|
|
141
|
+
"url": "^0.11.3",
|
|
142
|
+
"util": "^0.12.5",
|
|
143
|
+
"webpack": "^5.62.1",
|
|
144
|
+
"which-typed-array": "1.1.14"
|
|
102
145
|
},
|
|
103
146
|
"lint-staged": {
|
|
104
147
|
"*.{js,jsx,css,ts,tsx}": [
|
|
105
148
|
"npx eslint --cache --fix --quiet"
|
|
106
149
|
]
|
|
107
|
-
}
|
|
150
|
+
},
|
|
151
|
+
"gitHead": "082298934771fd7596d65a0e9f9fb4e38cf58fcb"
|
|
108
152
|
}
|