@microsoft/m365-spec-parser 0.1.1-alpha.cf377d39f.0 → 0.1.1-alpha.ded43fb2d.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.
@@ -1,5 +1,7 @@
1
+ import { ResponseSemanticsObject } from "@microsoft/teams-manifest";
1
2
  import { AdaptiveCard, PreviewCardTemplate, WrappedAdaptiveCard } from "./interfaces";
2
3
  export declare function wrapAdaptiveCard(card: AdaptiveCard, jsonPath: string): WrappedAdaptiveCard;
4
+ export declare function wrapResponseSemantics(card: AdaptiveCard, jsonPath: string): ResponseSemanticsObject;
3
5
  /**
4
6
  * Infers the preview card template from an Adaptive Card and a JSON path.
5
7
  * The preview card template includes a title and an optional subtitle and image.
@@ -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 MultipleAPIKeyNotSupported = "Multiple API keys are not supported. Please make sure that all selected APIs use the same API key.";
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";
@@ -23,8 +25,10 @@ export declare class ConstantString {
23
25
  static readonly AdaptiveCardSchema = "http://adaptivecards.io/schemas/adaptive-card.json";
24
26
  static readonly AdaptiveCardType = "AdaptiveCard";
25
27
  static readonly TextBlockType = "TextBlock";
28
+ static readonly ImageType = "Image";
26
29
  static readonly ContainerType = "Container";
27
30
  static readonly RegistrationIdPostfix = "REGISTRATION_ID";
31
+ static readonly OAuthRegistrationIdPostFix = "OAUTH_REGISTRATION_ID";
28
32
  static readonly ResponseCodeFor20X: string[];
29
33
  static readonly AllOperationMethods: string[];
30
34
  static readonly WellknownResultNames: string[];
@@ -37,4 +41,6 @@ export declare class ConstantString {
37
41
  static readonly ParameterDescriptionMaxLens = 128;
38
42
  static readonly CommandTitleMaxLens = 32;
39
43
  static readonly ParameterTitleMaxLens = 32;
44
+ static readonly SMERequiredParamsMaxNum = 5;
45
+ static readonly DefaultPluginId = "plugin_1";
40
46
  }
@@ -1,7 +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, AdaptiveCard, } 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
7
  export { AdaptiveCardGenerator } from "./adaptiveCardGenerator";
@@ -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, } 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";
@@ -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.
@@ -16,6 +17,16 @@ export interface ValidateResult {
16
17
  */
17
18
  errors: ErrorResult[];
18
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
+ }
19
30
  /**
20
31
  * An interface that represents a warning result generated during validation.
21
32
  */
