@microsoft/m365-spec-parser 0.1.1-alpha.cf377d39f.0 → 0.1.1-alpha.fc0606a28.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.
@@ -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.
@@ -3,8 +3,9 @@ import SwaggerParser from "@apidevtools/swagger-parser";
3
3
  import { AuthSchema, CheckParamResult, ErrorResult, Parameter, ValidateResult, WarningResult } from "./interfaces";
4
4
  import { IMessagingExtensionCommand } from "@microsoft/teams-manifest";
5
5
  export declare class Utils {
6
- static checkParameters(paramObject: OpenAPIV3.ParameterObject[]): CheckParamResult;
7
- static checkPostBody(schema: OpenAPIV3.SchemaObject, isRequired?: boolean): CheckParamResult;
6
+ static hasNestedObjectInSchema(schema: OpenAPIV3.SchemaObject): boolean;
7
+ static checkParameters(paramObject: OpenAPIV3.ParameterObject[], isCopilot: boolean): CheckParamResult;
8
+ static checkPostBody(schema: OpenAPIV3.SchemaObject, isRequired?: boolean, isCopilot?: boolean): CheckParamResult;
8
9
  /**
9
10
  * Checks if the given API is supported.
10
11
  * @param {string} method - The HTTP method of the API.
@@ -19,7 +20,7 @@ export declare class Utils {
19
20
  * 5. response body should be “application/json” and not empty, and response code should be 20X
20
21
  * 6. only support request body with “application/json” content type
21
22
  */
22
- static isSupportedApi(method: string, path: string, spec: OpenAPIV3.Document, allowMissingId: boolean, allowAPIKeyAuth: boolean, allowMultipleParameters: boolean, allowOauth2: boolean): boolean;
23
+ static isSupportedApi(method: string, path: string, spec: OpenAPIV3.Document, allowMissingId: boolean, allowAPIKeyAuth: boolean, allowMultipleParameters: boolean, allowOauth2: boolean, isCopilot: boolean): boolean;
23
24
  static isSupportedAuth(authSchemaArray: AuthSchema[][], allowAPIKeyAuth: boolean, allowOauth2: boolean): boolean;
24
25
  static isAPIKeyAuth(authSchema: OpenAPIV3.SecuritySchemeObject): boolean;
25
26
  static isBearerTokenAuth(authSchema: OpenAPIV3.SecuritySchemeObject): boolean;
@@ -30,15 +31,15 @@ export declare class Utils {
30
31
  static getUrlProtocol(urlString: string): string | undefined;
31
32
  static resolveServerUrl(url: string): string;
32
33
  static checkServerUrl(servers: OpenAPIV3.ServerObject[]): ErrorResult[];
33
- static validateServer(spec: OpenAPIV3.Document, allowMissingId: boolean, allowAPIKeyAuth: boolean, allowMultipleParameters: boolean, allowOauth2: boolean): ErrorResult[];
34
+ static validateServer(spec: OpenAPIV3.Document, allowMissingId: boolean, allowAPIKeyAuth: boolean, allowMultipleParameters: boolean, allowOauth2: boolean, isCopilot: boolean): ErrorResult[];
34
35
  static isWellKnownName(name: string, wellknownNameList: string[]): boolean;
35
36
  static generateParametersFromSchema(schema: OpenAPIV3.SchemaObject, name: string, allowMultipleParameters: boolean, isRequired?: boolean): [Parameter[], Parameter[]];
36
37
  static updateParameterWithInputType(schema: OpenAPIV3.SchemaObject, param: Parameter): void;
37
38
  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
+ static listSupportedAPIs(spec: OpenAPIV3.Document, allowMissingId: boolean, allowAPIKeyAuth: boolean, allowMultipleParameters: boolean, allowOauth2: boolean, isCopilot: boolean): {
39
40
  [key: string]: OpenAPIV3.OperationObject;
40
41
  };
41
- static validateSpec(spec: OpenAPIV3.Document, parser: SwaggerParser, isSwaggerFile: boolean, allowMissingId: boolean, allowAPIKeyAuth: boolean, allowMultipleParameters: boolean, allowOauth2: boolean): ValidateResult;
42
+ static validateSpec(spec: OpenAPIV3.Document, parser: SwaggerParser, isSwaggerFile: boolean, allowMissingId: boolean, allowAPIKeyAuth: boolean, allowMultipleParameters: boolean, allowOauth2: boolean, isCopilot: boolean): ValidateResult;
42
43
  static format(str: string, ...args: string[]): string;
43
44
  static getSafeRegistrationIdEnvName(authName: string): string;
44
45
  }
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.fc0606a28.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.fc0606a28.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": "0156cf2d4a44da2393425ffb29049ef8a2d2f41f"
152
152
  }