@kubb/plugin-swr 5.0.0-beta.75 → 5.0.0-beta.76

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.
package/dist/index.cjs CHANGED
@@ -228,6 +228,17 @@ var Url = class Url {
228
228
  return path.replace(/\{([^}]+)\}/g, ":$1");
229
229
  }
230
230
  /**
231
+ * Rewrites OpenAPI placeholder names while keeping the `{...}` braces, so the generated `url`
232
+ * literal aligns with the grouped `path` request option that the runtime client interpolates by
233
+ * key.
234
+ *
235
+ * @example
236
+ * Url.toCasedTemplate('/projects/{project_id}', { casing: 'camelcase' }) // '/projects/{projectId}'
237
+ */
238
+ static toCasedTemplate(path, { casing } = {}) {
239
+ return path.replace(/\{([^}]+)\}/g, (_, name) => `{${transformParam(name, casing)}}`);
240
+ }
241
+ /**
231
242
  * Converts an OpenAPI/Swagger path to a TypeScript template literal string.
232
243
  * `prefix` is prepended inside the literal, `replacer` transforms each parameter name,
233
244
  * and `casing` controls parameter identifier casing.
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["path","declarationPrinter","MutationKey","File","Function","declarationPrinter","File","Function","Type","declarationPrinter","callPrinter","TData","File","Type","Function","getComments","SharedMutationKey","File","Type","declarationPrinter","File","Function","TData","File","Function","getComments","jsxRenderer","ast","pluginTsName","pluginZodName","File","jsxRenderer","ast","pluginTsName","pluginZodName","File","pluginTsName","pluginZodName"],"sources":["../../../internals/utils/src/casing.ts","../../../internals/utils/src/fs.ts","../../../internals/utils/src/reserved.ts","../../../internals/utils/src/url.ts","../../../internals/shared/src/params.ts","../../../internals/shared/src/operation.ts","../../../internals/shared/src/group.ts","../../../internals/client/src/builders/parser.ts","../../../internals/client/src/resolveClient.ts","../../../internals/client/src/resolveClientOperation.ts","../../../internals/tanstack-query/src/components/MutationKey.tsx","../../../internals/tanstack-query/src/utils.ts","../../../internals/tanstack-query/src/components/QueryKey.tsx","../src/components/Mutation.tsx","../src/components/MutationKey.tsx","../src/components/QueryOptions.tsx","../src/components/Query.tsx","../src/generators/mutationGenerator.tsx","../src/generators/queryGenerator.tsx","../src/resolvers/resolverSwr.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 * Converts an OpenAPI/Swagger path to a template literal that reads each parameter off the\n * grouped `path` request option, e.g. `/pet/{petId}` becomes `` `/pet/${path.petId}` ``. Parameter\n * names are camelCased to match the generated `path` type, and `prefix` is prepended inside the\n * literal. Shared by the client and cypress generators that pass a grouped `path` object.\n *\n * @example\n * Url.toGroupedTemplateString('/pet/{petId}') // '`/pet/${path.petId}`'\n */\n static toGroupedTemplateString(path: string, { prefix }: { prefix?: string | null } = {}): string {\n return Url.toTemplateString(path, { prefix, casing: 'camelcase', replacer: (name) => `path.${name}` })\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 { camelCase } from '@internals/utils'\nimport type { ParameterNode } from '@kubb/ast'\n\nconst caseParamsCache = new WeakMap<Array<ParameterNode>, Array<ParameterNode>>()\n\n/**\n * Applies camelCase to parameter names and returns a new array without mutating the input.\n *\n * Run it before handing parameters to schema builders so output property keys get the right casing\n * while `OperationNode.parameters` stays intact for other consumers. When `casing` is unset, the\n * original array is returned unchanged. Results are cached per input array.\n */\nexport function caseParams(params: Array<ParameterNode>, casing: 'camelcase' | undefined): Array<ParameterNode> {\n if (!casing) return params\n\n const cached = caseParamsCache.get(params)\n if (cached) return cached\n\n const result = params.map((param) => ({ ...param, name: camelCase(param.name) }))\n caseParamsCache.set(params, result)\n return result\n}\n\nexport 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 { Url } from '@internals/utils'\nimport { ast, type ResolverFileParams } from '@kubb/core'\nimport { caseParams } from './params.ts'\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\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 * Resolves the type name for an individual parameter.\n *\n * @example Individual path parameter name\n * `resolver.resolveParamName(node, param) // → 'DeletePetPathPetId'`\n */\n resolveParamName(node: ast.OperationNode, param: ast.ParameterNode): string\n /**\n * Resolves the request body type name.\n *\n * @example Request body type name\n * `resolver.resolveDataName(node) // → 'CreatePetData'`\n */\n resolveDataName(node: ast.OperationNode): string\n /**\n * Resolves the grouped path parameters type name.\n * When the return value equals `resolveParamName`, no indexed access is emitted.\n *\n * @example Grouped path params type name\n * `resolver.resolvePathParamsName(node, param) // → 'DeletePetPathParams'`\n */\n resolvePathParamsName(node: ast.OperationNode, param: ast.ParameterNode): string\n /**\n * Resolves the grouped query parameters type name.\n * When the return value equals `resolveParamName`, an inline struct type is emitted instead.\n *\n * @example Grouped query params type name\n * `resolver.resolveQueryParamsName(node, param) // → 'FindPetsByStatusQueryParams'`\n */\n resolveQueryParamsName(node: ast.OperationNode, param: ast.ParameterNode): string\n /**\n * Resolves the grouped header parameters type name.\n * When the return value equals `resolveParamName`, an inline struct type is emitted instead.\n *\n * @example Grouped header params type name\n * `resolver.resolveHeaderParamsName(node, param) // → 'DeletePetHeaderParams'`\n */\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' | 'original'\n responseStatusNames?: boolean | 'error'\n exclude?: ReadonlyArray<string | undefined>\n order?: 'params-first' | 'body-response-first'\n /**\n * Include the individual `PathParams`/`QueryParams`/`HeaderParams` type names. Set to `false`\n * for clients that reference the grouped `RequestConfig` 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 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 */\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 { isMultipleContentTypes, contentTypeUnion } = getContentTypeInfo(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 const contentTypeProp = isMultipleContentTypes ? `contentType?: ${contentTypeUnion}` : null\n\n return contentTypeProp ? `${configType} & { ${contentTypeProp} }` : 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 RequestConfigNameResolver = RequestConfigResolver & {\n resolveRequestConfigName(node: ast.OperationNode): string\n}\n\n/**\n * Builds the grouped `{ path, query, body, headers }` parameter for a generated client\n * function, typed from the operation's `RequestConfig` (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: RequestConfigNameResolver,\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.resolveRequestConfigName(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\nexport function getOperationParameters(node: ast.OperationNode, options: { paramsCasing?: 'camelcase' | 'original' } = {}): OperationParameterGroups {\n const params = caseParams(node.parameters, options.paramsCasing === 'original' ? undefined : 'camelcase')\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\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.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, { 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 options.includeParams === false\n ? []\n : [\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","import type { ast } from '@kubb/core'\nimport type { ResolverZod } from '@kubb/plugin-zod'\nimport type { ParserOptions } from '../types.ts'\n\n/**\n * Returns `true` when any direction of the parser uses zod (used for dependency checks).\n */\nexport function isParserEnabled(parser: ParserOptions | undefined): boolean {\n if (!parser) return false\n if (parser === 'zod') return true\n return Boolean(parser.request || parser.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 resolveRequestParser(parser: ParserOptions | undefined): 'zod' | null {\n if (!parser || parser === 'zod') return null\n return parser.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 resolveQueryParamsParser(parser: ParserOptions | undefined): 'zod' | null {\n if (!parser || parser === 'zod') return null\n return parser.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 resolveResponseParser(parser: ParserOptions | undefined): 'zod' | null {\n if (!parser) return null\n if (parser === 'zod') return 'zod'\n return parser.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.resolveResponseName?.(node)\n return name ? { expression: name, importNames: [name] } : null\n}\n","/**\n * Resolves which client plugin a consumer (react-query, vue-query, swr, mcp) should call for an\n * operation, shared so the selection rules and diagnostics stay in one place.\n *\n * Every client runtime lives in a dedicated client plugin, so a consumer always calls a registered\n * contract client plugin (plugin-fetch or plugin-axios) and never emits its own inline client:\n *\n * - `contract` — a registered contract client plugin owns the `<op>` functions and the consumer\n * imports and calls them.\n * - `error` — no client plugin is registered, several are registered without a selector, or the\n * requested one is missing.\n *\n * The `client` string selects explicitly (`'fetch'` / `'axios'`); when it is unset a lone registered\n * contract client plugin is picked up automatically.\n */\n\n// Canonical plugin names. They mirror the `pluginFetchName` / `pluginAxiosName` consts the plugins\n// export, kept as literals so this internal needs no plugin install deps.\nconst pluginFetchName = 'plugin-fetch'\nconst pluginAxiosName = 'plugin-axios'\n\n/**\n * The client selector accepted by a consumer's `client` option. Both call a registered contract\n * client plugin.\n */\nexport type ClientSelector = 'fetch' | 'axios'\n\n/**\n * The outcome of {@link resolveClient}.\n *\n * - `contract` names the contract client plugin whose `<op>` functions the consumer imports.\n * - `error` carries a setup diagnostic.\n */\nexport type ResolveClientResult = { kind: 'contract'; pluginName: string } | { kind: 'error'; message: string }\n\nconst selectorToPlugin: Record<'fetch' | 'axios', string> = {\n fetch: pluginFetchName,\n axios: pluginAxiosName,\n}\n\n// Every contract client plugin, in auto-detect priority order.\nconst contractPlugins = [pluginFetchName, pluginAxiosName] as const\n\n/**\n * Applies the `client` resolution rules. See the module comment for the strategy shape.\n *\n * @example\n * ```ts\n * resolveClient({ client: 'fetch', pluginNames: ['plugin-ts', 'plugin-fetch'] })\n * // { kind: 'contract', pluginName: 'plugin-fetch' }\n * ```\n *\n * @example\n * ```ts\n * resolveClient({ client: undefined, pluginNames: ['plugin-ts'] })\n * // { kind: 'error', message: 'No client plugin is registered…' }\n * ```\n */\nexport function resolveClient(options: { client: ClientSelector | undefined; pluginNames: ReadonlyArray<string> }): ResolveClientResult {\n const { client, pluginNames } = options\n const has = (name: string) => pluginNames.includes(name)\n\n if (client === 'fetch' || client === 'axios') {\n const pluginName = selectorToPlugin[client]\n if (!has(pluginName)) {\n return {\n kind: 'error',\n message: `\\`client: '${client}'\\` is set but \\`@kubb/plugin-${client}\\` is not registered in \\`plugins\\`. Add it, or drop \\`client\\` to use a different client plugin.`,\n }\n }\n return { kind: 'contract', pluginName }\n }\n\n // `client` unset: auto-detect a lone registered contract client plugin.\n const registered = contractPlugins.filter(has)\n if (registered.length === 1) {\n return { kind: 'contract', pluginName: registered[0]! }\n }\n if (registered.length > 1) {\n return {\n kind: 'error',\n message: `Multiple client plugins are registered (${registered.map((name) => `\\`@kubb/${name}\\``).join(', ')}). Set \\`client: 'fetch' | 'axios'\\` to choose which client the hooks call, or register a single client plugin.`,\n }\n }\n\n return {\n kind: 'error',\n message: 'No client plugin is registered. Add `@kubb/plugin-axios` or `@kubb/plugin-fetch` to `plugins` so the generated code has an HTTP client to call.',\n }\n}\n","import path from 'node:path'\nimport { operationFileEntry } from '@internals/shared'\nimport type { ast, Group, Output } from '@kubb/core'\n\n/**\n * The resolved contract `<op>` for one operation: the generated function name, the file it lives in,\n * and the contract runtime's `.kubb/client.ts` path (where `RequestConfig` / `ResponseErrorConfig`\n * come from).\n */\nexport type ClientOperation = { name: string; path: string; clientPath: string }\n\ntype ClientResolver = {\n resolveName: (name: string) => string\n resolveFile: (entry: ReturnType<typeof operationFileEntry>, options: { root: string; output: Output; group?: Group }) => { path: string }\n}\n\n/**\n * Resolves the contract client `<op>` a consumer (query hook, MCP handler) imports, by looking up\n * the registered contract client plugin's resolver and output. Works for any contract client plugin\n * (plugin-fetch or plugin-axios). Returns `null` when no contract plugin is in play (the inline\n * path). The plugin injects `.kubb/client.ts` at the global output root, the same path consumers\n * read `RequestConfig` / `ResponseErrorConfig` from.\n */\nexport function resolveClientOperation(options: {\n clientPlugin: { pluginName: string } | null\n driver: { getPlugin: (name: string) => unknown; getResolver: (name: string) => unknown }\n node: ast.OperationNode\n root: string\n output: Output\n}): ClientOperation | null {\n const { clientPlugin, driver, node, root, output } = options\n if (!clientPlugin) return null\n\n const resolver = driver.getResolver(clientPlugin.pluginName) as ClientResolver | null | undefined\n if (!resolver) return null\n\n const plugin = driver.getPlugin(clientPlugin.pluginName) as { options?: { output?: Output; group?: Group | null } } | null | undefined\n const file = resolver.resolveFile(operationFileEntry(node, node.operationId), {\n root,\n output: plugin?.options?.output ?? output,\n group: plugin?.options?.group ?? undefined,\n })\n\n return { name: resolver.resolveName(node.operationId), path: file.path, clientPath: path.resolve(root, '.kubb/client.ts') }\n}\n","import { Url } from '@internals/utils'\nimport type { ast } from '@kubb/core'\nimport { createFunctionParameters, functionPrinter } from '@kubb/plugin-ts'\nimport { File, Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport type { Transformer } from '../types.ts'\n\ntype Props = {\n name: string\n node: ast.OperationNode\n transformer: Transformer | null | undefined\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\n\nexport const mutationKeyTransformer: Transformer = ({ node }) => {\n if (!node.path) return []\n return [`{ url: '${Url.toPath(node.path)}' }`]\n}\n\nexport function MutationKey({ name, node, transformer }: Props): KubbReactNode {\n const paramsNode = createFunctionParameters({ params: [] })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n const keys = (transformer ?? mutationKeyTransformer)({ node, casing: 'camelcase' })\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function.Arrow name={name} export params={paramsSignature} singleLine>\n {`[${keys.join(', ')}] as const`}\n </Function.Arrow>\n </File.Source>\n )\n}\n","import { getOperationParameters, getRequestGroupOptionality } from '@internals/shared'\nimport type { ast } from '@kubb/core'\nimport { createFunctionParameter, createFunctionParameters, createObjectBindingPattern, createTypeLiteral } from '@kubb/plugin-ts'\nimport type { FunctionParameterNode, FunctionParametersNode, PluginTs, ResolverTs } from '@kubb/plugin-ts'\n\n/**\n * The grouped request options, ordered for both the destructured signature and the\n * call passed to the underlying client.\n */\nconst requestGroupOrder = ['path', 'query', 'body', 'headers'] as const\n\ntype RequestGroupKey = (typeof requestGroupOrder)[number]\n\n/**\n * Builds the grouped `{ path, query, body, headers }` parameter that mirrors the client\n * function signature. Only the groups the operation carries are emitted, typed from the\n * operation's `RequestConfig`. `keys` narrows the emitted groups, used by the query key which\n * never carries `headers`.\n *\n * By default the whole group is typed as the single `RequestConfig` reference. When\n * `memberTypeWrapper` is set, each group is emitted as its own member typed from the matching\n * `RequestConfig['<group>']` slice and wrapped, used by vue-query to apply\n * `MaybeRefOrGetter` per group.\n */\nexport function buildGroupedRequestParam(\n node: ast.OperationNode,\n options: {\n resolver: ResolverTs\n keys?: ReadonlyArray<RequestGroupKey>\n memberTypeWrapper?: (type: string) => string\n },\n): FunctionParameterNode | null {\n const { resolver, keys = requestGroupOrder, memberTypeWrapper } = options\n const { groups, hasRequiredPath, hasRequiredQuery, hasRequiredHeader } = getRequestGroupOptionality(node)\n const names = keys.filter((key) => groups[key])\n\n if (names.length === 0) {\n return null\n }\n\n const requiredByGroup: Record<RequestGroupKey, boolean> = {\n path: hasRequiredPath,\n query: hasRequiredQuery,\n body: groups.body,\n headers: hasRequiredHeader,\n }\n\n // The grouped object can default to `{}` only when none of the emitted groups is required. The\n // query key narrows `keys`, so optionality is computed over the emitted groups, not all of them.\n const isOptional = names.every((name) => !requiredByGroup[name])\n\n // Drop the groups this binding never destructures (the query key omits `headers`), so a group\n // that is required elsewhere does not leak into a binding that does not carry it.\n const requestConfigName = resolver.resolveRequestConfigName(node)\n const omittedKeys = requestGroupOrder.filter((key) => !keys.includes(key))\n const requestConfigType = omittedKeys.length > 0 ? `Omit<${requestConfigName}, ${omittedKeys.map((key) => `'${key}'`).join(' | ')}>` : requestConfigName\n\n if (memberTypeWrapper) {\n const members = names.map((name) => ({\n name,\n type: memberTypeWrapper(`${requestConfigType}['${name}']`),\n optional: !requiredByGroup[name],\n }))\n\n return createFunctionParameter({\n name: createObjectBindingPattern({ elements: names.map((name) => ({ name })) }),\n type: createTypeLiteral({ members }),\n optional: false,\n ...(isOptional ? { default: '{}' } : {}),\n })\n }\n\n return createFunctionParameter({\n name: createObjectBindingPattern({ elements: names.map((name) => ({ name })) }),\n type: requestConfigType,\n optional: false,\n ...(isOptional ? { default: '{}' } : {}),\n })\n}\n\n/**\n * Builds the shared `({ path, query, body, headers }, config = {})` parameter list for a\n * TanStack query-options function. The leading parameter mirrors the client signature, and the\n * trailing `config` is a partial `RequestConfig` minus the grouped data-shape keys, which are passed\n * explicitly. Framework plugins wrap the result when needed, for example vue-query applies `MaybeRefOrGetter`.\n */\nexport function buildQueryOptionsParams(\n node: ast.OperationNode,\n options: { resolver: ResolverTs; memberTypeWrapper?: (type: string) => string },\n): FunctionParametersNode {\n const { resolver, memberTypeWrapper } = options\n\n const groupedParam = buildGroupedRequestParam(node, { resolver, memberTypeWrapper })\n\n const configParam = createFunctionParameter({\n name: 'config',\n type: `Partial<Omit<RequestConfig, 'path' | 'query' | 'body' | 'headers' | 'url'>>`,\n default: '{}',\n })\n\n return createFunctionParameters({ params: [groupedParam, configParam].filter((param): param is FunctionParameterNode => param !== null) })\n}\n\n/**\n * Builds the call to a client `<op>` function inside a query/mutation hook body. The function takes\n * a single grouped options object, so the operation's request groups are passed as\n * shorthand alongside the spread `config`, with `throwOnError: true` pinned last so a caller's config\n * can't flip the query's error semantics. Queries thread the TanStack `signal`; mutations omit it.\n *\n * @example\n * ```ts\n * buildClientCall(node, { clientName: 'getPetById', signal: true })\n * // getPetById({ path, ...config, signal: config.signal ?? signal, throwOnError: true })\n * ```\n */\nexport function buildClientCall(node: ast.OperationNode, options: { clientName: string; signal?: boolean }): string {\n const { clientName, signal = false } = options\n const { groups } = getRequestGroupOptionality(node)\n const names = requestGroupOrder.filter((key) => groups[key])\n\n const args = ['...config', ...names, signal ? 'signal: config.signal ?? signal' : null, 'throwOnError: true'].filter((part): part is string => part !== null)\n\n return `${clientName}({ ${args.join(', ')} })`\n}\n\nexport function transformName(name: string, type: string, transformers?: { name?: (name: string, type?: string) => string }): string {\n return transformers?.name?.(name, type) || name\n}\n\ntype OverrideEntry<TOptions> = {\n type: string\n pattern: string | RegExp\n options?: Partial<TOptions>\n}\n\nfunction matchesPattern(node: ast.OperationNode, ov: { type: string; pattern: string | RegExp }): boolean {\n const { type, pattern } = ov\n const matches = (value: string) => (typeof pattern === 'string' ? value === pattern : pattern.test(value))\n if (type === 'operationId') return matches(node.operationId)\n if (type === 'tag') return node.tags.some((t) => matches(t))\n if (type === 'path') return node.path !== undefined && matches(node.path)\n if (type === 'method') return node.method !== undefined && matches(node.method)\n return false\n}\n\n/**\n * Resolves per-operation overrides (first matching override wins).\n *\n * @example\n * ```ts\n * const opts = resolveOperationOverrides(node, override)\n * const queryOpts = 'query' in opts ? opts.query : defaultQuery\n * ```\n */\nexport function resolveOperationOverrides<TOptions>(node: ast.OperationNode, override?: ReadonlyArray<OverrideEntry<TOptions>>): Partial<TOptions> {\n if (!override) return {}\n const match = override.find((ov) => matchesPattern(node, ov))\n return match?.options ?? {}\n}\n\ntype ZodSchemaNameResolverLike = {\n resolveResponseName?: (node: ast.OperationNode) => string | undefined\n resolveDataName?: (node: ast.OperationNode) => string | undefined\n resolveQueryParamsName?: (node: ast.OperationNode, param: ast.ParameterNode) => string | undefined\n}\n\ntype ParserOption = false | 'zod' | { request?: 'zod'; response?: 'zod' } | undefined\n\n/**\n * Returns `'zod'` when response-direction parsing is enabled.\n * The string shorthand `'zod'` also enables response parsing.\n */\nexport function resolveResponseParser(parser: ParserOption): 'zod' | null {\n if (!parser) return null\n if (parser === 'zod') return 'zod'\n return parser.response ?? null\n}\n\n/**\n * Returns `'zod'` when request body parsing is enabled.\n * The string shorthand `'zod'` also enables request body parsing (existing behavior).\n */\nexport function resolveRequestParser(parser: ParserOption): '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-params parsing is enabled.\n * Only the object form `{ request: 'zod' }` enables this. `parser: 'zod'` does not.\n */\nexport function resolveQueryParamsParser(parser: ParserOption): 'zod' | null {\n if (!parser || parser === 'zod') return null\n return parser.request ?? null\n}\n\n/**\n * Collects the Zod schema import names for an operation based on the active parser directions.\n *\n * - `parser: 'zod'`: response and request body names (backward-compatible behavior).\n * - `parser: { request: 'zod' }`: request body and query params names.\n * - `parser: { response: 'zod' }`: response name only.\n * - `parser: { request: 'zod', response: 'zod' }`: all three.\n *\n * Returns an empty array when no resolver is provided or `parser` is falsy.\n */\nexport function resolveZodSchemaNames(node: ast.OperationNode, zodResolver: ZodSchemaNameResolverLike | null | undefined, parser: ParserOption): Array<string> {\n if (!zodResolver || !parser) return []\n const { query: queryParams } = getOperationParameters(node, { paramsCasing: 'original' })\n return [\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((n): n is string => Boolean(n))\n}\n\n/**\n * Build QueryKey params as the grouped `{ path, query, body }` object (NO headers, NO config),\n * typed from the operation's `RequestConfig` minus `url`. The query key transformer reads the\n * grouped `path`/`query`/`body` bindings.\n */\nexport function buildQueryKeyParams(node: ast.OperationNode, options: { resolver: PluginTs['resolver'] }): FunctionParametersNode {\n const { resolver } = options\n const groupedParam = buildGroupedRequestParam(node, { resolver, keys: ['path', 'query', 'body'] })\n\n return createFunctionParameters({ params: groupedParam ? [groupedParam] : [] })\n}\n","import { getOperationParameters } from '@internals/shared'\nimport { Url } from '@internals/utils'\nimport type { ast } from '@kubb/core'\nimport type { PluginTs } from '@kubb/plugin-ts'\nimport { functionPrinter } from '@kubb/plugin-ts'\nimport { File, Function, Type } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport type { Transformer } from '../types.ts'\nimport { buildQueryKeyParams } from '../utils.ts'\n\ntype Props = {\n name: string\n typeName: string\n node: ast.OperationNode\n tsResolver: PluginTs['resolver']\n transformer: Transformer | null | undefined\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\n\nexport const queryKeyTransformer: Transformer = ({ node }) => {\n if (!node.path) return []\n const hasPathParams = getOperationParameters(node).path.length > 0\n const hasQueryParams = getOperationParameters(node).query.length > 0\n const hasRequestBody = !!node.requestBody?.content?.[0]?.schema\n\n const urlObject = hasPathParams ? `{ url: '${Url.toPath(node.path)}', params: path }` : `{ url: '${Url.toPath(node.path)}' }`\n\n return [urlObject, hasQueryParams ? '...(query ? [query] : [])' : null, hasRequestBody ? '...(body ? [body] : [])' : null].filter(Boolean) as Array<string>\n}\n\nexport function QueryKey({ name, node, tsResolver, typeName, transformer }: Props): KubbReactNode {\n const paramsNode = buildQueryKeyParams(node, { resolver: tsResolver })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n const keys = (transformer ?? queryKeyTransformer)({ node, casing: 'camelcase' })\n\n return (\n <>\n <File.Source name={name} isExportable isIndexable>\n <Function.Arrow name={name} export params={paramsSignature} singleLine>\n {`[${keys.join(', ')}] as const`}\n </Function.Arrow>\n </File.Source>\n <File.Source name={typeName} isTypeOnly>\n <Type name={typeName}>{`ReturnType<typeof ${name}>`}</Type>\n </File.Source>\n </>\n )\n}\n","import type { ast } from '@kubb/core'\nimport type { FunctionParametersNode, ResolverTs } from '@kubb/plugin-ts'\nimport { createFunctionParameter, createFunctionParameters, functionPrinter } from '@kubb/plugin-ts'\nimport { File, Function, Type } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport { buildGroupedRequestParam, buildClientCall } from '@internals/tanstack-query'\nimport { buildRequestConfigType, getComments, resolveErrorNames } from '../utils.ts'\n\ntype Props = {\n name: string\n clientName: string\n mutationKeyName: string\n mutationKeyTypeName: string\n mutationArgTypeName: string\n node: ast.OperationNode\n tsResolver: ResolverTs\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\nconst callPrinter = functionPrinter({ mode: 'call' })\n\nfunction buildMutationParamsNode(\n node: ast.OperationNode,\n options: {\n mutationKeyTypeName: string\n mutationArgTypeName: string\n resolver: ResolverTs\n },\n): FunctionParametersNode {\n const { mutationKeyTypeName, mutationArgTypeName, resolver } = options\n const responseName = resolver.resolveResponseName(node)\n const errorNames = resolveErrorNames(node, resolver)\n\n const TData = responseName\n const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(' | ') : 'Error'}>`\n\n return createFunctionParameters({\n params: [\n createFunctionParameter({\n name: 'options',\n type: `{\n mutation?: SWRMutationConfiguration<${TData}, ${TError}, ${mutationKeyTypeName} | null, ${mutationArgTypeName}> & { throwOnError?: boolean },\n client?: ${buildRequestConfigType(node)},\n shouldFetch?: boolean,\n}`,\n default: '{}',\n }),\n ],\n })\n}\n\nexport function Mutation({ name, clientName, mutationKeyName, mutationKeyTypeName, mutationArgTypeName, node, tsResolver }: Props): KubbReactNode {\n const responseName = tsResolver.resolveResponseName(node)\n const errorNames = resolveErrorNames(node, tsResolver)\n\n const TData = responseName\n const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(' | ') : 'Error'}>`\n\n const groupedParam = buildGroupedRequestParam(node, { resolver: tsResolver })\n const hasMutationParams = groupedParam !== null\n const groupedParamsNode = createFunctionParameters({ params: groupedParam ? [groupedParam] : [] })\n const argTypeBody = hasMutationParams ? tsResolver.resolveRequestConfigName(node) : ''\n const argBindingStr = hasMutationParams ? (callPrinter.print(groupedParamsNode) ?? '') : ''\n const mutationFnBody = `const { data } = await ${buildClientCall(node, { clientName, signal: false })}\n return data`\n\n const generics = [TData, TError, `${mutationKeyTypeName} | null`, mutationArgTypeName]\n\n const paramsNode = buildMutationParamsNode(node, {\n mutationKeyTypeName,\n mutationArgTypeName,\n resolver: tsResolver,\n })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n\n return (\n <>\n <File.Source name={mutationArgTypeName} isExportable isIndexable isTypeOnly>\n <Type name={mutationArgTypeName} export>\n {hasMutationParams ? argTypeBody : 'never'}\n </Type>\n </File.Source>\n <File.Source name={name} isExportable isIndexable>\n <Function name={name} export params={paramsSignature} JSDoc={{ comments: getComments(node) }}>\n {`\n const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {}\n const mutationKey = ${mutationKeyName}()\n\n return useSWRMutation<${generics.join(', ')}>(\n shouldFetch ? mutationKey : null,\n async (_url${hasMutationParams ? `, { arg: ${argBindingStr} }` : ''}) => {\n ${mutationFnBody}\n },\n mutationOptions\n )\n `}\n </Function>\n </File.Source>\n </>\n )\n}\n","import type { Transformer } from '@internals/tanstack-query'\nimport { MutationKey as SharedMutationKey } from '@internals/tanstack-query'\nimport type { ast } from '@kubb/core'\nimport { File, Type } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\n\ntype Props = {\n name: string\n typeName: string\n node: ast.OperationNode\n transformer: Transformer | undefined\n}\n\nexport function MutationKey({ name, typeName, node, transformer }: Props): KubbReactNode {\n return (\n <>\n <SharedMutationKey name={name} node={node} transformer={transformer} />\n <File.Source name={typeName} isExportable isIndexable isTypeOnly>\n <Type export name={typeName}>{`ReturnType<typeof ${name}>`}</Type>\n </File.Source>\n </>\n )\n}\n","import type { ast } from '@kubb/core'\nimport type { FunctionParametersNode, ResolverTs } from '@kubb/plugin-ts'\nimport { functionPrinter } from '@kubb/plugin-ts'\nimport { File, Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport { buildQueryOptionsParams, buildClientCall } from '@internals/tanstack-query'\n\ntype Props = {\n name: string\n clientName: string\n node: ast.OperationNode\n tsResolver: ResolverTs\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\n\nexport function getQueryOptionsParams(node: ast.OperationNode, options: { resolver: ResolverTs }): FunctionParametersNode {\n return buildQueryOptionsParams(node, options)\n}\n\nexport function QueryOptions({ name, clientName, node, tsResolver }: Props): KubbReactNode {\n const paramsNode = getQueryOptionsParams(node, { resolver: tsResolver })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n const fetcherBody = `const { data } = await ${buildClientCall(node, { clientName, signal: false })}\n return data`\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function name={name} export params={paramsSignature}>\n {`\n return {\n fetcher: async () => {\n ${fetcherBody}\n },\n }\n`}\n </Function>\n </File.Source>\n )\n}\n","import type { ast } from '@kubb/core'\nimport type { FunctionParameterNode, FunctionParametersNode, ResolverTs } from '@kubb/plugin-ts'\nimport { createFunctionParameter, createFunctionParameters, functionPrinter } from '@kubb/plugin-ts'\nimport { File, Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport { buildGroupedRequestParam } from '@internals/tanstack-query'\nimport { buildClientOptionType, buildQueryKeyParams, getComments, resolveErrorNames } from '../utils.ts'\nimport { getQueryOptionsParams } from './QueryOptions.tsx'\n\ntype Props = {\n name: string\n queryOptionsName: string\n queryKeyName: string\n queryKeyTypeName: string\n node: ast.OperationNode\n tsResolver: ResolverTs\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\nconst callPrinter = functionPrinter({ mode: 'call' })\n\nfunction buildQueryParamsNode(\n node: ast.OperationNode,\n options: {\n resolver: ResolverTs\n },\n): FunctionParametersNode {\n const { resolver } = options\n const responseName = resolver.resolveResponseName(node)\n const errorNames = resolveErrorNames(node, resolver)\n\n const TData = responseName\n const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(' | ') : 'Error'}>`\n\n const optionsParam = createFunctionParameter({\n name: 'options',\n type: `{\n query?: SWRConfiguration<${[TData, TError].join(', ')}>,\n client?: ${buildClientOptionType()},\n shouldFetch?: boolean,\n immutable?: boolean\n}`,\n default: '{}',\n })\n\n const groupedParam = buildGroupedRequestParam(node, { resolver })\n\n return createFunctionParameters({ params: [groupedParam, optionsParam].filter((param): param is FunctionParameterNode => param !== null) })\n}\n\nexport function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, node, tsResolver }: Props): KubbReactNode {\n const responseName = tsResolver.resolveResponseName(node)\n const errorNames = resolveErrorNames(node, tsResolver)\n\n const TData = responseName\n const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(' | ') : 'Error'}>`\n const generics = [TData, TError, `${queryKeyTypeName} | null`]\n\n const queryKeyParamsNode = buildQueryKeyParams(node, { resolver: tsResolver })\n const queryKeyParamsCall = callPrinter.print(queryKeyParamsNode) ?? ''\n\n const queryOptionsParamsNode = getQueryOptionsParams(node, { resolver: tsResolver })\n const queryOptionsParamsCall = callPrinter.print(queryOptionsParamsNode) ?? ''\n\n const paramsNode = buildQueryParamsNode(node, { resolver: tsResolver })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function name={name} export params={paramsSignature} JSDoc={{ comments: getComments(node) }}>\n {`\n const { query: queryOptions, client: config = {}, shouldFetch = true, immutable } = options ?? {}\n\n const queryKey = ${queryKeyName}(${queryKeyParamsCall})\n\n return useSWR<${generics.join(', ')}>(\n shouldFetch ? queryKey : null,\n {\n ...${queryOptionsName}(${queryOptionsParamsCall}),\n ...(immutable ? {\n revalidateIfStale: false,\n revalidateOnFocus: false,\n revalidateOnReconnect: false\n } : { }),\n ...queryOptions,\n }\n )\n `}\n </Function>\n </File.Source>\n )\n}\n","import { resolveOperationTypeNames } from '@internals/shared'\nimport { resolveClientOperation } from '@internals/client'\nimport { resolveZodSchemaNames } from '@internals/tanstack-query'\nimport { ast, defineGenerator } from '@kubb/core'\nimport { isParserEnabled } from '@internals/client'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, jsxRenderer } from '@kubb/renderer-jsx'\nimport { Mutation, MutationKey } from '../components'\nimport type { PluginSwr } from '../types'\n\n/**\n * Built-in generator for `useSWRMutation` hooks. Emits one `useFooMutation` hook\n * per POST/PUT/DELETE operation (configurable via `mutation.methods`) plus\n * the matching `fooMutationKey` helper.\n */\nexport const mutationGenerator = defineGenerator<PluginSwr>({\n name: 'swr-mutation',\n renderer: jsxRenderer,\n operation(node, ctx) {\n if (!ast.isHttpOperationNode(node)) return null\n const { config, driver, resolver, root } = ctx\n const { output, query, mutation, parser, client, group } = ctx.options\n\n const pluginTs = driver.getPlugin(pluginTsName)\n if (!pluginTs) return null\n const tsResolver = driver.getResolver(pluginTsName)\n\n const isQuery = query === false || (!!query && query.methods.some((method) => node.method.toLowerCase() === method.toLowerCase()))\n const queryMethods = new Set(query ? query.methods : [])\n const isMutation =\n mutation !== false &&\n !isQuery &&\n (mutation ? mutation.methods : []).some((method) => !queryMethods.has(method) && node.method.toLowerCase() === method.toLowerCase())\n\n if (!isMutation) return null\n\n const importPath = mutation ? mutation.importPath : 'swr/mutation'\n\n // The registered contract client plugin owns the `<op>` the hook imports and calls.\n const contractOp = resolveClientOperation({ clientPlugin: { pluginName: client.pluginName }, driver, node, root, output })\n if (!contractOp) return null\n\n const mutationHookName = resolver.resolveMutationName(node)\n const mutationKeyName = resolver.resolveMutationKeyName(node)\n const mutationKeyTypeName = resolver.resolveMutationKeyTypeName(node)\n const mutationArgTypeName = resolver.resolveMutationArgTypeName(node)\n\n const meta = {\n file: resolver.resolveFile({ name: mutationHookName, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path }, { root, output, group }),\n fileTs: tsResolver.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n { root, output: pluginTs.options?.output ?? output, group: pluginTs.options?.group },\n ),\n }\n\n const importedTypeNames = [\n tsResolver.resolveRequestConfigName(node),\n ...resolveOperationTypeNames(node, tsResolver, { order: 'body-response-first', includeParams: false }),\n ].filter((name): name is string => Boolean(name))\n\n const pluginZod = isParserEnabled(parser) ? driver.getPlugin(pluginZodName) : undefined\n const zodResolver = pluginZod ? driver.getResolver(pluginZodName) : undefined\n const fileZod = zodResolver\n ? zodResolver.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n { root, output: pluginZod?.options?.output ?? output, group: pluginZod?.options?.group },\n )\n : undefined\n const zodSchemaNames = resolveZodSchemaNames(node, zodResolver, parser)\n\n const calledClientName = contractOp.name\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 {fileZod && zodSchemaNames.length > 0 && <File.Import name={zodSchemaNames} root={meta.file.path} path={fileZod.path} />}\n\n <File.Import name={[contractOp.name]} root={meta.file.path} path={contractOp.path} />\n <File.Import name={['RequestConfig', 'ResponseErrorConfig']} root={meta.file.path} path={contractOp.clientPath} isTypeOnly />\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 <MutationKey name={mutationKeyName} typeName={mutationKeyTypeName} node={node} transformer={ctx.options.mutationKey} />\n\n {mutation && (\n <>\n <File.Import name={'useSWRMutation'} path={importPath} />\n <File.Import name={['SWRMutationConfiguration']} path={importPath} isTypeOnly />\n <Mutation\n name={mutationHookName}\n clientName={calledClientName}\n mutationKeyName={mutationKeyName}\n mutationKeyTypeName={mutationKeyTypeName}\n mutationArgTypeName={mutationArgTypeName}\n node={node}\n tsResolver={tsResolver}\n />\n </>\n )}\n </File>\n )\n },\n})\n","import { resolveOperationTypeNames } from '@internals/shared'\nimport { resolveClientOperation } from '@internals/client'\nimport { resolveZodSchemaNames } from '@internals/tanstack-query'\nimport { ast, defineGenerator } from '@kubb/core'\nimport { isParserEnabled } from '@internals/client'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, jsxRenderer } from '@kubb/renderer-jsx'\nimport { Query, QueryKey, QueryOptions } from '../components'\nimport type { PluginSwr } from '../types'\n\nexport const queryGenerator = defineGenerator<PluginSwr>({\n name: 'swr-query',\n renderer: jsxRenderer,\n operation(node, ctx) {\n if (!ast.isHttpOperationNode(node)) return null\n const { config, driver, resolver, root } = ctx\n const { output, query, mutation, parser, client, group } = ctx.options\n\n const pluginTs = driver.getPlugin(pluginTsName)\n if (!pluginTs) return null\n const tsResolver = driver.getResolver(pluginTsName)\n\n const isQuery = query === false || (!!query && query.methods.some((method) => node.method.toLowerCase() === method.toLowerCase()))\n const queryMethods = new Set(query ? query.methods : [])\n const isMutation =\n mutation !== false &&\n !isQuery &&\n (mutation ? mutation.methods : []).some((method) => !queryMethods.has(method) && node.method.toLowerCase() === method.toLowerCase())\n\n if (!isQuery || isMutation) return null\n\n const importPath = query ? query.importPath : 'swr'\n\n // The registered contract client plugin owns the `<op>` the hook imports and calls.\n const contractOp = resolveClientOperation({ clientPlugin: { pluginName: client.pluginName }, driver, node, root, output })\n if (!contractOp) return null\n\n const queryName = resolver.resolveQueryName(node)\n const queryOptionsName = resolver.resolveQueryOptionsName(node)\n const queryKeyName = resolver.resolveQueryKeyName(node)\n const queryKeyTypeName = resolver.resolveQueryKeyTypeName(node)\n\n const meta = {\n file: resolver.resolveFile({ name: queryName, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path }, { root, output, group }),\n fileTs: tsResolver.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n { root, output: pluginTs.options?.output ?? output, group: pluginTs.options?.group },\n ),\n }\n\n const importedTypeNames = [\n tsResolver.resolveRequestConfigName(node),\n ...resolveOperationTypeNames(node, tsResolver, {\n exclude: [queryKeyTypeName],\n order: 'body-response-first',\n includeParams: false,\n }),\n ].filter((name): name is string => Boolean(name))\n\n const pluginZod = isParserEnabled(parser) ? driver.getPlugin(pluginZodName) : undefined\n const zodResolver = pluginZod ? driver.getResolver(pluginZodName) : undefined\n const fileZod = zodResolver\n ? zodResolver.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n { root, output: pluginZod?.options?.output ?? output, group: pluginZod?.options?.group },\n )\n : undefined\n const zodSchemaNames = resolveZodSchemaNames(node, zodResolver, parser)\n\n const calledClientName = contractOp.name\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 {fileZod && zodSchemaNames.length > 0 && <File.Import name={zodSchemaNames} root={meta.file.path} path={fileZod.path} />}\n\n <File.Import name={[contractOp.name]} root={meta.file.path} path={contractOp.path} />\n <File.Import name={['RequestConfig', 'ResponseErrorConfig']} root={meta.file.path} path={contractOp.clientPath} isTypeOnly />\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 <QueryKey name={queryKeyName} typeName={queryKeyTypeName} node={node} tsResolver={tsResolver} transformer={ctx.options.queryKey} />\n\n <QueryOptions name={queryOptionsName} clientName={calledClientName} node={node} tsResolver={tsResolver} />\n\n {query && (\n <>\n <File.Import name={'useSWR'} path={importPath} />\n <File.Import name={['SWRConfiguration']} path={importPath} isTypeOnly />\n <Query\n name={queryName}\n queryOptionsName={queryOptionsName}\n queryKeyName={queryKeyName}\n queryKeyTypeName={queryKeyTypeName}\n node={node}\n tsResolver={tsResolver}\n />\n </>\n )}\n </File>\n )\n },\n})\n","import { camelCase, toFilePath } from '@internals/utils'\nimport { defineResolver } from '@kubb/core'\nimport type { PluginSwr } from '../types.ts'\n\nfunction capitalize(name: string): string {\n return `${name.charAt(0).toUpperCase()}${name.slice(1)}`\n}\n\n/**\n * Naming convention resolver for the SWR plugin.\n *\n * Provides default naming helpers using camelCase for functions and file paths.\n *\n * @example\n * `resolverSwr.default('list pets', 'function') // → 'listPets'`\n */\nexport const resolverSwr = defineResolver<PluginSwr>(() => ({\n name: 'default',\n pluginName: 'plugin-swr',\n default(name, type) {\n return type === 'file' ? toFilePath(name) : 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 resolveQueryName(node) {\n return `use${capitalize(this.resolveName(node.operationId))}`\n },\n resolveMutationName(node) {\n return `use${capitalize(this.resolveName(node.operationId))}`\n },\n resolveQueryOptionsName(node) {\n return `${this.resolveName(node.operationId)}QueryOptions`\n },\n resolveQueryKeyName(node) {\n return `${this.resolveName(node.operationId)}QueryKey`\n },\n resolveMutationKeyName(node) {\n return `${this.resolveName(node.operationId)}MutationKey`\n },\n resolveQueryKeyTypeName(node) {\n return `${capitalize(this.resolveName(node.operationId))}QueryKey`\n },\n resolveMutationKeyTypeName(node) {\n return `${capitalize(this.resolveName(node.operationId))}MutationKey`\n },\n resolveMutationArgTypeName(node) {\n return `${capitalize(this.resolveName(node.operationId))}MutationArg`\n },\n resolveClientName(node) {\n return this.resolveName(node.operationId)\n },\n}))\n","import { createGroupConfig } from '@internals/shared'\nimport { definePlugin } from '@kubb/core'\nimport { isParserEnabled } from '@internals/client'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { resolveClient } from '@internals/client'\nimport { mutationKeyTransformer, queryKeyTransformer } from '@internals/tanstack-query'\nimport { mutationGenerator, queryGenerator } from './generators'\nimport { resolverSwr } from './resolvers/resolverSwr.ts'\nimport type { PluginSwr } from './types.ts'\n\nexport const pluginSwrName = 'plugin-swr' satisfies PluginSwr['name']\n\nexport const pluginSwr = definePlugin<PluginSwr>((options) => {\n const {\n output = { path: 'hooks', barrel: { type: 'named' } },\n group,\n exclude = [],\n include,\n override = [],\n parser = false,\n mutation = {},\n query = {},\n mutationKey = mutationKeyTransformer,\n queryKey = queryKeyTransformer,\n client,\n resolver: userResolver,\n macros: userMacros,\n } = options\n\n const selectedGenerators = [queryGenerator, mutationGenerator].filter((generator): generator is NonNullable<typeof generator> => Boolean(generator))\n\n const groupConfig = createGroupConfig(group) ?? undefined\n\n return {\n name: pluginSwrName,\n options,\n dependencies: [pluginTsName, isParserEnabled(parser) ? pluginZodName : undefined].filter((dependency): dependency is string => Boolean(dependency)),\n hooks: {\n 'kubb:plugin:setup'(ctx) {\n const resolver = userResolver ? { ...resolverSwr, ...userResolver } : resolverSwr\n\n const pluginNames = (ctx.config.plugins ?? []).map((p) => (p as { name?: string }).name).filter((name): name is string => Boolean(name))\n const resolvedClient = resolveClient({ client, pluginNames })\n if (resolvedClient.kind === 'error') {\n throw new Error(resolvedClient.message)\n }\n\n // The hooks always call a registered client plugin's op. The client runtime lives in\n // plugin-axios / plugin-fetch, so nothing is bundled here.\n const resolvedClientDescriptor: PluginSwr['resolvedOptions']['client'] = { kind: 'contract', pluginName: resolvedClient.pluginName }\n\n ctx.setOptions({\n output,\n client: resolvedClientDescriptor,\n queryKey,\n query:\n query === false\n ? false\n : {\n importPath: 'swr',\n methods: ['get'],\n ...query,\n },\n mutationKey,\n mutation:\n mutation === false\n ? false\n : {\n importPath: 'swr/mutation',\n methods: ['post', 'put', 'patch', 'delete'],\n ...mutation,\n },\n parser,\n group: groupConfig,\n exclude,\n include,\n override,\n resolver,\n })\n ctx.setResolver(resolver)\n if (userMacros?.length) {\n ctx.setMacros(userMacros)\n }\n\n ctx.addGenerator(...selectedGenerators)\n },\n },\n }\n})\n\nexport default pluginSwr\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;;;;;;;;;;;;;;;;;;;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W,CAAC,EAAA,CAAG,KAAK,MAAO,EAAwB,IAAI,CAAC,CAAC,QAAQ,SAAyB,QAAQ,IAAI,CAC7E;GAAE,CAAC;GAC5D,IAAI,eAAe,SAAS,SAC1B,MAAM,IAAI,MAAM,eAAe,OAAO;GAKxC,MAAM,2BAAmE;IAAE,MAAM;IAAY,YAAY,eAAe;GAAW;GAEnI,IAAI,WAAW;IACb;IACA,QAAQ;IACR;IACA,OACE,UAAU,QACN,QACA;KACE,YAAY;KACZ,SAAS,CAAC,KAAK;KACf,GAAG;IACL;IACN;IACA,UACE,aAAa,QACT,QACA;KACE,YAAY;KACZ,SAAS;MAAC;MAAQ;MAAO;MAAS;KAAQ;KAC1C,GAAG;IACL;IACN;IACA,OAAO;IACP;IACA;IACA;IACA;GACF,CAAC;GACD,IAAI,YAAY,QAAQ;GACxB,IAAI,YAAY,QACd,IAAI,UAAU,UAAU;GAG1B,IAAI,aAAa,GAAG,kBAAkB;EACxC,EACF;CACF;AACF,CAAC"}
1
+ {"version":3,"file":"index.cjs","names":["path","declarationPrinter","MutationKey","File","Function","declarationPrinter","File","Function","Type","declarationPrinter","callPrinter","TData","File","Type","Function","getComments","SharedMutationKey","File","Type","declarationPrinter","File","Function","TData","File","Function","getComments","jsxRenderer","ast","pluginTsName","pluginZodName","File","jsxRenderer","ast","pluginTsName","pluginZodName","File","pluginTsName","pluginZodName"],"sources":["../../../internals/utils/src/casing.ts","../../../internals/utils/src/fs.ts","../../../internals/utils/src/reserved.ts","../../../internals/utils/src/url.ts","../../../internals/shared/src/params.ts","../../../internals/shared/src/operation.ts","../../../internals/shared/src/group.ts","../../../internals/client/src/builders/parser.ts","../../../internals/client/src/resolveClient.ts","../../../internals/client/src/resolveClientOperation.ts","../../../internals/tanstack-query/src/components/MutationKey.tsx","../../../internals/tanstack-query/src/utils.ts","../../../internals/tanstack-query/src/components/QueryKey.tsx","../src/components/Mutation.tsx","../src/components/MutationKey.tsx","../src/components/QueryOptions.tsx","../src/components/Query.tsx","../src/generators/mutationGenerator.tsx","../src/generators/queryGenerator.tsx","../src/resolvers/resolverSwr.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 * Rewrites OpenAPI placeholder names while keeping the `{...}` braces, so the generated `url`\n * literal aligns with the grouped `path` request option that the runtime client interpolates by\n * key.\n *\n * @example\n * Url.toCasedTemplate('/projects/{project_id}', { casing: 'camelcase' }) // '/projects/{projectId}'\n */\n static toCasedTemplate(path: string, { casing }: { casing?: PathCasing } = {}): string {\n return path.replace(/\\{([^}]+)\\}/g, (_, name: string) => `{${transformParam(name, casing)}}`)\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 * Converts an OpenAPI/Swagger path to a template literal that reads each parameter off the\n * grouped `path` request option, e.g. `/pet/{petId}` becomes `` `/pet/${path.petId}` ``. Parameter\n * names are camelCased to match the generated `path` type, and `prefix` is prepended inside the\n * literal. Shared by the client and cypress generators that pass a grouped `path` object.\n *\n * @example\n * Url.toGroupedTemplateString('/pet/{petId}') // '`/pet/${path.petId}`'\n */\n static toGroupedTemplateString(path: string, { prefix }: { prefix?: string | null } = {}): string {\n return Url.toTemplateString(path, { prefix, casing: 'camelcase', replacer: (name) => `path.${name}` })\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 { camelCase } from '@internals/utils'\nimport type { ParameterNode } from '@kubb/ast'\n\nconst caseParamsCache = new WeakMap<Array<ParameterNode>, Array<ParameterNode>>()\n\n/**\n * Applies camelCase to parameter names and returns a new array without mutating the input.\n *\n * Run it before handing parameters to schema builders so output property keys get the right casing\n * while `OperationNode.parameters` stays intact for other consumers. When `casing` is unset, the\n * original array is returned unchanged. Results are cached per input array.\n */\nexport function caseParams(params: Array<ParameterNode>, casing: 'camelcase' | undefined): Array<ParameterNode> {\n if (!casing) return params\n\n const cached = caseParamsCache.get(params)\n if (cached) return cached\n\n const result = params.map((param) => ({ ...param, name: camelCase(param.name) }))\n caseParamsCache.set(params, result)\n return result\n}\n\nexport 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 { Url } from '@internals/utils'\nimport { ast, type ResolverFileParams } from '@kubb/core'\nimport { caseParams } from './params.ts'\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\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 * Resolves the type name for an individual parameter.\n *\n * @example Individual path parameter name\n * `resolver.resolveParamName(node, param) // → 'DeletePetPathPetId'`\n */\n resolveParamName(node: ast.OperationNode, param: ast.ParameterNode): string\n /**\n * Resolves the request body type name.\n *\n * @example Request body type name\n * `resolver.resolveDataName(node) // → 'CreatePetData'`\n */\n resolveDataName(node: ast.OperationNode): string\n /**\n * Resolves the grouped path parameters type name.\n * When the return value equals `resolveParamName`, no indexed access is emitted.\n *\n * @example Grouped path params type name\n * `resolver.resolvePathParamsName(node, param) // → 'DeletePetPathParams'`\n */\n resolvePathParamsName(node: ast.OperationNode, param: ast.ParameterNode): string\n /**\n * Resolves the grouped query parameters type name.\n * When the return value equals `resolveParamName`, an inline struct type is emitted instead.\n *\n * @example Grouped query params type name\n * `resolver.resolveQueryParamsName(node, param) // → 'FindPetsByStatusQueryParams'`\n */\n resolveQueryParamsName(node: ast.OperationNode, param: ast.ParameterNode): string\n /**\n * Resolves the grouped header parameters type name.\n * When the return value equals `resolveParamName`, an inline struct type is emitted instead.\n *\n * @example Grouped header params type name\n * `resolver.resolveHeaderParamsName(node, param) // → 'DeletePetHeaderParams'`\n */\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' | 'original'\n responseStatusNames?: boolean | 'error'\n exclude?: ReadonlyArray<string | undefined>\n order?: 'params-first' | 'body-response-first'\n /**\n * Include the individual `PathParams`/`QueryParams`/`HeaderParams` type names. Set to `false`\n * for clients that reference the grouped `RequestConfig` 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 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 */\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 { isMultipleContentTypes, contentTypeUnion } = getContentTypeInfo(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 const contentTypeProp = isMultipleContentTypes ? `contentType?: ${contentTypeUnion}` : null\n\n return contentTypeProp ? `${configType} & { ${contentTypeProp} }` : 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 RequestConfigNameResolver = RequestConfigResolver & {\n resolveRequestConfigName(node: ast.OperationNode): string\n}\n\n/**\n * Builds the grouped `{ path, query, body, headers }` parameter for a generated client\n * function, typed from the operation's `RequestConfig` (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: RequestConfigNameResolver,\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.resolveRequestConfigName(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\nexport function getOperationParameters(node: ast.OperationNode, options: { paramsCasing?: 'camelcase' | 'original' } = {}): OperationParameterGroups {\n const params = caseParams(node.parameters, options.paramsCasing === 'original' ? undefined : 'camelcase')\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\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.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, { 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 options.includeParams === false\n ? []\n : [\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","import { isSuccessStatusCode } from '@internals/shared'\nimport type { ast } from '@kubb/core'\nimport type { ResolverZod } from '@kubb/plugin-zod'\nimport type { ParserOptions } from '../types.ts'\n\n/**\n * Returns `true` when any direction of the parser uses zod (used for dependency checks).\n */\nexport function isParserEnabled(parser: ParserOptions | undefined): boolean {\n if (!parser) return false\n if (parser === 'zod') return true\n return Boolean(parser.request || parser.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 resolveRequestParser(parser: ParserOptions | undefined): 'zod' | null {\n if (!parser || parser === 'zod') return null\n return parser.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 resolveQueryParamsParser(parser: ParserOptions | undefined): 'zod' | null {\n if (!parser || parser === 'zod') return null\n return parser.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 resolveResponseParser(parser: ParserOptions | undefined): 'zod' | null {\n if (!parser) return null\n if (parser === 'zod') return 'zod'\n return parser.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.resolveResponseName?.(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.resolveErrorName?.(node)\n return name ? { expression: name, importNames: [name] } : null\n}\n","/**\n * Resolves which client plugin a consumer (react-query, vue-query, swr, mcp) should call for an\n * operation, shared so the selection rules and diagnostics stay in one place.\n *\n * Every client runtime lives in a dedicated client plugin, so a consumer always calls a registered\n * contract client plugin (plugin-fetch or plugin-axios) and never emits its own inline client:\n *\n * - `contract` — a registered contract client plugin owns the `<op>` functions and the consumer\n * imports and calls them.\n * - `error` — no client plugin is registered, several are registered without a selector, or the\n * requested one is missing.\n *\n * The `client` string selects explicitly (`'fetch'` / `'axios'`); when it is unset a lone registered\n * contract client plugin is picked up automatically.\n */\n\n// Canonical plugin names. They mirror the `pluginFetchName` / `pluginAxiosName` consts the plugins\n// export, kept as literals so this internal needs no plugin install deps.\nconst pluginFetchName = 'plugin-fetch'\nconst pluginAxiosName = 'plugin-axios'\n\n/**\n * The client selector accepted by a consumer's `client` option. Both call a registered contract\n * client plugin.\n */\nexport type ClientSelector = 'fetch' | 'axios'\n\n/**\n * The outcome of {@link resolveClient}.\n *\n * - `contract` names the contract client plugin whose `<op>` functions the consumer imports.\n * - `error` carries a setup diagnostic.\n */\nexport type ResolveClientResult = { kind: 'contract'; pluginName: string } | { kind: 'error'; message: string }\n\nconst selectorToPlugin: Record<'fetch' | 'axios', string> = {\n fetch: pluginFetchName,\n axios: pluginAxiosName,\n}\n\n// Every contract client plugin, in auto-detect priority order.\nconst contractPlugins = [pluginFetchName, pluginAxiosName] as const\n\n/**\n * Applies the `client` resolution rules. See the module comment for the strategy shape.\n *\n * @example\n * ```ts\n * resolveClient({ client: 'fetch', pluginNames: ['plugin-ts', 'plugin-fetch'] })\n * // { kind: 'contract', pluginName: 'plugin-fetch' }\n * ```\n *\n * @example\n * ```ts\n * resolveClient({ client: undefined, pluginNames: ['plugin-ts'] })\n * // { kind: 'error', message: 'No client plugin is registered…' }\n * ```\n */\nexport function resolveClient(options: { client: ClientSelector | undefined; pluginNames: ReadonlyArray<string> }): ResolveClientResult {\n const { client, pluginNames } = options\n const has = (name: string) => pluginNames.includes(name)\n\n if (client === 'fetch' || client === 'axios') {\n const pluginName = selectorToPlugin[client]\n if (!has(pluginName)) {\n return {\n kind: 'error',\n message: `\\`client: '${client}'\\` is set but \\`@kubb/plugin-${client}\\` is not registered in \\`plugins\\`. Add it, or drop \\`client\\` to use a different client plugin.`,\n }\n }\n return { kind: 'contract', pluginName }\n }\n\n // `client` unset: auto-detect a lone registered contract client plugin.\n const registered = contractPlugins.filter(has)\n if (registered.length === 1) {\n return { kind: 'contract', pluginName: registered[0]! }\n }\n if (registered.length > 1) {\n return {\n kind: 'error',\n message: `Multiple client plugins are registered (${registered.map((name) => `\\`@kubb/${name}\\``).join(', ')}). Set \\`client: 'fetch' | 'axios'\\` to choose which client the hooks call, or register a single client plugin.`,\n }\n }\n\n return {\n kind: 'error',\n message: 'No client plugin is registered. Add `@kubb/plugin-axios` or `@kubb/plugin-fetch` to `plugins` so the generated code has an HTTP client to call.',\n }\n}\n","import path from 'node:path'\nimport { operationFileEntry } from '@internals/shared'\nimport type { ast, Group, Output } from '@kubb/core'\n\n/**\n * The resolved contract `<op>` for one operation: the generated function name, the file it lives in,\n * and the contract runtime's `.kubb/client.ts` path (where `RequestConfig` / `ResponseErrorConfig`\n * come from).\n */\nexport type ClientOperation = { name: string; path: string; clientPath: string }\n\ntype ClientResolver = {\n resolveName: (name: string) => string\n resolveFile: (entry: ReturnType<typeof operationFileEntry>, options: { root: string; output: Output; group?: Group }) => { path: string }\n}\n\n/**\n * Resolves the contract client `<op>` a consumer (query hook, MCP handler) imports, by looking up\n * the registered contract client plugin's resolver and output. Works for any contract client plugin\n * (plugin-fetch or plugin-axios). Returns `null` when no contract plugin is in play (the inline\n * path). The plugin injects `.kubb/client.ts` at the global output root, the same path consumers\n * read `RequestConfig` / `ResponseErrorConfig` from.\n */\nexport function resolveClientOperation(options: {\n clientPlugin: { pluginName: string } | null\n driver: { getPlugin: (name: string) => unknown; getResolver: (name: string) => unknown }\n node: ast.OperationNode\n root: string\n output: Output\n}): ClientOperation | null {\n const { clientPlugin, driver, node, root, output } = options\n if (!clientPlugin) return null\n\n const resolver = driver.getResolver(clientPlugin.pluginName) as ClientResolver | null | undefined\n if (!resolver) return null\n\n const plugin = driver.getPlugin(clientPlugin.pluginName) as { options?: { output?: Output; group?: Group | null } } | null | undefined\n const file = resolver.resolveFile(operationFileEntry(node, node.operationId), {\n root,\n output: plugin?.options?.output ?? output,\n group: plugin?.options?.group ?? undefined,\n })\n\n return { name: resolver.resolveName(node.operationId), path: file.path, clientPath: path.resolve(root, '.kubb/client.ts') }\n}\n","import { Url } from '@internals/utils'\nimport type { ast } from '@kubb/core'\nimport { createFunctionParameters, functionPrinter } from '@kubb/plugin-ts'\nimport { File, Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport type { Transformer } from '../types.ts'\n\ntype Props = {\n name: string\n node: ast.OperationNode\n transformer: Transformer | null | undefined\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\n\nexport const mutationKeyTransformer: Transformer = ({ node }) => {\n if (!node.path) return []\n return [`{ url: '${Url.toPath(node.path)}' }`]\n}\n\nexport function MutationKey({ name, node, transformer }: Props): KubbReactNode {\n const paramsNode = createFunctionParameters({ params: [] })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n const keys = (transformer ?? mutationKeyTransformer)({ node, casing: 'camelcase' })\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function.Arrow name={name} export params={paramsSignature} singleLine>\n {`[${keys.join(', ')}] as const`}\n </Function.Arrow>\n </File.Source>\n )\n}\n","import { getOperationParameters, getRequestGroupOptionality } from '@internals/shared'\nimport type { ast } from '@kubb/core'\nimport { createFunctionParameter, createFunctionParameters, createObjectBindingPattern, createTypeLiteral } from '@kubb/plugin-ts'\nimport type { FunctionParameterNode, FunctionParametersNode, PluginTs, ResolverTs } from '@kubb/plugin-ts'\n\n/**\n * The grouped request options, ordered for both the destructured signature and the\n * call passed to the underlying client.\n */\nconst requestGroupOrder = ['path', 'query', 'body', 'headers'] as const\n\ntype RequestGroupKey = (typeof requestGroupOrder)[number]\n\n/**\n * Builds the grouped `{ path, query, body, headers }` parameter that mirrors the client\n * function signature. Only the groups the operation carries are emitted, typed from the\n * operation's `RequestConfig`. `keys` narrows the emitted groups, used by the query key which\n * never carries `headers`.\n *\n * By default the whole group is typed as the single `RequestConfig` reference. When\n * `memberTypeWrapper` is set, each group is emitted as its own member typed from the matching\n * `RequestConfig['<group>']` slice and wrapped, used by vue-query to apply\n * `MaybeRefOrGetter` per group.\n */\nexport function buildGroupedRequestParam(\n node: ast.OperationNode,\n options: {\n resolver: ResolverTs\n keys?: ReadonlyArray<RequestGroupKey>\n memberTypeWrapper?: (type: string) => string\n },\n): FunctionParameterNode | null {\n const { resolver, keys = requestGroupOrder, memberTypeWrapper } = options\n const { groups, hasRequiredPath, hasRequiredQuery, hasRequiredHeader } = getRequestGroupOptionality(node)\n const names = keys.filter((key) => groups[key])\n\n if (names.length === 0) {\n return null\n }\n\n const requiredByGroup: Record<RequestGroupKey, boolean> = {\n path: hasRequiredPath,\n query: hasRequiredQuery,\n body: groups.body,\n headers: hasRequiredHeader,\n }\n\n // The grouped object can default to `{}` only when none of the emitted groups is required. The\n // query key narrows `keys`, so optionality is computed over the emitted groups, not all of them.\n const isOptional = names.every((name) => !requiredByGroup[name])\n\n // Drop the groups this binding never destructures (the query key omits `headers`), so a group\n // that is required elsewhere does not leak into a binding that does not carry it.\n const requestConfigName = resolver.resolveRequestConfigName(node)\n const omittedKeys = requestGroupOrder.filter((key) => !keys.includes(key))\n const requestConfigType = omittedKeys.length > 0 ? `Omit<${requestConfigName}, ${omittedKeys.map((key) => `'${key}'`).join(' | ')}>` : requestConfigName\n\n if (memberTypeWrapper) {\n const members = names.map((name) => ({\n name,\n type: memberTypeWrapper(`${requestConfigType}['${name}']`),\n optional: !requiredByGroup[name],\n }))\n\n return createFunctionParameter({\n name: createObjectBindingPattern({ elements: names.map((name) => ({ name })) }),\n type: createTypeLiteral({ members }),\n optional: false,\n ...(isOptional ? { default: '{}' } : {}),\n })\n }\n\n return createFunctionParameter({\n name: createObjectBindingPattern({ elements: names.map((name) => ({ name })) }),\n type: requestConfigType,\n optional: false,\n ...(isOptional ? { default: '{}' } : {}),\n })\n}\n\n/**\n * Builds the shared `({ path, query, body, headers }, config = {})` parameter list for a\n * TanStack query-options function. The leading parameter mirrors the client signature, and the\n * trailing `config` is a partial `RequestConfig` minus the grouped data-shape keys, which are passed\n * explicitly. Framework plugins wrap the result when needed, for example vue-query applies `MaybeRefOrGetter`.\n */\nexport function buildQueryOptionsParams(\n node: ast.OperationNode,\n options: { resolver: ResolverTs; memberTypeWrapper?: (type: string) => string },\n): FunctionParametersNode {\n const { resolver, memberTypeWrapper } = options\n\n const groupedParam = buildGroupedRequestParam(node, { resolver, memberTypeWrapper })\n\n const configParam = createFunctionParameter({\n name: 'config',\n type: `Partial<Omit<RequestConfig, 'path' | 'query' | 'body' | 'headers' | 'url'>>`,\n default: '{}',\n })\n\n return createFunctionParameters({ params: [groupedParam, configParam].filter((param): param is FunctionParameterNode => param !== null) })\n}\n\n/**\n * Builds the call to a client `<op>` function inside a query/mutation hook body. The function takes\n * a single grouped options object, so the operation's request groups are passed as\n * shorthand alongside the spread `config`, with `throwOnError: true` pinned last so a caller's config\n * can't flip the query's error semantics. Queries thread the TanStack `signal`; mutations omit it.\n *\n * @example\n * ```ts\n * buildClientCall(node, { clientName: 'getPetById', signal: true })\n * // getPetById({ path, ...config, signal: config.signal ?? signal, throwOnError: true })\n * ```\n */\nexport function buildClientCall(node: ast.OperationNode, options: { clientName: string; signal?: boolean }): string {\n const { clientName, signal = false } = options\n const { groups } = getRequestGroupOptionality(node)\n const names = requestGroupOrder.filter((key) => groups[key])\n\n const args = ['...config', ...names, signal ? 'signal: config.signal ?? signal' : null, 'throwOnError: true'].filter((part): part is string => part !== null)\n\n return `${clientName}({ ${args.join(', ')} })`\n}\n\nexport function transformName(name: string, type: string, transformers?: { name?: (name: string, type?: string) => string }): string {\n return transformers?.name?.(name, type) || name\n}\n\ntype OverrideEntry<TOptions> = {\n type: string\n pattern: string | RegExp\n options?: Partial<TOptions>\n}\n\nfunction matchesPattern(node: ast.OperationNode, ov: { type: string; pattern: string | RegExp }): boolean {\n const { type, pattern } = ov\n const matches = (value: string) => (typeof pattern === 'string' ? value === pattern : pattern.test(value))\n if (type === 'operationId') return matches(node.operationId)\n if (type === 'tag') return node.tags.some((t) => matches(t))\n if (type === 'path') return node.path !== undefined && matches(node.path)\n if (type === 'method') return node.method !== undefined && matches(node.method)\n return false\n}\n\n/**\n * Resolves per-operation overrides (first matching override wins).\n *\n * @example\n * ```ts\n * const opts = resolveOperationOverrides(node, override)\n * const queryOpts = 'query' in opts ? opts.query : defaultQuery\n * ```\n */\nexport function resolveOperationOverrides<TOptions>(node: ast.OperationNode, override?: ReadonlyArray<OverrideEntry<TOptions>>): Partial<TOptions> {\n if (!override) return {}\n const match = override.find((ov) => matchesPattern(node, ov))\n return match?.options ?? {}\n}\n\ntype ZodSchemaNameResolverLike = {\n resolveResponseName?: (node: ast.OperationNode) => string | undefined\n resolveDataName?: (node: ast.OperationNode) => string | undefined\n resolveQueryParamsName?: (node: ast.OperationNode, param: ast.ParameterNode) => string | undefined\n}\n\ntype ParserOption = false | 'zod' | { request?: 'zod'; response?: 'zod' } | undefined\n\n/**\n * Returns `'zod'` when response-direction parsing is enabled.\n * The string shorthand `'zod'` also enables response parsing.\n */\nexport function resolveResponseParser(parser: ParserOption): 'zod' | null {\n if (!parser) return null\n if (parser === 'zod') return 'zod'\n return parser.response ?? null\n}\n\n/**\n * Returns `'zod'` when request body parsing is enabled.\n * The string shorthand `'zod'` also enables request body parsing (existing behavior).\n */\nexport function resolveRequestParser(parser: ParserOption): '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-params parsing is enabled.\n * Only the object form `{ request: 'zod' }` enables this. `parser: 'zod'` does not.\n */\nexport function resolveQueryParamsParser(parser: ParserOption): 'zod' | null {\n if (!parser || parser === 'zod') return null\n return parser.request ?? null\n}\n\n/**\n * Collects the Zod schema import names for an operation based on the active parser directions.\n *\n * - `parser: 'zod'`: response and request body names (backward-compatible behavior).\n * - `parser: { request: 'zod' }`: request body and query params names.\n * - `parser: { response: 'zod' }`: response name only.\n * - `parser: { request: 'zod', response: 'zod' }`: all three.\n *\n * Returns an empty array when no resolver is provided or `parser` is falsy.\n */\nexport function resolveZodSchemaNames(node: ast.OperationNode, zodResolver: ZodSchemaNameResolverLike | null | undefined, parser: ParserOption): Array<string> {\n if (!zodResolver || !parser) return []\n const { query: queryParams } = getOperationParameters(node, { paramsCasing: 'original' })\n return [\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((n): n is string => Boolean(n))\n}\n\n/**\n * Build QueryKey params as the grouped `{ path, query, body }` object (NO headers, NO config),\n * typed from the operation's `RequestConfig` minus `url`. The query key transformer reads the\n * grouped `path`/`query`/`body` bindings.\n */\nexport function buildQueryKeyParams(node: ast.OperationNode, options: { resolver: PluginTs['resolver'] }): FunctionParametersNode {\n const { resolver } = options\n const groupedParam = buildGroupedRequestParam(node, { resolver, keys: ['path', 'query', 'body'] })\n\n return createFunctionParameters({ params: groupedParam ? [groupedParam] : [] })\n}\n","import { getOperationParameters } from '@internals/shared'\nimport { Url } from '@internals/utils'\nimport type { ast } from '@kubb/core'\nimport type { PluginTs } from '@kubb/plugin-ts'\nimport { functionPrinter } from '@kubb/plugin-ts'\nimport { File, Function, Type } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport type { Transformer } from '../types.ts'\nimport { buildQueryKeyParams } from '../utils.ts'\n\ntype Props = {\n name: string\n typeName: string\n node: ast.OperationNode\n tsResolver: PluginTs['resolver']\n transformer: Transformer | null | undefined\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\n\nexport const queryKeyTransformer: Transformer = ({ node }) => {\n if (!node.path) return []\n const hasPathParams = getOperationParameters(node).path.length > 0\n const hasQueryParams = getOperationParameters(node).query.length > 0\n const hasRequestBody = !!node.requestBody?.content?.[0]?.schema\n\n const urlObject = hasPathParams ? `{ url: '${Url.toPath(node.path)}', params: path }` : `{ url: '${Url.toPath(node.path)}' }`\n\n return [urlObject, hasQueryParams ? '...(query ? [query] : [])' : null, hasRequestBody ? '...(body ? [body] : [])' : null].filter(Boolean) as Array<string>\n}\n\nexport function QueryKey({ name, node, tsResolver, typeName, transformer }: Props): KubbReactNode {\n const paramsNode = buildQueryKeyParams(node, { resolver: tsResolver })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n const keys = (transformer ?? queryKeyTransformer)({ node, casing: 'camelcase' })\n\n return (\n <>\n <File.Source name={name} isExportable isIndexable>\n <Function.Arrow name={name} export params={paramsSignature} singleLine>\n {`[${keys.join(', ')}] as const`}\n </Function.Arrow>\n </File.Source>\n <File.Source name={typeName} isTypeOnly>\n <Type name={typeName}>{`ReturnType<typeof ${name}>`}</Type>\n </File.Source>\n </>\n )\n}\n","import type { ast } from '@kubb/core'\nimport type { FunctionParametersNode, ResolverTs } from '@kubb/plugin-ts'\nimport { createFunctionParameter, createFunctionParameters, functionPrinter } from '@kubb/plugin-ts'\nimport { File, Function, Type } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport { buildGroupedRequestParam, buildClientCall } from '@internals/tanstack-query'\nimport { buildRequestConfigType, getComments, resolveErrorNames } from '../utils.ts'\n\ntype Props = {\n name: string\n clientName: string\n mutationKeyName: string\n mutationKeyTypeName: string\n mutationArgTypeName: string\n node: ast.OperationNode\n tsResolver: ResolverTs\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\nconst callPrinter = functionPrinter({ mode: 'call' })\n\nfunction buildMutationParamsNode(\n node: ast.OperationNode,\n options: {\n mutationKeyTypeName: string\n mutationArgTypeName: string\n resolver: ResolverTs\n },\n): FunctionParametersNode {\n const { mutationKeyTypeName, mutationArgTypeName, resolver } = options\n const responseName = resolver.resolveResponseName(node)\n const errorNames = resolveErrorNames(node, resolver)\n\n const TData = responseName\n const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(' | ') : 'Error'}>`\n\n return createFunctionParameters({\n params: [\n createFunctionParameter({\n name: 'options',\n type: `{\n mutation?: SWRMutationConfiguration<${TData}, ${TError}, ${mutationKeyTypeName} | null, ${mutationArgTypeName}> & { throwOnError?: boolean },\n client?: ${buildRequestConfigType(node)},\n shouldFetch?: boolean,\n}`,\n default: '{}',\n }),\n ],\n })\n}\n\nexport function Mutation({ name, clientName, mutationKeyName, mutationKeyTypeName, mutationArgTypeName, node, tsResolver }: Props): KubbReactNode {\n const responseName = tsResolver.resolveResponseName(node)\n const errorNames = resolveErrorNames(node, tsResolver)\n\n const TData = responseName\n const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(' | ') : 'Error'}>`\n\n const groupedParam = buildGroupedRequestParam(node, { resolver: tsResolver })\n const hasMutationParams = groupedParam !== null\n const groupedParamsNode = createFunctionParameters({ params: groupedParam ? [groupedParam] : [] })\n const argTypeBody = hasMutationParams ? tsResolver.resolveRequestConfigName(node) : ''\n const argBindingStr = hasMutationParams ? (callPrinter.print(groupedParamsNode) ?? '') : ''\n const mutationFnBody = `const { data } = await ${buildClientCall(node, { clientName, signal: false })}\n return data`\n\n const generics = [TData, TError, `${mutationKeyTypeName} | null`, mutationArgTypeName]\n\n const paramsNode = buildMutationParamsNode(node, {\n mutationKeyTypeName,\n mutationArgTypeName,\n resolver: tsResolver,\n })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n\n return (\n <>\n <File.Source name={mutationArgTypeName} isExportable isIndexable isTypeOnly>\n <Type name={mutationArgTypeName} export>\n {hasMutationParams ? argTypeBody : 'never'}\n </Type>\n </File.Source>\n <File.Source name={name} isExportable isIndexable>\n <Function name={name} export params={paramsSignature} JSDoc={{ comments: getComments(node) }}>\n {`\n const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {}\n const mutationKey = ${mutationKeyName}()\n\n return useSWRMutation<${generics.join(', ')}>(\n shouldFetch ? mutationKey : null,\n async (_url${hasMutationParams ? `, { arg: ${argBindingStr} }` : ''}) => {\n ${mutationFnBody}\n },\n mutationOptions\n )\n `}\n </Function>\n </File.Source>\n </>\n )\n}\n","import type { Transformer } from '@internals/tanstack-query'\nimport { MutationKey as SharedMutationKey } from '@internals/tanstack-query'\nimport type { ast } from '@kubb/core'\nimport { File, Type } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\n\ntype Props = {\n name: string\n typeName: string\n node: ast.OperationNode\n transformer: Transformer | undefined\n}\n\nexport function MutationKey({ name, typeName, node, transformer }: Props): KubbReactNode {\n return (\n <>\n <SharedMutationKey name={name} node={node} transformer={transformer} />\n <File.Source name={typeName} isExportable isIndexable isTypeOnly>\n <Type export name={typeName}>{`ReturnType<typeof ${name}>`}</Type>\n </File.Source>\n </>\n )\n}\n","import type { ast } from '@kubb/core'\nimport type { FunctionParametersNode, ResolverTs } from '@kubb/plugin-ts'\nimport { functionPrinter } from '@kubb/plugin-ts'\nimport { File, Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport { buildQueryOptionsParams, buildClientCall } from '@internals/tanstack-query'\n\ntype Props = {\n name: string\n clientName: string\n node: ast.OperationNode\n tsResolver: ResolverTs\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\n\nexport function getQueryOptionsParams(node: ast.OperationNode, options: { resolver: ResolverTs }): FunctionParametersNode {\n return buildQueryOptionsParams(node, options)\n}\n\nexport function QueryOptions({ name, clientName, node, tsResolver }: Props): KubbReactNode {\n const paramsNode = getQueryOptionsParams(node, { resolver: tsResolver })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n const fetcherBody = `const { data } = await ${buildClientCall(node, { clientName, signal: false })}\n return data`\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function name={name} export params={paramsSignature}>\n {`\n return {\n fetcher: async () => {\n ${fetcherBody}\n },\n }\n`}\n </Function>\n </File.Source>\n )\n}\n","import type { ast } from '@kubb/core'\nimport type { FunctionParameterNode, FunctionParametersNode, ResolverTs } from '@kubb/plugin-ts'\nimport { createFunctionParameter, createFunctionParameters, functionPrinter } from '@kubb/plugin-ts'\nimport { File, Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport { buildGroupedRequestParam } from '@internals/tanstack-query'\nimport { buildClientOptionType, buildQueryKeyParams, getComments, resolveErrorNames } from '../utils.ts'\nimport { getQueryOptionsParams } from './QueryOptions.tsx'\n\ntype Props = {\n name: string\n queryOptionsName: string\n queryKeyName: string\n queryKeyTypeName: string\n node: ast.OperationNode\n tsResolver: ResolverTs\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\nconst callPrinter = functionPrinter({ mode: 'call' })\n\nfunction buildQueryParamsNode(\n node: ast.OperationNode,\n options: {\n resolver: ResolverTs\n },\n): FunctionParametersNode {\n const { resolver } = options\n const responseName = resolver.resolveResponseName(node)\n const errorNames = resolveErrorNames(node, resolver)\n\n const TData = responseName\n const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(' | ') : 'Error'}>`\n\n const optionsParam = createFunctionParameter({\n name: 'options',\n type: `{\n query?: SWRConfiguration<${[TData, TError].join(', ')}>,\n client?: ${buildClientOptionType()},\n shouldFetch?: boolean,\n immutable?: boolean\n}`,\n default: '{}',\n })\n\n const groupedParam = buildGroupedRequestParam(node, { resolver })\n\n return createFunctionParameters({ params: [groupedParam, optionsParam].filter((param): param is FunctionParameterNode => param !== null) })\n}\n\nexport function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, node, tsResolver }: Props): KubbReactNode {\n const responseName = tsResolver.resolveResponseName(node)\n const errorNames = resolveErrorNames(node, tsResolver)\n\n const TData = responseName\n const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(' | ') : 'Error'}>`\n const generics = [TData, TError, `${queryKeyTypeName} | null`]\n\n const queryKeyParamsNode = buildQueryKeyParams(node, { resolver: tsResolver })\n const queryKeyParamsCall = callPrinter.print(queryKeyParamsNode) ?? ''\n\n const queryOptionsParamsNode = getQueryOptionsParams(node, { resolver: tsResolver })\n const queryOptionsParamsCall = callPrinter.print(queryOptionsParamsNode) ?? ''\n\n const paramsNode = buildQueryParamsNode(node, { resolver: tsResolver })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function name={name} export params={paramsSignature} JSDoc={{ comments: getComments(node) }}>\n {`\n const { query: queryOptions, client: config = {}, shouldFetch = true, immutable } = options ?? {}\n\n const queryKey = ${queryKeyName}(${queryKeyParamsCall})\n\n return useSWR<${generics.join(', ')}>(\n shouldFetch ? queryKey : null,\n {\n ...${queryOptionsName}(${queryOptionsParamsCall}),\n ...(immutable ? {\n revalidateIfStale: false,\n revalidateOnFocus: false,\n revalidateOnReconnect: false\n } : { }),\n ...queryOptions,\n }\n )\n `}\n </Function>\n </File.Source>\n )\n}\n","import { resolveOperationTypeNames } from '@internals/shared'\nimport { resolveClientOperation } from '@internals/client'\nimport { resolveZodSchemaNames } from '@internals/tanstack-query'\nimport { ast, defineGenerator } from '@kubb/core'\nimport { isParserEnabled } from '@internals/client'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, jsxRenderer } from '@kubb/renderer-jsx'\nimport { Mutation, MutationKey } from '../components'\nimport type { PluginSwr } from '../types'\n\n/**\n * Built-in generator for `useSWRMutation` hooks. Emits one `useFooMutation` hook\n * per POST/PUT/DELETE operation (configurable via `mutation.methods`) plus\n * the matching `fooMutationKey` helper.\n */\nexport const mutationGenerator = defineGenerator<PluginSwr>({\n name: 'swr-mutation',\n renderer: jsxRenderer,\n operation(node, ctx) {\n if (!ast.isHttpOperationNode(node)) return null\n const { config, driver, resolver, root } = ctx\n const { output, query, mutation, parser, client, group } = ctx.options\n\n const pluginTs = driver.getPlugin(pluginTsName)\n if (!pluginTs) return null\n const tsResolver = driver.getResolver(pluginTsName)\n\n const isQuery = query === false || (!!query && query.methods.some((method) => node.method.toLowerCase() === method.toLowerCase()))\n const queryMethods = new Set(query ? query.methods : [])\n const isMutation =\n mutation !== false &&\n !isQuery &&\n (mutation ? mutation.methods : []).some((method) => !queryMethods.has(method) && node.method.toLowerCase() === method.toLowerCase())\n\n if (!isMutation) return null\n\n const importPath = mutation ? mutation.importPath : 'swr/mutation'\n\n // The registered contract client plugin owns the `<op>` the hook imports and calls.\n const contractOp = resolveClientOperation({ clientPlugin: { pluginName: client.pluginName }, driver, node, root, output })\n if (!contractOp) return null\n\n const mutationHookName = resolver.resolveMutationName(node)\n const mutationKeyName = resolver.resolveMutationKeyName(node)\n const mutationKeyTypeName = resolver.resolveMutationKeyTypeName(node)\n const mutationArgTypeName = resolver.resolveMutationArgTypeName(node)\n\n const meta = {\n file: resolver.resolveFile({ name: mutationHookName, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path }, { root, output, group }),\n fileTs: tsResolver.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n { root, output: pluginTs.options?.output ?? output, group: pluginTs.options?.group },\n ),\n }\n\n const importedTypeNames = [\n tsResolver.resolveRequestConfigName(node),\n ...resolveOperationTypeNames(node, tsResolver, { order: 'body-response-first', includeParams: false }),\n ].filter((name): name is string => Boolean(name))\n\n const pluginZod = isParserEnabled(parser) ? driver.getPlugin(pluginZodName) : undefined\n const zodResolver = pluginZod ? driver.getResolver(pluginZodName) : undefined\n const fileZod = zodResolver\n ? zodResolver.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n { root, output: pluginZod?.options?.output ?? output, group: pluginZod?.options?.group },\n )\n : undefined\n const zodSchemaNames = resolveZodSchemaNames(node, zodResolver, parser)\n\n const calledClientName = contractOp.name\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 {fileZod && zodSchemaNames.length > 0 && <File.Import name={zodSchemaNames} root={meta.file.path} path={fileZod.path} />}\n\n <File.Import name={[contractOp.name]} root={meta.file.path} path={contractOp.path} />\n <File.Import name={['RequestConfig', 'ResponseErrorConfig']} root={meta.file.path} path={contractOp.clientPath} isTypeOnly />\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 <MutationKey name={mutationKeyName} typeName={mutationKeyTypeName} node={node} transformer={ctx.options.mutationKey} />\n\n {mutation && (\n <>\n <File.Import name={'useSWRMutation'} path={importPath} />\n <File.Import name={['SWRMutationConfiguration']} path={importPath} isTypeOnly />\n <Mutation\n name={mutationHookName}\n clientName={calledClientName}\n mutationKeyName={mutationKeyName}\n mutationKeyTypeName={mutationKeyTypeName}\n mutationArgTypeName={mutationArgTypeName}\n node={node}\n tsResolver={tsResolver}\n />\n </>\n )}\n </File>\n )\n },\n})\n","import { resolveOperationTypeNames } from '@internals/shared'\nimport { resolveClientOperation } from '@internals/client'\nimport { resolveZodSchemaNames } from '@internals/tanstack-query'\nimport { ast, defineGenerator } from '@kubb/core'\nimport { isParserEnabled } from '@internals/client'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, jsxRenderer } from '@kubb/renderer-jsx'\nimport { Query, QueryKey, QueryOptions } from '../components'\nimport type { PluginSwr } from '../types'\n\nexport const queryGenerator = defineGenerator<PluginSwr>({\n name: 'swr-query',\n renderer: jsxRenderer,\n operation(node, ctx) {\n if (!ast.isHttpOperationNode(node)) return null\n const { config, driver, resolver, root } = ctx\n const { output, query, mutation, parser, client, group } = ctx.options\n\n const pluginTs = driver.getPlugin(pluginTsName)\n if (!pluginTs) return null\n const tsResolver = driver.getResolver(pluginTsName)\n\n const isQuery = query === false || (!!query && query.methods.some((method) => node.method.toLowerCase() === method.toLowerCase()))\n const queryMethods = new Set(query ? query.methods : [])\n const isMutation =\n mutation !== false &&\n !isQuery &&\n (mutation ? mutation.methods : []).some((method) => !queryMethods.has(method) && node.method.toLowerCase() === method.toLowerCase())\n\n if (!isQuery || isMutation) return null\n\n const importPath = query ? query.importPath : 'swr'\n\n // The registered contract client plugin owns the `<op>` the hook imports and calls.\n const contractOp = resolveClientOperation({ clientPlugin: { pluginName: client.pluginName }, driver, node, root, output })\n if (!contractOp) return null\n\n const queryName = resolver.resolveQueryName(node)\n const queryOptionsName = resolver.resolveQueryOptionsName(node)\n const queryKeyName = resolver.resolveQueryKeyName(node)\n const queryKeyTypeName = resolver.resolveQueryKeyTypeName(node)\n\n const meta = {\n file: resolver.resolveFile({ name: queryName, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path }, { root, output, group }),\n fileTs: tsResolver.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n { root, output: pluginTs.options?.output ?? output, group: pluginTs.options?.group },\n ),\n }\n\n const importedTypeNames = [\n tsResolver.resolveRequestConfigName(node),\n ...resolveOperationTypeNames(node, tsResolver, {\n exclude: [queryKeyTypeName],\n order: 'body-response-first',\n includeParams: false,\n }),\n ].filter((name): name is string => Boolean(name))\n\n const pluginZod = isParserEnabled(parser) ? driver.getPlugin(pluginZodName) : undefined\n const zodResolver = pluginZod ? driver.getResolver(pluginZodName) : undefined\n const fileZod = zodResolver\n ? zodResolver.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n { root, output: pluginZod?.options?.output ?? output, group: pluginZod?.options?.group },\n )\n : undefined\n const zodSchemaNames = resolveZodSchemaNames(node, zodResolver, parser)\n\n const calledClientName = contractOp.name\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 {fileZod && zodSchemaNames.length > 0 && <File.Import name={zodSchemaNames} root={meta.file.path} path={fileZod.path} />}\n\n <File.Import name={[contractOp.name]} root={meta.file.path} path={contractOp.path} />\n <File.Import name={['RequestConfig', 'ResponseErrorConfig']} root={meta.file.path} path={contractOp.clientPath} isTypeOnly />\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 <QueryKey name={queryKeyName} typeName={queryKeyTypeName} node={node} tsResolver={tsResolver} transformer={ctx.options.queryKey} />\n\n <QueryOptions name={queryOptionsName} clientName={calledClientName} node={node} tsResolver={tsResolver} />\n\n {query && (\n <>\n <File.Import name={'useSWR'} path={importPath} />\n <File.Import name={['SWRConfiguration']} path={importPath} isTypeOnly />\n <Query\n name={queryName}\n queryOptionsName={queryOptionsName}\n queryKeyName={queryKeyName}\n queryKeyTypeName={queryKeyTypeName}\n node={node}\n tsResolver={tsResolver}\n />\n </>\n )}\n </File>\n )\n },\n})\n","import { camelCase, toFilePath } from '@internals/utils'\nimport { defineResolver } from '@kubb/core'\nimport type { PluginSwr } from '../types.ts'\n\nfunction capitalize(name: string): string {\n return `${name.charAt(0).toUpperCase()}${name.slice(1)}`\n}\n\n/**\n * Naming convention resolver for the SWR plugin.\n *\n * Provides default naming helpers using camelCase for functions and file paths.\n *\n * @example\n * `resolverSwr.default('list pets', 'function') // → 'listPets'`\n */\nexport const resolverSwr = defineResolver<PluginSwr>(() => ({\n name: 'default',\n pluginName: 'plugin-swr',\n default(name, type) {\n return type === 'file' ? toFilePath(name) : 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 resolveQueryName(node) {\n return `use${capitalize(this.resolveName(node.operationId))}`\n },\n resolveMutationName(node) {\n return `use${capitalize(this.resolveName(node.operationId))}`\n },\n resolveQueryOptionsName(node) {\n return `${this.resolveName(node.operationId)}QueryOptions`\n },\n resolveQueryKeyName(node) {\n return `${this.resolveName(node.operationId)}QueryKey`\n },\n resolveMutationKeyName(node) {\n return `${this.resolveName(node.operationId)}MutationKey`\n },\n resolveQueryKeyTypeName(node) {\n return `${capitalize(this.resolveName(node.operationId))}QueryKey`\n },\n resolveMutationKeyTypeName(node) {\n return `${capitalize(this.resolveName(node.operationId))}MutationKey`\n },\n resolveMutationArgTypeName(node) {\n return `${capitalize(this.resolveName(node.operationId))}MutationArg`\n },\n resolveClientName(node) {\n return this.resolveName(node.operationId)\n },\n}))\n","import { createGroupConfig } from '@internals/shared'\nimport { definePlugin } from '@kubb/core'\nimport { isParserEnabled } from '@internals/client'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { resolveClient } from '@internals/client'\nimport { mutationKeyTransformer, queryKeyTransformer } from '@internals/tanstack-query'\nimport { mutationGenerator, queryGenerator } from './generators'\nimport { resolverSwr } from './resolvers/resolverSwr.ts'\nimport type { PluginSwr } from './types.ts'\n\nexport const pluginSwrName = 'plugin-swr' satisfies PluginSwr['name']\n\nexport const pluginSwr = definePlugin<PluginSwr>((options) => {\n const {\n output = { path: 'hooks', barrel: { type: 'named' } },\n group,\n exclude = [],\n include,\n override = [],\n parser = false,\n mutation = {},\n query = {},\n mutationKey = mutationKeyTransformer,\n queryKey = queryKeyTransformer,\n client,\n resolver: userResolver,\n macros: userMacros,\n } = options\n\n const selectedGenerators = [queryGenerator, mutationGenerator].filter((generator): generator is NonNullable<typeof generator> => Boolean(generator))\n\n const groupConfig = createGroupConfig(group) ?? undefined\n\n return {\n name: pluginSwrName,\n options,\n dependencies: [pluginTsName, isParserEnabled(parser) ? pluginZodName : undefined].filter((dependency): dependency is string => Boolean(dependency)),\n hooks: {\n 'kubb:plugin:setup'(ctx) {\n const resolver = userResolver ? { ...resolverSwr, ...userResolver } : resolverSwr\n\n const pluginNames = (ctx.config.plugins ?? []).map((p) => (p as { name?: string }).name).filter((name): name is string => Boolean(name))\n const resolvedClient = resolveClient({ client, pluginNames })\n if (resolvedClient.kind === 'error') {\n throw new Error(resolvedClient.message)\n }\n\n // The hooks always call a registered client plugin's op. The client runtime lives in\n // plugin-axios / plugin-fetch, so nothing is bundled here.\n const resolvedClientDescriptor: PluginSwr['resolvedOptions']['client'] = { kind: 'contract', pluginName: resolvedClient.pluginName }\n\n ctx.setOptions({\n output,\n client: resolvedClientDescriptor,\n queryKey,\n query:\n query === false\n ? false\n : {\n importPath: 'swr',\n methods: ['get'],\n ...query,\n },\n mutationKey,\n mutation:\n mutation === false\n ? false\n : {\n importPath: 'swr/mutation',\n methods: ['post', 'put', 'patch', 'delete'],\n ...mutation,\n },\n parser,\n group: groupConfig,\n exclude,\n include,\n override,\n resolver,\n })\n ctx.setResolver(resolver)\n if (userMacros?.length) {\n ctx.setMacros(userMacros)\n }\n\n ctx.addGenerator(...selectedGenerators)\n },\n },\n }\n})\n\nexport default pluginSwr\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,SAAS,gBAAgB,MAAc,QAAyB;CAC9D,OAAO,KACJ,KAAK,CAAC,CACN,QAAQ,qB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A;GACF,CAAC;GACD,IAAI,YAAY,QAAQ;GACxB,IAAI,YAAY,QACd,IAAI,UAAU,UAAU;GAG1B,IAAI,aAAa,GAAG,kBAAkB;EACxC,EACF;CACF;AACF,CAAC"}
package/dist/index.d.ts CHANGED
@@ -4,9 +4,11 @@ import { Exclude, Group, Include, Output, OutputOptions, Override, PluginFactory
4
4
  /**
5
5
  * Validator applied to request and response bodies using schemas from `@kubb/plugin-zod`.
6
6
  * - `false`: no validation.
7
- * - `'zod'`: validates success (2xx) response bodies only.
7
+ * - `'zod'`: validates the success (2xx) response body, and the error body when a non-2xx call does
8
+ * not throw (`throwOnError: false`).
8
9
  * - `{ request?: 'zod'; response?: 'zod' }`: opt in per direction. `request` validates the request
9
- * body and query parameters before the call; `response` validates the success response body.
10
+ * body and query parameters before the call; `response` validates the success response body and,
11
+ * on the non-throw path, the error body.
10
12
  */
11
13
  type ParserOptions = false | 'zod' | {
12
14
  request?: 'zod';
package/dist/index.js CHANGED
@@ -198,6 +198,17 @@ var Url = class Url {
198
198
  return path.replace(/\{([^}]+)\}/g, ":$1");
199
199
  }
200
200
  /**
201
+ * Rewrites OpenAPI placeholder names while keeping the `{...}` braces, so the generated `url`
202
+ * literal aligns with the grouped `path` request option that the runtime client interpolates by
203
+ * key.
204
+ *
205
+ * @example
206
+ * Url.toCasedTemplate('/projects/{project_id}', { casing: 'camelcase' }) // '/projects/{projectId}'
207
+ */
208
+ static toCasedTemplate(path, { casing } = {}) {
209
+ return path.replace(/\{([^}]+)\}/g, (_, name) => `{${transformParam(name, casing)}}`);
210
+ }
211
+ /**
201
212
  * Converts an OpenAPI/Swagger path to a TypeScript template literal string.
202
213
  * `prefix` is prepended inside the literal, `replacer` transforms each parameter name,
203
214
  * and `casing` controls parameter identifier casing.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["declarationPrinter","MutationKey","declarationPrinter","declarationPrinter","callPrinter","TData","getComments","SharedMutationKey","declarationPrinter","TData","getComments"],"sources":["../../../internals/utils/src/casing.ts","../../../internals/utils/src/fs.ts","../../../internals/utils/src/reserved.ts","../../../internals/utils/src/url.ts","../../../internals/shared/src/params.ts","../../../internals/shared/src/operation.ts","../../../internals/shared/src/group.ts","../../../internals/client/src/builders/parser.ts","../../../internals/client/src/resolveClient.ts","../../../internals/client/src/resolveClientOperation.ts","../../../internals/tanstack-query/src/components/MutationKey.tsx","../../../internals/tanstack-query/src/utils.ts","../../../internals/tanstack-query/src/components/QueryKey.tsx","../src/components/Mutation.tsx","../src/components/MutationKey.tsx","../src/components/QueryOptions.tsx","../src/components/Query.tsx","../src/generators/mutationGenerator.tsx","../src/generators/queryGenerator.tsx","../src/resolvers/resolverSwr.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 * Converts an OpenAPI/Swagger path to a template literal that reads each parameter off the\n * grouped `path` request option, e.g. `/pet/{petId}` becomes `` `/pet/${path.petId}` ``. Parameter\n * names are camelCased to match the generated `path` type, and `prefix` is prepended inside the\n * literal. Shared by the client and cypress generators that pass a grouped `path` object.\n *\n * @example\n * Url.toGroupedTemplateString('/pet/{petId}') // '`/pet/${path.petId}`'\n */\n static toGroupedTemplateString(path: string, { prefix }: { prefix?: string | null } = {}): string {\n return Url.toTemplateString(path, { prefix, casing: 'camelcase', replacer: (name) => `path.${name}` })\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 { camelCase } from '@internals/utils'\nimport type { ParameterNode } from '@kubb/ast'\n\nconst caseParamsCache = new WeakMap<Array<ParameterNode>, Array<ParameterNode>>()\n\n/**\n * Applies camelCase to parameter names and returns a new array without mutating the input.\n *\n * Run it before handing parameters to schema builders so output property keys get the right casing\n * while `OperationNode.parameters` stays intact for other consumers. When `casing` is unset, the\n * original array is returned unchanged. Results are cached per input array.\n */\nexport function caseParams(params: Array<ParameterNode>, casing: 'camelcase' | undefined): Array<ParameterNode> {\n if (!casing) return params\n\n const cached = caseParamsCache.get(params)\n if (cached) return cached\n\n const result = params.map((param) => ({ ...param, name: camelCase(param.name) }))\n caseParamsCache.set(params, result)\n return result\n}\n\nexport 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 { Url } from '@internals/utils'\nimport { ast, type ResolverFileParams } from '@kubb/core'\nimport { caseParams } from './params.ts'\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\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 * Resolves the type name for an individual parameter.\n *\n * @example Individual path parameter name\n * `resolver.resolveParamName(node, param) // → 'DeletePetPathPetId'`\n */\n resolveParamName(node: ast.OperationNode, param: ast.ParameterNode): string\n /**\n * Resolves the request body type name.\n *\n * @example Request body type name\n * `resolver.resolveDataName(node) // → 'CreatePetData'`\n */\n resolveDataName(node: ast.OperationNode): string\n /**\n * Resolves the grouped path parameters type name.\n * When the return value equals `resolveParamName`, no indexed access is emitted.\n *\n * @example Grouped path params type name\n * `resolver.resolvePathParamsName(node, param) // → 'DeletePetPathParams'`\n */\n resolvePathParamsName(node: ast.OperationNode, param: ast.ParameterNode): string\n /**\n * Resolves the grouped query parameters type name.\n * When the return value equals `resolveParamName`, an inline struct type is emitted instead.\n *\n * @example Grouped query params type name\n * `resolver.resolveQueryParamsName(node, param) // → 'FindPetsByStatusQueryParams'`\n */\n resolveQueryParamsName(node: ast.OperationNode, param: ast.ParameterNode): string\n /**\n * Resolves the grouped header parameters type name.\n * When the return value equals `resolveParamName`, an inline struct type is emitted instead.\n *\n * @example Grouped header params type name\n * `resolver.resolveHeaderParamsName(node, param) // → 'DeletePetHeaderParams'`\n */\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' | 'original'\n responseStatusNames?: boolean | 'error'\n exclude?: ReadonlyArray<string | undefined>\n order?: 'params-first' | 'body-response-first'\n /**\n * Include the individual `PathParams`/`QueryParams`/`HeaderParams` type names. Set to `false`\n * for clients that reference the grouped `RequestConfig` 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 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 */\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 { isMultipleContentTypes, contentTypeUnion } = getContentTypeInfo(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 const contentTypeProp = isMultipleContentTypes ? `contentType?: ${contentTypeUnion}` : null\n\n return contentTypeProp ? `${configType} & { ${contentTypeProp} }` : 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 RequestConfigNameResolver = RequestConfigResolver & {\n resolveRequestConfigName(node: ast.OperationNode): string\n}\n\n/**\n * Builds the grouped `{ path, query, body, headers }` parameter for a generated client\n * function, typed from the operation's `RequestConfig` (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: RequestConfigNameResolver,\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.resolveRequestConfigName(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\nexport function getOperationParameters(node: ast.OperationNode, options: { paramsCasing?: 'camelcase' | 'original' } = {}): OperationParameterGroups {\n const params = caseParams(node.parameters, options.paramsCasing === 'original' ? undefined : 'camelcase')\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\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.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, { 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 options.includeParams === false\n ? []\n : [\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","import type { ast } from '@kubb/core'\nimport type { ResolverZod } from '@kubb/plugin-zod'\nimport type { ParserOptions } from '../types.ts'\n\n/**\n * Returns `true` when any direction of the parser uses zod (used for dependency checks).\n */\nexport function isParserEnabled(parser: ParserOptions | undefined): boolean {\n if (!parser) return false\n if (parser === 'zod') return true\n return Boolean(parser.request || parser.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 resolveRequestParser(parser: ParserOptions | undefined): 'zod' | null {\n if (!parser || parser === 'zod') return null\n return parser.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 resolveQueryParamsParser(parser: ParserOptions | undefined): 'zod' | null {\n if (!parser || parser === 'zod') return null\n return parser.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 resolveResponseParser(parser: ParserOptions | undefined): 'zod' | null {\n if (!parser) return null\n if (parser === 'zod') return 'zod'\n return parser.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.resolveResponseName?.(node)\n return name ? { expression: name, importNames: [name] } : null\n}\n","/**\n * Resolves which client plugin a consumer (react-query, vue-query, swr, mcp) should call for an\n * operation, shared so the selection rules and diagnostics stay in one place.\n *\n * Every client runtime lives in a dedicated client plugin, so a consumer always calls a registered\n * contract client plugin (plugin-fetch or plugin-axios) and never emits its own inline client:\n *\n * - `contract` — a registered contract client plugin owns the `<op>` functions and the consumer\n * imports and calls them.\n * - `error` — no client plugin is registered, several are registered without a selector, or the\n * requested one is missing.\n *\n * The `client` string selects explicitly (`'fetch'` / `'axios'`); when it is unset a lone registered\n * contract client plugin is picked up automatically.\n */\n\n// Canonical plugin names. They mirror the `pluginFetchName` / `pluginAxiosName` consts the plugins\n// export, kept as literals so this internal needs no plugin install deps.\nconst pluginFetchName = 'plugin-fetch'\nconst pluginAxiosName = 'plugin-axios'\n\n/**\n * The client selector accepted by a consumer's `client` option. Both call a registered contract\n * client plugin.\n */\nexport type ClientSelector = 'fetch' | 'axios'\n\n/**\n * The outcome of {@link resolveClient}.\n *\n * - `contract` names the contract client plugin whose `<op>` functions the consumer imports.\n * - `error` carries a setup diagnostic.\n */\nexport type ResolveClientResult = { kind: 'contract'; pluginName: string } | { kind: 'error'; message: string }\n\nconst selectorToPlugin: Record<'fetch' | 'axios', string> = {\n fetch: pluginFetchName,\n axios: pluginAxiosName,\n}\n\n// Every contract client plugin, in auto-detect priority order.\nconst contractPlugins = [pluginFetchName, pluginAxiosName] as const\n\n/**\n * Applies the `client` resolution rules. See the module comment for the strategy shape.\n *\n * @example\n * ```ts\n * resolveClient({ client: 'fetch', pluginNames: ['plugin-ts', 'plugin-fetch'] })\n * // { kind: 'contract', pluginName: 'plugin-fetch' }\n * ```\n *\n * @example\n * ```ts\n * resolveClient({ client: undefined, pluginNames: ['plugin-ts'] })\n * // { kind: 'error', message: 'No client plugin is registered…' }\n * ```\n */\nexport function resolveClient(options: { client: ClientSelector | undefined; pluginNames: ReadonlyArray<string> }): ResolveClientResult {\n const { client, pluginNames } = options\n const has = (name: string) => pluginNames.includes(name)\n\n if (client === 'fetch' || client === 'axios') {\n const pluginName = selectorToPlugin[client]\n if (!has(pluginName)) {\n return {\n kind: 'error',\n message: `\\`client: '${client}'\\` is set but \\`@kubb/plugin-${client}\\` is not registered in \\`plugins\\`. Add it, or drop \\`client\\` to use a different client plugin.`,\n }\n }\n return { kind: 'contract', pluginName }\n }\n\n // `client` unset: auto-detect a lone registered contract client plugin.\n const registered = contractPlugins.filter(has)\n if (registered.length === 1) {\n return { kind: 'contract', pluginName: registered[0]! }\n }\n if (registered.length > 1) {\n return {\n kind: 'error',\n message: `Multiple client plugins are registered (${registered.map((name) => `\\`@kubb/${name}\\``).join(', ')}). Set \\`client: 'fetch' | 'axios'\\` to choose which client the hooks call, or register a single client plugin.`,\n }\n }\n\n return {\n kind: 'error',\n message: 'No client plugin is registered. Add `@kubb/plugin-axios` or `@kubb/plugin-fetch` to `plugins` so the generated code has an HTTP client to call.',\n }\n}\n","import path from 'node:path'\nimport { operationFileEntry } from '@internals/shared'\nimport type { ast, Group, Output } from '@kubb/core'\n\n/**\n * The resolved contract `<op>` for one operation: the generated function name, the file it lives in,\n * and the contract runtime's `.kubb/client.ts` path (where `RequestConfig` / `ResponseErrorConfig`\n * come from).\n */\nexport type ClientOperation = { name: string; path: string; clientPath: string }\n\ntype ClientResolver = {\n resolveName: (name: string) => string\n resolveFile: (entry: ReturnType<typeof operationFileEntry>, options: { root: string; output: Output; group?: Group }) => { path: string }\n}\n\n/**\n * Resolves the contract client `<op>` a consumer (query hook, MCP handler) imports, by looking up\n * the registered contract client plugin's resolver and output. Works for any contract client plugin\n * (plugin-fetch or plugin-axios). Returns `null` when no contract plugin is in play (the inline\n * path). The plugin injects `.kubb/client.ts` at the global output root, the same path consumers\n * read `RequestConfig` / `ResponseErrorConfig` from.\n */\nexport function resolveClientOperation(options: {\n clientPlugin: { pluginName: string } | null\n driver: { getPlugin: (name: string) => unknown; getResolver: (name: string) => unknown }\n node: ast.OperationNode\n root: string\n output: Output\n}): ClientOperation | null {\n const { clientPlugin, driver, node, root, output } = options\n if (!clientPlugin) return null\n\n const resolver = driver.getResolver(clientPlugin.pluginName) as ClientResolver | null | undefined\n if (!resolver) return null\n\n const plugin = driver.getPlugin(clientPlugin.pluginName) as { options?: { output?: Output; group?: Group | null } } | null | undefined\n const file = resolver.resolveFile(operationFileEntry(node, node.operationId), {\n root,\n output: plugin?.options?.output ?? output,\n group: plugin?.options?.group ?? undefined,\n })\n\n return { name: resolver.resolveName(node.operationId), path: file.path, clientPath: path.resolve(root, '.kubb/client.ts') }\n}\n","import { Url } from '@internals/utils'\nimport type { ast } from '@kubb/core'\nimport { createFunctionParameters, functionPrinter } from '@kubb/plugin-ts'\nimport { File, Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport type { Transformer } from '../types.ts'\n\ntype Props = {\n name: string\n node: ast.OperationNode\n transformer: Transformer | null | undefined\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\n\nexport const mutationKeyTransformer: Transformer = ({ node }) => {\n if (!node.path) return []\n return [`{ url: '${Url.toPath(node.path)}' }`]\n}\n\nexport function MutationKey({ name, node, transformer }: Props): KubbReactNode {\n const paramsNode = createFunctionParameters({ params: [] })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n const keys = (transformer ?? mutationKeyTransformer)({ node, casing: 'camelcase' })\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function.Arrow name={name} export params={paramsSignature} singleLine>\n {`[${keys.join(', ')}] as const`}\n </Function.Arrow>\n </File.Source>\n )\n}\n","import { getOperationParameters, getRequestGroupOptionality } from '@internals/shared'\nimport type { ast } from '@kubb/core'\nimport { createFunctionParameter, createFunctionParameters, createObjectBindingPattern, createTypeLiteral } from '@kubb/plugin-ts'\nimport type { FunctionParameterNode, FunctionParametersNode, PluginTs, ResolverTs } from '@kubb/plugin-ts'\n\n/**\n * The grouped request options, ordered for both the destructured signature and the\n * call passed to the underlying client.\n */\nconst requestGroupOrder = ['path', 'query', 'body', 'headers'] as const\n\ntype RequestGroupKey = (typeof requestGroupOrder)[number]\n\n/**\n * Builds the grouped `{ path, query, body, headers }` parameter that mirrors the client\n * function signature. Only the groups the operation carries are emitted, typed from the\n * operation's `RequestConfig`. `keys` narrows the emitted groups, used by the query key which\n * never carries `headers`.\n *\n * By default the whole group is typed as the single `RequestConfig` reference. When\n * `memberTypeWrapper` is set, each group is emitted as its own member typed from the matching\n * `RequestConfig['<group>']` slice and wrapped, used by vue-query to apply\n * `MaybeRefOrGetter` per group.\n */\nexport function buildGroupedRequestParam(\n node: ast.OperationNode,\n options: {\n resolver: ResolverTs\n keys?: ReadonlyArray<RequestGroupKey>\n memberTypeWrapper?: (type: string) => string\n },\n): FunctionParameterNode | null {\n const { resolver, keys = requestGroupOrder, memberTypeWrapper } = options\n const { groups, hasRequiredPath, hasRequiredQuery, hasRequiredHeader } = getRequestGroupOptionality(node)\n const names = keys.filter((key) => groups[key])\n\n if (names.length === 0) {\n return null\n }\n\n const requiredByGroup: Record<RequestGroupKey, boolean> = {\n path: hasRequiredPath,\n query: hasRequiredQuery,\n body: groups.body,\n headers: hasRequiredHeader,\n }\n\n // The grouped object can default to `{}` only when none of the emitted groups is required. The\n // query key narrows `keys`, so optionality is computed over the emitted groups, not all of them.\n const isOptional = names.every((name) => !requiredByGroup[name])\n\n // Drop the groups this binding never destructures (the query key omits `headers`), so a group\n // that is required elsewhere does not leak into a binding that does not carry it.\n const requestConfigName = resolver.resolveRequestConfigName(node)\n const omittedKeys = requestGroupOrder.filter((key) => !keys.includes(key))\n const requestConfigType = omittedKeys.length > 0 ? `Omit<${requestConfigName}, ${omittedKeys.map((key) => `'${key}'`).join(' | ')}>` : requestConfigName\n\n if (memberTypeWrapper) {\n const members = names.map((name) => ({\n name,\n type: memberTypeWrapper(`${requestConfigType}['${name}']`),\n optional: !requiredByGroup[name],\n }))\n\n return createFunctionParameter({\n name: createObjectBindingPattern({ elements: names.map((name) => ({ name })) }),\n type: createTypeLiteral({ members }),\n optional: false,\n ...(isOptional ? { default: '{}' } : {}),\n })\n }\n\n return createFunctionParameter({\n name: createObjectBindingPattern({ elements: names.map((name) => ({ name })) }),\n type: requestConfigType,\n optional: false,\n ...(isOptional ? { default: '{}' } : {}),\n })\n}\n\n/**\n * Builds the shared `({ path, query, body, headers }, config = {})` parameter list for a\n * TanStack query-options function. The leading parameter mirrors the client signature, and the\n * trailing `config` is a partial `RequestConfig` minus the grouped data-shape keys, which are passed\n * explicitly. Framework plugins wrap the result when needed, for example vue-query applies `MaybeRefOrGetter`.\n */\nexport function buildQueryOptionsParams(\n node: ast.OperationNode,\n options: { resolver: ResolverTs; memberTypeWrapper?: (type: string) => string },\n): FunctionParametersNode {\n const { resolver, memberTypeWrapper } = options\n\n const groupedParam = buildGroupedRequestParam(node, { resolver, memberTypeWrapper })\n\n const configParam = createFunctionParameter({\n name: 'config',\n type: `Partial<Omit<RequestConfig, 'path' | 'query' | 'body' | 'headers' | 'url'>>`,\n default: '{}',\n })\n\n return createFunctionParameters({ params: [groupedParam, configParam].filter((param): param is FunctionParameterNode => param !== null) })\n}\n\n/**\n * Builds the call to a client `<op>` function inside a query/mutation hook body. The function takes\n * a single grouped options object, so the operation's request groups are passed as\n * shorthand alongside the spread `config`, with `throwOnError: true` pinned last so a caller's config\n * can't flip the query's error semantics. Queries thread the TanStack `signal`; mutations omit it.\n *\n * @example\n * ```ts\n * buildClientCall(node, { clientName: 'getPetById', signal: true })\n * // getPetById({ path, ...config, signal: config.signal ?? signal, throwOnError: true })\n * ```\n */\nexport function buildClientCall(node: ast.OperationNode, options: { clientName: string; signal?: boolean }): string {\n const { clientName, signal = false } = options\n const { groups } = getRequestGroupOptionality(node)\n const names = requestGroupOrder.filter((key) => groups[key])\n\n const args = ['...config', ...names, signal ? 'signal: config.signal ?? signal' : null, 'throwOnError: true'].filter((part): part is string => part !== null)\n\n return `${clientName}({ ${args.join(', ')} })`\n}\n\nexport function transformName(name: string, type: string, transformers?: { name?: (name: string, type?: string) => string }): string {\n return transformers?.name?.(name, type) || name\n}\n\ntype OverrideEntry<TOptions> = {\n type: string\n pattern: string | RegExp\n options?: Partial<TOptions>\n}\n\nfunction matchesPattern(node: ast.OperationNode, ov: { type: string; pattern: string | RegExp }): boolean {\n const { type, pattern } = ov\n const matches = (value: string) => (typeof pattern === 'string' ? value === pattern : pattern.test(value))\n if (type === 'operationId') return matches(node.operationId)\n if (type === 'tag') return node.tags.some((t) => matches(t))\n if (type === 'path') return node.path !== undefined && matches(node.path)\n if (type === 'method') return node.method !== undefined && matches(node.method)\n return false\n}\n\n/**\n * Resolves per-operation overrides (first matching override wins).\n *\n * @example\n * ```ts\n * const opts = resolveOperationOverrides(node, override)\n * const queryOpts = 'query' in opts ? opts.query : defaultQuery\n * ```\n */\nexport function resolveOperationOverrides<TOptions>(node: ast.OperationNode, override?: ReadonlyArray<OverrideEntry<TOptions>>): Partial<TOptions> {\n if (!override) return {}\n const match = override.find((ov) => matchesPattern(node, ov))\n return match?.options ?? {}\n}\n\ntype ZodSchemaNameResolverLike = {\n resolveResponseName?: (node: ast.OperationNode) => string | undefined\n resolveDataName?: (node: ast.OperationNode) => string | undefined\n resolveQueryParamsName?: (node: ast.OperationNode, param: ast.ParameterNode) => string | undefined\n}\n\ntype ParserOption = false | 'zod' | { request?: 'zod'; response?: 'zod' } | undefined\n\n/**\n * Returns `'zod'` when response-direction parsing is enabled.\n * The string shorthand `'zod'` also enables response parsing.\n */\nexport function resolveResponseParser(parser: ParserOption): 'zod' | null {\n if (!parser) return null\n if (parser === 'zod') return 'zod'\n return parser.response ?? null\n}\n\n/**\n * Returns `'zod'` when request body parsing is enabled.\n * The string shorthand `'zod'` also enables request body parsing (existing behavior).\n */\nexport function resolveRequestParser(parser: ParserOption): '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-params parsing is enabled.\n * Only the object form `{ request: 'zod' }` enables this. `parser: 'zod'` does not.\n */\nexport function resolveQueryParamsParser(parser: ParserOption): 'zod' | null {\n if (!parser || parser === 'zod') return null\n return parser.request ?? null\n}\n\n/**\n * Collects the Zod schema import names for an operation based on the active parser directions.\n *\n * - `parser: 'zod'`: response and request body names (backward-compatible behavior).\n * - `parser: { request: 'zod' }`: request body and query params names.\n * - `parser: { response: 'zod' }`: response name only.\n * - `parser: { request: 'zod', response: 'zod' }`: all three.\n *\n * Returns an empty array when no resolver is provided or `parser` is falsy.\n */\nexport function resolveZodSchemaNames(node: ast.OperationNode, zodResolver: ZodSchemaNameResolverLike | null | undefined, parser: ParserOption): Array<string> {\n if (!zodResolver || !parser) return []\n const { query: queryParams } = getOperationParameters(node, { paramsCasing: 'original' })\n return [\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((n): n is string => Boolean(n))\n}\n\n/**\n * Build QueryKey params as the grouped `{ path, query, body }` object (NO headers, NO config),\n * typed from the operation's `RequestConfig` minus `url`. The query key transformer reads the\n * grouped `path`/`query`/`body` bindings.\n */\nexport function buildQueryKeyParams(node: ast.OperationNode, options: { resolver: PluginTs['resolver'] }): FunctionParametersNode {\n const { resolver } = options\n const groupedParam = buildGroupedRequestParam(node, { resolver, keys: ['path', 'query', 'body'] })\n\n return createFunctionParameters({ params: groupedParam ? [groupedParam] : [] })\n}\n","import { getOperationParameters } from '@internals/shared'\nimport { Url } from '@internals/utils'\nimport type { ast } from '@kubb/core'\nimport type { PluginTs } from '@kubb/plugin-ts'\nimport { functionPrinter } from '@kubb/plugin-ts'\nimport { File, Function, Type } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport type { Transformer } from '../types.ts'\nimport { buildQueryKeyParams } from '../utils.ts'\n\ntype Props = {\n name: string\n typeName: string\n node: ast.OperationNode\n tsResolver: PluginTs['resolver']\n transformer: Transformer | null | undefined\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\n\nexport const queryKeyTransformer: Transformer = ({ node }) => {\n if (!node.path) return []\n const hasPathParams = getOperationParameters(node).path.length > 0\n const hasQueryParams = getOperationParameters(node).query.length > 0\n const hasRequestBody = !!node.requestBody?.content?.[0]?.schema\n\n const urlObject = hasPathParams ? `{ url: '${Url.toPath(node.path)}', params: path }` : `{ url: '${Url.toPath(node.path)}' }`\n\n return [urlObject, hasQueryParams ? '...(query ? [query] : [])' : null, hasRequestBody ? '...(body ? [body] : [])' : null].filter(Boolean) as Array<string>\n}\n\nexport function QueryKey({ name, node, tsResolver, typeName, transformer }: Props): KubbReactNode {\n const paramsNode = buildQueryKeyParams(node, { resolver: tsResolver })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n const keys = (transformer ?? queryKeyTransformer)({ node, casing: 'camelcase' })\n\n return (\n <>\n <File.Source name={name} isExportable isIndexable>\n <Function.Arrow name={name} export params={paramsSignature} singleLine>\n {`[${keys.join(', ')}] as const`}\n </Function.Arrow>\n </File.Source>\n <File.Source name={typeName} isTypeOnly>\n <Type name={typeName}>{`ReturnType<typeof ${name}>`}</Type>\n </File.Source>\n </>\n )\n}\n","import type { ast } from '@kubb/core'\nimport type { FunctionParametersNode, ResolverTs } from '@kubb/plugin-ts'\nimport { createFunctionParameter, createFunctionParameters, functionPrinter } from '@kubb/plugin-ts'\nimport { File, Function, Type } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport { buildGroupedRequestParam, buildClientCall } from '@internals/tanstack-query'\nimport { buildRequestConfigType, getComments, resolveErrorNames } from '../utils.ts'\n\ntype Props = {\n name: string\n clientName: string\n mutationKeyName: string\n mutationKeyTypeName: string\n mutationArgTypeName: string\n node: ast.OperationNode\n tsResolver: ResolverTs\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\nconst callPrinter = functionPrinter({ mode: 'call' })\n\nfunction buildMutationParamsNode(\n node: ast.OperationNode,\n options: {\n mutationKeyTypeName: string\n mutationArgTypeName: string\n resolver: ResolverTs\n },\n): FunctionParametersNode {\n const { mutationKeyTypeName, mutationArgTypeName, resolver } = options\n const responseName = resolver.resolveResponseName(node)\n const errorNames = resolveErrorNames(node, resolver)\n\n const TData = responseName\n const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(' | ') : 'Error'}>`\n\n return createFunctionParameters({\n params: [\n createFunctionParameter({\n name: 'options',\n type: `{\n mutation?: SWRMutationConfiguration<${TData}, ${TError}, ${mutationKeyTypeName} | null, ${mutationArgTypeName}> & { throwOnError?: boolean },\n client?: ${buildRequestConfigType(node)},\n shouldFetch?: boolean,\n}`,\n default: '{}',\n }),\n ],\n })\n}\n\nexport function Mutation({ name, clientName, mutationKeyName, mutationKeyTypeName, mutationArgTypeName, node, tsResolver }: Props): KubbReactNode {\n const responseName = tsResolver.resolveResponseName(node)\n const errorNames = resolveErrorNames(node, tsResolver)\n\n const TData = responseName\n const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(' | ') : 'Error'}>`\n\n const groupedParam = buildGroupedRequestParam(node, { resolver: tsResolver })\n const hasMutationParams = groupedParam !== null\n const groupedParamsNode = createFunctionParameters({ params: groupedParam ? [groupedParam] : [] })\n const argTypeBody = hasMutationParams ? tsResolver.resolveRequestConfigName(node) : ''\n const argBindingStr = hasMutationParams ? (callPrinter.print(groupedParamsNode) ?? '') : ''\n const mutationFnBody = `const { data } = await ${buildClientCall(node, { clientName, signal: false })}\n return data`\n\n const generics = [TData, TError, `${mutationKeyTypeName} | null`, mutationArgTypeName]\n\n const paramsNode = buildMutationParamsNode(node, {\n mutationKeyTypeName,\n mutationArgTypeName,\n resolver: tsResolver,\n })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n\n return (\n <>\n <File.Source name={mutationArgTypeName} isExportable isIndexable isTypeOnly>\n <Type name={mutationArgTypeName} export>\n {hasMutationParams ? argTypeBody : 'never'}\n </Type>\n </File.Source>\n <File.Source name={name} isExportable isIndexable>\n <Function name={name} export params={paramsSignature} JSDoc={{ comments: getComments(node) }}>\n {`\n const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {}\n const mutationKey = ${mutationKeyName}()\n\n return useSWRMutation<${generics.join(', ')}>(\n shouldFetch ? mutationKey : null,\n async (_url${hasMutationParams ? `, { arg: ${argBindingStr} }` : ''}) => {\n ${mutationFnBody}\n },\n mutationOptions\n )\n `}\n </Function>\n </File.Source>\n </>\n )\n}\n","import type { Transformer } from '@internals/tanstack-query'\nimport { MutationKey as SharedMutationKey } from '@internals/tanstack-query'\nimport type { ast } from '@kubb/core'\nimport { File, Type } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\n\ntype Props = {\n name: string\n typeName: string\n node: ast.OperationNode\n transformer: Transformer | undefined\n}\n\nexport function MutationKey({ name, typeName, node, transformer }: Props): KubbReactNode {\n return (\n <>\n <SharedMutationKey name={name} node={node} transformer={transformer} />\n <File.Source name={typeName} isExportable isIndexable isTypeOnly>\n <Type export name={typeName}>{`ReturnType<typeof ${name}>`}</Type>\n </File.Source>\n </>\n )\n}\n","import type { ast } from '@kubb/core'\nimport type { FunctionParametersNode, ResolverTs } from '@kubb/plugin-ts'\nimport { functionPrinter } from '@kubb/plugin-ts'\nimport { File, Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport { buildQueryOptionsParams, buildClientCall } from '@internals/tanstack-query'\n\ntype Props = {\n name: string\n clientName: string\n node: ast.OperationNode\n tsResolver: ResolverTs\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\n\nexport function getQueryOptionsParams(node: ast.OperationNode, options: { resolver: ResolverTs }): FunctionParametersNode {\n return buildQueryOptionsParams(node, options)\n}\n\nexport function QueryOptions({ name, clientName, node, tsResolver }: Props): KubbReactNode {\n const paramsNode = getQueryOptionsParams(node, { resolver: tsResolver })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n const fetcherBody = `const { data } = await ${buildClientCall(node, { clientName, signal: false })}\n return data`\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function name={name} export params={paramsSignature}>\n {`\n return {\n fetcher: async () => {\n ${fetcherBody}\n },\n }\n`}\n </Function>\n </File.Source>\n )\n}\n","import type { ast } from '@kubb/core'\nimport type { FunctionParameterNode, FunctionParametersNode, ResolverTs } from '@kubb/plugin-ts'\nimport { createFunctionParameter, createFunctionParameters, functionPrinter } from '@kubb/plugin-ts'\nimport { File, Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport { buildGroupedRequestParam } from '@internals/tanstack-query'\nimport { buildClientOptionType, buildQueryKeyParams, getComments, resolveErrorNames } from '../utils.ts'\nimport { getQueryOptionsParams } from './QueryOptions.tsx'\n\ntype Props = {\n name: string\n queryOptionsName: string\n queryKeyName: string\n queryKeyTypeName: string\n node: ast.OperationNode\n tsResolver: ResolverTs\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\nconst callPrinter = functionPrinter({ mode: 'call' })\n\nfunction buildQueryParamsNode(\n node: ast.OperationNode,\n options: {\n resolver: ResolverTs\n },\n): FunctionParametersNode {\n const { resolver } = options\n const responseName = resolver.resolveResponseName(node)\n const errorNames = resolveErrorNames(node, resolver)\n\n const TData = responseName\n const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(' | ') : 'Error'}>`\n\n const optionsParam = createFunctionParameter({\n name: 'options',\n type: `{\n query?: SWRConfiguration<${[TData, TError].join(', ')}>,\n client?: ${buildClientOptionType()},\n shouldFetch?: boolean,\n immutable?: boolean\n}`,\n default: '{}',\n })\n\n const groupedParam = buildGroupedRequestParam(node, { resolver })\n\n return createFunctionParameters({ params: [groupedParam, optionsParam].filter((param): param is FunctionParameterNode => param !== null) })\n}\n\nexport function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, node, tsResolver }: Props): KubbReactNode {\n const responseName = tsResolver.resolveResponseName(node)\n const errorNames = resolveErrorNames(node, tsResolver)\n\n const TData = responseName\n const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(' | ') : 'Error'}>`\n const generics = [TData, TError, `${queryKeyTypeName} | null`]\n\n const queryKeyParamsNode = buildQueryKeyParams(node, { resolver: tsResolver })\n const queryKeyParamsCall = callPrinter.print(queryKeyParamsNode) ?? ''\n\n const queryOptionsParamsNode = getQueryOptionsParams(node, { resolver: tsResolver })\n const queryOptionsParamsCall = callPrinter.print(queryOptionsParamsNode) ?? ''\n\n const paramsNode = buildQueryParamsNode(node, { resolver: tsResolver })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function name={name} export params={paramsSignature} JSDoc={{ comments: getComments(node) }}>\n {`\n const { query: queryOptions, client: config = {}, shouldFetch = true, immutable } = options ?? {}\n\n const queryKey = ${queryKeyName}(${queryKeyParamsCall})\n\n return useSWR<${generics.join(', ')}>(\n shouldFetch ? queryKey : null,\n {\n ...${queryOptionsName}(${queryOptionsParamsCall}),\n ...(immutable ? {\n revalidateIfStale: false,\n revalidateOnFocus: false,\n revalidateOnReconnect: false\n } : { }),\n ...queryOptions,\n }\n )\n `}\n </Function>\n </File.Source>\n )\n}\n","import { resolveOperationTypeNames } from '@internals/shared'\nimport { resolveClientOperation } from '@internals/client'\nimport { resolveZodSchemaNames } from '@internals/tanstack-query'\nimport { ast, defineGenerator } from '@kubb/core'\nimport { isParserEnabled } from '@internals/client'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, jsxRenderer } from '@kubb/renderer-jsx'\nimport { Mutation, MutationKey } from '../components'\nimport type { PluginSwr } from '../types'\n\n/**\n * Built-in generator for `useSWRMutation` hooks. Emits one `useFooMutation` hook\n * per POST/PUT/DELETE operation (configurable via `mutation.methods`) plus\n * the matching `fooMutationKey` helper.\n */\nexport const mutationGenerator = defineGenerator<PluginSwr>({\n name: 'swr-mutation',\n renderer: jsxRenderer,\n operation(node, ctx) {\n if (!ast.isHttpOperationNode(node)) return null\n const { config, driver, resolver, root } = ctx\n const { output, query, mutation, parser, client, group } = ctx.options\n\n const pluginTs = driver.getPlugin(pluginTsName)\n if (!pluginTs) return null\n const tsResolver = driver.getResolver(pluginTsName)\n\n const isQuery = query === false || (!!query && query.methods.some((method) => node.method.toLowerCase() === method.toLowerCase()))\n const queryMethods = new Set(query ? query.methods : [])\n const isMutation =\n mutation !== false &&\n !isQuery &&\n (mutation ? mutation.methods : []).some((method) => !queryMethods.has(method) && node.method.toLowerCase() === method.toLowerCase())\n\n if (!isMutation) return null\n\n const importPath = mutation ? mutation.importPath : 'swr/mutation'\n\n // The registered contract client plugin owns the `<op>` the hook imports and calls.\n const contractOp = resolveClientOperation({ clientPlugin: { pluginName: client.pluginName }, driver, node, root, output })\n if (!contractOp) return null\n\n const mutationHookName = resolver.resolveMutationName(node)\n const mutationKeyName = resolver.resolveMutationKeyName(node)\n const mutationKeyTypeName = resolver.resolveMutationKeyTypeName(node)\n const mutationArgTypeName = resolver.resolveMutationArgTypeName(node)\n\n const meta = {\n file: resolver.resolveFile({ name: mutationHookName, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path }, { root, output, group }),\n fileTs: tsResolver.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n { root, output: pluginTs.options?.output ?? output, group: pluginTs.options?.group },\n ),\n }\n\n const importedTypeNames = [\n tsResolver.resolveRequestConfigName(node),\n ...resolveOperationTypeNames(node, tsResolver, { order: 'body-response-first', includeParams: false }),\n ].filter((name): name is string => Boolean(name))\n\n const pluginZod = isParserEnabled(parser) ? driver.getPlugin(pluginZodName) : undefined\n const zodResolver = pluginZod ? driver.getResolver(pluginZodName) : undefined\n const fileZod = zodResolver\n ? zodResolver.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n { root, output: pluginZod?.options?.output ?? output, group: pluginZod?.options?.group },\n )\n : undefined\n const zodSchemaNames = resolveZodSchemaNames(node, zodResolver, parser)\n\n const calledClientName = contractOp.name\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 {fileZod && zodSchemaNames.length > 0 && <File.Import name={zodSchemaNames} root={meta.file.path} path={fileZod.path} />}\n\n <File.Import name={[contractOp.name]} root={meta.file.path} path={contractOp.path} />\n <File.Import name={['RequestConfig', 'ResponseErrorConfig']} root={meta.file.path} path={contractOp.clientPath} isTypeOnly />\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 <MutationKey name={mutationKeyName} typeName={mutationKeyTypeName} node={node} transformer={ctx.options.mutationKey} />\n\n {mutation && (\n <>\n <File.Import name={'useSWRMutation'} path={importPath} />\n <File.Import name={['SWRMutationConfiguration']} path={importPath} isTypeOnly />\n <Mutation\n name={mutationHookName}\n clientName={calledClientName}\n mutationKeyName={mutationKeyName}\n mutationKeyTypeName={mutationKeyTypeName}\n mutationArgTypeName={mutationArgTypeName}\n node={node}\n tsResolver={tsResolver}\n />\n </>\n )}\n </File>\n )\n },\n})\n","import { resolveOperationTypeNames } from '@internals/shared'\nimport { resolveClientOperation } from '@internals/client'\nimport { resolveZodSchemaNames } from '@internals/tanstack-query'\nimport { ast, defineGenerator } from '@kubb/core'\nimport { isParserEnabled } from '@internals/client'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, jsxRenderer } from '@kubb/renderer-jsx'\nimport { Query, QueryKey, QueryOptions } from '../components'\nimport type { PluginSwr } from '../types'\n\nexport const queryGenerator = defineGenerator<PluginSwr>({\n name: 'swr-query',\n renderer: jsxRenderer,\n operation(node, ctx) {\n if (!ast.isHttpOperationNode(node)) return null\n const { config, driver, resolver, root } = ctx\n const { output, query, mutation, parser, client, group } = ctx.options\n\n const pluginTs = driver.getPlugin(pluginTsName)\n if (!pluginTs) return null\n const tsResolver = driver.getResolver(pluginTsName)\n\n const isQuery = query === false || (!!query && query.methods.some((method) => node.method.toLowerCase() === method.toLowerCase()))\n const queryMethods = new Set(query ? query.methods : [])\n const isMutation =\n mutation !== false &&\n !isQuery &&\n (mutation ? mutation.methods : []).some((method) => !queryMethods.has(method) && node.method.toLowerCase() === method.toLowerCase())\n\n if (!isQuery || isMutation) return null\n\n const importPath = query ? query.importPath : 'swr'\n\n // The registered contract client plugin owns the `<op>` the hook imports and calls.\n const contractOp = resolveClientOperation({ clientPlugin: { pluginName: client.pluginName }, driver, node, root, output })\n if (!contractOp) return null\n\n const queryName = resolver.resolveQueryName(node)\n const queryOptionsName = resolver.resolveQueryOptionsName(node)\n const queryKeyName = resolver.resolveQueryKeyName(node)\n const queryKeyTypeName = resolver.resolveQueryKeyTypeName(node)\n\n const meta = {\n file: resolver.resolveFile({ name: queryName, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path }, { root, output, group }),\n fileTs: tsResolver.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n { root, output: pluginTs.options?.output ?? output, group: pluginTs.options?.group },\n ),\n }\n\n const importedTypeNames = [\n tsResolver.resolveRequestConfigName(node),\n ...resolveOperationTypeNames(node, tsResolver, {\n exclude: [queryKeyTypeName],\n order: 'body-response-first',\n includeParams: false,\n }),\n ].filter((name): name is string => Boolean(name))\n\n const pluginZod = isParserEnabled(parser) ? driver.getPlugin(pluginZodName) : undefined\n const zodResolver = pluginZod ? driver.getResolver(pluginZodName) : undefined\n const fileZod = zodResolver\n ? zodResolver.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n { root, output: pluginZod?.options?.output ?? output, group: pluginZod?.options?.group },\n )\n : undefined\n const zodSchemaNames = resolveZodSchemaNames(node, zodResolver, parser)\n\n const calledClientName = contractOp.name\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 {fileZod && zodSchemaNames.length > 0 && <File.Import name={zodSchemaNames} root={meta.file.path} path={fileZod.path} />}\n\n <File.Import name={[contractOp.name]} root={meta.file.path} path={contractOp.path} />\n <File.Import name={['RequestConfig', 'ResponseErrorConfig']} root={meta.file.path} path={contractOp.clientPath} isTypeOnly />\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 <QueryKey name={queryKeyName} typeName={queryKeyTypeName} node={node} tsResolver={tsResolver} transformer={ctx.options.queryKey} />\n\n <QueryOptions name={queryOptionsName} clientName={calledClientName} node={node} tsResolver={tsResolver} />\n\n {query && (\n <>\n <File.Import name={'useSWR'} path={importPath} />\n <File.Import name={['SWRConfiguration']} path={importPath} isTypeOnly />\n <Query\n name={queryName}\n queryOptionsName={queryOptionsName}\n queryKeyName={queryKeyName}\n queryKeyTypeName={queryKeyTypeName}\n node={node}\n tsResolver={tsResolver}\n />\n </>\n )}\n </File>\n )\n },\n})\n","import { camelCase, toFilePath } from '@internals/utils'\nimport { defineResolver } from '@kubb/core'\nimport type { PluginSwr } from '../types.ts'\n\nfunction capitalize(name: string): string {\n return `${name.charAt(0).toUpperCase()}${name.slice(1)}`\n}\n\n/**\n * Naming convention resolver for the SWR plugin.\n *\n * Provides default naming helpers using camelCase for functions and file paths.\n *\n * @example\n * `resolverSwr.default('list pets', 'function') // → 'listPets'`\n */\nexport const resolverSwr = defineResolver<PluginSwr>(() => ({\n name: 'default',\n pluginName: 'plugin-swr',\n default(name, type) {\n return type === 'file' ? toFilePath(name) : 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 resolveQueryName(node) {\n return `use${capitalize(this.resolveName(node.operationId))}`\n },\n resolveMutationName(node) {\n return `use${capitalize(this.resolveName(node.operationId))}`\n },\n resolveQueryOptionsName(node) {\n return `${this.resolveName(node.operationId)}QueryOptions`\n },\n resolveQueryKeyName(node) {\n return `${this.resolveName(node.operationId)}QueryKey`\n },\n resolveMutationKeyName(node) {\n return `${this.resolveName(node.operationId)}MutationKey`\n },\n resolveQueryKeyTypeName(node) {\n return `${capitalize(this.resolveName(node.operationId))}QueryKey`\n },\n resolveMutationKeyTypeName(node) {\n return `${capitalize(this.resolveName(node.operationId))}MutationKey`\n },\n resolveMutationArgTypeName(node) {\n return `${capitalize(this.resolveName(node.operationId))}MutationArg`\n },\n resolveClientName(node) {\n return this.resolveName(node.operationId)\n },\n}))\n","import { createGroupConfig } from '@internals/shared'\nimport { definePlugin } from '@kubb/core'\nimport { isParserEnabled } from '@internals/client'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { resolveClient } from '@internals/client'\nimport { mutationKeyTransformer, queryKeyTransformer } from '@internals/tanstack-query'\nimport { mutationGenerator, queryGenerator } from './generators'\nimport { resolverSwr } from './resolvers/resolverSwr.ts'\nimport type { PluginSwr } from './types.ts'\n\nexport const pluginSwrName = 'plugin-swr' satisfies PluginSwr['name']\n\nexport const pluginSwr = definePlugin<PluginSwr>((options) => {\n const {\n output = { path: 'hooks', barrel: { type: 'named' } },\n group,\n exclude = [],\n include,\n override = [],\n parser = false,\n mutation = {},\n query = {},\n mutationKey = mutationKeyTransformer,\n queryKey = queryKeyTransformer,\n client,\n resolver: userResolver,\n macros: userMacros,\n } = options\n\n const selectedGenerators = [queryGenerator, mutationGenerator].filter((generator): generator is NonNullable<typeof generator> => Boolean(generator))\n\n const groupConfig = createGroupConfig(group) ?? undefined\n\n return {\n name: pluginSwrName,\n options,\n dependencies: [pluginTsName, isParserEnabled(parser) ? pluginZodName : undefined].filter((dependency): dependency is string => Boolean(dependency)),\n hooks: {\n 'kubb:plugin:setup'(ctx) {\n const resolver = userResolver ? { ...resolverSwr, ...userResolver } : resolverSwr\n\n const pluginNames = (ctx.config.plugins ?? []).map((p) => (p as { name?: string }).name).filter((name): name is string => Boolean(name))\n const resolvedClient = resolveClient({ client, pluginNames })\n if (resolvedClient.kind === 'error') {\n throw new Error(resolvedClient.message)\n }\n\n // The hooks always call a registered client plugin's op. The client runtime lives in\n // plugin-axios / plugin-fetch, so nothing is bundled here.\n const resolvedClientDescriptor: PluginSwr['resolvedOptions']['client'] = { kind: 'contract', pluginName: resolvedClient.pluginName }\n\n ctx.setOptions({\n output,\n client: resolvedClientDescriptor,\n queryKey,\n query:\n query === false\n ? false\n : {\n importPath: 'swr',\n methods: ['get'],\n ...query,\n },\n mutationKey,\n mutation:\n mutation === false\n ? false\n : {\n importPath: 'swr/mutation',\n methods: ['post', 'put', 'patch', 'delete'],\n ...mutation,\n },\n parser,\n group: groupConfig,\n exclude,\n include,\n override,\n resolver,\n })\n ctx.setResolver(resolver)\n if (userMacros?.length) {\n ctx.setMacros(userMacros)\n }\n\n ctx.addGenerator(...selectedGenerators)\n },\n },\n }\n})\n\nexport default pluginSwr\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,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;MAAO;MAAS;KAAQ;KAC1C,GAAG;IACL;IACN;IACA,OAAO;IACP;IACA;IACA;IACA;GACF,CAAC;GACD,IAAI,YAAY,QAAQ;GACxB,IAAI,YAAY,QACd,IAAI,UAAU,UAAU;GAG1B,IAAI,aAAa,GAAG,kBAAkB;EACxC,EACF;CACF;AACF,CAAC"}
1
+ {"version":3,"file":"index.js","names":["declarationPrinter","MutationKey","declarationPrinter","declarationPrinter","callPrinter","TData","getComments","SharedMutationKey","declarationPrinter","TData","getComments"],"sources":["../../../internals/utils/src/casing.ts","../../../internals/utils/src/fs.ts","../../../internals/utils/src/reserved.ts","../../../internals/utils/src/url.ts","../../../internals/shared/src/params.ts","../../../internals/shared/src/operation.ts","../../../internals/shared/src/group.ts","../../../internals/client/src/builders/parser.ts","../../../internals/client/src/resolveClient.ts","../../../internals/client/src/resolveClientOperation.ts","../../../internals/tanstack-query/src/components/MutationKey.tsx","../../../internals/tanstack-query/src/utils.ts","../../../internals/tanstack-query/src/components/QueryKey.tsx","../src/components/Mutation.tsx","../src/components/MutationKey.tsx","../src/components/QueryOptions.tsx","../src/components/Query.tsx","../src/generators/mutationGenerator.tsx","../src/generators/queryGenerator.tsx","../src/resolvers/resolverSwr.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 * Rewrites OpenAPI placeholder names while keeping the `{...}` braces, so the generated `url`\n * literal aligns with the grouped `path` request option that the runtime client interpolates by\n * key.\n *\n * @example\n * Url.toCasedTemplate('/projects/{project_id}', { casing: 'camelcase' }) // '/projects/{projectId}'\n */\n static toCasedTemplate(path: string, { casing }: { casing?: PathCasing } = {}): string {\n return path.replace(/\\{([^}]+)\\}/g, (_, name: string) => `{${transformParam(name, casing)}}`)\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 * Converts an OpenAPI/Swagger path to a template literal that reads each parameter off the\n * grouped `path` request option, e.g. `/pet/{petId}` becomes `` `/pet/${path.petId}` ``. Parameter\n * names are camelCased to match the generated `path` type, and `prefix` is prepended inside the\n * literal. Shared by the client and cypress generators that pass a grouped `path` object.\n *\n * @example\n * Url.toGroupedTemplateString('/pet/{petId}') // '`/pet/${path.petId}`'\n */\n static toGroupedTemplateString(path: string, { prefix }: { prefix?: string | null } = {}): string {\n return Url.toTemplateString(path, { prefix, casing: 'camelcase', replacer: (name) => `path.${name}` })\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 { camelCase } from '@internals/utils'\nimport type { ParameterNode } from '@kubb/ast'\n\nconst caseParamsCache = new WeakMap<Array<ParameterNode>, Array<ParameterNode>>()\n\n/**\n * Applies camelCase to parameter names and returns a new array without mutating the input.\n *\n * Run it before handing parameters to schema builders so output property keys get the right casing\n * while `OperationNode.parameters` stays intact for other consumers. When `casing` is unset, the\n * original array is returned unchanged. Results are cached per input array.\n */\nexport function caseParams(params: Array<ParameterNode>, casing: 'camelcase' | undefined): Array<ParameterNode> {\n if (!casing) return params\n\n const cached = caseParamsCache.get(params)\n if (cached) return cached\n\n const result = params.map((param) => ({ ...param, name: camelCase(param.name) }))\n caseParamsCache.set(params, result)\n return result\n}\n\nexport 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 { Url } from '@internals/utils'\nimport { ast, type ResolverFileParams } from '@kubb/core'\nimport { caseParams } from './params.ts'\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\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 * Resolves the type name for an individual parameter.\n *\n * @example Individual path parameter name\n * `resolver.resolveParamName(node, param) // → 'DeletePetPathPetId'`\n */\n resolveParamName(node: ast.OperationNode, param: ast.ParameterNode): string\n /**\n * Resolves the request body type name.\n *\n * @example Request body type name\n * `resolver.resolveDataName(node) // → 'CreatePetData'`\n */\n resolveDataName(node: ast.OperationNode): string\n /**\n * Resolves the grouped path parameters type name.\n * When the return value equals `resolveParamName`, no indexed access is emitted.\n *\n * @example Grouped path params type name\n * `resolver.resolvePathParamsName(node, param) // → 'DeletePetPathParams'`\n */\n resolvePathParamsName(node: ast.OperationNode, param: ast.ParameterNode): string\n /**\n * Resolves the grouped query parameters type name.\n * When the return value equals `resolveParamName`, an inline struct type is emitted instead.\n *\n * @example Grouped query params type name\n * `resolver.resolveQueryParamsName(node, param) // → 'FindPetsByStatusQueryParams'`\n */\n resolveQueryParamsName(node: ast.OperationNode, param: ast.ParameterNode): string\n /**\n * Resolves the grouped header parameters type name.\n * When the return value equals `resolveParamName`, an inline struct type is emitted instead.\n *\n * @example Grouped header params type name\n * `resolver.resolveHeaderParamsName(node, param) // → 'DeletePetHeaderParams'`\n */\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' | 'original'\n responseStatusNames?: boolean | 'error'\n exclude?: ReadonlyArray<string | undefined>\n order?: 'params-first' | 'body-response-first'\n /**\n * Include the individual `PathParams`/`QueryParams`/`HeaderParams` type names. Set to `false`\n * for clients that reference the grouped `RequestConfig` 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 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 */\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 { isMultipleContentTypes, contentTypeUnion } = getContentTypeInfo(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 const contentTypeProp = isMultipleContentTypes ? `contentType?: ${contentTypeUnion}` : null\n\n return contentTypeProp ? `${configType} & { ${contentTypeProp} }` : 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 RequestConfigNameResolver = RequestConfigResolver & {\n resolveRequestConfigName(node: ast.OperationNode): string\n}\n\n/**\n * Builds the grouped `{ path, query, body, headers }` parameter for a generated client\n * function, typed from the operation's `RequestConfig` (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: RequestConfigNameResolver,\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.resolveRequestConfigName(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\nexport function getOperationParameters(node: ast.OperationNode, options: { paramsCasing?: 'camelcase' | 'original' } = {}): OperationParameterGroups {\n const params = caseParams(node.parameters, options.paramsCasing === 'original' ? undefined : 'camelcase')\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\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.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, { 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 options.includeParams === false\n ? []\n : [\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","import { isSuccessStatusCode } from '@internals/shared'\nimport type { ast } from '@kubb/core'\nimport type { ResolverZod } from '@kubb/plugin-zod'\nimport type { ParserOptions } from '../types.ts'\n\n/**\n * Returns `true` when any direction of the parser uses zod (used for dependency checks).\n */\nexport function isParserEnabled(parser: ParserOptions | undefined): boolean {\n if (!parser) return false\n if (parser === 'zod') return true\n return Boolean(parser.request || parser.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 resolveRequestParser(parser: ParserOptions | undefined): 'zod' | null {\n if (!parser || parser === 'zod') return null\n return parser.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 resolveQueryParamsParser(parser: ParserOptions | undefined): 'zod' | null {\n if (!parser || parser === 'zod') return null\n return parser.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 resolveResponseParser(parser: ParserOptions | undefined): 'zod' | null {\n if (!parser) return null\n if (parser === 'zod') return 'zod'\n return parser.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.resolveResponseName?.(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.resolveErrorName?.(node)\n return name ? { expression: name, importNames: [name] } : null\n}\n","/**\n * Resolves which client plugin a consumer (react-query, vue-query, swr, mcp) should call for an\n * operation, shared so the selection rules and diagnostics stay in one place.\n *\n * Every client runtime lives in a dedicated client plugin, so a consumer always calls a registered\n * contract client plugin (plugin-fetch or plugin-axios) and never emits its own inline client:\n *\n * - `contract` — a registered contract client plugin owns the `<op>` functions and the consumer\n * imports and calls them.\n * - `error` — no client plugin is registered, several are registered without a selector, or the\n * requested one is missing.\n *\n * The `client` string selects explicitly (`'fetch'` / `'axios'`); when it is unset a lone registered\n * contract client plugin is picked up automatically.\n */\n\n// Canonical plugin names. They mirror the `pluginFetchName` / `pluginAxiosName` consts the plugins\n// export, kept as literals so this internal needs no plugin install deps.\nconst pluginFetchName = 'plugin-fetch'\nconst pluginAxiosName = 'plugin-axios'\n\n/**\n * The client selector accepted by a consumer's `client` option. Both call a registered contract\n * client plugin.\n */\nexport type ClientSelector = 'fetch' | 'axios'\n\n/**\n * The outcome of {@link resolveClient}.\n *\n * - `contract` names the contract client plugin whose `<op>` functions the consumer imports.\n * - `error` carries a setup diagnostic.\n */\nexport type ResolveClientResult = { kind: 'contract'; pluginName: string } | { kind: 'error'; message: string }\n\nconst selectorToPlugin: Record<'fetch' | 'axios', string> = {\n fetch: pluginFetchName,\n axios: pluginAxiosName,\n}\n\n// Every contract client plugin, in auto-detect priority order.\nconst contractPlugins = [pluginFetchName, pluginAxiosName] as const\n\n/**\n * Applies the `client` resolution rules. See the module comment for the strategy shape.\n *\n * @example\n * ```ts\n * resolveClient({ client: 'fetch', pluginNames: ['plugin-ts', 'plugin-fetch'] })\n * // { kind: 'contract', pluginName: 'plugin-fetch' }\n * ```\n *\n * @example\n * ```ts\n * resolveClient({ client: undefined, pluginNames: ['plugin-ts'] })\n * // { kind: 'error', message: 'No client plugin is registered…' }\n * ```\n */\nexport function resolveClient(options: { client: ClientSelector | undefined; pluginNames: ReadonlyArray<string> }): ResolveClientResult {\n const { client, pluginNames } = options\n const has = (name: string) => pluginNames.includes(name)\n\n if (client === 'fetch' || client === 'axios') {\n const pluginName = selectorToPlugin[client]\n if (!has(pluginName)) {\n return {\n kind: 'error',\n message: `\\`client: '${client}'\\` is set but \\`@kubb/plugin-${client}\\` is not registered in \\`plugins\\`. Add it, or drop \\`client\\` to use a different client plugin.`,\n }\n }\n return { kind: 'contract', pluginName }\n }\n\n // `client` unset: auto-detect a lone registered contract client plugin.\n const registered = contractPlugins.filter(has)\n if (registered.length === 1) {\n return { kind: 'contract', pluginName: registered[0]! }\n }\n if (registered.length > 1) {\n return {\n kind: 'error',\n message: `Multiple client plugins are registered (${registered.map((name) => `\\`@kubb/${name}\\``).join(', ')}). Set \\`client: 'fetch' | 'axios'\\` to choose which client the hooks call, or register a single client plugin.`,\n }\n }\n\n return {\n kind: 'error',\n message: 'No client plugin is registered. Add `@kubb/plugin-axios` or `@kubb/plugin-fetch` to `plugins` so the generated code has an HTTP client to call.',\n }\n}\n","import path from 'node:path'\nimport { operationFileEntry } from '@internals/shared'\nimport type { ast, Group, Output } from '@kubb/core'\n\n/**\n * The resolved contract `<op>` for one operation: the generated function name, the file it lives in,\n * and the contract runtime's `.kubb/client.ts` path (where `RequestConfig` / `ResponseErrorConfig`\n * come from).\n */\nexport type ClientOperation = { name: string; path: string; clientPath: string }\n\ntype ClientResolver = {\n resolveName: (name: string) => string\n resolveFile: (entry: ReturnType<typeof operationFileEntry>, options: { root: string; output: Output; group?: Group }) => { path: string }\n}\n\n/**\n * Resolves the contract client `<op>` a consumer (query hook, MCP handler) imports, by looking up\n * the registered contract client plugin's resolver and output. Works for any contract client plugin\n * (plugin-fetch or plugin-axios). Returns `null` when no contract plugin is in play (the inline\n * path). The plugin injects `.kubb/client.ts` at the global output root, the same path consumers\n * read `RequestConfig` / `ResponseErrorConfig` from.\n */\nexport function resolveClientOperation(options: {\n clientPlugin: { pluginName: string } | null\n driver: { getPlugin: (name: string) => unknown; getResolver: (name: string) => unknown }\n node: ast.OperationNode\n root: string\n output: Output\n}): ClientOperation | null {\n const { clientPlugin, driver, node, root, output } = options\n if (!clientPlugin) return null\n\n const resolver = driver.getResolver(clientPlugin.pluginName) as ClientResolver | null | undefined\n if (!resolver) return null\n\n const plugin = driver.getPlugin(clientPlugin.pluginName) as { options?: { output?: Output; group?: Group | null } } | null | undefined\n const file = resolver.resolveFile(operationFileEntry(node, node.operationId), {\n root,\n output: plugin?.options?.output ?? output,\n group: plugin?.options?.group ?? undefined,\n })\n\n return { name: resolver.resolveName(node.operationId), path: file.path, clientPath: path.resolve(root, '.kubb/client.ts') }\n}\n","import { Url } from '@internals/utils'\nimport type { ast } from '@kubb/core'\nimport { createFunctionParameters, functionPrinter } from '@kubb/plugin-ts'\nimport { File, Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport type { Transformer } from '../types.ts'\n\ntype Props = {\n name: string\n node: ast.OperationNode\n transformer: Transformer | null | undefined\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\n\nexport const mutationKeyTransformer: Transformer = ({ node }) => {\n if (!node.path) return []\n return [`{ url: '${Url.toPath(node.path)}' }`]\n}\n\nexport function MutationKey({ name, node, transformer }: Props): KubbReactNode {\n const paramsNode = createFunctionParameters({ params: [] })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n const keys = (transformer ?? mutationKeyTransformer)({ node, casing: 'camelcase' })\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function.Arrow name={name} export params={paramsSignature} singleLine>\n {`[${keys.join(', ')}] as const`}\n </Function.Arrow>\n </File.Source>\n )\n}\n","import { getOperationParameters, getRequestGroupOptionality } from '@internals/shared'\nimport type { ast } from '@kubb/core'\nimport { createFunctionParameter, createFunctionParameters, createObjectBindingPattern, createTypeLiteral } from '@kubb/plugin-ts'\nimport type { FunctionParameterNode, FunctionParametersNode, PluginTs, ResolverTs } from '@kubb/plugin-ts'\n\n/**\n * The grouped request options, ordered for both the destructured signature and the\n * call passed to the underlying client.\n */\nconst requestGroupOrder = ['path', 'query', 'body', 'headers'] as const\n\ntype RequestGroupKey = (typeof requestGroupOrder)[number]\n\n/**\n * Builds the grouped `{ path, query, body, headers }` parameter that mirrors the client\n * function signature. Only the groups the operation carries are emitted, typed from the\n * operation's `RequestConfig`. `keys` narrows the emitted groups, used by the query key which\n * never carries `headers`.\n *\n * By default the whole group is typed as the single `RequestConfig` reference. When\n * `memberTypeWrapper` is set, each group is emitted as its own member typed from the matching\n * `RequestConfig['<group>']` slice and wrapped, used by vue-query to apply\n * `MaybeRefOrGetter` per group.\n */\nexport function buildGroupedRequestParam(\n node: ast.OperationNode,\n options: {\n resolver: ResolverTs\n keys?: ReadonlyArray<RequestGroupKey>\n memberTypeWrapper?: (type: string) => string\n },\n): FunctionParameterNode | null {\n const { resolver, keys = requestGroupOrder, memberTypeWrapper } = options\n const { groups, hasRequiredPath, hasRequiredQuery, hasRequiredHeader } = getRequestGroupOptionality(node)\n const names = keys.filter((key) => groups[key])\n\n if (names.length === 0) {\n return null\n }\n\n const requiredByGroup: Record<RequestGroupKey, boolean> = {\n path: hasRequiredPath,\n query: hasRequiredQuery,\n body: groups.body,\n headers: hasRequiredHeader,\n }\n\n // The grouped object can default to `{}` only when none of the emitted groups is required. The\n // query key narrows `keys`, so optionality is computed over the emitted groups, not all of them.\n const isOptional = names.every((name) => !requiredByGroup[name])\n\n // Drop the groups this binding never destructures (the query key omits `headers`), so a group\n // that is required elsewhere does not leak into a binding that does not carry it.\n const requestConfigName = resolver.resolveRequestConfigName(node)\n const omittedKeys = requestGroupOrder.filter((key) => !keys.includes(key))\n const requestConfigType = omittedKeys.length > 0 ? `Omit<${requestConfigName}, ${omittedKeys.map((key) => `'${key}'`).join(' | ')}>` : requestConfigName\n\n if (memberTypeWrapper) {\n const members = names.map((name) => ({\n name,\n type: memberTypeWrapper(`${requestConfigType}['${name}']`),\n optional: !requiredByGroup[name],\n }))\n\n return createFunctionParameter({\n name: createObjectBindingPattern({ elements: names.map((name) => ({ name })) }),\n type: createTypeLiteral({ members }),\n optional: false,\n ...(isOptional ? { default: '{}' } : {}),\n })\n }\n\n return createFunctionParameter({\n name: createObjectBindingPattern({ elements: names.map((name) => ({ name })) }),\n type: requestConfigType,\n optional: false,\n ...(isOptional ? { default: '{}' } : {}),\n })\n}\n\n/**\n * Builds the shared `({ path, query, body, headers }, config = {})` parameter list for a\n * TanStack query-options function. The leading parameter mirrors the client signature, and the\n * trailing `config` is a partial `RequestConfig` minus the grouped data-shape keys, which are passed\n * explicitly. Framework plugins wrap the result when needed, for example vue-query applies `MaybeRefOrGetter`.\n */\nexport function buildQueryOptionsParams(\n node: ast.OperationNode,\n options: { resolver: ResolverTs; memberTypeWrapper?: (type: string) => string },\n): FunctionParametersNode {\n const { resolver, memberTypeWrapper } = options\n\n const groupedParam = buildGroupedRequestParam(node, { resolver, memberTypeWrapper })\n\n const configParam = createFunctionParameter({\n name: 'config',\n type: `Partial<Omit<RequestConfig, 'path' | 'query' | 'body' | 'headers' | 'url'>>`,\n default: '{}',\n })\n\n return createFunctionParameters({ params: [groupedParam, configParam].filter((param): param is FunctionParameterNode => param !== null) })\n}\n\n/**\n * Builds the call to a client `<op>` function inside a query/mutation hook body. The function takes\n * a single grouped options object, so the operation's request groups are passed as\n * shorthand alongside the spread `config`, with `throwOnError: true` pinned last so a caller's config\n * can't flip the query's error semantics. Queries thread the TanStack `signal`; mutations omit it.\n *\n * @example\n * ```ts\n * buildClientCall(node, { clientName: 'getPetById', signal: true })\n * // getPetById({ path, ...config, signal: config.signal ?? signal, throwOnError: true })\n * ```\n */\nexport function buildClientCall(node: ast.OperationNode, options: { clientName: string; signal?: boolean }): string {\n const { clientName, signal = false } = options\n const { groups } = getRequestGroupOptionality(node)\n const names = requestGroupOrder.filter((key) => groups[key])\n\n const args = ['...config', ...names, signal ? 'signal: config.signal ?? signal' : null, 'throwOnError: true'].filter((part): part is string => part !== null)\n\n return `${clientName}({ ${args.join(', ')} })`\n}\n\nexport function transformName(name: string, type: string, transformers?: { name?: (name: string, type?: string) => string }): string {\n return transformers?.name?.(name, type) || name\n}\n\ntype OverrideEntry<TOptions> = {\n type: string\n pattern: string | RegExp\n options?: Partial<TOptions>\n}\n\nfunction matchesPattern(node: ast.OperationNode, ov: { type: string; pattern: string | RegExp }): boolean {\n const { type, pattern } = ov\n const matches = (value: string) => (typeof pattern === 'string' ? value === pattern : pattern.test(value))\n if (type === 'operationId') return matches(node.operationId)\n if (type === 'tag') return node.tags.some((t) => matches(t))\n if (type === 'path') return node.path !== undefined && matches(node.path)\n if (type === 'method') return node.method !== undefined && matches(node.method)\n return false\n}\n\n/**\n * Resolves per-operation overrides (first matching override wins).\n *\n * @example\n * ```ts\n * const opts = resolveOperationOverrides(node, override)\n * const queryOpts = 'query' in opts ? opts.query : defaultQuery\n * ```\n */\nexport function resolveOperationOverrides<TOptions>(node: ast.OperationNode, override?: ReadonlyArray<OverrideEntry<TOptions>>): Partial<TOptions> {\n if (!override) return {}\n const match = override.find((ov) => matchesPattern(node, ov))\n return match?.options ?? {}\n}\n\ntype ZodSchemaNameResolverLike = {\n resolveResponseName?: (node: ast.OperationNode) => string | undefined\n resolveDataName?: (node: ast.OperationNode) => string | undefined\n resolveQueryParamsName?: (node: ast.OperationNode, param: ast.ParameterNode) => string | undefined\n}\n\ntype ParserOption = false | 'zod' | { request?: 'zod'; response?: 'zod' } | undefined\n\n/**\n * Returns `'zod'` when response-direction parsing is enabled.\n * The string shorthand `'zod'` also enables response parsing.\n */\nexport function resolveResponseParser(parser: ParserOption): 'zod' | null {\n if (!parser) return null\n if (parser === 'zod') return 'zod'\n return parser.response ?? null\n}\n\n/**\n * Returns `'zod'` when request body parsing is enabled.\n * The string shorthand `'zod'` also enables request body parsing (existing behavior).\n */\nexport function resolveRequestParser(parser: ParserOption): '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-params parsing is enabled.\n * Only the object form `{ request: 'zod' }` enables this. `parser: 'zod'` does not.\n */\nexport function resolveQueryParamsParser(parser: ParserOption): 'zod' | null {\n if (!parser || parser === 'zod') return null\n return parser.request ?? null\n}\n\n/**\n * Collects the Zod schema import names for an operation based on the active parser directions.\n *\n * - `parser: 'zod'`: response and request body names (backward-compatible behavior).\n * - `parser: { request: 'zod' }`: request body and query params names.\n * - `parser: { response: 'zod' }`: response name only.\n * - `parser: { request: 'zod', response: 'zod' }`: all three.\n *\n * Returns an empty array when no resolver is provided or `parser` is falsy.\n */\nexport function resolveZodSchemaNames(node: ast.OperationNode, zodResolver: ZodSchemaNameResolverLike | null | undefined, parser: ParserOption): Array<string> {\n if (!zodResolver || !parser) return []\n const { query: queryParams } = getOperationParameters(node, { paramsCasing: 'original' })\n return [\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((n): n is string => Boolean(n))\n}\n\n/**\n * Build QueryKey params as the grouped `{ path, query, body }` object (NO headers, NO config),\n * typed from the operation's `RequestConfig` minus `url`. The query key transformer reads the\n * grouped `path`/`query`/`body` bindings.\n */\nexport function buildQueryKeyParams(node: ast.OperationNode, options: { resolver: PluginTs['resolver'] }): FunctionParametersNode {\n const { resolver } = options\n const groupedParam = buildGroupedRequestParam(node, { resolver, keys: ['path', 'query', 'body'] })\n\n return createFunctionParameters({ params: groupedParam ? [groupedParam] : [] })\n}\n","import { getOperationParameters } from '@internals/shared'\nimport { Url } from '@internals/utils'\nimport type { ast } from '@kubb/core'\nimport type { PluginTs } from '@kubb/plugin-ts'\nimport { functionPrinter } from '@kubb/plugin-ts'\nimport { File, Function, Type } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport type { Transformer } from '../types.ts'\nimport { buildQueryKeyParams } from '../utils.ts'\n\ntype Props = {\n name: string\n typeName: string\n node: ast.OperationNode\n tsResolver: PluginTs['resolver']\n transformer: Transformer | null | undefined\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\n\nexport const queryKeyTransformer: Transformer = ({ node }) => {\n if (!node.path) return []\n const hasPathParams = getOperationParameters(node).path.length > 0\n const hasQueryParams = getOperationParameters(node).query.length > 0\n const hasRequestBody = !!node.requestBody?.content?.[0]?.schema\n\n const urlObject = hasPathParams ? `{ url: '${Url.toPath(node.path)}', params: path }` : `{ url: '${Url.toPath(node.path)}' }`\n\n return [urlObject, hasQueryParams ? '...(query ? [query] : [])' : null, hasRequestBody ? '...(body ? [body] : [])' : null].filter(Boolean) as Array<string>\n}\n\nexport function QueryKey({ name, node, tsResolver, typeName, transformer }: Props): KubbReactNode {\n const paramsNode = buildQueryKeyParams(node, { resolver: tsResolver })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n const keys = (transformer ?? queryKeyTransformer)({ node, casing: 'camelcase' })\n\n return (\n <>\n <File.Source name={name} isExportable isIndexable>\n <Function.Arrow name={name} export params={paramsSignature} singleLine>\n {`[${keys.join(', ')}] as const`}\n </Function.Arrow>\n </File.Source>\n <File.Source name={typeName} isTypeOnly>\n <Type name={typeName}>{`ReturnType<typeof ${name}>`}</Type>\n </File.Source>\n </>\n )\n}\n","import type { ast } from '@kubb/core'\nimport type { FunctionParametersNode, ResolverTs } from '@kubb/plugin-ts'\nimport { createFunctionParameter, createFunctionParameters, functionPrinter } from '@kubb/plugin-ts'\nimport { File, Function, Type } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport { buildGroupedRequestParam, buildClientCall } from '@internals/tanstack-query'\nimport { buildRequestConfigType, getComments, resolveErrorNames } from '../utils.ts'\n\ntype Props = {\n name: string\n clientName: string\n mutationKeyName: string\n mutationKeyTypeName: string\n mutationArgTypeName: string\n node: ast.OperationNode\n tsResolver: ResolverTs\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\nconst callPrinter = functionPrinter({ mode: 'call' })\n\nfunction buildMutationParamsNode(\n node: ast.OperationNode,\n options: {\n mutationKeyTypeName: string\n mutationArgTypeName: string\n resolver: ResolverTs\n },\n): FunctionParametersNode {\n const { mutationKeyTypeName, mutationArgTypeName, resolver } = options\n const responseName = resolver.resolveResponseName(node)\n const errorNames = resolveErrorNames(node, resolver)\n\n const TData = responseName\n const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(' | ') : 'Error'}>`\n\n return createFunctionParameters({\n params: [\n createFunctionParameter({\n name: 'options',\n type: `{\n mutation?: SWRMutationConfiguration<${TData}, ${TError}, ${mutationKeyTypeName} | null, ${mutationArgTypeName}> & { throwOnError?: boolean },\n client?: ${buildRequestConfigType(node)},\n shouldFetch?: boolean,\n}`,\n default: '{}',\n }),\n ],\n })\n}\n\nexport function Mutation({ name, clientName, mutationKeyName, mutationKeyTypeName, mutationArgTypeName, node, tsResolver }: Props): KubbReactNode {\n const responseName = tsResolver.resolveResponseName(node)\n const errorNames = resolveErrorNames(node, tsResolver)\n\n const TData = responseName\n const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(' | ') : 'Error'}>`\n\n const groupedParam = buildGroupedRequestParam(node, { resolver: tsResolver })\n const hasMutationParams = groupedParam !== null\n const groupedParamsNode = createFunctionParameters({ params: groupedParam ? [groupedParam] : [] })\n const argTypeBody = hasMutationParams ? tsResolver.resolveRequestConfigName(node) : ''\n const argBindingStr = hasMutationParams ? (callPrinter.print(groupedParamsNode) ?? '') : ''\n const mutationFnBody = `const { data } = await ${buildClientCall(node, { clientName, signal: false })}\n return data`\n\n const generics = [TData, TError, `${mutationKeyTypeName} | null`, mutationArgTypeName]\n\n const paramsNode = buildMutationParamsNode(node, {\n mutationKeyTypeName,\n mutationArgTypeName,\n resolver: tsResolver,\n })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n\n return (\n <>\n <File.Source name={mutationArgTypeName} isExportable isIndexable isTypeOnly>\n <Type name={mutationArgTypeName} export>\n {hasMutationParams ? argTypeBody : 'never'}\n </Type>\n </File.Source>\n <File.Source name={name} isExportable isIndexable>\n <Function name={name} export params={paramsSignature} JSDoc={{ comments: getComments(node) }}>\n {`\n const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {}\n const mutationKey = ${mutationKeyName}()\n\n return useSWRMutation<${generics.join(', ')}>(\n shouldFetch ? mutationKey : null,\n async (_url${hasMutationParams ? `, { arg: ${argBindingStr} }` : ''}) => {\n ${mutationFnBody}\n },\n mutationOptions\n )\n `}\n </Function>\n </File.Source>\n </>\n )\n}\n","import type { Transformer } from '@internals/tanstack-query'\nimport { MutationKey as SharedMutationKey } from '@internals/tanstack-query'\nimport type { ast } from '@kubb/core'\nimport { File, Type } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\n\ntype Props = {\n name: string\n typeName: string\n node: ast.OperationNode\n transformer: Transformer | undefined\n}\n\nexport function MutationKey({ name, typeName, node, transformer }: Props): KubbReactNode {\n return (\n <>\n <SharedMutationKey name={name} node={node} transformer={transformer} />\n <File.Source name={typeName} isExportable isIndexable isTypeOnly>\n <Type export name={typeName}>{`ReturnType<typeof ${name}>`}</Type>\n </File.Source>\n </>\n )\n}\n","import type { ast } from '@kubb/core'\nimport type { FunctionParametersNode, ResolverTs } from '@kubb/plugin-ts'\nimport { functionPrinter } from '@kubb/plugin-ts'\nimport { File, Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport { buildQueryOptionsParams, buildClientCall } from '@internals/tanstack-query'\n\ntype Props = {\n name: string\n clientName: string\n node: ast.OperationNode\n tsResolver: ResolverTs\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\n\nexport function getQueryOptionsParams(node: ast.OperationNode, options: { resolver: ResolverTs }): FunctionParametersNode {\n return buildQueryOptionsParams(node, options)\n}\n\nexport function QueryOptions({ name, clientName, node, tsResolver }: Props): KubbReactNode {\n const paramsNode = getQueryOptionsParams(node, { resolver: tsResolver })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n const fetcherBody = `const { data } = await ${buildClientCall(node, { clientName, signal: false })}\n return data`\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function name={name} export params={paramsSignature}>\n {`\n return {\n fetcher: async () => {\n ${fetcherBody}\n },\n }\n`}\n </Function>\n </File.Source>\n )\n}\n","import type { ast } from '@kubb/core'\nimport type { FunctionParameterNode, FunctionParametersNode, ResolverTs } from '@kubb/plugin-ts'\nimport { createFunctionParameter, createFunctionParameters, functionPrinter } from '@kubb/plugin-ts'\nimport { File, Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport { buildGroupedRequestParam } from '@internals/tanstack-query'\nimport { buildClientOptionType, buildQueryKeyParams, getComments, resolveErrorNames } from '../utils.ts'\nimport { getQueryOptionsParams } from './QueryOptions.tsx'\n\ntype Props = {\n name: string\n queryOptionsName: string\n queryKeyName: string\n queryKeyTypeName: string\n node: ast.OperationNode\n tsResolver: ResolverTs\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\nconst callPrinter = functionPrinter({ mode: 'call' })\n\nfunction buildQueryParamsNode(\n node: ast.OperationNode,\n options: {\n resolver: ResolverTs\n },\n): FunctionParametersNode {\n const { resolver } = options\n const responseName = resolver.resolveResponseName(node)\n const errorNames = resolveErrorNames(node, resolver)\n\n const TData = responseName\n const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(' | ') : 'Error'}>`\n\n const optionsParam = createFunctionParameter({\n name: 'options',\n type: `{\n query?: SWRConfiguration<${[TData, TError].join(', ')}>,\n client?: ${buildClientOptionType()},\n shouldFetch?: boolean,\n immutable?: boolean\n}`,\n default: '{}',\n })\n\n const groupedParam = buildGroupedRequestParam(node, { resolver })\n\n return createFunctionParameters({ params: [groupedParam, optionsParam].filter((param): param is FunctionParameterNode => param !== null) })\n}\n\nexport function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, node, tsResolver }: Props): KubbReactNode {\n const responseName = tsResolver.resolveResponseName(node)\n const errorNames = resolveErrorNames(node, tsResolver)\n\n const TData = responseName\n const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(' | ') : 'Error'}>`\n const generics = [TData, TError, `${queryKeyTypeName} | null`]\n\n const queryKeyParamsNode = buildQueryKeyParams(node, { resolver: tsResolver })\n const queryKeyParamsCall = callPrinter.print(queryKeyParamsNode) ?? ''\n\n const queryOptionsParamsNode = getQueryOptionsParams(node, { resolver: tsResolver })\n const queryOptionsParamsCall = callPrinter.print(queryOptionsParamsNode) ?? ''\n\n const paramsNode = buildQueryParamsNode(node, { resolver: tsResolver })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function name={name} export params={paramsSignature} JSDoc={{ comments: getComments(node) }}>\n {`\n const { query: queryOptions, client: config = {}, shouldFetch = true, immutable } = options ?? {}\n\n const queryKey = ${queryKeyName}(${queryKeyParamsCall})\n\n return useSWR<${generics.join(', ')}>(\n shouldFetch ? queryKey : null,\n {\n ...${queryOptionsName}(${queryOptionsParamsCall}),\n ...(immutable ? {\n revalidateIfStale: false,\n revalidateOnFocus: false,\n revalidateOnReconnect: false\n } : { }),\n ...queryOptions,\n }\n )\n `}\n </Function>\n </File.Source>\n )\n}\n","import { resolveOperationTypeNames } from '@internals/shared'\nimport { resolveClientOperation } from '@internals/client'\nimport { resolveZodSchemaNames } from '@internals/tanstack-query'\nimport { ast, defineGenerator } from '@kubb/core'\nimport { isParserEnabled } from '@internals/client'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, jsxRenderer } from '@kubb/renderer-jsx'\nimport { Mutation, MutationKey } from '../components'\nimport type { PluginSwr } from '../types'\n\n/**\n * Built-in generator for `useSWRMutation` hooks. Emits one `useFooMutation` hook\n * per POST/PUT/DELETE operation (configurable via `mutation.methods`) plus\n * the matching `fooMutationKey` helper.\n */\nexport const mutationGenerator = defineGenerator<PluginSwr>({\n name: 'swr-mutation',\n renderer: jsxRenderer,\n operation(node, ctx) {\n if (!ast.isHttpOperationNode(node)) return null\n const { config, driver, resolver, root } = ctx\n const { output, query, mutation, parser, client, group } = ctx.options\n\n const pluginTs = driver.getPlugin(pluginTsName)\n if (!pluginTs) return null\n const tsResolver = driver.getResolver(pluginTsName)\n\n const isQuery = query === false || (!!query && query.methods.some((method) => node.method.toLowerCase() === method.toLowerCase()))\n const queryMethods = new Set(query ? query.methods : [])\n const isMutation =\n mutation !== false &&\n !isQuery &&\n (mutation ? mutation.methods : []).some((method) => !queryMethods.has(method) && node.method.toLowerCase() === method.toLowerCase())\n\n if (!isMutation) return null\n\n const importPath = mutation ? mutation.importPath : 'swr/mutation'\n\n // The registered contract client plugin owns the `<op>` the hook imports and calls.\n const contractOp = resolveClientOperation({ clientPlugin: { pluginName: client.pluginName }, driver, node, root, output })\n if (!contractOp) return null\n\n const mutationHookName = resolver.resolveMutationName(node)\n const mutationKeyName = resolver.resolveMutationKeyName(node)\n const mutationKeyTypeName = resolver.resolveMutationKeyTypeName(node)\n const mutationArgTypeName = resolver.resolveMutationArgTypeName(node)\n\n const meta = {\n file: resolver.resolveFile({ name: mutationHookName, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path }, { root, output, group }),\n fileTs: tsResolver.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n { root, output: pluginTs.options?.output ?? output, group: pluginTs.options?.group },\n ),\n }\n\n const importedTypeNames = [\n tsResolver.resolveRequestConfigName(node),\n ...resolveOperationTypeNames(node, tsResolver, { order: 'body-response-first', includeParams: false }),\n ].filter((name): name is string => Boolean(name))\n\n const pluginZod = isParserEnabled(parser) ? driver.getPlugin(pluginZodName) : undefined\n const zodResolver = pluginZod ? driver.getResolver(pluginZodName) : undefined\n const fileZod = zodResolver\n ? zodResolver.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n { root, output: pluginZod?.options?.output ?? output, group: pluginZod?.options?.group },\n )\n : undefined\n const zodSchemaNames = resolveZodSchemaNames(node, zodResolver, parser)\n\n const calledClientName = contractOp.name\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 {fileZod && zodSchemaNames.length > 0 && <File.Import name={zodSchemaNames} root={meta.file.path} path={fileZod.path} />}\n\n <File.Import name={[contractOp.name]} root={meta.file.path} path={contractOp.path} />\n <File.Import name={['RequestConfig', 'ResponseErrorConfig']} root={meta.file.path} path={contractOp.clientPath} isTypeOnly />\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 <MutationKey name={mutationKeyName} typeName={mutationKeyTypeName} node={node} transformer={ctx.options.mutationKey} />\n\n {mutation && (\n <>\n <File.Import name={'useSWRMutation'} path={importPath} />\n <File.Import name={['SWRMutationConfiguration']} path={importPath} isTypeOnly />\n <Mutation\n name={mutationHookName}\n clientName={calledClientName}\n mutationKeyName={mutationKeyName}\n mutationKeyTypeName={mutationKeyTypeName}\n mutationArgTypeName={mutationArgTypeName}\n node={node}\n tsResolver={tsResolver}\n />\n </>\n )}\n </File>\n )\n },\n})\n","import { resolveOperationTypeNames } from '@internals/shared'\nimport { resolveClientOperation } from '@internals/client'\nimport { resolveZodSchemaNames } from '@internals/tanstack-query'\nimport { ast, defineGenerator } from '@kubb/core'\nimport { isParserEnabled } from '@internals/client'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, jsxRenderer } from '@kubb/renderer-jsx'\nimport { Query, QueryKey, QueryOptions } from '../components'\nimport type { PluginSwr } from '../types'\n\nexport const queryGenerator = defineGenerator<PluginSwr>({\n name: 'swr-query',\n renderer: jsxRenderer,\n operation(node, ctx) {\n if (!ast.isHttpOperationNode(node)) return null\n const { config, driver, resolver, root } = ctx\n const { output, query, mutation, parser, client, group } = ctx.options\n\n const pluginTs = driver.getPlugin(pluginTsName)\n if (!pluginTs) return null\n const tsResolver = driver.getResolver(pluginTsName)\n\n const isQuery = query === false || (!!query && query.methods.some((method) => node.method.toLowerCase() === method.toLowerCase()))\n const queryMethods = new Set(query ? query.methods : [])\n const isMutation =\n mutation !== false &&\n !isQuery &&\n (mutation ? mutation.methods : []).some((method) => !queryMethods.has(method) && node.method.toLowerCase() === method.toLowerCase())\n\n if (!isQuery || isMutation) return null\n\n const importPath = query ? query.importPath : 'swr'\n\n // The registered contract client plugin owns the `<op>` the hook imports and calls.\n const contractOp = resolveClientOperation({ clientPlugin: { pluginName: client.pluginName }, driver, node, root, output })\n if (!contractOp) return null\n\n const queryName = resolver.resolveQueryName(node)\n const queryOptionsName = resolver.resolveQueryOptionsName(node)\n const queryKeyName = resolver.resolveQueryKeyName(node)\n const queryKeyTypeName = resolver.resolveQueryKeyTypeName(node)\n\n const meta = {\n file: resolver.resolveFile({ name: queryName, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path }, { root, output, group }),\n fileTs: tsResolver.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n { root, output: pluginTs.options?.output ?? output, group: pluginTs.options?.group },\n ),\n }\n\n const importedTypeNames = [\n tsResolver.resolveRequestConfigName(node),\n ...resolveOperationTypeNames(node, tsResolver, {\n exclude: [queryKeyTypeName],\n order: 'body-response-first',\n includeParams: false,\n }),\n ].filter((name): name is string => Boolean(name))\n\n const pluginZod = isParserEnabled(parser) ? driver.getPlugin(pluginZodName) : undefined\n const zodResolver = pluginZod ? driver.getResolver(pluginZodName) : undefined\n const fileZod = zodResolver\n ? zodResolver.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n { root, output: pluginZod?.options?.output ?? output, group: pluginZod?.options?.group },\n )\n : undefined\n const zodSchemaNames = resolveZodSchemaNames(node, zodResolver, parser)\n\n const calledClientName = contractOp.name\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 {fileZod && zodSchemaNames.length > 0 && <File.Import name={zodSchemaNames} root={meta.file.path} path={fileZod.path} />}\n\n <File.Import name={[contractOp.name]} root={meta.file.path} path={contractOp.path} />\n <File.Import name={['RequestConfig', 'ResponseErrorConfig']} root={meta.file.path} path={contractOp.clientPath} isTypeOnly />\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 <QueryKey name={queryKeyName} typeName={queryKeyTypeName} node={node} tsResolver={tsResolver} transformer={ctx.options.queryKey} />\n\n <QueryOptions name={queryOptionsName} clientName={calledClientName} node={node} tsResolver={tsResolver} />\n\n {query && (\n <>\n <File.Import name={'useSWR'} path={importPath} />\n <File.Import name={['SWRConfiguration']} path={importPath} isTypeOnly />\n <Query\n name={queryName}\n queryOptionsName={queryOptionsName}\n queryKeyName={queryKeyName}\n queryKeyTypeName={queryKeyTypeName}\n node={node}\n tsResolver={tsResolver}\n />\n </>\n )}\n </File>\n )\n },\n})\n","import { camelCase, toFilePath } from '@internals/utils'\nimport { defineResolver } from '@kubb/core'\nimport type { PluginSwr } from '../types.ts'\n\nfunction capitalize(name: string): string {\n return `${name.charAt(0).toUpperCase()}${name.slice(1)}`\n}\n\n/**\n * Naming convention resolver for the SWR plugin.\n *\n * Provides default naming helpers using camelCase for functions and file paths.\n *\n * @example\n * `resolverSwr.default('list pets', 'function') // → 'listPets'`\n */\nexport const resolverSwr = defineResolver<PluginSwr>(() => ({\n name: 'default',\n pluginName: 'plugin-swr',\n default(name, type) {\n return type === 'file' ? toFilePath(name) : 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 resolveQueryName(node) {\n return `use${capitalize(this.resolveName(node.operationId))}`\n },\n resolveMutationName(node) {\n return `use${capitalize(this.resolveName(node.operationId))}`\n },\n resolveQueryOptionsName(node) {\n return `${this.resolveName(node.operationId)}QueryOptions`\n },\n resolveQueryKeyName(node) {\n return `${this.resolveName(node.operationId)}QueryKey`\n },\n resolveMutationKeyName(node) {\n return `${this.resolveName(node.operationId)}MutationKey`\n },\n resolveQueryKeyTypeName(node) {\n return `${capitalize(this.resolveName(node.operationId))}QueryKey`\n },\n resolveMutationKeyTypeName(node) {\n return `${capitalize(this.resolveName(node.operationId))}MutationKey`\n },\n resolveMutationArgTypeName(node) {\n return `${capitalize(this.resolveName(node.operationId))}MutationArg`\n },\n resolveClientName(node) {\n return this.resolveName(node.operationId)\n },\n}))\n","import { createGroupConfig } from '@internals/shared'\nimport { definePlugin } from '@kubb/core'\nimport { isParserEnabled } from '@internals/client'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { resolveClient } from '@internals/client'\nimport { mutationKeyTransformer, queryKeyTransformer } from '@internals/tanstack-query'\nimport { mutationGenerator, queryGenerator } from './generators'\nimport { resolverSwr } from './resolvers/resolverSwr.ts'\nimport type { PluginSwr } from './types.ts'\n\nexport const pluginSwrName = 'plugin-swr' satisfies PluginSwr['name']\n\nexport const pluginSwr = definePlugin<PluginSwr>((options) => {\n const {\n output = { path: 'hooks', barrel: { type: 'named' } },\n group,\n exclude = [],\n include,\n override = [],\n parser = false,\n mutation = {},\n query = {},\n mutationKey = mutationKeyTransformer,\n queryKey = queryKeyTransformer,\n client,\n resolver: userResolver,\n macros: userMacros,\n } = options\n\n const selectedGenerators = [queryGenerator, mutationGenerator].filter((generator): generator is NonNullable<typeof generator> => Boolean(generator))\n\n const groupConfig = createGroupConfig(group) ?? undefined\n\n return {\n name: pluginSwrName,\n options,\n dependencies: [pluginTsName, isParserEnabled(parser) ? pluginZodName : undefined].filter((dependency): dependency is string => Boolean(dependency)),\n hooks: {\n 'kubb:plugin:setup'(ctx) {\n const resolver = userResolver ? { ...resolverSwr, ...userResolver } : resolverSwr\n\n const pluginNames = (ctx.config.plugins ?? []).map((p) => (p as { name?: string }).name).filter((name): name is string => Boolean(name))\n const resolvedClient = resolveClient({ client, pluginNames })\n if (resolvedClient.kind === 'error') {\n throw new Error(resolvedClient.message)\n }\n\n // The hooks always call a registered client plugin's op. The client runtime lives in\n // plugin-axios / plugin-fetch, so nothing is bundled here.\n const resolvedClientDescriptor: PluginSwr['resolvedOptions']['client'] = { kind: 'contract', pluginName: resolvedClient.pluginName }\n\n ctx.setOptions({\n output,\n client: resolvedClientDescriptor,\n queryKey,\n query:\n query === false\n ? false\n : {\n importPath: 'swr',\n methods: ['get'],\n ...query,\n },\n mutationKey,\n mutation:\n mutation === false\n ? false\n : {\n importPath: 'swr/mutation',\n methods: ['post', 'put', 'patch', 'delete'],\n ...mutation,\n },\n parser,\n group: groupConfig,\n exclude,\n include,\n override,\n resolver,\n })\n ctx.setResolver(resolver)\n if (userMacros?.length) {\n ctx.setMacros(userMacros)\n }\n\n ctx.addGenerator(...selectedGenerators)\n },\n },\n }\n})\n\nexport default pluginSwr\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,KAA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,IAAI,UAAU,UAAU;GAG1B,IAAI,aAAa,GAAG,kBAAkB;EACxC,EACF;CACF;AACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-swr",
3
- "version": "5.0.0-beta.75",
3
+ "version": "5.0.0-beta.76",
4
4
  "description": "Generate type-safe SWR hooks with Kubb. Covers useSWR and useSWRMutation with full TypeScript support.",
5
5
  "keywords": [
6
6
  "code-generation",
@@ -58,8 +58,8 @@
58
58
  "@kubb/ast": "5.0.0-beta.74",
59
59
  "@kubb/core": "5.0.0-beta.74",
60
60
  "@kubb/renderer-jsx": "5.0.0-beta.74",
61
- "@kubb/plugin-ts": "5.0.0-beta.75",
62
- "@kubb/plugin-zod": "5.0.0-beta.75"
61
+ "@kubb/plugin-ts": "5.0.0-beta.76",
62
+ "@kubb/plugin-zod": "5.0.0-beta.76"
63
63
  },
64
64
  "devDependencies": {
65
65
  "@internals/client": "0.0.0",