@kubb/plugin-client 5.11.0-canary.20261106T172015 → 5.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{client-CiHb_Cfg.d.ts → client-BxO6Dygu.d.ts} +13 -3
- package/dist/index.cjs +63 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +63 -10
- package/dist/index.js.map +1 -1
- package/dist/templates/client.d.ts +1 -1
- package/dist/templates/core.d.ts +2 -2
- package/dist/templates/sse.d.ts +1 -1
- package/docs/guides/write-your-client.md +3 -0
- package/package.json +5 -5
- package/templates/core.ts +30 -3
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../internals/shared/src/operation.ts","../../../internals/utils/src/reserved.ts","../../../internals/shared/src/resolver.ts","../../../internals/shared/src/group.ts","../kubb-extension.json","../package.json","../../../internals/client/src/builders/validatorOptions.ts","../../../internals/client/src/builders/generics.ts","../../../internals/client/src/builders/returnStatement.ts","../../../internals/client/src/builders/security.ts","../../../internals/client/src/builders/validator.ts","../../../internals/client/src/builders/contentType.ts","../../../internals/client/src/builders/styles.ts","../../../internals/client/src/builders/callConfig.ts","../../../internals/client/src/builders/signature.ts","../../../internals/client/src/builders/operationBody.ts","../../../internals/client/src/components/Operation.tsx","../../../internals/client/src/components/StreamRuntime.tsx","../../../internals/client/src/resolveOperationTypes.ts","../../../internals/client/src/generators/clientGenerator.tsx","../../../internals/client/src/macros.ts","../../../internals/client/src/resolver.ts","../src/generators/clientGenerator.tsx","../src/plugin.ts"],"sourcesContent":["import { ast, type Group, type Memo, type Output, type Resolver, type ResolverFileParams, Url } from '@kubb/kit'\n\n/**\n * Builds the `ResolverFileParams` every operation generator passes to\n * `resolver.file`: a file named `name`, tagged by the operation's first\n * tag (or `'default'`), at the operation's path. Centralizes the entry object\n * that was repeated at dozens of call sites across the client and query plugins.\n *\n * @example\n * ```ts\n * resolver.file(operationFileEntry(node, node.operationId), { root, output, group })\n * ```\n */\nexport function operationFileEntry(node: ast.OperationNode, name: string, extname: ResolverFileParams['extname'] = '.ts'): ResolverFileParams {\n return {\n name,\n extname,\n tag: node.tags[0] ?? 'default',\n path: node.path,\n }\n}\n\n/**\n * Resolves a dependency plugin's generated file for `node.operationId`, cached in `memo` (the\n * build's `ctx.memo`) under the resolver's own plugin name and the operation. Several dependents reading the\n * same dependency for the same operation in one pass (a query plugin's several hook generators, the\n * MCP handler, ...) share one computed name and path instead of each calling `resolver.file` again.\n *\n * @example Cache `plugin-ts`'s file for the current operation\n * ```ts\n * const fileTs = resolveDependencyOperationFile({ memo: ctx.memo, node, resolver: tsResolver, root, output })\n * ```\n */\nexport function resolveDependencyOperationFile(options: {\n memo: Memo\n node: ast.OperationNode\n resolver: Pick<Resolver, 'file' | 'pluginName'>\n root: string\n output: Output\n group?: Group | null\n}): ast.FileNode {\n const { memo, node, resolver, root, output, group } = options\n\n return memo(`${resolver.pluginName}:operationFile:${node.operationId}`, () =>\n resolver.file({ ...operationFileEntry(node, node.operationId), root, output, group: group ?? undefined }),\n )\n}\n\nexport type ContentTypeInfo = {\n contentTypes: string[]\n isMultipleContentTypes: boolean\n contentTypeUnion: string\n defaultContentType: string\n hasFormData: boolean\n}\n\nexport type RequestConfigResolver = {\n response: {\n body(node: ast.OperationNode): string\n }\n}\n\nexport type ResponseStatusNameResolver = {\n response: {\n status(node: ast.OperationNode, statusCode: ast.StatusCode): string\n }\n}\n\nexport type ResponseNameResolver = ResponseStatusNameResolver & {\n response: {\n response(node: ast.OperationNode): string\n }\n}\n\nexport type OperationTypeNameResolver = RequestConfigResolver &\n ResponseNameResolver & {\n param: {\n path(node: ast.OperationNode, param: ast.ParameterNode): string\n query(node: ast.OperationNode, param: ast.ParameterNode): string\n headers(node: ast.OperationNode, param: ast.ParameterNode): string\n }\n }\n\nexport type OperationCommentLink = 'pathTemplate' | 'urlPath' | false | ((node: ast.OperationNode) => string | undefined)\n\nexport type BuildOperationCommentsOptions = {\n link?: OperationCommentLink\n linkPosition?: 'beforeDeprecated' | 'afterDeprecated'\n splitLines?: boolean\n}\n\ntype ResponseLike = {\n statusCode: ast.StatusCode | number | string\n}\n\nexport type OperationParameterGroups = Record<Exclude<ast.ParameterNode['in'], 'querystring'>, Array<ast.ParameterNode>>\n\nexport type ResolveOperationTypeNameOptions = {\n responseStatusNames?: boolean | 'error'\n exclude?: ReadonlyArray<string | undefined>\n order?: 'params-first' | 'body-response-first'\n /**\n * Include the individual `Path`/`Query`/`Headers` group type names. Set to `false` for clients\n * that reference the grouped `Options` type instead of the per-group types.\n */\n includeParams?: boolean\n}\n\nfunction getOperationLink(node: ast.OperationNode, link: OperationCommentLink): string | null {\n if (!link) {\n return null\n }\n\n if (typeof link === 'function') {\n return link(node) ?? null\n }\n\n return node.path ? `{@link ${Url.toPath(node.path)}}` : null\n}\n\n/**\n * Derives the shared `ContentTypeInfo` shape from a list of content types, tracking whether several\n * are present and the union, default, and form-data flags the client uses to pick one.\n */\nfunction buildContentTypeInfo(contentTypes: string[]): ContentTypeInfo {\n const isMultipleContentTypes = contentTypes.length > 1\n\n return {\n contentTypes,\n isMultipleContentTypes,\n contentTypeUnion: isMultipleContentTypes ? contentTypes.map((ct) => JSON.stringify(ct)).join(' | ') : '',\n defaultContentType: contentTypes[0] ?? 'application/json',\n hasFormData: contentTypes.some((ct) => ct === 'multipart/form-data'),\n }\n}\n\nexport function getContentTypeInfo(node: ast.OperationNode): ContentTypeInfo {\n return buildContentTypeInfo(node.requestBody?.content?.map((e) => e.contentType) ?? [])\n}\n\n/**\n * The request-body counterpart for the primary success response: the content types it documents and\n * whether several are present, so the client can let a caller pick which one to accept.\n */\nexport function getResponseContentTypeInfo(node: ast.OperationNode): ContentTypeInfo {\n return buildContentTypeInfo(getPrimarySuccessResponse(node)?.content?.map((e) => e.contentType) ?? [])\n}\n\nexport type ResponseType = 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream'\n\n/**\n * Reads the single base content type of an operation's primary success response, lowercased and\n * stripped of any `; charset=...` suffix. Returns `undefined` when the response declares zero or\n * more than one content type, since neither case has a single type to act on.\n */\nfunction getPrimarySuccessContentType(node: ast.OperationNode): string | undefined {\n const contentTypes = getPrimarySuccessResponse(node)?.content?.map((entry) => entry.contentType) ?? []\n if (contentTypes.length !== 1) return undefined\n return contentTypes[0]!.split(';')[0]!.trim().toLowerCase()\n}\n\n/**\n * The `text/event-stream` content of the primary success response, when it is the only content type. A response that also\n * declares another type stays a normal call with its query hooks.\n */\nfunction getEventStreamContent(node: ast.OperationNode): ast.ContentNode | undefined {\n return getPrimarySuccessContentType(node) === 'text/event-stream' ? getPrimarySuccessResponse(node)?.content?.[0] : undefined\n}\n\n/**\n * Whether an operation streams its primary success response as Server-Sent Events (`text/event-stream`). The client\n * generator uses this to return a typed event stream instead of a one-shot `RequestResult`.\n */\nexport function isEventStream(node: ast.OperationNode): boolean {\n return getEventStreamContent(node) !== undefined\n}\n\n/**\n * How the document types a `text/event-stream` response, as the adapter read it from `itemSchema`: `event` when each item is\n * the parsed event with its own `event` and `data`, `data` when it is only the payload. Returns `null` without an event stream.\n */\nexport function getEventStream(node: ast.OperationNode): 'event' | 'data' | null {\n const content = getEventStreamContent(node)\n return content ? (content.stream?.shape ?? 'data') : null\n}\n\n/**\n * Derives the default `responseType` for an operation from its primary success response.\n *\n * Returns a value only when that response declares a single non-JSON content type. `text/event-stream` maps to\n * `'stream'`, `application/octet-stream`, `application/pdf`, `image/*`, `audio/*` and `video/*` map to `'blob'`, and\n * other `text/*` to `'text'`. Otherwise `undefined`, leaving the runtime client's `Content-Type` auto-detection in charge.\n */\nexport function getResponseType(node: ast.OperationNode): ResponseType | undefined {\n const baseType = getPrimarySuccessContentType(node)\n if (!baseType) return undefined\n\n if (baseType === 'application/json' || baseType.endsWith('+json') || baseType === 'text/json') return undefined\n if (baseType === 'text/event-stream') return 'stream'\n if (baseType.startsWith('text/')) return 'text'\n if (baseType === 'application/octet-stream' || baseType === 'application/pdf' || /^(image|audio|video)\\//.test(baseType)) return 'blob'\n return undefined\n}\n\n/**\n * Maps a content type to the PascalCase suffix used to name per-content-type variants\n * (e.g. `application/json` → `Json`, `application/xml` → `Xml`, `multipart/form-data` → `FormData`).\n */\nfunction getContentTypeSuffix(contentType: string): string {\n const baseType = contentType.split(';')[0]!.trim()\n if (baseType === 'application/json') return 'Json'\n if (baseType === 'multipart/form-data') return 'FormData'\n if (baseType === 'application/x-www-form-urlencoded') return 'FormUrlEncoded'\n const subtype = baseType.split('/').pop() ?? baseType\n const parts = subtype.split(/[^a-zA-Z0-9]+/).filter(Boolean)\n if (parts.length === 0) return 'Unknown'\n return parts.map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join('')\n}\n\n/**\n * Appends a content-type suffix to a base name, keeping a trailing `Data` segment last\n * (e.g. `AddPetData` + `Json` → `AddPetJsonData`, `AddPetStatus200` + `Xml` → `AddPetStatus200Xml`).\n */\nexport function getPerContentTypeName(baseName: string, suffix: string): string {\n if (baseName.endsWith('Data')) {\n return suffix.endsWith('Data') ? baseName.slice(0, -4) + suffix : `${baseName.slice(0, -4)}${suffix}Data`\n }\n return baseName + suffix\n}\n\nexport type ContentVariantInput = { contentType: string; schema?: ast.SchemaNode | null; keysToOmit?: Array<string> | null }\nexport type ContentVariant = { name: string; suffix: string; schema: ast.SchemaNode; keysToOmit?: Array<string> | null; contentType: string }\n\n/**\n * Resolves per-content-type variant names for a set of content entries, deduplicating suffix\n * collisions with a numeric counter. Entries without a schema are skipped. The returned `suffix` is\n * the final (possibly counter-augmented) value, so callers can derive parallel names in another\n * namespace (e.g. plugin-faker deriving the matching plugin-ts type name).\n */\nexport function resolveContentTypeVariants(entries: Array<ContentVariantInput>, baseName: string): Array<ContentVariant> {\n const usedNames = new Set<string>()\n return entries\n .filter((entry) => entry.schema)\n .map((entry) => {\n const baseSuffix = getContentTypeSuffix(entry.contentType)\n let suffix = baseSuffix\n let name = getPerContentTypeName(baseName, suffix)\n let counter = 2\n while (usedNames.has(name)) {\n suffix = `${baseSuffix}${counter++}`\n name = getPerContentTypeName(baseName, suffix)\n }\n usedNames.add(name)\n return { name, suffix, schema: entry.schema!, keysToOmit: entry.keysToOmit, contentType: entry.contentType }\n })\n}\n\n// The request groups come from the grouped params, so `config` drops the data-shape keys to stay\n// assignable to `Options`, which omits them from `RequestConfig`.\nconst requestConfigBaseType = `Partial<Omit<RequestConfig, 'path' | 'query' | 'body' | 'headers' | 'url'>>`\n\nexport function buildRequestConfigType(node: ast.OperationNode): string {\n const request = getContentTypeInfo(node)\n const response = getResponseContentTypeInfo(node)\n\n // Only the ambiguous side is offered: a single-type side has nothing to pick, so it stays baked in\n // the generated call.\n const members = [\n request.isMultipleContentTypes ? `request?: ${request.contentTypeUnion}` : null,\n response.isMultipleContentTypes ? `response?: ${response.contentTypeUnion}` : null,\n ].filter(Boolean)\n\n return members.length ? `${requestConfigBaseType} & { contentType?: { ${members.join('; ')} } }` : requestConfigBaseType\n}\n\n/**\n * Builds the `client?:` option type shared by the generated query hooks (`useQuery`,\n * `useInfiniteQuery`, `useSWR`, ...). Unlike {@link buildRequestConfigType}, it never adds a\n * `contentType?:` member: query hooks wrap GET operations, which carry no request body to select a\n * content type for.\n */\nexport function buildClientOptionType(): string {\n return requestConfigBaseType\n}\n\nexport type RequestGroups = {\n path: boolean\n query: boolean\n body: boolean\n headers: boolean\n}\n\n/**\n * Which of the grouped request options an operation carries.\n */\nexport function getRequestGroups(node: ast.OperationNode): RequestGroups {\n const { path, query, header } = getOperationParameters(node)\n return {\n path: path.length > 0,\n query: query.length > 0,\n body: Boolean(node.requestBody?.content?.[0]?.schema),\n headers: header.length > 0,\n }\n}\n\nexport type RequestGroupOptionality = {\n groups: RequestGroups\n hasRequiredPath: boolean\n hasRequiredQuery: boolean\n hasRequiredHeader: boolean\n /**\n * Whether the grouped request parameter can default to `{}`. True only when no group carries a\n * required member, so every member is safe to omit.\n */\n isOptional: boolean\n}\n\n/**\n * Resolves which grouped request options an operation carries together with whether each group\n * holds a required member. The grouped parameter stays optional only when nothing inside it is\n * required, matching the generated `RequestConfig` type.\n */\nexport function getRequestGroupOptionality(node: ast.OperationNode): RequestGroupOptionality {\n const groups = getRequestGroups(node)\n const { path, query, header } = getOperationParameters(node)\n const hasRequiredPath = path.some((param) => param.required)\n const hasRequiredQuery = query.some((param) => param.required)\n const hasRequiredHeader = header.some((param) => param.required)\n\n return {\n groups,\n hasRequiredPath,\n hasRequiredQuery,\n hasRequiredHeader,\n isOptional: !hasRequiredPath && !hasRequiredQuery && !hasRequiredHeader && !groups.body,\n }\n}\n\nexport type RequestOptionsNameResolver = RequestConfigResolver & {\n response: {\n options(node: ast.OperationNode): string\n }\n}\n\n/**\n * Builds the grouped `{ path, query, body, headers }` parameter for a generated client\n * function, typed from the operation's `Options` (minus `url`). Only the groups the\n * operation actually has are destructured. The trailing `config` parameter carries the\n * runtime `RequestConfig` overrides plus `client`.\n */\nexport function buildRequestParamsSignature(\n node: ast.OperationNode,\n resolver: RequestOptionsNameResolver,\n options: { isConfigurable?: boolean } = {},\n): { signature: string; groups: RequestGroups } {\n const { isConfigurable = true } = options\n const { groups, isOptional } = getRequestGroupOptionality(node)\n\n const names = (['path', 'query', 'body', 'headers'] as const).filter((key) => groups[key])\n\n // 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 }\n}\n\nexport function buildOperationComments(node: ast.OperationNode, options: BuildOperationCommentsOptions = {}): Array<string> {\n const { link = 'pathTemplate', linkPosition = 'afterDeprecated', splitLines = false } = options\n const linkComment = getOperationLink(node, link)\n const comments =\n linkPosition === 'beforeDeprecated'\n ? [node.description && `@description ${node.description}`, node.summary && `@summary ${node.summary}`, linkComment, node.deprecated && '@deprecated']\n : [node.description && `@description ${node.description}`, node.summary && `@summary ${node.summary}`, node.deprecated && '@deprecated', linkComment]\n\n const filteredComments = comments.filter((comment): comment is string => Boolean(comment))\n\n if (!splitLines) {\n return filteredComments\n }\n\n return filteredComments.flatMap((text) => text.split(/\\r?\\n/).map((line) => line.trim())).filter((comment): comment is string => Boolean(comment))\n}\n\nconst operationParameterGroupsByNode = new WeakMap<ast.OperationNode, OperationParameterGroups>()\n\n/**\n * An OpenAPI 3.2 `querystring` parameter is the whole query string, so a form-encoded object becomes one query parameter\n * per property, typed and serialized like any other.\n * Another content type, such as JSON, stays one parameter named after it, and the runtime sends its value as the whole query string.\n */\nfunction spreadQuerystring(param: ast.ParameterNode): Array<ast.ParameterNode> {\n const schema = param.schema.type === 'ref' ? param.schema.schema : param.schema\n const formEncoded = !param.contentType || param.contentType.split(';')[0]!.trim().toLowerCase() === 'application/x-www-form-urlencoded'\n if (schema?.type !== 'object' || !formEncoded) return [param]\n return schema.properties.map((property) =>\n ast.factory.createParameter({ name: property.name, in: 'query', schema: property.schema, required: param.required && property.required }),\n )\n}\n\n/**\n * Groups an operation's parameters by location (`path`/`query`/`header`/`cookie`), deduping each\n * group by name. Every plugin generator visiting the same `OperationNode` shares one AST instance\n * (see `KubbDriver`), so the result is cached per node to avoid re-filtering and re-deduping the\n * same parameters once per plugin.\n */\nexport function getOperationParameters(node: ast.OperationNode): OperationParameterGroups {\n const cached = operationParameterGroupsByNode.get(node)\n if (cached) return cached\n\n // A malformed spec can declare the same name twice within one location. Both would resolve to the\n // same output property, so emitting both would yield an object type with a duplicate member,\n // which TypeScript rejects. Keep the first.\n const dedupe = (params: Array<ast.ParameterNode>) => {\n const seen = new Set<string>()\n return params.filter((param) => {\n if (seen.has(param.name)) return false\n seen.add(param.name)\n return true\n })\n }\n const group = (location: ast.ParameterNode['in']) => dedupe(node.parameters.filter((param) => param.in === location))\n\n const groups: OperationParameterGroups = {\n path: group('path'),\n query: dedupe([...group('query'), ...group('querystring').flatMap(spreadQuerystring)]),\n header: group('header'),\n cookie: group('cookie'),\n }\n\n operationParameterGroupsByNode.set(node, groups)\n return groups\n}\n\n/**\n * Builds the combined `{ body, path, query, headers }` options object schema for an operation,\n * referencing the already-resolved body and grouped param names. Shared by `@kubb/plugin-ts`'s\n * `Options` type and `@kubb/plugin-zod`'s inferred options schema, so both printers emit the same\n * shape from the same inputs. `primitive: 'object'` is a no-op for the TS printer and tells the Zod\n * printer to emit `z.object(…)` rather than a record.\n */\nexport function 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\nexport function buildOptionsSchema(node: ast.OperationNode, resolver: OperationTypeNameResolver, { pairContentTypes = false } = {}): ast.SchemaNode {\n const { path, query, header } = getOperationParameters(node)\n const hasBody = Boolean(node.requestBody?.content?.[0]?.schema)\n const createNever = () => ast.factory.createSchema({ type: 'never', primitive: undefined, optional: true })\n const groups = [\n { name: 'path', params: path, resolve: resolver.param.path },\n { name: 'query', params: query, resolve: resolver.param.query },\n { name: 'headers', params: header, resolve: resolver.param.headers },\n ] as const\n\n 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, schema: body }),\n ...groups.map(({ name, params, resolve }) => {\n const required = params.some((param) => param.required)\n\n return ast.factory.createProperty({\n name,\n required,\n schema:\n params.length > 0\n ? ast.factory.createSchema({ type: 'ref', name: resolve.call(resolver.param, node, params[0]!), optional: !required })\n : createNever(),\n })\n }),\n ...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`.\n return ast.factory.createSchema({\n type: 'union',\n members: variants.map((variant, index) =>\n 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: 'object',\n primitive: 'object',\n properties: [\n ast.factory.createProperty({\n name: 'request',\n required: true,\n schema: ast.factory.createSchema({ type: 'enum', enumValues: [variant.contentType] }),\n }),\n ],\n }),\n }),\n ]),\n ),\n })\n}\n\n/**\n * The schema a status occupies in the `<Name>Responses` record. A status that documents several\n * content types becomes a `{ contentType; data }` union so the runtime can surface the negotiated type\n * on `result.parsed`, while the standalone `<Name>StatusNNN` alias stays the plain body union that the\n * query hooks and `result.data` use.\n */\nfunction buildResponseRecordEntry(node: ast.OperationNode, res: ast.ResponseNode, resolver: ResponseStatusNameResolver): ast.SchemaNode {\n const statusName = resolver.response.status(node, res.statusCode)\n const variants = (res.content ?? []).filter((entry) => entry.schema)\n if (variants.length <= 1) {\n return ast.factory.createSchema({ type: 'ref', name: statusName })\n }\n\n return ast.factory.createSchema({\n type: 'union',\n members: resolveContentTypeVariants(variants, statusName).map((variant) =>\n ast.factory.createSchema({\n type: 'object',\n primitive: 'object',\n properties: [\n ast.factory.createProperty({\n name: 'contentType',\n required: true,\n schema: ast.factory.createSchema({ type: 'enum', enumValues: [variant.contentType] }),\n }),\n ast.factory.createProperty({\n name: 'data',\n required: true,\n schema: ast.factory.createSchema({ type: 'ref', name: variant.name }),\n }),\n ],\n }),\n ),\n })\n}\n\n/**\n * Builds the per-status `<Name>Responses` record for an operation, referencing the already-resolved\n * `<Name>StatusNNN` names. Shared by `@kubb/plugin-ts`'s `Responses` type and `@kubb/plugin-zod`'s\n * inferred responses schema, so both emit the same shape from the same inputs.\n *\n * Always emits the keyed record, even when an operation declares no responses. An operation with no\n * responses renders as an empty object, which keeps every consumer's import (for example the axios\n * SDK's `RequestResult<XResponses>`) resolvable instead of pointing at a missing export.\n */\nexport function buildResponses(node: ast.OperationNode, resolver: ResponseStatusNameResolver): ast.SchemaNode {\n return ast.factory.createSchema({\n type: 'object',\n primitive: 'object',\n properties: node.responses.map((res) =>\n ast.factory.createProperty({\n name: String(res.statusCode),\n required: true,\n schema: buildResponseRecordEntry(node, res, resolver),\n }),\n ),\n })\n}\n\nexport function getStatusCodeNumber(statusCode: ast.StatusCode | number | string): number | null {\n const code = Number(statusCode)\n\n return Number.isNaN(code) ? null : code\n}\n\nexport function isSuccessStatusCode(statusCode: ast.StatusCode | number | string): boolean {\n const code = getStatusCodeNumber(statusCode)\n\n return code !== null && code >= 200 && code < 300\n}\n\nexport function isErrorStatusCode(statusCode: ast.StatusCode | number | string): boolean {\n const code = getStatusCodeNumber(statusCode)\n\n return code !== null && code >= 400\n}\n\nexport function getSuccessResponses<TResponse extends ResponseLike>(responses: ReadonlyArray<TResponse>): Array<TResponse> {\n return responses.filter((response) => isSuccessStatusCode(response.statusCode))\n}\n\nexport function getOperationSuccessResponses(node: ast.OperationNode): Array<ast.ResponseNode> {\n return getSuccessResponses(node.responses)\n}\n\nexport function getPrimarySuccessResponse(node: ast.OperationNode): ast.ResponseNode | null {\n return getOperationSuccessResponses(node)[0] ?? null\n}\n\nexport function resolveErrorNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses.filter((response) => isErrorStatusCode(response.statusCode)).map((response) => resolver.response.status(node, response.statusCode))\n}\n\nexport function resolveSuccessNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses.filter((response) => isSuccessStatusCode(response.statusCode)).map((response) => resolver.response.status(node, response.statusCode))\n}\n\nexport function resolveStatusCodeNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses.map((response) => resolver.response.status(node, response.statusCode))\n}\n\n/**\n * Lists the type names an operation's types file declares, computed once per resolver and `options` so every\n * dependent reads the same list.\n */\nexport function resolveOperationTypeNames(\n node: ast.OperationNode,\n resolver: OperationTypeNameResolver & Pick<Resolver, 'memo'>,\n options: ResolveOperationTypeNameOptions = {},\n): string[] {\n const key = `${node.operationId}\\0${options.order ?? ''}\\0${options.responseStatusNames ?? ''}\\0${options.includeParams === false ? 'noparams' : ''}\\0${(options.exclude ?? []).join(',')}`\n return resolver.memo(`operationTypeNames:${key}`, () => {\n const { path, query, header } = getOperationParameters(node)\n const responseStatusNames =\n options.responseStatusNames === 'error'\n ? resolveErrorNames(node, resolver)\n : options.responseStatusNames === false\n ? []\n : resolveStatusCodeNames(node, resolver)\n const exclude = new Set(options.exclude ?? [])\n const paramNames =\n options.includeParams === false\n ? []\n : [\n ...path.map((param) => resolver.param.path(node, param)),\n ...query.map((param) => resolver.param.query(node, param)),\n ...header.map((param) => resolver.param.headers(node, param)),\n ]\n const bodyAndResponseNames = [node.requestBody?.content?.[0]?.schema ? resolver.response.body(node) : null, resolver.response.response(node)]\n const names =\n options.order === 'body-response-first'\n ? [...bodyAndResponseNames, ...paramNames, ...responseStatusNames]\n : [...paramNames, ...bodyAndResponseNames, ...responseStatusNames]\n\n return names.filter((name): name is string => Boolean(name) && !exclude.has(name as string))\n })\n}\n\nexport function resolveResponseTypes(node: ast.OperationNode, resolver: ResponseNameResolver): Array<[statusCode: number | 'default', typeName: string]> {\n const types: Array<[number | 'default', string]> = []\n\n for (const response of node.responses) {\n if (response.statusCode === 'default') {\n types.push(['default', resolver.response.response(node)])\n continue\n }\n\n const code = getStatusCodeNumber(response.statusCode)\n if (code === null) {\n continue\n }\n\n types.push([code, isSuccessStatusCode(code) ? resolver.response.response(node) : resolver.response.status(node, response.statusCode)])\n }\n\n return types\n}\n","/**\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 { ensureValidVarName, toFilePath } from '@internals/utils'\nimport { ast, camelCase } from '@kubb/kit'\nimport type { GeneratorContext, Resolver, ResolverFile } from '@kubb/kit'\n\n/**\n * The shared top-level `name` of the operation plugins, computed once per operation name and build.\n */\nexport function resolveOperationName(this: Resolver, name: string): string {\n return this.memo(`operation:${name}`, () => ensureValidVarName(camelCase(name)))\n}\n\n/**\n * Builds the allocation key for a declaration an operation owns. `scope` names which declaration\n * it is, so two of them never share an allocation even when a custom resolver gives both the same\n * name. Leave `scope` empty for the operation's own declaration.\n *\n * @example\n * ```ts\n * resolver.resolveName({ key: operationKey(node, 'response', 'status', 404), name })\n * ```\n */\nexport function operationKey(node: ast.OperationNode, ...scope: Array<string | number>): Array<string | undefined> {\n return ['operation', node.method, node.path, ...scope.map(String)]\n}\n\n/**\n * The `param` namespace shared by the schema-producing plugins (ts, zod, faker):\n * per-parameter names plus the grouped `Path`/`Query`/`Headers` 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}\n\n/**\n * The `response` namespace shared by the schema-producing plugins: per-status,\n * body, and combined response names, all routed through the plugin's top-level\n * `name` casing.\n */\nexport type OperationResponseResolver = {\n status(this: Resolver, node: ast.OperationNode, statusCode: ast.StatusCode): string\n body(this: Resolver, node: ast.OperationNode): string\n responses(this: Resolver, node: ast.OperationNode): string\n response(this: Resolver, node: ast.OperationNode): string\n}\n\n/**\n * Builds the shared `param` namespace. Spread the result into `createResolver`\n * and override individual methods next to it when a plugin deviates.\n *\n * @example\n * ```ts\n * createResolver<PluginTs>({ param: createOperationParamResolver(), ... })\n * ```\n */\nexport function createOperationParamResolver(): OperationParamResolver {\n return {\n name(node, param) {\n const name = this.name(`${node.operationId} ${param.in} ${param.name}`)\n return this.resolveName({ key: operationKey(node, 'param', 'name', param.in, param.name), name })\n },\n path(node) {\n const name = this.name(`${node.operationId} Path`)\n return this.resolveName({ key: operationKey(node, 'param', 'path'), name })\n },\n query(node) {\n const name = this.name(`${node.operationId} Query`)\n return this.resolveName({ key: operationKey(node, 'param', 'query'), name })\n },\n headers(node) {\n const name = this.name(`${node.operationId} Headers`)\n return this.resolveName({ key: operationKey(node, 'param', 'headers'), name })\n },\n }\n}\n\n/**\n * Builds the shared `response` namespace. Spread the result into\n * `createResolver` and add plugin-specific methods (`options`, `error`) next\n * to it.\n *\n * @example\n * ```ts\n * createResolver<PluginTs>({ response: { ...createOperationResponseResolver(), options(node) {...} }, ... })\n * ```\n */\nexport function createOperationResponseResolver(): OperationResponseResolver {\n return {\n status(node, statusCode) {\n const name = this.name(`${node.operationId} Status ${statusCode}`)\n return this.resolveName({ key: operationKey(node, 'response', 'status', statusCode), name })\n },\n body(node) {\n const name = this.name(`${node.operationId} Body`)\n return this.resolveName({ key: operationKey(node, 'response', 'body'), name })\n },\n responses(node) {\n const name = this.name(`${node.operationId} Responses`)\n return this.resolveName({ key: operationKey(node, 'response', 'responses'), name })\n },\n response(node) {\n const name = this.name(`${node.operationId} Response`)\n return this.resolveName({ key: operationKey(node, 'response', 'response'), name })\n },\n }\n}\n\n/**\n * Builds a resolver `file` override whose base name runs every path segment\n * through `toFilePath`, casing the final segment with `caseLast`.\n *\n * @example\n * ```ts\n * createResolver<PluginTs>({ file: createCasedFile(pascalCase), ... })\n * ```\n */\nexport function createCasedFile(caseLast: (part: string) => string): ResolverFile {\n return {\n baseName({ name, extname }) {\n return this.memo(`file:${name}\\0${extname}`, (): ast.FileNode['baseName'] => `${toFilePath(name, caseLast)}${extname}`)\n },\n }\n}\n\ntype SchemaIndexContext = Pick<GeneratorContext, 'memo' | 'driver'>\n\n/**\n * Names of the schemas in a circular reference chain, computed once per build.\n */\nexport function getCircularNames(ctx: SchemaIndexContext): ReadonlySet<string> {\n return ctx.memo('circularNames:set', () => ast.findCircularSchemas(ctx.driver.inputNode?.schemas ?? []))\n}\n\n/**\n * Names of the schemas whose type is `enum`, computed once per build.\n */\nexport function getEnumNames(ctx: SchemaIndexContext): ReadonlySet<string> {\n return ctx.memo(\n 'enumNames:set',\n () => new Set((ctx.driver.inputNode?.schemas ?? []).flatMap((schema) => (schema.type === 'enum' && schema.name ? [schema.name] : []))),\n )\n}\n\ndeclare global {\n namespace Kubb {\n interface MemoRegistry {\n operation: string\n file: ast.FileNode['baseName']\n operationTypeNames: Array<string>\n }\n }\n}\n","import { camelCase, type Group } from '@kubb/kit'\n\n/**\n * Builds the `group` config a Kubb plugin passes to `ctx.setOptions`, applying the\n * shared default naming so every plugin groups output consistently:\n *\n * - `path` groups use the second path segment (`/pet/findByStatus` → `pet`).\n * - other groups use the camelCased group (`pet store` → `petStore`).\n *\n * A user-provided `group.name` always wins over the default namer, so callers stay in\n * control of their output folders. Returns `null` when grouping is disabled, matching the\n * per-plugin convention.\n *\n * @param group - The user-supplied group option, or `undefined` to disable grouping.\n *\n * @example\n * ```ts\n * createGroupConfig(group) // shared across every plugin\n * ```\n */\nexport function createGroupConfig(group: Group | undefined): Group | null {\n if (!group) {\n return null\n }\n\n const defaultName = (ctx: { group: string }): string => {\n if (group.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n\n return camelCase(ctx.group)\n }\n\n return {\n ...group,\n name: group.name ? group.name : defaultName,\n } satisfies Group\n}\n","","","import { isSuccessStatusCode } from '@internals/shared'\nimport type { ast } from '@kubb/kit'\nimport type { ResolverZod } from '@kubb/plugin-zod'\nimport type { ValidatorOptions } from '../types.ts'\n\n/**\n * Returns `true` when any direction of the validator uses zod (used for dependency checks).\n */\nexport function isValidatorEnabled(validator: ValidatorOptions | undefined): boolean {\n if (!validator) return false\n if (validator === 'zod') return true\n return Boolean(validator.request || validator.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 * Resolves the zod schema name a generated client validates an error body with on the non-throw path.\n * Uses the error-only `<operation>ErrorSchema` (the union of non-2xx statuses); returns `null` when the\n * operation documents no error responses with a schema.\n */\nexport function buildZodErrorParse(node: ast.OperationNode, zodResolver: ResolverZod): string | null {\n const hasErrorResponse = node.responses.some((res) => !isSuccessStatusCode(res.statusCode) && res.content?.some((entry) => entry.schema))\n if (!hasErrorResponse) return null\n return zodResolver.response.error?.(node) || null\n}\n","import type { ast } from '@kubb/kit'\nimport type { OperationTypeNames } from '../resolveOperationTypes.ts'\nimport type { ReturnTypeOption } from '../types.ts'\n\n/**\n * Builds the `RequestResult` generic arguments for one operation: the per-status responses record\n * plus the per-call `ThrowOnError` flag. `SuccessOf` / `ErrorOf` split the record inside the\n * runtime, so this only names the record and threads `ThrowOnError`.\n *\n * @example\n * `buildRequestResultGenerics({ node, types }) // 'AddPetResponses, ThrowOnError'`\n */\nexport function buildRequestResultGenerics({ node, types }: { node: ast.OperationNode; types: OperationTypeNames }): string {\n return `${types.response.responses(node)}, ThrowOnError`\n}\n\n/**\n * Builds the full return type an operation's function signature uses: `Unwrappable<RequestResult>`\n * for the default `returnType: 'full'`, already a promise so no further wrapping is needed, a plain\n * `Promise<RequestResult>` for the internal `'plain'` shape, or a\n * `Promise` of the runtime's `UnwrappedResult` when `returnType: 'data'` narrows a resolved call\n * down to the bare success body.\n *\n * @example\n * `buildResultType({ node, types, returnType: 'data' }) // 'Promise<UnwrappedResult<AddPetResponses, ThrowOnError>>'`\n */\nexport function buildResultType({ node, types, returnType }: { node: ast.OperationNode; types: OperationTypeNames; returnType: ReturnTypeOption }): string {\n const generics = buildRequestResultGenerics({ node, types })\n if (returnType === 'data') return `Promise<UnwrappedResult<${generics}>>`\n if (returnType === 'plain') return `Promise<RequestResult<${generics}>>`\n return `Unwrappable<RequestResult<${generics}>>`\n}\n","import { getEventStream, hasRequestContentTypeChoice } from '@internals/shared'\nimport type { ast } from '@kubb/kit'\nimport type { OperationTypeNames } from '../resolveOperationTypes.ts'\nimport type { ReturnTypeOption } from '../types.ts'\nimport type { ValidatorHooks } from './validator.ts'\nimport { buildRequestResultGenerics, buildResultType } from './generics.ts'\n\n/**\n * Builds the return statement of a generated operation function. With the default\n * `returnType: 'full'` the runtime call already resolves to `{ data, error, request, response }`.\n * The generated code casts that result to the operation's `RequestResult`, then wraps it with\n * `withUnwrap`, so the caller can `await` it directly or call `.unwrap()` for the bare success\n * body. With `returnType: 'data'` it instead routes the call through the runtime's `unwrapResult`,\n * which narrows the resolved value down to the bare success body the same way `RequestResult`\n * already does, using the plugin default when the call leaves `throwOnError` unset.\n * With `returnType: 'plain'` it returns the runtime call as is, cast to `RequestResult`, with no helper.\n *\n * Cast first, wrap second, for the `'full'` path. That order keeps `withUnwrap`'s generic inferred\n * as `RequestResult` instead of the runtime's own internal result type. Casting an `Unwrappable<A>`\n * straight to `Unwrappable<B>` does not work: the `.then` overload stays pinned to `A`, and `as`\n * rejects that two-generic swap even where `A` and `B` on their own would satisfy it.\n *\n * @example\n * `return withUnwrap(request({ method: 'POST', url: '/pet', ...config }) as Promise<RequestResult<AddPetResponses, ThrowOnError>>)`\n * @example\n * `return unwrapResult(request({ method: 'POST', url: '/pet', ...config }), config.throwOnError ?? false) as Promise<UnwrappedResult<AddPetResponses, ThrowOnError>>`\n * @example\n * `return request({ method: 'POST', url: '/pet', ...config }) as Promise<RequestResult<AddPetResponses, ThrowOnError>>`\n */\nexport function buildReturnStatement({\n node,\n types,\n callConfig,\n returnType,\n throwOnErrorDefault,\n}: {\n node: ast.OperationNode\n types: OperationTypeNames\n callConfig: string\n returnType: ReturnTypeOption\n throwOnErrorDefault: boolean\n}): string {\n // The options of a body offered in several media types are a union, so the body type cannot be inferred from `config`.\n // A `'plain'` client is the caller's own function, which takes no type argument.\n const request = returnType !== 'plain' && hasRequestContentTypeChoice(node) ? `request<${types.response.options(node)}['body']>` : 'request'\n if (returnType === 'data') {\n const resultType = buildResultType({ node, types, returnType })\n return `return unwrapResult(${request}(${callConfig}), config.throwOnError ?? ${throwOnErrorDefault}) as ${resultType}`\n }\n if (returnType === 'plain') {\n return `return ${request}(${callConfig}) as Promise<RequestResult<${buildRequestResultGenerics({ node, types })}>>`\n }\n return `return withUnwrap(${request}(${callConfig}) as Promise<RequestResult<${buildRequestResultGenerics({ node, types })}>>)`\n}\n\n/**\n * Builds the return type and statement of a `text/event-stream` operation. The item type is `TypedEvent<...>` when each item\n * declares its own `event` and `data`, and otherwise the payload type, which `EventStreamResult` wraps in `ServerSentEvent`. The call's\n * promise goes through `toEventStream` with the `client` for its defaults, the call's `config`, the shape and the per-event\n * validator. A `returnType: 'plain'` client receives only the promise,\n * `toEventStream(request(config))`, and keeps its response validator in the call config.\n */\nexport function buildEventStreamReturn({\n node,\n types,\n callConfig,\n returnType,\n validatorHooks,\n throwOnErrorDefault,\n}: {\n node: ast.HttpOperationNode\n types: OperationTypeNames\n callConfig: string\n returnType: ReturnTypeOption\n validatorHooks: ValidatorHooks | null\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 success = `SuccessOf<${responses}>`\n const eventType = shape === 'event' ? `TypedEvent<${success}>` : success\n if (returnType === 'plain') {\n return { returnType: `Promise<EventStreamResult<${eventType}>>`, statement: `return toEventStream<${eventType}>(request(${callConfig}))` }\n }\n\n const generics = `${responses}, ThrowOnError${shape === 'event' ? `, ${eventType}` : ''}`\n const meta = [`shape: '${shape}'`, validatorHooks?.response ? `validator: ${validatorHooks.response}` : null].filter(Boolean).join(', ')\n const call = `toEventStream<${eventType}>(request(${callConfig}), { client: request, config, ${meta} })`\n if (returnType === 'data') {\n const result = `Promise<UnwrappedStreamResult<${generics}>>`\n return { returnType: result, statement: `return unwrapResult(${call}, config.throwOnError ?? ${throwOnErrorDefault}) as ${result}` }\n }\n return { returnType: `Unwrappable<StreamResult<${generics}>>`, statement: `return withUnwrap(${call} as Promise<StreamResult<${generics}>>)` }\n}\n\n/** The stream types an operation file imports: `StreamResult` and `StreamOptions`, `EventStreamResult` for a plain client, and `TypedEvent` for named events. */\nexport function buildEventStreamImports({ returnType, typed }: { returnType: ReturnTypeOption; typed: boolean }): Array<string> {\n const result = { plain: ['EventStreamResult'], full: ['StreamResult', 'StreamOptions'], data: ['UnwrappedStreamResult', 'StreamOptions'] }[returnType]\n return [...result, ...(typed ? ['TypedEvent'] : [])]\n}\n","/**\n * A resolved security scheme as emitted on each generated call's `security` array. The runtime calls\n * the configured `auth` resolver with this object and places the returned token: `http` bearer/basic\n * on `Authorization`, `apiKey` under `name` in the header/query/cookie, and `oauth2`/`openIdConnect`\n * as a bearer token.\n */\nexport type Auth = {\n type: 'http' | 'apiKey' | 'oauth2' | 'openIdConnect'\n scheme?: 'bearer' | 'basic'\n name?: string\n in?: 'header' | 'query' | 'cookie'\n scopes?: Array<string>\n}\n\n/**\n * A single OpenAPI security requirement read from the spec: scheme name to the scopes it needs.\n */\ntype SecurityRequirement = Record<string, Array<string>>\n\n/**\n * The slice of an OpenAPI document the security derivation reads: the global `security`, the\n * per-operation `security` under `paths`, and the `securitySchemes` map under `components`. Typed\n * locally so this package stays independent of the OpenAPI adapter.\n */\nexport type SecurityDocument = {\n security?: Array<SecurityRequirement>\n components?: {\n securitySchemes?: Record<string, OasSecurityScheme | { $ref: string } | undefined>\n }\n paths?: Record<string, Record<string, { security?: Array<SecurityRequirement> } | undefined> | undefined>\n}\n\ntype OasSecurityScheme = { type: 'http'; scheme?: string } | { type: 'apiKey'; name?: string; in?: string } | { type: 'oauth2' } | { type: 'openIdConnect' }\n\nfunction serializeAuth(auth: Auth): string {\n const parts = [`type: '${auth.type}'`]\n if (auth.scheme) parts.push(`scheme: '${auth.scheme}'`)\n if (auth.name) parts.push(`name: '${auth.name}'`)\n if (auth.in) parts.push(`in: '${auth.in}'`)\n if (auth.scopes?.length) parts.push(`scopes: [${auth.scopes.map((scope) => `'${scope}'`).join(', ')}]`)\n return `{ ${parts.join(', ')} }`\n}\n\n/**\n * Maps an OpenAPI security scheme to the inline `Auth` object, or `null` when the runtime cannot\n * place it (an unresolved `$ref`, or an `apiKey` without a name or outside `header` / `query` /\n * `cookie`). `http` schemes other than `basic` are treated as bearer.\n */\nexport function resolveSecurityScheme(scheme: OasSecurityScheme | { $ref: string } | undefined): Auth | null {\n if (!scheme || '$ref' in scheme) return null\n if (scheme.type === 'apiKey') {\n if (!scheme.name || (scheme.in !== 'header' && scheme.in !== 'query' && scheme.in !== 'cookie')) return null\n return { type: 'apiKey', name: scheme.name, in: scheme.in }\n }\n if (scheme.type === 'http') return { type: 'http', scheme: scheme.scheme?.toLowerCase() === 'basic' ? 'basic' : 'bearer' }\n if (scheme.type === 'oauth2') return { type: 'oauth2' }\n if (scheme.type === 'openIdConnect') return { type: 'openIdConnect' }\n return null\n}\n\n/**\n * Derives the per-operation security metadata from the OpenAPI document. The operation's own\n * `security` overrides the global `security` (an explicit empty array disables auth), and every\n * referenced scheme is resolved from `components.securitySchemes` into a flat, de-duplicated list of\n * `Auth` objects the runtime walks in order.\n *\n * @example\n * `getOperationSecurity({ document, method: 'POST', path: '/pet' })`\n * `// [{ type: 'http', scheme: 'bearer' }]`\n */\nexport function getOperationSecurity({\n document,\n method,\n path,\n}: {\n document: SecurityDocument | null | undefined\n method: string\n path: string\n}): Array<Auth> | undefined {\n if (!document) return undefined\n\n const operation = document.paths?.[path]?.[method.toLowerCase()]\n const requirements = operation?.security ?? document.security\n if (!requirements?.length) return undefined\n\n const definitions = document.components?.securitySchemes ?? {}\n const security: Array<Auth> = []\n const seen = new Set<string>()\n for (const requirement of requirements) {\n for (const [schemeName, scopes] of Object.entries(requirement)) {\n if (seen.has(schemeName)) continue\n seen.add(schemeName)\n const auth = resolveSecurityScheme(definitions[schemeName])\n if (auth) security.push(scopes.length ? { ...auth, scopes } : auth)\n }\n }\n\n return security.length ? security : undefined\n}\n\n/**\n * Serializes the per-operation security into the literal emitted on each generated call's `security`\n * field. The runtime `resolveAuth` helper walks it, calling the configured `auth` resolver per entry.\n *\n * @example\n * `buildSecurityMetadata({ security: [{ type: 'http', scheme: 'bearer' }] }) // \"[{ type: 'http', scheme: 'bearer' }]\"`\n */\nexport function buildSecurityMetadata({ security }: { security?: Array<Auth> }): string | null {\n if (!security?.length) return null\n return `[${security.map(serializeAuth).join(', ')}]`\n}\n","import { getOperationParameters } from '@internals/shared'\nimport type { 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.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` 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 /**\n * Schema reference for the `validator.response` hook, or `null` when response validation is off.\n */\n response: string | null\n /**\n * Schema reference for the `validator.error` hook, or `null` when error validation is off or the\n * operation documents no error responses. The runtime runs this on the error body when a non-2xx\n * call does not throw.\n */\n error: string | null\n /**\n * Zod schema names the generated file imports from the zod plugin output.\n */\n importedZodNames: Array<string>\n}\n\n/**\n * Builds the validator-hook references for one operation. Request 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(node.requestBody?.content?.[0]?.schema)\n const parsesResponse = zodResolver && resolveResponseValidator(validator) === 'zod'\n\n // Success responses validate with the success-only `<operation>ResponseSchema`; error bodies are never zod-parsed on the throw path.\n const response = parsesResponse ? zodResolver.response.response(node) || null : null\n const error = parsesResponse ? buildZodErrorParse(node, zodResolver) : null\n const request = zodResolver && resolveRequestValidator(validator) === 'zod' && hasRequestBody ? zodResolver.response.body(node) || null : null\n\n const paramGroups = getOperationParameters(node)\n const resolveParamsName = (kind: 'path' | 'query' | 'headers', 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\n // Order is output: the generated file imports the response schema, then the error schema, then the request body and params schemas.\n const importedZodNames = [response, error, request, path, query, headers].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, response, error, 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 */\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(', ')} }` : null\n}\n","import { getContentTypeInfo, getResponseContentTypeInfo } from '@internals/shared'\nimport { ast } from '@kubb/kit'\n\n/**\n * Builds the `contentType` entry baked into the call config, or `null` without a request body.\n *\n * `merge` is `true` when the generated function must destructure `contentType` from `options` and\n * merge it over the baked request default, because the caller can also pick a response content type.\n */\nexport function buildContentType({ node }: { node: ast.HttpOperationNode }): { literal: string | null; merge: boolean } {\n const { defaultContentType } = getContentTypeInfo(node)\n const hasRequestBody = Boolean(node.requestBody?.content?.[0]?.schema)\n // The first declared type is the default; the caller overrides it on `contentType`.\n const requestContentType = hasRequestBody ? defaultContentType : null\n\n if (!requestContentType) return { literal: null, merge: false }\n\n // When the caller can also pick a response content type, a partial `{ response }` would replace the\n // baked request default through `...config`, so merge the caller's choice over it instead.\n const merge = getResponseContentTypeInfo(node).isMultipleContentTypes\n\n return {\n merge,\n literal: merge\n ? `contentType: { request: '${requestContentType}', ...(typeof contentType === 'string' ? { request: contentType } : contentType) }`\n : `contentType: { request: '${requestContentType}' }`,\n }\n}\n","import { getOperationParameters } from '@internals/shared'\nimport { isValidVarName } from '@internals/utils'\nimport { ast } from '@kubb/kit'\n\ntype StyledLocation = 'path' | 'query' | 'header' | 'cookie'\n\n/**\n * Renders a parameter name as an object-literal key, quoted when it is not a bare identifier. 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 use a fixed style (`simple` and `form`), so only `explode` is emitted\n * for them. `allowReserved` only applies to query parameters, and `contentType` to every location\n * except path.\n */\nfunction serializeParameter(parameter: ast.ParameterNode): string | null {\n const parts: Array<string> = []\n if ((parameter.in === 'path' || parameter.in === 'query') && parameter.style) parts.push(`style: '${parameter.style}'`)\n if (parameter.explode !== undefined) parts.push(`explode: ${parameter.explode}`)\n if (parameter.in === 'query' && parameter.allowReserved !== undefined) parts.push(`allowReserved: ${parameter.allowReserved}`)\n if (parameter.in !== 'path' && parameter.contentType) parts.push(`contentType: '${parameter.contentType}'`)\n if (parameter.in === 'querystring') parts.push('querystring: true')\n return parts.length > 0 ? `{ ${parts.join(', ')} }` : null\n}\n\n/**\n * Serializes the `encoding` of the request body's default content type into a `{ property: { ... } }`\n * literal, or `null` 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): string | null {\n const content = node.requestBody?.content\n const entries = Object.entries(content?.length === 1 ? (content[0]?.encoding ?? {}) : {}).map(\n ([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 return entries.length > 0 ? `body: { ${entries.join(', ')} }` : null\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 * @example\n * ```ts\n * // a path param with { style: 'matrix', explode: true } and a query param with { explode: false }\n * buildStyles({ node }) // \"{ path: { id: { style: 'matrix', explode: true } }, query: { tags: { explode: false } } }\"\n * ```\n */\nexport function buildStyles({ node }: { node: ast.OperationNode }): string | null {\n if (!ast.isHttpOperationNode(node)) return null\n\n const groups: Record<StyledLocation, Array<string>> = { path: [], query: [], header: [], cookie: [] }\n\n for (const [location, parameters] of Object.entries(getOperationParameters(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 = [\n ...(Object.keys(groups) as Array<StyledLocation>)\n .filter((location) => groups[location].length > 0)\n .map((location) => `${location}: { ${groups[location].join(', ')} }`),\n serializeBodyEncoding(node),\n ].filter(Boolean)\n\n return entries.length > 0 ? `{ ${entries.join(', ')} }` : null\n}\n","import { getResponseType, isEventStream } from '@internals/shared'\nimport type { ast } from '@kubb/kit'\nimport type { ReturnTypeOption } from '../types.ts'\nimport { buildContentType } from './contentType.ts'\nimport { type Auth, buildSecurityMetadata } from './security.ts'\nimport { buildStyles } from './styles.ts'\nimport { buildValidatorLiteral, type ValidatorHooks } from './validator.ts'\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 `throwOnError` fallback is applied after the `...config` spread.\n *\n * `mergeContentType` is `true` when the caller must destructure `contentType` from `options`, and\n * `eventStream` is `true` when the operation returns `text/event-stream`. Unless `returnType` is `'plain'`, a\n * stream's literal leaves the `response` validator to `toEventStream`, which runs it per event.\n */\nexport function buildCallConfig({\n node,\n validatorHooks,\n security,\n throwOnErrorDefault,\n returnType,\n}: {\n node: ast.HttpOperationNode\n validatorHooks: ValidatorHooks | null\n security?: Array<Auth>\n throwOnErrorDefault: boolean\n returnType: ReturnTypeOption\n}): { callConfig: string; mergeContentType: boolean; eventStream: boolean } {\n const eventStream = isEventStream(node)\n const securityLiteral = buildSecurityMetadata({ security })\n const stylesLiteral = buildStyles({ node })\n // Unless `returnType` is `'plain'`, `toEventStream` validates per event, so `response` stays out of the call config.\n const perEvent = eventStream && returnType !== 'plain'\n const validatorLiteral = buildValidatorLiteral(\n validatorHooks,\n perEvent ? ['request', 'path', 'query', 'headers', 'error'] : ['request', 'path', 'query', 'headers', 'response', 'error'],\n )\n const { literal: contentTypeLiteral, merge: mergeContentType } = buildContentType({ node })\n const responseType = getResponseType(node)\n\n const callConfig = `{ ${[\n `method: '${node.method.toUpperCase()}'`,\n `url: '${node.path}'`,\n securityLiteral ? `security: ${securityLiteral}` : null,\n stylesLiteral ? `styles: ${stylesLiteral}` : null,\n validatorLiteral,\n contentTypeLiteral,\n responseType ? `responseType: '${responseType}'` : null,\n '...config',\n `throwOnError: config.throwOnError ?? ${throwOnErrorDefault}`,\n ]\n .filter(Boolean)\n .join(', ')} }`\n\n return { callConfig, mergeContentType, eventStream }\n}\n","import type { ast } from '@kubb/kit'\nimport { getRequestGroupOptionality } from '@internals/shared'\nimport { createFunctionParameter, createFunctionParameters, functionPrinter } from '@kubb/plugin-ts'\nimport type { OperationTypeNames } from '../resolveOperationTypes.ts'\nimport type { ReturnTypeOption } from '../types.ts'\nimport { buildResultType } from './generics.ts'\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\n\n/**\n * The pieces of a generated operation function's grouped-options signature.\n */\nexport type GroupedOptionsSignature = {\n /**\n * The single function parameter: `options: Options<<Name>Options, ThrowOnError>`, 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 `toEventStream(promise)` does not read them.\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 '../resolveOperationTypes.ts'\nimport type { ReturnTypeOption } from '../types.ts'\nimport { buildCallConfig } from './callConfig.ts'\nimport { buildEventStreamReturn, buildReturnStatement } from './returnStatement.ts'\nimport type { Auth } 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 * `text/event-stream` operation is wired to `toEventStream` in one place.\n */\nexport function buildOperationBody({\n node,\n types,\n validatorHooks,\n security,\n returnType,\n throwOnErrorDefault,\n}: {\n node: ast.HttpOperationNode\n types: OperationTypeNames\n validatorHooks: ValidatorHooks | null\n security?: Array<Auth>\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, throwOnErrorDefault, returnType })\n const signature = buildGroupedOptionsSignature({ node, types, returnType, throwOnErrorDefault, eventStream })\n const stream = eventStream ? buildEventStreamReturn({ node, types, callConfig, returnType, validatorHooks, 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 { 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 { Auth } from '../builders/security.ts'\nimport type { ValidatorHooks } from '../builders/validator.ts'\nimport type { OperationTypeNames } from '../resolveOperationTypes.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 `Auth` objects and serialized onto the\n * call config's `security` field for the runtime `auth` resolver to consume.\n */\n security?: Array<Auth>\n}\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 }: Props): KubbReactNode {\n if (!ast.isHttpOperationNode(node)) return null\n\n const body = buildOperationBody({ node, types, validatorHooks, security, 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, { link: 'urlPath', linkPosition: 'beforeDeprecated', splitLines: true }) }}\n >\n {body.mergeContentType\n ? 'const { client: request = client, contentType, ...config } = options'\n : 'const { client: request = client, ...config } = options'}\n <br />\n {body.statement}\n </Function>\n </File.Source>\n )\n}\n","import path from 'node:path'\nimport { isEventStream } from '@internals/shared'\nimport type { ast } from '@kubb/kit'\nimport { File } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx'\n\n/**\n * The `footer` of `.kubb/client.ts`: the `baseURL` set at generation time, and the `sse.ts` re-export when the document\n * streams events, so `ServerSentEvent` and `toEventStream` stay importable from the client as in earlier releases.\n */\nfunction buildClientFooter({ baseURL, sse }: { baseURL?: string; sse: boolean }): string | undefined {\n const baseURLExpression = baseURL ? (baseURL.includes('${') ? `\\`${baseURL.replaceAll('`', '\\\\`')}\\`` : JSON.stringify(baseURL)) : undefined\n return (\n [baseURLExpression ? `client.setConfig({ baseURL: ${baseURLExpression} })` : null, sse ? `export * from './sse.ts'` : null].filter(Boolean).join('\\n') ||\n undefined\n )\n}\n\n/**\n * Writes the footer of the `.kubb/client.ts` the plugin injected, the one place it is built, and copies `sse.ts` into\n * `.kubb/` only for a document with a `text/event-stream` operation, so a document without streams ships no stream runtime.\n * `sse` is set by the plugins that ship the runtime, so a custom client from `@kubb/plugin-client` gets neither file.\n */\nexport function StreamRuntime({ nodes, root, sse, baseURL }: { nodes: Array<ast.OperationNode>; root: string; sse?: string; baseURL?: string }): KubbReactNode {\n if (!sse) return null\n const streams = nodes.some(isEventStream)\n const footer = buildClientFooter({ baseURL, sse: streams })\n return (\n <>\n {streams && <File baseName=\"sse.ts\" path={path.resolve(root, '.kubb/sse.ts')} copy={sse} />}\n {footer && <File baseName=\"client.ts\" path={path.resolve(root, '.kubb/client.ts')} footer={footer} />}\n </>\n )\n}\n","import { type ast, Diagnostics, type Generator, type Group, type Output } from '@kubb/kit'\nimport { pluginTsName, type ResolverTs } from '@kubb/plugin-ts'\nimport { pluginZodName, type ResolverZod } from '@kubb/plugin-zod'\nimport type { ContractClientFactory } from './types.ts'\n\ntype GeneratorDriver = Parameters<NonNullable<Generator<ContractClientFactory>['operations']>>[1]['driver']\n\n/**\n * The two per-operation type names a generated client references: the grouped input and the\n * per-status responses record its `RequestResult` is keyed on.\n */\nexport type OperationTypeNames = {\n response: {\n /**\n * Resolves the name of the operation's grouped `{ body, path, query, headers }` input type.\n */\n options(node: ast.OperationNode): string\n /**\n * Resolves the name of the operation's per-status responses record type.\n */\n responses(node: ast.OperationNode): string\n }\n}\n\n/**\n * Where a generated client sources its operation types, plus the resolver and output the file\n * declaring them is resolved with.\n */\nexport type OperationTypeSource = OperationTypeNames & {\n /**\n * `plugin-ts` shaped resolver of the plugin supplying the names, also used to resolve the file they are exported from.\n */\n resolver: ResolverTs\n /**\n * The supplying plugin's own `output`, when it configured one.\n */\n output: Output | undefined\n /**\n * The supplying plugin's own `group`, when it configured one.\n */\n group: Group | undefined\n}\n\n/**\n * A `plugin-ts` shaped resolver whose operation type names point at the types `pluginZod({ inferred })`\n * exports next to each schema, so code written against `plugin-ts` names picks up the zod types.\n */\nfunction toZodTypeResolver(resolver: ResolverZod): ResolverTs {\n const type = (name: string) => resolver.schema.type(name)\n\n return {\n ...resolver,\n // Class methods, so a spread drops them. `file` reads private fields, and `memo` gets its own key\n // space so these type names never share an entry with the zod names.\n file: resolver.file.bind(resolver),\n memo: (key: string, compute: () => unknown) => resolver.memo(`zodTypes:${key}`, compute),\n param: {\n name: (node: ast.OperationNode, p: ast.ParameterNode) => type(resolver.param.name(node, p)),\n path: (node: ast.OperationNode, p: ast.ParameterNode) => type(resolver.param.path(node, p)),\n query: (node: ast.OperationNode, p: ast.ParameterNode) => type(resolver.param.query(node, p)),\n headers: (node: ast.OperationNode, p: ast.ParameterNode) => type(resolver.param.headers(node, p)),\n },\n response: {\n body: (node: ast.OperationNode) => type(resolver.response.body(node)),\n status: (node: ast.OperationNode, statusCode: ast.StatusCode) => type(resolver.response.status(node, statusCode)),\n response: (node: ast.OperationNode) => type(resolver.response.response(node)),\n responses: (node: ast.OperationNode) => type(resolver.response.responses(node)),\n options: (node: ast.OperationNode) => resolver.response.options(node),\n },\n } as unknown as ResolverTs\n}\n\n/**\n * Picks the plugin generated clients, query hooks, and MCP handlers take their operation types from.\n *\n * `pluginZod({ inferred: 'codec' })` wins, so a codec param takes its domain value. Otherwise `plugin-ts`\n * wins when it is in the pipeline, and without it any `pluginZod({ inferred })`. Throws\n * `KUBB_MISSING_DEPENDENCY` for `pluginName` when neither is available.\n *\n * @example\n * ```ts\n * const types = resolveOperationTypes(ctx.driver, ctx.plugin.name)\n * types.response.options(node) // 'GetPetByIdOptions', or 'GetPetByIdOptionsSchemaType' from zod\n * ```\n */\nexport function resolveOperationTypes(driver: GeneratorDriver, pluginName: string): OperationTypeSource {\n return driver.memo(`operationTypes:${pluginName}`, () => {\n const pluginTs = driver.getPlugin(pluginTsName)\n const pluginZod = driver.getPlugin(pluginZodName)\n\n if (pluginTs && pluginZod?.options?.inferred !== 'codec') {\n const resolver = driver.getResolver(pluginTsName)\n return { response: resolver.response, resolver, output: pluginTs.options?.output, group: pluginTs.options?.group ?? undefined }\n }\n\n if (!pluginZod?.options?.inferred) {\n throw new Diagnostics.Error({\n code: Diagnostics.code.missingDependency,\n severity: 'error',\n message: `Plugin \"${pluginName}\" has no source for operation types.`,\n help: `Add \\`pluginTs()\\` before \"${pluginName}\", or add \\`pluginZod({ inferred: true })\\`.`,\n location: { kind: 'config' },\n plugin: pluginName,\n })\n }\n\n const resolver = toZodTypeResolver(driver.getResolver(pluginZodName))\n return { response: resolver.response, resolver, output: pluginZod.options.output, group: pluginZod.options.group ?? undefined }\n })\n}\n\ndeclare global {\n namespace Kubb {\n interface MemoRegistry {\n operationTypes: OperationTypeSource\n /**\n * Nests every key the zod-backed `ResolverTs` memoizes, so it holds each of their value types.\n */\n zodTypes: unknown\n }\n }\n}\n","import path from 'node:path'\nimport { getEventStream, operationFileEntry, operationKey, resolveDependencyOperationFile } from '@internals/shared'\nimport { ast, defineGenerator } from '@kubb/kit'\nimport type { Generator } from '@kubb/kit'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, jsxRenderer } from '@kubb/renderer-jsx'\nimport { buildEventStreamImports } from '../builders/returnStatement.ts'\nimport { isValidatorEnabled } from '../builders/validatorOptions.ts'\nimport { getOperationSecurity, type SecurityDocument } from '../builders/security.ts'\nimport { buildValidatorHooks } from '../builders/validator.ts'\nimport { Operation } from '../components/Operation.tsx'\nimport { StreamRuntime } from '../components/StreamRuntime.tsx'\nimport { resolveOperationTypes } from '../resolveOperationTypes.ts'\nimport type { ContractClientFactory } from '../types.ts'\n\n/**\n * Builds the built-in per-operation generator shared by the client plugins (`@kubb/plugin-fetch`,\n * `@kubb/plugin-axios`). Emits one async function per OpenAPI operation using the shared\n * `Operation` component: a grouped `<Name>Request` type and a function that forwards a single\n * `options` object to the bundled `client` and returns the `Unwrappable<RequestResult>`. Only the\n * generator `name` and the runtime templates differ between plugins. Every other resolution, import,\n * and rendering step is identical.\n *\n * `sse` is the Server-Sent Events runtime template, copied into `.kubb/sse.ts` only for a document with a\n * `text/event-stream` operation.\n */\nexport function createClientGenerator<TFactory extends ContractClientFactory>(name: string, { sse }: { sse?: string } = {}): Generator<TFactory> {\n return defineGenerator<TFactory>({\n name,\n renderer: jsxRenderer,\n operations(nodes, ctx) {\n return <StreamRuntime nodes={nodes} root={ctx.root} sse={sse} baseURL={ctx.options.baseURL} />\n },\n operation(node, ctx) {\n if (!ast.isHttpOperationNode(node)) return null\n\n const { config, driver, resolver, root } = ctx\n const { output, validator, returnType, throwOnErrorDefault, group, importPath } = ctx.options\n\n const types = resolveOperationTypes(driver, ctx.plugin.name)\n\n const pluginZod = isValidatorEnabled(validator) ? driver.getPlugin(pluginZodName) : null\n const zodResolver = pluginZod ? driver.getResolver(pluginZodName) : null\n\n const importedTypeNames = [types.response.options(node), types.response.responses(node)]\n\n const validatorHooks = buildValidatorHooks({ node, validator, zodResolver })\n const importedZodNames = validatorHooks.importedZodNames\n const operationName = resolver.name(node.operationId)\n\n const meta = {\n name: resolver.resolveName({ key: operationKey(node), name: operationName }),\n file: resolver.file({ ...operationFileEntry(node, node.operationId), root, output, group: group ?? undefined }),\n fileTypes: resolveDependencyOperationFile({\n memo: ctx.memo,\n node,\n resolver: types.resolver,\n root,\n output: types.output ?? output,\n group: types.group,\n }),\n fileZod:\n zodResolver && pluginZod?.options\n ? zodResolver.file({\n ...operationFileEntry(node, node.operationId),\n root,\n output: pluginZod.options.output ?? output,\n group: pluginZod.options?.group ?? undefined,\n })\n : null,\n } as const\n\n const security = getOperationSecurity({\n document: ctx.adapter.document as SecurityDocument | null | undefined,\n method: node.method,\n path: node.path,\n })\n\n // A custom client module is emitted verbatim, so `importPath` is used exactly as configured.\n // The default `.kubb/client.ts` is a file path and is made relative to the operation file.\n const clientPath = importPath ?? path.resolve(root, '.kubb/client.ts')\n const clientRoot = importPath === undefined ? meta.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 ssePath = importPath ?? path.resolve(root, '.kubb/sse.ts')\n const stream = getEventStream(node)\n\n const clientValueImports = (() => {\n if (returnType === 'plain') return ['client']\n if (returnType === 'data') return ['client', 'unwrapResult']\n return ['client', 'withUnwrap']\n })()\n\n const clientTypeImports = (() => {\n if (stream) return { plain: ['Options', 'SuccessOf'], data: ['SuccessOf'], full: ['SuccessOf', 'Unwrappable'] }[returnType]\n if (returnType === 'plain') return ['Options', 'RequestResult']\n if (returnType === 'data') return ['Options', 'UnwrappedResult']\n return ['Options', 'Unwrappable', 'RequestResult']\n })()\n\n return (\n <File\n baseName={meta.file.baseName}\n path={meta.file.path}\n meta={meta.file.meta}\n banner={resolver.default.banner(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n footer={resolver.default.footer(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n >\n <File.Import name={clientValueImports} root={clientRoot} path={clientPath} />\n <File.Import name={clientTypeImports} root={clientRoot} path={clientPath} isTypeOnly />\n {stream && <File.Import name={['toEventStream']} root={clientRoot} path={ssePath} />}\n {stream && <File.Import name={buildEventStreamImports({ returnType, typed: stream === 'event' })} root={clientRoot} path={ssePath} isTypeOnly />}\n\n {meta.fileTypes && importedTypeNames.length > 0 && (\n <File.Import name={Array.from(new Set(importedTypeNames))} root={meta.file.path} path={meta.fileTypes.path} isTypeOnly />\n )}\n\n {meta.fileZod && importedZodNames.length > 0 && <File.Import name={importedZodNames} root={meta.file.path} path={meta.fileZod.path} />}\n {validatorHooks.headers && <File.Import name={['toHeadersStandardSchema']} root={clientRoot} path={standardSchemaPath} />}\n\n <Operation\n name={meta.name}\n node={node}\n types={types}\n validatorHooks={validatorHooks}\n returnType={returnType}\n throwOnErrorDefault={throwOnErrorDefault}\n security={security}\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 { camelCase, createResolver, pascalCase } from '@kubb/kit'\nimport type { PluginContractClient } 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 = createResolver<PluginContractClient>({\n pluginName: 'plugin-contract-client',\n name: resolveOperationName,\n className(name) {\n return ensureValidVarName(pascalCase(name))\n },\n groupName(name) {\n return ensureValidVarName(pascalCase(`${name} Client`))\n },\n propertyName(name) {\n return ensureValidVarName(camelCase(name))\n },\n})\n","import { createClientGenerator } from '@internals/client'\nimport type { PluginClient } from '../types.ts'\n\n/**\n * Built-in operation generator for `@kubb/plugin-client`. Emits one async function per OpenAPI\n * operation using the shared `Operation` component: a grouped `<Name>Request` type and a function\n * that forwards a single `options` object to the user-provided client module and returns the `RequestResult`.\n */\nexport const clientGenerator = createClientGenerator<PluginClient>('client')\n","import { createGroupConfig } from '@internals/shared'\nimport { addGenerator, defineExtension, Resolver, setMacros, setResolver } from '@kubb/kit'\nimport { compatibility } from '../kubb-extension.json'\nimport { version } from '../package.json'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { clientGenerator } from './generators/clientGenerator.tsx'\nimport { defaultMacros, isValidatorEnabled, resolverClient } from '@internals/client'\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: (options) => ({ [pluginTsName]: { optional: true }, [pluginZodName]: { optional: !isValidatorEnabled(options.validator) } }),\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 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(clientGenerator)\n\n return {\n output,\n exclude,\n include,\n override,\n group: createGroupConfig(group),\n importPath,\n baseURL: undefined,\n throwOnErrorDefault,\n validator,\n returnType: 'plain',\n sdk: undefined,\n resolver,\n }\n },\n})\n\nexport default pluginClient\n"],"mappings":";;;;;;;;;;;;;;;;;;AAaA,SAAgB,mBAAmB,MAAyB,MAAc,UAAyC,OAA2B;CAC5I,OAAO;EACL;EACA;EACA,KAAK,KAAK,KAAK,MAAM;EACrB,MAAM,KAAK;CACb;AACF;;;;;;;;;;;;AAaA,SAAgB,+BAA+B,SAO9B;CACf,MAAM,EAAE,MAAM,MAAM,UAAU,MAAM,QAAQ,UAAU;CAEtD,OAAO,KAAK,GAAG,SAAS,WAAW,iBAAiB,KAAK,qBACvD,SAAS,KAAK;EAAE,GAAG,mBAAmB,MAAM,KAAK,WAAW;EAAG;EAAM;EAAQ,OAAO,SAAS,KAAA;CAAU,CAAC,CAC1G;AACF;AA8DA,SAAS,iBAAiB,MAAyB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,MAAM;EAAkB;EAAS;CAAc;CACvD,eAAe,aAAa;GAAG,eAAe,EAAE,UAAU,KAAK;GAAI,gBAAgB,EAAE,UAAU,CAAC,mBAAmB,QAAQ,SAAS,EAAE;CAAE;CACxI,MAAM,SAAS;EACb,MAAM,EACJ,SAAS;GAAE,MAAM;GAAW,QAAQ,EAAE,MAAM,QAAQ;EAAE,GACtD,UAAU,CAAC,GACX,SACA,WAAW,CAAC,GACZ,YACA,sBAAsB,MACtB,YAAY,OACZ,OACA,UAAU,iBACR;EAEJ,MAAM,WAAW,eAAe,SAAS,MAAsB,gBAAgB,YAAY,IAAI;EAE/F,YAAY,QAAQ;EACpB,UAAU,CAAC,GAAG,eAAe,GAAI,QAAQ,UAAU,CAAC,CAAE,CAAC;EACvD,aAAa,eAAe;EAE5B,OAAO;GACL;GACA;GACA;GACA;GACA,OAAO,kBAAkB,KAAK;GAC9B;GACA,SAAS,KAAA;GACT;GACA;GACA,YAAY;GACZ,KAAK,KAAA;GACL;EACF;CACF;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../internals/shared/src/operation.ts","../../../internals/utils/src/reserved.ts","../../../internals/shared/src/resolver.ts","../../../internals/shared/src/group.ts","../kubb-extension.json","../package.json","../../../internals/client/src/builders/validatorOptions.ts","../../../internals/client/src/builders/generics.ts","../../../internals/client/src/builders/returnStatement.ts","../../../internals/client/src/builders/security.ts","../../../internals/client/src/builders/validator.ts","../../../internals/client/src/builders/contentType.ts","../../../internals/client/src/builders/styles.ts","../../../internals/client/src/builders/callConfig.ts","../../../internals/client/src/builders/signature.ts","../../../internals/client/src/builders/operationBody.ts","../../../internals/client/src/components/Operation.tsx","../../../internals/client/src/components/StreamRuntime.tsx","../../../internals/client/src/resolveOperationTypes.ts","../../../internals/client/src/generators/clientGenerator.tsx","../../../internals/client/src/macros.ts","../../../internals/client/src/resolver.ts","../src/generators/clientGenerator.tsx","../src/plugin.ts"],"sourcesContent":["import { ast, type Group, type Memo, type Output, type Resolver, type ResolverFileParams, Url } from '@kubb/kit'\n\n/**\n * Builds the `ResolverFileParams` every operation generator passes to\n * `resolver.file`: a file named `name`, tagged by the operation's first\n * tag (or `'default'`), at the operation's path. Centralizes the entry object\n * that was repeated at dozens of call sites across the client and query plugins.\n *\n * @example\n * ```ts\n * resolver.file(operationFileEntry(node, node.operationId), { root, output, group })\n * ```\n */\nexport function operationFileEntry(node: ast.OperationNode, name: string, extname: ResolverFileParams['extname'] = '.ts'): ResolverFileParams {\n return {\n name,\n extname,\n tag: node.tags[0] ?? 'default',\n path: node.path,\n }\n}\n\n/**\n * Resolves a dependency plugin's generated file for `node.operationId`, cached in `memo` (the\n * build's `ctx.memo`) under the resolver's own plugin name and the operation. Several dependents reading the\n * same dependency for the same operation in one pass (a query plugin's several hook generators, the\n * MCP handler, ...) share one computed name and path instead of each calling `resolver.file` again.\n *\n * @example Cache `plugin-ts`'s file for the current operation\n * ```ts\n * const fileTs = resolveDependencyOperationFile({ memo: ctx.memo, node, resolver: tsResolver, root, output })\n * ```\n */\nexport function resolveDependencyOperationFile(options: {\n memo: Memo\n node: ast.OperationNode\n resolver: Pick<Resolver, 'file' | 'pluginName'>\n root: string\n output: Output\n group?: Group | null\n}): ast.FileNode {\n const { memo, node, resolver, root, output, group } = options\n\n return memo(`${resolver.pluginName}:operationFile:${node.operationId}`, () =>\n resolver.file({ ...operationFileEntry(node, node.operationId), root, output, group: group ?? undefined }),\n )\n}\n\nexport type ContentTypeInfo = {\n contentTypes: string[]\n isMultipleContentTypes: boolean\n contentTypeUnion: string\n defaultContentType: string\n hasFormData: boolean\n}\n\nexport type RequestConfigResolver = {\n response: {\n body(node: ast.OperationNode): string\n }\n}\n\nexport type ResponseStatusNameResolver = {\n response: {\n status(node: ast.OperationNode, statusCode: ast.StatusCode): string\n }\n}\n\nexport type ResponseNameResolver = ResponseStatusNameResolver & {\n response: {\n response(node: ast.OperationNode): string\n }\n}\n\nexport type OperationTypeNameResolver = RequestConfigResolver &\n ResponseNameResolver & {\n param: {\n path(node: ast.OperationNode, param: ast.ParameterNode): string\n query(node: ast.OperationNode, param: ast.ParameterNode): string\n headers(node: ast.OperationNode, param: ast.ParameterNode): string\n }\n }\n\nexport type OperationCommentLink = 'pathTemplate' | 'urlPath' | false | ((node: ast.OperationNode) => string | undefined)\n\nexport type BuildOperationCommentsOptions = {\n link?: OperationCommentLink\n linkPosition?: 'beforeDeprecated' | 'afterDeprecated'\n splitLines?: boolean\n}\n\ntype ResponseLike = {\n statusCode: ast.StatusCode | number | string\n}\n\nexport type OperationParameterGroups = Record<Exclude<ast.ParameterNode['in'], 'querystring'>, Array<ast.ParameterNode>>\n\nexport type ResolveOperationTypeNameOptions = {\n responseStatusNames?: boolean | 'error'\n exclude?: ReadonlyArray<string | undefined>\n order?: 'params-first' | 'body-response-first'\n /**\n * Include the individual `Path`/`Query`/`Headers` group type names. Set to `false` for clients\n * that reference the grouped `Options` type instead of the per-group types.\n */\n includeParams?: boolean\n}\n\nfunction getOperationLink(node: ast.OperationNode, link: OperationCommentLink): string | null {\n if (!link) {\n return null\n }\n\n if (typeof link === 'function') {\n return link(node) ?? null\n }\n\n return node.path ? `{@link ${Url.toPath(node.path)}}` : null\n}\n\n/**\n * Derives the shared `ContentTypeInfo` shape from a list of content types, tracking whether several\n * are present and the union, default, and form-data flags the client uses to pick one.\n */\nfunction buildContentTypeInfo(contentTypes: string[]): ContentTypeInfo {\n const isMultipleContentTypes = contentTypes.length > 1\n\n return {\n contentTypes,\n isMultipleContentTypes,\n contentTypeUnion: isMultipleContentTypes ? contentTypes.map((ct) => JSON.stringify(ct)).join(' | ') : '',\n defaultContentType: contentTypes[0] ?? 'application/json',\n hasFormData: contentTypes.some((ct) => ct === 'multipart/form-data'),\n }\n}\n\nexport function getContentTypeInfo(node: ast.OperationNode): ContentTypeInfo {\n return buildContentTypeInfo(node.requestBody?.content?.map((e) => e.contentType) ?? [])\n}\n\n/**\n * The request-body counterpart for the primary success response: the content types it documents and\n * whether several are present, so the client can let a caller pick which one to accept.\n */\nexport function getResponseContentTypeInfo(node: ast.OperationNode): ContentTypeInfo {\n return buildContentTypeInfo(getPrimarySuccessResponse(node)?.content?.map((e) => e.contentType) ?? [])\n}\n\nexport type ResponseType = 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream'\n\n/**\n * Reads the single base content type of an operation's primary success response, lowercased and\n * stripped of any `; charset=...` suffix. Returns `undefined` when the response declares zero or\n * more than one content type, since neither case has a single type to act on.\n */\nfunction getPrimarySuccessContentType(node: ast.OperationNode): string | undefined {\n const contentTypes = getPrimarySuccessResponse(node)?.content?.map((entry) => entry.contentType) ?? []\n if (contentTypes.length !== 1) return undefined\n return contentTypes[0]!.split(';')[0]!.trim().toLowerCase()\n}\n\n/**\n * The `text/event-stream` content of the primary success response, when it is the only content type. A response that also\n * declares another type stays a normal call with its query hooks.\n */\nfunction getEventStreamContent(node: ast.OperationNode): ast.ContentNode | undefined {\n return getPrimarySuccessContentType(node) === 'text/event-stream' ? getPrimarySuccessResponse(node)?.content?.[0] : undefined\n}\n\n/**\n * Whether an operation streams its primary success response as Server-Sent Events (`text/event-stream`). The client\n * generator uses this to return a typed event stream instead of a one-shot `RequestResult`.\n */\nexport function isEventStream(node: ast.OperationNode): boolean {\n return getEventStreamContent(node) !== undefined\n}\n\n/**\n * How the document types a `text/event-stream` response, as the adapter read it from `itemSchema`: `event` when each item is\n * the parsed event with its own `event` and `data`, `data` when it is only the payload. Returns `null` without an event stream.\n */\nexport function getEventStream(node: ast.OperationNode): 'event' | 'data' | null {\n const content = getEventStreamContent(node)\n return content ? (content.stream?.shape ?? 'data') : null\n}\n\nfunction baseContentType(contentType: string): string {\n return contentType.split(';')[0]!.trim().toLowerCase()\n}\n\nfunction isJsonContentType(baseType: string): boolean {\n return baseType === 'application/json' || baseType.endsWith('+json') || baseType === 'text/json'\n}\n\n/**\n * Parser for one response content entry.\n *\n * JSON stays unset so the runtime detects it. `text/event-stream` is a stream. 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(contentType: string, schema?: ast.SchemaNode | null): ResponseType | undefined {\n const baseType = baseContentType(contentType)\n if (!baseType) return undefined\n if (isJsonContentType(baseType)) return undefined\n if (baseType === 'text/event-stream') return 'stream'\n if (schema?.type === 'blob') return 'blob'\n if (baseType.startsWith('text/')) return 'text'\n if (baseType === 'application/octet-stream' || baseType === 'application/pdf' || /^(image|audio|video)\\//.test(baseType)) return 'blob'\n return undefined\n}\n\n/**\n * Derives the default `responseType` string for an operation from its primary success response.\n *\n * One content type uses {@link responseTypeForContent}. Several content types that all use the same\n * parser collapse to that string, so a call can keep `responseType: 'blob'`. Mixed parsers return\n * `undefined`; {@link getResponseTypeMap} carries the per-type choice.\n */\nexport function getResponseType(node: ast.OperationNode): ResponseType | undefined {\n const entries = getPrimarySuccessResponse(node)?.content ?? []\n if (entries.length === 0) return undefined\n\n const responseTypes = entries.map((entry) => responseTypeForContent(entry.contentType, entry.schema))\n const first = responseTypes[0]\n if (!first) return undefined\n if (responseTypes.every((responseType) => responseType === first)) return first\n return undefined\n}\n\n/**\n * Maps each base content type of a primary success response to its parser when those parsers differ.\n *\n * Keys are lowercased and stripped of parameters. JSON entries are kept as `'json'` so a catch-all\n * entry cannot claim a JSON response. Returns `undefined` when {@link getResponseType} already\n * covers the response with one string, or when no content type needs a parser other than JSON.\n * The runtime matches the response `Content-Type` against this map instead of guessing from the media type.\n */\nexport function getResponseTypeMap(node: ast.OperationNode): Record<string, ResponseType> | undefined {\n if (getResponseType(node)) return undefined\n\n const entries = getPrimarySuccessResponse(node)?.content ?? []\n if (entries.length <= 1) return undefined\n\n const map: Record<string, ResponseType> = {}\n for (const entry of entries) {\n const baseType = baseContentType(entry.contentType)\n const responseType = responseTypeForContent(entry.contentType, entry.schema) ?? (isJsonContentType(baseType) ? 'json' : undefined)\n if (baseType && responseType) map[baseType] = responseType\n }\n\n return Object.values(map).some((responseType) => responseType !== 'json') ? map : undefined\n}\n\n/**\n * Maps a content type to the PascalCase suffix used to name per-content-type variants\n * (e.g. `application/json` → `Json`, `application/xml` → `Xml`, `multipart/form-data` → `FormData`).\n */\nfunction getContentTypeSuffix(contentType: string): string {\n const baseType = contentType.split(';')[0]!.trim()\n if (baseType === 'application/json') return 'Json'\n if (baseType === 'multipart/form-data') return 'FormData'\n if (baseType === 'application/x-www-form-urlencoded') return 'FormUrlEncoded'\n const subtype = baseType.split('/').pop() ?? baseType\n const parts = subtype.split(/[^a-zA-Z0-9]+/).filter(Boolean)\n if (parts.length === 0) return 'Unknown'\n return parts.map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join('')\n}\n\n/**\n * Appends a content-type suffix to a base name, keeping a trailing `Data` segment last\n * (e.g. `AddPetData` + `Json` → `AddPetJsonData`, `AddPetStatus200` + `Xml` → `AddPetStatus200Xml`).\n */\nexport function getPerContentTypeName(baseName: string, suffix: string): string {\n if (baseName.endsWith('Data')) {\n return suffix.endsWith('Data') ? baseName.slice(0, -4) + suffix : `${baseName.slice(0, -4)}${suffix}Data`\n }\n return baseName + suffix\n}\n\nexport type ContentVariantInput = { contentType: string; schema?: ast.SchemaNode | null; keysToOmit?: Array<string> | null }\nexport type ContentVariant = { name: string; suffix: string; schema: ast.SchemaNode; keysToOmit?: Array<string> | null; contentType: string }\n\n/**\n * 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// The request groups come from the grouped params, so `config` drops the data-shape keys to stay\n// assignable to `Options`, which omits them from `RequestConfig`.\nconst requestConfigBaseType = `Partial<Omit<RequestConfig, 'path' | 'query' | 'body' | 'headers' | 'url'>>`\n\nexport function buildRequestConfigType(node: ast.OperationNode): string {\n const request = getContentTypeInfo(node)\n const response = getResponseContentTypeInfo(node)\n\n // Only the ambiguous side is offered: a single-type side has nothing to pick, so it stays baked in\n // the generated call.\n const members = [\n request.isMultipleContentTypes ? `request?: ${request.contentTypeUnion}` : null,\n response.isMultipleContentTypes ? `response?: ${response.contentTypeUnion}` : null,\n ].filter(Boolean)\n\n return members.length ? `${requestConfigBaseType} & { contentType?: { ${members.join('; ')} } }` : requestConfigBaseType\n}\n\n/**\n * Builds the `client?:` option type shared by the generated query hooks (`useQuery`,\n * `useInfiniteQuery`, `useSWR`, ...). Unlike {@link buildRequestConfigType}, it never adds a\n * `contentType?:` member: query hooks wrap GET operations, which carry no request body to select a\n * content type for.\n */\nexport function buildClientOptionType(): string {\n return requestConfigBaseType\n}\n\nexport type RequestGroups = {\n path: boolean\n query: boolean\n body: boolean\n headers: boolean\n}\n\n/**\n * Which of the grouped request options an operation carries.\n */\nexport function getRequestGroups(node: ast.OperationNode): RequestGroups {\n const { path, query, header } = getOperationParameters(node)\n return {\n path: path.length > 0,\n query: query.length > 0,\n body: Boolean(node.requestBody?.content?.[0]?.schema),\n headers: header.length > 0,\n }\n}\n\nexport type RequestGroupOptionality = {\n groups: RequestGroups\n hasRequiredPath: boolean\n hasRequiredQuery: boolean\n hasRequiredHeader: boolean\n /**\n * Whether the grouped request parameter can default to `{}`. True only when no group carries a\n * required member, so every member is safe to omit.\n */\n isOptional: boolean\n}\n\n/**\n * Resolves which grouped request options an operation carries together with whether each group\n * holds a required member. The grouped parameter stays optional only when nothing inside it is\n * required, matching the generated `RequestConfig` type.\n */\nexport function getRequestGroupOptionality(node: ast.OperationNode): RequestGroupOptionality {\n const groups = getRequestGroups(node)\n const { path, query, header } = getOperationParameters(node)\n const hasRequiredPath = path.some((param) => param.required)\n const hasRequiredQuery = query.some((param) => param.required)\n const hasRequiredHeader = header.some((param) => param.required)\n\n return {\n groups,\n hasRequiredPath,\n hasRequiredQuery,\n hasRequiredHeader,\n isOptional: !hasRequiredPath && !hasRequiredQuery && !hasRequiredHeader && !groups.body,\n }\n}\n\nexport type RequestOptionsNameResolver = RequestConfigResolver & {\n response: {\n options(node: ast.OperationNode): string\n }\n}\n\n/**\n * Builds the grouped `{ path, query, body, headers }` parameter for a generated client\n * function, typed from the operation's `Options` (minus `url`). Only the groups the\n * operation actually has are destructured. The trailing `config` parameter carries the\n * runtime `RequestConfig` overrides plus `client`.\n */\nexport function buildRequestParamsSignature(\n node: ast.OperationNode,\n resolver: RequestOptionsNameResolver,\n options: { isConfigurable?: boolean } = {},\n): { signature: string; groups: RequestGroups } {\n const { isConfigurable = true } = options\n const { groups, isOptional } = getRequestGroupOptionality(node)\n\n const names = (['path', 'query', 'body', 'headers'] as const).filter((key) => groups[key])\n\n // 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 }\n}\n\nexport function buildOperationComments(node: ast.OperationNode, options: BuildOperationCommentsOptions = {}): Array<string> {\n const { link = 'pathTemplate', linkPosition = 'afterDeprecated', splitLines = false } = options\n const linkComment = getOperationLink(node, link)\n const comments =\n linkPosition === 'beforeDeprecated'\n ? [node.description && `@description ${node.description}`, node.summary && `@summary ${node.summary}`, linkComment, node.deprecated && '@deprecated']\n : [node.description && `@description ${node.description}`, node.summary && `@summary ${node.summary}`, node.deprecated && '@deprecated', linkComment]\n\n const filteredComments = comments.filter((comment): comment is string => Boolean(comment))\n\n if (!splitLines) {\n return filteredComments\n }\n\n return filteredComments.flatMap((text) => text.split(/\\r?\\n/).map((line) => line.trim())).filter((comment): comment is string => Boolean(comment))\n}\n\nconst operationParameterGroupsByNode = new WeakMap<ast.OperationNode, OperationParameterGroups>()\n\n/**\n * An OpenAPI 3.2 `querystring` parameter is the whole query string, so a form-encoded object becomes one query parameter\n * per property, typed and serialized like any other.\n * Another content type, such as JSON, stays one parameter named after it, and the runtime sends its value as the whole query string.\n */\nfunction spreadQuerystring(param: ast.ParameterNode): Array<ast.ParameterNode> {\n const schema = param.schema.type === 'ref' ? param.schema.schema : param.schema\n const formEncoded = !param.contentType || param.contentType.split(';')[0]!.trim().toLowerCase() === 'application/x-www-form-urlencoded'\n if (schema?.type !== 'object' || !formEncoded) return [param]\n return schema.properties.map((property) =>\n ast.factory.createParameter({ name: property.name, in: 'query', schema: property.schema, required: param.required && property.required }),\n )\n}\n\n/**\n * Groups an operation's parameters by location (`path`/`query`/`header`/`cookie`), deduping each\n * group by name. Every plugin generator visiting the same `OperationNode` shares one AST instance\n * (see `KubbDriver`), so the result is cached per node to avoid re-filtering and re-deduping the\n * same parameters once per plugin.\n */\nexport function getOperationParameters(node: ast.OperationNode): OperationParameterGroups {\n const cached = operationParameterGroupsByNode.get(node)\n if (cached) return cached\n\n // A malformed spec can declare the same name twice within one location. Both would resolve to the\n // same output property, so emitting both would yield an object type with a duplicate member,\n // which TypeScript rejects. Keep the first.\n const dedupe = (params: Array<ast.ParameterNode>) => {\n const seen = new Set<string>()\n return params.filter((param) => {\n if (seen.has(param.name)) return false\n seen.add(param.name)\n return true\n })\n }\n const group = (location: ast.ParameterNode['in']) => dedupe(node.parameters.filter((param) => param.in === location))\n\n const groups: OperationParameterGroups = {\n path: group('path'),\n query: dedupe([...group('query'), ...group('querystring').flatMap(spreadQuerystring)]),\n header: group('header'),\n cookie: group('cookie'),\n }\n\n operationParameterGroupsByNode.set(node, groups)\n return groups\n}\n\n/**\n * Builds the combined `{ body, path, query, headers }` options object schema for an operation,\n * referencing the already-resolved body and grouped param names. Shared by `@kubb/plugin-ts`'s\n * `Options` type and `@kubb/plugin-zod`'s inferred options schema, so both printers emit the same\n * shape from the same inputs. `primitive: 'object'` is a no-op for the TS printer and tells the Zod\n * printer to emit `z.object(…)` rather than a record.\n */\nexport function 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\nexport function buildOptionsSchema(node: ast.OperationNode, resolver: OperationTypeNameResolver, { pairContentTypes = false } = {}): ast.SchemaNode {\n const { path, query, header } = getOperationParameters(node)\n const hasBody = Boolean(node.requestBody?.content?.[0]?.schema)\n const createNever = () => ast.factory.createSchema({ type: 'never', primitive: undefined, optional: true })\n const groups = [\n { name: 'path', params: path, resolve: resolver.param.path },\n { name: 'query', params: query, resolve: resolver.param.query },\n { name: 'headers', params: header, resolve: resolver.param.headers },\n ] as const\n\n 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, schema: body }),\n ...groups.map(({ name, params, resolve }) => {\n const required = params.some((param) => param.required)\n\n return ast.factory.createProperty({\n name,\n required,\n schema:\n params.length > 0\n ? ast.factory.createSchema({ type: 'ref', name: resolve.call(resolver.param, node, params[0]!), optional: !required })\n : createNever(),\n })\n }),\n ...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`.\n return ast.factory.createSchema({\n type: 'union',\n members: variants.map((variant, index) =>\n 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: 'object',\n primitive: 'object',\n properties: [\n ast.factory.createProperty({\n name: 'request',\n required: true,\n schema: ast.factory.createSchema({ type: 'enum', enumValues: [variant.contentType] }),\n }),\n ],\n }),\n }),\n ]),\n ),\n })\n}\n\n/**\n * The schema a status occupies in the `<Name>Responses` record. A status that documents several\n * content types becomes a `{ contentType; data }` union so the runtime can surface the negotiated type\n * on `result.parsed`, while the standalone `<Name>StatusNNN` alias stays the plain body union that the\n * query hooks and `result.data` use.\n */\nfunction buildResponseRecordEntry(node: ast.OperationNode, res: ast.ResponseNode, resolver: ResponseStatusNameResolver): ast.SchemaNode {\n const statusName = resolver.response.status(node, res.statusCode)\n const variants = (res.content ?? []).filter((entry) => entry.schema)\n if (variants.length <= 1) {\n return ast.factory.createSchema({ type: 'ref', name: statusName })\n }\n\n return ast.factory.createSchema({\n type: 'union',\n members: resolveContentTypeVariants(variants, statusName).map((variant) =>\n ast.factory.createSchema({\n type: 'object',\n primitive: 'object',\n properties: [\n ast.factory.createProperty({\n name: 'contentType',\n required: true,\n schema: ast.factory.createSchema({ type: 'enum', enumValues: [variant.contentType] }),\n }),\n ast.factory.createProperty({\n name: 'data',\n required: true,\n schema: ast.factory.createSchema({ type: 'ref', name: variant.name }),\n }),\n ],\n }),\n ),\n })\n}\n\n/**\n * Builds the per-status `<Name>Responses` record for an operation, referencing the already-resolved\n * `<Name>StatusNNN` names. Shared by `@kubb/plugin-ts`'s `Responses` type and `@kubb/plugin-zod`'s\n * inferred responses schema, so both emit the same shape from the same inputs.\n *\n * Always emits the keyed record, even when an operation declares no responses. An operation with no\n * responses renders as an empty object, which keeps every consumer's import (for example the axios\n * SDK's `RequestResult<XResponses>`) resolvable instead of pointing at a missing export.\n */\nexport function buildResponses(node: ast.OperationNode, resolver: ResponseStatusNameResolver): ast.SchemaNode {\n return ast.factory.createSchema({\n type: 'object',\n primitive: 'object',\n properties: node.responses.map((res) =>\n ast.factory.createProperty({\n name: String(res.statusCode),\n required: true,\n schema: buildResponseRecordEntry(node, res, resolver),\n }),\n ),\n })\n}\n\nexport function getStatusCodeNumber(statusCode: ast.StatusCode | number | string): number | null {\n const code = Number(statusCode)\n\n return Number.isNaN(code) ? null : code\n}\n\nexport function isSuccessStatusCode(statusCode: ast.StatusCode | number | string): boolean {\n const code = getStatusCodeNumber(statusCode)\n\n return code !== null && code >= 200 && code < 300\n}\n\nexport function isErrorStatusCode(statusCode: ast.StatusCode | number | string): boolean {\n const code = getStatusCodeNumber(statusCode)\n\n return code !== null && code >= 400\n}\n\nexport function getSuccessResponses<TResponse extends ResponseLike>(responses: ReadonlyArray<TResponse>): Array<TResponse> {\n return responses.filter((response) => isSuccessStatusCode(response.statusCode))\n}\n\nexport function getOperationSuccessResponses(node: ast.OperationNode): Array<ast.ResponseNode> {\n return getSuccessResponses(node.responses)\n}\n\nexport function getPrimarySuccessResponse(node: ast.OperationNode): ast.ResponseNode | null {\n return getOperationSuccessResponses(node)[0] ?? null\n}\n\nexport function resolveErrorNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses.filter((response) => isErrorStatusCode(response.statusCode)).map((response) => resolver.response.status(node, response.statusCode))\n}\n\nexport function resolveSuccessNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses.filter((response) => isSuccessStatusCode(response.statusCode)).map((response) => resolver.response.status(node, response.statusCode))\n}\n\nexport function resolveStatusCodeNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses.map((response) => resolver.response.status(node, response.statusCode))\n}\n\n/**\n * Lists the type names an operation's types file declares, computed once per resolver and `options` so every\n * dependent reads the same list.\n */\nexport function resolveOperationTypeNames(\n node: ast.OperationNode,\n resolver: OperationTypeNameResolver & Pick<Resolver, 'memo'>,\n options: ResolveOperationTypeNameOptions = {},\n): string[] {\n const key = `${node.operationId}\\0${options.order ?? ''}\\0${options.responseStatusNames ?? ''}\\0${options.includeParams === false ? 'noparams' : ''}\\0${(options.exclude ?? []).join(',')}`\n return resolver.memo(`operationTypeNames:${key}`, () => {\n const { path, query, header } = getOperationParameters(node)\n const responseStatusNames =\n options.responseStatusNames === 'error'\n ? resolveErrorNames(node, resolver)\n : options.responseStatusNames === false\n ? []\n : resolveStatusCodeNames(node, resolver)\n const exclude = new Set(options.exclude ?? [])\n const paramNames =\n options.includeParams === false\n ? []\n : [\n ...path.map((param) => resolver.param.path(node, param)),\n ...query.map((param) => resolver.param.query(node, param)),\n ...header.map((param) => resolver.param.headers(node, param)),\n ]\n const bodyAndResponseNames = [node.requestBody?.content?.[0]?.schema ? resolver.response.body(node) : null, resolver.response.response(node)]\n const names =\n options.order === 'body-response-first'\n ? [...bodyAndResponseNames, ...paramNames, ...responseStatusNames]\n : [...paramNames, ...bodyAndResponseNames, ...responseStatusNames]\n\n return names.filter((name): name is string => Boolean(name) && !exclude.has(name as string))\n })\n}\n\nexport function resolveResponseTypes(node: ast.OperationNode, resolver: ResponseNameResolver): Array<[statusCode: number | 'default', typeName: string]> {\n const types: Array<[number | 'default', string]> = []\n\n for (const response of node.responses) {\n if (response.statusCode === 'default') {\n types.push(['default', resolver.response.response(node)])\n continue\n }\n\n const code = getStatusCodeNumber(response.statusCode)\n if (code === null) {\n continue\n }\n\n types.push([code, isSuccessStatusCode(code) ? resolver.response.response(node) : resolver.response.status(node, response.statusCode)])\n }\n\n return types\n}\n","/**\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 { ensureValidVarName, toFilePath } from '@internals/utils'\nimport { ast, camelCase } from '@kubb/kit'\nimport type { GeneratorContext, Resolver, ResolverFile } from '@kubb/kit'\n\n/**\n * The shared top-level `name` of the operation plugins, computed once per operation name and build.\n */\nexport function resolveOperationName(this: Resolver, name: string): string {\n return this.memo(`operation:${name}`, () => ensureValidVarName(camelCase(name)))\n}\n\n/**\n * Builds the allocation key for a declaration an operation owns. `scope` names which declaration\n * it is, so two of them never share an allocation even when a custom resolver gives both the same\n * name. Leave `scope` empty for the operation's own declaration.\n *\n * @example\n * ```ts\n * resolver.resolveName({ key: operationKey(node, 'response', 'status', 404), name })\n * ```\n */\nexport function operationKey(node: ast.OperationNode, ...scope: Array<string | number>): Array<string | undefined> {\n return ['operation', node.method, node.path, ...scope.map(String)]\n}\n\n/**\n * The `param` namespace shared by the schema-producing plugins (ts, zod, faker):\n * per-parameter names plus the grouped `Path`/`Query`/`Headers` 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}\n\n/**\n * The `response` namespace shared by the schema-producing plugins: per-status,\n * body, and combined response names, all routed through the plugin's top-level\n * `name` casing.\n */\nexport type OperationResponseResolver = {\n status(this: Resolver, node: ast.OperationNode, statusCode: ast.StatusCode): string\n body(this: Resolver, node: ast.OperationNode): string\n responses(this: Resolver, node: ast.OperationNode): string\n response(this: Resolver, node: ast.OperationNode): string\n}\n\n/**\n * Builds the shared `param` namespace. Spread the result into `createResolver`\n * and override individual methods next to it when a plugin deviates.\n *\n * @example\n * ```ts\n * createResolver<PluginTs>({ param: createOperationParamResolver(), ... })\n * ```\n */\nexport function createOperationParamResolver(): OperationParamResolver {\n return {\n name(node, param) {\n const name = this.name(`${node.operationId} ${param.in} ${param.name}`)\n return this.resolveName({ key: operationKey(node, 'param', 'name', param.in, param.name), name })\n },\n path(node) {\n const name = this.name(`${node.operationId} Path`)\n return this.resolveName({ key: operationKey(node, 'param', 'path'), name })\n },\n query(node) {\n const name = this.name(`${node.operationId} Query`)\n return this.resolveName({ key: operationKey(node, 'param', 'query'), name })\n },\n headers(node) {\n const name = this.name(`${node.operationId} Headers`)\n return this.resolveName({ key: operationKey(node, 'param', 'headers'), name })\n },\n }\n}\n\n/**\n * Builds the shared `response` namespace. Spread the result into\n * `createResolver` and add plugin-specific methods (`options`, `error`) next\n * to it.\n *\n * @example\n * ```ts\n * createResolver<PluginTs>({ response: { ...createOperationResponseResolver(), options(node) {...} }, ... })\n * ```\n */\nexport function createOperationResponseResolver(): OperationResponseResolver {\n return {\n status(node, statusCode) {\n const name = this.name(`${node.operationId} Status ${statusCode}`)\n return this.resolveName({ key: operationKey(node, 'response', 'status', statusCode), name })\n },\n body(node) {\n const name = this.name(`${node.operationId} Body`)\n return this.resolveName({ key: operationKey(node, 'response', 'body'), name })\n },\n responses(node) {\n const name = this.name(`${node.operationId} Responses`)\n return this.resolveName({ key: operationKey(node, 'response', 'responses'), name })\n },\n response(node) {\n const name = this.name(`${node.operationId} Response`)\n return this.resolveName({ key: operationKey(node, 'response', 'response'), name })\n },\n }\n}\n\n/**\n * Builds a resolver `file` override whose base name runs every path segment\n * through `toFilePath`, casing the final segment with `caseLast`.\n *\n * @example\n * ```ts\n * createResolver<PluginTs>({ file: createCasedFile(pascalCase), ... })\n * ```\n */\nexport function createCasedFile(caseLast: (part: string) => string): ResolverFile {\n return {\n baseName({ name, extname }) {\n return this.memo(`file:${name}\\0${extname}`, (): ast.FileNode['baseName'] => `${toFilePath(name, caseLast)}${extname}`)\n },\n }\n}\n\ntype SchemaIndexContext = Pick<GeneratorContext, 'memo' | 'driver'>\n\n/**\n * Names of the schemas in a circular reference chain, computed once per build.\n */\nexport function getCircularNames(ctx: SchemaIndexContext): ReadonlySet<string> {\n return ctx.memo('circularNames:set', () => ast.findCircularSchemas(ctx.driver.inputNode?.schemas ?? []))\n}\n\n/**\n * Names of the schemas whose type is `enum`, computed once per build.\n */\nexport function getEnumNames(ctx: SchemaIndexContext): ReadonlySet<string> {\n return ctx.memo(\n 'enumNames:set',\n () => new Set((ctx.driver.inputNode?.schemas ?? []).flatMap((schema) => (schema.type === 'enum' && schema.name ? [schema.name] : []))),\n )\n}\n\ndeclare global {\n namespace Kubb {\n interface MemoRegistry {\n operation: string\n file: ast.FileNode['baseName']\n operationTypeNames: Array<string>\n }\n }\n}\n","import { camelCase, type Group } from '@kubb/kit'\n\n/**\n * Builds the `group` config a Kubb plugin passes to `ctx.setOptions`, applying the\n * shared default naming so every plugin groups output consistently:\n *\n * - `path` groups use the second path segment (`/pet/findByStatus` → `pet`).\n * - other groups use the camelCased group (`pet store` → `petStore`).\n *\n * A user-provided `group.name` always wins over the default namer, so callers stay in\n * control of their output folders. Returns `null` when grouping is disabled, matching the\n * per-plugin convention.\n *\n * @param group - The user-supplied group option, or `undefined` to disable grouping.\n *\n * @example\n * ```ts\n * createGroupConfig(group) // shared across every plugin\n * ```\n */\nexport function createGroupConfig(group: Group | undefined): Group | null {\n if (!group) {\n return null\n }\n\n const defaultName = (ctx: { group: string }): string => {\n if (group.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n\n return camelCase(ctx.group)\n }\n\n return {\n ...group,\n name: group.name ? group.name : defaultName,\n } satisfies Group\n}\n","","","import { isSuccessStatusCode } from '@internals/shared'\nimport type { ast } from '@kubb/kit'\nimport type { ResolverZod } from '@kubb/plugin-zod'\nimport type { ValidatorOptions } from '../types.ts'\n\n/**\n * Returns `true` when any direction of the validator uses zod (used for dependency checks).\n */\nexport function isValidatorEnabled(validator: ValidatorOptions | undefined): boolean {\n if (!validator) return false\n if (validator === 'zod') return true\n return Boolean(validator.request || validator.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 * Resolves the zod schema name a generated client validates an error body with on the non-throw path.\n * Uses the error-only `<operation>ErrorSchema` (the union of non-2xx statuses); returns `null` when the\n * operation documents no error responses with a schema.\n */\nexport function buildZodErrorParse(node: ast.OperationNode, zodResolver: ResolverZod): string | null {\n const hasErrorResponse = node.responses.some((res) => !isSuccessStatusCode(res.statusCode) && res.content?.some((entry) => entry.schema))\n if (!hasErrorResponse) return null\n return zodResolver.response.error?.(node) || null\n}\n","import type { ast } from '@kubb/kit'\nimport type { OperationTypeNames } from '../resolveOperationTypes.ts'\nimport type { ReturnTypeOption } from '../types.ts'\n\n/**\n * Builds the `RequestResult` generic arguments for one operation: the per-status responses record\n * plus the per-call `ThrowOnError` flag. `SuccessOf` / `ErrorOf` split the record inside the\n * runtime, so this only names the record and threads `ThrowOnError`.\n *\n * @example\n * `buildRequestResultGenerics({ node, types }) // 'AddPetResponses, ThrowOnError'`\n */\nexport function buildRequestResultGenerics({ node, types }: { node: ast.OperationNode; types: OperationTypeNames }): string {\n return `${types.response.responses(node)}, ThrowOnError`\n}\n\n/**\n * Builds the full return type an operation's function signature uses: `Unwrappable<RequestResult>`\n * for the default `returnType: 'full'`, already a promise so no further wrapping is needed, a plain\n * `Promise<RequestResult>` for the internal `'plain'` shape, or a\n * `Promise` of the runtime's `UnwrappedResult` when `returnType: 'data'` narrows a resolved call\n * down to the bare success body.\n *\n * @example\n * `buildResultType({ node, types, returnType: 'data' }) // 'Promise<UnwrappedResult<AddPetResponses, ThrowOnError>>'`\n */\nexport function buildResultType({ node, types, returnType }: { node: ast.OperationNode; types: OperationTypeNames; returnType: ReturnTypeOption }): string {\n const generics = buildRequestResultGenerics({ node, types })\n if (returnType === 'data') return `Promise<UnwrappedResult<${generics}>>`\n if (returnType === 'plain') return `Promise<RequestResult<${generics}>>`\n return `Unwrappable<RequestResult<${generics}>>`\n}\n","import { getEventStream, hasRequestContentTypeChoice } from '@internals/shared'\nimport type { ast } from '@kubb/kit'\nimport type { OperationTypeNames } from '../resolveOperationTypes.ts'\nimport type { ReturnTypeOption } from '../types.ts'\nimport type { ValidatorHooks } from './validator.ts'\nimport { buildRequestResultGenerics, buildResultType } from './generics.ts'\n\n/**\n * Builds the return statement of a generated operation function. With the default\n * `returnType: 'full'` the runtime call already resolves to `{ data, error, request, response }`.\n * The generated code casts that result to the operation's `RequestResult`, then wraps it with\n * `withUnwrap`, so the caller can `await` it directly or call `.unwrap()` for the bare success\n * body. With `returnType: 'data'` it instead routes the call through the runtime's `unwrapResult`,\n * which narrows the resolved value down to the bare success body the same way `RequestResult`\n * already does, using the plugin default when the call leaves `throwOnError` unset.\n * With `returnType: 'plain'` it returns the runtime call as is, cast to `RequestResult`, with no helper.\n *\n * Cast first, wrap second, for the `'full'` path. That order keeps `withUnwrap`'s generic inferred\n * as `RequestResult` instead of the runtime's own internal result type. Casting an `Unwrappable<A>`\n * straight to `Unwrappable<B>` does not work: the `.then` overload stays pinned to `A`, and `as`\n * rejects that two-generic swap even where `A` and `B` on their own would satisfy it.\n *\n * @example\n * `return withUnwrap(request({ method: 'POST', url: '/pet', ...config }) as Promise<RequestResult<AddPetResponses, ThrowOnError>>)`\n * @example\n * `return unwrapResult(request({ method: 'POST', url: '/pet', ...config }), config.throwOnError ?? false) as Promise<UnwrappedResult<AddPetResponses, ThrowOnError>>`\n * @example\n * `return request({ method: 'POST', url: '/pet', ...config }) as Promise<RequestResult<AddPetResponses, ThrowOnError>>`\n */\nexport function buildReturnStatement({\n node,\n types,\n callConfig,\n returnType,\n throwOnErrorDefault,\n}: {\n node: ast.OperationNode\n types: OperationTypeNames\n callConfig: string\n returnType: ReturnTypeOption\n throwOnErrorDefault: boolean\n}): string {\n // The options of a body offered in several media types are a union, so the body type cannot be inferred from `config`.\n // A `'plain'` client is the caller's own function, which takes no type argument.\n const request = returnType !== 'plain' && hasRequestContentTypeChoice(node) ? `request<${types.response.options(node)}['body']>` : 'request'\n if (returnType === 'data') {\n const resultType = buildResultType({ node, types, returnType })\n return `return unwrapResult(${request}(${callConfig}), config.throwOnError ?? ${throwOnErrorDefault}) as ${resultType}`\n }\n if (returnType === 'plain') {\n return `return ${request}(${callConfig}) as Promise<RequestResult<${buildRequestResultGenerics({ node, types })}>>`\n }\n return `return withUnwrap(${request}(${callConfig}) as Promise<RequestResult<${buildRequestResultGenerics({ node, types })}>>)`\n}\n\n/**\n * Builds the return type and statement of a `text/event-stream` operation. The item type is `TypedEvent<...>` when each item\n * declares its own `event` and `data`, and otherwise the payload type, which `EventStreamResult` wraps in `ServerSentEvent`. The call's\n * promise goes through `toEventStream` with the `client` for its defaults, the call's `config`, the shape and the per-event\n * validator. A `returnType: 'plain'` client receives only the promise,\n * `toEventStream(request(config))`, and keeps its response validator in the call config.\n */\nexport function buildEventStreamReturn({\n node,\n types,\n callConfig,\n returnType,\n validatorHooks,\n throwOnErrorDefault,\n}: {\n node: ast.HttpOperationNode\n types: OperationTypeNames\n callConfig: string\n returnType: ReturnTypeOption\n validatorHooks: ValidatorHooks | null\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 success = `SuccessOf<${responses}>`\n const eventType = shape === 'event' ? `TypedEvent<${success}>` : success\n if (returnType === 'plain') {\n return { returnType: `Promise<EventStreamResult<${eventType}>>`, statement: `return toEventStream<${eventType}>(request(${callConfig}))` }\n }\n\n const generics = `${responses}, ThrowOnError${shape === 'event' ? `, ${eventType}` : ''}`\n const meta = [`shape: '${shape}'`, validatorHooks?.response ? `validator: ${validatorHooks.response}` : null].filter(Boolean).join(', ')\n const call = `toEventStream<${eventType}>(request(${callConfig}), { client: request, config, ${meta} })`\n if (returnType === 'data') {\n const result = `Promise<UnwrappedStreamResult<${generics}>>`\n return { returnType: result, statement: `return unwrapResult(${call}, config.throwOnError ?? ${throwOnErrorDefault}) as ${result}` }\n }\n return { returnType: `Unwrappable<StreamResult<${generics}>>`, statement: `return withUnwrap(${call} as Promise<StreamResult<${generics}>>)` }\n}\n\n/** The stream types an operation file imports: `StreamResult` and `StreamOptions`, `EventStreamResult` for a plain client, and `TypedEvent` for named events. */\nexport function buildEventStreamImports({ returnType, typed }: { returnType: ReturnTypeOption; typed: boolean }): Array<string> {\n const result = { plain: ['EventStreamResult'], full: ['StreamResult', 'StreamOptions'], data: ['UnwrappedStreamResult', 'StreamOptions'] }[returnType]\n return [...result, ...(typed ? ['TypedEvent'] : [])]\n}\n","/**\n * A resolved security scheme as emitted on each generated call's `security` array. The runtime calls\n * the configured `auth` resolver with this object and places the returned token: `http` bearer/basic\n * on `Authorization`, `apiKey` under `name` in the header/query/cookie, and `oauth2`/`openIdConnect`\n * as a bearer token.\n */\nexport type Auth = {\n type: 'http' | 'apiKey' | 'oauth2' | 'openIdConnect'\n scheme?: 'bearer' | 'basic'\n name?: string\n in?: 'header' | 'query' | 'cookie'\n scopes?: Array<string>\n}\n\n/**\n * A single OpenAPI security requirement read from the spec: scheme name to the scopes it needs.\n */\ntype SecurityRequirement = Record<string, Array<string>>\n\n/**\n * The slice of an OpenAPI document the security derivation reads: the global `security`, the\n * per-operation `security` under `paths`, and the `securitySchemes` map under `components`. Typed\n * locally so this package stays independent of the OpenAPI adapter.\n */\nexport type SecurityDocument = {\n security?: Array<SecurityRequirement>\n components?: {\n securitySchemes?: Record<string, OasSecurityScheme | { $ref: string } | undefined>\n }\n paths?: Record<string, Record<string, { security?: Array<SecurityRequirement> } | undefined> | undefined>\n}\n\ntype OasSecurityScheme = { type: 'http'; scheme?: string } | { type: 'apiKey'; name?: string; in?: string } | { type: 'oauth2' } | { type: 'openIdConnect' }\n\nfunction serializeAuth(auth: Auth): string {\n const parts = [`type: '${auth.type}'`]\n if (auth.scheme) parts.push(`scheme: '${auth.scheme}'`)\n if (auth.name) parts.push(`name: '${auth.name}'`)\n if (auth.in) parts.push(`in: '${auth.in}'`)\n if (auth.scopes?.length) parts.push(`scopes: [${auth.scopes.map((scope) => `'${scope}'`).join(', ')}]`)\n return `{ ${parts.join(', ')} }`\n}\n\n/**\n * Maps an OpenAPI security scheme to the inline `Auth` object, or `null` when the runtime cannot\n * place it (an unresolved `$ref`, or an `apiKey` without a name or outside `header` / `query` /\n * `cookie`). `http` schemes other than `basic` are treated as bearer.\n */\nexport function resolveSecurityScheme(scheme: OasSecurityScheme | { $ref: string } | undefined): Auth | null {\n if (!scheme || '$ref' in scheme) return null\n if (scheme.type === 'apiKey') {\n if (!scheme.name || (scheme.in !== 'header' && scheme.in !== 'query' && scheme.in !== 'cookie')) return null\n return { type: 'apiKey', name: scheme.name, in: scheme.in }\n }\n if (scheme.type === 'http') return { type: 'http', scheme: scheme.scheme?.toLowerCase() === 'basic' ? 'basic' : 'bearer' }\n if (scheme.type === 'oauth2') return { type: 'oauth2' }\n if (scheme.type === 'openIdConnect') return { type: 'openIdConnect' }\n return null\n}\n\n/**\n * Derives the per-operation security metadata from the OpenAPI document. The operation's own\n * `security` overrides the global `security` (an explicit empty array disables auth), and every\n * referenced scheme is resolved from `components.securitySchemes` into a flat, de-duplicated list of\n * `Auth` objects the runtime walks in order.\n *\n * @example\n * `getOperationSecurity({ document, method: 'POST', path: '/pet' })`\n * `// [{ type: 'http', scheme: 'bearer' }]`\n */\nexport function getOperationSecurity({\n document,\n method,\n path,\n}: {\n document: SecurityDocument | null | undefined\n method: string\n path: string\n}): Array<Auth> | undefined {\n if (!document) return undefined\n\n const operation = document.paths?.[path]?.[method.toLowerCase()]\n const requirements = operation?.security ?? document.security\n if (!requirements?.length) return undefined\n\n const definitions = document.components?.securitySchemes ?? {}\n const security: Array<Auth> = []\n const seen = new Set<string>()\n for (const requirement of requirements) {\n for (const [schemeName, scopes] of Object.entries(requirement)) {\n if (seen.has(schemeName)) continue\n seen.add(schemeName)\n const auth = resolveSecurityScheme(definitions[schemeName])\n if (auth) security.push(scopes.length ? { ...auth, scopes } : auth)\n }\n }\n\n return security.length ? security : undefined\n}\n\n/**\n * Serializes the per-operation security into the literal emitted on each generated call's `security`\n * field. The runtime `resolveAuth` helper walks it, calling the configured `auth` resolver per entry.\n *\n * @example\n * `buildSecurityMetadata({ security: [{ type: 'http', scheme: 'bearer' }] }) // \"[{ type: 'http', scheme: 'bearer' }]\"`\n */\nexport function buildSecurityMetadata({ security }: { security?: Array<Auth> }): string | null {\n if (!security?.length) return null\n return `[${security.map(serializeAuth).join(', ')}]`\n}\n","import { getOperationParameters } from '@internals/shared'\nimport type { 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.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` 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 /**\n * Schema reference for the `validator.response` hook, or `null` when response validation is off.\n */\n response: string | null\n /**\n * Schema reference for the `validator.error` hook, or `null` when error validation is off or the\n * operation documents no error responses. The runtime runs this on the error body when a non-2xx\n * call does not throw.\n */\n error: string | null\n /**\n * Zod schema names the generated file imports from the zod plugin output.\n */\n importedZodNames: Array<string>\n}\n\n/**\n * Builds the validator-hook references for one operation. Request 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(node.requestBody?.content?.[0]?.schema)\n const parsesResponse = zodResolver && resolveResponseValidator(validator) === 'zod'\n\n // Success responses validate with the success-only `<operation>ResponseSchema`; error bodies are never zod-parsed on the throw path.\n const response = parsesResponse ? zodResolver.response.response(node) || null : null\n const error = parsesResponse ? buildZodErrorParse(node, zodResolver) : null\n const request = zodResolver && resolveRequestValidator(validator) === 'zod' && hasRequestBody ? zodResolver.response.body(node) || null : null\n\n const paramGroups = getOperationParameters(node)\n const resolveParamsName = (kind: 'path' | 'query' | 'headers', 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\n // Order is output: the generated file imports the response schema, then the error schema, then the request body and params schemas.\n const importedZodNames = [response, error, request, path, query, headers].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, response, error, 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 */\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(', ')} }` : null\n}\n","import { getContentTypeInfo, getResponseContentTypeInfo } from '@internals/shared'\nimport { ast } from '@kubb/kit'\n\n/**\n * Builds the `contentType` entry baked into the call config, or `null` without a request body.\n *\n * `merge` is `true` when the generated function must destructure `contentType` from `options` and\n * merge it over the baked request default, because the caller can also pick a response content type.\n */\nexport function buildContentType({ node }: { node: ast.HttpOperationNode }): { literal: string | null; merge: boolean } {\n const { defaultContentType } = getContentTypeInfo(node)\n const hasRequestBody = Boolean(node.requestBody?.content?.[0]?.schema)\n // The first declared type is the default; the caller overrides it on `contentType`.\n const requestContentType = hasRequestBody ? defaultContentType : null\n\n if (!requestContentType) return { literal: null, merge: false }\n\n // When the caller can also pick a response content type, a partial `{ response }` would replace the\n // baked request default through `...config`, so merge the caller's choice over it instead.\n const merge = getResponseContentTypeInfo(node).isMultipleContentTypes\n\n return {\n merge,\n literal: merge\n ? `contentType: { request: '${requestContentType}', ...(typeof contentType === 'string' ? { request: contentType } : contentType) }`\n : `contentType: { request: '${requestContentType}' }`,\n }\n}\n","import { getOperationParameters } from '@internals/shared'\nimport { isValidVarName } from '@internals/utils'\nimport { ast } from '@kubb/kit'\n\ntype StyledLocation = 'path' | 'query' | 'header' | 'cookie'\n\n/**\n * Renders a parameter name as an object-literal key, quoted when it is not a bare identifier. 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 use a fixed style (`simple` and `form`), so only `explode` is emitted\n * for them. `allowReserved` only applies to query parameters, and `contentType` to every location\n * except path.\n */\nfunction serializeParameter(parameter: ast.ParameterNode): string | null {\n const parts: Array<string> = []\n if ((parameter.in === 'path' || parameter.in === 'query') && parameter.style) parts.push(`style: '${parameter.style}'`)\n if (parameter.explode !== undefined) parts.push(`explode: ${parameter.explode}`)\n if (parameter.in === 'query' && parameter.allowReserved !== undefined) parts.push(`allowReserved: ${parameter.allowReserved}`)\n if (parameter.in !== 'path' && parameter.contentType) parts.push(`contentType: '${parameter.contentType}'`)\n if (parameter.in === 'querystring') parts.push('querystring: true')\n return parts.length > 0 ? `{ ${parts.join(', ')} }` : null\n}\n\n/**\n * Serializes the `encoding` of the request body's default content type into a `{ property: { ... } }`\n * literal, or `null` 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): string | null {\n const content = node.requestBody?.content\n const entries = Object.entries(content?.length === 1 ? (content[0]?.encoding ?? {}) : {}).map(\n ([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 return entries.length > 0 ? `body: { ${entries.join(', ')} }` : null\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 * @example\n * ```ts\n * // a path param with { style: 'matrix', explode: true } and a query param with { explode: false }\n * buildStyles({ node }) // \"{ path: { id: { style: 'matrix', explode: true } }, query: { tags: { explode: false } } }\"\n * ```\n */\nexport function buildStyles({ node }: { node: ast.OperationNode }): string | null {\n if (!ast.isHttpOperationNode(node)) return null\n\n const groups: Record<StyledLocation, Array<string>> = { path: [], query: [], header: [], cookie: [] }\n\n for (const [location, parameters] of Object.entries(getOperationParameters(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 = [\n ...(Object.keys(groups) as Array<StyledLocation>)\n .filter((location) => groups[location].length > 0)\n .map((location) => `${location}: { ${groups[location].join(', ')} }`),\n serializeBodyEncoding(node),\n ].filter(Boolean)\n\n return entries.length > 0 ? `{ ${entries.join(', ')} }` : null\n}\n","import { getResponseType, getResponseTypeMap, isEventStream } from '@internals/shared'\nimport type { ast } from '@kubb/kit'\nimport type { ReturnTypeOption } from '../types.ts'\nimport { buildContentType } from './contentType.ts'\nimport { type Auth, buildSecurityMetadata } from './security.ts'\nimport { buildStyles } from './styles.ts'\nimport { buildValidatorLiteral, type ValidatorHooks } from './validator.ts'\n\n/**\n * `responseType` baked into a call. One parser is a string. Several parsers become a map from content\n * type to parser so the runtime can choose from the response `Content-Type`.\n */\nfunction buildResponseTypeLiteral(node: ast.HttpOperationNode): string | null {\n const responseType = getResponseType(node)\n if (responseType) return `responseType: '${responseType}'`\n\n const responseTypes = getResponseTypeMap(node)\n if (!responseTypes) return null\n\n const entries = Object.entries(responseTypes)\n .map(([contentType, type]) => `${JSON.stringify(contentType)}: '${type}'`)\n .join(', ')\n return `responseType: { ${entries} }`\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 `throwOnError` fallback is applied after the `...config` spread.\n *\n * `mergeContentType` is `true` when the caller must destructure `contentType` from `options`, and\n * `eventStream` is `true` when the operation returns `text/event-stream`. Unless `returnType` is `'plain'`, a\n * stream's literal leaves the `response` validator to `toEventStream`, which runs it per event.\n */\nexport function buildCallConfig({\n node,\n validatorHooks,\n security,\n throwOnErrorDefault,\n returnType,\n}: {\n node: ast.HttpOperationNode\n validatorHooks: ValidatorHooks | null\n security?: Array<Auth>\n throwOnErrorDefault: boolean\n returnType: ReturnTypeOption\n}): { callConfig: string; mergeContentType: boolean; eventStream: boolean } {\n const eventStream = isEventStream(node)\n const securityLiteral = buildSecurityMetadata({ security })\n const stylesLiteral = buildStyles({ node })\n // Unless `returnType` is `'plain'`, `toEventStream` validates per event, so `response` stays out of the call config.\n const perEvent = eventStream && returnType !== 'plain'\n const validatorLiteral = buildValidatorLiteral(\n validatorHooks,\n perEvent ? ['request', 'path', 'query', 'headers', 'error'] : ['request', 'path', 'query', 'headers', 'response', 'error'],\n )\n const { literal: contentTypeLiteral, merge: mergeContentType } = buildContentType({ node })\n\n const callConfig = `{ ${[\n `method: '${node.method.toUpperCase()}'`,\n `url: '${node.path}'`,\n securityLiteral ? `security: ${securityLiteral}` : null,\n stylesLiteral ? `styles: ${stylesLiteral}` : null,\n validatorLiteral,\n contentTypeLiteral,\n buildResponseTypeLiteral(node),\n '...config',\n `throwOnError: config.throwOnError ?? ${throwOnErrorDefault}`,\n ]\n .filter(Boolean)\n .join(', ')} }`\n\n return { callConfig, mergeContentType, eventStream }\n}\n","import type { ast } from '@kubb/kit'\nimport { getRequestGroupOptionality } from '@internals/shared'\nimport { createFunctionParameter, createFunctionParameters, functionPrinter } from '@kubb/plugin-ts'\nimport type { OperationTypeNames } from '../resolveOperationTypes.ts'\nimport type { ReturnTypeOption } from '../types.ts'\nimport { buildResultType } from './generics.ts'\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\n\n/**\n * The pieces of a generated operation function's grouped-options signature.\n */\nexport type GroupedOptionsSignature = {\n /**\n * The single function parameter: `options: Options<<Name>Options, ThrowOnError>`, 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 `toEventStream(promise)` does not read them.\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 '../resolveOperationTypes.ts'\nimport type { ReturnTypeOption } from '../types.ts'\nimport { buildCallConfig } from './callConfig.ts'\nimport { buildEventStreamReturn, buildReturnStatement } from './returnStatement.ts'\nimport type { Auth } 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 * `text/event-stream` operation is wired to `toEventStream` in one place.\n */\nexport function buildOperationBody({\n node,\n types,\n validatorHooks,\n security,\n returnType,\n throwOnErrorDefault,\n}: {\n node: ast.HttpOperationNode\n types: OperationTypeNames\n validatorHooks: ValidatorHooks | null\n security?: Array<Auth>\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, throwOnErrorDefault, returnType })\n const signature = buildGroupedOptionsSignature({ node, types, returnType, throwOnErrorDefault, eventStream })\n const stream = eventStream ? buildEventStreamReturn({ node, types, callConfig, returnType, validatorHooks, 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 { 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 { Auth } from '../builders/security.ts'\nimport type { ValidatorHooks } from '../builders/validator.ts'\nimport type { OperationTypeNames } from '../resolveOperationTypes.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 `Auth` objects and serialized onto the\n * call config's `security` field for the runtime `auth` resolver to consume.\n */\n security?: Array<Auth>\n}\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 }: Props): KubbReactNode {\n if (!ast.isHttpOperationNode(node)) return null\n\n const body = buildOperationBody({ node, types, validatorHooks, security, 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, { link: 'urlPath', linkPosition: 'beforeDeprecated', splitLines: true }) }}\n >\n {body.mergeContentType\n ? 'const { client: request = client, contentType, ...config } = options'\n : 'const { client: request = client, ...config } = options'}\n <br />\n {body.statement}\n </Function>\n </File.Source>\n )\n}\n","import path from 'node:path'\nimport { isEventStream } from '@internals/shared'\nimport type { ast } from '@kubb/kit'\nimport { File } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx'\n\n/**\n * The `footer` of `.kubb/client.ts`: the `baseURL` set at generation time, and the `sse.ts` re-export when the document\n * streams events, so `ServerSentEvent` and `toEventStream` stay importable from the client as in earlier releases.\n */\nfunction buildClientFooter({ baseURL, sse }: { baseURL?: string; sse: boolean }): string | undefined {\n const baseURLExpression = baseURL ? (baseURL.includes('${') ? `\\`${baseURL.replaceAll('`', '\\\\`')}\\`` : JSON.stringify(baseURL)) : undefined\n return (\n [baseURLExpression ? `client.setConfig({ baseURL: ${baseURLExpression} })` : null, sse ? `export * from './sse.ts'` : null].filter(Boolean).join('\\n') ||\n undefined\n )\n}\n\n/**\n * Writes the footer of the `.kubb/client.ts` the plugin injected, the one place it is built, and copies `sse.ts` into\n * `.kubb/` only for a document with a `text/event-stream` operation, so a document without streams ships no stream runtime.\n * `sse` is set by the plugins that ship the runtime, so a custom client from `@kubb/plugin-client` gets neither file.\n */\nexport function StreamRuntime({ nodes, root, sse, baseURL }: { nodes: Array<ast.OperationNode>; root: string; sse?: string; baseURL?: string }): KubbReactNode {\n if (!sse) return null\n const streams = nodes.some(isEventStream)\n const footer = buildClientFooter({ baseURL, sse: streams })\n return (\n <>\n {streams && <File baseName=\"sse.ts\" path={path.resolve(root, '.kubb/sse.ts')} copy={sse} />}\n {footer && <File baseName=\"client.ts\" path={path.resolve(root, '.kubb/client.ts')} footer={footer} />}\n </>\n )\n}\n","import { type ast, Diagnostics, type Generator, type Group, type Output } from '@kubb/kit'\nimport { pluginTsName, type ResolverTs } from '@kubb/plugin-ts'\nimport { pluginZodName, type ResolverZod } from '@kubb/plugin-zod'\nimport type { ContractClientFactory } from './types.ts'\n\ntype GeneratorDriver = Parameters<NonNullable<Generator<ContractClientFactory>['operations']>>[1]['driver']\n\n/**\n * The two per-operation type names a generated client references: the grouped input and the\n * per-status responses record its `RequestResult` is keyed on.\n */\nexport type OperationTypeNames = {\n response: {\n /**\n * Resolves the name of the operation's grouped `{ body, path, query, headers }` input type.\n */\n options(node: ast.OperationNode): string\n /**\n * Resolves the name of the operation's per-status responses record type.\n */\n responses(node: ast.OperationNode): string\n }\n}\n\n/**\n * Where a generated client sources its operation types, plus the resolver and output the file\n * declaring them is resolved with.\n */\nexport type OperationTypeSource = OperationTypeNames & {\n /**\n * `plugin-ts` shaped resolver of the plugin supplying the names, also used to resolve the file they are exported from.\n */\n resolver: ResolverTs\n /**\n * The supplying plugin's own `output`, when it configured one.\n */\n output: Output | undefined\n /**\n * The supplying plugin's own `group`, when it configured one.\n */\n group: Group | undefined\n}\n\n/**\n * A `plugin-ts` shaped resolver whose operation type names point at the types `pluginZod({ inferred })`\n * exports next to each schema, so code written against `plugin-ts` names picks up the zod types.\n */\nfunction toZodTypeResolver(resolver: ResolverZod): ResolverTs {\n const type = (name: string) => resolver.schema.type(name)\n\n return {\n ...resolver,\n // Class methods, so a spread drops them. `file` reads private fields, and `memo` gets its own key\n // space so these type names never share an entry with the zod names.\n file: resolver.file.bind(resolver),\n memo: (key: string, compute: () => unknown) => resolver.memo(`zodTypes:${key}`, compute),\n param: {\n name: (node: ast.OperationNode, p: ast.ParameterNode) => type(resolver.param.name(node, p)),\n path: (node: ast.OperationNode, p: ast.ParameterNode) => type(resolver.param.path(node, p)),\n query: (node: ast.OperationNode, p: ast.ParameterNode) => type(resolver.param.query(node, p)),\n headers: (node: ast.OperationNode, p: ast.ParameterNode) => type(resolver.param.headers(node, p)),\n },\n response: {\n body: (node: ast.OperationNode) => type(resolver.response.body(node)),\n status: (node: ast.OperationNode, statusCode: ast.StatusCode) => type(resolver.response.status(node, statusCode)),\n response: (node: ast.OperationNode) => type(resolver.response.response(node)),\n responses: (node: ast.OperationNode) => type(resolver.response.responses(node)),\n options: (node: ast.OperationNode) => resolver.response.options(node),\n },\n } as unknown as ResolverTs\n}\n\n/**\n * Picks the plugin generated clients, query hooks, and MCP handlers take their operation types from.\n *\n * `pluginZod({ inferred: 'codec' })` wins, so a codec param takes its domain value. Otherwise `plugin-ts`\n * wins when it is in the pipeline, and without it any `pluginZod({ inferred })`. Throws\n * `KUBB_MISSING_DEPENDENCY` for `pluginName` when neither is available.\n *\n * @example\n * ```ts\n * const types = resolveOperationTypes(ctx.driver, ctx.plugin.name)\n * types.response.options(node) // 'GetPetByIdOptions', or 'GetPetByIdOptionsSchemaType' from zod\n * ```\n */\nexport function resolveOperationTypes(driver: GeneratorDriver, pluginName: string): OperationTypeSource {\n return driver.memo(`operationTypes:${pluginName}`, () => {\n const pluginTs = driver.getPlugin(pluginTsName)\n const pluginZod = driver.getPlugin(pluginZodName)\n\n if (pluginTs && pluginZod?.options?.inferred !== 'codec') {\n const resolver = driver.getResolver(pluginTsName)\n return { response: resolver.response, resolver, output: pluginTs.options?.output, group: pluginTs.options?.group ?? undefined }\n }\n\n if (!pluginZod?.options?.inferred) {\n throw new Diagnostics.Error({\n code: Diagnostics.code.missingDependency,\n severity: 'error',\n message: `Plugin \"${pluginName}\" has no source for operation types.`,\n help: `Add \\`pluginTs()\\` before \"${pluginName}\", or add \\`pluginZod({ inferred: true })\\`.`,\n location: { kind: 'config' },\n plugin: pluginName,\n })\n }\n\n const resolver = toZodTypeResolver(driver.getResolver(pluginZodName))\n return { response: resolver.response, resolver, output: pluginZod.options.output, group: pluginZod.options.group ?? undefined }\n })\n}\n\ndeclare global {\n namespace Kubb {\n interface MemoRegistry {\n operationTypes: OperationTypeSource\n /**\n * Nests every key the zod-backed `ResolverTs` memoizes, so it holds each of their value types.\n */\n zodTypes: unknown\n }\n }\n}\n","import path from 'node:path'\nimport { getEventStream, operationFileEntry, operationKey, resolveDependencyOperationFile } from '@internals/shared'\nimport { ast, defineGenerator } from '@kubb/kit'\nimport type { Generator } from '@kubb/kit'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, jsxRenderer } from '@kubb/renderer-jsx'\nimport { buildEventStreamImports } from '../builders/returnStatement.ts'\nimport { isValidatorEnabled } from '../builders/validatorOptions.ts'\nimport { getOperationSecurity, type SecurityDocument } from '../builders/security.ts'\nimport { buildValidatorHooks } from '../builders/validator.ts'\nimport { Operation } from '../components/Operation.tsx'\nimport { StreamRuntime } from '../components/StreamRuntime.tsx'\nimport { resolveOperationTypes } from '../resolveOperationTypes.ts'\nimport type { ContractClientFactory } from '../types.ts'\n\n/**\n * Builds the built-in per-operation generator shared by the client plugins (`@kubb/plugin-fetch`,\n * `@kubb/plugin-axios`). Emits one async function per OpenAPI operation using the shared\n * `Operation` component: a grouped `<Name>Request` type and a function that forwards a single\n * `options` object to the bundled `client` and returns the `Unwrappable<RequestResult>`. Only the\n * generator `name` and the runtime templates differ between plugins. Every other resolution, import,\n * and rendering step is identical.\n *\n * `sse` is the Server-Sent Events runtime template, copied into `.kubb/sse.ts` only for a document with a\n * `text/event-stream` operation.\n */\nexport function createClientGenerator<TFactory extends ContractClientFactory>(name: string, { sse }: { sse?: string } = {}): Generator<TFactory> {\n return defineGenerator<TFactory>({\n name,\n renderer: jsxRenderer,\n operations(nodes, ctx) {\n return <StreamRuntime nodes={nodes} root={ctx.root} sse={sse} baseURL={ctx.options.baseURL} />\n },\n operation(node, ctx) {\n if (!ast.isHttpOperationNode(node)) return null\n\n const { config, driver, resolver, root } = ctx\n const { output, validator, returnType, throwOnErrorDefault, group, importPath } = ctx.options\n\n const types = resolveOperationTypes(driver, ctx.plugin.name)\n\n const pluginZod = isValidatorEnabled(validator) ? driver.getPlugin(pluginZodName) : null\n const zodResolver = pluginZod ? driver.getResolver(pluginZodName) : null\n\n const importedTypeNames = [types.response.options(node), types.response.responses(node)]\n\n const validatorHooks = buildValidatorHooks({ node, validator, zodResolver })\n const importedZodNames = validatorHooks.importedZodNames\n const operationName = resolver.name(node.operationId)\n\n const meta = {\n name: resolver.resolveName({ key: operationKey(node), name: operationName }),\n file: resolver.file({ ...operationFileEntry(node, node.operationId), root, output, group: group ?? undefined }),\n fileTypes: resolveDependencyOperationFile({\n memo: ctx.memo,\n node,\n resolver: types.resolver,\n root,\n output: types.output ?? output,\n group: types.group,\n }),\n fileZod:\n zodResolver && pluginZod?.options\n ? zodResolver.file({\n ...operationFileEntry(node, node.operationId),\n root,\n output: pluginZod.options.output ?? output,\n group: pluginZod.options?.group ?? undefined,\n })\n : null,\n } as const\n\n const security = getOperationSecurity({\n document: ctx.adapter.document as SecurityDocument | null | undefined,\n method: node.method,\n path: node.path,\n })\n\n // A custom client module is emitted verbatim, so `importPath` is used exactly as configured.\n // The default `.kubb/client.ts` is a file path and is made relative to the operation file.\n const clientPath = importPath ?? path.resolve(root, '.kubb/client.ts')\n const clientRoot = importPath === undefined ? meta.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 ssePath = importPath ?? path.resolve(root, '.kubb/sse.ts')\n const stream = getEventStream(node)\n\n const clientValueImports = (() => {\n if (returnType === 'plain') return ['client']\n if (returnType === 'data') return ['client', 'unwrapResult']\n return ['client', 'withUnwrap']\n })()\n\n const clientTypeImports = (() => {\n if (stream) return { plain: ['Options', 'SuccessOf'], data: ['SuccessOf'], full: ['SuccessOf', 'Unwrappable'] }[returnType]\n if (returnType === 'plain') return ['Options', 'RequestResult']\n if (returnType === 'data') return ['Options', 'UnwrappedResult']\n return ['Options', 'Unwrappable', 'RequestResult']\n })()\n\n return (\n <File\n baseName={meta.file.baseName}\n path={meta.file.path}\n meta={meta.file.meta}\n banner={resolver.default.banner(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n footer={resolver.default.footer(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n >\n <File.Import name={clientValueImports} root={clientRoot} path={clientPath} />\n <File.Import name={clientTypeImports} root={clientRoot} path={clientPath} isTypeOnly />\n {stream && <File.Import name={['toEventStream']} root={clientRoot} path={ssePath} />}\n {stream && <File.Import name={buildEventStreamImports({ returnType, typed: stream === 'event' })} root={clientRoot} path={ssePath} isTypeOnly />}\n\n {meta.fileTypes && importedTypeNames.length > 0 && (\n <File.Import name={Array.from(new Set(importedTypeNames))} root={meta.file.path} path={meta.fileTypes.path} isTypeOnly />\n )}\n\n {meta.fileZod && importedZodNames.length > 0 && <File.Import name={importedZodNames} root={meta.file.path} path={meta.fileZod.path} />}\n {validatorHooks.headers && <File.Import name={['toHeadersStandardSchema']} root={clientRoot} path={standardSchemaPath} />}\n\n <Operation\n name={meta.name}\n node={node}\n types={types}\n validatorHooks={validatorHooks}\n returnType={returnType}\n throwOnErrorDefault={throwOnErrorDefault}\n security={security}\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 { camelCase, createResolver, pascalCase } from '@kubb/kit'\nimport type { PluginContractClient } 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 = createResolver<PluginContractClient>({\n pluginName: 'plugin-contract-client',\n name: resolveOperationName,\n className(name) {\n return ensureValidVarName(pascalCase(name))\n },\n groupName(name) {\n return ensureValidVarName(pascalCase(`${name} Client`))\n },\n propertyName(name) {\n return ensureValidVarName(camelCase(name))\n },\n})\n","import { createClientGenerator } from '@internals/client'\nimport type { PluginClient } from '../types.ts'\n\n/**\n * Built-in operation generator for `@kubb/plugin-client`. Emits one async function per OpenAPI\n * operation using the shared `Operation` component: a grouped `<Name>Request` type and a function\n * that forwards a single `options` object to the user-provided client module and returns the `RequestResult`.\n */\nexport const clientGenerator = createClientGenerator<PluginClient>('client')\n","import { createGroupConfig } from '@internals/shared'\nimport { addGenerator, defineExtension, Resolver, setMacros, setResolver } from '@kubb/kit'\nimport { compatibility } from '../kubb-extension.json'\nimport { version } from '../package.json'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { clientGenerator } from './generators/clientGenerator.tsx'\nimport { defaultMacros, isValidatorEnabled, resolverClient } from '@internals/client'\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: (options) => ({ [pluginTsName]: { optional: true }, [pluginZodName]: { optional: !isValidatorEnabled(options.validator) } }),\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 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(clientGenerator)\n\n return {\n output,\n exclude,\n include,\n override,\n group: createGroupConfig(group),\n importPath,\n baseURL: undefined,\n throwOnErrorDefault,\n validator,\n returnType: 'plain',\n sdk: undefined,\n resolver,\n }\n },\n})\n\nexport default pluginClient\n"],"mappings":";;;;;;;;;;;;;;;;;;AAaA,SAAgB,mBAAmB,MAAyB,MAAc,UAAyC,OAA2B;CAC5I,OAAO;EACL;EACA;EACA,KAAK,KAAK,KAAK,MAAM;EACrB,MAAM,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,MAAa,gBAA0C,CAAC,gBAAgB;;;;;;;;;;;;ACOxE,MAAa,iBAAiB,eAAqC;CACjE,YAAY;CACZ,MAAM;CACN,UAAU,MAAM;EACd,OAAO,mBAAmB,WAAW,IAAI,CAAC;CAC5C;CACA,UAAU,MAAM;EACd,OAAO,mBAAmB,WAAW,GAAG,KAAK,QAAQ,CAAC;CACxD;CACA,aAAa,MAAM;EACjB,OAAO,mBAAmB,UAAU,IAAI,CAAC;CAC3C;AACF,CAAC;;;;;;;ACnBD,MAAa,kBAAkB,sBAAoC,QAAQ;;;;;ACK3E,MAAa,mBAAmB;;;;;;;;;;;AAYhC,MAAa,eAAe,gBAA8B;CACxD,MAAM;CACN,MAAM;EAAE,MAAM;EAAkB;EAAS;CAAc;CACvD,eAAe,aAAa;GAAG,eAAe,EAAE,UAAU,KAAK;GAAI,gBAAgB,EAAE,UAAU,CAAC,mBAAmB,QAAQ,SAAS,EAAE;CAAE;CACxI,MAAM,SAAS;EACb,MAAM,EACJ,SAAS;GAAE,MAAM;GAAW,QAAQ,EAAE,MAAM,QAAQ;EAAE,GACtD,UAAU,CAAC,GACX,SACA,WAAW,CAAC,GACZ,YACA,sBAAsB,MACtB,YAAY,OACZ,OACA,UAAU,iBACR;EAEJ,MAAM,WAAW,eAAe,SAAS,MAAsB,gBAAgB,YAAY,IAAI;EAE/F,YAAY,QAAQ;EACpB,UAAU,CAAC,GAAG,eAAe,GAAI,QAAQ,UAAU,CAAC,CAAE,CAAC;EACvD,aAAa,eAAe;EAE5B,OAAO;GACL;GACA;GACA;GACA;GACA,OAAO,kBAAkB,KAAK;GAC9B;GACA,SAAS,KAAA;GACT;GACA;GACA,YAAY;GACZ,KAAK,KAAA;GACL;EACF;CACF;AACF,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as SuccessOf, S as RequestResult, n as NativeResponse, p as DataShape, t as NativeRequest, y as Options } from "../client-BxO6Dygu.js";
|
|
2
2
|
export { type DataShape, NativeRequest, NativeResponse, type Options, type RequestResult, type SuccessOf };
|