{"version":3,"file":"index.mjs","names":["t","t","t","logger"],"sources":["../src/core/base/Adaptor.ts","../src/core/constants/keywords.ts","../src/core/interface.ts","../src/core/base/Base.ts","../src/core/base/Provider.ts","../src/core/errors.ts","../src/core/generator/index.ts","../src/core/client/axios.ts","../src/core/client/fetch.ts","../src/core/config.ts","../src/core/logger.ts","../src/openapi/VersionedProvider.ts","../src/openapi/V2.ts","../src/openapi/V3.ts","../src/openapi/V3_1.ts","../src/openapi/index.ts","../src/vite-plugin/index.ts"],"sourcesContent":["/**\n * @file Adapter abstract class definition\n * @author wp.l\n * @description Base adapter implementation for various code generation tools\n */\n\nimport type { Statement } from 'typescript';\nimport type { MediaTypeObject, ParameterObject } from '../interface.js';\n\n/**\n * Base adapter for tool\n * This abstract class serves as the foundation for implementing adapters for different code generation tools\n */\nexport abstract class Adapter {\n\t/**\n\t * @abstract The unique name/identifier for this adapter implementation\n\t */\n\tabstract readonly name: string;\n\n\t/**\n\t * @abstract The name of the field used to specify the HTTP method in API calls\n\t */\n\tabstract readonly methodFieldName: string;\n\n\t/**\n\t * @abstract The name of the field used to specify the request body in API calls\n\t */\n\tabstract readonly bodyFieldName: string;\n\n\t/**\n\t * @abstract The name of the field used to specify request headers in API calls\n\t */\n\tabstract readonly headersFieldName: string;\n\n\t/**\n\t * @abstract The name of the field used to specify query parameters in API calls\n\t */\n\tabstract readonly queryFieldName: string;\n\n\t/**\n\t * @abstract\n\t * @param {string} uri - The API endpoint URI\n\t * @param {string} method - The HTTP method (e.g., GET, POST, etc.)\n\t * @param {ParameterObject[]} parameters - An array of parameters for the API call\n\t * @param {MediaTypeObject | undefined} requestBody - The request body payload (if applicable)\n\t * @param {MediaTypeObject | undefined} response - The expected response format (if applicable)\n\t * @param {Adapter} adapter - An instance of the adapter being used\n\t * @param {boolean} useFormData - Flag indicating whether to use FormData for the request body\n\t * @param {boolean} useJSONResponse - Flag indicating whether the response should be parsed as JSON\n\t * @param {boolean} isEventStream - Flag indicating whether the response is a text/event-stream (SSE) stream; when true, the adapter must return the raw response without parsing\n\t * @returns {Statement[]} An array of TypeScript AST statements representing the generated code\n\t */\n\tabstract client(\n\t\turi: string,\n\t\tmethod: string,\n\t\tparameters: ParameterObject[],\n\t\trequestBody: MediaTypeObject | undefined,\n\t\tresponse: MediaTypeObject | undefined,\n\t\tadapter: Adapter,\n\t\tuseFormData: boolean,\n\t\tuseJSONResponse: boolean,\n\t\tisEventStream: boolean\n\t): Statement[];\n}\n","export const typescriptKeywords = new Set([\n\t'break',\n\t'case',\n\t'catch',\n\t'class',\n\t'const',\n\t'continue',\n\t'debugger',\n\t'default',\n\t'delete',\n\t'do',\n\t'else',\n\t'enum',\n\t'export',\n\t'extends',\n\t'false',\n\t'finally',\n\t'for',\n\t'function',\n\t'if',\n\t'import',\n\t'in',\n\t'instanceof',\n\t'new',\n\t'null',\n\t'return',\n\t'super',\n\t'switch',\n\t'this',\n\t'throw',\n\t'true',\n\t'try',\n\t'typeof',\n\t'var',\n\t'void',\n\t'while',\n\t'with',\n\t'as',\n\t'implements',\n\t'interface',\n\t'let',\n\t'package',\n\t'private',\n\t'protected',\n\t'public',\n\t'static',\n\t'yield',\n\t'abstract',\n\t'any',\n\t'async',\n\t'await',\n\t'constructor',\n\t'declare',\n\t'from',\n\t'get',\n\t'is',\n\t'module',\n\t'namespace',\n\t'never',\n\t'require',\n\t'set',\n\t'type',\n\t'unknown',\n\t'readonly',\n\t'of',\n\t'asserts',\n\t'infer',\n\t'keyof',\n\t'boolean',\n\t'number',\n\t'string',\n\t'symbol',\n\t'object',\n\t'undefined',\n\t'bigint',\n]);\n","/**\n * Simple represenration for JSON object\n */\nexport type JSONValue = {\n\t[K: string]:\n\t\t| string\n\t\t| number\n\t\t| boolean\n\t\t| JSONValue\n\t\t| (string | number | boolean | JSONValue)[];\n};\n\nexport enum SchemaType {\n\tschemas = 'schemas',\n\tparameters = 'parameters',\n\tresponses = 'responses',\n\trequestBodies = 'requestBodies',\n}\n\nexport enum NonArraySchemaType {\n\tobject = 'object',\n\tstring = 'string',\n\tnumber = 'number',\n\tboolean = 'boolean',\n\tinteger = 'integer',\n\tenum = 'enum',\n\tfile = 'file',\n}\n\nexport enum ArraySchemaType {\n\tarray = 'array',\n}\n\nexport enum SchemaFormatType {\n\tstring = 'string',\n\tnumber = 'number',\n\tboolean = 'boolean',\n\tfile = 'file',\n\tbinary = 'binary',\n\tblob = 'blob',\n}\n\nexport enum ParameterIn {\n\theader = 'header',\n\tbody = 'body',\n\tquery = 'query',\n\tcookie = 'cookie',\n\tpath = 'path',\n\tformData = 'formData',\n}\n\nexport interface ReferenceObject {\n\t$ref: string;\n}\n\nexport interface EnumSchemaObject {\n\tname: string;\n\tenum: (string | number)[];\n}\n\nexport interface SingleTypeSchemaObject {\n\t// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n\ttype: keyof typeof NonArraySchemaType | string;\n\tdescription?: string;\n\tallOf?: SchemaObject[];\n\tanyOf?: SchemaObject[];\n\tdeprecated?: boolean;\n\tenum?: (string | number)[];\n\tformat?: keyof typeof SchemaFormatType;\n\toneOf?: SchemaObject[];\n\tproperties?: Record<string, SchemaObject>;\n\treadonly?: boolean;\n\trequired?: string[] | boolean;\n\tref?: string;\n\tisRef?: boolean;\n}\n\nexport interface ArrayTypeSchemaObject {\n\ttype: keyof typeof ArraySchemaType;\n\titems?: SchemaObject;\n\trequired?: boolean;\n\tdescription?: string;\n\tref?: string;\n}\n\nexport type SchemaObject = SingleTypeSchemaObject | ArrayTypeSchemaObject;\n\nexport type ParameterObject = {\n\tname: string;\n\tin: keyof typeof ParameterIn;\n\tschema?: SchemaObject;\n\trequired?: boolean;\n\tdescription?: string;\n\tdeprecated?: boolean;\n\tref?: string;\n};\n\nexport enum MediaTypes {\n\tJSON = 'application/json',\n\tEVENT_STREAM = 'text/event-stream',\n\tTEXT = 'text',\n\tIMAGE = 'image',\n\tAUDIO = 'audio',\n\tVIDEO = 'video',\n}\n\nexport type MediaTypeObject = {\n\ttype: MediaTypes | keyof typeof MediaTypes;\n\tschema?: SchemaObject;\n};\n\nexport type ResponsesObject = Record<string, MediaTypeObject[]>;\n\nexport type RequestBodyObject = ResponsesObject;\n\nexport enum HttpMethods {\n\tGET = 'get',\n\tPUT = 'put',\n\tPOST = 'post',\n\tDELETE = 'delete',\n\tOPTIONS = 'options',\n\tHEAD = 'head',\n\tPATCH = 'patch',\n\tTRACE = 'trace',\n}\n\nexport type OperationObject = {\n\tmethod: string;\n\tsummary?: string;\n\tdescription?: string;\n\toperationId?: string;\n\texternalDocs?: { url: string; description?: string }[];\n\tparameters?: ParameterObject[];\n\trequestBody?: MediaTypeObject[];\n\tresponses: MediaTypeObject[];\n\tdeprecated?: boolean;\n};\n\nexport type PathObject = {\n\tref?: string;\n\tsummary?: string;\n\tdescription?: string;\n\tparameters?: ParameterObject[];\n} & Partial<Record<HttpMethods, OperationObject>>;\n\nexport type PathsObject = Record<string, OperationObject[]>;\n\nexport type FetchDocRequestInit = {\n\tmethod?: string;\n\tbody?: string | FormData;\n\theaders?: Record<string, string>;\n};\n\nexport enum Adaptors {\n\tfetch = 'fetch',\n\taxios = 'axios',\n}\n\nexport type ProviderInitOptions = {\n\tdocURL: string;\n\toutput: string;\n\tbaseURL?: string;\n\timportClientSource?: string;\n\trequestOptions?: FetchDocRequestInit;\n\tverbose?: boolean;\n\tadaptor?: keyof typeof Adaptors;\n};\n\nexport interface ProviderInitResult {\n\treadonly enums: EnumSchemaObject[];\n\treadonly schemas: Record<string, SchemaObject>;\n\treadonly parameters: Record<string, ParameterObject>;\n\treadonly responses: Record<string, ResponsesObject>;\n\treadonly requestBodies: Record<string, RequestBodyObject>;\n\treadonly apis: PathsObject;\n}\n","/**\n * @file Base class implementation\n * @author wp.l\n * @description Base utility class providing common methods for code generation and API handling\n */\n\nimport { Agent, request } from 'undici';\nimport { typescriptKeywords } from '../constants/keywords.js';\nimport type {\n\tEnumSchemaObject,\n\tFetchDocRequestInit,\n\tReferenceObject,\n\tSchemaObject,\n\tSingleTypeSchemaObject,\n} from '../interface.js';\nimport { MediaTypes } from '../interface.js';\n\n/**\n * Represents success HTTP status codes.\n * Each key is a string representation of a success HTTP status code.\n */\nexport const SuccessHttpStatusCode = {\n\t'200': '200', // OK\n\t'201': '201', // Created\n\t'202': '202', // Accepted\n\t'203': '203', // Non-Authoritative Information\n\t'204': '204', // No Content\n\t'205': '205', // Reset Content\n\t'206': '206', // Partial Content\n\t'207': '207', // Multi_Status\n\t'208': '208', // Already_Reported\n\t'226': '226', // IM Used\n};\n\n/**\n * Base abstract class providing common utility methods.\n */\nexport abstract class Base {\n\tprotected constructor() {\n\t\tif (new.target === Base) {\n\t\t\tthrow new Error('Cannot instantiate abstract class');\n\t\t}\n\t}\n\n\t/**\n\t * Converts a reference string to a meaningful name.\n\t * @param ref - The reference string to process.\n\t * @param [doc] - Optional document reference for context.\n\t * @returns - The processed name.\n\t */\n\tstatic ref2name(ref: string, doc?: any): string {\n\t\tconst paths = ref.replace(/^#/, '').split('/').filter(Boolean);\n\n\t\tif (!doc) {\n\t\t\treturn paths.slice(-1)[0];\n\t\t}\n\n\t\tlet temporary = doc as unknown;\n\t\tlet lastPath = '';\n\t\tfor (const path of paths) {\n\t\t\t// For handling path prefix with ~1\n\t\t\tconst adjustedPath = path.replaceAll('~1', '/');\n\t\t\ttemporary = (temporary as Record<string, any>)[adjustedPath];\n\t\t\tlastPath = adjustedPath;\n\t\t}\n\n\t\tif (!temporary) {\n\t\t\treturn 'unknown';\n\t\t}\n\n\t\treturn (temporary as unknown as { $ref: string }).$ref\n\t\t\t? Base.ref2name((temporary as unknown as { $ref: string }).$ref, doc)\n\t\t\t: lastPath;\n\t}\n\n\t/**\n\t * Converts an API path to a function name.\n\t * @param path - The API endpoint path.\n\t * @param [method] - The HTTP method (e.g., GET, POST).\n\t * @param [operationId] - Unique identifier for the operation.\n\t * @returns - The generated function name.\n\t */\n\tstatic pathToFnName(\n\t\tpath: string,\n\t\tmethod?: string,\n\t\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\t\t_operationId: string = ''\n\t) {\n\t\tconst name = Base.normalize(Base.camelCase(Base.normalize(path)));\n\t\tconst suffix = method\n\t\t\t? Base.capitalize(Base.upperCamelCase(`using_${method}`))\n\t\t\t: '';\n\n\t\treturn name + suffix;\n\t}\n\n\t/**\n\t * Normalizes a string by replacing special characters and avoiding TypeScript keywords.\n\t * @param text - Input text to normalize.\n\t * @returns - The normalized string.\n\t */\n\tstatic normalize(text: string) {\n\t\tif (typescriptKeywords.has(text)) {\n\t\t\ttext += '_';\n\t\t}\n\t\treturn text\n\t\t\t.replace(/[/\\-_{}():\\s`,*<>$#.]/gm, '_')\n\t\t\t.replace(/^\\d./gm, '')\n\t\t\t.replaceAll('...', '');\n\t}\n\n\t/**\n\t * Capitalizes the first character of a string.\n\t * @param text - Input string.\n\t * @returns - Capitalized string.\n\t */\n\tstatic capitalize(text: string) {\n\t\ttext = text.trim();\n\t\treturn `${text.charAt(0).toUpperCase()}${text.slice(1)}`;\n\t}\n\n\t/**\n\t * Converts a string to camelCase.\n\t * @param text - Input string.\n\t * @returns - CamelCase string.\n\t */\n\tstatic camelCase(text: string) {\n\t\ttext = text.trim();\n\t\tconst parts = text.split('_').filter(Boolean);\n\t\twhile (parts[0]?.match(/^\\d/)) {\n\t\t\tparts.shift();\n\t\t}\n\t\treturn parts\n\t\t\t.map((t, index) => (index === 0 ? t : Base.capitalize(t)))\n\t\t\t.join('');\n\t}\n\n\t/**\n\t * Converts a string to UpperCamelCase.\n\t * @param text - Input string.\n\t * @returns - UpperCamelCase string.\n\t */\n\tstatic upperCamelCase(text: string) {\n\t\treturn Base.normalize(text)\n\t\t\t.replaceAll('...', '')\n\t\t\t.split('_')\n\t\t\t.filter(Boolean)\n\t\t\t.map(Base.capitalize)\n\t\t\t.join('');\n\t}\n\n\t/**\n\t * Fetches documentation from a given URL.\n\t * @param url - The URL to fetch the documentation from.\n\t * @param requestInit - Additional request parameters.\n\t * @returns - A promise resolving to the fetched documentation data.\n\t */\n\tstatic async fetchDoc<T = unknown>(\n\t\turl: string,\n\t\trequestInit: FetchDocRequestInit = {}\n\t): Promise<T> {\n\t\tconst agent = new Agent({\n\t\t\tconnect: { rejectUnauthorized: false },\n\t\t});\n\n\t\tconst { body, statusCode } = await request(url, {\n\t\t\tmethod: 'GET',\n\t\t\tdispatcher: agent,\n\t\t\t...requestInit,\n\t\t});\n\n\t\tif (statusCode >= 400) {\n\t\t\tthrow new Error(\n\t\t\t\t`Failed to fetch OpenAPI documentation from ${url}: HTTP ${statusCode}`\n\t\t\t);\n\t\t}\n\n\t\ttry {\n\t\t\treturn body.json() as T;\n\t\t} catch (error) {\n\t\t\tthrow new Error(\n\t\t\t\t`Failed to parse JSON response from ${url}: ${error instanceof Error ? error.message : String(error)}`\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Determines the media type from a given media type string.\n\t * @param mediaType - The media type string to evaluate.\n\t * @returns - The matched MediaTypes or null.\n\t */\n\tstatic getMediaType(mediaType: string): MediaTypes | undefined {\n\t\tconst mediaTypeValues = Object.values(MediaTypes) as string[];\n\t\tconst found = mediaTypeValues.find((type) => mediaType.includes(type));\n\t\treturn found as MediaTypes | undefined;\n\t}\n\n\t/**\n\t * Checks if a schema is a valid enum type that isn't boolean.\n\t * @param a - The schema object to evaluate.\n\t * @returns - True if the schema is a valid non-boolean enum.\n\t */\n\tstatic isValidEnumType(a: SchemaObject) {\n\t\treturn a.type !== 'boolean' && !Base.isBooleanEnum(a);\n\t}\n\n\t/**\n\t * Checks if a schema represents a boolean enum.\n\t * @param a - The schema object to evaluate.\n\t * @returns - True if the schema is a boolean enum.\n\t */\n\tstatic isBooleanEnum(a: SchemaObject) {\n\t\treturn (\n\t\t\ta.type === 'boolean' ||\n\t\t\t!!(a as SingleTypeSchemaObject).enum?.some(\n\t\t\t\t(member) => typeof member === 'boolean'\n\t\t\t)\n\t\t);\n\t}\n\n\t/**\n\t * Checks if two enum schemas are identical.\n\t * @param a - First enum schema to compare.\n\t * @param b - Second enum schema to compare.\n\t * @returns - True if the enums are identical.\n\t */\n\tprivate static isSameEnum(a: EnumSchemaObject, b: EnumSchemaObject) {\n\t\treturn (\n\t\t\ta.enum.length === b.enum.length &&\n\t\t\ta.enum.sort().every((v, index) => v === b.enum.sort()[index])\n\t\t);\n\t}\n\n\t/**\n\t * Filters out duplicate enum schemas from an array.\n\t * @param enums - Array of enum schemas to process.\n\t * @returns - Array of unique enum schemas.\n\t */\n\tstatic uniqueEnums(enums: EnumSchemaObject[]): EnumSchemaObject[] {\n\t\tconst enumMap = new Map<string, Set<string | number>>();\n\n\t\tfor (const e of enums) {\n\t\t\tconst existing = enumMap.get(e.name);\n\t\t\tif (existing) {\n\t\t\t\t// Merge enum values with the same name\n\t\t\t\tfor (const value of e.enum) {\n\t\t\t\t\texisting.add(value);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tenumMap.set(e.name, new Set(e.enum));\n\t\t\t}\n\t\t}\n\n\t\t// Convert back to array\n\t\treturn Array.from(enumMap.entries()).map(([name, values]) => ({\n\t\t\tname,\n\t\t\tenum: Array.from(values),\n\t\t}));\n\t}\n\n\t/**\n\t * Finds the first occurrence of a matching enum schema in an array.\n\t * @param a - The enum schema to find.\n\t * @param enums - Array of enum schemas to search.\n\t * @returns - The found schema or undefined.\n\t */\n\tstatic findSameSchema(a: EnumSchemaObject, enums: EnumSchemaObject[]) {\n\t\treturn enums.find((b) => Base.isSameEnum(b, a));\n\t}\n\n\t/**\n\t * Checks if an object is a reference object.\n\t * @param schema - The object to check.\n\t * @returns - True if the object is a reference.\n\t */\n\n\tstatic isRef(schema: unknown): schema is ReferenceObject {\n\t\treturn (\n\t\t\ttypeof schema === 'object' &&\n\t\t\tschema !== null &&\n\t\t\t'$ref' in schema &&\n\t\t\ttypeof (schema as Record<string, unknown>).$ref === 'string'\n\t\t);\n\t}\n}\n","/**\n * @file Base class implementation\n * @author wp.l\n * @description This file defines the `Provider` abstract class, which serves as a base for providers responsible for parsing and processing API documentation.\n */\n\nimport type {\n\tEnumSchemaObject,\n\tFetchDocRequestInit,\n\tOperationObject,\n\tParameterObject,\n\tProviderInitOptions,\n\tProviderInitResult,\n\tRequestBodyObject,\n\tResponsesObject,\n\tSchemaObject,\n} from '../interface.js';\n\n/**\n * Abstract Provider Class.\n *\n * The Provider class is designed to be extended by specific implementations (e.g., OpenAPI 2 provider, OpenAPI 3 provider).\n * It handles the initialization of the provider and the parsing of documentation into structured data.\n *\n * @example\n *\n * ```ts\n * /// Example of how this class might be used by a subclass:\n * class OpenAPIProvider extends Provider {\n *   /// Implement the parse method to handle OpenAPI-specific documentation parsing.\n *   parse(doc: unknown): ProviderInitResult {\n *     /// Implementation details...\n *   }\n * }\n *\n * /// Initializing a provider with configuration and documentation data:\n * const initOptions: ProviderInitOptions = {\n *   docURL: \"https://example.com/api/swagger.json\",\n *   baseURL: \"https://api.example.com\",\n *   output: \"./generated\",\n *   requestOptions: {\n *     headers: { \"Content-Type\": \"application/json\" },\n *   },\n *   importClientSource: \"generated/client\",\n * };\n *\n * const docData = fetchSwaggerDoc();\n * const provider = new OpenAPIProvider(initOptions, docData);\n * ```\n */\nexport abstract class Provider\n\timplements ProviderInitResult, ProviderInitOptions\n{\n\t/** collection of enum schemas */\n\treadonly enums: EnumSchemaObject[] = [];\n\t/** collection of schemas indexed by name */\n\treadonly schemas: Record<string, SchemaObject> = {};\n\t/** collection of parameters indexed by name */\n\treadonly parameters: Record<string, ParameterObject> = {};\n\t/** collection of API responses indexed by name */\n\treadonly responses: Record<string, ResponsesObject> = {};\n\t/** collection of request bodies indexed by name */\n\treadonly requestBodies: Record<string, RequestBodyObject> = {};\n\t/** collection of API endpoints (operations) indexed by path */\n\treadonly apis: Record<string, OperationObject[]> = {};\n\n\t/** URL for fetching API documentation */\n\treadonly docURL: string;\n\t/** base URL for API endpoints */\n\treadonly baseURL: string;\n\t/** output directory for generated code */\n\treadonly output: string;\n\t/** request options for API documentation fetch */\n\treadonly requestOptions: FetchDocRequestInit;\n\t/** source path for imported client */\n\treadonly importClientSource: string;\n\n\t/**\n\t * Provider Constructor.\n\t * @param {ProviderInitOptions} initOptions - Initial configuration for the provider.\n\t * @param {unknown} doc - Raw API documentation data to be parsed.\n\t */\n\tconstructor(initOptions: ProviderInitOptions, doc: unknown) {\n\t\tthis.docURL = initOptions.docURL;\n\t\tthis.baseURL = initOptions.baseURL ?? '';\n\t\tthis.output = initOptions.output ?? '.';\n\t\tthis.requestOptions = initOptions.requestOptions ?? {};\n\t\tthis.importClientSource = initOptions.importClientSource ?? '';\n\n\t\tconst { enums, schemas, requestBodies, responses, parameters, apis } =\n\t\t\tthis.parse(doc);\n\n\t\tthis.enums = enums;\n\t\tthis.schemas = schemas;\n\t\tthis.responses = responses;\n\t\tthis.parameters = parameters;\n\t\tthis.requestBodies = requestBodies;\n\t\tthis.apis = apis;\n\t}\n\n\t/**\n\t * Abstract Parse Method.\n\t * @abstract\n\t * @param {unknown} doc - Raw API documentation data.\n\t * @returns {ProviderInitResult} - Parsed documentation data.\n\t *\n\t * This method must be implemented by subclasses to parse the raw documentation into structured data.\n\t */\n\tabstract parse(doc: unknown): ProviderInitResult;\n}\n","/**\n * Error handling utilities for api-codegen\n */\n\n// Error codes\nexport const ErrorCodes = {\n\tSPEC_NOT_FOUND: 'E_SPEC_NOT_FOUND',\n\tSPEC_FETCH_FAILED: 'E_SPEC_FETCH_FAILED',\n\tSPEC_PARSE_FAILED: 'E_SPEC_PARSE_FAILED',\n\tOUTPUT_DIR_MISSING: 'E_OUTPUT_DIR_MISSING',\n\tCONFIG_INVALID: 'E_CONFIG_INVALID',\n\tVALIDATION_FAILED: 'E_VALIDATION_FAILED',\n\tGENERATION_FAILED: 'E_GENERATION_FAILED',\n\tTYPE_CHECK_FAILED: 'E_TYPE_CHECK_FAILED',\n} as const;\n\nexport type ErrorCode = (typeof ErrorCodes)[keyof typeof ErrorCodes];\n\n/**\n * Error context for ApicodegenError\n */\nexport interface ApicodegenErrorContext {\n\t/** Error code */\n\tcode: ErrorCode;\n\t/** Human readable message */\n\tmessage: string;\n\t/** File/URL related to error */\n\tlocation?: string;\n\t/** Line number if applicable */\n\tline?: number;\n\t/** Column number if applicable */\n\tcolumn?: number;\n\t/** Related schema/path if applicable */\n\tpath?: string;\n\t/** Suggested fixes */\n\tsuggestions?: string[];\n\t/** Original error */\n\tcause?: Error;\n}\n\n/**\n * Custom error class for api-codegen with rich context\n */\nexport class ApicodegenError extends Error {\n\treadonly code: ErrorCode;\n\treadonly location?: string;\n\treadonly line?: number;\n\treadonly column?: number;\n\treadonly path?: string;\n\treadonly suggestions: string[];\n\treadonly cause?: Error;\n\n\tconstructor(context: ApicodegenErrorContext) {\n\t\tsuper(context.message);\n\t\tthis.name = 'ApicodegenError';\n\t\tthis.code = context.code;\n\t\tthis.location = context.location;\n\t\tthis.line = context.line;\n\t\tthis.column = context.column;\n\t\tthis.path = context.path;\n\t\tthis.suggestions = context.suggestions || [];\n\t\tthis.cause = context.cause;\n\n\t\t// Maintains proper stack trace in V8 environments\n\t\tif (Error.captureStackTrace) {\n\t\t\tError.captureStackTrace(this, ApicodegenError);\n\t\t}\n\t}\n\n\t/**\n\t * Convert error to formatted string for CLI output\n\t */\n\ttoString(verbose = false): string {\n\t\tconst lines: string[] = [];\n\n\t\t// Error header with code\n\t\tlines.push(`\\x1b[1;31mError [${this.code}]\\x1b[0m ${this.message}`);\n\n\t\t// Location\n\t\tif (this.location) {\n\t\t\tlines.push(`  \\x1b[36m→ Location:\\x1b[0m ${this.location}`);\n\t\t}\n\n\t\t// Path\n\t\tif (this.path) {\n\t\t\tlines.push(`  \\x1b[36m→ Path:\\x1b[0m ${this.path}`);\n\t\t}\n\n\t\t// Line/column\n\t\tif (this.line !== undefined) {\n\t\t\tlet lineInfo = `  \\x1b[36m→ Line:\\x1b[0m ${this.line}`;\n\t\t\tif (this.column !== undefined) {\n\t\t\t\tlineInfo += `, Column: ${this.column}`;\n\t\t\t}\n\t\t\tlines.push(lineInfo);\n\t\t}\n\n\t\t// Suggestions\n\t\tif (this.suggestions.length > 0) {\n\t\t\tfor (const suggestion of this.suggestions) {\n\t\t\t\tlines.push(`  \\x1b[32m→ Suggestion:\\x1b[0m ${suggestion}`);\n\t\t\t}\n\t\t}\n\n\t\t// Stack trace in verbose mode\n\t\tif (verbose && this.cause) {\n\t\t\tlines.push(`\\n  \\x1b[90mOriginal Error:\\x1b[0m ${this.cause.message}`);\n\t\t\tif (this.stack) {\n\t\t\t\t// Skip first few lines of stack (our error header)\n\t\t\t\tconst stackLines = this.stack.split('\\n').slice(1).join('\\n');\n\t\t\t\tlines.push(`\\x1b[90m${stackLines}\\x1b[0m`);\n\t\t\t}\n\t\t}\n\n\t\treturn lines.join('\\n');\n\t}\n\n\t/**\n\t * Convert to JSON-serializable object\n\t */\n\ttoJSON(): object {\n\t\treturn {\n\t\t\tname: this.name,\n\t\t\tcode: this.code,\n\t\t\tmessage: this.message,\n\t\t\tlocation: this.location,\n\t\t\tline: this.line,\n\t\t\tcolumn: this.column,\n\t\t\tpath: this.path,\n\t\t\tsuggestions: this.suggestions,\n\t\t\tcause: this.cause?.message,\n\t\t};\n\t}\n}\n\n/**\n * ANSI color codes for terminal output\n */\nexport const Colors = {\n\treset: '\\x1b[0m',\n\tbold: '\\x1b[1m',\n\tred: '\\x1b[31m',\n\tgreen: '\\x1b[32m',\n\tyellow: '\\x1b[33m',\n\tblue: '\\x1b[34m',\n\tcyan: '\\x1b[36m',\n\tgray: '\\x1b[90m',\n\tbrightRed: '\\x1b[91m',\n\tbrightGreen: '\\x1b[92m',\n} as const;\n\n/**\n * Format error for CLI output\n */\nexport function formatError(error: unknown, verbose = false): string {\n\tif (error instanceof ApicodegenError) {\n\t\treturn error.toString(verbose);\n\t}\n\n\tif (error instanceof Error) {\n\t\treturn `${Colors.red}${Colors.bold}Error${Colors.reset}: ${error.message}${verbose && error.stack ? `\\n\\n${Colors.gray}${error.stack}${Colors.reset}` : ''}`;\n\t}\n\n\treturn `${Colors.red}${Colors.bold}Error${Colors.reset}: ${String(error)}`;\n}\n\n/**\n * Print error to console with formatting\n */\nexport function printError(\n\terror: unknown,\n\tverbose = false,\n\tstream: NodeJS.WriteStream = process.stderr\n): void {\n\tstream.write(formatError(error, verbose));\n\tstream.write('\\n');\n}\n\n/**\n * Create error with common patterns\n */\nexport const createErrors = {\n\tspecNotFound(path: string, cause?: Error): ApicodegenError {\n\t\treturn new ApicodegenError({\n\t\t\tcode: ErrorCodes.SPEC_NOT_FOUND,\n\t\t\tmessage: 'OpenAPI spec file not found',\n\t\t\tlocation: path,\n\t\t\tsuggestions: [\n\t\t\t\t\"Check if the file exists using 'ls -la'\",\n\t\t\t\t'Use --spec to provide the correct path',\n\t\t\t\t'For remote specs, ensure the URL is accessible',\n\t\t\t],\n\t\t\tcause,\n\t\t});\n\t},\n\n\tspecFetchFailed(\n\t\turl: string,\n\t\tstatusCode?: number,\n\t\tcause?: Error\n\t): ApicodegenError {\n\t\tconst message = statusCode\n\t\t\t? `Failed to fetch OpenAPI spec (HTTP ${statusCode})`\n\t\t\t: 'Failed to fetch OpenAPI spec from URL';\n\n\t\treturn new ApicodegenError({\n\t\t\tcode: ErrorCodes.SPEC_FETCH_FAILED,\n\t\t\tmessage,\n\t\t\tlocation: url,\n\t\t\tsuggestions: [\n\t\t\t\t'Check if the URL is accessible in a browser',\n\t\t\t\t'Download the spec file locally and use the local path',\n\t\t\t\t'Verify CORS settings if fetching from a different origin',\n\t\t\t],\n\t\t\tcause,\n\t\t});\n\t},\n\n\tspecParseFailed(\n\t\tpath: string,\n\t\tline?: number,\n\t\tcolumn?: number,\n\t\tcause?: Error\n\t): ApicodegenError {\n\t\treturn new ApicodegenError({\n\t\t\tcode: ErrorCodes.SPEC_PARSE_FAILED,\n\t\t\tmessage: 'Failed to parse OpenAPI spec (invalid JSON or YAML)',\n\t\t\tlocation: path,\n\t\t\tline,\n\t\t\tcolumn,\n\t\t\tsuggestions: [\n\t\t\t\t'Validate JSON syntax using jsonlint.com',\n\t\t\t\t'For YAML specs, ensure proper indentation',\n\t\t\t\t'Check for trailing commas or unquoted special characters',\n\t\t\t],\n\t\t\tcause,\n\t\t});\n\t},\n\n\toutputDirMissing(path: string, cause?: Error): ApicodegenError {\n\t\treturn new ApicodegenError({\n\t\t\tcode: ErrorCodes.OUTPUT_DIR_MISSING,\n\t\t\tmessage: 'Output directory does not exist',\n\t\t\tlocation: path,\n\t\t\tsuggestions: [\n\t\t\t\t'Create the directory: mkdir -p $(dirname <output>)',\n\t\t\t\t'Check if the path is correct',\n\t\t\t],\n\t\t\tcause,\n\t\t});\n\t},\n\n\tconfigInvalid(path: string, cause?: Error): ApicodegenError {\n\t\treturn new ApicodegenError({\n\t\t\tcode: ErrorCodes.CONFIG_INVALID,\n\t\t\tmessage: 'Invalid configuration file',\n\t\t\tlocation: path,\n\t\t\tsuggestions: [\n\t\t\t\t'Validate JSON syntax in the config file',\n\t\t\t\t'Check for required fields (spec, output)',\n\t\t\t],\n\t\t\tcause,\n\t\t});\n\t},\n\n\tvalidationFailed(\n\t\tpath: string,\n\t\tdetails: string,\n\t\tcause?: Error\n\t): ApicodegenError {\n\t\treturn new ApicodegenError({\n\t\t\tcode: ErrorCodes.VALIDATION_FAILED,\n\t\t\tmessage: 'OpenAPI spec validation failed',\n\t\t\tlocation: path,\n\t\t\tpath: details,\n\t\t\tsuggestions: [\n\t\t\t\t'Check OpenAPI spec structure at the specified path',\n\t\t\t\t'Ensure all required fields are present',\n\t\t\t\t'Validate using swagger.io editor',\n\t\t\t],\n\t\t\tcause,\n\t\t});\n\t},\n\n\tgenerationFailed(cause?: Error): ApicodegenError {\n\t\treturn new ApicodegenError({\n\t\t\tcode: ErrorCodes.GENERATION_FAILED,\n\t\t\tmessage: 'Code generation failed',\n\t\t\tsuggestions: [\n\t\t\t\t'Check for unsupported OpenAPI features',\n\t\t\t\t'Ensure spec follows OpenAPI 2.0, 3.0, or 3.1 specification',\n\t\t\t\t'Use --verbose for more details',\n\t\t\t],\n\t\t\tcause,\n\t\t});\n\t},\n\n\ttypeCheckFailed(\n\t\tpath: string,\n\t\t_errors: string[],\n\t\tcause?: Error\n\t): ApicodegenError {\n\t\treturn new ApicodegenError({\n\t\t\tcode: ErrorCodes.TYPE_CHECK_FAILED,\n\t\t\tmessage: 'TypeScript type check failed',\n\t\t\tlocation: path,\n\t\t\tsuggestions: [\n\t\t\t\t'Review type errors above',\n\t\t\t\t'Check for schema inconsistencies',\n\t\t\t\t'Update generated types or fix source schema',\n\t\t\t],\n\t\t\tcause,\n\t\t});\n\t},\n\n\tmissingRequiredField(field: string, context?: string): ApicodegenError {\n\t\treturn new ApicodegenError({\n\t\t\tcode: ErrorCodes.VALIDATION_FAILED,\n\t\t\tmessage: `Missing required field: ${field}`,\n\t\t\tpath: context,\n\t\t\tsuggestions: [`Add the '${field}' field to your configuration`],\n\t\t});\n\t},\n};\n\n/**\n * Wrap unknown error in ApicodegenError if needed\n */\nexport function wrapError(\n\terror: unknown,\n\tcontext?: Partial<ApicodegenErrorContext>\n): ApicodegenError {\n\tif (error instanceof ApicodegenError) {\n\t\treturn error;\n\t}\n\n\tif (error instanceof Error) {\n\t\treturn new ApicodegenError({\n\t\t\tcode: context?.code || ErrorCodes.GENERATION_FAILED,\n\t\t\tmessage: context?.message || error.message,\n\t\t\tlocation: context?.location,\n\t\t\tsuggestions: context?.suggestions,\n\t\t\tcause: error,\n\t\t});\n\t}\n\n\treturn new ApicodegenError({\n\t\tcode: context?.code || ErrorCodes.GENERATION_FAILED,\n\t\tmessage: String(error),\n\t\tsuggestions: context?.suggestions,\n\t});\n}\n\n/**\n * Check if error is an ApicodegenError\n */\nexport function isApicodegenError(error: unknown): error is ApicodegenError {\n\treturn error instanceof ApicodegenError;\n}\n","/* eslint-disable @typescript-eslint/no-unsafe-enum-comparison */\n/* eslint-disable no-case-declarations */\n\nimport { writeFile } from 'node:fs/promises';\nimport { format } from 'prettier';\nimport type {\n\tBindingElement,\n\tBlock,\n\tNode,\n\tParameterDeclaration,\n\tPropertySignature,\n\tStatement,\n\tTypeNode,\n} from 'typescript';\nimport {\n\taddSyntheticLeadingComment,\n\tcreatePrinter,\n\tNodeFlags,\n\tSyntaxKind,\n\tfactory as t,\n} from 'typescript';\nimport type { Adapter } from '../base/Adaptor.js';\nimport { Base } from '../base/Base.js';\nimport { ApicodegenError, ErrorCodes } from '../errors.js';\nimport type {\n\tArrayTypeSchemaObject,\n\tMediaTypeObject,\n\tParameterObject,\n\tProviderInitOptions,\n\tProviderInitResult,\n\tSchemaObject,\n\tSingleTypeSchemaObject,\n} from '../interface.js';\nimport {\n\tArraySchemaType,\n\tMediaTypes,\n\tNonArraySchemaType,\n\tParameterIn,\n\tSchemaFormatType,\n} from '../interface.js';\n\n/**\n * Represents a comment object with optional tag and message.\n */\nexport type CommentObject = {\n\ttag?: 'deprecated' | 'param' | 'returns';\n\tcomment: string;\n\tparamName?: string;\n\ttype?: string;\n};\n\n/**\n * Array of comment objects to be added to the code.\n */\nexport type Comments = CommentObject[];\n\nexport class Generator {\n\t/**\n\t * Converts an array of TypeScript statements into a formatted string of code.\n\t *\n\t * @param statements - The array of TypeScript statement nodes.\n\t * @returns Formatted code as a string.\n\t * @throws {Error} If no valid statements are provided.\n\t */\n\tstatic toCode(statements: Statement[]): string {\n\t\tif (statements.length === 0) {\n\t\t\treturn '// No api declaration found.';\n\t\t}\n\n\t\tconst sourceFile = t.createSourceFile(\n\t\t\tstatements,\n\t\t\tt.createToken(SyntaxKind.EndOfFileToken),\n\t\t\tNodeFlags.None\n\t\t);\n\n\t\treturn createPrinter().printFile(sourceFile);\n\t}\n\n\tstatic async write(code: string, filepath: string) {\n\t\tconst { mkdir } = await import('node:fs/promises');\n\t\tconst { dirname } = await import('node:path');\n\t\ttry {\n\t\t\tawait mkdir(dirname(filepath), { recursive: true });\n\t\t\tawait writeFile(filepath, code);\n\t\t} catch (error) {\n\t\t\tthrow new ApicodegenError({\n\t\t\t\tcode: ErrorCodes.OUTPUT_DIR_MISSING,\n\t\t\t\tmessage: 'Failed to write generated code to output file',\n\t\t\t\tlocation: filepath,\n\t\t\t\tcause: error instanceof Error ? error : new Error(String(error)),\n\t\t\t\tsuggestions: [\n\t\t\t\t\t'Verify the output directory path is writable',\n\t\t\t\t\t'Check that the parent directory exists or can be created',\n\t\t\t\t],\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Converts a path string with parameters into a TypeScript template expression.\n\t * Handles query parameters and path placeholders.\n\t *\n\t * @param path - The base path string containing placeholders.\n\t * @param parameters - Array of parameter objects defining the parameters.\n\t * @param basePath - Optional base path to prepend (default: \"\").\n\t * @returns A TypeScript template expressi\n\t */\n\tstatic toUrlTemplate(\n\t\tpath: string,\n\t\tparameters: ParameterObject[],\n\t\tbasePath = ''\n\t) {\n\t\t// Extract query parameters\n\t\tconst queryParameters = parameters.filter(\n\t\t\t(p) => p.in === ParameterIn.query\n\t\t);\n\n\t\tif (queryParameters.length > 0) {\n\t\t\tconst queryString = queryParameters\n\t\t\t\t.map(\n\t\t\t\t\t(qp, index) =>\n\t\t\t\t\t\t`${index === 0 ? '?' : '&'}${encodeURIComponent(qp.name)}={${Base.normalize(qp.name)}}`\n\t\t\t\t)\n\t\t\t\t.join('');\n\t\t\tpath += queryString;\n\t\t}\n\n\t\t// Split the path into segments\n\t\tconst pathSegments = path.replaceAll('{', '${').split('$').filter(Boolean);\n\n\t\t// If path segments only got one item, it means there are no parameters in path. So just return the path literal.\n\t\tif (pathSegments.length === 1) {\n\t\t\treturn t.createNoSubstitutionTemplateLiteral(basePath + path);\n\t\t}\n\n\t\treturn t.createTemplateExpression(\n\t\t\tt.createTemplateHead(basePath + pathSegments[0]),\n\t\t\tpathSegments.slice(1).map((segment, index) => {\n\t\t\t\tconst match = /^{(.+)}(.+)?/gm.exec(segment);\n\t\t\t\tconst isLastSegment = index === pathSegments.length - 2;\n\n\t\t\t\tif (!match) {\n\t\t\t\t\tthrow new Error(`Invalid path segment: ${segment}`);\n\t\t\t\t}\n\n\t\t\t\treturn t.createTemplateSpan(\n\t\t\t\t\tt.createIdentifier(Base.normalize(match[1])),\n\t\t\t\t\t!isLastSegment\n\t\t\t\t\t\t? t.createTemplateMiddle(match[2])\n\t\t\t\t\t\t: t.createTemplateTail(match[2] || '')\n\t\t\t\t);\n\t\t\t})\n\t\t);\n\t}\n\n\t/**\n\t * Adds synthetic comments to a TypeScript AST node.\n\t *\n\t * @param node - The target AST node.\n\t * @param comments - Array of comment objects to add.\n\t */\n\tstatic addComments(node: Node, comments: Comments) {\n\t\tif (!Array.isArray(comments) || comments.filter(Boolean).length === 0)\n\t\t\treturn;\n\n\t\tconst formatComment = (comment: CommentObject): string => {\n\t\t\tif (comment.tag === 'returns') {\n\t\t\t\treturn `* @returns {${comment.type}} ${comment.comment ?? ''}`;\n\t\t\t}\n\t\t\tif (comment.tag === 'param') {\n\t\t\t\treturn comment.comment\n\t\t\t\t\t? `* @param ${comment.paramName} - ${comment.comment}`\n\t\t\t\t\t: `* @param ${comment.paramName}`;\n\t\t\t}\n\t\t\tif (comment.tag) {\n\t\t\t\treturn `* @${comment.tag} ${comment.comment ?? ''}`;\n\t\t\t}\n\t\t\treturn `* ${comment.comment}`;\n\t\t};\n\n\t\tconst formattedComments =\n\t\t\tcomments.map(formatComment).join('\\n').trim() + '\\n';\n\n\t\taddSyntheticLeadingComment(\n\t\t\tnode,\n\t\t\tSyntaxKind.MultiLineCommentTrivia,\n\t\t\tformattedComments,\n\t\t\ttrue\n\t\t);\n\t}\n\n\t/**\n\t * Checks if a schema represents a binary type.\n\t *\n\t * @param schema - The schema object to check.\n\t * @returns true if the schema is a binary type, false otherwise.\n\t */\n\tstatic isBinarySchema(schema: SchemaObject): boolean {\n\t\tif (schema.type === 'array') {\n\t\t\tconst arraySchema = schema as ArrayTypeSchemaObject;\n\t\t\treturn Generator.isBinarySchema(arraySchema.items!);\n\t\t}\n\n\t\tconst nonArraySchema = schema as SingleTypeSchemaObject;\n\t\treturn (\n\t\t\tnonArraySchema.format === SchemaFormatType.blob ||\n\t\t\tnonArraySchema.format === SchemaFormatType.binary ||\n\t\t\tnonArraySchema.type === SchemaFormatType.file\n\t\t);\n\t}\n\n\tstatic schemaToTypeString(schema: SchemaObject): string {\n\t\tif (schema.type === 'array') {\n\t\t\tconst arraySchema = schema as ArrayTypeSchemaObject;\n\t\t\treturn arraySchema.items\n\t\t\t\t? `${Generator.schemaToTypeString(arraySchema.items)}[]`\n\t\t\t\t: 'unknown';\n\t\t}\n\t\tconst singleSchema = schema as SingleTypeSchemaObject;\n\t\tif (schema.type === 'string') return 'string';\n\t\tif (schema.type === 'number' || schema.type === 'integer') return 'number';\n\t\tif (schema.type === 'boolean') return 'boolean';\n\t\tif (\n\t\t\tschema.type === 'object' ||\n\t\t\t(schema as SingleTypeSchemaObject).properties\n\t\t)\n\t\t\treturn 'object';\n\t\tif (singleSchema.format === 'binary' || singleSchema.type === 'file')\n\t\t\treturn 'Blob';\n\t\tif (singleSchema.format === 'blob') return 'Blob';\n\t\tif (singleSchema.ref) return singleSchema.ref;\n\t\treturn 'unknown';\n\t}\n\n\tstatic generateParamTags(\n\t\tparameters: ParameterObject[],\n\t\trequestBody?: MediaTypeObject\n\t): CommentObject[] {\n\t\tconst tags: CommentObject[] = [];\n\n\t\tfor (const p of parameters) {\n\t\t\tconst paramName = Base.normalize(p.name);\n\t\t\tlet paramType = 'unknown';\n\n\t\t\tif (p.schema) {\n\t\t\t\tparamType = Generator.schemaToTypeString(p.schema);\n\t\t\t}\n\n\t\t\tconst isOptional = p.required === false;\n\t\t\ttags.push({\n\t\t\t\ttag: 'param',\n\t\t\t\tparamName: paramName,\n\t\t\t\ttype: `${paramType}${isOptional ? ' | undefined' : ''}`,\n\t\t\t\tcomment: p.description ?? '',\n\t\t\t});\n\t\t}\n\n\t\tif (requestBody?.schema && 'properties' in requestBody.schema) {\n\t\t\tconst properties = requestBody.schema.properties as Record<\n\t\t\t\tstring,\n\t\t\t\tSchemaObject\n\t\t\t>;\n\t\t\tconst required = requestBody.schema.required;\n\t\t\tconst requiredArray = Array.isArray(required) ? required : [];\n\t\t\tfor (const [key, schema] of Object.entries(properties ?? {})) {\n\t\t\t\tconst paramName = `req.${key}`;\n\t\t\t\tconst paramType = Generator.schemaToTypeString(schema);\n\t\t\t\tconst isOptional = !requiredArray.includes(key);\n\t\t\t\ttags.push({\n\t\t\t\t\ttag: 'param',\n\t\t\t\t\tparamName: paramName,\n\t\t\t\t\ttype: `${paramType}${isOptional ? ' | undefined' : ''}`,\n\t\t\t\t\tcomment: schema.description ?? '',\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\treturn tags;\n\t}\n\n\tstatic toRequestBodyTypeNode(schema: SchemaObject) {\n\t\treturn t.createParameterDeclaration(\n\t\t\tundefined,\n\t\t\tundefined,\n\t\t\tt.createIdentifier('req'),\n\t\t\tundefined,\n\t\t\tGenerator.toTypeNode(schema)\n\t\t);\n\t}\n\n\tstatic toTypeNode(schema: SchemaObject): TypeNode {\n\t\tconst { type, ref } = schema;\n\n\t\tif (ref) {\n\t\t\tconst identify = Base.ref2name(ref);\n\t\t\treturn t.createTypeReferenceNode(\n\t\t\t\tt.createIdentifier(\n\t\t\t\t\tidentify === 'unknown' ? identify : Base.upperCamelCase(identify)\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\n\t\tswitch (type) {\n\t\t\tcase ArraySchemaType.array: {\n\t\t\t\tconst { items } = schema as ArrayTypeSchemaObject;\n\t\t\t\treturn t.createArrayTypeNode(Generator.toTypeNode(items!));\n\t\t\t}\n\t\t\tcase NonArraySchemaType.object: {\n\t\t\t\tconst propsCount = Object.keys(schema.properties ?? {}).length;\n\t\t\t\tif (!schema.properties || propsCount === 0) {\n\t\t\t\t\t// Record<string, unknown>\n\t\t\t\t\treturn t.createTypeReferenceNode(t.createIdentifier('Record'), [\n\t\t\t\t\t\tt.createToken(SyntaxKind.StringKeyword),\n\t\t\t\t\t\tt.createToken(SyntaxKind.UnknownKeyword),\n\t\t\t\t\t]);\n\t\t\t\t}\n\n\t\t\t\tconst props = Object.keys(schema.properties);\n\n\t\t\t\treturn t.createTypeLiteralNode(\n\t\t\t\t\tprops.map((propKey) => {\n\t\t\t\t\t\tconst propSchema = schema.properties![propKey];\n\t\t\t\t\t\treturn t.createPropertySignature(\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\tt.createStringLiteral(propKey),\n\t\t\t\t\t\t\t// When field is required, a refrence or binary value, don't add question mark.\n\t\t\t\t\t\t\tschema.required || schema.ref || Generator.isBinarySchema(schema)\n\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t: t.createToken(SyntaxKind.QuestionToken),\n\t\t\t\t\t\t\tGenerator.toTypeNode(propSchema)\n\t\t\t\t\t\t);\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t}\n\t\t\tcase NonArraySchemaType.integer:\n\t\t\tcase NonArraySchemaType.number:\n\t\t\t\tif (schema.enum) {\n\t\t\t\t\treturn t.createUnionTypeNode(\n\t\t\t\t\t\tschema.enum.map((e) =>\n\t\t\t\t\t\t\tt.createLiteralTypeNode(t.createNumericLiteral(e))\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn t.createToken(SyntaxKind.NumberKeyword);\n\t\t\t// case NonArraySchemaType.string:\n\t\t\tcase NonArraySchemaType.boolean:\n\t\t\t\treturn t.createToken(SyntaxKind.BooleanKeyword);\n\t\t\tcase NonArraySchemaType.file:\n\t\t\t\treturn t.createTypeReferenceNode(t.createIdentifier('Blob'));\n\t\t\tdefault: {\n\t\t\t\tconst {\n\t\t\t\t\tformat,\n\t\t\t\t\toneOf,\n\t\t\t\t\tallOf,\n\t\t\t\t\tanyOf,\n\t\t\t\t\ttype,\n\t\t\t\t\tenum: enum_,\n\t\t\t\t} = schema as SingleTypeSchemaObject;\n\n\t\t\t\tswitch (format) {\n\t\t\t\t\tcase SchemaFormatType.number:\n\t\t\t\t\t\treturn t.createToken(SyntaxKind.NumberKeyword);\n\t\t\t\t\tcase SchemaFormatType.string:\n\t\t\t\t\t\treturn t.createToken(SyntaxKind.StringKeyword);\n\t\t\t\t\tcase SchemaFormatType.boolean:\n\t\t\t\t\t\treturn t.createToken(SyntaxKind.BooleanKeyword);\n\t\t\t\t\tcase SchemaFormatType.blob:\n\t\t\t\t\tcase SchemaFormatType.binary:\n\t\t\t\t\t\treturn t.createTypeReferenceNode(t.createIdentifier('Blob'));\n\t\t\t\t\tdefault:\n\t\t\t\t}\n\n\t\t\t\tif (enum_) {\n\t\t\t\t\treturn t.createUnionTypeNode(\n\t\t\t\t\t\tenum_.map((e) =>\n\t\t\t\t\t\t\tt.createLiteralTypeNode(t.createStringLiteral(e as string))\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tif (type === NonArraySchemaType.string) {\n\t\t\t\t\treturn t.createToken(SyntaxKind.StringKeyword);\n\t\t\t\t}\n\n\t\t\t\tif (oneOf) {\n\t\t\t\t\treturn t.createUnionTypeNode(\n\t\t\t\t\t\toneOf.map((schema) => Generator.toTypeNode(schema))\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tif (anyOf) {\n\t\t\t\t\treturn t.createUnionTypeNode(\n\t\t\t\t\t\tanyOf.map((schema) => Generator.toTypeNode(schema))\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tif (allOf) {\n\t\t\t\t\treturn t.createIntersectionTypeNode(\n\t\t\t\t\t\tallOf.map((schema) => Generator.toTypeNode(schema))\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tif (type && typeof type === 'string') {\n\t\t\t\t\treturn t.createTypeReferenceNode(\n\t\t\t\t\t\ttype !== 'unknown' && type !== 'null'\n\t\t\t\t\t\t\t? t.createIdentifier(Base.upperCamelCase(type))\n\t\t\t\t\t\t\t: type\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn t.createToken(SyntaxKind.UnknownKeyword);\n\t}\n\n\tstatic toDeclarationNodes(\n\t\tparameters: ParameterObject[]\n\t): ParameterDeclaration[] {\n\t\tconst objectElements: BindingElement[] = [];\n\t\tconst typeObjectElements: PropertySignature[] = [];\n\t\tconst refParameters: ParameterDeclaration[] = [];\n\n\t\tfor (const parameter of parameters) {\n\t\t\tif (parameter.ref) {\n\t\t\t\t// Handle reference parameters as standalone parameters\n\t\t\t\tconst refName = Base.ref2name(parameter.ref);\n\t\t\t\trefParameters.push(\n\t\t\t\t\tt.createParameterDeclaration(\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\tt.createIdentifier(Base.normalize(refName)),\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\tt.createTypeReferenceNode(\n\t\t\t\t\t\t\tt.createIdentifier(Base.upperCamelCase(Base.normalize(refName)))\n\t\t\t\t\t\t),\n\t\t\t\t\t\tundefined\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tconst { name, schema, required } = parameter;\n\t\t\t\tobjectElements.push(\n\t\t\t\t\tt.createBindingElement(\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\tt.createIdentifier(Base.normalize(name))\n\t\t\t\t\t)\n\t\t\t\t);\n\n\t\t\t\ttypeObjectElements.push(\n\t\t\t\t\tt.createPropertySignature(\n\t\t\t\t\t\t[],\n\t\t\t\t\t\tt.createIdentifier(Base.normalize(name)),\n\t\t\t\t\t\trequired ? undefined : t.createToken(SyntaxKind.QuestionToken),\n\t\t\t\t\t\t!schema\n\t\t\t\t\t\t\t? t.createToken(SyntaxKind.UnknownKeyword)\n\t\t\t\t\t\t\t: Generator.toTypeNode(schema)\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// Build object destructuring parameter for non-ref parameters\n\t\tif (objectElements.length > 0) {\n\t\t\tconst objectParam = t.createParameterDeclaration(\n\t\t\t\tundefined,\n\t\t\t\tundefined,\n\t\t\t\tt.createObjectBindingPattern(objectElements),\n\t\t\t\tundefined,\n\t\t\t\tt.createTypeLiteralNode(typeObjectElements),\n\t\t\t\tundefined\n\t\t\t);\n\t\t\treturn [objectParam, ...refParameters];\n\t\t}\n\n\t\treturn refParameters;\n\t}\n\n\tstatic toFormDataStatement(\n\t\tparameters: ParameterObject[],\n\t\trequestBody?: SchemaObject\n\t): Statement[] {\n\t\tconst statements: Statement[] = [];\n\t\tconst fdDeclaration = t.createVariableStatement(\n\t\t\tundefined,\n\t\t\tt.createVariableDeclarationList(\n\t\t\t\t[\n\t\t\t\t\tt.createVariableDeclaration(\n\t\t\t\t\t\tt.createIdentifier('fd'),\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\tt.createNewExpression(t.createIdentifier('FormData'), undefined, [])\n\t\t\t\t\t),\n\t\t\t\t],\n\t\t\t\tNodeFlags.Const\n\t\t\t)\n\t\t);\n\n\t\tstatements.push(fdDeclaration);\n\n\t\tparameters.forEach((parameter) => {\n\t\t\tstatements.push(\n\t\t\t\tt.createExpressionStatement(\n\t\t\t\t\tt.createBinaryExpression(\n\t\t\t\t\t\tt.createIdentifier(parameter.name),\n\t\t\t\t\t\tt.createToken(SyntaxKind.AmpersandAmpersandToken),\n\t\t\t\t\t\tt.createCallExpression(\n\t\t\t\t\t\t\tt.createPropertyAccessExpression(\n\t\t\t\t\t\t\t\tt.createIdentifier('fd'),\n\t\t\t\t\t\t\t\tt.createIdentifier('append')\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\tt.createStringLiteral(parameter.name),\n\t\t\t\t\t\t\t\tt.createIdentifier(parameter.name),\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t);\n\t\t});\n\n\t\tif (\n\t\t\trequestBody &&\n\t\t\trequestBody.type === 'object' &&\n\t\t\trequestBody.properties &&\n\t\t\tObject.keys(requestBody.properties).length !== 0\n\t\t) {\n\t\t\tObject.keys(requestBody.properties).forEach((key) => {\n\t\t\t\tconst schemaByKey = requestBody.properties![key];\n\t\t\t\tif (\n\t\t\t\t\tschemaByKey.type === ArraySchemaType.array &&\n\t\t\t\t\tGenerator.isBinarySchema(schemaByKey)\n\t\t\t\t) {\n\t\t\t\t\tstatements.push(\n\t\t\t\t\t\tt.createForOfStatement(\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\tt.createVariableDeclarationList(\n\t\t\t\t\t\t\t\t[t.createVariableDeclaration('file')],\n\t\t\t\t\t\t\t\tNodeFlags.Const\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tt.createElementAccessExpression(\n\t\t\t\t\t\t\t\tt.createIdentifier('req'),\n\t\t\t\t\t\t\t\tt.createStringLiteral(key)\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tt.createBlock([\n\t\t\t\t\t\t\t\tt.createExpressionStatement(\n\t\t\t\t\t\t\t\t\tt.createCallExpression(\n\t\t\t\t\t\t\t\t\t\tt.createPropertyAccessExpression(\n\t\t\t\t\t\t\t\t\t\t\tt.createIdentifier('fd'),\n\t\t\t\t\t\t\t\t\t\t\tt.createIdentifier('append')\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t[],\n\t\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t\tt.createStringLiteral(key),\n\t\t\t\t\t\t\t\t\t\t\tt.createIdentifier('file'),\n\t\t\t\t\t\t\t\t\t\t\tt.createPropertyAccessExpression(\n\t\t\t\t\t\t\t\t\t\t\t\tt.createAsExpression(\n\t\t\t\t\t\t\t\t\t\t\t\t\tt.createIdentifier('file'),\n\t\t\t\t\t\t\t\t\t\t\t\t\tt.createTypeReferenceNode(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tt.createIdentifier('File'),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tundefined\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\tt.createIdentifier('name')\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t])\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tif (schemaByKey.required) {\n\t\t\t\t\t\tstatements.push(\n\t\t\t\t\t\t\tt.createExpressionStatement(\n\t\t\t\t\t\t\t\tt.createCallExpression(\n\t\t\t\t\t\t\t\t\tt.createPropertyAccessExpression(\n\t\t\t\t\t\t\t\t\t\tt.createIdentifier('fd'),\n\t\t\t\t\t\t\t\t\t\tt.createIdentifier('append')\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\tt.createStringLiteral(key),\n\t\t\t\t\t\t\t\t\t\tschemaByKey.type === 'string' ||\n\t\t\t\t\t\t\t\t\t\tGenerator.isBinarySchema(schemaByKey as SchemaObject) ||\n\t\t\t\t\t\t\t\t\t\t(schemaByKey as SingleTypeSchemaObject).isRef\n\t\t\t\t\t\t\t\t\t\t\t? t.createElementAccessExpression(\n\t\t\t\t\t\t\t\t\t\t\t\t\tt.createIdentifier('req'),\n\t\t\t\t\t\t\t\t\t\t\t\t\tt.createStringLiteral(key)\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t: schemaByKey.type === 'array' ||\n\t\t\t\t\t\t\t\t\t\t\t\t\tschemaByKey.type === 'object'\n\t\t\t\t\t\t\t\t\t\t\t\t? t.createCallExpression(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tt.createPropertyAccessExpression(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tt.createIdentifier('JSON'),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tt.createIdentifier('stringify')\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tt.createElementAccessExpression(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tt.createIdentifier('req'),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tt.createStringLiteral(key)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t: t.createCallExpression(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tt.createIdentifier('String'),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tt.createElementAccessExpression(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tt.createIdentifier('req'),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tt.createStringLiteral(key)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tstatements.push(\n\t\t\t\t\t\t\tt.createExpressionStatement(\n\t\t\t\t\t\t\t\tt.createBinaryExpression(\n\t\t\t\t\t\t\t\t\tt.createElementAccessExpression(\n\t\t\t\t\t\t\t\t\t\tt.createIdentifier('req'),\n\t\t\t\t\t\t\t\t\t\tt.createStringLiteral(key)\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tt.createToken(SyntaxKind.AmpersandAmpersandToken),\n\t\t\t\t\t\t\t\t\tt.createCallExpression(\n\t\t\t\t\t\t\t\t\t\tt.createPropertyAccessExpression(\n\t\t\t\t\t\t\t\t\t\t\tt.createIdentifier('fd'),\n\t\t\t\t\t\t\t\t\t\t\tt.createIdentifier('append')\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t\tt.createStringLiteral(key),\n\t\t\t\t\t\t\t\t\t\t\tschemaByKey.type === 'string' ||\n\t\t\t\t\t\t\t\t\t\t\tGenerator.isBinarySchema(schemaByKey as SchemaObject) ||\n\t\t\t\t\t\t\t\t\t\t\t(schemaByKey as SingleTypeSchemaObject).isRef\n\t\t\t\t\t\t\t\t\t\t\t\t? t.createElementAccessExpression(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tt.createIdentifier('req'),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tt.createStringLiteral(key)\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t: schemaByKey.type === 'array' ||\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tschemaByKey.type === 'object'\n\t\t\t\t\t\t\t\t\t\t\t\t\t? t.createCallExpression(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tt.createPropertyAccessExpression(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tt.createIdentifier('JSON'),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tt.createIdentifier('stringify')\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tt.createElementAccessExpression(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tt.createIdentifier('req'),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tt.createStringLiteral(key)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t: t.createCallExpression(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tt.createIdentifier('String'),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tt.createElementAccessExpression(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tt.createIdentifier('req'),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tt.createStringLiteral(key)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\treturn statements;\n\t}\n\n\tstatic bodyBlock(\n\t\turi: string,\n\t\tmethod: string,\n\t\tparameters: ParameterObject[],\n\t\trequestBody: MediaTypeObject | undefined,\n\t\tresponse: MediaTypeObject | undefined,\n\t\tadapter: Adapter\n\t): Block {\n\t\tconst isFormDataRequest =\n\t\t\trequestBody &&\n\t\t\t['multipart/form-data', 'application/x-www-form-urlencoded'].includes(\n\t\t\t\trequestBody.type\n\t\t\t);\n\n\t\tconst shouldParseResponseToJSON = 'application/json' === response?.type;\n\t\tconst isEventStream = response?.type === 'text/event-stream';\n\n\t\t// Ignore one and only blob parameter.\n\t\tconst isRequestBodyBinary =\n\t\t\trequestBody?.schema &&\n\t\t\trequestBody.schema.type === ArraySchemaType.array &&\n\t\t\tGenerator.isBinarySchema(requestBody.schema);\n\n\t\tconst parametersShouldPutInFormData = parameters.filter(\n\t\t\t(p) =>\n\t\t\t\tp.in === ParameterIn.formData ||\n\t\t\t\t(p.schema && Generator.isBinarySchema(p.schema))\n\t\t);\n\n\t\tconst parametersShouldNotPutInFormData = parameters.filter(\n\t\t\t(p) => !parametersShouldPutInFormData.includes(p)\n\t\t);\n\n\t\tconst isRequestBodyContainsBinary =\n\t\t\trequestBody?.schema &&\n\t\t\t'properties' in requestBody.schema &&\n\t\t\tObject.values(requestBody.schema?.properties ?? {}).some((p) =>\n\t\t\t\tGenerator.isBinarySchema(p)\n\t\t\t);\n\n\t\tconst hasBinaryInParameters = parameters.some(\n\t\t\t(p) => p?.schema && Generator.isBinarySchema(p.schema)\n\t\t);\n\n\t\tconst shouldPutParametersOrBodyInFormData =\n\t\t\t!!isFormDataRequest &&\n\t\t\t(isRequestBodyBinary ||\n\t\t\t\thasBinaryInParameters ||\n\t\t\t\tisRequestBodyContainsBinary ||\n\t\t\t\tparametersShouldPutInFormData.length > 0);\n\n\t\treturn t.createBlock([\n\t\t\t...(shouldPutParametersOrBodyInFormData\n\t\t\t\t? Generator.toFormDataStatement(\n\t\t\t\t\t\tparametersShouldPutInFormData,\n\t\t\t\t\t\trequestBody?.schema\n\t\t\t\t\t)\n\t\t\t\t: []),\n\t\t\t...adapter.client(\n\t\t\t\turi,\n\t\t\t\tmethod,\n\t\t\t\tparametersShouldNotPutInFormData,\n\t\t\t\trequestBody,\n\t\t\t\tresponse,\n\t\t\t\tadapter,\n\t\t\t\tshouldPutParametersOrBodyInFormData,\n\t\t\t\tshouldParseResponseToJSON,\n\t\t\t\tisEventStream\n\t\t\t),\n\t\t]);\n\t}\n\n\tstatic schemaToStatemets(\n\t\tparsedDoc: ProviderInitResult,\n\t\tadaptor: Adapter,\n\t\toptions: Omit<ProviderInitOptions, 'docURL' | 'output' | 'requestOptions'>\n\t): Statement[] {\n\t\tconst statements = [] as Statement[];\n\t\tconst { apis, schemas = {}, enums } = parsedDoc;\n\n\t\tconst enumNames: string[] = [];\n\n\t\tfor (const enumObject of enums) {\n\t\t\tenumNames.push(Base.upperCamelCase(enumObject.name));\n\t\t\tstatements.push(\n\t\t\t\tt.createEnumDeclaration(\n\t\t\t\t\t[t.createToken(SyntaxKind.ExportKeyword)],\n\t\t\t\t\tt.createIdentifier(Base.upperCamelCase(enumObject.name)),\n\t\t\t\t\tenumObject.enum.map((member) => {\n\t\t\t\t\t\treturn t.createEnumMember(\n\t\t\t\t\t\t\tt.createStringLiteral(\n\t\t\t\t\t\t\t\ttypeof member === 'string' ? member : `${member}_`\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\ttypeof member === 'string'\n\t\t\t\t\t\t\t\t? t.createStringLiteral(member)\n\t\t\t\t\t\t\t\t: t.createNumericLiteral(member)\n\t\t\t\t\t\t);\n\t\t\t\t\t})\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\n\t\tfor (const schemaKey in schemas) {\n\t\t\tif (\n\t\t\t\tObject.hasOwn(schemas, schemaKey) &&\n\t\t\t\t!enumNames.includes(Base.upperCamelCase(schemaKey))\n\t\t\t) {\n\t\t\t\tconst schema = schemas[schemaKey];\n\t\t\t\tstatements.push(\n\t\t\t\t\tt.createTypeAliasDeclaration(\n\t\t\t\t\t\t[t.createModifier(SyntaxKind.ExportKeyword)],\n\t\t\t\t\t\tt.createIdentifier(Base.upperCamelCase(schemaKey)),\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\tGenerator.toTypeNode(schema)\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tfor (const uri in apis) {\n\t\t\tconst operations = apis[uri];\n\t\t\tfor (const operation of operations) {\n\t\t\t\tconst {\n\t\t\t\t\tmethod,\n\t\t\t\t\toperationId,\n\t\t\t\t\trequestBody = [],\n\t\t\t\t\tresponses = [],\n\t\t\t\t\tsummary,\n\t\t\t\t\tdeprecated,\n\t\t\t\t\tdescription,\n\t\t\t\t} = operation;\n\n\t\t\t\tlet { parameters = [] } = operation;\n\n\t\t\t\tparameters = parameters.filter((p) => p.in !== 'cookie');\n\n\t\t\t\t// Add a default request, with no schema.\n\t\t\t\tif (requestBody.length === 0) {\n\t\t\t\t\trequestBody.push({ type: MediaTypes.JSON });\n\t\t\t\t}\n\n\t\t\t\tconst shouldAddExtraMethodNameSuffix = requestBody.length > 1;\n\n\t\t\t\tfor (const req of requestBody) {\n\t\t\t\t\tconst statement = t.createFunctionDeclaration(\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\tt.createModifier(SyntaxKind.ExportKeyword),\n\t\t\t\t\t\t\tt.createModifier(SyntaxKind.AsyncKeyword),\n\t\t\t\t\t\t],\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\tBase.pathToFnName(uri, method, operationId) +\n\t\t\t\t\t\t\t(shouldAddExtraMethodNameSuffix\n\t\t\t\t\t\t\t\t? Base.capitalize(req.type.split('/')[1])\n\t\t\t\t\t\t\t\t: ''),\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t...(parameters.length > 0\n\t\t\t\t\t\t\t\t? Generator.toDeclarationNodes(parameters)\n\t\t\t\t\t\t\t\t: []),\n\t\t\t\t\t\t\t...(req?.schema\n\t\t\t\t\t\t\t\t? [Generator.toRequestBodyTypeNode(req.schema)]\n\t\t\t\t\t\t\t\t: []),\n\t\t\t\t\t\t].filter(Boolean) as ParameterDeclaration[],\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\tGenerator.bodyBlock(\n\t\t\t\t\t\t\toptions.baseURL + uri,\n\t\t\t\t\t\t\tmethod,\n\t\t\t\t\t\t\tparameters,\n\t\t\t\t\t\t\treq,\n\t\t\t\t\t\t\tresponses[0],\n\t\t\t\t\t\t\tadaptor\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\n\t\t\t\t\tconst mergedDescription = [description, summary]\n\t\t\t\t\t\t.filter(Boolean)\n\t\t\t\t\t\t.join('. ');\n\t\t\t\t\tGenerator.addComments(\n\t\t\t\t\t\tstatement,\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\tmergedDescription && {\n\t\t\t\t\t\t\t\tcomment: mergedDescription,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tdeprecated && {\n\t\t\t\t\t\t\t\ttag: 'deprecated',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t...Generator.generateParamTags(parameters, req),\n\t\t\t\t\t\t].filter(Boolean) as CommentObject[]\n\t\t\t\t\t);\n\t\t\t\t\tstatements.push(statement);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn statements;\n\t}\n\n\tstatic async prettier(code: string) {\n\t\treturn await format(code, {\n\t\t\tparser: 'typescript',\n\t\t});\n\t}\n\n\tstatic async genCode(\n\t\tschema: ProviderInitResult,\n\t\tinitOptions: ProviderInitOptions,\n\t\tadaptor: Adapter\n\t) {\n\t\tconst { importClientSource } = initOptions;\n\t\tconst statements = Generator.schemaToStatemets(schema, adaptor, {\n\t\t\tbaseURL: initOptions.baseURL ?? '',\n\t\t});\n\t\tlet code = Generator.toCode(statements);\n\n\t\tif (importClientSource) {\n\t\t\tcode = importClientSource + '\\n\\n' + code;\n\t\t}\n\n\t\treturn await Generator.prettier(code);\n\t}\n}\n","/* eslint-disable unicorn/prefer-spread */\n/**\n * File containing the implementation of the AxiosAdapter class.\n * This adapter is responsible for generating code that uses the Axios HTTP client library.\n */\n\nimport type {\n\tPropertyAssignment,\n\tStatement,\n\tTypeReferenceNode,\n} from 'typescript';\nimport { factory as t } from 'typescript';\nimport { Adapter } from '../base/Adaptor.js';\nimport { Base } from '../base/Base.js';\nimport { Generator } from '../generator/index.js';\nimport type { MediaTypeObject, ParameterObject } from '../interface.js';\n\n/**\n * Adapter class implementing support for generating code that makes use of the Axios HTTP client library.\n * This class defines custom behavior and field mappings specific to the Axios client.\n */\nexport class AxiosAdapter extends Adapter {\n\t/**\n\t * Name of the field used to specify the HTTP method in the request configuration.\n\t */\n\treadonly methodFieldName = 'method';\n\n\t/**\n\t * Name of the field used to specify the request body (data) in the request configuration.\n\t */\n\treadonly bodyFieldName = 'data';\n\n\t/**\n\t * Name of the field used to specify the request headers in the request configuration.\n\t */\n\treadonly headersFieldName = 'headers';\n\n\t/**\n\t * Name of the field used to specify the query parameters in the request configuration.\n\t */\n\treadonly queryFieldName = 'params';\n\n\t/**\n\t * The name of the client this adapter is configured for, which is 'axios' in this case.\n\t */\n\treadonly name = 'axios';\n\n\t/**\n\t * Generates client code for making API requests using Axios.\n\t * @param uri - The API endpoint URI\n\t * @param method - The HTTP method (GET, POST, etc.)\n\t * @param parameters - Array of parameters to include in the request\n\t * @param requestBody - The request body media type definition\n\t * @param response - The response media type definition\n\t * @param adapter - The adapter instance\n\t * @param shouldUseFormData - Flag to use FormData for the request body\n\t * @param shouldUseJSONResponse - Unused by AxiosAdapter; present to align with the abstract signature so positional args bind correctly\n\t * @param isEventStream - Flag indicating a text/event-stream response; when true the raw AxiosResponse is returned without JSON parsing\n\t * @return - An array of generated TypeScript statements\n\t */\n\tpublic client(\n\t\turi: string,\n\t\tmethod: string,\n\t\tparameters: ParameterObject[],\n\t\trequestBody: MediaTypeObject | undefined,\n\t\tresponse: MediaTypeObject | undefined,\n\t\tadapter: Adapter,\n\t\tshouldUseFormData: boolean,\n\t\t_shouldUseJSONResponse: boolean,\n\t\tisEventStream: boolean\n\t): Statement[] {\n\t\tconst statements: Statement[] = [];\n\n\t\t// Split parameters into header and body parameters\n\t\tconst inBody = parameters.filter((p) => !p.in || p.in === 'body');\n\t\tconst inHeader = parameters.filter((p) => p.in === 'header');\n\n\t\t/**\n\t\t * Creates the literal object expression for fetch options\n\t\t * including method, headers, and body.\n\t\t * @returns - The constructed fetch options object\n\t\t */\n\t\tconst toLiterlExpression = (extraProperties: PropertyAssignment[] = []) => {\n\t\t\treturn t.createObjectLiteralExpression(\n\t\t\t\t[\n\t\t\t\t\t// Set the HTTP method\n\t\t\t\t\tt.createPropertyAssignment(\n\t\t\t\t\t\tt.createIdentifier(adapter.methodFieldName),\n\t\t\t\t\t\tt.createStringLiteral(method.toUpperCase())\n\t\t\t\t\t),\n\t\t\t\t]\n\t\t\t\t\t.concat(\n\t\t\t\t\t\t// Add headers if there are any\n\t\t\t\t\t\tinHeader.length > 0\n\t\t\t\t\t\t\t? t.createPropertyAssignment(\n\t\t\t\t\t\t\t\t\tt.createIdentifier(adapter.headersFieldName),\n\t\t\t\t\t\t\t\t\tt.createObjectLiteralExpression(\n\t\t\t\t\t\t\t\t\t\tinHeader.map((p) =>\n\t\t\t\t\t\t\t\t\t\t\tt.createPropertyAssignment(\n\t\t\t\t\t\t\t\t\t\t\t\tt.createStringLiteral(p.name),\n\t\t\t\t\t\t\t\t\t\t\t\tt.createCallExpression(\n\t\t\t\t\t\t\t\t\t\t\t\t\tt.createIdentifier('encodeURIComponent'),\n\t\t\t\t\t\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tt.createCallExpression(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tt.createIdentifier('String'),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t[t.createIdentifier(Base.normalize(p.name))]\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t: []\n\t\t\t\t\t)\n\t\t\t\t\t.concat(\n\t\t\t\t\t\tshouldUseFormData || inBody.length > 0 || requestBody?.schema\n\t\t\t\t\t\t\t? t.createPropertyAssignment(\n\t\t\t\t\t\t\t\t\tt.createIdentifier(adapter.bodyFieldName),\n\t\t\t\t\t\t\t\t\tshouldUseFormData\n\t\t\t\t\t\t\t\t\t\t? t.createIdentifier('fd')\n\t\t\t\t\t\t\t\t\t\t: inBody.length > 0 ||\n\t\t\t\t\t\t\t\t\t\t\t\t(requestBody?.schema &&\n\t\t\t\t\t\t\t\t\t\t\t\t\t!Generator.isBinarySchema(requestBody.schema))\n\t\t\t\t\t\t\t\t\t\t\t? t.createIdentifier('req')\n\t\t\t\t\t\t\t\t\t\t\t: t.createIdentifier('req')\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t: []\n\t\t\t\t\t)\n\t\t\t\t\t.concat(extraProperties),\n\t\t\t\ttrue\n\t\t\t);\n\t\t};\n\n\t\t// SSE responses need axios to use the fetch adapter and stream the\n\t\t// response body so callers can iterate over the event stream.\n\t\tif (isEventStream) {\n\t\t\tstatements.push(\n\t\t\t\tt.createReturnStatement(\n\t\t\t\t\tt.createCallExpression(t.createIdentifier(adapter.name), undefined, [\n\t\t\t\t\t\tGenerator.toUrlTemplate(uri, parameters),\n\t\t\t\t\t\ttoLiterlExpression([\n\t\t\t\t\t\t\tt.createPropertyAssignment(\n\t\t\t\t\t\t\t\tt.createIdentifier('adapter'),\n\t\t\t\t\t\t\t\tt.createStringLiteral('fetch')\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tt.createPropertyAssignment(\n\t\t\t\t\t\t\t\tt.createIdentifier('responseType'),\n\t\t\t\t\t\t\t\tt.createStringLiteral('stream')\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t]),\n\t\t\t\t\t])\n\t\t\t\t)\n\t\t\t);\n\t\t\treturn statements;\n\t\t}\n\n\t\t// Construct the fetch call and return statement\n\t\tstatements.push(\n\t\t\tt.createReturnStatement(\n\t\t\t\tt.createCallExpression(\n\t\t\t\t\tt.createIdentifier(adapter.name),\n\t\t\t\t\tresponse?.schema\n\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\tGenerator.toTypeNode(\n\t\t\t\t\t\t\t\t\tresponse.schema\n\t\t\t\t\t\t\t\t) as unknown as TypeReferenceNode,\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t: undefined,\n\t\t\t\t\t[Generator.toUrlTemplate(uri, parameters), toLiterlExpression()]\n\t\t\t\t)\n\t\t\t)\n\t\t);\n\n\t\treturn statements;\n\t}\n}\n","/* eslint-disable unicorn/prefer-spread */\n\nimport type { Statement } from 'typescript';\nimport { SyntaxKind, factory as t } from 'typescript';\nimport { Adapter } from '../base/Adaptor.js';\nimport { Base } from '../base/Base.js';\nimport { Generator } from '../generator/index.js';\nimport type { MediaTypeObject, ParameterObject } from '../interface.js';\n\n/**\n * FetchAdapter is an adapter class that generates client-side fetch requests.\n * It handles parameters, headers, and request bodies to construct proper fetch calls.\n */\nexport class FetchAdapter extends Adapter {\n\treadonly methodFieldName = 'method';\n\treadonly bodyFieldName = 'body';\n\treadonly headersFieldName = 'headers';\n\treadonly queryFieldName = '';\n\treadonly name = 'fetch';\n\n\t/**\n\t * Generates client code for making API requests using the Fetch API.\n\t * @param uri - The API endpoint URI\n\t * @param method - The HTTP method (GET, POST, etc.)\n\t * @param parameters - Array of parameters to include in the request\n\t * @param requestBody - The request body media type definition\n\t * @param response - The response media type definition\n\t * @param adapter - The adapter instance\n\t * @param shouldUseFormData - Flag to use FormData for the request body\n\t * @param shouldUseJSONResponse - Flag to use JSON parsing for the response\n\t * @param isEventStream - Flag indicating a text/event-stream response; when true the raw Response is returned unparsed\n\t * @return - An array of generated TypeScript statements\n\t */\n\tpublic client(\n\t\turi: string,\n\t\tmethod: string,\n\t\tparameters: ParameterObject[],\n\t\trequestBody: MediaTypeObject | undefined,\n\t\tresponse: MediaTypeObject | undefined,\n\t\tadapter: Adapter,\n\t\tshouldUseFormData: boolean,\n\t\tshouldUseJSONResponse: boolean,\n\t\tisEventStream: boolean\n\t): Statement[] {\n\t\tconst statements: Statement[] = [];\n\n\t\t// Split parameters into header and body parameters\n\t\tconst inBody = parameters.filter((p) => !p.in || p.in === 'body');\n\t\tconst inHeader = parameters.filter((p) => p.in === 'header');\n\n\t\t/**\n\t\t * Creates the literal object expression for fetch options\n\t\t * including method, headers, and body.\n\t\t * @returns - The constructed fetch options object\n\t\t */\n\t\tconst toLiterlExpression = () => {\n\t\t\treturn t.createObjectLiteralExpression(\n\t\t\t\t[\n\t\t\t\t\t// Set the HTTP method\n\t\t\t\t\tt.createPropertyAssignment(\n\t\t\t\t\t\tt.createIdentifier(adapter.methodFieldName),\n\t\t\t\t\t\tt.createStringLiteral(method.toUpperCase())\n\t\t\t\t\t),\n\t\t\t\t]\n\t\t\t\t\t.concat(\n\t\t\t\t\t\t// Add headers if there are any\n\t\t\t\t\t\tinHeader.length > 0\n\t\t\t\t\t\t\t? t.createPropertyAssignment(\n\t\t\t\t\t\t\t\t\tt.createIdentifier(adapter.headersFieldName),\n\t\t\t\t\t\t\t\t\tt.createObjectLiteralExpression(\n\t\t\t\t\t\t\t\t\t\tinHeader.map((p) =>\n\t\t\t\t\t\t\t\t\t\t\tt.createPropertyAssignment(\n\t\t\t\t\t\t\t\t\t\t\t\tt.createStringLiteral(p.name),\n\t\t\t\t\t\t\t\t\t\t\t\tt.createCallExpression(\n\t\t\t\t\t\t\t\t\t\t\t\t\tt.createIdentifier('encodeURIComponent'),\n\t\t\t\t\t\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tt.createCallExpression(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tt.createIdentifier('String'),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t[t.createIdentifier(Base.normalize(p.name))]\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t: []\n\t\t\t\t\t)\n\t\t\t\t\t.concat(\n\t\t\t\t\t\tshouldUseFormData || inBody.length > 0 || requestBody?.schema\n\t\t\t\t\t\t\t? t.createPropertyAssignment(\n\t\t\t\t\t\t\t\t\tt.createIdentifier(adapter.bodyFieldName),\n\t\t\t\t\t\t\t\t\tshouldUseFormData\n\t\t\t\t\t\t\t\t\t\t? t.createIdentifier('fd')\n\t\t\t\t\t\t\t\t\t\t: inBody.length > 0 ||\n\t\t\t\t\t\t\t\t\t\t\t\t(requestBody?.schema &&\n\t\t\t\t\t\t\t\t\t\t\t\t\t!Generator.isBinarySchema(requestBody.schema))\n\t\t\t\t\t\t\t\t\t\t\t? t.createCallExpression(\n\t\t\t\t\t\t\t\t\t\t\t\t\tt.createPropertyAccessExpression(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tt.createIdentifier('JSON'),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tt.createIdentifier('stringify')\n\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t\t[],\n\t\t\t\t\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\t\t\t\t\trequestBody\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? t.createIdentifier('req')\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: t.createObjectLiteralExpression(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tinBody.map((b) =>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tt.createShorthandPropertyAssignment(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tt.createIdentifier(b.name)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t: // One File parameter\n\t\t\t\t\t\t\t\t\t\t\t\tt.createIdentifier('req')\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t: []\n\t\t\t\t\t),\n\t\t\t\ttrue\n\t\t\t);\n\t\t};\n\n\t\t// SSE responses are returned unparsed so the caller can read the stream\n\t\tif (isEventStream) {\n\t\t\tstatements.push(\n\t\t\t\tt.createReturnStatement(\n\t\t\t\t\tt.createCallExpression(t.createIdentifier(adapter.name), undefined, [\n\t\t\t\t\t\tGenerator.toUrlTemplate(uri, parameters),\n\t\t\t\t\t\ttoLiterlExpression(),\n\t\t\t\t\t])\n\t\t\t\t)\n\t\t\t);\n\t\t\treturn statements;\n\t\t}\n\n\t\t// Construct the fetch call and return statement\n\t\tstatements.push(\n\t\t\tt.createReturnStatement(\n\t\t\t\tshouldUseJSONResponse\n\t\t\t\t\t? // Handle JSON response with proper type checking\n\t\t\t\t\t\tt.createCallExpression(\n\t\t\t\t\t\t\tt.createPropertyAccessExpression(\n\t\t\t\t\t\t\t\tt.createCallExpression(\n\t\t\t\t\t\t\t\t\tt.createIdentifier(adapter.name),\n\t\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\tGenerator.toUrlTemplate(uri, parameters),\n\t\t\t\t\t\t\t\t\t\ttoLiterlExpression(),\n\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tt.createIdentifier('then')\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\tt.createArrowFunction(\n\t\t\t\t\t\t\t\t\t[t.createModifier(SyntaxKind.AsyncKeyword)],\n\t\t\t\t\t\t\t\t\t[],\n\t\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t\tt.createParameterDeclaration(\n\t\t\t\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\t\t\t\tt.createIdentifier('response')\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\t\tt.createToken(SyntaxKind.EqualsGreaterThanToken),\n\t\t\t\t\t\t\t\t\tresponse?.schema\n\t\t\t\t\t\t\t\t\t\t? t.createAsExpression(\n\t\t\t\t\t\t\t\t\t\t\t\tt.createParenthesizedExpression(\n\t\t\t\t\t\t\t\t\t\t\t\t\tt.createAwaitExpression(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tt.createCallExpression(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tt.createPropertyAccessExpression(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tt.createIdentifier('response'),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tt.createIdentifier('json')\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t[]\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\tresponse?.schema\n\t\t\t\t\t\t\t\t\t\t\t\t\t? Generator.toTypeNode(response.schema)\n\t\t\t\t\t\t\t\t\t\t\t\t\t: t.createToken(SyntaxKind.UnknownKeyword)\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t: t.createParenthesizedExpression(\n\t\t\t\t\t\t\t\t\t\t\t\tt.createAwaitExpression(\n\t\t\t\t\t\t\t\t\t\t\t\t\tt.createCallExpression(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tt.createPropertyAccessExpression(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tt.createIdentifier('response'),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tt.createIdentifier('json')\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t[]\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t)\n\t\t\t\t\t: // Simple fetch call without JSON parsing\n\t\t\t\t\t\tt.createCallExpression(\n\t\t\t\t\t\t\tt.createIdentifier(adapter.name),\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t[Generator.toUrlTemplate(uri, parameters), toLiterlExpression()]\n\t\t\t\t\t\t)\n\t\t\t)\n\t\t);\n\n\t\treturn statements;\n\t}\n}\n","import path from 'node:path';\nimport fs from 'fs-extra';\n\nimport type { Adaptors, FetchDocRequestInit } from './interface.js';\n\n/**\n * Adaptor type for HTTP client\n */\nexport type ConfigAdaptor = keyof typeof Adaptors;\n\n/**\n * Shared config interface for CLI and Vite plugin\n */\nexport interface ApicodegenConfig {\n\t/** OpenAPI spec file path or URL (required) */\n\tspec: string;\n\t/** Output file path */\n\toutput: string;\n\t/** HTTP client adaptor (fetch|axios) */\n\tadaptor?: ConfigAdaptor;\n\t/** Base URL for API endpoints */\n\tbaseURL?: string;\n\t/** Custom client import source path */\n\timportClientSource?: string;\n\t/** Enable verbose logging */\n\tverbose?: boolean;\n\t/** Run type check after generation (default: true) */\n\ttypeCheck?: boolean;\n\t/** Watch for file changes */\n\twatch?: boolean;\n\t/** Request options for fetching spec */\n\trequestOptions?: FetchDocRequestInit;\n}\n\n/**\n * Options for loading config\n */\nexport interface LoadConfigOptions {\n\t/** Explicit config file path */\n\tconfigFile?: string;\n\t/** Config file directory (defaults to cwd) */\n\tcwd?: string;\n\t/** CLI overrides */\n\tcliOptions?: Partial<ApicodegenConfig>;\n\t/** Vite plugin options (for name metadata) */\n\tname?: string;\n}\n\n/**\n * Result of config loading\n */\nexport interface ResolvedConfig extends ApicodegenConfig {\n\t/** Config file path if loaded from file */\n\tconfigFilePath?: string;\n\t/** Config name for logging */\n\tname: string;\n}\n\n/**\n * Environment variable mappings\n */\nconst ENV_MAPPINGS: Record<string, keyof ApicodegenConfig> = {\n\tAPICODEGEN_SPEC: 'spec',\n\tAPICODEGEN_OUTPUT: 'output',\n\tAPICODEGEN_BASE_URL: 'baseURL',\n\tAPICODEGEN_ADAPTOR: 'adaptor',\n\tAPICODEGEN_VERBOSE: 'verbose',\n\tAPICODEGEN_WATCH: 'watch',\n\tAPICODEGEN_TYPE_CHECK: 'typeCheck',\n};\n\n/**\n * Load config from environment variables\n */\nfunction loadFromEnv(): Partial<ApicodegenConfig> {\n\tconst config: Partial<ApicodegenConfig> = {};\n\n\tfor (const [envKey, configKey] of Object.entries(ENV_MAPPINGS)) {\n\t\tconst value = process.env[envKey];\n\t\tif (value !== undefined) {\n\t\t\t// Convert string to appropriate type\n\t\t\tswitch (configKey) {\n\t\t\t\tcase 'verbose':\n\t\t\t\tcase 'watch':\n\t\t\t\tcase 'typeCheck':\n\t\t\t\t\tconfig[configKey] = value === 'true' || value === '1';\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'adaptor':\n\t\t\t\t\tconfig[configKey] = value as ConfigAdaptor;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tconfig[configKey] = value;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn config;\n}\n\n/**\n * Load config from a file\n */\nasync function loadFromFile(\n\tfilePath: string\n): Promise<Partial<ApicodegenConfig>> {\n\tconst ext = path.extname(filePath).toLowerCase();\n\n\ttry {\n\t\tif (ext === '.json' || ext === '.jsonc') {\n\t\t\tconst content = await fs.readFile(filePath, 'utf-8');\n\t\t\treturn JSON.parse(content);\n\t\t}\n\n\t\tif (ext === '.js' || ext === '.cjs' || ext === '.mjs') {\n\t\t\tconst mod = await import(filePath);\n\t\t\treturn mod.default || mod;\n\t\t}\n\n\t\tif (ext === '.ts') {\n\t\t\t// For .ts files, try to load as JSON first\n\t\t\tconst content = await fs.readFile(filePath, 'utf-8');\n\t\t\t// Try parsing as JSON (may work for JSON-like TS files)\n\t\t\ttry {\n\t\t\t\treturn JSON.parse(content);\n\t\t\t} catch {\n\t\t\t\t// For actual TS config, we'd need ts-node or similar\n\t\t\t\t// For now, fall back to looking for JSON export pattern\n\t\t\t\tconst jsonMatch = content.match(/export\\s+default\\s+(\\{.+\\})/s);\n\t\t\t\tif (jsonMatch) {\n\t\t\t\t\treturn JSON.parse(jsonMatch[1]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Try parsing as JSON for unknown extensions\n\t\tconst content = await fs.readFile(filePath, 'utf-8');\n\t\treturn JSON.parse(content);\n\t} catch (error) {\n\t\tthrow new Error(`Failed to load config from ${filePath}: ${error}`);\n\t}\n}\n\n/**\n * Find config file in project root\n */\nasync function findConfigFile(cwd: string): Promise<string | null> {\n\tconst configFiles = [\n\t\t'apicodegen.config.json',\n\t\t'apicodegen.config.js',\n\t\t'apicodegen.config.mjs',\n\t\t'.apicodegenrc',\n\t\t'.apicodegenrc.json',\n\t\t'.apicodegenrc.js',\n\t\t'.apicodegenrc.mjs',\n\t];\n\n\tfor (const fileName of configFiles) {\n\t\tconst filePath = path.join(cwd, fileName);\n\t\tif (await fs.pathExists(filePath)) {\n\t\t\treturn filePath;\n\t\t}\n\t}\n\n\t// Also check package.json for apicodegen field\n\tconst packageJsonPath = path.join(cwd, 'package.json');\n\tif (await fs.pathExists(packageJsonPath)) {\n\t\ttry {\n\t\t\tconst pkg = JSON.parse(await fs.readFile(packageJsonPath, 'utf-8'));\n\t\t\tif (pkg.apicodegen && typeof pkg.apicodegen === 'string') {\n\t\t\t\treturn path.resolve(cwd, pkg.apicodegen);\n\t\t\t}\n\t\t} catch {\n\t\t\t// Ignore package.json parse errors\n\t\t}\n\t}\n\n\treturn null;\n}\n\n/**\n * Merge multiple config sources with priority\n * Priority: defaults < env vars < config file < CLI args\n */\nfunction mergeConfigs(\n\tbase: ApicodegenConfig,\n\t...sources: (Partial<ApicodegenConfig> | undefined)[]\n): ApicodegenConfig {\n\tconst result = { ...base };\n\n\tfor (const source of sources) {\n\t\tif (!source) continue;\n\n\t\tfor (const [key, value] of Object.entries(source)) {\n\t\t\t// Only override if value is defined (not undefined)\n\t\t\tif (value !== undefined) {\n\t\t\t\t(result as Record<string, unknown>)[key] = value;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn result;\n}\n\n/**\n * Validate config has required fields\n */\nfunction validateConfig(\n\tconfig: Partial<ApicodegenConfig>\n): config is ApicodegenConfig {\n\tif (!config.spec) {\n\t\tthrow new Error(\n\t\t\t'Missing required field: spec (OpenAPI spec file path or URL)'\n\t\t);\n\t}\n\treturn true;\n}\n\n/**\n * Load and resolve config from multiple sources\n */\nexport async function loadConfig(\n\toptions: LoadConfigOptions = {}\n): Promise<ResolvedConfig> {\n\tconst cwd = options.cwd || process.cwd();\n\tconst cliOptions = options.cliOptions || {};\n\n\t// 1. Load from environment variables\n\tconst envConfig = loadFromEnv();\n\n\t// 2. Load from config file (if specified or found)\n\tlet fileConfig: Partial<ApicodegenConfig> = {};\n\tlet configFilePath: string | undefined;\n\n\tif (options.configFile) {\n\t\tconfigFilePath = path.resolve(cwd, options.configFile);\n\t\tfileConfig = await loadFromFile(configFilePath);\n\t} else {\n\t\tconst foundPath = await findConfigFile(cwd);\n\t\tif (foundPath) {\n\t\t\tconfigFilePath = foundPath;\n\t\t\tfileConfig = await loadFromFile(foundPath);\n\t\t}\n\t}\n\n\t// 3. Check package.json inline config\n\tconst packageJsonPath = path.join(cwd, 'package.json');\n\tlet inlineConfig: Partial<ApicodegenConfig> = {};\n\tif (await fs.pathExists(packageJsonPath)) {\n\t\ttry {\n\t\t\tconst pkg = JSON.parse(await fs.readFile(packageJsonPath, 'utf-8'));\n\t\t\tif (pkg.apicodegen && typeof pkg.apicodegen === 'object') {\n\t\t\t\tinlineConfig = pkg.apicodegen as Partial<ApicodegenConfig>;\n\t\t\t}\n\t\t} catch {\n\t\t\t// Ignore\n\t\t}\n\t}\n\n\t// 4. Merge configs with priority\n\tconst merged = mergeConfigs(\n\t\t{ spec: '', output: './output.ts' }, // defaults\n\t\tenvConfig,\n\t\tinlineConfig,\n\t\tfileConfig,\n\t\tcliOptions\n\t);\n\n\t// 5. Validate\n\tvalidateConfig(merged);\n\n\t// 6. Add metadata\n\tconst name = options.name || merged.baseURL || merged.spec;\n\n\treturn {\n\t\t...merged,\n\t\tconfigFilePath,\n\t\tname,\n\t};\n}\n\n/**\n * Convert resolved config to provider options format\n */\nexport function toProviderOptions(config: ResolvedConfig) {\n\treturn {\n\t\tdocURL: config.spec,\n\t\toutput: config.output,\n\t\tadaptor: config.adaptor,\n\t\tbaseURL: config.baseURL,\n\t\timportClientSource: config.importClientSource,\n\t\tverbose: config.verbose,\n\t\trequestOptions: config.requestOptions,\n\t};\n}\n","const cyan = (s: string) => `\\x1b[36m${s}\\x1b[0m`;\nconst green = (s: string) => `\\x1b[32m${s}\\x1b[0m`;\nconst red = (s: string) => `\\x1b[31m${s}\\x1b[0m`;\nconst blue = (s: string) => `\\x1b[34m${s}\\x1b[0m`;\nconst yellow = (s: string) => `\\x1b[33m${s}\\x1b[0m`;\nconst magenta = (s: string) => `\\x1b[35m${s}\\x1b[0m`;\nconst gray = (s: string) => `\\x1b[90m${s}\\x1b[0m`;\nconst bold = (s: string) => `\\x1b[1m${s}\\x1b[0m`;\n\nexport const logger = {\n\tsuccess(msg: string): void {\n\t\tconsole.log(`${green('✓')} ${msg}`);\n\t},\n\n\terror(err: unknown, verbose = false): void {\n\t\tif (isApicodegenError(err)) {\n\t\t\tconsole.error(`${red('✗')} ${err.toString(verbose)}`);\n\t\t} else if (err instanceof Error) {\n\t\t\tconst msg = `Error: ${err.message}`;\n\t\t\tconsole.error(\n\t\t\t\t`${red('✗')} ${msg}${verbose && err.stack ? `\\n${gray(err.stack)}` : ''}`\n\t\t\t);\n\t\t} else {\n\t\t\tconsole.error(`${red('✗')} ${String(err)}`);\n\t\t}\n\t},\n\n\tinfo(msg: string): void {\n\t\tconsole.log(`${blue('ℹ')} ${msg}`);\n\t},\n\n\twarn(msg: string): void {\n\t\tconsole.log(`${yellow('⚠')} ${msg}`);\n\t},\n\n\tloading(msg: string): void {\n\t\tconsole.log(`${yellow('🔄')} ${msg}`);\n\t},\n\n\twatching(msg: string): void {\n\t\tconsole.log(`${magenta('⟳')} ${msg}`);\n\t},\n\n\tfileChange(filePath: string): void {\n\t\tconsole.log(`${yellow('↓')} ${filePath}`);\n\t},\n\n\tfileAdd(filePath: string): void {\n\t\tconsole.log(`${green('+')} ${filePath}`);\n\t},\n\n\tshutdown(): void {\n\t\tconsole.log(`\\n${gray('👋 Shutting down...')}`);\n\t},\n\n\tdivider(width = 50): void {\n\t\tconsole.log(`${bold(cyan('─'.repeat(width)))}`);\n\t},\n\n\theading(text: string, mode: string, width = 50): void {\n\t\tconsole.log(`${bold(cyan('─'.repeat(width)))}`);\n\t\tconsole.log(`${bold(cyan(text))}`);\n\t\tconsole.log(`${gray('Mode:')} ${mode || 'unknown'}`);\n\t\tconsole.log(`${bold(cyan('─'.repeat(width)))}`);\n\t},\n\n\titem(label: string, color: 'green' | 'red' | 'yellow' = 'green'): void {\n\t\tconst icon = color === 'green' ? '✓' : color === 'red' ? '✗' : '⚠';\n\t\tconsole.log(\n\t\t\t`${color === 'green' ? green(icon) : color === 'red' ? red(icon) : yellow(icon)} ${label}`\n\t\t);\n\t},\n\n\tsummary(stats: {\n\t\tsucceeded: number;\n\t\tfailed: number;\n\t\tendpoints: number;\n\t\tschemas: number;\n\t\tduration: number;\n\t}): void {\n\t\tconst { succeeded, failed, endpoints, schemas, duration } = stats;\n\t\tconst label = `API Code Gen - Complete (${succeeded} succeeded${\n\t\t\tfailed > 0 ? `, ${failed} failed` : ''\n\t\t}, ${endpoints} endpoints, ${schemas} schemas, ${duration}ms)`;\n\t\tif (failed === 0) {\n\t\t\tconsole.log(`${green('✓')} ${label}`);\n\t\t} else {\n\t\t\tconsole.log(`${yellow('⚠')} ${label}`);\n\t\t}\n\t},\n};\n\nimport { isApicodegenError } from './errors.js';\n","/**\n * @file VersionedProvider abstract base class\n * @description Shared OpenAPI doc parsing logic used by V2 / V3 / V3_1 providers.\n * Subclasses supply version-specific container accessors; the base class\n * owns the conversion methods (getSchemaByRef, toBaseSchema, etc.).\n */\n\nimport type { OpenAPIV2, OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';\nimport {\n\tBase,\n\ttype EnumSchemaObject,\n\tHttpMethods,\n\ttype MediaTypeObject,\n\ttype MediaTypes,\n\tNonArraySchemaType,\n\ttype OperationObject,\n\ttype ParameterIn,\n\ttype ParameterObject,\n\ttype ProviderInitResult,\n\ttype SchemaFormatType,\n\ttype SchemaObject,\n} from '../core/index.js';\n\n/**\n * Any of the three supported OpenAPI document shapes.\n * Subclasses narrow this to a specific version in their constructor.\n */\nexport type VersionedDoc =\n\t| OpenAPIV2.Document\n\t| OpenAPIV3.Document\n\t| OpenAPIV3_1.Document;\n\n/**\n * Minimal interfaces for the three version-specific container shapes we read.\n * Kept loose on purpose so v2/v3/v3.1 can be plugged in interchangeably.\n */\ntype SchemaMap = Record<string, unknown>;\ntype ParameterMap = Record<string, unknown>;\ntype ResponseMap = Record<string, unknown>;\ntype RequestBodyMap = Record<string, unknown>;\n\n/**\n * Returns the operations container for a path item regardless of version.\n */\ntype PathItemObject = Record<string, unknown>;\n\n/**\n * OpenAPI version tag for subclasses.\n */\nexport enum OpenAPIVersion {\n\tv2 = 'v2',\n\tv3 = 'v3',\n\tv3_1 = 'v3_1',\n}\n\n/**\n * Abstract base class. Subclasses implement the four container accessors\n * and a version tag. The shared logic lives here.\n */\nexport abstract class VersionedProvider {\n\tprotected abstract readonly doc: VersionedDoc;\n\n\t/**\n\t * The OpenAPI version this provider handles.\n\t */\n\tabstract readonly version: OpenAPIVersion;\n\n\t/**\n\t * Returns the version-specific schema container (`definitions` for v2,\n\t * `components.schemas` for v3 / v3.1).\n\t */\n\tprotected abstract getSchemaContainer(): SchemaMap | undefined;\n\n\t/**\n\t * Returns the version-specific parameter container (root-level `parameters`\n\t * for v2; `components.parameters` for v3 / v3.1).\n\t */\n\tprotected abstract getParameterContainer(): ParameterMap | undefined;\n\n\t/**\n\t * Returns the version-specific response container (root-level `responses`\n\t * for v2; `components.responses` for v3 / v3.1).\n\t */\n\tprotected abstract getResponseContainer(): ResponseMap | undefined;\n\n\t/**\n\t * Returns the version-specific requestBody container\n\t * (`components.requestBodies` for v3 / v3.1; undefined for v2).\n\t */\n\tprotected abstract getRequestBodyContainer(): RequestBodyMap | undefined;\n\n\t/**\n\t * Resolves a path $ref to the actual path object.\n\t */\n\tprotected resolvePathRef($ref: string): PathItemObject | undefined {\n\t\tconst refName = Base.ref2name(\n\t\t\t$ref,\n\t\t\tthis.doc as unknown as Record<string, unknown>\n\t\t);\n\t\tconst paths = (this.doc as { paths?: Record<string, PathItemObject> })\n\t\t\t.paths;\n\t\treturn paths?.[refName];\n\t}\n\n\t/**\n\t * Is array schema.\n\t */\n\tprivate isOpenAPIArraySchema(schema: unknown): boolean {\n\t\treturn (\n\t\t\ttypeof schema === 'object' &&\n\t\t\tschema !== null &&\n\t\t\t(schema as { type?: unknown }).type === 'array'\n\t\t);\n\t}\n\n\t/**\n\t * OpenAPI schema to base schema. Override for version-specific quirks\n\t * (V3_1 throws on missing ref; V3 returns `{ type: 'unknown' }`).\n\t */\n\tprotected getSchemaByRef(\n\t\tschema: unknown,\n\t\treserveRef = false,\n\t\tenums: EnumSchemaObject[] = [],\n\t\tupLevelSchemaKey = ''\n\t): SchemaObject {\n\t\tlet refName = '';\n\t\tif (Base.isRef(schema)) {\n\t\t\trefName = this.formatRefName(Base.ref2name(schema.$ref));\n\t\t\tif (reserveRef) {\n\t\t\t\treturn {\n\t\t\t\t\ttype: upLevelSchemaKey + refName,\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst resolvedSchema =\n\t\t\t\tthis.getSchemaContainer()?.[\n\t\t\t\t\tBase.ref2name(\n\t\t\t\t\t\tschema.$ref,\n\t\t\t\t\t\tthis.doc as unknown as Record<string, unknown>\n\t\t\t\t\t)\n\t\t\t\t];\n\t\t\tif (!resolvedSchema) {\n\t\t\t\treturn { type: 'unknown' };\n\t\t\t}\n\t\t\tschema = resolvedSchema;\n\t\t}\n\n\t\treturn this.toBaseSchema(\n\t\t\tschema as Record<string, unknown>,\n\t\t\tenums,\n\t\t\t'',\n\t\t\tupLevelSchemaKey + refName\n\t\t);\n\t}\n\n\t/**\n\t * Format a ref name for the schema's `type` field.\n\t * V3 uses `capitalize`; V3_1 uses `upperCamelCase` (preserved for compat).\n\t */\n\tprotected formatRefName(name: string): string {\n\t\treturn Base.capitalize(name);\n\t}\n\n\t/**\n\t * OpenAPI parameter to base parameter. Override in V2 — its parameter\n\t * shape is structurally different (top-level `items`/`properties`/`enum`).\n\t */\n\tprotected getParameterByRef(\n\t\tschema: unknown,\n\t\tenums: EnumSchemaObject[] = [],\n\t\tupLevelSchemaKey = ''\n\t): ParameterObject {\n\t\tif (Base.isRef(schema)) {\n\t\t\tconst resolvedSchema =\n\t\t\t\tthis.getParameterContainer()?.[\n\t\t\t\t\tBase.ref2name(\n\t\t\t\t\t\tschema.$ref,\n\t\t\t\t\t\tthis.doc as unknown as Record<string, unknown>\n\t\t\t\t\t)\n\t\t\t\t];\n\t\t\tif (!resolvedSchema) {\n\t\t\t\treturn {\n\t\t\t\t\tname: 'unknown',\n\t\t\t\t\tin: 'query' as ParameterIn,\n\t\t\t\t};\n\t\t\t}\n\t\t\tschema = resolvedSchema;\n\t\t}\n\n\t\tconst {\n\t\t\tname,\n\t\t\trequired,\n\t\t\tdeprecated,\n\t\t\tdescription,\n\t\t\tschema: parameterSchema,\n\t\t} = schema as {\n\t\t\tname: string;\n\t\t\trequired?: boolean;\n\t\t\tdeprecated?: boolean;\n\t\t\tdescription?: string;\n\t\t\tschema?: unknown;\n\t\t\tin: string;\n\t\t};\n\n\t\tif (\n\t\t\tparameterSchema &&\n\t\t\t!Base.isRef(parameterSchema) &&\n\t\t\t(parameterSchema as { enum?: unknown }).enum\n\t\t) {\n\t\t\tconst type =\n\t\t\t\tBase.upperCamelCase(Base.normalize(upLevelSchemaKey)) +\n\t\t\t\tBase.upperCamelCase(Base.normalize(name));\n\n\t\t\tconst enumSchema = {\n\t\t\t\tname: type,\n\t\t\t\tenum: [\n\t\t\t\t\t...new Set((parameterSchema as { enum: (string | number)[] }).enum),\n\t\t\t\t],\n\t\t\t};\n\n\t\t\tconst sameEnum = Base.findSameSchema(enumSchema, enums);\n\n\t\t\tif (\n\t\t\t\t!sameEnum &&\n\t\t\t\tBase.isValidEnumType(parameterSchema as unknown as SchemaObject)\n\t\t\t) {\n\t\t\t\tenums.push(enumSchema);\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tname,\n\t\t\t\trequired,\n\t\t\t\tdescription,\n\t\t\t\tdeprecated,\n\t\t\t\tin: (schema as { in: ParameterIn }).in,\n\t\t\t\tschema: {\n\t\t\t\t\ttype: sameEnum?.name ?? type,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\tname,\n\t\t\trequired,\n\t\t\tdescription,\n\t\t\tdeprecated,\n\t\t\tin: (schema as { in: ParameterIn }).in,\n\t\t\tschema: (schema as { schema?: unknown }).schema\n\t\t\t\t? this.getSchemaByRef(\n\t\t\t\t\t\t(schema as { schema?: unknown }).schema,\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t\tenums,\n\t\t\t\t\t\tupLevelSchemaKey + Base.capitalize(name)\n\t\t\t\t\t)\n\t\t\t\t: undefined,\n\t\t};\n\t}\n\n\t/**\n\t * OpenAPI schema to base response. Override in V2 (its response shape\n\t * lacks the `content` wrapper).\n\t */\n\tprotected getResponseByRef(schema: unknown): MediaTypeObject[] {\n\t\tif (Base.isRef(schema)) {\n\t\t\tconst resolvedSchema =\n\t\t\t\tthis.getResponseContainer()?.[\n\t\t\t\t\tBase.ref2name(\n\t\t\t\t\t\tschema.$ref,\n\t\t\t\t\t\tthis.doc as unknown as Record<string, unknown>\n\t\t\t\t\t)\n\t\t\t\t];\n\t\t\tif (!resolvedSchema) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\tschema = resolvedSchema;\n\t\t}\n\n\t\tconst { content = {} } = schema as {\n\t\t\tcontent?: Record<string, { schema?: unknown }>;\n\t\t};\n\n\t\treturn Object.keys(content).map((c) => ({\n\t\t\ttype: c as MediaTypes,\n\t\t\tschema: content[c].schema\n\t\t\t\t? this.getSchemaByRef(content[c].schema, true)\n\t\t\t\t: undefined,\n\t\t}));\n\t}\n\n\t/**\n\t * OpenAPI schema to requestBody. V2 has no requestBody concept.\n\t */\n\tprotected getRequestBodyByRef(\n\t\tschema: unknown,\n\t\tenums: EnumSchemaObject[] = []\n\t): MediaTypeObject[] {\n\t\tif (Base.isRef(schema)) {\n\t\t\tconst resolvedSchema =\n\t\t\t\tthis.getRequestBodyContainer()?.[\n\t\t\t\t\tBase.ref2name(\n\t\t\t\t\t\tschema.$ref,\n\t\t\t\t\t\tthis.doc as unknown as Record<string, unknown>\n\t\t\t\t\t)\n\t\t\t\t];\n\t\t\tif (!resolvedSchema) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\tschema = resolvedSchema;\n\t\t}\n\n\t\tconst { content = {} } = schema as {\n\t\t\tcontent?: Record<string, { schema?: unknown }>;\n\t\t};\n\n\t\treturn Object.keys(content).map((c) => ({\n\t\t\ttype: c as MediaTypes,\n\t\t\tschema: content[c].schema\n\t\t\t\t? this.getSchemaByRef(content[c].schema, false, enums)\n\t\t\t\t: undefined,\n\t\t}));\n\t}\n\n\t/**\n\t * Transform all OpenAPI schema to Base Schema\n\t */\n\tprivate toBaseSchema(\n\t\tschema: unknown,\n\t\tenums: EnumSchemaObject[] = [],\n\t\tschemaKey = '',\n\t\tupLevelSchemaKey = ''\n\t): SchemaObject {\n\t\tif (!schema) {\n\t\t\treturn {\n\t\t\t\ttype: 'unknown',\n\t\t\t};\n\t\t}\n\n\t\tif (Base.isRef(schema)) {\n\t\t\treturn this.getSchemaByRef(schema, true);\n\t\t}\n\n\t\tif (this.isOpenAPIArraySchema(schema)) {\n\t\t\tconst { type, description, items, required } = schema as {\n\t\t\t\ttype: string;\n\t\t\t\tdescription?: string;\n\t\t\t\titems?: unknown;\n\t\t\t\trequired?: unknown;\n\t\t\t};\n\n\t\t\tconst itemsSchema = items\n\t\t\t\t? this.toBaseSchema(items, enums, schemaKey, upLevelSchemaKey)\n\t\t\t\t: ({ type: 'unknown' } as SchemaObject);\n\n\t\t\treturn {\n\t\t\t\ttype: type as 'array',\n\t\t\t\trequired: !!required,\n\t\t\t\tdescription,\n\t\t\t\titems: itemsSchema,\n\t\t\t};\n\t\t}\n\t\tconst {\n\t\t\trequired = [],\n\t\t\tallOf,\n\t\t\tanyOf,\n\t\t\tdescription,\n\t\t\tdeprecated,\n\t\t\tenum: enum_,\n\t\t\tformat,\n\t\t\toneOf,\n\t\t\tproperties = {},\n\t\t} = schema as {\n\t\t\trequired?: string[];\n\t\t\tallOf?: unknown[];\n\t\t\tanyOf?: unknown[];\n\t\t\tdescription?: string;\n\t\t\tdeprecated?: boolean;\n\t\t\tenum?: (string | number)[];\n\t\t\tformat?: string;\n\t\t\toneOf?: unknown[];\n\t\t\tproperties?: Record<string, unknown>;\n\t\t\ttype?: string;\n\t\t};\n\t\tlet { type } = schema as { type?: string };\n\n\t\tif (enum_ && type !== 'boolean') {\n\t\t\tconst name =\n\t\t\t\tBase.upperCamelCase(Base.normalize(upLevelSchemaKey)) +\n\t\t\t\tBase.upperCamelCase(Base.normalize(schemaKey));\n\n\t\t\tconst enumObject = {\n\t\t\t\tname,\n\t\t\t\tenum: [...new Set(enum_)],\n\t\t\t};\n\n\t\t\tconst sameObject = Base.findSameSchema(enumObject, enums);\n\n\t\t\tif (\n\t\t\t\t!sameObject &&\n\t\t\t\tBase.isValidEnumType(schema as unknown as SchemaObject)\n\t\t\t) {\n\t\t\t\tenums.push(enumObject);\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\ttype: sameObject\n\t\t\t\t\t? sameObject.name\n\t\t\t\t\t: Base.isBooleanEnum(schema as unknown as SchemaObject)\n\t\t\t\t\t\t? 'boolean'\n\t\t\t\t\t\t: enumObject.name,\n\t\t\t\trequired: required as string[] | undefined,\n\t\t\t\tdescription,\n\t\t\t\tdeprecated,\n\t\t\t};\n\t\t}\n\n\t\tif (type === undefined && Object.keys(properties).length > 0) {\n\t\t\ttype = NonArraySchemaType.object;\n\t\t}\n\n\t\treturn {\n\t\t\ttype: type as unknown as NonArraySchemaType,\n\t\t\trequired: required as string[] | undefined,\n\t\t\tdescription,\n\t\t\tdeprecated,\n\t\t\tenum: enum_,\n\t\t\tformat: format as unknown as SchemaFormatType,\n\t\t\tallOf: allOf?.map((s) =>\n\t\t\t\tBase.isRef(s)\n\t\t\t\t\t? ({\n\t\t\t\t\t\t\t...s,\n\t\t\t\t\t\t\tref: (s as { $ref: string }).$ref,\n\t\t\t\t\t\t\ttype: Base.capitalize(\n\t\t\t\t\t\t\t\tBase.ref2name(\n\t\t\t\t\t\t\t\t\t(s as { $ref: string }).$ref,\n\t\t\t\t\t\t\t\t\tthis.doc as unknown as Record<string, unknown>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t} as unknown as SchemaObject)\n\t\t\t\t\t: this.toBaseSchema(s, enums)\n\t\t\t),\n\t\t\tanyOf: anyOf?.map((s) =>\n\t\t\t\tBase.isRef(s)\n\t\t\t\t\t? ({\n\t\t\t\t\t\t\t...s,\n\t\t\t\t\t\t\tref: (s as { $ref: string }).$ref,\n\t\t\t\t\t\t\ttype: Base.capitalize(\n\t\t\t\t\t\t\t\tBase.ref2name(\n\t\t\t\t\t\t\t\t\t(s as { $ref: string }).$ref,\n\t\t\t\t\t\t\t\t\tthis.doc as unknown as Record<string, unknown>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t} as unknown as SchemaObject)\n\t\t\t\t\t: this.toBaseSchema(s, enums)\n\t\t\t),\n\t\t\toneOf: oneOf?.map((s) =>\n\t\t\t\tBase.isRef(s)\n\t\t\t\t\t? ({\n\t\t\t\t\t\t\t...s,\n\t\t\t\t\t\t\tref: (s as { $ref: string }).$ref,\n\t\t\t\t\t\t\ttype: Base.capitalize(\n\t\t\t\t\t\t\t\tBase.ref2name(\n\t\t\t\t\t\t\t\t\t(s as { $ref: string }).$ref,\n\t\t\t\t\t\t\t\t\tthis.doc as unknown as Record<string, unknown>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t} as unknown as SchemaObject)\n\t\t\t\t\t: this.toBaseSchema(s, enums)\n\t\t\t),\n\t\t\tproperties: Object.keys(properties).reduce(\n\t\t\t\t(acc, p) => {\n\t\t\t\t\tconst propSchema = properties[p];\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...acc,\n\t\t\t\t\t\t[p]: Base.isRef(propSchema)\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\ttype: Base.capitalize(\n\t\t\t\t\t\t\t\t\t\tBase.ref2name(\n\t\t\t\t\t\t\t\t\t\t\t(propSchema as { $ref: string }).$ref,\n\t\t\t\t\t\t\t\t\t\t\tthis.doc as unknown as Record<string, unknown>\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tisRef: true,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: this.toBaseSchema(propSchema, enums, p, upLevelSchemaKey),\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t\t{} as Record<string, SchemaObject>\n\t\t\t),\n\t\t};\n\t}\n\n\t/**\n\t * Run the parsing pipeline and return a ProviderInitResult.\n\t */\n\tpublic init(): ProviderInitResult {\n\t\tconst { paths = {} } = this.doc as {\n\t\t\tpaths?: Record<string, PathItemObject>;\n\t\t};\n\t\tconst enums: EnumSchemaObject[] = [];\n\t\tconst schemaContainer = this.getSchemaContainer() ?? {};\n\t\tconst parameterContainer = this.getParameterContainer() ?? {};\n\t\tconst responseContainer = this.getResponseContainer() ?? {};\n\t\tconst requestBodyContainer = this.getRequestBodyContainer() ?? {};\n\n\t\tconst schemas_ = Object.keys(schemaContainer).reduce((acc, key) => {\n\t\t\tconst schema = schemaContainer[key];\n\t\t\treturn {\n\t\t\t\t...acc,\n\t\t\t\t[key]: this.getSchemaByRef(schema, false, enums, key),\n\t\t\t};\n\t\t}, {});\n\n\t\tconst parameters_ = Object.keys(parameterContainer).reduce((acc, key) => {\n\t\t\tconst parameter = parameterContainer[key];\n\t\t\treturn {\n\t\t\t\t...acc,\n\t\t\t\t[key]: this.getParameterByRef(parameter, enums, key),\n\t\t\t};\n\t\t}, {});\n\n\t\tconst responses_ = Object.keys(responseContainer).reduce((acc, key) => {\n\t\t\tconst response = responseContainer[key];\n\t\t\treturn {\n\t\t\t\t...acc,\n\t\t\t\t[key]: this.getResponseByRef(response),\n\t\t\t};\n\t\t}, {});\n\n\t\tconst requestBodies_ = Object.keys(requestBodyContainer).reduce(\n\t\t\t(acc, key) => {\n\t\t\t\tconst requestBody = requestBodyContainer[key];\n\t\t\t\treturn {\n\t\t\t\t\t...acc,\n\t\t\t\t\t[key]: this.getRequestBodyByRef(requestBody, enums),\n\t\t\t\t};\n\t\t\t},\n\t\t\t{}\n\t\t);\n\n\t\tconst apis = Object.keys(paths).reduce((acc, path) => {\n\t\t\tlet pathObject: PathItemObject = paths[path] ?? {};\n\n\t\t\tif ((pathObject as { $ref?: string }).$ref) {\n\t\t\t\tconst resolved = this.resolvePathRef(\n\t\t\t\t\t(pathObject as { $ref: string }).$ref\n\t\t\t\t);\n\t\t\t\tif (resolved) {\n\t\t\t\t\tpathObject = resolved;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst {\n\t\t\t\tparameters = [],\n\t\t\t\tdescription,\n\t\t\t\tsummary,\n\t\t\t} = pathObject as {\n\t\t\t\tparameters?: unknown[];\n\t\t\t\tdescription?: string;\n\t\t\t\tsummary?: string;\n\t\t\t};\n\t\t\tconst methodApis: OperationObject[] = [];\n\n\t\t\tObject.values(HttpMethods).forEach((method) => {\n\t\t\t\tconst methodObject = (pathObject as Record<string, unknown>)[method];\n\n\t\t\t\tif (methodObject) {\n\t\t\t\t\tconst {\n\t\t\t\t\t\tdeprecated,\n\t\t\t\t\t\toperationId,\n\t\t\t\t\t\tresponses,\n\t\t\t\t\t\tsummary: summary_,\n\t\t\t\t\t\tdescription: description_,\n\t\t\t\t\t\trequestBody = { content: {} },\n\t\t\t\t\t} = methodObject as {\n\t\t\t\t\t\tdeprecated?: boolean;\n\t\t\t\t\t\toperationId?: string;\n\t\t\t\t\t\tresponses?: Record<string, unknown>;\n\t\t\t\t\t\tsummary?: string;\n\t\t\t\t\t\tdescription?: string;\n\t\t\t\t\t\trequestBody?: { content?: Record<string, unknown> };\n\t\t\t\t\t};\n\t\t\t\t\t// Clone to avoid mutating the input spec when we inject a\n\t\t\t\t\t// default 200 response below.\n\t\t\t\t\tconst responsesClone: Record<string, unknown> = responses\n\t\t\t\t\t\t? { ...responses }\n\t\t\t\t\t\t: {};\n\t\t\t\t\tconst { parameters: parameters_ = [] } = methodObject as {\n\t\t\t\t\t\tparameters?: unknown[];\n\t\t\t\t\t};\n\t\t\t\t\tconst baseParameters = [...parameters, ...parameters_].map(\n\t\t\t\t\t\t(parameter) => this.getParameterByRef(parameter, enums)\n\t\t\t\t\t);\n\t\t\t\t\tconst baseRequestBody = this.getRequestBodyByRef(requestBody, enums);\n\t\t\t\t\tconst uniqueParameterName = [\n\t\t\t\t\t\t...new Set(baseParameters.map((p) => p.name)),\n\t\t\t\t\t];\n\n\t\t\t\t\tif (Object.keys(responsesClone).length === 0) {\n\t\t\t\t\t\tresponsesClone[200] = {\n\t\t\t\t\t\t\tdescription: 'Successful response',\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\tconst httpCodes = Object.keys(responsesClone);\n\t\t\t\t\tfor (const code of httpCodes) {\n\t\t\t\t\t\tif (code in responsesClone) {\n\t\t\t\t\t\t\tconst response = responsesClone[code];\n\t\t\t\t\t\t\tconst responseSchema = this.getResponseByRef(response);\n\t\t\t\t\t\t\tmethodApis.push({\n\t\t\t\t\t\t\t\tmethod,\n\t\t\t\t\t\t\t\toperationId,\n\t\t\t\t\t\t\t\tsummary: summary_ ?? summary,\n\t\t\t\t\t\t\t\tdescription: description_ ?? description,\n\t\t\t\t\t\t\t\tdeprecated: deprecated,\n\t\t\t\t\t\t\t\tparameters: uniqueParameterName\n\t\t\t\t\t\t\t\t\t.map((name) => baseParameters.find((p) => p.name === name))\n\t\t\t\t\t\t\t\t\t.filter((p): p is ParameterObject => p !== undefined),\n\t\t\t\t\t\t\t\tresponses: responseSchema,\n\t\t\t\t\t\t\t\trequestBody: baseRequestBody,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\n\t\t\treturn {\n\t\t\t\t...acc,\n\t\t\t\t[path]: methodApis,\n\t\t\t};\n\t\t}, {});\n\n\t\treturn {\n\t\t\tenums: Base.uniqueEnums(enums),\n\t\t\tschemas: schemas_ as Record<string, SchemaObject>,\n\t\t\tresponses: responses_ as Record<\n\t\t\t\tstring,\n\t\t\t\timport('../core/index.js').ResponsesObject\n\t\t\t>,\n\t\t\tparameters: parameters_ as Record<string, ParameterObject>,\n\t\t\trequestBodies: requestBodies_ as Record<\n\t\t\t\tstring,\n\t\t\t\timport('../core/index.js').RequestBodyObject\n\t\t\t>,\n\t\t\tapis: apis as Record<string, OperationObject[]>,\n\t\t};\n\t}\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { OpenAPIV2 } from 'openapi-types';\nimport {\n\tBase,\n\ttype EnumSchemaObject,\n\tHttpMethods,\n\ttype MediaTypeObject,\n\tMediaTypes,\n\ttype OperationObject,\n\ttype ParameterIn,\n\ttype ParameterObject,\n\ttype SchemaObject,\n} from '../core/index.js';\nimport { OpenAPIVersion, VersionedProvider } from './VersionedProvider.js';\n\nexport class V2 extends VersionedProvider {\n\tprotected readonly doc: OpenAPIV2.Document;\n\treadonly version = OpenAPIVersion.v2;\n\n\tconstructor(doc: OpenAPIV2.Document) {\n\t\tsuper();\n\t\tthis.doc = doc;\n\t}\n\n\tprotected override getSchemaContainer():\n\t\t| Record<string, OpenAPIV2.SchemaObject>\n\t\t| undefined {\n\t\treturn this.doc.definitions as any;\n\t}\n\n\tprotected override getParameterContainer():\n\t\t| Record<string, OpenAPIV2.ParameterObject>\n\t\t| undefined {\n\t\treturn this.doc.parameters as any;\n\t}\n\n\tprotected override getResponseContainer():\n\t\t| Record<string, OpenAPIV2.ResponseObject>\n\t\t| undefined {\n\t\treturn this.doc.responses as any;\n\t}\n\n\tprotected override getRequestBodyContainer(): undefined {\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * V2 parameter shape differs from V3: top-level `items`/`properties`/`enum`\n\t * rather than nested under `schema`. Override accordingly.\n\t */\n\tprotected override getParameterByRef(\n\t\tparameter: unknown,\n\t\tenums: EnumSchemaObject[] = [],\n\t\tupLevelSchemaKey = ''\n\t): ParameterObject {\n\t\tif (Base.isRef(parameter)) {\n\t\t\tconst refName = Base.ref2name(\n\t\t\t\t(parameter as { $ref: string }).$ref,\n\t\t\t\tthis.doc\n\t\t\t);\n\t\t\tconst resolved = (\n\t\t\t\tthis.doc as { parameters?: Record<string, OpenAPIV2.ParameterObject> }\n\t\t\t).parameters?.[refName];\n\t\t\tif (!resolved) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Parameter reference not found: ${(parameter as { $ref: string }).$ref}`\n\t\t\t\t);\n\t\t\t}\n\t\t\tparameter = resolved;\n\t\t}\n\n\t\tconst p = parameter as OpenAPIV2.ParameterObject;\n\t\tconst {\n\t\t\tname,\n\t\t\trequired,\n\t\t\tdescription,\n\t\t\ttype,\n\t\t\titems,\n\t\t\tenum: enum_,\n\t\t\tproperties,\n\t\t\tschema,\n\t\t} = p;\n\n\t\tif (enum_) {\n\t\t\tconst enumType =\n\t\t\t\tBase.upperCamelCase(Base.normalize(upLevelSchemaKey)) +\n\t\t\t\tBase.upperCamelCase(Base.normalize(name));\n\n\t\t\tconst enumSchema = {\n\t\t\t\tname: enumType,\n\t\t\t\tenum: [...new Set(enum_ as (string | number)[])],\n\t\t\t};\n\n\t\t\tconst sameEnum = Base.findSameSchema(enumSchema, enums);\n\n\t\t\tif (\n\t\t\t\t!sameEnum &&\n\t\t\t\tBase.isValidEnumType({ type: enumType, enum: enum_ } as SchemaObject)\n\t\t\t) {\n\t\t\t\tenums.push(enumSchema);\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tname,\n\t\t\t\trequired,\n\t\t\t\tdescription,\n\t\t\t\tin: p.in as ParameterIn,\n\t\t\t\tschema: { type: sameEnum?.name ?? enumType },\n\t\t\t};\n\t\t}\n\n\t\tif (items) {\n\t\t\treturn {\n\t\t\t\tname,\n\t\t\t\trequired,\n\t\t\t\tdescription,\n\t\t\t\tin: p.in as ParameterIn,\n\t\t\t\tschema: {\n\t\t\t\t\ttype: type as string,\n\t\t\t\t\titems: items as unknown as SchemaObject,\n\t\t\t\t} as unknown as SchemaObject,\n\t\t\t};\n\t\t}\n\n\t\tif (schema && Base.isRef(schema)) {\n\t\t\treturn {\n\t\t\t\tname,\n\t\t\t\trequired,\n\t\t\t\tdescription,\n\t\t\t\tin: p.in as ParameterIn,\n\t\t\t\tschema: {\n\t\t\t\t\ttype: Base.capitalize(\n\t\t\t\t\t\tBase.ref2name((schema as { $ref: string }).$ref)\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\tname,\n\t\t\trequired,\n\t\t\tdescription,\n\t\t\tin: p.in as ParameterIn,\n\t\t\tschema: { type: type as string, properties } as SchemaObject,\n\t\t};\n\t}\n\n\t/**\n\t * V2 response shape: a `schema` field directly, not `content`. V2 always\n\t * emits JSON.\n\t */\n\tprotected override getResponseByRef(schema: unknown): MediaTypeObject[] {\n\t\tif (Base.isRef(schema)) {\n\t\t\tschema = (\n\t\t\t\tthis.doc as { responses: Record<string, OpenAPIV2.ResponseObject> }\n\t\t\t).responses[Base.ref2name((schema as { $ref: string }).$ref, this.doc)];\n\t\t}\n\n\t\tconst { schema: responseSchema } = schema as { schema?: unknown };\n\n\t\treturn [\n\t\t\t{\n\t\t\t\ttype: MediaTypes.JSON,\n\t\t\t\tschema: responseSchema\n\t\t\t\t\t? this.getSchemaByRef(responseSchema, true)\n\t\t\t\t\t: undefined,\n\t\t\t},\n\t\t];\n\t}\n\n\t/**\n\t * V2 has no `requestBody` concept; parameters with `in: body` or\n\t * `in: formData` are split out and turned into a synthetic requestBody\n\t * here. A single body param named `body` is used directly; otherwise\n\t * the body / formData params are wrapped in a synthetic object.\n\t */\n\tpublic override init() {\n\t\tconst { paths = {} } = this.doc as {\n\t\t\tpaths?: Record<string, Record<string, unknown>>;\n\t\t};\n\t\tconst enums: EnumSchemaObject[] = [];\n\n\t\tconst schemaContainer = this.getSchemaContainer() ?? {};\n\t\tconst parameterContainer = this.getParameterContainer() ?? {};\n\t\tconst responseContainer = this.getResponseContainer() ?? {};\n\n\t\tconst schemas_ = Object.keys(schemaContainer).reduce((acc, key) => {\n\t\t\tconst schema = schemaContainer[key];\n\t\t\treturn { ...acc, [key]: this.getSchemaByRef(schema, false, enums, key) };\n\t\t}, {});\n\n\t\tconst parameters_ = Object.keys(parameterContainer).reduce((acc, key) => {\n\t\t\tconst parameter = parameterContainer[key];\n\t\t\treturn { ...acc, [key]: this.getParameterByRef(parameter, enums, key) };\n\t\t}, {});\n\n\t\tconst responses_ = Object.keys(responseContainer).reduce((acc, key) => {\n\t\t\tconst response = responseContainer[key];\n\t\t\treturn { ...acc, [key]: this.getResponseByRef(response) };\n\t\t}, {});\n\n\t\tconst apis: Record<string, OperationObject[]> = {};\n\t\tfor (const path of Object.keys(paths)) {\n\t\t\tlet pathObject = paths[path] ?? {};\n\n\t\t\tif ((pathObject as { $ref?: string }).$ref) {\n\t\t\t\tconst resolved = this.resolvePathRef(\n\t\t\t\t\t(pathObject as { $ref: string }).$ref\n\t\t\t\t);\n\t\t\t\tif (resolved) pathObject = resolved;\n\t\t\t}\n\n\t\t\tconst { parameters = [] } = pathObject as { parameters?: unknown[] };\n\t\t\tconst methodApis: OperationObject[] = [];\n\n\t\t\tObject.values(HttpMethods).forEach((method) => {\n\t\t\t\tconst methodObject = (pathObject as Record<string, unknown>)[method];\n\t\t\t\tif (!methodObject) return;\n\n\t\t\t\tconst {\n\t\t\t\t\tdeprecated,\n\t\t\t\t\toperationId,\n\t\t\t\t\tsummary: summary_,\n\t\t\t\t\tdescription: description_,\n\t\t\t\t\tresponses,\n\t\t\t\t} = methodObject as {\n\t\t\t\t\tdeprecated?: boolean;\n\t\t\t\t\toperationId?: string;\n\t\t\t\t\tsummary?: string;\n\t\t\t\t\tdescription?: string;\n\t\t\t\t\tresponses?: Record<string, unknown>;\n\t\t\t\t};\n\t\t\t\tconst { parameters: parameters_ = [] } = methodObject as {\n\t\t\t\t\tparameters?: unknown[];\n\t\t\t\t};\n\n\t\t\t\tconst baseParameters = [...parameters, ...parameters_].map((p) =>\n\t\t\t\t\tthis.getParameterByRef(p, enums)\n\t\t\t\t);\n\t\t\t\tconst uniqueParameterName = [\n\t\t\t\t\t...new Set(baseParameters.map((p) => p.name)),\n\t\t\t\t];\n\n\t\t\t\t// Clone to avoid mutating the input spec.\n\t\t\t\tconst responsesClone: Record<string, unknown> = responses\n\t\t\t\t\t? { ...responses }\n\t\t\t\t\t: {};\n\n\t\t\t\tif (Object.keys(responsesClone).length === 0) {\n\t\t\t\t\tresponsesClone[200] = { description: 'Successful response' };\n\t\t\t\t}\n\n\t\t\t\tconst inBody = baseParameters.filter(\n\t\t\t\t\t(p) => p.in === 'body' || p.in === 'formData'\n\t\t\t\t);\n\t\t\t\tconst notInBody = baseParameters.filter(\n\t\t\t\t\t(p) => p.in !== 'body' && p.in !== 'formData'\n\t\t\t\t);\n\n\t\t\t\tconst httpCodes = Object.keys(responsesClone);\n\t\t\t\tfor (const code of httpCodes) {\n\t\t\t\t\tif (code in responsesClone) {\n\t\t\t\t\t\tconst response = responsesClone[code];\n\t\t\t\t\t\tconst responseSchema = this.getResponseByRef(response);\n\n\t\t\t\t\t\tconst inBodyOnlyHasBody =\n\t\t\t\t\t\t\tinBody.length === 1 &&\n\t\t\t\t\t\t\tinBody[0].in === 'body' &&\n\t\t\t\t\t\t\tinBody[0].name === 'body';\n\n\t\t\t\t\t\tmethodApis.push({\n\t\t\t\t\t\t\tmethod,\n\t\t\t\t\t\t\toperationId,\n\t\t\t\t\t\t\tsummary: summary_,\n\t\t\t\t\t\t\tdeprecated: deprecated,\n\t\t\t\t\t\t\tdescription: description_,\n\t\t\t\t\t\t\tparameters: uniqueParameterName\n\t\t\t\t\t\t\t\t.map((name) => notInBody.find((p) => p.name === name))\n\t\t\t\t\t\t\t\t.filter((p): p is ParameterObject => p !== undefined),\n\t\t\t\t\t\t\tresponses: responseSchema,\n\t\t\t\t\t\t\trequestBody:\n\t\t\t\t\t\t\t\tinBody.length > 0\n\t\t\t\t\t\t\t\t\t? inBodyOnlyHasBody\n\t\t\t\t\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\ttype: MediaTypes.JSON,\n\t\t\t\t\t\t\t\t\t\t\t\t\tschema: inBody[0].schema,\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t\t: [\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\ttype: MediaTypes.JSON,\n\t\t\t\t\t\t\t\t\t\t\t\t\tschema: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttype: 'object' as const,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tproperties: inBody.reduce<\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tRecord<string, SchemaObject>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t>((a, p) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t...a,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t[p.name]: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttype: (p.schema?.type ??\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'unknown') as 'object',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\trequired: p.schema?.required,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\titems: (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tp.schema as unknown as {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\titems?: SchemaObject;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)?.items,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdescription: p.schema?.description,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t} as SchemaObject,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}, {}),\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tapis[path] = methodApis;\n\t\t}\n\n\t\treturn {\n\t\t\tenums: Base.uniqueEnums(enums),\n\t\t\tschemas: schemas_ as Record<string, SchemaObject>,\n\t\t\tresponses: responses_ as unknown as Record<\n\t\t\t\tstring,\n\t\t\t\timport('../core/index.js').ResponsesObject\n\t\t\t>,\n\t\t\tparameters: parameters_ as Record<string, ParameterObject>,\n\t\t\trequestBodies: {} as unknown as Record<\n\t\t\t\tstring,\n\t\t\t\timport('../core/index.js').RequestBodyObject\n\t\t\t>,\n\t\t\tapis: apis as Record<string, OperationObject[]>,\n\t\t};\n\t}\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { OpenAPIV3 } from 'openapi-types';\nimport { OpenAPIVersion, VersionedProvider } from './VersionedProvider.js';\n\nexport class V3 extends VersionedProvider {\n\tprotected readonly doc: OpenAPIV3.Document;\n\treadonly version = OpenAPIVersion.v3;\n\n\tconstructor(doc: OpenAPIV3.Document) {\n\t\tsuper();\n\t\tthis.doc = doc;\n\t}\n\n\tprotected override getSchemaContainer():\n\t\t| Record<string, OpenAPIV3.SchemaObject>\n\t\t| undefined {\n\t\treturn this.doc.components?.schemas as any;\n\t}\n\n\tprotected override getParameterContainer():\n\t\t| Record<string, OpenAPIV3.ParameterObject>\n\t\t| undefined {\n\t\treturn this.doc.components?.parameters as any;\n\t}\n\n\tprotected override getResponseContainer():\n\t\t| Record<string, OpenAPIV3.ResponseObject>\n\t\t| undefined {\n\t\treturn this.doc.components?.responses as any;\n\t}\n\n\tprotected override getRequestBodyContainer():\n\t\t| Record<string, OpenAPIV3.RequestBodyObject>\n\t\t| undefined {\n\t\treturn this.doc.components?.requestBodies as any;\n\t}\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable unicorn/filename-case */\nimport type { OpenAPIV3_1 } from 'openapi-types';\nimport { Base } from '../core/index.js';\nimport { OpenAPIVersion, VersionedProvider } from './VersionedProvider.js';\n\nexport class V3_1 extends VersionedProvider {\n\tprotected readonly doc: OpenAPIV3_1.Document;\n\treadonly version = OpenAPIVersion.v3_1;\n\n\tconstructor(doc: OpenAPIV3_1.Document) {\n\t\tsuper();\n\t\tthis.doc = doc;\n\t}\n\n\tprotected override formatRefName(name: string): string {\n\t\t// V3_1 normalizes ref names to UpperCamelCase (V3 only capitalizes\n\t\t// the first character). Preserved for backward compatibility.\n\t\treturn Base.upperCamelCase(name);\n\t}\n\n\tprotected override getSchemaContainer():\n\t\t| Record<string, OpenAPIV3_1.SchemaObject>\n\t\t| undefined {\n\t\treturn this.doc.components?.schemas as any;\n\t}\n\n\tprotected override getParameterContainer():\n\t\t| Record<string, OpenAPIV3_1.ParameterObject>\n\t\t| undefined {\n\t\treturn this.doc.components?.parameters as any;\n\t}\n\n\tprotected override getResponseContainer():\n\t\t| Record<string, OpenAPIV3_1.ResponseObject>\n\t\t| undefined {\n\t\treturn this.doc.components?.responses as any;\n\t}\n\n\tprotected override getRequestBodyContainer():\n\t\t| Record<string, OpenAPIV3_1.RequestBodyObject>\n\t\t| undefined {\n\t\treturn this.doc.components?.requestBodies as any;\n\t}\n}\n","import { createScopedLogger } from '@moccona/logger';\nimport type { OpenAPI, OpenAPIV2, OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';\nimport type {\n\tAdaptors,\n\tProviderInitOptions,\n\tProviderInitResult,\n} from '../core/index.js';\nimport {\n\ttype Adapter,\n\tAxiosAdapter,\n\tAdaptors as ads,\n\tBase,\n\tFetchAdapter,\n\tGenerator,\n\tProvider,\n} from '../core/index.js';\n\nimport { V2 } from './V2.js';\nimport { V3 } from './V3.js';\nimport { V3_1 } from './V3_1.js';\n\nconst logger = createScopedLogger('OpenAPI');\n\nexport enum OpenAPIVersion {\n\tv2 = 'v2',\n\tv3 = 'v3',\n\tv3_1 = 'v3_1',\n\tunknown = 'unknown',\n}\n\nfunction getDocVersion(doc: OpenAPI.Document) {\n\tconst version = (\n\t\t(doc as OpenAPIV3.Document).openapi || (doc as OpenAPIV2.Document).swagger\n\t).slice(0, 3);\n\n\tswitch (version) {\n\t\tcase '3.1':\n\t\t\treturn OpenAPIVersion.v3_1;\n\t\tcase '3.0':\n\t\t\treturn OpenAPIVersion.v3;\n\t\tcase '2.0':\n\t\t\treturn OpenAPIVersion.v2;\n\t\tdefault:\n\t\t\treturn OpenAPIVersion.unknown;\n\t}\n}\n\nexport class OpenAPIProvider extends Provider {\n\tpublic parse(doc: OpenAPIV3.Document): ProviderInitResult {\n\t\tconst version = getDocVersion(doc);\n\n\t\tlogger.debug(`openapi version ${version}`);\n\n\t\tswitch (version) {\n\t\t\tcase OpenAPIVersion.v2:\n\t\t\t\treturn new V2(doc as unknown as OpenAPIV2.Document).init();\n\t\t\tcase OpenAPIVersion.v3:\n\t\t\t\treturn new V3(doc as unknown as OpenAPIV3.Document).init();\n\t\t\tcase OpenAPIVersion.v3_1:\n\t\t\t\treturn new V3_1(doc as unknown as OpenAPIV3_1.Document).init();\n\t\t\tdefault:\n\t\t\t\tthrow new Error(`Not a valid OpenAPI version: ${version}`);\n\t\t}\n\t}\n}\n\nfunction getAdaptor(type: keyof typeof Adaptors): Adapter {\n\tswitch (type) {\n\t\tcase ads.axios:\n\t\t\treturn new AxiosAdapter();\n\t\tdefault:\n\t\t\treturn new FetchAdapter();\n\t}\n}\n\nexport interface CodeGenResult {\n\tcode: string;\n\tstats: {\n\t\tendpoints: number;\n\t\tschemas: number;\n\t\tduration: number;\n\t};\n}\n\nexport async function codeGen(\n\tinitOptions: ProviderInitOptions\n): Promise<CodeGenResult> {\n\tconst startTime = Date.now();\n\tconst { verbose } = initOptions;\n\n\tif (verbose) {\n\t\tlogger.setLevel('debug');\n\t} else {\n\t\tlogger.setLevel('info');\n\t}\n\n\tlogger.info(`Fetch document from ${initOptions.docURL}`);\n\n\tconst doc = await Base.fetchDoc(\n\t\tinitOptions.docURL,\n\t\tinitOptions.requestOptions\n\t);\n\n\tconst provider = new OpenAPIProvider(initOptions, doc);\n\tconst { enums, schemas, parameters, responses, requestBodies, apis } =\n\t\tprovider;\n\n\tconst adaptor = getAdaptor(initOptions.adaptor ?? ads.fetch);\n\tconst code = await Generator.genCode(\n\t\t{\n\t\t\tenums,\n\t\t\tschemas,\n\t\t\tparameters,\n\t\t\tresponses,\n\t\t\trequestBodies,\n\t\t\tapis,\n\t\t},\n\t\tinitOptions,\n\t\tadaptor\n\t);\n\n\tif (initOptions.output) {\n\t\tawait Generator.write(code, initOptions.output);\n\t}\n\n\tconst duration = Date.now() - startTime;\n\tconst endpoints = Object.keys(apis).length;\n\tconst schemasCount = Object.keys(schemas).length;\n\n\treturn {\n\t\tcode,\n\t\tstats: {\n\t\t\tendpoints,\n\t\t\tschemas: schemasCount,\n\t\t\tduration,\n\t\t},\n\t};\n}\n\nexport type { ProviderInitOptions } from '../core/index.js';\n","import path from 'node:path';\nimport { createScopedLogger } from '@moccona/logger';\nimport fs from 'fs-extra';\nimport type { PluginOption } from 'vite';\nimport { loadConfig, toProviderOptions } from '../core/config.js';\nimport {\n\tcreateErrors,\n\tErrorCodes,\n\tisApicodegenError,\n\twrapError,\n} from '../core/errors.js';\nimport { logger } from '../core/logger.js';\nimport { codeGen } from '../openapi/index.js';\n\nconst PLUGIN_NAME = 'api-code-gen';\nconst pluginLogger = createScopedLogger('api-code-gen');\n\nexport type ApiCodeGenPluginOptions = {\n\t/** Human-readable name for this API config (required) */\n\tname: string;\n\t/** OpenAPI spec file path or URL */\n\tspec?: string;\n\t/** Output file path */\n\toutput?: string;\n\t/** HTTP client adaptor */\n\tadaptor?: 'fetch' | 'axios';\n\t/** Base URL for API endpoints */\n\tbaseURL?: string;\n\t/** Custom client import source path */\n\timportClientSource?: string;\n\t/** Enable verbose logging */\n\tverbose?: boolean;\n\t/** Run type check after generation (default: true) */\n\ttypeCheck?: boolean;\n};\n\n/**\n * Find the nearest tsconfig.json or jsconfig.json by searching upward.\n * Bounded by process.cwd() — the Vite project root — to avoid picking up\n * unrelated configs outside the project.\n */\nasync function findNearestTsConfig(filePath: string): Promise<string | null> {\n\tlet dir = path.dirname(path.resolve(filePath));\n\tconst rootDir = process.cwd();\n\tconst fsRoot = path.parse(dir).root;\n\n\twhile (true) {\n\t\tfor (const name of ['tsconfig.json', 'jsconfig.json']) {\n\t\t\tconst configPath = path.join(dir, name);\n\t\t\tif (await fs.pathExists(configPath)) {\n\t\t\t\treturn configPath;\n\t\t\t}\n\t\t}\n\n\t\tif (dir === rootDir || dir === fsRoot) break;\n\n\t\tdir = path.dirname(dir);\n\t}\n\n\treturn null;\n}\n\n/**\n * Run TypeScript type checking on generated file\n */\nasync function runTypeCheck(filePath: string): Promise<string[]> {\n\tconst { execaCommand } = await import('execa');\n\tconst errors: string[] = [];\n\n\tconst resolvedPath = path.resolve(filePath);\n\tconst tsconfigPath = await findNearestTsConfig(resolvedPath);\n\n\tif (!tsconfigPath) {\n\t\ttry {\n\t\t\tawait execaCommand(`npx tsc ${resolvedPath} --noEmit`, {\n\t\t\t\tshell: true,\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tif (error instanceof Error) {\n\t\t\t\terrors.push(error.message);\n\t\t\t}\n\t\t}\n\t\treturn errors;\n\t}\n\n\tconst outputDir = path.dirname(resolvedPath);\n\tconst tempConfigName = `.${path.basename(resolvedPath).replace(/\\.ts$/i, '')}.${Date.now()}.apicodegen.json`;\n\tconst tempConfigPath = path.join(outputDir, tempConfigName);\n\tconst extendsPath = path.relative(outputDir, tsconfigPath);\n\n\tconst tempConfig = {\n\t\textends: extendsPath,\n\t\tcompilerOptions: {\n\t\t\tnoEmit: true,\n\t\t},\n\t\tinclude: [path.basename(resolvedPath)],\n\t};\n\n\ttry {\n\t\tawait fs.writeJson(tempConfigPath, tempConfig);\n\t\tawait execaCommand(`npx tsc --project \"${tempConfigPath}\" --noEmit`, {\n\t\t\tshell: true,\n\t\t});\n\t} catch (error) {\n\t\tif (error instanceof Error) {\n\t\t\terrors.push(error.message);\n\t\t}\n\t} finally {\n\t\ttry {\n\t\t\tawait fs.remove(tempConfigPath);\n\t\t} catch {\n\t\t\t// ignore cleanup errors\n\t\t}\n\t}\n\n\treturn errors;\n}\n\n/**\n * Validate spec path exists\n */\nasync function validateSpecPath(specPath: string): Promise<void> {\n\t// For URLs, skip file existence check\n\tif (specPath.startsWith('http://') || specPath.startsWith('https://')) {\n\t\treturn;\n\t}\n\n\tconst filePath = specPath.replace(/^file:\\/\\//, '');\n\tconst absolutePath = path.isAbsolute(filePath)\n\t\t? filePath\n\t\t: path.resolve(process.cwd(), filePath);\n\n\tconst exists = await fs.pathExists(absolutePath);\n\tif (!exists) {\n\t\tthrow createErrors.specNotFound(absolutePath);\n\t}\n}\n\n/**\n * Generate code for a single API configuration\n */\nasync function generateForOption(option: ApiCodeGenPluginOptions): Promise<{\n\tsuccess: boolean;\n\tname: string;\n\toutput?: string;\n\tstats?: { endpoints: number; schemas: number; duration: number };\n\terror?: unknown;\n}> {\n\tconst { name, typeCheck = true, verbose, ...restOptions } = option;\n\n\ttry {\n\t\tlogger.info(`Generating ${name}...`);\n\n\t\t// Use config loader to handle env vars and config files\n\t\tconst config = await loadConfig({\n\t\t\tname,\n\t\t\tcliOptions: { ...restOptions, verbose },\n\t\t});\n\n\t\t// Validate spec exists\n\t\tawait validateSpecPath(config.spec);\n\n\t\t// Ensure output directory exists\n\t\tif (config.output) {\n\t\t\tconst outputDir = path.dirname(config.output);\n\t\t\tawait fs.ensureDir(outputDir);\n\t\t}\n\n\t\t// Convert to provider options and resolve docURL\n\t\tlet docURL = config.spec;\n\t\tif (!docURL.startsWith('http://') && !docURL.startsWith('https://')) {\n\t\t\tif (docURL.startsWith('/') || docURL.match(/^[A-Za-z]:/)) {\n\t\t\t\tdocURL = `file://${docURL}`;\n\t\t\t} else {\n\t\t\t\tdocURL = path.resolve(process.cwd(), docURL);\n\t\t\t}\n\t\t}\n\n\t\tconst result = await codeGen({\n\t\t\t...toProviderOptions(config),\n\t\t\tdocURL,\n\t\t});\n\n\t\tif (config.output) {\n\t\t\tawait fs.writeFile(config.output, result.code);\n\t\t}\n\n\t\t// Run type check if enabled\n\t\tif (typeCheck && config.output) {\n\t\t\tconst typeErrors = await runTypeCheck(config.output);\n\t\t\tif (typeErrors.length > 0) {\n\t\t\t\tpluginLogger.warn(`Type check failed for ${config.output}`);\n\t\t\t\tif (verbose) {\n\t\t\t\t\tfor (const error of typeErrors) {\n\t\t\t\t\t\tpluginLogger.warn(`  ${error}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tname,\n\t\t\toutput: config.output,\n\t\t\tstats: result.stats,\n\t\t};\n\t} catch (error) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\tname,\n\t\t\terror,\n\t\t};\n\t}\n}\n\n/**\n * Main Vite plugin function\n *\n * @example\n * ```ts\n * // vite.config.ts\n * import { apiCodeGenPlugin } from '@moccona/apicodegen/vite';\n *\n * export default defineConfig({\n *   plugins: [\n *     apiCodeGenPlugin([\n *       {\n *         name: 'my-api',\n *         spec: './openapi.json',\n *         output: './src/api/generated.ts',\n *         baseURL: 'https://api.example.com',\n *       },\n *     ]),\n *   ],\n * });\n * ```\n */\nexport function apiCodeGenPlugin(\n\toptions: ApiCodeGenPluginOptions[]\n): PluginOption {\n\tif (!Array.isArray(options) || options.length === 0) {\n\t\tpluginLogger.warn('No API configurations provided to apiCodeGenPlugin');\n\t\treturn { name: PLUGIN_NAME };\n\t}\n\n\treturn {\n\t\tname: PLUGIN_NAME,\n\n\t\tasync config(_config, env) {\n\t\t\tlogger.heading('API Code Gen', env?.command);\n\n\t\t\tconst results = await Promise.all(options.map(generateForOption));\n\t\t\tconst successCount = results.filter((r) => r.success).length;\n\t\t\tconst failCount = options.length - successCount;\n\n\t\t\tlogger.divider();\n\n\t\t\tfor (const result of results) {\n\t\t\t\tif (result.success) {\n\t\t\t\t\tconst { name, output, stats } = result;\n\t\t\t\t\tif (stats) {\n\t\t\t\t\t\tlogger.item(\n\t\t\t\t\t\t\t`${name} → ${output} (${stats.endpoints} endpoints, ${stats.schemas} schemas) ${stats.duration}ms`,\n\t\t\t\t\t\t\t'green'\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlogger.item(`${name} → ${output || 'N/A'}`, 'green');\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst { name, error } = result;\n\t\t\t\t\tif (isApicodegenError(error)) {\n\t\t\t\t\t\tlogger.item(name, 'red');\n\t\t\t\t\t\tlogger.error(error, true);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst wrapped = wrapError(error!, {\n\t\t\t\t\t\t\tcode: ErrorCodes.GENERATION_FAILED,\n\t\t\t\t\t\t\tmessage: `Failed to generate API \"${name}\"`,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tlogger.item(name, 'red');\n\t\t\t\t\t\tlogger.error(wrapped, true);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlogger.divider();\n\n\t\t\tconst totalDuration = results.reduce(\n\t\t\t\t(sum, r) => sum + (r.stats?.duration || 0),\n\t\t\t\t0\n\t\t\t);\n\t\t\tconst totalEndpoints = results.reduce(\n\t\t\t\t(sum, r) => sum + (r.stats?.endpoints || 0),\n\t\t\t\t0\n\t\t\t);\n\t\t\tconst totalSchemas = results.reduce(\n\t\t\t\t(sum, r) => sum + (r.stats?.schemas || 0),\n\t\t\t\t0\n\t\t\t);\n\n\t\t\tlogger.summary({\n\t\t\t\tsucceeded: successCount,\n\t\t\t\tfailed: failCount,\n\t\t\t\tendpoints: totalEndpoints,\n\t\t\t\tschemas: totalSchemas,\n\t\t\t\tduration: totalDuration,\n\t\t\t});\n\t\t\tlogger.divider();\n\n\t\t\treturn {};\n\t\t},\n\t};\n}\n\nexport default apiCodeGenPlugin;\n"],"mappings":";;;;;;;;;;;;AAaA,IAAsB,UAAtB,MAA8B,CAkD9B;;;AC/DA,MAAa,qBAAqB,IAAI,IAAI;CACzC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;;;AC/DD,IAAY,aAAL,yBAAA,YAAA;CACN,WAAA,aAAA;CACA,WAAA,gBAAA;CACA,WAAA,eAAA;CACA,WAAA,mBAAA;;AACD,EAAA,CAAA,CAAA;AAEA,IAAY,qBAAL,yBAAA,oBAAA;CACN,mBAAA,YAAA;CACA,mBAAA,YAAA;CACA,mBAAA,YAAA;CACA,mBAAA,aAAA;CACA,mBAAA,aAAA;CACA,mBAAA,UAAA;CACA,mBAAA,UAAA;;AACD,EAAA,CAAA,CAAA;AAEA,IAAY,kBAAL,yBAAA,iBAAA;CACN,gBAAA,WAAA;;AACD,EAAA,CAAA,CAAA;AAEA,IAAY,mBAAL,yBAAA,kBAAA;CACN,iBAAA,YAAA;CACA,iBAAA,YAAA;CACA,iBAAA,aAAA;CACA,iBAAA,UAAA;CACA,iBAAA,YAAA;CACA,iBAAA,UAAA;;AACD,EAAA,CAAA,CAAA;AAEA,IAAY,cAAL,yBAAA,aAAA;CACN,YAAA,YAAA;CACA,YAAA,UAAA;CACA,YAAA,WAAA;CACA,YAAA,YAAA;CACA,YAAA,UAAA;CACA,YAAA,cAAA;;AACD,EAAA,CAAA,CAAA;AAgDA,I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