@@ -67,7 +78,8 @@ export declare enum ErrorType {
67
78
  NoExtraAPICanBeAdded = "no-extra-api-can-be-added",
68
79
  ResolveServerUrlFailed = "resolve-server-url-failed",
69
80
  SwaggerNotSupported = "swagger-not-supported",
70
- MultipleAPIKeyNotSupported = "multiple-api-key-not-supported",
81
+ MultipleAuthNotSupported = "multiple-auth-not-supported",
82
+ SpecVersionNotSupported = "spec-version-not-supported",
71
83
  ListFailed = "list-failed",
72
84
  listSupportedAPIInfoFailed = "list-supported-api-info-failed",
73
85
  FilterSpecFailed = "filter-spec-failed",
@@ -76,6 +88,21 @@ export declare enum ErrorType {
76
88
  GenerateFailed = "generate-failed",
77
89
  ValidateFailed = "validate-failed",
78
90
  GetSpecFailed = "get-spec-failed",
91
+ AuthTypeIsNotSupported = "auth-type-is-not-supported",
92
+ MissingOperationId = "missing-operation-id",
93
+ PostBodyContainMultipleMediaTypes = "post-body-contain-multiple-media-types",
94
+ ResponseContainMultipleMediaTypes = "response-contain-multiple-media-types",
95
+ ResponseJsonIsEmpty = "response-json-is-empty",
96
+ PostBodySchemaIsNotJson = "post-body-schema-is-not-json",
97
+ PostBodyContainsRequiredUnsupportedSchema = "post-body-contains-required-unsupported-schema",
98
+ ParamsContainRequiredUnsupportedSchema = "params-contain-required-unsupported-schema",
99
+ ParamsContainsNestedObject = "params-contains-nested-object",
100
+ RequestBodyContainsNestedObject = "request-body-contains-nested-object",
101
+ ExceededRequiredParamsLimit = "exceeded-required-params-limit",
102
+ NoParameter = "no-parameter",
103
+ NoAPIInfo = "no-api-info",
104
+ MethodNotAllowed = "method-not-allowed",
105
+ UrlPathNotExist = "url-path-not-exist",
79
106
  Cancelled = "cancelled",
80
107
  Unknown = "unknown"
81
108
  }
@@ -135,46 +162,107 @@ export interface WrappedAdaptiveCard {
135
162
  responseCardTemplate: AdaptiveCard;
136
163
  previewCardTemplate: PreviewCardTemplate;
137
164
  }
138
- export interface ChoicesItem {
139
- title: string;
140
- value: string;
141
- }
142
- export interface Parameter {
143
- name: string;
144
- title: string;
145
- description: string;
146
- inputType?: "text" | "textarea" | "number" | "date" | "time" | "toggle" | "choiceset";
147
- value?: string;
148
- choices?: ChoicesItem[];
149
- }
150
165
  export interface CheckParamResult {
151
166
  requiredNum: number;
152
167
  optionalNum: number;
153
168
  isValid: boolean;
169
+ reason: ErrorType[];
154
170
  }
155
171
  export interface ParseOptions {
172
+ /**
173
+ * If true, the parser will not throw an error if an ID is missing the spec file.
174
+ */
156
175
  allowMissingId?: boolean;
176
+ /**
177
+ * If true, the parser will allow parsing of Swagger specifications.
178
+ */
157
179
  allowSwagger?: boolean;
180
+ /**
181
+ * If true, the parser will allow API Key authentication in the spec file.
182
+ */
158
183
  allowAPIKeyAuth?: boolean;
184
+ /**
185
+ * If true, the parser will allow Bearer Token authentication in the spec file.
186
+ */
187
+ allowBearerTokenAuth?: boolean;
188
+ /**
189
+ * If true, the parser will allow multiple parameters in the spec file. Teams AI project would ignore this parameters and always true
190
+ */
159
191
  allowMultipleParameters?: boolean;
192
+ /**
193
+ * If true, the parser will allow OAuth2 authentication in the spec file. Currently only support OAuth2 with auth code flow.
194
+ */
160
195
  allowOauth2?: boolean;
196
+ /**
197
+ * An array of HTTP methods that the parser will allow in the spec file.
198
+ */
199
+ allowMethods?: string[];
200
+ /**
201
+ * If true, the parser will allow conversation starters in plugin file. Only take effect in Copilot project
202
+ */
203
+ allowConversationStarters?: boolean;
204
+ /**
205
+ * If true, the parser will allow response semantics in plugin file. Only take effect in Copilot project
206
+ */
207
+ allowResponseSemantics?: boolean;
208
+ /**
209
+ * If true, the paser will allow confirmation in plugin file. Only take effect in Copilot project
210
+ */
211
+ allowConfirmation?: boolean;
212
+ /**
213
+ * The type of project that the parser is being used for.
214
+ * Project can be SME/Copilot/TeamsAi
215
+ */
216
+ projectType?: ProjectType;
217
+ }
218
+ export declare enum ProjectType {
219
+ Copilot = 0,
220
+ SME = 1,
221
+ TeamsAi = 2
161
222
  }
162
223
  export interface APIInfo {
163
224
  method: string;
164
225
  path: string;
165
226
  title: string;
166
227
  id: string;
167
- parameters: Parameter[];
228
+ parameters: IParameter[];
168
229
  description: string;
169
230
  warning?: WarningResult;
170
231
  }
171
- export interface ListAPIResult {
232
+ export interface ListAPIInfo {
172
233
  api: string;
173
234
  server: string;
174
235
  operationId: string;
175
- auth?: OpenAPIV3.SecuritySchemeObject;
236
+ isValid: boolean;
237
+ reason: ErrorType[];
238
+ auth?: AuthInfo;
239
+ }
240
+ export interface APIMap {
241
+ [key: string]: {
242
+ operation: OpenAPIV3.OperationObject;
243
+ isValid: boolean;
244
+ reason: ErrorType[];
245
+ };
246
+ }
247
+ export interface APIValidationResult {
248
+ isValid: boolean;
249
+ reason: ErrorType[];
176
250
  }
177
- export interface AuthSchema {
178
- authSchema: OpenAPIV3.SecuritySchemeObject;
251
+ export interface ListAPIResult {
252
+ allAPICount: number;
253
+ validAPICount: number;
254
+ APIs: ListAPIInfo[];
255
+ }
256
+ export interface AuthInfo {
257
+ authScheme: OpenAPIV3.SecuritySchemeObject;
179
258
  name: string;
180
259
  }
260
+ export interface InvalidAPIInfo {
261
+ api: string;
262
+ reason: ErrorType[];
263
+ }
264
+ export interface InferredProperties {
265
+ title?: string;
266
+ subtitle?: string;
267
+ imageUrl?: string;
268
+ }
@@ -1,8 +1,15 @@
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 updateManifest(manifestPath: string, outputSpecPath: string, adaptiveCardFolder: string, spec: OpenAPIV3.Document, allowMultipleParameters: boolean, auth?: OpenAPIV3.SecuritySchemeObject, isMe?: boolean): Promise<[TeamsAppManifest, WarningResult[]]>;
6
- static generateCommands(spec: OpenAPIV3.Document, adaptiveCardFolder: string, manifestPath: string, allowMultipleParameters: boolean): Promise<[IMessagingExtensionCommand[], WarningResult[]]>;
5
+ static updateManifestWithAiPlugin(manifestPath: string, outputSpecPath: string, apiPluginFilePath: string, spec: OpenAPIV3.Document, options: ParseOptions, authInfo?: AuthInfo): 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, apiPluginFilePath: string, appName: string, authInfo: AuthInfo | undefined, options: ParseOptions): Promise<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;
13
+ static removeAllSpecialCharacters(str: string): string;
14
+ static getConfirmationBodyItem(paramName: string): string;
8
15
  }
@@ -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, allowMissingId: boolean, allowAPIKeyAuth: boolean, allowMultipleParameters: boolean, allowOauth2: boolean): OpenAPIV3.Document;
4
+ static specFilter(filter: string[], unResolveSpec: OpenAPIV3.Document, resolvedSpec: OpenAPIV3.Document, options: ParseOptions): OpenAPIV3.Document;
4
5
  }
