Outlook_Addin_LLM/node_modules/@microsoft/m365-spec-parser/dist/index.esm2017.mjs.map

1 line
155 KiB
Plaintext

{"version":3,"file":"index.esm2017.mjs","sources":["../src/interfaces.ts","../src/constants.ts","../src/specParserError.ts","../src/utils.ts","../src/validators/validator.ts","../src/validators/copilotValidator.ts","../src/validators/smeValidator.ts","../src/validators/teamsAIValidator.ts","../src/validators/validatorFactory.ts","../src/specFilter.ts","../src/adaptiveCardGenerator.ts","../src/adaptiveCardWrapper.ts","../src/manifestUpdater.ts","../src/specParser.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\"use strict\";\n\nimport { IParameter } from \"@microsoft/teams-manifest\";\nimport { OpenAPIV3 } from \"openapi-types\";\n\n/**\n * An interface that represents the result of validating an OpenAPI specification file.\n */\nexport interface ValidateResult {\n /**\n * The validation status of the OpenAPI specification file.\n */\n status: ValidationStatus;\n\n /**\n * An array of warning results generated during validation.\n */\n warnings: WarningResult[];\n\n /**\n * An array of error results generated during validation.\n */\n errors: ErrorResult[];\n}\n\nexport interface SpecValidationResult {\n /**\n * An array of warning results generated during validation.\n */\n warnings: WarningResult[];\n\n /**\n * An array of error results generated during validation.\n */\n errors: ErrorResult[];\n}\n\n/**\n * An interface that represents a warning result generated during validation.\n */\nexport interface WarningResult {\n /**\n * The type of warning.\n */\n type: WarningType;\n\n /**\n * The content of the warning.\n */\n content: string;\n\n /**\n * data of the warning.\n */\n data?: any;\n}\n\n/**\n * An interface that represents an error result generated during validation.\n */\nexport interface ErrorResult {\n /**\n * The type of error.\n */\n type: ErrorType;\n\n /**\n * The content of the error.\n */\n content: string;\n\n /**\n * data of the error.\n */\n data?: any;\n}\n\nexport interface GenerateResult {\n allSuccess: boolean;\n warnings: WarningResult[];\n}\n\n/**\n * An enum that represents the types of errors that can occur during validation.\n */\nexport enum ErrorType {\n SpecNotValid = \"spec-not-valid\",\n RemoteRefNotSupported = \"remote-ref-not-supported\",\n NoServerInformation = \"no-server-information\",\n UrlProtocolNotSupported = \"url-protocol-not-supported\",\n RelativeServerUrlNotSupported = \"relative-server-url-not-supported\",\n NoSupportedApi = \"no-supported-api\",\n NoExtraAPICanBeAdded = \"no-extra-api-can-be-added\",\n ResolveServerUrlFailed = \"resolve-server-url-failed\",\n SwaggerNotSupported = \"swagger-not-supported\",\n MultipleAuthNotSupported = \"multiple-auth-not-supported\",\n SpecVersionNotSupported = \"spec-version-not-supported\",\n\n ListFailed = \"list-failed\",\n listSupportedAPIInfoFailed = \"list-supported-api-info-failed\",\n FilterSpecFailed = \"filter-spec-failed\",\n UpdateManifestFailed = \"update-manifest-failed\",\n GenerateAdaptiveCardFailed = \"generate-adaptive-card-failed\",\n GenerateFailed = \"generate-failed\",\n ValidateFailed = \"validate-failed\",\n GetSpecFailed = \"get-spec-failed\",\n\n AuthTypeIsNotSupported = \"auth-type-is-not-supported\",\n MissingOperationId = \"missing-operation-id\",\n PostBodyContainMultipleMediaTypes = \"post-body-contain-multiple-media-types\",\n ResponseContainMultipleMediaTypes = \"response-contain-multiple-media-types\",\n ResponseJsonIsEmpty = \"response-json-is-empty\",\n PostBodySchemaIsNotJson = \"post-body-schema-is-not-json\",\n PostBodyContainsRequiredUnsupportedSchema = \"post-body-contains-required-unsupported-schema\",\n ParamsContainRequiredUnsupportedSchema = \"params-contain-required-unsupported-schema\",\n ParamsContainsNestedObject = \"params-contains-nested-object\",\n RequestBodyContainsNestedObject = \"request-body-contains-nested-object\",\n ExceededRequiredParamsLimit = \"exceeded-required-params-limit\",\n NoParameter = \"no-parameter\",\n NoAPIInfo = \"no-api-info\",\n MethodNotAllowed = \"method-not-allowed\",\n UrlPathNotExist = \"url-path-not-exist\",\n\n Cancelled = \"cancelled\",\n Unknown = \"unknown\",\n}\n\n/**\n * An enum that represents the types of warnings that can occur during validation.\n */\nexport enum WarningType {\n OperationIdMissing = \"operationid-missing\",\n GenerateCardFailed = \"generate-card-failed\",\n OperationOnlyContainsOptionalParam = \"operation-only-contains-optional-param\",\n ConvertSwaggerToOpenAPI = \"convert-swagger-to-openapi\",\n Unknown = \"unknown\",\n}\n\n/**\n * An enum that represents the validation status of an OpenAPI specification file.\n */\nexport enum ValidationStatus {\n Valid,\n Warning, // If there are any warnings, the file is still valid\n Error, // If there are any errors, the file is not valid\n}\n\nexport interface TextBlockElement {\n type: string;\n text: string;\n wrap: boolean;\n}\n\nexport interface ImageElement {\n type: string;\n url: string;\n $when: string;\n}\n\nexport interface ArrayElement {\n type: string;\n $data: string;\n items: Array<TextBlockElement | ImageElement | ArrayElement>;\n}\n\nexport interface AdaptiveCard {\n type: string;\n $schema: string;\n version: string;\n body: Array<TextBlockElement | ImageElement | ArrayElement>;\n}\n\nexport interface PreviewCardTemplate {\n title: string;\n subtitle?: string;\n image?: {\n url: string;\n alt?: string;\n $when?: string;\n };\n}\n\nexport interface WrappedAdaptiveCard {\n version: string;\n $schema?: string;\n jsonPath?: string;\n responseLayout: string;\n responseCardTemplate: AdaptiveCard;\n previewCardTemplate: PreviewCardTemplate;\n}\n\nexport interface CheckParamResult {\n requiredNum: number;\n optionalNum: number;\n isValid: boolean;\n reason: ErrorType[];\n}\n\nexport interface ParseOptions {\n /**\n * If true, the parser will not throw an error if an ID is missing the spec file.\n */\n allowMissingId?: boolean;\n\n /**\n * If true, the parser will allow parsing of Swagger specifications.\n */\n allowSwagger?: boolean;\n\n /**\n * If true, the parser will allow API Key authentication in the spec file.\n */\n allowAPIKeyAuth?: boolean;\n\n /**\n * If true, the parser will allow Bearer Token authentication in the spec file.\n */\n allowBearerTokenAuth?: boolean;\n\n /**\n * If true, the parser will allow multiple parameters in the spec file. Teams AI project would ignore this parameters and always true\n */\n allowMultipleParameters?: boolean;\n\n /**\n * If true, the parser will allow OAuth2 authentication in the spec file. Currently only support OAuth2 with auth code flow.\n */\n allowOauth2?: boolean;\n\n /**\n * An array of HTTP methods that the parser will allow in the spec file.\n */\n allowMethods?: string[];\n\n /**\n * If true, the parser will allow conversation starters in plugin file. Only take effect in Copilot project\n */\n allowConversationStarters?: boolean;\n\n /**\n * If true, the parser will allow response semantics in plugin file. Only take effect in Copilot project\n */\n allowResponseSemantics?: boolean;\n\n /**\n * If true, the paser will allow confirmation in plugin file. Only take effect in Copilot project\n */\n allowConfirmation?: boolean;\n\n /**\n * The type of project that the parser is being used for.\n * Project can be SME/Copilot/TeamsAi\n */\n projectType?: ProjectType;\n\n /**\n * If true, we will generate files of plugin for GPT (Declarative Extensions in a Copilot Extension). Otherwise, we will generate files of plugin for Copilot.\n */\n isGptPlugin?: boolean;\n}\n\nexport enum ProjectType {\n Copilot,\n SME,\n TeamsAi,\n}\n\nexport interface APIInfo {\n method: string;\n path: string;\n title: string;\n id: string;\n parameters: IParameter[];\n description: string;\n warning?: WarningResult;\n}\n\nexport interface ListAPIInfo {\n api: string;\n server: string;\n operationId: string;\n isValid: boolean;\n reason: ErrorType[];\n auth?: AuthInfo;\n}\n\nexport interface APIMap {\n [key: string]: {\n operation: OpenAPIV3.OperationObject;\n isValid: boolean;\n reason: ErrorType[];\n };\n}\n\nexport interface APIValidationResult {\n isValid: boolean;\n reason: ErrorType[];\n}\n\nexport interface ListAPIResult {\n allAPICount: number;\n validAPICount: number;\n APIs: ListAPIInfo[];\n}\n\nexport interface AuthInfo {\n authScheme: OpenAPIV3.SecuritySchemeObject;\n name: string;\n}\n\nexport interface InvalidAPIInfo {\n api: string;\n reason: ErrorType[];\n}\n\nexport interface InferredProperties {\n title?: string;\n subtitle?: string;\n imageUrl?: string;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\"use strict\";\n\nexport class ConstantString {\n static readonly CancelledMessage = \"Operation is cancelled.\";\n static readonly NoServerInformation =\n \"No server information is found in the OpenAPI description document.\";\n static readonly RemoteRefNotSupported = \"Remote reference is not supported: %s.\";\n static readonly MissingOperationId = \"Missing operationIds: %s.\";\n static readonly NoSupportedApi =\n \"No supported API is found in the OpenAPI description document: only GET and POST methods are supported, additionally, there can be at most one required parameter, and no auth is allowed.\";\n\n static readonly AdditionalPropertiesNotSupported =\n \"'additionalProperties' is not supported, and will be ignored.\";\n static readonly SchemaNotSupported =\n \"'oneOf', 'allOf', 'anyOf', and 'not' schema are not supported: %s.\";\n static readonly UnknownSchema = \"Unknown schema: %s.\";\n\n static readonly UrlProtocolNotSupported =\n \"Server url is not correct: protocol %s is not supported, you should use https protocol instead.\";\n static readonly RelativeServerUrlNotSupported =\n \"Server url is not correct: relative server url is not supported.\";\n static readonly ResolveServerUrlFailed =\n \"Unable to resolve the server URL: please make sure that the environment variable %s is defined.\";\n static readonly OperationOnlyContainsOptionalParam =\n \"Operation %s contains multiple optional parameters. The first optional parameter is used for this command.\";\n static readonly ConvertSwaggerToOpenAPI =\n \"The Swagger 2.0 file has been converted to OpenAPI 3.0.\";\n\n static readonly SwaggerNotSupported =\n \"Swagger 2.0 is not supported. Please convert to OpenAPI 3.0 manually before proceeding.\";\n\n static readonly SpecVersionNotSupported =\n \"Unsupported OpenAPI version %s. Please use version 3.0.x.\";\n\n static readonly MultipleAuthNotSupported =\n \"Multiple authentication methods are unsupported. Ensure all selected APIs use identical authentication.\";\n\n static readonly UnsupportedSchema = \"Unsupported schema in %s %s: %s\";\n\n static readonly WrappedCardVersion = \"devPreview\";\n static readonly WrappedCardSchema =\n \"https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.ResponseRenderingTemplate.schema.json\";\n static readonly WrappedCardResponseLayout = \"list\";\n\n static readonly GetMethod = \"get\";\n static readonly PostMethod = \"post\";\n static readonly AdaptiveCardVersion = \"1.5\";\n static readonly AdaptiveCardSchema = \"http://adaptivecards.io/schemas/adaptive-card.json\";\n static readonly AdaptiveCardType = \"AdaptiveCard\";\n static readonly TextBlockType = \"TextBlock\";\n static readonly ImageType = \"Image\";\n static readonly ContainerType = \"Container\";\n static readonly RegistrationIdPostfix: { [key: string]: string } = {\n apiKey: \"REGISTRATION_ID\",\n oauth2: \"CONFIGURATION_ID\",\n http: \"REGISTRATION_ID\",\n openIdConnect: \"REGISTRATION_ID\",\n };\n static readonly ResponseCodeFor20X = [\n \"200\",\n \"201\",\n \"202\",\n \"203\",\n \"204\",\n \"205\",\n \"206\",\n \"207\",\n \"208\",\n \"226\",\n \"default\",\n ];\n static readonly AllOperationMethods = [\n \"get\",\n \"post\",\n \"put\",\n \"delete\",\n \"patch\",\n \"head\",\n \"options\",\n \"trace\",\n ];\n\n // TODO: update after investigating the usage of these constants.\n static readonly WellknownResultNames = [\n \"result\",\n \"data\",\n \"items\",\n \"root\",\n \"matches\",\n \"queries\",\n \"list\",\n \"output\",\n ];\n static readonly WellknownTitleName = [\"title\", \"name\", \"summary\", \"caption\", \"subject\", \"label\"];\n static readonly WellknownSubtitleName = [\n \"subtitle\",\n \"id\",\n \"uid\",\n \"description\",\n \"desc\",\n \"detail\",\n ];\n static readonly WellknownImageName = [\n \"image\",\n \"icon\",\n \"avatar\",\n \"picture\",\n \"photo\",\n \"logo\",\n \"pic\",\n \"thumbnail\",\n \"img\",\n ];\n\n static readonly ShortDescriptionMaxLens = 80;\n static readonly FullDescriptionMaxLens = 4000;\n static readonly CommandDescriptionMaxLens = 128;\n static readonly ParameterDescriptionMaxLens = 128;\n static readonly ConversationStarterMaxLens = 50;\n static readonly CommandTitleMaxLens = 32;\n static readonly ParameterTitleMaxLens = 32;\n static readonly SMERequiredParamsMaxNum = 5;\n static readonly DefaultPluginId = \"plugin_1\";\n static readonly PluginManifestSchema =\n \"https://aka.ms/json-schemas/copilot-extensions/v2.1/plugin.schema.json\";\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\"use strict\";\n\nimport { ErrorType } from \"./interfaces\";\n\nexport class SpecParserError extends Error {\n public readonly errorType: ErrorType;\n\n constructor(message: string, errorType: ErrorType) {\n super(message);\n this.errorType = errorType;\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\"use strict\";\n\nimport { OpenAPIV3 } from \"openapi-types\";\nimport { ConstantString } from \"./constants\";\nimport { AuthInfo, ErrorResult, ErrorType, ParseOptions } from \"./interfaces\";\nimport { IMessagingExtensionCommand, IParameter } from \"@microsoft/teams-manifest\";\nimport { SpecParserError } from \"./specParserError\";\n\nexport class Utils {\n static hasNestedObjectInSchema(schema: OpenAPIV3.SchemaObject): boolean {\n if (schema.type === \"object\") {\n for (const property in schema.properties) {\n const nestedSchema = schema.properties[property] as OpenAPIV3.SchemaObject;\n if (nestedSchema.type === \"object\") {\n return true;\n }\n }\n }\n return false;\n }\n\n static containMultipleMediaTypes(\n bodyObject: OpenAPIV3.RequestBodyObject | OpenAPIV3.ResponseObject\n ): boolean {\n return Object.keys(bodyObject?.content || {}).length > 1;\n }\n\n static isBearerTokenAuth(authScheme: OpenAPIV3.SecuritySchemeObject): boolean {\n return authScheme.type === \"http\" && authScheme.scheme === \"bearer\";\n }\n\n static isAPIKeyAuth(authScheme: OpenAPIV3.SecuritySchemeObject): boolean {\n return authScheme.type === \"apiKey\";\n }\n\n static isOAuthWithAuthCodeFlow(authScheme: OpenAPIV3.SecuritySchemeObject): boolean {\n return !!(\n authScheme.type === \"oauth2\" &&\n authScheme.flows &&\n authScheme.flows.authorizationCode\n );\n }\n\n static getAuthArray(\n securities: OpenAPIV3.SecurityRequirementObject[] | undefined,\n spec: OpenAPIV3.Document\n ): AuthInfo[][] {\n const result: AuthInfo[][] = [];\n const securitySchemas = spec.components?.securitySchemes;\n const securitiesArr = securities ?? spec.security;\n if (securitiesArr && securitySchemas) {\n for (let i = 0; i < securitiesArr.length; i++) {\n const security = securitiesArr[i];\n\n const authArray: AuthInfo[] = [];\n for (const name in security) {\n const auth = securitySchemas[name] as OpenAPIV3.SecuritySchemeObject;\n authArray.push({\n authScheme: auth,\n name: name,\n });\n }\n\n if (authArray.length > 0) {\n result.push(authArray);\n }\n }\n }\n\n result.sort((a, b) => a[0].name.localeCompare(b[0].name));\n\n return result;\n }\n\n static getAuthInfo(spec: OpenAPIV3.Document): AuthInfo | undefined {\n let authInfo: AuthInfo | undefined = undefined;\n\n for (const url in spec.paths) {\n for (const method in spec.paths[url]) {\n const operation = (spec.paths[url] as any)[method] as OpenAPIV3.OperationObject;\n\n const authArray = Utils.getAuthArray(operation.security, spec);\n\n if (authArray && authArray.length > 0) {\n const currentAuth = authArray[0][0];\n if (!authInfo) {\n authInfo = authArray[0][0];\n } else if (authInfo.name !== currentAuth.name) {\n throw new SpecParserError(\n ConstantString.MultipleAuthNotSupported,\n ErrorType.MultipleAuthNotSupported\n );\n }\n }\n }\n }\n\n return authInfo;\n }\n\n static updateFirstLetter(str: string): string {\n return str.charAt(0).toUpperCase() + str.slice(1);\n }\n\n static getResponseJson(operationObject: OpenAPIV3.OperationObject | undefined): {\n json: OpenAPIV3.MediaTypeObject;\n multipleMediaType: boolean;\n } {\n let json: OpenAPIV3.MediaTypeObject = {};\n let multipleMediaType = false;\n\n for (const code of ConstantString.ResponseCodeFor20X) {\n const responseObject = operationObject?.responses?.[code] as OpenAPIV3.ResponseObject;\n\n if (responseObject?.content?.[\"application/json\"]) {\n multipleMediaType = false;\n json = responseObject.content[\"application/json\"];\n if (Utils.containMultipleMediaTypes(responseObject)) {\n multipleMediaType = true;\n json = {};\n } else {\n break;\n }\n }\n }\n\n return { json, multipleMediaType };\n }\n\n static convertPathToCamelCase(path: string): string {\n const pathSegments = path.split(/[./{]/);\n const camelCaseSegments = pathSegments.map((segment) => {\n segment = segment.replace(/}/g, \"\");\n return segment.charAt(0).toUpperCase() + segment.slice(1);\n });\n const camelCasePath = camelCaseSegments.join(\"\");\n return camelCasePath;\n }\n\n static getUrlProtocol(urlString: string): string | undefined {\n try {\n const url = new URL(urlString);\n return url.protocol;\n } catch (err) {\n return undefined;\n }\n }\n\n static resolveEnv(str: string): string {\n const placeHolderReg = /\\${{\\s*([a-zA-Z_][a-zA-Z0-9_]*)\\s*}}/g;\n let matches = placeHolderReg.exec(str);\n let newStr = str;\n while (matches != null) {\n const envVar = matches[1];\n const envVal = process.env[envVar];\n if (!envVal) {\n throw new Error(Utils.format(ConstantString.ResolveServerUrlFailed, envVar));\n } else {\n newStr = newStr.replace(matches[0], envVal);\n }\n matches = placeHolderReg.exec(str);\n }\n return newStr;\n }\n\n static checkServerUrl(servers: OpenAPIV3.ServerObject[]): ErrorResult[] {\n const errors: ErrorResult[] = [];\n\n let serverUrl;\n try {\n serverUrl = Utils.resolveEnv(servers[0].url);\n } catch (err) {\n errors.push({\n type: ErrorType.ResolveServerUrlFailed,\n content: (err as Error).message,\n data: servers,\n });\n return errors;\n }\n\n const protocol = Utils.getUrlProtocol(serverUrl);\n if (!protocol) {\n // Relative server url is not supported\n errors.push({\n type: ErrorType.RelativeServerUrlNotSupported,\n content: ConstantString.RelativeServerUrlNotSupported,\n data: servers,\n });\n } else if (protocol !== \"https:\") {\n // Http server url is not supported\n const protocolString = protocol.slice(0, -1);\n errors.push({\n type: ErrorType.UrlProtocolNotSupported,\n content: Utils.format(ConstantString.UrlProtocolNotSupported, protocol.slice(0, -1)),\n data: protocolString,\n });\n }\n\n return errors;\n }\n\n static validateServer(spec: OpenAPIV3.Document, options: ParseOptions): ErrorResult[] {\n const errors: ErrorResult[] = [];\n\n let hasTopLevelServers = false;\n let hasPathLevelServers = false;\n let hasOperationLevelServers = false;\n\n if (spec.servers && spec.servers.length >= 1) {\n hasTopLevelServers = true;\n\n // for multiple server, we only use the first url\n const serverErrors = Utils.checkServerUrl(spec.servers);\n errors.push(...serverErrors);\n }\n\n const paths = spec.paths;\n for (const path in paths) {\n const methods = paths[path];\n\n if (methods?.servers && methods.servers.length >= 1) {\n hasPathLevelServers = true;\n const serverErrors = Utils.checkServerUrl(methods.servers);\n\n errors.push(...serverErrors);\n }\n\n for (const method in methods) {\n const operationObject = (methods as any)[method] as OpenAPIV3.OperationObject;\n if (options.allowMethods?.includes(method) && operationObject) {\n if (operationObject?.servers && operationObject.servers.length >= 1) {\n hasOperationLevelServers = true;\n const serverErrors = Utils.checkServerUrl(operationObject.servers);\n errors.push(...serverErrors);\n }\n }\n }\n }\n\n if (!hasTopLevelServers && !hasPathLevelServers && !hasOperationLevelServers) {\n errors.push({\n type: ErrorType.NoServerInformation,\n content: ConstantString.NoServerInformation,\n });\n }\n\n return errors;\n }\n\n static isWellKnownName(name: string, wellknownNameList: string[]): boolean {\n for (let i = 0; i < wellknownNameList.length; i++) {\n name = name.replace(/_/g, \"\").replace(/-/g, \"\");\n if (name.toLowerCase().includes(wellknownNameList[i])) {\n return true;\n }\n }\n return false;\n }\n\n static generateParametersFromSchema(\n schema: OpenAPIV3.SchemaObject,\n name: string,\n allowMultipleParameters: boolean,\n isRequired = false\n ): [IParameter[], IParameter[]] {\n const requiredParams: IParameter[] = [];\n const optionalParams: IParameter[] = [];\n\n if (\n schema.type === \"string\" ||\n schema.type === \"integer\" ||\n schema.type === \"boolean\" ||\n schema.type === \"number\"\n ) {\n const parameter: IParameter = {\n name: name,\n title: Utils.updateFirstLetter(name).slice(0, ConstantString.ParameterTitleMaxLens),\n description: (schema.description ?? \"\").slice(\n 0,\n ConstantString.ParameterDescriptionMaxLens\n ),\n };\n\n if (allowMultipleParameters) {\n Utils.updateParameterWithInputType(schema, parameter);\n }\n\n if (isRequired && schema.default === undefined) {\n parameter.isRequired = true;\n requiredParams.push(parameter);\n } else {\n optionalParams.push(parameter);\n }\n } else if (schema.type === \"object\") {\n const { properties } = schema;\n for (const property in properties) {\n let isRequired = false;\n if (schema.required && schema.required?.indexOf(property) >= 0) {\n isRequired = true;\n }\n const [requiredP, optionalP] = Utils.generateParametersFromSchema(\n properties[property] as OpenAPIV3.SchemaObject,\n property,\n allowMultipleParameters,\n isRequired\n );\n\n requiredParams.push(...requiredP);\n optionalParams.push(...optionalP);\n }\n }\n\n return [requiredParams, optionalParams];\n }\n\n static updateParameterWithInputType(schema: OpenAPIV3.SchemaObject, param: IParameter): void {\n if (schema.enum) {\n param.inputType = \"choiceset\";\n param.choices = [];\n for (let i = 0; i < schema.enum.length; i++) {\n param.choices.push({\n title: schema.enum[i],\n value: schema.enum[i],\n });\n }\n } else if (schema.type === \"string\") {\n param.inputType = \"text\";\n } else if (schema.type === \"integer\" || schema.type === \"number\") {\n param.inputType = \"number\";\n } else if (schema.type === \"boolean\") {\n param.inputType = \"toggle\";\n }\n\n if (schema.default) {\n param.value = schema.default;\n }\n }\n\n static parseApiInfo(\n operationItem: OpenAPIV3.OperationObject,\n options: ParseOptions\n ): IMessagingExtensionCommand {\n const requiredParams: IParameter[] = [];\n const optionalParams: IParameter[] = [];\n const paramObject = operationItem.parameters as OpenAPIV3.ParameterObject[];\n\n if (paramObject) {\n paramObject.forEach((param: OpenAPIV3.ParameterObject) => {\n const parameter: IParameter = {\n name: param.name,\n title: Utils.updateFirstLetter(param.name).slice(0, ConstantString.ParameterTitleMaxLens),\n description: (param.description ?? \"\").slice(\n 0,\n ConstantString.ParameterDescriptionMaxLens\n ),\n };\n\n const schema = param.schema as OpenAPIV3.SchemaObject;\n if (options.allowMultipleParameters && schema) {\n Utils.updateParameterWithInputType(schema, parameter);\n }\n\n if (param.in !== \"header\" && param.in !== \"cookie\") {\n if (param.required && schema?.default === undefined) {\n parameter.isRequired = true;\n requiredParams.push(parameter);\n } else {\n optionalParams.push(parameter);\n }\n }\n });\n }\n\n if (operationItem.requestBody) {\n const requestBody = operationItem.requestBody as OpenAPIV3.RequestBodyObject;\n const requestJson = requestBody.content[\"application/json\"];\n if (Object.keys(requestJson).length !== 0) {\n const schema = requestJson.schema as OpenAPIV3.SchemaObject;\n const [requiredP, optionalP] = Utils.generateParametersFromSchema(\n schema,\n \"requestBody\",\n !!options.allowMultipleParameters,\n requestBody.required\n );\n requiredParams.push(...requiredP);\n optionalParams.push(...optionalP);\n }\n }\n\n const operationId = operationItem.operationId!;\n\n const parameters = [...requiredParams, ...optionalParams];\n\n const command: IMessagingExtensionCommand = {\n context: [\"compose\"],\n type: \"query\",\n title: (operationItem.summary ?? \"\").slice(0, ConstantString.CommandTitleMaxLens),\n id: operationId,\n parameters: parameters,\n description: (operationItem.description ?? \"\").slice(\n 0,\n ConstantString.CommandDescriptionMaxLens\n ),\n };\n return command;\n }\n\n static format(str: string, ...args: string[]): string {\n let index = 0;\n return str.replace(/%s/g, () => {\n const arg = args[index++];\n return arg !== undefined ? arg : \"\";\n });\n }\n\n static getSafeRegistrationIdEnvName(authName: string): string {\n if (!authName) {\n return \"\";\n }\n\n let safeRegistrationIdEnvName = authName.toUpperCase().replace(/[^A-Z0-9_]/g, \"_\");\n\n if (!safeRegistrationIdEnvName.match(/^[A-Z]/)) {\n safeRegistrationIdEnvName = \"PREFIX_\" + safeRegistrationIdEnvName;\n }\n\n return safeRegistrationIdEnvName;\n }\n\n static getServerObject(\n spec: OpenAPIV3.Document,\n method: string,\n path: string\n ): OpenAPIV3.ServerObject | undefined {\n const pathObj = spec.paths[path] as any;\n\n const operationObject = pathObj[method] as OpenAPIV3.OperationObject;\n\n const rootServer = spec.servers && spec.servers[0];\n const methodServer = spec.paths[path]!.servers && spec.paths[path]!.servers![0];\n const operationServer = operationObject.servers && operationObject.servers[0];\n\n const serverUrl = operationServer || methodServer || rootServer;\n\n return serverUrl;\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\"use strict\";\n\nimport { OpenAPIV3 } from \"openapi-types\";\nimport {\n ParseOptions,\n APIValidationResult,\n ErrorType,\n CheckParamResult,\n ProjectType,\n APIMap,\n SpecValidationResult,\n WarningType,\n InvalidAPIInfo,\n} from \"../interfaces\";\nimport { Utils } from \"../utils\";\nimport { ConstantString } from \"../constants\";\n\nexport abstract class Validator {\n projectType!: ProjectType;\n spec!: OpenAPIV3.Document;\n options!: ParseOptions;\n\n private apiMap: APIMap | undefined;\n\n abstract validateAPI(method: string, path: string): APIValidationResult;\n abstract validateSpec(): SpecValidationResult;\n\n listAPIs(): APIMap {\n if (this.apiMap) {\n return this.apiMap;\n }\n\n const paths = this.spec.paths;\n const result: APIMap = {};\n for (const path in paths) {\n const methods = paths[path];\n for (const method in methods) {\n const operationObject = (methods as any)[method] as OpenAPIV3.OperationObject;\n if (this.options.allowMethods?.includes(method) && operationObject) {\n const validateResult = this.validateAPI(method, path);\n result[`${method.toUpperCase()} ${path}`] = {\n operation: operationObject,\n isValid: validateResult.isValid,\n reason: validateResult.reason,\n };\n }\n }\n }\n\n this.apiMap = result;\n return result;\n }\n\n protected validateSpecVersion(): SpecValidationResult {\n const result: SpecValidationResult = { errors: [], warnings: [] };\n\n if (this.spec.openapi >= \"3.1.0\") {\n result.errors.push({\n type: ErrorType.SpecVersionNotSupported,\n content: Utils.format(ConstantString.SpecVersionNotSupported, this.spec.openapi),\n data: this.spec.openapi,\n });\n }\n\n return result;\n }\n\n protected validateSpecServer(): SpecValidationResult {\n const result: SpecValidationResult = { errors: [], warnings: [] };\n const serverErrors = Utils.validateServer(this.spec, this.options);\n result.errors.push(...serverErrors);\n return result;\n }\n\n protected validateSpecNoSupportAPI(): SpecValidationResult {\n const result: SpecValidationResult = { errors: [], warnings: [] };\n\n const apiMap = this.listAPIs();\n\n const validAPIs = Object.entries(apiMap).filter(([, value]) => value.isValid);\n if (validAPIs.length === 0) {\n const data = [];\n for (const key in apiMap) {\n const { reason } = apiMap[key];\n const apiInvalidReason: InvalidAPIInfo = { api: key, reason: reason };\n data.push(apiInvalidReason);\n }\n\n result.errors.push({\n type: ErrorType.NoSupportedApi,\n content: ConstantString.NoSupportedApi,\n data,\n });\n }\n\n return result;\n }\n\n protected validateSpecOperationId(): SpecValidationResult {\n const result: SpecValidationResult = { errors: [], warnings: [] };\n const apiMap = this.listAPIs();\n\n // OperationId missing\n const apisMissingOperationId: string[] = [];\n for (const key in apiMap) {\n const { operation } = apiMap[key];\n if (!operation.operationId) {\n apisMissingOperationId.push(key);\n }\n }\n\n if (apisMissingOperationId.length > 0) {\n result.warnings.push({\n type: WarningType.OperationIdMissing,\n content: Utils.format(ConstantString.MissingOperationId, apisMissingOperationId.join(\", \")),\n data: apisMissingOperationId,\n });\n }\n\n return result;\n }\n\n protected validateMethodAndPath(method: string, path: string): APIValidationResult {\n const result: APIValidationResult = { isValid: true, reason: [] };\n\n if (this.options.allowMethods && !this.options.allowMethods.includes(method)) {\n result.isValid = false;\n result.reason.push(ErrorType.MethodNotAllowed);\n return result;\n }\n\n const pathObj = this.spec.paths[path] as any;\n\n if (!pathObj || !pathObj[method]) {\n result.isValid = false;\n result.reason.push(ErrorType.UrlPathNotExist);\n return result;\n }\n\n return result;\n }\n\n protected validateResponse(method: string, path: string): APIValidationResult {\n const result: APIValidationResult = { isValid: true, reason: [] };\n\n const operationObject = (this.spec.paths[path] as any)[method] as OpenAPIV3.OperationObject;\n\n const { json, multipleMediaType } = Utils.getResponseJson(operationObject);\n\n if (this.options.projectType === ProjectType.SME) {\n // only support response body only contains “application/json” content type\n if (multipleMediaType) {\n result.reason.push(ErrorType.ResponseContainMultipleMediaTypes);\n } else if (Object.keys(json).length === 0) {\n // response body should not be empty\n result.reason.push(ErrorType.ResponseJsonIsEmpty);\n }\n }\n\n return result;\n }\n\n protected validateServer(method: string, path: string): APIValidationResult {\n const result: APIValidationResult = { isValid: true, reason: [] };\n const serverObj = Utils.getServerObject(this.spec, method, path);\n if (!serverObj) {\n // should contain server URL\n result.reason.push(ErrorType.NoServerInformation);\n } else {\n // server url should be absolute url with https protocol\n const serverValidateResult = Utils.checkServerUrl([serverObj]);\n result.reason.push(...serverValidateResult.map((item) => item.type));\n }\n\n return result;\n }\n\n protected validateAuth(method: string, path: string): APIValidationResult {\n const pathObj = this.spec.paths[path] as any;\n const operationObject = pathObj[method] as OpenAPIV3.OperationObject;\n\n const securities = operationObject.security;\n const authSchemeArray = Utils.getAuthArray(securities, this.spec);\n\n if (authSchemeArray.length === 0) {\n return { isValid: true, reason: [] };\n }\n\n if (\n this.options.allowAPIKeyAuth ||\n this.options.allowOauth2 ||\n this.options.allowBearerTokenAuth\n ) {\n // Currently we don't support multiple auth in one operation\n if (authSchemeArray.length > 0 && authSchemeArray.every((auths) => auths.length > 1)) {\n return {\n isValid: false,\n reason: [ErrorType.MultipleAuthNotSupported],\n };\n }\n\n for (const auths of authSchemeArray) {\n if (auths.length === 1) {\n if (\n (this.options.allowAPIKeyAuth && Utils.isAPIKeyAuth(auths[0].authScheme)) ||\n (this.options.allowOauth2 && Utils.isOAuthWithAuthCodeFlow(auths[0].authScheme)) ||\n (this.options.allowBearerTokenAuth && Utils.isBearerTokenAuth(auths[0].authScheme))\n ) {\n return { isValid: true, reason: [] };\n }\n }\n }\n }\n\n return { isValid: false, reason: [ErrorType.AuthTypeIsNotSupported] };\n }\n\n protected checkPostBodySchema(\n schema: OpenAPIV3.SchemaObject,\n isRequired = false\n ): CheckParamResult {\n const paramResult: CheckParamResult = {\n requiredNum: 0,\n optionalNum: 0,\n isValid: true,\n reason: [],\n };\n\n if (Object.keys(schema).length === 0) {\n return paramResult;\n }\n\n const isRequiredWithoutDefault = isRequired && schema.default === undefined;\n const isCopilot = this.projectType === ProjectType.Copilot;\n\n if (isCopilot && this.hasNestedObjectInSchema(schema)) {\n paramResult.isValid = false;\n paramResult.reason = [ErrorType.RequestBodyContainsNestedObject];\n return paramResult;\n }\n\n if (\n schema.type === \"string\" ||\n schema.type === \"integer\" ||\n schema.type === \"boolean\" ||\n schema.type === \"number\"\n ) {\n if (isRequiredWithoutDefault) {\n paramResult.requiredNum = paramResult.requiredNum + 1;\n } else {\n paramResult.optionalNum = paramResult.optionalNum + 1;\n }\n } else if (schema.type === \"object\") {\n const { properties } = schema;\n for (const property in properties) {\n let isRequired = false;\n if (schema.required && schema.required?.indexOf(property) >= 0) {\n isRequired = true;\n }\n const result = this.checkPostBodySchema(\n properties[property] as OpenAPIV3.SchemaObject,\n isRequired\n );\n paramResult.requiredNum += result.requiredNum;\n paramResult.optionalNum += result.optionalNum;\n paramResult.isValid = paramResult.isValid && result.isValid;\n paramResult.reason.push(...result.reason);\n }\n } else {\n if (isRequiredWithoutDefault && !isCopilot) {\n paramResult.isValid = false;\n paramResult.reason.push(ErrorType.PostBodyContainsRequiredUnsupportedSchema);\n }\n }\n return paramResult;\n }\n\n protected checkParamSchema(paramObject: OpenAPIV3.ParameterObject[]): CheckParamResult {\n const paramResult: CheckParamResult = {\n requiredNum: 0,\n optionalNum: 0,\n isValid: true,\n reason: [],\n };\n\n if (!paramObject) {\n return paramResult;\n }\n\n const isCopilot = this.projectType === ProjectType.Copilot;\n\n for (let i = 0; i < paramObject.length; i++) {\n const param = paramObject[i];\n const schema = param.schema as OpenAPIV3.SchemaObject;\n\n if (isCopilot && this.hasNestedObjectInSchema(schema)) {\n paramResult.isValid = false;\n paramResult.reason.push(ErrorType.ParamsContainsNestedObject);\n continue;\n }\n\n const isRequiredWithoutDefault = param.required && schema.default === undefined;\n\n if (isCopilot) {\n if (isRequiredWithoutDefault) {\n paramResult.requiredNum = paramResult.requiredNum + 1;\n } else {\n paramResult.optionalNum = paramResult.optionalNum + 1;\n }\n continue;\n }\n\n if (param.in === \"header\" || param.in === \"cookie\") {\n if (isRequiredWithoutDefault) {\n paramResult.isValid = false;\n paramResult.reason.push(ErrorType.ParamsContainRequiredUnsupportedSchema);\n }\n continue;\n }\n\n if (\n schema.type !== \"boolean\" &&\n schema.type !== \"string\" &&\n schema.type !== \"number\" &&\n schema.type !== \"integer\"\n ) {\n if (isRequiredWithoutDefault) {\n paramResult.isValid = false;\n paramResult.reason.push(ErrorType.ParamsContainRequiredUnsupportedSchema);\n }\n continue;\n }\n\n if (param.in === \"query\" || param.in === \"path\") {\n if (isRequiredWithoutDefault) {\n paramResult.requiredNum = paramResult.requiredNum + 1;\n } else {\n paramResult.optionalNum = paramResult.optionalNum + 1;\n }\n }\n }\n\n return paramResult;\n }\n\n private hasNestedObjectInSchema(schema: OpenAPIV3.SchemaObject): boolean {\n if (schema.type === \"object\") {\n for (const property in schema.properties) {\n const nestedSchema = schema.properties[property] as OpenAPIV3.SchemaObject;\n if (nestedSchema.type === \"object\") {\n return true;\n }\n }\n }\n return false;\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\"use strict\";\n\nimport { OpenAPIV3 } from \"openapi-types\";\nimport {\n ParseOptions,\n APIValidationResult,\n ErrorType,\n ProjectType,\n SpecValidationResult,\n} from \"../interfaces\";\nimport { Validator } from \"./validator\";\n\nexport class CopilotValidator extends Validator {\n constructor(spec: OpenAPIV3.Document, options: ParseOptions) {\n super();\n this.projectType = ProjectType.Copilot;\n this.options = options;\n this.spec = spec;\n }\n\n validateSpec(): SpecValidationResult {\n const result: SpecValidationResult = { errors: [], warnings: [] };\n\n // validate spec version\n let validationResult = this.validateSpecVersion();\n result.errors.push(...validationResult.errors);\n\n // validate spec server\n validationResult = this.validateSpecServer();\n result.errors.push(...validationResult.errors);\n\n // validate no supported API\n validationResult = this.validateSpecNoSupportAPI();\n result.errors.push(...validationResult.errors);\n\n // validate operationId missing\n validationResult = this.validateSpecOperationId();\n result.warnings.push(...validationResult.warnings);\n\n return result;\n }\n\n validateAPI(method: string, path: string): APIValidationResult {\n const result: APIValidationResult = { isValid: true, reason: [] };\n method = method.toLocaleLowerCase();\n\n // validate method and path\n const methodAndPathResult = this.validateMethodAndPath(method, path);\n if (!methodAndPathResult.isValid) {\n return methodAndPathResult;\n }\n\n const operationObject = (this.spec.paths[path] as any)[method] as OpenAPIV3.OperationObject;\n\n // validate auth\n const authCheckResult = this.validateAuth(method, path);\n result.reason.push(...authCheckResult.reason);\n\n // validate operationId\n if (!this.options.allowMissingId && !operationObject.operationId) {\n result.reason.push(ErrorType.MissingOperationId);\n }\n\n // validate server\n const validateServerResult = this.validateServer(method, path);\n result.reason.push(...validateServerResult.reason);\n\n // validate response\n const validateResponseResult = this.validateResponse(method, path);\n result.reason.push(...validateResponseResult.reason);\n\n // validate requestBody\n const requestBody = operationObject.requestBody as OpenAPIV3.RequestBodyObject;\n const requestJsonBody = requestBody?.content[\"application/json\"];\n\n if (requestJsonBody) {\n const requestBodySchema = requestJsonBody.schema as OpenAPIV3.SchemaObject;\n\n if (requestBodySchema.type !== \"object\") {\n result.reason.push(ErrorType.PostBodySchemaIsNotJson);\n }\n\n const requestBodyParamResult = this.checkPostBodySchema(\n requestBodySchema,\n requestBody.required\n );\n result.reason.push(...requestBodyParamResult.reason);\n }\n\n // validate parameters\n const paramObject = operationObject.parameters as OpenAPIV3.ParameterObject[];\n const paramResult = this.checkParamSchema(paramObject);\n result.reason.push(...paramResult.reason);\n\n if (result.reason.length > 0) {\n result.isValid = false;\n }\n\n return result;\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\"use strict\";\n\nimport { OpenAPIV3 } from \"openapi-types\";\nimport {\n ParseOptions,\n APIValidationResult,\n ErrorType,\n ProjectType,\n CheckParamResult,\n SpecValidationResult,\n} from \"../interfaces\";\nimport { Validator } from \"./validator\";\nimport { Utils } from \"../utils\";\n\nexport class SMEValidator extends Validator {\n private static readonly SMERequiredParamsMaxNum = 5;\n\n constructor(spec: OpenAPIV3.Document, options: ParseOptions) {\n super();\n this.projectType = ProjectType.SME;\n this.options = options;\n this.spec = spec;\n }\n\n validateSpec(): SpecValidationResult {\n const result: SpecValidationResult = { errors: [], warnings: [] };\n\n // validate spec version\n let validationResult = this.validateSpecVersion();\n result.errors.push(...validationResult.errors);\n\n // validate spec server\n validationResult = this.validateSpecServer();\n result.errors.push(...validationResult.errors);\n\n // validate no supported API\n validationResult = this.validateSpecNoSupportAPI();\n result.errors.push(...validationResult.errors);\n\n // validate operationId missing\n if (this.options.allowMissingId) {\n validationResult = this.validateSpecOperationId();\n result.warnings.push(...validationResult.warnings);\n }\n\n return result;\n }\n\n validateAPI(method: string, path: string): APIValidationResult {\n const result: APIValidationResult = { isValid: true, reason: [] };\n method = method.toLocaleLowerCase();\n\n // validate method and path\n const methodAndPathResult = this.validateMethodAndPath(method, path);\n if (!methodAndPathResult.isValid) {\n return methodAndPathResult;\n }\n\n const operationObject = (this.spec.paths[path] as any)[method] as OpenAPIV3.OperationObject;\n\n // validate auth\n const authCheckResult = this.validateAuth(method, path);\n result.reason.push(...authCheckResult.reason);\n\n // validate operationId\n if (!this.options.allowMissingId && !operationObject.operationId) {\n result.reason.push(ErrorType.MissingOperationId);\n }\n\n // validate server\n const validateServerResult = this.validateServer(method, path);\n result.reason.push(...validateServerResult.reason);\n\n // validate response\n const validateResponseResult = this.validateResponse(method, path);\n result.reason.push(...validateResponseResult.reason);\n\n let postBodyResult: CheckParamResult = {\n requiredNum: 0,\n optionalNum: 0,\n isValid: true,\n reason: [],\n };\n\n // validate requestBody\n const requestBody = operationObject.requestBody as OpenAPIV3.RequestBodyObject;\n const requestJsonBody = requestBody?.content[\"application/json\"];\n\n if (Utils.containMultipleMediaTypes(requestBody)) {\n result.reason.push(ErrorType.PostBodyContainMultipleMediaTypes);\n }\n\n if (requestJsonBody) {\n const requestBodySchema = requestJsonBody.schema as OpenAPIV3.SchemaObject;\n\n postBodyResult = this.checkPostBodySchema(requestBodySchema, requestBody.required);\n result.reason.push(...postBodyResult.reason);\n }\n\n // validate parameters\n const paramObject = operationObject.parameters as OpenAPIV3.ParameterObject[];\n const paramResult = this.checkParamSchema(paramObject);\n result.reason.push(...paramResult.reason);\n\n // validate total parameters count\n if (paramResult.isValid && postBodyResult.isValid) {\n const paramCountResult = this.validateParamCount(postBodyResult, paramResult);\n result.reason.push(...paramCountResult.reason);\n }\n\n if (result.reason.length > 0) {\n result.isValid = false;\n }\n\n return result;\n }\n\n private validateParamCount(\n postBodyResult: CheckParamResult,\n paramResult: CheckParamResult\n ): APIValidationResult {\n const result: APIValidationResult = { isValid: true, reason: [] };\n const totalRequiredParams = postBodyResult.requiredNum + paramResult.requiredNum;\n const totalParams = totalRequiredParams + postBodyResult.optionalNum + paramResult.optionalNum;\n\n if (totalRequiredParams > 1) {\n if (\n !this.options.allowMultipleParameters ||\n totalRequiredParams > SMEValidator.SMERequiredParamsMaxNum\n ) {\n result.reason.push(ErrorType.ExceededRequiredParamsLimit);\n }\n } else if (totalParams === 0) {\n result.reason.push(ErrorType.NoParameter);\n }\n\n return result;\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\"use strict\";\n\nimport { OpenAPIV3 } from \"openapi-types\";\nimport {\n ParseOptions,\n APIValidationResult,\n ErrorType,\n ProjectType,\n SpecValidationResult,\n} from \"../interfaces\";\nimport { Validator } from \"./validator\";\n\nexport class TeamsAIValidator extends Validator {\n constructor(spec: OpenAPIV3.Document, options: ParseOptions) {\n super();\n this.projectType = ProjectType.TeamsAi;\n this.options = options;\n this.spec = spec;\n }\n\n validateSpec(): SpecValidationResult {\n const result: SpecValidationResult = { errors: [], warnings: [] };\n\n // validate spec server\n let validationResult = this.validateSpecServer();\n result.errors.push(...validationResult.errors);\n\n // validate no supported API\n validationResult = this.validateSpecNoSupportAPI();\n result.errors.push(...validationResult.errors);\n\n return result;\n }\n\n validateAPI(method: string, path: string): APIValidationResult {\n const result: APIValidationResult = { isValid: true, reason: [] };\n method = method.toLocaleLowerCase();\n\n // validate method and path\n const methodAndPathResult = this.validateMethodAndPath(method, path);\n if (!methodAndPathResult.isValid) {\n return methodAndPathResult;\n }\n\n const operationObject = (this.spec.paths[path] as any)[method] as OpenAPIV3.OperationObject;\n\n // validate operationId\n if (!this.options.allowMissingId && !operationObject.operationId) {\n result.reason.push(ErrorType.MissingOperationId);\n }\n\n // validate server\n const validateServerResult = this.validateServer(method, path);\n result.reason.push(...validateServerResult.reason);\n\n if (result.reason.length > 0) {\n result.isValid = false;\n }\n\n return result;\n }\n}\n","import { OpenAPIV3 } from \"openapi-types\";\nimport { ParseOptions, ProjectType } from \"../interfaces\";\nimport { CopilotValidator } from \"./copilotValidator\";\nimport { SMEValidator } from \"./smeValidator\";\nimport { TeamsAIValidator } from \"./teamsAIValidator\";\nimport { Validator } from \"./validator\";\n\nexport class ValidatorFactory {\n static create(spec: OpenAPIV3.Document, options: ParseOptions): Validator {\n const type = options.projectType ?? ProjectType.SME;\n\n switch (type) {\n case ProjectType.SME:\n return new SMEValidator(spec, options);\n case ProjectType.Copilot:\n return new CopilotValidator(spec, options);\n case ProjectType.TeamsAi:\n return new TeamsAIValidator(spec, options);\n default:\n throw new Error(`Invalid project type: ${type}`);\n }\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\"use strict\";\n\nimport { OpenAPIV3 } from \"openapi-types\";\nimport { Utils } from \"./utils\";\nimport { SpecParserError } from \"./specParserError\";\nimport { ErrorType, ParseOptions } from \"./interfaces\";\nimport { ConstantString } from \"./constants\";\nimport { ValidatorFactory } from \"./validators/validatorFactory\";\n\nexport class SpecFilter {\n static specFilter(\n filter: string[],\n unResolveSpec: OpenAPIV3.Document,\n resolvedSpec: OpenAPIV3.Document,\n options: ParseOptions\n ): OpenAPIV3.Document {\n try {\n const newSpec = { ...unResolveSpec };\n const newPaths: OpenAPIV3.PathsObject = {};\n for (const filterItem of filter) {\n const [method, path] = filterItem.split(\" \");\n const methodName = method.toLowerCase();\n\n const pathObj = resolvedSpec.paths?.[path] as any;\n if (\n ConstantString.AllOperationMethods.includes(methodName) &&\n pathObj &&\n pathObj[methodName]\n ) {\n const validator = ValidatorFactory.create(resolvedSpec, options);\n const validateResult = validator.validateAPI(methodName, path);\n\n if (!validateResult.isValid) {\n continue;\n }\n\n if (!newPaths[path]) {\n newPaths[path] = { ...unResolveSpec.paths[path] };\n for (const m of ConstantString.AllOperationMethods) {\n delete (newPaths[path] as any)[m];\n }\n }\n\n (newPaths[path] as any)[methodName] = (unResolveSpec.paths[path] as any)[methodName];\n\n // Add the operationId if missing\n if (!(newPaths[path] as any)[methodName].operationId) {\n (newPaths[path] as any)[\n methodName\n ].operationId = `${methodName}${Utils.convertPathToCamelCase(path)}`;\n }\n }\n }\n\n newSpec.paths = newPaths;\n return newSpec;\n } catch (err) {\n throw new SpecParserError((err as Error).toString(), ErrorType.FilterSpecFailed);\n }\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\"use strict\";\n\nimport { OpenAPIV3 } from \"openapi-types\";\nimport { Utils } from \"./utils\";\nimport {\n AdaptiveCard,\n ArrayElement,\n ErrorType,\n ImageElement,\n TextBlockElement,\n} from \"./interfaces\";\nimport { ConstantString } from \"./constants\";\nimport { SpecParserError } from \"./specParserError\";\n\nexport class AdaptiveCardGenerator {\n static generateAdaptiveCard(operationItem: OpenAPIV3.OperationObject): [AdaptiveCard, string] {\n try {\n const { json } = Utils.getResponseJson(operationItem);\n\n let cardBody: Array<TextBlockElement | ImageElement | ArrayElement> = [];\n\n let schema = json.schema as OpenAPIV3.SchemaObject;\n let jsonPath = \"$\";\n if (schema && Object.keys(schema).length > 0) {\n jsonPath = AdaptiveCardGenerator.getResponseJsonPathFromSchema(schema);\n if (jsonPath !== \"$\") {\n schema = schema.properties![jsonPath] as OpenAPIV3.SchemaObject;\n }\n\n cardBody = AdaptiveCardGenerator.generateCardFromResponse(schema, \"\");\n }\n\n // if no schema, try to use example value\n if (cardBody.length === 0 && (json.examples || json.example)) {\n cardBody = [\n {\n type: ConstantString.TextBlockType,\n text: \"${jsonStringify($root)}\",\n wrap: true,\n },\n ];\n }\n\n // if no example value, use default success response\n if (cardBody.length === 0) {\n cardBody = [\n {\n type: ConstantString.TextBlockType,\n text: \"success\",\n wrap: true,\n },\n ];\n }\n\n const fullCard: AdaptiveCard = {\n type: ConstantString.AdaptiveCardType,\n $schema: ConstantString.AdaptiveCardSchema,\n version: ConstantString.AdaptiveCardVersion,\n body: cardBody,\n };\n\n return [fullCard, jsonPath];\n } catch (err) {\n throw new SpecParserError((err as Error).toString(), ErrorType.GenerateAdaptiveCardFailed);\n }\n }\n\n static generateCardFromResponse(\n schema: OpenAPIV3.SchemaObject,\n name: string,\n parentArrayName = \"\"\n ): Array<TextBlockElement | ImageElement | ArrayElement> {\n if (schema.type === \"array\") {\n // schema.items can be arbitrary object: schema { type: array, items: {} }\n if (Object.keys(schema.items).length === 0) {\n return [\n {\n type: ConstantString.TextBlockType,\n text: name ? `${name}: \\${jsonStringify(${name})}` : \"result: ${jsonStringify($root)}\",\n wrap: true,\n },\n ];\n }\n\n const obj = AdaptiveCardGenerator.generateCardFromResponse(\n schema.items as OpenAPIV3.SchemaObject,\n \"\",\n name\n );\n const template = {\n type: ConstantString.ContainerType,\n $data: name ? `\\${${name}}` : \"${$root}\",\n items: Array<TextBlockElement | ImageElement | ArrayElement>(),\n };\n\n template.items.push(...obj);\n return [template];\n }\n // some schema may not contain type but contain properties\n if (schema.type === \"object\" || (!schema.type && schema.properties)) {\n const { properties } = schema;\n const result: Array<TextBlockElement | ImageElement | ArrayElement> = [];\n for (const property in properties) {\n const obj = AdaptiveCardGenerator.generateCardFromResponse(\n properties[property] as OpenAPIV3.SchemaObject,\n name ? `${name}.${property}` : property,\n parentArrayName\n );\n result.push(...obj);\n }\n\n if (schema.additionalProperties) {\n // TODO: better ways to handler warnings.\n console.warn(ConstantString.AdditionalPropertiesNotSupported);\n }\n\n return result;\n }\n if (\n schema.type === \"string\" ||\n schema.type === \"integer\" ||\n schema.type === \"boolean\" ||\n schema.type === \"number\"\n ) {\n if (!AdaptiveCardGenerator.isImageUrlProperty(schema, name, parentArrayName)) {\n // string in root: \"ddd\"\n let text = \"result: ${$root}\";\n if (name) {\n // object { id: \"1\" }\n text = `${name}: \\${if(${name}, ${name}, 'N/A')}`;\n if (parentArrayName) {\n // object types inside array: { tags: [\"id\": 1, \"name\": \"name\"] }\n text = `${parentArrayName}.${text}`;\n }\n } else if (parentArrayName) {\n // string array: photoUrls: [\"1\", \"2\"]\n text = `${parentArrayName}: ` + \"${$data}\";\n }\n\n return [\n {\n type: ConstantString.TextBlockType,\n text,\n wrap: true,\n },\n ];\n } else {\n if (name) {\n return [\n {\n type: \"Image\",\n url: `\\${${name}}`,\n $when: `\\${${name} != null}`,\n },\n ];\n } else {\n return [\n {\n type: \"Image\",\n url: \"${$data}\",\n $when: \"${$data != null}\",\n },\n ];\n }\n }\n }\n\n if (schema.oneOf || schema.anyOf || schema.not || schema.allOf) {\n throw new Error(Utils.format(ConstantString.SchemaNotSupported, JSON.stringify(schema)));\n }\n\n throw new Error(Utils.format(ConstantString.UnknownSchema, JSON.stringify(schema)));\n }\n\n // Find the first array property in the response schema object with the well-known name\n static getResponseJsonPathFromSchema(schema: OpenAPIV3.SchemaObject): string {\n if (schema.type === \"object\" || (!schema.type && schema.properties)) {\n const { properties } = schema;\n for (const property in properties) {\n const schema = properties[property] as OpenAPIV3.SchemaObject;\n if (\n schema.type === \"array\" &&\n Utils.isWellKnownName(property, ConstantString.WellknownResultNames)\n ) {\n return property;\n }\n }\n }\n\n return \"$\";\n }\n\n static isImageUrlProperty(\n schema: OpenAPIV3.NonArraySchemaObject,\n name: string,\n parentArrayName: string\n ): boolean {\n const propertyName = name ? name : parentArrayName;\n return (\n !!propertyName &&\n schema.type === \"string\" &&\n Utils.isWellKnownName(propertyName, ConstantString.WellknownImageName) &&\n (propertyName.toLocaleLowerCase().indexOf(\"url\") >= 0 || schema.format === \"uri\")\n );\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\"use strict\";\n\nimport { ResponseSemanticsObject } from \"@microsoft/teams-manifest\";\nimport { ConstantString } from \"./constants\";\nimport {\n AdaptiveCard,\n ArrayElement,\n ImageElement,\n InferredProperties,\n PreviewCardTemplate,\n TextBlockElement,\n WrappedAdaptiveCard,\n} from \"./interfaces\";\nimport { Utils } from \"./utils\";\n\nexport function wrapAdaptiveCard(card: AdaptiveCard, jsonPath: string): WrappedAdaptiveCard {\n const result: WrappedAdaptiveCard = {\n version: ConstantString.WrappedCardVersion,\n $schema: ConstantString.WrappedCardSchema,\n jsonPath: jsonPath,\n responseLayout: ConstantString.WrappedCardResponseLayout,\n responseCardTemplate: card,\n previewCardTemplate: inferPreviewCardTemplate(card),\n };\n\n return result;\n}\n\nexport function wrapResponseSemantics(\n card: AdaptiveCard,\n jsonPath: string\n): ResponseSemanticsObject {\n const props = inferProperties(card);\n const dataPath = jsonPath === \"$\" ? \"$\" : \"$.\" + jsonPath;\n const result: ResponseSemanticsObject = {\n data_path: dataPath,\n };\n\n if (props.title || props.subtitle || props.imageUrl) {\n result.properties = {};\n if (props.title) {\n result.properties.title = \"$.\" + props.title;\n }\n\n if (props.subtitle) {\n result.properties.subtitle = \"$.\" + props.subtitle;\n }\n\n if (props.imageUrl) {\n result.properties.url = \"$.\" + props.imageUrl;\n }\n }\n\n result.static_template = card as any;\n\n return result;\n}\n\n/**\n * Infers the preview card template from an Adaptive Card and a JSON path.\n * The preview card template includes a title and an optional subtitle and image.\n * It populates the preview card template with the first text block that matches\n * each well-known name, in the order of title, subtitle, and image.\n * If no text block matches the title or subtitle, it uses the first two text block as the title and subtitle.\n * If the title is still empty and the subtitle is not empty, it uses subtitle as the title.\n * @param card The Adaptive Card to infer the preview card template from.\n * @param jsonPath The JSON path to the root object in the card body.\n * @returns The inferred preview card template.\n */\nexport function inferPreviewCardTemplate(card: AdaptiveCard): PreviewCardTemplate {\n const result: PreviewCardTemplate = {\n title: \"result\",\n };\n const inferredProperties = inferProperties(card);\n if (inferredProperties.title) {\n result.title = `\\${if(${inferredProperties.title}, ${inferredProperties.title}, 'N/A')}`;\n }\n\n if (inferredProperties.subtitle) {\n result.subtitle = `\\${if(${inferredProperties.subtitle}, ${inferredProperties.subtitle}, 'N/A')}`;\n }\n\n if (inferredProperties.imageUrl) {\n result.image = {\n url: `\\${${inferredProperties.imageUrl}}`,\n alt: `\\${if(${inferredProperties.imageUrl}, ${inferredProperties.imageUrl}, 'N/A')}`,\n $when: `\\${${inferredProperties.imageUrl} != null}`,\n };\n }\n\n return result;\n}\n\nfunction inferProperties(card: AdaptiveCard): InferredProperties {\n const result: InferredProperties = {};\n\n const nameSet = new Set<string>();\n\n let rootObject: (TextBlockElement | ArrayElement | ImageElement)[];\n if (card.body[0]?.type === ConstantString.ContainerType) {\n rootObject = (card.body[0] as ArrayElement).items;\n } else {\n rootObject = card.body;\n }\n\n for (const element of rootObject) {\n if (element.type === ConstantString.TextBlockType) {\n const textElement = element as TextBlockElement;\n const index = textElement.text.indexOf(\"${if(\");\n if (index > 0) {\n const text = textElement.text.substring(index);\n const match = text.match(/\\${if\\(([^,]+),/);\n const property = match ? match[1] : \"\";\n if (property) {\n nameSet.add(property);\n }\n }\n } else if (element.type === ConstantString.ImageType) {\n const imageElement = element as ImageElement;\n const match = imageElement.url.match(/\\${([^,]+)}/);\n const property = match ? match[1] : \"\";\n if (property) {\n nameSet.add(property);\n }\n }\n }\n\n for (const name of nameSet) {\n if (!result.title && Utils.isWellKnownName(name, ConstantString.WellknownTitleName)) {\n result.title = name;\n nameSet.delete(name);\n } else if (\n !result.subtitle &&\n Utils.isWellKnownName(name, ConstantString.WellknownSubtitleName)\n ) {\n result.subtitle = name;\n nameSet.delete(name);\n } else if (!result.imageUrl && Utils.isWellKnownName(name, ConstantString.WellknownImageName)) {\n result.imageUrl = name;\n nameSet.delete(name);\n }\n }\n\n for (const name of nameSet) {\n if (!result.title) {\n result.title = name;\n nameSet.delete(name);\n } else if (!result.subtitle) {\n result.subtitle = name;\n nameSet.delete(name);\n }\n }\n\n if (!result.title && result.subtitle) {\n result.title = result.subtitle;\n delete result.subtitle;\n }\n\n return result;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\"use strict\";\n\nimport { OpenAPIV3 } from \"openapi-types\";\nimport fs from \"fs-extra\";\nimport path from \"path\";\nimport {\n AuthInfo,\n ErrorType,\n ParseOptions,\n ProjectType,\n WarningResult,\n WarningType,\n} from \"./interfaces\";\nimport { Utils } from \"./utils\";\nimport { SpecParserError } from \"./specParserError\";\nimport { ConstantString } from \"./constants\";\nimport {\n IComposeExtension,\n IMessagingExtensionCommand,\n TeamsAppManifest,\n PluginManifestSchema,\n FunctionObject,\n AuthObject,\n} from \"@microsoft/teams-manifest\";\nimport { AdaptiveCardGenerator } from \"./adaptiveCardGenerator\";\nimport { wrapResponseSemantics } from \"./adaptiveCardWrapper\";\n\nexport class ManifestUpdater {\n static async updateManifestWithAiPlugin(\n manifestPath: string,\n outputSpecPath: string,\n apiPluginFilePath: string,\n spec: OpenAPIV3.Document,\n options: ParseOptions,\n authInfo?: AuthInfo\n ): Promise<[TeamsAppManifest, PluginManifestSchema, WarningResult[]]> {\n const manifest: TeamsAppManifest = await fs.readJSON(manifestPath);\n const apiPluginRelativePath = ManifestUpdater.getRelativePath(manifestPath, apiPluginFilePath);\n manifest.copilotExtensions = manifest.copilotExtensions || {};\n // Insert plugins in manifest.json if it is plugin for Copilot.\n if (!options.isGptPlugin) {\n manifest.copilotExtensions.plugins = [\n {\n file: apiPluginRelativePath,\n id: ConstantString.DefaultPluginId,\n },\n ];\n ManifestUpdater.updateManifestDescription(manifest, spec);\n }\n\n const appName = this.removeEnvs(manifest.name.short);\n\n const specRelativePath = ManifestUpdater.getRelativePath(manifestPath, outputSpecPath);\n const [apiPlugin, warnings] = await ManifestUpdater.generatePluginManifestSchema(\n spec,\n specRelativePath,\n apiPluginFilePath,\n appName,\n authInfo,\n options\n );\n\n return [manifest, apiPlugin, warnings];\n }\n\n static updateManifestDescription(manifest: TeamsAppManifest, spec: OpenAPIV3.Document): void {\n manifest.description = {\n short: spec.info.title.slice(0, ConstantString.ShortDescriptionMaxLens),\n full: (spec.info.description ?? manifest.description.full)?.slice(\n 0,\n ConstantString.FullDescriptionMaxLens\n ),\n };\n }\n\n static checkSchema(schema: OpenAPIV3.SchemaObject, method: string, pathUrl: string): void {\n if (schema.type === \"array\") {\n const items = schema.items as OpenAPIV3.SchemaObject;\n ManifestUpdater.checkSchema(items, method, pathUrl);\n } else if (\n schema.type !== \"string\" &&\n schema.type !== \"boolean\" &&\n schema.type !== \"integer\" &&\n schema.type !== \"number\"\n ) {\n throw new SpecParserError(\n Utils.format(ConstantString.UnsupportedSchema, method, pathUrl, JSON.stringify(schema)),\n ErrorType.UpdateManifestFailed\n );\n }\n }\n\n static async generatePluginManifestSchema(\n spec: OpenAPIV3.Document,\n specRelativePath: string,\n apiPluginFilePath: string,\n appName: string,\n authInfo: AuthInfo | undefined,\n options: ParseOptions\n ): Promise<[PluginManifestSchema, WarningResult[]]> {\n const warnings: WarningResult[] = [];\n const functions: FunctionObject[] = [];\n const functionNames: string[] = [];\n const conversationStarters: string[] = [];\n\n const paths = spec.paths;\n\n const pluginAuthObj: AuthObject = {\n type: \"None\",\n };\n\n if (authInfo) {\n if (Utils.isOAuthWithAuthCodeFlow(authInfo.authScheme)) {\n pluginAuthObj.type = \"OAuthPluginVault\";\n } else if (Utils.isBearerTokenAuth(authInfo.authScheme)) {\n pluginAuthObj.type = \"ApiKeyPluginVault\";\n }\n\n if (pluginAuthObj.type !== \"None\") {\n const safeRegistrationIdName = Utils.getSafeRegistrationIdEnvName(\n `${authInfo.name}_${ConstantString.RegistrationIdPostfix[authInfo.authScheme.type]}`\n );\n\n pluginAuthObj.reference_id = `\\${{${safeRegistrationIdName}}}`;\n }\n }\n\n for (const pathUrl in paths) {\n const pathItem = paths[pathUrl];\n if (pathItem) {\n const operations = pathItem;\n for (const method in operations) {\n if (options.allowMethods!.includes(method)) {\n const operationItem = (operations as any)[method] as OpenAPIV3.OperationObject;\n const confirmationBodies: string[] = [];\n if (operationItem) {\n const operationId = operationItem.operationId!;\n const description = operationItem.description ?? \"\";\n const summary = operationItem.summary;\n const paramObject = operationItem.parameters as OpenAPIV3.ParameterObject[];\n const requestBody = operationItem.requestBody as OpenAPIV3.ParameterObject;\n\n if (paramObject) {\n for (let i = 0; i < paramObject.length; i++) {\n const param = paramObject[i];\n const schema = param.schema as OpenAPIV3.SchemaObject;\n ManifestUpdater.checkSchema(schema, method, pathUrl);\n confirmationBodies.push(ManifestUpdater.getConfirmationBodyItem(param.name));\n }\n }\n\n if (requestBody) {\n const requestJsonBody = requestBody.content![\"application/json\"];\n const requestBodySchema = requestJsonBody.schema as OpenAPIV3.SchemaObject;\n if (requestBodySchema.type === \"object\") {\n for (const property in requestBodySchema.properties) {\n const schema = requestBodySchema.properties[property] as OpenAPIV3.SchemaObject;\n ManifestUpdater.checkSchema(schema, method, pathUrl);\n confirmationBodies.push(ManifestUpdater.getConfirmationBodyItem(property));\n }\n } else {\n throw new SpecParserError(\n Utils.format(\n ConstantString.UnsupportedSchema,\n method,\n pathUrl,\n JSON.stringify(requestBodySchema)\n ),\n ErrorType.UpdateManifestFailed\n );\n }\n }\n\n const funcObj: FunctionObject = {\n name: operationId,\n description: description,\n };\n\n if (options.allowResponseSemantics) {\n try {\n const { json } = Utils.getResponseJson(operationItem);\n if (json.schema) {\n const [card, jsonPath] =\n AdaptiveCardGenerator.generateAdaptiveCard(operationItem);\n\n card.body = card.body.slice(0, 5);\n const responseSemantic = wrapResponseSemantics(card, jsonPath);\n funcObj.capabilities = {\n response_semantics: responseSemantic,\n };\n }\n } catch (err) {\n warnings.push({\n type: WarningType.GenerateCardFailed,\n content: (err as Error).toString(),\n data: operationId,\n });\n }\n }\n\n if (options.allowConfirmation && method !== ConstantString.GetMethod) {\n if (!funcObj.capabilities) {\n funcObj.capabilities = {};\n }\n\n funcObj.capabilities.confirmation = {\n type: \"AdaptiveCard\",\n title: operationItem.summary ?? description,\n };\n\n if (confirmationBodies.length > 0) {\n funcObj.capabilities.confirmation.body = confirmationBodies.join(\"\\n\");\n }\n }\n\n functions.push(funcObj);\n functionNames.push(operationId);\n const conversationStarterStr = (summary ?? description).slice(\n 0,\n ConstantString.ConversationStarterMaxLens\n );\n if (conversationStarterStr) {\n conversationStarters.push(conversationStarterStr);\n }\n }\n }\n }\n }\n }\n\n let apiPlugin: PluginManifestSchema;\n if (await fs.pathExists(apiPluginFilePath)) {\n apiPlugin = await fs.readJSON(apiPluginFilePath);\n } else {\n apiPlugin = {\n $schema: ConstantString.PluginManifestSchema,\n schema_version: \"v2.1\",\n name_for_human: \"\",\n description_for_human: \"\",\n namespace: \"\",\n functions: [],\n runtimes: [],\n };\n }\n\n apiPlugin.functions = apiPlugin.functions || [];\n\n for (const func of functions) {\n const index = apiPlugin.functions?.findIndex((f) => f.name === func.name);\n if (index === -1) {\n apiPlugin.functions.push(func);\n } else {\n apiPlugin.functions[index] = func;\n }\n }\n\n apiPlugin.runtimes = apiPlugin.runtimes || [];\n const index = apiPlugin.runtimes.findIndex(\n (runtime) =>\n runtime.spec.url === specRelativePath &&\n runtime.type === \"OpenApi\" &&\n (runtime.auth?.type ?? \"None\") === pluginAuthObj.type\n );\n if (index === -1) {\n apiPlugin.runtimes.push({\n type: \"OpenApi\",\n auth: pluginAuthObj,\n spec: {\n url: specRelativePath,\n },\n run_for_functions: functionNames,\n });\n } else {\n apiPlugin.runtimes[index].run_for_functions = functionNames;\n }\n\n if (!apiPlugin.name_for_human) {\n apiPlugin.name_for_human = appName;\n }\n\n if (!apiPlugin.namespace) {\n apiPlugin.namespace = ManifestUpdater.removeAllSpecialCharacters(appName);\n }\n\n if (!apiPlugin.description_for_human) {\n apiPlugin.description_for_human =\n spec.info.description ?? \"<Please add description of the plugin>\";\n }\n\n if (options.allowConversationStarters && conversationStarters.length > 0) {\n if (!apiPlugin.capabilities) {\n apiPlugin.capabilities = {\n localization: {},\n };\n }\n if (!apiPlugin.capabilities.conversation_starters) {\n apiPlugin.capabilities.conversation_starters = conversationStarters\n .slice(0, 5)\n .map((text) => ({ text }));\n }\n }\n\n return [apiPlugin, warnings];\n }\n\n static async updateManifest(\n manifestPath: string,\n outputSpecPath: string,\n spec: OpenAPIV3.Document,\n options: ParseOptions,\n adaptiveCardFolder?: string,\n authInfo?: AuthInfo\n ): Promise<[TeamsAppManifest, WarningResult[]]> {\n try {\n const originalManifest: TeamsAppManifest = await fs.readJSON(manifestPath);\n const updatedPart: any = {};\n updatedPart.composeExtensions = [];\n let warnings: WarningResult[] = [];\n\n if (options.projectType === ProjectType.SME) {\n const updateResult = await ManifestUpdater.generateCommands(\n spec,\n manifestPath,\n options,\n adaptiveCardFolder\n );\n const commands = updateResult[0];\n warnings = updateResult[1];\n\n const composeExtension: IComposeExtension = {\n composeExtensionType: \"apiBased\",\n apiSpecificationFile: ManifestUpdater.getRelativePath(manifestPath, outputSpecPath),\n commands: commands,\n };\n\n if (authInfo) {\n const auth = authInfo.authScheme;\n const safeRegistrationIdName = Utils.getSafeRegistrationIdEnvName(\n `${authInfo.name}_${ConstantString.RegistrationIdPostfix[authInfo.authScheme.type]}`\n );\n if (Utils.isAPIKeyAuth(auth) || Utils.isBearerTokenAuth(auth)) {\n const safeApiSecretRegistrationId = Utils.getSafeRegistrationIdEnvName(\n `${authInfo.name}_${ConstantString.RegistrationIdPostfix[authInfo.authScheme.type]}`\n );\n (composeExtension as any).authorization = {\n authType: \"apiSecretServiceAuth\",\n apiSecretServiceAuthConfiguration: {\n apiSecretRegistrationId: `\\${{${safeRegistrationIdName}}}`,\n },\n };\n } else if (Utils.isOAuthWithAuthCodeFlow(auth)) {\n (composeExtension as any).authorization = {\n authType: \"oAuth2.0\",\n oAuthConfiguration: {\n oauthConfigurationId: `\\${{${safeRegistrationIdName}}}`,\n },\n };\n\n updatedPart.webApplicationInfo = {\n id: \"${{AAD_APP_CLIENT_ID}}\",\n resource: \"api://${{DOMAIN}}/${{AAD_APP_CLIENT_ID}}\",\n };\n }\n }\n\n updatedPart.composeExtensions = [composeExtension];\n }\n\n updatedPart.description = originalManifest.description;\n ManifestUpdater.updateManifestDescription(updatedPart, spec);\n\n const updatedManifest = { ...originalManifest, ...updatedPart };\n\n return [updatedManifest, warnings];\n } catch (err) {\n throw new SpecParserError((err as Error).toString(), ErrorType.UpdateManifestFailed);\n }\n }\n\n static async generateCommands(\n spec: OpenAPIV3.Document,\n manifestPath: string,\n options: ParseOptions,\n adaptiveCardFolder?: string\n ): Promise<[IMessagingExtensionCommand[], WarningResult[]]> {\n const paths = spec.paths;\n const commands: IMessagingExtensionCommand[] = [];\n const warnings: WarningResult[] = [];\n if (paths) {\n for (const pathUrl in paths) {\n const pathItem = paths[pathUrl];\n if (pathItem) {\n const operations = pathItem;\n\n // Currently only support GET and POST method\n for (const method in operations) {\n if (options.allowMethods?.includes(method)) {\n const operationItem = (operations as any)[method];\n if (operationItem) {\n const command = Utils.parseApiInfo(operationItem, options);\n\n if (\n command.parameters &&\n command.parameters.length >= 1 &&\n command.parameters.some((param) => param.isRequired)\n ) {\n command.parameters = command.parameters.filter((param) => param.isRequired);\n } else if (command.parameters && command.parameters.length > 0) {\n command.parameters = [command.parameters[0]];\n warnings.push({\n type: WarningType.OperationOnlyContainsOptionalParam,\n content: Utils.format(\n ConstantString.OperationOnlyContainsOptionalParam,\n command.id\n ),\n data: command.id,\n });\n }\n\n if (adaptiveCardFolder) {\n const adaptiveCardPath = path.join(adaptiveCardFolder, command.id + \".json\");\n command.apiResponseRenderingTemplateFile = (await fs.pathExists(adaptiveCardPath))\n ? ManifestUpdater.getRelativePath(manifestPath, adaptiveCardPath)\n : \"\";\n }\n\n commands.push(command);\n }\n }\n }\n }\n }\n }\n\n return [commands, warnings];\n }\n\n static getRelativePath(from: string, to: string): string {\n const relativePath = path.relative(path.dirname(from), to);\n return path.normalize(relativePath).replace(/\\\\/g, \"/\");\n }\n\n static removeEnvs(str: string): string {\n const placeHolderReg = /\\${{\\s*([a-zA-Z_][a-zA-Z0-9_]*)\\s*}}/g;\n const matches = placeHolderReg.exec(str);\n let newStr = str;\n if (matches != null) {\n newStr = newStr.replace(matches[0], \"\");\n }\n return newStr;\n }\n\n static removeAllSpecialCharacters(str: string): string {\n return str.toLowerCase().replace(/[^a-z0-9]/g, \"\");\n }\n\n static getConfirmationBodyItem(paramName: string): string {\n return `* **${Utils.updateFirstLetter(paramName)}**: {{function.parameters.${paramName}}}`;\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\"use strict\";\n\nimport SwaggerParser from \"@apidevtools/swagger-parser\";\nimport { OpenAPIV3 } from \"openapi-types\";\nimport converter from \"swagger2openapi\";\nimport jsyaml from \"js-yaml\";\nimport fs from \"fs-extra\";\nimport path from \"path\";\nimport {\n APIInfo,\n APIMap,\n ErrorResult,\n ErrorType,\n GenerateResult,\n ListAPIInfo,\n ListAPIResult,\n ParseOptions,\n ProjectType,\n ValidateResult,\n ValidationStatus,\n WarningResult,\n WarningType,\n} from \"./interfaces\";\nimport { ConstantString } from \"./constants\";\nimport { SpecParserError } from \"./specParserError\";\nimport { SpecFilter } from \"./specFilter\";\nimport { Utils } from \"./utils\";\nimport { ManifestUpdater } from \"./manifestUpdater\";\nimport { AdaptiveCardGenerator } from \"./adaptiveCardGenerator\";\nimport { wrapAdaptiveCard } from \"./adaptiveCardWrapper\";\nimport { ValidatorFactory } from \"./validators/validatorFactory\";\nimport { Validator } from \"./validators/validator\";\n\n/**\n * A class that parses an OpenAPI specification file and provides methods to validate, list, and generate artifacts.\n */\nexport class SpecParser {\n public readonly pathOrSpec: string | OpenAPIV3.Document;\n public readonly parser: SwaggerParser;\n public readonly options: Required<ParseOptions>;\n\n private validator: Validator | undefined;\n private spec: OpenAPIV3.Document | undefined;\n private unResolveSpec: OpenAPIV3.Document | undefined;\n private isSwaggerFile: boolean | undefined;\n\n private defaultOptions: ParseOptions = {\n allowMissingId: true,\n allowSwagger: true,\n allowAPIKeyAuth: false,\n allowBearerTokenAuth: false,\n allowMultipleParameters: false,\n allowOauth2: false,\n allowMethods: [\"get\", \"post\"],\n allowConversationStarters: false,\n allowResponseSemantics: false,\n allowConfirmation: false,\n projectType: ProjectType.SME,\n isGptPlugin: false,\n };\n\n /**\n * Creates a new instance of the SpecParser class.\n * @param pathOrDoc The path to the OpenAPI specification file or the OpenAPI specification object.\n * @param options The options for parsing the OpenAPI specification file.\n */\n constructor(pathOrDoc: string | OpenAPIV3.Document, options?: ParseOptions) {\n this.pathOrSpec = pathOrDoc;\n this.parser = new SwaggerParser();\n this.options = {\n ...this.defaultOptions,\n ...(options ?? {}),\n } as Required<ParseOptions>;\n }\n\n /**\n * Validates the OpenAPI specification file and returns a validation result.\n *\n * @returns A validation result object that contains information about any errors or warnings in the specification file.\n */\n async validate(): Promise<ValidateResult> {\n try {\n try {\n await this.loadSpec();\n await this.parser.validate(this.spec!);\n } catch (e) {\n return {\n status: ValidationStatus.Error,\n warnings: [],\n errors: [{ type: ErrorType.SpecNotValid, content: (e as Error).toString() }],\n };\n }\n\n const errors: ErrorResult[] = [];\n const warnings: WarningResult[] = [];\n\n if (!this.options.allowSwagger && this.isSwaggerFile) {\n return {\n status: ValidationStatus.Error,\n warnings: [],\n errors: [\n { type: ErrorType.SwaggerNotSupported, content: ConstantString.SwaggerNotSupported },\n ],\n };\n }\n\n // Remote reference not supported\n const refPaths = this.parser.$refs.paths();\n // refPaths [0] is the current spec file path\n if (refPaths.length > 1) {\n errors.push({\n type: ErrorType.RemoteRefNotSupported,\n content: Utils.format(ConstantString.RemoteRefNotSupported, refPaths.join(\", \")),\n data: refPaths,\n });\n }\n\n if (!!this.isSwaggerFile && this.options.allowSwagger) {\n warnings.push({\n type: WarningType.ConvertSwaggerToOpenAPI,\n content: ConstantString.ConvertSwaggerToOpenAPI,\n });\n }\n\n const validator = this.getValidator(this.spec!);\n const validationResult = validator.validateSpec();\n\n warnings.push(...validationResult.warnings);\n errors.push(...validationResult.errors);\n\n let status = ValidationStatus.Valid;\n if (warnings.length > 0 && errors.length === 0) {\n status = ValidationStatus.Warning;\n } else if (errors.length > 0) {\n status = ValidationStatus.Error;\n }\n\n return {\n status: status,\n warnings: warnings,\n errors: errors,\n };\n } catch (err) {\n throw new SpecParserError((err as Error).toString(), ErrorType.ValidateFailed);\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/require-await\n async listSupportedAPIInfo(): Promise<APIInfo[]> {\n throw new Error(\"Method not implemented.\");\n }\n\n /**\n * Lists all the OpenAPI operations in the specification file.\n * @returns A string array that represents the HTTP method and path of each operation, such as ['GET /pets/{petId}', 'GET /user/{userId}']\n * according to copilot plugin spec, only list get and post method without auth\n */\n async list(): Promise<ListAPIResult> {\n try {\n await this.loadSpec();\n const spec = this.spec!;\n const apiMap = this.getAPIs(spec);\n const result: ListAPIResult = {\n APIs: [],\n allAPICount: 0,\n validAPICount: 0,\n };\n for (const apiKey in apiMap) {\n const { operation, isValid, reason } = apiMap[apiKey];\n const [method, path] = apiKey.split(\" \");\n\n const operationId =\n operation.operationId ?? `${method.toLowerCase()}${Utils.convertPathToCamelCase(path)}`;\n\n const apiResult: ListAPIInfo = {\n api: apiKey,\n server: \"\",\n operationId: operationId,\n isValid: isValid,\n reason: reason,\n };\n\n if (isValid) {\n const serverObj = Utils.getServerObject(spec, method.toLocaleLowerCase(), path);\n if (serverObj) {\n apiResult.server = Utils.resolveEnv(serverObj.url);\n }\n\n const authArray = Utils.getAuthArray(operation.security, spec);\n for (const auths of authArray) {\n if (auths.length === 1) {\n apiResult.auth = auths[0];\n break;\n }\n }\n }\n\n result.APIs.push(apiResult);\n }\n\n result.allAPICount = result.APIs.length;\n result.validAPICount = result.APIs.filter((api) => api.isValid).length;\n\n return result;\n } catch (err) {\n if (err instanceof SpecParserError) {\n throw err;\n }\n throw new SpecParserError((err as Error).toString(), ErrorType.ListFailed);\n }\n }\n\n /**\n * Generate specs according to the filters.\n * @param filter An array of strings that represent the filters to apply when generating the artifacts. If filter is empty, it would process nothing.\n */\n async getFilteredSpecs(\n filter: string[],\n signal?: AbortSignal\n ): Promise<[OpenAPIV3.Document, OpenAPIV3.Document]> {\n try {\n if (signal?.aborted) {\n throw new SpecParserError(ConstantString.CancelledMessage, ErrorType.Cancelled);\n }\n\n await this.loadSpec();\n if (signal?.aborted) {\n throw new SpecParserError(ConstantString.CancelledMessage, ErrorType.Cancelled);\n }\n\n const newUnResolvedSpec = SpecFilter.specFilter(\n filter,\n this.unResolveSpec!,\n this.spec!,\n this.options\n );\n\n if (signal?.aborted) {\n throw new SpecParserError(ConstantString.CancelledMessage, ErrorType.Cancelled);\n }\n\n const newSpec = (await this.parser.dereference(newUnResolvedSpec)) as OpenAPIV3.Document;\n return [newUnResolvedSpec, newSpec];\n } catch (err) {\n if (err instanceof SpecParserError) {\n throw err;\n }\n throw new SpecParserError((err as Error).toString(), ErrorType.GetSpecFailed);\n }\n }\n\n /**\n * Generates and update artifacts from the OpenAPI specification file. Generate Adaptive Cards, update Teams app manifest, and generate a new OpenAPI specification file.\n * @param manifestPath A file path of the Teams app manifest file to update.\n * @param filter An array of strings that represent the filters to apply when generating the artifacts. If filter is empty, it would process nothing.\n * @param outputSpecPath File path of the new OpenAPI specification file to generate. If not specified or empty, no spec file will be generated.\n * @param pluginFilePath File path of the api plugin file to generate.\n */\n async generateForCopilot(\n manifestPath: string,\n filter: string[],\n outputSpecPath: string,\n pluginFilePath: string,\n signal?: AbortSignal\n ): Promise<GenerateResult> {\n const result: GenerateResult = {\n allSuccess: true,\n warnings: [],\n };\n\n try {\n const newSpecs = await this.getFilteredSpecs(filter, signal);\n const newUnResolvedSpec = newSpecs[0];\n const newSpec = newSpecs[1];\n\n const authInfo = Utils.getAuthInfo(newSpec);\n\n await this.saveFilterSpec(outputSpecPath, newUnResolvedSpec);\n\n if (signal?.aborted) {\n throw new SpecParserError(ConstantString.CancelledMessage, ErrorType.Cancelled);\n }\n\n const [updatedManifest, apiPlugin, warnings] =\n await ManifestUpdater.updateManifestWithAiPlugin(\n manifestPath,\n outputSpecPath,\n pluginFilePath,\n newSpec,\n this.options,\n authInfo\n );\n\n result.warnings.push(...warnings);\n\n await fs.outputJSON(manifestPath, updatedManifest, { spaces: 4 });\n await fs.outputJSON(pluginFilePath, apiPlugin, { spaces: 4 });\n } catch (err) {\n if (err instanceof SpecParserError) {\n throw err;\n }\n throw new SpecParserError((err as Error).toString(), ErrorType.GenerateFailed);\n }\n\n return result;\n }\n\n /**\n * Generates and update artifacts from the OpenAPI specification file. Generate Adaptive Cards, update Teams app manifest, and generate a new OpenAPI specification file.\n * @param manifestPath A file path of the Teams app manifest file to update.\n * @param filter An array of strings that represent the filters to apply when generating the artifacts. If filter is empty, it would process nothing.\n * @param outputSpecPath File path of the new OpenAPI specification file to generate. If not specified or empty, no spec file will be generated.\n * @param adaptiveCardFolder Folder path where the Adaptive Card files will be generated. If not specified or empty, Adaptive Card files will not be generated.\n */\n async generate(\n manifestPath: string,\n filter: string[],\n outputSpecPath: string,\n adaptiveCardFolder?: string,\n signal?: AbortSignal\n ): Promise<GenerateResult> {\n const result: GenerateResult = {\n allSuccess: true,\n warnings: [],\n };\n try {\n const newSpecs = await this.getFilteredSpecs(filter, signal);\n const newUnResolvedSpec = newSpecs[0];\n const newSpec = newSpecs[1];\n let authInfo = undefined;\n\n if (this.options.projectType === ProjectType.SME) {\n authInfo = Utils.getAuthInfo(newSpec);\n }\n\n await this.saveFilterSpec(outputSpecPath, newUnResolvedSpec);\n\n if (adaptiveCardFolder) {\n for (const url in newSpec.paths) {\n for (const method in newSpec.paths[url]) {\n // paths object may contain description/summary which is not a http method, so we need to check if it is a operation object\n if (this.options.allowMethods.includes(method)) {\n const operation = (newSpec.paths[url] as any)[method] as OpenAPIV3.OperationObject;\n try {\n const [card, jsonPath] = AdaptiveCardGenerator.generateAdaptiveCard(operation);\n const fileName = path.join(adaptiveCardFolder, `${operation.operationId!}.json`);\n const wrappedCard = wrapAdaptiveCard(card, jsonPath);\n await fs.outputJSON(fileName, wrappedCard, { spaces: 2 });\n const dataFileName = path.join(\n adaptiveCardFolder,\n `${operation.operationId!}.data.json`\n );\n await fs.outputJSON(dataFileName, {}, { spaces: 2 });\n } catch (err) {\n result.allSuccess = false;\n result.warnings.push({\n type: WarningType.GenerateCardFailed,\n content: (err as Error).toString(),\n data: operation.operationId!,\n });\n }\n }\n }\n }\n }\n\n if (signal?.aborted) {\n throw new SpecParserError(ConstantString.CancelledMessage, ErrorType.Cancelled);\n }\n\n const [updatedManifest, warnings] = await ManifestUpdater.updateManifest(\n manifestPath,\n outputSpecPath,\n newSpec,\n this.options,\n adaptiveCardFolder,\n authInfo\n );\n\n await fs.outputJSON(manifestPath, updatedManifest, { spaces: 2 });\n\n result.warnings.push(...warnings);\n } catch (err) {\n if (err instanceof SpecParserError) {\n throw err;\n }\n throw new SpecParserError((err as Error).toString(), ErrorType.GenerateFailed);\n }\n\n return result;\n }\n\n private async loadSpec(): Promise<void> {\n if (!this.spec) {\n this.unResolveSpec = (await this.parser.parse(this.pathOrSpec)) as OpenAPIV3.Document;\n // Convert swagger 2.0 to openapi 3.0\n if (!this.unResolveSpec.openapi && (this.unResolveSpec as any).swagger === \"2.0\") {\n const specObj = await converter.convert(this.unResolveSpec as any, {});\n this.unResolveSpec = specObj.openapi as OpenAPIV3.Document;\n this.isSwaggerFile = true;\n }\n\n const clonedUnResolveSpec = JSON.parse(JSON.stringify(this.unResolveSpec));\n this.spec = (await this.parser.dereference(clonedUnResolveSpec)) as OpenAPIV3.Document;\n }\n }\n\n private getAPIs(spec: OpenAPIV3.Document): APIMap {\n const validator = this.getValidator(spec);\n const apiMap = validator.listAPIs();\n return apiMap;\n }\n\n private getValidator(spec: OpenAPIV3.Document): Validator {\n if (this.validator) {\n return this.validator;\n }\n const validator = ValidatorFactory.create(spec, this.options);\n this.validator = validator;\n return validator;\n }\n\n private async saveFilterSpec(\n outputSpecPath: string,\n unResolvedSpec: OpenAPIV3.Document\n ): Promise<void> {\n let resultStr;\n if (outputSpecPath.endsWith(\".yaml\") || outputSpecPath.endsWith(\".yml\")) {\n resultStr = jsyaml.dump(unResolvedSpec);\n } else {\n resultStr = JSON.stringify(unResolvedSpec, null, 2);\n }\n await fs.outputFile(outputSpecPath, resultStr);\n }\n}\n"],"names":[],"mappings":";;;;;;AAAA;AAoFA;;;IAGY;AAAZ,WAAY,SAAS;IACnB,4CAA+B,CAAA;IAC/B,+DAAkD,CAAA;IAClD,0DAA6C,CAAA;IAC7C,mEAAsD,CAAA;IACtD,gFAAmE,CAAA;IACnE,gDAAmC,CAAA;IACnC,+DAAkD,CAAA;IAClD,iEAAoD,CAAA;IACpD,0DAA6C,CAAA;IAC7C,qEAAwD,CAAA;IACxD,mEAAsD,CAAA;IAEtD,uCAA0B,CAAA;IAC1B,0EAA6D,CAAA;IAC7D,oDAAuC,CAAA;IACvC,4DAA+C,CAAA;IAC/C,yEAA4D,CAAA;IAC5D,+CAAkC,CAAA;IAClC,+CAAkC,CAAA;IAClC,8CAAiC,CAAA;IAEjC,kEAAqD,CA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