@kubb/plugin-client 6.0.0 → 6.0.1
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/{client-Dq0z61hu.d.ts → client-C-0-puI2.d.ts} +2 -2
- package/dist/index.cjs +2 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -5
- package/dist/index.d.ts +4 -5
- package/dist/index.js +10 -11
- package/dist/index.js.map +1 -1
- package/dist/templates/client.d.ts +2 -2
- package/dist/templates/core.d.ts +2 -2
- package/dist/templates/mediaTypes/formData.d.ts +1 -1
- package/dist/templates/mediaTypes/urlencoded.d.ts +1 -1
- package/dist/templates/mediaTypes.d.ts +1 -1
- package/dist/templates/serializers/cookies.d.ts +1 -1
- package/dist/templates/serializers/headers.d.ts +1 -1
- package/dist/templates/serializers/path.d.ts +1 -1
- package/dist/templates/serializers/pathStyles.d.ts +1 -1
- package/dist/templates/serializers/query.d.ts +1 -1
- package/dist/templates/serializers/queryStyles.d.ts +1 -1
- package/dist/templates/serializers.d.ts +118 -2
- package/dist/templates/sse.d.ts +1 -1
- package/dist/templates/standardSchema.d.ts +81 -2
- package/docs/guides/authentication.md +3 -1
- package/docs/guides/calling-operations.md +8 -6
- package/docs/guides/validate-requests-and-responses.md +5 -5
- package/docs/guides/write-your-client.md +1 -1
- package/docs/options.md +3 -1
- package/docs/overview.md +2 -0
- package/kubb-extension.json +20 -2
- package/package.json +5 -5
- package/src/clientTypes.ts +3 -3
- package/src/generators/sdkGenerator.tsx +2 -3
- package/dist/serializers-BRgfPGr1.d.ts +0 -119
- package/dist/standardSchema-CGuiSK7F.d.ts +0 -82
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["text","ast","casing","pluginZodName","pluginTsName","Diagnostics","text","ast","ast","text","ast","pluginZodName","ast","ast","text","text","ast","ast","text","functionPrinter","createFunctionParameters","createFunctionParameter","ast","File","Function","ast","text","path","File","defineGenerator","jsxRenderer","ast","path","File","macroDedupeUnion","createResolver","casing","ast","File","File","ast","path","defineGenerator","jsxRenderer","Diagnostics","File","fileURLToPath","Resolver","useConfig","path","pluginTsName","pluginZodName","defineExtension","Resolver"],"sources":["../kubb-extension.json","../package.json","../../../internals/utils/src/reserved.ts","../../../internals/utils/src/codegen.ts","../../../internals/utils/src/strings.ts","../../../internals/shared/src/operation.ts","../../../internals/shared/src/resolver.ts","../../../internals/client/src/resolveOperationTypes.ts","../src/builders/security.ts","../src/builders/validatorOptions.ts","../src/builders/validator.ts","../src/builders/operationData.ts","../src/builders/generics.ts","../src/builders/returnStatement.ts","../src/builders/contentType.ts","../src/builders/styles.ts","../src/builders/callConfig.ts","../src/builders/signature.ts","../src/builders/operationBody.ts","../src/components/Operation.tsx","../src/components/ClientRuntime.tsx","../src/generators/clientGenerator.tsx","../src/macros.ts","../src/resolver.ts","../src/components/SdkClient.tsx","../src/components/SdkFacade.tsx","../src/generators/sdkGenerator.tsx","../src/setup.ts","../src/plugin.ts"],"sourcesContent":["","","/**\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'\nimport { isIdentifier } from './reserved.ts'\n\n/**\n * Builds a JSDoc comment block from an array of lines. Returns `fallback` when there are no\n * comments.\n *\n * @example\n * ```ts\n * buildJSDoc(['@type string', '@example hello'])\n * // '/**\\n * @type string\\n * @example hello\\n *\\/\\n '\n * ```\n */\nexport function buildJSDoc(\n comments: Array<string>,\n options: {\n /**\n * String used to indent each comment line.\n * @default ' * '\n */\n indent?: string\n /**\n * String appended after the closing tag.\n * @default '\\n '\n */\n suffix?: string\n /**\n * Returned as-is when `comments` is empty.\n * @default ' '\n */\n fallback?: string\n } = {},\n): string {\n const { indent = ' * ', suffix = '\\n ', fallback = ' ' } = options\n\n if (comments.length === 0) return fallback\n\n return `/**\\n${comments.map((c) => `${indent}${c}`).join('\\n')}\\n */${suffix}`\n}\n\n/**\n * Assembles a multi-line object literal from already-rendered `entries`, indenting each entry one\n * level and closing the brace at column zero. Entries that are themselves multi-line objects indent\n * cumulatively. Each entry ends with a trailing comma to match the formatter's multi-line style.\n *\n * @example\n * ```ts\n * buildObject(['id: z.number()', 'name: z.string()'])\n * // '{\\n id: z.number(),\\n name: z.string(),\\n}'\n * ```\n */\nexport function buildObject(entries: Array<string>): string {\n if (entries.length === 0) return '{}'\n const body = entries.map((entry) => `${text.indent({ text: entry })},`).join('\\n')\n\n return `{\\n${body}\\n}`\n}\n\n/**\n * Assembles a bracketed list (array by default) from already-rendered `items`. Keeps everything on\n * one line when no item spans multiple lines, and otherwise puts each item on its own line, indented\n * one level with a trailing comma and the closing bracket at column zero. Used for member lists such\n * as `z.union([…])` and `z.array([…])`.\n *\n * @example\n * ```ts\n * buildList(['z.string()', 'z.number()'])\n * // '[z.string(), z.number()]'\n * ```\n */\nexport function buildList(items: Array<string>, brackets: [open: string, close: string] = ['[', ']']): string {\n const [open, close] = brackets\n if (items.length === 0) return `${open}${close}`\n if (!items.some((item) => item.includes('\\n'))) return `${open}${items.join(', ')}${close}`\n const body = items.map((item) => `${text.indent({ text: item })},`).join('\\n')\n\n return `${open}\\n${body}\\n${close}`\n}\n\n/**\n * Emits a lazy getter for a circular-ref property position, `get name() { return body }`. The key\n * is quoted only when it is not a valid identifier. Used by the string printers to defer evaluation\n * of a recursive schema until first access.\n *\n * @example\n * ```ts\n * lazyGetter({ name: 'parent', body: 'z.lazy(() => Pet)' })\n * // \"get parent() { return z.lazy(() => Pet) }\"\n * ```\n */\nexport function lazyGetter({ name, body }: { name: string; body: string }): string {\n return `get ${objectKey(name)}() { return ${body} }`\n}\n\n/**\n * An object key, quoted only when it is not identifier-shaped. Reserved words such as `class` stay bare.\n *\n * @example\n * ```ts\n * objectKey('x-total') // \"'x-total'\"\n * ```\n */\nexport function objectKey(name: string): string {\n return isIdentifier(name) ? name : text.quote(name)\n}\n\n/**\n * A JSON value as a JavaScript literal, with single-quoted strings and identifier keys left unquoted.\n *\n * @example\n * ```ts\n * toLiteral({ id: 1, 'x-tag': ['a'] }) // \"{ id: 1, 'x-tag': ['a'] }\"\n * ```\n */\nexport function toLiteral(value: unknown): string {\n if (typeof value === 'string') return text.quote(value)\n if (Array.isArray(value)) return `[${value.map(toLiteral).join(', ')}]`\n if (value && typeof value === 'object') {\n return `{ ${Object.entries(value)\n .map(([key, item]) => `${objectKey(key)}: ${toLiteral(item)}`)\n .join(', ')} }`\n }\n return String(value)\n}\n","import { text } from '@kubb/kit'\n\n// `\\p{`, `\\P{` or `\\u{` behind an odd number of backslashes, or a character outside the BMP: both need the `u` flag.\nconst NEEDS_UNICODE = /(?<!\\\\)(?:\\\\\\\\)*\\\\[pPu]\\{|[\\u{10000}-\\u{10FFFF}]/u\n// Escapes the `u` flag accepts. `\\-` only counts inside a class.\nconst KEPT_ESCAPE = /[A-Za-z0-9^$\\\\.*+?()[\\]{}|/]/\n\n/**\n * Drops the backslash from escapes that the `u` flag rejects: an escaped punctuation character that is\n * not a syntax character, and `\\-` outside a class. Both match the same character without the backslash.\n */\nfunction dropIdentityEscapes(pattern: string): string {\n let inClass = false\n\n return pattern.replace(/\\\\(.)|[[\\]]/gs, (match, escaped?: string) => {\n if (escaped === undefined) {\n inClass = match === '['\n return match\n }\n\n return KEPT_ESCAPE.test(escaped) || (escaped === '-' && inClass) ? match : escaped\n })\n}\n\n/**\n * Builds the `RegExp` for a pattern, adding the `u` flag when it uses `\\p{...}`, `\\P{...}` or `\\u{...}`, or\n * holds a character outside the BMP. A pattern that is not valid under `u` keeps the flags it came with.\n */\nfunction toRegExp(pattern: string, flags: string | undefined): RegExp {\n if (flags?.includes('u') || !NEEDS_UNICODE.test(pattern)) return new RegExp(pattern, flags)\n\n try {\n return new RegExp(dropIdentityEscapes(pattern), `${flags ?? ''}u`)\n } catch {\n return new RegExp(pattern, flags)\n }\n}\n\n/**\n * Converts a pattern string into a `new RegExp(...)` constructor call or a regex literal string.\n * Inline flags expressed as a `^(?im)` prefix are extracted and applied to the resulting expression.\n * Pass `null` as the second argument to emit a `/pattern/flags` literal instead.\n *\n * @example\n * ```ts\n * toRegExpString('^(?im)foo') // 'new RegExp(\"^foo\", \"im\")'\n * toRegExpString('^(?im)foo', null) // '/^foo/im'\n * ```\n */\nexport function toRegExpString(pattern: string, func: string | null = 'RegExp'): string {\n const raw = text.unquote(pattern)\n\n const match = raw.match(/^\\^(\\(\\?([igmsuy]+)\\))/i)\n const replacementTarget = match?.[1] ?? ''\n const matchedFlags = match?.[2]\n const cleaned = raw\n .replace(/^\\\\?\\//, '')\n .replace(/\\\\?\\/$/, '')\n .replace(replacementTarget, '')\n\n const { source, flags } = toRegExp(cleaned, matchedFlags)\n\n if (func === null) return `/${source}/${flags}`\n\n return `new ${func}(${JSON.stringify(source)}${flags ? `, ${JSON.stringify(flags)}` : ''})`\n}\n\n/**\n * Renders a dotted path or string array as an optional-chaining accessor expression rooted at\n * `accessor`. Returns `null` for an empty path.\n *\n * @example\n * ```ts\n * getNestedAccessor('pagination.next.id', 'lastPage')\n * // \"lastPage?.['pagination']?.['next']?.['id']\"\n * ```\n */\nexport function getNestedAccessor(param: string | Array<string>, accessor: string): string | null {\n const parts = Array.isArray(param) ? param : param.split('.')\n if (parts.length === 0 || (parts.length === 1 && parts[0] === '')) return null\n return `${accessor}?.['${`${parts.join(\"']?.['\")}']`}`\n}\n\n/**\n * Escapes an `@` at the start of a line, so a multi-line description can't start a new JSDoc tag.\n * Editors render `\\@` as `@` in hovers.\n *\n * @example\n * ```ts\n * jsDocEscape('intro\\n@example value') // 'intro\\n\\\\@example value'\n * ```\n */\nexport function jsDocEscape(input: unknown): string {\n return `${input}`.replace(/^(\\s*)@/gm, '$1\\\\@')\n}\n","import { jsDocEscape } from '@internals/utils'\nimport { ast, type Group, type Memo, type Output, type Resolver, type ResolverFileParams } from '@kubb/kit'\n\n/**\n * Builds the `ResolverFileParams` every operation generator passes to\n * `resolver.file`: a file named `name`, tagged by the operation's first\n * tag (or `'default'`), at the operation's path. Centralizes the entry object\n * that was repeated at dozens of call sites across the client and query plugins.\n *\n * @example\n * ```ts\n * resolver.file(operationFileEntry(node, node.operationId), { root, output, group })\n * ```\n */\nexport function operationFileEntry(node: ast.OperationNode, name: string, extname: ResolverFileParams['extname'] = '.ts'): ResolverFileParams {\n return {\n name,\n extname,\n tag: node.tags[0] ?? 'default',\n path: node.path,\n }\n}\n\n/**\n * Resolves the file a schema-emitting plugin (`plugin-ts`, `plugin-zod`, `plugin-faker`) writes\n * `node` to, cached in `ctx.memo` under the resolver's plugin name and the\n * operation. The plugin itself and every plugin that imports from it call this, so they all get\n * the same path.\n *\n * When that path matches the file of a component schema in `ctx.driver.inputNode`, ignoring case, the file name\n * gets an `Operation` suffix: operation `point` goes to `PointOperation.ts` next to schema `Point.ts`.\n * Otherwise the two merge into one file, or overwrite each other on a case-insensitive file system.\n * Only the file name changes. The declarations keep their names.\n *\n * @example Resolve `plugin-ts`'s file for the current operation\n * ```ts\n * const fileTs = resolveOperationFile({ ctx, node, resolver: tsResolver, root, output })\n * ```\n */\nexport function resolveOperationFile(options: {\n ctx: { memo: Memo; driver: { inputNode?: { schemas: ReadonlyArray<ast.SchemaNode> } | null } }\n node: ast.OperationNode\n resolver: Pick<Resolver, 'file' | 'pluginName'>\n root: string\n output: Output\n group?: Group | null\n}): ast.FileNode {\n const { ctx, node, resolver, root, output } = options\n const { memo } = ctx\n const location = { root, output, group: options.group ?? undefined }\n\n return memo(`${resolver.pluginName}:operationFile:${node.operationId}`, () => {\n const schemaPaths = memo(\n `${resolver.pluginName}:schemaFilePaths`,\n () =>\n new Set(\n (ctx.driver.inputNode?.schemas ?? []).flatMap((schema) =>\n schema.name ? [resolver.file({ name: schema.name, extname: '.ts', ...location }).path.toLowerCase()] : [],\n ),\n ),\n )\n let file = resolver.file({ ...operationFileEntry(node, node.operationId), ...location })\n\n for (let name = `${node.operationId}Operation`; schemaPaths.has(file.path.toLowerCase()); name += 'Operation') {\n const next = resolver.file({ ...operationFileEntry(node, name), ...location })\n // A single-file output holds every declaration on purpose, so a new name changes nothing.\n if (next.path === file.path) break\n file = next\n }\n\n return file\n })\n}\n\nexport type ContentTypeInfo = {\n contentTypes: string[]\n isMultipleContentTypes: boolean\n contentTypeUnion: string\n defaultContentType: string\n hasFormData: boolean\n}\n\nexport type RequestConfigResolver = {\n response: {\n body(node: ast.OperationNode): string\n }\n}\n\nexport type ResponseStatusNameResolver = {\n response: {\n status(node: ast.OperationNode, statusCode: ast.StatusCode): string\n }\n}\n\nexport type ResponseNameResolver = ResponseStatusNameResolver & {\n response: {\n response(node: ast.OperationNode): string\n }\n}\n\nexport type OperationTypeNameResolver = RequestConfigResolver &\n ResponseNameResolver & {\n param: {\n path(node: ast.OperationNode, param: ast.ParameterNode): string\n query(node: ast.OperationNode, param: ast.ParameterNode): string\n headers(node: ast.OperationNode, param: ast.ParameterNode): string\n cookies(node: ast.OperationNode, param: ast.ParameterNode): string\n }\n }\n\nexport type BuildOperationCommentsOptions = {\n splitLines?: boolean\n}\n\nexport type ResolveOperationTypeNameOptions = {\n responseStatusNames?: boolean | 'error'\n exclude?: ReadonlyArray<string | undefined>\n order?: 'params-first' | 'body-response-first'\n /**\n * Include the individual `Path`/`Query`/`Headers` group type names. Set to `false` for clients\n * that reference the grouped `Options` type instead of the per-group types.\n */\n includeParams?: boolean\n}\n\n/**\n * The operation's method and path as plain text, such as `` `GET /pet/{petId}` ``. A path is not a valid `{@link}` target.\n */\nfunction getOperationRequestLine(node: ast.OperationNode): string | null {\n return ast.http.isOperation(node) && node.path ? `\\`${node.method.toUpperCase()} ${node.path}\\`` : null\n}\n\n/**\n * Derives the shared `ContentTypeInfo` shape from a list of content types, tracking whether several\n * are present and the union, default, and form-data flags the client uses to pick one.\n */\nfunction buildContentTypeInfo(contentTypes: string[]): ContentTypeInfo {\n const isMultipleContentTypes = contentTypes.length > 1\n\n return {\n contentTypes,\n isMultipleContentTypes,\n contentTypeUnion: isMultipleContentTypes ? contentTypes.map((ct) => JSON.stringify(ct)).join(' | ') : '',\n defaultContentType: contentTypes[0] ?? 'application/json',\n hasFormData: contentTypes.some((ct) => ct === 'multipart/form-data'),\n }\n}\n\nexport function getContentTypeInfo(node: ast.OperationNode): ContentTypeInfo {\n return buildContentTypeInfo(node.requestBody?.content?.map((e) => e.contentType) ?? [])\n}\n\n/**\n * The request-body counterpart for the primary success response: the content types it documents and\n * whether several are present, so the client can let a caller pick which one to accept.\n */\nexport function getResponseContentTypeInfo(node: ast.OperationNode): ContentTypeInfo {\n return buildContentTypeInfo(ast.http.responses.findPrimary(node)?.content?.map((e) => e.contentType) ?? [])\n}\n\ntype ResponseType = 'blob' | 'text' | 'stream'\n\ntype ResponseContentEntry = { contentType: string; schema?: ast.SchemaNode | null; stream?: ast.ContentNode['stream'] }\n\n/**\n * How an operation streams its primary success response item by item, when that response declares one content type:\n * - `'event'` for `text/event-stream` whose `itemSchema` types the whole event with its own `event` and `data`\n * - `'data'` for `text/event-stream` typed by its payload only\n * - `'line'` for JSON Lines, one parsed JSON value per line\n *\n * Returns `null` for any other response, and for a response that also declares another content type, which stays a normal\n * call with its query hooks.\n */\nexport function getEventStream(node: ast.OperationNode): 'event' | 'data' | 'line' | null {\n const content = ast.http.responses.findPrimary(node)?.content ?? []\n if (content.length !== 1) return null\n const entry = content[0]!\n const framing = getStreamFraming(entry)\n if (framing === 'events') return entry.stream?.shape ?? 'data'\n return framing === 'lines' ? 'line' : null\n}\n\n/**\n * How a content entry is framed as a stream: `'events'` for Server-Sent Events, `'lines'` for JSON Lines.\n */\nexport function getStreamFraming(entry: Pick<ast.ContentNode, 'contentType' | 'stream'>): 'events' | 'lines' | undefined {\n if (ast.mediaType.getBase(entry) === 'text/event-stream') return 'events'\n // `multipart/mixed` with an `itemSchema` also has `stream`, but it is a stream of parts, not of JSON values.\n return entry.stream && ast.mediaType.isStream(entry) ? 'lines' : undefined\n}\n\n/**\n * Whether an operation streams its primary success response, as Server-Sent Events or JSON Lines. The client generator uses\n * this to return a typed stream of items instead of a one-shot `RequestResult`.\n */\nexport function isEventStream(node: ast.OperationNode): boolean {\n return getEventStream(node) !== null\n}\n\n// A stream without a schema is a `blob` with a string primitive, so it keeps the JSON-parse default.\nfunction isTextSchema(schema: ast.SchemaNode | null | undefined): boolean {\n if (!schema) return false\n const resolved = ast.ref.getSchema(schema)\n return resolved.type !== 'blob' && resolved.primitive === 'string'\n}\n\n/**\n * Whether an operation streams Server-Sent Events whose `data` the document types as a string, so the client keeps each\n * `data` as text instead of JSON-parsing it. With an event-shaped `itemSchema` where only some events type `data` as a\n * string, it returns the names of those events, or `false` when one of them has no fixed name.\n */\nexport function hasTextEventData(node: ast.OperationNode): boolean | Array<string> {\n const shape = getEventStream(node)\n const entry = ast.http.responses.findPrimary(node)?.content?.[0]\n if (!entry || (shape !== 'data' && shape !== 'event')) return false\n if (shape === 'data') return isTextSchema(entry.stream?.schema ?? entry.schema)\n\n const item = entry.stream?.schema ? ast.ref.getSchema(entry.stream.schema) : undefined\n if (!item) return false\n const events = item.type === 'union' ? (ast.schema.narrow(item, 'union')?.members ?? []) : [item]\n // A discriminator makes each event an intersection of its `$ref` and the pinned `event`, so every part is read.\n const propertySchemas = (event: ast.SchemaNode, propertyName: string) => ast.schema.findProperties({ node: event, propertyName }).map(({ schema }) => schema)\n const textEvents = events.filter((event) => {\n const dataSchemas = propertySchemas(event, 'data')\n return dataSchemas.length > 0 && dataSchemas.every(isTextSchema)\n })\n if (textEvents.length === events.length) return events.length > 0\n\n const eventNames = textEvents.map((event) => propertySchemas(event, 'event').flatMap((schema) => ast.schema.getLiterals(ast.ref.getSchema(schema))))\n return eventNames.length > 0 && eventNames.every((values) => values.length > 0) && [...new Set(eventNames.flat().map(String))]\n}\n\n/**\n * Whether the primary success response offers `text/event-stream`, alone or next to other content types. The client asks\n * for the stream by default and ships the `sse.ts` runtime, so a mixed response can be read as events too.\n */\nexport function hasEventStreamContent(node: ast.OperationNode): boolean {\n const entries = ast.http.responses.findPrimary(node)?.content ?? []\n // Next to another type, a stream without a schema gets no typed variant, so it keeps the plain call.\n return entries.some((entry) => getStreamFraming(entry) === 'events' && (entries.length === 1 || Boolean(entry.schema)))\n}\n\n/**\n * Whether a success response offers a stream media type next to other content types. The client returns that variant's\n * body as a `ReadableStream`, so the stream runtime is registered and a hook's data type includes the stream.\n */\nexport function hasStreamVariant(node: ast.OperationNode): boolean {\n return ast.http.responses.filterSuccess(node).some((response) => {\n const variants = (response.content ?? []).filter((entry) => entry.schema)\n return variants.length > 1 && variants.some((entry) => ast.mediaType.isStream(entry))\n })\n}\n\nconst formContentTypes = ['multipart/form-data', 'application/x-www-form-urlencoded'] as const\n\n/**\n * The form media types the operation's request body offers, `multipart/form-data` and `application/x-www-form-urlencoded`,\n * which the client needs a handler for.\n */\nexport function getFormContentTypes(node: ast.OperationNode): Array<(typeof formContentTypes)[number]> {\n const request = new Set((node.requestBody?.content ?? []).map((entry) => ast.mediaType.getBase(entry)))\n return formContentTypes.filter((contentType) => request.has(contentType))\n}\n\n/**\n * Parser for one response content entry.\n *\n * JSON stays unset so the runtime detects it. `text/event-stream` and JSON Lines are streams. A binary schema\n * (`format: binary` / `contentMediaType`) is a blob even when the media type is not a well-known\n * binary type. Other `text/*` is text, and `application/octet-stream`, `application/pdf`,\n * `image/*`, `audio/*`, and `video/*` are blobs.\n */\nfunction responseTypeForContent(entry: ResponseContentEntry): ResponseType | undefined {\n const baseType = ast.mediaType.getBase(entry)\n if (!baseType) return undefined\n if (getStreamFraming(entry)) return 'stream'\n if (ast.mediaType.isJson(baseType)) return undefined\n if (entry.schema?.type === 'blob') return 'blob'\n if (baseType.startsWith('text/')) return 'text'\n if (isBinaryContentType(baseType)) return 'blob'\n return undefined\n}\n\nfunction isBinaryContentType(baseType: string): boolean {\n return baseType === 'application/octet-stream' || baseType === 'application/pdf' || /^(image|audio|video)\\//.test(baseType)\n}\n\n/**\n * Maps a content type to the PascalCase suffix used to name per-content-type variants\n * (e.g. `application/json` → `Json`, `application/xml` → `Xml`, `multipart/form-data` → `FormData`).\n */\nfunction getContentTypeSuffix(contentType: string): string {\n // Keeps the original case, unlike ast.mediaType.getBase, so generated names stay stable.\n const baseType = contentType.split(';')[0]!.trim()\n if (baseType === 'application/json') return 'Json'\n if (baseType === 'multipart/form-data') return 'FormData'\n if (baseType === 'application/x-www-form-urlencoded') return 'FormUrlEncoded'\n const subtype = baseType.split('/').pop() ?? baseType\n const parts = subtype.split(/[^a-zA-Z0-9]+/).filter(Boolean)\n if (parts.length === 0) return 'Unknown'\n return parts.map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join('')\n}\n\n/**\n * Appends a content-type suffix to a base name, keeping a trailing `Data` segment last\n * (e.g. `AddPetData` + `Json` → `AddPetJsonData`, `AddPetStatus200` + `Xml` → `AddPetStatus200Xml`).\n */\nexport function getPerContentTypeName(baseName: string, suffix: string): string {\n if (baseName.endsWith('Data')) {\n return suffix.endsWith('Data') ? baseName.slice(0, -4) + suffix : `${baseName.slice(0, -4)}${suffix}Data`\n }\n return baseName + suffix\n}\n\nexport type ContentVariantInput = { contentType: string; schema?: ast.SchemaNode | null; keysToOmit?: Array<string> | null }\nexport type ContentVariant = { name: string; suffix: string; schema: ast.SchemaNode; keysToOmit?: Array<string> | null; contentType: string }\n\n/**\n * Returns the entry with the schema of the value the client returns: `string` for a body read as text, such as `Pet` on\n * `application/xml`, and `blob` for `image/*`, `audio/*`, `video/*`, PDF, and octet-stream. A binary schema elsewhere is a `Blob`\n * only through `parseAs: 'blob'`, which needs every entry in `entries` binary. JSON, vendor (`application/vnd.*`), stream,\n * schemaless, and wildcard entries keep their schema. `entries` is the response's full list of content types.\n */\nexport function toResponseContent<T extends ContentVariantInput & ResponseContentEntry>(entry: T, entries: ReadonlyArray<ResponseContentEntry> = [entry]): T {\n const { contentType, schema } = entry\n if (!schema || entry.stream) return entry\n\n const baseType = ast.mediaType.getBase(contentType)\n const resolved = ast.ref.getSchema(schema)\n if (isBinaryContentType(baseType)) {\n return resolved.type === 'blob' ? entry : { ...entry, schema: ast.factory.createSchema({ type: 'blob' }), keysToOmit: null }\n }\n const isPlainMediaType = Boolean(baseType) && !ast.mediaType.isJson(baseType) && !baseType.includes('*')\n if (resolved.type === 'blob') {\n // shortcut: an error response never gets `parseAs`, so a lone binary schema there reads as text too but stays `Blob`.\n const readsAsText = isPlainMediaType && !entries.every((item) => item.schema?.type === 'blob')\n return readsAsText ? { ...entry, schema: ast.factory.createSchema({ type: 'string' }), keysToOmit: null } : entry\n }\n if (resolved.primitive === 'string') return entry\n\n const responseType = responseTypeForContent(entry)\n // A response without a body, such as a 405, has no schema to read. Only `text/*` is always text.\n if (responseType !== 'text' && (resolved.type === 'unknown' || resolved.type === 'any' || resolved.type === 'void')) return entry\n const isVendorJson = /^[^/]+\\/vnd\\./.test(baseType) && !/(xml|yaml|yml|csv)$/.test(baseType)\n const isText = responseType === 'text' || (!responseType && isPlainMediaType && !isVendorJson)\n\n return isText ? { ...entry, schema: ast.factory.createSchema({ type: 'string' }), keysToOmit: null } : entry\n}\n\n/**\n * Resolves per-content-type variant names for a set of content entries, deduplicating suffix\n * collisions with a numeric counter. Entries without a schema are skipped. The returned `suffix` is\n * the final (possibly counter-augmented) value, so callers can derive parallel names in another\n * namespace (e.g. plugin-faker deriving the matching plugin-ts type name).\n */\nexport function resolveContentTypeVariants(entries: Array<ContentVariantInput>, baseName: string): Array<ContentVariant> {\n const usedNames = new Set<string>()\n return entries\n .filter((entry) => entry.schema)\n .map((entry) => {\n const baseSuffix = getContentTypeSuffix(entry.contentType)\n let suffix = baseSuffix\n let name = getPerContentTypeName(baseName, suffix)\n let counter = 2\n while (usedNames.has(name)) {\n suffix = `${baseSuffix}${counter++}`\n name = getPerContentTypeName(baseName, suffix)\n }\n usedNames.add(name)\n return { name, suffix, schema: entry.schema!, keysToOmit: entry.keysToOmit, contentType: entry.contentType }\n })\n}\n\n/**\n * Builds the `client?:` option type shared by the generated query hooks (`useQuery`,\n * `useInfiniteQuery`, `useSWR`, ...): `RequestConfig` minus what the\n * hook fills in, which is every request group and `throwOnError`. Unlike {@link buildRequestConfigType},\n * it never narrows `contentType`: query hooks wrap GET operations, which carry no request body to select\n * a content type for.\n */\nexport function buildClientOptionType(options: { omit?: Array<string> } = {}): string {\n const keys = [...requestGroupOrder, 'url', ...(options.omit ?? []), 'throwOnError']\n return `Partial<Omit<RequestConfig, ${keys.map((key) => `'${key}'`).join(' | ')}>>`\n}\n\n/**\n * The `client?:` option type of a mutation hook. When the operation has a request content type choice,\n * the mutation variables carry `contentType`, so the config leaves it out. Otherwise the ambiguous side is\n * narrowed to the operation's media types; a single-type side has nothing to pick, so it stays baked in the\n * generated call.\n */\nexport function buildRequestConfigType(node: ast.OperationNode): string {\n if (hasRequestContentTypeChoice(node)) {\n return buildClientOptionType({ omit: ['contentType'] })\n }\n\n const request = getContentTypeInfo(node)\n const response = getResponseContentTypeInfo(node)\n const members = [\n request.isMultipleContentTypes ? `request?: ${request.contentTypeUnion}` : null,\n response.isMultipleContentTypes ? `response?: ${response.contentTypeUnion}` : null,\n ].filter(Boolean)\n\n const base = buildClientOptionType()\n return members.length ? `${base} & { contentType?: { ${members.join('; ')} } }` : base\n}\n\n/** The grouped request options, in the order generated signatures and calls list them. */\nexport const requestGroupOrder = ['path', 'query', 'body', 'headers', 'cookies'] as const\n\nexport type RequestGroups = {\n path: boolean\n query: boolean\n body: boolean\n headers: boolean\n cookies: boolean\n}\n\n/**\n * Which of the grouped request options an operation carries.\n */\nexport function getRequestGroups(node: ast.OperationNode): RequestGroups {\n const { path, query, header, cookie } = ast.http.groupParameters(node)\n return {\n path: path.length > 0,\n query: query.length > 0,\n body: Boolean(ast.http.requestBody.getSchema(node)),\n headers: header.length > 0,\n cookies: cookie.length > 0,\n }\n}\n\nexport type RequestGroupOptionality = {\n groups: RequestGroups\n hasRequiredPath: boolean\n hasRequiredQuery: boolean\n hasRequiredHeader: boolean\n /**\n * Whether the grouped request parameter can default to `{}`. True only when no group carries a\n * required member, so every member is safe to omit.\n */\n isOptional: boolean\n}\n\n/**\n * Resolves which grouped request options an operation carries together with whether each group\n * holds a required member. The grouped parameter stays optional only when nothing inside it is\n * required, matching the generated `RequestConfig` type.\n */\nexport function getRequestGroupOptionality(node: ast.OperationNode): RequestGroupOptionality {\n const groups = getRequestGroups(node)\n const { path, query, header } = ast.http.groupParameters(node)\n const hasRequiredPath = path.some((param) => param.required)\n const hasRequiredQuery = query.some((param) => param.required)\n const hasRequiredHeader = header.some((param) => param.required)\n\n return {\n groups,\n hasRequiredPath,\n hasRequiredQuery,\n hasRequiredHeader,\n // `cookies` never makes the parameter required: a browser sends its cookies itself and cannot set a `Cookie` header.\n isOptional: !hasRequiredPath && !hasRequiredQuery && !hasRequiredHeader && !(groups.body && node.requestBody?.required === true),\n }\n}\n\nexport type RequestOptionsNameResolver = RequestConfigResolver & {\n response: {\n options(node: ast.OperationNode): string\n }\n}\n\n/**\n * Builds the grouped `{ path, query, body, headers, cookies }` parameter for a generated client\n * function, typed from the operation's `Options` (minus `url`). Only the groups the\n * operation actually has are destructured. The trailing `config` parameter carries the\n * runtime `RequestConfig` overrides plus `client`.\n */\nexport function buildRequestParamsSignature(\n node: ast.OperationNode,\n resolver: RequestOptionsNameResolver,\n options: { isConfigurable?: boolean } = {},\n): { signature: string; groups: RequestGroups; names: Array<keyof RequestGroups> } {\n const { isConfigurable = true } = options\n const { groups, isOptional } = getRequestGroupOptionality(node)\n\n const names = requestGroupOrder.filter((key) => groups[key])\n\n // These callers never carry the `contentType` that several media types require.\n const optionsType = hasRequestContentTypeChoice(node)\n ? `Pick<${resolver.response.options(node)}, ${names.map((name) => `'${name}'`).join(' | ')}>`\n : resolver.response.options(node)\n const firstParam = names.length > 0 ? `{ ${names.join(', ')} }: ${optionsType}${isOptional ? ' = {}' : ''}` : null\n const configParam = isConfigurable ? `config: ${buildRequestConfigType(node)} = {}` : null\n\n return {\n signature: [firstParam, configParam].filter(Boolean).join(', '),\n groups,\n names,\n }\n}\n\nexport function buildOperationComments(node: ast.OperationNode, options: BuildOperationCommentsOptions = {}): Array<string> {\n const { splitLines = false } = options\n // The request line leads: free text after a block tag would belong to that tag.\n const comments = [\n getOperationRequestLine(node),\n node.description && `@description ${node.description}`,\n node.summary && `@summary ${node.summary}`,\n node.deprecated && '@deprecated',\n node.externalDocs && `@see ${jsDocEscape([node.externalDocs.url, node.externalDocs.description].filter(Boolean).join(' '))}`,\n ]\n\n const filteredComments = comments.filter((comment): comment is string => Boolean(comment))\n\n if (!splitLines) {\n return filteredComments\n }\n\n return filteredComments.flatMap((text) => text.split(/\\r?\\n/).map((line) => line.trim())).filter((comment): comment is string => Boolean(comment))\n}\n\n/**\n * Whether the operation declares more than one request media type with a schema, so a caller must pick one on `contentType`.\n */\nexport function hasRequestContentTypeChoice(node: ast.OperationNode): boolean {\n return (node.requestBody?.content ?? []).filter((entry) => entry.schema).length > 1\n}\n\n/**\n * Casts a call argument to the client's parameter type; a `'plain'` client is non-generic.\n */\nexport function castToClientOptions(callArg: string, clientName: string, returnType: 'full' | 'data' | 'plain' = 'full'): string {\n return `${callArg} as Parameters<typeof ${clientName}${returnType === 'plain' ? '' : '<true>'}>[0]`\n}\n\n/**\n * Builds the combined `{ body, path, query, headers, cookies }` options object schema for an operation,\n * referencing the already-resolved body and grouped param names. `cookies` appears only on an operation\n * with a cookie parameter, and stays optional because a browser sends its cookies itself. Shared by `@kubb/plugin-ts`'s\n * `Options` type and `@kubb/plugin-zod`'s inferred options schema, so both printers emit the same shape from the same inputs.\n * `primitive: 'object'` is a no-op for the TS printer and tells the Zod printer to emit `z.object(…)` rather\n * than a record.\n */\nexport function buildOptionsSchema(node: ast.OperationNode, resolver: OperationTypeNameResolver, { pairContentTypes = false } = {}): ast.SchemaNode {\n const { path, query, header, cookie } = ast.http.groupParameters(node)\n const hasBody = Boolean(ast.http.requestBody.getSchema(node))\n const createNever = () => ast.factory.createSchema({ type: 'never', primitive: undefined, optional: true })\n const groups = [\n { name: 'path', params: path, resolve: resolver.param.path },\n { name: 'query', params: query, resolve: resolver.param.query },\n { name: 'headers', params: header, resolve: resolver.param.headers },\n { name: 'cookies', params: cookie, resolve: resolver.param.cookies },\n ] as const\n\n const createOptions = (body: ast.SchemaNode, extra: Array<ast.PropertyNode> = []) =>\n // NOTE(v5-stable): the fields were renamed from the legacy beta shape\n // (`data`/`pathParams`/`queryParams`/`headerParams`) to `body`/`path`/`query`/`headers` so the\n // type matches the runtime client. Drop this note once v5 leaves beta.\n ast.factory.createSchema({\n type: 'object',\n primitive: 'object',\n deprecated: node.deprecated,\n properties: [\n ast.factory.createProperty({ name: 'body', required: hasBody && node.requestBody?.required === true, schema: body }),\n ...groups\n .filter(({ name, params }) => name !== 'cookies' || params.length > 0)\n .map(({ name, params, resolve }) => {\n const required = name !== 'cookies' && params.some((param) => param.required)\n\n return ast.factory.createProperty({\n name,\n required,\n schema:\n params.length > 0\n ? ast.factory.createSchema({ type: 'ref', name: resolve.call(resolver.param, node, params[0]!), optional: !required })\n : createNever(),\n })\n }),\n ...extra,\n ],\n })\n\n const variants =\n pairContentTypes && hasRequestContentTypeChoice(node) ? resolveContentTypeVariants(node.requestBody?.content ?? [], resolver.response.body(node)) : []\n if (variants.length < 2) {\n return createOptions(hasBody ? ast.factory.createSchema({ type: 'ref', name: resolver.response.body(node) }) : createNever())\n }\n\n // The first media type is the runtime default, so only the others must pass `contentType`. A bare string sets the\n // request content type at runtime, so it is accepted next to the `{ request }` form.\n return ast.factory.createSchema({\n type: 'union',\n members: variants.map((variant, index) => {\n const contentType = ast.factory.createSchema({ type: 'enum', enumValues: [variant.contentType] })\n\n return createOptions(ast.factory.createSchema({ type: 'ref', name: variant.name }), [\n ast.factory.createProperty({\n name: 'contentType',\n required: index > 0,\n schema: ast.factory.createSchema({\n type: 'union',\n members: [\n contentType,\n ast.factory.createSchema({\n type: 'object',\n primitive: 'object',\n properties: [ast.factory.createProperty({ name: 'request', required: true, schema: contentType })],\n }),\n ],\n }),\n }),\n ])\n }),\n })\n}\n\n/**\n * The schema a status occupies in the `<Name>Responses` record. A status that documents several\n * content types becomes a `{ contentType; data }` union so the runtime can surface the negotiated type\n * on `result.parsed`, while the standalone `<Name>StatusNNN` alias stays the plain body union that the\n * query hooks and `result.data` use. With `streamData`, the stream variant of a 2xx status holds that schema, since the\n * client returns its body unread.\n */\nfunction buildResponseRecordEntry(\n node: ast.OperationNode,\n res: ast.ResponseNode,\n resolver: ResponseStatusNameResolver,\n streamData: ast.SchemaNode | undefined,\n): ast.SchemaNode {\n const statusName = resolver.response.status(node, res.statusCode)\n const variants = (res.content ?? []).filter((entry) => entry.schema)\n if (variants.length <= 1) {\n return ast.factory.createSchema({ type: 'ref', name: statusName })\n }\n\n return ast.factory.createSchema({\n type: 'union',\n members: resolveContentTypeVariants(variants, statusName).map((variant) =>\n ast.factory.createSchema({\n type: 'object',\n primitive: 'object',\n properties: [\n ast.factory.createProperty({\n name: 'contentType',\n required: true,\n // The runtime reports the bare media type, without parameters such as `charset` or `profile`.\n schema: ast.factory.createSchema({ type: 'enum', enumValues: [ast.mediaType.getBase(variant)] }),\n }),\n ast.factory.createProperty({\n name: 'data',\n required: true,\n schema:\n streamData && ast.http.status.isSuccess(res) && ast.mediaType.isStream(variant)\n ? streamData\n : ast.factory.createSchema({ type: 'ref', name: variant.name }),\n }),\n ],\n }),\n ),\n })\n}\n\n/**\n * Builds the per-status `<Name>Responses` record for an operation, referencing the already-resolved\n * `<Name>StatusNNN` names. Shared by `@kubb/plugin-ts`'s `Responses` type and `@kubb/plugin-zod`'s\n * inferred responses schema, so both emit the same shape from the same inputs.\n *\n * Always emits the keyed record, even when an operation declares no responses. An operation with no\n * responses renders as an empty object, which keeps every consumer's import (for example the axios\n * SDK's `RequestResult<XResponses>`) resolvable instead of pointing at a missing export.\n *\n * `streamData` is the type of a stream variant's `data`, such as a `ReadableStream<Uint8Array>` reference.\n */\nexport function buildResponses(\n node: ast.OperationNode,\n resolver: ResponseStatusNameResolver,\n { streamData }: { streamData?: ast.SchemaNode } = {},\n): ast.SchemaNode {\n return ast.factory.createSchema({\n type: 'object',\n primitive: 'object',\n properties: node.responses.map((res) =>\n ast.factory.createProperty({\n name: String(res.statusCode),\n required: true,\n schema: buildResponseRecordEntry(node, res, resolver, streamData),\n }),\n ),\n })\n}\n\nexport function resolveErrorNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return ast.http.responses.filterError(node).map((response) => resolver.response.status(node, response.statusCode))\n}\n\nexport function resolveSuccessNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return ast.http.responses.filterSuccess(node).map((response) => resolver.response.status(node, response.statusCode))\n}\n\nexport function resolveStatusCodeNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses.map((response) => resolver.response.status(node, response.statusCode))\n}\n\n/**\n * Lists the type names an operation's types file declares, computed once per resolver and `options` so every\n * dependent reads the same list.\n */\nexport function resolveOperationTypeNames(\n node: ast.OperationNode,\n resolver: OperationTypeNameResolver & Pick<Resolver, 'memo'>,\n options: ResolveOperationTypeNameOptions = {},\n): string[] {\n const key = `${node.operationId}\\0${options.order ?? ''}\\0${options.responseStatusNames ?? ''}\\0${options.includeParams === false ? 'noparams' : ''}\\0${(options.exclude ?? []).join(',')}`\n return resolver.memo(`operationTypeNames:${key}`, () => {\n const { path, query, header, cookie } = ast.http.groupParameters(node)\n const responseStatusNames =\n options.responseStatusNames === 'error'\n ? resolveErrorNames(node, resolver)\n : options.responseStatusNames === false\n ? []\n : resolveStatusCodeNames(node, resolver)\n const exclude = new Set(options.exclude ?? [])\n const paramNames =\n options.includeParams === false\n ? []\n : [\n ...path.map((param) => resolver.param.path(node, param)),\n ...query.map((param) => resolver.param.query(node, param)),\n ...header.map((param) => resolver.param.headers(node, param)),\n ...cookie.map((param) => resolver.param.cookies(node, param)),\n ]\n const bodyAndResponseNames = [ast.http.requestBody.getSchema(node) ? resolver.response.body(node) : null, resolver.response.response(node)]\n const names =\n options.order === 'body-response-first'\n ? [...bodyAndResponseNames, ...paramNames, ...responseStatusNames]\n : [...paramNames, ...bodyAndResponseNames, ...responseStatusNames]\n\n return names.filter((name): name is string => Boolean(name) && !exclude.has(name as string))\n })\n}\n\nexport function resolveResponseTypes(node: ast.OperationNode, resolver: ResponseNameResolver): Array<[statusCode: number | 'default', typeName: string]> {\n const types: Array<[number | 'default', string]> = []\n\n for (const response of node.responses) {\n if (response.statusCode === 'default') {\n types.push(['default', resolver.response.response(node)])\n continue\n }\n\n const code = Number(response.statusCode)\n if (Number.isNaN(code)) {\n continue\n }\n\n types.push([code, ast.http.status.isSuccess(code) ? resolver.response.response(node) : resolver.response.status(node, response.statusCode)])\n }\n\n return types\n}\n","import { ensureValidVarName, toFilePath } from '@internals/utils'\nimport { ast, casing } from '@kubb/kit'\nimport type { GeneratorContext, Resolver, ResolverFile } from '@kubb/kit'\n\n/**\n * The shared top-level `name` of the operation plugins, computed once per operation name and build.\n */\nexport function resolveOperationName(this: Resolver, name: string): string {\n return this.memo(`operation:${name}`, () => ensureValidVarName(casing.camel(name)))\n}\n\n/**\n * Builds the allocation key for a declaration an operation owns. `scope` names which declaration\n * it is, so two of them never share an allocation even when a custom resolver gives both the same\n * name. Leave `scope` empty for the operation's own declaration.\n *\n * The key starts from the operation's input `pointer`, which macros keep, so a plugin whose macro\n * rewrites the method or path still resolves another plugin's names for the same operation.\n *\n * @example\n * ```ts\n * resolver.resolveName({ key: operationKey(node, 'response', 'status', 404), name })\n * ```\n */\nexport function operationKey(node: ast.OperationNode, ...scope: Array<string | number>): Array<string | undefined> {\n const source = node.pointer ? [node.pointer] : [node.method, node.path]\n return ['operation', ...source, ...scope.map(String)]\n}\n\n/**\n * The `param` namespace shared by the schema-producing plugins (ts, zod, faker):\n * per-parameter names plus the grouped `Path`/`Query`/`Headers`/`Cookies` names, all routed\n * through the plugin's top-level `name` casing.\n */\nexport type OperationParamResolver = {\n name(this: Resolver, node: ast.OperationNode, param: ast.ParameterNode): string\n path(this: Resolver, node: ast.OperationNode): string\n query(this: Resolver, node: ast.OperationNode): string\n headers(this: Resolver, node: ast.OperationNode): string\n cookies(this: Resolver, node: ast.OperationNode): string\n}\n\n/**\n * The `response` namespace shared by the schema-producing plugins: per-status,\n * body, and combined response names, all routed through the plugin's top-level\n * `name` casing.\n */\nexport type OperationResponseResolver = {\n status(this: Resolver, node: ast.OperationNode, statusCode: ast.StatusCode): string\n /**\n * Name of the headers a response declares, such as `ListPetsStatus200Headers`.\n */\n headers(this: Resolver, node: ast.OperationNode, statusCode: ast.StatusCode): string\n body(this: Resolver, node: ast.OperationNode): string\n responses(this: Resolver, node: ast.OperationNode): string\n response(this: Resolver, node: ast.OperationNode): string\n}\n\n/**\n * Builds the shared `param` namespace. Spread the result into `createResolver`\n * and override individual methods next to it when a plugin deviates.\n *\n * @example\n * ```ts\n * createResolver<PluginTs>({ param: createOperationParamResolver(), ... })\n * ```\n */\nexport function createOperationParamResolver(): OperationParamResolver {\n return {\n name(node, param) {\n const name = this.name(`${node.operationId} ${param.in} ${param.name}`)\n return this.resolveName({ key: operationKey(node, 'param', 'name', param.in, param.name), name })\n },\n path(node) {\n const name = this.name(`${node.operationId} Path`)\n return this.resolveName({ key: operationKey(node, 'param', 'path'), name })\n },\n query(node) {\n const name = this.name(`${node.operationId} Query`)\n return this.resolveName({ key: operationKey(node, 'param', 'query'), name })\n },\n headers(node) {\n const name = this.name(`${node.operationId} Headers`)\n return this.resolveName({ key: operationKey(node, 'param', 'headers'), name })\n },\n cookies(node) {\n const name = this.name(`${node.operationId} Cookies`)\n return this.resolveName({ key: operationKey(node, 'param', 'cookies'), name })\n },\n }\n}\n\n/**\n * Builds the shared `response` namespace. Spread the result into\n * `createResolver` and add plugin-specific methods (`options`, `error`) next\n * to it.\n *\n * @example\n * ```ts\n * createResolver<PluginTs>({ response: { ...createOperationResponseResolver(), options(node) {...} }, ... })\n * ```\n */\nexport function createOperationResponseResolver(): OperationResponseResolver {\n return {\n status(node, statusCode) {\n const name = this.name(`${node.operationId} Status ${statusCode}`)\n return this.resolveName({ key: operationKey(node, 'response', 'status', statusCode), name })\n },\n headers(node, statusCode) {\n const name = this.name(`${node.operationId} Status ${statusCode} Headers`)\n return this.resolveName({ key: operationKey(node, 'response', 'headers', statusCode), name })\n },\n body(node) {\n const name = this.name(`${node.operationId} Body`)\n return this.resolveName({ key: operationKey(node, 'response', 'body'), name })\n },\n responses(node) {\n const name = this.name(`${node.operationId} Responses`)\n return this.resolveName({ key: operationKey(node, 'response', 'responses'), name })\n },\n response(node) {\n const name = this.name(`${node.operationId} Response`)\n return this.resolveName({ key: operationKey(node, 'response', 'response'), name })\n },\n }\n}\n\n/**\n * Builds a resolver `file` override whose base name runs every path segment\n * through `toFilePath`, casing the final segment with `caseLast`.\n *\n * @example\n * ```ts\n * createResolver<PluginTs>({ file: createCasedFile(pascalCase), ... })\n * ```\n */\nexport function createCasedFile(caseLast: (part: string) => string): ResolverFile {\n return {\n baseName({ name, extname }) {\n return this.memo(`file:${name}\\0${extname}`, (): ast.FileNode['baseName'] => `${toFilePath(name, caseLast)}${extname}`)\n },\n }\n}\n\ntype SchemaIndexContext = Pick<GeneratorContext, 'memo' | 'driver'>\n\n/**\n * Names of the schemas in a circular reference chain, computed once per build.\n */\nexport function getCircularNames(ctx: SchemaIndexContext): ReadonlySet<string> {\n return ctx.memo('circularNames:set', () => ast.graph.getCircularNames(ctx.driver.inputNode?.schemas ?? []))\n}\n\n/**\n * Names of the schemas whose type is `enum`, computed once per build.\n */\nexport function getEnumNames(ctx: SchemaIndexContext): ReadonlySet<string> {\n return ctx.memo(\n 'enumNames:set',\n () => new Set((ctx.driver.inputNode?.schemas ?? []).flatMap((schema) => (schema.type === 'enum' && schema.name ? [schema.name] : []))),\n )\n}\n\ndeclare global {\n namespace Kubb {\n interface MemoRegistry {\n operation: string\n file: ast.FileNode['baseName']\n operationTypeNames: Array<string>\n }\n }\n}\n","import { type ast, Diagnostics, type GeneratorContext, type Group, type Output } from '@kubb/kit'\nimport { pluginTsName, type ResolverTs } from '@kubb/plugin-ts'\nimport type { PluginZod, ResolverZod } from '@kubb/plugin-zod'\n\n// A type-only import: the query plugins bundle this file but do not depend on @kubb/plugin-zod.\nconst pluginZodName = 'plugin-zod' satisfies PluginZod['name']\n\ntype GeneratorDriver = GeneratorContext['driver']\n\n/**\n * The per-operation type names a generated client references: the grouped input, the per-status\n * responses record its `RequestResult` is keyed on, and the headers each response declares.\n */\nexport type OperationTypeNames = {\n response: {\n /**\n * Resolves the name of the operation's grouped `{ body, path, query, headers, cookies }` input type.\n */\n options(node: ast.OperationNode): string\n /**\n * Resolves the name of the operation's per-status responses record type.\n */\n responses(node: ast.OperationNode): string\n /**\n * Resolves the name of the type of the headers one response declares. Left out, results keep untyped headers.\n */\n headers?(node: ast.OperationNode, statusCode: ast.StatusCode): string\n }\n}\n\nfunction getResponseHeadersEntries({ node, types }: { node: ast.OperationNode; types: OperationTypeNames }): Array<[ast.StatusCode, string]> {\n const resolve = types.response.headers\n if (!resolve) return []\n return node.responses\n .filter((response) => response.headers?.length)\n .map((response) => [response.statusCode, resolve.call(types.response, node, response.statusCode)])\n}\n\n/**\n * The headers type argument of `RequestResult`, such as `{ '200': LoginUserStatus200Headers }`, or `null` when no response declares headers.\n */\nexport function buildResponseHeadersType({ node, types }: { node: ast.OperationNode; types: OperationTypeNames }): string | null {\n const entries = getResponseHeadersEntries({ node, types }).map(([statusCode, name]) => `'${statusCode}': ${name}`)\n return entries.length ? `{ ${entries.join('; ')} }` : null\n}\n\n/**\n * A runtime result type, such as `RequestResult`, in its `WithHeaders` form when `headers` is set.\n */\nexport function resultTypeName(name: string, headers: boolean): string {\n return headers ? `${name}WithHeaders` : name\n}\n\n/**\n * A runtime result type with its arguments, such as `RequestResultWithHeaders<Responses, Headers, ThrowOnError>`.\n */\nexport function buildResultTypeRef(name: string, responses: string, headers: string | null, rest: Array<string | null> = []): string {\n return `${resultTypeName(name, headers !== null)}<${[responses, headers, ...rest].filter(Boolean).join(', ')}>`\n}\n\n/**\n * The names of the headers types `buildResponseHeadersType` references, for the file's imports.\n */\nexport function getResponseHeadersTypeNames({ node, types }: { node: ast.OperationNode; types: OperationTypeNames }): Array<string> {\n return getResponseHeadersEntries({ node, types }).map(([, name]) => name)\n}\n\n/**\n * Where a generated client sources its operation types, plus the resolver and output the file\n * declaring them is resolved with.\n */\nexport type OperationTypeSource = OperationTypeNames & {\n /**\n * `plugin-ts` shaped resolver of the plugin supplying the names, also used to resolve the file they are exported from.\n */\n resolver: ResolverTs\n /**\n * The supplying plugin's own `output`, when it configured one.\n */\n output: Output | undefined\n /**\n * The supplying plugin's own `group`, when it configured one.\n */\n group: Group | undefined\n}\n\n/**\n * A `plugin-ts` shaped resolver whose operation type names point at the types `pluginZod({ inferred })`\n * exports next to each schema, so code written against `plugin-ts` names picks up the zod types.\n */\nfunction toZodTypeResolver(resolver: ResolverZod): ResolverTs {\n const type = (name: string) => resolver.schema.type(name)\n\n return {\n ...resolver,\n // Class methods, so a spread drops them. `file` reads private fields, and `memo` gets its own key\n // space so these type names never share an entry with the zod names.\n file: resolver.file.bind(resolver),\n memo: (key: string, compute: () => unknown) => resolver.memo(`zodTypes:${key}`, compute),\n param: {\n name: (node: ast.OperationNode, p: ast.ParameterNode) => type(resolver.param.name(node, p)),\n path: (node: ast.OperationNode, p: ast.ParameterNode) => type(resolver.param.path(node, p)),\n query: (node: ast.OperationNode, p: ast.ParameterNode) => type(resolver.param.query(node, p)),\n headers: (node: ast.OperationNode, p: ast.ParameterNode) => type(resolver.param.headers(node, p)),\n cookies: (node: ast.OperationNode, p: ast.ParameterNode) => type(resolver.param.cookies(node, p)),\n },\n response: {\n body: (node: ast.OperationNode) => type(resolver.response.body(node)),\n status: (node: ast.OperationNode, statusCode: ast.StatusCode) => type(resolver.response.status(node, statusCode)),\n response: (node: ast.OperationNode) => type(resolver.response.response(node)),\n responses: (node: ast.OperationNode) => type(resolver.response.responses(node)),\n headers: (node: ast.OperationNode, statusCode: ast.StatusCode) => type(resolver.response.headers(node, statusCode)),\n options: (node: ast.OperationNode) => resolver.response.options(node),\n },\n } as unknown as ResolverTs\n}\n\n/**\n * Picks the plugin generated clients, query hooks, and MCP handlers take their operation types from.\n *\n * `pluginZod({ inferred: 'codec' })` wins, so a codec param takes its domain value. Otherwise `plugin-ts`\n * wins when it is in the pipeline, and without it any `pluginZod({ inferred })`. Throws\n * `KUBB_MISSING_DEPENDENCY` for `pluginName` when neither is available.\n *\n * @example\n * ```ts\n * const types = resolveOperationTypes(ctx.driver, ctx.plugin.name)\n * types.response.options(node) // 'GetPetByIdOptions', or 'GetPetByIdOptionsSchemaType' from zod\n * ```\n */\nexport function resolveOperationTypes(driver: GeneratorDriver, pluginName: string): OperationTypeSource {\n return driver.memo(`operationTypes:${pluginName}`, () => {\n const pluginTs = driver.getPlugin(pluginTsName)\n const pluginZod = driver.getPlugin(pluginZodName)\n\n if (pluginTs && pluginZod?.options?.inferred !== 'codec') {\n const resolver = driver.getResolver(pluginTsName)\n return { response: resolver.response, resolver, output: pluginTs.options?.output, group: pluginTs.options?.group ?? undefined }\n }\n\n if (!pluginZod?.options?.inferred) {\n throw new Diagnostics.Error({\n code: Diagnostics.code.missingDependency,\n severity: 'error',\n message: `Plugin \"${pluginName}\" has no source for operation types.`,\n help: `Add \\`pluginTs()\\` before \"${pluginName}\", or add \\`pluginZod({ inferred: true })\\`.`,\n location: { kind: 'config' },\n plugin: pluginName,\n })\n }\n\n const resolver = toZodTypeResolver(driver.getResolver(pluginZodName))\n return { response: resolver.response, resolver, output: pluginZod.options.output, group: pluginZod.options.group ?? undefined }\n })\n}\n\ndeclare global {\n namespace Kubb {\n interface MemoRegistry {\n operationTypes: OperationTypeSource\n /**\n * Nests every key the zod-backed `ResolverTs` memoizes, so it holds each of their value types.\n */\n zodTypes: unknown\n }\n }\n}\n","import { isValidVarName, objectKey, toLiteral } from '@internals/utils'\nimport { ast, text } from '@kubb/kit'\n\n/**\n * A resolved security scheme. The runtime calls the configured `auth` resolver with this object and places the\n * returned token: `http` bearer/basic on `Authorization`, `apiKey` under `name` in the header/query/cookie, and\n * `oauth2`/`openIdConnect` as a bearer token.\n */\nexport type Auth = {\n type: 'http' | 'apiKey' | 'oauth2' | 'openIdConnect'\n scheme?: 'bearer' | 'basic'\n name?: string\n in?: 'header' | 'query' | 'cookie'\n scopes?: Array<string>\n flows?: Record<string, Omit<ast.OAuthFlow, 'scopes'>>\n metadataUrl?: string\n url?: string\n}\n\n/**\n * One entry of a generated call's `security` array: an OpenAPI security requirement, as one scheme or as the schemes it\n * needs together. The runtime sends the first requirement whose schemes all resolve a token.\n */\nexport type SecurityRequirement = OperationAuth | Array<OperationAuth>\n\n/**\n * A scheme of one operation. `ref` names its entry in `securitySchemes`, which the call then points at.\n */\ntype OperationAuth = Auth & { ref?: string }\n\n// The order the keys of an inline scheme are printed in.\nconst inlineAuthKeys = ['type', 'scheme', 'name', 'in', 'scopes', 'flows', 'metadataUrl', 'url'] as const\n\nfunction serializeScheme({ ref, ...auth }: OperationAuth): string {\n const scopes = auth.scopes?.length ? auth.scopes : undefined\n if (ref) {\n const schemeRef = isValidVarName(ref) ? `securitySchemes.${ref}` : `securitySchemes[${text.quote(ref)}]`\n return scopes ? `{ ...${schemeRef}, scopes: ${toLiteral(scopes)} }` : schemeRef\n }\n const entries = inlineAuthKeys.flatMap((key) => {\n const entryValue = key === 'scopes' ? scopes : auth[key]\n return entryValue ? [`${key}: ${toLiteral(entryValue)}`] : []\n })\n return `{ ${entries.join(', ')} }`\n}\n\nfunction serializeRequirement(requirement: SecurityRequirement): string {\n return Array.isArray(requirement) ? `[${requirement.map(serializeScheme).join(', ')}]` : serializeScheme(requirement)\n}\n\n/**\n * Maps an AST credential to the inline `Auth` object, or `null` for `mutualTLS`, which the runtime cannot send.\n * `http` schemes other than `basic` are treated as bearer. OAuth2 and OpenID Connect keep their URLs for the `auth` resolver.\n */\nexport function resolveCredential(credential: ast.AuthCredential): Auth | null {\n if (credential.type === 'apiKey') return { type: 'apiKey', name: credential.name, in: credential.in }\n if (credential.type === 'http') return { type: 'http', scheme: credential.scheme === 'basic' ? 'basic' : 'bearer' }\n if (credential.type === 'oauth2') {\n const flows = Object.fromEntries(Object.entries(credential.flows).map(([name, { scopes: _scopes, ...urls }]) => [name, urls]))\n return {\n type: 'oauth2',\n ...(Object.keys(flows).length ? { flows } : {}),\n ...(credential.metadataUrl ? { metadataUrl: credential.metadataUrl } : {}),\n }\n }\n if (credential.type === 'openIdConnect') return { type: 'openIdConnect', ...(credential.url ? { url: credential.url } : {}) }\n return null\n}\n\n/**\n * Derives the per-operation security metadata from `OperationNode.auth` and the document's `meta.auth` schemes. Each\n * requirement becomes one entry: its scheme, or an array of its schemes when it needs several together. A requirement\n * with a scheme the runtime cannot place or that is not declared is left out, since it can never be met, and so is a\n * repeated one. With `hoist`, each scheme carries its name as `ref`.\n *\n * @example\n * `getOperationSecurity({ auth: [[{ scheme: 'bearerAuth' }]], schemes: meta.auth })`\n * `// [{ type: 'http', scheme: 'bearer' }]`\n * @example\n * `// auth: [[{ scheme: 'api_key' }, { scheme: 'session' }]] gives [[{ type: 'apiKey', ... }, { type: 'apiKey', ... }]]`\n */\nexport function getOperationSecurity({\n auth,\n schemes,\n hoist,\n}: {\n auth: Array<ast.AuthRequirement> | undefined\n schemes: Array<ast.AuthScheme> | undefined\n hoist?: boolean\n}): Array<SecurityRequirement> | undefined {\n const security = ast.auth.getRequirements({ auth, schemes }).flatMap((requirement): Array<SecurityRequirement> => {\n const resolved = requirement.map(({ name, credential, scopes }) => {\n const entry = resolveCredential(credential)\n return entry && { ...entry, ...(scopes.length ? { scopes } : {}), ...(hoist ? { ref: name } : {}) }\n })\n if (!resolved.length || !resolved.every((entry): entry is OperationAuth => entry !== null)) return []\n return [resolved.length === 1 ? resolved[0]! : resolved]\n })\n\n return security.length ? security : undefined\n}\n\n/**\n * Serializes the per-operation security into the literal emitted on each generated call's `security`\n * field. The runtime `resolveAuth` helper walks it, calling the configured `auth` resolver per scheme.\n *\n * @example\n * `buildSecurityMetadata({ security: [{ type: 'http', scheme: 'bearer' }] }) // \"[{ type: 'http', scheme: 'bearer' }]\"`\n */\nexport function buildSecurityMetadata({ security }: { security?: Array<SecurityRequirement> }): string | null {\n if (!security?.length) return null\n return `[${security.map(serializeRequirement).join(', ')}]`\n}\n\n/**\n * The `securitySchemes` const of `.kubb/client.ts`: every scheme the runtime can place, by name, or `null` without one.\n */\nexport function buildSecuritySchemes(schemes: Array<ast.AuthScheme> | undefined): string | null {\n const entries = (schemes ?? []).flatMap(({ name, credential }) => {\n const auth = resolveCredential(credential)\n return auth ? [`${objectKey(name)}: ${serializeScheme(auth)}`] : []\n })\n if (!entries.length) return null\n return `/**\\n * The security schemes from the spec by name. A generated call sends one of them to the \\`auth\\` resolver.\\n */\\nexport const securitySchemes = { ${entries.join(', ')} } as const`\n}\n","import { ast, text } from '@kubb/kit'\nimport type { ResolverZod } from '@kubb/plugin-zod'\nimport type { ValidatorOptions } from '../types.ts'\n\n/**\n * Returns `true` when any direction of the validator uses zod (used for dependency checks).\n */\nexport function isValidatorEnabled(validator: ValidatorOptions | undefined): boolean {\n if (!validator) return false\n if (validator === 'zod') return true\n return Boolean(validator.request || validator.params || validator.response)\n}\n\n/**\n * Returns `'zod'` when request body parsing is enabled, `null` otherwise. The string shorthand\n * `'zod'` validates the response only, so it does not enable request parsing.\n */\nexport function resolveRequestValidator(validator: ValidatorOptions | undefined): 'zod' | null {\n if (!validator || validator === 'zod') return null\n return validator.request ?? null\n}\n\n/**\n * Returns `'zod'` when path, query, and header params parsing is enabled, `null` otherwise. Only the\n * object form `{ params: 'zod' }` enables it.\n */\nexport function resolveParamsValidator(validator: ValidatorOptions | undefined): 'zod' | null {\n if (!validator || validator === 'zod') return null\n return validator.params ?? null\n}\n\n/**\n * Returns `'zod'` when response parsing is enabled, `null` otherwise. The string shorthand `'zod'`\n * maps to response parsing.\n */\nexport function resolveResponseValidator(validator: ValidatorOptions | undefined): 'zod' | null {\n if (!validator) return null\n if (validator === 'zod') return 'zod'\n return validator.response ?? null\n}\n\n/**\n * Builds the `validator.error` map of a call, one plugin-zod `<operation>StatusNNNSchema` per non-2xx response with a\n * schema, such as `{ 404: getPetStatus404Schema, '5xx': getPetStatus5xxSchema }`. Returns `null` without one.\n */\nexport function buildZodErrorParse(node: ast.OperationNode, zodResolver: ResolverZod): { literal: string; names: Array<string> } | null {\n const entries = node.responses\n .filter((res) => !ast.http.status.isSuccess(res) && res.content?.some((entry) => entry.schema))\n .map((res) => ({ key: String(res.statusCode), name: zodResolver.response.status(node, res.statusCode) }))\n if (!entries.length) return null\n const literal = entries.map(({ key, name }) => `${/^\\d+$/.test(key) ? key : text.quote(key)}: ${name}`).join(', ')\n return { literal: `{ ${literal} }`, names: entries.map(({ name }) => name) }\n}\n","import { ast } from '@kubb/kit'\nimport type { ResolverZod } from '@kubb/plugin-zod'\nimport type { ValidatorOptions } from '../types.ts'\nimport { buildZodErrorParse, resolveParamsValidator, resolveRequestValidator, resolveResponseValidator } from './validatorOptions.ts'\n\n/**\n * The per-call validator references a generated function wires into its request config. Each hook is\n * the bare schema reference passed to the runtime's `validator.request` / `validator.path` /\n * `validator.query` / `validator.headers` / `validator.cookies` / `validator.response` / `validator.error` slot. `client.ts`\n * runs it through `validateStandardSchema`. The response validator only ever sees success (2xx) bodies.\n */\nexport type ValidatorHooks = {\n /**\n * Schema reference for the `validator.request` hook, or `null` when request validation is off.\n */\n request: string | null\n /**\n * Schema references for the `validator.path` / `query` / `headers` / `cookies` hooks (`headers` wrapped in\n * `toHeadersStandardSchema`), or `null` when params validation is off or the group is empty.\n */\n path: string | null\n query: string | null\n headers: string | null\n cookies: string | null\n /**\n * Schema reference for the `validator.response` hook, or `null` when response validation is off.\n */\n response: string | null\n /** Per-status schema map for `validator.error`, such as `{ 404: getPetStatus404Schema }`, or `null` when off or absent. */\n error: string | null\n /**\n * Zod schema names the generated file imports from the zod plugin output.\n */\n importedZodNames: Array<string>\n}\n\n/**\n * Builds the validator-hook references for one operation. Request body and params validation run before the send.\n * Response validation runs on the success body only. Returns `null` references when the matching\n * direction is disabled or the schema is absent.\n */\nexport function buildValidatorHooks({\n node,\n validator,\n zodResolver,\n}: {\n node: ast.OperationNode\n validator: ValidatorOptions | undefined\n zodResolver: ResolverZod | null | undefined\n}): ValidatorHooks {\n const hasRequestBody = Boolean(ast.http.requestBody.getSchema(node))\n const parsesResponse = zodResolver && resolveResponseValidator(validator) === 'zod'\n\n // Success responses validate with the success-only `<operation>ResponseSchema`; error bodies with the schema of their status.\n // plugin-zod emits that schema only for an operation with a response body schema.\n const hasResponseSchema = node.responses.some((res) => res.content?.some((entry) => entry.schema))\n const response = parsesResponse && hasResponseSchema ? zodResolver.response.response(node) || null : null\n const errorParse = parsesResponse ? buildZodErrorParse(node, zodResolver) : null\n const request = zodResolver && resolveRequestValidator(validator) === 'zod' && hasRequestBody ? zodResolver.response.body(node) || null : null\n\n const paramGroups = ast.http.groupParameters(node)\n const resolveParamsName = (kind: 'path' | 'query' | 'headers' | 'cookies', params: Array<ast.ParameterNode>): string | null =>\n zodResolver && resolveParamsValidator(validator) === 'zod' && params.length > 0 ? zodResolver.param[kind](node, params[0]!) : null\n const path = resolveParamsName('path', paramGroups.path)\n const query = resolveParamsName('query', paramGroups.query)\n const headers = resolveParamsName('headers', paramGroups.header)\n const cookies = resolveParamsName('cookies', paramGroups.cookie)\n\n // Order is output: the generated file imports the response schema, then the error schemas, then the request body and params schemas.\n const importedZodNames = [response, ...(errorParse?.names ?? []), request, path, query, headers, cookies].filter((name): name is string => Boolean(name))\n\n const headersValidator = headers ? `toHeadersStandardSchema(${headers}, ${headers}.shape)` : null\n\n return { request, path, query, headers: headersValidator, cookies, response, error: errorParse?.literal ?? null, importedZodNames }\n}\n\n/**\n * Prints the `validator: { … }` entry of a call config from the hooks named in `keys`, or `null` when none is set.\n * The entry spreads `config.validator` last, so a per-call hook overrides the generated one for its key only.\n */\nexport function buildValidatorLiteral(hooks: ValidatorHooks | null, keys: ReadonlyArray<keyof Omit<ValidatorHooks, 'importedZodNames'>>): string | null {\n const entries = keys.flatMap((key) => (hooks?.[key] ? [`${key}: ${hooks[key]}`] : []))\n return entries.length ? `validator: { ${entries.join(', ')}, ...config.validator }` : null\n}\n","import { getResponseHeadersTypeNames, type OperationTypeNames, type OperationTypeSource } from '@internals/client'\nimport { operationKey, resolveOperationFile } from '@internals/shared'\nimport { ast, type Generator } from '@kubb/kit'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport type { ContractClientFactory } from '../types.ts'\nimport { getOperationSecurity, type SecurityRequirement } from './security.ts'\nimport { buildValidatorHooks, type ValidatorHooks } from './validator.ts'\nimport { isValidatorEnabled } from './validatorOptions.ts'\n\nexport type GeneratorContext = Parameters<NonNullable<Generator<ContractClientFactory>['operations']>>[1]\n\nexport type OperationData = {\n node: ast.HttpOperationNode\n name: string\n types: OperationTypeNames\n typeFile: ast.FileNode\n /**\n * `null` unless `validator` turns a direction on.\n */\n zodFile: ast.FileNode | null\n validatorHooks: ValidatorHooks\n /**\n * The names of the headers types the result references.\n */\n headerTypeNames: Array<string>\n security?: Array<SecurityRequirement>\n baseURL?: string\n}\n\n/**\n * Resolves what the function and SDK generators both print for one operation: its name, the files its types and zod\n * schemas come from, and its validator hooks, security, base URL and response headers types.\n */\nexport function resolveOperationData({ node, ctx, types }: { node: ast.HttpOperationNode; ctx: GeneratorContext; types: OperationTypeSource }): OperationData {\n const { driver, resolver, root } = ctx\n const { output, validator, importPath } = ctx.options\n const pluginZod = isValidatorEnabled(validator) ? driver.getPlugin(pluginZodName) : null\n const zodResolver = pluginZod ? driver.getResolver(pluginZodName) : null\n\n return {\n node,\n name: resolver.resolveName({ key: operationKey(node), name: resolver.name(node.operationId) }),\n types,\n typeFile: resolveOperationFile({ ctx, node, resolver: types.resolver, root, output: types.output ?? output, group: types.group }),\n zodFile:\n zodResolver && pluginZod?.options\n ? resolveOperationFile({\n ctx,\n node,\n resolver: zodResolver,\n root,\n output: pluginZod.options.output ?? output,\n group: pluginZod.options.group ?? undefined,\n })\n : null,\n validatorHooks: buildValidatorHooks({ node, validator, zodResolver }),\n headerTypeNames: getResponseHeadersTypeNames({ node, types }),\n // The fetch and axios clients write `securitySchemes` into `.kubb/client.ts`. A custom client module has none.\n security: getOperationSecurity({ auth: node.auth, schemes: ctx.meta.auth, hoist: importPath === undefined }),\n baseURL: ast.http.getBaseURL(\n ast.server.get({ servers: node.servers, index: (ctx.adapter.options as { server?: { index?: number } } | undefined)?.server?.index }),\n ),\n }\n}\n","import type { ast } from '@kubb/kit'\nimport { buildResponseHeadersType, buildResultTypeRef, type OperationTypeNames } from '@internals/client'\nimport type { ReturnTypeOption } from '../types.ts'\n\n/**\n * Builds the `RequestResult` type arguments of one operation: responses, `ThrowOnError` and the response headers, when a response declares any.\n *\n * @example\n * `buildRequestResultGenerics({ node, types }) // \"LoginUserResponses, ThrowOnError, { '200': LoginUserStatus200Headers }\"`\n */\nexport function buildRequestResultGenerics({ node, types }: { node: ast.OperationNode; types: OperationTypeNames }): string {\n return [types.response.responses(node), 'ThrowOnError', buildResponseHeadersType({ node, types })].filter(Boolean).join(', ')\n}\n\n/**\n * Builds the full return type an operation's function signature uses: `Unwrappable<RequestResult>`\n * for the default `returnType: 'full'`, already a promise so no further wrapping is needed, a plain\n * `Promise<RequestResult>` for the internal `'plain'` shape, or a\n * `Promise` of the runtime's `UnwrappedResult` when `returnType: 'data'` narrows a resolved call\n * down to the bare success body.\n *\n * @example\n * `buildResultType({ node, types, returnType: 'data' }) // 'Promise<UnwrappedResult<AddPetResponses, ThrowOnError>>'`\n */\nexport function buildResultType({ node, types, returnType }: { node: ast.OperationNode; types: OperationTypeNames; returnType: ReturnTypeOption }): string {\n const name = returnType === 'data' ? 'UnwrappedResult' : 'RequestResult'\n const result = buildResultTypeRef(name, types.response.responses(node), buildResponseHeadersType({ node, types }), ['ThrowOnError'])\n return returnType === 'full' ? `Unwrappable<${result}>` : `Promise<${result}>`\n}\n","import { getEventStream } from '@internals/shared'\nimport type { ast } from '@kubb/kit'\nimport { buildResponseHeadersType, buildResultTypeRef, resultTypeName, type OperationTypeNames } from '@internals/client'\nimport type { ReturnTypeOption } from '../types.ts'\nimport { buildRequestResultGenerics } from './generics.ts'\n\n/**\n * Builds the return statement of a generated operation function. The client call takes the responses record and\n * `ThrowOnError` as type arguments, so its result is already the operation's `RequestResult` and needs no cast. With the\n * default `returnType: 'full'` it is wrapped in `withUnwrap`, so the caller can `await` it or call `.unwrap()`. With\n * `returnType: 'data'` it goes through `unwrapResult`, which keeps the success body when the call throws on errors.\n * With `returnType: 'plain'` it is returned as is.\n *\n * @example\n * `return withUnwrap(apiClient<AddPetResponses, ThrowOnError>({ method: 'POST', url: '/pet', ...config }))`\n * @example\n * `return unwrapResult(apiClient<AddPetResponses, ThrowOnError>({ ... }), resolveThrowOnError(config.throwOnError, true))`\n * @example\n * `return apiClient<AddPetResponses, ThrowOnError>({ method: 'POST', url: '/pet', ...config })`\n */\nexport function buildReturnStatement({\n node,\n types,\n callConfig,\n returnType,\n throwOnErrorDefault,\n}: {\n node: ast.OperationNode\n types: OperationTypeNames\n callConfig: string\n returnType: ReturnTypeOption\n throwOnErrorDefault: boolean\n}): string {\n const call = `apiClient<${buildRequestResultGenerics({ node, types })}>(${callConfig})`\n if (returnType === 'data') return `return unwrapResult(${call}, resolveThrowOnError(config.throwOnError, ${throwOnErrorDefault}))`\n if (returnType === 'plain') return `return ${call}`\n return `return withUnwrap(${call})`\n}\n\n/**\n * Builds the return type and statement of a streamed operation, which calls `apiClient.stream`. The item type is\n * `TypedEvent<...>` when each event declares its own `event` and `data`, the success type itself for JSON Lines, and\n * otherwise the default, `ServerSentEvent` around the payload, which needs no type argument.\n */\nexport function buildEventStreamReturn({\n node,\n types,\n callConfig,\n returnType,\n throwOnErrorDefault,\n}: {\n node: ast.HttpOperationNode\n types: OperationTypeNames\n callConfig: string\n returnType: ReturnTypeOption\n throwOnErrorDefault: boolean\n}): {\n returnType: string\n statement: string\n} {\n const shape = getEventStream(node) ?? 'data'\n const responses = types.response.responses(node)\n const headers = buildResponseHeadersType({ node, types })\n const success = `SuccessOf<${responses}>`\n const item = { event: `TypedEvent<${success}>`, data: null, line: success }[shape]\n // The headers come after the item in `client.stream`, so a typed-headers call spells out the default item.\n const callItem = item ?? (headers ? `ServerSentEvent<${success}>` : null)\n const call = `apiClient.stream<${[responses, 'ThrowOnError', callItem, headers].filter(Boolean).join(', ')}>(${callConfig})`\n const result = (name: string) => buildResultTypeRef(name, responses, headers, ['ThrowOnError', item])\n if (returnType === 'plain') return { returnType: `Promise<${result('StreamResult')}>`, statement: `return ${call}` }\n if (returnType === 'data') {\n return {\n returnType: `Promise<${result('UnwrappedStreamResult')}>`,\n statement: `return unwrapResult(${call}, resolveThrowOnError(config.throwOnError, ${throwOnErrorDefault}))`,\n }\n }\n return { returnType: `Unwrappable<${result('StreamResult')}>`, statement: `return withUnwrap(${call})` }\n}\n\n/**\n * The stream types an operation file imports from the client for one streamed operation: the result and options types\n * for `returnType`, their `WithHeaders` form when the response declares headers, and `SuccessOf` with `TypedEvent` or\n * `ServerSentEvent` for an item type the call spells out.\n */\nexport function buildEventStreamImports({\n node,\n types,\n returnType,\n}: {\n node: ast.OperationNode\n types: OperationTypeNames\n returnType: ReturnTypeOption\n}): Array<string> {\n const shape = getEventStream(node) ?? 'data'\n const headers = buildResponseHeadersType({ node, types }) !== null\n const result = {\n plain: ['Options', 'StreamResult'],\n full: ['StreamOptions', 'Unwrappable', 'StreamResult'],\n data: ['StreamOptions', 'UnwrappedStreamResult'],\n }[returnType].map((name) => (name.endsWith('Result') ? resultTypeName(name, headers) : name))\n const item = { event: ['SuccessOf', 'TypedEvent'], data: headers ? ['SuccessOf', 'ServerSentEvent'] : [], line: ['SuccessOf'] }[shape]\n return [...result, ...item]\n}\n","import { getContentTypeInfo, getResponseContentTypeInfo, hasEventStreamContent, isEventStream } from '@internals/shared'\nimport { ast, text } from '@kubb/kit'\n\n/**\n * Builds the `contentType` entry baked into the call config. It holds the request default when the operation has a body\n * and `response` set to the streamed media type when it streams items, or `text/event-stream` when it offers events next to\n * another type, and is `null` with neither.\n *\n * `merge` is `true` when the generated function must destructure `contentType` from `options` and merge it over the\n * baked defaults, because the caller can also pick a response content type or a stream must keep its `Accept`.\n */\nexport function buildContentType({ node }: { node: ast.HttpOperationNode }): { literal: string | null; merge: boolean } {\n const { defaultContentType } = getContentTypeInfo(node)\n const hasRequestBody = Boolean(ast.http.requestBody.getSchema(node))\n // The first declared type is the default; the caller overrides it on `contentType`.\n const requestContentType = hasRequestBody ? defaultContentType : null\n // A stream asks for its own media type, and a response that offers events next to JSON asks for the events, so a client whose\n // default `Accept` prefers JSON, such as axios, gets the stream. The caller picks another type with `contentType.response`.\n const streamType = isEventStream(node) ? ast.mediaType.getBase(getResponseContentTypeInfo(node).defaultContentType) : null\n const response = streamType || hasEventStreamContent(node) ? `response: ${text.quote(streamType ?? 'text/event-stream')}` : null\n\n if (!requestContentType) return { literal: response && `contentType: { ${response} }`, merge: false }\n\n // When the caller can also pick a response content type, or a stream must keep its `Accept`, a partial `contentType` would\n // replace the baked default through `...config`, so merge the caller's choice over it instead.\n const merge = Boolean(response) || getResponseContentTypeInfo(node).isMultipleContentTypes\n const defaults = [`request: ${text.quote(requestContentType)}`, response].filter(Boolean).join(', ')\n\n return {\n merge,\n literal: merge\n ? `contentType: { ${defaults}, ...(typeof contentType === 'string' ? { request: contentType } : contentType) }`\n : `contentType: { ${defaults} }`,\n }\n}\n","import { isValidVarName } from '@internals/utils'\nimport { ast, text } from '@kubb/kit'\n\ntype StyledLocation = 'path' | 'query' | 'header' | 'cookie'\n\n/**\n * Renders a parameter name as an object-literal key, quoted when it is not a bare identifier. Every\n * location keeps the spec name: the runtime looks path styles up by the `{name}` placeholder in the\n * URL, and the other locations by the key it serializes.\n */\nfunction toKey(name: string): string {\n return isValidVarName(name) ? name : JSON.stringify(name)\n}\n\n/**\n * Serializes one parameter's metadata into a `{ style, explode, allowReserved, contentType }`\n * literal, or `null` when the parameter carries none. Path and query carry the serialization\n * `style`. Header and cookie have a fixed style (`simple` and `form`), so they emit only `explode`,\n * plus `style: 'cookie'` when a cookie parameter sets the OpenAPI 3.2 `cookie` style.\n * `allowReserved` only applies to query parameters, and `contentType` to every location except path.\n */\nfunction serializeParameter(parameter: ast.ParameterNode): string | null {\n const parts = [\n (parameter.in === 'path' || parameter.in === 'query') && parameter.style && `style: '${parameter.style}'`,\n parameter.in === 'cookie' && parameter.style === 'cookie' && `style: 'cookie'`,\n parameter.explode !== undefined && `explode: ${parameter.explode}`,\n parameter.in === 'query' && parameter.allowReserved !== undefined && `allowReserved: ${parameter.allowReserved}`,\n parameter.in !== 'path' && parameter.contentType && `contentType: ${text.quote(parameter.contentType)}`,\n parameter.in === 'querystring' && 'querystring: true',\n ].filter(Boolean)\n return parts.length > 0 ? `{ ${parts.join(', ')} }` : null\n}\n\n/**\n * Whether a query parameter of the operation has a style entry, so the call needs the styled query serializer.\n */\nexport function hasQueryStyles(node: ast.OperationNode): boolean {\n return ast.http.isOperation(node) && ast.http.groupParameters(node).query.some((parameter) => serializeParameter(parameter) !== null)\n}\n\n/**\n * Serializes the `encoding` of the request body's default content type into `property: { ... }`\n * entries, empty when it carries none. Only an operation with a single request content type\n * emits it, because the runtime applies `styles.body` to whichever type the caller selects.\n */\nfunction serializeBodyEncoding(node: ast.HttpOperationNode): Array<string> {\n const content = node.requestBody?.content\n return Object.entries(content?.length === 1 ? (content[0]?.encoding ?? {}) : {}).map(([property, { contentType, style, explode, allowReserved }]) => {\n const parts = [\n style && `style: ${JSON.stringify(style)}`,\n explode !== undefined && `explode: ${explode}`,\n allowReserved !== undefined && `allowReserved: ${allowReserved}`,\n contentType && `contentType: ${JSON.stringify(contentType)}`,\n ].filter(Boolean)\n return `${isValidVarName(property) ? property : JSON.stringify(property)}: { ${parts.join(', ')} }`\n })\n}\n\n/**\n * Builds the per-operation `styles` literal from the operation's parameters, grouped by location.\n * Entries are keyed by the spec name of the parameter.\n * Only parameters whose source defines `style`, `explode`, `allowReserved`, or `contentType` are\n * emitted, so calls without serialization metadata keep the runtime defaults and existing output\n * is unchanged. A form request body adds a `body` group keyed by property name from its `encoding`.\n * Returns `null` when nothing carries metadata.\n *\n * With `merge`, the literal spreads `config.styles` per parameter, so a per-call entry overrides the generated one for\n * that parameter and leaves the others in place.\n *\n * @example\n * ```ts\n * // a path param with { style: 'matrix', explode: true } and a query param with { explode: false }\n * buildStyles({ node }) // \"{ path: { id: { style: 'matrix', explode: true } }, query: { tags: { explode: false } } }\"\n * ```\n */\nexport function buildStyles({ node, merge }: { node: ast.OperationNode; merge?: boolean }): string | null {\n if (!ast.http.isOperation(node)) return null\n\n const groups: Record<StyledLocation | 'body', Array<string>> = { path: [], query: [], header: [], cookie: [], body: serializeBodyEncoding(node) }\n\n for (const [location, parameters] of Object.entries(ast.http.groupParameters(node)) as Array<[StyledLocation, Array<ast.ParameterNode>]>) {\n for (const parameter of parameters) {\n const literal = serializeParameter(parameter)\n if (literal) groups[location].push(`${toKey(parameter.name)}: ${literal}`)\n }\n }\n\n const entries = Object.entries(groups)\n .filter(([, items]) => items.length > 0)\n .map(([location, items]) => `${location}: { ${(merge ? [...items, `...config.styles?.${location}`] : items).join(', ')} }`)\n\n if (entries.length === 0) return null\n return `{ ${(merge ? ['...config.styles', ...entries] : entries).join(', ')} }`\n}\n","import { toLiteral } from '@internals/utils'\nimport { getEventStream, hasTextEventData } from '@internals/shared'\n\nimport { ast, text } from '@kubb/kit'\nimport type { ReturnTypeOption } from '../types.ts'\nimport { buildContentType } from './contentType.ts'\nimport { buildSecurityMetadata, type SecurityRequirement } from './security.ts'\nimport { buildStyles } from './styles.ts'\nimport { buildValidatorLiteral, type ValidatorHooks } from './validator.ts'\n\n/**\n * `parseAs: 'blob'` when every success content type is binary, so a download is a `Blob` whatever its media type, and\n * also when the server sends no `Content-Type`. Any other body is decoded by its media type at runtime.\n */\nfunction buildParseAsLiteral(content: Array<ast.ContentNode>): string | null {\n return content.length > 0 && content.every((entry) => entry.schema?.type === 'blob') ? `parseAs: 'blob'` : null\n}\n\n/**\n * Builds the call config literal a generated operation forwards to the client, shared by the standalone\n * functions and the SDK methods. The operation's own `baseURL` comes before the `...config` spread, so a per-call one wins. The\n * `validator` and `throwOnError` entries come after it, so a per-call `validator` is merged per key with the generated one instead\n * of replacing it. `styles` is merged the same way, per parameter, unless `returnType` is `'plain'`.\n *\n * `mergeContentType` is `true` when the caller must destructure `contentType` from `options`, and\n * `eventStream` is `true` when the operation streams `text/event-stream` or JSON Lines. A Server-Sent Events call\n * carries its `eventShape`, which tells the runtime what the `response` validator checks on each event, and `rawData` when\n * the document types each event's `data` as a string, so the runtime keeps it as text.\n */\nexport function buildCallConfig({\n node,\n validatorHooks,\n security,\n baseURL,\n throwOnErrorDefault,\n returnType,\n}: {\n node: ast.HttpOperationNode\n validatorHooks: ValidatorHooks | null\n security?: Array<SecurityRequirement>\n baseURL?: string\n throwOnErrorDefault: boolean\n returnType: ReturnTypeOption\n}): { callConfig: string; mergeContentType: boolean; eventStream: boolean } {\n const stream = getEventStream(node)\n const content = ast.http.responses.findPrimary(node)?.content ?? []\n const securityLiteral = buildSecurityMetadata({ security })\n // A `'plain'` client is the user's own, which may type `styles` as `unknown`, so it keeps the generated styles as a default.\n const ownRuntime = returnType !== 'plain'\n const stylesLiteral = buildStyles({ node, merge: ownRuntime })\n const styles = stylesLiteral ? `styles: ${stylesLiteral}` : null\n const validatorLiteral = buildValidatorLiteral(validatorHooks, ['request', 'path', 'query', 'headers', 'cookies', 'response', 'error'])\n const { literal: contentTypeLiteral, merge: mergeContentType } = buildContentType({ node })\n // The runtime's call types `throwOnError` as the operation's `ThrowOnError`, which the shared helper keeps. A `'plain'`\n // client takes a boolean.\n const throwOnError = ownRuntime\n ? `throwOnError: resolveThrowOnError(config.throwOnError, ${throwOnErrorDefault})`\n : `throwOnError: config.throwOnError ?? ${throwOnErrorDefault}`\n\n const rawData = hasTextEventData(node)\n const callConfig = `{ ${[\n `method: ${text.quote(node.method.toUpperCase())}`,\n `url: ${text.quote(node.path)}`,\n baseURL ? `baseURL: ${JSON.stringify(baseURL)}` : null,\n securityLiteral ? `security: ${securityLiteral}` : null,\n ownRuntime ? null : styles,\n contentTypeLiteral,\n buildParseAsLiteral(content),\n stream === 'event' || stream === 'data' ? `eventShape: '${stream}'` : null,\n rawData ? `rawData: ${toLiteral(rawData)}` : null,\n '...config',\n ownRuntime ? styles : null,\n validatorLiteral,\n throwOnError,\n ]\n .filter(Boolean)\n .join(', ')} }`\n\n return { callConfig, mergeContentType, eventStream: stream !== null }\n}\n","import type { ast } from '@kubb/kit'\nimport { getRequestGroupOptionality } from '@internals/shared'\nimport { createFunctionParameter, createFunctionParameters, functionPrinter } from '@kubb/plugin-ts'\nimport type { OperationTypeNames } from '@internals/client'\nimport type { ReturnTypeOption } from '../types.ts'\nimport { buildResultType } from './generics.ts'\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\n\n/**\n * The pieces of a generated operation function's grouped-options signature.\n */\nexport type GroupedOptionsSignature = {\n /**\n * The single function parameter: `options: Options<<Name>Options, ThrowOnError>`, or `StreamOptions<...>`\n * for a `text/event-stream` operation.\n */\n paramsSignature: string\n /**\n * The function return type: `Unwrappable<RequestResult<<Name>Responses, ThrowOnError>>`.\n */\n returnType: string\n /**\n * The function generics. One per-call `ThrowOnError` flag, defaulting to the plugin setting.\n */\n generics: Array<string>\n}\n\n/**\n * Builds the grouped-options signature for one operation: a single `options` object whose `TData`\n * is the `<Name>Options` type, and a `RequestResult` return type keyed to the per-status responses\n * record. There are no positional arguments.\n *\n * The generated file imports `<Name>Options` and `<Name>Responses` and uses them directly, so no\n * per-operation input type has to be emitted. Both names come from `types`, which is `plugin-ts` or\n * `plugin-zod`'s inferred types (see `resolveOperationTypes`).\n */\nexport function buildGroupedOptionsSignature({\n node,\n types,\n returnType,\n throwOnErrorDefault,\n eventStream = false,\n}: {\n node: ast.OperationNode\n types: OperationTypeNames\n returnType: ReturnTypeOption\n throwOnErrorDefault: boolean\n /**\n * Adds the per-call stream options to the `options` type of a `text/event-stream` operation, except for a plain custom\n * client, whose own `client.stream` returns a `StreamResult` and types its config itself.\n */\n eventStream?: boolean\n}): GroupedOptionsSignature {\n const optionsName = types.response.options(node)\n const optionsType = `${eventStream && returnType !== 'plain' ? 'StreamOptions' : 'Options'}<${optionsName}, ThrowOnError>`\n const { isOptional } = getRequestGroupOptionality(node)\n\n const paramsSignature =\n declarationPrinter.print(\n createFunctionParameters({\n params: [createFunctionParameter({ name: 'options', type: optionsType, ...(isOptional ? { default: '{}' } : {}) })],\n }),\n ) ?? ''\n\n return {\n paramsSignature,\n returnType: buildResultType({ node, types, returnType }),\n generics: [`ThrowOnError extends boolean = ${throwOnErrorDefault}`],\n }\n}\n","import type { ast } from '@kubb/kit'\nimport type { OperationTypeNames } from '@internals/client'\nimport type { ReturnTypeOption } from '../types.ts'\nimport { buildCallConfig } from './callConfig.ts'\nimport { buildEventStreamReturn, buildReturnStatement } from './returnStatement.ts'\nimport type { SecurityRequirement } from './security.ts'\nimport { buildGroupedOptionsSignature } from './signature.ts'\nimport type { ValidatorHooks } from './validator.ts'\n\n/**\n * The pieces of a generated operation: its generics, `options` parameter, return type, return statement, and whether the\n * body destructures `contentType` from `options`. Shared by the standalone functions and the SDK methods, so a\n * streamed operation is wired to `apiClient.stream` in one place.\n */\nexport function buildOperationBody({\n node,\n types,\n validatorHooks,\n security,\n baseURL,\n returnType,\n throwOnErrorDefault,\n}: {\n node: ast.HttpOperationNode\n types: OperationTypeNames\n validatorHooks: ValidatorHooks | null\n security?: Array<SecurityRequirement>\n baseURL?: string\n returnType: ReturnTypeOption\n throwOnErrorDefault: boolean\n}): { generics: Array<string>; paramsSignature: string; returnType: string; statement: string; mergeContentType: boolean } {\n const { callConfig, mergeContentType, eventStream } = buildCallConfig({ node, validatorHooks, security, baseURL, throwOnErrorDefault, returnType })\n const signature = buildGroupedOptionsSignature({ node, types, returnType, throwOnErrorDefault, eventStream })\n const stream = eventStream ? buildEventStreamReturn({ node, types, callConfig, returnType, throwOnErrorDefault }) : null\n\n return {\n generics: signature.generics,\n paramsSignature: signature.paramsSignature,\n returnType: stream?.returnType ?? signature.returnType,\n statement: stream?.statement ?? buildReturnStatement({ node, types, callConfig, returnType, throwOnErrorDefault }),\n mergeContentType,\n }\n}\n","import type { OperationTypeNames } from '@internals/client'\nimport { buildOperationComments } from '@internals/shared'\nimport { ast } from '@kubb/kit'\nimport { File, Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx'\nimport { buildOperationBody } from '../builders/operationBody.ts'\nimport type { SecurityRequirement } from '../builders/security.ts'\nimport type { ValidatorHooks } from '../builders/validator.ts'\nimport type { ReturnTypeOption } from '../types.ts'\n\ntype Props = {\n /**\n * The generated function name.\n */\n name: string\n /**\n * The operation being generated.\n */\n node: ast.OperationNode\n /**\n * The operation type names the signature references, from `plugin-ts` or `plugin-zod`'s inferred\n * types.\n */\n types: OperationTypeNames\n /**\n * The operation's validator hooks, built once by the generator and shared with its zod imports.\n */\n validatorHooks: ValidatorHooks | null\n /**\n * Shape of the value the generated function resolves to.\n */\n returnType: ReturnTypeOption\n throwOnErrorDefault: boolean\n /**\n * Per-operation security, resolved from the spec into inline security requirements and serialized onto the\n * call config's `security` field for the runtime `auth` resolver to consume.\n */\n security?: Array<SecurityRequirement>\n /** The operation's own server URL from a path-level or operation-level `servers` entry, emitted as the call's default `baseURL`. */\n baseURL?: string\n}\n\n/**\n * Renders one client operation: the grouped `<Name>Request` type and the function that forwards a\n * single `options` object to the resolved client and returns the `Unwrappable<RequestResult>`. The\n * type, signature, and call config are built with the AST factory, and only the jsx-renderer emits\n * the source.\n */\nexport function Operation({ name, node, types, validatorHooks, returnType, throwOnErrorDefault, security, baseURL }: Props): KubbReactNode {\n if (!ast.http.isOperation(node)) return null\n\n const body = buildOperationBody({ node, types, validatorHooks, security, baseURL, returnType, throwOnErrorDefault })\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function\n name={name}\n export\n generics={body.generics}\n params={body.paramsSignature}\n returnType={body.returnType}\n JSDoc={{ comments: buildOperationComments(node, { splitLines: true }) }}\n >\n {body.mergeContentType\n ? 'const { client: apiClient = client, contentType, ...config } = options'\n : 'const { client: apiClient = client, ...config } = options'}\n <br />\n {body.statement}\n </Function>\n </File.Source>\n )\n}\n","import { objectKey } from '@internals/utils'\nimport path from 'node:path'\nimport { getFormContentTypes, hasEventStreamContent, hasStreamVariant, isEventStream } from '@internals/shared'\n\nimport { ast, text } from '@kubb/kit'\nimport { File } from '@kubb/renderer-jsx'\nimport { buildSecuritySchemes } from '../builders/security.ts'\nimport { hasQueryStyles } from '../builders/styles.ts'\nimport type { KubbReactNode } from '@kubb/renderer-jsx'\n\nfunction buildServersExport(servers: Array<ast.InputServer> | undefined): string | null {\n const named = ast.server.groupByName(servers)\n if (!named.size) return null\n const entries = [...named].map(([name, { url }]) => `${objectKey(name)}: ${text.quote(url)}`)\n return `/**\\n * The servers from the spec by name, for \\`baseURL\\`.\\n */\\nexport const servers = { ${entries.join(', ')} } as const`\n}\n\n// The form media types, each in its own file under `templates/mediaTypes/`, so a document ships only the ones it uses.\nconst formMediaTypes = {\n 'multipart/form-data': { file: 'mediaTypes/formData', name: 'multipartFormData' },\n 'application/x-www-form-urlencoded': { file: 'mediaTypes/urlencoded', name: 'urlencoded' },\n} as const\n\n/**\n * Writes the runtime a document needs into `.kubb/`: the optional media type, serializer and `sse.ts` files, and a\n * `config.ts` that imports them, which `client.ts` passes to `setConfig`. The footer of `client.ts` gets the named\n * `servers` and `securitySchemes` and the `sse.ts` re-export. `templates` is the folder the runtime is copied from, set\n * by the plugins that ship it, so a custom client from `@kubb/plugin-client` gets none of this.\n */\nexport function ClientRuntime({\n nodes,\n root,\n templates,\n baseURL,\n servers,\n auth,\n}: {\n nodes: Array<ast.OperationNode>\n root: string\n templates?: string\n baseURL?: string\n servers?: Array<ast.InputServer>\n auth?: Array<ast.AuthScheme>\n}): KubbReactNode {\n if (!templates) return null\n const hasParameter = (match: (parameter: ast.ParameterNode) => boolean) => nodes.some((node) => node.parameters.some(match))\n const streams = nodes.some((node) => hasEventStreamContent(node) || isEventStream(node) || hasStreamVariant(node))\n const forms = [...new Set(nodes.flatMap(getFormContentTypes))].sort().map((contentType) => ({ contentType, ...formMediaTypes[contentType] }))\n const queryStyles = nodes.some(hasQueryStyles)\n\n const serializers = [\n queryStyles\n ? { key: 'query', file: 'serializers/queryStyles', name: 'serializeStyledQuery' }\n : { key: 'query', file: 'serializers/query', name: 'serializeQuery' },\n hasParameter((parameter) => parameter.in === 'path' && (parameter.style === 'label' || parameter.style === 'matrix'))\n ? { key: 'path', file: 'serializers/pathStyles', name: 'serializeStyledPath' }\n : { key: 'path', file: 'serializers/path', name: 'serializePath' },\n hasParameter((parameter) => parameter.in === 'header') ? { key: 'header', file: 'serializers/headers', name: 'serializeHeaders' } : null,\n hasParameter((parameter) => parameter.in === 'cookie') ? { key: 'cookie', file: 'serializers/cookies', name: 'serializeCookies' } : null,\n ].filter((serializer) => serializer !== null)\n const imports = [...forms, ...(streams ? [{ file: 'sse', name: 'streamMediaTypes' }] : []), ...serializers]\n // `pathStyles.ts` builds on `path.ts`, and the urlencoded media type on `queryStyles.ts`.\n const files = new Set([\n ...imports.map(({ file }) => file),\n 'serializers/path',\n ...(forms.some(({ name }) => name === 'urlencoded') ? ['serializers/queryStyles'] : []),\n ])\n\n const baseURLExpression = baseURL ? (baseURL.includes('${') ? `\\`${baseURL.replaceAll('`', '\\\\`')}\\`` : JSON.stringify(baseURL)) : undefined\n const mediaTypes = [...forms.map(({ contentType, name }) => `'${contentType}': ${name}`), streams ? '...streamMediaTypes' : null].filter(Boolean)\n const config = [\n baseURLExpression ? `baseURL: ${baseURLExpression}` : null,\n mediaTypes.length ? `mediaTypes: { ${mediaTypes.join(', ')} }` : null,\n `serializer: { ${serializers.map(({ key, name }) => `${key}: ${name}`).join(', ')} }`,\n ].filter(Boolean)\n const footer = [buildServersExport(servers), buildSecuritySchemes(auth), streams ? `export * from './sse.ts'` : null].filter(Boolean).join('\\n')\n const configPath = path.resolve(root, '.kubb/config.ts')\n const runtimePath = (file: string) => path.resolve(root, '.kubb', `${file}.ts`)\n\n return (\n <>\n {[...files].map((file) => (\n <File key={file} baseName={`${path.basename(file)}.ts`} path={runtimePath(file)} copy={path.join(templates, `${file}.ts`)} />\n ))}\n <File baseName=\"config.ts\" path={configPath}>\n {imports.map(({ file, name }) => (\n <File.Import key={name} name={[name]} root={configPath} path={runtimePath(file)} />\n ))}\n <File.Import name={['ClientConfig']} root={configPath} path={runtimePath('core')} isTypeOnly />\n <File.Source name=\"defaultConfig\" isExportable>\n {`/**\\n * The config \\`client.ts\\` starts with: what this spec needs from the runtime.\\n */\\nexport const defaultConfig: ClientConfig = { ${config.join(', ')} }`}\n </File.Source>\n </File>\n {footer && <File baseName=\"client.ts\" path={path.resolve(root, '.kubb/client.ts')} footer={footer} />}\n </>\n )\n}\n","import path from 'node:path'\nimport { resolveOperationTypes, resultTypeName } from '@internals/client'\nimport { getEventStream, operationFileEntry } from '@internals/shared'\nimport { ast, defineGenerator } from '@kubb/kit'\nimport type { Generator } from '@kubb/kit'\nimport { File, jsxRenderer } from '@kubb/renderer-jsx'\nimport { resolveOperationData } from '../builders/operationData.ts'\nimport { buildEventStreamImports } from '../builders/returnStatement.ts'\nimport { Operation } from '../components/Operation.tsx'\nimport { ClientRuntime } from '../components/ClientRuntime.tsx'\nimport type { ContractClientFactory } from '../types.ts'\n\n/**\n * Builds the per-operation client generator shared by the client plugins. `templates` is the folder the optional runtime, such as `sse.ts`, is copied from.\n */\nexport function createClientGenerator<TFactory extends ContractClientFactory>(name: string, { templates }: { templates?: string } = {}): Generator<TFactory> {\n return defineGenerator<TFactory>({\n name,\n renderer: jsxRenderer,\n operations(nodes, ctx) {\n return <ClientRuntime nodes={nodes} root={ctx.root} templates={templates} baseURL={ctx.options.baseURL} servers={ctx.meta.servers} auth={ctx.meta.auth} />\n },\n operation(node, ctx) {\n if (!ast.http.isOperation(node)) return null\n\n const { config, driver, resolver, root } = ctx\n const { output, returnType, throwOnErrorDefault, group, importPath } = ctx.options\n\n const resolvedTypes = resolveOperationTypes(driver, ctx.plugin.name)\n // A custom client module keeps the two-argument `RequestResult` it documents, so its results get no typed headers.\n const types = importPath === undefined ? resolvedTypes : { ...resolvedTypes, response: { ...resolvedTypes.response, headers: undefined } }\n\n const data = resolveOperationData({ node, ctx, types })\n const { validatorHooks, headerTypeNames } = data\n const file = resolver.file({ ...operationFileEntry(node, node.operationId), root, output, group: group ?? undefined })\n const importedTypeNames = [types.response.options(node), types.response.responses(node), ...headerTypeNames]\n\n // A custom client module is emitted verbatim, so `importPath` is used exactly as configured.\n // The default `.kubb/client.ts` is a file path and is made relative to the operation file.\n const clientPath = importPath ?? path.resolve(root, '.kubb/client.ts')\n const clientRoot = importPath === undefined ? file.path : undefined\n // The headers validator helper ships in `.kubb/standardSchema.ts`; a custom client module exports it\n // alongside its other runtime helpers.\n const standardSchemaPath = importPath ?? path.resolve(root, '.kubb/standardSchema.ts')\n const stream = getEventStream(node)\n\n const clientValueImports = [\n ...{\n plain: ['client'],\n data: ['client', 'unwrapResult', 'resolveThrowOnError'],\n full: ['client', 'withUnwrap', 'resolveThrowOnError'],\n }[returnType],\n ...(importPath === undefined && data.security ? ['securitySchemes'] : []),\n ]\n\n const clientTypeImports = stream\n ? buildEventStreamImports({ node, types, returnType })\n : { plain: ['Options', 'RequestResult'], data: ['Options', 'UnwrappedResult'], full: ['Options', 'Unwrappable', 'RequestResult'] }[returnType].map(\n (name) => (name.endsWith('Result') ? resultTypeName(name, headerTypeNames.length > 0) : name),\n )\n\n return (\n <File\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={resolver.default.banner(ctx.meta, { output, config, file: { path: file.path, baseName: file.baseName } })}\n footer={resolver.default.footer(ctx.meta, { output, config, file: { path: file.path, baseName: file.baseName } })}\n >\n <File.Import name={clientValueImports} root={clientRoot} path={clientPath} />\n <File.Import name={clientTypeImports} root={clientRoot} path={clientPath} isTypeOnly />\n\n <File.Import name={Array.from(new Set(importedTypeNames))} root={file.path} path={data.typeFile.path} isTypeOnly />\n\n {data.zodFile && validatorHooks.importedZodNames.length > 0 && (\n <File.Import name={validatorHooks.importedZodNames} root={file.path} path={data.zodFile.path} />\n )}\n {validatorHooks.headers && <File.Import name={['toHeadersStandardSchema']} root={clientRoot} path={standardSchemaPath} />}\n\n <Operation\n name={data.name}\n node={node}\n types={types}\n validatorHooks={validatorHooks}\n returnType={returnType}\n throwOnErrorDefault={throwOnErrorDefault}\n security={data.security}\n baseURL={data.baseURL}\n />\n </File>\n )\n },\n })\n}\n","import { macroDedupeUnion } from '@kubb/kit'\nimport type { ast } from '@kubb/kit'\n\n/**\n * Macros the client plugins apply by default, ahead of any user macros. `macroDedupeUnion`\n * drops repeated union members, keeping the generated response and error\n * unions tidy. A plugin wires them with `ctx.setMacros([...defaultMacros, ...userMacros])`.\n */\nexport const defaultMacros: ReadonlyArray<ast.Macro> = [macroDedupeUnion]\n","import { resolveOperationName } from '@internals/shared'\nimport { ensureValidVarName } from '@internals/utils'\nimport { casing, createResolver } from '@kubb/kit'\nimport type { PluginContractClient, ResolverClient } from './types.ts'\n\n/**\n * Default resolver shared by the client plugins. Functions use safe camelCase identifiers and\n * files inherit the built-in casing; classes and tag groups use PascalCase.\n *\n * @example\n * ```ts\n * resolverClient.name('show pet by id') // 'showPetById'\n * resolverClient.groupName('pet') // 'PetClient'\n * ```\n */\nexport const resolverClient: ResolverClient = createResolver<PluginContractClient>({\n pluginName: 'plugin-contract-client',\n name: resolveOperationName,\n className(name) {\n return ensureValidVarName(casing.pascal(name))\n },\n groupName(name) {\n return ensureValidVarName(casing.pascal(`${name} Client`))\n },\n propertyName(name) {\n return ensureValidVarName(casing.camel(name))\n },\n})\n","import type { OperationTypeNames } from '@internals/client'\nimport { buildOperationComments } from '@internals/shared'\nimport { buildJSDoc } from '@internals/utils'\nimport { ast } from '@kubb/kit'\nimport { File } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx'\nimport { buildOperationBody } from '../builders/operationBody.ts'\nimport type { SecurityRequirement } from '../builders/security.ts'\nimport type { ValidatorHooks } from '../builders/validator.ts'\nimport type { ReturnTypeOption } from '../types.ts'\n\n/**\n * Builds one instance method of a generated SDK class; a per-call `options.client` overrides `this.client`.\n */\nexport function buildSdkMethod({\n node,\n name,\n types,\n validatorHooks,\n security,\n baseURL,\n returnType,\n throwOnErrorDefault,\n}: {\n node: ast.OperationNode\n name: string\n types: OperationTypeNames\n validatorHooks: ValidatorHooks | null\n security?: Array<SecurityRequirement>\n baseURL?: string\n returnType: ReturnTypeOption\n throwOnErrorDefault: boolean\n}): string {\n if (!ast.http.isOperation(node)) return ''\n\n const body = buildOperationBody({ node, types, validatorHooks, security, baseURL, returnType, throwOnErrorDefault })\n const generics = body.generics.length ? `<${body.generics.join(', ')}>` : ''\n const jsdoc = buildJSDoc(buildOperationComments(node, { splitLines: true }))\n\n const destructure = body.mergeContentType\n ? 'const { client: apiClient = this.client, contentType, ...config } = options'\n : 'const { client: apiClient = this.client, ...config } = options'\n const methodBody = [destructure, '', body.statement].map((line) => (line ? ` ${line}` : '')).join('\\n')\n\n return `${jsdoc} public ${name}${generics}(${body.paramsSignature}): ${body.returnType} {\\n${methodBody}\\n }`\n}\n\ntype OperationData = {\n node: ast.OperationNode\n name: string\n types: OperationTypeNames\n validatorHooks: ValidatorHooks | null\n security?: Array<SecurityRequirement>\n baseURL?: string\n}\n\ntype Props = {\n name: string\n operations: Array<OperationData>\n returnType: ReturnTypeOption\n throwOnErrorDefault: boolean\n}\n\n/**\n * Renders one instance class per tag with one method per operation. The constructor takes a client\n * config object and builds its own client through `createClient`, so each environment is a separate\n * instance: `const api = new PetClient({ baseURL }); api.getPetById(...)`. It also takes an existing\n * client, which is how the root SDK shares one client across its tags. The client is public so callers\n * can add interceptors, and a per-call `client` option still overrides it for a one-off call.\n */\nexport function SdkClient({ name, operations, returnType, throwOnErrorDefault }: Props): KubbReactNode {\n const methods = operations.map(({ node, name: methodName, types, validatorHooks, security, baseURL }) =>\n buildSdkMethod({\n node,\n name: methodName,\n types,\n validatorHooks,\n security,\n baseURL,\n returnType,\n throwOnErrorDefault,\n }),\n )\n\n const constructor = [\n ' readonly client: ClientInstance',\n '',\n ' constructor(config: ClientConfig | ClientInstance = {}) {',\n \" this.client = typeof config === 'function' ? config : createClient(config)\",\n ' }',\n ].join('\\n')\n\n const classCode = `export class ${name} {\\n${constructor}\\n\\n${methods.join('\\n\\n')}\\n}`\n\n return (\n <File.Source name={name} isExportable isIndexable>\n {classCode}\n </File.Source>\n )\n}\n","import { File } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx'\n\ntype Member = {\n className: string\n propName: string\n}\n\ntype Props = {\n name: string\n members: Array<Member>\n}\n\n/**\n * Renders a composed root SDK class that creates one client from the config and hands it to every tag\n * client, so `new PetStore({ baseURL }).pet.getPetById(...)` reaches an operation through a single entry\n * point bound to one environment. The shared client is the public `client` field, where interceptors\n * registered once apply to every tag. The per-tag clients are read-only fields built in the constructor.\n */\nexport function SdkFacade({ name, members }: Props): KubbReactNode {\n const fields = [' readonly client: ClientInstance', ...members.map((member) => ` readonly ${member.propName}: ${member.className}`)]\n const assignments = [\n ' this.client = createClient(config)',\n ...members.map((member) => ` this.${member.propName} = new ${member.className}(this.client)`),\n ]\n const body = [...fields, '', ' constructor(config: ClientConfig = {}) {', ...assignments, ' }'].join('\\n')\n\n const classCode = `export class ${name} {\\n${body}\\n}`\n\n return (\n <File.Source name={name} isExportable isIndexable>\n {classCode}\n </File.Source>\n )\n}\n","import path from 'node:path'\nimport { type OperationTypeSource, resolveOperationTypes, resultTypeName } from '@internals/client'\nimport { isEventStream } from '@internals/shared'\nimport { ensureValidVarName } from '@internals/utils'\nimport { ast, defineGenerator, Diagnostics } from '@kubb/kit'\nimport type { Generator } from '@kubb/kit'\nimport { File, jsxRenderer } from '@kubb/renderer-jsx'\nimport { type GeneratorContext, type OperationData, resolveOperationData } from '../builders/operationData.ts'\nimport { buildEventStreamImports } from '../builders/returnStatement.ts'\nimport { isValidatorEnabled } from '../builders/validatorOptions.ts'\nimport { SdkClient } from '../components/SdkClient.tsx'\nimport { ClientRuntime } from '../components/ClientRuntime.tsx'\nimport { SdkFacade } from '../components/SdkFacade.tsx'\nimport type { ContractClientFactory } from '../types.ts'\n\ntype Controller = {\n name: string\n tag: string | undefined\n file: ast.FileNode\n operations: Array<OperationData>\n}\n\n/**\n * Groups operations into one controller per tag. Operations without a tag fall back to a single\n * `Client`/`ApiClient` controller, matching the resolver's default naming.\n */\nfunction buildControllers(nodes: ReadonlyArray<ast.OperationNode>, ctx: GeneratorContext, types: OperationTypeSource): Array<Controller> {\n const { resolver, root } = ctx\n const { output, group } = ctx.options\n\n return nodes.reduce((acc, operationNode) => {\n if (!ast.http.isOperation(operationNode)) return acc\n const tag = operationNode.tags[0]\n const name = tag ? ensureValidVarName(resolver.groupName(tag)) : resolver.className('ApiClient')\n // `group.name` names the folder and file, never the class.\n const fileName = tag && group ? ensureValidVarName(path.basename(resolver.groupDir(group, tag))) : name\n const file = resolver.file({ name: fileName, extname: '.ts', tag, root, output, group: group ?? undefined })\n const operationData = resolveOperationData({ node: operationNode, ctx, types })\n const previous = acc.find((item) => item.file.path === file.path)\n\n if (previous) {\n previous.operations.push(operationData)\n } else {\n acc.push({ name, tag, file, operations: [operationData] })\n }\n\n return acc\n }, [] as Array<Controller>)\n}\n\nfunction collectImportsByFile(ops: Array<OperationData>, pick: (op: OperationData) => { file: ast.FileNode | null; names: Array<string> }) {\n const namesByPath = new Map<string, Set<string>>()\n const filesByPath = new Map<string, ast.FileNode>()\n\n ops.forEach((op) => {\n const { file, names } = pick(op)\n if (!file || names.length === 0) return\n if (!namesByPath.has(file.path)) namesByPath.set(file.path, new Set())\n const set = namesByPath.get(file.path)!\n names.forEach((n) => set.add(n))\n filesByPath.set(file.path, file)\n })\n\n return { namesByPath, filesByPath }\n}\n\n/**\n * Builds the class-based SDK generator for a client plugin (`@kubb/plugin-fetch`,\n * `@kubb/plugin-axios`). Only registered when `sdk` is set; otherwise the plugin keeps its\n * standalone per-operation functions.\n *\n * Every tag client is an instance class whose constructor takes a client config and builds its own\n * client, or takes an existing client, so each environment is a separate instance. With `sdk.mode:\n * 'tag'` (the default) it emits one class per tag, named by `resolver.groupName`, and, when `sdk.name`\n * is set, a composed root that creates one client and shares it with every tag client. With\n * `sdk.mode: 'flat'` it emits one class named by `sdk.name`, with every operation as a direct method.\n *\n * `templates` is the folder the optional runtime is copied from: `sse.ts` only for a document that streams, and each\n * form media type only for a document with a body of that type.\n */\nexport function createSdkGenerator<TFactory extends ContractClientFactory>({ templates }: { templates?: string } = {}): Generator<TFactory> {\n return defineGenerator<TFactory>({\n name: 'sdk',\n renderer: jsxRenderer,\n operations(nodes, ctx) {\n const { config, resolver, root } = ctx\n const { output, group, validator, returnType, throwOnErrorDefault, sdk } = ctx.options\n\n if (!sdk) return null\n\n // `resolver.file(...)` resolves every tag to the same single `output.path` under `mode:\n // 'file'`, so a tag-per-class split has nothing to split into: every tag would collapse\n // into whichever controller `buildControllers` reduces first, silently dropping the rest.\n if (sdk.mode === 'tag' && output.mode === 'file') {\n throw new Diagnostics.Error({\n code: Diagnostics.code.invalidPluginOptions,\n severity: 'error',\n message: `Plugin \"${ctx.plugin.name}\" resolves \\`output.mode\\` to 'file' but also configures \\`sdk.mode: 'tag'\\`.`,\n help: \"A single-file output has nothing to split tag classes into. Set `sdk.mode: 'flat'` to emit one class into that file, or give `output.path` an extensionless directory name (or set `output.mode: 'directory'` explicitly) so each tag gets its own file.\",\n location: { kind: 'config' },\n plugin: ctx.plugin.name,\n })\n }\n\n const types = resolveOperationTypes(ctx.driver, ctx.plugin.name)\n\n const validatorEnabled = isValidatorEnabled(validator)\n const controllers = buildControllers(nodes, ctx, types)\n const clientPath = path.resolve(root, '.kubb/client.ts')\n const standardSchemaPath = path.resolve(root, '.kubb/standardSchema.ts')\n\n const banner = (file: ast.FileNode) => resolver.default.banner(ctx.meta, { output, config, file: { path: file.path, baseName: file.baseName } })\n const footer = (file: ast.FileNode) => resolver.default.footer(ctx.meta, { output, config, file: { path: file.path, baseName: file.baseName } })\n\n const renderClassFile = (className: string, file: ast.FileNode, ops: Array<OperationData>) => {\n const { namesByPath: typeNamesByPath, filesByPath: typeFilesByPath } = collectImportsByFile(ops, (op) => ({\n file: op.typeFile,\n names: [op.types.response.options(op.node), op.types.response.responses(op.node), ...op.headerTypeNames],\n }))\n const { namesByPath: zodNamesByPath, filesByPath: zodFilesByPath } = validatorEnabled\n ? collectImportsByFile(ops, (op) => ({ file: op.zodFile, names: op.validatorHooks.importedZodNames }))\n : { namesByPath: new Map<string, Set<string>>(), filesByPath: new Map<string, ast.FileNode>() }\n const resultOps = ops.filter((op) => !isEventStream(op.node))\n const typedHeaders = (op: OperationData) => op.headerTypeNames.length > 0\n const resultName = returnType === 'data' ? 'UnwrappedResult' : 'RequestResult'\n\n return (\n <File key={file.path} baseName={file.baseName} path={file.path} meta={file.meta} banner={banner(file)} footer={footer(file)}>\n <File.Import\n name={[\n 'createClient',\n returnType === 'data' ? 'unwrapResult' : 'withUnwrap',\n 'resolveThrowOnError',\n ...(ctx.options.importPath === undefined && ops.some((op) => op.security) ? ['securitySchemes'] : []),\n ]}\n root={file.path}\n path={clientPath}\n />\n <File.Import\n name={Array.from(\n new Set([\n 'ClientConfig',\n 'ClientInstance',\n 'Options',\n ...(returnType === 'data' ? [] : ['Unwrappable']),\n ...(resultOps.some((op) => !typedHeaders(op)) ? [resultName] : []),\n ...(resultOps.some(typedHeaders) ? [resultTypeName(resultName, true)] : []),\n ...ops.filter((op) => isEventStream(op.node)).flatMap((op) => buildEventStreamImports({ node: op.node, types: op.types, returnType })),\n ]),\n )}\n root={file.path}\n path={clientPath}\n isTypeOnly\n />\n\n {validator === 'zod' && ops.some((op) => ast.http.requestBody.getSchema(op.node) != null) && <File.Import name={['z']} path=\"zod\" isTypeOnly />}\n\n {Array.from(typeNamesByPath.entries()).map(([filePath, set]) => (\n <File.Import key={filePath} name={Array.from(set)} root={file.path} path={typeFilesByPath.get(filePath)!.path} isTypeOnly />\n ))}\n\n {validatorEnabled &&\n Array.from(zodNamesByPath.entries()).map(([filePath, set]) => (\n <File.Import key={filePath} name={Array.from(set)} root={file.path} path={zodFilesByPath.get(filePath)!.path} />\n ))}\n\n {ops.some((op) => op.validatorHooks.headers) && <File.Import name={['toHeadersStandardSchema']} root={file.path} path={standardSchemaPath} />}\n\n <SdkClient name={className} operations={ops} returnType={returnType} throwOnErrorDefault={throwOnErrorDefault} />\n </File>\n )\n }\n\n // `flat` collapses every operation into one class named by `sdk.name`, so callers reach\n // an operation as `new PetStore(config).getPetById(...)` without a per-tag sub-client.\n const renderFacadeFile = (name: string) => {\n const sdkFile = resolver.file({ name, extname: '.ts', root, output, group: group ?? undefined })\n const members = controllers.map(({ name, tag }) => ({ className: name, propName: resolver.propertyName(tag ?? name) }))\n\n return (\n <File key={sdkFile.path} baseName={sdkFile.baseName} path={sdkFile.path} meta={sdkFile.meta} banner={banner(sdkFile)} footer={footer(sdkFile)}>\n <File.Import name={['createClient']} root={sdkFile.path} path={clientPath} />\n <File.Import name={['ClientConfig', 'ClientInstance']} root={sdkFile.path} path={clientPath} isTypeOnly />\n {controllers.map(({ name, file }) => (\n <File.Import key={name} name={[name]} root={sdkFile.path} path={file.path} />\n ))}\n <SdkFacade name={resolver.className(name)} members={members} />\n </File>\n )\n }\n\n const files =\n sdk.mode === 'flat'\n ? renderClassFile(\n resolver.className(sdk.name ?? 'sdk'),\n resolver.file({ name: sdk.name ?? 'sdk', extname: '.ts', root, output, group: group ?? undefined }),\n controllers.flatMap((controller) => controller.operations),\n )\n : [...controllers.map(({ name, file, operations: ops }) => renderClassFile(name, file, ops)), sdk.name && renderFacadeFile(sdk.name)]\n\n return (\n <>\n <ClientRuntime nodes={nodes} root={root} templates={templates} baseURL={ctx.options.baseURL} servers={ctx.meta.servers} auth={ctx.meta.auth} />\n {files}\n </>\n )\n },\n })\n}\n","import path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { addGenerator, injectFile, Resolver, setMacros, setResolver, useConfig } from '@kubb/kit'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { isValidatorEnabled } from './builders/validatorOptions.ts'\nimport { createClientGenerator } from './generators/clientGenerator.tsx'\nimport { createSdkGenerator } from './generators/sdkGenerator.tsx'\nimport { defaultMacros } from './macros.ts'\nimport { resolverClient } from './resolver.ts'\nimport type { ClientOptions, ClientResolvedOptions, ContractClientFactory, ResolverClient } from './types.ts'\n\n// Resolved from a file directly in `src/`, so the same `../templates/` path works from `dist/`.\nconst templatePath = (name: string) => fileURLToPath(new URL(`../templates/${name}`, import.meta.url))\n\n/**\n * Applies the client option defaults and merges a user `resolver` over the built-in one.\n */\nexport function resolveClientOptions(options: ClientOptions): ClientResolvedOptions {\n const {\n output = { path: 'clients', barrel: { type: 'named' } },\n exclude = [],\n include,\n override = [],\n baseURL,\n throwOnErrorDefault = true,\n validator = false,\n returnType = 'full',\n group,\n sdk,\n resolver: userResolver,\n } = options\n\n return {\n output,\n exclude,\n include,\n override,\n group: group ?? null,\n baseURL,\n throwOnErrorDefault,\n validator,\n returnType,\n sdk: sdk ? { mode: sdk.mode ?? 'tag', name: sdk.name } : undefined,\n resolver: userResolver ? Resolver.merge<ResolverClient>(resolverClient, userResolver) : resolverClient,\n }\n}\n\n/**\n * Wires a client plugin in its `setup`: resolver, macros, client or SDK generator, and the `.kubb/` runtime with the plugin's own `client.ts`.\n */\nexport function setupClient({\n name,\n resolved,\n macros = [],\n client,\n}: {\n name: string\n resolved: ClientResolvedOptions\n macros?: ClientOptions['macros']\n client: string\n}): void {\n const config = useConfig()\n\n setResolver(resolved.resolver)\n setMacros([...defaultMacros, ...macros])\n\n const templates = templatePath('')\n addGenerator<ContractClientFactory>(resolved.sdk ? createSdkGenerator({ templates }) : createClientGenerator(name, { templates }))\n\n const root = path.resolve(config.root, config.output.path)\n const files = [\n ['serializers.ts', templatePath('serializers.ts')],\n ['mediaTypes.ts', templatePath('mediaTypes.ts')],\n ['core.ts', templatePath('core.ts')],\n ['client.ts', client],\n ['standardSchema.ts', templatePath('standardSchema.ts')],\n ] as const\n\n for (const [baseName, copy] of files) {\n injectFile({ baseName, path: path.resolve(root, '.kubb', baseName), copy })\n }\n}\n\n/**\n * Declares `plugin-ts` as optional and `plugin-zod` as required once `validator` enables a direction.\n */\nexport function clientDependencies(options: Pick<ClientOptions, 'validator'>) {\n return { [pluginTsName]: { optional: true }, [pluginZodName]: { optional: !isValidatorEnabled(options.validator) } }\n}\n","import { addGenerator, defineExtension, Resolver, setMacros, setResolver } from '@kubb/kit'\nimport { compatibility } from '../kubb-extension.json'\nimport { version } from '../package.json'\nimport { createClientGenerator } from './generators/clientGenerator.tsx'\nimport { defaultMacros } from './macros.ts'\nimport { resolverClient } from './resolver.ts'\nimport { clientDependencies } from './setup.ts'\nimport type { PluginClient, ResolverClient } from './types.ts'\n\n/**\n * Canonical plugin name for `@kubb/plugin-client`.\n */\nexport const pluginClientName = 'plugin-client' satisfies PluginClient['name']\n\n/**\n * Generates typed operations that call a client module owned by your application.\n * The module at `importPath` must export the runtime helpers and types used by generated operations.\n * Kubb does not copy or inject a transport implementation.\n *\n * @example\n * ```ts\n * pluginClient({ importPath: '../api/client' })\n * ```\n */\nexport const pluginClient = defineExtension<PluginClient>({\n kind: 'plugin',\n meta: { name: pluginClientName, version, compatibility },\n dependencies: clientDependencies,\n setup(options) {\n const {\n output = { path: 'clients', barrel: { type: 'named' } },\n exclude = [],\n include,\n override = [],\n importPath,\n throwOnErrorDefault = true,\n validator = false,\n returnType = 'plain',\n group,\n resolver: userResolver,\n } = options\n\n const resolver = userResolver ? Resolver.merge<ResolverClient>(resolverClient, userResolver) : resolverClient\n\n setResolver(resolver)\n setMacros([...defaultMacros, ...(options.macros ?? [])])\n addGenerator(createClientGenerator<PluginClient>('client'))\n\n return {\n output,\n exclude,\n include,\n override,\n group: group ?? null,\n importPath,\n baseURL: undefined,\n throwOnErrorDefault,\n validator,\n returnType,\n sdk: undefined,\n resolver,\n }\n },\n})\n\nexport default pluginClient\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEIA,MAAM,gCAAgB,IAAI,IAAI;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAU;;;;;;;;;;;AAYV,SAAgB,eAAe,MAAuB;CACpD,IAAI,CAAC,QAAQ,cAAc,IAAI,IAAiB,GAC9C,OAAO;CAET,OAAO,aAAa,IAAI;AAC1B;;;;;;;;;;;;;;;;;AAkBA,SAAgB,mBAAmB,MAAsB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ACvD,CAAA,GAAA,UAAA,aAAA,CAAa,sBAAoC,QAAQ,CAAC;EAE1D,OAAO;GACL;GACA;GACA;GACA;GACA,OAAO,SAAS;GAChB;GACA,SAAS,KAAA;GACT;GACA;GACA;GACA,KAAK,KAAA;GACL;EACF;CACF;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["text","ast","casing","pluginZodName","pluginTsName","Diagnostics","text","ast","ast","text","ast","pluginZodName","ast","ast","text","text","ast","ast","text","functionPrinter","createFunctionParameters","createFunctionParameter","ast","File","Function","ast","text","path","File","defineGenerator","jsxRenderer","ast","path","File","macroDedupeUnion","createResolver","casing","ast","File","File","ast","path","memo","defineGenerator","jsxRenderer","Diagnostics","File","fileURLToPath","Resolver","useConfig","path","pluginTsName","pluginZodName","defineExtension","Resolver"],"sources":["../kubb-extension.json","../package.json","../../../internals/utils/src/reserved.ts","../../../internals/utils/src/codegen.ts","../../../internals/utils/src/strings.ts","../../../internals/shared/src/operation.ts","../../../internals/shared/src/resolver.ts","../../../internals/client/src/resolveOperationTypes.ts","../src/builders/security.ts","../src/builders/validatorOptions.ts","../src/builders/validator.ts","../src/builders/operationData.ts","../src/builders/generics.ts","../src/builders/returnStatement.ts","../src/builders/contentType.ts","../src/builders/styles.ts","../src/builders/callConfig.ts","../src/builders/signature.ts","../src/builders/operationBody.ts","../src/components/Operation.tsx","../src/components/ClientRuntime.tsx","../src/generators/clientGenerator.tsx","../src/macros.ts","../src/resolver.ts","../src/components/SdkClient.tsx","../src/components/SdkFacade.tsx","../src/generators/sdkGenerator.tsx","../src/setup.ts","../src/plugin.ts"],"sourcesContent":["","","/**\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'\nimport { isIdentifier } from './reserved.ts'\n\n/**\n * Builds a JSDoc comment block from an array of lines. Returns `fallback` when there are no\n * comments.\n *\n * @example\n * ```ts\n * buildJSDoc(['@type string', '@example hello'])\n * // '/**\\n * @type string\\n * @example hello\\n *\\/\\n '\n * ```\n */\nexport function buildJSDoc(\n comments: Array<string>,\n options: {\n /**\n * String used to indent each comment line.\n * @default ' * '\n */\n indent?: string\n /**\n * String appended after the closing tag.\n * @default '\\n '\n */\n suffix?: string\n /**\n * Returned as-is when `comments` is empty.\n * @default ' '\n */\n fallback?: string\n } = {},\n): string {\n const { indent = ' * ', suffix = '\\n ', fallback = ' ' } = options\n\n if (comments.length === 0) return fallback\n\n return `/**\\n${comments.map((c) => `${indent}${c}`).join('\\n')}\\n */${suffix}`\n}\n\n/**\n * Assembles a multi-line object literal from already-rendered `entries`, indenting each entry one\n * level and closing the brace at column zero. Entries that are themselves multi-line objects indent\n * cumulatively. Each entry ends with a trailing comma to match the formatter's multi-line style.\n *\n * @example\n * ```ts\n * buildObject(['id: z.number()', 'name: z.string()'])\n * // '{\\n id: z.number(),\\n name: z.string(),\\n}'\n * ```\n */\nexport function buildObject(entries: Array<string>): string {\n if (entries.length === 0) return '{}'\n const body = entries.map((entry) => `${text.indent({ text: entry })},`).join('\\n')\n\n return `{\\n${body}\\n}`\n}\n\n/**\n * Assembles a bracketed list (array by default) from already-rendered `items`. Keeps everything on\n * one line when no item spans multiple lines, and otherwise puts each item on its own line, indented\n * one level with a trailing comma and the closing bracket at column zero. Used for member lists such\n * as `z.union([…])` and `z.array([…])`.\n *\n * @example\n * ```ts\n * buildList(['z.string()', 'z.number()'])\n * // '[z.string(), z.number()]'\n * ```\n */\nexport function buildList(items: Array<string>, brackets: [open: string, close: string] = ['[', ']']): string {\n const [open, close] = brackets\n if (items.length === 0) return `${open}${close}`\n if (!items.some((item) => item.includes('\\n'))) return `${open}${items.join(', ')}${close}`\n const body = items.map((item) => `${text.indent({ text: item })},`).join('\\n')\n\n return `${open}\\n${body}\\n${close}`\n}\n\n/**\n * Emits a lazy getter for a circular-ref property position, `get name() { return body }`. The key\n * is quoted only when it is not a valid identifier. Used by the string printers to defer evaluation\n * of a recursive schema until first access.\n *\n * @example\n * ```ts\n * lazyGetter({ name: 'parent', body: 'z.lazy(() => Pet)' })\n * // \"get parent() { return z.lazy(() => Pet) }\"\n * ```\n */\nexport function lazyGetter({ name, body }: { name: string; body: string }): string {\n return `get ${objectKey(name)}() { return ${body} }`\n}\n\n/**\n * An object key, quoted only when it is not identifier-shaped. Reserved words such as `class` stay bare.\n *\n * @example\n * ```ts\n * objectKey('x-total') // \"'x-total'\"\n * ```\n */\nexport function objectKey(name: string): string {\n return isIdentifier(name) ? name : text.quote(name)\n}\n\n/**\n * A JSON value as a JavaScript literal, with single-quoted strings and identifier keys left unquoted.\n *\n * @example\n * ```ts\n * toLiteral({ id: 1, 'x-tag': ['a'] }) // \"{ id: 1, 'x-tag': ['a'] }\"\n * ```\n */\nexport function toLiteral(value: unknown): string {\n if (typeof value === 'string') return text.quote(value)\n if (Array.isArray(value)) return `[${value.map(toLiteral).join(', ')}]`\n if (value && typeof value === 'object') {\n return `{ ${Object.entries(value)\n .map(([key, item]) => `${objectKey(key)}: ${toLiteral(item)}`)\n .join(', ')} }`\n }\n return String(value)\n}\n","import { text } from '@kubb/kit'\n\n// `\\p{`, `\\P{` or `\\u{` behind an odd number of backslashes, or a character outside the BMP: both need the `u` flag.\nconst NEEDS_UNICODE = /(?<!\\\\)(?:\\\\\\\\)*\\\\[pPu]\\{|[\\u{10000}-\\u{10FFFF}]/u\n// Escapes the `u` flag accepts. `\\-` only counts inside a class.\nconst KEPT_ESCAPE = /[A-Za-z0-9^$\\\\.*+?()[\\]{}|/]/\n\n/**\n * Drops the backslash from escapes that the `u` flag rejects: an escaped punctuation character that is\n * not a syntax character, and `\\-` outside a class. Both match the same character without the backslash.\n */\nfunction dropIdentityEscapes(pattern: string): string {\n let inClass = false\n\n return pattern.replace(/\\\\(.)|[[\\]]/gs, (match, escaped?: string) => {\n if (escaped === undefined) {\n inClass = match === '['\n return match\n }\n\n return KEPT_ESCAPE.test(escaped) || (escaped === '-' && inClass) ? match : escaped\n })\n}\n\n/**\n * Builds the `RegExp` for a pattern, adding the `u` flag when it uses `\\p{...}`, `\\P{...}` or `\\u{...}`, or\n * holds a character outside the BMP. A pattern that is not valid under `u` keeps the flags it came with.\n */\nfunction toRegExp(pattern: string, flags: string | undefined): RegExp {\n if (flags?.includes('u') || !NEEDS_UNICODE.test(pattern)) return new RegExp(pattern, flags)\n\n try {\n return new RegExp(dropIdentityEscapes(pattern), `${flags ?? ''}u`)\n } catch {\n return new RegExp(pattern, flags)\n }\n}\n\n/**\n * Converts a pattern string into a `new RegExp(...)` constructor call or a regex literal string.\n * Inline flags expressed as a `^(?im)` prefix are extracted and applied to the resulting expression.\n * Pass `null` as the second argument to emit a `/pattern/flags` literal instead.\n *\n * @example\n * ```ts\n * toRegExpString('^(?im)foo') // 'new RegExp(\"^foo\", \"im\")'\n * toRegExpString('^(?im)foo', null) // '/^foo/im'\n * ```\n */\nexport function toRegExpString(pattern: string, func: string | null = 'RegExp'): string {\n const raw = text.unquote(pattern)\n\n const match = raw.match(/^\\^(\\(\\?([igmsuy]+)\\))/i)\n const replacementTarget = match?.[1] ?? ''\n const matchedFlags = match?.[2]\n const cleaned = raw\n .replace(/^\\\\?\\//, '')\n .replace(/\\\\?\\/$/, '')\n .replace(replacementTarget, '')\n\n const { source, flags } = toRegExp(cleaned, matchedFlags)\n\n if (func === null) return `/${source}/${flags}`\n\n return `new ${func}(${JSON.stringify(source)}${flags ? `, ${JSON.stringify(flags)}` : ''})`\n}\n\n/**\n * Renders a dotted path or string array as an optional-chaining accessor expression rooted at\n * `accessor`. Returns `null` for an empty path.\n *\n * @example\n * ```ts\n * getNestedAccessor('pagination.next.id', 'lastPage')\n * // \"lastPage?.['pagination']?.['next']?.['id']\"\n * ```\n */\nexport function getNestedAccessor(param: string | Array<string>, accessor: string): string | null {\n const parts = Array.isArray(param) ? param : param.split('.')\n if (parts.length === 0 || (parts.length === 1 && parts[0] === '')) return null\n return `${accessor}?.['${`${parts.join(\"']?.['\")}']`}`\n}\n\n/**\n * Escapes an `@` at the start of a line, so a multi-line description can't start a new JSDoc tag.\n * Editors render `\\@` as `@` in hovers.\n *\n * @example\n * ```ts\n * jsDocEscape('intro\\n@example value') // 'intro\\n\\\\@example value'\n * ```\n */\nexport function jsDocEscape(input: unknown): string {\n return `${input}`.replace(/^(\\s*)@/gm, '$1\\\\@')\n}\n","import { jsDocEscape } from '@internals/utils'\nimport { ast, type Group, type Memo, type Output, type Resolver, type ResolverFileParams } from '@kubb/kit'\n\n/**\n * Builds the `ResolverFileParams` every operation generator passes to\n * `resolver.file`: a file named `name`, tagged by the operation's first\n * tag (or `'default'`), at the operation's path. Centralizes the entry object\n * that was repeated at dozens of call sites across the client and query plugins.\n *\n * @example\n * ```ts\n * resolver.file(operationFileEntry(node, node.operationId), { root, output, group })\n * ```\n */\nexport function operationFileEntry(node: ast.OperationNode, name: string, extname: ResolverFileParams['extname'] = '.ts'): ResolverFileParams {\n return {\n name,\n extname,\n tag: node.tags[0] ?? 'default',\n path: node.path,\n }\n}\n\n/**\n * Resolves the file a schema-emitting plugin (`plugin-ts`, `plugin-zod`, `plugin-faker`) writes\n * `node` to, cached in `ctx.memo` under the resolver's plugin name and the\n * operation. The plugin itself and every plugin that imports from it call this, so they all get\n * the same path.\n *\n * When that path matches the file of a component schema in `ctx.driver.inputNode`, ignoring case, the file name\n * gets an `Operation` suffix: operation `point` goes to `PointOperation.ts` next to schema `Point.ts`.\n * Otherwise the two merge into one file, or overwrite each other on a case-insensitive file system.\n * Only the file name changes. The declarations keep their names.\n *\n * @example Resolve `plugin-ts`'s file for the current operation\n * ```ts\n * const fileTs = resolveOperationFile({ ctx, node, resolver: tsResolver, root, output })\n * ```\n */\nexport function resolveOperationFile(options: {\n ctx: { memo: Memo; driver: { inputNode?: { schemas: ReadonlyArray<ast.SchemaNode> } | null } }\n node: ast.OperationNode\n resolver: Pick<Resolver, 'file' | 'pluginName'>\n root: string\n output: Output\n group?: Group | null\n}): ast.FileNode {\n const { ctx, node, resolver, root, output } = options\n const { memo } = ctx\n const location = { root, output, group: options.group ?? undefined }\n\n return memo(`${resolver.pluginName}:operationFile:${node.operationId}`, () => {\n const schemaPaths = memo(\n `${resolver.pluginName}:schemaFilePaths`,\n () =>\n new Set(\n (ctx.driver.inputNode?.schemas ?? []).flatMap((schema) =>\n schema.name ? [resolver.file({ name: schema.name, extname: '.ts', ...location }).path.toLowerCase()] : [],\n ),\n ),\n )\n let file = resolver.file({ ...operationFileEntry(node, node.operationId), ...location })\n\n for (let name = `${node.operationId}Operation`; schemaPaths.has(file.path.toLowerCase()); name += 'Operation') {\n const next = resolver.file({ ...operationFileEntry(node, name), ...location })\n // A single-file output holds every declaration on purpose, so a new name changes nothing.\n if (next.path === file.path) break\n file = next\n }\n\n return file\n })\n}\n\nexport type ContentTypeInfo = {\n contentTypes: string[]\n isMultipleContentTypes: boolean\n contentTypeUnion: string\n defaultContentType: string\n hasFormData: boolean\n}\n\nexport type RequestConfigResolver = {\n response: {\n body(node: ast.OperationNode): string\n }\n}\n\nexport type ResponseStatusNameResolver = {\n response: {\n status(node: ast.OperationNode, statusCode: ast.StatusCode): string\n }\n}\n\nexport type ResponseNameResolver = ResponseStatusNameResolver & {\n response: {\n response(node: ast.OperationNode): string\n }\n}\n\nexport type OperationTypeNameResolver = RequestConfigResolver &\n ResponseNameResolver & {\n param: {\n path(node: ast.OperationNode, param: ast.ParameterNode): string\n query(node: ast.OperationNode, param: ast.ParameterNode): string\n headers(node: ast.OperationNode, param: ast.ParameterNode): string\n cookies(node: ast.OperationNode, param: ast.ParameterNode): string\n }\n }\n\nexport type BuildOperationCommentsOptions = {\n splitLines?: boolean\n}\n\nexport type ResolveOperationTypeNameOptions = {\n responseStatusNames?: boolean | 'error'\n exclude?: ReadonlyArray<string | undefined>\n order?: 'params-first' | 'body-response-first'\n /**\n * Include the individual `Path`/`Query`/`Headers` group type names. Set to `false` for clients\n * that reference the grouped `Options` type instead of the per-group types.\n */\n includeParams?: boolean\n}\n\n/**\n * The operation's method and path as plain text, such as `` `GET /pet/{petId}` ``. A path is not a valid `{@link}` target.\n */\nfunction getOperationRequestLine(node: ast.OperationNode): string | null {\n return ast.http.isOperation(node) && node.path ? `\\`${node.method.toUpperCase()} ${node.path}\\`` : null\n}\n\n/**\n * Derives the shared `ContentTypeInfo` shape from a list of content types, tracking whether several\n * are present and the union, default, and form-data flags the client uses to pick one.\n */\nfunction buildContentTypeInfo(contentTypes: string[]): ContentTypeInfo {\n const isMultipleContentTypes = contentTypes.length > 1\n\n return {\n contentTypes,\n isMultipleContentTypes,\n contentTypeUnion: isMultipleContentTypes ? contentTypes.map((ct) => JSON.stringify(ct)).join(' | ') : '',\n defaultContentType: contentTypes[0] ?? 'application/json',\n hasFormData: contentTypes.some((ct) => ct === 'multipart/form-data'),\n }\n}\n\nexport function getContentTypeInfo(node: ast.OperationNode): ContentTypeInfo {\n return buildContentTypeInfo(node.requestBody?.content?.map((e) => e.contentType) ?? [])\n}\n\n/**\n * The request-body counterpart for the primary success response: the content types it documents and\n * whether several are present, so the client can let a caller pick which one to accept.\n */\nexport function getResponseContentTypeInfo(node: ast.OperationNode): ContentTypeInfo {\n return buildContentTypeInfo(ast.http.responses.findPrimary(node)?.content?.map((e) => e.contentType) ?? [])\n}\n\ntype ResponseType = 'blob' | 'text' | 'stream'\n\ntype ResponseContentEntry = { contentType: string; schema?: ast.SchemaNode | null; stream?: ast.ContentNode['stream'] }\n\n/**\n * How an operation streams its primary success response item by item, when that response declares one content type:\n * - `'event'` for `text/event-stream` whose `itemSchema` types the whole event with its own `event` and `data`\n * - `'data'` for `text/event-stream` typed by its payload only\n * - `'line'` for JSON Lines, one parsed JSON value per line\n *\n * Returns `null` for any other response, and for a response that also declares another content type, which stays a normal\n * call with its query hooks.\n */\nexport function getEventStream(node: ast.OperationNode): 'event' | 'data' | 'line' | null {\n const content = ast.http.responses.findPrimary(node)?.content ?? []\n if (content.length !== 1) return null\n const entry = content[0]!\n const framing = getStreamFraming(entry)\n if (framing === 'events') return entry.stream?.shape ?? 'data'\n return framing === 'lines' ? 'line' : null\n}\n\n/**\n * How a content entry is framed as a stream: `'events'` for Server-Sent Events, `'lines'` for JSON Lines.\n */\nexport function getStreamFraming(entry: Pick<ast.ContentNode, 'contentType' | 'stream'>): 'events' | 'lines' | undefined {\n if (ast.mediaType.getBase(entry) === 'text/event-stream') return 'events'\n // `multipart/mixed` with an `itemSchema` also has `stream`, but it is a stream of parts, not of JSON values.\n return entry.stream && ast.mediaType.isStream(entry) ? 'lines' : undefined\n}\n\n/**\n * Whether an operation streams its primary success response, as Server-Sent Events or JSON Lines. The client generator uses\n * this to return a typed stream of items instead of a one-shot `RequestResult`.\n */\nexport function isEventStream(node: ast.OperationNode): boolean {\n return getEventStream(node) !== null\n}\n\n// A stream without a schema is a `blob` with a string primitive, so it keeps the JSON-parse default.\nfunction isTextSchema(schema: ast.SchemaNode | null | undefined): boolean {\n if (!schema) return false\n const resolved = ast.ref.getSchema(schema)\n return resolved.type !== 'blob' && resolved.primitive === 'string'\n}\n\n/**\n * Whether an operation streams Server-Sent Events whose `data` the document types as a string, so the client keeps each\n * `data` as text instead of JSON-parsing it. With an event-shaped `itemSchema` where only some events type `data` as a\n * string, it returns the names of those events, or `false` when one of them has no fixed name.\n */\nexport function hasTextEventData(node: ast.OperationNode): boolean | Array<string> {\n const shape = getEventStream(node)\n const entry = ast.http.responses.findPrimary(node)?.content?.[0]\n if (!entry || (shape !== 'data' && shape !== 'event')) return false\n if (shape === 'data') return isTextSchema(entry.stream?.schema ?? entry.schema)\n\n const item = entry.stream?.schema ? ast.ref.getSchema(entry.stream.schema) : undefined\n if (!item) return false\n const events = item.type === 'union' ? (ast.schema.narrow(item, 'union')?.members ?? []) : [item]\n // A discriminator makes each event an intersection of its `$ref` and the pinned `event`, so every part is read.\n const propertySchemas = (event: ast.SchemaNode, propertyName: string) => ast.schema.findProperties({ node: event, propertyName }).map(({ schema }) => schema)\n const textEvents = events.filter((event) => {\n const dataSchemas = propertySchemas(event, 'data')\n return dataSchemas.length > 0 && dataSchemas.every(isTextSchema)\n })\n if (textEvents.length === events.length) return events.length > 0\n\n const eventNames = textEvents.map((event) => propertySchemas(event, 'event').flatMap((schema) => ast.schema.getLiterals(ast.ref.getSchema(schema))))\n return eventNames.length > 0 && eventNames.every((values) => values.length > 0) && [...new Set(eventNames.flat().map(String))]\n}\n\n/**\n * Whether the primary success response offers `text/event-stream`, alone or next to other content types. The client asks\n * for the stream by default and ships the `sse.ts` runtime, so a mixed response can be read as events too.\n */\nexport function hasEventStreamContent(node: ast.OperationNode): boolean {\n const entries = ast.http.responses.findPrimary(node)?.content ?? []\n // Next to another type, a stream without a schema gets no typed variant, so it keeps the plain call.\n return entries.some((entry) => getStreamFraming(entry) === 'events' && (entries.length === 1 || Boolean(entry.schema)))\n}\n\n/**\n * Whether a success response offers a stream media type next to other content types. The client returns that variant's\n * body as a `ReadableStream`, so the stream runtime is registered and a hook's data type includes the stream.\n */\nexport function hasStreamVariant(node: ast.OperationNode): boolean {\n return ast.http.responses.filterSuccess(node).some((response) => {\n const variants = (response.content ?? []).filter((entry) => entry.schema)\n return variants.length > 1 && variants.some((entry) => ast.mediaType.isStream(entry))\n })\n}\n\nconst formContentTypes = ['multipart/form-data', 'application/x-www-form-urlencoded'] as const\n\n/**\n * The form media types the operation's request body offers, `multipart/form-data` and `application/x-www-form-urlencoded`,\n * which the client needs a handler for.\n */\nexport function getFormContentTypes(node: ast.OperationNode): Array<(typeof formContentTypes)[number]> {\n const request = new Set((node.requestBody?.content ?? []).map((entry) => ast.mediaType.getBase(entry)))\n return formContentTypes.filter((contentType) => request.has(contentType))\n}\n\n/**\n * Parser for one response content entry.\n *\n * JSON stays unset so the runtime detects it. `text/event-stream` and JSON Lines are streams. A binary schema\n * (`format: binary` / `contentMediaType`) is a blob even when the media type is not a well-known\n * binary type. Other `text/*` is text, and `application/octet-stream`, `application/pdf`,\n * `image/*`, `audio/*`, and `video/*` are blobs.\n */\nfunction responseTypeForContent(entry: ResponseContentEntry): ResponseType | undefined {\n const baseType = ast.mediaType.getBase(entry)\n if (!baseType) return undefined\n if (getStreamFraming(entry)) return 'stream'\n if (ast.mediaType.isJson(baseType)) return undefined\n if (entry.schema?.type === 'blob') return 'blob'\n if (baseType.startsWith('text/')) return 'text'\n if (isBinaryContentType(baseType)) return 'blob'\n return undefined\n}\n\nfunction isBinaryContentType(baseType: string): boolean {\n return baseType === 'application/octet-stream' || baseType === 'application/pdf' || /^(image|audio|video)\\//.test(baseType)\n}\n\n/**\n * Maps a content type to the PascalCase suffix used to name per-content-type variants\n * (e.g. `application/json` → `Json`, `application/xml` → `Xml`, `multipart/form-data` → `FormData`).\n */\nfunction getContentTypeSuffix(contentType: string): string {\n // Keeps the original case, unlike ast.mediaType.getBase, so generated names stay stable.\n const baseType = contentType.split(';')[0]!.trim()\n if (baseType === 'application/json') return 'Json'\n if (baseType === 'multipart/form-data') return 'FormData'\n if (baseType === 'application/x-www-form-urlencoded') return 'FormUrlEncoded'\n const subtype = baseType.split('/').pop() ?? baseType\n const parts = subtype.split(/[^a-zA-Z0-9]+/).filter(Boolean)\n if (parts.length === 0) return 'Unknown'\n return parts.map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join('')\n}\n\n/**\n * Appends a content-type suffix to a base name, keeping a trailing `Data` segment last\n * (e.g. `AddPetData` + `Json` → `AddPetJsonData`, `AddPetStatus200` + `Xml` → `AddPetStatus200Xml`).\n */\nexport function getPerContentTypeName(baseName: string, suffix: string): string {\n if (baseName.endsWith('Data')) {\n return suffix.endsWith('Data') ? baseName.slice(0, -4) + suffix : `${baseName.slice(0, -4)}${suffix}Data`\n }\n return baseName + suffix\n}\n\nexport type ContentVariantInput = { contentType: string; schema?: ast.SchemaNode | null; keysToOmit?: Array<string> | null }\nexport type ContentVariant = { name: string; suffix: string; schema: ast.SchemaNode; keysToOmit?: Array<string> | null; contentType: string }\n\n/**\n * Returns the entry with the schema of the value the client returns: `string` for a body read as text, such as `Pet` on\n * `application/xml`, and `blob` for `image/*`, `audio/*`, `video/*`, PDF, and octet-stream. A binary schema elsewhere is a `Blob`\n * only through `parseAs: 'blob'`, which needs every entry in `entries` binary. JSON, vendor (`application/vnd.*`), stream,\n * schemaless, and wildcard entries keep their schema. `entries` is the response's full list of content types.\n */\nexport function toResponseContent<T extends ContentVariantInput & ResponseContentEntry>(entry: T, entries: ReadonlyArray<ResponseContentEntry> = [entry]): T {\n const { contentType, schema } = entry\n if (!schema || entry.stream) return entry\n\n const baseType = ast.mediaType.getBase(contentType)\n const resolved = ast.ref.getSchema(schema)\n if (isBinaryContentType(baseType)) {\n return resolved.type === 'blob' ? entry : { ...entry, schema: ast.factory.createSchema({ type: 'blob' }), keysToOmit: null }\n }\n const isPlainMediaType = Boolean(baseType) && !ast.mediaType.isJson(baseType) && !baseType.includes('*')\n if (resolved.type === 'blob') {\n // shortcut: an error response never gets `parseAs`, so a lone binary schema there reads as text too but stays `Blob`.\n const readsAsText = isPlainMediaType && !entries.every((item) => item.schema?.type === 'blob')\n return readsAsText ? { ...entry, schema: ast.factory.createSchema({ type: 'string' }), keysToOmit: null } : entry\n }\n if (resolved.primitive === 'string') return entry\n\n const responseType = responseTypeForContent(entry)\n // A response without a body, such as a 405, has no schema to read. Only `text/*` is always text.\n if (responseType !== 'text' && (resolved.type === 'unknown' || resolved.type === 'any' || resolved.type === 'void')) return entry\n const isVendorJson = /^[^/]+\\/vnd\\./.test(baseType) && !/(xml|yaml|yml|csv)$/.test(baseType)\n const isText = responseType === 'text' || (!responseType && isPlainMediaType && !isVendorJson)\n\n return isText ? { ...entry, schema: ast.factory.createSchema({ type: 'string' }), keysToOmit: null } : entry\n}\n\n/**\n * Resolves per-content-type variant names for a set of content entries, deduplicating suffix\n * collisions with a numeric counter. Entries without a schema are skipped. The returned `suffix` is\n * the final (possibly counter-augmented) value, so callers can derive parallel names in another\n * namespace (e.g. plugin-faker deriving the matching plugin-ts type name).\n */\nexport function resolveContentTypeVariants(entries: Array<ContentVariantInput>, baseName: string): Array<ContentVariant> {\n const usedNames = new Set<string>()\n return entries\n .filter((entry) => entry.schema)\n .map((entry) => {\n const baseSuffix = getContentTypeSuffix(entry.contentType)\n let suffix = baseSuffix\n let name = getPerContentTypeName(baseName, suffix)\n let counter = 2\n while (usedNames.has(name)) {\n suffix = `${baseSuffix}${counter++}`\n name = getPerContentTypeName(baseName, suffix)\n }\n usedNames.add(name)\n return { name, suffix, schema: entry.schema!, keysToOmit: entry.keysToOmit, contentType: entry.contentType }\n })\n}\n\n/**\n * Builds the `client?:` option type shared by the generated query hooks (`useQuery`,\n * `useInfiniteQuery`, `useSWR`, ...): `RequestConfig` minus what the\n * hook fills in, which is every request group and `throwOnError`. Unlike {@link buildRequestConfigType},\n * it never narrows `contentType`: query hooks wrap GET operations, which carry no request body to select\n * a content type for.\n */\nexport function buildClientOptionType(options: { omit?: Array<string> } = {}): string {\n const keys = [...requestGroupOrder, 'url', ...(options.omit ?? []), 'throwOnError']\n return `Partial<Omit<RequestConfig, ${keys.map((key) => `'${key}'`).join(' | ')}>>`\n}\n\n/**\n * The `client?:` option type of a mutation hook. When the operation has a request content type choice,\n * the mutation variables carry `contentType`, so the config leaves it out. Otherwise the ambiguous side is\n * narrowed to the operation's media types; a single-type side has nothing to pick, so it stays baked in the\n * generated call.\n */\nexport function buildRequestConfigType(node: ast.OperationNode): string {\n if (hasRequestContentTypeChoice(node)) {\n return buildClientOptionType({ omit: ['contentType'] })\n }\n\n const request = getContentTypeInfo(node)\n const response = getResponseContentTypeInfo(node)\n const members = [\n request.isMultipleContentTypes ? `request?: ${request.contentTypeUnion}` : null,\n response.isMultipleContentTypes ? `response?: ${response.contentTypeUnion}` : null,\n ].filter(Boolean)\n\n const base = buildClientOptionType()\n return members.length ? `${base} & { contentType?: { ${members.join('; ')} } }` : base\n}\n\n/** The grouped request options, in the order generated signatures and calls list them. */\nexport const requestGroupOrder = ['path', 'query', 'body', 'headers', 'cookies'] as const\n\nexport type RequestGroups = {\n path: boolean\n query: boolean\n body: boolean\n headers: boolean\n cookies: boolean\n}\n\n/**\n * Which of the grouped request options an operation carries.\n */\nexport function getRequestGroups(node: ast.OperationNode): RequestGroups {\n const { path, query, header, cookie } = ast.http.groupParameters(node)\n return {\n path: path.length > 0,\n query: query.length > 0,\n body: Boolean(ast.http.requestBody.getSchema(node)),\n headers: header.length > 0,\n cookies: cookie.length > 0,\n }\n}\n\nexport type RequestGroupOptionality = {\n groups: RequestGroups\n hasRequiredPath: boolean\n hasRequiredQuery: boolean\n hasRequiredHeader: boolean\n /**\n * Whether the grouped request parameter can default to `{}`. True only when no group carries a\n * required member, so every member is safe to omit.\n */\n isOptional: boolean\n}\n\n/**\n * Resolves which grouped request options an operation carries together with whether each group\n * holds a required member. The grouped parameter stays optional only when nothing inside it is\n * required, matching the generated `RequestConfig` type.\n */\nexport function getRequestGroupOptionality(node: ast.OperationNode): RequestGroupOptionality {\n const groups = getRequestGroups(node)\n const { path, query, header } = ast.http.groupParameters(node)\n const hasRequiredPath = path.some((param) => param.required)\n const hasRequiredQuery = query.some((param) => param.required)\n const hasRequiredHeader = header.some((param) => param.required)\n\n return {\n groups,\n hasRequiredPath,\n hasRequiredQuery,\n hasRequiredHeader,\n // `cookies` never makes the parameter required: a browser sends its cookies itself and cannot set a `Cookie` header.\n isOptional: !hasRequiredPath && !hasRequiredQuery && !hasRequiredHeader && !(groups.body && node.requestBody?.required === true),\n }\n}\n\nexport type RequestOptionsNameResolver = RequestConfigResolver & {\n response: {\n options(node: ast.OperationNode): string\n }\n}\n\n/**\n * Builds the grouped `{ path, query, body, headers, cookies }` parameter for a generated client\n * function, typed from the operation's `Options` (minus `url`). Only the groups the\n * operation actually has are destructured. The trailing `config` parameter carries the\n * runtime `RequestConfig` overrides plus `client`.\n */\nexport function buildRequestParamsSignature(\n node: ast.OperationNode,\n resolver: RequestOptionsNameResolver,\n options: { isConfigurable?: boolean } = {},\n): { signature: string; groups: RequestGroups; names: Array<keyof RequestGroups> } {\n const { isConfigurable = true } = options\n const { groups, isOptional } = getRequestGroupOptionality(node)\n\n const names = requestGroupOrder.filter((key) => groups[key])\n\n // These callers never carry the `contentType` that several media types require.\n const optionsType = hasRequestContentTypeChoice(node)\n ? `Pick<${resolver.response.options(node)}, ${names.map((name) => `'${name}'`).join(' | ')}>`\n : resolver.response.options(node)\n const firstParam = names.length > 0 ? `{ ${names.join(', ')} }: ${optionsType}${isOptional ? ' = {}' : ''}` : null\n const configParam = isConfigurable ? `config: ${buildRequestConfigType(node)} = {}` : null\n\n return {\n signature: [firstParam, configParam].filter(Boolean).join(', '),\n groups,\n names,\n }\n}\n\nexport function buildOperationComments(node: ast.OperationNode, options: BuildOperationCommentsOptions = {}): Array<string> {\n const { splitLines = false } = options\n // The request line leads: free text after a block tag would belong to that tag.\n const comments = [\n getOperationRequestLine(node),\n node.description && `@description ${node.description}`,\n node.summary && `@summary ${node.summary}`,\n node.deprecated && '@deprecated',\n node.externalDocs && `@see ${jsDocEscape([node.externalDocs.url, node.externalDocs.description].filter(Boolean).join(' '))}`,\n ]\n\n const filteredComments = comments.filter((comment): comment is string => Boolean(comment))\n\n if (!splitLines) {\n return filteredComments\n }\n\n return filteredComments.flatMap((text) => text.split(/\\r?\\n/).map((line) => line.trim())).filter((comment): comment is string => Boolean(comment))\n}\n\n/**\n * Whether the operation declares more than one request media type with a schema, so a caller must pick one on `contentType`.\n */\nexport function hasRequestContentTypeChoice(node: ast.OperationNode): boolean {\n return (node.requestBody?.content ?? []).filter((entry) => entry.schema).length > 1\n}\n\n/**\n * Casts a call argument to the client's parameter type; a `'plain'` client is non-generic.\n */\nexport function castToClientOptions(callArg: string, clientName: string, returnType: 'full' | 'data' | 'plain' = 'full'): string {\n return `${callArg} as Parameters<typeof ${clientName}${returnType === 'plain' ? '' : '<true>'}>[0]`\n}\n\n/**\n * Builds the combined `{ body, path, query, headers, cookies }` options object schema for an operation,\n * referencing the already-resolved body and grouped param names. `cookies` appears only on an operation\n * with a cookie parameter, and stays optional because a browser sends its cookies itself. Shared by `@kubb/plugin-ts`'s\n * `Options` type and `@kubb/plugin-zod`'s inferred options schema, so both printers emit the same shape from the same inputs.\n * `primitive: 'object'` is a no-op for the TS printer and tells the Zod printer to emit `z.object(…)` rather\n * than a record.\n */\nexport function buildOptionsSchema(node: ast.OperationNode, resolver: OperationTypeNameResolver, { pairContentTypes = false } = {}): ast.SchemaNode {\n const { path, query, header, cookie } = ast.http.groupParameters(node)\n const hasBody = Boolean(ast.http.requestBody.getSchema(node))\n const createNever = () => ast.factory.createSchema({ type: 'never', primitive: undefined, optional: true })\n const groups = [\n { name: 'path', params: path, resolve: resolver.param.path },\n { name: 'query', params: query, resolve: resolver.param.query },\n { name: 'headers', params: header, resolve: resolver.param.headers },\n { name: 'cookies', params: cookie, resolve: resolver.param.cookies },\n ] as const\n\n const createOptions = (body: ast.SchemaNode, extra: Array<ast.PropertyNode> = []) =>\n // NOTE(v5-stable): the fields were renamed from the legacy beta shape\n // (`data`/`pathParams`/`queryParams`/`headerParams`) to `body`/`path`/`query`/`headers` so the\n // type matches the runtime client. Drop this note once v5 leaves beta.\n ast.factory.createSchema({\n type: 'object',\n primitive: 'object',\n deprecated: node.deprecated,\n properties: [\n ast.factory.createProperty({ name: 'body', required: hasBody && node.requestBody?.required === true, schema: body }),\n ...groups\n .filter(({ name, params }) => name !== 'cookies' || params.length > 0)\n .map(({ name, params, resolve }) => {\n const required = name !== 'cookies' && params.some((param) => param.required)\n\n return ast.factory.createProperty({\n name,\n required,\n schema:\n params.length > 0\n ? ast.factory.createSchema({ type: 'ref', name: resolve.call(resolver.param, node, params[0]!), optional: !required })\n : createNever(),\n })\n }),\n ...extra,\n ],\n })\n\n const variants =\n pairContentTypes && hasRequestContentTypeChoice(node) ? resolveContentTypeVariants(node.requestBody?.content ?? [], resolver.response.body(node)) : []\n if (variants.length < 2) {\n return createOptions(hasBody ? ast.factory.createSchema({ type: 'ref', name: resolver.response.body(node) }) : createNever())\n }\n\n // The first media type is the runtime default, so only the others must pass `contentType`. A bare string sets the\n // request content type at runtime, so it is accepted next to the `{ request }` form.\n return ast.factory.createSchema({\n type: 'union',\n members: variants.map((variant, index) => {\n const contentType = ast.factory.createSchema({ type: 'enum', enumValues: [variant.contentType] })\n\n return createOptions(ast.factory.createSchema({ type: 'ref', name: variant.name }), [\n ast.factory.createProperty({\n name: 'contentType',\n required: index > 0,\n schema: ast.factory.createSchema({\n type: 'union',\n members: [\n contentType,\n ast.factory.createSchema({\n type: 'object',\n primitive: 'object',\n properties: [ast.factory.createProperty({ name: 'request', required: true, schema: contentType })],\n }),\n ],\n }),\n }),\n ])\n }),\n })\n}\n\n/**\n * The schema a status occupies in the `<Name>Responses` record. A status that documents several\n * content types becomes a `{ contentType; data }` union so the runtime can surface the negotiated type\n * on `result.parsed`, while the standalone `<Name>StatusNNN` alias stays the plain body union that the\n * query hooks and `result.data` use. With `streamData`, the stream variant of a 2xx status holds that schema, since the\n * client returns its body unread.\n */\nfunction buildResponseRecordEntry(\n node: ast.OperationNode,\n res: ast.ResponseNode,\n resolver: ResponseStatusNameResolver,\n streamData: ast.SchemaNode | undefined,\n): ast.SchemaNode {\n const statusName = resolver.response.status(node, res.statusCode)\n const variants = (res.content ?? []).filter((entry) => entry.schema)\n if (variants.length <= 1) {\n return ast.factory.createSchema({ type: 'ref', name: statusName })\n }\n\n return ast.factory.createSchema({\n type: 'union',\n members: resolveContentTypeVariants(variants, statusName).map((variant) =>\n ast.factory.createSchema({\n type: 'object',\n primitive: 'object',\n properties: [\n ast.factory.createProperty({\n name: 'contentType',\n required: true,\n // The runtime reports the bare media type, without parameters such as `charset` or `profile`.\n schema: ast.factory.createSchema({ type: 'enum', enumValues: [ast.mediaType.getBase(variant)] }),\n }),\n ast.factory.createProperty({\n name: 'data',\n required: true,\n schema:\n streamData && ast.http.status.isSuccess(res) && ast.mediaType.isStream(variant)\n ? streamData\n : ast.factory.createSchema({ type: 'ref', name: variant.name }),\n }),\n ],\n }),\n ),\n })\n}\n\n/**\n * Builds the per-status `<Name>Responses` record for an operation, referencing the already-resolved\n * `<Name>StatusNNN` names. Shared by `@kubb/plugin-ts`'s `Responses` type and `@kubb/plugin-zod`'s\n * inferred responses schema, so both emit the same shape from the same inputs.\n *\n * Always emits the keyed record, even when an operation declares no responses. An operation with no\n * responses renders as an empty object, which keeps every consumer's import (for example the axios\n * SDK's `RequestResult<XResponses>`) resolvable instead of pointing at a missing export.\n *\n * `streamData` is the type of a stream variant's `data`, such as a `ReadableStream<Uint8Array>` reference.\n */\nexport function buildResponses(\n node: ast.OperationNode,\n resolver: ResponseStatusNameResolver,\n { streamData }: { streamData?: ast.SchemaNode } = {},\n): ast.SchemaNode {\n return ast.factory.createSchema({\n type: 'object',\n primitive: 'object',\n properties: node.responses.map((res) =>\n ast.factory.createProperty({\n name: String(res.statusCode),\n required: true,\n schema: buildResponseRecordEntry(node, res, resolver, streamData),\n }),\n ),\n })\n}\n\nexport function resolveErrorNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return ast.http.responses.filterError(node).map((response) => resolver.response.status(node, response.statusCode))\n}\n\nexport function resolveSuccessNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return ast.http.responses.filterSuccess(node).map((response) => resolver.response.status(node, response.statusCode))\n}\n\nexport function resolveStatusCodeNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses.map((response) => resolver.response.status(node, response.statusCode))\n}\n\n/**\n * Lists the type names an operation's types file declares, computed once per resolver and `options` so every\n * dependent reads the same list.\n */\nexport function resolveOperationTypeNames(\n node: ast.OperationNode,\n resolver: OperationTypeNameResolver & Pick<Resolver, 'memo'>,\n options: ResolveOperationTypeNameOptions = {},\n): string[] {\n const key = `${node.operationId}\\0${options.order ?? ''}\\0${options.responseStatusNames ?? ''}\\0${options.includeParams === false ? 'noparams' : ''}\\0${(options.exclude ?? []).join(',')}`\n return resolver.memo(`operationTypeNames:${key}`, () => {\n const { path, query, header, cookie } = ast.http.groupParameters(node)\n const responseStatusNames =\n options.responseStatusNames === 'error'\n ? resolveErrorNames(node, resolver)\n : options.responseStatusNames === false\n ? []\n : resolveStatusCodeNames(node, resolver)\n const exclude = new Set(options.exclude ?? [])\n const paramNames =\n options.includeParams === false\n ? []\n : [\n ...path.map((param) => resolver.param.path(node, param)),\n ...query.map((param) => resolver.param.query(node, param)),\n ...header.map((param) => resolver.param.headers(node, param)),\n ...cookie.map((param) => resolver.param.cookies(node, param)),\n ]\n const bodyAndResponseNames = [ast.http.requestBody.getSchema(node) ? resolver.response.body(node) : null, resolver.response.response(node)]\n const names =\n options.order === 'body-response-first'\n ? [...bodyAndResponseNames, ...paramNames, ...responseStatusNames]\n : [...paramNames, ...bodyAndResponseNames, ...responseStatusNames]\n\n return names.filter((name): name is string => Boolean(name) && !exclude.has(name as string))\n })\n}\n\nexport function resolveResponseTypes(node: ast.OperationNode, resolver: ResponseNameResolver): Array<[statusCode: number | 'default', typeName: string]> {\n const types: Array<[number | 'default', string]> = []\n\n for (const response of node.responses) {\n if (response.statusCode === 'default') {\n types.push(['default', resolver.response.response(node)])\n continue\n }\n\n const code = Number(response.statusCode)\n if (Number.isNaN(code)) {\n continue\n }\n\n types.push([code, ast.http.status.isSuccess(code) ? resolver.response.response(node) : resolver.response.status(node, response.statusCode)])\n }\n\n return types\n}\n","import { ensureValidVarName, toFilePath } from '@internals/utils'\nimport { ast, casing } from '@kubb/kit'\nimport type { GeneratorContext, Resolver, ResolverFile } from '@kubb/kit'\n\n/**\n * The shared top-level `name` of the operation plugins, computed once per operation name and build.\n */\nexport function resolveOperationName(this: Resolver, name: string): string {\n return this.memo(`operation:${name}`, () => ensureValidVarName(casing.camel(name)))\n}\n\n/**\n * Builds the allocation key for a declaration an operation owns. `scope` names which declaration\n * it is, so two of them never share an allocation even when a custom resolver gives both the same\n * name. Leave `scope` empty for the operation's own declaration.\n *\n * The key starts from the operation's input `pointer`, which macros keep, so a plugin whose macro\n * rewrites the method or path still resolves another plugin's names for the same operation.\n *\n * @example\n * ```ts\n * resolver.resolveName({ key: operationKey(node, 'response', 'status', 404), name })\n * ```\n */\nexport function operationKey(node: ast.OperationNode, ...scope: Array<string | number>): Array<string | undefined> {\n const source = node.pointer ? [node.pointer] : [node.method, node.path]\n return ['operation', ...source, ...scope.map(String)]\n}\n\n/**\n * The `param` namespace shared by the schema-producing plugins (ts, zod, faker):\n * per-parameter names plus the grouped `Path`/`Query`/`Headers`/`Cookies` names, all routed\n * through the plugin's top-level `name` casing.\n */\nexport type OperationParamResolver = {\n name(this: Resolver, node: ast.OperationNode, param: ast.ParameterNode): string\n path(this: Resolver, node: ast.OperationNode): string\n query(this: Resolver, node: ast.OperationNode): string\n headers(this: Resolver, node: ast.OperationNode): string\n cookies(this: Resolver, node: ast.OperationNode): string\n}\n\n/**\n * The `response` namespace shared by the schema-producing plugins: per-status,\n * body, and combined response names, all routed through the plugin's top-level\n * `name` casing.\n */\nexport type OperationResponseResolver = {\n status(this: Resolver, node: ast.OperationNode, statusCode: ast.StatusCode): string\n /**\n * Name of the headers a response declares, such as `ListPetsStatus200Headers`.\n */\n headers(this: Resolver, node: ast.OperationNode, statusCode: ast.StatusCode): string\n body(this: Resolver, node: ast.OperationNode): string\n responses(this: Resolver, node: ast.OperationNode): string\n response(this: Resolver, node: ast.OperationNode): string\n}\n\n/**\n * Builds the shared `param` namespace. Spread the result into `createResolver`\n * and override individual methods next to it when a plugin deviates.\n *\n * @example\n * ```ts\n * createResolver<PluginTs>({ param: createOperationParamResolver(), ... })\n * ```\n */\nexport function createOperationParamResolver(): OperationParamResolver {\n return {\n name(node, param) {\n const name = this.name(`${node.operationId} ${param.in} ${param.name}`)\n return this.resolveName({ key: operationKey(node, 'param', 'name', param.in, param.name), name })\n },\n path(node) {\n const name = this.name(`${node.operationId} Path`)\n return this.resolveName({ key: operationKey(node, 'param', 'path'), name })\n },\n query(node) {\n const name = this.name(`${node.operationId} Query`)\n return this.resolveName({ key: operationKey(node, 'param', 'query'), name })\n },\n headers(node) {\n const name = this.name(`${node.operationId} Headers`)\n return this.resolveName({ key: operationKey(node, 'param', 'headers'), name })\n },\n cookies(node) {\n const name = this.name(`${node.operationId} Cookies`)\n return this.resolveName({ key: operationKey(node, 'param', 'cookies'), name })\n },\n }\n}\n\n/**\n * Builds the shared `response` namespace. Spread the result into\n * `createResolver` and add plugin-specific methods (`options`, `error`) next\n * to it.\n *\n * @example\n * ```ts\n * createResolver<PluginTs>({ response: { ...createOperationResponseResolver(), options(node) {...} }, ... })\n * ```\n */\nexport function createOperationResponseResolver(): OperationResponseResolver {\n return {\n status(node, statusCode) {\n const name = this.name(`${node.operationId} Status ${statusCode}`)\n return this.resolveName({ key: operationKey(node, 'response', 'status', statusCode), name })\n },\n headers(node, statusCode) {\n const name = this.name(`${node.operationId} Status ${statusCode} Headers`)\n return this.resolveName({ key: operationKey(node, 'response', 'headers', statusCode), name })\n },\n body(node) {\n const name = this.name(`${node.operationId} Body`)\n return this.resolveName({ key: operationKey(node, 'response', 'body'), name })\n },\n responses(node) {\n const name = this.name(`${node.operationId} Responses`)\n return this.resolveName({ key: operationKey(node, 'response', 'responses'), name })\n },\n response(node) {\n const name = this.name(`${node.operationId} Response`)\n return this.resolveName({ key: operationKey(node, 'response', 'response'), name })\n },\n }\n}\n\n/**\n * Builds a resolver `file` override whose base name runs every path segment\n * through `toFilePath`, casing the final segment with `caseLast`.\n *\n * @example\n * ```ts\n * createResolver<PluginTs>({ file: createCasedFile(pascalCase), ... })\n * ```\n */\nexport function createCasedFile(caseLast: (part: string) => string): ResolverFile {\n return {\n baseName({ name, extname }) {\n return this.memo(`file:${name}\\0${extname}`, (): ast.FileNode['baseName'] => `${toFilePath(name, caseLast)}${extname}`)\n },\n }\n}\n\ntype SchemaIndexContext = Pick<GeneratorContext, 'memo' | 'driver'>\n\n/**\n * Names of the schemas in a circular reference chain, computed once per build.\n */\nexport function getCircularNames(ctx: SchemaIndexContext): ReadonlySet<string> {\n return ctx.memo('circularNames:set', () => ast.graph.getCircularNames(ctx.driver.inputNode?.schemas ?? []))\n}\n\n/**\n * Names of the schemas whose type is `enum`, computed once per build.\n */\nexport function getEnumNames(ctx: SchemaIndexContext): ReadonlySet<string> {\n return ctx.memo(\n 'enumNames:set',\n () => new Set((ctx.driver.inputNode?.schemas ?? []).flatMap((schema) => (schema.type === 'enum' && schema.name ? [schema.name] : []))),\n )\n}\n\ndeclare global {\n namespace Kubb {\n interface MemoRegistry {\n operation: string\n file: ast.FileNode['baseName']\n operationTypeNames: Array<string>\n }\n }\n}\n","import { type ast, Diagnostics, type GeneratorContext, type Group, type Output } from '@kubb/kit'\nimport { pluginTsName, type ResolverTs } from '@kubb/plugin-ts'\nimport type { PluginZod, ResolverZod } from '@kubb/plugin-zod'\n\n// A type-only import: the query plugins bundle this file but do not depend on @kubb/plugin-zod.\nconst pluginZodName = 'plugin-zod' satisfies PluginZod['name']\n\ntype GeneratorDriver = GeneratorContext['driver']\n\n/**\n * The per-operation type names a generated client references: the grouped input, the per-status\n * responses record its `RequestResult` is keyed on, and the headers each response declares.\n */\nexport type OperationTypeNames = {\n response: {\n /**\n * Resolves the name of the operation's grouped `{ body, path, query, headers, cookies }` input type.\n */\n options(node: ast.OperationNode): string\n /**\n * Resolves the name of the operation's per-status responses record type.\n */\n responses(node: ast.OperationNode): string\n /**\n * Resolves the name of the type of the headers one response declares. Left out, results keep untyped headers.\n */\n headers?(node: ast.OperationNode, statusCode: ast.StatusCode): string\n }\n}\n\nfunction getResponseHeadersEntries({ node, types }: { node: ast.OperationNode; types: OperationTypeNames }): Array<[ast.StatusCode, string]> {\n const resolve = types.response.headers\n if (!resolve) return []\n return node.responses\n .filter((response) => response.headers?.length)\n .map((response) => [response.statusCode, resolve.call(types.response, node, response.statusCode)])\n}\n\n/**\n * The headers type argument of `RequestResult`, such as `{ '200': LoginUserStatus200Headers }`, or `null` when no response declares headers.\n */\nexport function buildResponseHeadersType({ node, types }: { node: ast.OperationNode; types: OperationTypeNames }): string | null {\n const entries = getResponseHeadersEntries({ node, types }).map(([statusCode, name]) => `'${statusCode}': ${name}`)\n return entries.length ? `{ ${entries.join('; ')} }` : null\n}\n\n/**\n * A runtime result type, such as `RequestResult`, in its `WithHeaders` form when `headers` is set.\n */\nexport function resultTypeName(name: string, headers: boolean): string {\n return headers ? `${name}WithHeaders` : name\n}\n\n/**\n * A runtime result type with its arguments, such as `RequestResultWithHeaders<Responses, Headers, ThrowOnError>`.\n */\nexport function buildResultTypeRef(name: string, responses: string, headers: string | null, rest: Array<string | null> = []): string {\n return `${resultTypeName(name, headers !== null)}<${[responses, headers, ...rest].filter(Boolean).join(', ')}>`\n}\n\n/**\n * The names of the headers types `buildResponseHeadersType` references, for the file's imports.\n */\nexport function getResponseHeadersTypeNames({ node, types }: { node: ast.OperationNode; types: OperationTypeNames }): Array<string> {\n return getResponseHeadersEntries({ node, types }).map(([, name]) => name)\n}\n\n/**\n * Where a generated client sources its operation types, plus the resolver and output the file\n * declaring them is resolved with.\n */\nexport type OperationTypeSource = OperationTypeNames & {\n /**\n * `plugin-ts` shaped resolver of the plugin supplying the names, also used to resolve the file they are exported from.\n */\n resolver: ResolverTs\n /**\n * The supplying plugin's own `output`, when it configured one.\n */\n output: Output | undefined\n /**\n * The supplying plugin's own `group`, when it configured one.\n */\n group: Group | undefined\n}\n\n/**\n * A `plugin-ts` shaped resolver whose operation type names point at the types `pluginZod({ inferred })`\n * exports next to each schema, so code written against `plugin-ts` names picks up the zod types.\n */\nfunction toZodTypeResolver(resolver: ResolverZod): ResolverTs {\n const type = (name: string) => resolver.schema.type(name)\n\n return {\n ...resolver,\n // Class methods, so a spread drops them. `file` reads private fields, and `memo` gets its own key\n // space so these type names never share an entry with the zod names.\n file: resolver.file.bind(resolver),\n memo: (key: string, compute: () => unknown) => resolver.memo(`zodTypes:${key}`, compute),\n param: {\n name: (node: ast.OperationNode, p: ast.ParameterNode) => type(resolver.param.name(node, p)),\n path: (node: ast.OperationNode, p: ast.ParameterNode) => type(resolver.param.path(node, p)),\n query: (node: ast.OperationNode, p: ast.ParameterNode) => type(resolver.param.query(node, p)),\n headers: (node: ast.OperationNode, p: ast.ParameterNode) => type(resolver.param.headers(node, p)),\n cookies: (node: ast.OperationNode, p: ast.ParameterNode) => type(resolver.param.cookies(node, p)),\n },\n response: {\n body: (node: ast.OperationNode) => type(resolver.response.body(node)),\n status: (node: ast.OperationNode, statusCode: ast.StatusCode) => type(resolver.response.status(node, statusCode)),\n response: (node: ast.OperationNode) => type(resolver.response.response(node)),\n responses: (node: ast.OperationNode) => type(resolver.response.responses(node)),\n headers: (node: ast.OperationNode, statusCode: ast.StatusCode) => type(resolver.response.headers(node, statusCode)),\n options: (node: ast.OperationNode) => resolver.response.options(node),\n },\n } as unknown as ResolverTs\n}\n\n/**\n * Picks the plugin generated clients, query hooks, and MCP handlers take their operation types from.\n *\n * `pluginZod({ inferred: 'codec' })` wins, so a codec param takes its domain value. Otherwise `plugin-ts`\n * wins when it is in the pipeline, and without it any `pluginZod({ inferred })`. Throws\n * `KUBB_MISSING_DEPENDENCY` for `pluginName` when neither is available.\n *\n * @example\n * ```ts\n * const types = resolveOperationTypes(ctx.driver, ctx.plugin.name)\n * types.response.options(node) // 'GetPetByIdOptions', or 'GetPetByIdOptionsSchemaType' from zod\n * ```\n */\nexport function resolveOperationTypes(driver: GeneratorDriver, pluginName: string): OperationTypeSource {\n return driver.memo(`operationTypes:${pluginName}`, () => {\n const pluginTs = driver.getPlugin(pluginTsName)\n const pluginZod = driver.getPlugin(pluginZodName)\n\n if (pluginTs && pluginZod?.options?.inferred !== 'codec') {\n const resolver = driver.getResolver(pluginTsName)\n return { response: resolver.response, resolver, output: pluginTs.options?.output, group: pluginTs.options?.group ?? undefined }\n }\n\n if (!pluginZod?.options?.inferred) {\n throw new Diagnostics.Error({\n code: Diagnostics.code.missingDependency,\n severity: 'error',\n message: `Plugin \"${pluginName}\" has no source for operation types.`,\n help: `Add \\`pluginTs()\\` before \"${pluginName}\", or add \\`pluginZod({ inferred: true })\\`.`,\n location: { kind: 'config' },\n plugin: pluginName,\n })\n }\n\n const resolver = toZodTypeResolver(driver.getResolver(pluginZodName))\n return { response: resolver.response, resolver, output: pluginZod.options.output, group: pluginZod.options.group ?? undefined }\n })\n}\n\ndeclare global {\n namespace Kubb {\n interface MemoRegistry {\n operationTypes: OperationTypeSource\n /**\n * Nests every key the zod-backed `ResolverTs` memoizes, so it holds each of their value types.\n */\n zodTypes: unknown\n }\n }\n}\n","import { isValidVarName, objectKey, toLiteral } from '@internals/utils'\nimport { ast, text } from '@kubb/kit'\n\n/**\n * A resolved security scheme. The runtime calls the configured `auth` resolver with this object and places the\n * returned token: `http` bearer/basic on `Authorization`, `apiKey` under `name` in the header/query/cookie, and\n * `oauth2`/`openIdConnect` as a bearer token.\n */\nexport type Auth = {\n type: 'http' | 'apiKey' | 'oauth2' | 'openIdConnect'\n scheme?: 'bearer' | 'basic'\n name?: string\n in?: 'header' | 'query' | 'cookie'\n scopes?: Array<string>\n flows?: Record<string, Omit<ast.OAuthFlow, 'scopes'>>\n metadataUrl?: string\n url?: string\n}\n\n/**\n * One entry of a generated call's `security` array: an OpenAPI security requirement, as one scheme or as the schemes it\n * needs together. The runtime sends the first requirement whose schemes all resolve a token.\n */\nexport type SecurityRequirement = OperationAuth | Array<OperationAuth>\n\n/**\n * A scheme of one operation. `ref` names its entry in `securitySchemes`, which the call then points at.\n */\ntype OperationAuth = Auth & { ref?: string }\n\n// The order the keys of an inline scheme are printed in.\nconst inlineAuthKeys = ['type', 'scheme', 'name', 'in', 'scopes', 'flows', 'metadataUrl', 'url'] as const\n\nfunction serializeScheme({ ref, ...auth }: OperationAuth): string {\n const scopes = auth.scopes?.length ? auth.scopes : undefined\n if (ref) {\n const schemeRef = isValidVarName(ref) ? `securitySchemes.${ref}` : `securitySchemes[${text.quote(ref)}]`\n return scopes ? `{ ...${schemeRef}, scopes: ${toLiteral(scopes)} }` : schemeRef\n }\n const entries = inlineAuthKeys.flatMap((key) => {\n const entryValue = key === 'scopes' ? scopes : auth[key]\n return entryValue ? [`${key}: ${toLiteral(entryValue)}`] : []\n })\n return `{ ${entries.join(', ')} }`\n}\n\nfunction serializeRequirement(requirement: SecurityRequirement): string {\n return Array.isArray(requirement) ? `[${requirement.map(serializeScheme).join(', ')}]` : serializeScheme(requirement)\n}\n\n/**\n * Maps an AST credential to the inline `Auth` object, or `null` for `mutualTLS`, which the runtime cannot send.\n * `http` schemes other than `basic` are treated as bearer. OAuth2 and OpenID Connect keep their URLs for the `auth` resolver.\n */\nexport function resolveCredential(credential: ast.AuthCredential): Auth | null {\n if (credential.type === 'apiKey') return { type: 'apiKey', name: credential.name, in: credential.in }\n if (credential.type === 'http') return { type: 'http', scheme: credential.scheme === 'basic' ? 'basic' : 'bearer' }\n if (credential.type === 'oauth2') {\n const flows = Object.fromEntries(Object.entries(credential.flows).map(([name, { scopes: _scopes, ...urls }]) => [name, urls]))\n return {\n type: 'oauth2',\n ...(Object.keys(flows).length ? { flows } : {}),\n ...(credential.metadataUrl ? { metadataUrl: credential.metadataUrl } : {}),\n }\n }\n if (credential.type === 'openIdConnect') return { type: 'openIdConnect', ...(credential.url ? { url: credential.url } : {}) }\n return null\n}\n\n/**\n * Derives the per-operation security metadata from `OperationNode.auth` and the document's `meta.auth` schemes. Each\n * requirement becomes one entry: its scheme, or an array of its schemes when it needs several together. A requirement\n * with a scheme the runtime cannot place or that is not declared is left out, since it can never be met, and so is a\n * repeated one. With `hoist`, each scheme carries its name as `ref`.\n *\n * @example\n * `getOperationSecurity({ auth: [[{ scheme: 'bearerAuth' }]], schemes: meta.auth })`\n * `// [{ type: 'http', scheme: 'bearer' }]`\n * @example\n * `// auth: [[{ scheme: 'api_key' }, { scheme: 'session' }]] gives [[{ type: 'apiKey', ... }, { type: 'apiKey', ... }]]`\n */\nexport function getOperationSecurity({\n auth,\n schemes,\n hoist,\n}: {\n auth: Array<ast.AuthRequirement> | undefined\n schemes: Array<ast.AuthScheme> | undefined\n hoist?: boolean\n}): Array<SecurityRequirement> | undefined {\n const security = ast.auth.getRequirements({ auth, schemes }).flatMap((requirement): Array<SecurityRequirement> => {\n const resolved = requirement.map(({ name, credential, scopes }) => {\n const entry = resolveCredential(credential)\n return entry && { ...entry, ...(scopes.length ? { scopes } : {}), ...(hoist ? { ref: name } : {}) }\n })\n if (!resolved.length || !resolved.every((entry): entry is OperationAuth => entry !== null)) return []\n return [resolved.length === 1 ? resolved[0]! : resolved]\n })\n\n return security.length ? security : undefined\n}\n\n/**\n * Serializes the per-operation security into the literal emitted on each generated call's `security`\n * field. The runtime `resolveAuth` helper walks it, calling the configured `auth` resolver per scheme.\n *\n * @example\n * `buildSecurityMetadata({ security: [{ type: 'http', scheme: 'bearer' }] }) // \"[{ type: 'http', scheme: 'bearer' }]\"`\n */\nexport function buildSecurityMetadata({ security }: { security?: Array<SecurityRequirement> }): string | null {\n if (!security?.length) return null\n return `[${security.map(serializeRequirement).join(', ')}]`\n}\n\n/**\n * The `securitySchemes` const of `.kubb/client.ts`: every scheme the runtime can place, by name, or `null` without one.\n */\nexport function buildSecuritySchemes(schemes: Array<ast.AuthScheme> | undefined): string | null {\n const entries = (schemes ?? []).flatMap(({ name, credential }) => {\n const auth = resolveCredential(credential)\n return auth ? [`${objectKey(name)}: ${serializeScheme(auth)}`] : []\n })\n if (!entries.length) return null\n return `/**\\n * The security schemes from the spec by name. A generated call sends one of them to the \\`auth\\` resolver.\\n */\\nexport const securitySchemes = { ${entries.join(', ')} } as const`\n}\n","import { ast, text } from '@kubb/kit'\nimport type { ResolverZod } from '@kubb/plugin-zod'\nimport type { ValidatorOptions } from '../types.ts'\n\n/**\n * Returns `true` when any direction of the validator uses zod (used for dependency checks).\n */\nexport function isValidatorEnabled(validator: ValidatorOptions | undefined): boolean {\n if (!validator) return false\n if (validator === 'zod') return true\n return Boolean(validator.request || validator.params || validator.response)\n}\n\n/**\n * Returns `'zod'` when request body parsing is enabled, `null` otherwise. The string shorthand\n * `'zod'` validates the response only, so it does not enable request parsing.\n */\nexport function resolveRequestValidator(validator: ValidatorOptions | undefined): 'zod' | null {\n if (!validator || validator === 'zod') return null\n return validator.request ?? null\n}\n\n/**\n * Returns `'zod'` when path, query, and header params parsing is enabled, `null` otherwise. Only the\n * object form `{ params: 'zod' }` enables it.\n */\nexport function resolveParamsValidator(validator: ValidatorOptions | undefined): 'zod' | null {\n if (!validator || validator === 'zod') return null\n return validator.params ?? null\n}\n\n/**\n * Returns `'zod'` when response parsing is enabled, `null` otherwise. The string shorthand `'zod'`\n * maps to response parsing.\n */\nexport function resolveResponseValidator(validator: ValidatorOptions | undefined): 'zod' | null {\n if (!validator) return null\n if (validator === 'zod') return 'zod'\n return validator.response ?? null\n}\n\n/**\n * Builds the `validator.error` map of a call, one plugin-zod `<operation>StatusNNNSchema` per non-2xx response with a\n * schema, such as `{ 404: getPetStatus404Schema, '5xx': getPetStatus5xxSchema }`. Returns `null` without one.\n */\nexport function buildZodErrorParse(node: ast.OperationNode, zodResolver: ResolverZod): { literal: string; names: Array<string> } | null {\n const entries = node.responses\n .filter((res) => !ast.http.status.isSuccess(res) && res.content?.some((entry) => entry.schema))\n .map((res) => ({ key: String(res.statusCode), name: zodResolver.response.status(node, res.statusCode) }))\n if (!entries.length) return null\n const literal = entries.map(({ key, name }) => `${/^\\d+$/.test(key) ? key : text.quote(key)}: ${name}`).join(', ')\n return { literal: `{ ${literal} }`, names: entries.map(({ name }) => name) }\n}\n","import { ast } from '@kubb/kit'\nimport type { ResolverZod } from '@kubb/plugin-zod'\nimport type { ValidatorOptions } from '../types.ts'\nimport { buildZodErrorParse, resolveParamsValidator, resolveRequestValidator, resolveResponseValidator } from './validatorOptions.ts'\n\n/**\n * The per-call validator references a generated function wires into its request config. Each hook is\n * the bare schema reference passed to the runtime's `validator.request` / `validator.path` /\n * `validator.query` / `validator.headers` / `validator.cookies` / `validator.response` / `validator.error` slot. `client.ts`\n * runs it through `validateStandardSchema`. The response validator only ever sees success (2xx) bodies.\n */\nexport type ValidatorHooks = {\n /**\n * Schema reference for the `validator.request` hook, or `null` when request validation is off.\n */\n request: string | null\n /**\n * Schema references for the `validator.path` / `query` / `headers` / `cookies` hooks (`headers` wrapped in\n * `toHeadersStandardSchema`), or `null` when params validation is off or the group is empty.\n */\n path: string | null\n query: string | null\n headers: string | null\n cookies: string | null\n /**\n * Schema reference for the `validator.response` hook, or `null` when response validation is off.\n */\n response: string | null\n /** Per-status schema map for `validator.error`, such as `{ 404: getPetStatus404Schema }`, or `null` when off or absent. */\n error: string | null\n /**\n * Zod schema names the generated file imports from the zod plugin output.\n */\n importedZodNames: Array<string>\n}\n\n/**\n * Builds the validator-hook references for one operation. Request body and params validation run before the send.\n * Response validation runs on the success body only. Returns `null` references when the matching\n * direction is disabled or the schema is absent.\n */\nexport function buildValidatorHooks({\n node,\n validator,\n zodResolver,\n}: {\n node: ast.OperationNode\n validator: ValidatorOptions | undefined\n zodResolver: ResolverZod | null | undefined\n}): ValidatorHooks {\n const hasRequestBody = Boolean(ast.http.requestBody.getSchema(node))\n const parsesResponse = zodResolver && resolveResponseValidator(validator) === 'zod'\n\n // Success responses validate with the success-only `<operation>ResponseSchema`; error bodies with the schema of their status.\n // plugin-zod emits that schema only for an operation with a response body schema.\n const hasResponseSchema = node.responses.some((res) => res.content?.some((entry) => entry.schema))\n const response = parsesResponse && hasResponseSchema ? zodResolver.response.response(node) || null : null\n const errorParse = parsesResponse ? buildZodErrorParse(node, zodResolver) : null\n const request = zodResolver && resolveRequestValidator(validator) === 'zod' && hasRequestBody ? zodResolver.response.body(node) || null : null\n\n const paramGroups = ast.http.groupParameters(node)\n const resolveParamsName = (kind: 'path' | 'query' | 'headers' | 'cookies', params: Array<ast.ParameterNode>): string | null =>\n zodResolver && resolveParamsValidator(validator) === 'zod' && params.length > 0 ? zodResolver.param[kind](node, params[0]!) : null\n const path = resolveParamsName('path', paramGroups.path)\n const query = resolveParamsName('query', paramGroups.query)\n const headers = resolveParamsName('headers', paramGroups.header)\n const cookies = resolveParamsName('cookies', paramGroups.cookie)\n\n // Order is output: the generated file imports the response schema, then the error schemas, then the request body and params schemas.\n const importedZodNames = [response, ...(errorParse?.names ?? []), request, path, query, headers, cookies].filter((name): name is string => Boolean(name))\n\n const headersValidator = headers ? `toHeadersStandardSchema(${headers}, ${headers}.shape)` : null\n\n return { request, path, query, headers: headersValidator, cookies, response, error: errorParse?.literal ?? null, importedZodNames }\n}\n\n/**\n * Prints the `validator: { … }` entry of a call config from the hooks named in `keys`, or `null` when none is set.\n * The entry spreads `config.validator` last, so a per-call hook overrides the generated one for its key only.\n */\nexport function buildValidatorLiteral(hooks: ValidatorHooks | null, keys: ReadonlyArray<keyof Omit<ValidatorHooks, 'importedZodNames'>>): string | null {\n const entries = keys.flatMap((key) => (hooks?.[key] ? [`${key}: ${hooks[key]}`] : []))\n return entries.length ? `validator: { ${entries.join(', ')}, ...config.validator }` : null\n}\n","import { getResponseHeadersTypeNames, type OperationTypeNames, type OperationTypeSource } from '@internals/client'\nimport { operationKey, resolveOperationFile } from '@internals/shared'\nimport { ast, type Generator } from '@kubb/kit'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport type { ContractClientFactory } from '../types.ts'\nimport { getOperationSecurity, type SecurityRequirement } from './security.ts'\nimport { buildValidatorHooks, type ValidatorHooks } from './validator.ts'\nimport { isValidatorEnabled } from './validatorOptions.ts'\n\nexport type GeneratorContext = Parameters<NonNullable<Generator<ContractClientFactory>['operations']>>[1]\n\nexport type OperationData = {\n node: ast.HttpOperationNode\n name: string\n types: OperationTypeNames\n typeFile: ast.FileNode\n /**\n * `null` unless `validator` turns a direction on.\n */\n zodFile: ast.FileNode | null\n validatorHooks: ValidatorHooks\n /**\n * The names of the headers types the result references.\n */\n headerTypeNames: Array<string>\n security?: Array<SecurityRequirement>\n baseURL?: string\n}\n\n/**\n * Resolves what the function and SDK generators both print for one operation: its name, the files its types and zod\n * schemas come from, and its validator hooks, security, base URL and response headers types.\n */\nexport function resolveOperationData({ node, ctx, types }: { node: ast.HttpOperationNode; ctx: GeneratorContext; types: OperationTypeSource }): OperationData {\n const { driver, resolver, root } = ctx\n const { output, validator, importPath } = ctx.options\n const pluginZod = isValidatorEnabled(validator) ? driver.getPlugin(pluginZodName) : null\n const zodResolver = pluginZod ? driver.getResolver(pluginZodName) : null\n\n return {\n node,\n name: resolver.resolveName({ key: operationKey(node), name: resolver.name(node.operationId) }),\n types,\n typeFile: resolveOperationFile({ ctx, node, resolver: types.resolver, root, output: types.output ?? output, group: types.group }),\n zodFile:\n zodResolver && pluginZod?.options\n ? resolveOperationFile({\n ctx,\n node,\n resolver: zodResolver,\n root,\n output: pluginZod.options.output ?? output,\n group: pluginZod.options.group ?? undefined,\n })\n : null,\n validatorHooks: buildValidatorHooks({ node, validator, zodResolver }),\n headerTypeNames: getResponseHeadersTypeNames({ node, types }),\n // The fetch and axios clients write `securitySchemes` into `.kubb/client.ts`. A custom client module has none.\n security: getOperationSecurity({ auth: node.auth, schemes: ctx.meta.auth, hoist: importPath === undefined }),\n baseURL: ast.http.getBaseURL(\n ast.server.get({ servers: node.servers, index: (ctx.adapter.options as { server?: { index?: number } } | undefined)?.server?.index }),\n ),\n }\n}\n","import type { ast } from '@kubb/kit'\nimport { buildResponseHeadersType, buildResultTypeRef, type OperationTypeNames } from '@internals/client'\nimport type { ReturnTypeOption } from '../types.ts'\n\n/**\n * Builds the `RequestResult` type arguments of one operation: responses, `ThrowOnError` and the response headers, when a response declares any.\n *\n * @example\n * `buildRequestResultGenerics({ node, types }) // \"LoginUserResponses, ThrowOnError, { '200': LoginUserStatus200Headers }\"`\n */\nexport function buildRequestResultGenerics({ node, types }: { node: ast.OperationNode; types: OperationTypeNames }): string {\n return [types.response.responses(node), 'ThrowOnError', buildResponseHeadersType({ node, types })].filter(Boolean).join(', ')\n}\n\n/**\n * Builds the full return type an operation's function signature uses: `Unwrappable<RequestResult>`\n * for the default `returnType: 'full'`, already a promise so no further wrapping is needed, a plain\n * `Promise<RequestResult>` for the internal `'plain'` shape, or a\n * `Promise` of the runtime's `UnwrappedResult` when `returnType: 'data'` narrows a resolved call\n * down to the bare success body.\n *\n * @example\n * `buildResultType({ node, types, returnType: 'data' }) // 'Promise<UnwrappedResult<AddPetResponses, ThrowOnError>>'`\n */\nexport function buildResultType({ node, types, returnType }: { node: ast.OperationNode; types: OperationTypeNames; returnType: ReturnTypeOption }): string {\n const name = returnType === 'data' ? 'UnwrappedResult' : 'RequestResult'\n const result = buildResultTypeRef(name, types.response.responses(node), buildResponseHeadersType({ node, types }), ['ThrowOnError'])\n return returnType === 'full' ? `Unwrappable<${result}>` : `Promise<${result}>`\n}\n","import { getEventStream } from '@internals/shared'\nimport type { ast } from '@kubb/kit'\nimport { buildResponseHeadersType, buildResultTypeRef, resultTypeName, type OperationTypeNames } from '@internals/client'\nimport type { ReturnTypeOption } from '../types.ts'\nimport { buildRequestResultGenerics } from './generics.ts'\n\n/**\n * Builds the return statement of a generated operation function. The client call takes the responses record and\n * `ThrowOnError` as type arguments, so its result is already the operation's `RequestResult` and needs no cast. With the\n * default `returnType: 'full'` it is wrapped in `withUnwrap`, so the caller can `await` it or call `.unwrap()`. With\n * `returnType: 'data'` it goes through `unwrapResult`, which keeps the success body when the call throws on errors.\n * With `returnType: 'plain'` it is returned as is.\n *\n * @example\n * `return withUnwrap(apiClient<AddPetResponses, ThrowOnError>({ method: 'POST', url: '/pet', ...config }))`\n * @example\n * `return unwrapResult(apiClient<AddPetResponses, ThrowOnError>({ ... }), resolveThrowOnError(config.throwOnError, true))`\n * @example\n * `return apiClient<AddPetResponses, ThrowOnError>({ method: 'POST', url: '/pet', ...config })`\n */\nexport function buildReturnStatement({\n node,\n types,\n callConfig,\n returnType,\n throwOnErrorDefault,\n}: {\n node: ast.OperationNode\n types: OperationTypeNames\n callConfig: string\n returnType: ReturnTypeOption\n throwOnErrorDefault: boolean\n}): string {\n const call = `apiClient<${buildRequestResultGenerics({ node, types })}>(${callConfig})`\n if (returnType === 'data') return `return unwrapResult(${call}, resolveThrowOnError(config.throwOnError, ${throwOnErrorDefault}))`\n if (returnType === 'plain') return `return ${call}`\n return `return withUnwrap(${call})`\n}\n\n/**\n * Builds the return type and statement of a streamed operation, which calls `apiClient.stream`. The item type is\n * `TypedEvent<...>` when each event declares its own `event` and `data`, the success type itself for JSON Lines, and\n * otherwise the default, `ServerSentEvent` around the payload, which needs no type argument.\n */\nexport function buildEventStreamReturn({\n node,\n types,\n callConfig,\n returnType,\n throwOnErrorDefault,\n}: {\n node: ast.HttpOperationNode\n types: OperationTypeNames\n callConfig: string\n returnType: ReturnTypeOption\n throwOnErrorDefault: boolean\n}): {\n returnType: string\n statement: string\n} {\n const shape = getEventStream(node) ?? 'data'\n const responses = types.response.responses(node)\n const headers = buildResponseHeadersType({ node, types })\n const success = `SuccessOf<${responses}>`\n const item = { event: `TypedEvent<${success}>`, data: null, line: success }[shape]\n // The headers come after the item in `client.stream`, so a typed-headers call spells out the default item.\n const callItem = item ?? (headers ? `ServerSentEvent<${success}>` : null)\n const call = `apiClient.stream<${[responses, 'ThrowOnError', callItem, headers].filter(Boolean).join(', ')}>(${callConfig})`\n const result = (name: string) => buildResultTypeRef(name, responses, headers, ['ThrowOnError', item])\n if (returnType === 'plain') return { returnType: `Promise<${result('StreamResult')}>`, statement: `return ${call}` }\n if (returnType === 'data') {\n return {\n returnType: `Promise<${result('UnwrappedStreamResult')}>`,\n statement: `return unwrapResult(${call}, resolveThrowOnError(config.throwOnError, ${throwOnErrorDefault}))`,\n }\n }\n return { returnType: `Unwrappable<${result('StreamResult')}>`, statement: `return withUnwrap(${call})` }\n}\n\n/**\n * The stream types an operation file imports from the client for one streamed operation: the result and options types\n * for `returnType`, their `WithHeaders` form when the response declares headers, and `SuccessOf` with `TypedEvent` or\n * `ServerSentEvent` for an item type the call spells out.\n */\nexport function buildEventStreamImports({\n node,\n types,\n returnType,\n}: {\n node: ast.OperationNode\n types: OperationTypeNames\n returnType: ReturnTypeOption\n}): Array<string> {\n const shape = getEventStream(node) ?? 'data'\n const headers = buildResponseHeadersType({ node, types }) !== null\n const result = {\n plain: ['Options', 'StreamResult'],\n full: ['StreamOptions', 'Unwrappable', 'StreamResult'],\n data: ['StreamOptions', 'UnwrappedStreamResult'],\n }[returnType].map((name) => (name.endsWith('Result') ? resultTypeName(name, headers) : name))\n const item = { event: ['SuccessOf', 'TypedEvent'], data: headers ? ['SuccessOf', 'ServerSentEvent'] : [], line: ['SuccessOf'] }[shape]\n return [...result, ...item]\n}\n","import { getContentTypeInfo, getResponseContentTypeInfo, hasEventStreamContent, isEventStream } from '@internals/shared'\nimport { ast, text } from '@kubb/kit'\n\n/**\n * Builds the `contentType` entry baked into the call config. It holds the request default when the operation has a body\n * and `response` set to the streamed media type when it streams items, or `text/event-stream` when it offers events next to\n * another type, and is `null` with neither.\n *\n * `merge` is `true` when the generated function must destructure `contentType` from `options` and merge it over the\n * baked defaults, because the caller can also pick a response content type or a stream must keep its `Accept`.\n */\nexport function buildContentType({ node }: { node: ast.HttpOperationNode }): { literal: string | null; merge: boolean } {\n const { defaultContentType } = getContentTypeInfo(node)\n const hasRequestBody = Boolean(ast.http.requestBody.getSchema(node))\n // The first declared type is the default; the caller overrides it on `contentType`.\n const requestContentType = hasRequestBody ? defaultContentType : null\n // A stream asks for its own media type, and a response that offers events next to JSON asks for the events, so a client whose\n // default `Accept` prefers JSON, such as axios, gets the stream. The caller picks another type with `contentType.response`.\n const streamType = isEventStream(node) ? ast.mediaType.getBase(getResponseContentTypeInfo(node).defaultContentType) : null\n const response = streamType || hasEventStreamContent(node) ? `response: ${text.quote(streamType ?? 'text/event-stream')}` : null\n\n if (!requestContentType) return { literal: response && `contentType: { ${response} }`, merge: false }\n\n // When the caller can also pick a response content type, or a stream must keep its `Accept`, a partial `contentType` would\n // replace the baked default through `...config`, so merge the caller's choice over it instead.\n const merge = Boolean(response) || getResponseContentTypeInfo(node).isMultipleContentTypes\n const defaults = [`request: ${text.quote(requestContentType)}`, response].filter(Boolean).join(', ')\n\n return {\n merge,\n literal: merge\n ? `contentType: { ${defaults}, ...(typeof contentType === 'string' ? { request: contentType } : contentType) }`\n : `contentType: { ${defaults} }`,\n }\n}\n","import { isValidVarName } from '@internals/utils'\nimport { ast, text } from '@kubb/kit'\n\ntype StyledLocation = 'path' | 'query' | 'header' | 'cookie'\n\n/**\n * Renders a parameter name as an object-literal key, quoted when it is not a bare identifier. Every\n * location keeps the spec name: the runtime looks path styles up by the `{name}` placeholder in the\n * URL, and the other locations by the key it serializes.\n */\nfunction toKey(name: string): string {\n return isValidVarName(name) ? name : JSON.stringify(name)\n}\n\n/**\n * Serializes one parameter's metadata into a `{ style, explode, allowReserved, contentType }`\n * literal, or `null` when the parameter carries none. Path and query carry the serialization\n * `style`. Header and cookie have a fixed style (`simple` and `form`), so they emit only `explode`,\n * plus `style: 'cookie'` when a cookie parameter sets the OpenAPI 3.2 `cookie` style.\n * `allowReserved` only applies to query parameters, and `contentType` to every location except path.\n */\nfunction serializeParameter(parameter: ast.ParameterNode): string | null {\n const parts = [\n (parameter.in === 'path' || parameter.in === 'query') && parameter.style && `style: '${parameter.style}'`,\n parameter.in === 'cookie' && parameter.style === 'cookie' && `style: 'cookie'`,\n parameter.explode !== undefined && `explode: ${parameter.explode}`,\n parameter.in === 'query' && parameter.allowReserved !== undefined && `allowReserved: ${parameter.allowReserved}`,\n parameter.in !== 'path' && parameter.contentType && `contentType: ${text.quote(parameter.contentType)}`,\n parameter.in === 'querystring' && 'querystring: true',\n ].filter(Boolean)\n return parts.length > 0 ? `{ ${parts.join(', ')} }` : null\n}\n\n/**\n * Whether a query parameter of the operation has a style entry, so the call needs the styled query serializer.\n */\nexport function hasQueryStyles(node: ast.OperationNode): boolean {\n return ast.http.isOperation(node) && ast.http.groupParameters(node).query.some((parameter) => serializeParameter(parameter) !== null)\n}\n\n/**\n * Serializes the `encoding` of the request body's default content type into `property: { ... }`\n * entries, empty when it carries none. Only an operation with a single request content type\n * emits it, because the runtime applies `styles.body` to whichever type the caller selects.\n */\nfunction serializeBodyEncoding(node: ast.HttpOperationNode): Array<string> {\n const content = node.requestBody?.content\n return Object.entries(content?.length === 1 ? (content[0]?.encoding ?? {}) : {}).map(([property, { contentType, style, explode, allowReserved }]) => {\n const parts = [\n style && `style: ${JSON.stringify(style)}`,\n explode !== undefined && `explode: ${explode}`,\n allowReserved !== undefined && `allowReserved: ${allowReserved}`,\n contentType && `contentType: ${JSON.stringify(contentType)}`,\n ].filter(Boolean)\n return `${isValidVarName(property) ? property : JSON.stringify(property)}: { ${parts.join(', ')} }`\n })\n}\n\n/**\n * Builds the per-operation `styles` literal from the operation's parameters, grouped by location.\n * Entries are keyed by the spec name of the parameter.\n * Only parameters whose source defines `style`, `explode`, `allowReserved`, or `contentType` are\n * emitted, so calls without serialization metadata keep the runtime defaults and existing output\n * is unchanged. A form request body adds a `body` group keyed by property name from its `encoding`.\n * Returns `null` when nothing carries metadata.\n *\n * With `merge`, the literal spreads `config.styles` per parameter, so a per-call entry overrides the generated one for\n * that parameter and leaves the others in place.\n *\n * @example\n * ```ts\n * // a path param with { style: 'matrix', explode: true } and a query param with { explode: false }\n * buildStyles({ node }) // \"{ path: { id: { style: 'matrix', explode: true } }, query: { tags: { explode: false } } }\"\n * ```\n */\nexport function buildStyles({ node, merge }: { node: ast.OperationNode; merge?: boolean }): string | null {\n if (!ast.http.isOperation(node)) return null\n\n const groups: Record<StyledLocation | 'body', Array<string>> = { path: [], query: [], header: [], cookie: [], body: serializeBodyEncoding(node) }\n\n for (const [location, parameters] of Object.entries(ast.http.groupParameters(node)) as Array<[StyledLocation, Array<ast.ParameterNode>]>) {\n for (const parameter of parameters) {\n const literal = serializeParameter(parameter)\n if (literal) groups[location].push(`${toKey(parameter.name)}: ${literal}`)\n }\n }\n\n const entries = Object.entries(groups)\n .filter(([, items]) => items.length > 0)\n .map(([location, items]) => `${location}: { ${(merge ? [...items, `...config.styles?.${location}`] : items).join(', ')} }`)\n\n if (entries.length === 0) return null\n return `{ ${(merge ? ['...config.styles', ...entries] : entries).join(', ')} }`\n}\n","import { toLiteral } from '@internals/utils'\nimport { getEventStream, hasTextEventData } from '@internals/shared'\n\nimport { ast, text } from '@kubb/kit'\nimport type { ReturnTypeOption } from '../types.ts'\nimport { buildContentType } from './contentType.ts'\nimport { buildSecurityMetadata, type SecurityRequirement } from './security.ts'\nimport { buildStyles } from './styles.ts'\nimport { buildValidatorLiteral, type ValidatorHooks } from './validator.ts'\n\n/**\n * `parseAs: 'blob'` when every success content type is binary, so a download is a `Blob` whatever its media type, and\n * also when the server sends no `Content-Type`. Any other body is decoded by its media type at runtime.\n */\nfunction buildParseAsLiteral(content: Array<ast.ContentNode>): string | null {\n return content.length > 0 && content.every((entry) => entry.schema?.type === 'blob') ? `parseAs: 'blob'` : null\n}\n\n/**\n * Builds the call config literal a generated operation forwards to the client, shared by the standalone\n * functions and the SDK methods. The operation's own `baseURL` comes before the `...config` spread, so a per-call one wins. The\n * `validator` and `throwOnError` entries come after it, so a per-call `validator` is merged per key with the generated one instead\n * of replacing it. `styles` is merged the same way, per parameter, unless `returnType` is `'plain'`.\n *\n * `mergeContentType` is `true` when the caller must destructure `contentType` from `options`, and\n * `eventStream` is `true` when the operation streams `text/event-stream` or JSON Lines. A Server-Sent Events call\n * carries its `eventShape`, which tells the runtime what the `response` validator checks on each event, and `rawData` when\n * the document types each event's `data` as a string, so the runtime keeps it as text.\n */\nexport function buildCallConfig({\n node,\n validatorHooks,\n security,\n baseURL,\n throwOnErrorDefault,\n returnType,\n}: {\n node: ast.HttpOperationNode\n validatorHooks: ValidatorHooks | null\n security?: Array<SecurityRequirement>\n baseURL?: string\n throwOnErrorDefault: boolean\n returnType: ReturnTypeOption\n}): { callConfig: string; mergeContentType: boolean; eventStream: boolean } {\n const stream = getEventStream(node)\n const content = ast.http.responses.findPrimary(node)?.content ?? []\n const securityLiteral = buildSecurityMetadata({ security })\n // A `'plain'` client is the user's own, which may type `styles` as `unknown`, so it keeps the generated styles as a default.\n const ownRuntime = returnType !== 'plain'\n const stylesLiteral = buildStyles({ node, merge: ownRuntime })\n const styles = stylesLiteral ? `styles: ${stylesLiteral}` : null\n const validatorLiteral = buildValidatorLiteral(validatorHooks, ['request', 'path', 'query', 'headers', 'cookies', 'response', 'error'])\n const { literal: contentTypeLiteral, merge: mergeContentType } = buildContentType({ node })\n // The runtime's call types `throwOnError` as the operation's `ThrowOnError`, which the shared helper keeps. A `'plain'`\n // client takes a boolean.\n const throwOnError = ownRuntime\n ? `throwOnError: resolveThrowOnError(config.throwOnError, ${throwOnErrorDefault})`\n : `throwOnError: config.throwOnError ?? ${throwOnErrorDefault}`\n\n const rawData = hasTextEventData(node)\n const callConfig = `{ ${[\n `method: ${text.quote(node.method.toUpperCase())}`,\n `url: ${text.quote(node.path)}`,\n baseURL ? `baseURL: ${JSON.stringify(baseURL)}` : null,\n securityLiteral ? `security: ${securityLiteral}` : null,\n ownRuntime ? null : styles,\n contentTypeLiteral,\n buildParseAsLiteral(content),\n stream === 'event' || stream === 'data' ? `eventShape: '${stream}'` : null,\n rawData ? `rawData: ${toLiteral(rawData)}` : null,\n '...config',\n ownRuntime ? styles : null,\n validatorLiteral,\n throwOnError,\n ]\n .filter(Boolean)\n .join(', ')} }`\n\n return { callConfig, mergeContentType, eventStream: stream !== null }\n}\n","import type { ast } from '@kubb/kit'\nimport { getRequestGroupOptionality } from '@internals/shared'\nimport { createFunctionParameter, createFunctionParameters, functionPrinter } from '@kubb/plugin-ts'\nimport type { OperationTypeNames } from '@internals/client'\nimport type { ReturnTypeOption } from '../types.ts'\nimport { buildResultType } from './generics.ts'\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\n\n/**\n * The pieces of a generated operation function's grouped-options signature.\n */\nexport type GroupedOptionsSignature = {\n /**\n * The single function parameter: `options: Options<<Name>Options, ThrowOnError>`, or `StreamOptions<...>`\n * for a `text/event-stream` operation.\n */\n paramsSignature: string\n /**\n * The function return type: `Unwrappable<RequestResult<<Name>Responses, ThrowOnError>>`.\n */\n returnType: string\n /**\n * The function generics. One per-call `ThrowOnError` flag, defaulting to the plugin setting.\n */\n generics: Array<string>\n}\n\n/**\n * Builds the grouped-options signature for one operation: a single `options` object whose `TData`\n * is the `<Name>Options` type, and a `RequestResult` return type keyed to the per-status responses\n * record. There are no positional arguments.\n *\n * The generated file imports `<Name>Options` and `<Name>Responses` and uses them directly, so no\n * per-operation input type has to be emitted. Both names come from `types`, which is `plugin-ts` or\n * `plugin-zod`'s inferred types (see `resolveOperationTypes`).\n */\nexport function buildGroupedOptionsSignature({\n node,\n types,\n returnType,\n throwOnErrorDefault,\n eventStream = false,\n}: {\n node: ast.OperationNode\n types: OperationTypeNames\n returnType: ReturnTypeOption\n throwOnErrorDefault: boolean\n /**\n * Adds the per-call stream options to the `options` type of a `text/event-stream` operation, except for a plain custom\n * client, whose own `client.stream` returns a `StreamResult` and types its config itself.\n */\n eventStream?: boolean\n}): GroupedOptionsSignature {\n const optionsName = types.response.options(node)\n const optionsType = `${eventStream && returnType !== 'plain' ? 'StreamOptions' : 'Options'}<${optionsName}, ThrowOnError>`\n const { isOptional } = getRequestGroupOptionality(node)\n\n const paramsSignature =\n declarationPrinter.print(\n createFunctionParameters({\n params: [createFunctionParameter({ name: 'options', type: optionsType, ...(isOptional ? { default: '{}' } : {}) })],\n }),\n ) ?? ''\n\n return {\n paramsSignature,\n returnType: buildResultType({ node, types, returnType }),\n generics: [`ThrowOnError extends boolean = ${throwOnErrorDefault}`],\n }\n}\n","import type { ast } from '@kubb/kit'\nimport type { OperationTypeNames } from '@internals/client'\nimport type { ReturnTypeOption } from '../types.ts'\nimport { buildCallConfig } from './callConfig.ts'\nimport { buildEventStreamReturn, buildReturnStatement } from './returnStatement.ts'\nimport type { SecurityRequirement } from './security.ts'\nimport { buildGroupedOptionsSignature } from './signature.ts'\nimport type { ValidatorHooks } from './validator.ts'\n\n/**\n * The pieces of a generated operation: its generics, `options` parameter, return type, return statement, and whether the\n * body destructures `contentType` from `options`. Shared by the standalone functions and the SDK methods, so a\n * streamed operation is wired to `apiClient.stream` in one place.\n */\nexport function buildOperationBody({\n node,\n types,\n validatorHooks,\n security,\n baseURL,\n returnType,\n throwOnErrorDefault,\n}: {\n node: ast.HttpOperationNode\n types: OperationTypeNames\n validatorHooks: ValidatorHooks | null\n security?: Array<SecurityRequirement>\n baseURL?: string\n returnType: ReturnTypeOption\n throwOnErrorDefault: boolean\n}): { generics: Array<string>; paramsSignature: string; returnType: string; statement: string; mergeContentType: boolean } {\n const { callConfig, mergeContentType, eventStream } = buildCallConfig({ node, validatorHooks, security, baseURL, throwOnErrorDefault, returnType })\n const signature = buildGroupedOptionsSignature({ node, types, returnType, throwOnErrorDefault, eventStream })\n const stream = eventStream ? buildEventStreamReturn({ node, types, callConfig, returnType, throwOnErrorDefault }) : null\n\n return {\n generics: signature.generics,\n paramsSignature: signature.paramsSignature,\n returnType: stream?.returnType ?? signature.returnType,\n statement: stream?.statement ?? buildReturnStatement({ node, types, callConfig, returnType, throwOnErrorDefault }),\n mergeContentType,\n }\n}\n","import type { OperationTypeNames } from '@internals/client'\nimport { buildOperationComments } from '@internals/shared'\nimport { ast } from '@kubb/kit'\nimport { File, Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx'\nimport { buildOperationBody } from '../builders/operationBody.ts'\nimport type { SecurityRequirement } from '../builders/security.ts'\nimport type { ValidatorHooks } from '../builders/validator.ts'\nimport type { ReturnTypeOption } from '../types.ts'\n\ntype Props = {\n /**\n * The generated function name.\n */\n name: string\n /**\n * The operation being generated.\n */\n node: ast.OperationNode\n /**\n * The operation type names the signature references, from `plugin-ts` or `plugin-zod`'s inferred\n * types.\n */\n types: OperationTypeNames\n /**\n * The operation's validator hooks, built once by the generator and shared with its zod imports.\n */\n validatorHooks: ValidatorHooks | null\n /**\n * Shape of the value the generated function resolves to.\n */\n returnType: ReturnTypeOption\n throwOnErrorDefault: boolean\n /**\n * Per-operation security, resolved from the spec into inline security requirements and serialized onto the\n * call config's `security` field for the runtime `auth` resolver to consume.\n */\n security?: Array<SecurityRequirement>\n /** The operation's own server URL from a path-level or operation-level `servers` entry, emitted as the call's default `baseURL`. */\n baseURL?: string\n}\n\n/**\n * Renders one client operation: the grouped `<Name>Request` type and the function that forwards a\n * single `options` object to the resolved client and returns the `Unwrappable<RequestResult>`. The\n * type, signature, and call config are built with the AST factory, and only the jsx-renderer emits\n * the source.\n */\nexport function Operation({ name, node, types, validatorHooks, returnType, throwOnErrorDefault, security, baseURL }: Props): KubbReactNode {\n if (!ast.http.isOperation(node)) return null\n\n const body = buildOperationBody({ node, types, validatorHooks, security, baseURL, returnType, throwOnErrorDefault })\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function\n name={name}\n export\n generics={body.generics}\n params={body.paramsSignature}\n returnType={body.returnType}\n JSDoc={{ comments: buildOperationComments(node, { splitLines: true }) }}\n >\n {body.mergeContentType\n ? 'const { client: apiClient = client, contentType, ...config } = options'\n : 'const { client: apiClient = client, ...config } = options'}\n <br />\n {body.statement}\n </Function>\n </File.Source>\n )\n}\n","import { objectKey } from '@internals/utils'\nimport path from 'node:path'\nimport { getFormContentTypes, hasEventStreamContent, hasStreamVariant, isEventStream } from '@internals/shared'\n\nimport { ast, text } from '@kubb/kit'\nimport { File } from '@kubb/renderer-jsx'\nimport { buildSecuritySchemes } from '../builders/security.ts'\nimport { hasQueryStyles } from '../builders/styles.ts'\nimport type { KubbReactNode } from '@kubb/renderer-jsx'\n\nfunction buildServersExport(servers: Array<ast.InputServer> | undefined): string | null {\n const named = ast.server.groupByName(servers)\n if (!named.size) return null\n const entries = [...named].map(([name, { url }]) => `${objectKey(name)}: ${text.quote(url)}`)\n return `/**\\n * The servers from the spec by name, for \\`baseURL\\`.\\n */\\nexport const servers = { ${entries.join(', ')} } as const`\n}\n\n// The form media types, each in its own file under `templates/mediaTypes/`, so a document ships only the ones it uses.\nconst formMediaTypes = {\n 'multipart/form-data': { file: 'mediaTypes/formData', name: 'multipartFormData' },\n 'application/x-www-form-urlencoded': { file: 'mediaTypes/urlencoded', name: 'urlencoded' },\n} as const\n\n/**\n * Writes the runtime a document needs into `.kubb/`: the optional media type, serializer and `sse.ts` files, and a\n * `config.ts` that imports them, which `client.ts` passes to `setConfig`. The footer of `client.ts` gets the named\n * `servers` and `securitySchemes` and the `sse.ts` re-export. `templates` is the folder the runtime is copied from, set\n * by the plugins that ship it, so a custom client from `@kubb/plugin-client` gets none of this.\n */\nexport function ClientRuntime({\n nodes,\n root,\n templates,\n baseURL,\n servers,\n auth,\n}: {\n nodes: Array<ast.OperationNode>\n root: string\n templates?: string\n baseURL?: string\n servers?: Array<ast.InputServer>\n auth?: Array<ast.AuthScheme>\n}): KubbReactNode {\n if (!templates) return null\n const hasParameter = (match: (parameter: ast.ParameterNode) => boolean) => nodes.some((node) => node.parameters.some(match))\n const streams = nodes.some((node) => hasEventStreamContent(node) || isEventStream(node) || hasStreamVariant(node))\n const forms = [...new Set(nodes.flatMap(getFormContentTypes))].sort().map((contentType) => ({ contentType, ...formMediaTypes[contentType] }))\n const queryStyles = nodes.some(hasQueryStyles)\n\n const serializers = [\n queryStyles\n ? { key: 'query', file: 'serializers/queryStyles', name: 'serializeStyledQuery' }\n : { key: 'query', file: 'serializers/query', name: 'serializeQuery' },\n hasParameter((parameter) => parameter.in === 'path' && (parameter.style === 'label' || parameter.style === 'matrix'))\n ? { key: 'path', file: 'serializers/pathStyles', name: 'serializeStyledPath' }\n : { key: 'path', file: 'serializers/path', name: 'serializePath' },\n hasParameter((parameter) => parameter.in === 'header') ? { key: 'header', file: 'serializers/headers', name: 'serializeHeaders' } : null,\n hasParameter((parameter) => parameter.in === 'cookie') ? { key: 'cookie', file: 'serializers/cookies', name: 'serializeCookies' } : null,\n ].filter((serializer) => serializer !== null)\n const imports = [...forms, ...(streams ? [{ file: 'sse', name: 'streamMediaTypes' }] : []), ...serializers]\n // `pathStyles.ts` builds on `path.ts`, and the urlencoded media type on `queryStyles.ts`.\n const files = new Set([\n ...imports.map(({ file }) => file),\n 'serializers/path',\n ...(forms.some(({ name }) => name === 'urlencoded') ? ['serializers/queryStyles'] : []),\n ])\n\n const baseURLExpression = baseURL ? (baseURL.includes('${') ? `\\`${baseURL.replaceAll('`', '\\\\`')}\\`` : JSON.stringify(baseURL)) : undefined\n const mediaTypes = [...forms.map(({ contentType, name }) => `'${contentType}': ${name}`), streams ? '...streamMediaTypes' : null].filter(Boolean)\n const config = [\n baseURLExpression ? `baseURL: ${baseURLExpression}` : null,\n mediaTypes.length ? `mediaTypes: { ${mediaTypes.join(', ')} }` : null,\n `serializer: { ${serializers.map(({ key, name }) => `${key}: ${name}`).join(', ')} }`,\n ].filter(Boolean)\n const footer = [buildServersExport(servers), buildSecuritySchemes(auth), streams ? `export * from './sse.ts'` : null].filter(Boolean).join('\\n')\n const configPath = path.resolve(root, '.kubb/config.ts')\n const runtimePath = (file: string) => path.resolve(root, '.kubb', `${file}.ts`)\n\n return (\n <>\n {[...files].map((file) => (\n <File key={file} baseName={`${path.basename(file)}.ts`} path={runtimePath(file)} copy={path.join(templates, `${file}.ts`)} />\n ))}\n <File baseName=\"config.ts\" path={configPath}>\n {imports.map(({ file, name }) => (\n <File.Import key={name} name={[name]} root={configPath} path={runtimePath(file)} />\n ))}\n <File.Import name={['ClientConfig']} root={configPath} path={runtimePath('core')} isTypeOnly />\n <File.Source name=\"defaultConfig\" isExportable>\n {`/**\\n * The config \\`client.ts\\` starts with: what this spec needs from the runtime.\\n */\\nexport const defaultConfig: ClientConfig = { ${config.join(', ')} }`}\n </File.Source>\n </File>\n {footer && <File baseName=\"client.ts\" path={path.resolve(root, '.kubb/client.ts')} footer={footer} />}\n </>\n )\n}\n","import path from 'node:path'\nimport { resolveOperationTypes, resultTypeName } from '@internals/client'\nimport { getEventStream, operationFileEntry } from '@internals/shared'\nimport { ast, defineGenerator } from '@kubb/kit'\nimport type { Generator } from '@kubb/kit'\nimport { File, jsxRenderer } from '@kubb/renderer-jsx'\nimport { resolveOperationData } from '../builders/operationData.ts'\nimport { buildEventStreamImports } from '../builders/returnStatement.ts'\nimport { Operation } from '../components/Operation.tsx'\nimport { ClientRuntime } from '../components/ClientRuntime.tsx'\nimport type { ContractClientFactory } from '../types.ts'\n\n/**\n * Builds the per-operation client generator shared by the client plugins. `templates` is the folder the optional runtime, such as `sse.ts`, is copied from.\n */\nexport function createClientGenerator<TFactory extends ContractClientFactory>(name: string, { templates }: { templates?: string } = {}): Generator<TFactory> {\n return defineGenerator<TFactory>({\n name,\n renderer: jsxRenderer,\n operations(nodes, ctx) {\n return <ClientRuntime nodes={nodes} root={ctx.root} templates={templates} baseURL={ctx.options.baseURL} servers={ctx.meta.servers} auth={ctx.meta.auth} />\n },\n operation(node, ctx) {\n if (!ast.http.isOperation(node)) return null\n\n const { config, driver, resolver, root } = ctx\n const { output, returnType, throwOnErrorDefault, group, importPath } = ctx.options\n\n const resolvedTypes = resolveOperationTypes(driver, ctx.plugin.name)\n // A custom client module keeps the two-argument `RequestResult` it documents, so its results get no typed headers.\n const types = importPath === undefined ? resolvedTypes : { ...resolvedTypes, response: { ...resolvedTypes.response, headers: undefined } }\n\n const data = resolveOperationData({ node, ctx, types })\n const { validatorHooks, headerTypeNames } = data\n const file = resolver.file({ ...operationFileEntry(node, node.operationId), root, output, group: group ?? undefined })\n const importedTypeNames = [types.response.options(node), types.response.responses(node), ...headerTypeNames]\n\n // A custom client module is emitted verbatim, so `importPath` is used exactly as configured.\n // The default `.kubb/client.ts` is a file path and is made relative to the operation file.\n const clientPath = importPath ?? path.resolve(root, '.kubb/client.ts')\n const clientRoot = importPath === undefined ? file.path : undefined\n // The headers validator helper ships in `.kubb/standardSchema.ts`; a custom client module exports it\n // alongside its other runtime helpers.\n const standardSchemaPath = importPath ?? path.resolve(root, '.kubb/standardSchema.ts')\n const stream = getEventStream(node)\n\n const clientValueImports = [\n ...{\n plain: ['client'],\n data: ['client', 'unwrapResult', 'resolveThrowOnError'],\n full: ['client', 'withUnwrap', 'resolveThrowOnError'],\n }[returnType],\n ...(importPath === undefined && data.security ? ['securitySchemes'] : []),\n ]\n\n const clientTypeImports = stream\n ? buildEventStreamImports({ node, types, returnType })\n : { plain: ['Options', 'RequestResult'], data: ['Options', 'UnwrappedResult'], full: ['Options', 'Unwrappable', 'RequestResult'] }[returnType].map(\n (name) => (name.endsWith('Result') ? resultTypeName(name, headerTypeNames.length > 0) : name),\n )\n\n return (\n <File\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={resolver.default.banner(ctx.meta, { output, config, file: { path: file.path, baseName: file.baseName } })}\n footer={resolver.default.footer(ctx.meta, { output, config, file: { path: file.path, baseName: file.baseName } })}\n >\n <File.Import name={clientValueImports} root={clientRoot} path={clientPath} />\n <File.Import name={clientTypeImports} root={clientRoot} path={clientPath} isTypeOnly />\n\n <File.Import name={Array.from(new Set(importedTypeNames))} root={file.path} path={data.typeFile.path} isTypeOnly />\n\n {data.zodFile && validatorHooks.importedZodNames.length > 0 && (\n <File.Import name={validatorHooks.importedZodNames} root={file.path} path={data.zodFile.path} />\n )}\n {validatorHooks.headers && <File.Import name={['toHeadersStandardSchema']} root={clientRoot} path={standardSchemaPath} />}\n\n <Operation\n name={data.name}\n node={node}\n types={types}\n validatorHooks={validatorHooks}\n returnType={returnType}\n throwOnErrorDefault={throwOnErrorDefault}\n security={data.security}\n baseURL={data.baseURL}\n />\n </File>\n )\n },\n })\n}\n","import { macroDedupeUnion } from '@kubb/kit'\nimport type { ast } from '@kubb/kit'\n\n/**\n * Macros the client plugins apply by default, ahead of any user macros. `macroDedupeUnion`\n * drops repeated union members, keeping the generated response and error\n * unions tidy. A plugin wires them with `ctx.setMacros([...defaultMacros, ...userMacros])`.\n */\nexport const defaultMacros: ReadonlyArray<ast.Macro> = [macroDedupeUnion]\n","import { resolveOperationName } from '@internals/shared'\nimport { ensureValidVarName } from '@internals/utils'\nimport { casing, createResolver } from '@kubb/kit'\nimport type { PluginContractClient, ResolverClient } from './types.ts'\n\n/**\n * Default resolver shared by the client plugins. Functions use safe camelCase identifiers and\n * files inherit the built-in casing; classes and tag groups use PascalCase.\n *\n * @example\n * ```ts\n * resolverClient.name('show pet by id') // 'showPetById'\n * resolverClient.groupName('pet') // 'PetClient'\n * ```\n */\nexport const resolverClient: ResolverClient = createResolver<PluginContractClient>({\n pluginName: 'plugin-contract-client',\n name: resolveOperationName,\n className(name) {\n return ensureValidVarName(casing.pascal(name))\n },\n groupName(name) {\n return ensureValidVarName(casing.pascal(`${name} Client`))\n },\n propertyName(name) {\n return ensureValidVarName(casing.camel(name))\n },\n})\n","import type { OperationTypeNames } from '@internals/client'\nimport { buildOperationComments } from '@internals/shared'\nimport { buildJSDoc } from '@internals/utils'\nimport { ast } from '@kubb/kit'\nimport { File } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx'\nimport { buildOperationBody } from '../builders/operationBody.ts'\nimport type { SecurityRequirement } from '../builders/security.ts'\nimport type { ValidatorHooks } from '../builders/validator.ts'\nimport type { ReturnTypeOption } from '../types.ts'\n\n/**\n * Builds one instance method of a generated SDK class; a per-call `options.client` overrides `this.client`.\n */\nexport function buildSdkMethod({\n node,\n name,\n types,\n validatorHooks,\n security,\n baseURL,\n returnType,\n throwOnErrorDefault,\n}: {\n node: ast.OperationNode\n name: string\n types: OperationTypeNames\n validatorHooks: ValidatorHooks | null\n security?: Array<SecurityRequirement>\n baseURL?: string\n returnType: ReturnTypeOption\n throwOnErrorDefault: boolean\n}): string {\n if (!ast.http.isOperation(node)) return ''\n\n const body = buildOperationBody({ node, types, validatorHooks, security, baseURL, returnType, throwOnErrorDefault })\n const generics = body.generics.length ? `<${body.generics.join(', ')}>` : ''\n const jsdoc = buildJSDoc(buildOperationComments(node, { splitLines: true }))\n\n const destructure = body.mergeContentType\n ? 'const { client: apiClient = this.client, contentType, ...config } = options'\n : 'const { client: apiClient = this.client, ...config } = options'\n const methodBody = [destructure, '', body.statement].map((line) => (line ? ` ${line}` : '')).join('\\n')\n\n return `${jsdoc} public ${name}${generics}(${body.paramsSignature}): ${body.returnType} {\\n${methodBody}\\n }`\n}\n\ntype OperationData = {\n node: ast.OperationNode\n name: string\n types: OperationTypeNames\n validatorHooks: ValidatorHooks | null\n security?: Array<SecurityRequirement>\n baseURL?: string\n}\n\ntype Props = {\n name: string\n operations: Array<OperationData>\n returnType: ReturnTypeOption\n throwOnErrorDefault: boolean\n}\n\n/**\n * Renders one instance class per tag with one method per operation. The constructor takes a client\n * config object and builds its own client through `createClient`, so each environment is a separate\n * instance: `const api = new PetClient({ baseURL }); api.getPetById(...)`. It also takes an existing\n * client, which is how the root SDK shares one client across its tags. The client is public so callers\n * can add interceptors, and a per-call `client` option still overrides it for a one-off call.\n */\nexport function SdkClient({ name, operations, returnType, throwOnErrorDefault }: Props): KubbReactNode {\n const methods = operations.map(({ node, name: methodName, types, validatorHooks, security, baseURL }) =>\n buildSdkMethod({\n node,\n name: methodName,\n types,\n validatorHooks,\n security,\n baseURL,\n returnType,\n throwOnErrorDefault,\n }),\n )\n\n const constructor = [\n ' readonly client: ClientInstance',\n '',\n ' constructor(config: ClientConfig | ClientInstance = {}) {',\n \" this.client = typeof config === 'function' ? config : createClient(config)\",\n ' }',\n ].join('\\n')\n\n const classCode = `export class ${name} {\\n${constructor}\\n\\n${methods.join('\\n\\n')}\\n}`\n\n return (\n <File.Source name={name} isExportable isIndexable>\n {classCode}\n </File.Source>\n )\n}\n","import { File } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx'\n\ntype Member = {\n className: string\n propName: string\n}\n\ntype Props = {\n name: string\n members: Array<Member>\n}\n\n/**\n * Renders a composed root SDK class that creates one client from the config and hands it to every tag\n * client, so `new PetStore({ baseURL }).pet.getPetById(...)` reaches an operation through a single entry\n * point bound to one environment. The shared client is the public `client` field, where interceptors\n * registered once apply to every tag. The per-tag clients are read-only fields built in the constructor.\n */\nexport function SdkFacade({ name, members }: Props): KubbReactNode {\n const fields = [' readonly client: ClientInstance', ...members.map((member) => ` readonly ${member.propName}: ${member.className}`)]\n const assignments = [\n ' this.client = createClient(config)',\n ...members.map((member) => ` this.${member.propName} = new ${member.className}(this.client)`),\n ]\n const body = [...fields, '', ' constructor(config: ClientConfig = {}) {', ...assignments, ' }'].join('\\n')\n\n const classCode = `export class ${name} {\\n${body}\\n}`\n\n return (\n <File.Source name={name} isExportable isIndexable>\n {classCode}\n </File.Source>\n )\n}\n","import path from 'node:path'\nimport { type OperationTypeSource, resolveOperationTypes, resultTypeName } from '@internals/client'\nimport { isEventStream } from '@internals/shared'\nimport { ensureValidVarName } from '@internals/utils'\nimport { ast, defineGenerator, Diagnostics, memo } from '@kubb/kit'\nimport type { Generator } from '@kubb/kit'\nimport { File, jsxRenderer } from '@kubb/renderer-jsx'\nimport { type GeneratorContext, type OperationData, resolveOperationData } from '../builders/operationData.ts'\nimport { buildEventStreamImports } from '../builders/returnStatement.ts'\nimport { isValidatorEnabled } from '../builders/validatorOptions.ts'\nimport { SdkClient } from '../components/SdkClient.tsx'\nimport { ClientRuntime } from '../components/ClientRuntime.tsx'\nimport { SdkFacade } from '../components/SdkFacade.tsx'\nimport type { ContractClientFactory } from '../types.ts'\n\ntype Controller = {\n name: string\n tag: string | undefined\n file: ast.FileNode\n operations: Array<OperationData>\n}\n\n/**\n * Groups operations into one controller per tag. Operations without a tag fall back to a single\n * `Client`/`ApiClient` controller, matching the resolver's default naming.\n */\nfunction buildControllers(nodes: ReadonlyArray<ast.OperationNode>, ctx: GeneratorContext, types: OperationTypeSource): Array<Controller> {\n const { resolver, root } = ctx\n const { output, group } = ctx.options\n\n return nodes.reduce((acc, operationNode) => {\n if (!ast.http.isOperation(operationNode)) return acc\n const tag = operationNode.tags[0]\n const name = tag ? ensureValidVarName(resolver.groupName(tag)) : resolver.className('ApiClient')\n // `group.name` names the folder and file, never the class.\n const fileName = tag && group ? ensureValidVarName(path.basename(resolver.groupDir(group, tag))) : name\n const file = resolver.file({ name: fileName, extname: '.ts', tag, root, output, group: group ?? undefined })\n const operationData = resolveOperationData({ node: operationNode, ctx, types })\n const previous = acc.find((item) => item.file.path === file.path)\n\n if (previous) {\n previous.operations.push(operationData)\n } else {\n acc.push({ name, tag, file, operations: [operationData] })\n }\n\n return acc\n }, [] as Array<Controller>)\n}\n\nfunction collectImportsByFile(ops: Array<OperationData>, pick: (op: OperationData) => { file: ast.FileNode | null; names: Array<string> }) {\n const namesByPath = new Map<string, Set<string>>()\n const filesByPath = new Map<string, ast.FileNode>()\n\n ops.forEach((op) => {\n const { file, names } = pick(op)\n if (!file || names.length === 0) return\n const set = memo(namesByPath, file.path, () => new Set<string>())\n names.forEach((n) => set.add(n))\n filesByPath.set(file.path, file)\n })\n\n return { namesByPath, filesByPath }\n}\n\n/**\n * Builds the class-based SDK generator for a client plugin (`@kubb/plugin-fetch`,\n * `@kubb/plugin-axios`). Only registered when `sdk` is set; otherwise the plugin keeps its\n * standalone per-operation functions.\n *\n * Every tag client is an instance class whose constructor takes a client config and builds its own\n * client, or takes an existing client, so each environment is a separate instance. With `sdk.mode:\n * 'tag'` (the default) it emits one class per tag, named by `resolver.groupName`, and, when `sdk.name`\n * is set, a composed root that creates one client and shares it with every tag client. With\n * `sdk.mode: 'flat'` it emits one class named by `sdk.name`, with every operation as a direct method.\n *\n * `templates` is the folder the optional runtime is copied from: `sse.ts` only for a document that streams, and each\n * form media type only for a document with a body of that type.\n */\nexport function createSdkGenerator<TFactory extends ContractClientFactory>({ templates }: { templates?: string } = {}): Generator<TFactory> {\n return defineGenerator<TFactory>({\n name: 'sdk',\n renderer: jsxRenderer,\n operations(nodes, ctx) {\n const { config, resolver, root } = ctx\n const { output, group, validator, returnType, throwOnErrorDefault, sdk } = ctx.options\n\n if (!sdk) return null\n\n // `resolver.file(...)` resolves every tag to the same single `output.path` under `mode:\n // 'file'`, so a tag-per-class split has nothing to split into: every tag would collapse\n // into whichever controller `buildControllers` reduces first, silently dropping the rest.\n if (sdk.mode === 'tag' && output.mode === 'file') {\n throw new Diagnostics.Error({\n code: Diagnostics.code.invalidPluginOptions,\n severity: 'error',\n message: `Plugin \"${ctx.plugin.name}\" resolves \\`output.mode\\` to 'file' but also configures \\`sdk.mode: 'tag'\\`.`,\n help: \"A single-file output has nothing to split tag classes into. Set `sdk.mode: 'flat'` to emit one class into that file, or give `output.path` an extensionless directory name (or set `output.mode: 'directory'` explicitly) so each tag gets its own file.\",\n location: { kind: 'config' },\n plugin: ctx.plugin.name,\n })\n }\n\n const types = resolveOperationTypes(ctx.driver, ctx.plugin.name)\n\n const validatorEnabled = isValidatorEnabled(validator)\n const controllers = buildControllers(nodes, ctx, types)\n const clientPath = path.resolve(root, '.kubb/client.ts')\n const standardSchemaPath = path.resolve(root, '.kubb/standardSchema.ts')\n\n const banner = (file: ast.FileNode) => resolver.default.banner(ctx.meta, { output, config, file: { path: file.path, baseName: file.baseName } })\n const footer = (file: ast.FileNode) => resolver.default.footer(ctx.meta, { output, config, file: { path: file.path, baseName: file.baseName } })\n\n const renderClassFile = (className: string, file: ast.FileNode, ops: Array<OperationData>) => {\n const { namesByPath: typeNamesByPath, filesByPath: typeFilesByPath } = collectImportsByFile(ops, (op) => ({\n file: op.typeFile,\n names: [op.types.response.options(op.node), op.types.response.responses(op.node), ...op.headerTypeNames],\n }))\n const { namesByPath: zodNamesByPath, filesByPath: zodFilesByPath } = validatorEnabled\n ? collectImportsByFile(ops, (op) => ({ file: op.zodFile, names: op.validatorHooks.importedZodNames }))\n : { namesByPath: new Map<string, Set<string>>(), filesByPath: new Map<string, ast.FileNode>() }\n const resultOps = ops.filter((op) => !isEventStream(op.node))\n const typedHeaders = (op: OperationData) => op.headerTypeNames.length > 0\n const resultName = returnType === 'data' ? 'UnwrappedResult' : 'RequestResult'\n\n return (\n <File key={file.path} baseName={file.baseName} path={file.path} meta={file.meta} banner={banner(file)} footer={footer(file)}>\n <File.Import\n name={[\n 'createClient',\n returnType === 'data' ? 'unwrapResult' : 'withUnwrap',\n 'resolveThrowOnError',\n ...(ctx.options.importPath === undefined && ops.some((op) => op.security) ? ['securitySchemes'] : []),\n ]}\n root={file.path}\n path={clientPath}\n />\n <File.Import\n name={Array.from(\n new Set([\n 'ClientConfig',\n 'ClientInstance',\n 'Options',\n ...(returnType === 'data' ? [] : ['Unwrappable']),\n ...(resultOps.some((op) => !typedHeaders(op)) ? [resultName] : []),\n ...(resultOps.some(typedHeaders) ? [resultTypeName(resultName, true)] : []),\n ...ops.filter((op) => isEventStream(op.node)).flatMap((op) => buildEventStreamImports({ node: op.node, types: op.types, returnType })),\n ]),\n )}\n root={file.path}\n path={clientPath}\n isTypeOnly\n />\n\n {validator === 'zod' && ops.some((op) => ast.http.requestBody.getSchema(op.node) != null) && <File.Import name={['z']} path=\"zod\" isTypeOnly />}\n\n {Array.from(typeNamesByPath.entries()).map(([filePath, set]) => (\n <File.Import key={filePath} name={Array.from(set)} root={file.path} path={typeFilesByPath.get(filePath)!.path} isTypeOnly />\n ))}\n\n {validatorEnabled &&\n Array.from(zodNamesByPath.entries()).map(([filePath, set]) => (\n <File.Import key={filePath} name={Array.from(set)} root={file.path} path={zodFilesByPath.get(filePath)!.path} />\n ))}\n\n {ops.some((op) => op.validatorHooks.headers) && <File.Import name={['toHeadersStandardSchema']} root={file.path} path={standardSchemaPath} />}\n\n <SdkClient name={className} operations={ops} returnType={returnType} throwOnErrorDefault={throwOnErrorDefault} />\n </File>\n )\n }\n\n // `flat` collapses every operation into one class named by `sdk.name`, so callers reach\n // an operation as `new PetStore(config).getPetById(...)` without a per-tag sub-client.\n const renderFacadeFile = (name: string) => {\n const sdkFile = resolver.file({ name, extname: '.ts', root, output, group: group ?? undefined })\n const members = controllers.map(({ name, tag }) => ({ className: name, propName: resolver.propertyName(tag ?? name) }))\n\n return (\n <File key={sdkFile.path} baseName={sdkFile.baseName} path={sdkFile.path} meta={sdkFile.meta} banner={banner(sdkFile)} footer={footer(sdkFile)}>\n <File.Import name={['createClient']} root={sdkFile.path} path={clientPath} />\n <File.Import name={['ClientConfig', 'ClientInstance']} root={sdkFile.path} path={clientPath} isTypeOnly />\n {controllers.map(({ name, file }) => (\n <File.Import key={name} name={[name]} root={sdkFile.path} path={file.path} />\n ))}\n <SdkFacade name={resolver.className(name)} members={members} />\n </File>\n )\n }\n\n const files =\n sdk.mode === 'flat'\n ? renderClassFile(\n resolver.className(sdk.name ?? 'sdk'),\n resolver.file({ name: sdk.name ?? 'sdk', extname: '.ts', root, output, group: group ?? undefined }),\n controllers.flatMap((controller) => controller.operations),\n )\n : [...controllers.map(({ name, file, operations: ops }) => renderClassFile(name, file, ops)), sdk.name && renderFacadeFile(sdk.name)]\n\n return (\n <>\n <ClientRuntime nodes={nodes} root={root} templates={templates} baseURL={ctx.options.baseURL} servers={ctx.meta.servers} auth={ctx.meta.auth} />\n {files}\n </>\n )\n },\n })\n}\n","import path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { addGenerator, injectFile, Resolver, setMacros, setResolver, useConfig } from '@kubb/kit'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { isValidatorEnabled } from './builders/validatorOptions.ts'\nimport { createClientGenerator } from './generators/clientGenerator.tsx'\nimport { createSdkGenerator } from './generators/sdkGenerator.tsx'\nimport { defaultMacros } from './macros.ts'\nimport { resolverClient } from './resolver.ts'\nimport type { ClientOptions, ClientResolvedOptions, ContractClientFactory, ResolverClient } from './types.ts'\n\n// Resolved from a file directly in `src/`, so the same `../templates/` path works from `dist/`.\nconst templatePath = (name: string) => fileURLToPath(new URL(`../templates/${name}`, import.meta.url))\n\n/**\n * Applies the client option defaults and merges a user `resolver` over the built-in one.\n */\nexport function resolveClientOptions(options: ClientOptions): ClientResolvedOptions {\n const {\n output = { path: 'clients', barrel: { type: 'named' } },\n exclude = [],\n include,\n override = [],\n baseURL,\n throwOnErrorDefault = true,\n validator = false,\n returnType = 'full',\n group,\n sdk,\n resolver: userResolver,\n } = options\n\n return {\n output,\n exclude,\n include,\n override,\n group: group ?? null,\n baseURL,\n throwOnErrorDefault,\n validator,\n returnType,\n sdk: sdk ? { mode: sdk.mode ?? 'tag', name: sdk.name } : undefined,\n resolver: userResolver ? Resolver.merge<ResolverClient>(resolverClient, userResolver) : resolverClient,\n }\n}\n\n/**\n * Wires a client plugin in its `setup`: resolver, macros, client or SDK generator, and the `.kubb/` runtime with the plugin's own `client.ts`.\n */\nexport function setupClient({\n name,\n resolved,\n macros = [],\n client,\n}: {\n name: string\n resolved: ClientResolvedOptions\n macros?: ClientOptions['macros']\n client: string\n}): void {\n const config = useConfig()\n\n setResolver(resolved.resolver)\n setMacros([...defaultMacros, ...macros])\n\n const templates = templatePath('')\n addGenerator<ContractClientFactory>(resolved.sdk ? createSdkGenerator({ templates }) : createClientGenerator(name, { templates }))\n\n const root = path.resolve(config.root, config.output.path)\n const files = [\n ['serializers.ts', templatePath('serializers.ts')],\n ['mediaTypes.ts', templatePath('mediaTypes.ts')],\n ['core.ts', templatePath('core.ts')],\n ['client.ts', client],\n ['standardSchema.ts', templatePath('standardSchema.ts')],\n ] as const\n\n for (const [baseName, copy] of files) {\n injectFile({ baseName, path: path.resolve(root, '.kubb', baseName), copy })\n }\n}\n\n/**\n * Declares `plugin-ts` as optional and `plugin-zod` as required once `validator` enables a direction.\n */\nexport function clientDependencies(options: Pick<ClientOptions, 'validator'>) {\n return { [pluginTsName]: { optional: true }, [pluginZodName]: { optional: !isValidatorEnabled(options.validator) } }\n}\n","import { addGenerator, defineExtension, Resolver, setMacros, setResolver } from '@kubb/kit'\nimport { compatibility } from '../kubb-extension.json'\nimport { version } from '../package.json'\nimport { createClientGenerator } from './generators/clientGenerator.tsx'\nimport { defaultMacros } from './macros.ts'\nimport { resolverClient } from './resolver.ts'\nimport { clientDependencies } from './setup.ts'\nimport type { PluginClient, ResolverClient } from './types.ts'\n\n/**\n * Canonical plugin name for `@kubb/plugin-client`.\n */\nexport const pluginClientName = 'plugin-client' satisfies PluginClient['name']\n\n/**\n * Generates typed operations that call a client module owned by your application.\n * The module at `importPath` must export the runtime helpers and types used by generated operations.\n * Kubb does not copy or inject a transport implementation.\n *\n * @example\n * ```ts\n * pluginClient({ importPath: '../api/client' })\n * ```\n */\nexport const pluginClient = defineExtension<PluginClient>({\n kind: 'plugin',\n meta: { name: pluginClientName, version, compatibility },\n dependencies: clientDependencies,\n setup(options) {\n const {\n output = { path: 'clients', barrel: { type: 'named' } },\n exclude = [],\n include,\n override = [],\n importPath,\n throwOnErrorDefault = true,\n validator = false,\n returnType = 'plain',\n group,\n resolver: userResolver,\n } = options\n\n const resolver = userResolver ? Resolver.merge<ResolverClient>(resolverClient, userResolver) : resolverClient\n\n setResolver(resolver)\n setMacros([...defaultMacros, ...(options.macros ?? [])])\n addGenerator(createClientGenerator<PluginClient>('client'))\n\n return {\n output,\n exclude,\n include,\n override,\n group: group ?? null,\n importPath,\n baseURL: undefined,\n throwOnErrorDefault,\n validator,\n returnType,\n sdk: undefined,\n resolver,\n }\n },\n})\n\nexport default pluginClient\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEIA,MAAM,gCAAgB,IAAI,IAAI;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;C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