@kubb/plugin-react-query 5.10.0-canary.20261109T191216 → 5.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +598 -569
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -5
- package/dist/index.d.ts +8 -5
- package/dist/index.js +597 -568
- package/dist/index.js.map +1 -1
- package/docs/options.md +1 -1
- package/kubb-extension.json +1 -1
- package/package.json +9 -8
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["declarationPrinter","callPrinter","declarationPrinter","declarationPrinter","declarationPrinter","declarationPrinter","callPrinter","declarationPrinter","callPrinter","getComments"],"sources":["../../../internals/shared/src/operation.ts","../../../internals/utils/src/casing.ts","../../../internals/utils/src/reserved.ts","../../../internals/utils/src/strings.ts","../../../internals/shared/src/resolver.ts","../../../internals/shared/src/group.ts","../kubb-extension.json","../package.json","../../../internals/client/src/resolveOperationTypes.ts","../../../internals/client/src/resolveClient.ts","../../../internals/client/src/resolveClientOperation.ts","../../../internals/tanstack-query/src/components/HookFile.tsx","../../../internals/tanstack-query/src/utils.ts","../../../internals/tanstack-query/src/components/InfiniteQueryOptions.tsx","../../../internals/tanstack-query/src/components/MutationKey.tsx","../../../internals/tanstack-query/src/resolver.ts","../../../internals/tanstack-query/src/components/QueryKey.tsx","../src/generators/customHookOptionsFileGenerator.tsx","../src/generators/hookOptionsGenerator.tsx","../src/components/Query.tsx","../src/components/QueryOptions.tsx","../src/generators/createQueryGenerator.tsx","../src/generators/infiniteQueryGenerator.tsx","../src/components/MutationOptions.tsx","../src/components/Mutation.tsx","../src/generators/mutationGenerator.tsx","../src/generators/queryGenerator.tsx","../src/generators/suspenseInfiniteQueryGenerator.tsx","../src/generators/suspenseQueryGenerator.tsx","../src/resolvers/resolverReactQuery.ts","../src/plugin.ts"],"sourcesContent":["import { ast, type Group, type Memo, type Output, type Resolver, type ResolverFileParams, Url } from '@kubb/kit'\n\n/**\n * Builds the `ResolverFileParams` every operation generator passes to\n * `resolver.file`: a file named `name`, tagged by the operation's first\n * tag (or `'default'`), at the operation's path. Centralizes the entry object\n * that was repeated at dozens of call sites across the client and query plugins.\n *\n * @example\n * ```ts\n * resolver.file(operationFileEntry(node, node.operationId), { root, output, group })\n * ```\n */\nexport function operationFileEntry(node: ast.OperationNode, name: string, extname: ResolverFileParams['extname'] = '.ts'): ResolverFileParams {\n return {\n name,\n extname,\n tag: node.tags[0] ?? 'default',\n path: node.path,\n }\n}\n\n/**\n * Resolves a dependency plugin's generated file for `node.operationId`, cached in `memo` (the\n * build's `ctx.memo`) under the resolver's own plugin name and the operation. Several dependents reading the\n * same dependency for the same operation in one pass (a query plugin's several hook generators, the\n * MCP handler, ...) share one computed name and path instead of each calling `resolver.file` again.\n *\n * @example Cache `plugin-ts`'s file for the current operation\n * ```ts\n * const fileTs = resolveDependencyOperationFile({ memo: ctx.memo, node, resolver: tsResolver, root, output })\n * ```\n */\nexport function resolveDependencyOperationFile(options: {\n memo: Memo\n node: ast.OperationNode\n resolver: Pick<Resolver, 'file' | 'pluginName'>\n root: string\n output: Output\n group?: Group | null\n}): ast.FileNode {\n const { memo, node, resolver, root, output, group } = options\n\n return memo(`${resolver.pluginName}:operationFile:${node.operationId}`, () =>\n resolver.file({ ...operationFileEntry(node, node.operationId), root, output, group: group ?? undefined }),\n )\n}\n\nexport type ContentTypeInfo = {\n contentTypes: string[]\n isMultipleContentTypes: boolean\n contentTypeUnion: string\n defaultContentType: string\n hasFormData: boolean\n}\n\nexport type RequestConfigResolver = {\n response: {\n body(node: ast.OperationNode): string\n }\n}\n\nexport type ResponseStatusNameResolver = {\n response: {\n status(node: ast.OperationNode, statusCode: ast.StatusCode): string\n }\n}\n\nexport type ResponseNameResolver = ResponseStatusNameResolver & {\n response: {\n response(node: ast.OperationNode): string\n }\n}\n\nexport type OperationTypeNameResolver = RequestConfigResolver &\n ResponseNameResolver & {\n param: {\n path(node: ast.OperationNode, param: ast.ParameterNode): string\n query(node: ast.OperationNode, param: ast.ParameterNode): string\n headers(node: ast.OperationNode, param: ast.ParameterNode): string\n cookies(node: ast.OperationNode, param: ast.ParameterNode): string\n }\n }\n\nexport type OperationCommentLink = 'pathTemplate' | 'urlPath' | false | ((node: ast.OperationNode) => string | undefined)\n\nexport type BuildOperationCommentsOptions = {\n link?: OperationCommentLink\n linkPosition?: 'beforeDeprecated' | 'afterDeprecated'\n splitLines?: boolean\n}\n\ntype ResponseLike = {\n statusCode: ast.StatusCode | number | string\n}\n\nexport type OperationParameterGroups = Record<Exclude<ast.ParameterNode['in'], 'querystring'>, Array<ast.ParameterNode>>\n\nexport type ResolveOperationTypeNameOptions = {\n responseStatusNames?: boolean | 'error'\n exclude?: ReadonlyArray<string | undefined>\n order?: 'params-first' | 'body-response-first'\n /**\n * Include the individual `Path`/`Query`/`Headers` group type names. Set to `false` for clients\n * that reference the grouped `Options` type instead of the per-group types.\n */\n includeParams?: boolean\n}\n\nfunction getOperationLink(node: ast.OperationNode, link: OperationCommentLink): string | null {\n if (!link) {\n return null\n }\n\n if (typeof link === 'function') {\n return link(node) ?? null\n }\n\n return node.path ? `{@link ${Url.toPath(node.path)}}` : null\n}\n\n/**\n * Derives the shared `ContentTypeInfo` shape from a list of content types, tracking whether several\n * are present and the union, default, and form-data flags the client uses to pick one.\n */\nfunction buildContentTypeInfo(contentTypes: string[]): ContentTypeInfo {\n const isMultipleContentTypes = contentTypes.length > 1\n\n return {\n contentTypes,\n isMultipleContentTypes,\n contentTypeUnion: isMultipleContentTypes ? contentTypes.map((ct) => JSON.stringify(ct)).join(' | ') : '',\n defaultContentType: contentTypes[0] ?? 'application/json',\n hasFormData: contentTypes.some((ct) => ct === 'multipart/form-data'),\n }\n}\n\nexport function getContentTypeInfo(node: ast.OperationNode): ContentTypeInfo {\n return buildContentTypeInfo(node.requestBody?.content?.map((e) => e.contentType) ?? [])\n}\n\n/**\n * The request-body counterpart for the primary success response: the content types it documents and\n * whether several are present, so the client can let a caller pick which one to accept.\n */\nexport function getResponseContentTypeInfo(node: ast.OperationNode): ContentTypeInfo {\n return buildContentTypeInfo(getPrimarySuccessResponse(node)?.content?.map((e) => e.contentType) ?? [])\n}\n\nexport type ResponseType = 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream'\n\nfunction baseContentType(contentType: string): string {\n return contentType.split(';')[0]!.trim().toLowerCase()\n}\n\ntype ResponseContentEntry = { contentType: string; schema?: ast.SchemaNode | null; stream?: ast.ContentNode['stream'] }\n\n/**\n * Whether a content entry is a sequence of JSON values the adapter marks as a stream, such as `application/jsonl`,\n * `application/x-ndjson`, `application/json-seq`, or any media type with an OpenAPI 3.2 `itemSchema`.\n */\nfunction isJsonLines(entry: ResponseContentEntry): boolean {\n const baseType = baseContentType(entry.contentType)\n // `multipart/mixed` is a stream of parts, not of JSON values.\n return Boolean(entry.stream) && baseType !== 'text/event-stream' && !baseType.startsWith('multipart/')\n}\n\n/**\n * How an operation streams its primary success response item by item, when that response declares one content type:\n * - `'event'` for `text/event-stream` whose `itemSchema` types the whole event with its own `event` and `data`\n * - `'data'` for `text/event-stream` typed by its payload only\n * - `'line'` for JSON Lines, one parsed JSON value per line\n *\n * Returns `null` for any other response, and for a response that also declares another content type, which stays a normal\n * call with its query hooks.\n */\nexport function getEventStream(node: ast.OperationNode): 'event' | 'data' | 'line' | null {\n const content = getPrimarySuccessResponse(node)?.content ?? []\n if (content.length !== 1) return null\n const entry = content[0]!\n if (baseContentType(entry.contentType) === 'text/event-stream') return entry.stream?.shape ?? 'data'\n return isJsonLines(entry) ? 'line' : null\n}\n\n/**\n * Whether an operation streams its primary success response, as Server-Sent Events or JSON Lines. The client generator uses\n * this to return a typed stream of items instead of a one-shot `RequestResult`.\n */\nexport function isEventStream(node: ast.OperationNode): boolean {\n return getEventStream(node) !== null\n}\n\n/**\n * Whether the primary success response offers `text/event-stream`, alone or next to other content types. The client asks\n * for the stream by default and ships the `sse.ts` runtime, so a mixed response can be read as events too.\n */\nexport function hasEventStreamContent(node: ast.OperationNode): boolean {\n const entries = getPrimarySuccessResponse(node)?.content ?? []\n // Next to another type, a stream without a schema gets no typed variant, so it keeps the plain call.\n return entries.some((entry) => baseContentType(entry.contentType) === 'text/event-stream' && (entries.length === 1 || Boolean(entry.schema)))\n}\n\nfunction isJsonContentType(baseType: string): boolean {\n return baseType === 'application/json' || baseType.endsWith('+json') || baseType === 'text/json'\n}\n\n/**\n * Parser for one response content entry.\n *\n * JSON stays unset so the runtime detects it. `text/event-stream` and JSON Lines are streams. A binary schema\n * (`format: binary` / `contentMediaType`) is a blob even when the media type is not a well-known\n * binary type. Other `text/*` is text, and `application/octet-stream`, `application/pdf`,\n * `image/*`, `audio/*`, and `video/*` are blobs.\n */\nfunction responseTypeForContent(entry: ResponseContentEntry): ResponseType | undefined {\n const baseType = baseContentType(entry.contentType)\n if (!baseType) return undefined\n if (baseType === 'text/event-stream' || isJsonLines(entry)) return 'stream'\n if (isJsonContentType(baseType)) return undefined\n if (entry.schema?.type === 'blob') return 'blob'\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 * Derives the default `responseType` string for an operation from its primary success response.\n *\n * One content type uses {@link responseTypeForContent}. Several content types that all use the same\n * parser collapse to that string, so a call can keep `responseType: 'blob'`. Mixed parsers return\n * `undefined`; {@link getResponseTypeMap} carries the per-type choice.\n */\nexport function getResponseType(node: ast.OperationNode): ResponseType | undefined {\n const entries = getPrimarySuccessResponse(node)?.content ?? []\n if (entries.length === 0) return undefined\n\n const responseTypes = entries.map((entry) => responseTypeForContent(entry))\n const first = responseTypes[0]\n if (!first) return undefined\n if (responseTypes.every((responseType) => responseType === first)) return first\n return undefined\n}\n\n/**\n * Maps each base content type of a primary success response to its parser when those parsers differ.\n *\n * Keys are lowercased and stripped of parameters. JSON entries are kept as `'json'` so a catch-all\n * entry cannot claim a JSON response. Returns `undefined` when {@link getResponseType} already\n * covers the response with one string, or when no content type needs a parser other than JSON.\n * The runtime matches the response `Content-Type` against this map instead of guessing from the media type.\n */\nexport function getResponseTypeMap(node: ast.OperationNode): Record<string, ResponseType> | undefined {\n if (getResponseType(node)) return undefined\n\n const entries = getPrimarySuccessResponse(node)?.content ?? []\n if (entries.length <= 1) return undefined\n\n const map: Record<string, ResponseType> = {}\n for (const entry of entries) {\n const baseType = baseContentType(entry.contentType)\n const responseType = responseTypeForContent(entry) ?? (isJsonContentType(baseType) ? 'json' : undefined)\n if (baseType && responseType) map[baseType] = responseType\n }\n\n return Object.values(map).some((responseType) => responseType !== 'json') ? map : 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 * Returns the entry with a `string` schema when the client runtime reads its body as text, such as `Pet` on `application/xml`.\n * JSON, binary, and stream entries keep their schema, and so do wildcards such as `application/*` and the any-type `*`, so the runtime can pick the\n * parser from the server's `Content-Type`. `text/*` reads as text.\n */\nexport function toResponseContent<T extends ContentVariantInput & ResponseContentEntry>(entry: T): T {\n const { contentType, schema } = entry\n if (!schema || entry.stream || ast.resolveRef(schema).primitive === 'string') return entry\n\n const baseType = baseContentType(contentType)\n const responseType = responseTypeForContent(entry)\n const isText = responseType === 'text' || (!responseType && Boolean(baseType) && !isJsonContentType(baseType) && !baseType.includes('*'))\n\n return isText ? { ...entry, schema: ast.factory.createSchema({ type: 'string' }), keysToOmit: null } : entry\n}\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\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. It drops the data-shape keys to stay assignable to `Options`, which omits them\n * from `RequestConfig`. `cookies` is a group only on an operation that declares one.\n */\nexport function buildClientOptionType(node: ast.OperationNode): string {\n const cookies = getOperationParameters(node).cookie.length > 0 ? ` | 'cookies'` : ''\n return `Partial<Omit<RequestConfig, 'path' | 'query' | 'body' | 'headers'${cookies} | 'url'>>`\n}\n\nexport function buildRequestConfigType(node: ast.OperationNode): string {\n const request = getContentTypeInfo(node)\n const response = getResponseContentTypeInfo(node)\n\n // Only the ambiguous side is offered: a single-type side has nothing to pick, so it stays baked in\n // the generated call.\n const members = [\n request.isMultipleContentTypes ? `request?: ${request.contentTypeUnion}` : null,\n response.isMultipleContentTypes ? `response?: ${response.contentTypeUnion}` : null,\n ].filter(Boolean)\n\n const base = buildClientOptionType(node)\n return members.length ? `${base} & { contentType?: { ${members.join('; ')} } }` : base\n}\n\n/** The grouped request options, in the order generated signatures and calls list them. */\nexport const requestGroupOrder = ['path', 'query', 'body', 'headers', 'cookies'] as const\n\nexport type RequestGroups = {\n path: boolean\n query: boolean\n body: boolean\n headers: boolean\n cookies: 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, cookie } = 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 cookies: cookie.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 // `cookies` never makes the parameter required: a browser sends its cookies itself and cannot set a `Cookie` header.\n isOptional: !hasRequiredPath && !hasRequiredQuery && !hasRequiredHeader && !(groups.body && node.requestBody?.required === true),\n }\n}\n\nexport type RequestOptionsNameResolver = RequestConfigResolver & {\n response: {\n options(node: ast.OperationNode): string\n }\n}\n\n/**\n * Builds the grouped `{ path, query, body, headers, cookies }` parameter for a generated client\n * function, typed from the operation's `Options` (minus `url`). Only the groups the\n * operation actually has are destructured. The trailing `config` parameter carries the\n * runtime `RequestConfig` overrides plus `client`.\n */\nexport function buildRequestParamsSignature(\n node: ast.OperationNode,\n resolver: RequestOptionsNameResolver,\n options: { isConfigurable?: boolean } = {},\n): { signature: string; groups: RequestGroups; names: Array<keyof RequestGroups> } {\n const { isConfigurable = true } = options\n const { groups, isOptional } = getRequestGroupOptionality(node)\n\n const names = requestGroupOrder.filter((key) => groups[key])\n\n // These callers never carry the `contentType` that several media types require.\n const optionsType = hasRequestContentTypeChoice(node)\n ? `Pick<${resolver.response.options(node)}, ${names.map((name) => `'${name}'`).join(' | ')}>`\n : resolver.response.options(node)\n const firstParam = names.length > 0 ? `{ ${names.join(', ')} }: ${optionsType}${isOptional ? ' = {}' : ''}` : null\n const configParam = isConfigurable ? `config: ${buildRequestConfigType(node)} = {}` : null\n\n return {\n signature: [firstParam, configParam].filter(Boolean).join(', '),\n groups,\n names,\n }\n}\n\nexport function buildOperationComments(node: ast.OperationNode, options: BuildOperationCommentsOptions = {}): Array<string> {\n const { link = 'pathTemplate', linkPosition = 'afterDeprecated', splitLines = false } = options\n const linkComment = getOperationLink(node, link)\n const comments =\n linkPosition === 'beforeDeprecated'\n ? [node.description && `@description ${node.description}`, node.summary && `@summary ${node.summary}`, linkComment, node.deprecated && '@deprecated']\n : [node.description && `@description ${node.description}`, node.summary && `@summary ${node.summary}`, node.deprecated && '@deprecated', linkComment]\n\n const filteredComments = comments.filter((comment): comment is string => Boolean(comment))\n\n if (!splitLines) {\n return filteredComments\n }\n\n return filteredComments.flatMap((text) => text.split(/\\r?\\n/).map((line) => line.trim())).filter((comment): comment is string => Boolean(comment))\n}\n\nconst operationParameterGroupsByNode = new WeakMap<ast.OperationNode, OperationParameterGroups>()\n\n/**\n * An OpenAPI 3.2 `querystring` parameter is the whole query string, so a form-encoded object becomes one query parameter\n * per property, typed and serialized like any other.\n * Another content type, such as JSON, stays one parameter named after it, and the runtime sends its value as the whole query string.\n */\nfunction spreadQuerystring(param: ast.ParameterNode): Array<ast.ParameterNode> {\n const schema = param.schema.type === 'ref' ? param.schema.schema : param.schema\n const formEncoded = !param.contentType || param.contentType.split(';')[0]!.trim().toLowerCase() === 'application/x-www-form-urlencoded'\n if (schema?.type !== 'object' || !formEncoded) return [param]\n return schema.properties.map((property) =>\n ast.factory.createParameter({ name: property.name, in: 'query', schema: property.schema, required: param.required && property.required }),\n )\n}\n\n/**\n * Groups an operation's parameters by location (`path`/`query`/`header`/`cookie`), deduping each\n * group by name. Every plugin generator visiting the same `OperationNode` shares one AST instance\n * (see `KubbDriver`), so the result is cached per node to avoid re-filtering and re-deduping the\n * same parameters once per plugin.\n */\nexport function getOperationParameters(node: ast.OperationNode): OperationParameterGroups {\n const cached = operationParameterGroupsByNode.get(node)\n if (cached) return cached\n\n // A malformed spec can declare the same name twice within one location. Both would resolve to the\n // same output property, so emitting both would yield an object type with a duplicate member,\n // which TypeScript rejects. Keep the first.\n const dedupe = (params: Array<ast.ParameterNode>) => {\n const seen = new Set<string>()\n return params.filter((param) => {\n if (seen.has(param.name)) return false\n seen.add(param.name)\n return true\n })\n }\n const group = (location: ast.ParameterNode['in']) => dedupe(node.parameters.filter((param) => param.in === location))\n\n const groups: OperationParameterGroups = {\n path: group('path'),\n query: dedupe([...group('query'), ...group('querystring').flatMap(spreadQuerystring)]),\n header: group('header'),\n cookie: group('cookie'),\n }\n\n operationParameterGroupsByNode.set(node, groups)\n return groups\n}\n\n/**\n * Whether the operation declares more than one request media type with a schema, so a caller must pick one on `contentType`.\n */\nexport function hasRequestContentTypeChoice(node: ast.OperationNode): boolean {\n return (node.requestBody?.content ?? []).filter((entry) => entry.schema).length > 1\n}\n\n/**\n * Casts a call argument to the client's parameter type; a `'plain'` client is non-generic.\n */\nexport function castToClientOptions(callArg: string, clientName: string, returnType: 'full' | 'data' | 'plain' = 'full'): string {\n return `${callArg} as Parameters<typeof ${clientName}${returnType === 'plain' ? '' : '<true>'}>[0]`\n}\n\n/**\n * Builds the combined `{ body, path, query, headers, cookies }` options object schema for an operation,\n * referencing the already-resolved body and grouped param names. `cookies` appears only on an operation\n * with a cookie parameter, and stays optional because a browser sends its cookies itself. Shared by `@kubb/plugin-ts`'s\n * `Options` type and `@kubb/plugin-zod`'s inferred options schema, so both printers emit the same shape from the same inputs.\n * `primitive: 'object'` is a no-op for the TS printer and tells the Zod printer to emit `z.object(…)` rather\n * than a record.\n */\nexport function buildOptionsSchema(node: ast.OperationNode, resolver: OperationTypeNameResolver, { pairContentTypes = false } = {}): ast.SchemaNode {\n const { path, query, header, cookie } = getOperationParameters(node)\n const hasBody = Boolean(node.requestBody?.content?.[0]?.schema)\n const createNever = () => ast.factory.createSchema({ type: 'never', primitive: undefined, optional: true })\n const groups = [\n { name: 'path', params: path, resolve: resolver.param.path },\n { name: 'query', params: query, resolve: resolver.param.query },\n { name: 'headers', params: header, resolve: resolver.param.headers },\n { name: 'cookies', params: cookie, resolve: resolver.param.cookies },\n ] as const\n\n const createOptions = (body: ast.SchemaNode, extra: Array<ast.PropertyNode> = []) =>\n // NOTE(v5-stable): the fields were renamed from the legacy beta shape\n // (`data`/`pathParams`/`queryParams`/`headerParams`) to `body`/`path`/`query`/`headers` so the\n // type matches the runtime client. Drop this note once v5 leaves beta.\n ast.factory.createSchema({\n type: 'object',\n primitive: 'object',\n deprecated: node.deprecated,\n properties: [\n ast.factory.createProperty({ name: 'body', required: hasBody && node.requestBody?.required === true, schema: body }),\n ...groups\n .filter(({ name, params }) => name !== 'cookies' || params.length > 0)\n .map(({ name, params, resolve }) => {\n const required = name !== 'cookies' && params.some((param) => param.required)\n\n return ast.factory.createProperty({\n name,\n required,\n schema:\n params.length > 0\n ? ast.factory.createSchema({ type: 'ref', name: resolve.call(resolver.param, node, params[0]!), optional: !required })\n : createNever(),\n })\n }),\n ...extra,\n ],\n })\n\n const variants =\n pairContentTypes && hasRequestContentTypeChoice(node) ? resolveContentTypeVariants(node.requestBody?.content ?? [], resolver.response.body(node)) : []\n if (variants.length < 2) {\n return createOptions(hasBody ? ast.factory.createSchema({ type: 'ref', name: resolver.response.body(node) }) : createNever())\n }\n\n // The first media type is the runtime default, so only the others must pass `contentType`. A bare string sets the\n // request content type at runtime, so it is accepted next to the `{ request }` form.\n return ast.factory.createSchema({\n type: 'union',\n members: variants.map((variant, index) => {\n const contentType = ast.factory.createSchema({ type: 'enum', enumValues: [variant.contentType] })\n\n return createOptions(ast.factory.createSchema({ type: 'ref', name: variant.name }), [\n ast.factory.createProperty({\n name: 'contentType',\n required: index > 0,\n schema: ast.factory.createSchema({\n type: 'union',\n members: [\n contentType,\n ast.factory.createSchema({\n type: 'object',\n primitive: 'object',\n properties: [ast.factory.createProperty({ name: 'request', required: true, schema: contentType })],\n }),\n ],\n }),\n }),\n ])\n }),\n })\n}\n\n/**\n * The schema a status occupies in the `<Name>Responses` record. A status that documents several\n * content types becomes a `{ contentType; data }` union so the runtime can surface the negotiated type\n * on `result.parsed`, while the standalone `<Name>StatusNNN` alias stays the plain body union that the\n * query hooks and `result.data` use.\n */\nfunction buildResponseRecordEntry(node: ast.OperationNode, res: ast.ResponseNode, resolver: ResponseStatusNameResolver): ast.SchemaNode {\n const statusName = resolver.response.status(node, res.statusCode)\n const variants = (res.content ?? []).filter((entry) => entry.schema)\n if (variants.length <= 1) {\n return ast.factory.createSchema({ type: 'ref', name: statusName })\n }\n\n return ast.factory.createSchema({\n type: 'union',\n members: resolveContentTypeVariants(variants, statusName).map((variant) =>\n ast.factory.createSchema({\n type: 'object',\n primitive: 'object',\n properties: [\n ast.factory.createProperty({\n name: 'contentType',\n required: true,\n schema: ast.factory.createSchema({ type: 'enum', enumValues: [variant.contentType] }),\n }),\n ast.factory.createProperty({\n name: 'data',\n required: true,\n schema: ast.factory.createSchema({ type: 'ref', name: variant.name }),\n }),\n ],\n }),\n ),\n })\n}\n\n/**\n * Builds the per-status `<Name>Responses` record for an operation, referencing the already-resolved\n * `<Name>StatusNNN` names. Shared by `@kubb/plugin-ts`'s `Responses` type and `@kubb/plugin-zod`'s\n * inferred responses schema, so both emit the same shape from the same inputs.\n *\n * Always emits the keyed record, even when an operation declares no responses. An operation with no\n * responses renders as an empty object, which keeps every consumer's import (for example the axios\n * SDK's `RequestResult<XResponses>`) resolvable instead of pointing at a missing export.\n */\nexport function buildResponses(node: ast.OperationNode, resolver: ResponseStatusNameResolver): ast.SchemaNode {\n return ast.factory.createSchema({\n type: 'object',\n primitive: 'object',\n properties: node.responses.map((res) =>\n ast.factory.createProperty({\n name: String(res.statusCode),\n required: true,\n schema: buildResponseRecordEntry(node, res, resolver),\n }),\n ),\n })\n}\n\nexport function getStatusCodeNumber(statusCode: ast.StatusCode | number | string): number | null {\n const code = Number(statusCode)\n\n return Number.isNaN(code) ? null : code\n}\n\nexport function isSuccessStatusCode(statusCode: ast.StatusCode | number | string): boolean {\n const code = getStatusCodeNumber(statusCode)\n\n return code !== null && code >= 200 && code < 300\n}\n\nexport function isErrorStatusCode(statusCode: ast.StatusCode | number | string): boolean {\n const code = getStatusCodeNumber(statusCode)\n\n return code !== null && code >= 400\n}\n\nexport function getSuccessResponses<TResponse extends ResponseLike>(responses: ReadonlyArray<TResponse>): Array<TResponse> {\n return responses.filter((response) => isSuccessStatusCode(response.statusCode))\n}\n\nexport function getOperationSuccessResponses(node: ast.OperationNode): Array<ast.ResponseNode> {\n return getSuccessResponses(node.responses)\n}\n\nexport function getPrimarySuccessResponse(node: ast.OperationNode): ast.ResponseNode | null {\n return getOperationSuccessResponses(node)[0] ?? null\n}\n\nexport function resolveErrorNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses.filter((response) => isErrorStatusCode(response.statusCode)).map((response) => resolver.response.status(node, response.statusCode))\n}\n\nexport function resolveSuccessNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses.filter((response) => isSuccessStatusCode(response.statusCode)).map((response) => resolver.response.status(node, response.statusCode))\n}\n\nexport function resolveStatusCodeNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses.map((response) => resolver.response.status(node, response.statusCode))\n}\n\n/**\n * Lists the type names an operation's types file declares, computed once per resolver and `options` so every\n * dependent reads the same list.\n */\nexport function resolveOperationTypeNames(\n node: ast.OperationNode,\n resolver: OperationTypeNameResolver & Pick<Resolver, 'memo'>,\n options: ResolveOperationTypeNameOptions = {},\n): string[] {\n const key = `${node.operationId}\\0${options.order ?? ''}\\0${options.responseStatusNames ?? ''}\\0${options.includeParams === false ? 'noparams' : ''}\\0${(options.exclude ?? []).join(',')}`\n return resolver.memo(`operationTypeNames:${key}`, () => {\n const { path, query, header, cookie } = getOperationParameters(node)\n const responseStatusNames =\n options.responseStatusNames === 'error'\n ? resolveErrorNames(node, resolver)\n : options.responseStatusNames === false\n ? []\n : resolveStatusCodeNames(node, resolver)\n const exclude = new Set(options.exclude ?? [])\n const paramNames =\n options.includeParams === false\n ? []\n : [\n ...path.map((param) => resolver.param.path(node, param)),\n ...query.map((param) => resolver.param.query(node, param)),\n ...header.map((param) => resolver.param.headers(node, param)),\n ...cookie.map((param) => resolver.param.cookies(node, param)),\n ]\n const bodyAndResponseNames = [node.requestBody?.content?.[0]?.schema ? resolver.response.body(node) : null, resolver.response.response(node)]\n const names =\n options.order === 'body-response-first'\n ? [...bodyAndResponseNames, ...paramNames, ...responseStatusNames]\n : [...paramNames, ...bodyAndResponseNames, ...responseStatusNames]\n\n return names.filter((name): name is string => Boolean(name) && !exclude.has(name as string))\n })\n}\n\nexport function resolveResponseTypes(node: ast.OperationNode, resolver: ResponseNameResolver): Array<[statusCode: number | 'default', typeName: string]> {\n const types: Array<[number | 'default', string]> = []\n\n for (const response of node.responses) {\n if (response.statusCode === 'default') {\n types.push(['default', resolver.response.response(node)])\n continue\n }\n\n const code = getStatusCodeNumber(response.statusCode)\n if (code === null) {\n continue\n }\n\n types.push([code, isSuccessStatusCode(code) ? resolver.response.response(node) : resolver.response.status(node, response.statusCode)])\n }\n\n return types\n}\n","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// A word starts at `petType`, `sensor2Reading`, and `HTTPResponse`, while `IDs` and `OAuth` stay whole\nconst wordStart = /(?<=[a-z\\d])(?=[A-Z])|(?<=[A-Z]{2})(?=[A-Z][a-z]{2})/\n\n/**\n * Splits `text` into words on separators (whitespace, hyphens, underscores, dots, slashes, colons)\n * and on {@link wordStart}. A segment without lowercase letters, such as `COOL` or `2D`, is one word,\n * so snake case leaves a name that is already in it unchanged.\n */\nfunction words(text: string): Array<string> {\n return text\n .split(/[\\s\\-_./\\\\:]+/)\n .filter(Boolean)\n .flatMap((segment) => (segment === segment.toUpperCase() ? segment : segment.split(wordStart)))\n}\n\n/**\n * Uppercases only the first character of `text`, leaving the rest untouched.\n * Unlike `pascalCase` it never re-splits word boundaries or strips characters.\n *\n * @example\n * `capitalize('getPetById') // 'GetPetById'`\n */\nexport function capitalize(text: string): string {\n return `${text.charAt(0).toUpperCase()}${text.slice(1)}`\n}\n\n/**\n * Converts `text` to snake_case.\n *\n * @example From camelCase\n * `snakeCase('helloWorld') // 'hello_world'`\n *\n * @example From mixed separators\n * `snakeCase('Hello-World') // 'hello_world'`\n */\nexport function snakeCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return words(`${prefix} ${text} ${suffix}`)\n .map((word) => word.replace(/[^a-zA-Z0-9]/g, '').toLowerCase())\n .filter(Boolean)\n .join('_')\n}\n\n/**\n * Converts `text` to SCREAMING_SNAKE_CASE.\n *\n * @example From camelCase\n * `screamingSnakeCase('helloWorld') // 'HELLO_WORLD'`\n */\nexport function screamingSnakeCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return snakeCase(text, { prefix, suffix }).toUpperCase()\n}\n","/**\n * JavaScript and Java reserved words.\n * @link https://github.com/jonschlinkert/reserved/blob/master/index.js\n */\nconst reservedWords = new Set([\n 'abstract',\n 'arguments',\n 'await',\n 'boolean',\n 'break',\n 'byte',\n 'case',\n 'catch',\n 'char',\n 'class',\n 'const',\n 'continue',\n 'debugger',\n 'default',\n 'delete',\n 'do',\n 'double',\n 'else',\n 'enum',\n 'eval',\n 'export',\n 'extends',\n 'false',\n 'final',\n 'finally',\n 'float',\n 'for',\n 'function',\n 'goto',\n 'if',\n 'implements',\n 'import',\n 'in',\n 'instanceof',\n 'int',\n 'interface',\n 'let',\n 'long',\n 'native',\n 'new',\n 'null',\n 'package',\n 'private',\n 'protected',\n 'public',\n 'return',\n 'short',\n 'static',\n 'super',\n 'switch',\n 'synchronized',\n 'this',\n 'throw',\n 'throws',\n 'transient',\n 'true',\n 'try',\n 'typeof',\n 'var',\n 'void',\n 'volatile',\n 'while',\n 'with',\n 'yield',\n 'Array',\n 'Date',\n 'hasOwnProperty',\n 'Infinity',\n 'isFinite',\n 'isNaN',\n 'isPrototypeOf',\n 'length',\n 'Math',\n 'name',\n 'NaN',\n 'Number',\n 'Object',\n 'prototype',\n 'String',\n 'toString',\n 'undefined',\n 'valueOf',\n] as const)\n\n/**\n * Returns `true` when `name` is a syntactically valid JavaScript variable name.\n *\n * @example\n * ```ts\n * isValidVarName('status') // true\n * isValidVarName('class') // false (reserved word)\n * isValidVarName('42foo') // false (starts with digit)\n * ```\n */\nexport function isValidVarName(name: string): boolean {\n if (!name || reservedWords.has(name as 'valueOf')) {\n return false\n }\n return isIdentifier(name)\n}\n\n/**\n * Returns `name` when it's a syntactically valid JavaScript variable name,\n * otherwise prefixes it with `_` so the result is a valid identifier.\n *\n * Useful for sanitizing OpenAPI schema names or operation IDs that start with\n * a digit (e.g. `409`, `504AccountCancel`) before using them as exported\n * variable, type, or function names.\n *\n * @example\n * ```ts\n * ensureValidVarName('409') // '_409'\n * ensureValidVarName('504AccountCancel') // '_504AccountCancel'\n * ensureValidVarName('Pet') // 'Pet'\n * ensureValidVarName('class') // '_class'\n * ```\n */\nexport function ensureValidVarName(name: string): string {\n if (!name || isValidVarName(name)) {\n return name\n }\n return `_${name}`\n}\n\n/**\n * Returns `true` when `name` is syntactically a valid identifier, ignoring reserved words.\n *\n * Reserved words and globals (`class`, `name`, `Date`, …) are valid as bare object-literal keys\n * even though they are not valid variable names, so use this (not {@link isValidVarName}) when\n * deciding whether an object key needs quoting.\n *\n * @example\n * ```ts\n * isIdentifier('name') // true\n * isIdentifier('x-total')// false\n * ```\n */\nexport function isIdentifier(name: string): boolean {\n return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name)\n}\n","/**\n * Wraps a value in single quotes for emitting a single-quoted JavaScript string literal, escaping\n * any backslash or single quote in the content.\n *\n * @example\n * ```ts\n * singleQuote('foo') // \"'foo'\"\n * singleQuote(\"o'clock\") // \"'o\\\\'clock'\"\n * ```\n */\nexport function singleQuote(value: string | number | boolean | undefined | null): string {\n if (value === undefined || value === null) return \"''\"\n const escaped = String(value).replace(/\\\\/g, '\\\\\\\\').replace(/'/g, \"\\\\'\")\n\n return `'${escaped}'`\n}\n\n/**\n * Strips a single matching pair of `\"...\"`, `'...'`, or `` `...` `` from both ends of `text`.\n * Returns the string unchanged when no balanced quote pair is found.\n *\n * @example\n * ```ts\n * trimQuotes('\"hello\"') // 'hello'\n * trimQuotes('hello') // 'hello'\n * ```\n */\nexport function trimQuotes(text: string): string {\n if (text.length >= 2) {\n const first = text[0]\n const last = text[text.length - 1]\n if ((first === '\"' && last === '\"') || (first === \"'\" && last === \"'\") || (first === '`' && last === '`')) {\n return text.slice(1, -1)\n }\n }\n return text\n}\n\n/**\n * Serializes a primitive to a single-quoted string literal, stripping any surrounding quotes first.\n *\n * Escaping runs through `JSON.stringify`, then the result switches to single quotes so the generated\n * code matches the repo style without a formatter.\n *\n * @example\n * ```ts\n * stringify('hello') // \"'hello'\"\n * stringify('\"hello\"') // \"'hello'\"\n * ```\n */\nexport function stringify(value: string | number | boolean | undefined): string {\n if (value === undefined || value === null) return \"''\"\n const json = JSON.stringify(trimQuotes(value.toString()))\n const inner = json.slice(1, -1).replace(/\\\\\"/g, '\"').replace(/'/g, \"\\\\'\")\n return `'${inner}'`\n}\n\n/**\n * Escapes an `@` at the start of a line, so a multi-line description can't start a new JSDoc tag.\n * Editors render `\\@` as `@` in hovers.\n *\n * @example\n * ```ts\n * jsDocEscape('intro\\n@example value') // 'intro\\n\\\\@example value'\n * ```\n */\nexport function jsDocEscape(input: unknown): string {\n return `${input}`.replace(/^(\\s*)@/gm, '$1\\\\@')\n}\n\n/**\n * Escapes characters that are not allowed inside JS string literals, covering quotes, backslashes,\n * and the Unicode line terminators U+2028 and U+2029.\n *\n * @see http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.4\n *\n * @example\n * ```ts\n * jsStringEscape('say \"hi\"\\nbye') // 'say \\\\\"hi\\\\\"\\\\nbye'\n * ```\n */\nexport function jsStringEscape(input: unknown): string {\n return `${input}`.replace(/[\"'\\\\\\n\\r\\u2028\\u2029]/g, (character) => {\n switch (character) {\n case '\"':\n case \"'\":\n case '\\\\':\n return `\\\\${character}`\n case '\\n':\n return '\\\\n'\n case '\\r':\n return '\\\\r'\n case '\\u2028':\n return '\\\\u2028'\n case '\\u2029':\n return '\\\\u2029'\n default:\n return ''\n }\n })\n}\n\n// `\\p{`, `\\P{` or `\\u{` behind an odd number of backslashes, or a character outside the BMP: both need the `u` flag.\nconst NEEDS_UNICODE = /(?<!\\\\)(?:\\\\\\\\)*\\\\[pPu]\\{|[\\u{10000}-\\u{10FFFF}]/u\n// Escapes the `u` flag accepts. `\\-` only counts inside a class.\nconst KEPT_ESCAPE = /[A-Za-z0-9^$\\\\.*+?()[\\]{}|/]/\n\n/**\n * Drops the backslash from escapes that the `u` flag rejects: an escaped punctuation character that is\n * not a syntax character, and `\\-` outside a class. Both match the same character without the backslash.\n */\nfunction dropIdentityEscapes(pattern: string): string {\n let inClass = false\n\n return pattern.replace(/\\\\(.)|[[\\]]/gs, (match, escaped?: string) => {\n if (escaped === undefined) {\n inClass = match === '['\n return match\n }\n\n return KEPT_ESCAPE.test(escaped) || (escaped === '-' && inClass) ? match : escaped\n })\n}\n\n/**\n * Builds the `RegExp` for a pattern, adding the `u` flag when it uses `\\p{...}`, `\\P{...}` or `\\u{...}`, or\n * holds a character outside the BMP. A pattern that is not valid under `u` keeps the flags it came with.\n */\nfunction toRegExp(pattern: string, flags: string | undefined): RegExp {\n if (flags?.includes('u') || !NEEDS_UNICODE.test(pattern)) return new RegExp(pattern, flags)\n\n try {\n return new RegExp(dropIdentityEscapes(pattern), `${flags ?? ''}u`)\n } catch {\n return new RegExp(pattern, flags)\n }\n}\n\n/**\n * Converts a pattern string into a `new RegExp(...)` constructor call or a regex literal string.\n * Inline flags expressed as a `^(?im)` prefix are extracted and applied to the resulting expression.\n * Pass `null` as the second argument to emit a `/pattern/flags` literal instead.\n *\n * @example\n * ```ts\n * toRegExpString('^(?im)foo') // 'new RegExp(\"^foo\", \"im\")'\n * toRegExpString('^(?im)foo', null) // '/^foo/im'\n * ```\n */\nexport function toRegExpString(text: string, func: string | null = 'RegExp'): string {\n const raw = trimQuotes(text)\n\n const match = raw.match(/^\\^(\\(\\?([igmsuy]+)\\))/i)\n const replacementTarget = match?.[1] ?? ''\n const matchedFlags = match?.[2]\n const cleaned = raw\n .replace(/^\\\\?\\//, '')\n .replace(/\\\\?\\/$/, '')\n .replace(replacementTarget, '')\n\n const { source, flags } = toRegExp(cleaned, matchedFlags)\n\n if (func === null) return `/${source}/${flags}`\n\n return `new ${func}(${JSON.stringify(source)}${flags ? `, ${JSON.stringify(flags)}` : ''})`\n}\n\n/**\n * Renders a dotted path or string array as an optional-chaining accessor expression rooted at\n * `accessor`. Returns `null` for an empty path.\n *\n * @example\n * ```ts\n * getNestedAccessor('pagination.next.id', 'lastPage')\n * // \"lastPage?.['pagination']?.['next']?.['id']\"\n * ```\n */\nexport function getNestedAccessor(param: string | Array<string>, accessor: string): string | null {\n const parts = Array.isArray(param) ? param : param.split('.')\n if (parts.length === 0 || (parts.length === 1 && parts[0] === '')) return null\n return `${accessor}?.['${`${parts.join(\"']?.['\")}']`}`\n}\n","import { ensureValidVarName, toFilePath } from '@internals/utils'\nimport { ast, camelCase } from '@kubb/kit'\nimport type { GeneratorContext, Resolver, ResolverFile } from '@kubb/kit'\n\n/**\n * The shared top-level `name` of the operation plugins, computed once per operation name and build.\n */\nexport function resolveOperationName(this: Resolver, name: string): string {\n return this.memo(`operation:${name}`, () => ensureValidVarName(camelCase(name)))\n}\n\n/**\n * Builds the allocation key for a declaration an operation owns. `scope` names which declaration\n * it is, so two of them never share an allocation even when a custom resolver gives both the same\n * name. Leave `scope` empty for the operation's own declaration.\n *\n * @example\n * ```ts\n * resolver.resolveName({ key: operationKey(node, 'response', 'status', 404), name })\n * ```\n */\nexport function operationKey(node: ast.OperationNode, ...scope: Array<string | number>): Array<string | undefined> {\n return ['operation', node.method, node.path, ...scope.map(String)]\n}\n\n/**\n * The `param` namespace shared by the schema-producing plugins (ts, zod, faker):\n * per-parameter names plus the grouped `Path`/`Query`/`Headers`/`Cookies` names, all routed\n * through the plugin's top-level `name` casing.\n */\nexport type OperationParamResolver = {\n name(this: Resolver, node: ast.OperationNode, param: ast.ParameterNode): string\n path(this: Resolver, node: ast.OperationNode): string\n query(this: Resolver, node: ast.OperationNode): string\n headers(this: Resolver, node: ast.OperationNode): string\n cookies(this: Resolver, node: ast.OperationNode): string\n}\n\n/**\n * The `response` namespace shared by the schema-producing plugins: per-status,\n * body, and combined response names, all routed through the plugin's top-level\n * `name` casing.\n */\nexport type OperationResponseResolver = {\n status(this: Resolver, node: ast.OperationNode, statusCode: ast.StatusCode): string\n body(this: Resolver, node: ast.OperationNode): string\n responses(this: Resolver, node: ast.OperationNode): string\n response(this: Resolver, node: ast.OperationNode): string\n}\n\n/**\n * Builds the shared `param` namespace. Spread the result into `createResolver`\n * and override individual methods next to it when a plugin deviates.\n *\n * @example\n * ```ts\n * createResolver<PluginTs>({ param: createOperationParamResolver(), ... })\n * ```\n */\nexport function createOperationParamResolver(): OperationParamResolver {\n return {\n name(node, param) {\n const name = this.name(`${node.operationId} ${param.in} ${param.name}`)\n return this.resolveName({ key: operationKey(node, 'param', 'name', param.in, param.name), name })\n },\n path(node) {\n const name = this.name(`${node.operationId} Path`)\n return this.resolveName({ key: operationKey(node, 'param', 'path'), name })\n },\n query(node) {\n const name = this.name(`${node.operationId} Query`)\n return this.resolveName({ key: operationKey(node, 'param', 'query'), name })\n },\n headers(node) {\n const name = this.name(`${node.operationId} Headers`)\n return this.resolveName({ key: operationKey(node, 'param', 'headers'), name })\n },\n cookies(node) {\n const name = this.name(`${node.operationId} Cookies`)\n return this.resolveName({ key: operationKey(node, 'param', 'cookies'), name })\n },\n }\n}\n\n/**\n * Builds the shared `response` namespace. Spread the result into\n * `createResolver` and add plugin-specific methods (`options`, `error`) next\n * to it.\n *\n * @example\n * ```ts\n * createResolver<PluginTs>({ response: { ...createOperationResponseResolver(), options(node) {...} }, ... })\n * ```\n */\nexport function createOperationResponseResolver(): OperationResponseResolver {\n return {\n status(node, statusCode) {\n const name = this.name(`${node.operationId} Status ${statusCode}`)\n return this.resolveName({ key: operationKey(node, 'response', 'status', statusCode), name })\n },\n body(node) {\n const name = this.name(`${node.operationId} Body`)\n return this.resolveName({ key: operationKey(node, 'response', 'body'), name })\n },\n responses(node) {\n const name = this.name(`${node.operationId} Responses`)\n return this.resolveName({ key: operationKey(node, 'response', 'responses'), name })\n },\n response(node) {\n const name = this.name(`${node.operationId} Response`)\n return this.resolveName({ key: operationKey(node, 'response', 'response'), name })\n },\n }\n}\n\n/**\n * Builds a resolver `file` override whose base name runs every path segment\n * through `toFilePath`, casing the final segment with `caseLast`.\n *\n * @example\n * ```ts\n * createResolver<PluginTs>({ file: createCasedFile(pascalCase), ... })\n * ```\n */\nexport function createCasedFile(caseLast: (part: string) => string): ResolverFile {\n return {\n baseName({ name, extname }) {\n return this.memo(`file:${name}\\0${extname}`, (): ast.FileNode['baseName'] => `${toFilePath(name, caseLast)}${extname}`)\n },\n }\n}\n\ntype SchemaIndexContext = Pick<GeneratorContext, 'memo' | 'driver'>\n\n/**\n * Names of the schemas in a circular reference chain, computed once per build.\n */\nexport function getCircularNames(ctx: SchemaIndexContext): ReadonlySet<string> {\n return ctx.memo('circularNames:set', () => ast.findCircularSchemas(ctx.driver.inputNode?.schemas ?? []))\n}\n\n/**\n * Names of the schemas whose type is `enum`, computed once per build.\n */\nexport function getEnumNames(ctx: SchemaIndexContext): ReadonlySet<string> {\n return ctx.memo(\n 'enumNames:set',\n () => new Set((ctx.driver.inputNode?.schemas ?? []).flatMap((schema) => (schema.type === 'enum' && schema.name ? [schema.name] : []))),\n )\n}\n\ndeclare global {\n namespace Kubb {\n interface MemoRegistry {\n operation: string\n file: ast.FileNode['baseName']\n operationTypeNames: Array<string>\n }\n }\n}\n","import { camelCase, type Group } from '@kubb/kit'\n\n/**\n * Builds the `group` config a Kubb plugin passes to `ctx.setOptions`, applying the\n * shared default naming so every plugin groups output consistently:\n *\n * - `path` groups use the second path segment (`/pet/findByStatus` → `pet`).\n * - other groups use the camelCased group (`pet store` → `petStore`).\n *\n * A user-provided `group.name` always wins over the default namer, so callers stay in\n * control of their output folders. Returns `null` when grouping is disabled, matching the\n * per-plugin convention.\n *\n * @param group - The user-supplied group option, or `undefined` to disable grouping.\n *\n * @example\n * ```ts\n * createGroupConfig(group) // shared across every plugin\n * ```\n */\nexport function createGroupConfig(group: Group | undefined): Group | null {\n if (!group) {\n return null\n }\n\n const defaultName = (ctx: { group: string }): string => {\n if (group.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n\n return camelCase(ctx.group)\n }\n\n return {\n ...group,\n name: group.name ? group.name : defaultName,\n } satisfies Group\n}\n","","","import { type ast, Diagnostics, type Generator, type Group, type Output } from '@kubb/kit'\nimport { pluginTsName, type ResolverTs } from '@kubb/plugin-ts'\nimport { pluginZodName, type ResolverZod } from '@kubb/plugin-zod'\nimport type { ContractClientFactory } from './types.ts'\n\ntype GeneratorDriver = Parameters<NonNullable<Generator<ContractClientFactory>['operations']>>[1]['driver']\n\n/**\n * The two per-operation type names a generated client references: the grouped input and the\n * per-status responses record its `RequestResult` is keyed on.\n */\nexport type OperationTypeNames = {\n response: {\n /**\n * Resolves the name of the operation's grouped `{ body, path, query, headers, cookies }` input type.\n */\n options(node: ast.OperationNode): string\n /**\n * Resolves the name of the operation's per-status responses record type.\n */\n responses(node: ast.OperationNode): string\n }\n}\n\n/**\n * Where a generated client sources its operation types, plus the resolver and output the file\n * declaring them is resolved with.\n */\nexport type OperationTypeSource = OperationTypeNames & {\n /**\n * `plugin-ts` shaped resolver of the plugin supplying the names, also used to resolve the file they are exported from.\n */\n resolver: ResolverTs\n /**\n * The supplying plugin's own `output`, when it configured one.\n */\n output: Output | undefined\n /**\n * The supplying plugin's own `group`, when it configured one.\n */\n group: Group | undefined\n}\n\n/**\n * A `plugin-ts` shaped resolver whose operation type names point at the types `pluginZod({ inferred })`\n * exports next to each schema, so code written against `plugin-ts` names picks up the zod types.\n */\nfunction toZodTypeResolver(resolver: ResolverZod): ResolverTs {\n const type = (name: string) => resolver.schema.type(name)\n\n return {\n ...resolver,\n // Class methods, so a spread drops them. `file` reads private fields, and `memo` gets its own key\n // space so these type names never share an entry with the zod names.\n file: resolver.file.bind(resolver),\n memo: (key: string, compute: () => unknown) => resolver.memo(`zodTypes:${key}`, compute),\n param: {\n name: (node: ast.OperationNode, p: ast.ParameterNode) => type(resolver.param.name(node, p)),\n path: (node: ast.OperationNode, p: ast.ParameterNode) => type(resolver.param.path(node, p)),\n query: (node: ast.OperationNode, p: ast.ParameterNode) => type(resolver.param.query(node, p)),\n headers: (node: ast.OperationNode, p: ast.ParameterNode) => type(resolver.param.headers(node, p)),\n cookies: (node: ast.OperationNode, p: ast.ParameterNode) => type(resolver.param.cookies(node, p)),\n },\n response: {\n body: (node: ast.OperationNode) => type(resolver.response.body(node)),\n status: (node: ast.OperationNode, statusCode: ast.StatusCode) => type(resolver.response.status(node, statusCode)),\n response: (node: ast.OperationNode) => type(resolver.response.response(node)),\n responses: (node: ast.OperationNode) => type(resolver.response.responses(node)),\n options: (node: ast.OperationNode) => resolver.response.options(node),\n },\n } as unknown as ResolverTs\n}\n\n/**\n * Picks the plugin generated clients, query hooks, and MCP handlers take their operation types from.\n *\n * `pluginZod({ inferred: 'codec' })` wins, so a codec param takes its domain value. Otherwise `plugin-ts`\n * wins when it is in the pipeline, and without it any `pluginZod({ inferred })`. Throws\n * `KUBB_MISSING_DEPENDENCY` for `pluginName` when neither is available.\n *\n * @example\n * ```ts\n * const types = resolveOperationTypes(ctx.driver, ctx.plugin.name)\n * types.response.options(node) // 'GetPetByIdOptions', or 'GetPetByIdOptionsSchemaType' from zod\n * ```\n */\nexport function resolveOperationTypes(driver: GeneratorDriver, pluginName: string): OperationTypeSource {\n return driver.memo(`operationTypes:${pluginName}`, () => {\n const pluginTs = driver.getPlugin(pluginTsName)\n const pluginZod = driver.getPlugin(pluginZodName)\n\n if (pluginTs && pluginZod?.options?.inferred !== 'codec') {\n const resolver = driver.getResolver(pluginTsName)\n return { response: resolver.response, resolver, output: pluginTs.options?.output, group: pluginTs.options?.group ?? undefined }\n }\n\n if (!pluginZod?.options?.inferred) {\n throw new Diagnostics.Error({\n code: Diagnostics.code.missingDependency,\n severity: 'error',\n message: `Plugin \"${pluginName}\" has no source for operation types.`,\n help: `Add \\`pluginTs()\\` before \"${pluginName}\", or add \\`pluginZod({ inferred: true })\\`.`,\n location: { kind: 'config' },\n plugin: pluginName,\n })\n }\n\n const resolver = toZodTypeResolver(driver.getResolver(pluginZodName))\n return { response: resolver.response, resolver, output: pluginZod.options.output, group: pluginZod.options.group ?? undefined }\n })\n}\n\ndeclare global {\n namespace Kubb {\n interface MemoRegistry {\n operationTypes: OperationTypeSource\n /**\n * Nests every key the zod-backed `ResolverTs` memoizes, so it holds each of their value types.\n */\n zodTypes: unknown\n }\n }\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, plugin-axios, or plugin-client) and never emits its own\n * 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, the\n * requested one is missing, or `client` is not a known selector.\n *\n * The `client` string selects explicitly (`'fetch'` / `'axios'` / `'client'`); when it is unset a\n * lone registered contract client plugin is picked up automatically.\n */\n\nimport { Diagnostics } from '@kubb/kit'\n\n// Canonical plugin names. They mirror the `pluginFetchName` / `pluginAxiosName` / `pluginClientName`\n// consts the plugins export, kept as literals so this internal needs no plugin install deps.\nconst pluginFetchName = 'plugin-fetch'\nconst pluginAxiosName = 'plugin-axios'\nconst pluginClientName = 'plugin-client'\n\n/**\n * The client selector accepted by a consumer's `client` option. Each calls a registered contract\n * client plugin.\n */\nexport type ClientSelector = 'fetch' | 'axios' | 'client'\n\n/**\n * The resolved client strategy stored in a consumer plugin's options: the generated code always\n * imports and calls a registered contract client plugin's `<op>`. The client runtime lives in\n * plugin-axios / plugin-fetch, so nothing is bundled by the consumer.\n */\nexport type ResolvedContractClient = { kind: 'contract'; pluginName: string }\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: its code, what is wrong, and how to fix it.\n */\nexport type ResolveClientResult =\n | ResolvedContractClient\n | { kind: 'error'; code: typeof Diagnostics.code.missingDependency | typeof Diagnostics.code.invalidPluginOptions; message: string; help: string }\n\nconst selectorToPlugin: Record<ClientSelector, string> = {\n fetch: pluginFetchName,\n axios: pluginAxiosName,\n client: pluginClientName,\n}\n\n// Every contract client plugin, in auto-detect priority order.\nconst contractPlugins = [pluginFetchName, pluginAxiosName, pluginClientName] 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', code: 'KUBB_MISSING_DEPENDENCY', message: 'No client plugin is registered.', help: 'Add …' }\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' || client === 'client') {\n const pluginName = selectorToPlugin[client]\n if (!has(pluginName)) {\n return {\n kind: 'error',\n code: Diagnostics.code.missingDependency,\n message: `\\`client: '${client}'\\` is set but \\`@kubb/plugin-${client}\\` is not registered in \\`plugins\\`.`,\n help: `Add \\`@kubb/plugin-${client}\\` to \\`plugins\\`, or drop \\`client\\` to use a different client plugin.`,\n }\n }\n return { kind: 'contract', pluginName }\n }\n\n // A JS config bypasses the `ClientSelector` type, so reject unknown selectors instead of auto-detecting.\n if (client !== undefined) {\n return {\n kind: 'error',\n code: Diagnostics.code.invalidPluginOptions,\n message: `Option \\`client\\` is ${typeof client === 'string' ? `'${client}'` : String(client)}, but it must be one of 'fetch', 'axios', 'client'.`,\n help: 'Set `client` to one of those values, or drop it to use the registered client plugin.',\n }\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 code: Diagnostics.code.invalidPluginOptions,\n message: `Multiple client plugins are registered (${registered.map((name) => `\\`@kubb/${name}\\``).join(', ')}) and \\`client\\` is not set.`,\n help: \"Set `client: 'fetch' | 'axios' | 'client'` to choose which client the hooks call, or register a single client plugin.\",\n }\n }\n\n return {\n kind: 'error',\n code: Diagnostics.code.missingDependency,\n message: 'No client plugin is registered.',\n help: 'Add `@kubb/plugin-fetch`, `@kubb/plugin-axios`, or `@kubb/plugin-client` to `plugins` so the generated code has an HTTP client to call.',\n }\n}\n\n/**\n * Resolves the contract client during a consumer plugin's setup hook.\n * It extracts the plugin names from the raw `plugins` config and applies {@link resolveClient}.\n * On a misconfiguration it throws a config diagnostic tagged with `plugin`, so every consumer\n * fails fast with the same message.\n */\nexport function resolveContractClient(options: {\n plugin: string\n client: ClientSelector | undefined\n plugins?: ReadonlyArray<unknown>\n}): ResolvedContractClient {\n const { plugin, client, plugins = [] } = options\n const pluginNames = plugins.map((plugin) => (plugin as { name?: string }).name).filter((name): name is string => Boolean(name))\n const resolved = resolveClient({ client, pluginNames })\n if (resolved.kind === 'error') {\n const { code, message, help } = resolved\n throw new Diagnostics.Error({ code, severity: 'error', message, help, location: { kind: 'config' }, plugin })\n }\n return resolved\n}\n","import path from 'node:path'\nimport { operationFileEntry, operationKey } from '@internals/shared'\nimport type { ast, Exclude, Group, Include, Memo, Output, Override, Resolver } from '@kubb/kit'\nimport type { ReturnTypeOption } from './types.ts'\n\n/**\n * The resolved contract `<op>` for one operation: the generated function name, the file it lives in,\n * the client module path (where `RequestConfig` / `ResponseErrorConfig` come from), and the\n * registered client plugin's `returnType`.\n *\n * `clientPath` is the absolute `.kubb/client.ts` path for plugin-fetch / plugin-axios, or\n * plugin-client's `importPath`: a relative one is resolved against the `<op>` file to an absolute\n * path, a package name or alias is kept verbatim. `clientPathIsFile` tells a consumer whether to\n * make it relative to the importing file.\n */\nexport type ClientOperation = { name: string; path: string; clientPath: string; clientPathIsFile: boolean; returnType: ReturnTypeOption }\n\n/**\n * The client plugin options a dependent reads, including the filters that scope them per operation.\n */\ntype ClientPluginOptions = {\n output?: Output\n group?: Group | null\n returnType?: ReturnTypeOption\n importPath?: string\n exclude?: Array<Exclude>\n include?: Array<Include>\n override?: Array<Override<Omit<ClientPluginOptions, 'override'>>>\n}\n\nfunction isRelativeImport(importPath: string): boolean {\n return importPath.startsWith('.')\n}\n\n// plugin-client resolves a relative `importPath` from its `<op>` file, so do the same here.\nfunction resolveImportPath(options: { importPath: string; operationFile: string }): string {\n const { importPath, operationFile } = options\n return isRelativeImport(importPath) ? path.resolve(path.dirname(operationFile), importPath) : importPath\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, plugin-axios, or plugin-client). Returns `null` when no contract plugin is in play (the inline\n * path), or when the client plugin's `exclude` / `include` leaves this operation out, since it then\n * emits no `<op>` to import. plugin-fetch / plugin-axios inject `.kubb/client.ts` at the global\n * output root, the same path consumers read `RequestConfig` / `ResponseErrorConfig` from.\n * With plugin-client they come from the user's `importPath` module instead.\n *\n * The result is cached in `memo` (the build's `ctx.memo`) under the client plugin's name and the operation,\n * so several dependents reading the same client plugin for one operation in a single pass\n * (react-query's query/mutation/infinite generators, vue-query, swr, the MCP handler, ...) share\n * one computed result instead of each re-deriving the name and path.\n *\n * `returnType`, `output`, and `group` are the client plugin's options for this operation, after its\n * `override` entries, the same resolution its own generator sees. A dependent's generated call body\n * and import path therefore match the `<op>` actually emitted, even when an `override` changes it.\n */\nexport function resolveClientOperation(options: {\n clientPlugin: { pluginName: string } | null\n driver: {\n getPlugin: (name: string) => { options?: ClientPluginOptions } | undefined\n getResolver: (name: string) => Resolver\n }\n node: ast.OperationNode\n root: string\n output: Output\n memo: Memo\n}): ClientOperation | null {\n const { clientPlugin, driver, node, root, output, memo } = options\n if (!clientPlugin) return null\n\n return memo(`${clientPlugin.pluginName}:clientOperation:${node.operationId}`, () => {\n const resolver = driver.getResolver(clientPlugin.pluginName)\n const pluginOptions = driver.getPlugin(clientPlugin.pluginName)?.options ?? {}\n const { exclude, include, override } = pluginOptions\n const hasOperationOptions = Boolean(exclude?.length || include?.length || override?.length)\n // Kubb's resolver always has `default`; the fallback keeps partial or custom resolvers working.\n const operationOptions =\n hasOperationOptions && resolver.default ? resolver.default.options(node, { options: pluginOptions, exclude, include, override }) : pluginOptions\n if (!operationOptions) return null\n\n const file = resolver.file({\n ...operationFileEntry(node, node.operationId),\n root,\n output: operationOptions.output ?? output,\n group: operationOptions.group ?? undefined,\n })\n\n const { importPath } = operationOptions\n const name = resolver.name(node.operationId)\n\n return {\n name: resolver.resolveName({ key: operationKey(node), name }),\n path: file.path,\n clientPath: importPath === undefined ? path.resolve(root, '.kubb/client.ts') : resolveImportPath({ importPath, operationFile: file.path }),\n clientPathIsFile: importPath === undefined || isRelativeImport(importPath),\n returnType: operationOptions.returnType ?? 'full',\n }\n })\n}\n","import { resolveOperationTypes } from '@internals/client'\nimport { operationFileEntry, resolveDependencyOperationFile, resolveOperationTypeNames } from '@internals/shared'\nimport { type ast, Diagnostics, type GeneratorContext, type Group, type Output } from '@kubb/kit'\nimport type { ResolverTs } from '@kubb/plugin-ts'\nimport { File } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx'\nimport type { ClientOperation, ReturnTypeOption } from '@internals/client'\n\ntype HookFileContext = Pick<GeneratorContext, 'config' | 'root' | 'memo' | 'meta' | 'driver' | 'requirePlugin' | 'resolver'>\n\ntype ResolveHookFileOptions = {\n name: string\n output: Output\n group?: Group | null\n contractOp: ClientOperation\n /**\n * The `<Key>` type alias declared in this file, left out of the imported type names.\n */\n keyTypeName?: string\n /**\n * Type names imported right after the response options type.\n */\n extraTypeNames?: Array<string | null | undefined>\n returnType?: ReturnTypeOption\n}\n\ntype ResolvedHookFile = {\n file: ast.FileNode\n fileTs: ast.FileNode\n tsResolver: ResolverTs\n contractOp: ClientOperation\n importedTypeNames: Array<string>\n returnType: ReturnTypeOption\n banner: string | null\n footer: string | null\n}\n\n/**\n * Resolves what every TanStack hook file shares: its file, the operation types file and names (`@kubb/plugin-ts`, or\n * `pluginZod({ inferred: 'codec' })`), banner and footer.\n */\nexport function resolveHookFile(node: ast.OperationNode, ctx: HookFileContext, options: ResolveHookFileOptions): ResolvedHookFile {\n const { name, output, group, contractOp, keyTypeName, extraTypeNames = [], returnType = 'data' } = options\n const { config, root, resolver } = ctx\n if (returnType !== 'data' && contractOp.returnType === 'data') {\n throw new Diagnostics.Error({\n code: Diagnostics.code.invalidPluginOptions,\n severity: 'error',\n message: `Option \\`returnType\\` is '${returnType}' for ${node.operationId}, but the client plugin has \\`returnType: 'data'\\` and only returns the response body.`,\n help: \"Set the client plugin's `returnType` to 'full', or set the hook plugin's `returnType` to 'data'.\",\n location: { kind: 'config' },\n plugin: resolver.pluginName,\n })\n }\n const types = resolveOperationTypes(ctx.driver, resolver.pluginName)\n const tsResolver = types.resolver\n\n const file = resolver.file({ ...operationFileEntry(node, name), root, output, group: group ?? undefined })\n const fileTs = resolveDependencyOperationFile({\n memo: ctx.memo,\n node,\n resolver: tsResolver,\n root,\n output: types.output ?? output,\n group: types.group,\n })\n const importedTypeNames = [\n tsResolver.response.options(node),\n tsResolver.response.responses(node),\n ...extraTypeNames,\n ...resolveOperationTypeNames(node, tsResolver, {\n // The joined response alias is unused with the full result, and the printer keeps it as a substring of the responses record name.\n exclude: [keyTypeName, returnType !== 'data' ? tsResolver.response.response(node) : null].filter((name): name is string => Boolean(name)),\n order: 'body-response-first',\n includeParams: false,\n }),\n ].filter((typeName): typeName is string => Boolean(typeName))\n const fileMeta = { path: file.path, baseName: file.baseName }\n\n return {\n file,\n fileTs,\n tsResolver,\n contractOp,\n importedTypeNames,\n returnType,\n banner: resolver.default.banner(ctx.meta, { output, config, file: fileMeta }),\n footer: resolver.default.footer(ctx.meta, { output, config, file: fileMeta }),\n }\n}\n\ntype HookFileProps = {\n hook: ResolvedHookFile\n /**\n * Framework imports rendered between the client imports and the type import.\n */\n imports?: KubbReactNode\n children?: KubbReactNode\n}\n\n/**\n * The `<File>` shell shared by the TanStack hook generators; renders `children` after the imports.\n */\nexport function HookFile({ hook, imports, children }: HookFileProps): KubbReactNode {\n const { file, fileTs, contractOp, importedTypeNames, banner, footer } = hook\n\n return (\n <File baseName={file.baseName} path={file.path} meta={file.meta} banner={banner} footer={footer}>\n <File.Import name={[contractOp.name]} root={file.path} path={contractOp.path} />\n <File.Import\n name={['RequestConfig', 'ResponseErrorConfig', 'RequestResult']}\n root={contractOp.clientPathIsFile ? file.path : undefined}\n path={contractOp.clientPath}\n isTypeOnly\n />\n\n {imports}\n {fileTs && importedTypeNames.length > 0 && <File.Import name={Array.from(new Set(importedTypeNames))} root={file.path} path={fileTs.path} isTypeOnly />}\n\n {children}\n </File>\n )\n}\n","import {\n castToClientOptions,\n getOperationParameters,\n getPrimarySuccessResponse,\n getRequestGroupOptionality,\n getRequestGroups,\n hasRequestContentTypeChoice,\n isEventStream,\n resolveErrorNames,\n resolveSuccessNames,\n buildClientOptionType,\n requestGroupOrder,\n} from '@internals/shared'\nimport type { ast } from '@kubb/kit'\nimport { createFunctionParameter, createFunctionParameters, createObjectBindingPattern, createTypeLiteral } from '@kubb/plugin-ts'\nimport type { FunctionParameterNode, FunctionParametersNode, PluginTs, ResolverTs } from '@kubb/plugin-ts'\nimport type { ReturnTypeOption } from '@internals/client'\nimport type { Infinite, Mutation, PageParamFn, Query } from './types.ts'\n\ntype RequestGroupKey = (typeof requestGroupOrder)[number]\n\n/**\n * Widens a request-group member type so a generated TanStack hook accepts either the value or a\n * deferred value. Both plugins apply this through the `memberTypeWrapper` of `buildGroupedRequestParam`;\n * they only differ in how the deferred form is later resolved.\n *\n * `maybeRefOrGetter` is used by vue-query, which keeps the ref/getter live and unwraps it lazily with\n * `toValue` because vue-query keys are reactive. `maybeValueOrGetter` is used by react-query, which\n * resolves the getter once at the hook boundary and forwards a plain value because React Query hashes\n * keys structurally and cannot hold a function.\n */\nexport function maybeRefOrGetter(type: string): string {\n return `MaybeRefOrGetter<${type}>`\n}\n\nexport function maybeValueOrGetter(type: string): string {\n return `${type} | (() => ${type})`\n}\n\n/**\n * Builds the grouped `{ path, query, body, headers, cookies }` parameter that mirrors the client\n * function signature. Only the groups the operation carries are emitted, typed from the\n * operation's `Options`. `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 `Options` reference. When\n * `memberTypeWrapper` is set, each group is emitted as its own member typed from the matching\n * `Options['<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 /** Binds the variables whole, so destructuring does not drop the chosen media type. */\n withContentType?: boolean\n },\n): FunctionParameterNode | null {\n const { resolver, keys = requestGroupOrder, memberTypeWrapper, withContentType = false } = 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 cookies: false,\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 optionsName = resolver.response.options(node)\n if (withContentType && hasRequestContentTypeChoice(node)) {\n return createFunctionParameter({ name: 'variables', type: optionsName, optional: false })\n }\n\n // `cookies` is on the options type only when the operation has cookie parameters, so it is omitted only then.\n const omittedKeys = requestGroupOrder.filter((key) => !keys.includes(key) && (key !== 'cookies' || groups.cookies))\n const optionsType = omittedKeys.length > 0 ? `Omit<${optionsName}, ${omittedKeys.map((key) => `'${key}'`).join(' | ')}>` : optionsName\n\n if (memberTypeWrapper) {\n const members = names.map((name) => ({\n name,\n type: memberTypeWrapper(`${optionsType}['${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: optionsType,\n optional: false,\n ...(isOptional ? { default: '{}' } : {}),\n })\n}\n\n/**\n * Builds the shared `({ path, query, body, headers, cookies }, 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: buildClientOptionType(node),\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 * When `unwrapName` is set, each request group is passed as an explicit member unwrapped through it,\n * used by vue-query to resolve refs and getters with `toValue(...)` at call time.\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(\n node: ast.OperationNode,\n options: { clientName: string; signal?: boolean; unwrapName?: (name: string) => string; withContentType?: boolean; returnType?: ReturnTypeOption },\n): string {\n const { clientName, signal = false, unwrapName, withContentType = false, returnType = 'full' } = options\n const { groups } = getRequestGroupOptionality(node)\n const names = requestGroupOrder.filter((key) => groups[key])\n\n const args = [\n '...config',\n ...(withContentType && hasRequestContentTypeChoice(node) ? ['...variables'] : names.map((name) => (unwrapName ? `${name}: ${unwrapName(name)}` : name))),\n signal ? 'signal: config.signal ?? signal' : null,\n 'throwOnError: true',\n ].filter((part): part is string => part !== null)\n\n if (withContentType && hasRequestContentTypeChoice(node)) return `${clientName}(${castToClientOptions(`{ ${args.join(', ')} }`, clientName, returnType)})`\n\n return `${clientName}({ ${args.join(', ')} })`\n}\n\n/**\n * Builds the query/mutation body that resolves a `buildClientCall` expression down to the bare\n * success body. `clientReturnType` mirrors the registered client plugin's own `returnType` option: with\n * `'data'` the call already resolves to the bare body, so it is returned directly; with `'full'`\n * (the default) the call carries `unwrap()`, so the body calls it instead of destructuring `data`\n * off the full result by hand. With `'plain'` (plugin-client) the call resolves to the user's\n * `RequestResult`, so the body awaits it and reads `data`. With `returnType` `'full'` the body\n * resolves to the whole `RequestResult`; `resolveHookFile` rejects that for a client that already stripped it.\n *\n * @example\n * ```ts\n * buildCallResultBody(buildClientCall(node, { clientName: 'getPetById' }))\n * // return getPetById({ ...config, throwOnError: true }).unwrap()\n * ```\n */\nexport function buildCallResultBody(call: string, options: { clientReturnType?: ReturnTypeOption; returnType?: ReturnTypeOption } = {}): string {\n const { clientReturnType = 'full', returnType = 'data' } = options\n if (returnType !== 'data' || clientReturnType === 'data') {\n return `return ${call}`\n }\n if (clientReturnType === 'plain') {\n return `return (await ${call}).data`\n }\n return `return ${call}.unwrap()`\n}\n\ntype ResponseTypes = {\n TData: string\n TError: string\n}\n\ntype PageParamType = {\n queryParamsTypeName: string | null\n pageParamType: string\n}\n\ntype ResolvePageParamTypeParams = {\n resolver: ResolverTs\n initialPageParam: Infinite['initialPageParam']\n queryParam?: Infinite['queryParam']\n}\n\n/**\n * Builds the `TData` / `TError` type expressions shared by every generated hook, joining the resolved\n * success responses into `TData` and wrapping the error responses in `ResponseErrorConfig<...>`.\n * With `returnType` `'full'`, `TData` is the client's `RequestResult` over the operation's responses record.\n */\nexport function buildResponseTypes(node: ast.OperationNode, resolver: ResolverTs, options: { returnType?: ReturnTypeOption } = {}): ResponseTypes {\n const { returnType = 'data' } = options\n return resolver.memo(`responseTypes:${returnType}:${node.method}\\0${node.path}`, () => {\n const successNames = resolveSuccessNames(node, resolver)\n const responseName = successNames.length > 0 ? successNames.join(' | ') : resolver.response.response(node)\n const errorNames = resolveErrorNames(node, resolver)\n\n return {\n TData: returnType !== 'data' ? `RequestResult<${resolver.response.responses(node)}, true>` : responseName,\n TError: `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(' | ') : 'Error'}>`,\n }\n })\n}\n\nfunction resolveFallbackPageParamType(initialPageParam: Infinite['initialPageParam']): string {\n if (typeof initialPageParam === 'number') return 'number'\n if (typeof initialPageParam === 'boolean') return 'boolean'\n if (typeof initialPageParam !== 'string') return 'unknown'\n if (!initialPageParam.includes(' as ')) return 'string'\n\n return initialPageParam.split(' as ').at(-1) ?? 'unknown'\n}\n\n/**\n * Resolves the `TPageParam` generic for the infinite-query hooks. Prefers the type read from the\n * configured `queryParam` on the operation's query object, and falls back to the type inferred from\n * `initialPageParam` when that parameter type is unavailable. Also returns the query params type name\n * so callers can reuse it when rewriting the paginated request.\n */\nexport function resolvePageParamType(node: ast.OperationNode, { resolver, initialPageParam, queryParam }: ResolvePageParamTypeParams): PageParamType {\n const firstQueryParam = getOperationParameters(node).query[0]\n const groupName = firstQueryParam ? resolver.param.query(node, firstQueryParam) : null\n const individualName = firstQueryParam ? resolver.param.name(node, firstQueryParam) : null\n const queryParamsTypeName = groupName !== individualName ? groupName : null\n\n const queryParamType = queryParam && queryParamsTypeName ? `${queryParamsTypeName}['${queryParam}']` : null\n\n if (!queryParamType) {\n return { queryParamsTypeName, pageParamType: resolveFallbackPageParamType(initialPageParam) }\n }\n\n const isInitialPageParamDefined = initialPageParam !== undefined && initialPageParam !== null\n\n return { queryParamsTypeName, pageParamType: isInitialPageParamDefined ? `NonNullable<${queryParamType}>` : queryParamType }\n}\n\n/**\n * Applies the shared query defaults during plugin setup: `false` disables query generation, and an\n * object merges over `methods: ['GET', 'QUERY']` and the plugin's runtime `importPath`. QUERY\n * (RFC 10008) is a safe, idempotent read that carries its input in the body, so it is a query too.\n */\nexport function resolveQueryConfig(query: Partial<Query> | false, options: { importPath: string }): Required<Query> | false {\n if (query === false) return false\n return { importPath: options.importPath, methods: ['GET', 'QUERY'], ...query }\n}\n\n/**\n * Applies the shared mutation defaults during plugin setup: `false` disables mutation generation,\n * and an object merges over `methods: ['POST', 'PUT', 'PATCH', 'DELETE']` and the plugin's runtime\n * `importPath`.\n */\nexport function resolveMutationConfig(mutation: Partial<Mutation> | false, options: { importPath: string }): Required<Mutation> | false {\n if (mutation === false) return false\n return { importPath: options.importPath, methods: ['POST', 'PUT', 'PATCH', 'DELETE'], ...mutation }\n}\n\ntype OperationClassification = {\n isQuery: boolean\n isMutation: boolean\n}\n\ntype ClassifyOperationParams = {\n query: Required<Query> | false\n mutation: Required<Mutation> | false\n}\n\n/**\n * Classifies an operation as a query or a mutation from the resolved `query` / `mutation` method lists.\n * Disabled query and mutation configs do not claim operations, and a method already claimed by an\n * enabled query config never counts as a mutation. Event streams are consumed through the client\n * directly, so they do not generate query or mutation hooks.\n */\nexport function classifyOperation(node: ast.HttpOperationNode, { query, mutation }: ClassifyOperationParams): OperationClassification {\n if (isEventStream(node)) return { isQuery: false, isMutation: false }\n\n const isQuery = !!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 return { isQuery, isMutation }\n}\n\n/**\n * Helper to define a typed page param function for `infinite.getNextPageParam` or\n * `infinite.getPreviousPageParam`. Serializes the function to a string for inlining in generated code.\n *\n * Note: Because the function is inlined verbatim into the generated file via `.toString()`,\n * it must be self-contained and cannot reference local closures or external variables from\n * the config file.\n */\nexport function definePageParam<TPage = any, TParam = any>(fn: PageParamFn<TPage, TParam>): string {\n return fn.toString()\n}\n\n/**\n * Applies the shared infinite-query defaults during plugin setup: a falsy value disables infinite\n * queries, and an object merges over `queryParam: 'id'` and `initialPageParam: 0` with the cursor\n * paths cleared.\n */\nexport function resolveInfiniteConfig(infinite: Partial<Infinite> | false): Required<Infinite> | false {\n if (!infinite) return false\n const hasExplicitInitialPageParam = infinite.hasExplicitInitialPageParam ?? infinite.initialPageParam !== undefined\n const getNextPageParam = infinite.getNextPageParam\n ? typeof infinite.getNextPageParam === 'function'\n ? infinite.getNextPageParam.toString()\n : infinite.getNextPageParam\n : null\n const getPreviousPageParam = infinite.getPreviousPageParam\n ? typeof infinite.getPreviousPageParam === 'function'\n ? infinite.getPreviousPageParam.toString()\n : infinite.getPreviousPageParam\n : null\n\n return {\n queryParam: 'id',\n initialPageParam: 0,\n hasExplicitInitialPageParam,\n cursorParam: null,\n nextParam: null,\n previousParam: null,\n getNextPageParam,\n getPreviousPageParam,\n ...infinite,\n ...(getNextPageParam ? { getNextPageParam } : {}),\n ...(getPreviousPageParam ? { getPreviousPageParam } : {}),\n }\n}\n\n/**\n * Whether the infinite hook for `node` should be generated: the operation takes the configured\n * `queryParam`.\n */\nexport function matchesInfinite(node: ast.OperationNode, infinite: Infinite): boolean {\n if (!infinite.queryParam) return false\n // Strip trailing '?' which OpenAPI specs sometimes append to parameter names to denote optionality\n return getOperationParameters(node).query.some((param) => param.name.replace(/\\?$/, '') === infinite.queryParam)\n}\n\n/**\n * Warning for an infinite hook that falls back to the built-in page params on a response that\n * isn't an array. Those params only stop on an empty array, so `hasNextPage` never turns false.\n */\nexport function getDefaultPageParamsWarning(node: ast.OperationNode, infinite: Infinite): string | null {\n const usesDefault =\n infinite.getNextPageParam == null &&\n infinite.getPreviousPageParam == null &&\n infinite.nextParam == null &&\n infinite.previousParam == null &&\n !infinite.cursorParam\n if (!usesDefault) return null\n\n const content = getPrimarySuccessResponse(node)?.content\n const jsonContent = content?.find((item) => item.contentType?.includes('json')) ?? content?.[0]\n const schema = jsonContent?.schema\n\n let resolved: ast.SchemaNode | null | undefined = schema\n while (resolved?.type === 'ref' || (resolved?.type === 'intersection' && resolved.members?.length === 1)) {\n resolved = resolved.type === 'ref' ? resolved.schema : resolved.members?.[0]\n }\n if (!resolved || resolved.type === 'array') return null\n\n return `${node.operationId}: the default infinite page params expect an array response and never end for this one. Set \\`infinite.getNextPageParam\\` (or \\`nextParam\\`) to read the next page from the response.`\n}\n\ntype OverrideFilter = { type: string; pattern: string | RegExp } | { type: 'extension'; key: `x-${string}`; value?: unknown }\n\ntype OverrideEntry<TOptions> = OverrideFilter & {\n options?: Partial<TOptions>\n}\n\nfunction matchesPattern(node: ast.OperationNode, ov: OverrideFilter): boolean {\n if ('key' in ov) {\n const extensions = node.extensions\n if (!extensions || !(ov.key in extensions)) return false\n return ov.value === undefined || extensions[ov.key] === ov.value\n }\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\n/**\n * The request groups a query key is built from, matching `buildQueryKeyParams`. Headers are\n * deliberately absent: they do not identify a cache entry, so the key factory takes no parameter\n * for an operation that only carries headers. Cookies are left out too: they often hold a session token, and a query key\n * is stored in SSR payloads, persisted caches, and devtools.\n */\nexport const queryKeyGroupOrder = ['path', 'query', 'body'] as const\n\n/**\n * Whether the generated query key factory declares a parameter, so a call site passes an argument\n * only when one is accepted.\n */\nexport function hasQueryKeyParams(node: ast.OperationNode): boolean {\n const groups = getRequestGroups(node)\n return queryKeyGroupOrder.some((key) => groups[key])\n}\n\n/**\n * Build QueryKey params as the grouped `{ path, query, body }` object (NO headers, NO cookies, NO config),\n * typed from the operation's `Options` minus `url`. The query key transformer reads the\n * grouped `path`/`query`/`body` bindings.\n */\nexport function buildQueryKeyParams(\n node: ast.OperationNode,\n options: { resolver: PluginTs['resolver']; memberTypeWrapper?: (type: string) => string },\n): FunctionParametersNode {\n const { resolver, memberTypeWrapper } = options\n const groupedParam = buildGroupedRequestParam(node, { resolver, keys: queryKeyGroupOrder, memberTypeWrapper })\n\n return createFunctionParameters({ params: groupedParam ? [groupedParam] : [] })\n}\n\n/**\n * Builds the hook parameter list: the grouped request param (omitted when `withRequest` is `false`) then `options` typed as `optionsType`.\n */\nexport function buildHookParams(\n node: ast.OperationNode,\n options: { resolver: ResolverTs; optionsType: string; memberTypeWrapper?: (type: string) => string; withRequest?: boolean },\n): FunctionParametersNode {\n const { resolver, optionsType, memberTypeWrapper, withRequest = true } = options\n const optionsParam = createFunctionParameter({ name: 'options', type: optionsType, default: '{}' })\n const groupedParam = withRequest ? buildGroupedRequestParam(node, { resolver, memberTypeWrapper }) : null\n\n return createFunctionParameters({ params: [groupedParam, optionsParam].filter((param): param is FunctionParameterNode => param !== null) })\n}\n\n/**\n * The `TRequest` type argument of a mutation hook: the options type when the operation takes a request, else `undefined`.\n */\nexport function resolveMutationRequestType(node: ast.OperationNode, resolver: ResolverTs): string {\n return buildGroupedRequestParam(node, { resolver }) ? resolver.response.options(node) : 'undefined'\n}\n\n/**\n * Builds the object literal that unwraps each request group's getter before it reaches `queryKey`/`queryOptions`; `null` without a request group.\n */\nexport function buildResolvedRequestParams(node: ast.OperationNode): string | null {\n const groups = getRequestGroups(node)\n const names = requestGroupOrder.filter((key) => groups[key])\n if (names.length === 0) return null\n return `{ ${names.map((name) => `${name}: typeof ${name} === 'function' ? ${name}() : ${name}`).join(', ')} }`\n}\n\ndeclare global {\n namespace Kubb {\n interface MemoRegistry {\n responseTypes: ResponseTypes\n }\n }\n}\n","import { getNestedAccessor } from '@internals/utils'\nimport type { ast } from '@kubb/kit'\nimport type { ResolverTs } from '@kubb/plugin-ts'\nimport { createFunctionParameters, functionPrinter } from '@kubb/plugin-ts'\nimport { File, Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx'\nimport type { CallReturnTypeProps, Infinite } from '../types.ts'\nimport {\n buildCallResultBody,\n buildClientCall,\n buildGroupedRequestParam,\n buildQueryOptionsParams,\n buildResponseTypes,\n queryKeyGroupOrder,\n resolvePageParamType,\n} from '../utils.ts'\n\ntype Props = {\n name: string\n clientName: string\n queryKeyName: string\n node: ast.OperationNode\n tsResolver: ResolverTs\n initialPageParam: Infinite['initialPageParam']\n hasExplicitInitialPageParam?: boolean\n cursorParam: Infinite['cursorParam']\n nextParam: Infinite['nextParam']\n previousParam: Infinite['previousParam']\n getNextPageParam?: Infinite['getNextPageParam']\n getPreviousPageParam?: Infinite['getPreviousPageParam']\n queryParam: Infinite['queryParam']\n /**\n * The `TQueryKey` generic written into the emitted `infiniteQueryOptions` call. react-query\n * points it at the local `queryKey` const, vue-query uses the imported `QueryKey` type.\n *\n * @default 'typeof queryKey'\n */\n queryKeyType?: string\n /**\n * Wraps each grouped request member type, used by vue-query to accept `MaybeRefOrGetter` values.\n */\n memberTypeWrapper?: (type: string) => string\n /**\n * Unwraps a request group inside the client call, used by vue-query to emit `toValue(...)`.\n */\n unwrapName?: (name: string) => string\n} & CallReturnTypeProps\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\nconst callPrinter = functionPrinter({ mode: 'call' })\n\nexport function InfiniteQueryOptions({\n name,\n clientName,\n initialPageParam,\n hasExplicitInitialPageParam,\n cursorParam,\n nextParam,\n previousParam,\n getNextPageParam,\n getPreviousPageParam,\n node,\n tsResolver,\n queryParam,\n queryKeyName,\n queryKeyType = 'typeof queryKey',\n memberTypeWrapper,\n unwrapName,\n clientReturnType,\n returnType,\n}: Props): KubbReactNode {\n const { TData: queryFnDataType, TError: errorType } = buildResponseTypes(node, tsResolver, { returnType })\n const dataSuffix = returnType === 'data' ? '' : '.data'\n\n const { queryParamsTypeName, pageParamType } = resolvePageParamType(node, { resolver: tsResolver, initialPageParam, queryParam })\n\n const groupedKeyParam = buildGroupedRequestParam(node, { resolver: tsResolver, keys: queryKeyGroupOrder, memberTypeWrapper })\n const queryKeyParamsNode = createFunctionParameters({ params: groupedKeyParam ? [groupedKeyParam] : [] })\n const queryKeyParamsCall = callPrinter.print(queryKeyParamsNode) ?? ''\n\n const paramsNode = buildQueryOptionsParams(node, { resolver: tsResolver, memberTypeWrapper })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n const queryFnBody = buildCallResultBody(buildClientCall(node, { clientName, signal: true, unwrapName }), { clientReturnType, returnType })\n\n const initialPageParamLiteral =\n typeof initialPageParam === 'string' || (typeof initialPageParam === 'object' && initialPageParam !== null)\n ? JSON.stringify(initialPageParam)\n : String(initialPageParam === undefined ? 0 : initialPageParam)\n\n // Resolve getNextPageParam: custom source > nextParam > cursorParam > default numeric fallback.\n // TanStack Query v5 requires getNextPageParam on infiniteQueryOptions.\n const serializedGetNextPageParam = typeof getNextPageParam === 'function' ? getNextPageParam.toString() : getNextPageParam\n const getNextPageParamExpr = (() => {\n if (serializedGetNextPageParam) return `getNextPageParam: ${serializedGetNextPageParam}`\n if (nextParam) return `getNextPageParam: (lastPage) => ${getNestedAccessor(nextParam, `lastPage${dataSuffix}`)}`\n if (cursorParam) return `getNextPageParam: (lastPage) => lastPage${dataSuffix}['${cursorParam}']`\n return `getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage${dataSuffix}) && lastPage${dataSuffix}.length === 0 ? undefined : lastPageParam + 1`\n })()\n\n // Resolve getPreviousPageParam: custom source > previousParam > cursorParam > default numeric fallback.\n // In TanStack Query, getPreviousPageParam is optional (only needed for bi-directional pagination).\n // When next pagination is custom or cursor-based, numeric decrement is omitted unless explicitly configured.\n // When initialPageParam is not explicitly configured, keep the legacy 1-based default (<= 1) for non-breaking compatibility.\n const serializedGetPreviousPageParam = typeof getPreviousPageParam === 'function' ? getPreviousPageParam.toString() : getPreviousPageParam\n const defaultPreviousThreshold = hasExplicitInitialPageParam ? initialPageParamLiteral : '1'\n\n const getPreviousPageParamExpr = (() => {\n if (serializedGetPreviousPageParam) return `getPreviousPageParam: ${serializedGetPreviousPageParam}`\n if (previousParam) return `getPreviousPageParam: (firstPage) => ${getNestedAccessor(previousParam, `firstPage${dataSuffix}`)}`\n if (cursorParam) return `getPreviousPageParam: (firstPage) => firstPage${dataSuffix}['${cursorParam}']`\n if (serializedGetNextPageParam || nextParam) return null\n return `getPreviousPageParam: (_firstPage, _allPages, firstPageParam) => firstPageParam <= ${defaultPreviousThreshold} ? undefined : firstPageParam - 1`\n })()\n\n const queryOptionsArr = [`initialPageParam: ${initialPageParamLiteral}`, getNextPageParamExpr, getPreviousPageParamExpr].filter(Boolean)\n\n const infiniteOverrideParams =\n queryParam && queryParamsTypeName\n ? `query = {\n ...(query ?? {}),\n ['${queryParam}']: pageParam as unknown as ${queryParamsTypeName}['${queryParam}'],\n } as ${queryParamsTypeName}`\n : ''\n\n const queryFnArgs = infiniteOverrideParams ? '{ signal, pageParam }' : '{ signal }'\n const queryFnStatements = infiniteOverrideParams ? `${infiniteOverrideParams}\\n ${queryFnBody}` : queryFnBody\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function name={name} export params={paramsSignature}>\n {`\nconst queryKey = ${queryKeyName}(${queryKeyParamsCall})\nreturn infiniteQueryOptions<${queryFnDataType}, ${errorType}, InfiniteData<${queryFnDataType}>, ${queryKeyType}, ${pageParamType}>({\n queryKey,\n queryFn: async (${queryFnArgs}) => {\n ${queryFnStatements}\n },\n ${queryOptionsArr.join(',\\n ')}\n})\n`}\n </Function>\n </File.Source>\n )\n}\n","import { type ast, Url } from '@kubb/kit'\nimport { createFunctionParameters, functionPrinter } from '@kubb/plugin-ts'\nimport { File, Function, Type } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx'\nimport type { Transformer } from '../types.ts'\n\ntype Props = {\n name: string\n node: ast.OperationNode\n transformer: Transformer | null | undefined\n /**\n * Also emits `ReturnType<typeof name>` as an exported type alias of this name.\n */\n typeName?: string\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\n\n/**\n * Default `mutationKey` builder. Call it from a custom builder to extend the default key.\n *\n * @remarks The returned segments may change between releases. Spread them instead of reading single entries.\n *\n * @example\n * ```ts\n * mutationKey: (props) => [JSON.stringify(props.node.operationId), ...mutationKeyTransformer(props)]\n * ```\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, typeName }: Props): KubbReactNode {\n const paramsNode = createFunctionParameters({ params: [] })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n // Mutations always use 'mutation' as they do not have suspense or infinite variants.\n const keys = (transformer ?? mutationKeyTransformer)({ node, casing: 'camelcase', variant: 'mutation' })\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 {typeName && (\n <File.Source name={typeName} isExportable isIndexable isTypeOnly>\n <Type export name={typeName}>{`ReturnType<typeof ${name}>`}</Type>\n </File.Source>\n )}\n </>\n )\n}\n","import { operationKey } from '@internals/shared'\nimport { capitalize } from '@internals/utils'\nimport type { ast, Resolver } from '@kubb/kit'\n\n/**\n * The naming variant of a query namespace: the plain query, or the\n * `Suspense`/`Infinite`/`SuspenseInfinite` flavors that suffix every\n * generated identifier.\n */\nexport type QueryVariant = '' | 'Suspense' | 'Infinite' | 'SuspenseInfinite'\n\n/**\n * The query namespace shared by the TanStack Query flavored plugins\n * (react-query, vue-query, swr): hook, options, key, and key type names.\n */\nexport type QueryResolver = {\n name(this: Resolver, node: ast.OperationNode): string\n optionsName(this: Resolver, node: ast.OperationNode): string\n keyName(this: Resolver, node: ast.OperationNode): string\n keyTypeName(this: Resolver, node: ast.OperationNode): string\n}\n\n/**\n * The mutation namespace shared by the TanStack Query flavored plugins:\n * hook and mutation key names.\n */\nexport type MutationResolver = {\n name(this: Resolver, node: ast.OperationNode): string\n keyName(this: Resolver, node: ast.OperationNode): string\n}\n\n/**\n * Builds the shared query namespace for a variant. Spread the result into\n * `createResolver` once per variant the plugin supports.\n *\n * @example\n * ```ts\n * createResolver<PluginReactQuery>({\n * query: createQueryResolver(),\n * suspenseQuery: createQueryResolver('Suspense'),\n * })\n * ```\n */\nexport function createQueryResolver(variant: QueryVariant = ''): QueryResolver {\n return {\n name(node) {\n const name = `use${capitalize(this.name(node.operationId))}${variant}`\n return this.resolveName({ key: operationKey(node, 'query', variant, 'name'), name })\n },\n optionsName(node) {\n const name = `${this.name(node.operationId)}${variant}QueryOptions`\n return this.resolveName({ key: operationKey(node, 'query', variant, 'optionsName'), name })\n },\n keyName(node) {\n const name = `${this.name(node.operationId)}${variant}QueryKey`\n return this.resolveName({ key: operationKey(node, 'query', variant, 'keyName'), name })\n },\n keyTypeName(node) {\n const name = `${capitalize(this.name(node.operationId))}${variant}QueryKey`\n return this.resolveName({ key: operationKey(node, 'query', variant, 'keyTypeName'), name })\n },\n }\n}\n\n/**\n * Builds the shared mutation namespace. Spread the result into\n * `createResolver` and add plugin-specific methods (`optionsName`,\n * `argTypeName`) next to it.\n *\n * @example\n * ```ts\n * createResolver<PluginSwr>({ mutation: { ...createMutationResolver(), argTypeName(node) {...} } })\n * ```\n */\nexport function createMutationResolver(): MutationResolver {\n return {\n name(node) {\n const name = `use${capitalize(this.name(node.operationId))}`\n return this.resolveName({ key: operationKey(node, 'mutation', 'name'), name })\n },\n keyName(node) {\n const name = `${this.name(node.operationId)}MutationKey`\n return this.resolveName({ key: operationKey(node, 'mutation', 'keyName'), name })\n },\n }\n}\n","import { getOperationParameters } from '@internals/shared'\nimport { type ast, Url } from '@kubb/kit'\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'\nimport type { KeyVariant, 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 * @default 'query'\n */\n variant?: KeyVariant\n /**\n * Wraps each grouped request member type, used by vue-query for `MaybeRefOrGetter`.\n */\n memberTypeWrapper?: (type: string) => string\n /**\n * Exports and indexes the `typeName` alias too (default `false`).\n */\n exportType?: boolean\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\n\n/**\n * Default `queryKey` builder. Call it from a custom builder to extend the default key.\n *\n * @remarks The returned segments may change between releases. Spread them instead of reading single entries.\n *\n * @example\n * ```ts\n * queryKey: (props) => [JSON.stringify(props.node.operationId), ...queryKeyTransformer(props)]\n * ```\n */\nexport const queryKeyTransformer: Transformer = ({ node, variant }) => {\n if (!node.path) return []\n const { path, query } = getOperationParameters(node)\n // Embedding `infinite: true` inside the URL segment separates infinite queries in the cache\n // while preserving TanStack Query partial matching for base URL invalidation.\n const isInfinite = variant === 'infiniteQuery' || variant === 'suspenseInfiniteQuery'\n\n const urlFields = [`url: '${Url.toPath(node.path)}'`]\n if (path.length > 0) urlFields.push('params: path')\n if (isInfinite) urlFields.push('infinite: true')\n\n const result = [`{ ${urlFields.join(', ')} }`]\n if (query.length > 0) result.push('...(query ? [query] : [])')\n // A falsy body (`''`, `0`, `false`, `null`) is still an input, so only an absent one is left out.\n if (node.requestBody?.content?.[0]?.schema) result.push('...(body !== undefined ? [body] : [])')\n\n return result\n}\n\nexport function QueryKey({ name, node, tsResolver, typeName, transformer, variant = 'query', memberTypeWrapper, exportType }: Props): KubbReactNode {\n const paramsNode = buildQueryKeyParams(node, { resolver: tsResolver, memberTypeWrapper })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n const keys = (transformer ?? queryKeyTransformer)({ node, casing: 'camelcase', variant })\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} isExportable={exportType} isIndexable={exportType} isTypeOnly>\n <Type name={typeName} export={exportType}>{`ReturnType<typeof ${name}>`}</Type>\n </File.Source>\n </>\n )\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\nimport { defineGenerator } from '@kubb/kit'\nimport { File, Function, jsxRenderer } from '@kubb/renderer-jsx'\nimport type { PluginReactQuery } from '../types'\n\n/**\n * Scaffolds the user-editable `useCustomHookOptions` file when\n * `pluginReactQuery({ customOptions: { ... }, hooks: true })` is configured. The file is\n * only created when it does not already exist, so user edits persist across\n * regeneration, and only when `importPath` resolves inside the plugin's output folder.\n */\nexport const customHookOptionsFileGenerator = defineGenerator<PluginReactQuery>({\n name: 'react-query-custom-hook-options-file',\n renderer: jsxRenderer,\n operations(nodes, ctx) {\n const { resolver, root } = ctx\n const { output, customOptions, query, group, hooks } = ctx.options\n\n // The starter file imports the `HookOptions` type, which is only generated alongside the hooks.\n if (!customOptions || !hooks) return null\n\n const { importPath, name } = customOptions\n const hookOptionsName = resolver.hook.optionsName()\n const customHookOptionsName = resolver.hook.customOptionsName()\n\n const reactQueryImportPath = query ? query.importPath : '@tanstack/react-query'\n\n const outputPath = path.resolve(root, output.path)\n const outputDir = output.mode === 'directory' ? outputPath : path.dirname(outputPath)\n\n let basePath = outputDir\n const firstNode = nodes[0]\n if (firstNode) {\n const hookName = resolver.query.name(firstNode)\n const hookFile = resolver.file({\n name: hookName,\n extname: '.ts',\n tag: firstNode.tags[0] ?? 'default',\n path: firstNode.path,\n root,\n output,\n group: group ?? undefined,\n })\n basePath = path.dirname(hookFile.path)\n }\n\n const ensureExtension = (filePath: string, extname: string) => {\n if (path.extname(filePath) === '') return filePath + extname\n return filePath\n }\n\n const actualFilePath = ensureExtension(importPath, '.ts')\n const file = {\n baseName: path.basename(actualFilePath) as `${string}.${string}`,\n path: path.resolve(basePath, actualFilePath),\n }\n\n // `importPath` bypasses the resolver's output-folder guard, so apply the same boundary here.\n // A module outside the output folder belongs to the user, who creates it themselves.\n const relativeToOutput = path.relative(outputDir, file.path)\n if (relativeToOutput === '..' || relativeToOutput.startsWith(`..${path.sep}`) || path.isAbsolute(relativeToOutput)) return null\n\n if (fs.existsSync(file.path)) return null\n\n return (\n <File baseName={file.baseName} path={file.path}>\n <File.Import name={['QueryClient']} path={reactQueryImportPath} isTypeOnly />\n <File.Import name={['useQueryClient']} path={reactQueryImportPath} />\n <File.Import name={[hookOptionsName]} root={file.path} path={path.resolve(root, './index.ts')} />\n <File.Source name={name} isExportable isIndexable>\n <Function name={customHookOptionsName} params=\"{ queryClient }: { queryClient: QueryClient }\" returnType={`Partial<${hookOptionsName}>`}>\n {`return {\n // TODO: Define custom hook options here\n // Example:\n // useUpdatePetHook: {\n // onSuccess: () => {\n // void queryClient.invalidateQueries({ queryKey: ['pet'] })\n // }\n // }\n }`}\n </Function>\n <Function\n name={name}\n generics={`T extends keyof ${hookOptionsName}`}\n params=\"{ hookName, operationId }: { hookName: T, operationId: string }\"\n returnType={`${hookOptionsName}[T]`}\n export\n >\n {`const queryClient = useQueryClient()\n const customOptions = ${customHookOptionsName}({ queryClient })\n return customOptions[hookName] ?? {}`}\n </Function>\n </File.Source>\n </File>\n )\n },\n})\n","import { operationFileEntry } from '@internals/shared'\nimport { matchesInfinite } from '@internals/tanstack-query'\nimport { ast, defineGenerator } from '@kubb/kit'\nimport { File, jsxRenderer, Type } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx'\nimport type { PluginReactQuery } from '../types'\nimport { classifyOperation, resolveOperationOverrides } from '@internals/tanstack-query'\n\ntype QueryOption = PluginReactQuery['resolvedOptions']['query']\ntype MutationOption = PluginReactQuery['resolvedOptions']['mutation']\n\n/**\n * Emits the `HookOptions` type used by `customOptions`. Enabled when\n * `pluginReactQuery({ customOptions: { ... } })`. The generated type lists\n * every hook keyed by name so user-supplied options stay in sync with the\n * generated hooks at compile time.\n */\nexport const hookOptionsGenerator = defineGenerator<PluginReactQuery>({\n name: 'react-query-hook-options',\n renderer: jsxRenderer,\n operations(nodes, ctx) {\n const { resolver, config, root } = ctx\n const { output, customOptions, query, mutation, suspense, infinite, group, override, hooks } = ctx.options\n\n if (!customOptions || !hooks) return null\n\n const name = resolver.hook.optionsName()\n const resolvedFile = resolver.file({ name, extname: '.ts', root, output, group: group ?? undefined })\n const hookOptionsFile = {\n ...resolvedFile,\n baseName: `${name}.ts` as const,\n path: resolvedFile.path.replace(/[^/\\\\]+\\.ts$/, `${name}.ts`),\n }\n\n const imports: Array<KubbReactNode> = []\n const hookOptions: Record<string, string> = {}\n\n for (const node of nodes) {\n if (!ast.isHttpOperationNode(node)) continue\n const opOverrides = resolveOperationOverrides(node, override)\n const nodeQuery: QueryOption = 'query' in opOverrides ? (opOverrides.query as QueryOption) : query\n const nodeMutation: MutationOption = 'mutation' in opOverrides ? (opOverrides.mutation as MutationOption) : mutation\n const nodeInfinite = 'infinite' in opOverrides ? opOverrides.infinite : infinite\n const nodeInfiniteOptions = nodeInfinite && typeof nodeInfinite === 'object' ? nodeInfinite : null\n\n // A per-operation `query: false` skips the query hooks, matching the generators that emit them.\n const { isQuery, isMutation } = classifyOperation(node, { query: nodeQuery, mutation: nodeMutation })\n const isSuspense = !!suspense\n const isInfinite = isQuery && !!nodeInfiniteOptions && matchesInfinite(node, nodeInfiniteOptions)\n\n const namespaces: Array<[{ name(node: ast.OperationNode): string; optionsName(node: ast.OperationNode): string }, boolean]> = [\n [resolver.query, isQuery],\n [resolver.suspenseQuery, isQuery && isSuspense],\n [resolver.infiniteQuery, isInfinite],\n [resolver.suspenseInfiniteQuery, isInfinite && isSuspense],\n [resolver.mutation, isMutation],\n ]\n\n for (const [ns, enabled] of namespaces) {\n if (!enabled) continue\n const optionsName = ns.optionsName(node)\n const hookName = ns.name(node)\n const hookFile = resolver.file({ ...operationFileEntry(node, hookName), root, output, group: group ?? undefined })\n imports.push(<File.Import name={[optionsName]} root={hookOptionsFile.path} path={hookFile.path} />)\n hookOptions[hookName] = `Partial<ReturnType<typeof ${optionsName}>>`\n }\n }\n\n return (\n <File\n baseName={hookOptionsFile.baseName}\n path={hookOptionsFile.path}\n meta={hookOptionsFile.meta}\n banner={resolver.default.banner(ctx.meta, { output, config, file: { path: hookOptionsFile.path, baseName: hookOptionsFile.baseName } })}\n footer={resolver.default.footer(ctx.meta, { output, config, file: { path: hookOptionsFile.path, baseName: hookOptionsFile.baseName } })}\n >\n {imports}\n <File.Source name={name} isExportable isIndexable isTypeOnly>\n <Type export name={name}>\n {`{ ${Object.keys(hookOptions)\n .map((key) => `${JSON.stringify(key)}: ${hookOptions[key]}`)\n .join(', ')} }`}\n </Type>\n </File.Source>\n </File>\n )\n },\n})\n","import type { ast } from '@kubb/kit'\nimport type { 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'\nimport { buildClientOptionType, buildOperationComments } from '@internals/shared'\nimport {\n buildHookParams,\n buildResolvedRequestParams,\n buildResponseTypes,\n hasQueryKeyParams,\n maybeValueOrGetter,\n resolvePageParamType,\n} from '@internals/tanstack-query'\nimport type { HookReturnTypeProps, Infinite } from '@internals/tanstack-query'\nimport type { PluginReactQuery } from '../types.ts'\n\ntype Props = {\n name: string\n queryOptionsName: string\n queryKeyName: string\n queryKeyTypeName: string\n node: ast.OperationNode\n tsResolver: ResolverTs\n customOptions: PluginReactQuery['resolvedOptions']['customOptions']\n /**\n * Emits the suspense variant of the hook (`useSuspenseQuery`, `useSuspenseInfiniteQuery`). The\n * suspense observer options drop the `TQueryData` generic, everything else stays identical.\n */\n suspense?: boolean\n /**\n * Emits the infinite variant of the hook (`useInfiniteQuery`) with the page param type resolved from these.\n */\n infinite?: {\n initialPageParam: Infinite['initialPageParam']\n queryParam?: Infinite['queryParam']\n }\n} & HookReturnTypeProps\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\n\nconst OBSERVER_OPTIONS_NAMES = {\n infinite: { suspense: 'UseSuspenseInfiniteQueryOptions', standard: 'InfiniteQueryObserverOptions' },\n plain: { suspense: 'UseSuspenseQueryOptions', standard: 'QueryObserverOptions' },\n}\n\ntype HookTypesProps = Pick<Props, 'node' | 'suspense' | 'queryKeyTypeName' | 'infinite'> & {\n tsResolver: ResolverTs\n TData: string\n TError: string\n observerOptionsName: string\n resultTypeName: string\n}\n\nfunction buildHookTypes({ node, tsResolver, infinite, suspense, TData, TError, queryKeyTypeName, observerOptionsName, resultTypeName }: HookTypesProps) {\n if (infinite) {\n const { pageParamType } = resolvePageParamType(node, { resolver: tsResolver, initialPageParam: infinite.initialPageParam, queryParam: infinite.queryParam })\n return {\n generics: [\n `TQueryFnData = ${TData}`,\n `TError = ${TError}`,\n 'TData = InfiniteData<TQueryFnData>',\n `TQueryKey extends QueryKey = ${queryKeyTypeName}`,\n `TPageParam = ${pageParamType}`,\n ],\n observerOptionsType: `${observerOptionsName}<TQueryFnData, TError, TData, TQueryKey, TPageParam>`,\n resultType: `${resultTypeName}<TData, TError> & { queryKey: TQueryKey }`,\n }\n }\n\n return {\n generics: suspense\n ? [`TData = ${TData}`, `TQueryKey extends QueryKey = ${queryKeyTypeName}`]\n : [`TData = ${TData}`, `TQueryData = ${TData}`, `TQueryKey extends QueryKey = ${queryKeyTypeName}`],\n observerOptionsType: `${observerOptionsName}<${(suspense ? [TData, TError, 'TData', 'TQueryKey'] : [TData, TError, 'TData', 'TQueryData', 'TQueryKey']).join(', ')}>`,\n resultType: `${resultTypeName}<TData, ${TError}> & { queryKey: TQueryKey }`,\n }\n}\n\nexport function Query({\n name,\n queryKeyTypeName,\n queryOptionsName,\n queryKeyName,\n node,\n tsResolver,\n customOptions,\n suspense,\n infinite,\n returnType,\n}: Props): KubbReactNode {\n const { TData, TError } = buildResponseTypes(node, tsResolver, { returnType })\n\n const prefix = suspense ? 'UseSuspense' : 'Use'\n const hookName = `${suspense ? 'useSuspense' : 'use'}${infinite ? 'InfiniteQuery' : 'Query'}`\n const observerOptionsName = OBSERVER_OPTIONS_NAMES[infinite ? 'infinite' : 'plain'][suspense ? 'suspense' : 'standard']\n const resultTypeName = `${prefix}${infinite ? 'Infinite' : ''}QueryResult`\n\n const { generics, observerOptionsType, resultType } = buildHookTypes({\n node,\n tsResolver,\n infinite,\n suspense,\n TData,\n TError,\n queryKeyTypeName,\n observerOptionsName,\n resultTypeName,\n })\n // The non-infinite hook casts to the bare options type, the infinite one to the fully applied type.\n const castType = infinite ? observerOptionsType : observerOptionsName\n\n const resolvedParams = buildResolvedRequestParams(node)\n const queryKeyArgs = resolvedParams && hasQueryKeyParams(node) ? 'resolvedParams' : ''\n const queryOptionsArgs = resolvedParams ? 'resolvedParams, config' : 'config'\n\n const paramsNode = buildHookParams(node, {\n resolver: tsResolver,\n memberTypeWrapper: maybeValueOrGetter,\n optionsType: `{\n query?: Partial<${observerOptionsType}> & { client?: QueryClient },\n client?: ${buildClientOptionType(node)}\n}`,\n })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function\n name={name}\n export\n generics={generics.join(', ')}\n params={paramsSignature}\n returnType={undefined}\n JSDoc={{ comments: buildOperationComments(node) }}\n >\n {`\n const { query: queryConfig = {}, client: config = {} } = options ?? {}\n const { client: queryClient, ...resolvedOptions } = queryConfig${resolvedParams ? `\\n const resolvedParams = ${resolvedParams}` : ''}\n const queryKey = resolvedOptions?.queryKey ?? ${queryKeyName}(${queryKeyArgs})${customOptions ? `\\n const customOptions = ${customOptions.name}({ hookName: '${name}', operationId: '${node.operationId}' })` : ''}\n\n const queryResult = ${hookName}({\n ...${queryOptionsName}(${queryOptionsArgs}),${customOptions ? '\\n ...customOptions,' : ''}\n ...resolvedOptions,\n queryKey,\n } as unknown as ${castType}, queryClient) as ${resultType}\n\n queryResult.queryKey = queryKey as TQueryKey\n\n return queryResult\n `}\n </Function>\n </File.Source>\n )\n}\n","import type { ast } from '@kubb/kit'\nimport type { 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'\nimport { buildCallResultBody, buildQueryOptionsParams, buildClientCall } from '@internals/tanstack-query'\nimport type { CallReturnTypeProps } from '@internals/tanstack-query'\nimport { buildQueryKeyParams, buildResponseTypes } from '@internals/tanstack-query'\n\ntype Props = {\n name: string\n clientName: string\n queryKeyName: string\n node: ast.OperationNode\n tsResolver: ResolverTs\n} & CallReturnTypeProps\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\nconst callPrinter = functionPrinter({ mode: 'call' })\n\nexport function QueryOptions({ name, clientName, node, tsResolver, queryKeyName, clientReturnType, returnType }: Props): KubbReactNode {\n const { TData, TError } = buildResponseTypes(node, tsResolver, { returnType })\n\n const queryKeyParamsNode = buildQueryKeyParams(node, { resolver: tsResolver })\n const queryKeyParamsCall = callPrinter.print(queryKeyParamsNode) ?? ''\n\n const paramsNode = buildQueryOptionsParams(node, { resolver: tsResolver })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n const queryFnBody = buildCallResultBody(buildClientCall(node, { clientName, signal: true }), { clientReturnType, returnType })\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function name={name} export params={paramsSignature}>\n {`\n const queryKey = ${queryKeyName}(${queryKeyParamsCall})\n return queryOptions<${TData}, ${TError}, ${TData}, typeof queryKey>({\n queryKey,\n queryFn: async ({ signal }) => {\n ${queryFnBody}\n },\n })\n`}\n </Function>\n </File.Source>\n )\n}\n","import { resolveClientOperation, resolveOperationTypes } from '@internals/client'\nimport {\n classifyOperation,\n getDefaultPageParamsWarning,\n HookFile,\n InfiniteQueryOptions,\n matchesInfinite,\n QueryKey,\n resolveHookFile,\n resolvePageParamType,\n} from '@internals/tanstack-query'\nimport { ast, defineGenerator } from '@kubb/kit'\nimport { File, jsxRenderer } from '@kubb/renderer-jsx'\nimport { Query } from '../components/Query.tsx'\nimport { QueryOptions } from '../components/QueryOptions.tsx'\nimport type { PluginReactQuery } from '../types'\n\ntype Variant = 'query' | 'suspenseQuery' | 'infiniteQuery' | 'suspenseInfiniteQuery'\n\nconst OBSERVER_IMPORTS: Record<Variant, Array<string>> = {\n query: ['QueryObserverOptions', 'UseQueryResult'],\n suspenseQuery: ['UseSuspenseQueryOptions', 'UseSuspenseQueryResult'],\n infiniteQuery: ['InfiniteQueryObserverOptions', 'UseInfiniteQueryResult'],\n suspenseInfiniteQuery: ['UseSuspenseInfiniteQueryOptions', 'UseSuspenseInfiniteQueryResult'],\n}\n\n/**\n * Builds the generator for one `useQuery` flavor. `variant` picks the resolver namespace\n * (`resolver.query`, `resolver.suspenseQuery`, ...), the TanStack hook, and the options it needs.\n */\nexport function createQueryGenerator({ name, variant }: { name: string; variant: Variant }) {\n const suspense = variant === 'suspenseQuery' || variant === 'suspenseInfiniteQuery'\n const infinite = variant === 'infiniteQuery' || variant === 'suspenseInfiniteQuery'\n const hookImport = `use${suspense ? 'Suspense' : ''}${infinite ? 'InfiniteQuery' : 'Query'}`\n const observerImports = OBSERVER_IMPORTS[variant]\n\n return defineGenerator<PluginReactQuery>({\n name,\n renderer: jsxRenderer,\n match(node, ctx) {\n const operationNode = node as ast.OperationNode\n if (!ast.isHttpOperationNode(operationNode)) return false\n const { query, mutation, infinite: infiniteConfig, suspense: suspenseConfig, hooks } = ctx.options\n const { isQuery, isMutation } = classifyOperation(operationNode, { query, mutation })\n if (!isQuery || isMutation) return false\n if (suspense && !suspenseConfig) return false\n if (variant === 'query') return true\n if (!hooks) return false\n if (!infinite) return true\n\n const infiniteOptions = infiniteConfig && typeof infiniteConfig === 'object' ? infiniteConfig : null\n return !!infiniteOptions && matchesInfinite(operationNode, infiniteOptions)\n },\n operation(node, ctx) {\n if (!ast.isHttpOperationNode(node)) return null\n const { driver, resolver, root } = ctx\n const { output, query, infinite: infiniteConfig, client, group, customOptions, hooks } = ctx.options\n\n const infiniteOptions = infinite && infiniteConfig && typeof infiniteConfig === 'object' ? infiniteConfig : null\n if (infinite && !infiniteOptions) return null\n\n // The suspense infinite generator skips the warning: the infinite one already emits it for this operation.\n if (variant === 'infiniteQuery' && infiniteOptions) {\n const pageParamsWarning = getDefaultPageParamsWarning(node, infiniteOptions)\n if (pageParamsWarning) ctx.warn(pageParamsWarning)\n }\n\n const contractOp = resolveClientOperation({ clientPlugin: { pluginName: client.pluginName }, driver, node, root, output, memo: ctx.memo })\n if (!contractOp) return null\n\n const importPath = query ? query.importPath : '@tanstack/react-query'\n const variantResolver = resolver[variant]\n const queryName = variantResolver.name(node)\n const queryOptionsName = variantResolver.optionsName(node)\n const queryKeyName = variantResolver.keyName(node)\n const queryKeyTypeName = variantResolver.keyTypeName(node)\n const tsResolver = resolveOperationTypes(driver, resolver.pluginName).resolver\n\n const hook = resolveHookFile(node, ctx, {\n name: queryName,\n output,\n group,\n contractOp,\n returnType: ctx.options.returnType,\n keyTypeName: queryKeyTypeName,\n extraTypeNames: infiniteOptions\n ? [\n resolvePageParamType(node, { resolver: tsResolver, initialPageParam: infiniteOptions.initialPageParam, queryParam: infiniteOptions.queryParam })\n .queryParamsTypeName,\n ]\n : [],\n })\n\n return (\n <HookFile hook={hook} imports={customOptions && <File.Import name={[customOptions.name]} path={customOptions.importPath} />}>\n <QueryKey\n name={queryKeyName}\n typeName={queryKeyTypeName}\n node={node}\n tsResolver={hook.tsResolver}\n transformer={ctx.options.queryKey}\n variant={variant}\n />\n\n {infiniteOptions ? (\n <>\n <File.Import name={['InfiniteData']} isTypeOnly path={importPath} />\n <File.Import name={['infiniteQueryOptions']} path={importPath} />\n <InfiniteQueryOptions\n name={queryOptionsName}\n clientName={contractOp.name}\n queryKeyName={queryKeyName}\n node={node}\n tsResolver={hook.tsResolver}\n cursorParam={infiniteOptions.cursorParam}\n nextParam={infiniteOptions.nextParam}\n previousParam={infiniteOptions.previousParam}\n getNextPageParam={infiniteOptions.getNextPageParam}\n getPreviousPageParam={infiniteOptions.getPreviousPageParam}\n initialPageParam={infiniteOptions.initialPageParam}\n hasExplicitInitialPageParam={infiniteOptions.hasExplicitInitialPageParam}\n queryParam={infiniteOptions.queryParam}\n clientReturnType={contractOp.returnType}\n returnType={hook.returnType}\n />\n </>\n ) : (\n <>\n <File.Import name={['queryOptions']} path={importPath} />\n <QueryOptions\n name={queryOptionsName}\n clientName={contractOp.name}\n queryKeyName={queryKeyName}\n node={node}\n tsResolver={hook.tsResolver}\n clientReturnType={contractOp.returnType}\n returnType={hook.returnType}\n />\n </>\n )}\n\n {(variant !== 'query' || (query && hooks)) && (\n <>\n <File.Import name={[hookImport]} path={importPath} />\n <File.Import name={['QueryKey', 'QueryClient', ...observerImports]} path={importPath} isTypeOnly />\n <Query\n name={queryName}\n queryOptionsName={queryOptionsName}\n queryKeyName={queryKeyName}\n queryKeyTypeName={queryKeyTypeName}\n node={node}\n tsResolver={hook.tsResolver}\n customOptions={customOptions}\n returnType={hook.returnType}\n suspense={suspense}\n infinite={infiniteOptions ? { initialPageParam: infiniteOptions.initialPageParam, queryParam: infiniteOptions.queryParam } : undefined}\n />\n </>\n )}\n </HookFile>\n )\n },\n })\n}\n","import { createQueryGenerator } from './createQueryGenerator.tsx'\n\n/**\n * Built-in generator for `useInfiniteQuery` hooks. Enabled when\n * `pluginReactQuery({ infinite: { ... }, hooks: true })`. Emits one\n * `useFooInfiniteQuery` hook per query operation, wiring the configured\n * `nextParam` / `previousParam` paths into TanStack Query's cursor-based\n * pagination.\n */\nexport const infiniteQueryGenerator = createQueryGenerator({ name: 'react-infinite-query', variant: 'infiniteQuery' })\n","import type { ast } from '@kubb/kit'\nimport type { 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'\nimport { buildCallResultBody, buildGroupedRequestParam, buildClientCall } from '@internals/tanstack-query'\nimport type { CallReturnTypeProps } from '@internals/tanstack-query'\nimport { buildRequestConfigType } from '@internals/shared'\nimport { buildResponseTypes } from '@internals/tanstack-query'\n\ntype Props = {\n name: string\n clientName: string\n mutationKeyName: string\n node: ast.OperationNode\n tsResolver: ResolverTs\n} & CallReturnTypeProps\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\nconst callPrinter = functionPrinter({ mode: 'call' })\n\nexport function buildMutationConfigParamsNode(node: ast.OperationNode): FunctionParametersNode {\n return createFunctionParameters({\n params: [\n createFunctionParameter({\n name: 'config',\n type: buildRequestConfigType(node),\n default: '{}',\n }),\n ],\n })\n}\n\nexport function MutationOptions({ name, clientName, node, tsResolver, mutationKeyName, clientReturnType, returnType }: Props): KubbReactNode {\n const { TData, TError } = buildResponseTypes(node, tsResolver, { returnType })\n\n const configParamsNode = buildMutationConfigParamsNode(node)\n const paramsSignature = declarationPrinter.print(configParamsNode) ?? ''\n\n const groupedParam = buildGroupedRequestParam(node, { resolver: tsResolver, withContentType: true })\n const hasMutationParams = groupedParam !== null\n\n const groupedParamsNode = createFunctionParameters({ params: groupedParam ? [groupedParam] : [] })\n const TRequest = hasMutationParams ? tsResolver.response.options(node) : 'undefined'\n const argBindingStr = hasMutationParams ? (callPrinter.print(groupedParamsNode) ?? '') : '_'\n const mutationFnBody = buildCallResultBody(buildClientCall(node, { clientName, signal: false, withContentType: true, returnType: clientReturnType }), {\n clientReturnType,\n returnType,\n })\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function name={name} export params={paramsSignature} generics={['TContext = unknown']}>\n {`\n const mutationKey = ${mutationKeyName}()\n return mutationOptions<${TData}, ${TError}, ${TRequest}, TContext>({\n mutationKey,\n mutationFn: async(${argBindingStr}) => {\n ${mutationFnBody}\n },\n })\n`}\n </Function>\n </File.Source>\n )\n}\n","import type { ast } from '@kubb/kit'\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'\nimport { buildHookParams, buildResponseTypes, resolveMutationRequestType } from '@internals/tanstack-query'\nimport type { HookReturnTypeProps } from '@internals/tanstack-query'\nimport type { ReturnTypeOption } from '@internals/client'\nimport type { PluginReactQuery } from '../types.ts'\nimport { buildOperationComments as getComments, buildRequestConfigType } from '@internals/shared'\nimport { buildMutationConfigParamsNode } from './MutationOptions.tsx'\n\ntype Props = {\n name: string\n mutationOptionsName: string\n mutationKeyName: string\n node: ast.OperationNode\n tsResolver: ResolverTs\n customOptions: PluginReactQuery['resolvedOptions']['customOptions']\n} & HookReturnTypeProps\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\nconst callPrinter = functionPrinter({ mode: 'call' })\n\nfunction buildMutationParamsNode(node: ast.OperationNode, options: { resolver: ResolverTs; returnType: ReturnTypeOption }): FunctionParametersNode {\n const { resolver, returnType } = options\n const { TData, TError } = buildResponseTypes(node, resolver, { returnType })\n const generics = [TData, TError, resolveMutationRequestType(node, resolver), 'TContext'].join(', ')\n\n return buildHookParams(node, {\n resolver,\n withRequest: false,\n optionsType: `{\n mutation?: UseMutationOptions<${generics}> & { client?: QueryClient },\n client?: ${buildRequestConfigType(node)},\n}`,\n })\n}\n\nexport function Mutation({ name, mutationOptionsName, node, tsResolver, mutationKeyName, customOptions, returnType }: Props): KubbReactNode {\n const { TData, TError } = buildResponseTypes(node, tsResolver, { returnType })\n\n const TRequest = resolveMutationRequestType(node, tsResolver)\n const generics = [TData, TError, TRequest, 'TContext'].join(', ')\n const resultType = `UseMutationResult<${generics}>`\n\n const mutationOptionsConfigNode = buildMutationConfigParamsNode(node)\n const mutationOptionsParamsCall = callPrinter.print(mutationOptionsConfigNode) ?? ''\n\n const paramsNode = buildMutationParamsNode(node, { resolver: tsResolver, returnType })\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) }} generics={['TContext']}>\n {`\n const { mutation = {}, client: config = {} } = options ?? {}\n const { client: queryClient, ...mutationOptions } = mutation;\n const mutationKey = mutationOptions.mutationKey ?? ${mutationKeyName}()\n\n const baseOptions = ${mutationOptionsName}(${mutationOptionsParamsCall}) as UseMutationOptions<${generics}>${customOptions ? `\\n const customOptions = ${customOptions.name}({ hookName: '${name}', operationId: '${node.operationId}' }) as UseMutationOptions<${generics}>` : ''}\n\n return useMutation<${generics}>({\n ...baseOptions,${customOptions ? '\\n ...customOptions,' : ''}\n mutationKey,\n ...mutationOptions,\n }, queryClient) as ${resultType}\n `}\n </Function>\n </File.Source>\n )\n}\n","import { resolveClientOperation } from '@internals/client'\nimport { classifyOperation, HookFile, MutationKey, resolveHookFile } from '@internals/tanstack-query'\nimport { ast, defineGenerator } from '@kubb/kit'\nimport { File, jsxRenderer } from '@kubb/renderer-jsx'\nimport { Mutation } from '../components/Mutation.tsx'\nimport { MutationOptions } from '../components/MutationOptions.tsx'\nimport type { PluginReactQuery } from '../types'\n\n/**\n * Built-in generator for `useMutation` hooks. Emits one `useFooMutation` hook\n * per POST/PUT/DELETE operation (configurable via `mutation.methods`) plus\n * the matching `fooMutationKey` / `fooMutationOptions` helpers.\n */\nexport const mutationGenerator = defineGenerator<PluginReactQuery>({\n name: 'react-query-mutation',\n renderer: jsxRenderer,\n match(node, ctx) {\n const operationNode = node as ast.OperationNode\n if (!ast.isHttpOperationNode(operationNode)) return false\n const { query, mutation } = ctx.options\n return classifyOperation(operationNode, { query, mutation }).isMutation\n },\n operation(node, ctx) {\n if (!ast.isHttpOperationNode(node)) return null\n const { driver, resolver, root } = ctx\n const { output, mutation, client, group, customOptions, hooks } = ctx.options\n\n const importPath = mutation ? mutation.importPath : '@tanstack/react-query'\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, memo: ctx.memo })\n if (!contractOp) return null\n\n const mutationHookName = resolver.mutation.name(node)\n const mutationOptionsName = resolver.mutation.optionsName(node)\n const mutationKeyName = resolver.mutation.keyName(node)\n\n const hook = resolveHookFile(node, ctx, { name: mutationHookName, output, group, contractOp, returnType: ctx.options.returnType })\n const { tsResolver } = hook\n\n return (\n <HookFile hook={hook} imports={customOptions && <File.Import name={[customOptions.name]} path={customOptions.importPath} />}>\n <MutationKey name={mutationKeyName} node={node} transformer={ctx.options.mutationKey} />\n\n <File.Import name={['mutationOptions']} path={importPath} />\n\n <MutationOptions\n name={mutationOptionsName}\n clientName={contractOp.name}\n mutationKeyName={mutationKeyName}\n node={node}\n tsResolver={tsResolver}\n clientReturnType={contractOp.returnType}\n returnType={hook.returnType}\n />\n\n {mutation && hooks && (\n <>\n <File.Import name={['useMutation']} path={importPath} />\n <File.Import name={['UseMutationOptions', 'UseMutationResult', 'QueryClient']} path={importPath} isTypeOnly />\n <Mutation\n name={mutationHookName}\n mutationOptionsName={mutationOptionsName}\n mutationKeyName={mutationKeyName}\n node={node}\n tsResolver={tsResolver}\n customOptions={customOptions}\n returnType={hook.returnType}\n />\n </>\n )}\n </HookFile>\n )\n },\n})\n","import { createQueryGenerator } from './createQueryGenerator.tsx'\n\n/**\n * Built-in generator for `useQuery` hooks. Emits one `useFooQuery` hook per\n * GET and QUERY operation (configurable via `query.methods`) plus the matching\n * `fooQueryKey` / `fooQueryOptions` helpers.\n */\nexport const queryGenerator = createQueryGenerator({ name: 'react-query', variant: 'query' })\n","import { createQueryGenerator } from './createQueryGenerator.tsx'\n\n/**\n * Built-in generator for `useSuspenseInfiniteQuery` hooks. Enabled when\n * `suspense`, `infinite`, and `hooks` are all configured. Combines suspense\n * semantics with cursor-based pagination. Handlers throw promises while\n * loading and pull additional pages on demand.\n */\nexport const suspenseInfiniteQueryGenerator = createQueryGenerator({ name: 'react-suspense-infinite-query', variant: 'suspenseInfiniteQuery' })\n","import { createQueryGenerator } from './createQueryGenerator.tsx'\n\n/**\n * Built-in generator for `useSuspenseQuery` hooks. Enabled when\n * `pluginReactQuery({ suspense: {}, hooks: true })`. Emits one\n * `useFooSuspenseQuery` hook per query operation. Suspense queries throw\n * promises while loading and require a `<Suspense>` boundary in the React\n * tree. TanStack Query v5+ only.\n */\nexport const suspenseQueryGenerator = createQueryGenerator({ name: 'react-suspense-query', variant: 'suspenseQuery' })\n","import { operationKey, resolveOperationName } from '@internals/shared'\nimport { createMutationResolver, createQueryResolver } from '@internals/tanstack-query'\nimport { createResolver } from '@kubb/kit'\nimport type { PluginReactQuery } from '../types.ts'\n\n/**\n * Default resolver used by `@kubb/plugin-react-query`. Decides the names and\n * file paths for every generated TanStack Query hook (`useFoo`,\n * `useFooSuspense`, `useFooInfinite`, ...) and its companion helpers\n * (`fooQueryKey`, `fooQueryOptions`).\n *\n * Functions use safe camelCase identifiers; hooks get the `use`\n * prefix; suspense and infinite variants are suffixed with `Suspense`/`Infinite`.\n *\n * @example Resolve hook and helper names\n * ```ts\n * import { resolverReactQuery } from '@kubb/plugin-react-query'\n *\n * resolverReactQuery.query.name(operationNode) // 'useGetPetById'\n * resolverReactQuery.mutation.name(operationNode) // 'useUpdatePet'\n * resolverReactQuery.query.keyName(operationNode) // 'getPetByIdQueryKey'\n * resolverReactQuery.query.optionsName(operationNode) // 'getPetByIdQueryOptions'\n * ```\n */\nexport const resolverReactQuery = createResolver<PluginReactQuery>({\n pluginName: 'plugin-react-query',\n name: resolveOperationName,\n query: createQueryResolver(),\n suspenseQuery: createQueryResolver('Suspense'),\n infiniteQuery: createQueryResolver('Infinite'),\n suspenseInfiniteQuery: createQueryResolver('SuspenseInfinite'),\n mutation: {\n ...createMutationResolver(),\n optionsName(node) {\n const name = `${this.name(node.operationId)}MutationOptions`\n return this.resolveName({ key: operationKey(node, 'mutation', 'optionsName'), name })\n },\n },\n hook: {\n optionsName() {\n return this.resolveName({ key: ['hook', 'options'], name: 'HookOptions' })\n },\n customOptionsName() {\n return this.resolveName({ key: ['hook', 'custom-options'], name: 'getCustomHookOptions' })\n },\n },\n})\n","import { createGroupConfig } from '@internals/shared'\nimport { addGenerator, defineExtension, Resolver, setMacros, setResolver, useConfig } from '@kubb/kit'\nimport { compatibility } from '../kubb-extension.json'\nimport { version } from '../package.json'\nimport { resolveContractClient } from '@internals/client'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { mutationKeyTransformer, queryKeyTransformer, resolveInfiniteConfig, resolveMutationConfig, resolveQueryConfig } from '@internals/tanstack-query'\nimport {\n customHookOptionsFileGenerator,\n hookOptionsGenerator,\n infiniteQueryGenerator,\n mutationGenerator,\n queryGenerator,\n suspenseInfiniteQueryGenerator,\n suspenseQueryGenerator,\n} from './generators'\nimport { resolverReactQuery } from './resolvers/resolverReactQuery.ts'\nimport type { PluginReactQuery, ResolverReactQuery } from './types.ts'\n\n/**\n * Canonical plugin name for `@kubb/plugin-react-query`. Used for driver lookups\n * and cross-plugin dependency references.\n */\nexport const pluginReactQueryName = 'plugin-react-query' satisfies PluginReactQuery['name']\n\n/**\n * Generates one TanStack Query hook per OpenAPI operation for React. Queries\n * become `useFoo`, with `useFooSuspense` and `useFooInfinite` variants.\n * Mutations become `useFoo`. Each hook is fully typed: query keys, input\n * variables, response data, and error shape all come from the spec.\n *\n * @example\n * ```ts\n * import { defineConfig } from 'kubb/config'\n * import { pluginTs } from '@kubb/plugin-ts'\n * import { pluginReactQuery } from '@kubb/plugin-react-query'\n *\n * export default defineConfig({\n * input: './petStore.yaml',\n * output: { path: './src/gen' },\n * plugins: [\n * pluginTs(),\n * pluginReactQuery({\n * output: { path: './hooks' },\n * suspense: {},\n * }),\n * ],\n * })\n * ```\n */\nexport const pluginReactQuery = defineExtension<PluginReactQuery>({\n kind: 'plugin',\n meta: { name: pluginReactQueryName, version, compatibility },\n dependencies: { [pluginTsName]: { optional: true } },\n setup(options) {\n const {\n output = { path: 'hooks', barrel: { type: 'named' } },\n group,\n exclude = [],\n include,\n override = [],\n suspense = false,\n infinite = false,\n mutation = {},\n query = {},\n mutationKey = mutationKeyTransformer,\n queryKey = queryKeyTransformer,\n customOptions,\n hooks = false,\n client,\n returnType = 'data',\n resolver: userResolver,\n macros: userMacros,\n } = options\n\n const resolver = userResolver ? Resolver.merge<ResolverReactQuery>(resolverReactQuery, userResolver) : resolverReactQuery\n\n setResolver(resolver)\n if (userMacros?.length) {\n setMacros(userMacros)\n }\n\n addGenerator(\n queryGenerator,\n suspenseQueryGenerator,\n infiniteQueryGenerator,\n suspenseInfiniteQueryGenerator,\n mutationGenerator,\n hookOptionsGenerator,\n customHookOptionsFileGenerator,\n )\n\n return {\n output,\n client: resolveContractClient({ plugin: pluginReactQueryName, client, plugins: useConfig().plugins }),\n returnType,\n queryKey,\n query: resolveQueryConfig(query, { importPath: '@tanstack/react-query' }),\n mutationKey,\n mutation: resolveMutationConfig(mutation, { importPath: '@tanstack/react-query' }),\n infinite: resolveInfiniteConfig(infinite),\n suspense,\n customOptions: customOptions ? { name: 'useCustomHookOptions', ...customOptions } : null,\n hooks,\n group: createGroupCon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ACA;GACA;GACA;EACF;CACF;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["declarationPrinter","callPrinter","declarationPrinter","declarationPrinter","declarationPrinter","declarationPrinter","callPrinter","declarationPrinter","callPrinter","getComments"],"sources":["../kubb-extension.json","../package.json","../../../internals/client/src/resolveClient.ts","../../../internals/utils/src/reserved.ts","../../../internals/utils/src/strings.ts","../../../internals/shared/src/operation.ts","../../../internals/shared/src/resolver.ts","../../../internals/client/src/resolveClientOperation.ts","../../../internals/client/src/resolveOperationTypes.ts","../../../internals/tanstack-query/src/components/HookFile.tsx","../../../internals/tanstack-query/src/utils.ts","../../../internals/tanstack-query/src/components/InfiniteQueryOptions.tsx","../../../internals/tanstack-query/src/components/MutationKey.tsx","../../../internals/tanstack-query/src/resolver.ts","../../../internals/tanstack-query/src/components/QueryKey.tsx","../src/generators/customHookOptionsFileGenerator.tsx","../src/generators/hookOptionsGenerator.tsx","../src/components/Query.tsx","../src/components/QueryOptions.tsx","../src/generators/createQueryGenerator.tsx","../src/generators/infiniteQueryGenerator.tsx","../src/components/MutationOptions.tsx","../src/components/Mutation.tsx","../src/generators/mutationGenerator.tsx","../src/generators/queryGenerator.tsx","../src/generators/suspenseInfiniteQueryGenerator.tsx","../src/generators/suspenseQueryGenerator.tsx","../src/resolvers/resolverReactQuery.ts","../src/plugin.ts"],"sourcesContent":["","","/**\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, plugin-axios, or plugin-client) and never emits its own\n * 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, the\n * requested one is missing, or `client` is not a known selector.\n *\n * The `client` string selects explicitly (`'fetch'` / `'axios'` / `'client'`); when it is unset a\n * lone registered contract client plugin is picked up automatically.\n */\n\nimport { Diagnostics } from '@kubb/kit'\n\n// Canonical plugin names. They mirror the `pluginFetchName` / `pluginAxiosName` / `pluginClientName`\n// consts the plugins export, kept as literals so this internal needs no plugin install deps.\nconst pluginFetchName = 'plugin-fetch'\nconst pluginAxiosName = 'plugin-axios'\nconst pluginClientName = 'plugin-client'\n\n/**\n * The client selector accepted by a consumer's `client` option. Each calls a registered contract\n * client plugin.\n */\nexport type ClientSelector = 'fetch' | 'axios' | 'client'\n\n/**\n * The resolved client strategy stored in a consumer plugin's options: the generated code always\n * imports and calls a registered contract client plugin's `<op>`. The client runtime lives in\n * plugin-axios / plugin-fetch, so nothing is bundled by the consumer.\n */\nexport type ResolvedContractClient = { kind: 'contract'; pluginName: string }\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: its code, what is wrong, and how to fix it.\n */\nexport type ResolveClientResult =\n | ResolvedContractClient\n | { kind: 'error'; code: typeof Diagnostics.code.missingDependency | typeof Diagnostics.code.invalidPluginOptions; message: string; help: string }\n\nconst selectorToPlugin: Record<ClientSelector, string> = {\n fetch: pluginFetchName,\n axios: pluginAxiosName,\n client: pluginClientName,\n}\n\n// Every contract client plugin, in auto-detect priority order.\nconst contractPlugins = [pluginFetchName, pluginAxiosName, pluginClientName] 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', code: 'KUBB_MISSING_DEPENDENCY', message: 'No client plugin is registered.', help: 'Add …' }\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' || client === 'client') {\n const pluginName = selectorToPlugin[client]\n if (!has(pluginName)) {\n return {\n kind: 'error',\n code: Diagnostics.code.missingDependency,\n message: `\\`client: '${client}'\\` is set but \\`@kubb/plugin-${client}\\` is not registered in \\`plugins\\`.`,\n help: `Add \\`@kubb/plugin-${client}\\` to \\`plugins\\`, or drop \\`client\\` to use a different client plugin.`,\n }\n }\n return { kind: 'contract', pluginName }\n }\n\n // A JS config bypasses the `ClientSelector` type, so reject unknown selectors instead of auto-detecting.\n if (client !== undefined) {\n return {\n kind: 'error',\n code: Diagnostics.code.invalidPluginOptions,\n message: `Option \\`client\\` is ${typeof client === 'string' ? `'${client}'` : String(client)}, but it must be one of 'fetch', 'axios', 'client'.`,\n help: 'Set `client` to one of those values, or drop it to use the registered client plugin.',\n }\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 code: Diagnostics.code.invalidPluginOptions,\n message: `Multiple client plugins are registered (${registered.map((name) => `\\`@kubb/${name}\\``).join(', ')}) and \\`client\\` is not set.`,\n help: \"Set `client: 'fetch' | 'axios' | 'client'` to choose which client the hooks call, or register a single client plugin.\",\n }\n }\n\n return {\n kind: 'error',\n code: Diagnostics.code.missingDependency,\n message: 'No client plugin is registered.',\n help: 'Add `@kubb/plugin-fetch`, `@kubb/plugin-axios`, or `@kubb/plugin-client` to `plugins` so the generated code has an HTTP client to call.',\n }\n}\n\n/**\n * Resolves the contract client during a consumer plugin's setup hook.\n * It extracts the plugin names from the raw `plugins` config and applies {@link resolveClient}.\n * On a misconfiguration it throws a config diagnostic tagged with `plugin`, so every consumer\n * fails fast with the same message.\n */\nexport function resolveContractClient(options: {\n plugin: string\n client: ClientSelector | undefined\n plugins?: ReadonlyArray<unknown>\n}): ResolvedContractClient {\n const { plugin, client, plugins = [] } = options\n const pluginNames = plugins.map((plugin) => (plugin as { name?: string }).name).filter((name): name is string => Boolean(name))\n const resolved = resolveClient({ client, pluginNames })\n if (resolved.kind === 'error') {\n const { code, message, help } = resolved\n throw new Diagnostics.Error({ code, severity: 'error', message, help, location: { kind: 'config' }, plugin })\n }\n return resolved\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 'await',\n 'boolean',\n 'break',\n 'byte',\n 'case',\n 'catch',\n 'char',\n 'class',\n 'const',\n 'continue',\n 'debugger',\n 'default',\n 'delete',\n 'do',\n 'double',\n 'else',\n 'enum',\n 'eval',\n 'export',\n 'extends',\n 'false',\n 'final',\n 'finally',\n 'float',\n 'for',\n 'function',\n 'goto',\n 'if',\n 'implements',\n 'import',\n 'in',\n 'instanceof',\n 'int',\n 'interface',\n 'let',\n 'long',\n 'native',\n 'new',\n 'null',\n 'package',\n 'private',\n 'protected',\n 'public',\n 'return',\n 'short',\n 'static',\n 'super',\n 'switch',\n 'synchronized',\n 'this',\n 'throw',\n 'throws',\n 'transient',\n 'true',\n 'try',\n 'typeof',\n 'var',\n 'void',\n 'volatile',\n 'while',\n 'with',\n 'yield',\n 'Array',\n 'Date',\n 'hasOwnProperty',\n 'Infinity',\n 'isFinite',\n 'isNaN',\n 'isPrototypeOf',\n 'length',\n 'Math',\n 'name',\n 'NaN',\n 'Number',\n 'Object',\n 'prototype',\n 'String',\n 'toString',\n 'undefined',\n 'valueOf',\n] as const)\n\n/**\n * Returns `true` when `name` is a syntactically valid JavaScript variable name.\n *\n * @example\n * ```ts\n * isValidVarName('status') // true\n * isValidVarName('class') // false (reserved word)\n * isValidVarName('42foo') // false (starts with digit)\n * ```\n */\nexport function isValidVarName(name: string): boolean {\n if (!name || reservedWords.has(name as 'valueOf')) {\n return false\n }\n return isIdentifier(name)\n}\n\n/**\n * Returns `name` when it's a syntactically valid JavaScript variable name,\n * otherwise prefixes it with `_` so the result is a valid identifier.\n *\n * Useful for sanitizing OpenAPI schema names or operation IDs that start with\n * a digit (e.g. `409`, `504AccountCancel`) before using them as exported\n * variable, type, or function names.\n *\n * @example\n * ```ts\n * ensureValidVarName('409') // '_409'\n * ensureValidVarName('504AccountCancel') // '_504AccountCancel'\n * ensureValidVarName('Pet') // 'Pet'\n * ensureValidVarName('class') // '_class'\n * ```\n */\nexport function ensureValidVarName(name: string): string {\n if (!name || isValidVarName(name)) {\n return name\n }\n return `_${name}`\n}\n\n/**\n * Returns `true` when `name` is syntactically a valid identifier, ignoring reserved words.\n *\n * Reserved words and globals (`class`, `name`, `Date`, …) are valid as bare object-literal keys\n * even though they are not valid variable names, so use this (not {@link isValidVarName}) when\n * deciding whether an object key needs quoting.\n *\n * @example\n * ```ts\n * isIdentifier('name') // true\n * isIdentifier('x-total')// false\n * ```\n */\nexport function isIdentifier(name: string): boolean {\n return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name)\n}\n","import { text } from '@kubb/kit'\n\n// `\\p{`, `\\P{` or `\\u{` behind an odd number of backslashes, or a character outside the BMP: both need the `u` flag.\nconst NEEDS_UNICODE = /(?<!\\\\)(?:\\\\\\\\)*\\\\[pPu]\\{|[\\u{10000}-\\u{10FFFF}]/u\n// Escapes the `u` flag accepts. `\\-` only counts inside a class.\nconst KEPT_ESCAPE = /[A-Za-z0-9^$\\\\.*+?()[\\]{}|/]/\n\n/**\n * Drops the backslash from escapes that the `u` flag rejects: an escaped punctuation character that is\n * not a syntax character, and `\\-` outside a class. Both match the same character without the backslash.\n */\nfunction dropIdentityEscapes(pattern: string): string {\n let inClass = false\n\n return pattern.replace(/\\\\(.)|[[\\]]/gs, (match, escaped?: string) => {\n if (escaped === undefined) {\n inClass = match === '['\n return match\n }\n\n return KEPT_ESCAPE.test(escaped) || (escaped === '-' && inClass) ? match : escaped\n })\n}\n\n/**\n * Builds the `RegExp` for a pattern, adding the `u` flag when it uses `\\p{...}`, `\\P{...}` or `\\u{...}`, or\n * holds a character outside the BMP. A pattern that is not valid under `u` keeps the flags it came with.\n */\nfunction toRegExp(pattern: string, flags: string | undefined): RegExp {\n if (flags?.includes('u') || !NEEDS_UNICODE.test(pattern)) return new RegExp(pattern, flags)\n\n try {\n return new RegExp(dropIdentityEscapes(pattern), `${flags ?? ''}u`)\n } catch {\n return new RegExp(pattern, flags)\n }\n}\n\n/**\n * Converts a pattern string into a `new RegExp(...)` constructor call or a regex literal string.\n * Inline flags expressed as a `^(?im)` prefix are extracted and applied to the resulting expression.\n * Pass `null` as the second argument to emit a `/pattern/flags` literal instead.\n *\n * @example\n * ```ts\n * toRegExpString('^(?im)foo') // 'new RegExp(\"^foo\", \"im\")'\n * toRegExpString('^(?im)foo', null) // '/^foo/im'\n * ```\n */\nexport function toRegExpString(pattern: string, func: string | null = 'RegExp'): string {\n const raw = text.unquote(pattern)\n\n const match = raw.match(/^\\^(\\(\\?([igmsuy]+)\\))/i)\n const replacementTarget = match?.[1] ?? ''\n const matchedFlags = match?.[2]\n const cleaned = raw\n .replace(/^\\\\?\\//, '')\n .replace(/\\\\?\\/$/, '')\n .replace(replacementTarget, '')\n\n const { source, flags } = toRegExp(cleaned, matchedFlags)\n\n if (func === null) return `/${source}/${flags}`\n\n return `new ${func}(${JSON.stringify(source)}${flags ? `, ${JSON.stringify(flags)}` : ''})`\n}\n\n/**\n * Renders a dotted path or string array as an optional-chaining accessor expression rooted at\n * `accessor`. Returns `null` for an empty path.\n *\n * @example\n * ```ts\n * getNestedAccessor('pagination.next.id', 'lastPage')\n * // \"lastPage?.['pagination']?.['next']?.['id']\"\n * ```\n */\nexport function getNestedAccessor(param: string | Array<string>, accessor: string): string | null {\n const parts = Array.isArray(param) ? param : param.split('.')\n if (parts.length === 0 || (parts.length === 1 && parts[0] === '')) return null\n return `${accessor}?.['${`${parts.join(\"']?.['\")}']`}`\n}\n\n/**\n * Escapes an `@` at the start of a line, so a multi-line description can't start a new JSDoc tag.\n * Editors render `\\@` as `@` in hovers.\n *\n * @example\n * ```ts\n * jsDocEscape('intro\\n@example value') // 'intro\\n\\\\@example value'\n * ```\n */\nexport function jsDocEscape(input: unknown): string {\n return `${input}`.replace(/^(\\s*)@/gm, '$1\\\\@')\n}\n","import { jsDocEscape } from '@internals/utils'\nimport { ast, type Group, type Memo, type Output, type Resolver, type ResolverFileParams } from '@kubb/kit'\n\n/**\n * Builds the `ResolverFileParams` every operation generator passes to\n * `resolver.file`: a file named `name`, tagged by the operation's first\n * tag (or `'default'`), at the operation's path. Centralizes the entry object\n * that was repeated at dozens of call sites across the client and query plugins.\n *\n * @example\n * ```ts\n * resolver.file(operationFileEntry(node, node.operationId), { root, output, group })\n * ```\n */\nexport function operationFileEntry(node: ast.OperationNode, name: string, extname: ResolverFileParams['extname'] = '.ts'): ResolverFileParams {\n return {\n name,\n extname,\n tag: node.tags[0] ?? 'default',\n path: node.path,\n }\n}\n\n/**\n * Resolves the file a schema-emitting plugin (`plugin-ts`, `plugin-zod`, `plugin-faker`) writes\n * `node` to, cached in `ctx.memo` under the resolver's plugin name and the\n * operation. The plugin itself and every plugin that imports from it call this, so they all get\n * the same path.\n *\n * When that path matches the file of a component schema in `ctx.driver.inputNode`, ignoring case, the file name\n * gets an `Operation` suffix: operation `point` goes to `PointOperation.ts` next to schema `Point.ts`.\n * Otherwise the two merge into one file, or overwrite each other on a case-insensitive file system.\n * Only the file name changes. The declarations keep their names.\n *\n * @example Resolve `plugin-ts`'s file for the current operation\n * ```ts\n * const fileTs = resolveOperationFile({ ctx, node, resolver: tsResolver, root, output })\n * ```\n */\nexport function resolveOperationFile(options: {\n ctx: { memo: Memo; driver: { inputNode?: { schemas: ReadonlyArray<ast.SchemaNode> } | null } }\n node: ast.OperationNode\n resolver: Pick<Resolver, 'file' | 'pluginName'>\n root: string\n output: Output\n group?: Group | null\n}): ast.FileNode {\n const { ctx, node, resolver, root, output } = options\n const { memo } = ctx\n const location = { root, output, group: options.group ?? undefined }\n\n return memo(`${resolver.pluginName}:operationFile:${node.operationId}`, () => {\n const schemaPaths = memo(\n `${resolver.pluginName}:schemaFilePaths`,\n () =>\n new Set(\n (ctx.driver.inputNode?.schemas ?? []).flatMap((schema) =>\n schema.name ? [resolver.file({ name: schema.name, extname: '.ts', ...location }).path.toLowerCase()] : [],\n ),\n ),\n )\n let file = resolver.file({ ...operationFileEntry(node, node.operationId), ...location })\n\n for (let name = `${node.operationId}Operation`; schemaPaths.has(file.path.toLowerCase()); name += 'Operation') {\n const next = resolver.file({ ...operationFileEntry(node, name), ...location })\n // A single-file output holds every declaration on purpose, so a new name changes nothing.\n if (next.path === file.path) break\n file = next\n }\n\n return file\n })\n}\n\nexport type ContentTypeInfo = {\n contentTypes: string[]\n isMultipleContentTypes: boolean\n contentTypeUnion: string\n defaultContentType: string\n hasFormData: boolean\n}\n\nexport type RequestConfigResolver = {\n response: {\n body(node: ast.OperationNode): string\n }\n}\n\nexport type ResponseStatusNameResolver = {\n response: {\n status(node: ast.OperationNode, statusCode: ast.StatusCode): string\n }\n}\n\nexport type ResponseNameResolver = ResponseStatusNameResolver & {\n response: {\n response(node: ast.OperationNode): string\n }\n}\n\nexport type OperationTypeNameResolver = RequestConfigResolver &\n ResponseNameResolver & {\n param: {\n path(node: ast.OperationNode, param: ast.ParameterNode): string\n query(node: ast.OperationNode, param: ast.ParameterNode): string\n headers(node: ast.OperationNode, param: ast.ParameterNode): string\n cookies(node: ast.OperationNode, param: ast.ParameterNode): string\n }\n }\n\nexport type BuildOperationCommentsOptions = {\n splitLines?: boolean\n}\n\nexport type ResolveOperationTypeNameOptions = {\n responseStatusNames?: boolean | 'error'\n exclude?: ReadonlyArray<string | undefined>\n order?: 'params-first' | 'body-response-first'\n /**\n * Include the individual `Path`/`Query`/`Headers` group type names. Set to `false` for clients\n * that reference the grouped `Options` type instead of the per-group types.\n */\n includeParams?: boolean\n}\n\n/**\n * The operation's method and path as plain text, such as `` `GET /pet/{petId}` ``. A path is not a valid `{@link}` target.\n */\nfunction getOperationRequestLine(node: ast.OperationNode): string | null {\n return ast.http.isOperation(node) && node.path ? `\\`${node.method.toUpperCase()} ${node.path}\\`` : null\n}\n\n/**\n * Derives the shared `ContentTypeInfo` shape from a list of content types, tracking whether several\n * are present and the union, default, and form-data flags the client uses to pick one.\n */\nfunction buildContentTypeInfo(contentTypes: string[]): ContentTypeInfo {\n const isMultipleContentTypes = contentTypes.length > 1\n\n return {\n contentTypes,\n isMultipleContentTypes,\n contentTypeUnion: isMultipleContentTypes ? contentTypes.map((ct) => JSON.stringify(ct)).join(' | ') : '',\n defaultContentType: contentTypes[0] ?? 'application/json',\n hasFormData: contentTypes.some((ct) => ct === 'multipart/form-data'),\n }\n}\n\nexport function getContentTypeInfo(node: ast.OperationNode): ContentTypeInfo {\n return buildContentTypeInfo(node.requestBody?.content?.map((e) => e.contentType) ?? [])\n}\n\n/**\n * The request-body counterpart for the primary success response: the content types it documents and\n * whether several are present, so the client can let a caller pick which one to accept.\n */\nexport function getResponseContentTypeInfo(node: ast.OperationNode): ContentTypeInfo {\n return buildContentTypeInfo(ast.http.responses.findPrimary(node)?.content?.map((e) => e.contentType) ?? [])\n}\n\ntype ResponseType = 'blob' | 'text' | 'stream'\n\ntype ResponseContentEntry = { contentType: string; schema?: ast.SchemaNode | null; stream?: ast.ContentNode['stream'] }\n\n/**\n * How an operation streams its primary success response item by item, when that response declares one content type:\n * - `'event'` for `text/event-stream` whose `itemSchema` types the whole event with its own `event` and `data`\n * - `'data'` for `text/event-stream` typed by its payload only\n * - `'line'` for JSON Lines, one parsed JSON value per line\n *\n * Returns `null` for any other response, and for a response that also declares another content type, which stays a normal\n * call with its query hooks.\n */\nexport function getEventStream(node: ast.OperationNode): 'event' | 'data' | 'line' | null {\n const content = ast.http.responses.findPrimary(node)?.content ?? []\n if (content.length !== 1) return null\n const entry = content[0]!\n const framing = getStreamFraming(entry)\n if (framing === 'events') return entry.stream?.shape ?? 'data'\n return framing === 'lines' ? 'line' : null\n}\n\n/**\n * How a content entry is framed as a stream: `'events'` for Server-Sent Events, `'lines'` for JSON Lines.\n */\nexport function getStreamFraming(entry: Pick<ast.ContentNode, 'contentType' | 'stream'>): 'events' | 'lines' | undefined {\n if (ast.mediaType.getBase(entry) === 'text/event-stream') return 'events'\n // `multipart/mixed` with an `itemSchema` also has `stream`, but it is a stream of parts, not of JSON values.\n return entry.stream && ast.mediaType.isStream(entry) ? 'lines' : undefined\n}\n\n/**\n * Whether an operation streams its primary success response, as Server-Sent Events or JSON Lines. The client generator uses\n * this to return a typed stream of items instead of a one-shot `RequestResult`.\n */\nexport function isEventStream(node: ast.OperationNode): boolean {\n return getEventStream(node) !== null\n}\n\n// A stream without a schema is a `blob` with a string primitive, so it keeps the JSON-parse default.\nfunction isTextSchema(schema: ast.SchemaNode | null | undefined): boolean {\n if (!schema) return false\n const resolved = ast.ref.getSchema(schema)\n return resolved.type !== 'blob' && resolved.primitive === 'string'\n}\n\n/**\n * Whether an operation streams Server-Sent Events whose `data` the document types as a string, so the client keeps each\n * `data` as text instead of JSON-parsing it. With an event-shaped `itemSchema` where only some events type `data` as a\n * string, it returns the names of those events, or `false` when one of them has no fixed name.\n */\nexport function hasTextEventData(node: ast.OperationNode): boolean | Array<string> {\n const shape = getEventStream(node)\n const entry = ast.http.responses.findPrimary(node)?.content?.[0]\n if (!entry || (shape !== 'data' && shape !== 'event')) return false\n if (shape === 'data') return isTextSchema(entry.stream?.schema ?? entry.schema)\n\n const item = entry.stream?.schema ? ast.ref.getSchema(entry.stream.schema) : undefined\n if (!item) return false\n const events = item.type === 'union' ? (ast.schema.narrow(item, 'union')?.members ?? []) : [item]\n // A discriminator makes each event an intersection of its `$ref` and the pinned `event`, so every part is read.\n const propertySchemas = (event: ast.SchemaNode, propertyName: string) => ast.schema.findProperties({ node: event, propertyName }).map(({ schema }) => schema)\n const textEvents = events.filter((event) => {\n const dataSchemas = propertySchemas(event, 'data')\n return dataSchemas.length > 0 && dataSchemas.every(isTextSchema)\n })\n if (textEvents.length === events.length) return events.length > 0\n\n const eventNames = textEvents.map((event) => propertySchemas(event, 'event').flatMap((schema) => ast.schema.getLiterals(ast.ref.getSchema(schema))))\n return eventNames.length > 0 && eventNames.every((values) => values.length > 0) && [...new Set(eventNames.flat().map(String))]\n}\n\n/**\n * Whether the primary success response offers `text/event-stream`, alone or next to other content types. The client asks\n * for the stream by default and ships the `sse.ts` runtime, so a mixed response can be read as events too.\n */\nexport function hasEventStreamContent(node: ast.OperationNode): boolean {\n const entries = ast.http.responses.findPrimary(node)?.content ?? []\n // Next to another type, a stream without a schema gets no typed variant, so it keeps the plain call.\n return entries.some((entry) => getStreamFraming(entry) === 'events' && (entries.length === 1 || Boolean(entry.schema)))\n}\n\n/**\n * Whether a success response offers a stream media type next to other content types. The client returns that variant's\n * body as a `ReadableStream`, so the stream runtime is registered and a hook's data type includes the stream.\n */\nexport function hasStreamVariant(node: ast.OperationNode): boolean {\n return ast.http.responses.filterSuccess(node).some((response) => {\n const variants = (response.content ?? []).filter((entry) => entry.schema)\n return variants.length > 1 && variants.some((entry) => ast.mediaType.isStream(entry))\n })\n}\n\nconst formContentTypes = ['multipart/form-data', 'application/x-www-form-urlencoded'] as const\n\n/**\n * The form media types the operation's request body offers, `multipart/form-data` and `application/x-www-form-urlencoded`,\n * which the client needs a handler for.\n */\nexport function getFormContentTypes(node: ast.OperationNode): Array<(typeof formContentTypes)[number]> {\n const request = new Set((node.requestBody?.content ?? []).map((entry) => ast.mediaType.getBase(entry)))\n return formContentTypes.filter((contentType) => request.has(contentType))\n}\n\n/**\n * Parser for one response content entry.\n *\n * JSON stays unset so the runtime detects it. `text/event-stream` and JSON Lines are streams. A binary schema\n * (`format: binary` / `contentMediaType`) is a blob even when the media type is not a well-known\n * binary type. Other `text/*` is text, and `application/octet-stream`, `application/pdf`,\n * `image/*`, `audio/*`, and `video/*` are blobs.\n */\nfunction responseTypeForContent(entry: ResponseContentEntry): ResponseType | undefined {\n const baseType = ast.mediaType.getBase(entry)\n if (!baseType) return undefined\n if (getStreamFraming(entry)) return 'stream'\n if (ast.mediaType.isJson(baseType)) return undefined\n if (entry.schema?.type === 'blob') return 'blob'\n if (baseType.startsWith('text/')) return 'text'\n if (isBinaryContentType(baseType)) return 'blob'\n return undefined\n}\n\nfunction isBinaryContentType(baseType: string): boolean {\n return baseType === 'application/octet-stream' || baseType === 'application/pdf' || /^(image|audio|video)\\//.test(baseType)\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 // Keeps the original case, unlike ast.mediaType.getBase, so generated names stay stable.\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 * Returns the entry with the schema of the value the client returns: `string` for a body read as text, such as `Pet` on\n * `application/xml`, and `blob` for `image/*`, `audio/*`, `video/*`, PDF, and octet-stream. A binary schema elsewhere is a `Blob`\n * only through `parseAs: 'blob'`, which needs every entry in `entries` binary. JSON, vendor (`application/vnd.*`), stream,\n * schemaless, and wildcard entries keep their schema. `entries` is the response's full list of content types.\n */\nexport function toResponseContent<T extends ContentVariantInput & ResponseContentEntry>(entry: T, entries: ReadonlyArray<ResponseContentEntry> = [entry]): T {\n const { contentType, schema } = entry\n if (!schema || entry.stream) return entry\n\n const baseType = ast.mediaType.getBase(contentType)\n const resolved = ast.ref.getSchema(schema)\n if (isBinaryContentType(baseType)) {\n return resolved.type === 'blob' ? entry : { ...entry, schema: ast.factory.createSchema({ type: 'blob' }), keysToOmit: null }\n }\n const isPlainMediaType = Boolean(baseType) && !ast.mediaType.isJson(baseType) && !baseType.includes('*')\n if (resolved.type === 'blob') {\n // shortcut: an error response never gets `parseAs`, so a lone binary schema there reads as text too but stays `Blob`.\n const readsAsText = isPlainMediaType && !entries.every((item) => item.schema?.type === 'blob')\n return readsAsText ? { ...entry, schema: ast.factory.createSchema({ type: 'string' }), keysToOmit: null } : entry\n }\n if (resolved.primitive === 'string') return entry\n\n const responseType = responseTypeForContent(entry)\n // A response without a body, such as a 405, has no schema to read. Only `text/*` is always text.\n if (responseType !== 'text' && (resolved.type === 'unknown' || resolved.type === 'any' || resolved.type === 'void')) return entry\n const isVendorJson = /^[^/]+\\/vnd\\./.test(baseType) && !/(xml|yaml|yml|csv)$/.test(baseType)\n const isText = responseType === 'text' || (!responseType && isPlainMediaType && !isVendorJson)\n\n return isText ? { ...entry, schema: ast.factory.createSchema({ type: 'string' }), keysToOmit: null } : entry\n}\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\n/**\n * Builds the `client?:` option type shared by the generated query hooks (`useQuery`,\n * `useInfiniteQuery`, `useSWR`, ...): `RequestConfig` minus what the\n * hook fills in, which is every request group and `throwOnError`. Unlike {@link buildRequestConfigType},\n * it never narrows `contentType`: query hooks wrap GET operations, which carry no request body to select\n * a content type for.\n */\nexport function buildClientOptionType(options: { omit?: Array<string> } = {}): string {\n const keys = [...requestGroupOrder, 'url', ...(options.omit ?? []), 'throwOnError']\n return `Partial<Omit<RequestConfig, ${keys.map((key) => `'${key}'`).join(' | ')}>>`\n}\n\n/**\n * The `client?:` option type of a mutation hook. When the operation has a request content type choice,\n * the mutation variables carry `contentType`, so the config leaves it out. Otherwise the ambiguous side is\n * narrowed to the operation's media types; a single-type side has nothing to pick, so it stays baked in the\n * generated call.\n */\nexport function buildRequestConfigType(node: ast.OperationNode): string {\n if (hasRequestContentTypeChoice(node)) {\n return buildClientOptionType({ omit: ['contentType'] })\n }\n\n const request = getContentTypeInfo(node)\n const response = getResponseContentTypeInfo(node)\n const members = [\n request.isMultipleContentTypes ? `request?: ${request.contentTypeUnion}` : null,\n response.isMultipleContentTypes ? `response?: ${response.contentTypeUnion}` : null,\n ].filter(Boolean)\n\n const base = buildClientOptionType()\n return members.length ? `${base} & { contentType?: { ${members.join('; ')} } }` : base\n}\n\n/** The grouped request options, in the order generated signatures and calls list them. */\nexport const requestGroupOrder = ['path', 'query', 'body', 'headers', 'cookies'] as const\n\nexport type RequestGroups = {\n path: boolean\n query: boolean\n body: boolean\n headers: boolean\n cookies: 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, cookie } = ast.http.groupParameters(node)\n return {\n path: path.length > 0,\n query: query.length > 0,\n body: Boolean(ast.http.requestBody.getSchema(node)),\n headers: header.length > 0,\n cookies: cookie.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 } = ast.http.groupParameters(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 // `cookies` never makes the parameter required: a browser sends its cookies itself and cannot set a `Cookie` header.\n isOptional: !hasRequiredPath && !hasRequiredQuery && !hasRequiredHeader && !(groups.body && node.requestBody?.required === true),\n }\n}\n\nexport type RequestOptionsNameResolver = RequestConfigResolver & {\n response: {\n options(node: ast.OperationNode): string\n }\n}\n\n/**\n * Builds the grouped `{ path, query, body, headers, cookies }` parameter for a generated client\n * function, typed from the operation's `Options` (minus `url`). Only the groups the\n * operation actually has are destructured. The trailing `config` parameter carries the\n * runtime `RequestConfig` overrides plus `client`.\n */\nexport function buildRequestParamsSignature(\n node: ast.OperationNode,\n resolver: RequestOptionsNameResolver,\n options: { isConfigurable?: boolean } = {},\n): { signature: string; groups: RequestGroups; names: Array<keyof RequestGroups> } {\n const { isConfigurable = true } = options\n const { groups, isOptional } = getRequestGroupOptionality(node)\n\n const names = requestGroupOrder.filter((key) => groups[key])\n\n // These callers never carry the `contentType` that several media types require.\n const optionsType = hasRequestContentTypeChoice(node)\n ? `Pick<${resolver.response.options(node)}, ${names.map((name) => `'${name}'`).join(' | ')}>`\n : resolver.response.options(node)\n const firstParam = names.length > 0 ? `{ ${names.join(', ')} }: ${optionsType}${isOptional ? ' = {}' : ''}` : null\n const configParam = isConfigurable ? `config: ${buildRequestConfigType(node)} = {}` : null\n\n return {\n signature: [firstParam, configParam].filter(Boolean).join(', '),\n groups,\n names,\n }\n}\n\nexport function buildOperationComments(node: ast.OperationNode, options: BuildOperationCommentsOptions = {}): Array<string> {\n const { splitLines = false } = options\n // The request line leads: free text after a block tag would belong to that tag.\n const comments = [\n getOperationRequestLine(node),\n node.description && `@description ${node.description}`,\n node.summary && `@summary ${node.summary}`,\n node.deprecated && '@deprecated',\n node.externalDocs && `@see ${jsDocEscape([node.externalDocs.url, node.externalDocs.description].filter(Boolean).join(' '))}`,\n ]\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\n/**\n * Whether the operation declares more than one request media type with a schema, so a caller must pick one on `contentType`.\n */\nexport function hasRequestContentTypeChoice(node: ast.OperationNode): boolean {\n return (node.requestBody?.content ?? []).filter((entry) => entry.schema).length > 1\n}\n\n/**\n * Casts a call argument to the client's parameter type; a `'plain'` client is non-generic.\n */\nexport function castToClientOptions(callArg: string, clientName: string, returnType: 'full' | 'data' | 'plain' = 'full'): string {\n return `${callArg} as Parameters<typeof ${clientName}${returnType === 'plain' ? '' : '<true>'}>[0]`\n}\n\n/**\n * Builds the combined `{ body, path, query, headers, cookies }` options object schema for an operation,\n * referencing the already-resolved body and grouped param names. `cookies` appears only on an operation\n * with a cookie parameter, and stays optional because a browser sends its cookies itself. Shared by `@kubb/plugin-ts`'s\n * `Options` type and `@kubb/plugin-zod`'s inferred options schema, so both printers emit the same shape from the same inputs.\n * `primitive: 'object'` is a no-op for the TS printer and tells the Zod printer to emit `z.object(…)` rather\n * than a record.\n */\nexport function buildOptionsSchema(node: ast.OperationNode, resolver: OperationTypeNameResolver, { pairContentTypes = false } = {}): ast.SchemaNode {\n const { path, query, header, cookie } = ast.http.groupParameters(node)\n const hasBody = Boolean(ast.http.requestBody.getSchema(node))\n const createNever = () => ast.factory.createSchema({ type: 'never', primitive: undefined, optional: true })\n const groups = [\n { name: 'path', params: path, resolve: resolver.param.path },\n { name: 'query', params: query, resolve: resolver.param.query },\n { name: 'headers', params: header, resolve: resolver.param.headers },\n { name: 'cookies', params: cookie, resolve: resolver.param.cookies },\n ] as const\n\n const createOptions = (body: ast.SchemaNode, extra: Array<ast.PropertyNode> = []) =>\n // NOTE(v5-stable): the fields were renamed from the legacy beta shape\n // (`data`/`pathParams`/`queryParams`/`headerParams`) to `body`/`path`/`query`/`headers` so the\n // type matches the runtime client. Drop this note once v5 leaves beta.\n ast.factory.createSchema({\n type: 'object',\n primitive: 'object',\n deprecated: node.deprecated,\n properties: [\n ast.factory.createProperty({ name: 'body', required: hasBody && node.requestBody?.required === true, schema: body }),\n ...groups\n .filter(({ name, params }) => name !== 'cookies' || params.length > 0)\n .map(({ name, params, resolve }) => {\n const required = name !== 'cookies' && params.some((param) => param.required)\n\n return ast.factory.createProperty({\n name,\n required,\n schema:\n params.length > 0\n ? ast.factory.createSchema({ type: 'ref', name: resolve.call(resolver.param, node, params[0]!), optional: !required })\n : createNever(),\n })\n }),\n ...extra,\n ],\n })\n\n const variants =\n pairContentTypes && hasRequestContentTypeChoice(node) ? resolveContentTypeVariants(node.requestBody?.content ?? [], resolver.response.body(node)) : []\n if (variants.length < 2) {\n return createOptions(hasBody ? ast.factory.createSchema({ type: 'ref', name: resolver.response.body(node) }) : createNever())\n }\n\n // The first media type is the runtime default, so only the others must pass `contentType`. A bare string sets the\n // request content type at runtime, so it is accepted next to the `{ request }` form.\n return ast.factory.createSchema({\n type: 'union',\n members: variants.map((variant, index) => {\n const contentType = ast.factory.createSchema({ type: 'enum', enumValues: [variant.contentType] })\n\n return createOptions(ast.factory.createSchema({ type: 'ref', name: variant.name }), [\n ast.factory.createProperty({\n name: 'contentType',\n required: index > 0,\n schema: ast.factory.createSchema({\n type: 'union',\n members: [\n contentType,\n ast.factory.createSchema({\n type: 'object',\n primitive: 'object',\n properties: [ast.factory.createProperty({ name: 'request', required: true, schema: contentType })],\n }),\n ],\n }),\n }),\n ])\n }),\n })\n}\n\n/**\n * The schema a status occupies in the `<Name>Responses` record. A status that documents several\n * content types becomes a `{ contentType; data }` union so the runtime can surface the negotiated type\n * on `result.parsed`, while the standalone `<Name>StatusNNN` alias stays the plain body union that the\n * query hooks and `result.data` use. With `streamData`, the stream variant of a 2xx status holds that schema, since the\n * client returns its body unread.\n */\nfunction buildResponseRecordEntry(\n node: ast.OperationNode,\n res: ast.ResponseNode,\n resolver: ResponseStatusNameResolver,\n streamData: ast.SchemaNode | undefined,\n): ast.SchemaNode {\n const statusName = resolver.response.status(node, res.statusCode)\n const variants = (res.content ?? []).filter((entry) => entry.schema)\n if (variants.length <= 1) {\n return ast.factory.createSchema({ type: 'ref', name: statusName })\n }\n\n return ast.factory.createSchema({\n type: 'union',\n members: resolveContentTypeVariants(variants, statusName).map((variant) =>\n ast.factory.createSchema({\n type: 'object',\n primitive: 'object',\n properties: [\n ast.factory.createProperty({\n name: 'contentType',\n required: true,\n // The runtime reports the bare media type, without parameters such as `charset` or `profile`.\n schema: ast.factory.createSchema({ type: 'enum', enumValues: [ast.mediaType.getBase(variant)] }),\n }),\n ast.factory.createProperty({\n name: 'data',\n required: true,\n schema:\n streamData && ast.http.status.isSuccess(res) && ast.mediaType.isStream(variant)\n ? streamData\n : ast.factory.createSchema({ type: 'ref', name: variant.name }),\n }),\n ],\n }),\n ),\n })\n}\n\n/**\n * Builds the per-status `<Name>Responses` record for an operation, referencing the already-resolved\n * `<Name>StatusNNN` names. Shared by `@kubb/plugin-ts`'s `Responses` type and `@kubb/plugin-zod`'s\n * inferred responses schema, so both emit the same shape from the same inputs.\n *\n * Always emits the keyed record, even when an operation declares no responses. An operation with no\n * responses renders as an empty object, which keeps every consumer's import (for example the axios\n * SDK's `RequestResult<XResponses>`) resolvable instead of pointing at a missing export.\n *\n * `streamData` is the type of a stream variant's `data`, such as a `ReadableStream<Uint8Array>` reference.\n */\nexport function buildResponses(\n node: ast.OperationNode,\n resolver: ResponseStatusNameResolver,\n { streamData }: { streamData?: ast.SchemaNode } = {},\n): ast.SchemaNode {\n return ast.factory.createSchema({\n type: 'object',\n primitive: 'object',\n properties: node.responses.map((res) =>\n ast.factory.createProperty({\n name: String(res.statusCode),\n required: true,\n schema: buildResponseRecordEntry(node, res, resolver, streamData),\n }),\n ),\n })\n}\n\nexport function resolveErrorNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return ast.http.responses.filterError(node).map((response) => resolver.response.status(node, response.statusCode))\n}\n\nexport function resolveSuccessNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return ast.http.responses.filterSuccess(node).map((response) => resolver.response.status(node, response.statusCode))\n}\n\nexport function resolveStatusCodeNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses.map((response) => resolver.response.status(node, response.statusCode))\n}\n\n/**\n * Lists the type names an operation's types file declares, computed once per resolver and `options` so every\n * dependent reads the same list.\n */\nexport function resolveOperationTypeNames(\n node: ast.OperationNode,\n resolver: OperationTypeNameResolver & Pick<Resolver, 'memo'>,\n options: ResolveOperationTypeNameOptions = {},\n): string[] {\n const key = `${node.operationId}\\0${options.order ?? ''}\\0${options.responseStatusNames ?? ''}\\0${options.includeParams === false ? 'noparams' : ''}\\0${(options.exclude ?? []).join(',')}`\n return resolver.memo(`operationTypeNames:${key}`, () => {\n const { path, query, header, cookie } = ast.http.groupParameters(node)\n const responseStatusNames =\n options.responseStatusNames === 'error'\n ? resolveErrorNames(node, resolver)\n : options.responseStatusNames === false\n ? []\n : resolveStatusCodeNames(node, resolver)\n const exclude = new Set(options.exclude ?? [])\n const paramNames =\n options.includeParams === false\n ? []\n : [\n ...path.map((param) => resolver.param.path(node, param)),\n ...query.map((param) => resolver.param.query(node, param)),\n ...header.map((param) => resolver.param.headers(node, param)),\n ...cookie.map((param) => resolver.param.cookies(node, param)),\n ]\n const bodyAndResponseNames = [ast.http.requestBody.getSchema(node) ? resolver.response.body(node) : null, resolver.response.response(node)]\n const names =\n options.order === 'body-response-first'\n ? [...bodyAndResponseNames, ...paramNames, ...responseStatusNames]\n : [...paramNames, ...bodyAndResponseNames, ...responseStatusNames]\n\n return names.filter((name): name is string => Boolean(name) && !exclude.has(name as string))\n })\n}\n\nexport function resolveResponseTypes(node: ast.OperationNode, resolver: ResponseNameResolver): Array<[statusCode: number | 'default', typeName: string]> {\n const types: Array<[number | 'default', string]> = []\n\n for (const response of node.responses) {\n if (response.statusCode === 'default') {\n types.push(['default', resolver.response.response(node)])\n continue\n }\n\n const code = Number(response.statusCode)\n if (Number.isNaN(code)) {\n continue\n }\n\n types.push([code, ast.http.status.isSuccess(code) ? resolver.response.response(node) : resolver.response.status(node, response.statusCode)])\n }\n\n return types\n}\n","import { ensureValidVarName, toFilePath } from '@internals/utils'\nimport { ast, casing } from '@kubb/kit'\nimport type { GeneratorContext, Resolver, ResolverFile } from '@kubb/kit'\n\n/**\n * The shared top-level `name` of the operation plugins, computed once per operation name and build.\n */\nexport function resolveOperationName(this: Resolver, name: string): string {\n return this.memo(`operation:${name}`, () => ensureValidVarName(casing.camel(name)))\n}\n\n/**\n * Builds the allocation key for a declaration an operation owns. `scope` names which declaration\n * it is, so two of them never share an allocation even when a custom resolver gives both the same\n * name. Leave `scope` empty for the operation's own declaration.\n *\n * The key starts from the operation's input `pointer`, which macros keep, so a plugin whose macro\n * rewrites the method or path still resolves another plugin's names for the same operation.\n *\n * @example\n * ```ts\n * resolver.resolveName({ key: operationKey(node, 'response', 'status', 404), name })\n * ```\n */\nexport function operationKey(node: ast.OperationNode, ...scope: Array<string | number>): Array<string | undefined> {\n const source = node.pointer ? [node.pointer] : [node.method, node.path]\n return ['operation', ...source, ...scope.map(String)]\n}\n\n/**\n * The `param` namespace shared by the schema-producing plugins (ts, zod, faker):\n * per-parameter names plus the grouped `Path`/`Query`/`Headers`/`Cookies` names, all routed\n * through the plugin's top-level `name` casing.\n */\nexport type OperationParamResolver = {\n name(this: Resolver, node: ast.OperationNode, param: ast.ParameterNode): string\n path(this: Resolver, node: ast.OperationNode): string\n query(this: Resolver, node: ast.OperationNode): string\n headers(this: Resolver, node: ast.OperationNode): string\n cookies(this: Resolver, node: ast.OperationNode): string\n}\n\n/**\n * The `response` namespace shared by the schema-producing plugins: per-status,\n * body, and combined response names, all routed through the plugin's top-level\n * `name` casing.\n */\nexport type OperationResponseResolver = {\n status(this: Resolver, node: ast.OperationNode, statusCode: ast.StatusCode): string\n /**\n * Name of the headers a response declares, such as `ListPetsStatus200Headers`.\n */\n headers(this: Resolver, node: ast.OperationNode, statusCode: ast.StatusCode): string\n body(this: Resolver, node: ast.OperationNode): string\n responses(this: Resolver, node: ast.OperationNode): string\n response(this: Resolver, node: ast.OperationNode): string\n}\n\n/**\n * Builds the shared `param` namespace. Spread the result into `createResolver`\n * and override individual methods next to it when a plugin deviates.\n *\n * @example\n * ```ts\n * createResolver<PluginTs>({ param: createOperationParamResolver(), ... })\n * ```\n */\nexport function createOperationParamResolver(): OperationParamResolver {\n return {\n name(node, param) {\n const name = this.name(`${node.operationId} ${param.in} ${param.name}`)\n return this.resolveName({ key: operationKey(node, 'param', 'name', param.in, param.name), name })\n },\n path(node) {\n const name = this.name(`${node.operationId} Path`)\n return this.resolveName({ key: operationKey(node, 'param', 'path'), name })\n },\n query(node) {\n const name = this.name(`${node.operationId} Query`)\n return this.resolveName({ key: operationKey(node, 'param', 'query'), name })\n },\n headers(node) {\n const name = this.name(`${node.operationId} Headers`)\n return this.resolveName({ key: operationKey(node, 'param', 'headers'), name })\n },\n cookies(node) {\n const name = this.name(`${node.operationId} Cookies`)\n return this.resolveName({ key: operationKey(node, 'param', 'cookies'), name })\n },\n }\n}\n\n/**\n * Builds the shared `response` namespace. Spread the result into\n * `createResolver` and add plugin-specific methods (`options`, `error`) next\n * to it.\n *\n * @example\n * ```ts\n * createResolver<PluginTs>({ response: { ...createOperationResponseResolver(), options(node) {...} }, ... })\n * ```\n */\nexport function createOperationResponseResolver(): OperationResponseResolver {\n return {\n status(node, statusCode) {\n const name = this.name(`${node.operationId} Status ${statusCode}`)\n return this.resolveName({ key: operationKey(node, 'response', 'status', statusCode), name })\n },\n headers(node, statusCode) {\n const name = this.name(`${node.operationId} Status ${statusCode} Headers`)\n return this.resolveName({ key: operationKey(node, 'response', 'headers', statusCode), name })\n },\n body(node) {\n const name = this.name(`${node.operationId} Body`)\n return this.resolveName({ key: operationKey(node, 'response', 'body'), name })\n },\n responses(node) {\n const name = this.name(`${node.operationId} Responses`)\n return this.resolveName({ key: operationKey(node, 'response', 'responses'), name })\n },\n response(node) {\n const name = this.name(`${node.operationId} Response`)\n return this.resolveName({ key: operationKey(node, 'response', 'response'), name })\n },\n }\n}\n\n/**\n * Builds a resolver `file` override whose base name runs every path segment\n * through `toFilePath`, casing the final segment with `caseLast`.\n *\n * @example\n * ```ts\n * createResolver<PluginTs>({ file: createCasedFile(pascalCase), ... })\n * ```\n */\nexport function createCasedFile(caseLast: (part: string) => string): ResolverFile {\n return {\n baseName({ name, extname }) {\n return this.memo(`file:${name}\\0${extname}`, (): ast.FileNode['baseName'] => `${toFilePath(name, caseLast)}${extname}`)\n },\n }\n}\n\ntype SchemaIndexContext = Pick<GeneratorContext, 'memo' | 'driver'>\n\n/**\n * Names of the schemas in a circular reference chain, computed once per build.\n */\nexport function getCircularNames(ctx: SchemaIndexContext): ReadonlySet<string> {\n return ctx.memo('circularNames:set', () => ast.graph.getCircularNames(ctx.driver.inputNode?.schemas ?? []))\n}\n\n/**\n * Names of the schemas whose type is `enum`, computed once per build.\n */\nexport function getEnumNames(ctx: SchemaIndexContext): ReadonlySet<string> {\n return ctx.memo(\n 'enumNames:set',\n () => new Set((ctx.driver.inputNode?.schemas ?? []).flatMap((schema) => (schema.type === 'enum' && schema.name ? [schema.name] : []))),\n )\n}\n\ndeclare global {\n namespace Kubb {\n interface MemoRegistry {\n operation: string\n file: ast.FileNode['baseName']\n operationTypeNames: Array<string>\n }\n }\n}\n","import path from 'node:path'\nimport { operationFileEntry, operationKey } from '@internals/shared'\nimport type { ast, Exclude, Group, Include, Memo, Output, Override, Resolver } from '@kubb/kit'\n\n/**\n * Shape of the value a generated operation function resolves to.\n * - `'full'`: the complete `{ status, data, error, contentType, request, response }` result.\n * - `'data'`: the bare success body when `throwOnError` is true, or the full result when it is false\n * so callers can inspect `error`.\n * - `'plain'`: the client's own promise typed as `RequestResult`, with no `withUnwrap` / `unwrapResult`\n * helper. Backs `@kubb/plugin-client`.\n */\nexport type ReturnTypeOption = 'full' | 'data' | 'plain'\n\n/**\n * The resolved contract `<op>` for one operation: the generated function name, the file it lives in,\n * the client module path (where `RequestConfig` / `ResponseErrorConfig` come from), and the\n * registered client plugin's `returnType`.\n *\n * `clientPath` is the absolute `.kubb/client.ts` path for plugin-fetch / plugin-axios, or\n * plugin-client's `importPath`: a relative one is resolved against the `<op>` file to an absolute\n * path, a package name or alias is kept verbatim. `clientPathIsFile` tells a consumer whether to\n * make it relative to the importing file.\n */\nexport type ClientOperation = {\n name: string\n path: string\n clientPath: string\n clientPathIsFile: boolean\n returnType: ReturnTypeOption\n /**\n * Whether the client's results carry the declared response headers. A custom `importPath` client keeps untyped headers.\n */\n typedHeaders: boolean\n}\n\n/**\n * The client plugin options a dependent reads, including the filters that scope them per operation.\n */\ntype ClientPluginOptions = {\n output?: Output\n group?: Group | null\n returnType?: ReturnTypeOption\n importPath?: string\n exclude?: Array<Exclude>\n include?: Array<Include>\n override?: Array<Override<Omit<ClientPluginOptions, 'override'>>>\n}\n\nfunction isRelativeImport(importPath: string): boolean {\n return importPath.startsWith('.')\n}\n\n// plugin-client resolves a relative `importPath` from its `<op>` file, so do the same here.\nfunction resolveImportPath(options: { importPath: string; operationFile: string }): string {\n const { importPath, operationFile } = options\n return isRelativeImport(importPath) ? path.resolve(path.dirname(operationFile), importPath) : importPath\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, plugin-axios, or plugin-client). Returns `null` when no contract plugin is in play (the inline\n * path), or when the client plugin's `exclude` / `include` leaves this operation out, since it then\n * emits no `<op>` to import. plugin-fetch / plugin-axios inject `.kubb/client.ts` at the global\n * output root, the same path consumers read `RequestConfig` / `ResponseErrorConfig` from.\n * With plugin-client they come from the user's `importPath` module instead.\n *\n * The result is cached in `memo` (the build's `ctx.memo`) under the client plugin's name and the operation,\n * so several dependents reading the same client plugin for one operation in a single pass\n * (react-query's query/mutation/infinite generators, vue-query, swr, the MCP handler, ...) share\n * one computed result instead of each re-deriving the name and path.\n *\n * `returnType`, `output`, and `group` are the client plugin's options for this operation, after its\n * `override` entries, the same resolution its own generator sees. A dependent's generated call body\n * and import path therefore match the `<op>` actually emitted, even when an `override` changes it.\n */\nexport function resolveClientOperation(options: {\n clientPlugin: { pluginName: string } | null\n driver: {\n getPlugin: (name: string) => { options?: ClientPluginOptions } | undefined\n getResolver: (name: string) => Resolver\n }\n node: ast.OperationNode\n root: string\n output: Output\n memo: Memo\n}): ClientOperation | null {\n const { clientPlugin, driver, node, root, output, memo } = options\n if (!clientPlugin) return null\n\n return memo(`${clientPlugin.pluginName}:clientOperation:${node.operationId}`, () => {\n const resolver = driver.getResolver(clientPlugin.pluginName)\n const pluginOptions = driver.getPlugin(clientPlugin.pluginName)?.options ?? {}\n const { exclude, include, override } = pluginOptions\n const hasOperationOptions = Boolean(exclude?.length || include?.length || override?.length)\n // Kubb's resolver always has `default`; the fallback keeps partial or custom resolvers working.\n const operationOptions =\n hasOperationOptions && resolver.default ? resolver.default.options(node, { options: pluginOptions, exclude, include, override }) : pluginOptions\n if (!operationOptions) return null\n\n const file = resolver.file({\n ...operationFileEntry(node, node.operationId),\n root,\n output: operationOptions.output ?? output,\n group: operationOptions.group ?? undefined,\n })\n\n const { importPath } = operationOptions\n const name = resolver.name(node.operationId)\n\n return {\n name: resolver.resolveName({ key: operationKey(node), name }),\n path: file.path,\n clientPath: importPath === undefined ? path.resolve(root, '.kubb/client.ts') : resolveImportPath({ importPath, operationFile: file.path }),\n clientPathIsFile: importPath === undefined || isRelativeImport(importPath),\n returnType: operationOptions.returnType ?? 'full',\n typedHeaders: importPath === undefined,\n }\n })\n}\n","import { type ast, Diagnostics, type GeneratorContext, type Group, type Output } from '@kubb/kit'\nimport { pluginTsName, type ResolverTs } from '@kubb/plugin-ts'\nimport type { PluginZod, ResolverZod } from '@kubb/plugin-zod'\n\n// A type-only import: the query plugins bundle this file but do not depend on @kubb/plugin-zod.\nconst pluginZodName = 'plugin-zod' satisfies PluginZod['name']\n\ntype GeneratorDriver = GeneratorContext['driver']\n\n/**\n * The per-operation type names a generated client references: the grouped input, the per-status\n * responses record its `RequestResult` is keyed on, and the headers each response declares.\n */\nexport type OperationTypeNames = {\n response: {\n /**\n * Resolves the name of the operation's grouped `{ body, path, query, headers, cookies }` input type.\n */\n options(node: ast.OperationNode): string\n /**\n * Resolves the name of the operation's per-status responses record type.\n */\n responses(node: ast.OperationNode): string\n /**\n * Resolves the name of the type of the headers one response declares. Left out, results keep untyped headers.\n */\n headers?(node: ast.OperationNode, statusCode: ast.StatusCode): string\n }\n}\n\nfunction getResponseHeadersEntries({ node, types }: { node: ast.OperationNode; types: OperationTypeNames }): Array<[ast.StatusCode, string]> {\n const resolve = types.response.headers\n if (!resolve) return []\n return node.responses\n .filter((response) => response.headers?.length)\n .map((response) => [response.statusCode, resolve.call(types.response, node, response.statusCode)])\n}\n\n/**\n * The headers type argument of `RequestResult`, such as `{ '200': LoginUserStatus200Headers }`, or `null` when no response declares headers.\n */\nexport function buildResponseHeadersType({ node, types }: { node: ast.OperationNode; types: OperationTypeNames }): string | null {\n const entries = getResponseHeadersEntries({ node, types }).map(([statusCode, name]) => `'${statusCode}': ${name}`)\n return entries.length ? `{ ${entries.join('; ')} }` : null\n}\n\n/**\n * A runtime result type, such as `RequestResult`, in its `WithHeaders` form when `headers` is set.\n */\nexport function resultTypeName(name: string, headers: boolean): string {\n return headers ? `${name}WithHeaders` : name\n}\n\n/**\n * A runtime result type with its arguments, such as `RequestResultWithHeaders<Responses, Headers, ThrowOnError>`.\n */\nexport function buildResultTypeRef(name: string, responses: string, headers: string | null, rest: Array<string | null> = []): string {\n return `${resultTypeName(name, headers !== null)}<${[responses, headers, ...rest].filter(Boolean).join(', ')}>`\n}\n\n/**\n * The names of the headers types `buildResponseHeadersType` references, for the file's imports.\n */\nexport function getResponseHeadersTypeNames({ node, types }: { node: ast.OperationNode; types: OperationTypeNames }): Array<string> {\n return getResponseHeadersEntries({ node, types }).map(([, name]) => name)\n}\n\n/**\n * Where a generated client sources its operation types, plus the resolver and output the file\n * declaring them is resolved with.\n */\nexport type OperationTypeSource = OperationTypeNames & {\n /**\n * `plugin-ts` shaped resolver of the plugin supplying the names, also used to resolve the file they are exported from.\n */\n resolver: ResolverTs\n /**\n * The supplying plugin's own `output`, when it configured one.\n */\n output: Output | undefined\n /**\n * The supplying plugin's own `group`, when it configured one.\n */\n group: Group | undefined\n}\n\n/**\n * A `plugin-ts` shaped resolver whose operation type names point at the types `pluginZod({ inferred })`\n * exports next to each schema, so code written against `plugin-ts` names picks up the zod types.\n */\nfunction toZodTypeResolver(resolver: ResolverZod): ResolverTs {\n const type = (name: string) => resolver.schema.type(name)\n\n return {\n ...resolver,\n // Class methods, so a spread drops them. `file` reads private fields, and `memo` gets its own key\n // space so these type names never share an entry with the zod names.\n file: resolver.file.bind(resolver),\n memo: (key: string, compute: () => unknown) => resolver.memo(`zodTypes:${key}`, compute),\n param: {\n name: (node: ast.OperationNode, p: ast.ParameterNode) => type(resolver.param.name(node, p)),\n path: (node: ast.OperationNode, p: ast.ParameterNode) => type(resolver.param.path(node, p)),\n query: (node: ast.OperationNode, p: ast.ParameterNode) => type(resolver.param.query(node, p)),\n headers: (node: ast.OperationNode, p: ast.ParameterNode) => type(resolver.param.headers(node, p)),\n cookies: (node: ast.OperationNode, p: ast.ParameterNode) => type(resolver.param.cookies(node, p)),\n },\n response: {\n body: (node: ast.OperationNode) => type(resolver.response.body(node)),\n status: (node: ast.OperationNode, statusCode: ast.StatusCode) => type(resolver.response.status(node, statusCode)),\n response: (node: ast.OperationNode) => type(resolver.response.response(node)),\n responses: (node: ast.OperationNode) => type(resolver.response.responses(node)),\n headers: (node: ast.OperationNode, statusCode: ast.StatusCode) => type(resolver.response.headers(node, statusCode)),\n options: (node: ast.OperationNode) => resolver.response.options(node),\n },\n } as unknown as ResolverTs\n}\n\n/**\n * Picks the plugin generated clients, query hooks, and MCP handlers take their operation types from.\n *\n * `pluginZod({ inferred: 'codec' })` wins, so a codec param takes its domain value. Otherwise `plugin-ts`\n * wins when it is in the pipeline, and without it any `pluginZod({ inferred })`. Throws\n * `KUBB_MISSING_DEPENDENCY` for `pluginName` when neither is available.\n *\n * @example\n * ```ts\n * const types = resolveOperationTypes(ctx.driver, ctx.plugin.name)\n * types.response.options(node) // 'GetPetByIdOptions', or 'GetPetByIdOptionsSchemaType' from zod\n * ```\n */\nexport function resolveOperationTypes(driver: GeneratorDriver, pluginName: string): OperationTypeSource {\n return driver.memo(`operationTypes:${pluginName}`, () => {\n const pluginTs = driver.getPlugin(pluginTsName)\n const pluginZod = driver.getPlugin(pluginZodName)\n\n if (pluginTs && pluginZod?.options?.inferred !== 'codec') {\n const resolver = driver.getResolver(pluginTsName)\n return { response: resolver.response, resolver, output: pluginTs.options?.output, group: pluginTs.options?.group ?? undefined }\n }\n\n if (!pluginZod?.options?.inferred) {\n throw new Diagnostics.Error({\n code: Diagnostics.code.missingDependency,\n severity: 'error',\n message: `Plugin \"${pluginName}\" has no source for operation types.`,\n help: `Add \\`pluginTs()\\` before \"${pluginName}\", or add \\`pluginZod({ inferred: true })\\`.`,\n location: { kind: 'config' },\n plugin: pluginName,\n })\n }\n\n const resolver = toZodTypeResolver(driver.getResolver(pluginZodName))\n return { response: resolver.response, resolver, output: pluginZod.options.output, group: pluginZod.options.group ?? undefined }\n })\n}\n\ndeclare global {\n namespace Kubb {\n interface MemoRegistry {\n operationTypes: OperationTypeSource\n /**\n * Nests every key the zod-backed `ResolverTs` memoizes, so it holds each of their value types.\n */\n zodTypes: unknown\n }\n }\n}\n","import { getResponseHeadersTypeNames, resolveOperationTypes } from '@internals/client'\nimport { operationFileEntry, resolveOperationFile, resolveOperationTypeNames } from '@internals/shared'\nimport { type ast, Diagnostics, type GeneratorContext, type Group, type Output } from '@kubb/kit'\nimport type { ResolverTs } from '@kubb/plugin-ts'\nimport { File } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx'\nimport type { ClientOperation, ReturnTypeOption } from '@internals/client'\n\ntype HookFileContext = Pick<GeneratorContext, 'config' | 'root' | 'memo' | 'meta' | 'driver' | 'requirePlugin' | 'resolver'>\n\ntype ResolveHookFileOptions = {\n name: string\n output: Output\n group?: Group | null\n contractOp: ClientOperation\n /**\n * The `<Key>` type alias declared in this file, left out of the imported type names.\n */\n keyTypeName?: string\n /**\n * Type names imported right after the response options type.\n */\n extraTypeNames?: Array<string | null | undefined>\n returnType?: ReturnTypeOption\n}\n\ntype ResolvedHookFile = {\n file: ast.FileNode\n fileTs: ast.FileNode\n tsResolver: ResolverTs\n contractOp: ClientOperation\n importedTypeNames: Array<string>\n /**\n * The client's result type the hook names with `returnType: 'full'`.\n */\n resultTypeName: 'RequestResult' | 'RequestResultWithHeaders'\n returnType: ReturnTypeOption\n banner: string | null\n footer: string | null\n}\n\n/**\n * Resolves what every TanStack hook file shares: its file, the operation types file and names (`@kubb/plugin-ts`, or\n * `pluginZod({ inferred: 'codec' })`), banner and footer.\n */\nexport function resolveHookFile(node: ast.OperationNode, ctx: HookFileContext, options: ResolveHookFileOptions): ResolvedHookFile {\n const { name, output, group, contractOp, keyTypeName, extraTypeNames = [], returnType = 'data' } = options\n const { config, root, resolver } = ctx\n if (returnType !== 'data' && contractOp.returnType === 'data') {\n throw new Diagnostics.Error({\n code: Diagnostics.code.invalidPluginOptions,\n severity: 'error',\n message: `Option \\`returnType\\` is '${returnType}' for ${node.operationId}, but the client plugin has \\`returnType: 'data'\\` and only returns the response body.`,\n help: \"Set the client plugin's `returnType` to 'full', or set the hook plugin's `returnType` to 'data'.\",\n location: { kind: 'config' },\n plugin: resolver.pluginName,\n })\n }\n const types = resolveOperationTypes(ctx.driver, resolver.pluginName)\n const tsResolver = types.resolver\n const headerTypeNames = returnType === 'data' || !contractOp.typedHeaders ? [] : getResponseHeadersTypeNames({ node, types: tsResolver })\n\n const file = resolver.file({ ...operationFileEntry(node, name), root, output, group: group ?? undefined })\n const fileTs = resolveOperationFile({\n ctx,\n node,\n resolver: tsResolver,\n root,\n output: types.output ?? output,\n group: types.group,\n })\n const importedTypeNames = [\n tsResolver.response.options(node),\n tsResolver.response.responses(node),\n ...headerTypeNames,\n ...extraTypeNames,\n ...resolveOperationTypeNames(node, tsResolver, {\n // The joined response alias is unused with the full result, and the printer keeps it as a substring of the responses record name.\n exclude: [keyTypeName, returnType !== 'data' ? tsResolver.response.response(node) : null].filter((name): name is string => Boolean(name)),\n order: 'body-response-first',\n includeParams: false,\n }),\n ].filter((typeName): typeName is string => Boolean(typeName))\n const fileMeta = { path: file.path, baseName: file.baseName }\n\n return {\n file,\n fileTs,\n tsResolver,\n contractOp,\n importedTypeNames,\n resultTypeName: headerTypeNames.length ? 'RequestResultWithHeaders' : 'RequestResult',\n returnType,\n banner: resolver.default.banner(ctx.meta, { output, config, file: fileMeta }),\n footer: resolver.default.footer(ctx.meta, { output, config, file: fileMeta }),\n }\n}\n\ntype HookFileProps = {\n hook: ResolvedHookFile\n /**\n * Framework imports rendered between the client imports and the type import.\n */\n imports?: KubbReactNode\n children?: KubbReactNode\n}\n\n/**\n * The `<File>` shell shared by the TanStack hook generators; renders `children` after the imports.\n */\nexport function HookFile({ hook, imports, children }: HookFileProps): KubbReactNode {\n const { file, fileTs, contractOp, importedTypeNames, resultTypeName, banner, footer } = hook\n\n return (\n <File baseName={file.baseName} path={file.path} meta={file.meta} banner={banner} footer={footer}>\n <File.Import name={[contractOp.name]} root={file.path} path={contractOp.path} />\n <File.Import\n name={['RequestConfig', 'ResponseErrorConfig', resultTypeName]}\n root={contractOp.clientPathIsFile ? file.path : undefined}\n path={contractOp.clientPath}\n isTypeOnly\n />\n\n {imports}\n {fileTs && importedTypeNames.length > 0 && <File.Import name={Array.from(new Set(importedTypeNames))} root={file.path} path={fileTs.path} isTypeOnly />}\n\n {children}\n </File>\n )\n}\n","import {\n getRequestGroupOptionality,\n getRequestGroups,\n getResponseContentTypeInfo,\n hasRequestContentTypeChoice,\n hasStreamVariant,\n isEventStream,\n resolveErrorNames,\n resolveSuccessNames,\n buildClientOptionType,\n requestGroupOrder,\n} from '@internals/shared'\nimport { ast } from '@kubb/kit'\nimport { createFunctionParameter, createFunctionParameters, createObjectBindingPattern, createTypeLiteral } from '@kubb/plugin-ts'\nimport type { FunctionParameterNode, FunctionParametersNode, PluginTs, ResolverTs } from '@kubb/plugin-ts'\nimport { buildResponseHeadersType, buildResultTypeRef } from '@internals/client'\nimport type { ReturnTypeOption } from '@internals/client'\nimport type { Infinite, Mutation, PageParamFn, Query } from './types.ts'\n\ntype RequestGroupKey = (typeof requestGroupOrder)[number]\n\n/**\n * Widens a request-group member type so a generated TanStack hook accepts either the value or a\n * deferred value. Both plugins apply this through the `memberTypeWrapper` of `buildGroupedRequestParam`;\n * they only differ in how the deferred form is later resolved.\n *\n * `maybeRefOrGetter` is used by vue-query, which keeps the ref/getter live and unwraps it lazily with\n * `toValue` because vue-query keys are reactive. `maybeValueOrGetter` is used by react-query, which\n * resolves the getter once at the hook boundary and forwards a plain value because React Query hashes\n * keys structurally and cannot hold a function.\n */\nexport function maybeRefOrGetter(type: string): string {\n return `MaybeRefOrGetter<${type}>`\n}\n\nexport function maybeValueOrGetter(type: string): string {\n return `${type} | (() => ${type})`\n}\n\n/**\n * Builds the grouped `{ path, query, body, headers, cookies }` parameter that mirrors the client\n * function signature. Only the groups the operation carries are emitted, typed from the\n * operation's `Options`. `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 `Options` reference. When\n * `memberTypeWrapper` is set, each group is emitted as its own member typed from the matching\n * `Options['<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 /** Binds the variables whole, so destructuring does not drop the chosen media type. */\n withContentType?: boolean\n },\n): FunctionParameterNode | null {\n const { resolver, keys = requestGroupOrder, memberTypeWrapper, withContentType = false } = 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 cookies: false,\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 optionsName = resolver.response.options(node)\n if (withContentType && hasRequestContentTypeChoice(node)) {\n return createFunctionParameter({ name: 'variables', type: optionsName, optional: false })\n }\n\n // `cookies` is on the options type only when the operation has cookie parameters, so it is omitted only then.\n const omittedKeys = requestGroupOrder.filter((key) => !keys.includes(key) && (key !== 'cookies' || groups.cookies))\n const optionsType = omittedKeys.length > 0 ? `Omit<${optionsName}, ${omittedKeys.map((key) => `'${key}'`).join(' | ')}>` : optionsName\n\n if (memberTypeWrapper) {\n const members = names.map((name) => ({\n name,\n type: memberTypeWrapper(`${optionsType}['${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: optionsType,\n optional: false,\n ...(isOptional ? { default: '{}' } : {}),\n })\n}\n\n/**\n * Builds the shared `({ path, query, body, headers, cookies }, config = {})` parameter list for a\n * TanStack query-options function. The leading parameter mirrors the client signature, and the\n * trailing `config` is the client's `Options` minus the request groups and `throwOnError`, which the\n * hook passes itself. 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: buildClientOptionType(),\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 * When `unwrapName` is set, each request group is passed as an explicit member unwrapped through it,\n * used by vue-query to resolve refs and getters with `toValue(...)` at call time. `pageParam` names the\n * query parameter an infinite query sets from TanStack's `pageParam`.\n *\n * @example\n * ```ts\n * buildClientCall(node, { clientName: 'getPetById', signal: true })\n * // getPetById({ ...config, path, signal: config.signal ?? signal, throwOnError: true })\n * ```\n */\nexport function buildClientCall(\n node: ast.OperationNode,\n options: { clientName: string; signal?: boolean; unwrapName?: (name: string) => string; withContentType?: boolean; pageParam?: string },\n): string {\n const { clientName, signal = false, unwrapName, withContentType = false, pageParam } = options\n const { groups } = getRequestGroupOptionality(node)\n const names = requestGroupOrder.filter((key) => groups[key])\n const member = (name: RequestGroupKey) => {\n const value = unwrapName ? unwrapName(name) : name\n if (name === 'query' && pageParam) return `query: { ...${value}, ${JSON.stringify(pageParam)}: pageParam }`\n return unwrapName ? `${name}: ${value}` : name\n }\n\n const args = [\n '...config',\n ...(withContentType && hasRequestContentTypeChoice(node) ? ['...variables'] : names.map(member)),\n signal ? 'signal: config.signal ?? signal' : null,\n 'throwOnError: true',\n ].filter((part): part is string => part !== null)\n\n return `${clientName}({ ${args.join(', ')} })`\n}\n\n/**\n * Builds the query/mutation body that resolves a `buildClientCall` expression down to the bare\n * success body. `clientReturnType` mirrors the registered client plugin's own `returnType` option: with\n * `'data'` the call already resolves to the bare body, so it is returned directly; with `'full'`\n * (the default) the call carries `unwrap()`, so the body calls it instead of destructuring `data`\n * off the full result by hand. With `'plain'` (plugin-client) the call resolves to the user's\n * `RequestResult`, so the body awaits it and reads `data`. With `returnType` `'full'` the body\n * resolves to the whole `RequestResult`; `resolveHookFile` rejects that for a client that already stripped it.\n *\n * @example\n * ```ts\n * buildCallResultBody(buildClientCall(node, { clientName: 'getPetById' }))\n * // return getPetById({ ...config, throwOnError: true }).unwrap()\n * ```\n */\nexport function buildCallResultBody(call: string, options: { clientReturnType?: ReturnTypeOption; returnType?: ReturnTypeOption } = {}): string {\n const { clientReturnType = 'full', returnType = 'data' } = options\n if (returnType !== 'data' || clientReturnType === 'data') {\n return `return ${call}`\n }\n if (clientReturnType === 'plain') {\n return `return (await ${call}).data`\n }\n return `return ${call}.unwrap()`\n}\n\nfunction buildResultType(node: ast.OperationNode, resolver: ResolverTs, typedHeaders: boolean): string {\n const headers = typedHeaders ? buildResponseHeadersType({ node, types: resolver }) : null\n return buildResultTypeRef('RequestResult', resolver.response.responses(node), headers, ['true'])\n}\n\ntype ResponseTypes = {\n TData: string\n TError: string\n}\n\ntype PageParamType = {\n queryParamsTypeName: string | null\n pageParamType: string\n}\n\ntype ResolvePageParamTypeParams = {\n resolver: ResolverTs\n initialPageParam: Infinite['initialPageParam']\n queryParam?: Infinite['queryParam']\n}\n\n/**\n * Builds the `TData` / `TError` type expressions shared by every generated hook, joining the resolved\n * success responses into `TData` and wrapping the error responses in `ResponseErrorConfig<...>`.\n * With `returnType` `'full'`, `TData` is the client's `RequestResult` over the operation's responses record, with the\n * response headers the operation declares.\n */\nexport function buildResponseTypes(\n node: ast.OperationNode,\n resolver: ResolverTs,\n options: { returnType?: ReturnTypeOption; typedHeaders?: boolean } = {},\n): ResponseTypes {\n const { returnType = 'data', typedHeaders = true } = options\n // The same operation gets typed headers from one client and not from another, so both results are kept.\n return resolver.memo(`responseTypes:${returnType}:${typedHeaders}:${node.method}\\0${node.path}`, () => {\n const successNames = resolveSuccessNames(node, resolver)\n const bodyName = successNames.length > 0 ? successNames.join(' | ') : resolver.response.response(node)\n // The client resolves a stream variant of a mixed response to its raw body.\n const responseName = hasStreamVariant(node) ? `${bodyName} | ReadableStream<Uint8Array>` : bodyName\n const errorNames = resolveErrorNames(node, resolver)\n\n return {\n TData: returnType === 'data' ? responseName : buildResultType(node, resolver, typedHeaders),\n TError: `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(' | ') : 'Error'}>`,\n }\n })\n}\n\nfunction resolveFallbackPageParamType(initialPageParam: Infinite['initialPageParam']): string {\n if (typeof initialPageParam === 'number') return 'number'\n if (typeof initialPageParam === 'boolean') return 'boolean'\n if (typeof initialPageParam !== 'string') return 'unknown'\n if (!initialPageParam.includes(' as ')) return 'string'\n\n return initialPageParam.split(' as ').at(-1) ?? 'unknown'\n}\n\n/**\n * Resolves the `TPageParam` generic for the infinite-query hooks. Prefers the type read from the\n * configured `queryParam` on the operation's query object, and falls back to the type inferred from\n * `initialPageParam` when that parameter type is unavailable. Also returns the query params type name\n * so callers can reuse it when rewriting the paginated request.\n */\nexport function resolvePageParamType(node: ast.OperationNode, { resolver, initialPageParam, queryParam }: ResolvePageParamTypeParams): PageParamType {\n const firstQueryParam = ast.http.groupParameters(node).query[0]\n const groupName = firstQueryParam ? resolver.param.query(node, firstQueryParam) : null\n const individualName = firstQueryParam ? resolver.param.name(node, firstQueryParam) : null\n const queryParamsTypeName = groupName !== individualName ? groupName : null\n\n const queryParamType = queryParam && queryParamsTypeName ? `${queryParamsTypeName}['${queryParam}']` : null\n\n if (!queryParamType) {\n return { queryParamsTypeName, pageParamType: resolveFallbackPageParamType(initialPageParam) }\n }\n\n const isInitialPageParamDefined = initialPageParam !== undefined && initialPageParam !== null\n\n return { queryParamsTypeName, pageParamType: isInitialPageParamDefined ? `NonNullable<${queryParamType}>` : queryParamType }\n}\n\n/**\n * Applies the shared query defaults during plugin setup: `false` disables query generation, and an\n * object merges over `methods: ['GET', 'QUERY']` and the plugin's runtime `importPath`. QUERY\n * (RFC 10008) is a safe, idempotent read that carries its input in the body, so it is a query too.\n */\nexport function resolveQueryConfig(query: Partial<Query> | false, options: { importPath: string }): Required<Query> | false {\n if (query === false) return false\n return { importPath: options.importPath, methods: ['GET', 'QUERY'], ...query }\n}\n\n/**\n * Applies the shared mutation defaults during plugin setup: `false` disables mutation generation,\n * and an object merges over `methods: ['POST', 'PUT', 'PATCH', 'DELETE']` and the plugin's runtime\n * `importPath`.\n */\nexport function resolveMutationConfig(mutation: Partial<Mutation> | false, options: { importPath: string }): Required<Mutation> | false {\n if (mutation === false) return false\n return { importPath: options.importPath, methods: ['POST', 'PUT', 'PATCH', 'DELETE'], ...mutation }\n}\n\ntype OperationClassification = {\n isQuery: boolean\n isMutation: boolean\n}\n\ntype ClassifyOperationParams = {\n query: Required<Query> | false\n mutation: Required<Mutation> | false\n}\n\n/**\n * Classifies an operation as a query or a mutation from the resolved `query` / `mutation` method lists.\n * Disabled query and mutation configs do not claim operations, and a method already claimed by an\n * enabled query config never counts as a mutation. Event streams are consumed through the client\n * directly, so they do not generate query or mutation hooks.\n */\nexport function classifyOperation(node: ast.HttpOperationNode, { query, mutation }: ClassifyOperationParams): OperationClassification {\n if (isEventStream(node)) return { isQuery: false, isMutation: false }\n\n const isQuery = !!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 return { isQuery, isMutation }\n}\n\n/**\n * Helper to define a typed page param function for `infinite.getNextPageParam` or\n * `infinite.getPreviousPageParam`. Serializes the function to a string for inlining in generated code.\n *\n * Note: Because the function is inlined verbatim into the generated file via `.toString()`,\n * it must be self-contained and cannot reference local closures or external variables from\n * the config file.\n */\nexport function definePageParam<TPage = any, TParam = any>(fn: PageParamFn<TPage, TParam>): string {\n return fn.toString()\n}\n\n/**\n * Applies the shared infinite-query defaults during plugin setup: a falsy value disables infinite\n * queries, and an object merges over `queryParam: 'id'` and `initialPageParam: 0` with the cursor\n * paths cleared.\n */\nexport function resolveInfiniteConfig(infinite: Partial<Infinite> | false): Required<Infinite> | false {\n if (!infinite) return false\n const hasExplicitInitialPageParam = infinite.hasExplicitInitialPageParam ?? infinite.initialPageParam !== undefined\n const getNextPageParam = infinite.getNextPageParam\n ? typeof infinite.getNextPageParam === 'function'\n ? infinite.getNextPageParam.toString()\n : infinite.getNextPageParam\n : null\n const getPreviousPageParam = infinite.getPreviousPageParam\n ? typeof infinite.getPreviousPageParam === 'function'\n ? infinite.getPreviousPageParam.toString()\n : infinite.getPreviousPageParam\n : null\n\n return {\n queryParam: 'id',\n initialPageParam: 0,\n hasExplicitInitialPageParam,\n cursorParam: null,\n nextParam: null,\n previousParam: null,\n getNextPageParam,\n getPreviousPageParam,\n ...infinite,\n ...(getNextPageParam ? { getNextPageParam } : {}),\n ...(getPreviousPageParam ? { getPreviousPageParam } : {}),\n }\n}\n\n/**\n * Whether the infinite hook for `node` should be generated: the operation takes the configured\n * `queryParam`.\n */\nexport function matchesInfinite(node: ast.OperationNode, infinite: Infinite): boolean {\n if (!infinite.queryParam) return false\n // Strip trailing '?' which OpenAPI specs sometimes append to parameter names to denote optionality\n return ast.http.groupParameters(node).query.some((param) => param.name.replace(/\\?$/, '') === infinite.queryParam)\n}\n\n/**\n * Warning for an infinite hook that falls back to the built-in page params on a response that\n * isn't an array. Those params only stop on an empty array, so `hasNextPage` never turns false.\n */\nexport function getDefaultPageParamsWarning(node: ast.OperationNode, infinite: Infinite): string | null {\n const usesDefault =\n infinite.getNextPageParam == null &&\n infinite.getPreviousPageParam == null &&\n infinite.nextParam == null &&\n infinite.previousParam == null &&\n !infinite.cursorParam\n if (!usesDefault) return null\n\n const content = ast.http.responses.findPrimary(node)?.content\n const jsonContent = content?.find((item) => ast.mediaType.isJson(item)) ?? content?.[0]\n const schema = jsonContent?.schema\n\n let resolved: ast.SchemaNode | null | undefined = schema\n while (resolved?.type === 'ref' || (resolved?.type === 'intersection' && resolved.members?.length === 1)) {\n resolved = resolved.type === 'ref' ? resolved.schema : resolved.members?.[0]\n }\n if (!resolved || resolved.type === 'array') return null\n\n return `${node.operationId}: the default infinite page params expect an array response and never end for this one. Set \\`infinite.getNextPageParam\\` (or \\`nextParam\\`) to read the next page from the response.`\n}\n\ntype OverrideFilter = { type: string; pattern: string | RegExp } | { type: 'extension'; key: `x-${string}`; value?: unknown }\n\ntype OverrideEntry<TOptions> = OverrideFilter & {\n options?: Partial<TOptions>\n}\n\nfunction matchesPattern(node: ast.OperationNode, ov: OverrideFilter): boolean {\n if ('key' in ov) {\n const extensions = node.extensions\n if (!extensions || !(ov.key in extensions)) return false\n return ov.value === undefined || extensions[ov.key] === ov.value\n }\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\n/**\n * The request groups a query key is built from, matching `buildQueryKeyParams`. Headers are\n * deliberately absent: they do not identify a cache entry, so the key factory takes no parameter\n * for an operation that only carries headers. Cookies are left out too: they often hold a session token, and a query key\n * is stored in SSR payloads, persisted caches, and devtools.\n */\nexport const queryKeyGroupOrder = ['path', 'query', 'body'] as const\n\n/**\n * Whether the generated query key factory declares a parameter, so a call site passes an argument\n * only when one is accepted.\n */\nexport function hasQueryKeyParams(node: ast.OperationNode): boolean {\n const groups = getRequestGroups(node)\n return queryKeyGroupOrder.some((key) => groups[key])\n}\n\n/**\n * Build QueryKey params as the grouped `{ path, query, body }` object (NO headers, NO cookies, NO config),\n * typed from the operation's `Options` minus `url`. The query key transformer reads the\n * grouped `path`/`query`/`body` bindings.\n */\nexport function buildQueryKeyParams(\n node: ast.OperationNode,\n options: { resolver: PluginTs['resolver']; memberTypeWrapper?: (type: string) => string },\n): FunctionParametersNode {\n const { resolver, memberTypeWrapper } = options\n const groupedParam = buildGroupedRequestParam(node, { resolver, keys: queryKeyGroupOrder, memberTypeWrapper })\n\n return createFunctionParameters({ params: groupedParam ? [groupedParam] : [] })\n}\n\n/**\n * Builds the hook parameter list: the grouped request param (omitted when `withRequest` is `false`) then `options` typed as `optionsType`.\n */\nexport function buildHookParams(\n node: ast.OperationNode,\n options: { resolver: ResolverTs; optionsType: string; memberTypeWrapper?: (type: string) => string; withRequest?: boolean },\n): FunctionParametersNode {\n const { resolver, optionsType, memberTypeWrapper, withRequest = true } = options\n const optionsParam = createFunctionParameter({ name: 'options', type: optionsType, default: '{}' })\n const groupedParam = withRequest ? buildGroupedRequestParam(node, { resolver, memberTypeWrapper }) : null\n\n return createFunctionParameters({ params: [groupedParam, optionsParam].filter((param): param is FunctionParameterNode => param !== null) })\n}\n\n/**\n * The `TRequest` type argument of a mutation hook: the options type when the operation takes a request, else `undefined`.\n * When the variables carry the request media type and the response has several, `contentType` can pick the\n * response one too, as `{ request, response }`.\n */\nexport function resolveMutationRequestType(node: ast.OperationNode, resolver: ResolverTs): string {\n if (!buildGroupedRequestParam(node, { resolver })) return 'undefined'\n\n const optionsName = resolver.response.options(node)\n const response = getResponseContentTypeInfo(node)\n if (!hasRequestContentTypeChoice(node) || !response.isMultipleContentTypes) return optionsName\n\n // An inline options type is a union, so it needs parentheses. `string` keeps its bare request media type form assignable.\n const base = /^[\\w$]+$/.test(optionsName) ? optionsName : `(${optionsName})`\n return `${base} & { contentType?: string | { response?: ${response.contentTypeUnion} } }`\n}\n\n/**\n * Builds the object literal that unwraps each request group's getter before it reaches `queryKey`/`queryOptions`; `null` without a request group.\n */\nexport function buildResolvedRequestParams(node: ast.OperationNode): string | null {\n const groups = getRequestGroups(node)\n const names = requestGroupOrder.filter((key) => groups[key])\n if (names.length === 0) return null\n return `{ ${names.map((name) => `${name}: typeof ${name} === 'function' ? ${name}() : ${name}`).join(', ')} }`\n}\n\ndeclare global {\n namespace Kubb {\n interface MemoRegistry {\n responseTypes: ResponseTypes\n }\n }\n}\n","import { getNestedAccessor } from '@internals/utils'\nimport type { ast } from '@kubb/kit'\nimport type { ResolverTs } from '@kubb/plugin-ts'\nimport { createFunctionParameters, functionPrinter } from '@kubb/plugin-ts'\nimport { File, Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx'\nimport type { CallReturnTypeProps, Infinite } from '../types.ts'\nimport {\n buildCallResultBody,\n buildClientCall,\n buildGroupedRequestParam,\n buildQueryOptionsParams,\n buildResponseTypes,\n queryKeyGroupOrder,\n resolvePageParamType,\n} from '../utils.ts'\n\ntype Props = {\n name: string\n clientName: string\n queryKeyName: string\n node: ast.OperationNode\n tsResolver: ResolverTs\n initialPageParam: Infinite['initialPageParam']\n hasExplicitInitialPageParam?: boolean\n cursorParam: Infinite['cursorParam']\n nextParam: Infinite['nextParam']\n previousParam: Infinite['previousParam']\n getNextPageParam?: Infinite['getNextPageParam']\n getPreviousPageParam?: Infinite['getPreviousPageParam']\n queryParam: Infinite['queryParam']\n /**\n * The `TQueryKey` generic written into the emitted `infiniteQueryOptions` call. react-query\n * points it at the local `queryKey` const, vue-query uses the imported `QueryKey` type.\n *\n * @default 'typeof queryKey'\n */\n queryKeyType?: string\n /**\n * Wraps each grouped request member type, used by vue-query to accept `MaybeRefOrGetter` values.\n */\n memberTypeWrapper?: (type: string) => string\n /**\n * Unwraps a request group inside the client call, used by vue-query to emit `toValue(...)`.\n */\n unwrapName?: (name: string) => string\n} & CallReturnTypeProps\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\nconst callPrinter = functionPrinter({ mode: 'call' })\n\nexport function InfiniteQueryOptions({\n name,\n clientName,\n initialPageParam,\n hasExplicitInitialPageParam,\n cursorParam,\n nextParam,\n previousParam,\n getNextPageParam,\n getPreviousPageParam,\n node,\n tsResolver,\n queryParam,\n queryKeyName,\n queryKeyType = 'typeof queryKey',\n memberTypeWrapper,\n unwrapName,\n clientReturnType,\n returnType,\n typedHeaders,\n}: Props): KubbReactNode {\n const { TData: queryFnDataType, TError: errorType } = buildResponseTypes(node, tsResolver, { returnType, typedHeaders })\n const dataSuffix = returnType === 'data' ? '' : '.data'\n\n const { queryParamsTypeName, pageParamType } = resolvePageParamType(node, { resolver: tsResolver, initialPageParam, queryParam })\n\n const groupedKeyParam = buildGroupedRequestParam(node, { resolver: tsResolver, keys: queryKeyGroupOrder, memberTypeWrapper })\n const queryKeyParamsNode = createFunctionParameters({ params: groupedKeyParam ? [groupedKeyParam] : [] })\n const queryKeyParamsCall = callPrinter.print(queryKeyParamsNode) ?? ''\n\n const paramsNode = buildQueryOptionsParams(node, { resolver: tsResolver, memberTypeWrapper })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n // The page param replaces the configured query parameter of the request, typed as that parameter.\n const pageParam = queryParam && queryParamsTypeName ? queryParam : undefined\n const queryFnBody = buildCallResultBody(buildClientCall(node, { clientName, signal: true, unwrapName, pageParam }), { clientReturnType, returnType })\n\n const initialPageParamLiteral =\n typeof initialPageParam === 'string' || (typeof initialPageParam === 'object' && initialPageParam !== null)\n ? JSON.stringify(initialPageParam)\n : String(initialPageParam === undefined ? 0 : initialPageParam)\n\n // Resolve getNextPageParam: custom source > nextParam > cursorParam > default numeric fallback.\n // TanStack Query v5 requires getNextPageParam on infiniteQueryOptions.\n const serializedGetNextPageParam = typeof getNextPageParam === 'function' ? getNextPageParam.toString() : getNextPageParam\n const getNextPageParamExpr = (() => {\n if (serializedGetNextPageParam) return `getNextPageParam: ${serializedGetNextPageParam}`\n if (nextParam) return `getNextPageParam: (lastPage) => ${getNestedAccessor(nextParam, `lastPage${dataSuffix}`)}`\n if (cursorParam) return `getNextPageParam: (lastPage) => lastPage${dataSuffix}['${cursorParam}']`\n return `getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage${dataSuffix}) && lastPage${dataSuffix}.length === 0 ? undefined : lastPageParam + 1`\n })()\n\n // Resolve getPreviousPageParam: custom source > previousParam > cursorParam > default numeric fallback.\n // In TanStack Query, getPreviousPageParam is optional (only needed for bi-directional pagination).\n // When next pagination is custom or cursor-based, numeric decrement is omitted unless explicitly configured.\n // When initialPageParam is not explicitly configured, keep the legacy 1-based default (<= 1) for non-breaking compatibility.\n const serializedGetPreviousPageParam = typeof getPreviousPageParam === 'function' ? getPreviousPageParam.toString() : getPreviousPageParam\n const defaultPreviousThreshold = hasExplicitInitialPageParam ? initialPageParamLiteral : '1'\n\n const getPreviousPageParamExpr = (() => {\n if (serializedGetPreviousPageParam) return `getPreviousPageParam: ${serializedGetPreviousPageParam}`\n if (previousParam) return `getPreviousPageParam: (firstPage) => ${getNestedAccessor(previousParam, `firstPage${dataSuffix}`)}`\n if (cursorParam) return `getPreviousPageParam: (firstPage) => firstPage${dataSuffix}['${cursorParam}']`\n if (serializedGetNextPageParam || nextParam) return null\n return `getPreviousPageParam: (_firstPage, _allPages, firstPageParam) => firstPageParam <= ${defaultPreviousThreshold} ? undefined : firstPageParam - 1`\n })()\n\n const queryOptionsArr = [`initialPageParam: ${initialPageParamLiteral}`, getNextPageParamExpr, getPreviousPageParamExpr].filter(Boolean)\n\n const queryFnArgs = pageParam ? '{ signal, pageParam }' : '{ signal }'\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function name={name} export params={paramsSignature}>\n {`\nconst queryKey = ${queryKeyName}(${queryKeyParamsCall})\nreturn infiniteQueryOptions<${queryFnDataType}, ${errorType}, InfiniteData<${queryFnDataType}>, ${queryKeyType}, ${pageParamType}>({\n queryKey,\n queryFn: async (${queryFnArgs}) => {\n ${queryFnBody}\n },\n ${queryOptionsArr.join(',\\n ')}\n})\n`}\n </Function>\n </File.Source>\n )\n}\n","import { type ast, Url } from '@kubb/kit'\nimport { createFunctionParameters, functionPrinter } from '@kubb/plugin-ts'\nimport { File, Function, Type } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx'\nimport type { Transformer } from '../types.ts'\n\ntype Props = {\n name: string\n node: ast.OperationNode\n transformer: Transformer | null | undefined\n /**\n * Also emits `ReturnType<typeof name>` as an exported type alias of this name.\n */\n typeName?: string\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\n\n/**\n * Default `mutationKey` builder. Call it from a custom builder to extend the default key.\n *\n * @remarks The returned segments may change between releases. Spread them instead of reading single entries.\n *\n * @example\n * ```ts\n * mutationKey: (props) => [JSON.stringify(props.node.operationId), ...mutationKeyTransformer(props)]\n * ```\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, typeName }: Props): KubbReactNode {\n const paramsNode = createFunctionParameters({ params: [] })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n // Mutations always use 'mutation' as they do not have suspense or infinite variants.\n const keys = (transformer ?? mutationKeyTransformer)({ node, casing: 'camelcase', variant: 'mutation' })\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 {typeName && (\n <File.Source name={typeName} isExportable isIndexable isTypeOnly>\n <Type export name={typeName}>{`ReturnType<typeof ${name}>`}</Type>\n </File.Source>\n )}\n </>\n )\n}\n","import { casing } from '@kubb/kit'\nimport { operationKey } from '@internals/shared'\nimport type { ast, Resolver } from '@kubb/kit'\n\n/**\n * The naming variant of a query namespace: the plain query, or the\n * `Suspense`/`Infinite`/`SuspenseInfinite` flavors that suffix every\n * generated identifier.\n */\nexport type QueryVariant = '' | 'Suspense' | 'Infinite' | 'SuspenseInfinite'\n\n/**\n * The query namespace shared by the TanStack Query flavored plugins\n * (react-query, vue-query, swr): hook, options, key, and key type names.\n */\nexport type QueryResolver = {\n name(this: Resolver, node: ast.OperationNode): string\n optionsName(this: Resolver, node: ast.OperationNode): string\n keyName(this: Resolver, node: ast.OperationNode): string\n keyTypeName(this: Resolver, node: ast.OperationNode): string\n}\n\n/**\n * The mutation namespace shared by the TanStack Query flavored plugins:\n * hook and mutation key names.\n */\nexport type MutationResolver = {\n name(this: Resolver, node: ast.OperationNode): string\n keyName(this: Resolver, node: ast.OperationNode): string\n}\n\n/**\n * Builds the shared query namespace for a variant. Spread the result into\n * `createResolver` once per variant the plugin supports.\n *\n * @example\n * ```ts\n * createResolver<PluginReactQuery>({\n * query: createQueryResolver(),\n * suspenseQuery: createQueryResolver('Suspense'),\n * })\n * ```\n */\nexport function createQueryResolver(variant: QueryVariant = ''): QueryResolver {\n return {\n name(node) {\n const name = `use${casing.capitalize(this.name(node.operationId))}${variant}`\n return this.resolveName({ key: operationKey(node, 'query', variant, 'name'), name })\n },\n optionsName(node) {\n const name = `${this.name(node.operationId)}${variant}QueryOptions`\n return this.resolveName({ key: operationKey(node, 'query', variant, 'optionsName'), name })\n },\n keyName(node) {\n const name = `${this.name(node.operationId)}${variant}QueryKey`\n return this.resolveName({ key: operationKey(node, 'query', variant, 'keyName'), name })\n },\n keyTypeName(node) {\n const name = `${casing.capitalize(this.name(node.operationId))}${variant}QueryKey`\n return this.resolveName({ key: operationKey(node, 'query', variant, 'keyTypeName'), name })\n },\n }\n}\n\n/**\n * Builds the shared mutation namespace. Spread the result into\n * `createResolver` and add plugin-specific methods (`optionsName`,\n * `argTypeName`) next to it.\n *\n * @example\n * ```ts\n * createResolver<PluginSwr>({ mutation: { ...createMutationResolver(), argTypeName(node) {...} } })\n * ```\n */\nexport function createMutationResolver(): MutationResolver {\n return {\n name(node) {\n const name = `use${casing.capitalize(this.name(node.operationId))}`\n return this.resolveName({ key: operationKey(node, 'mutation', 'name'), name })\n },\n keyName(node) {\n const name = `${this.name(node.operationId)}MutationKey`\n return this.resolveName({ key: operationKey(node, 'mutation', 'keyName'), name })\n },\n }\n}\n","import { ast, Url } from '@kubb/kit'\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'\nimport type { KeyVariant, 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 * @default 'query'\n */\n variant?: KeyVariant\n /**\n * Wraps each grouped request member type, used by vue-query for `MaybeRefOrGetter`.\n */\n memberTypeWrapper?: (type: string) => string\n /**\n * Exports and indexes the `typeName` alias too (default `false`).\n */\n exportType?: boolean\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\n\n/**\n * Default `queryKey` builder. Call it from a custom builder to extend the default key.\n *\n * @remarks The returned segments may change between releases. Spread them instead of reading single entries.\n *\n * @example\n * ```ts\n * queryKey: (props) => [JSON.stringify(props.node.operationId), ...queryKeyTransformer(props)]\n * ```\n */\nexport const queryKeyTransformer: Transformer = ({ node, variant }) => {\n if (!node.path) return []\n const { path, query } = ast.http.groupParameters(node)\n // Embedding `infinite: true` inside the URL segment separates infinite queries in the cache\n // while preserving TanStack Query partial matching for base URL invalidation.\n const isInfinite = variant === 'infiniteQuery' || variant === 'suspenseInfiniteQuery'\n\n const urlFields = [`url: '${Url.toPath(node.path)}'`]\n if (path.length > 0) urlFields.push('params: path')\n if (isInfinite) urlFields.push('infinite: true')\n\n const result = [`{ ${urlFields.join(', ')} }`]\n if (query.length > 0) result.push('...(query ? [query] : [])')\n // A falsy body (`''`, `0`, `false`, `null`) is still an input, so only an absent one is left out.\n if (ast.http.requestBody.getSchema(node)) result.push('...(body !== undefined ? [body] : [])')\n\n return result\n}\n\nexport function QueryKey({ name, node, tsResolver, typeName, transformer, variant = 'query', memberTypeWrapper, exportType }: Props): KubbReactNode {\n const paramsNode = buildQueryKeyParams(node, { resolver: tsResolver, memberTypeWrapper })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n const keys = (transformer ?? queryKeyTransformer)({ node, casing: 'camelcase', variant })\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} isExportable={exportType} isIndexable={exportType} isTypeOnly>\n <Type name={typeName} export={exportType}>{`ReturnType<typeof ${name}>`}</Type>\n </File.Source>\n </>\n )\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\nimport { defineGenerator } from '@kubb/kit'\nimport { File, Function, jsxRenderer } from '@kubb/renderer-jsx'\nimport type { PluginReactQuery } from '../types'\n\n/**\n * Scaffolds the user-editable `useCustomHookOptions` file when\n * `pluginReactQuery({ customOptions: { ... }, hooks: true })` is configured. The file is\n * only created when it does not already exist, so user edits persist across\n * regeneration, and only when `importPath` resolves inside the plugin's output folder.\n */\nexport const customHookOptionsFileGenerator = defineGenerator<PluginReactQuery>({\n name: 'react-query-custom-hook-options-file',\n renderer: jsxRenderer,\n operations(nodes, ctx) {\n const { resolver, root } = ctx\n const { output, customOptions, query, group, hooks } = ctx.options\n\n // The starter file imports the `HookOptions` type, which is only generated alongside the hooks.\n if (!customOptions || !hooks) return null\n\n const { importPath, name } = customOptions\n const hookOptionsName = resolver.hook.optionsName()\n const customHookOptionsName = resolver.hook.customOptionsName()\n\n const reactQueryImportPath = query ? query.importPath : '@tanstack/react-query'\n\n const outputPath = path.resolve(root, output.path)\n const outputDir = output.mode === 'directory' ? outputPath : path.dirname(outputPath)\n\n let basePath = outputDir\n const firstNode = nodes[0]\n if (firstNode) {\n const hookName = resolver.query.name(firstNode)\n const hookFile = resolver.file({\n name: hookName,\n extname: '.ts',\n tag: firstNode.tags[0] ?? 'default',\n path: firstNode.path,\n root,\n output,\n group: group ?? undefined,\n })\n basePath = path.dirname(hookFile.path)\n }\n\n const ensureExtension = (filePath: string, extname: string) => {\n if (path.extname(filePath) === '') return filePath + extname\n return filePath\n }\n\n const actualFilePath = ensureExtension(importPath, '.ts')\n const file = {\n baseName: path.basename(actualFilePath) as `${string}.${string}`,\n path: path.resolve(basePath, actualFilePath),\n }\n\n // `importPath` bypasses the resolver's output-folder guard, so apply the same boundary here.\n // A module outside the output folder belongs to the user, who creates it themselves.\n const relativeToOutput = path.relative(outputDir, file.path)\n if (relativeToOutput === '..' || relativeToOutput.startsWith(`..${path.sep}`) || path.isAbsolute(relativeToOutput)) return null\n\n if (fs.existsSync(file.path)) return null\n\n return (\n <File baseName={file.baseName} path={file.path}>\n <File.Import name={['QueryClient']} path={reactQueryImportPath} isTypeOnly />\n <File.Import name={['useQueryClient']} path={reactQueryImportPath} />\n <File.Import name={[hookOptionsName]} root={file.path} path={path.resolve(root, './index.ts')} />\n <File.Source name={name} isExportable isIndexable>\n <Function name={customHookOptionsName} params=\"{ queryClient }: { queryClient: QueryClient }\" returnType={`Partial<${hookOptionsName}>`}>\n {`return {\n // TODO: Define custom hook options here\n // Example:\n // useUpdatePetHook: {\n // onSuccess: () => {\n // void queryClient.invalidateQueries({ queryKey: ['pet'] })\n // }\n // }\n }`}\n </Function>\n <Function\n name={name}\n generics={`T extends keyof ${hookOptionsName}`}\n params=\"{ hookName, operationId }: { hookName: T, operationId: string }\"\n returnType={`${hookOptionsName}[T]`}\n export\n >\n {`const queryClient = useQueryClient()\n const customOptions = ${customHookOptionsName}({ queryClient })\n return customOptions[hookName] ?? {}`}\n </Function>\n </File.Source>\n </File>\n )\n },\n})\n","import { operationFileEntry } from '@internals/shared'\nimport { matchesInfinite } from '@internals/tanstack-query'\nimport { ast, defineGenerator } from '@kubb/kit'\nimport { File, jsxRenderer, Type } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx'\nimport type { PluginReactQuery } from '../types'\nimport { classifyOperation, resolveOperationOverrides } from '@internals/tanstack-query'\n\ntype QueryOption = PluginReactQuery['resolvedOptions']['query']\ntype MutationOption = PluginReactQuery['resolvedOptions']['mutation']\n\n/**\n * Emits the `HookOptions` type used by `customOptions`. Enabled when\n * `pluginReactQuery({ customOptions: { ... } })`. The generated type lists\n * every hook keyed by name so user-supplied options stay in sync with the\n * generated hooks at compile time.\n */\nexport const hookOptionsGenerator = defineGenerator<PluginReactQuery>({\n name: 'react-query-hook-options',\n renderer: jsxRenderer,\n operations(nodes, ctx) {\n const { resolver, config, root } = ctx\n const { output, customOptions, query, mutation, suspense, infinite, group, override, hooks } = ctx.options\n\n if (!customOptions || !hooks) return null\n\n const name = resolver.hook.optionsName()\n const resolvedFile = resolver.file({ name, extname: '.ts', root, output, group: group ?? undefined })\n const hookOptionsFile = {\n ...resolvedFile,\n baseName: `${name}.ts` as const,\n path: resolvedFile.path.replace(/[^/\\\\]+\\.ts$/, `${name}.ts`),\n }\n\n const imports: Array<KubbReactNode> = []\n const hookOptions: Record<string, string> = {}\n\n for (const node of nodes) {\n if (!ast.http.isOperation(node)) continue\n const opOverrides = resolveOperationOverrides(node, override)\n const nodeQuery: QueryOption = 'query' in opOverrides ? (opOverrides.query as QueryOption) : query\n const nodeMutation: MutationOption = 'mutation' in opOverrides ? (opOverrides.mutation as MutationOption) : mutation\n const nodeInfinite = 'infinite' in opOverrides ? opOverrides.infinite : infinite\n const nodeInfiniteOptions = nodeInfinite && typeof nodeInfinite === 'object' ? nodeInfinite : null\n\n // A per-operation `query: false` skips the query hooks, matching the generators that emit them.\n const { isQuery, isMutation } = classifyOperation(node, { query: nodeQuery, mutation: nodeMutation })\n const isSuspense = !!suspense\n const isInfinite = isQuery && !!nodeInfiniteOptions && matchesInfinite(node, nodeInfiniteOptions)\n\n const namespaces: Array<[{ name(node: ast.OperationNode): string; optionsName(node: ast.OperationNode): string }, boolean]> = [\n [resolver.query, isQuery],\n [resolver.suspenseQuery, isQuery && isSuspense],\n [resolver.infiniteQuery, isInfinite],\n [resolver.suspenseInfiniteQuery, isInfinite && isSuspense],\n [resolver.mutation, isMutation],\n ]\n\n for (const [ns, enabled] of namespaces) {\n if (!enabled) continue\n const optionsName = ns.optionsName(node)\n const hookName = ns.name(node)\n const hookFile = resolver.file({ ...operationFileEntry(node, hookName), root, output, group: group ?? undefined })\n imports.push(<File.Import name={[optionsName]} root={hookOptionsFile.path} path={hookFile.path} />)\n hookOptions[hookName] = `Partial<ReturnType<typeof ${optionsName}>>`\n }\n }\n\n return (\n <File\n baseName={hookOptionsFile.baseName}\n path={hookOptionsFile.path}\n meta={hookOptionsFile.meta}\n banner={resolver.default.banner(ctx.meta, { output, config, file: { path: hookOptionsFile.path, baseName: hookOptionsFile.baseName } })}\n footer={resolver.default.footer(ctx.meta, { output, config, file: { path: hookOptionsFile.path, baseName: hookOptionsFile.baseName } })}\n >\n {imports}\n <File.Source name={name} isExportable isIndexable isTypeOnly>\n <Type export name={name}>\n {`{ ${Object.keys(hookOptions)\n .map((key) => `${JSON.stringify(key)}: ${hookOptions[key]}`)\n .join(', ')} }`}\n </Type>\n </File.Source>\n </File>\n )\n },\n})\n","import type { ast } from '@kubb/kit'\nimport type { 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'\nimport { buildClientOptionType, buildOperationComments } from '@internals/shared'\nimport {\n buildHookParams,\n buildResolvedRequestParams,\n buildResponseTypes,\n hasQueryKeyParams,\n maybeValueOrGetter,\n resolvePageParamType,\n} from '@internals/tanstack-query'\nimport type { HookResultProps, Infinite } from '@internals/tanstack-query'\nimport type { PluginReactQuery } from '../types.ts'\n\ntype Props = {\n name: string\n queryOptionsName: string\n queryKeyName: string\n queryKeyTypeName: string\n node: ast.OperationNode\n tsResolver: ResolverTs\n customOptions: PluginReactQuery['resolvedOptions']['customOptions']\n /**\n * Emits the suspense variant of the hook (`useSuspenseQuery`, `useSuspenseInfiniteQuery`). The\n * suspense observer options drop the `TQueryData` generic, everything else stays identical.\n */\n suspense?: boolean\n /**\n * Emits the infinite variant of the hook (`useInfiniteQuery`) with the page param type resolved from these.\n */\n infinite?: {\n initialPageParam: Infinite['initialPageParam']\n queryParam?: Infinite['queryParam']\n }\n} & HookResultProps\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\n\nconst OBSERVER_OPTIONS_NAMES = {\n infinite: { suspense: 'UseSuspenseInfiniteQueryOptions', standard: 'InfiniteQueryObserverOptions' },\n plain: { suspense: 'UseSuspenseQueryOptions', standard: 'QueryObserverOptions' },\n}\n\ntype HookTypesProps = Pick<Props, 'node' | 'suspense' | 'queryKeyTypeName' | 'infinite'> & {\n tsResolver: ResolverTs\n TData: string\n TError: string\n observerOptionsName: string\n resultTypeName: string\n}\n\nfunction buildHookTypes({ node, tsResolver, infinite, suspense, TData, TError, queryKeyTypeName, observerOptionsName, resultTypeName }: HookTypesProps) {\n if (infinite) {\n const { pageParamType } = resolvePageParamType(node, { resolver: tsResolver, initialPageParam: infinite.initialPageParam, queryParam: infinite.queryParam })\n return {\n generics: [\n `TQueryFnData = ${TData}`,\n `TError = ${TError}`,\n 'TData = InfiniteData<TQueryFnData>',\n `TQueryKey extends QueryKey = ${queryKeyTypeName}`,\n `TPageParam = ${pageParamType}`,\n ],\n observerOptionsType: `${observerOptionsName}<TQueryFnData, TError, TData, TQueryKey, TPageParam>`,\n resultType: `${resultTypeName}<TData, TError> & { queryKey: TQueryKey }`,\n }\n }\n\n return {\n generics: suspense\n ? [`TData = ${TData}`, `TQueryKey extends QueryKey = ${queryKeyTypeName}`]\n : [`TData = ${TData}`, `TQueryData = ${TData}`, `TQueryKey extends QueryKey = ${queryKeyTypeName}`],\n observerOptionsType: `${observerOptionsName}<${(suspense ? [TData, TError, 'TData', 'TQueryKey'] : [TData, TError, 'TData', 'TQueryData', 'TQueryKey']).join(', ')}>`,\n resultType: `${resultTypeName}<TData, ${TError}> & { queryKey: TQueryKey }`,\n }\n}\n\nexport function Query({\n name,\n queryKeyTypeName,\n queryOptionsName,\n queryKeyName,\n node,\n tsResolver,\n customOptions,\n suspense,\n infinite,\n returnType,\n typedHeaders,\n}: Props): KubbReactNode {\n const { TData, TError } = buildResponseTypes(node, tsResolver, { returnType, typedHeaders })\n\n const prefix = suspense ? 'UseSuspense' : 'Use'\n const hookName = `${suspense ? 'useSuspense' : 'use'}${infinite ? 'InfiniteQuery' : 'Query'}`\n const observerOptionsName = OBSERVER_OPTIONS_NAMES[infinite ? 'infinite' : 'plain'][suspense ? 'suspense' : 'standard']\n const resultTypeName = `${prefix}${infinite ? 'Infinite' : ''}QueryResult`\n\n const { generics, observerOptionsType, resultType } = buildHookTypes({\n node,\n tsResolver,\n infinite,\n suspense,\n TData,\n TError,\n queryKeyTypeName,\n observerOptionsName,\n resultTypeName,\n })\n // The non-infinite hook casts to the bare options type, the infinite one to the fully applied type.\n const castType = infinite ? observerOptionsType : observerOptionsName\n\n const resolvedParams = buildResolvedRequestParams(node)\n const queryKeyArgs = resolvedParams && hasQueryKeyParams(node) ? 'resolvedParams' : ''\n const queryOptionsArgs = resolvedParams ? 'resolvedParams, config' : 'config'\n\n const paramsNode = buildHookParams(node, {\n resolver: tsResolver,\n memberTypeWrapper: maybeValueOrGetter,\n optionsType: `{\n query?: Partial<${observerOptionsType}> & { client?: QueryClient },\n client?: ${buildClientOptionType()}\n}`,\n })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function\n name={name}\n export\n generics={generics.join(', ')}\n params={paramsSignature}\n returnType={undefined}\n JSDoc={{ comments: buildOperationComments(node) }}\n >\n {`\n const { query: queryConfig = {}, client: config = {} } = options ?? {}\n const { client: queryClient, ...resolvedOptions } = queryConfig${resolvedParams ? `\\n const resolvedParams = ${resolvedParams}` : ''}\n const queryKey = resolvedOptions?.queryKey ?? ${queryKeyName}(${queryKeyArgs})${customOptions ? `\\n const customOptions = ${customOptions.name}({ hookName: '${name}', operationId: '${node.operationId}' })` : ''}\n\n const queryResult = ${hookName}({\n ...${queryOptionsName}(${queryOptionsArgs}),${customOptions ? '\\n ...customOptions,' : ''}\n ...resolvedOptions,\n queryKey,\n } as unknown as ${castType}, queryClient) as ${resultType}\n\n queryResult.queryKey = queryKey as TQueryKey\n\n return queryResult\n `}\n </Function>\n </File.Source>\n )\n}\n","import type { ast } from '@kubb/kit'\nimport type { 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'\nimport { buildCallResultBody, buildQueryOptionsParams, buildClientCall } from '@internals/tanstack-query'\nimport type { CallReturnTypeProps } from '@internals/tanstack-query'\nimport { buildQueryKeyParams, buildResponseTypes } from '@internals/tanstack-query'\n\ntype Props = {\n name: string\n clientName: string\n queryKeyName: string\n node: ast.OperationNode\n tsResolver: ResolverTs\n} & CallReturnTypeProps\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\nconst callPrinter = functionPrinter({ mode: 'call' })\n\nexport function QueryOptions({ name, clientName, node, tsResolver, queryKeyName, clientReturnType, returnType, typedHeaders }: Props): KubbReactNode {\n const { TData, TError } = buildResponseTypes(node, tsResolver, { returnType, typedHeaders })\n\n const queryKeyParamsNode = buildQueryKeyParams(node, { resolver: tsResolver })\n const queryKeyParamsCall = callPrinter.print(queryKeyParamsNode) ?? ''\n\n const paramsNode = buildQueryOptionsParams(node, { resolver: tsResolver })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n const queryFnBody = buildCallResultBody(buildClientCall(node, { clientName, signal: true }), { clientReturnType, returnType })\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function name={name} export params={paramsSignature}>\n {`\n const queryKey = ${queryKeyName}(${queryKeyParamsCall})\n return queryOptions<${TData}, ${TError}, ${TData}, typeof queryKey>({\n queryKey,\n queryFn: async ({ signal }) => {\n ${queryFnBody}\n },\n })\n`}\n </Function>\n </File.Source>\n )\n}\n","import { resolveClientOperation, resolveOperationTypes } from '@internals/client'\nimport {\n classifyOperation,\n getDefaultPageParamsWarning,\n HookFile,\n InfiniteQueryOptions,\n matchesInfinite,\n QueryKey,\n resolveHookFile,\n resolvePageParamType,\n} from '@internals/tanstack-query'\nimport { ast, defineGenerator } from '@kubb/kit'\nimport { File, jsxRenderer } from '@kubb/renderer-jsx'\nimport { Query } from '../components/Query.tsx'\nimport { QueryOptions } from '../components/QueryOptions.tsx'\nimport type { PluginReactQuery } from '../types'\n\ntype Variant = 'query' | 'suspenseQuery' | 'infiniteQuery' | 'suspenseInfiniteQuery'\n\nconst OBSERVER_IMPORTS: Record<Variant, Array<string>> = {\n query: ['QueryObserverOptions', 'UseQueryResult'],\n suspenseQuery: ['UseSuspenseQueryOptions', 'UseSuspenseQueryResult'],\n infiniteQuery: ['InfiniteQueryObserverOptions', 'UseInfiniteQueryResult'],\n suspenseInfiniteQuery: ['UseSuspenseInfiniteQueryOptions', 'UseSuspenseInfiniteQueryResult'],\n}\n\n/**\n * Builds the generator for one `useQuery` flavor. `variant` picks the resolver namespace\n * (`resolver.query`, `resolver.suspenseQuery`, ...), the TanStack hook, and the options it needs.\n */\nexport function createQueryGenerator({ name, variant }: { name: string; variant: Variant }) {\n const suspense = variant === 'suspenseQuery' || variant === 'suspenseInfiniteQuery'\n const infinite = variant === 'infiniteQuery' || variant === 'suspenseInfiniteQuery'\n const hookImport = `use${suspense ? 'Suspense' : ''}${infinite ? 'InfiniteQuery' : 'Query'}`\n const observerImports = OBSERVER_IMPORTS[variant]\n\n return defineGenerator<PluginReactQuery>({\n name,\n renderer: jsxRenderer,\n match(node, ctx) {\n const operationNode = node as ast.OperationNode\n if (!ast.http.isOperation(operationNode)) return false\n const { query, mutation, infinite: infiniteConfig, suspense: suspenseConfig, hooks } = ctx.options\n const { isQuery, isMutation } = classifyOperation(operationNode, { query, mutation })\n if (!isQuery || isMutation) return false\n if (suspense && !suspenseConfig) return false\n if (variant === 'query') return true\n if (!hooks) return false\n if (!infinite) return true\n\n const infiniteOptions = infiniteConfig && typeof infiniteConfig === 'object' ? infiniteConfig : null\n return !!infiniteOptions && matchesInfinite(operationNode, infiniteOptions)\n },\n operation(node, ctx) {\n if (!ast.http.isOperation(node)) return null\n const { driver, resolver, root } = ctx\n const { output, query, infinite: infiniteConfig, client, group, customOptions, hooks } = ctx.options\n\n const infiniteOptions = infinite && infiniteConfig && typeof infiniteConfig === 'object' ? infiniteConfig : null\n if (infinite && !infiniteOptions) return null\n\n // The suspense infinite generator skips the warning: the infinite one already emits it for this operation.\n if (variant === 'infiniteQuery' && infiniteOptions) {\n const pageParamsWarning = getDefaultPageParamsWarning(node, infiniteOptions)\n if (pageParamsWarning) ctx.warn(pageParamsWarning)\n }\n\n const contractOp = resolveClientOperation({ clientPlugin: { pluginName: client.pluginName }, driver, node, root, output, memo: ctx.memo })\n if (!contractOp) return null\n\n const importPath = query ? query.importPath : '@tanstack/react-query'\n const variantResolver = resolver[variant]\n const queryName = variantResolver.name(node)\n const queryOptionsName = variantResolver.optionsName(node)\n const queryKeyName = variantResolver.keyName(node)\n const queryKeyTypeName = variantResolver.keyTypeName(node)\n const tsResolver = resolveOperationTypes(driver, resolver.pluginName).resolver\n\n const hook = resolveHookFile(node, ctx, {\n name: queryName,\n output,\n group,\n contractOp,\n returnType: ctx.options.returnType,\n keyTypeName: queryKeyTypeName,\n extraTypeNames: infiniteOptions\n ? [\n resolvePageParamType(node, { resolver: tsResolver, initialPageParam: infiniteOptions.initialPageParam, queryParam: infiniteOptions.queryParam })\n .queryParamsTypeName,\n ]\n : [],\n })\n\n return (\n <HookFile hook={hook} imports={customOptions && <File.Import name={[customOptions.name]} path={customOptions.importPath} />}>\n <QueryKey\n name={queryKeyName}\n typeName={queryKeyTypeName}\n node={node}\n tsResolver={hook.tsResolver}\n transformer={ctx.options.queryKey}\n variant={variant}\n />\n\n {infiniteOptions ? (\n <>\n <File.Import name={['InfiniteData']} isTypeOnly path={importPath} />\n <File.Import name={['infiniteQueryOptions']} path={importPath} />\n <InfiniteQueryOptions\n name={queryOptionsName}\n clientName={contractOp.name}\n queryKeyName={queryKeyName}\n node={node}\n tsResolver={hook.tsResolver}\n cursorParam={infiniteOptions.cursorParam}\n nextParam={infiniteOptions.nextParam}\n previousParam={infiniteOptions.previousParam}\n getNextPageParam={infiniteOptions.getNextPageParam}\n getPreviousPageParam={infiniteOptions.getPreviousPageParam}\n initialPageParam={infiniteOptions.initialPageParam}\n hasExplicitInitialPageParam={infiniteOptions.hasExplicitInitialPageParam}\n queryParam={infiniteOptions.queryParam}\n clientReturnType={contractOp.returnType}\n returnType={hook.returnType}\n typedHeaders={hook.contractOp.typedHeaders}\n />\n </>\n ) : (\n <>\n <File.Import name={['queryOptions']} path={importPath} />\n <QueryOptions\n name={queryOptionsName}\n clientName={contractOp.name}\n queryKeyName={queryKeyName}\n node={node}\n tsResolver={hook.tsResolver}\n clientReturnType={contractOp.returnType}\n returnType={hook.returnType}\n typedHeaders={hook.contractOp.typedHeaders}\n />\n </>\n )}\n\n {(variant !== 'query' || (query && hooks)) && (\n <>\n <File.Import name={[hookImport]} path={importPath} />\n <File.Import name={['QueryKey', 'QueryClient', ...observerImports]} path={importPath} isTypeOnly />\n <Query\n name={queryName}\n queryOptionsName={queryOptionsName}\n queryKeyName={queryKeyName}\n queryKeyTypeName={queryKeyTypeName}\n node={node}\n tsResolver={hook.tsResolver}\n customOptions={customOptions}\n returnType={hook.returnType}\n typedHeaders={hook.contractOp.typedHeaders}\n suspense={suspense}\n infinite={infiniteOptions ? { initialPageParam: infiniteOptions.initialPageParam, queryParam: infiniteOptions.queryParam } : undefined}\n />\n </>\n )}\n </HookFile>\n )\n },\n })\n}\n","import { createQueryGenerator } from './createQueryGenerator.tsx'\n\n/**\n * Built-in generator for `useInfiniteQuery` hooks. Enabled when\n * `pluginReactQuery({ infinite: { ... }, hooks: true })`. Emits one\n * `useFooInfiniteQuery` hook per query operation, wiring the configured\n * `nextParam` / `previousParam` paths into TanStack Query's cursor-based\n * pagination.\n */\nexport const infiniteQueryGenerator = createQueryGenerator({ name: 'react-infinite-query', variant: 'infiniteQuery' })\n","import type { ast } from '@kubb/kit'\nimport type { 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'\nimport { buildCallResultBody, buildGroupedRequestParam, buildClientCall, resolveMutationRequestType } from '@internals/tanstack-query'\nimport type { CallReturnTypeProps } from '@internals/tanstack-query'\nimport { buildRequestConfigType } from '@internals/shared'\nimport { buildResponseTypes } from '@internals/tanstack-query'\n\ntype Props = {\n name: string\n clientName: string\n mutationKeyName: string\n node: ast.OperationNode\n tsResolver: ResolverTs\n} & CallReturnTypeProps\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\nconst callPrinter = functionPrinter({ mode: 'call' })\n\nexport function buildMutationConfigParamsNode(node: ast.OperationNode): FunctionParametersNode {\n return createFunctionParameters({\n params: [\n createFunctionParameter({\n name: 'config',\n type: buildRequestConfigType(node),\n default: '{}',\n }),\n ],\n })\n}\n\nexport function MutationOptions({ name, clientName, node, tsResolver, mutationKeyName, clientReturnType, returnType, typedHeaders }: Props): KubbReactNode {\n const { TData, TError } = buildResponseTypes(node, tsResolver, { returnType, typedHeaders })\n\n const configParamsNode = buildMutationConfigParamsNode(node)\n const paramsSignature = declarationPrinter.print(configParamsNode) ?? ''\n\n const groupedParam = buildGroupedRequestParam(node, { resolver: tsResolver, withContentType: true })\n const hasMutationParams = groupedParam !== null\n\n const groupedParamsNode = createFunctionParameters({ params: groupedParam ? [groupedParam] : [] })\n const TRequest = resolveMutationRequestType(node, tsResolver)\n const argBindingStr = hasMutationParams ? (callPrinter.print(groupedParamsNode) ?? '') : '_'\n const mutationFnBody = buildCallResultBody(buildClientCall(node, { clientName, signal: false, withContentType: true }), {\n clientReturnType,\n returnType,\n })\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function name={name} export params={paramsSignature} generics={['TContext = unknown']}>\n {`\n const mutationKey = ${mutationKeyName}()\n return mutationOptions<${TData}, ${TError}, ${TRequest}, TContext>({\n mutationKey,\n mutationFn: async(${argBindingStr}) => {\n ${mutationFnBody}\n },\n })\n`}\n </Function>\n </File.Source>\n )\n}\n","import type { ast } from '@kubb/kit'\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'\nimport { buildHookParams, buildResponseTypes, resolveMutationRequestType } from '@internals/tanstack-query'\nimport type { HookResultProps } from '@internals/tanstack-query'\nimport type { ReturnTypeOption } from '@internals/client'\nimport type { PluginReactQuery } from '../types.ts'\nimport { buildOperationComments as getComments, buildRequestConfigType } from '@internals/shared'\nimport { buildMutationConfigParamsNode } from './MutationOptions.tsx'\n\ntype Props = {\n name: string\n mutationOptionsName: string\n mutationKeyName: string\n node: ast.OperationNode\n tsResolver: ResolverTs\n customOptions: PluginReactQuery['resolvedOptions']['customOptions']\n} & HookResultProps\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\nconst callPrinter = functionPrinter({ mode: 'call' })\n\nfunction buildMutationParamsNode(\n node: ast.OperationNode,\n options: { resolver: ResolverTs; returnType: ReturnTypeOption; typedHeaders?: boolean },\n): FunctionParametersNode {\n const { resolver, returnType, typedHeaders } = options\n const { TData, TError } = buildResponseTypes(node, resolver, { returnType, typedHeaders })\n const generics = [TData, TError, resolveMutationRequestType(node, resolver), 'TContext'].join(', ')\n\n return buildHookParams(node, {\n resolver,\n withRequest: false,\n optionsType: `{\n mutation?: UseMutationOptions<${generics}> & { client?: QueryClient },\n client?: ${buildRequestConfigType(node)},\n}`,\n })\n}\n\nexport function Mutation({ name, mutationOptionsName, node, tsResolver, mutationKeyName, customOptions, returnType, typedHeaders }: Props): KubbReactNode {\n const { TData, TError } = buildResponseTypes(node, tsResolver, { returnType, typedHeaders })\n\n const TRequest = resolveMutationRequestType(node, tsResolver)\n const generics = [TData, TError, TRequest, 'TContext'].join(', ')\n const resultType = `UseMutationResult<${generics}>`\n\n const mutationOptionsConfigNode = buildMutationConfigParamsNode(node)\n const mutationOptionsParamsCall = callPrinter.print(mutationOptionsConfigNode) ?? ''\n\n const paramsNode = buildMutationParamsNode(node, { resolver: tsResolver, returnType, typedHeaders })\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) }} generics={['TContext']}>\n {`\n const { mutation = {}, client: config = {} } = options ?? {}\n const { client: queryClient, ...mutationOptions } = mutation;\n const mutationKey = mutationOptions.mutationKey ?? ${mutationKeyName}()\n\n const baseOptions = ${mutationOptionsName}(${mutationOptionsParamsCall}) as UseMutationOptions<${generics}>${customOptions ? `\\n const customOptions = ${customOptions.name}({ hookName: '${name}', operationId: '${node.operationId}' }) as UseMutationOptions<${generics}>` : ''}\n\n return useMutation<${generics}>({\n ...baseOptions,${customOptions ? '\\n ...customOptions,' : ''}\n mutationKey,\n ...mutationOptions,\n }, queryClient) as ${resultType}\n `}\n </Function>\n </File.Source>\n )\n}\n","import { resolveClientOperation } from '@internals/client'\nimport { classifyOperation, HookFile, MutationKey, resolveHookFile } from '@internals/tanstack-query'\nimport { ast, defineGenerator } from '@kubb/kit'\nimport { File, jsxRenderer } from '@kubb/renderer-jsx'\nimport { Mutation } from '../components/Mutation.tsx'\nimport { MutationOptions } from '../components/MutationOptions.tsx'\nimport type { PluginReactQuery } from '../types'\n\n/**\n * Built-in generator for `useMutation` hooks. Emits one `useFooMutation` hook\n * per POST/PUT/DELETE operation (configurable via `mutation.methods`) plus\n * the matching `fooMutationKey` / `fooMutationOptions` helpers.\n */\nexport const mutationGenerator = defineGenerator<PluginReactQuery>({\n name: 'react-query-mutation',\n renderer: jsxRenderer,\n match(node, ctx) {\n const operationNode = node as ast.OperationNode\n if (!ast.http.isOperation(operationNode)) return false\n const { query, mutation } = ctx.options\n return classifyOperation(operationNode, { query, mutation }).isMutation\n },\n operation(node, ctx) {\n if (!ast.http.isOperation(node)) return null\n const { driver, resolver, root } = ctx\n const { output, mutation, client, group, customOptions, hooks } = ctx.options\n\n const importPath = mutation ? mutation.importPath : '@tanstack/react-query'\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, memo: ctx.memo })\n if (!contractOp) return null\n\n const mutationHookName = resolver.mutation.name(node)\n const mutationOptionsName = resolver.mutation.optionsName(node)\n const mutationKeyName = resolver.mutation.keyName(node)\n\n const hook = resolveHookFile(node, ctx, { name: mutationHookName, output, group, contractOp, returnType: ctx.options.returnType })\n const { tsResolver } = hook\n\n return (\n <HookFile hook={hook} imports={customOptions && <File.Import name={[customOptions.name]} path={customOptions.importPath} />}>\n <MutationKey name={mutationKeyName} node={node} transformer={ctx.options.mutationKey} />\n\n <File.Import name={['mutationOptions']} path={importPath} />\n\n <MutationOptions\n name={mutationOptionsName}\n clientName={contractOp.name}\n mutationKeyName={mutationKeyName}\n node={node}\n tsResolver={tsResolver}\n clientReturnType={contractOp.returnType}\n returnType={hook.returnType}\n typedHeaders={hook.contractOp.typedHeaders}\n />\n\n {mutation && hooks && (\n <>\n <File.Import name={['useMutation']} path={importPath} />\n <File.Import name={['UseMutationOptions', 'UseMutationResult', 'QueryClient']} path={importPath} isTypeOnly />\n <Mutation\n name={mutationHookName}\n mutationOptionsName={mutationOptionsName}\n mutationKeyName={mutationKeyName}\n node={node}\n tsResolver={tsResolver}\n customOptions={customOptions}\n returnType={hook.returnType}\n typedHeaders={hook.contractOp.typedHeaders}\n />\n </>\n )}\n </HookFile>\n )\n },\n})\n","import { createQueryGenerator } from './createQueryGenerator.tsx'\n\n/**\n * Built-in generator for `useQuery` hooks. Emits one `useFooQuery` hook per\n * GET and QUERY operation (configurable via `query.methods`) plus the matching\n * `fooQueryKey` / `fooQueryOptions` helpers.\n */\nexport const queryGenerator = createQueryGenerator({ name: 'react-query', variant: 'query' })\n","import { createQueryGenerator } from './createQueryGenerator.tsx'\n\n/**\n * Built-in generator for `useSuspenseInfiniteQuery` hooks. Enabled when\n * `suspense`, `infinite`, and `hooks` are all configured. Combines suspense\n * semantics with cursor-based pagination. Handlers throw promises while\n * loading and pull additional pages on demand.\n */\nexport const suspenseInfiniteQueryGenerator = createQueryGenerator({ name: 'react-suspense-infinite-query', variant: 'suspenseInfiniteQuery' })\n","import { createQueryGenerator } from './createQueryGenerator.tsx'\n\n/**\n * Built-in generator for `useSuspenseQuery` hooks. Enabled when\n * `pluginReactQuery({ suspense: {}, hooks: true })`. Emits one\n * `useFooSuspenseQuery` hook per query operation. Suspense queries throw\n * promises while loading and require a `<Suspense>` boundary in the React\n * tree. TanStack Query v5+ only.\n */\nexport const suspenseQueryGenerator = createQueryGenerator({ name: 'react-suspense-query', variant: 'suspenseQuery' })\n","import { operationKey, resolveOperationName } from '@internals/shared'\nimport { createMutationResolver, createQueryResolver } from '@internals/tanstack-query'\nimport { createResolver } from '@kubb/kit'\nimport type { PluginReactQuery } from '../types.ts'\n\n/**\n * Default resolver used by `@kubb/plugin-react-query`. Decides the names and\n * file paths for every generated TanStack Query hook (`useFoo`,\n * `useFooSuspense`, `useFooInfinite`, ...) and its companion helpers\n * (`fooQueryKey`, `fooQueryOptions`).\n *\n * Functions use safe camelCase identifiers; hooks get the `use`\n * prefix; suspense and infinite variants are suffixed with `Suspense`/`Infinite`.\n *\n * @example Resolve hook and helper names\n * ```ts\n * import { resolverReactQuery } from '@kubb/plugin-react-query'\n *\n * resolverReactQuery.query.name(operationNode) // 'useGetPetById'\n * resolverReactQuery.mutation.name(operationNode) // 'useUpdatePet'\n * resolverReactQuery.query.keyName(operationNode) // 'getPetByIdQueryKey'\n * resolverReactQuery.query.optionsName(operationNode) // 'getPetByIdQueryOptions'\n * ```\n */\nexport const resolverReactQuery = createResolver<PluginReactQuery>({\n pluginName: 'plugin-react-query',\n name: resolveOperationName,\n query: createQueryResolver(),\n suspenseQuery: createQueryResolver('Suspense'),\n infiniteQuery: createQueryResolver('Infinite'),\n suspenseInfiniteQuery: createQueryResolver('SuspenseInfinite'),\n mutation: {\n ...createMutationResolver(),\n optionsName(node) {\n const name = `${this.name(node.operationId)}MutationOptions`\n return this.resolveName({ key: operationKey(node, 'mutation', 'optionsName'), name })\n },\n },\n hook: {\n optionsName() {\n return this.resolveName({ key: ['hook', 'options'], name: 'HookOptions' })\n },\n customOptionsName() {\n return this.resolveName({ key: ['hook', 'custom-options'], name: 'getCustomHookOptions' })\n },\n },\n})\n","import { addGenerator, defineExtension, Resolver, setMacros, setResolver, useConfig } from '@kubb/kit'\nimport { compatibility } from '../kubb-extension.json'\nimport { version } from '../package.json'\nimport { resolveContractClient } from '@internals/client'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { mutationKeyTransformer, queryKeyTransformer, resolveInfiniteConfig, resolveMutationConfig, resolveQueryConfig } from '@internals/tanstack-query'\nimport {\n customHookOptionsFileGenerator,\n hookOptionsGenerator,\n infiniteQueryGenerator,\n mutationGenerator,\n queryGenerator,\n suspenseInfiniteQueryGenerator,\n suspenseQueryGenerator,\n} from './generators'\nimport { resolverReactQuery } from './resolvers/resolverReactQuery.ts'\nimport type { PluginReactQuery, ResolverReactQuery } from './types.ts'\n\n/**\n * Canonical plugin name for `@kubb/plugin-react-query`. Used for driver lookups\n * and cross-plugin dependency references.\n */\nexport const pluginReactQueryName = 'plugin-react-query' satisfies PluginReactQuery['name']\n\n/**\n * Generates one TanStack Query hook per OpenAPI operation for React. Queries\n * become `useFoo`, with `useFooSuspense` and `useFooInfinite` variants.\n * Mutations become `useFoo`. Each hook is fully typed: query keys, input\n * variables, response data, and error shape all come from the spec.\n *\n * @example\n * ```ts\n * import { defineConfig } from 'kubb/config'\n * import { pluginTs } from '@kubb/plugin-ts'\n * import { pluginReactQuery } from '@kubb/plugin-react-query'\n *\n * export default defineConfig({\n * input: './petStore.yaml',\n * output: { path: './src/gen' },\n * plugins: [\n * pluginTs(),\n * pluginReactQuery({\n * output: { path: './hooks' },\n * suspense: {},\n * }),\n * ],\n * })\n * ```\n */\nexport const pluginReactQuery = defineExtension<PluginReactQuery>({\n kind: 'plugin',\n meta: { name: pluginReactQueryName, version, compatibility },\n dependencies: { [pluginTsName]: { optional: true } },\n setup(options) {\n const {\n output = { path: 'hooks', barrel: { type: 'named' } },\n group,\n exclude = [],\n include,\n override = [],\n suspense = false,\n infinite = false,\n mutation = {},\n query = {},\n mutationKey = mutationKeyTransformer,\n queryKey = queryKeyTransformer,\n customOptions,\n hooks = false,\n client,\n returnType = 'data',\n resolver: userResolver,\n macros: userMacros,\n } = options\n\n const resolver = userResolver ? Resolver.merge<ResolverReactQuery>(resolverReactQuery, userResolver) : resolverReactQuery\n\n setResolver(resolver)\n if (userMacros?.length) {\n setMacros(userMacros)\n }\n\n addGenerator(\n queryGenerator,\n suspenseQueryGenerator,\n infiniteQueryGenerator,\n suspenseInfiniteQueryGenerator,\n mutationGenerator,\n hookOptionsGenerator,\n customHookOptionsFileGenerator,\n )\n\n return {\n output,\n client: resolveContractClient({ plugin: pluginReactQueryName, client, plugins: useConfig().plugins }),\n returnType,\n queryKey,\n query: resolveQueryConfig(query, { importPath: '@tanstack/react-query' }),\n mutationKey,\n mutation: resolveMutationConfig(mutation, { importPath: '@tanstack/react-query' }),\n infinite: resolveInfiniteConfig(infinite),\n suspense,\n customOptions: customOptions ? { name: 'useCustomHookOptions', ...customOptions } : null,\n hooks,\n group: group ?? null,\n exclude,\n include,\n override,\n resolver,\n }\n },\n})\n\nexport default pluginReactQuery\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEqBA,MAAM,kBAAkB;AACxB,MAAM,kBAAkB;AACxB,MAAM,mBAAmB;AAyBzB,MAAM,mBAAmD;CACvD,OAAO;CACP,OAAO;CACP,QAAQ;AACV;AAGA,MAAM,kBAAkB;CAAC;CAAiB;CAAiB;AAAgB;;;;;;;;;;;;;;;;AAiB3E,SAAgB,cAAc,SAA0G;CACtI,MAAM,EAAE,QAAQ,gBAAgB;CAChC,MAAM,OAAO,SAAiB,YAAY,SAAS,IAAI;CAEvD,IAAI,WAAW,WAAW,WAAW,WAAW,WAAW,UAAU;EACnE,MAAM,aAAa,iBAAiB;EACpC,IAAI,CAAC,IAAI,UAAU,GACjB,OAAO;GACL,MAAM;GACN,MAAM,YAAY,KAAK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