@kubb/plugin-vue-query 5.13.1 → 5.13.3
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 +54 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -4
- package/dist/index.d.ts +2 -4
- package/dist/index.js +55 -36
- package/dist/index.js.map +1 -1
- package/package.json +3 -14
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["ast","file","ast","ast","Diagnostics","path","useKubb","operationKey","useKubb","pluginTsName","Diagnostics","ast.http.isOperation","ast.http.getRequestGroups","ast.http.responses.findPrimary","ast.schema.is","ast.schema.narrow","ast.schema.findProperties","ast.schema.getLiterals","ast.mediaType.getKind","ast.http.responses.filterSuccess","ast.mediaType.isStream","ast.http.responses.filterError","ast.http.groupParameters","ast.http.requestBody.getSchema","casing","casing","operationKey","useKubb","Diagnostics","code","File","ast.imports.asType","ast.http.getRequestGroups","createFunctionParameter","createObjectBindingPattern","createTypeLiteral","createFunctionParameters","ast.http.groupParameters","ast.http.responses.findPrimary","ast.mediaType.isJson","declarationPrinter","functionPrinter","callPrinter","createFunctionParameters","Function","declarationPrinter","functionPrinter","Url","createFunctionParameters","Function","Type","declarationPrinter","functionPrinter","ast.http.groupParameters","Url","ast.http.requestBody.getSchema","Function","Type","declarationPrinter","functionPrinter","callPrinter","Function","declarationPrinter","functionPrinter","callPrinter","Function","getComments","ast.http.isOperation","defineTemplate","File","functionPrinter","createFunctionParameters","Function","getComments","defineTemplate","ast.http.isOperation","ast.http.getRequestGroups","File","defineTemplate","ast.http.isOperation","File","createResolver","defineExtension","pluginTsName","Resolver","useConfig"],"sources":["../kubb-extension.json","../package.json","../../../internals/ast/src/http/requestBody.ts","../../../internals/ast/src/http/status.ts","../../../internals/ast/src/http/responses.ts","../../../internals/ast/src/http/index.ts","../../../internals/ast/src/imports.ts","../../../internals/ast/src/mediaType.ts","../../../internals/ast/src/schema.ts","../../../internals/client/src/resolveClient.ts","../../../internals/client/src/resolveClientOperation.ts","../../../internals/client/src/resolveOperationTypes.ts","../../../internals/utils/src/reserved.ts","../../../internals/utils/src/strings.ts","../../../internals/shared/src/operation.ts","../../../internals/shared/src/resolver.ts","../../../internals/tanstack-query/src/resolver.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/components/QueryKey.tsx","../src/components/QueryOptions.tsx","../src/components/Query.tsx","../src/templates/infiniteQuery.tsx","../src/components/Mutation.tsx","../src/templates/mutation.tsx","../src/templates/query.tsx","../src/resolvers/resolverVueQuery.ts","../src/plugin.ts"],"sourcesContent":["","","import type { OperationNode, SchemaNode } from '@kubb/ast'\n\n/** The schema of the first request body entry, else `undefined` when the operation takes no body. */\nexport function getSchema(node: Pick<OperationNode, 'requestBody'>): SchemaNode | undefined {\n return node.requestBody?.content?.[0]?.schema\n}\n","import type { ResponseNode, StatusCode } from '@kubb/ast'\n\ntype StatusInput = StatusCode | number | (string & {}) | Pick<ResponseNode, 'statusCode'>\n\nconst classByRange = new Map([\n ['1xx', 1],\n ['2xx', 2],\n ['3xx', 3],\n ['4xx', 4],\n ['5xx', 5],\n])\n\n/** The class digit of a status code or range: `2` for `201` and `2xx`, `null` for `default`. */\nfunction statusClass(input: StatusInput): number | null {\n const statusCode = typeof input === 'object' ? input.statusCode : input\n const rangeClass = classByRange.get(String(statusCode))\n if (rangeClass) return rangeClass\n const code = Number(statusCode)\n return Number.isNaN(code) ? null : Math.floor(code / 100)\n}\n\nexport { statusClass as getClass }\n\nexport function isSuccess(statusCode: StatusInput): boolean {\n return statusClass(statusCode) === 2\n}\n\nexport function isError(statusCode: StatusInput): boolean {\n const code = statusClass(statusCode)\n return code !== null && code >= 4\n}\n\n/** One concrete code for a status or range: `200` for `2xx` and `default`, the code itself otherwise. */\nexport function toCode(input: StatusInput): number {\n const statusCode = typeof input === 'object' ? input.statusCode : input\n const code = Number(statusCode)\n return Number.isNaN(code) ? (statusClass(statusCode) ?? 2) * 100 : code\n}\n","import { ast, type HttpOperationNode, type OperationNode, type ResponseNode, type SchemaNode } from '@kubb/ast'\nimport { isError, isSuccess } from './status.ts'\n\n/** The `4xx` and `5xx` responses, ranges included. */\nexport function filterError(node: Pick<HttpOperationNode, 'responses'>): Array<ResponseNode> {\n return node.responses.filter((response) => isError(response.statusCode))\n}\n\n/** The ref names the response bodies import, in order, with repeats. */\nexport function getImportedNames(responses: ReadonlyArray<ResponseNode>): Array<string> {\n return responses.flatMap((response) => (response.content ?? []).flatMap((entry) => (entry.schema ? ast.graph.getImportedNames(entry.schema) : [])))\n}\n\nexport function filterSuccess(node: Pick<HttpOperationNode, 'responses'>): Array<ResponseNode> {\n return node.responses.filter((response) => isSuccess(response.statusCode))\n}\n\n/** The success response a client returns: one with a body first, then an exact code over a `2xx` range. */\nexport function findPrimary(node: Pick<HttpOperationNode, 'responses'>): ResponseNode | null {\n const responses = filterSuccess(node)\n const withBody = responses.filter((response) => response.content?.some((entry) => entry.contentType))\n const candidates = withBody.length ? withBody : responses\n return candidates.find((response) => !Number.isNaN(Number(response.statusCode))) ?? candidates[0] ?? null\n}\n\n/** A union of refs to the success responses with a body, else every response with a body, else `null`. */\nexport function getUnion<TNode extends Pick<OperationNode, 'responses'>>(\n node: TNode,\n resolver: { response: { status(node: TNode, statusCode: ResponseNode['statusCode']): string } },\n): SchemaNode | null {\n const withSchema = node.responses.filter((response) => response.content?.some((entry) => entry.schema))\n const success = withSchema.filter((response) => isSuccess(response.statusCode))\n const responses = success.length > 0 ? success : withSchema\n if (responses.length === 0) return null\n\n return ast.factory.createSchema({\n type: 'union',\n members: responses.map((response) => ast.factory.createSchema({ type: 'ref', name: resolver.response.status(node, response.statusCode) })),\n })\n}\n","import { ast, type HttpOperationNode, type InputServer, type ParameterNode } from '@kubb/ast'\n\nexport const isOperation = ast.http.isOperation\nexport * as requestBody from './requestBody.ts'\nexport * as responses from './responses.ts'\nexport * as status from './status.ts'\n\n/** The server's URL when it is absolute and has no template variables, else `undefined`. */\nexport function getBaseURL(server: InputServer | undefined): string | undefined {\n if (!server || server.variables || server.url.includes('{') || !server.url.includes('://')) return undefined\n return URL.canParse(server.url) ? server.url : undefined\n}\n\n/** Computes once per key; generators visit the same node many times. */\nfunction cached<TKey extends object, TValue>(store: WeakMap<TKey, TValue>, key: TKey, compute: () => TValue): TValue {\n if (!store.has(key)) store.set(key, compute())\n return store.get(key)!\n}\n\ntype ParameterGroups = Record<'path' | 'query' | 'header' | 'cookie', Array<ParameterNode>>\n\n// Every plugin's generator visits the same node, so the groups are built once per node.\nconst parametersByNode = new WeakMap<Pick<HttpOperationNode, 'parameters'>, ParameterGroups>()\n\n/** The operation's parameters by location, with a `querystring` parameter in `query`. A repeated name keeps its first parameter. */\nexport function groupParameters(node: Pick<HttpOperationNode, 'parameters'>): ParameterGroups {\n return cached(parametersByNode, node, () => {\n const group = (...locations: Array<ParameterNode['in']>) => {\n const seen = new Set<string>()\n return locations.flatMap((location) =>\n node.parameters.filter((param) => {\n if (param.in !== location || seen.has(param.name)) return false\n seen.add(param.name)\n return true\n }),\n )\n }\n // A `querystring` parameter left whole, such as a JSON one, is sent as the query string, so it joins the query group.\n return { path: group('path'), query: group('query', 'querystring'), header: group('header'), cookie: group('cookie') }\n })\n}\n\nexport type RequestGroups = {\n path: boolean\n query: boolean\n body: boolean\n headers: boolean\n cookies: boolean\n /** `cookies` is never required: a browser sends its cookies itself. */\n required: { path: boolean; query: boolean; headers: boolean; body: boolean }\n /** No group holds a required member. */\n isOptional: boolean\n contentTypes: Array<string>\n /** More than one body media type has a schema, so a caller must pick one. */\n hasContentTypeChoice: boolean\n}\n\nconst requestGroupsByNode = new WeakMap<Pick<HttpOperationNode, 'parameters' | 'requestBody'>, RequestGroups>()\n\n/** Which request groups are present, which hold a required member, and the body's media types. Built once per operation. */\nexport function getRequestGroups(node: Pick<HttpOperationNode, 'parameters' | 'requestBody'>): RequestGroups {\n return cached(requestGroupsByNode, node, () => {\n const { path, query, header, cookie } = groupParameters(node)\n const content = node.requestBody?.content ?? []\n const body = Boolean(content[0]?.schema)\n const required = {\n path: path.some((param) => param.required),\n query: query.some((param) => param.required),\n headers: header.some((param) => param.required),\n body: body && node.requestBody?.required === true,\n }\n\n return {\n path: path.length > 0,\n query: query.length > 0,\n body,\n headers: header.length > 0,\n cookies: cookie.length > 0,\n required,\n isOptional: !required.path && !required.query && !required.headers && !required.body,\n contentTypes: content.map((entry) => entry.contentType),\n hasContentTypeChoice: content.filter((entry) => entry.schema).length > 1,\n }\n })\n}\n","import { file } from '@kubb/ast'\nimport type { ImportNode, ModuleName } from '@kubb/ast'\n\n/**\n * Returns the names of `imp`, each marked as a type, for an import that only types use.\n *\n * @example\n * ```tsx\n * <File.Import names={ast.imports.asType(imp)} path={imp.path} root={file.path} />\n * ```\n */\nexport function asType(imp: ImportNode): Array<ModuleName> {\n return file.getNames(imp).map((item) => ({ ...item, space: 'type' }))\n}\n","import { ast, type ContentNode, type SchemaNode } from '@kubb/ast'\n\ntype MediaTypeInput = string | { contentType: string }\n\nconst streamMediaTypes = new Set(['application/jsonl', 'application/x-ndjson', 'application/json-seq', 'text/event-stream'])\n\nexport const getBase = ast.mediaType.getBase\nexport const isJson = ast.mediaType.isJson\n\n/** Whether the media type is a stream of items: SSE, JSON Lines, or a `+json-seq` sequence. */\nexport function isStream(mediaType: MediaTypeInput): boolean {\n const baseType = getBase(mediaType)\n return streamMediaTypes.has(baseType) || (baseType.startsWith('application/') && baseType.endsWith('+json-seq'))\n}\n\ntype ContentEntry = { contentType: string; schema?: Pick<SchemaNode, 'type'> | null; stream?: ContentNode['stream'] }\n\nconst formKinds: Record<string, 'form' | 'urlencoded'> = { 'multipart/form-data': 'form', 'application/x-www-form-urlencoded': 'urlencoded' }\n\n/** How a client reads or sends a content entry, or `null` for another media type. A `blob` schema is `binary`. */\nexport function getKind(entry: string | ContentEntry): 'json' | 'form' | 'urlencoded' | 'text' | 'binary' | 'eventStream' | 'lineStream' | null {\n const content = typeof entry === 'string' ? { contentType: entry } : entry\n const baseType = getBase(content)\n if (!baseType) return null\n if (baseType === 'text/event-stream') return 'eventStream'\n // `multipart/mixed` with an `itemSchema` also has `stream`, but it is a stream of parts, not of JSON values.\n if (content.stream && isStream(content)) return 'lineStream'\n if (isJson(baseType)) return 'json'\n if (formKinds[baseType]) return formKinds[baseType]\n if (content.schema?.type === 'blob') return 'binary'\n if (baseType.startsWith('text/')) return 'text'\n if (baseType === 'application/octet-stream' || baseType === 'application/pdf' || /^(image|audio|video)\\//.test(baseType)) return 'binary'\n return null\n}\n","import { ast, type NumberSchemaNode } from '@kubb/ast'\n\nexport type IsOptions = ast.schema.IsOptions\nexport type SchemaFollow = ast.schema.SchemaFollow\nexport type SchemaKind = ast.schema.SchemaKind\n\nexport const applyOptionality = ast.schema.applyOptionality\nexport const types = ast.schema.types\nexport const narrow = ast.schema.narrow\nexport const find = ast.schema.find\nexport const getEmbeddedJson = ast.schema.getEmbeddedJson\nexport const is = ast.schema.is\nexport const getLiterals = ast.schema.getLiterals\nexport const inferDiscriminator = ast.schema.inferDiscriminator\nexport const findProperties = ast.schema.findProperties\n\n// Integer formats whose whole range is a safe integer. The 64-bit ranges are not, so they never become a bound.\nconst integerFormatRanges: Record<string, [min: number, max: number]> = {\n int8: [-(2 ** 7), 2 ** 7 - 1],\n uint8: [0, 2 ** 8 - 1],\n int16: [-(2 ** 15), 2 ** 15 - 1],\n uint16: [0, 2 ** 16 - 1],\n int32: [-(2 ** 31), 2 ** 31 - 1],\n uint32: [0, 2 ** 32 - 1],\n}\n\n/**\n * The tightest inclusive bounds of a number schema. An exclusive bound moves to the next point of `step` (`1` for an\n * integer), an integer bound rounds inward, and an integer bound past `Number.MAX_SAFE_INTEGER` is left out, since it\n * prints as a rounded or invalid literal. A number node also applies its `int8` to `uint32` format range and `multipleOf`.\n */\nexport function getNumberBounds({\n min,\n max,\n exclusive,\n type,\n format,\n multipleOf,\n integer = type === 'integer' || type === 'bigint',\n step,\n}: Pick<NumberSchemaNode, 'min' | 'max' | 'exclusive'> &\n Partial<Pick<NumberSchemaNode, 'type' | 'format' | 'multipleOf'>> & { integer?: boolean; step?: number }): {\n min?: number\n max?: number\n multipleOf?: number\n} {\n const range = integer && format ? integerFormatRanges[format] : undefined\n const grid = step ?? (integer ? 1 : undefined)\n const above = (bound: number) => (grid ? (Math.floor(bound / grid) + 1) * grid : bound)\n const below = (bound: number) => (grid ? (Math.ceil(bound / grid) - 1) * grid : bound)\n const tightest = (pick: (...bounds: Array<number>) => number, bounds: Array<number | undefined>) => {\n const usable = bounds.filter((bound): bound is number => bound !== undefined && (!integer || Number.isSafeInteger(bound)))\n return usable.length ? pick(...usable) : undefined\n }\n const lower = tightest(Math.max, [\n min !== undefined && integer ? Math.ceil(min) : min,\n exclusive?.min === undefined ? undefined : above(exclusive.min),\n range?.[0],\n ])\n const upper = tightest(Math.min, [\n max !== undefined && integer ? Math.floor(max) : max,\n exclusive?.max === undefined ? undefined : below(exclusive.max),\n range?.[1],\n ])\n const keepsStep = multipleOf !== undefined && (!integer || Number.isSafeInteger(multipleOf))\n return {\n ...(lower !== undefined ? { min: lower } : {}),\n ...(upper !== undefined ? { max: upper } : {}),\n ...(keepsStep ? { multipleOf } : {}),\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, plugin-ky, 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'` / `'ky'` / `'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` / `pluginKyName` / `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 pluginKyName = 'plugin-ky'\nexport const 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' | 'ky' | '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-fetch / plugin-axios / plugin-ky, 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 ky: pluginKyName,\n client: pluginClientName,\n}\n\n// Every contract client plugin, in auto-detect priority order.\nconst contractPlugins = [pluginFetchName, pluginAxiosName, pluginKyName, 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 !== undefined && Object.hasOwn(selectorToPlugin, 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', 'ky', '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' | 'ky' | '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`, `@kubb/plugin-ky`, 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 type { ast } from '@internals/ast'\nimport path from 'node:path'\nimport { operationKey, useKubb } from '@kubb/kit'\nimport type { Exclude, GeneratorContext, Include, Override } from '@kubb/kit'\nimport { pluginClientName } from './resolveClient.ts'\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 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, from the registered contract client plugin\n * (plugin-fetch, plugin-axios, or plugin-client). Returns `null` when the client plugin's `exclude` / `include` leaves this\n * operation out, since it then 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. With plugin-client they come from\n * the user's `importPath` module instead.\n *\n * Call it from a generator. The result is cached in `ctx.memo` per client plugin and operation, so the query, mutation and\n * MCP generators share it. `returnType` and `importPath` come from the client plugin's options after its `override` entries,\n * and `ctx.file()` finds its file, so a dependent's call and import match the `<op>` actually emitted.\n * Throws `KUBB_PLUGIN_NOT_FOUND` when `pluginName` is not in the config.\n */\nexport function resolveClientOperation({ node, pluginName }: { node: ast.OperationNode; pluginName: string }): ClientOperation | null {\n const ctx = useKubb<GeneratorContext>()\n\n return ctx.memo(`${pluginName}:clientOperation:${node.operationId}`, () => {\n const resolver = ctx.getResolver(pluginName)\n const pluginOptions = (ctx.requirePlugin(pluginName).options ?? {}) as ClientPluginOptions\n const { exclude, include, override } = pluginOptions\n const operationOptions = resolver.default.options(node, { options: pluginOptions, exclude, include, override })\n if (!operationOptions) return null\n\n const name = resolver.resolveName({ key: operationKey(node), name: resolver.name(node.operationId) })\n const file = ctx.file(node, { plugin: pluginName })\n const { importPath } = operationOptions\n\n return {\n name,\n path: file.path,\n clientPath: importPath === undefined ? path.resolve(ctx.root, '.kubb/client.ts') : resolveImportPath({ importPath, operationFile: file.path }),\n clientPathIsFile: importPath === undefined || isRelativeImport(importPath),\n returnType: operationOptions.returnType ?? 'full',\n // Only a custom `@kubb/plugin-client` module lacks the typed-headers result; the transports re-export the runtime.\n typedHeaders: importPath === undefined || pluginName !== pluginClientName,\n }\n })\n}\n","import type { ast } from '@internals/ast'\nimport { Diagnostics, type GeneratorContext, useKubb } from '@kubb/kit'\nimport { pluginTsName, type ResolverTs } from '@kubb/plugin-ts'\nimport type { PluginZod } 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\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 of the plugin that provides them.\n */\nexport type OperationTypeSource = OperationTypeNames & {\n /**\n * `plugin-ts` shaped resolver of the plugin that provides `types`.\n */\n resolver: 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 the current plugin when neither is available. Reads the current generator context.\n *\n * @example\n * ```ts\n * const types = resolveOperationTypes()\n * types.response.options(node) // 'GetPetByIdOptions', or 'GetPetByIdOptionsSchemaType' from zod\n * ```\n */\nexport function resolveOperationTypes(): OperationTypeSource {\n const ctx = useKubb<GeneratorContext>()\n const pluginName = ctx.plugin.name\n return ctx.memo(`operationTypes:${pluginName}`, () => {\n if (!ctx.getPlugin(pluginTsName) && !ctx.getPlugin(pluginZodName)?.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 // plugin-ts and `pluginZod({ inferred })` provide `types`, and kit picks the provider by priority.\n const resolver = ctx.getResolver('types')\n return { response: resolver.response, resolver }\n })\n}\n\ndeclare global {\n namespace Kubb {\n interface MemoRegistry {\n operationTypes: OperationTypeSource\n }\n }\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 { ast } from '@internals/ast'\nimport { jsDocEscape } from '@internals/utils'\nimport type { Resolver } from '@kubb/kit'\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(ast.http.getRequestGroups(node).contentTypes)\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\n/** How an operation streams its success responses, as {@link getStream} returns it. */\nexport type ResponseStream = {\n /** `event` for a whole typed event, `data` for a typed payload, `line` for a JSON Lines value. */\n shape: 'event' | 'data' | 'line' | null\n /** Whether events keep `data` as text: all of them, the named ones, or none. */\n textEvents: boolean | Array<string>\n /** Whether the primary success response offers `text/event-stream`. */\n hasEventStream: boolean\n /** Whether a success response offers a stream next to other content types. */\n hasVariant: boolean\n}\n\nconst isText = (schema: ast.SchemaNode | null | undefined) => !!schema && ast.schema.is(schema, 'text', { follow: ['ref'] })\n\nfunction getTextEvents(entry: ast.ContentNode, shape: ResponseStream['shape']): ResponseStream['textEvents'] {\n if (shape === 'data') return isText(entry.stream?.schema ?? entry.schema)\n if (shape !== 'event' || !entry.stream?.schema) return false\n\n const item = ast.ref.getSchema(entry.stream.schema)\n const events = 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(isText)\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 // An event without a fixed name cannot be told apart from the others.\n if (!eventNames.length || eventNames.some((values) => !values.length)) return false\n return [...new Set(eventNames.flat().map(String))]\n}\n\n/** How an operation streams its success responses, or `null` when none offers a stream. */\nexport function getStream(node: Pick<ast.HttpOperationNode, 'responses'>): ResponseStream | null {\n const entries = ast.http.responses.findPrimary(node)?.content ?? []\n const entry = entries.length === 1 ? entries[0] : undefined\n const kind = entry ? ast.mediaType.getKind(entry) : null\n const shape = kind === 'eventStream' ? (entry?.stream?.shape ?? 'data') : kind === 'lineStream' ? 'line' : null\n // Next to another type, a stream without a schema gets no typed variant, so it keeps the plain call.\n const hasEventStream = entries.some((item) => ast.mediaType.getKind(item) === 'eventStream' && (entries.length === 1 || !!item.schema))\n const hasVariant = ast.http.responses.filterSuccess(node).some((response) => {\n const variants = (response.content ?? []).filter((item) => item.schema)\n return variants.length > 1 && variants.some(ast.mediaType.isStream)\n })\n if (!shape && !hasEventStream && !hasVariant) return null\n\n return { shape, textEvents: entry ? getTextEvents(entry, shape) : false, hasEventStream, hasVariant }\n}\n\ntype ResponseType = 'blob' | 'text' | 'stream'\n\ntype ResponseContentEntry = { contentType: string; schema?: ast.SchemaNode | null; stream?: ast.ContentNode['stream'] }\n\nconst responseTypes: Partial<Record<NonNullable<ReturnType<typeof ast.mediaType.getKind>>, ResponseType>> = {\n eventStream: 'stream',\n lineStream: 'stream',\n binary: 'blob',\n text: 'text',\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 (ast.mediaType.getKind(baseType) === 'binary') {\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 kind = ast.mediaType.getKind(entry)\n const responseType = kind ? responseTypes[kind] : undefined\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 (ast.http.getRequestGroups(node).hasContentTypeChoice) {\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 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: ast.http.RequestGroups; names: Array<(typeof requestGroupOrder)[number]> } {\n const { isConfigurable = true } = options\n const groups = ast.http.getRequestGroups(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 = groups.hasContentTypeChoice\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}${groups.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 * 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 && ast.http.getRequestGroups(node).hasContentTypeChoice\n ? resolveContentTypeVariants(node.requestBody?.content ?? [], resolver.response.body(node))\n : []\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\n/**\n * One object schema for a list of parameters or response headers, with each schema inline.\n */\nexport function buildParamsSchema(params: Array<ast.ParameterNode>): ast.SchemaNode {\n return ast.factory.createSchema({\n type: 'object',\n // `primitive: 'object'` makes a printer emit an object schema and not a record.\n primitive: 'object',\n properties: params.map((param) => ast.factory.createProperty({ name: param.name, required: param.required, schema: param.schema })),\n })\n}\n\n/**\n * One object schema for the parameters of an operation, where each key points at the const of\n * that parameter. The const already has its optional wrapper, so every key is required here.\n */\nexport function buildParamRefsSchema({\n node,\n params,\n resolver,\n}: {\n node: ast.OperationNode\n params: Array<ast.ParameterNode>\n resolver: { param: { name(node: ast.OperationNode, param: ast.ParameterNode): string } }\n}): ast.SchemaNode {\n return ast.factory.createSchema({\n type: 'object',\n primitive: 'object',\n properties: params.map((param) =>\n ast.factory.createProperty({\n name: param.name,\n required: true,\n schema: ast.factory.createSchema({ type: 'ref', name: resolver.param.name(node, param) }),\n }),\n ),\n })\n}\n\ntype SchemaEntry = { schema: ast.SchemaNode; name: string; keysToOmit?: Array<string> | null }\n\n/**\n * The schemas a name with several content types needs: one per content type, then the union of\n * them under `baseName`.\n */\nexport function buildContentTypeEntries(\n entries: Array<ContentVariantInput>,\n baseName: string,\n decorate: (schema: ast.SchemaNode) => ast.SchemaNode = (schema) => schema,\n): Array<SchemaEntry> {\n const variants = resolveContentTypeVariants(entries, baseName)\n const union = ast.factory.createSchema({\n type: 'union',\n members: variants.map((variant) => ast.factory.createSchema({ type: 'ref', name: variant.name })),\n })\n\n return [\n ...variants.map((variant) => ({ schema: decorate(variant.schema), name: variant.name, keysToOmit: variant.keysToOmit })),\n { schema: union, name: baseName },\n ]\n}\n\n/**\n * The schema behind a response or error name: a union of the per-status schemas. Returns `null`\n * when a response is a `$ref` to a component whose name is already `name`, which would declare it twice.\n */\nexport function buildResponseUnionSchema({\n node,\n responses,\n name,\n resolver,\n fallbackUnknown,\n}: {\n node: ast.OperationNode\n responses: Array<ast.ResponseNode>\n name: string\n resolver: { name(name: string): string; response: { status(node: ast.OperationNode, statusCode: ast.StatusCode): string } }\n /**\n * Print an unknown schema when no response has one, so the name still resolves.\n */\n fallbackUnknown: boolean\n}): ast.SchemaNode | null {\n const importedNames = new Set(ast.http.responses.getImportedNames(responses).map((refName) => resolver.name(refName)))\n if (importedNames.has(name)) return null\n\n const members = responses.map((res) => ast.factory.createSchema({ type: 'ref', name: resolver.response.status(node, res.statusCode) }))\n if (members.length === 0) return fallbackUnknown ? ast.factory.createSchema({ type: 'unknown' }) : null\n\n return members.length === 1 ? members[0]! : ast.factory.createSchema({ type: 'union', members })\n}\n","import { ast } from '@internals/ast'\nimport { ensureValidVarName } from '@internals/utils'\nimport { casing, memo, useKubb } from '@kubb/kit'\nimport type { FileTarget, GeneratorContext, Group, Output, PrinterContext, Resolver, ResolverFileParams } 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/** `ctx.file(node)` for a file that no single node owns, such as `handlers.ts`: path, banner and footer from the current plugin. */\nexport function namedFile(entry: Pick<ResolverFileParams, 'name' | 'tag'> & { extname?: ResolverFileParams['extname'] }): FileTarget {\n const ctx = useKubb<GeneratorContext>()\n const { output, group } = ctx.options as { output: Output; group?: Group | null }\n const file = ctx.resolver.file({ extname: '.ts', ...entry, root: ctx.root, output, group: group ?? undefined })\n const fileContext = { output, config: ctx.config, file: { path: file.path, baseName: file.baseName } }\n\n return {\n baseName: file.baseName,\n path: file.path,\n meta: file.meta,\n banner: ctx.resolver.default.banner(ctx.meta, fileContext),\n footer: ctx.resolver.default.footer(ctx.meta, fileContext),\n }\n}\n\n/**\n * Names of the schemas in a circular reference chain, computed once per build. Reads the current context, so call it\n * in a generator or a printer factory.\n */\nexport function getCircularNames(): ReadonlySet<string> {\n return memo('circularNames:set', () => ast.graph.getCircularNames(useKubb<PrinterContext>().schemas))\n}\n\n/**\n * Names of the schemas whose type is `enum`, computed once per build. Reads the current context, so call it\n * in a generator or a printer factory.\n */\nexport function getEnumNames(): ReadonlySet<string> {\n return memo(\n 'enumNames:set',\n () => new Set(useKubb<PrinterContext>().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 type { ast } from '@internals/ast'\nimport { ensureValidVarName } from '@internals/utils'\nimport { casing, operationKey } from '@kubb/kit'\nimport type { 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/** A hook file: one of the query variants, or the mutation hook. */\nexport type HookFileVariant = QueryVariant | 'mutation'\n\n/**\n * A hook file's name before casing, such as `useGetPetByIdSuspense`. Built from the `operationId`, not the resolver's `name`,\n * so a `name` override renames hooks and leaves their files alone. Two operations with the same name get `usePetList2`.\n */\nexport function hookFileName({ resolver, node, variant = '' }: { resolver: Resolver; node: ast.OperationNode; variant?: HookFileVariant }): string {\n const name = `use${casing.capitalize(ensureValidVarName(casing.camel(node.operationId)))}${variant === 'mutation' ? '' : variant}`\n return resolver.resolveName({ key: operationKey(node, 'hookFile', variant), name, scope: 'file' })\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 } from '@internals/ast'\nimport { getResponseHeadersTypeNames, resolveOperationTypes } from '@internals/client'\nimport { resolveOperationTypeNames } from '@internals/shared'\nimport { code, Diagnostics, type FileTarget, type GeneratorContext, useKubb } from '@kubb/kit'\nimport type { ResolverTs } from '@kubb/plugin-ts'\nimport { File } from '@kubb/renderer-jsx'\nimport { type HookFileVariant, hookFileName } from '../resolver.ts'\nimport type { KubbReactNode } from '@kubb/renderer-jsx'\nimport type { ClientOperation, ReturnTypeOption } from '@internals/client'\n\ntype ResolveHookFileOptions = {\n /** The hook's variant, which names its file through `hookFileName`. */\n variant?: HookFileVariant\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: FileTarget\n tsResolver: ResolverTs\n contractOp: ClientOperation\n /** The imports of the operation type names, from the `types` provider. */\n typeImports: ReadonlyArray<ast.ImportNode>\n /**\n * The client's result type the hook names with `returnType: 'full'`.\n */\n resultTypeName: 'RequestResult' | 'RequestResultWithHeaders'\n returnType: ReturnTypeOption\n}\n\n/**\n * Resolves what every TanStack hook file shares: its file with banner and footer, and the type imports from the `types` provider.\n */\nexport function resolveHookFile(node: ast.OperationNode, options: ResolveHookFileOptions): ResolvedHookFile {\n const ctx = useKubb<GeneratorContext>()\n const { variant = '', contractOp, keyTypeName, extraTypeNames = [], returnType = 'data' } = options\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: ctx.resolver.pluginName,\n })\n }\n const types = resolveOperationTypes()\n const tsResolver = types.resolver\n const headerTypeNames = returnType === 'data' || !contractOp.typedHeaders ? [] : getResponseHeadersTypeNames({ node, types: tsResolver })\n\n const file = ctx.file(node, { name: hookFileName({ resolver: ctx.resolver, node, variant }) })\n const typeSource = ctx.from('types')\n const typeRefs = [\n typeSource.resolver.response.options(node),\n typeSource.resolver.response.responses(node),\n ...[\n ...headerTypeNames,\n ...extraTypeNames,\n ...resolveOperationTypeNames(node, tsResolver, {\n // The full result only names error statuses (in ResponseErrorConfig); success statuses are unused.\n responseStatusNames: returnType === 'data' ? undefined : 'error',\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 ].flatMap((typeName) => (typeName ? [typeSource.ref(node, typeName)] : [])),\n ]\n\n return {\n file,\n tsResolver,\n contractOp,\n typeImports: code.join(typeRefs).imports,\n resultTypeName: headerTypeNames.length ? 'RequestResultWithHeaders' : 'RequestResult',\n returnType,\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, contractOp, typeImports, resultTypeName } = hook\n\n return (\n <File {...file}>\n <File.Import names={[{ name: contractOp.name, space: 'value' }]} root={file.path} path={contractOp.path} />\n <File.Import\n names={['RequestConfig', 'ResponseErrorConfig', resultTypeName].map((name) => ({ name, space: 'type' as const }))}\n root={contractOp.clientPathIsFile ? file.path : undefined}\n path={contractOp.clientPath}\n />\n\n {imports}\n {typeImports.map((imp) => (\n <File.Import key={imp.path} names={ast.imports.asType(imp)} root={file.path} path={imp.path} />\n ))}\n\n {children}\n </File>\n )\n}\n","import { ast } from '@internals/ast'\nimport { getResponseContentTypeInfo, resolveErrorNames, resolveSuccessNames, buildClientOptionType, requestGroupOrder, getStream } from '@internals/shared'\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.\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 /**\n * Keeps headers optional for query key helpers, including operations with required headers.\n */\n optionalHeaders?: boolean\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, optionalHeaders = false, withContentType = false } = options\n const groups = ast.http.getRequestGroups(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: groups.required.path,\n query: groups.required.query,\n body: groups.body,\n headers: !optionalHeaders && groups.required.headers,\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, 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 && groups.hasContentTypeChoice) {\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(\n (key) => (!keys.includes(key) || (optionalHeaders && key === 'headers' && !groups.headers)) && (key !== 'cookies' || groups.cookies),\n )\n const optionsType = omittedKeys.length > 0 ? `Omit<${optionsName}, ${omittedKeys.map((key) => `'${key}'`).join(' | ')}>` : optionsName\n const paramType = optionalHeaders && names.includes('headers') ? `Omit<${optionsType}, 'headers'> & { headers?: ${optionsType}['headers'] }` : optionsType\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: paramType,\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 = ast.http.getRequestGroups(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 && groups.hasContentTypeChoice ? ['...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 = getStream(node)?.hasVariant ? `${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 (getStream(node)?.shape) 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 available to a query key transformer. Headers are available for custom keys\n * but excluded from the default key. Cookies stay excluded.\n */\nexport const queryKeyGroupOrder = ['path', 'query', 'body', 'headers'] 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 = ast.http.getRequestGroups(node)\n return queryKeyGroupOrder.some((key) => groups[key])\n}\n\n/**\n * Builds query key bindings for path, query, body, and optional headers. Custom transformers\n * can reference `headers` in returned code without changing the default key.\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, optionalHeaders: true })\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 (!ast.http.getRequestGroups(node).hasContentTypeChoice || !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 = ast.http.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 type { ast } from '@internals/ast'\nimport { getNestedAccessor } from '@internals/utils'\nimport type { ResolverTs } from '@kubb/plugin-ts'\nimport { createFunctionParameters, functionPrinter } from '@kubb/plugin-ts'\nimport { 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 <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 )\n}\n","import type { ast } from '@internals/ast'\nimport { Url } from '@kubb/kit'\nimport { createFunctionParameters, functionPrinter } from '@kubb/plugin-ts'\nimport { 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 <Function.Arrow name={name} export params={paramsSignature} singleLine>\n {`[${keys.join(', ')}] as const`}\n </Function.Arrow>\n {typeName && <Type export name={typeName}>{`ReturnType<typeof ${name}>`}</Type>}\n </>\n )\n}\n","import { ast } from '@internals/ast'\nimport { Url } from '@kubb/kit'\nimport type { PluginTs } from '@kubb/plugin-ts'\nimport { functionPrinter } from '@kubb/plugin-ts'\nimport { 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 <Function.Arrow name={name} export params={paramsSignature} singleLine>\n {`[${keys.join(', ')}] as const`}\n </Function.Arrow>\n <Type name={typeName} export={exportType}>{`ReturnType<typeof ${name}>`}</Type>\n </>\n )\n}\n","import type { ast } from '@internals/ast'\nimport type { FunctionParametersNode, ResolverTs } from '@kubb/plugin-ts'\nimport { functionPrinter } from '@kubb/plugin-ts'\nimport { Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx'\nimport { buildCallResultBody, buildClientCall, buildQueryKeyParams, buildQueryOptionsParams, buildResponseTypes } from '@internals/tanstack-query'\nimport type { CallReturnTypeProps } from '@internals/tanstack-query'\nimport { maybeRefOrGetter } from '../utils.ts'\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 getQueryOptionsParams(node: ast.OperationNode, options: { resolver: ResolverTs }): FunctionParametersNode {\n return buildQueryOptionsParams(node, { resolver: options.resolver, memberTypeWrapper: maybeRefOrGetter })\n}\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, memberTypeWrapper: maybeRefOrGetter })\n const queryKeyParamsCall = callPrinter.print(queryKeyParamsNode) ?? ''\n\n const paramsNode = getQueryOptionsParams(node, { resolver: tsResolver })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n const queryFnBody = buildCallResultBody(buildClientCall(node, { clientName, signal: true, unwrapName: (name) => `toValue(${name})` }), {\n clientReturnType,\n returnType,\n })\n\n return (\n <Function name={name} export params={paramsSignature}>\n {`\n const queryKey = ${queryKeyName}(${queryKeyParamsCall})\n return queryOptions<${TData}, ${TError}, ${TData}>({\n queryKey,\n queryFn: async ({ signal }) => {\n ${queryFnBody}\n },\n })\n`}\n </Function>\n )\n}\n","import type { ast } from '@internals/ast'\nimport type { ResolverTs } from '@kubb/plugin-ts'\nimport { functionPrinter } from '@kubb/plugin-ts'\nimport { Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx'\nimport { buildHookParams, buildQueryKeyParams, buildResponseTypes, maybeRefOrGetter } from '@internals/tanstack-query'\nimport type { HookResultProps } from '@internals/tanstack-query'\nimport { buildClientOptionType, getComments } from '../utils.ts'\nimport { getQueryOptionsParams } from './QueryOptions.tsx'\n\ntype Props = {\n name: string\n queryOptionsName: string\n queryKeyName: string\n queryKeyTypeName: string\n node: ast.OperationNode\n tsResolver: ResolverTs\n /**\n * Emits the `useInfiniteQuery` variant of the hook instead of `useQuery`.\n */\n infinite?: boolean\n} & HookResultProps\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\nconst callPrinter = functionPrinter({ mode: 'call' })\n\nexport function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, node, tsResolver, infinite, returnType, typedHeaders }: Props): KubbReactNode {\n const { TData, TError } = buildResponseTypes(node, tsResolver, { returnType, typedHeaders })\n const optionsName = infinite ? 'UseInfiniteQueryOptions' : 'UseQueryOptions'\n const hookName = infinite ? 'useInfiniteQuery' : 'useQuery'\n const resultType = `${infinite ? 'UseInfiniteQueryReturnType' : 'UseQueryReturnType'}<${['TData', TError].join(', ')}> & { queryKey: TQueryKey }`\n const generics = [\n infinite ? `TData = InfiniteData<${TData}>` : `TData = ${TData}`,\n `TQueryData = ${TData}`,\n `TQueryKey extends QueryKey = ${queryKeyTypeName}`,\n ]\n const optionsGenerics = infinite ? [TData, TError, 'TQueryData', 'TQueryKey', 'TQueryData'] : [TData, TError, 'TData', 'TQueryData', 'TQueryKey']\n const castGenerics = infinite ? [TData, TError, TData, 'TQueryKey', TData] : [TData, TError, 'TData', TData, 'TQueryKey']\n\n const queryKeyParamsNode = buildQueryKeyParams(node, { resolver: tsResolver, memberTypeWrapper: maybeRefOrGetter })\n const queryKeyParamsCall = callPrinter.print(queryKeyParamsNode) ?? ''\n\n const queryOptionsParamsNode = getQueryOptionsParams(node, { resolver: tsResolver })\n const queryOptionsParamsCall = callPrinter.print(queryOptionsParamsNode) ?? ''\n\n // Vue-query wraps each grouped operation param with MaybeRefOrGetter\n const paramsNode = buildHookParams(node, {\n resolver: tsResolver,\n memberTypeWrapper: maybeRefOrGetter,\n optionsType: `{\n query?: Partial<${optionsName}<${optionsGenerics.join(', ')}>> & { client?: QueryClient },\n client?: ${buildClientOptionType()}\n}`,\n })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n\n return (\n <Function name={name} export generics={generics.join(', ')} params={paramsSignature} JSDoc={{ comments: getComments(node) }}>\n {`\n const { query: queryConfig = {}, client: config = {} } = options ?? {}\n const { client: queryClient, ...resolvedOptions } = queryConfig\n const queryKey = (resolvedOptions && 'queryKey' in resolvedOptions ? toValue(resolvedOptions.queryKey) : undefined) ?? ${queryKeyName}(${queryKeyParamsCall})\n\n const queryResult = ${hookName}({\n ...${queryOptionsName}(${queryOptionsParamsCall}),\n ...resolvedOptions,\n queryKey\n } as unknown as ${optionsName}<${castGenerics.join(', ')}>, toValue(queryClient)) as ${resultType}\n\n queryResult.queryKey = queryKey as TQueryKey\n\n return queryResult\n `}\n </Function>\n )\n}\n","import { ast } from '@internals/ast'\nimport { 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 { defineTemplate } from '@kubb/kit'\nimport type { TemplateContext } from '@kubb/kit'\nimport { File } from '@kubb/renderer-jsx'\nimport { Query } from '../components/Query.tsx'\nimport { maybeRefOrGetter } from '../utils.ts'\nimport type { PluginVueQuery } from '../types'\n\n// The operations this template writes. Every other operation returns `null`.\nfunction matchesInfiniteQuery(node: ast.OperationNode, ctx: TemplateContext<PluginVueQuery>): boolean {\n if (!ast.http.isOperation(node)) return false\n const { query, mutation, infinite, hooks } = ctx.options\n\n const { isQuery, isMutation } = classifyOperation(node, { query, mutation })\n const infiniteOptions = infinite && typeof infinite === 'object' ? infinite : null\n if (!isQuery || isMutation || !infiniteOptions || !hooks) return false\n\n return matchesInfinite(node, infiniteOptions)\n}\n\n/**\n * Built-in template for `useInfiniteQuery` composables. Enabled when\n * `pluginVueQuery({ infinite: { ... }, hooks: true })`. Emits one\n * `useFooInfiniteQuery` composable per query operation, wiring the\n * configured cursor path into TanStack Query's cursor-based pagination.\n */\nexport const infiniteQueryOperation = defineTemplate<PluginVueQuery>({\n kind: ast.node.kinds.operation,\n render(node, ctx) {\n if (!matchesInfiniteQuery(node, ctx)) return null\n if (!ast.http.isOperation(node)) return null\n const { query, infinite, client } = ctx.options\n\n const infiniteOptions = infinite && typeof infinite === 'object' ? infinite : null\n if (!infiniteOptions) return null\n\n const pageParamsWarning = getDefaultPageParamsWarning(node, infiniteOptions)\n if (pageParamsWarning) ctx.warn(pageParamsWarning)\n\n const importPath = query ? query.importPath : '@tanstack/vue-query'\n\n // The registered contract client plugin owns the `<op>` the composable imports and calls.\n const contractOp = resolveClientOperation({ node, pluginName: client.pluginName })\n if (!contractOp) return null\n\n const queryName = ctx.resolver.infiniteQuery.name(node)\n const queryOptionsName = ctx.resolver.infiniteQuery.optionsName(node)\n const queryKeyName = ctx.resolver.infiniteQuery.keyName(node)\n const queryKeyTypeName = ctx.resolver.infiniteQuery.keyTypeName(node)\n\n const hook = resolveHookFile(node, {\n variant: 'Infinite',\n contractOp,\n returnType: ctx.options.returnType,\n keyTypeName: queryKeyTypeName,\n extraTypeNames: [\n resolvePageParamType(node, {\n resolver: resolveOperationTypes().resolver,\n initialPageParam: infiniteOptions.initialPageParam,\n queryParam: infiniteOptions.queryParam,\n }).queryParamsTypeName,\n ],\n })\n const { tsResolver } = hook\n\n return (\n <HookFile\n hook={hook}\n imports={\n <>\n <File.Import\n names={[\n { name: 'toValue', space: 'value' },\n { name: 'MaybeRefOrGetter', space: 'type' },\n ]}\n path=\"vue\"\n />\n </>\n }\n >\n <QueryKey\n name={queryKeyName}\n typeName={queryKeyTypeName}\n node={node}\n tsResolver={tsResolver}\n transformer={ctx.options.queryKey}\n variant=\"infiniteQuery\"\n memberTypeWrapper={maybeRefOrGetter}\n exportType\n />\n\n <File.Import\n names={[\n { name: 'infiniteQueryOptions', space: 'value' },\n { name: 'InfiniteData', space: 'type' },\n ]}\n path={importPath}\n />\n\n <InfiniteQueryOptions\n name={queryOptionsName}\n clientName={contractOp.name}\n queryKeyName={queryKeyName}\n node={node}\n tsResolver={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 queryKeyType=\"QueryKey\"\n memberTypeWrapper={maybeRefOrGetter}\n unwrapName={(name) => `toValue(${name})`}\n />\n\n <File.Import\n names={[\n { name: 'useInfiniteQuery', space: 'value' },\n { name: 'QueryKey', space: 'type' },\n { name: 'QueryClient', space: 'type' },\n { name: 'UseInfiniteQueryOptions', space: 'type' },\n { name: 'UseInfiniteQueryReturnType', space: 'type' },\n ]}\n path={importPath}\n />\n\n <Query\n name={queryName}\n queryOptionsName={queryOptionsName}\n queryKeyName={queryKeyName}\n queryKeyTypeName={queryKeyTypeName}\n node={node}\n tsResolver={tsResolver}\n infinite\n returnType={hook.returnType}\n typedHeaders={hook.contractOp.typedHeaders}\n />\n </HookFile>\n )\n },\n})\n","import type { ast } from '@internals/ast'\nimport type { FunctionParametersNode, ResolverTs } from '@kubb/plugin-ts'\nimport { createFunctionParameters, functionPrinter } from '@kubb/plugin-ts'\nimport { Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx'\nimport {\n buildCallResultBody,\n buildClientCall,\n buildGroupedRequestParam,\n buildHookParams,\n buildResponseTypes,\n resolveMutationRequestType,\n} from '@internals/tanstack-query'\nimport type { CallReturnTypeProps } from '@internals/tanstack-query'\nimport type { ReturnTypeOption } from '@internals/client'\nimport { buildRequestConfigType, getComments } from '../utils.ts'\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\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\n return buildHookParams(node, {\n resolver,\n withRequest: false,\n optionsType: `{\n mutation?: MutationObserverOptions<${[TData, TError, resolveMutationRequestType(node, resolver), 'TContext'].join(', ')}> & { client?: QueryClient },\n client?: ${buildRequestConfigType(node)},\n}`,\n })\n}\n\nexport function Mutation({ name, clientName, node, tsResolver, mutationKeyName, clientReturnType, returnType, typedHeaders }: Props): KubbReactNode {\n const { TData, TError } = buildResponseTypes(node, tsResolver, { returnType, typedHeaders })\n\n const groupedParam = buildGroupedRequestParam(node, { resolver: tsResolver, withContentType: true })\n const hasMutationParams = groupedParam !== null\n const groupedParamsNode = createFunctionParameters({ params: groupedParam ? [groupedParam] : [] })\n const argBindingStr = hasMutationParams ? (callPrinter.print(groupedParamsNode) ?? '') : ''\n const TRequest = resolveMutationRequestType(node, tsResolver)\n const mutationFnBody = buildCallResultBody(\n buildClientCall(node, {\n clientName,\n signal: false,\n withContentType: true,\n // Pin the payload type: an optional `value` property can otherwise drive Vue's ref inference.\n unwrapName: (name) => `toValue<${TRequest}['${name}']>(${name})`,\n }),\n { clientReturnType, returnType },\n )\n const generics = [TData, TError, TRequest, 'TContext'].join(', ')\n\n const paramsNode = buildMutationParamsNode(node, { resolver: tsResolver, returnType, typedHeaders })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n\n return (\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 return useMutation<${generics}>({\n mutationFn: async(${argBindingStr}) => {\n ${mutationFnBody}\n },\n mutationKey,\n ...mutationOptions\n }, queryClient)\n `}\n </Function>\n )\n}\n","import { ast } from '@internals/ast'\nimport { requestGroupOrder } from '@internals/shared'\nimport { resolveClientOperation } from '@internals/client'\nimport { classifyOperation, HookFile, MutationKey, resolveHookFile } from '@internals/tanstack-query'\nimport { defineTemplate } from '@kubb/kit'\nimport { File } from '@kubb/renderer-jsx'\nimport { Mutation } from '../components/Mutation.tsx'\nimport type { PluginVueQuery } from '../types'\n\n/**\n * Built-in template for `useMutation` composables. Emits one\n * `useFooMutation` composable per POST/PUT/DELETE operation (configurable\n * via `mutation.methods`) plus the matching `fooMutationKey` helper.\n */\nexport const mutationOperation = defineTemplate<PluginVueQuery>({\n kind: ast.node.kinds.operation,\n render(node, ctx) {\n if (!ast.http.isOperation(node)) return null\n const { query, mutation, client, hooks } = ctx.options\n\n const { isMutation } = classifyOperation(node, { query, mutation })\n\n if (!isMutation) return null\n\n const importPath = mutation ? mutation.importPath : '@tanstack/vue-query'\n\n // The registered contract client plugin owns the `<op>` the composable imports and calls.\n const contractOp = resolveClientOperation({ node, pluginName: client.pluginName })\n if (!contractOp) return null\n\n const mutationHookName = ctx.resolver.mutation.name(node)\n const mutationKeyName = ctx.resolver.mutation.keyName(node)\n\n const hook = resolveHookFile(node, { variant: 'mutation', contractOp, returnType: ctx.options.returnType })\n\n // The contract body unwraps each request group with `toValue()`, so it needs the runtime import.\n const groups = ast.http.getRequestGroups(node)\n const hasRequestGroups = requestGroupOrder.some((key) => groups[key])\n\n return (\n <HookFile\n hook={hook}\n imports={\n <>\n <File.Import\n names={[...(hasRequestGroups ? [{ name: 'toValue', space: 'value' as const }] : []), { name: 'MaybeRefOrGetter', space: 'type' }]}\n path=\"vue\"\n />\n </>\n }\n >\n <MutationKey name={mutationKeyName} node={node} transformer={ctx.options.mutationKey} />\n\n {mutation && hooks && (\n <>\n <File.Import\n names={[\n { name: 'useMutation', space: 'value' },\n { name: 'MutationObserverOptions', space: 'type' },\n { name: 'QueryClient', space: 'type' },\n ]}\n path={importPath}\n />\n <Mutation\n name={mutationHookName}\n clientName={contractOp.name}\n node={node}\n tsResolver={hook.tsResolver}\n mutationKeyName={mutationKeyName}\n clientReturnType={contractOp.returnType}\n returnType={hook.returnType}\n typedHeaders={hook.contractOp.typedHeaders}\n />\n </>\n )}\n </HookFile>\n )\n },\n})\n","import { ast } from '@internals/ast'\nimport { resolveClientOperation } from '@internals/client'\nimport { classifyOperation, HookFile, QueryKey, resolveHookFile } from '@internals/tanstack-query'\nimport { defineTemplate } from '@kubb/kit'\nimport { File } from '@kubb/renderer-jsx'\nimport { Query } from '../components/Query.tsx'\nimport { QueryOptions } from '../components/QueryOptions.tsx'\nimport { maybeRefOrGetter } from '../utils.ts'\nimport type { PluginVueQuery } from '../types'\n\n/**\n * Built-in template for `useQuery` composables. Emits one `useFooQuery`\n * composable per GET and QUERY operation (configurable via `query.methods`) plus the\n * matching `fooQueryKey` / `fooQueryOptions` helpers.\n */\nexport const queryOperation = defineTemplate<PluginVueQuery>({\n kind: ast.node.kinds.operation,\n render(node, ctx) {\n if (!ast.http.isOperation(node)) return null\n const { query, mutation, client, hooks } = ctx.options\n\n const { isQuery, isMutation } = classifyOperation(node, { query, mutation })\n\n if (!isQuery || isMutation) return null\n\n const importPath = query ? query.importPath : '@tanstack/vue-query'\n\n // The registered contract client plugin owns the `<op>` the composable imports and calls.\n const contractOp = resolveClientOperation({ node, pluginName: client.pluginName })\n if (!contractOp) return null\n\n const queryName = ctx.resolver.query.name(node)\n const queryOptionsName = ctx.resolver.query.optionsName(node)\n const queryKeyName = ctx.resolver.query.keyName(node)\n const queryKeyTypeName = ctx.resolver.query.keyTypeName(node)\n\n const hook = resolveHookFile(node, { contractOp, keyTypeName: queryKeyTypeName, returnType: ctx.options.returnType })\n const { tsResolver } = hook\n\n return (\n <HookFile\n hook={hook}\n imports={\n <>\n <File.Import\n names={[\n { name: 'toValue', space: 'value' },\n { name: 'MaybeRefOrGetter', space: 'type' },\n ]}\n path=\"vue\"\n />\n </>\n }\n >\n <QueryKey\n name={queryKeyName}\n typeName={queryKeyTypeName}\n node={node}\n tsResolver={tsResolver}\n transformer={ctx.options.queryKey}\n variant=\"query\"\n memberTypeWrapper={maybeRefOrGetter}\n exportType\n />\n\n <File.Import names={[{ name: 'queryOptions', space: 'value' }]} path={importPath} />\n\n <QueryOptions\n name={queryOptionsName}\n clientName={contractOp.name}\n queryKeyName={queryKeyName}\n node={node}\n tsResolver={tsResolver}\n clientReturnType={contractOp.returnType}\n returnType={hook.returnType}\n typedHeaders={hook.contractOp.typedHeaders}\n />\n\n {query && hooks && (\n <>\n <File.Import\n names={[\n { name: 'useQuery', space: 'value' },\n { name: 'QueryKey', space: 'type' },\n { name: 'QueryClient', space: 'type' },\n { name: 'UseQueryOptions', space: 'type' },\n { name: 'UseQueryReturnType', space: 'type' },\n ]}\n path={importPath}\n />\n <Query\n name={queryName}\n queryOptionsName={queryOptionsName}\n queryKeyName={queryKeyName}\n queryKeyTypeName={queryKeyTypeName}\n node={node}\n tsResolver={tsResolver}\n returnType={hook.returnType}\n typedHeaders={hook.contractOp.typedHeaders}\n />\n </>\n )}\n </HookFile>\n )\n },\n})\n","import { resolveOperationName } from '@internals/shared'\nimport { createMutationResolver, createQueryResolver } from '@internals/tanstack-query'\nimport { createResolver } from '@kubb/kit'\nimport type { PluginVueQuery } from '../types.ts'\n\n/**\n * Default resolver used by `@kubb/plugin-vue-query`. Decides the names and\n * file paths for every generated TanStack Query composable (`useFoo`,\n * `useFooInfinite`) and its companion helpers.\n *\n * The `default` helpers are supplied by `createResolver`. Functions use safe camelCase identifiers;\n * composables get the `use` prefix. Operation-specific naming is grouped under the `query`,\n * `infiniteQuery`, and `mutation` namespaces.\n *\n * @example Resolve composable and helper names\n * ```ts\n * import { resolverVueQuery } from '@kubb/plugin-vue-query'\n *\n * resolverVueQuery.query.name(operationNode) // 'useGetPetById'\n * resolverVueQuery.query.keyName(operationNode) // 'getPetByIdQueryKey'\n * resolverVueQuery.query.optionsName(operationNode) // 'getPetByIdQueryOptions'\n * ```\n */\nexport const resolverVueQuery = createResolver<PluginVueQuery>({\n pluginName: 'plugin-vue-query',\n name: resolveOperationName,\n query: createQueryResolver(),\n infiniteQuery: createQueryResolver('Infinite'),\n mutation: createMutationResolver(),\n})\n","import { addMacro, addTemplate, defineExtension, Resolver, setResolver, useConfig } from '@kubb/kit'\nimport { compatibility } from '../kubb-extension.json'\nimport { version } from '../package.json'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { mutationKeyTransformer, queryKeyTransformer, resolveInfiniteConfig, resolveMutationConfig, resolveQueryConfig } from '@internals/tanstack-query'\nimport { resolveContractClient } from '@internals/client'\nimport { infiniteQueryOperation, mutationOperation, queryOperation } from './templates'\nimport { resolverVueQuery } from './resolvers/resolverVueQuery.ts'\nimport type { PluginVueQuery, ResolverVueQuery } from './types.ts'\n\n/**\n * Canonical plugin name for `@kubb/plugin-vue-query`. Used for driver lookups\n * and cross-plugin dependency references.\n */\nexport const pluginVueQueryName = 'plugin-vue-query' satisfies PluginVueQuery['name']\n\n/**\n * Generates one TanStack Query composable per OpenAPI operation for Vue's\n * Composition API. Queries become `useFoo` (and optionally\n * `useFooInfinite`). Mutations become `useFoo` as well. Each composable\n * is fully typed end to end.\n *\n * @example\n * ```ts\n * import { defineConfig } from 'kubb/config'\n * import { pluginTs } from '@kubb/plugin-ts'\n * import { pluginVueQuery } from '@kubb/plugin-vue-query'\n *\n * export default defineConfig({\n * input: './petStore.yaml',\n * output: { path: './src/gen' },\n * plugins: [\n * pluginTs(),\n * pluginVueQuery({\n * output: { path: './hooks' },\n * }),\n * ],\n * })\n * ```\n */\nexport const pluginVueQuery = defineExtension<PluginVueQuery>({\n kind: 'plugin',\n meta: { name: pluginVueQueryName, 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 infinite = false,\n mutation = {},\n query = {},\n mutationKey = mutationKeyTransformer,\n queryKey = queryKeyTransformer,\n hooks = false,\n client,\n returnType = 'data',\n resolver: userResolver,\n macros: userMacros,\n } = options\n\n const resolver = userResolver ? Resolver.merge<ResolverVueQuery>(resolverVueQuery, ...[userResolver].flat()) : resolverVueQuery\n\n setResolver(resolver)\n addMacro(...(userMacros ?? []))\n\n addTemplate(queryOperation)\n addTemplate(infiniteQueryOperation)\n addTemplate(mutationOperation)\n\n return {\n output,\n client: resolveContractClient({ plugin: pluginVueQueryName, client, plugins: useConfig().plugins }),\n returnType,\n queryKey,\n query: resolveQueryConfig(query, { importPath: '@tanstack/vue-query' }),\n mutationKey,\n mutation: resolveMutationConfig(mutation, { importPath: '@tanstack/vue-query' }),\n infinite: resolveInfiniteConfig(infinite),\n hooks,\n group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AAA,UAAA,YAAA,CAAY,cAAc;EAC1B,CAAA,GAAA,UAAA,YAAA,CAAY,sBAAsB;EAClC,CAAA,GAAA,UAAA,YAAA,CAAY,iBAAiB;EAE7B,OAAO;GACL;GACA,QAAQ,sBAAsB;IAAE,QAAQ;IAAoB;IAAQ,UAAA,GAASC,UAAAA,UAAAA,CAAU,CAAC,CAAC;GAAQ,CAAC;GAClG;GACA;GACA,OAAO,mBAAmB,OAAO,EAAE,YAAY,sBAAsB,CAAC;GACtE;GACA,UAAU,sBAAsB,UAAU,EAAE,YAAY,sBAAsB,CAAC;GAC/E,UAAU,sBAAsB,QAAQ;GACxC;GACA,OAAO,SAAS;GAChB;GACA;GACA;GACA;EACF;CACF;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["ast","memo","file","ast","ast","Diagnostics","path","useKubb","operationKey","text","useKubb","pluginTsName","Diagnostics","text","ast.http.isOperation","ast.http.getRequestGroups","ast.http.responses.findPrimary","ast.schema.is","ast.schema.narrow","ast.schema.findProperties","ast.schema.getLiterals","ast.mediaType.getKind","ast.http.responses.filterSuccess","ast.mediaType.isStream","ast.http.responses.filterError","ast.http.groupParameters","ast.http.requestBody.getSchema","casing","casing","operationKey","useKubb","Diagnostics","code","File","ast.imports.asType","ast.http.getRequestGroups","createFunctionParameter","createObjectBindingPattern","createTypeLiteral","createFunctionParameters","ast.http.groupParameters","text","ast.http.responses.findPrimary","ast.mediaType.isJson","declarationPrinter","functionPrinter","callPrinter","createFunctionParameters","text","Function","declarationPrinter","functionPrinter","text","Url","createFunctionParameters","Function","Type","declarationPrinter","functionPrinter","ast.http.groupParameters","text","Url","ast.http.requestBody.getSchema","Function","Type","declarationPrinter","functionPrinter","callPrinter","Function","declarationPrinter","functionPrinter","callPrinter","Function","ast.http.isOperation","defineTemplate","File","functionPrinter","createFunctionParameters","Function","defineTemplate","ast.http.isOperation","ast.http.getRequestGroups","File","defineTemplate","ast.http.isOperation","File","createResolver","defineExtension","pluginTsName","Resolver","useConfig"],"sources":["../kubb-extension.json","../package.json","../../../internals/ast/src/http/requestBody.ts","../../../internals/ast/src/http/status.ts","../../../internals/ast/src/http/responses.ts","../../../internals/ast/src/http/index.ts","../../../internals/ast/src/imports.ts","../../../internals/ast/src/mediaType.ts","../../../internals/ast/src/schema.ts","../../../internals/client/src/resolveClient.ts","../../../internals/client/src/resolveClientOperation.ts","../../../internals/client/src/resolveOperationTypes.ts","../../../internals/utils/src/reserved.ts","../../../internals/utils/src/strings.ts","../../../internals/shared/src/operation.ts","../../../internals/shared/src/resolver.ts","../../../internals/tanstack-query/src/resolver.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/components/QueryKey.tsx","../src/components/QueryOptions.tsx","../src/components/Query.tsx","../src/templates/infiniteQuery.tsx","../src/components/Mutation.tsx","../src/templates/mutation.tsx","../src/templates/query.tsx","../src/resolvers/resolverVueQuery.ts","../src/plugin.ts"],"sourcesContent":["","","import type { OperationNode, SchemaNode } from '@kubb/ast'\n\n/** The schema of the first request body entry, else `undefined` when the operation takes no body. */\nexport function getSchema(node: Pick<OperationNode, 'requestBody'>): SchemaNode | undefined {\n return node.requestBody?.content?.[0]?.schema\n}\n","import type { ResponseNode, StatusCode } from '@kubb/ast'\n\nexport type StatusInput = StatusCode | number | (string & {}) | Pick<ResponseNode, 'statusCode'>\n\nconst classByRange = new Map([\n ['1xx', 1],\n ['2xx', 2],\n ['3xx', 3],\n ['4xx', 4],\n ['5xx', 5],\n])\n\n/** The class digit of a status code or range: `2` for `201` and `2xx`, `null` for `default`. */\nfunction statusClass(input: StatusInput): number | null {\n const statusCode = typeof input === 'object' ? input.statusCode : input\n const rangeClass = classByRange.get(String(statusCode))\n if (rangeClass) return rangeClass\n const code = Number(statusCode)\n return Number.isNaN(code) ? null : Math.floor(code / 100)\n}\n\nexport { statusClass as getClass }\n\nexport function isSuccess(statusCode: StatusInput): boolean {\n return statusClass(statusCode) === 2\n}\n\nexport function isError(statusCode: StatusInput): boolean {\n const code = statusClass(statusCode)\n return code !== null && code >= 4\n}\n\n/** One concrete code for a status or range: `200` for `2xx` and `default`, the code itself otherwise. */\nexport function toCode(input: StatusInput): number {\n const statusCode = typeof input === 'object' ? input.statusCode : input\n const code = Number(statusCode)\n return Number.isNaN(code) ? (statusClass(statusCode) ?? 2) * 100 : code\n}\n","import { ast, type HttpOperationNode, type OperationNode, type ResponseNode, type SchemaNode } from '@kubb/ast'\nimport { isError, isSuccess } from './status.ts'\n\n/** The `4xx` and `5xx` responses, ranges included. */\nexport function filterError(node: Pick<HttpOperationNode, 'responses'>): Array<ResponseNode> {\n return node.responses.filter((response) => isError(response.statusCode))\n}\n\n/** The ref names the response bodies import, in order, with repeats. */\nexport function getImportedNames(responses: ReadonlyArray<ResponseNode>): Array<string> {\n return responses.flatMap((response) => (response.content ?? []).flatMap((entry) => (entry.schema ? ast.graph.getImportedNames(entry.schema) : [])))\n}\n\nexport function filterSuccess(node: Pick<HttpOperationNode, 'responses'>): Array<ResponseNode> {\n return node.responses.filter((response) => isSuccess(response.statusCode))\n}\n\n/** The success response a client returns: one with a body first, then an exact code over a `2xx` range. */\nexport function findPrimary(node: Pick<HttpOperationNode, 'responses'>): ResponseNode | null {\n const responses = filterSuccess(node)\n const withBody = responses.filter((response) => response.content?.some((entry) => entry.contentType))\n const candidates = withBody.length ? withBody : responses\n return candidates.find((response) => !Number.isNaN(Number(response.statusCode))) ?? candidates[0] ?? null\n}\n\n/** A union of refs to the success responses with a body, else every response with a body, else `null`. */\nexport function getUnion<TNode extends Pick<OperationNode, 'responses'>>(\n node: TNode,\n resolver: { response: { status(node: TNode, statusCode: ResponseNode['statusCode']): string } },\n): SchemaNode | null {\n const withSchema = node.responses.filter((response) => response.content?.some((entry) => entry.schema))\n const success = withSchema.filter((response) => isSuccess(response.statusCode))\n const responses = success.length > 0 ? success : withSchema\n if (responses.length === 0) return null\n\n return ast.factory.createSchema({\n type: 'union',\n members: responses.map((response) => ast.factory.createSchema({ type: 'ref', name: resolver.response.status(node, response.statusCode) })),\n })\n}\n","import { ast, type HttpOperationNode, type InputServer, type ParameterNode } from '@kubb/ast'\nimport { memo } from '@kubb/kit'\n\nexport const isOperation = ast.http.isOperation\nexport * as requestBody from './requestBody.ts'\nexport * as responses from './responses.ts'\nexport * as status from './status.ts'\n\n/** The server's URL when it is absolute and has no template variables, else `undefined`. */\nexport function getBaseURL(server: InputServer | undefined): string | undefined {\n if (!server || server.variables || server.url.includes('{') || !server.url.includes('://')) return undefined\n return URL.canParse(server.url) ? server.url : undefined\n}\n\nexport type ParameterGroups = Record<'path' | 'query' | 'header' | 'cookie', Array<ParameterNode>>\n\n// Every plugin's generator visits the same node, so the groups are built once per node.\nconst parametersByNode = new WeakMap<Pick<HttpOperationNode, 'parameters'>, ParameterGroups>()\n\n/** The operation's parameters by location, with a `querystring` parameter in `query`. A repeated name keeps its first parameter. */\nexport function groupParameters(node: Pick<HttpOperationNode, 'parameters'>): ParameterGroups {\n return memo(parametersByNode, node, () => {\n const group = (...locations: Array<ParameterNode['in']>) => {\n const seen = new Set<string>()\n return locations.flatMap((location) =>\n node.parameters.filter((param) => {\n if (param.in !== location || seen.has(param.name)) return false\n seen.add(param.name)\n return true\n }),\n )\n }\n // A `querystring` parameter left whole, such as a JSON one, is sent as the query string, so it joins the query group.\n return { path: group('path'), query: group('query', 'querystring'), header: group('header'), cookie: group('cookie') }\n })\n}\n\nexport type RequestGroups = {\n path: boolean\n query: boolean\n body: boolean\n headers: boolean\n cookies: boolean\n /** `cookies` is never required: a browser sends its cookies itself. */\n required: { path: boolean; query: boolean; headers: boolean; body: boolean }\n /** No group holds a required member. */\n isOptional: boolean\n contentTypes: Array<string>\n /** More than one body media type has a schema, so a caller must pick one. */\n hasContentTypeChoice: boolean\n}\n\nconst requestGroupsByNode = new WeakMap<Pick<HttpOperationNode, 'parameters' | 'requestBody'>, RequestGroups>()\n\n/** Which request groups are present, which hold a required member, and the body's media types. Built once per operation. */\nexport function getRequestGroups(node: Pick<HttpOperationNode, 'parameters' | 'requestBody'>): RequestGroups {\n return memo(requestGroupsByNode, node, () => {\n const { path, query, header, cookie } = groupParameters(node)\n const content = node.requestBody?.content ?? []\n const body = Boolean(content[0]?.schema)\n const required = {\n path: path.some((param) => param.required),\n query: query.some((param) => param.required),\n headers: header.some((param) => param.required),\n body: body && node.requestBody?.required === true,\n }\n\n return {\n path: path.length > 0,\n query: query.length > 0,\n body,\n headers: header.length > 0,\n cookies: cookie.length > 0,\n required,\n isOptional: !required.path && !required.query && !required.headers && !required.body,\n contentTypes: content.map((entry) => entry.contentType),\n hasContentTypeChoice: content.filter((entry) => entry.schema).length > 1,\n }\n })\n}\n","import { file } from '@kubb/ast'\nimport type { ImportNode, ModuleName } from '@kubb/ast'\n\n/**\n * Returns the names of `imp`, each marked as a type, for an import that only types use.\n *\n * @example\n * ```tsx\n * <File.Import names={ast.imports.asType(imp)} path={imp.path} root={file.path} />\n * ```\n */\nexport function asType(imp: ImportNode): Array<ModuleName> {\n return file.getNames(imp).map((item) => ({ ...item, space: 'type' }))\n}\n","import { ast, type ContentNode, type SchemaNode } from '@kubb/ast'\n\nexport type MediaTypeInput = string | { contentType: string }\n\nconst streamMediaTypes = new Set(['application/jsonl', 'application/x-ndjson', 'application/json-seq', 'text/event-stream'])\n\nexport const getBase = ast.mediaType.getBase\nexport const isJson = ast.mediaType.isJson\n\n/** Whether the media type is a stream of items: SSE, JSON Lines, or a `+json-seq` sequence. */\nexport function isStream(mediaType: MediaTypeInput): boolean {\n const baseType = getBase(mediaType)\n return streamMediaTypes.has(baseType) || (baseType.startsWith('application/') && baseType.endsWith('+json-seq'))\n}\n\nexport type ContentEntry = { contentType: string; schema?: Pick<SchemaNode, 'type'> | null; stream?: ContentNode['stream'] }\n\nconst formKinds: Record<string, 'form' | 'urlencoded'> = { 'multipart/form-data': 'form', 'application/x-www-form-urlencoded': 'urlencoded' }\n\n/** How a client reads or sends a content entry, or `null` for another media type. A `blob` schema is `binary`. */\nexport function getKind(entry: string | ContentEntry): 'json' | 'form' | 'urlencoded' | 'text' | 'binary' | 'eventStream' | 'lineStream' | null {\n const content = typeof entry === 'string' ? { contentType: entry } : entry\n const baseType = getBase(content)\n if (!baseType) return null\n if (baseType === 'text/event-stream') return 'eventStream'\n // `multipart/mixed` with an `itemSchema` also has `stream`, but it is a stream of parts, not of JSON values.\n if (content.stream && isStream(content)) return 'lineStream'\n if (isJson(baseType)) return 'json'\n if (formKinds[baseType]) return formKinds[baseType]\n if (content.schema?.type === 'blob') return 'binary'\n if (baseType.startsWith('text/')) return 'text'\n if (baseType === 'application/octet-stream' || baseType === 'application/pdf' || /^(image|audio|video)\\//.test(baseType)) return 'binary'\n return null\n}\n","import { ast, type NumberSchemaNode } from '@kubb/ast'\n\nexport type IsOptions = ast.schema.IsOptions\nexport type SchemaFollow = ast.schema.SchemaFollow\nexport type SchemaKind = ast.schema.SchemaKind\n\nexport const applyOptionality = ast.schema.applyOptionality\nexport const types = ast.schema.types\nexport const narrow = ast.schema.narrow\nexport const find = ast.schema.find\nexport const getEmbeddedJson = ast.schema.getEmbeddedJson\nexport const is = ast.schema.is\nexport const getLiterals = ast.schema.getLiterals\nexport const inferDiscriminator = ast.schema.inferDiscriminator\nexport const findProperties = ast.schema.findProperties\n\n// Integer formats whose whole range is a safe integer. The 64-bit ranges are not, so they never become a bound.\nconst integerFormatRanges: Record<string, [min: number, max: number]> = {\n int8: [-(2 ** 7), 2 ** 7 - 1],\n uint8: [0, 2 ** 8 - 1],\n int16: [-(2 ** 15), 2 ** 15 - 1],\n uint16: [0, 2 ** 16 - 1],\n int32: [-(2 ** 31), 2 ** 31 - 1],\n uint32: [0, 2 ** 32 - 1],\n}\n\n/**\n * The tightest inclusive bounds of a number schema. An exclusive bound moves to the next point of `step` (`1` for an\n * integer), an integer bound rounds inward, and an integer bound past `Number.MAX_SAFE_INTEGER` is left out, since it\n * prints as a rounded or invalid literal. A number node also applies its `int8` to `uint32` format range and `multipleOf`.\n */\nexport function getNumberBounds({\n min,\n max,\n exclusive,\n type,\n format,\n multipleOf,\n integer = type === 'integer' || type === 'bigint',\n step,\n}: Pick<NumberSchemaNode, 'min' | 'max' | 'exclusive'> &\n Partial<Pick<NumberSchemaNode, 'type' | 'format' | 'multipleOf'>> & { integer?: boolean; step?: number }): {\n min?: number\n max?: number\n multipleOf?: number\n} {\n const range = integer && format ? integerFormatRanges[format] : undefined\n const grid = step ?? (integer ? 1 : undefined)\n const above = (bound: number) => (grid ? (Math.floor(bound / grid) + 1) * grid : bound)\n const below = (bound: number) => (grid ? (Math.ceil(bound / grid) - 1) * grid : bound)\n const tightest = (pick: (...bounds: Array<number>) => number, bounds: Array<number | undefined>) => {\n const usable = bounds.filter((bound): bound is number => bound !== undefined && (!integer || Number.isSafeInteger(bound)))\n return usable.length ? pick(...usable) : undefined\n }\n const lower = tightest(Math.max, [\n min !== undefined && integer ? Math.ceil(min) : min,\n exclusive?.min === undefined ? undefined : above(exclusive.min),\n range?.[0],\n ])\n const upper = tightest(Math.min, [\n max !== undefined && integer ? Math.floor(max) : max,\n exclusive?.max === undefined ? undefined : below(exclusive.max),\n range?.[1],\n ])\n const keepsStep = multipleOf !== undefined && (!integer || Number.isSafeInteger(multipleOf))\n return {\n ...(lower !== undefined ? { min: lower } : {}),\n ...(upper !== undefined ? { max: upper } : {}),\n ...(keepsStep ? { multipleOf } : {}),\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, plugin-ky, 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'` / `'ky'` / `'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` / `pluginKyName` / `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 pluginKyName = 'plugin-ky'\nexport const 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' | 'ky' | '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-fetch / plugin-axios / plugin-ky, 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 ky: pluginKyName,\n client: pluginClientName,\n}\n\n// Every contract client plugin, in auto-detect priority order.\nconst contractPlugins = [pluginFetchName, pluginAxiosName, pluginKyName, 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 !== undefined && Object.hasOwn(selectorToPlugin, 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', 'ky', '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' | 'ky' | '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`, `@kubb/plugin-ky`, 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 type { ast } from '@internals/ast'\nimport path from 'node:path'\nimport { operationKey, useKubb } from '@kubb/kit'\nimport type { Exclude, GeneratorContext, Include, Override } from '@kubb/kit'\nimport { pluginClientName } from './resolveClient.ts'\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 and plugin-ky, 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 /** The local name a consumer calls. `moduleName` imports it, under an alias when a consumer binding would shadow the export. */\n name: string\n moduleName: ast.ModuleName\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 returnType?: ReturnTypeOption\n importPath?: string\n exclude?: Array<Exclude>\n include?: Array<Include>\n override?: Array<Override<Omit<ClientPluginOptions, 'override'>>>\n}\n\n// Names the hook and MCP handler bodies bind around the client call, which would shadow an operation of the same name.\nconst consumerBindings = new Set([\n 'path',\n 'query',\n 'body',\n 'headers',\n 'cookies',\n 'config',\n 'signal',\n 'variables',\n 'options',\n 'ctx',\n 'res',\n 'pageParam',\n 'queryKey',\n 'mutationKey',\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, from the registered contract client plugin\n * (plugin-fetch, plugin-axios, plugin-ky, or plugin-client). Returns `null` when the client plugin's `exclude` / `include` leaves this\n * operation out, since it then emits no `<op>` to import. plugin-fetch, plugin-axios and plugin-ky inject `.kubb/client.ts` at the global\n * output root, the same path consumers read `RequestConfig` / `ResponseErrorConfig` from. With plugin-client they come from\n * the user's `importPath` module instead.\n *\n * Call it from a generator. The result is cached in `ctx.memo` per client plugin and operation, so the query, mutation and\n * MCP generators share it. `returnType` and `importPath` come from the client plugin's options after its `override` entries,\n * and `ctx.file()` finds its file, so a dependent's call and import match the `<op>` actually emitted.\n * Throws `KUBB_PLUGIN_NOT_FOUND` when `pluginName` is not in the config.\n */\nexport function resolveClientOperation({ node, pluginName }: { node: ast.OperationNode; pluginName: string }): ClientOperation | null {\n const ctx = useKubb<GeneratorContext>()\n\n return ctx.memo(`${pluginName}:clientOperation:${node.operationId}`, () => {\n const resolver = ctx.getResolver(pluginName)\n const pluginOptions = (ctx.requirePlugin(pluginName).options ?? {}) as ClientPluginOptions\n const { exclude, include, override } = pluginOptions\n const operationOptions = resolver.default.options(node, { options: pluginOptions, exclude, include, override })\n if (!operationOptions) return null\n\n const importName = resolver.resolveName({ key: operationKey(node), name: resolver.name(node.operationId) })\n const name = consumerBindings.has(importName) ? `${importName}Request` : importName\n const file = ctx.file(node, { plugin: pluginName })\n const { importPath } = operationOptions\n\n return {\n name,\n moduleName: { name: importName, alias: name === importName ? undefined : name, space: 'value' as const },\n path: file.path,\n clientPath: importPath === undefined ? path.resolve(ctx.root, '.kubb/client.ts') : resolveImportPath({ importPath, operationFile: file.path }),\n clientPathIsFile: importPath === undefined || isRelativeImport(importPath),\n returnType: operationOptions.returnType ?? 'full',\n // Only a custom `@kubb/plugin-client` module lacks the typed-headers result; the transports re-export the runtime.\n typedHeaders: importPath === undefined || pluginName !== pluginClientName,\n }\n })\n}\n","import type { ast } from '@internals/ast'\nimport { Diagnostics, type GeneratorContext, text, useKubb } from '@kubb/kit'\nimport { pluginTsName, type ResolverTs } from '@kubb/plugin-ts'\nimport type { PluginZod } 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\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]) => `${text.quote(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 of the plugin that provides them.\n */\nexport type OperationTypeSource = OperationTypeNames & {\n /**\n * `plugin-ts` shaped resolver of the plugin that provides `types`.\n */\n resolver: 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 the current plugin when neither is available. Reads the current generator context.\n *\n * @example\n * ```ts\n * const types = resolveOperationTypes()\n * types.response.options(node) // 'GetPetByIdOptions', or 'GetPetByIdOptionsSchemaType' from zod\n * ```\n */\nexport function resolveOperationTypes(): OperationTypeSource {\n const ctx = useKubb<GeneratorContext>()\n const pluginName = ctx.plugin.name\n return ctx.memo(`operationTypes:${pluginName}`, () => {\n if (!ctx.getPlugin(pluginTsName) && !ctx.getPlugin(pluginZodName)?.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 // plugin-ts and `pluginZod({ inferred })` provide `types`, and kit picks the provider by priority.\n const resolver = ctx.getResolver('types')\n return { response: resolver.response, resolver }\n })\n}\n\ndeclare global {\n namespace Kubb {\n interface MemoRegistry {\n operationTypes: OperationTypeSource\n }\n }\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 { Diagnostics, 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 } = (() => {\n try {\n return toRegExp(cleaned, matchedFlags)\n } catch (error) {\n // A spec `pattern` in another regex dialect would otherwise surface as a bare `SyntaxError` with no hint of its origin.\n throw new Diagnostics.Error({\n code: Diagnostics.code.invalidSpec,\n severity: 'error',\n message: `The pattern ${JSON.stringify(raw)} is not a valid JavaScript regular expression.`,\n help: 'Rewrite the `pattern` in ECMAScript syntax. Inline flags such as `(?i)` are only read at the start, as `^(?i)`.',\n cause: error instanceof Error ? error : undefined,\n })\n }\n })()\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.map((part) => `?.[${text.quote(part)}]`).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\n// Escapes the literal segments of an OpenAPI path for a template literal, and keeps the `{param}` placeholders.\nexport function templatePathEscape(path: string): string {\n return path\n .split(/(\\{[^}]+\\})/)\n .map((part, index) => (index % 2 === 0 ? part.replace(/[\\\\`$]/g, '\\\\$&') : part))\n .join('')\n}\n","import { ast } from '@internals/ast'\nimport { jsDocEscape } from '@internals/utils'\nimport { casing, type Resolver } from '@kubb/kit'\n\nexport type ContentTypeInfo = {\n contentTypes: Array<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: Array<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(ast.http.getRequestGroups(node).contentTypes)\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\n/** How an operation streams its success responses, as {@link getStream} returns it. */\nexport type ResponseStream = {\n /** `event` for a whole typed event, `data` for a typed payload, `line` for a JSON Lines value. */\n shape: 'event' | 'data' | 'line' | null\n /** Whether events keep `data` as text: all of them, the named ones, or none. */\n textEvents: boolean | Array<string>\n /** Whether the primary success response offers `text/event-stream`. */\n hasEventStream: boolean\n /** Whether a success response offers a stream next to other content types. */\n hasVariant: boolean\n}\n\nconst isText = (schema: ast.SchemaNode | null | undefined) => !!schema && ast.schema.is(schema, 'text', { follow: ['ref'] })\n\nfunction getTextEvents(entry: ast.ContentNode, shape: ResponseStream['shape']): ResponseStream['textEvents'] {\n if (shape === 'data') return isText(entry.stream?.schema ?? entry.schema)\n if (shape !== 'event' || !entry.stream?.schema) return false\n\n const item = ast.ref.getSchema(entry.stream.schema)\n const events = 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(isText)\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 // An event without a fixed name cannot be told apart from the others.\n if (!eventNames.length || eventNames.some((values) => !values.length)) return false\n return [...new Set(eventNames.flat().map(String))]\n}\n\n/** How an operation streams its success responses, or `null` when none offers a stream. */\nexport function getStream(node: Pick<ast.HttpOperationNode, 'responses'>): ResponseStream | null {\n const entries = ast.http.responses.findPrimary(node)?.content ?? []\n const entry = entries.length === 1 ? entries[0] : undefined\n const kind = entry ? ast.mediaType.getKind(entry) : null\n const shape = kind === 'eventStream' ? (entry?.stream?.shape ?? 'data') : kind === 'lineStream' ? 'line' : null\n // Next to another type, a stream without a schema gets no typed variant, so it keeps the plain call.\n const hasEventStream = entries.some((item) => ast.mediaType.getKind(item) === 'eventStream' && (entries.length === 1 || !!item.schema))\n const hasVariant = ast.http.responses.filterSuccess(node).some((response) => {\n const variants = (response.content ?? []).filter((item) => item.schema)\n return variants.length > 1 && variants.some(ast.mediaType.isStream)\n })\n if (!shape && !hasEventStream && !hasVariant) return null\n\n return { shape, textEvents: entry ? getTextEvents(entry, shape) : false, hasEventStream, hasVariant }\n}\n\ntype ResponseType = 'blob' | 'text' | 'stream'\n\nexport type ResponseContentEntry = { contentType: string; schema?: ast.SchemaNode | null; stream?: ast.ContentNode['stream'] }\n\nconst responseTypes: Partial<Record<NonNullable<ReturnType<typeof ast.mediaType.getKind>>, ResponseType>> = {\n eventStream: 'stream',\n lineStream: 'stream',\n binary: 'blob',\n text: 'text',\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(casing.capitalize).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 (ast.mediaType.getKind(baseType) === 'binary') {\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 kind = ast.mediaType.getKind(entry)\n const responseType = kind ? responseTypes[kind] : undefined\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 (ast.http.getRequestGroups(node).hasContentTypeChoice) {\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 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: ast.http.RequestGroups; names: Array<(typeof requestGroupOrder)[number]> } {\n const { isConfigurable = true } = options\n const groups = ast.http.getRequestGroups(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 = groups.hasContentTypeChoice\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}${groups.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 ${jsDocEscape(node.description)}`,\n node.summary && `@summary ${jsDocEscape(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 * 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 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 && ast.http.getRequestGroups(node).hasContentTypeChoice\n ? resolveContentTypeVariants(node.requestBody?.content ?? [], resolver.response.body(node))\n : []\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): Array<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): Array<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): Array<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): Array<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\n/**\n * One object schema for a list of parameters or response headers, with each schema inline.\n */\nexport function buildParamsSchema(params: Array<ast.ParameterNode>): ast.SchemaNode {\n return ast.factory.createSchema({\n type: 'object',\n // `primitive: 'object'` makes a printer emit an object schema and not a record.\n primitive: 'object',\n properties: params.map((param) => ast.factory.createProperty({ name: param.name, required: param.required, schema: param.schema })),\n })\n}\n\n/**\n * One object schema for the parameters of an operation, where each key points at the const of\n * that parameter. The const already has its optional wrapper, so every key is required here.\n */\nexport function buildParamRefsSchema({\n node,\n params,\n resolver,\n}: {\n node: ast.OperationNode\n params: Array<ast.ParameterNode>\n resolver: { param: { name(node: ast.OperationNode, param: ast.ParameterNode): string } }\n}): ast.SchemaNode {\n return ast.factory.createSchema({\n type: 'object',\n primitive: 'object',\n properties: params.map((param) =>\n ast.factory.createProperty({\n name: param.name,\n required: true,\n schema: ast.factory.createSchema({ type: 'ref', name: resolver.param.name(node, param) }),\n }),\n ),\n })\n}\n\nexport type SchemaEntry = { schema: ast.SchemaNode; name: string; keysToOmit?: Array<string> | null }\n\n/**\n * The schemas a name with several content types needs: one per content type, then the union of\n * them under `baseName`.\n */\nexport function buildContentTypeEntries(\n entries: Array<ContentVariantInput>,\n baseName: string,\n decorate: (schema: ast.SchemaNode) => ast.SchemaNode = (schema) => schema,\n): Array<SchemaEntry> {\n const variants = resolveContentTypeVariants(entries, baseName)\n const union = ast.factory.createSchema({\n type: 'union',\n members: variants.map((variant) => ast.factory.createSchema({ type: 'ref', name: variant.name })),\n })\n\n return [\n ...variants.map((variant) => ({ schema: decorate(variant.schema), name: variant.name, keysToOmit: variant.keysToOmit })),\n { schema: union, name: baseName },\n ]\n}\n\n/**\n * The schema behind a response or error name: a union of the per-status schemas. Returns `null`\n * when a response is a `$ref` to a component whose name is already `name`, which would declare it twice.\n */\nexport function buildResponseUnionSchema({\n node,\n responses,\n name,\n resolver,\n fallbackUnknown,\n}: {\n node: ast.OperationNode\n responses: Array<ast.ResponseNode>\n name: string\n resolver: { name(name: string): string; response: { status(node: ast.OperationNode, statusCode: ast.StatusCode): string } }\n /**\n * Print an unknown schema when no response has one, so the name still resolves.\n */\n fallbackUnknown: boolean\n}): ast.SchemaNode | null {\n const importedNames = new Set(ast.http.responses.getImportedNames(responses).map((refName) => resolver.name(refName)))\n if (importedNames.has(name)) return null\n\n const members = responses.map((res) => ast.factory.createSchema({ type: 'ref', name: resolver.response.status(node, res.statusCode) }))\n if (members.length === 0) return fallbackUnknown ? ast.factory.createSchema({ type: 'unknown' }) : null\n\n return members.length === 1 ? members[0]! : ast.factory.createSchema({ type: 'union', members })\n}\n\ntype OperationSchemaEntry = { schema: ast.SchemaNode | null; name: string; keysToOmit?: Array<string> | null; direction?: 'encode' | 'decode' }\n\ntype OperationSchemaResolver = OperationTypeNameResolver &\n ResponseStatusNameResolver & {\n name(name: string): string\n param: { name(node: ast.OperationNode, param: ast.ParameterNode): string }\n response: {\n headers(node: ast.OperationNode, statusCode: ast.StatusCode): string\n error(node: ast.OperationNode): string\n responses(node: ast.OperationNode): string\n }\n }\n\n/**\n * The schemas a validator plugin writes into the file of an operation, in file order: every parameter, every response\n * and its headers, the success and error unions, the request body, and the parameter groups. `inferred` adds the\n * options object and the per-status record, for callers that take their types from the plugin.\n * A request-direction entry has `direction: 'encode'`. An entry without a schema is one the caller skips.\n */\nexport function buildOperationSchemaEntries({\n node,\n resolver,\n inferred,\n}: {\n node: ast.HttpOperationNode\n resolver: OperationSchemaResolver\n inferred: boolean\n}): Array<OperationSchemaEntry> {\n const encode = (entry: OperationSchemaEntry): OperationSchemaEntry => ({ ...entry, direction: 'encode' })\n const responseUnion = (responses: Array<ast.ResponseNode>, name: string, fallbackUnknown: boolean): OperationSchemaEntry => ({\n schema: buildResponseUnionSchema({ node, responses, name, resolver, fallbackUnknown }),\n name,\n })\n\n const parameters = node.parameters.map((param) => encode({ schema: param.schema, name: resolver.param.name(node, param) }))\n\n const responses = node.responses.flatMap((res): Array<OperationSchemaEntry> => {\n const content = (res.content ?? []).map((entry, _, entries) => toResponseContent(entry, entries))\n const variants = content.filter((entry) => entry.schema)\n const name = resolver.response.status(node, res.statusCode)\n // Several content types for one name: one schema per content type, then the union of them.\n if (variants.length > 1) return buildContentTypeEntries(content, name)\n const primary = variants[0] ?? content[0]\n return [{ schema: primary?.schema ?? null, name, keysToOmit: primary?.keysToOmit }]\n })\n\n const responseHeaders = node.responses\n .filter((res) => res.headers?.length)\n .map((res) => ({ schema: buildParamsSchema(res.headers ?? []), name: resolver.response.headers(node, res.statusCode) }))\n\n // The response schema covers the success (2xx) bodies, and the error schema every other response, including `default`.\n const withSchema = node.responses.filter((res) => res.content?.some((entry) => entry.schema))\n const success = withSchema.filter((res) => ast.http.status.isSuccess(res))\n const errors = withSchema.filter((res) => !ast.http.status.isSuccess(res))\n const unions = [\n ...(withSchema.length > 0 ? [responseUnion(success, resolver.response.response(node), true)] : []),\n ...(errors.length > 0 ? [responseUnion(errors, resolver.response.error(node), false)] : []),\n ]\n\n const bodyContent = node.requestBody?.content ?? []\n const describe = (schema: ast.SchemaNode): ast.SchemaNode => ({ ...schema, description: node.requestBody?.description ?? schema.description })\n const [onlyBody] = bodyContent\n const body =\n bodyContent.length > 1\n ? buildContentTypeEntries(bodyContent, resolver.response.body(node), describe)\n : onlyBody?.schema\n ? [{ schema: describe(onlyBody.schema), name: resolver.response.body(node), keysToOmit: onlyBody.keysToOmit }]\n : []\n\n const { path, query, header, cookie } = ast.http.groupParameters(node)\n const groups = (\n [\n { kind: 'path', params: path },\n { kind: 'query', params: query },\n { kind: 'headers', params: header },\n { kind: 'cookies', params: cookie },\n ] as const\n )\n .filter(({ params }) => params.length > 0)\n .map(({ kind, params }) => ({ schema: buildParamRefsSchema({ node, params, resolver }), name: resolver.param[kind](node, params[0]!) }))\n\n return [\n ...parameters,\n ...responses,\n ...responseHeaders,\n ...unions,\n ...body.map(encode),\n ...groups.map(encode),\n ...(inferred\n ? [\n encode({ schema: buildOptionsSchema(node, resolver), name: resolver.name(`${node.operationId} Options`) }),\n { schema: buildResponses(node, resolver), name: resolver.response.responses(node) },\n ]\n : []),\n ]\n}\n","import { ast } from '@internals/ast'\nimport { ensureValidVarName } from '@internals/utils'\nimport { casing, memo, useKubb } from '@kubb/kit'\nimport type { FileTarget, GeneratorContext, Group, Output, PrinterContext, Resolver, ResolverFileParams } 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/** `ctx.file(node)` for a file that no single node owns, such as `handlers.ts`: path, banner and footer from the current plugin. */\nexport function namedFile(entry: Pick<ResolverFileParams, 'name' | 'tag'> & { extname?: ResolverFileParams['extname'] }): FileTarget {\n const ctx = useKubb<GeneratorContext>()\n const { output, group } = ctx.options as { output: Output; group?: Group | null }\n const file = ctx.resolver.file({ extname: '.ts', ...entry, root: ctx.root, output, group: group ?? undefined })\n const fileContext = { output, config: ctx.config, file: { path: file.path, baseName: file.baseName } }\n\n return {\n baseName: file.baseName,\n path: file.path,\n meta: file.meta,\n banner: ctx.resolver.default.banner(ctx.meta, fileContext),\n footer: ctx.resolver.default.footer(ctx.meta, fileContext),\n }\n}\n\n/**\n * Names of the schemas in a circular reference chain, computed once per build. Reads the current context, so call it\n * in a generator or a printer factory.\n */\nexport function getCircularNames(): ReadonlySet<string> {\n return memo('circularNames:set', () => ast.graph.getCircularNames(useKubb<PrinterContext>().schemas))\n}\n\n/**\n * Names of the schemas whose type is `enum`, computed once per build. Reads the current context, so call it\n * in a generator or a printer factory.\n */\nexport function getEnumNames(): ReadonlySet<string> {\n return memo(\n 'enumNames:set',\n () => new Set(useKubb<PrinterContext>().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 operationTypeNames: Array<string>\n }\n }\n}\n","import type { ast } from '@internals/ast'\nimport { ensureValidVarName } from '@internals/utils'\nimport { casing, operationKey } from '@kubb/kit'\nimport type { 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/** A hook file: one of the query variants, or the mutation hook. */\nexport type HookFileVariant = QueryVariant | 'mutation'\n\n/**\n * A hook file's name before casing, such as `useGetPetByIdSuspense`. Built from the `operationId`, not the resolver's `name`,\n * so a `name` override renames hooks and leaves their files alone. Two operations with the same name get `usePetList2`.\n */\nexport function hookFileName({ resolver, node, variant = '' }: { resolver: Resolver; node: ast.OperationNode; variant?: HookFileVariant }): string {\n const name = `use${casing.capitalize(ensureValidVarName(casing.camel(node.operationId)))}${variant === 'mutation' ? '' : variant}`\n return resolver.resolveName({ key: operationKey(node, 'hookFile', variant), name, scope: 'file' })\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 } from '@internals/ast'\nimport { getResponseHeadersTypeNames, resolveOperationTypes } from '@internals/client'\nimport { resolveOperationTypeNames } from '@internals/shared'\nimport { code, Diagnostics, type FileTarget, type GeneratorContext, useKubb } from '@kubb/kit'\nimport type { ResolverTs } from '@kubb/plugin-ts'\nimport { File } from '@kubb/renderer-jsx'\nimport { type HookFileVariant, hookFileName } from '../resolver.ts'\nimport type { KubbReactNode } from '@kubb/renderer-jsx'\nimport type { ClientOperation, ReturnTypeOption } from '@internals/client'\n\nexport type ResolveHookFileOptions = {\n /** The hook's variant, which names its file through `hookFileName`. */\n variant?: HookFileVariant\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\nexport type ResolvedHookFile = {\n file: FileTarget\n tsResolver: ResolverTs\n contractOp: ClientOperation\n /** The imports of the operation type names, from the `types` provider. */\n typeImports: ReadonlyArray<ast.ImportNode>\n /**\n * The client's result type the hook names with `returnType: 'full'`.\n */\n resultTypeName: 'RequestResult' | 'RequestResultWithHeaders'\n returnType: ReturnTypeOption\n}\n\n/**\n * Resolves what every TanStack hook file shares: its file with banner and footer, and the type imports from the `types` provider.\n */\nexport function resolveHookFile(node: ast.OperationNode, options: ResolveHookFileOptions): ResolvedHookFile {\n const ctx = useKubb<GeneratorContext>()\n const { variant = '', contractOp, keyTypeName, extraTypeNames = [], returnType = 'data' } = options\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: ctx.resolver.pluginName,\n })\n }\n const types = resolveOperationTypes()\n const tsResolver = types.resolver\n const headerTypeNames = returnType === 'data' || !contractOp.typedHeaders ? [] : getResponseHeadersTypeNames({ node, types: tsResolver })\n\n const file = ctx.file(node, { name: hookFileName({ resolver: ctx.resolver, node, variant }) })\n const typeSource = ctx.from('types')\n const typeRefs = [\n typeSource.resolver.response.options(node),\n typeSource.resolver.response.responses(node),\n ...[\n ...headerTypeNames,\n ...extraTypeNames,\n ...resolveOperationTypeNames(node, tsResolver, {\n // The full result only names error statuses (in ResponseErrorConfig); success statuses are unused.\n responseStatusNames: returnType === 'data' ? undefined : 'error',\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 ].flatMap((typeName) => (typeName ? [typeSource.ref(node, typeName)] : [])),\n ]\n\n return {\n file,\n tsResolver,\n contractOp,\n typeImports: code.join(typeRefs).imports,\n resultTypeName: headerTypeNames.length ? 'RequestResultWithHeaders' : 'RequestResult',\n returnType,\n }\n}\n\nexport type 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, contractOp, typeImports, resultTypeName } = hook\n\n return (\n <File {...file}>\n <File.Import names={[contractOp.moduleName]} root={file.path} path={contractOp.path} />\n <File.Import\n names={['RequestConfig', 'ResponseErrorConfig', resultTypeName].map((name) => ({ name, space: 'type' as const }))}\n root={contractOp.clientPathIsFile ? file.path : undefined}\n path={contractOp.clientPath}\n />\n\n {imports}\n {typeImports.map((imp) => (\n <File.Import key={imp.path} names={ast.imports.asType(imp)} root={file.path} path={imp.path} />\n ))}\n\n {children}\n </File>\n )\n}\n","import { ast } from '@internals/ast'\nimport { text } from '@kubb/kit'\nimport { getResponseContentTypeInfo, resolveErrorNames, resolveSuccessNames, buildClientOptionType, requestGroupOrder, getStream } from '@internals/shared'\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\nexport type 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.\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 /**\n * Keeps headers optional for query key helpers, including operations with required headers.\n */\n optionalHeaders?: boolean\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, optionalHeaders = false, withContentType = false } = options\n const groups = ast.http.getRequestGroups(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: groups.required.path,\n query: groups.required.query,\n body: groups.body,\n headers: !optionalHeaders && groups.required.headers,\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, 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 && groups.hasContentTypeChoice) {\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(\n (key) => (!keys.includes(key) || (optionalHeaders && key === 'headers' && !groups.headers)) && (key !== 'cookies' || groups.cookies),\n )\n const optionsType = omittedKeys.length > 0 ? `Omit<${optionsName}, ${omittedKeys.map((key) => `'${key}'`).join(' | ')}>` : optionsName\n const paramType = optionalHeaders && names.includes('headers') ? `Omit<${optionsType}, 'headers'> & { headers?: ${optionsType}['headers'] }` : optionsType\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: paramType,\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 = ast.http.getRequestGroups(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 && groups.hasContentTypeChoice ? ['...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\nexport type ResponseTypes = {\n TData: string\n TError: string\n}\n\nexport type PageParamType = {\n queryParamsTypeName: string | null\n pageParamType: string\n}\n\nexport type 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 = getStream(node)?.hasVariant ? `${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}[${text.quote(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\nexport type OperationClassification = {\n isQuery: boolean\n isMutation: boolean\n}\n\nexport type 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 (getStream(node)?.shape) 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 */\n// oxlint-disable-next-line typescript/no-explicit-any -- same defaults as `PageParamFn`\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\n/**\n * The request groups available to a query key transformer. Headers are available for custom keys\n * but excluded from the default key. Cookies stay excluded.\n */\nexport const queryKeyGroupOrder = ['path', 'query', 'body', 'headers'] 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 = ast.http.getRequestGroups(node)\n return queryKeyGroupOrder.some((key) => groups[key])\n}\n\n/**\n * Builds query key bindings for path, query, body, and optional headers. Custom transformers\n * can reference `headers` in returned code without changing the default key.\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, optionalHeaders: true })\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 (!ast.http.getRequestGroups(node).hasContentTypeChoice || !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 = ast.http.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 type { ast } from '@internals/ast'\nimport { getNestedAccessor } from '@internals/utils'\nimport { text } from '@kubb/kit'\nimport type { ResolverTs } from '@kubb/plugin-ts'\nimport { createFunctionParameters, functionPrinter } from '@kubb/plugin-ts'\nimport { 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\nexport type InfiniteQueryOptionsProps = {\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}: InfiniteQueryOptionsProps): 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}[${text.quote(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}[${text.quote(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 <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 )\n}\n","import type { ast } from '@internals/ast'\nimport { text, Url } from '@kubb/kit'\nimport { createFunctionParameters, functionPrinter } from '@kubb/plugin-ts'\nimport { Function, Type } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx'\nimport type { Transformer } from '../types.ts'\n\nexport type MutationKeyProps = {\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: ${text.quote(Url.toPath(node.path))} }`]\n}\n\nexport function MutationKey({ name, node, transformer, typeName }: MutationKeyProps): 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 <Function.Arrow name={name} export params={paramsSignature} singleLine>\n {`[${keys.join(', ')}] as const`}\n </Function.Arrow>\n {typeName && <Type export name={typeName}>{`ReturnType<typeof ${name}>`}</Type>}\n </>\n )\n}\n","import { ast } from '@internals/ast'\nimport { text, Url } from '@kubb/kit'\nimport type { PluginTs } from '@kubb/plugin-ts'\nimport { functionPrinter } from '@kubb/plugin-ts'\nimport { 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\nexport type QueryKeyProps = {\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: ${text.quote(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 }: QueryKeyProps): 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 <Function.Arrow name={name} export params={paramsSignature} singleLine>\n {`[${keys.join(', ')}] as const`}\n </Function.Arrow>\n <Type name={typeName} export={exportType}>{`ReturnType<typeof ${name}>`}</Type>\n </>\n )\n}\n","import type { ast } from '@internals/ast'\nimport type { FunctionParametersNode, ResolverTs } from '@kubb/plugin-ts'\nimport { functionPrinter } from '@kubb/plugin-ts'\nimport { Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx'\nimport { buildCallResultBody, buildClientCall, buildQueryKeyParams, buildQueryOptionsParams, buildResponseTypes } from '@internals/tanstack-query'\nimport type { CallReturnTypeProps } from '@internals/tanstack-query'\nimport { maybeRefOrGetter } from '@internals/tanstack-query'\n\nexport type QueryOptionsProps = {\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 getQueryOptionsParams(node: ast.OperationNode, options: { resolver: ResolverTs }): FunctionParametersNode {\n return buildQueryOptionsParams(node, { resolver: options.resolver, memberTypeWrapper: maybeRefOrGetter })\n}\n\nexport function QueryOptions({\n name,\n clientName,\n node,\n tsResolver,\n queryKeyName,\n clientReturnType,\n returnType,\n typedHeaders,\n}: QueryOptionsProps): KubbReactNode {\n const { TData, TError } = buildResponseTypes(node, tsResolver, { returnType, typedHeaders })\n\n const queryKeyParamsNode = buildQueryKeyParams(node, { resolver: tsResolver, memberTypeWrapper: maybeRefOrGetter })\n const queryKeyParamsCall = callPrinter.print(queryKeyParamsNode) ?? ''\n\n const paramsNode = getQueryOptionsParams(node, { resolver: tsResolver })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n const queryFnBody = buildCallResultBody(buildClientCall(node, { clientName, signal: true, unwrapName: (name) => `toValue(${name})` }), {\n clientReturnType,\n returnType,\n })\n\n return (\n <Function name={name} export params={paramsSignature}>\n {`\n const queryKey = ${queryKeyName}(${queryKeyParamsCall})\n return queryOptions<${TData}, ${TError}, ${TData}>({\n queryKey,\n queryFn: async ({ signal }) => {\n ${queryFnBody}\n },\n })\n`}\n </Function>\n )\n}\n","import type { ast } from '@internals/ast'\nimport type { ResolverTs } from '@kubb/plugin-ts'\nimport { functionPrinter } from '@kubb/plugin-ts'\nimport { Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx'\nimport { buildHookParams, buildQueryKeyParams, buildResponseTypes, maybeRefOrGetter, resolvePageParamType } from '@internals/tanstack-query'\nimport type { HookResultProps, Infinite } from '@internals/tanstack-query'\nimport { buildClientOptionType, buildOperationComments } from '@internals/shared'\nimport { getQueryOptionsParams } from './QueryOptions.tsx'\n\nexport type QueryProps = {\n name: string\n queryOptionsName: string\n queryKeyName: string\n queryKeyTypeName: string\n node: ast.OperationNode\n tsResolver: ResolverTs\n /**\n * Emits the `useInfiniteQuery` variant of the hook instead of `useQuery`. Carries the options the page param type is read from.\n */\n infinite?: Pick<Infinite, 'initialPageParam' | 'queryParam'>\n} & HookResultProps\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\nconst callPrinter = functionPrinter({ mode: 'call' })\n\nexport function Query({\n name,\n queryKeyTypeName,\n queryOptionsName,\n queryKeyName,\n node,\n tsResolver,\n infinite,\n returnType,\n typedHeaders,\n}: QueryProps): KubbReactNode {\n const { TData, TError } = buildResponseTypes(node, tsResolver, { returnType, typedHeaders })\n const optionsName = infinite ? 'UseInfiniteQueryOptions' : 'UseQueryOptions'\n const hookName = infinite ? 'useInfiniteQuery' : 'useQuery'\n const resultType = `${infinite ? 'UseInfiniteQueryReturnType' : 'UseQueryReturnType'}<${['TData', TError].join(', ')}> & { queryKey: TQueryKey }`\n const generics = [\n infinite ? `TData = InfiniteData<${TData}>` : `TData = ${TData}`,\n `TQueryData = ${TData}`,\n `TQueryKey extends QueryKey = ${queryKeyTypeName}`,\n ]\n const pageParamType = infinite\n ? resolvePageParamType(node, { resolver: tsResolver, initialPageParam: infinite.initialPageParam, queryParam: infinite.queryParam }).pageParamType\n : null\n const optionsGenerics = pageParamType ? ['TQueryData', TError, 'TData', 'TQueryKey', pageParamType] : [TData, TError, 'TData', 'TQueryData', 'TQueryKey']\n const castGenerics = pageParamType ? [TData, TError, 'TData', 'TQueryKey', pageParamType] : [TData, TError, 'TData', TData, 'TQueryKey']\n\n const queryKeyParamsNode = buildQueryKeyParams(node, { resolver: tsResolver, memberTypeWrapper: maybeRefOrGetter })\n const queryKeyParamsCall = callPrinter.print(queryKeyParamsNode) ?? ''\n\n const queryOptionsParamsNode = getQueryOptionsParams(node, { resolver: tsResolver })\n const queryOptionsParamsCall = callPrinter.print(queryOptionsParamsNode) ?? ''\n\n // Vue-query wraps each grouped operation param with MaybeRefOrGetter\n const paramsNode = buildHookParams(node, {\n resolver: tsResolver,\n memberTypeWrapper: maybeRefOrGetter,\n optionsType: `{\n query?: Partial<${optionsName}<${optionsGenerics.join(', ')}>> & { client?: QueryClient },\n client?: ${buildClientOptionType()}\n}`,\n })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n\n return (\n <Function name={name} export generics={generics.join(', ')} params={paramsSignature} JSDoc={{ comments: buildOperationComments(node) }}>\n {`\n const { query: queryConfig = {}, client: config = {} } = options ?? {}\n const { client: queryClient, ...resolvedOptions } = queryConfig\n const queryKey = (resolvedOptions && 'queryKey' in resolvedOptions ? toValue(resolvedOptions.queryKey) : undefined) ?? ${queryKeyName}(${queryKeyParamsCall})\n\n const queryResult = ${hookName}({\n ...${queryOptionsName}(${queryOptionsParamsCall}),\n ...resolvedOptions,\n queryKey\n } as unknown as ${optionsName}<${castGenerics.join(', ')}>, toValue(queryClient)) as ${resultType}\n\n queryResult.queryKey = queryKey as TQueryKey\n\n return queryResult\n `}\n </Function>\n )\n}\n","import { ast } from '@internals/ast'\nimport { 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 { defineTemplate } from '@kubb/kit'\nimport type { TemplateContext } from '@kubb/kit'\nimport { File } from '@kubb/renderer-jsx'\nimport { Query } from '../components/Query.tsx'\nimport { maybeRefOrGetter } from '@internals/tanstack-query'\nimport type { PluginVueQuery } from '../types'\n\n// The operations this template writes. Every other operation returns `null`.\nfunction matchesInfiniteQuery(node: ast.OperationNode, ctx: TemplateContext<PluginVueQuery>): boolean {\n if (!ast.http.isOperation(node)) return false\n const { query, mutation, infinite, hooks } = ctx.options\n\n const { isQuery, isMutation } = classifyOperation(node, { query, mutation })\n const infiniteOptions = infinite && typeof infinite === 'object' ? infinite : null\n if (!isQuery || isMutation || !infiniteOptions || !hooks) return false\n\n return matchesInfinite(node, infiniteOptions)\n}\n\n/**\n * Built-in template for `useInfiniteQuery` composables. Enabled when\n * `pluginVueQuery({ infinite: { ... }, hooks: true })`. Emits one\n * `useFooInfinite` composable per query operation, wiring the\n * configured cursor path into TanStack Query's cursor-based pagination.\n */\nexport const infiniteQueryOperation = defineTemplate<PluginVueQuery>({\n kind: ast.node.kinds.operation,\n render(node, ctx) {\n if (!matchesInfiniteQuery(node, ctx)) return null\n if (!ast.http.isOperation(node)) return null\n const { query, infinite, client } = ctx.options\n\n const infiniteOptions = infinite && typeof infinite === 'object' ? infinite : null\n if (!infiniteOptions) return null\n\n const pageParamsWarning = getDefaultPageParamsWarning(node, infiniteOptions)\n if (pageParamsWarning) ctx.warn(pageParamsWarning)\n\n const importPath = query ? query.importPath : '@tanstack/vue-query'\n\n // The registered contract client plugin owns the `<op>` the composable imports and calls.\n const contractOp = resolveClientOperation({ node, pluginName: client.pluginName })\n if (!contractOp) return null\n\n const queryName = ctx.resolver.infiniteQuery.name(node)\n const queryOptionsName = ctx.resolver.infiniteQuery.optionsName(node)\n const queryKeyName = ctx.resolver.infiniteQuery.keyName(node)\n const queryKeyTypeName = ctx.resolver.infiniteQuery.keyTypeName(node)\n\n const hook = resolveHookFile(node, {\n variant: 'Infinite',\n contractOp,\n returnType: ctx.options.returnType,\n keyTypeName: queryKeyTypeName,\n extraTypeNames: [\n resolvePageParamType(node, {\n resolver: resolveOperationTypes().resolver,\n initialPageParam: infiniteOptions.initialPageParam,\n queryParam: infiniteOptions.queryParam,\n }).queryParamsTypeName,\n ],\n })\n const { tsResolver } = hook\n\n return (\n <HookFile\n hook={hook}\n imports={\n <>\n <File.Import\n names={[\n { name: 'toValue', space: 'value' },\n { name: 'MaybeRefOrGetter', space: 'type' },\n ]}\n path=\"vue\"\n />\n </>\n }\n >\n <QueryKey\n name={queryKeyName}\n typeName={queryKeyTypeName}\n node={node}\n tsResolver={tsResolver}\n transformer={ctx.options.queryKey}\n variant=\"infiniteQuery\"\n memberTypeWrapper={maybeRefOrGetter}\n exportType\n />\n\n <File.Import\n names={[\n { name: 'infiniteQueryOptions', space: 'value' },\n { name: 'InfiniteData', space: 'type' },\n ]}\n path={importPath}\n />\n\n <InfiniteQueryOptions\n name={queryOptionsName}\n clientName={contractOp.name}\n queryKeyName={queryKeyName}\n node={node}\n tsResolver={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 queryKeyType=\"QueryKey\"\n memberTypeWrapper={maybeRefOrGetter}\n unwrapName={(name) => `toValue(${name})`}\n />\n\n <File.Import\n names={[\n { name: 'useInfiniteQuery', space: 'value' },\n { name: 'QueryKey', space: 'type' },\n { name: 'QueryClient', space: 'type' },\n { name: 'UseInfiniteQueryOptions', space: 'type' },\n { name: 'UseInfiniteQueryReturnType', space: 'type' },\n ]}\n path={importPath}\n />\n\n <Query\n name={queryName}\n queryOptionsName={queryOptionsName}\n queryKeyName={queryKeyName}\n queryKeyTypeName={queryKeyTypeName}\n node={node}\n tsResolver={tsResolver}\n infinite={infiniteOptions}\n returnType={hook.returnType}\n typedHeaders={hook.contractOp.typedHeaders}\n />\n </HookFile>\n )\n },\n})\n","import type { ast } from '@internals/ast'\nimport type { FunctionParametersNode, ResolverTs } from '@kubb/plugin-ts'\nimport { createFunctionParameters, functionPrinter } from '@kubb/plugin-ts'\nimport { Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx'\nimport {\n buildCallResultBody,\n buildClientCall,\n buildGroupedRequestParam,\n buildHookParams,\n buildResponseTypes,\n resolveMutationRequestType,\n} from '@internals/tanstack-query'\nimport type { CallReturnTypeProps } from '@internals/tanstack-query'\nimport type { ReturnTypeOption } from '@internals/client'\nimport { buildOperationComments, buildRequestConfigType } from '@internals/shared'\n\nexport type MutationProps = {\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\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\n return buildHookParams(node, {\n resolver,\n withRequest: false,\n optionsType: `{\n mutation?: MutationObserverOptions<${[TData, TError, resolveMutationRequestType(node, resolver), 'TContext'].join(', ')}> & { client?: QueryClient },\n client?: ${buildRequestConfigType(node)},\n}`,\n })\n}\n\nexport function Mutation({ name, clientName, node, tsResolver, mutationKeyName, clientReturnType, returnType, typedHeaders }: MutationProps): KubbReactNode {\n const { TData, TError } = buildResponseTypes(node, tsResolver, { returnType, typedHeaders })\n\n const groupedParam = buildGroupedRequestParam(node, { resolver: tsResolver, withContentType: true })\n const hasMutationParams = groupedParam !== null\n const groupedParamsNode = createFunctionParameters({ params: groupedParam ? [groupedParam] : [] })\n const argBindingStr = hasMutationParams ? (callPrinter.print(groupedParamsNode) ?? '') : ''\n const TRequest = resolveMutationRequestType(node, tsResolver)\n const mutationFnBody = buildCallResultBody(\n buildClientCall(node, {\n clientName,\n signal: false,\n withContentType: true,\n // Pin the payload type: an optional `value` property can otherwise drive Vue's ref inference.\n unwrapName: (name) => `toValue<${TRequest}['${name}']>(${name})`,\n }),\n { clientReturnType, returnType },\n )\n const generics = [TData, TError, TRequest, 'TContext'].join(', ')\n\n const paramsNode = buildMutationParamsNode(node, { resolver: tsResolver, returnType, typedHeaders })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n\n return (\n <Function name={name} export params={paramsSignature} JSDoc={{ comments: buildOperationComments(node) }} generics={['TContext']}>\n {`\n const { mutation = {}, client: config = {} } = options ?? {}\n const { client: queryClient, ...mutationOptions } = mutation;\n const mutationKey = mutationOptions?.mutationKey ?? ${mutationKeyName}()\n\n return useMutation<${generics}>({\n mutationFn: async(${argBindingStr}) => {\n ${mutationFnBody}\n },\n mutationKey,\n ...mutationOptions\n }, queryClient)\n `}\n </Function>\n )\n}\n","import { ast } from '@internals/ast'\nimport { requestGroupOrder } from '@internals/shared'\nimport { resolveClientOperation } from '@internals/client'\nimport { classifyOperation, HookFile, MutationKey, resolveHookFile } from '@internals/tanstack-query'\nimport { defineTemplate } from '@kubb/kit'\nimport { File } from '@kubb/renderer-jsx'\nimport { Mutation } from '../components/Mutation.tsx'\nimport type { PluginVueQuery } from '../types'\n\n/**\n * Built-in template for `useMutation` composables. Emits one\n * `useFoo` composable per POST/PUT/DELETE operation (configurable\n * via `mutation.methods`) plus the matching `fooMutationKey` helper.\n */\nexport const mutationOperation = defineTemplate<PluginVueQuery>({\n kind: ast.node.kinds.operation,\n render(node, ctx) {\n if (!ast.http.isOperation(node)) return null\n const { query, mutation, client, hooks } = ctx.options\n\n const { isMutation } = classifyOperation(node, { query, mutation })\n\n if (!isMutation) return null\n\n const importPath = mutation ? mutation.importPath : '@tanstack/vue-query'\n\n // The registered contract client plugin owns the `<op>` the composable imports and calls.\n const contractOp = resolveClientOperation({ node, pluginName: client.pluginName })\n if (!contractOp) return null\n\n const mutationHookName = ctx.resolver.mutation.name(node)\n const mutationKeyName = ctx.resolver.mutation.keyName(node)\n\n const hook = resolveHookFile(node, { variant: 'mutation', contractOp, returnType: ctx.options.returnType })\n\n // The contract body unwraps each request group with `toValue()`, so it needs the runtime import.\n const groups = ast.http.getRequestGroups(node)\n const hasRequestGroups = requestGroupOrder.some((key) => groups[key])\n\n return (\n <HookFile\n hook={hook}\n imports={\n <>\n <File.Import\n names={[...(hasRequestGroups ? [{ name: 'toValue', space: 'value' as const }] : []), { name: 'MaybeRefOrGetter', space: 'type' }]}\n path=\"vue\"\n />\n </>\n }\n >\n <MutationKey name={mutationKeyName} node={node} transformer={ctx.options.mutationKey} />\n\n {mutation && hooks && (\n <>\n <File.Import\n names={[\n { name: 'useMutation', space: 'value' },\n { name: 'MutationObserverOptions', space: 'type' },\n { name: 'QueryClient', space: 'type' },\n ]}\n path={importPath}\n />\n <Mutation\n name={mutationHookName}\n clientName={contractOp.name}\n node={node}\n tsResolver={hook.tsResolver}\n mutationKeyName={mutationKeyName}\n clientReturnType={contractOp.returnType}\n returnType={hook.returnType}\n typedHeaders={hook.contractOp.typedHeaders}\n />\n </>\n )}\n </HookFile>\n )\n },\n})\n","import { ast } from '@internals/ast'\nimport { resolveClientOperation } from '@internals/client'\nimport { classifyOperation, HookFile, QueryKey, resolveHookFile } from '@internals/tanstack-query'\nimport { defineTemplate } from '@kubb/kit'\nimport { File } from '@kubb/renderer-jsx'\nimport { Query } from '../components/Query.tsx'\nimport { QueryOptions } from '../components/QueryOptions.tsx'\nimport { maybeRefOrGetter } from '@internals/tanstack-query'\nimport type { PluginVueQuery } from '../types'\n\n/**\n * Built-in template for `useQuery` composables. Emits one `useFoo`\n * composable per GET and QUERY operation (configurable via `query.methods`) plus the\n * matching `fooQueryKey` / `fooQueryOptions` helpers.\n */\nexport const queryOperation = defineTemplate<PluginVueQuery>({\n kind: ast.node.kinds.operation,\n render(node, ctx) {\n if (!ast.http.isOperation(node)) return null\n const { query, mutation, client, hooks } = ctx.options\n\n const { isQuery, isMutation } = classifyOperation(node, { query, mutation })\n\n if (!isQuery || isMutation) return null\n\n const importPath = query ? query.importPath : '@tanstack/vue-query'\n\n // The registered contract client plugin owns the `<op>` the composable imports and calls.\n const contractOp = resolveClientOperation({ node, pluginName: client.pluginName })\n if (!contractOp) return null\n\n const queryName = ctx.resolver.query.name(node)\n const queryOptionsName = ctx.resolver.query.optionsName(node)\n const queryKeyName = ctx.resolver.query.keyName(node)\n const queryKeyTypeName = ctx.resolver.query.keyTypeName(node)\n\n const hook = resolveHookFile(node, { contractOp, keyTypeName: queryKeyTypeName, returnType: ctx.options.returnType })\n const { tsResolver } = hook\n\n return (\n <HookFile\n hook={hook}\n imports={\n <>\n <File.Import\n names={[\n { name: 'toValue', space: 'value' },\n { name: 'MaybeRefOrGetter', space: 'type' },\n ]}\n path=\"vue\"\n />\n </>\n }\n >\n <QueryKey\n name={queryKeyName}\n typeName={queryKeyTypeName}\n node={node}\n tsResolver={tsResolver}\n transformer={ctx.options.queryKey}\n variant=\"query\"\n memberTypeWrapper={maybeRefOrGetter}\n exportType\n />\n\n <File.Import names={[{ name: 'queryOptions', space: 'value' }]} path={importPath} />\n\n <QueryOptions\n name={queryOptionsName}\n clientName={contractOp.name}\n queryKeyName={queryKeyName}\n node={node}\n tsResolver={tsResolver}\n clientReturnType={contractOp.returnType}\n returnType={hook.returnType}\n typedHeaders={hook.contractOp.typedHeaders}\n />\n\n {query && hooks && (\n <>\n <File.Import\n names={[\n { name: 'useQuery', space: 'value' },\n { name: 'QueryKey', space: 'type' },\n { name: 'QueryClient', space: 'type' },\n { name: 'UseQueryOptions', space: 'type' },\n { name: 'UseQueryReturnType', space: 'type' },\n ]}\n path={importPath}\n />\n <Query\n name={queryName}\n queryOptionsName={queryOptionsName}\n queryKeyName={queryKeyName}\n queryKeyTypeName={queryKeyTypeName}\n node={node}\n tsResolver={tsResolver}\n returnType={hook.returnType}\n typedHeaders={hook.contractOp.typedHeaders}\n />\n </>\n )}\n </HookFile>\n )\n },\n})\n","import { resolveOperationName } from '@internals/shared'\nimport { createMutationResolver, createQueryResolver } from '@internals/tanstack-query'\nimport { createResolver } from '@kubb/kit'\nimport type { PluginVueQuery } from '../types.ts'\n\n/**\n * Default resolver used by `@kubb/plugin-vue-query`. Decides the names and\n * file paths for every generated TanStack Query composable (`useFoo`,\n * `useFooInfinite`) and its companion helpers.\n *\n * The `default` helpers are supplied by `createResolver`. Functions use safe camelCase identifiers;\n * composables get the `use` prefix. Operation-specific naming is grouped under the `query`,\n * `infiniteQuery`, and `mutation` namespaces.\n *\n * @example Resolve composable and helper names\n * ```ts\n * import { resolverVueQuery } from '@kubb/plugin-vue-query'\n *\n * resolverVueQuery.query.name(operationNode) // 'useGetPetById'\n * resolverVueQuery.query.keyName(operationNode) // 'getPetByIdQueryKey'\n * resolverVueQuery.query.optionsName(operationNode) // 'getPetByIdQueryOptions'\n * ```\n */\nexport const resolverVueQuery = createResolver<PluginVueQuery>({\n pluginName: 'plugin-vue-query',\n name: resolveOperationName,\n query: createQueryResolver(),\n infiniteQuery: createQueryResolver('Infinite'),\n mutation: createMutationResolver(),\n})\n","import { addMacro, addTemplate, defineExtension, Resolver, setResolver, useConfig } from '@kubb/kit'\nimport { compatibility } from '../kubb-extension.json'\nimport { version } from '../package.json'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { mutationKeyTransformer, queryKeyTransformer, resolveInfiniteConfig, resolveMutationConfig, resolveQueryConfig } from '@internals/tanstack-query'\nimport { resolveContractClient } from '@internals/client'\nimport { infiniteQueryOperation, mutationOperation, queryOperation } from './templates'\nimport { resolverVueQuery } from './resolvers/resolverVueQuery.ts'\nimport type { PluginVueQuery, ResolverVueQuery } from './types.ts'\n\n/**\n * Canonical plugin name for `@kubb/plugin-vue-query`. Used for driver lookups\n * and cross-plugin dependency references.\n */\nexport const pluginVueQueryName = 'plugin-vue-query' satisfies PluginVueQuery['name']\n\n/**\n * Generates one TanStack Query composable per OpenAPI operation for Vue's\n * Composition API. Queries become `useFoo` (and optionally\n * `useFooInfinite`). Mutations become `useFoo` as well. Each composable\n * is fully typed end to end.\n *\n * @example\n * ```ts\n * import { defineConfig } from 'kubb/config'\n * import { pluginTs } from '@kubb/plugin-ts'\n * import { pluginVueQuery } from '@kubb/plugin-vue-query'\n *\n * export default defineConfig({\n * input: './petStore.yaml',\n * output: { path: './src/gen' },\n * plugins: [\n * pluginTs(),\n * pluginVueQuery({\n * output: { path: './hooks' },\n * }),\n * ],\n * })\n * ```\n */\nexport const pluginVueQuery = defineExtension<PluginVueQuery>({\n kind: 'plugin',\n meta: { name: pluginVueQueryName, 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 infinite = false,\n mutation = {},\n query = {},\n mutationKey = mutationKeyTransformer,\n queryKey = queryKeyTransformer,\n hooks = false,\n client,\n returnType = 'data',\n resolver: userResolver,\n macros: userMacros,\n } = options\n\n const resolver = userResolver ? Resolver.merge<ResolverVueQuery>(resolverVueQuery, ...[userResolver].flat()) : resolverVueQuery\n\n setResolver(resolver)\n addMacro(...(userMacros ?? []))\n\n addTemplate(queryOperation)\n addTemplate(infiniteQueryOperation)\n addTemplate(mutationOperation)\n\n return {\n output,\n client: resolveContractClient({ plugin: pluginVueQueryName, client, plugins: useConfig().plugins }),\n returnType,\n queryKey,\n query: resolveQueryConfig(query, { importPath: '@tanstack/vue-query' }),\n mutationKey,\n mutation: resolveMutationConfig(mutation, { importPath: '@tanstack/vue-query' }),\n infinite: resolveInfiniteConfig(infinite),\n hooks,\n group: group ?? null,\n exclude,\n include,\n override,\n resolver,\n }\n },\n})\n\nexport default pluginVueQuery\n"],"mappings":";;;;;;;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