@@ -8,8 +8,8 @@ export declare class SpecParser {
8
8
  readonly pathOrSpec: string | OpenAPIV3.Document;
9
9
  readonly parser: SwaggerParser;
10
10
  readonly options: Required<ParseOptions>;
11
- private apiMap;
12
11
  private spec;
12
+ private validator;
13
13
  private unResolveSpec;
14
14
  private isSwaggerFile;
15
15
  private defaultOptions;
@@ -37,6 +37,14 @@ export declare class SpecParser {
37
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
38
  */
39
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>;
40
48
  /**
41
49
  * Generates and update artifacts from the OpenAPI specification file. Generate Adaptive Cards, update Teams app manifest, and generate a new OpenAPI specification file.
42
50
  * @param manifestPath A file path of the Teams app manifest file to update.
@@ -45,7 +53,8 @@ export declare class SpecParser {
45
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.
46
54
  * @param isMe Boolean that indicates whether the project is an Messaging Extension. For Messaging Extension, composeExtensions will be added in Teams app manifest.
47
55
  */
48
- generate(manifestPath: string, filter: string[], outputSpecPath: string, adaptiveCardFolder: string, signal?: AbortSignal, isMe?: boolean): Promise<GenerateResult>;
56
+ generate(manifestPath: string, filter: string[], outputSpecPath: string, adaptiveCardFolder?: string, signal?: AbortSignal): Promise<GenerateResult>;
49
57
  private loadSpec;
50
- private getAllSupportedAPIs;
58
+ private getAPIs;
59
+ private getValidator;
51
60
  }
@@ -8,7 +8,7 @@ export declare class SpecParser {
8
8
  readonly pathOrSpec: string | OpenAPIV3.Document;
9
9
  readonly parser: SwaggerParser;
10
10
  readonly options: Required<ParseOptions>;
11
- private apiMap;
11
+ private validator;
12
12
  private spec;
13
13
  private unResolveSpec;
14
14
  private isSwaggerFile;
@@ -31,21 +31,30 @@ 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
35
  /**
36
36
  * Generate specs according to the filters.
37
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
38
  */
39
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>;
40
48
  /**
41
49
  * Generates and update artifacts from the OpenAPI specification file. Generate Adaptive Cards, update Teams app manifest, and generate a new OpenAPI specification file.
42
50
  * @param manifestPath A file path of the Teams app manifest file to update.
43
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.
44
52
  * @param outputSpecPath File path of the new OpenAPI specification file to generate. If not specified or empty, no spec file will be generated.
45
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.
46
- * @param isMe Boolean that indicates whether the project is an Messaging Extension. For Messaging Extension, composeExtensions will be added in Teams app manifest.
47
54
  */
48
- generate(manifestPath: string, filter: string[], outputSpecPath: string, adaptiveCardFolder: string, signal?: AbortSignal, isMe?: boolean): Promise<GenerateResult>;
55
+ generate(manifestPath: string, filter: string[], outputSpecPath: string, adaptiveCardFolder?: string, signal?: AbortSignal): Promise<GenerateResult>;
49
56
  private loadSpec;
50
- private getAllSupportedAPIs;
57
+ private getAPIs;
58
+ private getValidator;
59
+ private saveFilterSpec;
51
60
  }
@@ -1,44 +1,29 @@
1
1
  import { OpenAPIV3 } from "openapi-types";
2
- import SwaggerParser from "@apidevtools/swagger-parser";
3
- import { AuthSchema, CheckParamResult, ErrorResult, Parameter, ValidateResult, WarningResult } from "./interfaces";
4
- import { IMessagingExtensionCommand } from "@microsoft/teams-manifest";
2
+ import { AuthInfo, ErrorResult, ParseOptions } from "./interfaces";
3
+ import { IMessagingExtensionCommand, IParameter } from "@microsoft/teams-manifest";
5
4
  export declare class Utils {
6
- static checkParameters(paramObject: OpenAPIV3.ParameterObject[]): CheckParamResult;
7
- static checkPostBody(schema: OpenAPIV3.SchemaObject, isRequired?: boolean): CheckParamResult;
8
- /**
9
- * Checks if the given API is supported.
10
- * @param {string} method - The HTTP method of the API.
11
- * @param {string} path - The path of the API.
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[][];
5
+ static hasNestedObjectInSchema(schema: OpenAPIV3.SchemaObject): boolean;
6
+ static containMultipleMediaTypes(bodyObject: OpenAPIV3.RequestBodyObject | OpenAPIV3.ResponseObject): boolean;
7
+ static isBearerTokenAuth(authScheme: OpenAPIV3.SecuritySchemeObject): boolean;
8
+ static isAPIKeyAuth(authScheme: OpenAPIV3.SecuritySchemeObject): boolean;
9
+ static isOAuthWithAuthCodeFlow(authScheme: OpenAPIV3.SecuritySchemeObject): boolean;
10
+ static getAuthArray(securities: OpenAPIV3.SecurityRequirementObject[] | undefined, spec: OpenAPIV3.Document): AuthInfo[][];
11
+ static getAuthInfo(spec: OpenAPIV3.Document): AuthInfo | undefined;
27
12
  static updateFirstLetter(str: string): string;
28
- static getResponseJson(operationObject: OpenAPIV3.OperationObject | undefined): OpenAPIV3.MediaTypeObject;
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 resolveServerUrl(url: string): string;
19
+ static resolveEnv(str: string): string;
32
20
  static checkServerUrl(servers: OpenAPIV3.ServerObject[]): ErrorResult[];
33
- static validateServer(spec: OpenAPIV3.Document, allowMissingId: boolean, allowAPIKeyAuth: boolean, allowMultipleParameters: boolean, allowOauth2: boolean): ErrorResult[];
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): [Parameter[], Parameter[]];
36
- static updateParameterWithInputType(schema: OpenAPIV3.SchemaObject, param: Parameter): void;
37
- static parseApiInfo(operationItem: OpenAPIV3.OperationObject, allowMultipleParameters: boolean): [IMessagingExtensionCommand, WarningResult | undefined];
38
- static listSupportedAPIs(spec: OpenAPIV3.Document, allowMissingId: boolean, allowAPIKeyAuth: boolean, allowMultipleParameters: boolean, allowOauth2: boolean): {
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;
42
26
  static format(str: string, ...args: string[]): string;
43
27
  static getSafeRegistrationIdEnvName(authName: string): string;
28
+ static getServerObject(spec: OpenAPIV3.Document, method: string, path: string): OpenAPIV3.ServerObject | undefined;
44
29
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/m365-spec-parser",
3
- "version": "0.1.1-alpha.cf377d39f.0",
3
+ "version": "0.1.1-alpha.ded43fb2d.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 \"test/*.test.ts\" -r config/mocha.env.ts --config config/.mocharc.json",
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,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.cf377d39f.0",
42
+ "@microsoft/teams-manifest": "0.1.4-alpha.ded43fb2d.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": "2a9ae0132af43d3809f8e60350d5fce5da39a435"
151
+ "gitHead": "9ef7847e0976ff5ac94920010082c802c5226530"
152
152
  }