@microsoft/m365-spec-parser 0.2.1 → 0.2.2-alpha.070ff93c3.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,7 +1,7 @@
1
1
  import { OpenAPIV3 } from "openapi-types";
2
2
  import { AdaptiveCard, ArrayElement, ImageElement, TextBlockElement } from "./interfaces";
3
3
  export declare class AdaptiveCardGenerator {
4
- static generateAdaptiveCard(operationItem: OpenAPIV3.OperationObject): [AdaptiveCard, string];
4
+ static generateAdaptiveCard(operationItem: OpenAPIV3.OperationObject, allowMultipleMediaType?: boolean): [AdaptiveCard, string];
5
5
  static generateCardFromResponse(schema: OpenAPIV3.SchemaObject, name: string, parentArrayName?: string): Array<TextBlockElement | ImageElement | ArrayElement>;
6
6
  static getResponseJsonPathFromSchema(schema: OpenAPIV3.SchemaObject): string;
7
7
  static isImageUrlProperty(schema: OpenAPIV3.NonArraySchemaObject, name: string, parentArrayName: string): boolean;
@@ -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, InvalidAPIInfo, } from "./interfaces";
3
+ export { ValidationStatus, WarningType, ErrorType, WarningResult, ErrorResult, ListAPIResult, APIInfo, ValidateResult, ParseOptions, AdaptiveCard, ProjectType, InvalidAPIInfo, AuthType, } from "./interfaces";
4
4
  export { ConstantString } from "./constants";
5
5
  export { Utils } from "./utils";
6
6
  export { AdaptiveCardGenerator } from "./adaptiveCardGenerator";
@@ -76,10 +76,12 @@ export declare enum ErrorType {
76
76
  RelativeServerUrlNotSupported = "relative-server-url-not-supported",
77
77
  NoSupportedApi = "no-supported-api",
78
78
  NoExtraAPICanBeAdded = "no-extra-api-can-be-added",
79
+ AddedAPINotInOriginalSpec = "added-api-not-in-original-spec",
79
80
  ResolveServerUrlFailed = "resolve-server-url-failed",
80
81
  SwaggerNotSupported = "swagger-not-supported",
81
82
  MultipleAuthNotSupported = "multiple-auth-not-supported",
82
83
  SpecVersionNotSupported = "spec-version-not-supported",
84
+ CircularReferenceNotSupported = "circular-reference-not-supported",
83
85
  ListFailed = "list-failed",
84
86
  listSupportedAPIInfoFailed = "list-supported-api-info-failed",
85
87
  FilterSpecFailed = "filter-spec-failed",
@@ -134,16 +136,17 @@ export interface ImageElement {
134
136
  url: string;
135
137
  $when: string;
136
138
  }
139
+ export declare type AdaptiveCardBody = Array<TextBlockElement | ImageElement | ArrayElement>;
137
140
  export interface ArrayElement {
138
141
  type: string;
139
142
  $data: string;
140
- items: Array<TextBlockElement | ImageElement | ArrayElement>;
143
+ items: AdaptiveCardBody;
141
144
  }
142
145
  export interface AdaptiveCard {
143
146
  type: string;
144
147
  $schema: string;
145
148
  version: string;
146
- body: Array<TextBlockElement | ImageElement | ArrayElement>;
149
+ body: AdaptiveCardBody;
147
150
  }
148
151
  export interface PreviewCardTemplate {
149
152
  title: string;
@@ -257,8 +260,11 @@ export interface ListAPIResult {
257
260
  validAPICount: number;
258
261
  APIs: ListAPIInfo[];
259
262
  }
263
+ export declare type AuthType = OpenAPIV3.SecuritySchemeObject | {
264
+ type: "multipleAuth";
265
+ };
260
266
  export interface AuthInfo {
261
- authScheme: OpenAPIV3.SecuritySchemeObject;
267
+ authScheme: AuthType;
262
268
  name: string;
263
269
  }
264
270
  export interface InvalidAPIInfo {
@@ -0,0 +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
+ }
@@ -57,4 +57,5 @@ export declare class SpecParser {
57
57
  private getAPIs;
58
58
  private getValidator;
59
59
  private saveFilterSpec;
60
+ private resolveEnvForSpec;
60
61
  }
@@ -1,16 +1,16 @@
1
1
  import { OpenAPIV3 } from "openapi-types";
2
- import { AuthInfo, ErrorResult, ParseOptions } from "./interfaces";
2
+ import { AdaptiveCardBody, AuthInfo, AuthType, ErrorResult, ParseOptions } from "./interfaces";
3
3
  import { IMessagingExtensionCommand, IParameter } from "@microsoft/teams-manifest";
4
4
  export declare class Utils {
5
5
  static hasNestedObjectInSchema(schema: OpenAPIV3.SchemaObject): boolean;
6
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;
7
+ static isBearerTokenAuth(authScheme: AuthType): boolean;
8
+ static isAPIKeyAuth(authScheme: AuthType): boolean;
9
+ static isOAuthWithAuthCodeFlow(authScheme: AuthType): boolean;
10
10
  static getAuthArray(securities: OpenAPIV3.SecurityRequirementObject[] | undefined, spec: OpenAPIV3.Document): AuthInfo[][];
11
11
  static getAuthInfo(spec: OpenAPIV3.Document): AuthInfo | undefined;
12
12
  static updateFirstLetter(str: string): string;
13
- static getResponseJson(operationObject: OpenAPIV3.OperationObject | undefined): {
13
+ static getResponseJson(operationObject: OpenAPIV3.OperationObject | undefined, allowMultipleMediaType?: boolean): {
14
14
  json: OpenAPIV3.MediaTypeObject;
15
15
  multipleMediaType: boolean;
16
16
  };
@@ -26,4 +26,5 @@ export declare class Utils {
26
26
  static format(str: string, ...args: string[]): string;
27
27
  static getSafeRegistrationIdEnvName(authName: string): string;
28
28
  static getServerObject(spec: OpenAPIV3.Document, method: string, path: string): OpenAPIV3.ServerObject | undefined;
29
+ static limitACBodyProperties(body: AdaptiveCardBody, maxCount: number): AdaptiveCardBody;
29
30
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/m365-spec-parser",
3
- "version": "0.2.1",
3
+ "version": "0.2.2-alpha.070ff93c3.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.5",
42
+ "@microsoft/teams-manifest": "0.1.6-alpha.070ff93c3.0",
43
43
  "fs-extra": "^11.2.0",
44
44
  "js-yaml": "^4.1.0",
45
45
  "openapi-types": "^7.2.3",
@@ -147,5 +147,5 @@
147
147
  "npx eslint --cache --fix --quiet"
148
148
  ]
149
149
  },
150
- "gitHead": "400fc6af9abee5c7484fd9ed406790c39889b1bc"
150
+ "gitHead": "ad7952c369f15bba09ffc2fa12b0e7bd5bbfd545"
151
151
  }