@microsoft/m365-spec-parser 0.2.6-alpha.d99d3c39d.0 → 0.2.6-alpha.dea29f186.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.
@@ -20,8 +20,8 @@ export declare class ConstantString {
20
20
  static readonly UnsupportedSchema = "Unsupported schema in %s %s: %s";
21
21
  static readonly FuncDescriptionTooLong = "The description of the function '%s' is too long. The current length is %s characters, while the maximum allowed length is %s characters.";
22
22
  static readonly GenerateJsonDataFailed = "Failed to generate JSON data for api: %s due to %s.";
23
- static readonly WrappedCardVersion = "devPreview";
24
- static readonly WrappedCardSchema = "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.ResponseRenderingTemplate.schema.json";
23
+ static readonly WrappedCardVersion = "1.0";
24
+ static readonly WrappedCardSchema = "https://developer.microsoft.com/json-schemas/teams/v1.19/MicrosoftTeams.ResponseRenderingTemplate.schema.json";
25
25
  static readonly WrappedCardResponseLayout = "list";
26
26
  static readonly GetMethod = "get";
27
27
  static readonly PostMethod = "post";
@@ -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, AuthType, } from "./interfaces";
3
+ export { ValidationStatus, WarningType, ErrorType, WarningResult, ErrorResult, ListAPIResult, APIInfo, ValidateResult, ParseOptions, AdaptiveCard, ProjectType, InvalidAPIInfo, AuthType, AdaptiveCardUpdateStrategy, ListAPIInfo, } from "./interfaces";
4
4
  export { ConstantString } from "./constants";
5
5
  export { Utils } from "./utils";
6
6
  export { AdaptiveCardGenerator } from "./adaptiveCardGenerator";
@@ -104,7 +104,8 @@ export declare enum ErrorType {
104
104
  MethodNotAllowed = "method-not-allowed",
105
105
  UrlPathNotExist = "url-path-not-exist",
106
106
  Cancelled = "cancelled",
107
- Unknown = "unknown"
107
+ Unknown = "unknown",
108
+ AddAuthFailed = "add-auth-failed"
108
109
  }
109
110
  /**
110
111
  * An enum that represents the types of warnings that can occur during validation.
@@ -229,6 +230,10 @@ export declare enum ProjectType {
229
230
  SME = 1,
230
231
  TeamsAi = 2
231
232
  }
233
+ export declare enum AdaptiveCardUpdateStrategy {
234
+ CreateNew = 0,
235
+ KeepExisting = 1
236
+ }
232
237
  export interface APIInfo {
233
238
  method: string;
234
239
  path: string;
@@ -245,6 +250,8 @@ export interface ListAPIInfo {
245
250
  isValid: boolean;
246
251
  reason: ErrorType[];
247
252
  auth?: AuthInfo;
253
+ summary?: string;
254
+ description?: string;
248
255
  }
249
256
  export interface APIMap {
250
257
  [key: string]: {
@@ -2,10 +2,10 @@ import { OpenAPIV3 } from "openapi-types";
2
2
  import { AuthInfo, ExistingPluginManifestInfo, OperationAuthInfoMap, ParseOptions, WarningResult } from "./interfaces";
3
3
  import { IMessagingExtensionCommand, TeamsAppManifest, PluginManifestSchema } from "@microsoft/teams-manifest";
4
4
  export declare class ManifestUpdater {
5
- static updateManifestWithAiPlugin(manifestPath: string, outputSpecPath: string, apiPluginFilePath: string, spec: OpenAPIV3.Document, options: ParseOptions, authMap: OperationAuthInfoMap, existingPluginManifestInfo?: ExistingPluginManifestInfo): Promise<[TeamsAppManifest, PluginManifestSchema, WarningResult[]]>;
5
+ static updateManifestWithAiPlugin(manifestPath: string, outputSpecPath: string, apiPluginFilePath: string, spec: OpenAPIV3.Document, options: ParseOptions, authMap: OperationAuthInfoMap, existingPluginManifestInfo?: ExistingPluginManifestInfo): Promise<[TeamsAppManifest, PluginManifestSchema, WarningResult[], Record<string, any>]>;
6
6
  static updateManifestDescription(manifest: TeamsAppManifest, spec: OpenAPIV3.Document): void;
7
7
  static checkSchema(schema: OpenAPIV3.SchemaObject, method: string, pathUrl: string): void;
8
- static generatePluginManifestSchema(spec: OpenAPIV3.Document, specRelativePath: string, apiPluginFilePath: string, appName: string, authMap: OperationAuthInfoMap, options: ParseOptions, existingPluginManifestInfo?: ExistingPluginManifestInfo): Promise<[PluginManifestSchema, WarningResult[]]>;
8
+ static generatePluginManifestSchema(spec: OpenAPIV3.Document, specRelativePath: string, apiPluginFilePath: string, appName: string, authMap: OperationAuthInfoMap, options: ParseOptions, existingPluginManifestInfo?: ExistingPluginManifestInfo): Promise<[PluginManifestSchema, WarningResult[], Record<string, any>]>;
9
9
  static updateManifest(manifestPath: string, outputSpecPath: string, spec: OpenAPIV3.Document, options: ParseOptions, adaptiveCardFolder?: string, authInfo?: AuthInfo): Promise<[TeamsAppManifest, WarningResult[]]>;
10
10
  static generateCommands(spec: OpenAPIV3.Document, manifestPath: string, options: ParseOptions, adaptiveCardFolder?: string): Promise<[IMessagingExtensionCommand[], WarningResult[]]>;
11
11
  static getRelativePath(from: string, to: string): string;
@@ -1,6 +1,6 @@
1
1
  import SwaggerParser from "@apidevtools/swagger-parser";
2
2
  import { OpenAPIV3 } from "openapi-types";
3
- import { APIInfo, GenerateResult, ListAPIResult, ParseOptions, ValidateResult } from "./interfaces";
3
+ import { AdaptiveCardUpdateStrategy, APIInfo, GenerateResult, ListAPIResult, ParseOptions, ValidateResult } from "./interfaces";
4
4
  /**
5
5
  * A class that parses an OpenAPI specification file and provides methods to validate, list, and generate artifacts.
6
6
  */
