@kubb/plugin-client 5.0.0-beta.64 → 5.7.0-canary.20260930T095256

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +8 -61
  2. package/dist/index.cjs +753 -1749
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.ts +168 -347
  5. package/dist/index.js +729 -1734
  6. package/dist/index.js.map +1 -1
  7. package/package.json +12 -64
  8. package/src/generators/clientGenerator.tsx +9 -0
  9. package/src/index.ts +2 -0
  10. package/src/plugin.ts +71 -0
  11. package/src/types.ts +54 -0
  12. package/dist/chunk-Bx3C2hgW.cjs +0 -38
  13. package/dist/clients/axios.cjs +0 -68
  14. package/dist/clients/axios.cjs.map +0 -1
  15. package/dist/clients/axios.d.ts +0 -49
  16. package/dist/clients/axios.js +0 -58
  17. package/dist/clients/axios.js.map +0 -1
  18. package/dist/clients/fetch.cjs +0 -128
  19. package/dist/clients/fetch.cjs.map +0 -1
  20. package/dist/clients/fetch.d.ts +0 -50
  21. package/dist/clients/fetch.js +0 -120
  22. package/dist/clients/fetch.js.map +0 -1
  23. package/dist/templates/clients/axios.source.cjs +0 -7
  24. package/dist/templates/clients/axios.source.cjs.map +0 -1
  25. package/dist/templates/clients/axios.source.d.ts +0 -7
  26. package/dist/templates/clients/axios.source.js +0 -6
  27. package/dist/templates/clients/axios.source.js.map +0 -1
  28. package/dist/templates/clients/fetch.source.cjs +0 -7
  29. package/dist/templates/clients/fetch.source.cjs.map +0 -1
  30. package/dist/templates/clients/fetch.source.d.ts +0 -7
  31. package/dist/templates/clients/fetch.source.js +0 -6
  32. package/dist/templates/clients/fetch.source.js.map +0 -1
  33. package/dist/templates/config.source.cjs +0 -7
  34. package/dist/templates/config.source.cjs.map +0 -1
  35. package/dist/templates/config.source.d.ts +0 -7
  36. package/dist/templates/config.source.js +0 -6
  37. package/dist/templates/config.source.js.map +0 -1
  38. /package/dist/{chunk-C0LytTxp.js → rolldown-runtime-C0LytTxp.js} +0 -0
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["Url","Url","declarationPrinter","declarationPrinter","UrlHelper","declarationPrinter","Url","declarationPrinter","generateMethod","Url","resolveTypeImportNames","resolveZodImportNames","Url","Url","fetchClientSource","axiosClientSource","configSource"],"sources":["../../../internals/utils/src/casing.ts","../../../internals/utils/src/fs.ts","../../../internals/utils/src/reserved.ts","../../../internals/utils/src/url.ts","../../../internals/shared/src/operation.ts","../../../internals/shared/src/group.ts","../../../internals/shared/src/params.ts","../src/functionParams.ts","../src/utils.ts","../src/components/Url.tsx","../src/components/Client.tsx","../src/components/ClassClient.tsx","../src/components/WrapperClient.tsx","../src/generators/classClientGenerator.tsx","../src/generators/clientGenerator.tsx","../src/generators/groupedClientGenerator.tsx","../src/generators/operationsGenerator.ts","../src/components/StaticClassClient.tsx","../src/generators/staticClassClientGenerator.tsx","../src/resolvers/resolverClient.ts","../src/plugin.ts"],"sourcesContent":["type Options = {\n /**\n * Text prepended before casing is applied.\n */\n prefix?: string\n /**\n * Text appended before casing is applied.\n */\n suffix?: string\n}\n\n/**\n * Shared implementation for camelCase and PascalCase conversion.\n * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)\n * and capitalizes each word according to `pascal`.\n *\n * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.\n */\nfunction toCamelOrPascal(text: string, pascal: boolean): string {\n return text\n .trim()\n .replace(/([a-z\\d])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n .replace(/(\\d)([a-z])/g, '$1 $2')\n .split(/[\\s\\-_./\\\\:]+/)\n .filter(Boolean)\n .map((word, i) => {\n if (word.length > 1 && word === word.toUpperCase()) return word\n const head = i === 0 && !pascal ? word.charAt(0).toLowerCase() : word.charAt(0).toUpperCase()\n return head + word.slice(1)\n })\n .join('')\n .replace(/[^a-zA-Z0-9]/g, '')\n}\n\n/**\n * Converts `text` to camelCase.\n *\n * @example Word boundaries\n * `camelCase('hello-world') // 'helloWorld'`\n *\n * @example With a prefix\n * `camelCase('tag', { prefix: 'create' }) // 'createTag'`\n */\nexport function camelCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false)\n}\n\n/**\n * Converts `text` to PascalCase.\n *\n * @example Word boundaries\n * `pascalCase('hello-world') // 'HelloWorld'`\n *\n * @example With a suffix\n * `pascalCase('tag', { suffix: 'schema' }) // 'TagSchema'`\n */\nexport function pascalCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true)\n}\n\n/**\n * Converts `text` to snake_case.\n *\n * @example From camelCase\n * `snakeCase('helloWorld') // 'hello_world'`\n *\n * @example From mixed separators\n * `snakeCase('Hello-World') // 'hello_world'`\n */\nexport function snakeCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n const processed = `${prefix} ${text} ${suffix}`.trim()\n return processed\n .replace(/([a-z])([A-Z])/g, '$1_$2')\n .replace(/[\\s\\-.]+/g, '_')\n .replace(/[^a-zA-Z0-9_]/g, '')\n .toLowerCase()\n .split('_')\n .filter(Boolean)\n .join('_')\n}\n\n/**\n * Converts `text` to SCREAMING_SNAKE_CASE.\n *\n * @example From camelCase\n * `screamingSnakeCase('helloWorld') // 'HELLO_WORLD'`\n */\nexport function screamingSnakeCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return snakeCase(text, { prefix, suffix }).toUpperCase()\n}\n","import { posix } from 'node:path'\nimport { camelCase } from './casing.ts'\n\nfunction toSlash(p: string): string {\n if (p.startsWith('\\\\\\\\?\\\\')) return p\n return p.replaceAll('\\\\', '/')\n}\n\n/**\n * Returns the relative path from `rootDir` to `filePath`, always using forward slashes\n * and prefixed with `./` when not already traversing upward.\n *\n * @example\n * ```ts\n * getRelativePath('/src/components', '/src/components/Button.tsx') // './Button.tsx'\n * getRelativePath('/src/components', '/src/utils/helpers.ts') // '../utils/helpers.ts'\n * ```\n */\nexport function getRelativePath(rootDir?: string | null, filePath?: string | null): string {\n if (!rootDir || !filePath) {\n throw new Error(`Root and file should be filled in when retrieving the relativePath, ${rootDir || ''} ${filePath || ''}`)\n }\n\n const relativePath = posix.relative(toSlash(rootDir), toSlash(filePath))\n\n return relativePath.startsWith('../') ? relativePath : `./${relativePath}`\n}\n\n/**\n * Builds a nested file path from a dotted name. Splits on dots that precede a letter\n * (so version numbers embedded in operationIds like `v2025.0` stay intact), camelCases\n * every earlier segment, applies `caseLast` to the final segment, and joins with `/`.\n *\n * Empty segments are dropped before joining. They arise when the name starts with a dot\n * followed by a letter (e.g. `..Schema` splits into `['..', 'Schema']` and `'..'` cases to\n * an empty string). Without this a leading `/` would form, which `path.resolve` reads as an\n * absolute path, letting generated files escape the configured output directory.\n *\n * @example Nested path from a dotted name\n * `toFilePath('pet.petId') // 'pet/petId'`\n *\n * @example PascalCase the final segment\n * `toFilePath('pet.Pet', pascalCase) // 'pet/Pet'`\n *\n * @example Suffix applied to the final segment only\n * `toFilePath('tag.tag', (part) => camelCase(part, { suffix: 'schema' })) // 'tag/tagSchema'`\n */\nexport function toFilePath(name: string, caseLast: (part: string) => string = camelCase): string {\n const parts = name.split(/\\.(?=[a-zA-Z])/)\n return parts\n .map((part, i) => (i === parts.length - 1 ? caseLast(part) : camelCase(part)))\n .filter(Boolean)\n .join('/')\n}\n","/**\n * JavaScript and Java reserved words.\n * @link https://github.com/jonschlinkert/reserved/blob/master/index.js\n */\nconst reservedWords = new Set([\n 'abstract',\n 'arguments',\n 'boolean',\n 'break',\n 'byte',\n 'case',\n 'catch',\n 'char',\n 'class',\n 'const',\n 'continue',\n 'debugger',\n 'default',\n 'delete',\n 'do',\n 'double',\n 'else',\n 'enum',\n 'eval',\n 'export',\n 'extends',\n 'false',\n 'final',\n 'finally',\n 'float',\n 'for',\n 'function',\n 'goto',\n 'if',\n 'implements',\n 'import',\n 'in',\n 'instanceof',\n 'int',\n 'interface',\n 'let',\n 'long',\n 'native',\n 'new',\n 'null',\n 'package',\n 'private',\n 'protected',\n 'public',\n 'return',\n 'short',\n 'static',\n 'super',\n 'switch',\n 'synchronized',\n 'this',\n 'throw',\n 'throws',\n 'transient',\n 'true',\n 'try',\n 'typeof',\n 'var',\n 'void',\n 'volatile',\n 'while',\n 'with',\n 'yield',\n 'Array',\n 'Date',\n 'hasOwnProperty',\n 'Infinity',\n 'isFinite',\n 'isNaN',\n 'isPrototypeOf',\n 'length',\n 'Math',\n 'name',\n 'NaN',\n 'Number',\n 'Object',\n 'prototype',\n 'String',\n 'toString',\n 'undefined',\n 'valueOf',\n] as const)\n\n/**\n * Returns `true` when `name` is a syntactically valid JavaScript variable name.\n *\n * @example\n * ```ts\n * isValidVarName('status') // true\n * isValidVarName('class') // false (reserved word)\n * isValidVarName('42foo') // false (starts with digit)\n * ```\n */\nexport function isValidVarName(name: string): boolean {\n if (!name || reservedWords.has(name as 'valueOf')) {\n return false\n }\n return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name)\n}\n\n/**\n * Returns `name` when it's a syntactically valid JavaScript variable name,\n * otherwise prefixes it with `_` so the result is a valid identifier.\n *\n * Useful for sanitizing OpenAPI schema names or operation IDs that start with\n * a digit (e.g. `409`, `504AccountCancel`) before using them as exported\n * variable, type, or function names.\n *\n * @example\n * ```ts\n * ensureValidVarName('409') // '_409'\n * ensureValidVarName('504AccountCancel') // '_504AccountCancel'\n * ensureValidVarName('Pet') // 'Pet'\n * ensureValidVarName('class') // '_class'\n * ```\n */\nexport function ensureValidVarName(name: string): string {\n if (!name || isValidVarName(name)) {\n return name\n }\n return `_${name}`\n}\n","import { camelCase } from './casing.ts'\nimport { isValidVarName } from './reserved.ts'\n\nexport type URLObject = {\n /**\n * The resolved URL string (Express-style or template literal, depending on context).\n */\n url: string\n /**\n * Extracted path parameters as a key-value map, or `null` when the path has none.\n */\n params: Record<string, string> | null\n}\n\n/**\n * Supported identifier casing strategies for path parameters.\n */\nexport type PathCasing = 'camelcase'\n\ntype TemplateOptions = {\n /**\n * Literal text prepended inside the template literal, e.g. a base URL.\n */\n prefix?: string | null\n /**\n * Transform applied to each extracted parameter name before interpolation.\n */\n replacer?: (pathParam: string) => string\n /**\n * Casing strategy applied to path parameter names.\n */\n casing?: PathCasing\n}\n\ntype ObjectOptions = {\n /**\n * Controls whether the `url` is rendered as an Express path or a template literal.\n * @default 'path'\n */\n type?: 'path' | 'template'\n /**\n * Transform applied to each extracted parameter name.\n */\n replacer?: (pathParam: string) => string\n /**\n * When `true`, the result is serialized to a string expression instead of a plain object.\n */\n stringify?: boolean\n /**\n * Casing strategy applied to path parameter names.\n */\n casing?: PathCasing\n}\n\nfunction transformParam(raw: string, casing?: PathCasing): string {\n const param = isValidVarName(raw) ? raw : camelCase(raw)\n return casing === 'camelcase' ? camelCase(param) : param\n}\n\nfunction toParamsObject(\n path: string,\n { replacer, casing }: { replacer?: (pathParam: string) => string; casing?: PathCasing } = {},\n): Record<string, string> | null {\n const params: Record<string, string> = {}\n\n for (const match of path.matchAll(/\\{([^}]+)\\}/g)) {\n const param = transformParam(match[1]!, casing)\n const key = replacer ? replacer(param) : param\n params[key] = key\n }\n\n return Object.keys(params).length > 0 ? params : null\n}\n\n/**\n * Helpers for OpenAPI/Swagger paths, plus a thin wrapper over the native `URL`.\n */\nexport class Url {\n /**\n * Reports whether `url` is a parseable absolute URL. Delegates to the native `URL.canParse`.\n *\n * @example\n * Url.canParse('https://petstore.swagger.io/v2') // true\n * Url.canParse('/pet/{petId}') // false\n */\n static canParse(url: string, base?: string | URL): boolean {\n return URL.canParse(url, base)\n }\n\n /**\n * Converts an OpenAPI/Swagger path to Express-style colon syntax.\n *\n * @example\n * Url.toPath('/pet/{petId}') // '/pet/:petId'\n */\n static toPath(path: string): string {\n return path.replace(/\\{([^}]+)\\}/g, ':$1')\n }\n\n /**\n * Converts an OpenAPI/Swagger path to a TypeScript template literal string.\n * `prefix` is prepended inside the literal, `replacer` transforms each parameter name,\n * and `casing` controls parameter identifier casing.\n *\n * @example\n * Url.toTemplateString('/pet/{petId}') // '`/pet/${petId}`'\n *\n * @example\n * Url.toTemplateString('/pet/{petId}', { prefix: 'https://api' }) // '`https://api/pet/${petId}`'\n */\n static toTemplateString(path: string, { prefix, replacer, casing }: TemplateOptions = {}): string {\n const parts = path.split(/\\{([^}]+)\\}/)\n const result = parts\n .map((part, i) => {\n if (i % 2 === 0) return part\n const param = transformParam(part, casing)\n return `\\${${replacer ? replacer(param) : param}}`\n })\n .join('')\n\n return `\\`${prefix ?? ''}${result}\\``\n }\n\n /**\n * Returns the path and its extracted params as a structured `URLObject`, or as a stringified\n * expression when `stringify` is set.\n *\n * @example\n * Url.toObject('/pet/{petId}')\n * // { url: '/pet/:petId', params: { petId: 'petId' } }\n */\n static toObject(path: string, { type = 'path', replacer, stringify, casing }: ObjectOptions = {}): URLObject | string {\n const object: URLObject = {\n url: type === 'path' ? Url.toPath(path) : Url.toTemplateString(path, { replacer, casing }),\n params: toParamsObject(path, { replacer, casing }),\n }\n\n if (stringify) {\n if (type === 'template') {\n return JSON.stringify(object).replaceAll(\"'\", '').replaceAll(`\"`, '')\n }\n\n if (object.params) {\n return `{ url: '${object.url}', params: ${JSON.stringify(object.params).replaceAll(\"'\", '').replaceAll(`\"`, '')} }`\n }\n\n return `{ url: '${object.url}' }`\n }\n\n return object\n }\n}\n","import { Url } from '@internals/utils'\nimport { ast, type ResolverFileParams } from '@kubb/core'\nimport { caseParams } from '@kubb/ast/utils'\n\n/**\n * Builds the `ResolverFileParams` every operation generator passes to\n * `resolver.resolveFile`: a file named `name`, tagged by the operation's first\n * tag (or `'default'`), at the operation's path. Centralizes the entry object\n * that was repeated at dozens of call sites across the client and query plugins.\n *\n * @example\n * ```ts\n * resolver.resolveFile(operationFileEntry(node, node.operationId), { root, output, group })\n * ```\n */\nexport function operationFileEntry(node: ast.OperationNode, name: string, extname: ResolverFileParams['extname'] = '.ts'): ResolverFileParams {\n return {\n name,\n extname,\n tag: node.tags[0] ?? 'default',\n path: node.path,\n }\n}\n\nexport type ContentTypeInfo = {\n contentTypes: string[]\n isMultipleContentTypes: boolean\n contentTypeUnion: string\n defaultContentType: string\n hasFormData: boolean\n}\n\nexport type RequestConfigResolver = {\n resolveDataName(node: ast.OperationNode): string\n}\n\nexport type ResponseStatusNameResolver = {\n resolveResponseStatusName(node: ast.OperationNode, statusCode: ast.StatusCode): string\n}\n\nexport type ResponseNameResolver = ResponseStatusNameResolver & {\n resolveResponseName(node: ast.OperationNode): string\n}\n\nexport type OperationTypeNameResolver = RequestConfigResolver &\n ResponseNameResolver & {\n resolvePathParamsName(node: ast.OperationNode, param: ast.ParameterNode): string\n resolveQueryParamsName(node: ast.OperationNode, param: ast.ParameterNode): string\n resolveHeaderParamsName(node: ast.OperationNode, param: ast.ParameterNode): string\n }\n\nexport type OperationCommentLink = 'pathTemplate' | 'urlPath' | false | ((node: ast.OperationNode) => string | undefined)\n\nexport type BuildOperationCommentsOptions = {\n link?: OperationCommentLink\n linkPosition?: 'beforeDeprecated' | 'afterDeprecated'\n splitLines?: boolean\n}\n\ntype ResponseLike = {\n statusCode: ast.StatusCode | number | string\n}\n\nexport type OperationParameterGroups = Record<ast.ParameterNode['in'], Array<ast.ParameterNode>>\n\nexport type ResolveOperationTypeNameOptions = {\n paramsCasing?: 'camelcase'\n responseStatusNames?: boolean | 'error'\n exclude?: ReadonlyArray<string | undefined>\n order?: 'params-first' | 'body-response-first'\n}\n\nfunction getOperationLink(node: ast.OperationNode, link: OperationCommentLink): string | null {\n if (!link) {\n return null\n }\n\n if (typeof link === 'function') {\n return link(node) ?? null\n }\n\n if (link === 'urlPath') {\n return node.path ? `{@link ${Url.toPath(node.path)}}` : null\n }\n\n return node.path ? `{@link ${node.path.replaceAll('{', ':').replaceAll('}', '')}}` : null\n}\n\nexport function getContentTypeInfo(node: ast.OperationNode): ContentTypeInfo {\n const contentTypes = node.requestBody?.content?.map((e) => e.contentType) ?? []\n const isMultipleContentTypes = contentTypes.length > 1\n\n return {\n contentTypes,\n isMultipleContentTypes,\n contentTypeUnion: isMultipleContentTypes ? contentTypes.map((ct) => JSON.stringify(ct)).join(' | ') : '',\n defaultContentType: contentTypes[0] ?? 'application/json',\n hasFormData: contentTypes.some((ct) => ct === 'multipart/form-data'),\n }\n}\n\nexport type ResponseType = 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream'\n\n/**\n * Derives the default `responseType` for an operation from its primary success response.\n *\n * Returns a value only when that response declares a single non-JSON content type — a binary type\n * (`application/octet-stream`, `application/pdf`, `image/*`, `audio/*`, `video/*`) maps to `'blob'`\n * and other `text/*` maps to `'text'`. Otherwise `undefined`, leaving the runtime client's\n * `Content-Type` auto-detection in charge.\n */\nexport function getResponseType(node: ast.OperationNode): ResponseType | undefined {\n const contentTypes = getPrimarySuccessResponse(node)?.content?.map((entry) => entry.contentType) ?? []\n if (contentTypes.length !== 1) return undefined\n\n const baseType = contentTypes[0]!.split(';')[0]!.trim().toLowerCase()\n if (baseType === 'application/json' || baseType.endsWith('+json') || baseType === 'text/json') return undefined\n if (baseType.startsWith('text/')) return 'text'\n if (baseType === 'application/octet-stream' || baseType === 'application/pdf' || /^(image|audio|video)\\//.test(baseType)) return 'blob'\n return undefined\n}\n\n/**\n * Maps a content type to the PascalCase suffix used to name per-content-type variants\n * (e.g. `application/json` → `Json`, `application/xml` → `Xml`, `multipart/form-data` → `FormData`).\n */\nexport function getContentTypeSuffix(contentType: string): string {\n const baseType = contentType.split(';')[0]!.trim()\n if (baseType === 'application/json') return 'Json'\n if (baseType === 'multipart/form-data') return 'FormData'\n if (baseType === 'application/x-www-form-urlencoded') return 'FormUrlEncoded'\n const subtype = baseType.split('/').pop() ?? baseType\n const parts = subtype.split(/[^a-zA-Z0-9]+/).filter(Boolean)\n if (parts.length === 0) return 'Unknown'\n return parts.map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join('')\n}\n\n/**\n * Appends a content-type suffix to a base name, keeping a trailing `Data` segment last\n * (e.g. `AddPetData` + `Json` → `AddPetJsonData`, `AddPetStatus200` + `Xml` → `AddPetStatus200Xml`).\n */\nexport function getPerContentTypeName(baseName: string, suffix: string): string {\n if (baseName.endsWith('Data')) {\n return suffix.endsWith('Data') ? baseName.slice(0, -4) + suffix : `${baseName.slice(0, -4)}${suffix}Data`\n }\n return baseName + suffix\n}\n\nexport type ContentVariantInput = { contentType: string; schema?: ast.SchemaNode | null; keysToOmit?: Array<string> | null }\nexport type ContentVariant = { name: string; suffix: string; schema: ast.SchemaNode; keysToOmit?: Array<string> | null; contentType: string }\n\n/**\n * Resolves per-content-type variant names for a set of content entries, deduplicating suffix\n * collisions with a numeric counter. Entries without a schema are skipped. The returned `suffix` is\n * the final (possibly counter-augmented) value, so callers can derive parallel names in another\n * namespace (e.g. plugin-faker deriving the matching plugin-ts type name).\n */\nexport function resolveContentTypeVariants(entries: Array<ContentVariantInput>, baseName: string): Array<ContentVariant> {\n const usedNames = new Set<string>()\n return entries\n .filter((entry) => entry.schema)\n .map((entry) => {\n const baseSuffix = getContentTypeSuffix(entry.contentType)\n let suffix = baseSuffix\n let name = getPerContentTypeName(baseName, suffix)\n let counter = 2\n while (usedNames.has(name)) {\n suffix = `${baseSuffix}${counter++}`\n name = getPerContentTypeName(baseName, suffix)\n }\n usedNames.add(name)\n return { name, suffix, schema: entry.schema!, keysToOmit: entry.keysToOmit, contentType: entry.contentType }\n })\n}\n\nexport function buildRequestConfigType(node: ast.OperationNode, resolver: RequestConfigResolver): string {\n const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : null\n const { isMultipleContentTypes, contentTypeUnion } = getContentTypeInfo(node)\n const configType = requestName ? `Partial<RequestConfig<${requestName}>>` : 'Partial<RequestConfig>'\n const configProps = ['client?: Client', isMultipleContentTypes ? `contentType?: ${contentTypeUnion}` : null].filter(Boolean).join('; ')\n\n return `${configType} & { ${configProps} }`\n}\n\nexport function buildOperationComments(node: ast.OperationNode, options: BuildOperationCommentsOptions = {}): Array<string> {\n const { link = 'pathTemplate', linkPosition = 'afterDeprecated', splitLines = false } = options\n const linkComment = getOperationLink(node, link)\n const comments =\n linkPosition === 'beforeDeprecated'\n ? [node.description && `@description ${node.description}`, node.summary && `@summary ${node.summary}`, linkComment, node.deprecated && '@deprecated']\n : [node.description && `@description ${node.description}`, node.summary && `@summary ${node.summary}`, node.deprecated && '@deprecated', linkComment]\n\n const filteredComments = comments.filter((comment): comment is string => Boolean(comment))\n\n if (!splitLines) {\n return filteredComments\n }\n\n return filteredComments.flatMap((text) => text.split(/\\r?\\n/).map((line) => line.trim())).filter((comment): comment is string => Boolean(comment))\n}\n\nexport function getOperationParameters(node: ast.OperationNode, options: { paramsCasing?: 'camelcase' } = {}): OperationParameterGroups {\n const params = caseParams(node.parameters, options.paramsCasing)\n\n return {\n path: params.filter((param) => param.in === 'path'),\n query: params.filter((param) => param.in === 'query'),\n header: params.filter((param) => param.in === 'header'),\n cookie: params.filter((param) => param.in === 'cookie'),\n }\n}\n\nexport function getStatusCodeNumber(statusCode: ast.StatusCode | number | string): number | null {\n const code = Number(statusCode)\n\n return Number.isNaN(code) ? null : code\n}\n\nexport function isSuccessStatusCode(statusCode: ast.StatusCode | number | string): boolean {\n const code = getStatusCodeNumber(statusCode)\n\n return code !== null && code >= 200 && code < 300\n}\n\nexport function isErrorStatusCode(statusCode: ast.StatusCode | number | string): boolean {\n const code = getStatusCodeNumber(statusCode)\n\n return code !== null && code >= 400\n}\n\nexport function getSuccessResponses<TResponse extends ResponseLike>(responses: ReadonlyArray<TResponse>): Array<TResponse> {\n return responses.filter((response) => isSuccessStatusCode(response.statusCode))\n}\n\nexport function getOperationSuccessResponses(node: ast.OperationNode): Array<ast.ResponseNode> {\n return getSuccessResponses(node.responses)\n}\n\nexport function getPrimarySuccessResponse(node: ast.OperationNode): ast.ResponseNode | null {\n return getOperationSuccessResponses(node)[0] ?? null\n}\n\nexport function resolveErrorNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses\n .filter((response) => isErrorStatusCode(response.statusCode))\n .map((response) => resolver.resolveResponseStatusName(node, response.statusCode))\n}\n\nexport function resolveSuccessNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses\n .filter((response) => isSuccessStatusCode(response.statusCode))\n .map((response) => resolver.resolveResponseStatusName(node, response.statusCode))\n}\n\nexport function resolveStatusCodeNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses.map((response) => resolver.resolveResponseStatusName(node, response.statusCode))\n}\n\n/**\n * Builds the discriminated union type string for `dataReturnType: 'full'` return shapes.\n * Each member is `{ status: N; data: StatusNType; statusText: string }`.\n */\nexport function buildStatusUnionType(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string {\n const members = node.responses.map((r) => {\n const typeName = resolver.resolveResponseStatusName(node, r.statusCode)\n const statusCode = Number.parseInt(r.statusCode, 10)\n const statusLiteral = Number.isNaN(statusCode) ? 'number' : String(statusCode)\n return `{ status: ${statusLiteral}; data: ${typeName}; statusText: string }`\n })\n if (members.length === 1) return members[0]!\n return `(${members.join(' | ')})`\n}\n\nconst typeNamesByResolver = new WeakMap<OperationTypeNameResolver, Map<string, string[]>>()\n\nexport function resolveOperationTypeNames(\n node: ast.OperationNode,\n resolver: OperationTypeNameResolver,\n options: ResolveOperationTypeNameOptions = {},\n): string[] {\n const cacheKey = `${node.operationId}\\0${options.paramsCasing ?? ''}\\0${options.order ?? ''}\\0${options.responseStatusNames ?? ''}\\0${(options.exclude ?? []).join(',')}`\n let byResolver = typeNamesByResolver.get(resolver)\n if (byResolver) {\n const cached = byResolver.get(cacheKey)\n if (cached) return cached\n } else {\n byResolver = new Map()\n typeNamesByResolver.set(resolver, byResolver)\n }\n\n const { path, query, header } = getOperationParameters(node, { paramsCasing: options.paramsCasing })\n const responseStatusNames =\n options.responseStatusNames === 'error'\n ? resolveErrorNames(node, resolver)\n : options.responseStatusNames === false\n ? []\n : resolveStatusCodeNames(node, resolver)\n const exclude = new Set(options.exclude ?? [])\n const paramNames = [\n ...path.map((param) => resolver.resolvePathParamsName(node, param)),\n ...query.map((param) => resolver.resolveQueryParamsName(node, param)),\n ...header.map((param) => resolver.resolveHeaderParamsName(node, param)),\n ]\n const bodyAndResponseNames = [node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : null, resolver.resolveResponseName(node)]\n const names =\n options.order === 'body-response-first'\n ? [...bodyAndResponseNames, ...paramNames, ...responseStatusNames]\n : [...paramNames, ...bodyAndResponseNames, ...responseStatusNames]\n\n const result = names.filter((name): name is string => Boolean(name) && !exclude.has(name as string))\n byResolver.set(cacheKey, result)\n return result\n}\n\nexport function resolveResponseTypes(node: ast.OperationNode, resolver: ResponseNameResolver): Array<[statusCode: number | 'default', typeName: string]> {\n const types: Array<[number | 'default', string]> = []\n\n for (const response of node.responses) {\n if (response.statusCode === 'default') {\n types.push(['default', resolver.resolveResponseName(node)])\n continue\n }\n\n const code = getStatusCodeNumber(response.statusCode)\n if (code === null) {\n continue\n }\n\n types.push([code, isSuccessStatusCode(code) ? resolver.resolveResponseName(node) : resolver.resolveResponseStatusName(node, response.statusCode)])\n }\n\n return types\n}\n\nexport function findSuccessStatusCode(responses: Array<{ statusCode: ast.StatusCode | number | string }>): ast.StatusCode | null {\n for (const response of responses) {\n if (isSuccessStatusCode(response.statusCode)) {\n return response.statusCode as ast.StatusCode\n }\n }\n\n return null\n}\n","import { camelCase } from '@internals/utils'\nimport type { Group } from '@kubb/core'\n\n/**\n * Builds the `group` config a Kubb plugin passes to `ctx.setOptions`, applying the\n * shared default naming so every plugin groups output consistently:\n *\n * - `path` groups use the second path segment (`/pet/findByStatus` → `pet`).\n * - other groups use the camelCased group (`pet store` → `petStore`).\n *\n * A user-provided `group.name` always wins over the default namer, so callers stay in\n * control of their output folders. Returns `null` when grouping is disabled, matching the\n * per-plugin convention.\n *\n * @param group - The user-supplied group option, or `undefined` to disable grouping.\n *\n * @example\n * ```ts\n * createGroupConfig(group) // shared across every plugin\n * ```\n */\nexport function createGroupConfig(group: Group | undefined): Group | null {\n if (!group) {\n return null\n }\n\n const defaultName = (ctx: { group: string }): string => {\n if (group.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n\n return camelCase(ctx.group)\n }\n\n return {\n ...group,\n name: group.name ? group.name : defaultName,\n } satisfies Group\n}\n","export function buildParamsMapping<TParam extends { name: string }>(\n originalParams: ReadonlyArray<TParam>,\n mappedParams: ReadonlyArray<TParam>,\n): Record<string, string> | null {\n const mapping: Record<string, string> = {}\n let hasChanged = false\n\n originalParams.forEach((param, i) => {\n const mappedName = mappedParams[i]?.name ?? param.name\n mapping[param.name] = mappedName\n\n if (param.name !== mappedName) {\n hasChanged = true\n }\n })\n\n return hasChanged ? mapping : null\n}\n\nexport function buildTransformedParamsMapping<TParam extends { name: string }>(\n params: ReadonlyArray<TParam>,\n transformName: (name: string) => string,\n): Record<string, string> | null {\n if (!params.length) {\n return null\n }\n\n return buildParamsMapping(\n params,\n params.map((param) => ({ ...param, name: transformName(param.name) })),\n )\n}\n","import { ast } from '@kubb/core'\nimport { functionPrinter } from '@kubb/plugin-ts'\n\ntype ParamLeaf = {\n type?: string\n optional?: boolean\n default?: string\n value?: string\n mode?: 'inlineSpread'\n}\n\ntype ParamGroup = {\n mode: 'object' | 'inlineSpread'\n children: Record<string, ParamLeaf | null | undefined>\n default?: string\n}\n\ntype ParamSpec = ParamLeaf | ParamGroup\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\nconst callPrinter = functionPrinter({ mode: 'call' })\n\nfunction isGroup(spec: ParamSpec): spec is ParamGroup {\n return 'children' in spec\n}\n\nfunction groupEntries(group: ParamGroup): Array<[string, ParamLeaf]> {\n return Object.entries(group.children).filter(([, child]) => child != null) as Array<[string, ParamLeaf]>\n}\n\n/**\n * Assembles a destructured group parameter from a binding pattern and an optional\n * type literal. Built directly because `createFunctionParameter({ properties })`\n * requires every member to carry a type, while these groups also hold untyped,\n * value-only call entries.\n */\nfunction createGroupParam(\n elements: Array<{ name: string }>,\n members: Array<{ name: string; type: string; optional?: boolean }>,\n default_?: string,\n): ast.FunctionParameterNode {\n return {\n kind: 'FunctionParameter',\n name: ast.factory.createObjectBindingPattern({ elements }),\n type: members.length ? ast.factory.createTypeLiteral({ members }) : undefined,\n default: default_,\n optional: false,\n }\n}\n\nfunction createDeclarationLeaf(name: string, spec: ParamLeaf): ast.FunctionParameterNode {\n if (spec.default !== undefined) {\n return ast.factory.createFunctionParameter({ name, type: spec.type, default: spec.default, rest: spec.mode === 'inlineSpread' })\n }\n\n return ast.factory.createFunctionParameter({ name, type: spec.type, optional: !!spec.optional, rest: spec.mode === 'inlineSpread' })\n}\n\nfunction createDeclarationParam(name: string, spec: ParamSpec): ast.FunctionParameterNode {\n if (isGroup(spec)) {\n const entries = groupEntries(spec)\n const elements = entries.map(([childName]) => ({ name: childName }))\n const members = entries\n .filter(([, child]) => child.type)\n .map(([childName, child]) => ({ name: childName, type: child.type!, optional: !!child.optional || child.default !== undefined }))\n return createGroupParam(elements, members, spec.default)\n }\n\n return createDeclarationLeaf(name, spec)\n}\n\nfunction createCallParam(name: string, spec: ParamSpec): ast.FunctionParameterNode {\n if (isGroup(spec)) {\n const elements = groupEntries(spec).map(([childName, child]) => ({\n name:\n child.mode === 'inlineSpread'\n ? spec.mode === 'inlineSpread'\n ? (child.value ?? childName)\n : `...${child.value ?? childName}`\n : child.value\n ? `${childName}: ${child.value}`\n : childName,\n }))\n return createGroupParam(elements, [])\n }\n\n return ast.factory.createFunctionParameter({ name: spec.value ?? name, rest: spec.mode === 'inlineSpread' })\n}\n\n/**\n * Creates function parameter builders for generating function signatures and calls.\n * Returns utilities to output constructor signatures (`toConstructor()`) or call expressions (`toCall()`).\n */\nexport function createFunctionParams(params: Record<string, ParamSpec | null | undefined>) {\n const entries = Object.entries(params).filter(([, spec]) => spec != null) as Array<[string, ParamSpec]>\n\n return {\n toConstructor() {\n return (\n declarationPrinter.print(\n ast.factory.createFunctionParameters({\n params: entries.map(([name, spec]) => createDeclarationParam(name, spec)),\n }),\n ) ?? ''\n )\n },\n toCall() {\n return (\n callPrinter.print(\n ast.factory.createFunctionParameters({\n params: entries.map(([name, spec]) => createCallParam(name, spec)),\n }),\n ) ?? ''\n )\n },\n }\n}\n","import { buildStatusUnionType, getOperationParameters, getResponseType, resolveSuccessNames } from '@internals/shared'\nimport { ast } from '@kubb/core'\nimport type { ResolverTs } from '@kubb/plugin-ts'\nimport type { ResolverZod } from '@kubb/plugin-zod'\nimport { createFunctionParams } from './functionParams.ts'\nimport type { PluginClient } from './types.ts'\n\ntype ParserOption = PluginClient['resolvedOptions']['parser']\n\n/**\n * Returns `true` when any direction of the parser uses Zod (used for dependency checks).\n */\nexport function isParserEnabled(parser: ParserOption | undefined | false): boolean {\n if (!parser) return false\n if (parser === 'zod') return true\n return !!(parser.request || parser.response)\n}\n\n/**\n * Returns `'zod'` when request body parsing is enabled, `null` otherwise.\n * The string shorthand `'zod'` also enables request body parsing (existing behavior).\n */\nexport function resolveRequestParser(parser: ParserOption | undefined | false): 'zod' | null {\n if (!parser) return null\n if (parser === 'zod') return 'zod'\n return parser.request ?? null\n}\n\n/**\n * Returns `'zod'` when query-parameters parsing is enabled, `null` otherwise.\n * Only the object form `{ request: 'zod' }` enables query-params parsing.\n * The string shorthand `'zod'` does not, preserving its existing behavior.\n */\nexport function resolveQueryParamsParser(parser: ParserOption | undefined | false): 'zod' | null {\n if (!parser || parser === 'zod') return null\n return parser.request ?? null\n}\n\n/**\n * Returns `'zod'` when response-direction parsing is enabled, `null` otherwise.\n * `parser: 'zod'` (string shorthand) maps to response parsing and returns `'zod'`.\n */\nexport function resolveResponseParser(parser: ParserOption | undefined | false): 'zod' | null {\n if (!parser) return null\n if (parser === 'zod') return 'zod'\n return parser.response ?? null\n}\n\nexport { buildStatusUnionType }\n\n/**\n * Builds HTTP headers array for a client request.\n * Includes Content-Type (if not default) and spreads header parameters if present.\n */\nexport function buildHeaders(contentType: string, hasHeaderParams: boolean): Array<string> {\n return [\n contentType !== 'application/json' && contentType !== 'multipart/form-data' ? `'Content-Type': '${contentType}'` : null,\n hasHeaderParams ? '...headers' : null,\n ].filter(Boolean) as Array<string>\n}\n\n/**\n * Returns the generic type arguments — response, error, and request body — for a generated\n * client call.\n *\n * When `dataReturnType` is `'full'`, the response generic widens to a union of all documented\n * status types. When `parser` is `'zod'` and a request body schema exists, the request type\n * uses `z.output<typeof schema>` to reflect post-transform types (e.g. date coercion).\n */\nexport function buildGenerics(\n node: ast.OperationNode,\n tsResolver: ResolverTs,\n options: {\n dataReturnType?: PluginClient['resolvedOptions']['dataReturnType']\n zodResolver?: ResolverZod | null\n parser?: PluginClient['resolvedOptions']['parser']\n } = {},\n): Array<string> {\n const allStatusNames = node.responses.map((r) => tsResolver.resolveResponseStatusName(node, r.statusCode))\n const successNames = resolveSuccessNames(node, tsResolver)\n const responseName =\n options.dataReturnType === 'full'\n ? allStatusNames.length > 0\n ? allStatusNames.join(' | ')\n : tsResolver.resolveResponseName(node)\n : successNames.length > 0\n ? successNames.join(' | ')\n : tsResolver.resolveResponseName(node)\n const requestName = node.requestBody?.content?.[0]?.schema ? tsResolver.resolveDataName(node) : null\n const errorNames = node.responses.filter((r) => Number.parseInt(r.statusCode, 10) >= 400).map((r) => tsResolver.resolveResponseStatusName(node, r.statusCode))\n const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(' | ') : 'Error'}>`\n\n const zodRequestName =\n options.parser === 'zod' && options.zodResolver && node.requestBody?.content?.[0]?.schema ? (options.zodResolver.resolveDataName?.(node) ?? null) : null\n\n const requestGenericType = zodRequestName ? `z.output<typeof ${zodRequestName}>` : requestName || 'unknown'\n\n return [responseName, TError, requestGenericType].filter(Boolean)\n}\n\n/**\n * Builds the parameters object for a class-based client method.\n * Includes URL, method, base URL, headers, and request/response data.\n */\nexport function buildClassClientParams({\n node,\n url,\n baseURL,\n tsResolver,\n isFormData,\n isMultipleContentTypes,\n hasFormData,\n headers,\n zodQueryParamsName,\n}: {\n node: ast.OperationNode\n url: string\n baseURL: string | null | undefined\n tsResolver: ResolverTs\n isFormData: boolean\n isMultipleContentTypes: boolean\n hasFormData: boolean\n headers: Array<string>\n zodQueryParamsName?: string | null\n}) {\n const { query: queryParams } = getOperationParameters(node)\n const queryParamsName = queryParams.length > 0 ? tsResolver.resolveQueryParamsName(node, queryParams[0]!) : null\n const requestName = node.requestBody?.content?.[0]?.schema ? tsResolver.resolveDataName(node) : null\n const responseType = getResponseType(node)\n\n return createFunctionParams({\n config: {\n mode: 'object',\n children: {\n requestConfig: {\n mode: 'inlineSpread',\n },\n method: {\n value: JSON.stringify(ast.isHttpOperationNode(node) ? node.method.toUpperCase() : ''),\n },\n url: {\n value: url,\n },\n baseURL: baseURL\n ? {\n value: JSON.stringify(baseURL),\n }\n : null,\n params: queryParamsName ? (zodQueryParamsName ? { value: 'requestParams' } : {}) : null,\n data: requestName\n ? {\n value:\n isMultipleContentTypes && hasFormData\n ? \"contentType === 'multipart/form-data' ? formData as FormData : requestData\"\n : isFormData\n ? 'formData as FormData'\n : 'requestData',\n }\n : null,\n contentType: isMultipleContentTypes ? {} : null,\n responseType: responseType ? { value: JSON.stringify(responseType) } : null,\n headers: headers.length\n ? {\n value: `{ ${headers.join(', ')}, ...requestConfig.headers }`,\n }\n : null,\n },\n },\n })\n}\n\n/**\n * Builds the request data parsing line for client methods.\n * Applies Zod validation when `parser.request === 'zod'`, otherwise assigns data directly.\n */\nexport function buildRequestDataLine({\n parser,\n node,\n zodResolver,\n}: {\n parser: PluginClient['resolvedOptions']['parser'] | undefined\n node: ast.OperationNode\n zodResolver?: ResolverZod | null\n}): string {\n const requestParser = resolveRequestParser(parser)\n const zodRequestName = zodResolver && requestParser === 'zod' && node.requestBody?.content?.[0]?.schema ? zodResolver.resolveDataName?.(node) : null\n if (requestParser === 'zod' && zodRequestName) {\n return `const requestData = ${zodRequestName}.parse(data)`\n }\n if (node.requestBody?.content?.[0]?.schema) {\n return 'const requestData = data'\n }\n return ''\n}\n\n/**\n * Builds the query parameters parsing line for client methods.\n * Returns an empty string when no query params exist or query-params parsing is not enabled.\n * Only the object form `parser: { request: 'zod' }` triggers this. `parser: 'zod'` does not.\n */\nexport function buildQueryParamsLine({\n parser,\n node,\n zodResolver,\n}: {\n parser: PluginClient['resolvedOptions']['parser'] | undefined\n node: ast.OperationNode\n zodResolver?: ResolverZod | null\n}): string {\n if (resolveQueryParamsParser(parser) !== 'zod' || !zodResolver) return ''\n const { query: queryParams } = getOperationParameters(node)\n if (queryParams.length === 0) return ''\n const zodQueryParamsName = zodResolver.resolveQueryParamsName?.(node, queryParams[0]!)\n if (!zodQueryParamsName) return ''\n return `const requestParams = ${zodQueryParamsName}.parse(params)`\n}\n\n/**\n * Builds the form data conversion line for file upload requests.\n * Returns empty string if not applicable.\n */\nexport function buildFormDataLine(isFormData: boolean, hasRequest: boolean): string {\n return isFormData && hasRequest ? 'const formData = buildFormData(requestData)' : ''\n}\n\n/**\n * Builds the return statement for a client method.\n * When `dataReturnType` is `'full'`, casts the response to the status-discriminated union type.\n * When `parser.response` is `'zod'`, pipes the response body through the Zod schema before returning.\n */\nexport function buildReturnStatement({\n dataReturnType,\n parser,\n node,\n zodResolver,\n tsResolver,\n}: {\n dataReturnType: PluginClient['resolvedOptions']['dataReturnType']\n parser: PluginClient['resolvedOptions']['parser'] | undefined\n node: ast.OperationNode\n zodResolver?: ResolverZod | null\n tsResolver?: ResolverTs | null\n}): string {\n const responseParser = resolveResponseParser(parser)\n const zodResponseName = zodResolver && responseParser === 'zod' ? zodResolver.resolveResponseName?.(node) : null\n\n if (dataReturnType === 'full' && tsResolver) {\n const unionType = buildStatusUnionType(node, tsResolver)\n if (responseParser === 'zod' && zodResponseName) {\n return `return {...res, data: ${zodResponseName}.parse(res.data)} as ${unionType}`\n }\n return `return res as ${unionType}`\n }\n\n if (dataReturnType === 'data' && responseParser === 'zod' && zodResponseName) {\n return `return ${zodResponseName}.parse(res.data)`\n }\n return 'return res.data'\n}\n","import { buildParamsMapping, getOperationParameters } from '@internals/shared'\nimport { isValidVarName, Url as UrlHelper } from '@internals/utils'\nimport { createOperationParams } from '@kubb/ast/utils'\nimport { ast } from '@kubb/core'\nimport type { ResolverTs } from '@kubb/plugin-ts'\nimport { functionPrinter } from '@kubb/plugin-ts'\nimport { Const, File, Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport type { PluginClient } from '../types.ts'\n\ntype Props = {\n name: string\n isExportable?: boolean\n isIndexable?: boolean\n\n baseURL: string | null | undefined\n paramsCasing: PluginClient['resolvedOptions']['paramsCasing']\n paramsType: PluginClient['resolvedOptions']['pathParamsType']\n pathParamsType: PluginClient['resolvedOptions']['pathParamsType']\n node: ast.OperationNode\n tsResolver: ResolverTs\n}\n\ntype GetParamsProps = {\n paramsCasing: PluginClient['resolvedOptions']['paramsCasing']\n paramsType: PluginClient['resolvedOptions']['paramsType']\n pathParamsType: PluginClient['resolvedOptions']['pathParamsType']\n node: ast.OperationNode\n tsResolver: ResolverTs\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\n\nexport function buildUrlParamsNode({ paramsType, paramsCasing, pathParamsType, node, tsResolver }: GetParamsProps): ast.FunctionParametersNode {\n // Build a URL-only node with only path params (no body, query, header)\n const urlNode: ast.OperationNode = {\n ...node,\n parameters: node.parameters.filter((p) => p.in === 'path'),\n requestBody: undefined,\n }\n\n return createOperationParams(urlNode, {\n paramsType: paramsType === 'object' ? 'object' : 'inline',\n pathParamsType: paramsType === 'object' ? 'object' : pathParamsType === 'object' ? 'object' : 'inline',\n paramsCasing,\n resolver: tsResolver,\n })\n}\n\nexport function Url({\n name,\n isExportable = true,\n isIndexable = true,\n baseURL,\n paramsType,\n paramsCasing,\n pathParamsType,\n node,\n tsResolver,\n}: Props): KubbReactNode {\n if (!ast.isHttpOperationNode(node)) return null\n\n const paramsNode = buildUrlParamsNode({\n paramsType,\n paramsCasing,\n pathParamsType,\n node,\n tsResolver,\n })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n\n const { path: originalPathParams } = getOperationParameters(node)\n const { path: casedPathParams } = getOperationParameters(node, { paramsCasing })\n const pathParamsMapping = paramsCasing ? buildParamsMapping(originalPathParams, casedPathParams) : null\n\n return (\n <File.Source name={name} isExportable={isExportable} isIndexable={isIndexable}>\n <Function name={name} export={isExportable} params={paramsSignature}>\n {pathParamsMapping &&\n Object.entries(pathParamsMapping)\n .filter(([originalName, camelCaseName]) => isValidVarName(originalName) && originalName !== camelCaseName)\n .map(([originalName, camelCaseName]) => `const ${originalName} = ${camelCaseName}`)\n .join('\\n')}\n {pathParamsMapping && Object.keys(pathParamsMapping).length > 0 && <br />}\n <Const name={'res'}>{`{ method: '${node.method.toUpperCase()}', url: ${UrlHelper.toTemplateString(node.path, { prefix: baseURL })} as const }`}</Const>\n <br />\n return res\n </Function>\n </File.Source>\n )\n}\n","import {\n buildOperationComments,\n buildParamsMapping,\n buildRequestConfigType,\n getContentTypeInfo,\n getOperationParameters,\n getResponseType,\n resolveSuccessNames,\n} from '@internals/shared'\nimport { isValidVarName, Url } from '@internals/utils'\nimport { createOperationParams, stringify } from '@kubb/ast/utils'\nimport { ast } from '@kubb/core'\nimport type { ResolverTs } from '@kubb/plugin-ts'\nimport { functionPrinter } from '@kubb/plugin-ts'\nimport type { ResolverZod } from '@kubb/plugin-zod'\nimport { File, Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport { createFunctionParams } from '../functionParams.ts'\nimport type { PluginClient } from '../types.ts'\nimport { buildStatusUnionType, resolveQueryParamsParser, resolveRequestParser, resolveResponseParser } from '../utils.ts'\nimport { buildUrlParamsNode } from './Url.tsx'\n\ntype Props = {\n name: string\n urlName?: string\n isExportable?: boolean\n isIndexable?: boolean\n isConfigurable?: boolean\n returnType?: string\n\n baseURL: string | null | undefined\n dataReturnType: PluginClient['resolvedOptions']['dataReturnType']\n paramsCasing: PluginClient['resolvedOptions']['paramsCasing']\n paramsType: PluginClient['resolvedOptions']['pathParamsType']\n pathParamsType: PluginClient['resolvedOptions']['pathParamsType']\n parser: PluginClient['resolvedOptions']['parser'] | undefined\n node: ast.OperationNode\n tsResolver: ResolverTs\n zodResolver?: ResolverZod | null\n children?: KubbReactNode\n}\n\ntype GetParamsProps = {\n paramsCasing: PluginClient['resolvedOptions']['paramsCasing']\n paramsType: PluginClient['resolvedOptions']['paramsType']\n pathParamsType: PluginClient['resolvedOptions']['pathParamsType']\n node: ast.OperationNode\n tsResolver: ResolverTs\n isConfigurable: boolean\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\n\nexport function buildClientParamsNode({\n paramsType,\n paramsCasing,\n pathParamsType,\n node,\n tsResolver,\n isConfigurable,\n}: GetParamsProps): ast.FunctionParametersNode {\n return createOperationParams(node, {\n paramsType,\n pathParamsType: paramsType === 'object' ? 'object' : pathParamsType === 'object' ? 'object' : 'inline',\n paramsCasing,\n resolver: tsResolver,\n extraParams: [\n ...(isConfigurable\n ? [\n ast.factory.createFunctionParameter({\n name: 'config',\n type: buildRequestConfigType(node, tsResolver),\n default: '{}',\n }),\n ]\n : []),\n ],\n })\n}\n\nexport function Client({\n name,\n isExportable = true,\n isIndexable = true,\n returnType,\n baseURL,\n dataReturnType,\n parser,\n paramsType,\n paramsCasing,\n pathParamsType,\n node,\n tsResolver,\n zodResolver,\n urlName,\n children,\n isConfigurable = true,\n}: Props): KubbReactNode {\n if (!ast.isHttpOperationNode(node)) return null\n const { defaultContentType: contentType, isMultipleContentTypes, hasFormData } = getContentTypeInfo(node)\n const isFormData = !isMultipleContentTypes && contentType === 'multipart/form-data'\n const responseType = getResponseType(node)\n\n const { path: originalPathParams, query: originalQueryParams, header: originalHeaderParams } = getOperationParameters(node)\n const { path: casedPathParams, query: casedQueryParams, header: casedHeaderParams } = getOperationParameters(node, { paramsCasing })\n\n const pathParamsMapping = paramsCasing && !urlName ? buildParamsMapping(originalPathParams, casedPathParams) : null\n const queryParamsMapping = paramsCasing ? buildParamsMapping(originalQueryParams, casedQueryParams) : null\n const headerParamsMapping = paramsCasing ? buildParamsMapping(originalHeaderParams, casedHeaderParams) : null\n\n const requestName = node.requestBody?.content?.[0]?.schema ? tsResolver.resolveDataName(node) : null\n const successNames = resolveSuccessNames(node, tsResolver)\n const responseName = successNames.length > 0 ? successNames.join(' | ') : tsResolver.resolveResponseName(node)\n const queryParamsName = originalQueryParams.length > 0 ? tsResolver.resolveQueryParamsName(node, originalQueryParams[0]!) : null\n const headerParamsName = originalHeaderParams.length > 0 ? tsResolver.resolveHeaderParamsName(node, originalHeaderParams[0]!) : null\n\n const requestParser = resolveRequestParser(parser)\n const responseParser = resolveResponseParser(parser)\n const zodResponseName = zodResolver && responseParser === 'zod' ? zodResolver.resolveResponseName?.(node) : null\n const zodRequestName = zodResolver && requestParser === 'zod' && node.requestBody?.content?.[0]?.schema ? zodResolver.resolveDataName?.(node) : null\n const queryParamsParser = resolveQueryParamsParser(parser)\n const zodQueryParamsName =\n zodResolver && queryParamsParser === 'zod' && originalQueryParams.length > 0 ? zodResolver.resolveQueryParamsName?.(node, originalQueryParams[0]!) : null\n\n const errorNames = node.responses\n .filter((r) => {\n const code = Number.parseInt(r.statusCode, 10)\n return code >= 400\n })\n .map((r) => tsResolver.resolveResponseStatusName(node, r.statusCode))\n\n const headers = [\n !isMultipleContentTypes && contentType !== 'application/json' && contentType !== 'multipart/form-data' ? `'Content-Type': '${contentType}'` : null,\n headerParamsName ? (headerParamsMapping ? '...mappedHeaders' : '...headers') : null,\n ].filter(Boolean)\n\n const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(' | ') : 'Error'}>`\n\n const allStatusNames = node.responses.map((r) => tsResolver.resolveResponseStatusName(node, r.statusCode))\n const genericsResponseName = dataReturnType === 'full' ? (allStatusNames.length > 0 ? allStatusNames.join(' | ') : responseName) : responseName\n // z.output<> reflects the post-transform type (e.g. date coercion turns Date → string), avoiding a compile error on the generated call\n const requestGenericType = parser === 'zod' && zodRequestName ? `z.output<typeof ${zodRequestName}>` : requestName || 'unknown'\n const generics = [genericsResponseName, TError, requestGenericType].filter(Boolean)\n const paramsNode = buildClientParamsNode({\n paramsType,\n paramsCasing,\n pathParamsType,\n node,\n tsResolver,\n isConfigurable,\n })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n\n const urlParamsNode = buildUrlParamsNode({\n paramsType,\n paramsCasing,\n pathParamsType,\n node,\n tsResolver,\n })\n const callPrinter = functionPrinter({ mode: 'call' })\n const urlParamsCall = callPrinter.print(urlParamsNode) ?? ''\n\n const clientParams = createFunctionParams({\n config: {\n mode: 'object',\n children: {\n method: {\n value: stringify(node.method.toUpperCase()),\n },\n url: {\n value: urlName ? `${urlName}(${urlParamsCall}).url.toString()` : Url.toTemplateString(node.path),\n },\n baseURL:\n baseURL && !urlName\n ? {\n value: `\\`${baseURL}\\``,\n }\n : null,\n params: queryParamsName ? (zodQueryParamsName ? { value: 'requestParams' } : queryParamsMapping ? { value: 'mappedParams' } : {}) : null,\n data: requestName\n ? {\n value:\n isMultipleContentTypes && hasFormData\n ? \"contentType === 'multipart/form-data' ? formData as FormData : requestData\"\n : isFormData\n ? 'formData as FormData'\n : 'requestData',\n }\n : null,\n contentType: isConfigurable && isMultipleContentTypes ? {} : null,\n responseType: responseType ? { value: stringify(responseType) } : null,\n requestConfig: isConfigurable\n ? {\n mode: 'inlineSpread',\n }\n : null,\n headers: headers.length\n ? {\n value: isConfigurable ? `{ ${headers.join(', ')}, ...requestConfig.headers }` : `{ ${headers.join(', ')} }`,\n }\n : null,\n },\n },\n })\n\n const statusUnionType = dataReturnType === 'full' ? buildStatusUnionType(node, tsResolver) : null\n\n const childrenElement = children ? (\n children\n ) : (\n <>\n {dataReturnType === 'full' &&\n responseParser === 'zod' &&\n zodResponseName &&\n statusUnionType &&\n `return {...res, data: ${zodResponseName}.parse(res.data)} as ${statusUnionType}`}\n {dataReturnType === 'full' && responseParser !== 'zod' && statusUnionType && `return res as ${statusUnionType}`}\n {dataReturnType === 'data' && responseParser === 'zod' && zodResponseName && `return ${zodResponseName}.parse(res.data)`}\n {dataReturnType === 'data' && responseParser !== 'zod' && 'return res.data'}\n </>\n )\n\n return (\n <>\n <br />\n\n <File.Source name={name} isExportable={isExportable} isIndexable={isIndexable}>\n <Function\n name={name}\n async\n export={isExportable}\n params={paramsSignature}\n JSDoc={{\n comments: buildOperationComments(node, { link: 'urlPath', linkPosition: 'beforeDeprecated', splitLines: true }),\n }}\n returnType={returnType}\n >\n {isConfigurable\n ? `const { client: request = client, ${isMultipleContentTypes ? `contentType = ${stringify(contentType)}, ` : ''}...requestConfig } = config`\n : ''}\n <br />\n {pathParamsMapping &&\n Object.entries(pathParamsMapping)\n .filter(([originalName, camelCaseName]) => isValidVarName(originalName) && originalName !== camelCaseName)\n .map(([originalName, camelCaseName]) => `const ${originalName} = ${camelCaseName}`)\n .join('\\n')}\n {pathParamsMapping && <br />}\n {queryParamsMapping && queryParamsName && (\n <>\n {`const mappedParams = params ? { ${Object.entries(queryParamsMapping)\n .map(([originalName, camelCaseName]) => `\"${originalName}\": params.${camelCaseName}`)\n .join(', ')} } : undefined`}\n <br />\n </>\n )}\n {headerParamsMapping && headerParamsName && (\n <>\n {`const mappedHeaders = headers ? { ${Object.entries(headerParamsMapping)\n .map(([originalName, camelCaseName]) => `\"${originalName}\": headers.${camelCaseName}`)\n .join(', ')} } : undefined`}\n <br />\n </>\n )}\n {requestParser === 'zod' && zodRequestName ? `const requestData = ${zodRequestName}.parse(data)` : requestName && 'const requestData = data'}\n {zodQueryParamsName && `const requestParams = ${zodQueryParamsName}.parse(params)`}\n {(isFormData || (isMultipleContentTypes && hasFormData)) && requestName && 'const formData = buildFormData(requestData)'}\n <br />\n {isConfigurable\n ? `const res = await request<${generics.join(', ')}>(${clientParams.toCall()})`\n : `const res = await client<${generics.join(', ')}>(${clientParams.toCall()})`}\n <br />\n {childrenElement}\n </Function>\n </File.Source>\n </>\n )\n}\n","import { buildOperationComments, getContentTypeInfo, getOperationParameters } from '@internals/shared'\nimport { Url } from '@internals/utils'\nimport { buildJSDoc, stringify } from '@kubb/ast/utils'\nimport { ast } from '@kubb/core'\nimport type { ResolverTs } from '@kubb/plugin-ts'\nimport { functionPrinter } from '@kubb/plugin-ts'\nimport type { ResolverZod } from '@kubb/plugin-zod'\nimport { File } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport type { PluginClient } from '../types.ts'\nimport {\n buildClassClientParams,\n buildFormDataLine,\n buildGenerics,\n buildHeaders,\n buildQueryParamsLine,\n buildRequestDataLine,\n buildReturnStatement,\n resolveQueryParamsParser,\n} from '../utils.ts'\nimport { buildClientParamsNode } from './Client.tsx'\n\ntype OperationData = {\n node: ast.OperationNode\n name: string\n tsResolver: ResolverTs\n zodResolver?: ResolverZod | null\n}\n\ntype Props = {\n name: string\n isExportable?: boolean\n isIndexable?: boolean\n operations: Array<OperationData>\n baseURL: string | null | undefined\n dataReturnType: PluginClient['resolvedOptions']['dataReturnType']\n paramsCasing: PluginClient['resolvedOptions']['paramsCasing']\n paramsType: PluginClient['resolvedOptions']['pathParamsType']\n pathParamsType: PluginClient['resolvedOptions']['pathParamsType']\n parser: PluginClient['resolvedOptions']['parser'] | undefined\n children?: KubbReactNode\n}\n\ntype GenerateMethodProps = {\n node: ast.OperationNode\n name: string\n tsResolver: ResolverTs\n zodResolver?: ResolverZod | null\n baseURL: string | null | undefined\n dataReturnType: PluginClient['resolvedOptions']['dataReturnType']\n parser: PluginClient['resolvedOptions']['parser'] | undefined\n paramsType: PluginClient['resolvedOptions']['paramsType']\n paramsCasing: PluginClient['resolvedOptions']['paramsCasing']\n pathParamsType: PluginClient['resolvedOptions']['pathParamsType']\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\n\nfunction generateMethod({\n node,\n name,\n tsResolver,\n zodResolver,\n baseURL,\n dataReturnType,\n parser,\n paramsType,\n paramsCasing,\n pathParamsType,\n}: GenerateMethodProps): string {\n if (!ast.isHttpOperationNode(node)) return ''\n const { defaultContentType: contentType, isMultipleContentTypes, hasFormData } = getContentTypeInfo(node)\n const isFormData = !isMultipleContentTypes && contentType === 'multipart/form-data'\n const { header: headerParams } = getOperationParameters(node)\n const headerParamsName = headerParams.length > 0 ? tsResolver.resolveHeaderParamsName(node, headerParams[0]!) : null\n const headers = isMultipleContentTypes ? (headerParamsName ? ['...headers'] : []) : buildHeaders(contentType, !!headerParamsName)\n const generics = buildGenerics(node, tsResolver, { dataReturnType, zodResolver, parser })\n const paramsNode = buildClientParamsNode({ paramsType, paramsCasing, pathParamsType, node, tsResolver, isConfigurable: true })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n const { query: queryParams } = getOperationParameters(node)\n const zodQueryParamsName =\n zodResolver && resolveQueryParamsParser(parser) === 'zod' && queryParams.length > 0 ? zodResolver.resolveQueryParamsName?.(node, queryParams[0]!) : null\n const clientParams = buildClassClientParams({\n node,\n url: Url.toTemplateString(node.path, { casing: paramsCasing }),\n baseURL,\n tsResolver,\n isFormData,\n isMultipleContentTypes,\n hasFormData,\n headers,\n zodQueryParamsName,\n })\n const jsdoc = buildJSDoc(buildOperationComments(node, { link: 'urlPath', linkPosition: 'beforeDeprecated', splitLines: true }))\n\n const requestDataLine = buildRequestDataLine({ parser, node, zodResolver })\n const queryParamsLine = buildQueryParamsLine({ parser, node, zodResolver })\n const formDataLine = buildFormDataLine(isFormData || (isMultipleContentTypes && hasFormData), !!node.requestBody?.content?.[0]?.schema)\n const returnStatement = buildReturnStatement({ dataReturnType, parser, node, zodResolver, tsResolver })\n\n const methodBody = [\n `const { client: request = client, ${isMultipleContentTypes ? `contentType = ${stringify(contentType)}, ` : ''}...requestConfig } = mergeConfig(this.#config, config)`,\n '',\n requestDataLine,\n queryParamsLine,\n formDataLine,\n `const res = await request<${generics.join(', ')}>(${clientParams.toCall()})`,\n returnStatement,\n ]\n .filter(Boolean)\n .map((line) => ` ${line}`)\n .join('\\n')\n\n return `${jsdoc}async ${name}(${paramsSignature}) {\\n${methodBody}\\n }`\n}\n\nexport function ClassClient({\n name,\n isExportable = true,\n isIndexable = true,\n operations,\n baseURL,\n dataReturnType,\n parser,\n paramsType,\n paramsCasing,\n pathParamsType,\n children,\n}: Props): KubbReactNode {\n const methods = operations.map(({ node, name: methodName, tsResolver, zodResolver }) =>\n generateMethod({\n node,\n name: methodName,\n tsResolver,\n zodResolver,\n baseURL,\n dataReturnType,\n parser,\n paramsType,\n paramsCasing,\n pathParamsType,\n }),\n )\n\n const classCode = `export class ${name} {\n #config: Partial<RequestConfig> & { client?: Client }\n\n constructor(config: Partial<RequestConfig> & { client?: Client } = {}) {\n this.#config = config\n }\n\n${methods.join('\\n\\n')}\n}`\n\n return (\n <File.Source name={name} isExportable={isExportable} isIndexable={isIndexable}>\n {classCode}\n {children}\n </File.Source>\n )\n}\n","import { File } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\n\ntype ClientController = {\n className: string\n propertyName: string\n}\n\ntype Props = {\n name: string\n controllers: Array<ClientController>\n isExportable?: boolean\n isIndexable?: boolean\n}\n\nexport function WrapperClient({ name, controllers, isExportable = true, isIndexable = true }: Props): KubbReactNode {\n const properties = controllers.map(({ className, propertyName }) => ` readonly ${propertyName}: ${className}`).join('\\n')\n const assignments = controllers.map(({ className, propertyName }) => ` this.${propertyName} = new ${className}(config)`).join('\\n')\n\n const classCode = `export class ${name} {\n${properties}\n\n constructor(config: Partial<RequestConfig> & { client?: Client } = {}) {\n${assignments}\n }\n}`\n\n return (\n <File.Source name={name} isExportable={isExportable} isIndexable={isIndexable}>\n {classCode}\n </File.Source>\n )\n}\n","import path from 'node:path'\nimport { getOperationParameters, operationFileEntry, resolveOperationTypeNames } from '@internals/shared'\nimport { camelCase } from '@internals/utils'\nimport { ast, defineGenerator } from '@kubb/core'\nimport type { ResolverTs } from '@kubb/plugin-ts'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport type { ResolverZod } from '@kubb/plugin-zod'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, jsxRenderer } from '@kubb/renderer-jsx'\nimport { ClassClient } from '../components/ClassClient'\nimport { WrapperClient } from '../components/WrapperClient'\nimport type { PluginClient } from '../types'\nimport { isParserEnabled, resolveQueryParamsParser, resolveRequestParser, resolveResponseParser } from '../utils.ts'\n\ntype OperationData = {\n node: ast.OperationNode\n name: string\n tsResolver: ResolverTs\n zodResolver: ResolverZod | null\n typeFile: ast.FileNode\n zodFile: ast.FileNode | null\n}\n\ntype Controller = {\n name: string\n propertyName: string\n file: ast.FileNode\n operations: Array<OperationData>\n}\n\nfunction resolveTypeImportNames(node: ast.OperationNode, tsResolver: ResolverTs): Array<string> {\n return resolveOperationTypeNames(node, tsResolver, { order: 'body-response-first' })\n}\n\nfunction resolveZodImportNames(node: ast.OperationNode, zodResolver: ResolverZod, parser: PluginClient['resolvedOptions']['parser']): Array<string> {\n const { query: queryParams } = getOperationParameters(node)\n const names: Array<string | null | undefined> = [\n resolveResponseParser(parser) === 'zod' ? zodResolver.resolveResponseName?.(node) : null,\n resolveRequestParser(parser) === 'zod' && node.requestBody?.content?.[0]?.schema ? zodResolver.resolveDataName?.(node) : null,\n resolveQueryParamsParser(parser) === 'zod' && queryParams.length > 0 ? zodResolver.resolveQueryParamsName?.(node, queryParams[0]!) : null,\n ]\n return names.filter((n): n is string => Boolean(n))\n}\n\n/**\n * Built-in `operations` generator for `@kubb/plugin-client` when\n * `clientType: 'class'`. Emits one class per tag, with one instance method\n * per operation and a shared constructor for request configuration.\n */\nexport const classClientGenerator = defineGenerator<PluginClient>({\n name: 'classClient',\n renderer: jsxRenderer,\n operations(nodes, ctx) {\n const { config, driver, resolver, root } = ctx\n const { output, group, dataReturnType, paramsCasing, paramsType, pathParamsType, parser, importPath, sdk } = ctx.options\n const baseURL = ctx.options.baseURL ?? ctx.meta.baseURL\n\n const pluginTs = driver.getPlugin(pluginTsName)\n if (!pluginTs) return null\n\n const tsResolver = driver.getResolver(pluginTsName)\n const tsPluginOptions = pluginTs.options\n const pluginZod = isParserEnabled(parser) ? driver.getPlugin(pluginZodName) : null\n const zodResolver = pluginZod ? driver.getResolver(pluginZodName) : null\n\n function buildOperationData(node: ast.OperationNode): OperationData {\n const typeFile = tsResolver.resolveFile(operationFileEntry(node, node.operationId), {\n root,\n output: tsPluginOptions?.output ?? output,\n group: tsPluginOptions?.group,\n })\n const zodFile =\n zodResolver && pluginZod?.options\n ? zodResolver.resolveFile(operationFileEntry(node, node.operationId), {\n root,\n output: pluginZod.options?.output ?? output,\n group: pluginZod.options?.group ?? undefined,\n })\n : null\n\n return {\n node: node,\n name: resolver.resolveName(node.operationId),\n tsResolver,\n zodResolver,\n typeFile,\n zodFile,\n }\n }\n\n const controllers = nodes.reduce((acc, operationNode) => {\n if (!ast.isHttpOperationNode(operationNode)) return acc\n const tag = operationNode.tags[0]\n const groupName = tag ? (group?.name?.({ group: camelCase(tag) }) ?? resolver.resolveGroupName(tag)) : resolver.resolveClassName('Client')\n\n if (!tag && !group) {\n const name = resolver.resolveClassName('ApiClient')\n const file = resolver.resolveFile({ name, extname: '.ts' }, { root, output, group: group ?? undefined })\n const operationData = buildOperationData(operationNode)\n const previous = acc.find((item) => item.file.path === file.path)\n\n if (previous) {\n previous.operations.push(operationData)\n } else {\n acc.push({ name, propertyName: resolver.resolveClientPropertyName(name), file, operations: [operationData] })\n }\n return acc\n }\n\n if (tag) {\n const name = groupName\n const file = resolver.resolveFile({ name, extname: '.ts', tag }, { root, output, group: group ?? undefined })\n const operationData = buildOperationData(operationNode)\n const previous = acc.find((item) => item.file.path === file.path)\n\n if (previous) {\n previous.operations.push(operationData)\n } else {\n acc.push({ name, propertyName: resolver.resolveClientPropertyName(name), file, operations: [operationData] })\n }\n }\n\n return acc\n }, [] as Array<Controller>)\n\n function collectTypeImports(ops: Array<OperationData>) {\n const typeImportsByFile = new Map<string, Set<string>>()\n const typeFilesByPath = new Map<string, ast.FileNode>()\n\n ops.forEach((op) => {\n const names = resolveTypeImportNames(op.node, tsResolver)\n if (!typeImportsByFile.has(op.typeFile.path)) {\n typeImportsByFile.set(op.typeFile.path, new Set())\n }\n const imports = typeImportsByFile.get(op.typeFile.path)!\n names.forEach((n) => {\n imports.add(n)\n })\n typeFilesByPath.set(op.typeFile.path, op.typeFile)\n })\n\n return { typeImportsByFile, typeFilesByPath }\n }\n\n function collectZodImports(ops: Array<OperationData>) {\n const zodImportsByFile = new Map<string, Set<string>>()\n const zodFilesByPath = new Map<string, ast.FileNode>()\n\n ops.forEach((op) => {\n if (!op.zodFile || !zodResolver) return\n const names = resolveZodImportNames(op.node, zodResolver, parser)\n if (!zodImportsByFile.has(op.zodFile.path)) {\n zodImportsByFile.set(op.zodFile.path, new Set())\n }\n const imports = zodImportsByFile.get(op.zodFile.path)!\n names.forEach((n) => {\n imports.add(n)\n })\n zodFilesByPath.set(op.zodFile.path, op.zodFile)\n })\n\n return { zodImportsByFile, zodFilesByPath }\n }\n\n const files = controllers.map(({ name, file, operations: ops }) => {\n const { typeImportsByFile, typeFilesByPath } = collectTypeImports(ops)\n const { zodImportsByFile, zodFilesByPath } = isParserEnabled(parser)\n ? collectZodImports(ops)\n : { zodImportsByFile: new Map<string, Set<string>>(), zodFilesByPath: new Map<string, ast.FileNode>() }\n const hasFormData = ops.some((op) => op.node.requestBody?.content?.some((e) => e.contentType === 'multipart/form-data') ?? false)\n\n return (\n <File\n key={file.path}\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={resolver.resolveBanner(ctx.meta, { output, config, file: { path: file.path, baseName: file.baseName } })}\n footer={resolver.resolveFooter(ctx.meta, { output, config, file: { path: file.path, baseName: file.baseName } })}\n >\n {importPath ? (\n <>\n <File.Import name={'client'} path={importPath} />\n <File.Import name={['mergeConfig']} path={importPath} />\n <File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={importPath} isTypeOnly />\n </>\n ) : (\n <>\n <File.Import name={['client']} root={file.path} path={path.resolve(root, '.kubb/client.ts')} />\n <File.Import name={['mergeConfig']} root={file.path} path={path.resolve(root, '.kubb/client.ts')} />\n <File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} root={file.path} path={path.resolve(root, '.kubb/client.ts')} isTypeOnly />\n </>\n )}\n\n {hasFormData && <File.Import name={['buildFormData']} root={file.path} path={path.resolve(root, '.kubb/config.ts')} />}\n\n {parser === 'zod' && zodResolver && ops.some((op) => op.node.requestBody?.content?.[0]?.schema != null) && (\n <File.Import name={['z']} path=\"zod\" isTypeOnly />\n )}\n\n {Array.from(typeImportsByFile.entries()).map(([filePath, importSet]) => {\n const typeFile = typeFilesByPath.get(filePath)\n if (!typeFile) return null\n const importNames = Array.from(importSet).filter(Boolean)\n if (importNames.length === 0) return null\n return <File.Import key={filePath} name={importNames} root={file.path} path={typeFile.path} isTypeOnly />\n })}\n\n {isParserEnabled(parser) &&\n Array.from(zodImportsByFile.entries()).map(([filePath, importSet]) => {\n const zodFile = zodFilesByPath.get(filePath)\n if (!zodFile) return null\n const importNames = Array.from(importSet).filter(Boolean)\n if (importNames.length === 0) return null\n return <File.Import key={filePath} name={importNames} root={file.path} path={zodFile.path} />\n })}\n\n <ClassClient\n name={name}\n operations={ops}\n baseURL={baseURL}\n dataReturnType={dataReturnType}\n pathParamsType={pathParamsType}\n paramsCasing={paramsCasing}\n paramsType={paramsType}\n parser={parser}\n />\n </File>\n )\n })\n\n if (sdk) {\n const sdkFile = resolver.resolveFile({ name: sdk.className, extname: '.ts' }, { root, output, group: group ?? undefined })\n\n files.push(\n <File\n key={sdkFile.path}\n baseName={sdkFile.baseName}\n path={sdkFile.path}\n meta={sdkFile.meta}\n banner={resolver.resolveBanner(ctx.meta, { output, config, file: { path: sdkFile.path, baseName: sdkFile.baseName } })}\n footer={resolver.resolveFooter(ctx.meta, { output, config, file: { path: sdkFile.path, baseName: sdkFile.baseName } })}\n >\n {importPath ? (\n <File.Import name={['Client', 'RequestConfig']} path={importPath} isTypeOnly />\n ) : (\n <File.Import name={['Client', 'RequestConfig']} root={sdkFile.path} path={path.resolve(root, '.kubb/client.ts')} isTypeOnly />\n )}\n\n {controllers.map(({ name, file }) => (\n <File.Import key={name} name={[name]} root={sdkFile.path} path={file.path} />\n ))}\n\n <WrapperClient name={sdk.className} controllers={controllers.map(({ name, propertyName }) => ({ className: name, propertyName }))} />\n </File>,\n )\n }\n\n return <>{files}</>\n },\n})\n","import path from 'node:path'\nimport { getOperationParameters, operationFileEntry, resolveOperationTypeNames } from '@internals/shared'\nimport { ast, defineGenerator } from '@kubb/core'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, jsxRenderer } from '@kubb/renderer-jsx'\nimport { Client } from '../components/Client'\nimport { Url } from '../components/Url.tsx'\nimport type { PluginClient } from '../types'\nimport { isParserEnabled, resolveQueryParamsParser, resolveRequestParser, resolveResponseParser } from '../utils.ts'\n\n/**\n * Built-in operation generator for `@kubb/plugin-client`. Emits one async\n * function per OpenAPI operation, plus the matching URL helper. Used when\n * `clientType: 'function'` (the default).\n */\nexport const clientGenerator = defineGenerator<PluginClient>({\n name: 'client',\n renderer: jsxRenderer,\n operation(node, ctx) {\n if (!ast.isHttpOperationNode(node)) return null\n const { config, driver, resolver, root } = ctx\n const { output, urlType, dataReturnType, paramsCasing, paramsType, pathParamsType, parser, importPath, group } = ctx.options\n const baseURL = ctx.options.baseURL ?? ctx.meta.baseURL\n\n const pluginTs = driver.getPlugin(pluginTsName)\n\n if (!pluginTs) {\n return null\n }\n\n const tsResolver = driver.getResolver(pluginTsName)\n\n const pluginZod = isParserEnabled(parser) ? driver.getPlugin(pluginZodName) : null\n const zodResolver = pluginZod ? driver.getResolver(pluginZodName) : null\n\n const importedTypeNames = resolveOperationTypeNames(node, tsResolver, { paramsCasing })\n\n const { query: queryParams } = getOperationParameters(node)\n\n const importedZodNames = zodResolver\n ? [\n resolveResponseParser(parser) === 'zod' ? zodResolver.resolveResponseName?.(node) : null,\n resolveRequestParser(parser) === 'zod' && node.requestBody?.content?.[0]?.schema ? zodResolver.resolveDataName?.(node) : null,\n resolveQueryParamsParser(parser) === 'zod' && queryParams.length > 0 ? zodResolver.resolveQueryParamsName?.(node, queryParams[0]!) : null,\n ].filter((name): name is string => Boolean(name))\n : []\n\n const zodRequestName = zodResolver && parser === 'zod' && node.requestBody?.content?.[0]?.schema ? (zodResolver.resolveDataName?.(node) ?? null) : null\n\n const meta = {\n name: resolver.resolveName(node.operationId),\n urlName: resolver.resolveUrlName(node),\n file: resolver.resolveFile(operationFileEntry(node, node.operationId), { root, output, group: group ?? undefined }),\n fileTs: tsResolver.resolveFile(operationFileEntry(node, node.operationId), {\n root,\n output: pluginTs.options?.output ?? output,\n group: pluginTs.options?.group ?? undefined,\n }),\n fileZod:\n zodResolver && pluginZod?.options\n ? zodResolver.resolveFile(operationFileEntry(node, node.operationId), {\n root,\n output: pluginZod.options.output ?? output,\n group: pluginZod.options?.group ?? undefined,\n })\n : null,\n } as const\n\n const hasFormData = node.requestBody?.content?.some((e) => e.contentType === 'multipart/form-data') ?? false\n\n return (\n <File\n baseName={meta.file.baseName}\n path={meta.file.path}\n meta={meta.file.meta}\n banner={resolver.resolveBanner(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n footer={resolver.resolveFooter(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n >\n {importPath ? (\n <>\n <File.Import name={'client'} path={importPath} />\n <File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={importPath} isTypeOnly />\n </>\n ) : (\n <>\n <File.Import name={['client']} root={meta.file.path} path={path.resolve(root, '.kubb/client.ts')} />\n <File.Import\n name={['Client', 'RequestConfig', 'ResponseErrorConfig']}\n root={meta.file.path}\n path={path.resolve(root, '.kubb/client.ts')}\n isTypeOnly\n />\n </>\n )}\n\n {hasFormData && <File.Import name={['buildFormData']} root={meta.file.path} path={path.resolve(root, '.kubb/config.ts')} />}\n\n {zodRequestName && <File.Import name={['z']} path=\"zod\" isTypeOnly />}\n\n {meta.fileZod && importedZodNames.length > 0 && <File.Import name={importedZodNames as Array<string>} root={meta.file.path} path={meta.fileZod.path} />}\n\n {meta.fileTs && importedTypeNames.length > 0 && (\n <File.Import name={Array.from(new Set(importedTypeNames))} root={meta.file.path} path={meta.fileTs.path} isTypeOnly />\n )}\n\n <Url\n name={meta.urlName}\n baseURL={baseURL}\n pathParamsType={pathParamsType}\n paramsCasing={paramsCasing}\n paramsType={paramsType}\n node={node}\n tsResolver={tsResolver}\n isIndexable={urlType === 'export'}\n isExportable={urlType === 'export'}\n />\n\n <Client\n name={meta.name}\n urlName={meta.urlName}\n baseURL={baseURL}\n dataReturnType={dataReturnType}\n pathParamsType={pathParamsType}\n paramsCasing={paramsCasing}\n paramsType={paramsType}\n node={node}\n tsResolver={tsResolver}\n zodResolver={zodResolver}\n parser={parser}\n />\n </File>\n )\n },\n})\n","import { camelCase } from '@internals/utils'\nimport type { ast } from '@kubb/core'\nimport { defineGenerator } from '@kubb/core'\nimport { File, Function, jsxRenderer } from '@kubb/renderer-jsx'\nimport type { PluginClient } from '../types'\n\n/**\n * Emits one aggregate file per tag/group when `group` is configured. Each\n * file re-exports every client function for that group, so callers can\n * `import { petController } from './gen/clients'` instead of importing\n * each operation individually.\n */\nexport const groupedClientGenerator = defineGenerator<PluginClient>({\n name: 'groupedClient',\n renderer: jsxRenderer,\n operations(nodes, ctx) {\n const { config, resolver, root } = ctx\n const { output, group } = ctx.options\n\n const controllers = nodes.reduce(\n (acc, operationNode) => {\n if (group?.type === 'tag') {\n const tag = operationNode.tags[0]\n const name = tag ? group?.name?.({ group: camelCase(tag) }) : null\n\n if (!tag || !name) {\n return acc\n }\n\n const file = resolver.resolveFile({ name, extname: '.ts', tag }, { root, output, group: group ?? undefined })\n const clientFile = resolver.resolveFile(\n { name: operationNode.operationId, extname: '.ts', tag: operationNode.tags[0] ?? 'default', path: operationNode.path },\n { root, output, group: group ?? undefined },\n )\n\n const client = {\n name: resolver.resolveName(operationNode.operationId),\n file: clientFile,\n }\n\n const previous = acc.find((item) => item.file.path === file.path)\n\n if (previous) {\n previous.clients.push(client)\n } else {\n acc.push({ name, file, clients: [client] })\n }\n }\n\n return acc\n },\n [] as Array<{ name: string; file: ast.FileNode; clients: Array<{ name: string; file: ast.FileNode }> }>,\n )\n\n return (\n <>\n {controllers.map(({ name, file, clients }) => {\n return (\n <File\n key={file.path}\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={resolver.resolveBanner(ctx.meta, { output, config, file: { path: file.path, baseName: file.baseName, isAggregation: true } })}\n footer={resolver.resolveFooter(ctx.meta, { output, config, file: { path: file.path, baseName: file.baseName, isAggregation: true } })}\n >\n {clients.map((client) => (\n <File.Import key={client.name} name={[client.name]} root={file.path} path={client.file.path} />\n ))}\n\n <File.Source name={name} isExportable isIndexable>\n <Function export name={name}>\n {`return { ${clients.map((client) => client.name).join(', ')} }`}\n </Function>\n </File.Source>\n </File>\n )\n })}\n </>\n )\n },\n})\n","import { Url } from '@internals/utils'\nimport { ast, defineGenerator } from '@kubb/core'\nimport type { PluginClient } from '../types'\n\n/**\n * Generates an `operations.ts` file that re-exports every operation grouped\n * by HTTP method. Enabled when `pluginClient({ operations: true })`. Useful\n * for building meta-tooling on top of the generated client (route\n * registries, API explorers).\n */\nexport const operationsGenerator = defineGenerator<PluginClient>({\n name: 'client',\n operations(nodes, ctx) {\n const { config, resolver, root } = ctx\n const { output, group } = ctx.options\n\n const name = 'operations'\n const file = resolver.resolveFile({ name, extname: '.ts' }, { root, output, group: group ?? undefined })\n\n const operationsObject: Record<string, { path: string; method: string }> = {}\n for (const node of nodes) {\n if (!ast.isHttpOperationNode(node)) continue\n operationsObject[node.operationId] = {\n path: Url.toPath(node.path),\n method: node.method.toLowerCase(),\n }\n }\n\n return [\n ast.factory.createFile({\n baseName: file.baseName,\n path: file.path,\n meta: file.meta,\n banner: resolver.resolveBanner(ctx.meta, { output, config, file: { path: file.path, baseName: file.baseName } }),\n footer: resolver.resolveFooter(ctx.meta, { output, config, file: { path: file.path, baseName: file.baseName } }),\n sources: [\n ast.factory.createSource({\n name,\n isExportable: true,\n isIndexable: true,\n nodes: [ast.factory.createConst({ name, export: true, nodes: [ast.factory.createText(JSON.stringify(operationsObject, undefined, 2))] })],\n }),\n ],\n }),\n ]\n },\n})\n","import { buildOperationComments, getContentTypeInfo, getOperationParameters } from '@internals/shared'\nimport { Url } from '@internals/utils'\nimport { buildJSDoc, stringify } from '@kubb/ast/utils'\nimport { ast } from '@kubb/core'\nimport type { ResolverTs } from '@kubb/plugin-ts'\nimport { functionPrinter } from '@kubb/plugin-ts'\nimport type { ResolverZod } from '@kubb/plugin-zod'\nimport { File } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport type { PluginClient } from '../types.ts'\nimport {\n buildClassClientParams,\n buildFormDataLine,\n buildGenerics,\n buildHeaders,\n buildQueryParamsLine,\n buildRequestDataLine,\n buildReturnStatement,\n resolveQueryParamsParser,\n} from '../utils.ts'\nimport { buildClientParamsNode } from './Client.tsx'\n\ntype OperationData = {\n node: ast.OperationNode\n name: string\n tsResolver: ResolverTs\n zodResolver?: ResolverZod | null\n}\n\ntype Props = {\n name: string\n isExportable?: boolean\n isIndexable?: boolean\n operations: Array<OperationData>\n baseURL: string | null | undefined\n dataReturnType: PluginClient['resolvedOptions']['dataReturnType']\n paramsCasing: PluginClient['resolvedOptions']['paramsCasing']\n paramsType: PluginClient['resolvedOptions']['pathParamsType']\n pathParamsType: PluginClient['resolvedOptions']['pathParamsType']\n parser: PluginClient['resolvedOptions']['parser'] | undefined\n children?: KubbReactNode\n}\n\ntype GenerateMethodProps = {\n node: ast.OperationNode\n name: string\n tsResolver: ResolverTs\n zodResolver?: ResolverZod | null\n baseURL: string | null | undefined\n dataReturnType: PluginClient['resolvedOptions']['dataReturnType']\n parser: PluginClient['resolvedOptions']['parser'] | undefined\n paramsType: PluginClient['resolvedOptions']['paramsType']\n paramsCasing: PluginClient['resolvedOptions']['paramsCasing']\n pathParamsType: PluginClient['resolvedOptions']['pathParamsType']\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\n\nfunction generateMethod({\n node,\n name,\n tsResolver,\n zodResolver,\n baseURL,\n dataReturnType,\n parser,\n paramsType,\n paramsCasing,\n pathParamsType,\n}: GenerateMethodProps): string {\n if (!ast.isHttpOperationNode(node)) return ''\n const { defaultContentType: contentType, isMultipleContentTypes, hasFormData } = getContentTypeInfo(node)\n const isFormData = !isMultipleContentTypes && contentType === 'multipart/form-data'\n const { header: headerParams } = getOperationParameters(node)\n const headerParamsName = headerParams.length > 0 ? tsResolver.resolveHeaderParamsName(node, headerParams[0]!) : null\n const headers = isMultipleContentTypes ? (headerParamsName ? ['...headers'] : []) : buildHeaders(contentType, !!headerParamsName)\n const generics = buildGenerics(node, tsResolver, { dataReturnType, zodResolver, parser })\n const paramsNode = buildClientParamsNode({ paramsType, paramsCasing, pathParamsType, node, tsResolver, isConfigurable: true })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n const { query: queryParams } = getOperationParameters(node)\n const zodQueryParamsName =\n zodResolver && resolveQueryParamsParser(parser) === 'zod' && queryParams.length > 0 ? zodResolver.resolveQueryParamsName?.(node, queryParams[0]!) : null\n const clientParams = buildClassClientParams({\n node,\n url: Url.toTemplateString(node.path, { casing: paramsCasing }),\n baseURL,\n tsResolver,\n isFormData,\n isMultipleContentTypes,\n hasFormData,\n headers,\n zodQueryParamsName,\n })\n const jsdoc = buildJSDoc(buildOperationComments(node, { link: 'urlPath', linkPosition: 'beforeDeprecated', splitLines: true }))\n\n const requestDataLine = buildRequestDataLine({ parser, node, zodResolver })\n const queryParamsLine = buildQueryParamsLine({ parser, node, zodResolver })\n const formDataLine = buildFormDataLine(isFormData || (isMultipleContentTypes && hasFormData), !!node.requestBody?.content?.[0]?.schema)\n const returnStatement = buildReturnStatement({ dataReturnType, parser, node, zodResolver, tsResolver })\n\n const methodBody = [\n `const { client: request = client, ${isMultipleContentTypes ? `contentType = ${stringify(contentType)}, ` : ''}...requestConfig } = mergeConfig(this.#config, config)`,\n '',\n requestDataLine,\n queryParamsLine,\n formDataLine,\n `const res = await request<${generics.join(', ')}>(${clientParams.toCall()})`,\n returnStatement,\n ]\n .filter(Boolean)\n .map((line) => ` ${line}`)\n .join('\\n')\n\n return `${jsdoc} static async ${name}(${paramsSignature}) {\\n${methodBody}\\n }`\n}\n\nexport function StaticClassClient({\n name,\n isExportable = true,\n isIndexable = true,\n operations,\n baseURL,\n dataReturnType,\n parser,\n paramsType,\n paramsCasing,\n pathParamsType,\n children,\n}: Props): KubbReactNode {\n const methods = operations.map(({ node, name: methodName, tsResolver, zodResolver }) =>\n generateMethod({\n node,\n name: methodName,\n tsResolver,\n zodResolver,\n baseURL,\n dataReturnType,\n parser,\n paramsType,\n paramsCasing,\n pathParamsType,\n }),\n )\n\n const classCode = `export class ${name} {\\n static #config: Partial<RequestConfig> & { client?: Client } = {}\\n\\n${methods.join('\\n\\n')}\\n}`\n\n return (\n <File.Source name={name} isExportable={isExportable} isIndexable={isIndexable}>\n {classCode}\n {children}\n </File.Source>\n )\n}\n","import path from 'node:path'\nimport { getOperationParameters, operationFileEntry, resolveOperationTypeNames } from '@internals/shared'\nimport { camelCase } from '@internals/utils'\nimport { ast, defineGenerator } from '@kubb/core'\nimport type { ResolverTs } from '@kubb/plugin-ts'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport type { ResolverZod } from '@kubb/plugin-zod'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, jsxRenderer } from '@kubb/renderer-jsx'\nimport { StaticClassClient } from '../components/StaticClassClient'\nimport type { PluginClient } from '../types'\nimport { isParserEnabled, resolveQueryParamsParser, resolveRequestParser, resolveResponseParser } from '../utils.ts'\n\ntype OperationData = {\n node: ast.OperationNode\n name: string\n tsResolver: ResolverTs\n zodResolver: ResolverZod | null\n typeFile: ast.FileNode\n zodFile: ast.FileNode | null\n}\n\ntype Controller = {\n name: string\n file: ast.FileNode\n operations: Array<OperationData>\n}\n\nfunction resolveTypeImportNames(node: ast.OperationNode, tsResolver: ResolverTs): Array<string> {\n return resolveOperationTypeNames(node, tsResolver, { order: 'body-response-first' })\n}\n\nfunction resolveZodImportNames(node: ast.OperationNode, zodResolver: ResolverZod, parser: PluginClient['resolvedOptions']['parser']): Array<string> {\n const { query: queryParams } = getOperationParameters(node)\n const names: Array<string | null | undefined> = [\n resolveResponseParser(parser) === 'zod' ? zodResolver.resolveResponseName?.(node) : null,\n resolveRequestParser(parser) === 'zod' && node.requestBody?.content?.[0]?.schema ? zodResolver.resolveDataName?.(node) : null,\n resolveQueryParamsParser(parser) === 'zod' && queryParams.length > 0 ? zodResolver.resolveQueryParamsName?.(node, queryParams[0]!) : null,\n ]\n return names.filter((n): n is string => Boolean(n))\n}\n\n/**\n * Built-in `operations` generator for `@kubb/plugin-client` when\n * `clientType: 'staticClass'`. Emits one class per tag, with a static method\n * per operation so callers can use `Pet.getPetById(...)` without\n * instantiating the class.\n */\nexport const staticClassClientGenerator = defineGenerator<PluginClient>({\n name: 'staticClassClient',\n renderer: jsxRenderer,\n operations(nodes, ctx) {\n const { config, driver, resolver, root } = ctx\n const { output, group, dataReturnType, paramsCasing, paramsType, pathParamsType, parser, importPath } = ctx.options\n const baseURL = ctx.options.baseURL ?? ctx.meta.baseURL\n\n const pluginTs = driver.getPlugin(pluginTsName)\n if (!pluginTs) return null\n\n const tsResolver = driver.getResolver(pluginTsName)\n const tsPluginOptions = pluginTs.options\n const pluginZod = isParserEnabled(parser) ? driver.getPlugin(pluginZodName) : null\n const zodResolver = pluginZod ? driver.getResolver(pluginZodName) : null\n\n function buildOperationData(node: ast.OperationNode): OperationData {\n const typeFile = tsResolver.resolveFile(operationFileEntry(node, node.operationId), {\n root,\n output: tsPluginOptions?.output ?? output,\n group: tsPluginOptions?.group,\n })\n const zodFile =\n zodResolver && pluginZod?.options\n ? zodResolver.resolveFile(operationFileEntry(node, node.operationId), {\n root,\n output: pluginZod.options?.output ?? output,\n group: pluginZod.options?.group ?? undefined,\n })\n : null\n\n return {\n node: node,\n name: resolver.resolveName(node.operationId),\n tsResolver,\n zodResolver,\n typeFile,\n zodFile,\n }\n }\n\n const controllers = nodes.reduce((acc, operationNode) => {\n if (!ast.isHttpOperationNode(operationNode)) return acc\n const tag = operationNode.tags[0]\n const groupName = tag ? (group?.name?.({ group: camelCase(tag) }) ?? resolver.resolveGroupName(tag)) : resolver.resolveClassName('Client')\n\n if (!tag && !group) {\n const name = resolver.resolveClassName('ApiClient')\n const file = resolver.resolveFile({ name, extname: '.ts' }, { root, output, group: group ?? undefined })\n const operationData = buildOperationData(operationNode)\n const previous = acc.find((item) => item.file.path === file.path)\n\n if (previous) {\n previous.operations.push(operationData)\n } else {\n acc.push({ name, file, operations: [operationData] })\n }\n return acc\n }\n\n if (tag) {\n const name = groupName\n const file = resolver.resolveFile({ name, extname: '.ts', tag }, { root, output, group: group ?? undefined })\n const operationData = buildOperationData(operationNode)\n const previous = acc.find((item) => item.file.path === file.path)\n\n if (previous) {\n previous.operations.push(operationData)\n } else {\n acc.push({ name, file, operations: [operationData] })\n }\n }\n\n return acc\n }, [] as Array<Controller>)\n\n function collectTypeImports(ops: Array<OperationData>) {\n const typeImportsByFile = new Map<string, Set<string>>()\n const typeFilesByPath = new Map<string, ast.FileNode>()\n\n ops.forEach((op) => {\n const names = resolveTypeImportNames(op.node, tsResolver)\n if (!typeImportsByFile.has(op.typeFile.path)) {\n typeImportsByFile.set(op.typeFile.path, new Set())\n }\n const imports = typeImportsByFile.get(op.typeFile.path)!\n names.forEach((n) => {\n imports.add(n)\n })\n typeFilesByPath.set(op.typeFile.path, op.typeFile)\n })\n\n return { typeImportsByFile, typeFilesByPath }\n }\n\n function collectZodImports(ops: Array<OperationData>) {\n const zodImportsByFile = new Map<string, Set<string>>()\n const zodFilesByPath = new Map<string, ast.FileNode>()\n\n ops.forEach((op) => {\n if (!op.zodFile || !zodResolver) return\n const names = resolveZodImportNames(op.node, zodResolver, parser)\n if (!zodImportsByFile.has(op.zodFile.path)) {\n zodImportsByFile.set(op.zodFile.path, new Set())\n }\n const imports = zodImportsByFile.get(op.zodFile.path)!\n names.forEach((n) => {\n imports.add(n)\n })\n zodFilesByPath.set(op.zodFile.path, op.zodFile)\n })\n\n return { zodImportsByFile, zodFilesByPath }\n }\n\n return (\n <>\n {controllers.map(({ name, file, operations: ops }) => {\n const { typeImportsByFile, typeFilesByPath } = collectTypeImports(ops)\n const { zodImportsByFile, zodFilesByPath } = isParserEnabled(parser)\n ? collectZodImports(ops)\n : { zodImportsByFile: new Map<string, Set<string>>(), zodFilesByPath: new Map<string, ast.FileNode>() }\n const hasFormData = ops.some((op) => op.node.requestBody?.content?.some((e) => e.contentType === 'multipart/form-data') ?? false)\n\n return (\n <File\n key={file.path}\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={resolver.resolveBanner(ctx.meta, { output, config, file: { path: file.path, baseName: file.baseName } })}\n footer={resolver.resolveFooter(ctx.meta, { output, config, file: { path: file.path, baseName: file.baseName } })}\n >\n {importPath ? (\n <>\n <File.Import name={'client'} path={importPath} />\n <File.Import name={['mergeConfig']} path={importPath} />\n <File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={importPath} isTypeOnly />\n </>\n ) : (\n <>\n <File.Import name={['client']} root={file.path} path={path.resolve(root, '.kubb/client.ts')} />\n <File.Import name={['mergeConfig']} root={file.path} path={path.resolve(root, '.kubb/client.ts')} />\n <File.Import\n name={['Client', 'RequestConfig', 'ResponseErrorConfig']}\n root={file.path}\n path={path.resolve(root, '.kubb/client.ts')}\n isTypeOnly\n />\n </>\n )}\n\n {hasFormData && <File.Import name={['buildFormData']} root={file.path} path={path.resolve(root, '.kubb/config.ts')} />}\n\n {parser === 'zod' && zodResolver && ops.some((op) => op.node.requestBody?.content?.[0]?.schema != null) && (\n <File.Import name={['z']} path=\"zod\" isTypeOnly />\n )}\n\n {Array.from(typeImportsByFile.entries()).map(([filePath, importSet]) => {\n const typeFile = typeFilesByPath.get(filePath)\n if (!typeFile) return null\n const importNames = Array.from(importSet).filter(Boolean)\n if (importNames.length === 0) return null\n return <File.Import key={filePath} name={importNames} root={file.path} path={typeFile.path} isTypeOnly />\n })}\n\n {isParserEnabled(parser) &&\n Array.from(zodImportsByFile.entries()).map(([filePath, importSet]) => {\n const zodFile = zodFilesByPath.get(filePath)\n if (!zodFile) return null\n const importNames = Array.from(importSet).filter(Boolean)\n if (importNames.length === 0) return null\n return <File.Import key={filePath} name={importNames} root={file.path} path={zodFile.path} />\n })}\n\n <StaticClassClient\n name={name}\n operations={ops}\n baseURL={baseURL}\n dataReturnType={dataReturnType}\n pathParamsType={pathParamsType}\n paramsCasing={paramsCasing}\n paramsType={paramsType}\n parser={parser}\n />\n </File>\n )\n })}\n </>\n )\n },\n})\n","import { camelCase, ensureValidVarName, pascalCase, toFilePath } from '@internals/utils'\nimport { defineResolver } from '@kubb/core'\nimport type { PluginClient } from '../types.ts'\n\n/**\n * Default resolver used by `@kubb/plugin-client`. Decides the names and file\n * paths for every generated client function or class. Functions and files use\n * camelCase; classes and tag groups use PascalCase.\n *\n * @example Resolve client function and class names\n * ```ts\n * import { resolverClient } from '@kubb/plugin-client'\n *\n * resolverClient.default('list pets', 'function') // 'listPets'\n * resolverClient.resolveClassName('pet') // 'Pet'\n * resolverClient.resolveGroupName('pet') // 'PetClient'\n * resolverClient.resolveUrlName(operationNode) // 'getShowPetByIdUrl'\n * ```\n */\nexport const resolverClient = defineResolver<PluginClient>(() => ({\n name: 'default',\n pluginName: 'plugin-client',\n default(name, type) {\n if (type === 'file') return toFilePath(name)\n return ensureValidVarName(camelCase(name))\n },\n resolveName(name) {\n return this.default(name, 'function')\n },\n resolvePathName(name, type) {\n return this.default(name, type)\n },\n resolveClassName(name) {\n return ensureValidVarName(pascalCase(name))\n },\n resolveGroupName(name) {\n return ensureValidVarName(pascalCase(`${name} Client`))\n },\n resolveClientPropertyName(name) {\n return ensureValidVarName(camelCase(name))\n },\n resolveUrlName(node) {\n const name = this.resolveName(node.operationId)\n return `get${name.charAt(0).toUpperCase()}${name.slice(1)}Url`\n },\n}))\n","import path from 'node:path'\nimport { createGroupConfig } from '@internals/shared'\n\nimport { ast, definePlugin } from '@kubb/core'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { classClientGenerator } from './generators/classClientGenerator.tsx'\nimport { clientGenerator } from './generators/clientGenerator.tsx'\nimport { groupedClientGenerator } from './generators/groupedClientGenerator.tsx'\nimport { operationsGenerator } from './generators/operationsGenerator.ts'\nimport { staticClassClientGenerator } from './generators/staticClassClientGenerator.tsx'\nimport { resolverClient } from './resolvers/resolverClient.ts'\nimport { source as axiosClientSource } from './templates/clients/axios.source.ts'\nimport { source as fetchClientSource } from './templates/clients/fetch.source.ts'\nimport { source as configSource } from './templates/config.source.ts'\nimport type { PluginClient } from './types.ts'\nimport { isParserEnabled } from './utils.ts'\n\n/**\n * Canonical plugin name for `@kubb/plugin-client`. Used for driver lookups and\n * cross-plugin dependency references.\n */\nexport const pluginClientName = 'plugin-client' satisfies PluginClient['name']\n\n/**\n * Generates one HTTP client function per OpenAPI operation. Each function has\n * typed path params, query params, body, and response, so callers use the API\n * like any other typed function. Ships with `axios` and `fetch` runtimes; bring\n * your own by setting `importPath`.\n *\n * @example\n * ```ts\n * import { defineConfig } from 'kubb'\n * import { pluginTs } from '@kubb/plugin-ts'\n * import { pluginClient } from '@kubb/plugin-client'\n *\n * export default defineConfig({\n * input: { path: './petStore.yaml' },\n * output: { path: './src/gen' },\n * plugins: [\n * pluginTs(),\n * pluginClient({\n * output: { path: './clients' },\n * client: 'fetch',\n * }),\n * ],\n * })\n * ```\n */\nexport const pluginClient = definePlugin<PluginClient>((options) => {\n const {\n output = { path: 'clients', barrel: { type: 'named' } },\n group,\n exclude = [],\n include,\n override = [],\n urlType = false,\n dataReturnType = 'data',\n paramsType = 'inline',\n pathParamsType = paramsType === 'object' ? 'object' : options.pathParamsType || 'inline',\n operations = false,\n paramsCasing,\n clientType = options.sdk ? 'class' : 'function',\n parser = false,\n client = 'axios',\n importPath,\n bundle = false,\n sdk,\n baseURL,\n resolver: userResolver,\n macros: userMacros,\n } = options\n\n const resolvedImportPath = importPath ?? (!bundle ? `@kubb/plugin-client/clients/${client}` : undefined)\n\n const selectedGenerators =\n options.generators ??\n [\n clientType === 'staticClass' ? staticClassClientGenerator : clientType === 'class' ? classClientGenerator : clientGenerator,\n group && clientType === 'function' ? groupedClientGenerator : null,\n operations ? operationsGenerator : null,\n ].filter((x): x is NonNullable<typeof x> => Boolean(x))\n\n const groupConfig = createGroupConfig(group)\n\n return {\n name: pluginClientName,\n options,\n dependencies: [pluginTsName, isParserEnabled(parser) ? pluginZodName : null].filter((dependency): dependency is string => Boolean(dependency)),\n hooks: {\n 'kubb:plugin:setup'(ctx) {\n const resolver = userResolver ? { ...resolverClient, ...userResolver } : resolverClient\n\n ctx.setOptions({\n client,\n clientType,\n bundle,\n output,\n exclude,\n include,\n override,\n group: groupConfig,\n parser,\n dataReturnType,\n importPath: resolvedImportPath,\n baseURL,\n paramsType,\n paramsCasing,\n pathParamsType,\n urlType,\n sdk,\n resolver,\n })\n ctx.setResolver(resolver)\n if (userMacros?.length) {\n ctx.setMacros(userMacros)\n }\n for (const gen of selectedGenerators) {\n ctx.addGenerator(gen)\n }\n\n const root = path.resolve(ctx.config.root, ctx.config.output.path)\n\n const isRelativePath = resolvedImportPath?.startsWith('.')\n\n if (!isRelativePath) {\n const isInlineSource = bundle && !resolvedImportPath\n\n ctx.injectFile({\n baseName: 'client.ts',\n path: path.resolve(root, '.kubb/client.ts'),\n sources: [\n ast.factory.createSource({\n name: 'client',\n nodes: isInlineSource ? [ast.factory.createText(client === 'fetch' ? fetchClientSource : axiosClientSource)] : [],\n isExportable: true,\n isIndexable: true,\n }),\n ],\n exports: !isInlineSource && resolvedImportPath ? [ast.factory.createExport({ path: resolvedImportPath })] : [],\n })\n }\n\n ctx.injectFile({\n baseName: 'config.ts',\n path: path.resolve(root, '.kubb/config.ts'),\n sources: [\n ast.factory.createSource({\n name: 'config',\n nodes: [ast.factory.createText(configSource)],\n isExportable: false,\n isIndexable: false,\n }),\n ],\n })\n },\n },\n }\n})\n\nexport default pluginClient\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAkBA,SAAS,gBAAgB,MAAc,QAAyB;CAC9D,OAAO,KACJ,KAAK,CAAC,CACN,QAAQ,qBAAqB,OAAO,CAAC,CACrC,QAAQ,yBAAyB,OAAO,CAAC,CACzC,QAAQ,gBAAgB,OAAO,CAAC,CAChC,MAAM,eAAe,CAAC,CACtB,OAAO,OAAO,CAAC,CACf,KAAK,MAAM,MAAM;EAChB,IAAI,KAAK,SAAS,KAAK,SAAS,KAAK,YAAY,GAAG,OAAO;EAE3D,QADa,MAAM,KAAK,CAAC,SAAS,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,KAC9E,KAAK,MAAM,CAAC;CAC5B,CAAC,CAAC,CACD,KAAK,EAAE,CAAC,CACR,QAAQ,iBAAiB,EAAE;AAChC;;;;;;;;;;AAWA,SAAgB,UAAU,MAAc,EAAE,SAAS,IAAI,SAAS,OAAgB,CAAC,GAAW;CAC1F,OAAO,gBAAgB,GAAG,OAAO,GAAG,KAAK,GAAG,UAAU,KAAK;AAC7D;;;;;;;;;;AAWA,SAAgB,WAAW,MAAc,EAAE,SAAS,IAAI,SAAS,OAAgB,CAAC,GAAW;CAC3F,OAAO,gBAAgB,GAAG,OAAO,GAAG,KAAK,GAAG,UAAU,IAAI;AAC5D;;;;;;;;;;;;;;;;;;;;;;ACZA,SAAgB,WAAW,MAAc,WAAqC,WAAmB;CAC/F,MAAM,QAAQ,KAAK,MAAM,gBAAgB;CACzC,OAAO,MACJ,KAAK,MAA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ACd,aAAa;KACf,CAAC,CACH;KACA,SAAS,CAAC,kBAAkB,qBAAqB,CAAC,IAAI,QAAQ,aAAa,EAAE,MAAM,mBAAmB,CAAC,CAAC,IAAI,CAAC;IAC/G,CAAC;GACH;GAEA,IAAI,WAAW;IACb,UAAU;IACV,MAAM,KAAK,QAAQ,MAAM,iBAAiB;IAC1C,SAAS,CACP,IAAI,QAAQ,aAAa;KACvB,MAAM;KACN,OAAO,CAAC,IAAI,QAAQ,WAAWC,QAAY,CAAC;KAC5C,cAAc;KACd,aAAa;IACf,CAAC,CACH;GACF,CAAC;EACH,EACF;CACF;AACF,CAAC"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../internals/shared/src/params.ts","../../../internals/shared/src/operation.ts","../../../internals/utils/src/casing.ts","../../../internals/utils/src/reserved.ts","../../../internals/shared/src/group.ts","../../../internals/client/src/builders/generics.ts","../../../internals/client/src/builders/returnStatement.ts","../../../internals/client/src/builders/security.ts","../../../internals/client/src/builders/signature.ts","../../../internals/client/src/builders/validatorOptions.ts","../../../internals/client/src/builders/validator.ts","../../../internals/client/src/builders/styles.ts","../../../internals/client/src/components/Operation.tsx","../../../internals/client/src/resolveOperationTypes.ts","../../../internals/client/src/generators/clientGenerator.tsx","../../../internals/client/src/macros.ts","../../../internals/client/src/resolver.ts","../src/generators/clientGenerator.tsx","../src/plugin.ts"],"sourcesContent":["import type { ast } from 'kubb/kit'\n\n/**\n * Drops parameters that share the same name, keeping the first.\n *\n * A malformed spec can declare the same parameter name twice within one `in` location. Both would\n * resolve to the same output property, so emitting both would yield an object type with a duplicate\n * member, which TypeScript rejects. This is a defensive guard against that case, not a casing guard:\n * parameter names flow through unchanged, so no two distinct names ever collide here anymore.\n */\nexport function dedupeParams(params: Array<ast.ParameterNode>): Array<ast.ParameterNode> {\n const seen = new Set<string>()\n\n return params.filter((param) => {\n if (seen.has(param.name)) return false\n seen.add(param.name)\n return true\n })\n}\n","import { ast, type Group, type NodeCache, type Output, type Resolver, type ResolverFileParams, Url } from 'kubb/kit'\nimport { dedupeParams } from './params.ts'\n\n/**\n * Builds the `ResolverFileParams` every operation generator passes to\n * `resolver.file`: a file named `name`, tagged by the operation's first\n * tag (or `'default'`), at the operation's path. Centralizes the entry object\n * that was repeated at dozens of call sites across the client and query plugins.\n *\n * @example\n * ```ts\n * resolver.file(operationFileEntry(node, node.operationId), { root, output, group })\n * ```\n */\nexport function operationFileEntry(node: ast.OperationNode, name: string, extname: ResolverFileParams['extname'] = '.ts'): ResolverFileParams {\n return {\n name,\n extname,\n tag: node.tags[0] ?? 'default',\n path: node.path,\n }\n}\n\n/**\n * Resolves a dependency plugin's generated file for `node.operationId`, cached in `cache` (the\n * current node's `ctx.cache`) under the resolver's own plugin name. Several dependents reading the\n * same dependency for the same operation in one pass (a query plugin's several hook generators, the\n * MCP handler, ...) share one computed name and path instead of each calling `resolver.file` again.\n *\n * @example Cache `plugin-ts`'s file for the current operation\n * ```ts\n * const fileTs = resolveDependencyOperationFile({ cache: ctx.cache, node, resolver: tsResolver, root, output })\n * ```\n */\nexport function resolveDependencyOperationFile(options: {\n cache: NodeCache\n node: ast.OperationNode\n resolver: Pick<Resolver, 'file' | 'pluginName'>\n root: string\n output: Output\n group?: Group | null\n}): ast.FileNode {\n const { cache, node, resolver, root, output, group } = options\n\n return cache.ensureItem(`${resolver.pluginName}:operationFile`, () =>\n resolver.file({ ...operationFileEntry(node, node.operationId), root, output, group: group ?? undefined }),\n )\n}\n\nexport type ContentTypeInfo = {\n contentTypes: string[]\n isMultipleContentTypes: boolean\n contentTypeUnion: string\n defaultContentType: string\n hasFormData: boolean\n}\n\nexport type RequestConfigResolver = {\n response: {\n body(node: ast.OperationNode): string\n }\n}\n\nexport type ResponseStatusNameResolver = {\n response: {\n status(node: ast.OperationNode, statusCode: ast.StatusCode): string\n }\n}\n\nexport type ResponseNameResolver = ResponseStatusNameResolver & {\n response: {\n response(node: ast.OperationNode): string\n }\n}\n\nexport type OperationTypeNameResolver = RequestConfigResolver &\n ResponseNameResolver & {\n param: {\n path(node: ast.OperationNode, param: ast.ParameterNode): string\n query(node: ast.OperationNode, param: ast.ParameterNode): string\n headers(node: ast.OperationNode, param: ast.ParameterNode): string\n }\n }\n\n/**\n * Resolver interface for building operation parameters.\n *\n * `ResolverTs` from `@kubb/plugin-ts` satisfies this interface and can be passed directly.\n */\nexport type OperationParamsResolver = {\n /**\n * Naming for an operation's parameters, grouped by location.\n */\n param: {\n /**\n * Resolves the type name for an individual parameter.\n *\n * @example Individual path parameter name\n * `resolver.param.name(node, param) // → 'DeletePetPathPetId'`\n */\n name(node: ast.OperationNode, param: ast.ParameterNode): string\n /**\n * Resolves the grouped path parameters type name.\n * When the return value equals `resolver.param.name`, no indexed access is emitted.\n *\n * @example Grouped path params type name\n * `resolver.param.path(node, param) // → 'DeletePetPath'`\n */\n path(node: ast.OperationNode, param: ast.ParameterNode): string\n /**\n * Resolves the grouped query parameters type name.\n * When the return value equals `resolver.param.name`, an inline struct type is emitted instead.\n *\n * @example Grouped query params type name\n * `resolver.param.query(node, param) // → 'FindPetsByStatusQuery'`\n */\n query(node: ast.OperationNode, param: ast.ParameterNode): string\n /**\n * Resolves the grouped header parameters type name.\n * When the return value equals `resolver.param.name`, an inline struct type is emitted instead.\n *\n * @example Grouped header params type name\n * `resolver.param.headers(node, param) // → 'DeletePetHeaders'`\n */\n headers(node: ast.OperationNode, param: ast.ParameterNode): string\n }\n /**\n * Naming for an operation's request and response types.\n */\n response: {\n /**\n * Resolves the request body type name.\n *\n * @example Request body type name\n * `resolver.response.body(node) // → 'CreatePetBody'`\n */\n body(node: ast.OperationNode): string\n }\n}\n\nexport type OperationCommentLink = 'pathTemplate' | 'urlPath' | false | ((node: ast.OperationNode) => string | undefined)\n\nexport type BuildOperationCommentsOptions = {\n link?: OperationCommentLink\n linkPosition?: 'beforeDeprecated' | 'afterDeprecated'\n splitLines?: boolean\n}\n\ntype ResponseLike = {\n statusCode: ast.StatusCode | number | string\n}\n\nexport type OperationParameterGroups = Record<ast.ParameterNode['in'], Array<ast.ParameterNode>>\n\nexport type ResolveOperationTypeNameOptions = {\n responseStatusNames?: boolean | 'error'\n exclude?: ReadonlyArray<string | undefined>\n order?: 'params-first' | 'body-response-first'\n /**\n * Include the individual `Path`/`Query`/`Headers` group type names. Set to `false` for clients\n * that reference the grouped `Options` type instead of the per-group types.\n */\n includeParams?: boolean\n}\n\nfunction getOperationLink(node: ast.OperationNode, link: OperationCommentLink): string | null {\n if (!link) {\n return null\n }\n\n if (typeof link === 'function') {\n return link(node) ?? null\n }\n\n return node.path ? `{@link ${Url.toPath(node.path)}}` : null\n}\n\n/**\n * Derives the shared `ContentTypeInfo` shape from a list of content types, tracking whether several\n * are present and the union, default, and form-data flags the client uses to pick one.\n */\nfunction buildContentTypeInfo(contentTypes: string[]): ContentTypeInfo {\n const isMultipleContentTypes = contentTypes.length > 1\n\n return {\n contentTypes,\n isMultipleContentTypes,\n contentTypeUnion: isMultipleContentTypes ? contentTypes.map((ct) => JSON.stringify(ct)).join(' | ') : '',\n defaultContentType: contentTypes[0] ?? 'application/json',\n hasFormData: contentTypes.some((ct) => ct === 'multipart/form-data'),\n }\n}\n\nexport function getContentTypeInfo(node: ast.OperationNode): ContentTypeInfo {\n return buildContentTypeInfo(node.requestBody?.content?.map((e) => e.contentType) ?? [])\n}\n\n/**\n * The request-body counterpart for the primary success response: the content types it documents and\n * whether several are present, so the client can let a caller pick which one to accept.\n */\nexport function getResponseContentTypeInfo(node: ast.OperationNode): ContentTypeInfo {\n return buildContentTypeInfo(getPrimarySuccessResponse(node)?.content?.map((e) => e.contentType) ?? [])\n}\n\nexport type ResponseType = 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream'\n\n/**\n * Reads the single base content type of an operation's primary success response, lowercased and\n * stripped of any `; charset=...` suffix. Returns `undefined` when the response declares zero or\n * more than one content type, since neither case has a single type to act on.\n */\nfunction getPrimarySuccessContentType(node: ast.OperationNode): string | undefined {\n const contentTypes = getPrimarySuccessResponse(node)?.content?.map((entry) => entry.contentType) ?? []\n if (contentTypes.length !== 1) return undefined\n return contentTypes[0]!.split(';')[0]!.trim().toLowerCase()\n}\n\n/**\n * Whether an operation streams its primary success response as Server-Sent Events\n * (`text/event-stream`). The client generator uses this to return a typed event stream instead of a\n * one-shot `RequestResult`.\n */\nexport function isEventStream(node: ast.OperationNode): boolean {\n return getPrimarySuccessContentType(node) === 'text/event-stream'\n}\n\n/**\n * Derives the default `responseType` for an operation from its primary success response.\n *\n * Returns a value only when that response declares a single non-JSON content type. `text/event-stream`\n * and other binary types (`application/octet-stream`, `application/pdf`, `image/*`, `audio/*`,\n * `video/*`) map to a stream or `'blob'`, and other `text/*` maps to `'text'`. Otherwise `undefined`,\n * leaving the runtime client's `Content-Type` auto-detection in charge.\n */\nexport function getResponseType(node: ast.OperationNode): ResponseType | undefined {\n const baseType = getPrimarySuccessContentType(node)\n if (!baseType) return undefined\n\n if (baseType === 'application/json' || baseType.endsWith('+json') || baseType === 'text/json') return undefined\n if (baseType === 'text/event-stream') return 'stream'\n if (baseType.startsWith('text/')) return 'text'\n if (baseType === 'application/octet-stream' || baseType === 'application/pdf' || /^(image|audio|video)\\//.test(baseType)) return 'blob'\n return undefined\n}\n\n/**\n * Maps a content type to the PascalCase suffix used to name per-content-type variants\n * (e.g. `application/json` → `Json`, `application/xml` → `Xml`, `multipart/form-data` → `FormData`).\n */\nfunction getContentTypeSuffix(contentType: string): string {\n const baseType = contentType.split(';')[0]!.trim()\n if (baseType === 'application/json') return 'Json'\n if (baseType === 'multipart/form-data') return 'FormData'\n if (baseType === 'application/x-www-form-urlencoded') return 'FormUrlEncoded'\n const subtype = baseType.split('/').pop() ?? baseType\n const parts = subtype.split(/[^a-zA-Z0-9]+/).filter(Boolean)\n if (parts.length === 0) return 'Unknown'\n return parts.map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join('')\n}\n\n/**\n * Appends a content-type suffix to a base name, keeping a trailing `Data` segment last\n * (e.g. `AddPetData` + `Json` → `AddPetJsonData`, `AddPetStatus200` + `Xml` → `AddPetStatus200Xml`).\n */\nexport function getPerContentTypeName(baseName: string, suffix: string): string {\n if (baseName.endsWith('Data')) {\n return suffix.endsWith('Data') ? baseName.slice(0, -4) + suffix : `${baseName.slice(0, -4)}${suffix}Data`\n }\n return baseName + suffix\n}\n\nexport type ContentVariantInput = { contentType: string; schema?: ast.SchemaNode | null; keysToOmit?: Array<string> | null }\nexport type ContentVariant = { name: string; suffix: string; schema: ast.SchemaNode; keysToOmit?: Array<string> | null; contentType: string }\n\n/**\n * Resolves per-content-type variant names for a set of content entries, deduplicating suffix\n * collisions with a numeric counter. Entries without a schema are skipped. The returned `suffix` is\n * the final (possibly counter-augmented) value, so callers can derive parallel names in another\n * namespace (e.g. plugin-faker deriving the matching plugin-ts type name).\n */\nexport function resolveContentTypeVariants(entries: Array<ContentVariantInput>, baseName: string): Array<ContentVariant> {\n const usedNames = new Set<string>()\n return entries\n .filter((entry) => entry.schema)\n .map((entry) => {\n const baseSuffix = getContentTypeSuffix(entry.contentType)\n let suffix = baseSuffix\n let name = getPerContentTypeName(baseName, suffix)\n let counter = 2\n while (usedNames.has(name)) {\n suffix = `${baseSuffix}${counter++}`\n name = getPerContentTypeName(baseName, suffix)\n }\n usedNames.add(name)\n return { name, suffix, schema: entry.schema!, keysToOmit: entry.keysToOmit, contentType: entry.contentType }\n })\n}\n\nexport function buildRequestConfigType(node: ast.OperationNode): string {\n const request = getContentTypeInfo(node)\n const response = getResponseContentTypeInfo(node)\n // The request groups come from the grouped params, so `config` drops the data-shape keys to stay\n // assignable to `Options`, which omits them from `RequestConfig`.\n const configType = `Partial<Omit<RequestConfig, 'path' | 'query' | 'body' | 'headers' | 'url'>>`\n\n // Only the ambiguous side is offered: a single-type side has nothing to pick, so it stays baked in\n // the generated call.\n const members = [\n request.isMultipleContentTypes ? `request?: ${request.contentTypeUnion}` : null,\n response.isMultipleContentTypes ? `response?: ${response.contentTypeUnion}` : null,\n ].filter(Boolean)\n\n return members.length ? `${configType} & { contentType?: { ${members.join('; ')} } }` : configType\n}\n\n/**\n * Builds the `client?:` option type shared by the generated query hooks (`useQuery`,\n * `useInfiniteQuery`, `useSWR`, ...). Unlike {@link buildRequestConfigType}, it never adds a\n * `contentType?:` member: query hooks wrap GET operations, which carry no request body to select a\n * content type for.\n */\nexport function buildClientOptionType(): string {\n return `Partial<Omit<RequestConfig, 'path' | 'query' | 'body' | 'headers' | 'url'>>`\n}\n\nexport type RequestGroups = {\n path: boolean\n query: boolean\n body: boolean\n headers: boolean\n}\n\n/**\n * Which of the grouped request options an operation carries.\n */\nexport function getRequestGroups(node: ast.OperationNode): RequestGroups {\n const { path, query, header } = getOperationParameters(node)\n return {\n path: path.length > 0,\n query: query.length > 0,\n body: Boolean(node.requestBody?.content?.[0]?.schema),\n headers: header.length > 0,\n }\n}\n\nexport type RequestGroupOptionality = {\n groups: RequestGroups\n hasRequiredPath: boolean\n hasRequiredQuery: boolean\n hasRequiredHeader: boolean\n /**\n * Whether the grouped request parameter can default to `{}`. True only when no group carries a\n * required member, so every member is safe to omit.\n */\n isOptional: boolean\n}\n\n/**\n * Resolves which grouped request options an operation carries together with whether each group\n * holds a required member. The grouped parameter stays optional only when nothing inside it is\n * required, matching the generated `RequestConfig` type.\n */\nexport function getRequestGroupOptionality(node: ast.OperationNode): RequestGroupOptionality {\n const groups = getRequestGroups(node)\n const { path, query, header } = getOperationParameters(node)\n const hasRequiredPath = path.some((param) => param.required)\n const hasRequiredQuery = query.some((param) => param.required)\n const hasRequiredHeader = header.some((param) => param.required)\n\n return {\n groups,\n hasRequiredPath,\n hasRequiredQuery,\n hasRequiredHeader,\n isOptional: !hasRequiredPath && !hasRequiredQuery && !hasRequiredHeader && !groups.body,\n }\n}\n\nexport type RequestOptionsNameResolver = RequestConfigResolver & {\n response: {\n options(node: ast.OperationNode): string\n }\n}\n\n/**\n * Builds the grouped `{ path, query, body, headers }` parameter for a generated client\n * function, typed from the operation's `Options` (minus `url`). Only the groups the\n * operation actually has are destructured. The trailing `config` parameter carries the\n * runtime `RequestConfig` overrides plus `client`.\n */\nexport function buildRequestParamsSignature(\n node: ast.OperationNode,\n resolver: RequestOptionsNameResolver,\n options: { isConfigurable?: boolean } = {},\n): { signature: string; groups: RequestGroups } {\n const { isConfigurable = true } = options\n const { groups, isOptional } = getRequestGroupOptionality(node)\n\n const names = (['path', 'query', 'body', 'headers'] as const).filter((key) => groups[key])\n\n const firstParam = names.length > 0 ? `{ ${names.join(', ')} }: ${resolver.response.options(node)}${isOptional ? ' = {}' : ''}` : null\n const configParam = isConfigurable ? `config: ${buildRequestConfigType(node)} = {}` : null\n\n return {\n signature: [firstParam, configParam].filter(Boolean).join(', '),\n groups,\n }\n}\n\nexport function buildOperationComments(node: ast.OperationNode, options: BuildOperationCommentsOptions = {}): Array<string> {\n const { link = 'pathTemplate', linkPosition = 'afterDeprecated', splitLines = false } = options\n const linkComment = getOperationLink(node, link)\n const comments =\n linkPosition === 'beforeDeprecated'\n ? [node.description && `@description ${node.description}`, node.summary && `@summary ${node.summary}`, linkComment, node.deprecated && '@deprecated']\n : [node.description && `@description ${node.description}`, node.summary && `@summary ${node.summary}`, node.deprecated && '@deprecated', linkComment]\n\n const filteredComments = comments.filter((comment): comment is string => Boolean(comment))\n\n if (!splitLines) {\n return filteredComments\n }\n\n return filteredComments.flatMap((text) => text.split(/\\r?\\n/).map((line) => line.trim())).filter((comment): comment is string => Boolean(comment))\n}\n\nconst operationParameterGroupsByNode = new WeakMap<ast.OperationNode, OperationParameterGroups>()\n\n/**\n * Groups an operation's parameters by location (`path`/`query`/`header`/`cookie`), deduping each\n * group by name. Every plugin generator visiting the same `OperationNode` shares one AST instance\n * (see `KubbDriver`), so the result is cached per node to avoid re-filtering and re-deduping the\n * same parameters once per plugin.\n */\nexport function getOperationParameters(node: ast.OperationNode): OperationParameterGroups {\n const cached = operationParameterGroupsByNode.get(node)\n if (cached) return cached\n\n const groups: OperationParameterGroups = {\n path: dedupeParams(node.parameters.filter((param) => param.in === 'path')),\n query: dedupeParams(node.parameters.filter((param) => param.in === 'query')),\n header: dedupeParams(node.parameters.filter((param) => param.in === 'header')),\n cookie: dedupeParams(node.parameters.filter((param) => param.in === 'cookie')),\n }\n\n operationParameterGroupsByNode.set(node, groups)\n return groups\n}\n\n/**\n * Builds the combined `{ body, path, query, headers }` options object schema for an operation,\n * referencing the already-resolved body and grouped param names. Shared by `@kubb/plugin-ts`'s\n * `Options` type and `@kubb/plugin-zod`'s inferred options schema, so both printers emit the same\n * shape from the same inputs. `primitive: 'object'` is a no-op for the TS printer and tells the Zod\n * printer to emit `z.object(…)` rather than a record.\n */\nexport function buildOptionsSchema(node: ast.OperationNode, resolver: OperationTypeNameResolver): ast.SchemaNode {\n const { path, query, header } = getOperationParameters(node)\n const hasBody = Boolean(node.requestBody?.content?.[0]?.schema)\n const createNever = () => ast.factory.createSchema({ type: 'never', primitive: undefined, optional: true })\n const groups = [\n { name: 'path', params: path, resolve: resolver.param.path },\n { name: 'query', params: query, resolve: resolver.param.query },\n { name: 'headers', params: header, resolve: resolver.param.headers },\n ] as const\n\n // NOTE(v5-stable): the fields were renamed from the legacy beta shape\n // (`data`/`pathParams`/`queryParams`/`headerParams`) to `body`/`path`/`query`/`headers` so the\n // type matches the runtime client. Drop this note once v5 leaves beta.\n return ast.factory.createSchema({\n type: 'object',\n primitive: 'object',\n deprecated: node.deprecated,\n properties: [\n ast.factory.createProperty({\n name: 'body',\n required: hasBody,\n schema: hasBody ? ast.factory.createSchema({ type: 'ref', name: resolver.response.body(node) }) : createNever(),\n }),\n ...groups.map(({ name, params, resolve }) => {\n const required = params.some((param) => param.required)\n\n return ast.factory.createProperty({\n name,\n required,\n schema:\n params.length > 0\n ? ast.factory.createSchema({ type: 'ref', name: resolve.call(resolver.param, node, params[0]!), optional: !required })\n : createNever(),\n })\n }),\n ],\n })\n}\n\n/**\n * The schema a status occupies in the `<Name>Responses` record. A status that documents several\n * content types becomes a `{ contentType; data }` union so the runtime can surface the negotiated type\n * on `result.parsed`, while the standalone `<Name>StatusNNN` alias stays the plain body union that the\n * query hooks and `result.data` use.\n */\nfunction buildResponseRecordEntry(node: ast.OperationNode, res: ast.ResponseNode, resolver: ResponseStatusNameResolver): ast.SchemaNode {\n const statusName = resolver.response.status(node, res.statusCode)\n const variants = (res.content ?? []).filter((entry) => entry.schema)\n if (variants.length <= 1) {\n return ast.factory.createSchema({ type: 'ref', name: statusName })\n }\n\n return ast.factory.createSchema({\n type: 'union',\n members: resolveContentTypeVariants(variants, statusName).map((variant) =>\n ast.factory.createSchema({\n type: 'object',\n primitive: 'object',\n properties: [\n ast.factory.createProperty({\n name: 'contentType',\n required: true,\n schema: ast.factory.createSchema({ type: 'enum', enumValues: [variant.contentType] }),\n }),\n ast.factory.createProperty({\n name: 'data',\n required: true,\n schema: ast.factory.createSchema({ type: 'ref', name: variant.name }),\n }),\n ],\n }),\n ),\n })\n}\n\n/**\n * Builds the per-status `<Name>Responses` record for an operation, referencing the already-resolved\n * `<Name>StatusNNN` names. Shared by `@kubb/plugin-ts`'s `Responses` type and `@kubb/plugin-zod`'s\n * inferred responses schema, so both emit the same shape from the same inputs.\n *\n * Always emits the keyed record, even when an operation declares no responses. An operation with no\n * responses renders as an empty object, which keeps every consumer's import (for example the axios\n * SDK's `RequestResult<XResponses>`) resolvable instead of pointing at a missing export.\n */\nexport function buildResponses(node: ast.OperationNode, resolver: ResponseStatusNameResolver): ast.SchemaNode {\n return ast.factory.createSchema({\n type: 'object',\n primitive: 'object',\n properties: node.responses.map((res) =>\n ast.factory.createProperty({\n name: String(res.statusCode),\n required: true,\n schema: buildResponseRecordEntry(node, res, resolver),\n }),\n ),\n })\n}\n\nexport function getStatusCodeNumber(statusCode: ast.StatusCode | number | string): number | null {\n const code = Number(statusCode)\n\n return Number.isNaN(code) ? null : code\n}\n\nexport function isSuccessStatusCode(statusCode: ast.StatusCode | number | string): boolean {\n const code = getStatusCodeNumber(statusCode)\n\n return code !== null && code >= 200 && code < 300\n}\n\nexport function isErrorStatusCode(statusCode: ast.StatusCode | number | string): boolean {\n const code = getStatusCodeNumber(statusCode)\n\n return code !== null && code >= 400\n}\n\nexport function getSuccessResponses<TResponse extends ResponseLike>(responses: ReadonlyArray<TResponse>): Array<TResponse> {\n return responses.filter((response) => isSuccessStatusCode(response.statusCode))\n}\n\nexport function getOperationSuccessResponses(node: ast.OperationNode): Array<ast.ResponseNode> {\n return getSuccessResponses(node.responses)\n}\n\nexport function getPrimarySuccessResponse(node: ast.OperationNode): ast.ResponseNode | null {\n return getOperationSuccessResponses(node)[0] ?? null\n}\n\nexport function resolveErrorNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses.filter((response) => isErrorStatusCode(response.statusCode)).map((response) => resolver.response.status(node, response.statusCode))\n}\n\nexport function resolveSuccessNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses.filter((response) => isSuccessStatusCode(response.statusCode)).map((response) => resolver.response.status(node, response.statusCode))\n}\n\nexport function resolveStatusCodeNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses.map((response) => resolver.response.status(node, response.statusCode))\n}\n\nconst typeNamesByResolver = new WeakMap<OperationTypeNameResolver, Map<string, string[]>>()\n\nexport function resolveOperationTypeNames(\n node: ast.OperationNode,\n resolver: OperationTypeNameResolver,\n options: ResolveOperationTypeNameOptions = {},\n): string[] {\n const cacheKey = `${node.operationId}\\0${options.order ?? ''}\\0${options.responseStatusNames ?? ''}\\0${options.includeParams === false ? 'noparams' : ''}\\0${(options.exclude ?? []).join(',')}`\n let byResolver = typeNamesByResolver.get(resolver)\n if (byResolver) {\n const cached = byResolver.get(cacheKey)\n if (cached) return cached\n } else {\n byResolver = new Map()\n typeNamesByResolver.set(resolver, byResolver)\n }\n\n const { path, query, header } = getOperationParameters(node)\n const responseStatusNames =\n options.responseStatusNames === 'error'\n ? resolveErrorNames(node, resolver)\n : options.responseStatusNames === false\n ? []\n : resolveStatusCodeNames(node, resolver)\n const exclude = new Set(options.exclude ?? [])\n const paramNames =\n options.includeParams === false\n ? []\n : [\n ...path.map((param) => resolver.param.path(node, param)),\n ...query.map((param) => resolver.param.query(node, param)),\n ...header.map((param) => resolver.param.headers(node, param)),\n ]\n const bodyAndResponseNames = [node.requestBody?.content?.[0]?.schema ? resolver.response.body(node) : null, resolver.response.response(node)]\n const names =\n options.order === 'body-response-first'\n ? [...bodyAndResponseNames, ...paramNames, ...responseStatusNames]\n : [...paramNames, ...bodyAndResponseNames, ...responseStatusNames]\n\n const result = names.filter((name): name is string => Boolean(name) && !exclude.has(name as string))\n byResolver.set(cacheKey, result)\n return result\n}\n\nexport function resolveResponseTypes(node: ast.OperationNode, resolver: ResponseNameResolver): Array<[statusCode: number | 'default', typeName: string]> {\n const types: Array<[number | 'default', string]> = []\n\n for (const response of node.responses) {\n if (response.statusCode === 'default') {\n types.push(['default', resolver.response.response(node)])\n continue\n }\n\n const code = getStatusCodeNumber(response.statusCode)\n if (code === null) {\n continue\n }\n\n types.push([code, isSuccessStatusCode(code) ? resolver.response.response(node) : resolver.response.status(node, response.statusCode)])\n }\n\n return types\n}\n\nexport function findSuccessStatusCode(responses: Array<{ statusCode: ast.StatusCode | number | string }>): ast.StatusCode | null {\n for (const response of responses) {\n if (isSuccessStatusCode(response.statusCode)) {\n return response.statusCode as ast.StatusCode\n }\n }\n\n return null\n}\n","type Options = {\n /**\n * Text prepended before casing is applied.\n */\n prefix?: string\n /**\n * Text appended before casing is applied.\n */\n suffix?: string\n}\n\n/**\n * Shared implementation for camelCase and PascalCase conversion.\n * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)\n * and capitalizes each word according to `pascal`.\n *\n * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.\n */\nfunction toCamelOrPascal(text: string, pascal: boolean): string {\n return text\n .trim()\n .replace(/([a-z\\d])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n .replace(/(\\d)([a-z])/g, '$1 $2')\n .split(/[\\s\\-_./\\\\:]+/)\n .filter(Boolean)\n .map((word, i) => {\n if (word.length > 1 && word === word.toUpperCase()) return word\n const head = i === 0 && !pascal ? word.charAt(0).toLowerCase() : word.charAt(0).toUpperCase()\n return head + word.slice(1)\n })\n .join('')\n .replace(/[^a-zA-Z0-9]/g, '')\n}\n\n/**\n * Converts `text` to camelCase.\n *\n * @example Word boundaries\n * `camelCase('hello-world') // 'helloWorld'`\n *\n * @example With a prefix\n * `camelCase('tag', { prefix: 'create' }) // 'createTag'`\n */\nexport function camelCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false)\n}\n\n/**\n * Converts `text` to PascalCase.\n *\n * @example Word boundaries\n * `pascalCase('hello-world') // 'HelloWorld'`\n *\n * @example With a suffix\n * `pascalCase('tag', { suffix: 'schema' }) // 'TagSchema'`\n */\nexport function pascalCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true)\n}\n\n/**\n * Uppercases only the first character of `text`, leaving the rest untouched.\n * Unlike {@link pascalCase} it never re-splits word boundaries or strips characters.\n *\n * @example\n * `capitalize('getPetById') // 'GetPetById'`\n */\nexport function capitalize(text: string): string {\n return `${text.charAt(0).toUpperCase()}${text.slice(1)}`\n}\n\n/**\n * Converts `text` to snake_case.\n *\n * @example From camelCase\n * `snakeCase('helloWorld') // 'hello_world'`\n *\n * @example From mixed separators\n * `snakeCase('Hello-World') // 'hello_world'`\n */\nexport function snakeCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n const processed = `${prefix} ${text} ${suffix}`.trim()\n return processed\n .replace(/([a-z])([A-Z])/g, '$1_$2')\n .replace(/[\\s\\-.]+/g, '_')\n .replace(/[^a-zA-Z0-9_]/g, '')\n .toLowerCase()\n .split('_')\n .filter(Boolean)\n .join('_')\n}\n\n/**\n * Converts `text` to SCREAMING_SNAKE_CASE.\n *\n * @example From camelCase\n * `screamingSnakeCase('helloWorld') // 'HELLO_WORLD'`\n */\nexport function screamingSnakeCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return snakeCase(text, { prefix, suffix }).toUpperCase()\n}\n","/**\n * JavaScript and Java reserved words.\n * @link https://github.com/jonschlinkert/reserved/blob/master/index.js\n */\nconst reservedWords = new Set([\n 'abstract',\n 'arguments',\n 'boolean',\n 'break',\n 'byte',\n 'case',\n 'catch',\n 'char',\n 'class',\n 'const',\n 'continue',\n 'debugger',\n 'default',\n 'delete',\n 'do',\n 'double',\n 'else',\n 'enum',\n 'eval',\n 'export',\n 'extends',\n 'false',\n 'final',\n 'finally',\n 'float',\n 'for',\n 'function',\n 'goto',\n 'if',\n 'implements',\n 'import',\n 'in',\n 'instanceof',\n 'int',\n 'interface',\n 'let',\n 'long',\n 'native',\n 'new',\n 'null',\n 'package',\n 'private',\n 'protected',\n 'public',\n 'return',\n 'short',\n 'static',\n 'super',\n 'switch',\n 'synchronized',\n 'this',\n 'throw',\n 'throws',\n 'transient',\n 'true',\n 'try',\n 'typeof',\n 'var',\n 'void',\n 'volatile',\n 'while',\n 'with',\n 'yield',\n 'Array',\n 'Date',\n 'hasOwnProperty',\n 'Infinity',\n 'isFinite',\n 'isNaN',\n 'isPrototypeOf',\n 'length',\n 'Math',\n 'name',\n 'NaN',\n 'Number',\n 'Object',\n 'prototype',\n 'String',\n 'toString',\n 'undefined',\n 'valueOf',\n] as const)\n\n/**\n * Returns `true` when `name` is a syntactically valid JavaScript variable name.\n *\n * @example\n * ```ts\n * isValidVarName('status') // true\n * isValidVarName('class') // false (reserved word)\n * isValidVarName('42foo') // false (starts with digit)\n * ```\n */\nexport function isValidVarName(name: string): boolean {\n if (!name || reservedWords.has(name as 'valueOf')) {\n return false\n }\n return isIdentifier(name)\n}\n\n/**\n * Returns `name` when it's a syntactically valid JavaScript variable name,\n * otherwise prefixes it with `_` so the result is a valid identifier.\n *\n * Useful for sanitizing OpenAPI schema names or operation IDs that start with\n * a digit (e.g. `409`, `504AccountCancel`) before using them as exported\n * variable, type, or function names.\n *\n * @example\n * ```ts\n * ensureValidVarName('409') // '_409'\n * ensureValidVarName('504AccountCancel') // '_504AccountCancel'\n * ensureValidVarName('Pet') // 'Pet'\n * ensureValidVarName('class') // '_class'\n * ```\n */\nexport function ensureValidVarName(name: string): string {\n if (!name || isValidVarName(name)) {\n return name\n }\n return `_${name}`\n}\n\n/**\n * Returns `true` when `name` is syntactically a valid identifier, ignoring reserved words.\n *\n * Reserved words and globals (`class`, `name`, `Date`, …) are valid as bare object-literal keys\n * even though they are not valid variable names, so use this (not {@link isValidVarName}) when\n * deciding whether an object key needs quoting.\n *\n * @example\n * ```ts\n * isIdentifier('name') // true\n * isIdentifier('x-total')// false\n * ```\n */\nexport function isIdentifier(name: string): boolean {\n return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name)\n}\n","import { camelCase } from '@internals/utils'\nimport type { Group } from 'kubb/kit'\n\n/**\n * Builds the `group` config a Kubb plugin passes to `ctx.setOptions`, applying the\n * shared default naming so every plugin groups output consistently:\n *\n * - `path` groups use the second path segment (`/pet/findByStatus` → `pet`).\n * - other groups use the camelCased group (`pet store` → `petStore`).\n *\n * A user-provided `group.name` always wins over the default namer, so callers stay in\n * control of their output folders. Returns `null` when grouping is disabled, matching the\n * per-plugin convention.\n *\n * @param group - The user-supplied group option, or `undefined` to disable grouping.\n *\n * @example\n * ```ts\n * createGroupConfig(group) // shared across every plugin\n * ```\n */\nexport function createGroupConfig(group: Group | undefined): Group | null {\n if (!group) {\n return null\n }\n\n const defaultName = (ctx: { group: string }): string => {\n if (group.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n\n return camelCase(ctx.group)\n }\n\n return {\n ...group,\n name: group.name ? group.name : defaultName,\n } satisfies Group\n}\n","import type { ast } from 'kubb/kit'\nimport type { OperationTypeNames } from '../resolveOperationTypes.ts'\nimport type { ReturnTypeOption } from '../types.ts'\n\n/**\n * Builds the `RequestResult` generic arguments for one operation: the per-status responses record\n * plus the per-call `ThrowOnError` flag. `SuccessOf` / `ErrorOf` split the record inside the\n * runtime, so this only names the record and threads `ThrowOnError`.\n *\n * @example\n * `buildRequestResultGenerics({ node, types }) // 'AddPetResponses, ThrowOnError'`\n */\nexport function buildRequestResultGenerics({ node, types }: { node: ast.OperationNode; types: OperationTypeNames }): string {\n return `${types.response.responses(node)}, ThrowOnError`\n}\n\n/**\n * Builds the full return type an operation's function signature uses: `Unwrappable<RequestResult>`\n * for the default `returnType: 'full'`, already a promise so no further wrapping is needed, a plain\n * `Promise<RequestResult>` for the internal `'plain'` shape, or a\n * `Promise` of the runtime's `UnwrappedResult` when `returnType: 'data'` narrows a resolved call\n * down to the bare success body.\n *\n * @example\n * `buildResultType({ node, types, returnType: 'data' }) // 'Promise<UnwrappedResult<AddPetResponses, ThrowOnError>>'`\n */\nexport function buildResultType({ node, types, returnType }: { node: ast.OperationNode; types: OperationTypeNames; returnType: ReturnTypeOption }): string {\n const generics = buildRequestResultGenerics({ node, types })\n if (returnType === 'data') return `Promise<UnwrappedResult<${generics}>>`\n if (returnType === 'plain') return `Promise<RequestResult<${generics}>>`\n return `Unwrappable<RequestResult<${generics}>>`\n}\n","import type { ast } from 'kubb/kit'\nimport type { OperationTypeNames } from '../resolveOperationTypes.ts'\nimport type { ReturnTypeOption } from '../types.ts'\nimport { buildRequestResultGenerics, buildResultType } from './generics.ts'\n\n/**\n * Builds the return statement of a generated operation function. With the default\n * `returnType: 'full'` the runtime call already resolves to `{ data, error, request, response }`.\n * The generated code casts that result to the operation's `RequestResult`, then wraps it with\n * `withUnwrap`, so the caller can `await` it directly or call `.unwrap()` for the bare success\n * body. With `returnType: 'data'` it instead routes the call through the runtime's `unwrapResult`,\n * which narrows the resolved value down to the bare success body the same way `RequestResult`\n * already does, using the plugin default when the call leaves `throwOnError` unset.\n * With `returnType: 'plain'` it returns the runtime call as is, cast to `RequestResult`, with no helper.\n *\n * Cast first, wrap second, for the `'full'` path. That order keeps `withUnwrap`'s generic inferred\n * as `RequestResult` instead of the runtime's own internal result type. Casting an `Unwrappable<A>`\n * straight to `Unwrappable<B>` does not work: the `.then` overload stays pinned to `A`, and `as`\n * rejects that two-generic swap even where `A` and `B` on their own would satisfy it.\n *\n * @example\n * `return withUnwrap(request({ method: 'POST', url: '/pet', ...config }) as Promise<RequestResult<AddPetResponses, ThrowOnError>>)`\n * @example\n * `return unwrapResult(request({ method: 'POST', url: '/pet', ...config }), config.throwOnError ?? false) as Promise<UnwrappedResult<AddPetResponses, ThrowOnError>>`\n * @example\n * `return request({ method: 'POST', url: '/pet', ...config }) as Promise<RequestResult<AddPetResponses, ThrowOnError>>`\n */\nexport function buildReturnStatement({\n node,\n types,\n callConfig,\n returnType,\n throwOnErrorDefault,\n}: {\n node: ast.OperationNode\n types: OperationTypeNames\n callConfig: string\n returnType: ReturnTypeOption\n throwOnErrorDefault: boolean\n}): string {\n if (returnType === 'data') {\n const resultType = buildResultType({ node, types, returnType })\n return `return unwrapResult(request(${callConfig}), config.throwOnError ?? ${throwOnErrorDefault}) as ${resultType}`\n }\n if (returnType === 'plain') {\n return `return request(${callConfig}) as Promise<RequestResult<${buildRequestResultGenerics({ node, types })}>>`\n }\n return `return withUnwrap(request(${callConfig}) as Promise<RequestResult<${buildRequestResultGenerics({ node, types })}>>)`\n}\n","/**\n * A resolved security scheme as emitted on each generated call's `security` array. The runtime calls\n * the configured `auth` resolver with this object and places the returned token: `http` bearer/basic\n * on `Authorization`, `apiKey` under `name` in the header/query/cookie, and `oauth2`/`openIdConnect`\n * as a bearer token.\n */\nexport type Auth = {\n type: 'http' | 'apiKey' | 'oauth2' | 'openIdConnect'\n scheme?: 'bearer' | 'basic'\n name?: string\n in?: 'header' | 'query' | 'cookie'\n}\n\n/**\n * A single OpenAPI security requirement read from the spec: scheme name to the scopes it needs.\n */\ntype SecurityRequirement = Record<string, Array<string>>\n\n/**\n * The slice of an OpenAPI document the security derivation reads: the global `security`, the\n * per-operation `security` under `paths`, and the `securitySchemes` map under `components`. Typed\n * locally so this package stays independent of the OpenAPI adapter.\n */\nexport type SecurityDocument = {\n security?: Array<SecurityRequirement>\n components?: {\n securitySchemes?: Record<string, OasSecurityScheme | { $ref: string } | undefined>\n }\n paths?: Record<string, Record<string, { security?: Array<SecurityRequirement> } | undefined> | undefined>\n}\n\ntype OasSecurityScheme = { type: 'http'; scheme?: string } | { type: 'apiKey'; name?: string; in?: string } | { type: 'oauth2' } | { type: 'openIdConnect' }\n\nfunction serializeAuth(auth: Auth): string {\n const parts = [`type: '${auth.type}'`]\n if (auth.scheme) parts.push(`scheme: '${auth.scheme}'`)\n if (auth.name) parts.push(`name: '${auth.name}'`)\n if (auth.in) parts.push(`in: '${auth.in}'`)\n return `{ ${parts.join(', ')} }`\n}\n\n/**\n * Maps an OpenAPI security scheme to the inline `Auth` object, or `null` when the runtime cannot\n * place it (an unresolved `$ref`, or an `apiKey` without a name or outside `header` / `query` /\n * `cookie`). `http` schemes other than `basic` are treated as bearer.\n */\nexport function resolveSecurityScheme(scheme: OasSecurityScheme | { $ref: string } | undefined): Auth | null {\n if (!scheme || '$ref' in scheme) return null\n if (scheme.type === 'apiKey') {\n if (!scheme.name || (scheme.in !== 'header' && scheme.in !== 'query' && scheme.in !== 'cookie')) return null\n return { type: 'apiKey', name: scheme.name, in: scheme.in }\n }\n if (scheme.type === 'http') return { type: 'http', scheme: scheme.scheme?.toLowerCase() === 'basic' ? 'basic' : 'bearer' }\n if (scheme.type === 'oauth2') return { type: 'oauth2' }\n if (scheme.type === 'openIdConnect') return { type: 'openIdConnect' }\n return null\n}\n\n/**\n * Derives the per-operation security metadata from the OpenAPI document. The operation's own\n * `security` overrides the global `security` (an explicit empty array disables auth), and every\n * referenced scheme is resolved from `components.securitySchemes` into a flat, de-duplicated list of\n * `Auth` objects the runtime walks in order.\n *\n * @example\n * `getOperationSecurity({ document, method: 'POST', path: '/pet' })`\n * `// [{ type: 'http', scheme: 'bearer' }]`\n */\nexport function getOperationSecurity({\n document,\n method,\n path,\n}: {\n document: SecurityDocument | null | undefined\n method: string\n path: string\n}): Array<Auth> | undefined {\n if (!document) return undefined\n\n const operation = document.paths?.[path]?.[method.toLowerCase()]\n const requirements = operation?.security ?? document.security\n if (!requirements?.length) return undefined\n\n const definitions = document.components?.securitySchemes ?? {}\n const security: Array<Auth> = []\n const seen = new Set<string>()\n for (const requirement of requirements) {\n for (const schemeName of Object.keys(requirement)) {\n if (seen.has(schemeName)) continue\n seen.add(schemeName)\n const auth = resolveSecurityScheme(definitions[schemeName])\n if (auth) security.push(auth)\n }\n }\n\n return security.length ? security : undefined\n}\n\n/**\n * Serializes the per-operation security into the literal emitted on each generated call's `security`\n * field. The runtime `resolveAuth` helper walks it, calling the configured `auth` resolver per entry.\n *\n * @example\n * `buildSecurityMetadata({ security: [{ type: 'http', scheme: 'bearer' }] }) // \"[{ type: 'http', scheme: 'bearer' }]\"`\n */\nexport function buildSecurityMetadata({ security }: { security?: Array<Auth> }): string | null {\n if (!security?.length) return null\n return `[${security.map(serializeAuth).join(', ')}]`\n}\n","import type { ast } from 'kubb/kit'\nimport { getRequestGroupOptionality } from '@internals/shared'\nimport { createFunctionParameter, createFunctionParameters, functionPrinter } from '@kubb/plugin-ts'\nimport type { OperationTypeNames } from '../resolveOperationTypes.ts'\nimport type { ReturnTypeOption } from '../types.ts'\nimport { buildResultType } from './generics.ts'\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\n\n/**\n * The pieces of a generated operation function's grouped-options signature.\n */\nexport type GroupedOptionsSignature = {\n /**\n * The single function parameter: `options: Options<<Name>Options, ThrowOnError>`.\n */\n paramsSignature: string\n /**\n * The function return type: `Unwrappable<RequestResult<<Name>Responses, ThrowOnError>>`.\n */\n returnType: string\n /**\n * The function generics. One per-call `ThrowOnError` flag, defaulting to the plugin setting.\n */\n generics: Array<string>\n}\n\n/**\n * Builds the grouped-options signature for one operation: a single `options` object whose `TData`\n * is the `<Name>Options` type, and a `RequestResult` return type keyed to the per-status responses\n * record. There are no positional arguments.\n *\n * The generated file imports `<Name>Options` and `<Name>Responses` and uses them directly, so no\n * per-operation input type has to be emitted. Both names come from `types`, which is `plugin-ts` or\n * `plugin-zod`'s inferred types (see `resolveOperationTypes`).\n */\nexport function buildGroupedOptionsSignature({\n node,\n types,\n returnType,\n throwOnErrorDefault,\n}: {\n node: ast.OperationNode\n types: OperationTypeNames\n returnType: ReturnTypeOption\n throwOnErrorDefault: boolean\n}): GroupedOptionsSignature {\n const optionsName = types.response.options(node)\n const { isOptional } = getRequestGroupOptionality(node)\n\n const paramsSignature =\n declarationPrinter.print(\n createFunctionParameters({\n params: [createFunctionParameter({ name: 'options', type: `Options<${optionsName}, ThrowOnError>`, ...(isOptional ? { default: '{}' } : {}) })],\n }),\n ) ?? ''\n\n return {\n paramsSignature,\n returnType: buildResultType({ node, types, returnType }),\n generics: [`ThrowOnError extends boolean = ${throwOnErrorDefault}`],\n }\n}\n","import { isSuccessStatusCode } from '@internals/shared'\nimport type { ast } from 'kubb/kit'\nimport type { ResolverZod } from '@kubb/plugin-zod'\nimport type { ValidatorOptions } from '../types.ts'\n\n/**\n * Returns `true` when any direction of the validator uses zod (used for dependency checks).\n */\nexport function isValidatorEnabled(validator: ValidatorOptions | undefined): boolean {\n if (!validator) return false\n if (validator === 'zod') return true\n return Boolean(validator.request || validator.response)\n}\n\n/**\n * Returns `'zod'` when request body parsing is enabled, `null` otherwise. The string shorthand\n * `'zod'` validates the response only, so it does not enable request parsing.\n */\nexport function resolveRequestValidator(validator: ValidatorOptions | undefined): 'zod' | null {\n if (!validator || validator === 'zod') return null\n return validator.request ?? null\n}\n\n/**\n * Returns `'zod'` when query-parameters parsing is enabled, `null` otherwise. Only the object form\n * `{ request: 'zod' }` enables it.\n */\nexport function resolveQueryParamsValidator(validator: ValidatorOptions | undefined): 'zod' | null {\n if (!validator || validator === 'zod') return null\n return validator.request ?? null\n}\n\n/**\n * Returns `'zod'` when response parsing is enabled, `null` otherwise. The string shorthand `'zod'`\n * maps to response parsing.\n */\nexport function resolveResponseValidator(validator: ValidatorOptions | undefined): 'zod' | null {\n if (!validator) return null\n if (validator === 'zod') return 'zod'\n return validator.response ?? null\n}\n\n/**\n * The zod validation a generated client applies to a success response body.\n */\nexport type ZodResponseParse = {\n /**\n * The success-only response schema name that the generated code calls `.parse(data)` on.\n */\n expression: string\n /**\n * Schema names the generated file imports from the zod plugin output.\n */\n importNames: Array<string>\n}\n\n/**\n * Resolves the zod expression a generated client validates a success response with. Only success\n * (2xx) bodies reach the parse under the throw-on-error contract, so the success-only\n * `<operation>ResponseSchema` is used; error bodies are never zod-parsed.\n */\nexport function buildZodResponseParse(node: ast.OperationNode, zodResolver: ResolverZod): ZodResponseParse | null {\n const name = zodResolver.response.response(node)\n return name ? { expression: name, importNames: [name] } : null\n}\n\n/**\n * Resolves the zod expression a generated client validates an error body with on the non-throw path.\n * Uses the error-only `<operation>ErrorSchema` (the union of non-2xx statuses); returns `null` when the\n * operation documents no error responses with a schema.\n */\nexport function buildZodErrorParse(node: ast.OperationNode, zodResolver: ResolverZod): ZodResponseParse | null {\n const hasErrorResponse = node.responses.some((res) => !isSuccessStatusCode(res.statusCode) && res.content?.some((entry) => entry.schema))\n if (!hasErrorResponse) return null\n const name = zodResolver.response.error?.(node)\n return name ? { expression: name, importNames: [name] } : null\n}\n","import type { ast } from 'kubb/kit'\nimport type { ResolverZod } from '@kubb/plugin-zod'\nimport type { ValidatorOptions } from '../types.ts'\nimport { buildZodErrorParse, buildZodResponseParse, resolveRequestValidator, resolveResponseValidator } from './validatorOptions.ts'\n\n/**\n * The per-call validator references a generated function wires into its request config. Each hook is\n * the bare schema reference passed to the runtime's `validator.request` / `validator.response` /\n * `validator.error` slot; `client.ts` runs it through `validateStandardSchema`. The response validator\n * only ever sees success (2xx) bodies.\n */\nexport type ValidatorHooks = {\n /**\n * Schema reference for the `validator.request` hook, or `null` when request validation is off.\n */\n request: string | null\n /**\n * Schema reference for the `validator.response` hook, or `null` when response validation is off.\n */\n response: string | null\n /**\n * Schema reference for the `validator.error` hook, or `null` when error validation is off or the\n * operation documents no error responses. The runtime runs this on the error body when a non-2xx\n * call does not throw.\n */\n error: string | null\n /**\n * Zod schema names the generated file imports from the zod plugin output.\n */\n importedZodNames: Array<string>\n}\n\n/**\n * Builds the validator-hook references for one operation. Request validation runs before the send;\n * response validation runs on the success body only. Returns `null` references when the matching\n * direction is disabled or the schema is absent.\n */\nexport function buildValidatorHooks({\n node,\n validator,\n zodResolver,\n}: {\n node: ast.OperationNode\n validator: ValidatorOptions | undefined\n zodResolver: ResolverZod | null | undefined\n}): ValidatorHooks {\n const importedZodNames: Array<string> = []\n\n const hasRequestBody = Boolean(node.requestBody?.content?.[0]?.schema)\n const zodRequestName = zodResolver && resolveRequestValidator(validator) === 'zod' && hasRequestBody ? zodResolver.response.body(node) : null\n const request = zodRequestName ?? null\n if (zodRequestName) importedZodNames.push(zodRequestName)\n\n const responseParse = zodResolver && resolveResponseValidator(validator) === 'zod' ? buildZodResponseParse(node, zodResolver) : null\n const response = responseParse ? responseParse.expression : null\n if (responseParse) importedZodNames.push(...responseParse.importNames)\n\n const errorParse = zodResolver && resolveResponseValidator(validator) === 'zod' ? buildZodErrorParse(node, zodResolver) : null\n const error = errorParse ? errorParse.expression : null\n if (errorParse) importedZodNames.push(...errorParse.importNames)\n\n return { request, response, error, importedZodNames }\n}\n","import { camelCase, isValidVarName } from '@internals/utils'\nimport { ast } from 'kubb/kit'\n\ntype StyledLocation = 'path' | 'query' | 'header' | 'cookie'\n\n/**\n * Renders a parameter name as an object-literal key, quoted when it is not a bare identifier.\n * Path keys are camelCased to match the URL template placeholders. Query, header, and cookie keys\n * keep the spec name, matching the remapped keys the runtime serializes.\n */\nfunction toKey(name: string, location: StyledLocation): string {\n const key = location === 'path' ? camelCase(name) : name\n return isValidVarName(key) ? key : JSON.stringify(key)\n}\n\n/**\n * Serializes one parameter's metadata into a `{ style, explode }` literal, or `null` when the\n * parameter carries neither. Path and query carry the serialization `style`; header and cookie use a\n * fixed style (`simple` and `form`), so only `explode` is emitted for them.\n */\nfunction serializeParameter(parameter: ast.ParameterNode): string | null {\n const parts: Array<string> = []\n if ((parameter.in === 'path' || parameter.in === 'query') && parameter.style) parts.push(`style: '${parameter.style}'`)\n if (parameter.explode !== undefined) parts.push(`explode: ${parameter.explode}`)\n return parts.length > 0 ? `{ ${parts.join(', ')} }` : null\n}\n\n/**\n * Builds the per-operation `styles` literal from the operation's parameters, grouped by location.\n * Path entries are keyed by the camelCased name to match the URL template placeholders; query,\n * header, and cookie entries keep the spec name to match the keys the runtime serializes.\n * Only parameters whose source defines `style` or `explode` are emitted, so calls without\n * serialization metadata keep the runtime defaults and existing output is unchanged. Returns `null`\n * when no parameter carries metadata.\n *\n * @example\n * ```ts\n * // a path param with { style: 'matrix', explode: true } and a query param with { explode: false }\n * buildStyles({ node }) // \"{ path: { id: { style: 'matrix', explode: true } }, query: { tags: { explode: false } } }\"\n * ```\n */\nexport function buildStyles({ node }: { node: ast.OperationNode }): string | null {\n if (!ast.isHttpOperationNode(node)) return null\n\n const groups: Record<StyledLocation, Array<string>> = { path: [], query: [], header: [], cookie: [] }\n\n for (const parameter of node.parameters) {\n const literal = serializeParameter(parameter)\n if (!literal) continue\n groups[parameter.in].push(`${toKey(parameter.name, parameter.in)}: ${literal}`)\n }\n\n const locations = (Object.keys(groups) as Array<StyledLocation>).filter((location) => groups[location].length > 0)\n if (locations.length === 0) return null\n\n return `{ ${locations.map((location) => `${location}: { ${groups[location].join(', ')} }`).join(', ')} }`\n}\n","import { buildOperationComments, getContentTypeInfo, getResponseContentTypeInfo, getResponseType, isEventStream } from '@internals/shared'\nimport { ast } from 'kubb/kit'\nimport type { ResolverZod } from '@kubb/plugin-zod'\nimport { File, Function } from 'kubb/jsx'\nimport type { KubbReactNode } from 'kubb/jsx'\nimport { buildReturnStatement } from '../builders/returnStatement.ts'\nimport { type Auth, buildSecurityMetadata } from '../builders/security.ts'\nimport { buildGroupedOptionsSignature } from '../builders/signature.ts'\nimport { buildStyles } from '../builders/styles.ts'\nimport { buildValidatorHooks } from '../builders/validator.ts'\nimport type { OperationTypeNames } from '../resolveOperationTypes.ts'\nimport type { ReturnTypeOption, ValidatorOptions } from '../types.ts'\n\ntype Props = {\n /**\n * The generated function name.\n */\n name: string\n /**\n * The operation being generated.\n */\n node: ast.OperationNode\n /**\n * The operation type names the signature references, from `plugin-ts` or `plugin-zod`'s inferred\n * types.\n */\n types: OperationTypeNames\n /**\n * Resolver for the zod schema names the validators reference, when `validator` is on.\n */\n zodResolver?: ResolverZod | null\n /**\n * The active validator option, driving the validator-hook wiring.\n */\n validator?: ValidatorOptions\n /**\n * Shape of the value the generated function resolves to.\n */\n returnType: ReturnTypeOption\n throwOnErrorDefault: boolean\n /**\n * Per-operation security, resolved from the spec into inline `Auth` objects and serialized onto the\n * call config's `security` field for the runtime `auth` resolver to consume.\n */\n security?: Array<Auth>\n isExportable?: boolean\n isIndexable?: boolean\n}\n\n/**\n * Renders one client operation: the grouped `<Name>Request` type and the function that forwards a\n * single `options` object to the resolved client and returns the `Unwrappable<RequestResult>`. The\n * type, signature, and call config are built with the AST factory, and only the jsx-renderer emits\n * the source.\n */\nexport function Operation({\n name,\n node,\n types,\n zodResolver,\n validator,\n returnType,\n throwOnErrorDefault,\n security,\n isExportable = true,\n isIndexable = true,\n}: Props): KubbReactNode {\n if (!ast.isHttpOperationNode(node)) return null\n\n const signature = buildGroupedOptionsSignature({ node, types, returnType, throwOnErrorDefault })\n const validators = buildValidatorHooks({ node, validator, zodResolver })\n const securityLiteral = buildSecurityMetadata({ security })\n const stylesLiteral = buildStyles({ node })\n\n const { defaultContentType } = getContentTypeInfo(node)\n const hasRequestBody = Boolean(node.requestBody?.content?.[0]?.schema)\n // Bake the request body content type only when it is not the JSON default. The first declared type is\n // the default for an operation with several request types; the caller overrides it on `contentType`.\n const bakedRequestContentType = hasRequestBody && defaultContentType !== 'application/json' ? defaultContentType : null\n // When the caller can also pick a response content type, a partial `{ response }` would replace the\n // baked request default through `...config`, so merge the caller's choice over it instead.\n const mergeContentType = Boolean(bakedRequestContentType) && getResponseContentTypeInfo(node).isMultipleContentTypes\n const contentTypeLiteral = !bakedRequestContentType\n ? null\n : mergeContentType\n ? `contentType: { request: '${bakedRequestContentType}', ...(typeof contentType === 'string' ? { request: contentType } : contentType) }`\n : `contentType: { request: '${bakedRequestContentType}' }`\n\n const eventStream = isEventStream(node)\n const responseType = getResponseType(node)\n const responseTypeLiteral = responseType ? `responseType: '${responseType}'` : null\n\n const validatorEntries = [\n validators.request ? `request: ${validators.request}` : null,\n validators.response ? `response: ${validators.response}` : null,\n validators.error ? `error: ${validators.error}` : null,\n ].filter(Boolean)\n const validatorLiteral = validatorEntries.length ? `validator: { ${validatorEntries.join(', ')} }` : null\n\n const callConfig = `{ ${[\n `method: '${node.method.toUpperCase()}'`,\n `url: '${node.path}'`,\n securityLiteral ? `security: ${securityLiteral}` : null,\n stylesLiteral ? `styles: ${stylesLiteral}` : null,\n validatorLiteral,\n contentTypeLiteral,\n responseTypeLiteral,\n '...config',\n `throwOnError: config.throwOnError ?? ${throwOnErrorDefault}`,\n ]\n .filter(Boolean)\n .join(', ')} }`\n\n const eventType = `SuccessOf<${types.response.responses(node)}>`\n const functionReturnType = eventStream ? `Promise<EventStreamResult<${eventType}>>` : signature.returnType\n const returnStatement = eventStream\n ? `return toEventStream<${eventType}>(request(${callConfig}))`\n : buildReturnStatement({ node, types, callConfig, returnType, throwOnErrorDefault })\n\n return (\n <File.Source name={name} isExportable={isExportable} isIndexable={isIndexable}>\n <Function\n name={name}\n export={isExportable}\n generics={signature.generics}\n params={signature.paramsSignature}\n returnType={functionReturnType}\n JSDoc={{ comments: buildOperationComments(node, { link: 'urlPath', linkPosition: 'beforeDeprecated', splitLines: true }) }}\n >\n {mergeContentType ? 'const { client: request = client, contentType, ...config } = options' : 'const { client: request = client, ...config } = options'}\n <br />\n {returnStatement}\n </Function>\n </File.Source>\n )\n}\n","import type { ast, Generator, Group, Output, Resolver } from 'kubb/kit'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport type { ContractClientFactory } from './types.ts'\n\ntype GeneratorDriver = Parameters<NonNullable<Generator<ContractClientFactory>['operations']>>[1]['driver']\n\n/**\n * The two per-operation type names a generated client references: the grouped input and the\n * per-status responses record its `RequestResult` is keyed on.\n */\nexport type OperationTypeNames = {\n response: {\n /**\n * Resolves the name of the operation's grouped `{ body, path, query, headers }` input type.\n */\n options(node: ast.OperationNode): string\n /**\n * Resolves the name of the operation's per-status responses record type.\n */\n responses(node: ast.OperationNode): string\n }\n}\n\n/**\n * Where a generated client sources its operation types, plus the resolver and output the file\n * declaring them is resolved with.\n */\nexport type OperationTypeSource = OperationTypeNames & {\n /**\n * Resolver of the plugin supplying the names, used to resolve the file they are exported from.\n */\n resolver: Pick<Resolver, 'file' | 'pluginName'>\n /**\n * The supplying plugin's own `output`, when it configured one.\n */\n output: Output | undefined\n /**\n * The supplying plugin's own `group`, when it configured one.\n */\n group: Group | undefined\n}\n\n/**\n * Warning a client generator reports when neither plugin can supply the operation types, so the\n * pipeline says why nothing was generated instead of silently emitting no files.\n */\nexport const MISSING_OPERATION_TYPES_WARNING =\n 'Skipped: no operation types available. Add `pluginTs()`, or `pluginZod({ inferred: true })` to type the client from its zod schemas.'\n\n/**\n * Picks the plugin a generated client takes its `Options` and `Responses` types from.\n *\n * `plugin-ts` wins whenever it is in the pipeline, so existing configs keep the types they generate\n * today. Without it, `pluginZod({ inferred: true })` takes over: its inferred options and responses\n * types are built from the same shared schemas as the `plugin-ts` ones, so a client typed off\n * `z.infer` carries what the codecs decode to (a `Temporal` instance, a `Date`) rather than the raw\n * wire type. Returns `null` when neither is available, leaving the caller nothing to type against.\n *\n * @example\n * ```ts\n * const types = resolveOperationTypes(ctx.driver)\n * if (!types) return null\n * types.response.options(node) // 'GetPetByIdOptions', or 'GetPetByIdOptionsSchemaType' from zod\n * ```\n */\nexport function resolveOperationTypes(driver: GeneratorDriver): OperationTypeSource | null {\n const pluginTs = driver.getPlugin(pluginTsName)\n\n if (pluginTs) {\n const resolver = driver.getResolver(pluginTsName)\n\n return {\n response: resolver.response,\n resolver,\n output: pluginTs.options?.output,\n group: pluginTs.options?.group,\n }\n }\n\n const pluginZod = driver.getPlugin(pluginZodName)\n\n if (!pluginZod?.options?.inferred) return null\n\n const resolver = driver.getResolver(pluginZodName)\n\n return {\n response: {\n options: resolver.response.options,\n // `response.responses` names the schema; the client needs the type inferred from it.\n responses: (node) => resolver.schema.type(resolver.response.responses(node)),\n },\n resolver,\n output: pluginZod.options.output,\n group: pluginZod.options.group,\n }\n}\n","import path from 'node:path'\nimport { isEventStream, operationFileEntry, resolveDependencyOperationFile } from '@internals/shared'\nimport { ast, defineGenerator } from 'kubb/kit'\nimport type { Generator } from 'kubb/kit'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, jsxRenderer } from 'kubb/jsx'\nimport { buildZodErrorParse, resolveRequestValidator, resolveResponseValidator } from '../builders/validatorOptions.ts'\nimport { getOperationSecurity, type SecurityDocument } from '../builders/security.ts'\nimport { Operation } from '../components/Operation.tsx'\nimport { MISSING_OPERATION_TYPES_WARNING, resolveOperationTypes } from '../resolveOperationTypes.ts'\nimport type { ContractClientFactory } from '../types.ts'\n\n/**\n * Builds the built-in per-operation generator shared by the client plugins (`@kubb/plugin-fetch`,\n * `@kubb/plugin-axios`). Emits one async function per OpenAPI operation using the shared\n * `Operation` component: a grouped `<Name>Request` type and a function that forwards a single\n * `options` object to the bundled `client` and returns the `Unwrappable<RequestResult>`. Only the\n * generator `name` differs between plugins. Every other resolution, import, and rendering step is\n * identical.\n */\nexport function createClientGenerator<TFactory extends ContractClientFactory>(\n name: string,\n resolveClientPath?: (options: TFactory['resolvedOptions'], root: string) => string,\n): Generator<TFactory> {\n return defineGenerator<TFactory>({\n name,\n renderer: jsxRenderer,\n operation(node, ctx) {\n if (!ast.isHttpOperationNode(node)) return null\n\n const { config, driver, resolver, root } = ctx\n const { output, validator, returnType, throwOnErrorDefault, group } = ctx.options\n\n const types = resolveOperationTypes(driver)\n if (!types) {\n ctx.warn(MISSING_OPERATION_TYPES_WARNING)\n return null\n }\n\n const validatorEnabled = resolveResponseValidator(validator) === 'zod' || resolveRequestValidator(validator) === 'zod'\n const pluginZod = validatorEnabled ? driver.getPlugin(pluginZodName) : null\n const zodResolver = pluginZod ? driver.getResolver(pluginZodName) : null\n\n const hasRequestBody = Boolean(node.requestBody?.content?.[0]?.schema)\n const importedTypeNames = [types.response.options(node), types.response.responses(node)]\n\n const importedZodNames = zodResolver\n ? [\n resolveResponseValidator(validator) === 'zod' ? zodResolver.response.response?.(node) : null,\n resolveResponseValidator(validator) === 'zod' ? (buildZodErrorParse(node, zodResolver)?.expression ?? null) : null,\n resolveRequestValidator(validator) === 'zod' && hasRequestBody ? zodResolver.response.body?.(node) : null,\n ].filter((name): name is string => Boolean(name))\n : []\n\n const meta = {\n name: resolver.name(node.operationId),\n file: resolver.file({ ...operationFileEntry(node, node.operationId), root, output, group: group ?? undefined }),\n fileTypes: resolveDependencyOperationFile({\n cache: ctx.cache,\n node,\n resolver: types.resolver,\n root,\n output: types.output ?? output,\n group: types.group,\n }),\n fileZod:\n zodResolver && pluginZod?.options\n ? zodResolver.file({\n ...operationFileEntry(node, node.operationId),\n root,\n output: pluginZod.options.output ?? output,\n group: pluginZod.options?.group ?? undefined,\n })\n : null,\n } as const\n\n const security = getOperationSecurity({\n document: ctx.adapter.document as SecurityDocument | null | undefined,\n method: node.method,\n path: node.path,\n })\n\n // A custom client module is emitted verbatim, so `importPath` is used exactly as configured.\n // The default `.kubb/client.ts` is a file path and is made relative to the operation file.\n const customClientPath = resolveClientPath?.(ctx.options, root)\n const clientPath = customClientPath ?? path.resolve(root, '.kubb/client.ts')\n const clientRoot = customClientPath === undefined ? meta.file.path : undefined\n const eventStream = isEventStream(node)\n\n const clientValueImports = (() => {\n if (eventStream) return ['client', 'toEventStream']\n if (returnType === 'plain') return ['client']\n if (returnType === 'data') return ['client', 'unwrapResult']\n return ['client', 'withUnwrap']\n })()\n\n const clientTypeImports = (() => {\n if (eventStream) return ['Options', 'EventStreamResult', 'SuccessOf']\n if (returnType === 'plain') return ['Options', 'RequestResult']\n if (returnType === 'data') return ['Options', 'UnwrappedResult']\n return ['Options', 'Unwrappable', 'RequestResult']\n })()\n\n return (\n <File\n baseName={meta.file.baseName}\n path={meta.file.path}\n meta={meta.file.meta}\n banner={resolver.default.banner(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n footer={resolver.default.footer(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n >\n <File.Import name={clientValueImports} root={clientRoot} path={clientPath} />\n <File.Import name={clientTypeImports} root={clientRoot} path={clientPath} isTypeOnly />\n\n {meta.fileTypes && importedTypeNames.length > 0 && (\n <File.Import name={Array.from(new Set(importedTypeNames))} root={meta.file.path} path={meta.fileTypes.path} isTypeOnly />\n )}\n\n {meta.fileZod && importedZodNames.length > 0 && <File.Import name={importedZodNames} root={meta.file.path} path={meta.fileZod.path} />}\n\n <Operation\n name={meta.name}\n node={node}\n types={types}\n zodResolver={zodResolver}\n validator={validator}\n returnType={returnType}\n throwOnErrorDefault={throwOnErrorDefault}\n security={security}\n />\n </File>\n )\n },\n })\n}\n","import { macroSimplifyUnion } from 'kubb/kit'\nimport type { ast } from 'kubb/kit'\n\n/**\n * Macros the client plugins apply by default, ahead of any user macros. `macroSimplifyUnion`\n * drops union members a broader scalar already covers, keeping the generated response and error\n * unions tidy. A plugin wires them with `ctx.setMacros([...defaultMacros, ...userMacros])`.\n */\nexport const defaultMacros: ReadonlyArray<ast.Macro> = [macroSimplifyUnion]\n","import { camelCase, ensureValidVarName, pascalCase } from '@internals/utils'\nimport { createResolver } from 'kubb/kit'\nimport type { PluginContractClient } from './types.ts'\n\n/**\n * Default resolver shared by the client plugins. Functions and files inherit the built-in camelCase\n * `name` and `file`; classes and tag groups use PascalCase.\n *\n * @example\n * ```ts\n * resolverClient.name('show pet by id') // 'showPetById'\n * resolverClient.groupName('pet') // 'PetClient'\n * ```\n */\nexport const resolverClient = createResolver<PluginContractClient>({\n pluginName: 'plugin-contract-client',\n className(name) {\n return ensureValidVarName(pascalCase(name))\n },\n groupName(name) {\n return ensureValidVarName(pascalCase(`${name} Client`))\n },\n propertyName(name) {\n return ensureValidVarName(camelCase(name))\n },\n})\n","import { createClientGenerator } from '@internals/client'\nimport type { PluginClient } from '../types.ts'\n\n/**\n * Built-in operation generator for `@kubb/plugin-client`. Emits one async function per OpenAPI\n * operation using the shared `Operation` component: a grouped `<Name>Request` type and a function\n * that forwards a single `options` object to the user-provided client module and returns the `RequestResult`.\n */\nexport const clientGenerator = createClientGenerator<PluginClient>('client', (options) => options.importPath)\n","import { createGroupConfig } from '@internals/shared'\nimport { definePlugin, Resolver } from 'kubb/kit'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { clientGenerator } from './generators/clientGenerator.tsx'\nimport { defaultMacros, resolverClient } from '@internals/client'\nimport type { PluginClient, ResolvedOptions, ResolverClient } from './types.ts'\n\n/**\n * Canonical plugin name for `@kubb/plugin-client`.\n */\nexport const pluginClientName = 'plugin-client' satisfies PluginClient['name']\n\n/**\n * Generates typed operations that call a client module owned by your application.\n * The module at `importPath` must export the runtime helpers and types used by generated operations.\n * Kubb does not copy or inject a transport implementation.\n *\n * @example\n * ```ts\n * pluginClient({ importPath: '../api/client' })\n * ```\n */\nexport const pluginClient = definePlugin<PluginClient>((options) => {\n const {\n output = { path: 'clients', barrel: { type: 'named' } },\n exclude = [],\n include,\n override = [],\n importPath,\n throwOnErrorDefault = true,\n validator = false,\n group,\n resolver: userResolver,\n } = options\n\n const resolved: ResolvedOptions = {\n output,\n exclude,\n include,\n override,\n group: createGroupConfig(group),\n importPath,\n baseURL: undefined,\n throwOnErrorDefault,\n validator,\n returnType: 'plain',\n sdk: undefined,\n resolver: userResolver ? Resolver.merge<ResolverClient>(resolverClient, userResolver) : resolverClient,\n }\n\n return {\n name: pluginClientName,\n options,\n dependencies: [pluginTsName, pluginZodName],\n hooks: {\n 'kubb:plugin:setup'(ctx) {\n if (validator && !ctx.config.plugins?.some((plugin) => plugin.name === pluginZodName)) {\n throw new Error(`${pluginClientName}: \\`validator\\` needs ${pluginZodName}. Add pluginZod() to the plugins or set \\`validator: false\\`.`)\n }\n\n ctx.setOptions(resolved)\n ctx.setResolver(resolved.resolver)\n ctx.setMacros([...defaultMacros, ...(options.macros ?? [])])\n ctx.addGenerator(clientGenerator)\n },\n },\n }\n})\n\nexport default pluginClient\n"],"mappings":";;;;;;;;;;;;;;;;AAUA,SAAgB,aAAa,QAA4D;CACvF,MAAM,uBAAO,IAAI,IAAY;CAE7B,OAAO,OAAO,QAAQ,UAAU;EAC9B,IAAI,KAAK,IAAI,MAAM,IAAI,GAAG,OAAO;EACjC,KAAK,IAAI,MAAM,IAAI;EACnB,OAAO;CACT,CAAC;AACH;;;;;;;;;;;;;;ACJA,SAAgB,mBAAmB,MAAyB,MAAc,UAAyC,OAA2B;CAC5I,OAAO;EACL;EACA;EACA,KAAK,KAAK,KAAK,MAAM;EACrB,MAAM,KAAK;CACb;AACF;;;;;;;;;;;;AAaA,SAAgB,+BAA+B,SAO9B;CACf,MAAM,EAAE,OAAO,MAAM,UAAU,MAAM,QAAQ,UAAU;CAEvD,OAAO,MAAM,WAAW,GAAG,SAAS,WAAW,uBAC7C,SAAS,KAAK;EAAE,GAAG,mBAAmB,MAAM,KAAK,WAAW;EAAG;EAAM;EAAQ,OAAO,SAAS,KAAA;CAAU,CAAC,CAC1G;AACF;AAsHA,SAAS,iBAAiB,MAAyB,MAA2C;CAC5F,IAAI,CAAC,MACH,OAAO;CAGT,IAAI,OAAO,SAAS,YAClB,OAAO,KAAK,IAAI,KAAK;CAGvB,OAAO,KAAK,OAAO,UAAU,IAAI,OAAO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