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