@@ -26,6 +26,7 @@ export declare class SpecParser {
26
26
  */
27
27
  validate(): Promise<ValidateResult>;
28
28
  listSupportedAPIInfo(): Promise<APIInfo[]>;
29
+ addAuthScheme(authName: string, authType: string, authParameters: any, signal?: AbortSignal): Promise<void>;
29
30
  /**
30
31
  * Lists all the OpenAPI operations in the specification file.
31
32
  * @returns A string array that represents the HTTP method and path of each operation, such as ['GET /pets/{petId}', 'GET /user/{userId}']
@@ -45,7 +46,7 @@ export declare class SpecParser {
45
46
  * @param outputSpecPath File path of the new OpenAPI specification file to generate. If not specified or empty, no spec file will be generated.
46
47
  * @param pluginFilePath File path of the api plugin file to generate.
47
48
  */
48
- generateForCopilot(manifestPath: string, filter: string[], outputSpecPath: string, pluginFilePath: string, existingPluginFilePath?: string, signal?: AbortSignal): Promise<GenerateResult>;
49
+ generateForCopilot(manifestPath: string, filter: string[], outputSpecPath: string, pluginFilePath: string, existingPluginFilePath?: string, signal?: AbortSignal, adaptiveCardUpdateStrategy?: AdaptiveCardUpdateStrategy): Promise<GenerateResult>;
49
50
  /**
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.
51
52
  * @param manifestPath A file path of the Teams app manifest file to update.
@@ -60,9 +61,11 @@ export declare class SpecParser {
60
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.
61
62
  */
62
63
  generateAdaptiveCardInPlugin(pluginFilePath: string, filter: string[], signal?: AbortSignal): Promise<void>;
64
+ private separateAdaptiveCards;
63
65
  private loadSpec;
64
66
  private getAPIs;
65
67
  private getValidator;
66
68
  private saveFilterSpec;
67
69
  private resolveEnvForSpec;
70
+ private findUniqueCardName;
68
71
  }
@@ -30,4 +30,5 @@ export declare class Utils {
30
30
  static format(str: string, ...args: string[]): string;
31
31
  static getSafeRegistrationIdEnvName(authName: string): string;
32
32
  static getServerObject(spec: OpenAPIV3.Document, method: string, path: string): OpenAPIV3.ServerObject | undefined;
33
+ static getAuthSchemaObject(authType: string, authParameters: any): OpenAPIV3.SecuritySchemeObject;
33
34
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/m365-spec-parser",
3
- "version": "0.2.6-alpha.d99d3c39d.0",
3
+ "version": "0.2.6-alpha.dea29f186.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.1",
42
- "@microsoft/teams-manifest": "0.1.9-alpha.d99d3c39d.0",
42
+ "@microsoft/teams-manifest": "0.1.9-alpha.dea29f186.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": "99eb457d9999b3de001f3381dfa6526d2d95ae27"
150
+ "gitHead": "8281d21c3fba6d6a36ca1b7826ca2f25227088d8"
151
151
  }