@kubb/plugin-fetch 5.0.0-beta.104 → 5.0.0-beta.109

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -19,7 +19,7 @@ var __copyProps = (to, from, except, desc) => {
19
19
  }
20
20
  return to;
21
21
  };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
23
23
  value: mod,
24
24
  enumerable: true
25
25
  }) : target, mod));
@@ -83,7 +83,7 @@ function operationFileEntry(node, name, extname = ".ts") {
83
83
  */
84
84
  function resolveDependencyOperationFile(options) {
85
85
  const { cache, node, resolver, root, output, group } = options;
86
- return cache.getOrSet(`${resolver.pluginName}:operationFile`, () => resolver.file({
86
+ return cache.ensureItem(`${resolver.pluginName}:operationFile`, () => resolver.file({
87
87
  ...operationFileEntry(node, node.operationId),
88
88
  root,
89
89
  output,
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["Url","ast","ast","ast","File","Function","File","jsxRenderer","ast","pluginTsName","pluginZodName","path","File","File","pluginTsName","pluginZodName","ast","jsxRenderer","path","File","macroSimplifyUnion","Resolver","pluginTsName","pluginZodName","path"],"sources":["../../../internals/shared/src/params.ts","../../../internals/shared/src/operation.ts","../../../internals/utils/src/casing.ts","../../../internals/utils/src/reserved.ts","../../../internals/utils/src/codegen.ts","../../../internals/shared/src/group.ts","../../../internals/client/src/builders/generics.ts","../../../internals/client/src/builders/returnStatement.ts","../../../internals/client/src/builders/security.ts","../../../internals/client/src/builders/signature.ts","../../../internals/client/src/builders/validatorOptions.ts","../../../internals/client/src/builders/validator.ts","../../../internals/client/src/builders/sdkMethod.ts","../../../internals/client/src/builders/styles.ts","../../../internals/client/src/components/Operation.tsx","../../../internals/client/src/components/SdkClient.tsx","../../../internals/client/src/generators/clientGenerator.tsx","../../../internals/client/src/components/SdkFacade.tsx","../../../internals/client/src/generators/sdkGenerator.tsx","../../../internals/client/src/macros.ts","../../../internals/client/src/resolver.ts","../src/generators/clientGenerator.tsx","../src/templates.ts","../src/plugin.ts"],"sourcesContent":["import type { ast } from 'kubb/kit'\n\n/**\n * Drops parameters that share the same name, keeping the first.\n *\n * A malformed spec can declare the same parameter name twice within one `in` location. Both would\n * resolve to the same output property, so emitting both would yield an object type with a duplicate\n * member, which TypeScript rejects. This is a defensive guard against that case, not a casing guard:\n * parameter names flow through unchanged, so no two distinct names ever collide here anymore.\n */\nexport function dedupeParams(params: Array<ast.ParameterNode>): Array<ast.ParameterNode> {\n const seen = new Set<string>()\n\n return params.filter((param) => {\n if (seen.has(param.name)) return false\n seen.add(param.name)\n return true\n })\n}\n","import { ast, type Group, type NodeCache, type Output, type Resolver, type ResolverFileParams, Url } from 'kubb/kit'\nimport { dedupeParams } from './params.ts'\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 `cache` (the\n * current node's `ctx.cache`) under the resolver's own plugin name. 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({ cache: ctx.cache, node, resolver: tsResolver, root, output })\n * ```\n */\nexport function resolveDependencyOperationFile(options: {\n cache: NodeCache\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 { cache, node, resolver, root, output, group } = options\n\n return cache.getOrSet(`${resolver.pluginName}:operationFile`, () =>\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\n/**\n * Resolver interface for building operation parameters.\n *\n * `ResolverTs` from `@kubb/plugin-ts` satisfies this interface and can be passed directly.\n */\nexport type OperationParamsResolver = {\n /**\n * Naming for an operation's parameters, grouped by location.\n */\n param: {\n /**\n * Resolves the type name for an individual parameter.\n *\n * @example Individual path parameter name\n * `resolver.param.name(node, param) // → 'DeletePetPathPetId'`\n */\n name(node: ast.OperationNode, param: ast.ParameterNode): string\n /**\n * Resolves the grouped path parameters type name.\n * When the return value equals `resolver.param.name`, no indexed access is emitted.\n *\n * @example Grouped path params type name\n * `resolver.param.path(node, param) // → 'DeletePetPath'`\n */\n path(node: ast.OperationNode, param: ast.ParameterNode): string\n /**\n * Resolves the grouped query parameters type name.\n * When the return value equals `resolver.param.name`, an inline struct type is emitted instead.\n *\n * @example Grouped query params type name\n * `resolver.param.query(node, param) // → 'FindPetsByStatusQuery'`\n */\n query(node: ast.OperationNode, param: ast.ParameterNode): string\n /**\n * Resolves the grouped header parameters type name.\n * When the return value equals `resolver.param.name`, an inline struct type is emitted instead.\n *\n * @example Grouped header params type name\n * `resolver.param.headers(node, param) // → 'DeletePetHeaders'`\n */\n headers(node: ast.OperationNode, param: ast.ParameterNode): string\n }\n /**\n * Naming for an operation's request and response types.\n */\n response: {\n /**\n * Resolves the request body type name.\n *\n * @example Request body type name\n * `resolver.response.body(node) // → 'CreatePetBody'`\n */\n body(node: ast.OperationNode): 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<ast.ParameterNode['in'], 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 * Whether an operation streams its primary success response as Server-Sent Events\n * (`text/event-stream`). The client generator uses this to return a typed event stream instead of a\n * one-shot `RequestResult`.\n */\nexport function isEventStream(node: ast.OperationNode): boolean {\n return getPrimarySuccessContentType(node) === 'text/event-stream'\n}\n\n/**\n * Derives the default `responseType` for an operation from its primary success response.\n *\n * Returns a value only when that response declares a single non-JSON content type. `text/event-stream`\n * and other binary types (`application/octet-stream`, `application/pdf`, `image/*`, `audio/*`,\n * `video/*`) map to a stream or `'blob'`, and other `text/*` maps to `'text'`. Otherwise `undefined`,\n * leaving the runtime client's `Content-Type` auto-detection in charge.\n */\nexport function getResponseType(node: ast.OperationNode): ResponseType | undefined {\n const baseType = getPrimarySuccessContentType(node)\n if (!baseType) return undefined\n\n if (baseType === 'application/json' || baseType.endsWith('+json') || baseType === 'text/json') return undefined\n if (baseType === 'text/event-stream') return 'stream'\n if (baseType.startsWith('text/')) return 'text'\n if (baseType === 'application/octet-stream' || baseType === 'application/pdf' || /^(image|audio|video)\\//.test(baseType)) return 'blob'\n return undefined\n}\n\n/**\n * Maps a content type to the PascalCase suffix used to name per-content-type variants\n * (e.g. `application/json` → `Json`, `application/xml` → `Xml`, `multipart/form-data` → `FormData`).\n */\nfunction getContentTypeSuffix(contentType: string): string {\n const baseType = contentType.split(';')[0]!.trim()\n if (baseType === 'application/json') return 'Json'\n if (baseType === 'multipart/form-data') return 'FormData'\n if (baseType === 'application/x-www-form-urlencoded') return 'FormUrlEncoded'\n const subtype = baseType.split('/').pop() ?? baseType\n const parts = subtype.split(/[^a-zA-Z0-9]+/).filter(Boolean)\n if (parts.length === 0) return 'Unknown'\n return parts.map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join('')\n}\n\n/**\n * Appends a content-type suffix to a base name, keeping a trailing `Data` segment last\n * (e.g. `AddPetData` + `Json` → `AddPetJsonData`, `AddPetStatus200` + `Xml` → `AddPetStatus200Xml`).\n */\nexport function getPerContentTypeName(baseName: string, suffix: string): string {\n if (baseName.endsWith('Data')) {\n return suffix.endsWith('Data') ? baseName.slice(0, -4) + suffix : `${baseName.slice(0, -4)}${suffix}Data`\n }\n return baseName + suffix\n}\n\nexport type ContentVariantInput = { contentType: string; schema?: ast.SchemaNode | null; keysToOmit?: Array<string> | null }\nexport type ContentVariant = { name: string; suffix: string; schema: ast.SchemaNode; keysToOmit?: Array<string> | null; contentType: string }\n\n/**\n * Resolves per-content-type variant names for a set of content entries, deduplicating suffix\n * collisions with a numeric counter. Entries without a schema are skipped. The returned `suffix` is\n * the final (possibly counter-augmented) value, so callers can derive parallel names in another\n * namespace (e.g. plugin-faker deriving the matching plugin-ts type name).\n */\nexport function resolveContentTypeVariants(entries: Array<ContentVariantInput>, baseName: string): Array<ContentVariant> {\n const usedNames = new Set<string>()\n return entries\n .filter((entry) => entry.schema)\n .map((entry) => {\n const baseSuffix = getContentTypeSuffix(entry.contentType)\n let suffix = baseSuffix\n let name = getPerContentTypeName(baseName, suffix)\n let counter = 2\n while (usedNames.has(name)) {\n suffix = `${baseSuffix}${counter++}`\n name = getPerContentTypeName(baseName, suffix)\n }\n usedNames.add(name)\n return { name, suffix, schema: entry.schema!, keysToOmit: entry.keysToOmit, contentType: entry.contentType }\n })\n}\n\nexport function buildRequestConfigType(node: ast.OperationNode): string {\n const request = getContentTypeInfo(node)\n const response = getResponseContentTypeInfo(node)\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`.\n const configType = `Partial<Omit<RequestConfig, 'path' | 'query' | 'body' | 'headers' | 'url'>>`\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 ? `${configType} & { contentType?: { ${members.join('; ')} } }` : configType\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 `Partial<Omit<RequestConfig, 'path' | 'query' | 'body' | 'headers' | 'url'>>`\n}\n\nexport type RequestGroups = {\n path: boolean\n query: boolean\n body: boolean\n headers: boolean\n}\n\n/**\n * Which of the grouped request options an operation carries.\n */\nexport function getRequestGroups(node: ast.OperationNode): RequestGroups {\n const { path, query, header } = getOperationParameters(node)\n return {\n path: path.length > 0,\n query: query.length > 0,\n body: Boolean(node.requestBody?.content?.[0]?.schema),\n headers: header.length > 0,\n }\n}\n\nexport type RequestGroupOptionality = {\n groups: RequestGroups\n hasRequiredPath: boolean\n hasRequiredQuery: boolean\n hasRequiredHeader: boolean\n /**\n * Whether the grouped request parameter can default to `{}`. True only when no group carries a\n * required member, so every member is safe to omit.\n */\n isOptional: boolean\n}\n\n/**\n * Resolves which grouped request options an operation carries together with whether each group\n * holds a required member. The grouped parameter stays optional only when nothing inside it is\n * required, matching the generated `RequestConfig` type.\n */\nexport function getRequestGroupOptionality(node: ast.OperationNode): RequestGroupOptionality {\n const groups = getRequestGroups(node)\n const { path, query, header } = getOperationParameters(node)\n const hasRequiredPath = path.some((param) => param.required)\n const hasRequiredQuery = query.some((param) => param.required)\n const hasRequiredHeader = header.some((param) => param.required)\n\n return {\n groups,\n hasRequiredPath,\n hasRequiredQuery,\n hasRequiredHeader,\n isOptional: !hasRequiredPath && !hasRequiredQuery && !hasRequiredHeader && !groups.body,\n }\n}\n\nexport type RequestOptionsNameResolver = RequestConfigResolver & {\n response: {\n options(node: ast.OperationNode): string\n }\n}\n\n/**\n * Builds the grouped `{ path, query, body, headers }` parameter for a generated client\n * function, typed from the operation's `Options` (minus `url`). Only the groups the\n * operation actually has are destructured. The trailing `config` parameter carries the\n * runtime `RequestConfig` overrides plus `client`.\n */\nexport function buildRequestParamsSignature(\n node: ast.OperationNode,\n resolver: RequestOptionsNameResolver,\n options: { isConfigurable?: boolean } = {},\n): { signature: string; groups: RequestGroups } {\n const { isConfigurable = true } = options\n const { groups, isOptional } = getRequestGroupOptionality(node)\n\n const names = (['path', 'query', 'body', 'headers'] as const).filter((key) => groups[key])\n\n const firstParam = names.length > 0 ? `{ ${names.join(', ')} }: ${resolver.response.options(node)}${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 * 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 const groups: OperationParameterGroups = {\n path: dedupeParams(node.parameters.filter((param) => param.in === 'path')),\n query: dedupeParams(node.parameters.filter((param) => param.in === 'query')),\n header: dedupeParams(node.parameters.filter((param) => param.in === 'header')),\n cookie: dedupeParams(node.parameters.filter((param) => param.in === '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 buildOptionsSchema(node: ast.OperationNode, resolver: OperationTypeNameResolver): 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 // 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 return ast.factory.createSchema({\n type: 'object',\n primitive: 'object',\n deprecated: node.deprecated,\n properties: [\n ast.factory.createProperty({\n name: 'body',\n required: hasBody,\n schema: hasBody ? ast.factory.createSchema({ type: 'ref', name: resolver.response.body(node) }) : createNever(),\n }),\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 ],\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\nconst typeNamesByResolver = new WeakMap<OperationTypeNameResolver, Map<string, string[]>>()\n\nexport function resolveOperationTypeNames(\n node: ast.OperationNode,\n resolver: OperationTypeNameResolver,\n options: ResolveOperationTypeNameOptions = {},\n): string[] {\n const cacheKey = `${node.operationId}\\0${options.order ?? ''}\\0${options.responseStatusNames ?? ''}\\0${options.includeParams === false ? 'noparams' : ''}\\0${(options.exclude ?? []).join(',')}`\n let byResolver = typeNamesByResolver.get(resolver)\n if (byResolver) {\n const cached = byResolver.get(cacheKey)\n if (cached) return cached\n } else {\n byResolver = new Map()\n typeNamesByResolver.set(resolver, byResolver)\n }\n\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 const result = names.filter((name): name is string => Boolean(name) && !exclude.has(name as string))\n byResolver.set(cacheKey, result)\n return result\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\nexport function findSuccessStatusCode(responses: Array<{ statusCode: ast.StatusCode | number | string }>): ast.StatusCode | null {\n for (const response of responses) {\n if (isSuccessStatusCode(response.statusCode)) {\n return response.statusCode as ast.StatusCode\n }\n }\n\n return null\n}\n","type Options = {\n /**\n * Text prepended before casing is applied.\n */\n prefix?: string\n /**\n * Text appended before casing is applied.\n */\n suffix?: string\n}\n\n/**\n * Shared implementation for camelCase and PascalCase conversion.\n * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)\n * and capitalizes each word according to `pascal`.\n *\n * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.\n */\nfunction toCamelOrPascal(text: string, pascal: boolean): string {\n return text\n .trim()\n .replace(/([a-z\\d])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n .replace(/(\\d)([a-z])/g, '$1 $2')\n .split(/[\\s\\-_./\\\\:]+/)\n .filter(Boolean)\n .map((word, i) => {\n if (word.length > 1 && word === word.toUpperCase()) return word\n const head = i === 0 && !pascal ? word.charAt(0).toLowerCase() : word.charAt(0).toUpperCase()\n return head + word.slice(1)\n })\n .join('')\n .replace(/[^a-zA-Z0-9]/g, '')\n}\n\n/**\n * Converts `text` to camelCase.\n *\n * @example Word boundaries\n * `camelCase('hello-world') // 'helloWorld'`\n *\n * @example With a prefix\n * `camelCase('tag', { prefix: 'create' }) // 'createTag'`\n */\nexport function camelCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false)\n}\n\n/**\n * Converts `text` to PascalCase.\n *\n * @example Word boundaries\n * `pascalCase('hello-world') // 'HelloWorld'`\n *\n * @example With a suffix\n * `pascalCase('tag', { suffix: 'schema' }) // 'TagSchema'`\n */\nexport function pascalCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true)\n}\n\n/**\n * Uppercases only the first character of `text`, leaving the rest untouched.\n * Unlike {@link pascalCase} it never re-splits word boundaries or strips characters.\n *\n * @example\n * `capitalize('getPetById') // 'GetPetById'`\n */\nexport function capitalize(text: string): string {\n return `${text.charAt(0).toUpperCase()}${text.slice(1)}`\n}\n\n/**\n * Converts `text` to snake_case.\n *\n * @example From camelCase\n * `snakeCase('helloWorld') // 'hello_world'`\n *\n * @example From mixed separators\n * `snakeCase('Hello-World') // 'hello_world'`\n */\nexport function snakeCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n const processed = `${prefix} ${text} ${suffix}`.trim()\n return processed\n .replace(/([a-z])([A-Z])/g, '$1_$2')\n .replace(/[\\s\\-.]+/g, '_')\n .replace(/[^a-zA-Z0-9_]/g, '')\n .toLowerCase()\n .split('_')\n .filter(Boolean)\n .join('_')\n}\n\n/**\n * Converts `text` to SCREAMING_SNAKE_CASE.\n *\n * @example From camelCase\n * `screamingSnakeCase('helloWorld') // 'HELLO_WORLD'`\n */\nexport function screamingSnakeCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return snakeCase(text, { prefix, suffix }).toUpperCase()\n}\n","/**\n * JavaScript and Java reserved words.\n * @link https://github.com/jonschlinkert/reserved/blob/master/index.js\n */\nconst reservedWords = new Set([\n 'abstract',\n 'arguments',\n '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 { isIdentifier } from './reserved.ts'\nimport { singleQuote } from './strings.ts'\n\nconst INDENT = ' '\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 * Indents every non-empty line of `text` by one indent level, leaving blank lines empty.\n */\nfunction indentLines(text: string): string {\n if (!text) return ''\n return text\n .split('\\n')\n .map((line) => (line.trim() ? `${INDENT}${line}` : ''))\n .join('\\n')\n}\n\n/**\n * Renders an object key, quoting it with single quotes only when it is not a valid identifier.\n * Reserved words and globals (`name`, `class`, …) are valid bare keys and stay unquoted.\n *\n * @example\n * ```ts\n * objectKey('name') // 'name'\n * objectKey('x-total') // \"'x-total'\"\n * ```\n */\nexport function objectKey(name: string): string {\n return isIdentifier(name) ? name : singleQuote(name)\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) => `${indentLines(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) => `${indentLines(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","import { camelCase } from '@internals/utils'\nimport type { Group } from 'kubb/kit'\n\n/**\n * Builds the `group` config a Kubb plugin passes to `ctx.setOptions`, applying the\n * shared default naming so every plugin groups output consistently:\n *\n * - `path` groups use the second path segment (`/pet/findByStatus` → `pet`).\n * - other groups use the camelCased group (`pet store` → `petStore`).\n *\n * A user-provided `group.name` always wins over the default namer, so callers stay in\n * control of their output folders. Returns `null` when grouping is disabled, matching the\n * per-plugin convention.\n *\n * @param group - The user-supplied group option, or `undefined` to disable grouping.\n *\n * @example\n * ```ts\n * createGroupConfig(group) // shared across every plugin\n * ```\n */\nexport function createGroupConfig(group: Group | undefined): Group | null {\n if (!group) {\n return null\n }\n\n const defaultName = (ctx: { group: string }): string => {\n if (group.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n\n return camelCase(ctx.group)\n }\n\n return {\n ...group,\n name: group.name ? group.name : defaultName,\n } satisfies Group\n}\n","import type { ast } from 'kubb/kit'\nimport type { ResolverTs } from '@kubb/plugin-ts'\n\n/**\n * Builds the `RequestResult` generic arguments for one operation: the plugin-ts per-status responses\n * record 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, tsResolver }) // 'AddPetResponses, ThrowOnError'`\n */\nexport function buildRequestResultGenerics({ node, tsResolver }: { node: ast.OperationNode; tsResolver: ResolverTs }): string {\n return `${tsResolver.response.responses(node)}, ThrowOnError`\n}\n","import type { ast } from 'kubb/kit'\nimport type { ResolverTs } from '@kubb/plugin-ts'\nimport { buildRequestResultGenerics } from './generics.ts'\n\n/**\n * Builds the return statement of a generated operation function. The runtime call already resolves\n * to `{ data, error, request, response }`; the generated code forwards that result and casts it to\n * the operation's `RequestResult`, which carries the `throwOnError` discrimination.\n *\n * @example\n * `return request({ method: 'POST', url: '/pet', ...config }) as Promise<RequestResult<AddPetResponses, ThrowOnError>>`\n */\nexport function buildReturnStatement({ node, tsResolver, callConfig }: { node: ast.OperationNode; tsResolver: ResolverTs; callConfig: string }): string {\n return `return request(${callConfig}) as Promise<RequestResult<${buildRequestResultGenerics({ node, tsResolver })}>>`\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}\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 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 of Object.keys(requirement)) {\n if (seen.has(schemeName)) continue\n seen.add(schemeName)\n const auth = resolveSecurityScheme(definitions[schemeName])\n if (auth) security.push(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 type { ast } from 'kubb/kit'\nimport { getRequestGroupOptionality } from '@internals/shared'\nimport { createFunctionParameter, createFunctionParameters, functionPrinter, type ResolverTs } from '@kubb/plugin-ts'\nimport { buildRequestResultGenerics } 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 * Name of the per-operation grouped data type, the plugin-ts `<Name>Options` used directly\n * as the function input.\n */\n dataTypeName: string\n /**\n * The single function parameter: `options: Options<<Name>Options, ThrowOnError>`.\n */\n paramsSignature: string\n /**\n * The function return type: `Promise<RequestResult<<Name>Responses, ThrowOnError>>`.\n */\n returnType: string\n /**\n * The function generics. One per-call `ThrowOnError` flag, defaulting to `true`.\n */\n generics: Array<string>\n /**\n * The plugin-ts type names the generated file imports (type-only).\n */\n importedTypeNames: Array<string>\n}\n\n/**\n * Builds the grouped-options signature for one operation: a single `options` object whose `TData`\n * is the plugin-ts `<Name>Options` (carrying a literal `url`), and a `RequestResult` return type\n * keyed to the plugin-ts per-status responses 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.\n */\nexport function buildGroupedOptionsSignature({ node, tsResolver }: { node: ast.OperationNode; tsResolver: ResolverTs }): GroupedOptionsSignature {\n const optionsName = tsResolver.response.options(node)\n const responsesName = tsResolver.response.responses(node)\n const resultGenerics = buildRequestResultGenerics({ node, tsResolver })\n const { isOptional } = getRequestGroupOptionality(node)\n\n const paramsSignature =\n declarationPrinter.print(\n createFunctionParameters({\n params: [createFunctionParameter({ name: 'options', type: `Options<${optionsName}, ThrowOnError>`, ...(isOptional ? { default: '{}' } : {}) })],\n }),\n ) ?? ''\n\n return {\n dataTypeName: optionsName,\n paramsSignature,\n returnType: `Promise<RequestResult<${resultGenerics}>>`,\n generics: ['ThrowOnError extends boolean = true'],\n importedTypeNames: [optionsName, responsesName],\n }\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.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 query-parameters parsing is enabled, `null` otherwise. Only the object form\n * `{ request: 'zod' }` enables it.\n */\nexport function resolveQueryParamsValidator(validator: ValidatorOptions | undefined): 'zod' | null {\n if (!validator || validator === 'zod') return null\n return validator.request ?? 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 * The zod validation a generated client applies to a success response body.\n */\nexport type ZodResponseParse = {\n /**\n * The success-only response schema name that the generated code calls `.parse(data)` on.\n */\n expression: string\n /**\n * Schema names the generated file imports from the zod plugin output.\n */\n importNames: Array<string>\n}\n\n/**\n * Resolves the zod expression a generated client validates a success response with. Only success\n * (2xx) bodies reach the parse under the throw-on-error contract, so the success-only\n * `<operation>ResponseSchema` is used; error bodies are never zod-parsed.\n */\nexport function buildZodResponseParse(node: ast.OperationNode, zodResolver: ResolverZod): ZodResponseParse | null {\n const name = zodResolver.response.response(node)\n return name ? { expression: name, importNames: [name] } : null\n}\n\n/**\n * Resolves the zod expression 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): ZodResponseParse | null {\n const hasErrorResponse = node.responses.some((res) => !isSuccessStatusCode(res.statusCode) && res.content?.some((entry) => entry.schema))\n if (!hasErrorResponse) return null\n const name = zodResolver.response.error?.(node)\n return name ? { expression: name, importNames: [name] } : null\n}\n","import type { ast } from 'kubb/kit'\nimport type { ResolverZod } from '@kubb/plugin-zod'\nimport type { ValidatorOptions } from '../types.ts'\nimport { buildZodErrorParse, buildZodResponseParse, 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.response` /\n * `validator.error` slot; `client.ts` runs it through `validateStandardSchema`. The response validator\n * 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 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 validation runs 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 importedZodNames: Array<string> = []\n\n const hasRequestBody = Boolean(node.requestBody?.content?.[0]?.schema)\n const zodRequestName = zodResolver && resolveRequestValidator(validator) === 'zod' && hasRequestBody ? zodResolver.response.body(node) : null\n const request = zodRequestName ?? null\n if (zodRequestName) importedZodNames.push(zodRequestName)\n\n const responseParse = zodResolver && resolveResponseValidator(validator) === 'zod' ? buildZodResponseParse(node, zodResolver) : null\n const response = responseParse ? responseParse.expression : null\n if (responseParse) importedZodNames.push(...responseParse.importNames)\n\n const errorParse = zodResolver && resolveResponseValidator(validator) === 'zod' ? buildZodErrorParse(node, zodResolver) : null\n const error = errorParse ? errorParse.expression : null\n if (errorParse) importedZodNames.push(...errorParse.importNames)\n\n return { request, response, error, importedZodNames }\n}\n","import { buildOperationComments } from '@internals/shared'\nimport { buildJSDoc } from '@internals/utils'\nimport { ast } from 'kubb/kit'\nimport type { ResolverTs } from '@kubb/plugin-ts'\nimport type { ResolverZod } from '@kubb/plugin-zod'\nimport type { ValidatorOptions } from '../types.ts'\nimport { buildReturnStatement } from './returnStatement.ts'\nimport { type Auth, buildSecurityMetadata } from './security.ts'\nimport { buildGroupedOptionsSignature } from './signature.ts'\nimport { buildValidatorHooks } from './validator.ts'\n\n/**\n * Builds the call config literal forwarded to the contract client, mirroring the shared `Operation`\n * component: `{ method, url, security?, validator?, ...config }`. The `...config` spread carries every\n * per-call field (including `throwOnError`), so the method stays a thin wrapper over the contract.\n */\nfunction buildCallConfig({\n node,\n validator,\n zodResolver,\n security,\n}: {\n node: ast.HttpOperationNode\n validator: ValidatorOptions | undefined\n zodResolver?: ResolverZod | null\n security?: Array<Auth>\n}): string {\n const validators = buildValidatorHooks({ node, validator, zodResolver })\n const validatorEntries = [\n validators.request ? `request: ${validators.request}` : null,\n validators.response ? `response: ${validators.response}` : null,\n ].filter(Boolean)\n const validatorLiteral = validatorEntries.length ? `validator: { ${validatorEntries.join(', ')} }` : null\n const securityLiteral = buildSecurityMetadata({ security })\n\n return `{ ${[\n `method: '${node.method.toUpperCase()}'`,\n `url: '${node.path}'`,\n securityLiteral ? `security: ${securityLiteral}` : null,\n validatorLiteral,\n '...config',\n ]\n .filter(Boolean)\n .join(', ')} }`\n}\n\n/**\n * Builds a single instance method for a generated SDK class. The body forwards the single grouped\n * `options` object to the instance's own client (`this.client`, built once in the constructor) and\n * returns the `RequestResult`. A per-call `options.client` still overrides the instance client, so\n * one operation can be routed to a different environment without a new instance.\n */\nexport function buildSdkMethod({\n node,\n name,\n tsResolver,\n zodResolver,\n validator,\n security,\n}: {\n node: ast.OperationNode\n name: string\n tsResolver: ResolverTs\n zodResolver?: ResolverZod | null\n validator: ValidatorOptions | undefined\n security?: Array<Auth>\n}): string {\n if (!ast.isHttpOperationNode(node)) return ''\n\n const signature = buildGroupedOptionsSignature({ node, tsResolver })\n const callConfig = buildCallConfig({ node, validator, zodResolver, security })\n const returnStatement = buildReturnStatement({ node, tsResolver, callConfig })\n const generics = signature.generics.length ? `<${signature.generics.join(', ')}>` : ''\n const jsdoc = buildJSDoc(buildOperationComments(node, { link: 'urlPath', linkPosition: 'beforeDeprecated', splitLines: true }))\n\n const methodBody = ['const { client: request = this.client, ...config } = options', '', returnStatement].map((line) => (line ? ` ${line}` : '')).join('\\n')\n\n return `${jsdoc} public ${name}${generics}(${signature.paramsSignature}): ${signature.returnType} {\\n${methodBody}\\n }`\n}\n","import { camelCase, 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.\n * Path keys are camelCased to match the URL template placeholders. Query, header, and cookie keys\n * keep the spec name, matching the remapped keys the runtime serializes.\n */\nfunction toKey(name: string, location: StyledLocation): string {\n const key = location === 'path' ? camelCase(name) : name\n return isValidVarName(key) ? key : JSON.stringify(key)\n}\n\n/**\n * Serializes one parameter's metadata into a `{ style, explode }` literal, or `null` when the\n * parameter carries neither. Path and query carry the serialization `style`; header and cookie use a\n * fixed style (`simple` and `form`), so only `explode` is emitted for them.\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 return parts.length > 0 ? `{ ${parts.join(', ')} }` : null\n}\n\n/**\n * Builds the per-operation `styles` literal from the operation's parameters, grouped by location.\n * Path entries are keyed by the camelCased name to match the URL template placeholders; query,\n * header, and cookie entries keep the spec name to match the keys the runtime serializes.\n * Only parameters whose source defines `style` or `explode` are emitted, so calls without\n * serialization metadata keep the runtime defaults and existing output is unchanged. Returns `null`\n * when no parameter 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 parameter of node.parameters) {\n const literal = serializeParameter(parameter)\n if (!literal) continue\n groups[parameter.in].push(`${toKey(parameter.name, parameter.in)}: ${literal}`)\n }\n\n const locations = (Object.keys(groups) as Array<StyledLocation>).filter((location) => groups[location].length > 0)\n if (locations.length === 0) return null\n\n return `{ ${locations.map((location) => `${location}: { ${groups[location].join(', ')} }`).join(', ')} }`\n}\n","import { buildOperationComments, getContentTypeInfo, getResponseContentTypeInfo, getResponseType, isEventStream } from '@internals/shared'\nimport { ast } from 'kubb/kit'\nimport type { ResolverTs } from '@kubb/plugin-ts'\nimport type { ResolverZod } from '@kubb/plugin-zod'\nimport { File, Function } from 'kubb/jsx'\nimport type { KubbReactNode } from 'kubb/jsx'\nimport { buildReturnStatement } from '../builders/returnStatement.ts'\nimport { type Auth, buildSecurityMetadata } from '../builders/security.ts'\nimport { buildGroupedOptionsSignature } from '../builders/signature.ts'\nimport { buildStyles } from '../builders/styles.ts'\nimport { buildValidatorHooks } from '../builders/validator.ts'\nimport type { ValidatorOptions } 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 * Resolver for the plugin-ts type names the signature references.\n */\n tsResolver: ResolverTs\n /**\n * Resolver for the zod schema names the validators reference, when `validator` is on.\n */\n zodResolver?: ResolverZod | null\n /**\n * The active validator option, driving the validator-hook wiring.\n */\n validator?: ValidatorOptions\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 isExportable?: boolean\n isIndexable?: boolean\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 `RequestResult`. The type, signature,\n * and call config are built with the AST factory, and only the jsx-renderer emits the source.\n */\nexport function Operation({ name, node, tsResolver, zodResolver, validator, security, isExportable = true, isIndexable = true }: Props): KubbReactNode {\n if (!ast.isHttpOperationNode(node)) return null\n\n const signature = buildGroupedOptionsSignature({ node, tsResolver })\n const validators = buildValidatorHooks({ node, validator, zodResolver })\n const securityLiteral = buildSecurityMetadata({ security })\n const stylesLiteral = buildStyles({ node })\n\n const { defaultContentType } = getContentTypeInfo(node)\n const hasRequestBody = Boolean(node.requestBody?.content?.[0]?.schema)\n // Bake the request body content type only when it is not the JSON default. The first declared type is\n // the default for an operation with several request types; the caller overrides it on `contentType`.\n const bakedRequestContentType = hasRequestBody && defaultContentType !== 'application/json' ? defaultContentType : null\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 mergeContentType = Boolean(bakedRequestContentType) && getResponseContentTypeInfo(node).isMultipleContentTypes\n const contentTypeLiteral = !bakedRequestContentType\n ? null\n : mergeContentType\n ? `contentType: { request: '${bakedRequestContentType}', ...(typeof contentType === 'string' ? { request: contentType } : contentType) }`\n : `contentType: { request: '${bakedRequestContentType}' }`\n\n const eventStream = isEventStream(node)\n const responseType = getResponseType(node)\n const responseTypeLiteral = responseType ? `responseType: '${responseType}'` : null\n\n const validatorEntries = [\n validators.request ? `request: ${validators.request}` : null,\n validators.response ? `response: ${validators.response}` : null,\n validators.error ? `error: ${validators.error}` : null,\n ].filter(Boolean)\n const validatorLiteral = validatorEntries.length ? `validator: { ${validatorEntries.join(', ')} }` : null\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 responseTypeLiteral,\n '...config',\n ]\n .filter(Boolean)\n .join(', ')} }`\n\n const eventType = `SuccessOf<${tsResolver.response.responses(node)}>`\n const returnType = eventStream ? `Promise<EventStreamResult<${eventType}>>` : signature.returnType\n const returnStatement = eventStream ? `return toEventStream<${eventType}>(request(${callConfig}))` : buildReturnStatement({ node, tsResolver, callConfig })\n\n return (\n <File.Source name={name} isExportable={isExportable} isIndexable={isIndexable}>\n <Function\n name={name}\n export={isExportable}\n generics={signature.generics}\n params={signature.paramsSignature}\n returnType={returnType}\n JSDoc={{ comments: buildOperationComments(node, { link: 'urlPath', linkPosition: 'beforeDeprecated', splitLines: true }) }}\n >\n {mergeContentType ? 'const { client: request = client, contentType, ...config } = options' : 'const { client: request = client, ...config } = options'}\n <br />\n {returnStatement}\n </Function>\n </File.Source>\n )\n}\n","import type { ast } from 'kubb/kit'\nimport type { ResolverTs } from '@kubb/plugin-ts'\nimport type { ResolverZod } from '@kubb/plugin-zod'\nimport { File } from 'kubb/jsx'\nimport type { KubbReactNode } from 'kubb/jsx'\nimport { buildSdkMethod } from '../builders/sdkMethod.ts'\nimport type { Auth } from '../builders/security.ts'\nimport type { ValidatorOptions } from '../types.ts'\n\ntype OperationData = {\n node: ast.OperationNode\n name: string\n tsResolver: ResolverTs\n zodResolver?: ResolverZod | null\n security?: Array<Auth>\n}\n\ntype Props = {\n name: string\n isExportable?: boolean\n isIndexable?: boolean\n operations: Array<OperationData>\n validator: ValidatorOptions | undefined\n children?: KubbReactNode\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(...)`. A per-call `client` option\n * still overrides the instance client for a one-off call.\n */\nexport function SdkClient({ name, isExportable = true, isIndexable = true, operations, validator, children }: Props): KubbReactNode {\n const methods = operations.map(({ node, name: methodName, tsResolver, zodResolver, security }) =>\n buildSdkMethod({\n node,\n name: methodName,\n tsResolver,\n zodResolver,\n validator,\n security,\n }),\n )\n\n const constructor = [\n ' private readonly client: ClientInstance',\n '',\n ' constructor(config: ClientConfig = {}) {',\n ' this.client = 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={isExportable} isIndexable={isIndexable}>\n {classCode}\n {children}\n </File.Source>\n )\n}\n","import path from 'node:path'\nimport { isEventStream, operationFileEntry, resolveDependencyOperationFile } from '@internals/shared'\nimport { ast, defineGenerator } from 'kubb/kit'\nimport type { Generator } from 'kubb/kit'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, jsxRenderer } from 'kubb/jsx'\nimport { buildZodErrorParse, resolveRequestValidator, resolveResponseValidator } from '../builders/validatorOptions.ts'\nimport { getOperationSecurity, type SecurityDocument } from '../builders/security.ts'\nimport { Operation } from '../components/Operation.tsx'\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 `RequestResult`. Only the generator\n * `name` differs between plugins; every other resolution, import, and rendering step is identical.\n */\nexport function createClientGenerator<TFactory extends ContractClientFactory>(name: string): Generator<TFactory> {\n return defineGenerator<TFactory>({\n name,\n renderer: jsxRenderer,\n operation(node, ctx) {\n if (!ast.isHttpOperationNode(node)) return null\n\n const { config, driver, resolver, root } = ctx\n const { output, validator, group } = ctx.options\n\n const pluginTs = driver.getPlugin(pluginTsName)\n if (!pluginTs) return null\n\n const tsResolver = driver.getResolver(pluginTsName)\n\n const validatorEnabled = resolveResponseValidator(validator) === 'zod' || resolveRequestValidator(validator) === 'zod'\n const pluginZod = validatorEnabled ? driver.getPlugin(pluginZodName) : null\n const zodResolver = pluginZod ? driver.getResolver(pluginZodName) : null\n\n const hasRequestBody = Boolean(node.requestBody?.content?.[0]?.schema)\n const importedTypeNames = [tsResolver.response.options(node), tsResolver.response.responses(node)]\n\n const importedZodNames = zodResolver\n ? [\n resolveResponseValidator(validator) === 'zod' ? zodResolver.response.response?.(node) : null,\n resolveResponseValidator(validator) === 'zod' ? (buildZodErrorParse(node, zodResolver)?.expression ?? null) : null,\n resolveRequestValidator(validator) === 'zod' && hasRequestBody ? zodResolver.response.body?.(node) : null,\n ].filter((name): name is string => Boolean(name))\n : []\n\n const meta = {\n name: resolver.name(node.operationId),\n file: resolver.file({ ...operationFileEntry(node, node.operationId), root, output, group: group ?? undefined }),\n fileTs: resolveDependencyOperationFile({\n cache: ctx.cache,\n node,\n resolver: tsResolver,\n root,\n output: pluginTs.options?.output ?? output,\n group: pluginTs.options?.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 const clientPath = path.resolve(root, '.kubb/client.ts')\n const eventStream = isEventStream(node)\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={eventStream ? ['client', 'toEventStream'] : ['client']} root={meta.file.path} path={clientPath} />\n <File.Import\n name={eventStream ? ['Options', 'EventStreamResult', 'SuccessOf'] : ['Options', 'RequestResult']}\n root={meta.file.path}\n path={clientPath}\n isTypeOnly\n />\n\n {meta.fileTs && importedTypeNames.length > 0 && (\n <File.Import name={Array.from(new Set(importedTypeNames))} root={meta.file.path} path={meta.fileTs.path} isTypeOnly />\n )}\n\n {meta.fileZod && importedZodNames.length > 0 && <File.Import name={importedZodNames} root={meta.file.path} path={meta.fileZod.path} />}\n\n <Operation name={meta.name} node={node} tsResolver={tsResolver} zodResolver={zodResolver} validator={validator} security={security} />\n </File>\n )\n },\n })\n}\n","import { File } from 'kubb/jsx'\nimport type { KubbReactNode } from 'kubb/jsx'\n\ntype Member = {\n className: string\n propName: string\n}\n\ntype Props = {\n name: string\n isExportable?: boolean\n isIndexable?: boolean\n members: Array<Member>\n children?: KubbReactNode\n}\n\n/**\n * Renders a composed root SDK class that instantiates every tag client from one shared config, so\n * `new PetStore({ baseURL }).petClient.getPetById(...)` reaches an operation through a single entry\n * point bound to one environment. The per-tag clients are read-only fields built in the constructor.\n */\nexport function SdkFacade({ name, isExportable = true, isIndexable = true, members, children }: Props): KubbReactNode {\n const fields = members.map((member) => ` readonly ${member.propName}: ${member.className}`)\n const assignments = members.map((member) => ` this.${member.propName} = new ${member.className}(config)`)\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={isExportable} isIndexable={isIndexable}>\n {classCode}\n {children}\n </File.Source>\n )\n}\n","import path from 'node:path'\nimport { getOperationParameters, operationFileEntry } from '@internals/shared'\nimport { camelCase } from '@internals/utils'\nimport { ast, defineGenerator } from 'kubb/kit'\nimport type { Generator } from 'kubb/kit'\nimport type { ResolverTs } from '@kubb/plugin-ts'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport type { ResolverZod } from '@kubb/plugin-zod'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, jsxRenderer } from 'kubb/jsx'\nimport {\n buildZodErrorParse,\n isValidatorEnabled,\n resolveQueryParamsValidator,\n resolveRequestValidator,\n resolveResponseValidator,\n} from '../builders/validatorOptions.ts'\nimport { type Auth, getOperationSecurity, type SecurityDocument } from '../builders/security.ts'\nimport { SdkClient } from '../components/SdkClient.tsx'\nimport { SdkFacade } from '../components/SdkFacade.tsx'\nimport type { ContractClientFactory, ValidatorOptions } from '../types.ts'\n\ntype GeneratorContext = Parameters<NonNullable<Generator<ContractClientFactory>['operations']>>[1]\n\ntype OperationData = {\n node: ast.OperationNode\n name: string\n tsResolver: ResolverTs\n zodResolver: ResolverZod | null\n typeFile: ast.FileNode\n zodFile: ast.FileNode | null\n security?: Array<Auth>\n}\n\ntype Controller = {\n name: string\n tag: string | undefined\n file: ast.FileNode\n operations: Array<OperationData>\n}\n\nfunction resolveTypeImportNames(node: ast.OperationNode, tsResolver: ResolverTs): Array<string> {\n return [tsResolver.response.options(node), tsResolver.response.responses(node)]\n}\n\nfunction resolveZodImportNames(node: ast.OperationNode, zodResolver: ResolverZod, validator: ValidatorOptions): Array<string> {\n const { query: queryParams } = getOperationParameters(node)\n const names: Array<string | null | undefined> = [\n resolveResponseValidator(validator) === 'zod' ? zodResolver.response.response(node) : null,\n resolveResponseValidator(validator) === 'zod' ? (buildZodErrorParse(node, zodResolver)?.expression ?? null) : null,\n resolveRequestValidator(validator) === 'zod' && node.requestBody?.content?.[0]?.schema ? zodResolver.response.body(node) : null,\n resolveQueryParamsValidator(validator) === 'zod' && queryParams.length > 0 ? zodResolver.param.query(node, queryParams[0]!) : null,\n ]\n return names.filter((n): n is string => Boolean(n))\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): Array<Controller> {\n const { driver, resolver, root } = ctx\n const { output, group, validator } = ctx.options\n\n const pluginTs = driver.getPlugin(pluginTsName)!\n const tsResolver = driver.getResolver(pluginTsName)\n const tsPluginOptions = pluginTs.options\n const pluginZod = isValidatorEnabled(validator) ? driver.getPlugin(pluginZodName) : null\n const zodResolver = pluginZod ? driver.getResolver(pluginZodName) : null\n const document = ctx.adapter.document as SecurityDocument | null | undefined\n\n function buildOperationData(node: ast.OperationNode): OperationData {\n const typeFile = tsResolver.file({\n ...operationFileEntry(node, node.operationId),\n root,\n output: tsPluginOptions?.output ?? output,\n group: tsPluginOptions?.group,\n })\n const zodFile =\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\n const security = ast.isHttpOperationNode(node) ? getOperationSecurity({ document, method: node.method, path: node.path }) : undefined\n\n return { node, name: resolver.name(node.operationId), tsResolver, zodResolver, typeFile, zodFile, security }\n }\n\n return nodes.reduce((acc, operationNode) => {\n if (!ast.isHttpOperationNode(operationNode)) return acc\n const tag = operationNode.tags[0]\n const name = tag ? (group?.name?.({ group: camelCase(tag) }) ?? resolver.groupName(tag)) : resolver.className('ApiClient')\n const file = resolver.file({ name, extname: '.ts', tag, root, output, group: group ?? undefined })\n const operationData = buildOperationData(operationNode)\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, so each environment is a separate instance. With `sdk.mode: 'tag'` (the default) it\n * emits one class per tag and, when `sdk.name` is set, a composed root that instantiates every tag\n * client. With `sdk.mode: 'flat'` it emits one class named by `sdk.name`, with every operation as a\n * direct method.\n */\nexport function createSdkGenerator<TFactory extends ContractClientFactory>(): 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, sdk } = ctx.options\n\n const pluginTs = ctx.driver.getPlugin(pluginTsName)\n if (!pluginTs || !sdk) return null\n\n const controllers = buildControllers(nodes, ctx)\n const clientPath = path.resolve(root, '.kubb/client.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: resolveTypeImportNames(op.node, op.tsResolver),\n }))\n const { namesByPath: zodNamesByPath, filesByPath: zodFilesByPath } = isValidatorEnabled(validator)\n ? collectImportsByFile(ops, (op) => ({ file: op.zodFile, names: op.zodResolver ? resolveZodImportNames(op.node, op.zodResolver, validator) : [] }))\n : { namesByPath: new Map<string, Set<string>>(), filesByPath: new Map<string, ast.FileNode>() }\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 name={['createClient']} root={file.path} path={clientPath} />\n <File.Import name={['ClientConfig', 'ClientInstance', 'Options', 'RequestResult']} root={file.path} path={clientPath} isTypeOnly />\n\n {validator === 'zod' && ops.some((op) => op.node.requestBody?.content?.[0]?.schema != 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 {isValidatorEnabled(validator) &&\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 <SdkClient name={className} operations={ops} validator={validator} />\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 if (sdk.mode === 'flat') {\n const flatName = resolver.className(sdk.name ?? 'sdk')\n const flatFile = resolver.file({ name: sdk.name ?? 'sdk', extname: '.ts', root, output, group: group ?? undefined })\n const allOps = controllers.flatMap((controller) => controller.operations)\n\n return renderClassFile(flatName, flatFile, allOps)\n }\n\n const classFiles = controllers.map(({ name, file, operations: ops }) => renderClassFile(name, file, ops))\n\n if (!sdk.name) return <>{classFiles}</>\n\n const sdkFile = resolver.file({ name: sdk.name, extname: '.ts', root, output, group: group ?? undefined })\n const facadeName = resolver.className(sdk.name)\n const members = controllers.map(({ name, tag }) => ({ className: name, propName: resolver.propertyName(tag ?? name) }))\n\n return (\n <>\n {classFiles}\n <File key={sdkFile.path} baseName={sdkFile.baseName} path={sdkFile.path} meta={sdkFile.meta} banner={banner(sdkFile)} footer={footer(sdkFile)}>\n <File.Import name={['ClientConfig']} 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={facadeName} members={members} />\n </File>\n </>\n )\n },\n })\n}\n","import { macroSimplifyUnion } from 'kubb/kit'\nimport type { ast } from 'kubb/kit'\n\n/**\n * Macros the client plugins apply by default, ahead of any user macros. `macroSimplifyUnion`\n * drops union members a broader scalar already covers, 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> = [macroSimplifyUnion]\n","import { camelCase, ensureValidVarName, pascalCase } from '@internals/utils'\nimport { createResolver } from 'kubb/kit'\nimport type { PluginContractClient } from './types.ts'\n\n/**\n * Default resolver shared by the client plugins. Functions and files inherit the built-in camelCase\n * `name` and `file`; 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 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 { PluginFetch } from '../types.ts'\n\n/**\n * Built-in operation generator for `@kubb/plugin-fetch`. 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 bundled `client` and returns the `RequestResult`.\n */\nexport const clientGenerator = createClientGenerator<PluginFetch>('fetch')\n","import { fileURLToPath } from 'node:url'\n\n/** Absolute path to the fetch client template, copied into `.kubb/client.ts`. */\nexport const fetchClientTemplatePath = fileURLToPath(new URL('../templates/fetch.ts', import.meta.url))\n\n/** Absolute path to the fetch serializers template, copied into `.kubb/serializers.ts`. */\nexport const fetchSerializersTemplatePath = fileURLToPath(new URL('../templates/serializers.ts', import.meta.url))\n\n/**\n * Absolute path to the Standard Schema runtime template. Pass it to a file node's `copy` field to\n * emit the helper into the generated `.kubb/standardSchema.ts` verbatim.\n */\nexport const standardSchemaTemplatePath = fileURLToPath(new URL('../templates/standardSchema.ts', import.meta.url))\n","import path from 'node:path'\nimport { createSdkGenerator, defaultMacros, isValidatorEnabled, resolverClient } from '@internals/client'\nimport { createGroupConfig } from '@internals/shared'\nimport { definePlugin, Resolver } from 'kubb/kit'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { clientGenerator } from './generators/clientGenerator.tsx'\nimport { fetchClientTemplatePath, fetchSerializersTemplatePath, standardSchemaTemplatePath } from './templates.ts'\nimport type { PluginFetch, ResolvedOptions, ResolverClient } from './types.ts'\n\n/**\n * Canonical plugin name for `@kubb/plugin-fetch`. Used for driver lookups and cross-plugin\n * dependency references.\n */\nexport const pluginFetchName = 'plugin-fetch' satisfies PluginFetch['name']\n\n/**\n * Generates a type-safe HTTP client pinned to the Fetch API. Each operation becomes one async\n * function that takes a single grouped `options` object and returns the shared `RequestResult`\n * contract. The runtime is always bundled into `.kubb/client.ts`, so generated code never imports\n * from `@kubb/plugin-fetch` and the only runtime dependency is the global `fetch`.\n *\n * @example\n * ```ts\n * import { defineConfig } from 'kubb/config'\n * import { pluginTs } from '@kubb/plugin-ts'\n * import { pluginFetch } from '@kubb/plugin-fetch'\n *\n * export default defineConfig({\n * input: './petStore.yaml',\n * output: { path: './src/gen' },\n * plugins: [\n * pluginTs(),\n * pluginFetch({ output: { path: './clients' } }),\n * ],\n * })\n * ```\n */\nexport const pluginFetch = definePlugin<PluginFetch>((options) => {\n const {\n output = { path: 'clients', barrel: { type: 'named' } },\n exclude = [],\n include,\n override = [],\n baseURL,\n validator = false,\n group,\n sdk,\n resolver: userResolver,\n } = options\n\n const resolved: ResolvedOptions = {\n output,\n exclude,\n include,\n override,\n group: createGroupConfig(group),\n baseURL,\n validator,\n sdk: sdk ? { mode: sdk.mode ?? 'tag', name: sdk.name } : undefined,\n resolver: userResolver ? Resolver.merge<ResolverClient>(resolverClient, userResolver) : resolverClient,\n }\n\n // `sdk` swaps the per-operation functions for the class-based SDK; left unset, the standalone\n // functions (which query plugins consume) stay.\n const selectedGenerators = resolved.sdk ? [createSdkGenerator<PluginFetch>()] : [clientGenerator]\n\n return {\n name: pluginFetchName,\n options,\n dependencies: [pluginTsName, isValidatorEnabled(resolved.validator) ? pluginZodName : null].filter((dependency): dependency is string =>\n Boolean(dependency),\n ),\n hooks: {\n 'kubb:plugin:setup'(ctx) {\n ctx.setOptions(resolved)\n ctx.setResolver(resolved.resolver)\n ctx.setMacros([...defaultMacros, ...(options.macros ?? [])])\n\n ctx.addGenerator(...selectedGenerators)\n\n const root = path.resolve(ctx.config.root, ctx.config.output.path)\n const baseURLExpression = baseURL ? (baseURL.includes('${') ? `\\`${baseURL.replaceAll('`', '\\\\`')}\\`` : JSON.stringify(baseURL)) : undefined\n\n ctx.injectFile({\n baseName: 'serializers.ts',\n path: path.resolve(root, '.kubb/serializers.ts'),\n copy: fetchSerializersTemplatePath,\n })\n\n ctx.injectFile({\n baseName: 'client.ts',\n path: path.resolve(root, '.kubb/client.ts'),\n copy: fetchClientTemplatePath,\n footer: baseURLExpression ? `client.setConfig({ baseURL: ${baseURLExpression} })` : undefined,\n })\n\n ctx.injectFile({\n baseName: 'standardSchema.ts',\n path: path.resolve(root, '.kubb/standardSchema.ts'),\n copy: standardSchemaTemplatePath,\n })\n },\n },\n }\n})\n\nexport default pluginFetch\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,SAAgB,aAAa,QAA4D;CACvF,MAAM,uBAAO,IAAI,IAAY;CAE7B,OAAO,OAAO,QAAQ,UAAU;EAC9B,IAAI,KAAK,IAAI,MAAM,IAAI,GAAG,OAAO;EACjC,KAAK,IAAI,MAAM,IAAI;EACnB,OAAO;CACT,CAAC;AACH;;;;;;;;;;;;;;ACJA,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,OAAO,MAAM,UAAU,MAAM,QAAQ,UAAU;CAEvD,OAAO,MAAM,SAAS,GAAG,SAAS,WAAW,uBAC3C,SAAS,KAAK;EAAE,GAAG,mBAAmB,MAAM,KAAK,WAAW;EAAG;EAAM;EAAQ,OAAO,SAAS,KAAA;CAAU,CAAC,CAC1G;AACF;AAsHA,SAAS,iBAAiB,MAAyB,MAA2C;CAC5F,IAAI,CAAC,MACH,OAAO;CAGT,IAAI,OAAO,SAAS,YAClB,OAAO,KAAK,IAAI,KAAK;CAGvB,OAAO,KAAK,OAAO,UAAUA,SAAAA,IAAI,OAAO,KAAK,I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AAO,OAAO,IAAI;GACjE,MAAM,oBAAoB,UAAW,QAAQ,SAAS,IAAI,IAAI,KAAK,QAAQ,WAAW,KAAK,KAAK,EAAE,MAAM,KAAK,UAAU,OAAO,IAAK,KAAA;GAEnI,IAAI,WAAW;IACb,UAAU;IACV,MAAMA,UAAAA,QAAK,QAAQ,MAAM,sBAAsB;IAC/C,MAAM;GACR,CAAC;GAED,IAAI,WAAW;IACb,UAAU;IACV,MAAMA,UAAAA,QAAK,QAAQ,MAAM,iBAAiB;IAC1C,MAAM;IACN,QAAQ,oBAAoB,+BAA+B,kBAAkB,OAAO,KAAA;GACtF,CAAC;GAED,IAAI,WAAW;IACb,UAAU;IACV,MAAMA,UAAAA,QAAK,QAAQ,MAAM,yBAAyB;IAClD,MAAM;GACR,CAAC;EACH,EACF;CACF;AACF,CAAC"}
1
+ {"version":3,"file":"index.cjs","names":["Url","functionPrinter","createFunctionParameters","createFunctionParameter","ast","ast","ast","File","Function","File","defineGenerator","jsxRenderer","ast","pluginTsName","pluginZodName","path","File","File","pluginTsName","pluginZodName","ast","defineGenerator","jsxRenderer","path","File","macroSimplifyUnion","createResolver","fileURLToPath","definePlugin","Resolver","pluginTsName","pluginZodName","path"],"sources":["../../../internals/shared/src/params.ts","../../../internals/shared/src/operation.ts","../../../internals/utils/src/casing.ts","../../../internals/utils/src/reserved.ts","../../../internals/utils/src/codegen.ts","../../../internals/shared/src/group.ts","../../../internals/client/src/builders/generics.ts","../../../internals/client/src/builders/returnStatement.ts","../../../internals/client/src/builders/security.ts","../../../internals/client/src/builders/signature.ts","../../../internals/client/src/builders/validatorOptions.ts","../../../internals/client/src/builders/validator.ts","../../../internals/client/src/builders/sdkMethod.ts","../../../internals/client/src/builders/styles.ts","../../../internals/client/src/components/Operation.tsx","../../../internals/client/src/components/SdkClient.tsx","../../../internals/client/src/generators/clientGenerator.tsx","../../../internals/client/src/components/SdkFacade.tsx","../../../internals/client/src/generators/sdkGenerator.tsx","../../../internals/client/src/macros.ts","../../../internals/client/src/resolver.ts","../src/generators/clientGenerator.tsx","../src/templates.ts","../src/plugin.ts"],"sourcesContent":["import type { ast } from 'kubb/kit'\n\n/**\n * Drops parameters that share the same name, keeping the first.\n *\n * A malformed spec can declare the same parameter name twice within one `in` location. Both would\n * resolve to the same output property, so emitting both would yield an object type with a duplicate\n * member, which TypeScript rejects. This is a defensive guard against that case, not a casing guard:\n * parameter names flow through unchanged, so no two distinct names ever collide here anymore.\n */\nexport function dedupeParams(params: Array<ast.ParameterNode>): Array<ast.ParameterNode> {\n const seen = new Set<string>()\n\n return params.filter((param) => {\n if (seen.has(param.name)) return false\n seen.add(param.name)\n return true\n })\n}\n","import { ast, type Group, type NodeCache, type Output, type Resolver, type ResolverFileParams, Url } from 'kubb/kit'\nimport { dedupeParams } from './params.ts'\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 `cache` (the\n * current node's `ctx.cache`) under the resolver's own plugin name. 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({ cache: ctx.cache, node, resolver: tsResolver, root, output })\n * ```\n */\nexport function resolveDependencyOperationFile(options: {\n cache: NodeCache\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 { cache, node, resolver, root, output, group } = options\n\n return cache.ensureItem(`${resolver.pluginName}:operationFile`, () =>\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\n/**\n * Resolver interface for building operation parameters.\n *\n * `ResolverTs` from `@kubb/plugin-ts` satisfies this interface and can be passed directly.\n */\nexport type OperationParamsResolver = {\n /**\n * Naming for an operation's parameters, grouped by location.\n */\n param: {\n /**\n * Resolves the type name for an individual parameter.\n *\n * @example Individual path parameter name\n * `resolver.param.name(node, param) // → 'DeletePetPathPetId'`\n */\n name(node: ast.OperationNode, param: ast.ParameterNode): string\n /**\n * Resolves the grouped path parameters type name.\n * When the return value equals `resolver.param.name`, no indexed access is emitted.\n *\n * @example Grouped path params type name\n * `resolver.param.path(node, param) // → 'DeletePetPath'`\n */\n path(node: ast.OperationNode, param: ast.ParameterNode): string\n /**\n * Resolves the grouped query parameters type name.\n * When the return value equals `resolver.param.name`, an inline struct type is emitted instead.\n *\n * @example Grouped query params type name\n * `resolver.param.query(node, param) // → 'FindPetsByStatusQuery'`\n */\n query(node: ast.OperationNode, param: ast.ParameterNode): string\n /**\n * Resolves the grouped header parameters type name.\n * When the return value equals `resolver.param.name`, an inline struct type is emitted instead.\n *\n * @example Grouped header params type name\n * `resolver.param.headers(node, param) // → 'DeletePetHeaders'`\n */\n headers(node: ast.OperationNode, param: ast.ParameterNode): string\n }\n /**\n * Naming for an operation's request and response types.\n */\n response: {\n /**\n * Resolves the request body type name.\n *\n * @example Request body type name\n * `resolver.response.body(node) // → 'CreatePetBody'`\n */\n body(node: ast.OperationNode): 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<ast.ParameterNode['in'], 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 * Whether an operation streams its primary success response as Server-Sent Events\n * (`text/event-stream`). The client generator uses this to return a typed event stream instead of a\n * one-shot `RequestResult`.\n */\nexport function isEventStream(node: ast.OperationNode): boolean {\n return getPrimarySuccessContentType(node) === 'text/event-stream'\n}\n\n/**\n * Derives the default `responseType` for an operation from its primary success response.\n *\n * Returns a value only when that response declares a single non-JSON content type. `text/event-stream`\n * and other binary types (`application/octet-stream`, `application/pdf`, `image/*`, `audio/*`,\n * `video/*`) map to a stream or `'blob'`, and other `text/*` maps to `'text'`. Otherwise `undefined`,\n * leaving the runtime client's `Content-Type` auto-detection in charge.\n */\nexport function getResponseType(node: ast.OperationNode): ResponseType | undefined {\n const baseType = getPrimarySuccessContentType(node)\n if (!baseType) return undefined\n\n if (baseType === 'application/json' || baseType.endsWith('+json') || baseType === 'text/json') return undefined\n if (baseType === 'text/event-stream') return 'stream'\n if (baseType.startsWith('text/')) return 'text'\n if (baseType === 'application/octet-stream' || baseType === 'application/pdf' || /^(image|audio|video)\\//.test(baseType)) return 'blob'\n return undefined\n}\n\n/**\n * Maps a content type to the PascalCase suffix used to name per-content-type variants\n * (e.g. `application/json` → `Json`, `application/xml` → `Xml`, `multipart/form-data` → `FormData`).\n */\nfunction getContentTypeSuffix(contentType: string): string {\n const baseType = contentType.split(';')[0]!.trim()\n if (baseType === 'application/json') return 'Json'\n if (baseType === 'multipart/form-data') return 'FormData'\n if (baseType === 'application/x-www-form-urlencoded') return 'FormUrlEncoded'\n const subtype = baseType.split('/').pop() ?? baseType\n const parts = subtype.split(/[^a-zA-Z0-9]+/).filter(Boolean)\n if (parts.length === 0) return 'Unknown'\n return parts.map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join('')\n}\n\n/**\n * Appends a content-type suffix to a base name, keeping a trailing `Data` segment last\n * (e.g. `AddPetData` + `Json` → `AddPetJsonData`, `AddPetStatus200` + `Xml` → `AddPetStatus200Xml`).\n */\nexport function getPerContentTypeName(baseName: string, suffix: string): string {\n if (baseName.endsWith('Data')) {\n return suffix.endsWith('Data') ? baseName.slice(0, -4) + suffix : `${baseName.slice(0, -4)}${suffix}Data`\n }\n return baseName + suffix\n}\n\nexport type ContentVariantInput = { contentType: string; schema?: ast.SchemaNode | null; keysToOmit?: Array<string> | null }\nexport type ContentVariant = { name: string; suffix: string; schema: ast.SchemaNode; keysToOmit?: Array<string> | null; contentType: string }\n\n/**\n * Resolves per-content-type variant names for a set of content entries, deduplicating suffix\n * collisions with a numeric counter. Entries without a schema are skipped. The returned `suffix` is\n * the final (possibly counter-augmented) value, so callers can derive parallel names in another\n * namespace (e.g. plugin-faker deriving the matching plugin-ts type name).\n */\nexport function resolveContentTypeVariants(entries: Array<ContentVariantInput>, baseName: string): Array<ContentVariant> {\n const usedNames = new Set<string>()\n return entries\n .filter((entry) => entry.schema)\n .map((entry) => {\n const baseSuffix = getContentTypeSuffix(entry.contentType)\n let suffix = baseSuffix\n let name = getPerContentTypeName(baseName, suffix)\n let counter = 2\n while (usedNames.has(name)) {\n suffix = `${baseSuffix}${counter++}`\n name = getPerContentTypeName(baseName, suffix)\n }\n usedNames.add(name)\n return { name, suffix, schema: entry.schema!, keysToOmit: entry.keysToOmit, contentType: entry.contentType }\n })\n}\n\nexport function buildRequestConfigType(node: ast.OperationNode): string {\n const request = getContentTypeInfo(node)\n const response = getResponseContentTypeInfo(node)\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`.\n const configType = `Partial<Omit<RequestConfig, 'path' | 'query' | 'body' | 'headers' | 'url'>>`\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 ? `${configType} & { contentType?: { ${members.join('; ')} } }` : configType\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 `Partial<Omit<RequestConfig, 'path' | 'query' | 'body' | 'headers' | 'url'>>`\n}\n\nexport type RequestGroups = {\n path: boolean\n query: boolean\n body: boolean\n headers: boolean\n}\n\n/**\n * Which of the grouped request options an operation carries.\n */\nexport function getRequestGroups(node: ast.OperationNode): RequestGroups {\n const { path, query, header } = getOperationParameters(node)\n return {\n path: path.length > 0,\n query: query.length > 0,\n body: Boolean(node.requestBody?.content?.[0]?.schema),\n headers: header.length > 0,\n }\n}\n\nexport type RequestGroupOptionality = {\n groups: RequestGroups\n hasRequiredPath: boolean\n hasRequiredQuery: boolean\n hasRequiredHeader: boolean\n /**\n * Whether the grouped request parameter can default to `{}`. True only when no group carries a\n * required member, so every member is safe to omit.\n */\n isOptional: boolean\n}\n\n/**\n * Resolves which grouped request options an operation carries together with whether each group\n * holds a required member. The grouped parameter stays optional only when nothing inside it is\n * required, matching the generated `RequestConfig` type.\n */\nexport function getRequestGroupOptionality(node: ast.OperationNode): RequestGroupOptionality {\n const groups = getRequestGroups(node)\n const { path, query, header } = getOperationParameters(node)\n const hasRequiredPath = path.some((param) => param.required)\n const hasRequiredQuery = query.some((param) => param.required)\n const hasRequiredHeader = header.some((param) => param.required)\n\n return {\n groups,\n hasRequiredPath,\n hasRequiredQuery,\n hasRequiredHeader,\n isOptional: !hasRequiredPath && !hasRequiredQuery && !hasRequiredHeader && !groups.body,\n }\n}\n\nexport type RequestOptionsNameResolver = RequestConfigResolver & {\n response: {\n options(node: ast.OperationNode): string\n }\n}\n\n/**\n * Builds the grouped `{ path, query, body, headers }` parameter for a generated client\n * function, typed from the operation's `Options` (minus `url`). Only the groups the\n * operation actually has are destructured. The trailing `config` parameter carries the\n * runtime `RequestConfig` overrides plus `client`.\n */\nexport function buildRequestParamsSignature(\n node: ast.OperationNode,\n resolver: RequestOptionsNameResolver,\n options: { isConfigurable?: boolean } = {},\n): { signature: string; groups: RequestGroups } {\n const { isConfigurable = true } = options\n const { groups, isOptional } = getRequestGroupOptionality(node)\n\n const names = (['path', 'query', 'body', 'headers'] as const).filter((key) => groups[key])\n\n const firstParam = names.length > 0 ? `{ ${names.join(', ')} }: ${resolver.response.options(node)}${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 * 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 const groups: OperationParameterGroups = {\n path: dedupeParams(node.parameters.filter((param) => param.in === 'path')),\n query: dedupeParams(node.parameters.filter((param) => param.in === 'query')),\n header: dedupeParams(node.parameters.filter((param) => param.in === 'header')),\n cookie: dedupeParams(node.parameters.filter((param) => param.in === '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 buildOptionsSchema(node: ast.OperationNode, resolver: OperationTypeNameResolver): 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 // 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 return ast.factory.createSchema({\n type: 'object',\n primitive: 'object',\n deprecated: node.deprecated,\n properties: [\n ast.factory.createProperty({\n name: 'body',\n required: hasBody,\n schema: hasBody ? ast.factory.createSchema({ type: 'ref', name: resolver.response.body(node) }) : createNever(),\n }),\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 ],\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\nconst typeNamesByResolver = new WeakMap<OperationTypeNameResolver, Map<string, string[]>>()\n\nexport function resolveOperationTypeNames(\n node: ast.OperationNode,\n resolver: OperationTypeNameResolver,\n options: ResolveOperationTypeNameOptions = {},\n): string[] {\n const cacheKey = `${node.operationId}\\0${options.order ?? ''}\\0${options.responseStatusNames ?? ''}\\0${options.includeParams === false ? 'noparams' : ''}\\0${(options.exclude ?? []).join(',')}`\n let byResolver = typeNamesByResolver.get(resolver)\n if (byResolver) {\n const cached = byResolver.get(cacheKey)\n if (cached) return cached\n } else {\n byResolver = new Map()\n typeNamesByResolver.set(resolver, byResolver)\n }\n\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 const result = names.filter((name): name is string => Boolean(name) && !exclude.has(name as string))\n byResolver.set(cacheKey, result)\n return result\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\nexport function findSuccessStatusCode(responses: Array<{ statusCode: ast.StatusCode | number | string }>): ast.StatusCode | null {\n for (const response of responses) {\n if (isSuccessStatusCode(response.statusCode)) {\n return response.statusCode as ast.StatusCode\n }\n }\n\n return null\n}\n","type Options = {\n /**\n * Text prepended before casing is applied.\n */\n prefix?: string\n /**\n * Text appended before casing is applied.\n */\n suffix?: string\n}\n\n/**\n * Shared implementation for camelCase and PascalCase conversion.\n * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)\n * and capitalizes each word according to `pascal`.\n *\n * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.\n */\nfunction toCamelOrPascal(text: string, pascal: boolean): string {\n return text\n .trim()\n .replace(/([a-z\\d])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n .replace(/(\\d)([a-z])/g, '$1 $2')\n .split(/[\\s\\-_./\\\\:]+/)\n .filter(Boolean)\n .map((word, i) => {\n if (word.length > 1 && word === word.toUpperCase()) return word\n const head = i === 0 && !pascal ? word.charAt(0).toLowerCase() : word.charAt(0).toUpperCase()\n return head + word.slice(1)\n })\n .join('')\n .replace(/[^a-zA-Z0-9]/g, '')\n}\n\n/**\n * Converts `text` to camelCase.\n *\n * @example Word boundaries\n * `camelCase('hello-world') // 'helloWorld'`\n *\n * @example With a prefix\n * `camelCase('tag', { prefix: 'create' }) // 'createTag'`\n */\nexport function camelCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false)\n}\n\n/**\n * Converts `text` to PascalCase.\n *\n * @example Word boundaries\n * `pascalCase('hello-world') // 'HelloWorld'`\n *\n * @example With a suffix\n * `pascalCase('tag', { suffix: 'schema' }) // 'TagSchema'`\n */\nexport function pascalCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true)\n}\n\n/**\n * Uppercases only the first character of `text`, leaving the rest untouched.\n * Unlike {@link pascalCase} it never re-splits word boundaries or strips characters.\n *\n * @example\n * `capitalize('getPetById') // 'GetPetById'`\n */\nexport function capitalize(text: string): string {\n return `${text.charAt(0).toUpperCase()}${text.slice(1)}`\n}\n\n/**\n * Converts `text` to snake_case.\n *\n * @example From camelCase\n * `snakeCase('helloWorld') // 'hello_world'`\n *\n * @example From mixed separators\n * `snakeCase('Hello-World') // 'hello_world'`\n */\nexport function snakeCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n const processed = `${prefix} ${text} ${suffix}`.trim()\n return processed\n .replace(/([a-z])([A-Z])/g, '$1_$2')\n .replace(/[\\s\\-.]+/g, '_')\n .replace(/[^a-zA-Z0-9_]/g, '')\n .toLowerCase()\n .split('_')\n .filter(Boolean)\n .join('_')\n}\n\n/**\n * Converts `text` to SCREAMING_SNAKE_CASE.\n *\n * @example From camelCase\n * `screamingSnakeCase('helloWorld') // 'HELLO_WORLD'`\n */\nexport function screamingSnakeCase(text: string, { prefix = '', suffix = '' }: Options = {}): string {\n return snakeCase(text, { prefix, suffix }).toUpperCase()\n}\n","/**\n * JavaScript and Java reserved words.\n * @link https://github.com/jonschlinkert/reserved/blob/master/index.js\n */\nconst reservedWords = new Set([\n 'abstract',\n 'arguments',\n '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 { isIdentifier } from './reserved.ts'\nimport { singleQuote } from './strings.ts'\n\nconst INDENT = ' '\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 * Indents every non-empty line of `text` by one indent level, leaving blank lines empty.\n */\nfunction indentLines(text: string): string {\n if (!text) return ''\n return text\n .split('\\n')\n .map((line) => (line.trim() ? `${INDENT}${line}` : ''))\n .join('\\n')\n}\n\n/**\n * Renders an object key, quoting it with single quotes only when it is not a valid identifier.\n * Reserved words and globals (`name`, `class`, …) are valid bare keys and stay unquoted.\n *\n * @example\n * ```ts\n * objectKey('name') // 'name'\n * objectKey('x-total') // \"'x-total'\"\n * ```\n */\nexport function objectKey(name: string): string {\n return isIdentifier(name) ? name : singleQuote(name)\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) => `${indentLines(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) => `${indentLines(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","import { camelCase } from '@internals/utils'\nimport type { Group } from 'kubb/kit'\n\n/**\n * Builds the `group` config a Kubb plugin passes to `ctx.setOptions`, applying the\n * shared default naming so every plugin groups output consistently:\n *\n * - `path` groups use the second path segment (`/pet/findByStatus` → `pet`).\n * - other groups use the camelCased group (`pet store` → `petStore`).\n *\n * A user-provided `group.name` always wins over the default namer, so callers stay in\n * control of their output folders. Returns `null` when grouping is disabled, matching the\n * per-plugin convention.\n *\n * @param group - The user-supplied group option, or `undefined` to disable grouping.\n *\n * @example\n * ```ts\n * createGroupConfig(group) // shared across every plugin\n * ```\n */\nexport function createGroupConfig(group: Group | undefined): Group | null {\n if (!group) {\n return null\n }\n\n const defaultName = (ctx: { group: string }): string => {\n if (group.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n\n return camelCase(ctx.group)\n }\n\n return {\n ...group,\n name: group.name ? group.name : defaultName,\n } satisfies Group\n}\n","import type { ast } from 'kubb/kit'\nimport type { ResolverTs } from '@kubb/plugin-ts'\n\n/**\n * Builds the `RequestResult` generic arguments for one operation: the plugin-ts per-status responses\n * record 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, tsResolver }) // 'AddPetResponses, ThrowOnError'`\n */\nexport function buildRequestResultGenerics({ node, tsResolver }: { node: ast.OperationNode; tsResolver: ResolverTs }): string {\n return `${tsResolver.response.responses(node)}, ThrowOnError`\n}\n","import type { ast } from 'kubb/kit'\nimport type { ResolverTs } from '@kubb/plugin-ts'\nimport { buildRequestResultGenerics } from './generics.ts'\n\n/**\n * Builds the return statement of a generated operation function. The runtime call already resolves\n * to `{ data, error, request, response }`; the generated code forwards that result and casts it to\n * the operation's `RequestResult`, which carries the `throwOnError` discrimination.\n *\n * @example\n * `return request({ method: 'POST', url: '/pet', ...config }) as Promise<RequestResult<AddPetResponses, ThrowOnError>>`\n */\nexport function buildReturnStatement({ node, tsResolver, callConfig }: { node: ast.OperationNode; tsResolver: ResolverTs; callConfig: string }): string {\n return `return request(${callConfig}) as Promise<RequestResult<${buildRequestResultGenerics({ node, tsResolver })}>>`\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}\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 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 of Object.keys(requirement)) {\n if (seen.has(schemeName)) continue\n seen.add(schemeName)\n const auth = resolveSecurityScheme(definitions[schemeName])\n if (auth) security.push(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 type { ast } from 'kubb/kit'\nimport { getRequestGroupOptionality } from '@internals/shared'\nimport { createFunctionParameter, createFunctionParameters, functionPrinter, type ResolverTs } from '@kubb/plugin-ts'\nimport { buildRequestResultGenerics } 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 * Name of the per-operation grouped data type, the plugin-ts `<Name>Options` used directly\n * as the function input.\n */\n dataTypeName: string\n /**\n * The single function parameter: `options: Options<<Name>Options, ThrowOnError>`.\n */\n paramsSignature: string\n /**\n * The function return type: `Promise<RequestResult<<Name>Responses, ThrowOnError>>`.\n */\n returnType: string\n /**\n * The function generics. One per-call `ThrowOnError` flag, defaulting to `true`.\n */\n generics: Array<string>\n /**\n * The plugin-ts type names the generated file imports (type-only).\n */\n importedTypeNames: Array<string>\n}\n\n/**\n * Builds the grouped-options signature for one operation: a single `options` object whose `TData`\n * is the plugin-ts `<Name>Options` (carrying a literal `url`), and a `RequestResult` return type\n * keyed to the plugin-ts per-status responses 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.\n */\nexport function buildGroupedOptionsSignature({ node, tsResolver }: { node: ast.OperationNode; tsResolver: ResolverTs }): GroupedOptionsSignature {\n const optionsName = tsResolver.response.options(node)\n const responsesName = tsResolver.response.responses(node)\n const resultGenerics = buildRequestResultGenerics({ node, tsResolver })\n const { isOptional } = getRequestGroupOptionality(node)\n\n const paramsSignature =\n declarationPrinter.print(\n createFunctionParameters({\n params: [createFunctionParameter({ name: 'options', type: `Options<${optionsName}, ThrowOnError>`, ...(isOptional ? { default: '{}' } : {}) })],\n }),\n ) ?? ''\n\n return {\n dataTypeName: optionsName,\n paramsSignature,\n returnType: `Promise<RequestResult<${resultGenerics}>>`,\n generics: ['ThrowOnError extends boolean = true'],\n importedTypeNames: [optionsName, responsesName],\n }\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.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 query-parameters parsing is enabled, `null` otherwise. Only the object form\n * `{ request: 'zod' }` enables it.\n */\nexport function resolveQueryParamsValidator(validator: ValidatorOptions | undefined): 'zod' | null {\n if (!validator || validator === 'zod') return null\n return validator.request ?? 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 * The zod validation a generated client applies to a success response body.\n */\nexport type ZodResponseParse = {\n /**\n * The success-only response schema name that the generated code calls `.parse(data)` on.\n */\n expression: string\n /**\n * Schema names the generated file imports from the zod plugin output.\n */\n importNames: Array<string>\n}\n\n/**\n * Resolves the zod expression a generated client validates a success response with. Only success\n * (2xx) bodies reach the parse under the throw-on-error contract, so the success-only\n * `<operation>ResponseSchema` is used; error bodies are never zod-parsed.\n */\nexport function buildZodResponseParse(node: ast.OperationNode, zodResolver: ResolverZod): ZodResponseParse | null {\n const name = zodResolver.response.response(node)\n return name ? { expression: name, importNames: [name] } : null\n}\n\n/**\n * Resolves the zod expression 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): ZodResponseParse | null {\n const hasErrorResponse = node.responses.some((res) => !isSuccessStatusCode(res.statusCode) && res.content?.some((entry) => entry.schema))\n if (!hasErrorResponse) return null\n const name = zodResolver.response.error?.(node)\n return name ? { expression: name, importNames: [name] } : null\n}\n","import type { ast } from 'kubb/kit'\nimport type { ResolverZod } from '@kubb/plugin-zod'\nimport type { ValidatorOptions } from '../types.ts'\nimport { buildZodErrorParse, buildZodResponseParse, 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.response` /\n * `validator.error` slot; `client.ts` runs it through `validateStandardSchema`. The response validator\n * 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 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 validation runs 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 importedZodNames: Array<string> = []\n\n const hasRequestBody = Boolean(node.requestBody?.content?.[0]?.schema)\n const zodRequestName = zodResolver && resolveRequestValidator(validator) === 'zod' && hasRequestBody ? zodResolver.response.body(node) : null\n const request = zodRequestName ?? null\n if (zodRequestName) importedZodNames.push(zodRequestName)\n\n const responseParse = zodResolver && resolveResponseValidator(validator) === 'zod' ? buildZodResponseParse(node, zodResolver) : null\n const response = responseParse ? responseParse.expression : null\n if (responseParse) importedZodNames.push(...responseParse.importNames)\n\n const errorParse = zodResolver && resolveResponseValidator(validator) === 'zod' ? buildZodErrorParse(node, zodResolver) : null\n const error = errorParse ? errorParse.expression : null\n if (errorParse) importedZodNames.push(...errorParse.importNames)\n\n return { request, response, error, importedZodNames }\n}\n","import { buildOperationComments } from '@internals/shared'\nimport { buildJSDoc } from '@internals/utils'\nimport { ast } from 'kubb/kit'\nimport type { ResolverTs } from '@kubb/plugin-ts'\nimport type { ResolverZod } from '@kubb/plugin-zod'\nimport type { ValidatorOptions } from '../types.ts'\nimport { buildReturnStatement } from './returnStatement.ts'\nimport { type Auth, buildSecurityMetadata } from './security.ts'\nimport { buildGroupedOptionsSignature } from './signature.ts'\nimport { buildValidatorHooks } from './validator.ts'\n\n/**\n * Builds the call config literal forwarded to the contract client, mirroring the shared `Operation`\n * component: `{ method, url, security?, validator?, ...config }`. The `...config` spread carries every\n * per-call field (including `throwOnError`), so the method stays a thin wrapper over the contract.\n */\nfunction buildCallConfig({\n node,\n validator,\n zodResolver,\n security,\n}: {\n node: ast.HttpOperationNode\n validator: ValidatorOptions | undefined\n zodResolver?: ResolverZod | null\n security?: Array<Auth>\n}): string {\n const validators = buildValidatorHooks({ node, validator, zodResolver })\n const validatorEntries = [\n validators.request ? `request: ${validators.request}` : null,\n validators.response ? `response: ${validators.response}` : null,\n ].filter(Boolean)\n const validatorLiteral = validatorEntries.length ? `validator: { ${validatorEntries.join(', ')} }` : null\n const securityLiteral = buildSecurityMetadata({ security })\n\n return `{ ${[\n `method: '${node.method.toUpperCase()}'`,\n `url: '${node.path}'`,\n securityLiteral ? `security: ${securityLiteral}` : null,\n validatorLiteral,\n '...config',\n ]\n .filter(Boolean)\n .join(', ')} }`\n}\n\n/**\n * Builds a single instance method for a generated SDK class. The body forwards the single grouped\n * `options` object to the instance's own client (`this.client`, built once in the constructor) and\n * returns the `RequestResult`. A per-call `options.client` still overrides the instance client, so\n * one operation can be routed to a different environment without a new instance.\n */\nexport function buildSdkMethod({\n node,\n name,\n tsResolver,\n zodResolver,\n validator,\n security,\n}: {\n node: ast.OperationNode\n name: string\n tsResolver: ResolverTs\n zodResolver?: ResolverZod | null\n validator: ValidatorOptions | undefined\n security?: Array<Auth>\n}): string {\n if (!ast.isHttpOperationNode(node)) return ''\n\n const signature = buildGroupedOptionsSignature({ node, tsResolver })\n const callConfig = buildCallConfig({ node, validator, zodResolver, security })\n const returnStatement = buildReturnStatement({ node, tsResolver, callConfig })\n const generics = signature.generics.length ? `<${signature.generics.join(', ')}>` : ''\n const jsdoc = buildJSDoc(buildOperationComments(node, { link: 'urlPath', linkPosition: 'beforeDeprecated', splitLines: true }))\n\n const methodBody = ['const { client: request = this.client, ...config } = options', '', returnStatement].map((line) => (line ? ` ${line}` : '')).join('\\n')\n\n return `${jsdoc} public ${name}${generics}(${signature.paramsSignature}): ${signature.returnType} {\\n${methodBody}\\n }`\n}\n","import { camelCase, 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.\n * Path keys are camelCased to match the URL template placeholders. Query, header, and cookie keys\n * keep the spec name, matching the remapped keys the runtime serializes.\n */\nfunction toKey(name: string, location: StyledLocation): string {\n const key = location === 'path' ? camelCase(name) : name\n return isValidVarName(key) ? key : JSON.stringify(key)\n}\n\n/**\n * Serializes one parameter's metadata into a `{ style, explode }` literal, or `null` when the\n * parameter carries neither. Path and query carry the serialization `style`; header and cookie use a\n * fixed style (`simple` and `form`), so only `explode` is emitted for them.\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 return parts.length > 0 ? `{ ${parts.join(', ')} }` : null\n}\n\n/**\n * Builds the per-operation `styles` literal from the operation's parameters, grouped by location.\n * Path entries are keyed by the camelCased name to match the URL template placeholders; query,\n * header, and cookie entries keep the spec name to match the keys the runtime serializes.\n * Only parameters whose source defines `style` or `explode` are emitted, so calls without\n * serialization metadata keep the runtime defaults and existing output is unchanged. Returns `null`\n * when no parameter 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 parameter of node.parameters) {\n const literal = serializeParameter(parameter)\n if (!literal) continue\n groups[parameter.in].push(`${toKey(parameter.name, parameter.in)}: ${literal}`)\n }\n\n const locations = (Object.keys(groups) as Array<StyledLocation>).filter((location) => groups[location].length > 0)\n if (locations.length === 0) return null\n\n return `{ ${locations.map((location) => `${location}: { ${groups[location].join(', ')} }`).join(', ')} }`\n}\n","import { buildOperationComments, getContentTypeInfo, getResponseContentTypeInfo, getResponseType, isEventStream } from '@internals/shared'\nimport { ast } from 'kubb/kit'\nimport type { ResolverTs } from '@kubb/plugin-ts'\nimport type { ResolverZod } from '@kubb/plugin-zod'\nimport { File, Function } from 'kubb/jsx'\nimport type { KubbReactNode } from 'kubb/jsx'\nimport { buildReturnStatement } from '../builders/returnStatement.ts'\nimport { type Auth, buildSecurityMetadata } from '../builders/security.ts'\nimport { buildGroupedOptionsSignature } from '../builders/signature.ts'\nimport { buildStyles } from '../builders/styles.ts'\nimport { buildValidatorHooks } from '../builders/validator.ts'\nimport type { ValidatorOptions } 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 * Resolver for the plugin-ts type names the signature references.\n */\n tsResolver: ResolverTs\n /**\n * Resolver for the zod schema names the validators reference, when `validator` is on.\n */\n zodResolver?: ResolverZod | null\n /**\n * The active validator option, driving the validator-hook wiring.\n */\n validator?: ValidatorOptions\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 isExportable?: boolean\n isIndexable?: boolean\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 `RequestResult`. The type, signature,\n * and call config are built with the AST factory, and only the jsx-renderer emits the source.\n */\nexport function Operation({ name, node, tsResolver, zodResolver, validator, security, isExportable = true, isIndexable = true }: Props): KubbReactNode {\n if (!ast.isHttpOperationNode(node)) return null\n\n const signature = buildGroupedOptionsSignature({ node, tsResolver })\n const validators = buildValidatorHooks({ node, validator, zodResolver })\n const securityLiteral = buildSecurityMetadata({ security })\n const stylesLiteral = buildStyles({ node })\n\n const { defaultContentType } = getContentTypeInfo(node)\n const hasRequestBody = Boolean(node.requestBody?.content?.[0]?.schema)\n // Bake the request body content type only when it is not the JSON default. The first declared type is\n // the default for an operation with several request types; the caller overrides it on `contentType`.\n const bakedRequestContentType = hasRequestBody && defaultContentType !== 'application/json' ? defaultContentType : null\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 mergeContentType = Boolean(bakedRequestContentType) && getResponseContentTypeInfo(node).isMultipleContentTypes\n const contentTypeLiteral = !bakedRequestContentType\n ? null\n : mergeContentType\n ? `contentType: { request: '${bakedRequestContentType}', ...(typeof contentType === 'string' ? { request: contentType } : contentType) }`\n : `contentType: { request: '${bakedRequestContentType}' }`\n\n const eventStream = isEventStream(node)\n const responseType = getResponseType(node)\n const responseTypeLiteral = responseType ? `responseType: '${responseType}'` : null\n\n const validatorEntries = [\n validators.request ? `request: ${validators.request}` : null,\n validators.response ? `response: ${validators.response}` : null,\n validators.error ? `error: ${validators.error}` : null,\n ].filter(Boolean)\n const validatorLiteral = validatorEntries.length ? `validator: { ${validatorEntries.join(', ')} }` : null\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 responseTypeLiteral,\n '...config',\n ]\n .filter(Boolean)\n .join(', ')} }`\n\n const eventType = `SuccessOf<${tsResolver.response.responses(node)}>`\n const returnType = eventStream ? `Promise<EventStreamResult<${eventType}>>` : signature.returnType\n const returnStatement = eventStream ? `return toEventStream<${eventType}>(request(${callConfig}))` : buildReturnStatement({ node, tsResolver, callConfig })\n\n return (\n <File.Source name={name} isExportable={isExportable} isIndexable={isIndexable}>\n <Function\n name={name}\n export={isExportable}\n generics={signature.generics}\n params={signature.paramsSignature}\n returnType={returnType}\n JSDoc={{ comments: buildOperationComments(node, { link: 'urlPath', linkPosition: 'beforeDeprecated', splitLines: true }) }}\n >\n {mergeContentType ? 'const { client: request = client, contentType, ...config } = options' : 'const { client: request = client, ...config } = options'}\n <br />\n {returnStatement}\n </Function>\n </File.Source>\n )\n}\n","import type { ast } from 'kubb/kit'\nimport type { ResolverTs } from '@kubb/plugin-ts'\nimport type { ResolverZod } from '@kubb/plugin-zod'\nimport { File } from 'kubb/jsx'\nimport type { KubbReactNode } from 'kubb/jsx'\nimport { buildSdkMethod } from '../builders/sdkMethod.ts'\nimport type { Auth } from '../builders/security.ts'\nimport type { ValidatorOptions } from '../types.ts'\n\ntype OperationData = {\n node: ast.OperationNode\n name: string\n tsResolver: ResolverTs\n zodResolver?: ResolverZod | null\n security?: Array<Auth>\n}\n\ntype Props = {\n name: string\n isExportable?: boolean\n isIndexable?: boolean\n operations: Array<OperationData>\n validator: ValidatorOptions | undefined\n children?: KubbReactNode\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(...)`. A per-call `client` option\n * still overrides the instance client for a one-off call.\n */\nexport function SdkClient({ name, isExportable = true, isIndexable = true, operations, validator, children }: Props): KubbReactNode {\n const methods = operations.map(({ node, name: methodName, tsResolver, zodResolver, security }) =>\n buildSdkMethod({\n node,\n name: methodName,\n tsResolver,\n zodResolver,\n validator,\n security,\n }),\n )\n\n const constructor = [\n ' private readonly client: ClientInstance',\n '',\n ' constructor(config: ClientConfig = {}) {',\n ' this.client = 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={isExportable} isIndexable={isIndexable}>\n {classCode}\n {children}\n </File.Source>\n )\n}\n","import path from 'node:path'\nimport { isEventStream, operationFileEntry, resolveDependencyOperationFile } from '@internals/shared'\nimport { ast, defineGenerator } from 'kubb/kit'\nimport type { Generator } from 'kubb/kit'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, jsxRenderer } from 'kubb/jsx'\nimport { buildZodErrorParse, resolveRequestValidator, resolveResponseValidator } from '../builders/validatorOptions.ts'\nimport { getOperationSecurity, type SecurityDocument } from '../builders/security.ts'\nimport { Operation } from '../components/Operation.tsx'\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 `RequestResult`. Only the generator\n * `name` differs between plugins; every other resolution, import, and rendering step is identical.\n */\nexport function createClientGenerator<TFactory extends ContractClientFactory>(name: string): Generator<TFactory> {\n return defineGenerator<TFactory>({\n name,\n renderer: jsxRenderer,\n operation(node, ctx) {\n if (!ast.isHttpOperationNode(node)) return null\n\n const { config, driver, resolver, root } = ctx\n const { output, validator, group } = ctx.options\n\n const pluginTs = driver.getPlugin(pluginTsName)\n if (!pluginTs) return null\n\n const tsResolver = driver.getResolver(pluginTsName)\n\n const validatorEnabled = resolveResponseValidator(validator) === 'zod' || resolveRequestValidator(validator) === 'zod'\n const pluginZod = validatorEnabled ? driver.getPlugin(pluginZodName) : null\n const zodResolver = pluginZod ? driver.getResolver(pluginZodName) : null\n\n const hasRequestBody = Boolean(node.requestBody?.content?.[0]?.schema)\n const importedTypeNames = [tsResolver.response.options(node), tsResolver.response.responses(node)]\n\n const importedZodNames = zodResolver\n ? [\n resolveResponseValidator(validator) === 'zod' ? zodResolver.response.response?.(node) : null,\n resolveResponseValidator(validator) === 'zod' ? (buildZodErrorParse(node, zodResolver)?.expression ?? null) : null,\n resolveRequestValidator(validator) === 'zod' && hasRequestBody ? zodResolver.response.body?.(node) : null,\n ].filter((name): name is string => Boolean(name))\n : []\n\n const meta = {\n name: resolver.name(node.operationId),\n file: resolver.file({ ...operationFileEntry(node, node.operationId), root, output, group: group ?? undefined }),\n fileTs: resolveDependencyOperationFile({\n cache: ctx.cache,\n node,\n resolver: tsResolver,\n root,\n output: pluginTs.options?.output ?? output,\n group: pluginTs.options?.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 const clientPath = path.resolve(root, '.kubb/client.ts')\n const eventStream = isEventStream(node)\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={eventStream ? ['client', 'toEventStream'] : ['client']} root={meta.file.path} path={clientPath} />\n <File.Import\n name={eventStream ? ['Options', 'EventStreamResult', 'SuccessOf'] : ['Options', 'RequestResult']}\n root={meta.file.path}\n path={clientPath}\n isTypeOnly\n />\n\n {meta.fileTs && importedTypeNames.length > 0 && (\n <File.Import name={Array.from(new Set(importedTypeNames))} root={meta.file.path} path={meta.fileTs.path} isTypeOnly />\n )}\n\n {meta.fileZod && importedZodNames.length > 0 && <File.Import name={importedZodNames} root={meta.file.path} path={meta.fileZod.path} />}\n\n <Operation name={meta.name} node={node} tsResolver={tsResolver} zodResolver={zodResolver} validator={validator} security={security} />\n </File>\n )\n },\n })\n}\n","import { File } from 'kubb/jsx'\nimport type { KubbReactNode } from 'kubb/jsx'\n\ntype Member = {\n className: string\n propName: string\n}\n\ntype Props = {\n name: string\n isExportable?: boolean\n isIndexable?: boolean\n members: Array<Member>\n children?: KubbReactNode\n}\n\n/**\n * Renders a composed root SDK class that instantiates every tag client from one shared config, so\n * `new PetStore({ baseURL }).petClient.getPetById(...)` reaches an operation through a single entry\n * point bound to one environment. The per-tag clients are read-only fields built in the constructor.\n */\nexport function SdkFacade({ name, isExportable = true, isIndexable = true, members, children }: Props): KubbReactNode {\n const fields = members.map((member) => ` readonly ${member.propName}: ${member.className}`)\n const assignments = members.map((member) => ` this.${member.propName} = new ${member.className}(config)`)\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={isExportable} isIndexable={isIndexable}>\n {classCode}\n {children}\n </File.Source>\n )\n}\n","import path from 'node:path'\nimport { getOperationParameters, operationFileEntry } from '@internals/shared'\nimport { camelCase } from '@internals/utils'\nimport { ast, defineGenerator } from 'kubb/kit'\nimport type { Generator } from 'kubb/kit'\nimport type { ResolverTs } from '@kubb/plugin-ts'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport type { ResolverZod } from '@kubb/plugin-zod'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, jsxRenderer } from 'kubb/jsx'\nimport {\n buildZodErrorParse,\n isValidatorEnabled,\n resolveQueryParamsValidator,\n resolveRequestValidator,\n resolveResponseValidator,\n} from '../builders/validatorOptions.ts'\nimport { type Auth, getOperationSecurity, type SecurityDocument } from '../builders/security.ts'\nimport { SdkClient } from '../components/SdkClient.tsx'\nimport { SdkFacade } from '../components/SdkFacade.tsx'\nimport type { ContractClientFactory, ValidatorOptions } from '../types.ts'\n\ntype GeneratorContext = Parameters<NonNullable<Generator<ContractClientFactory>['operations']>>[1]\n\ntype OperationData = {\n node: ast.OperationNode\n name: string\n tsResolver: ResolverTs\n zodResolver: ResolverZod | null\n typeFile: ast.FileNode\n zodFile: ast.FileNode | null\n security?: Array<Auth>\n}\n\ntype Controller = {\n name: string\n tag: string | undefined\n file: ast.FileNode\n operations: Array<OperationData>\n}\n\nfunction resolveTypeImportNames(node: ast.OperationNode, tsResolver: ResolverTs): Array<string> {\n return [tsResolver.response.options(node), tsResolver.response.responses(node)]\n}\n\nfunction resolveZodImportNames(node: ast.OperationNode, zodResolver: ResolverZod, validator: ValidatorOptions): Array<string> {\n const { query: queryParams } = getOperationParameters(node)\n const names: Array<string | null | undefined> = [\n resolveResponseValidator(validator) === 'zod' ? zodResolver.response.response(node) : null,\n resolveResponseValidator(validator) === 'zod' ? (buildZodErrorParse(node, zodResolver)?.expression ?? null) : null,\n resolveRequestValidator(validator) === 'zod' && node.requestBody?.content?.[0]?.schema ? zodResolver.response.body(node) : null,\n resolveQueryParamsValidator(validator) === 'zod' && queryParams.length > 0 ? zodResolver.param.query(node, queryParams[0]!) : null,\n ]\n return names.filter((n): n is string => Boolean(n))\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): Array<Controller> {\n const { driver, resolver, root } = ctx\n const { output, group, validator } = ctx.options\n\n const pluginTs = driver.getPlugin(pluginTsName)!\n const tsResolver = driver.getResolver(pluginTsName)\n const tsPluginOptions = pluginTs.options\n const pluginZod = isValidatorEnabled(validator) ? driver.getPlugin(pluginZodName) : null\n const zodResolver = pluginZod ? driver.getResolver(pluginZodName) : null\n const document = ctx.adapter.document as SecurityDocument | null | undefined\n\n function buildOperationData(node: ast.OperationNode): OperationData {\n const typeFile = tsResolver.file({\n ...operationFileEntry(node, node.operationId),\n root,\n output: tsPluginOptions?.output ?? output,\n group: tsPluginOptions?.group,\n })\n const zodFile =\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\n const security = ast.isHttpOperationNode(node) ? getOperationSecurity({ document, method: node.method, path: node.path }) : undefined\n\n return { node, name: resolver.name(node.operationId), tsResolver, zodResolver, typeFile, zodFile, security }\n }\n\n return nodes.reduce((acc, operationNode) => {\n if (!ast.isHttpOperationNode(operationNode)) return acc\n const tag = operationNode.tags[0]\n const name = tag ? (group?.name?.({ group: camelCase(tag) }) ?? resolver.groupName(tag)) : resolver.className('ApiClient')\n const file = resolver.file({ name, extname: '.ts', tag, root, output, group: group ?? undefined })\n const operationData = buildOperationData(operationNode)\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, so each environment is a separate instance. With `sdk.mode: 'tag'` (the default) it\n * emits one class per tag and, when `sdk.name` is set, a composed root that instantiates every tag\n * client. With `sdk.mode: 'flat'` it emits one class named by `sdk.name`, with every operation as a\n * direct method.\n */\nexport function createSdkGenerator<TFactory extends ContractClientFactory>(): 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, sdk } = ctx.options\n\n const pluginTs = ctx.driver.getPlugin(pluginTsName)\n if (!pluginTs || !sdk) return null\n\n const controllers = buildControllers(nodes, ctx)\n const clientPath = path.resolve(root, '.kubb/client.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: resolveTypeImportNames(op.node, op.tsResolver),\n }))\n const { namesByPath: zodNamesByPath, filesByPath: zodFilesByPath } = isValidatorEnabled(validator)\n ? collectImportsByFile(ops, (op) => ({ file: op.zodFile, names: op.zodResolver ? resolveZodImportNames(op.node, op.zodResolver, validator) : [] }))\n : { namesByPath: new Map<string, Set<string>>(), filesByPath: new Map<string, ast.FileNode>() }\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 name={['createClient']} root={file.path} path={clientPath} />\n <File.Import name={['ClientConfig', 'ClientInstance', 'Options', 'RequestResult']} root={file.path} path={clientPath} isTypeOnly />\n\n {validator === 'zod' && ops.some((op) => op.node.requestBody?.content?.[0]?.schema != 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 {isValidatorEnabled(validator) &&\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 <SdkClient name={className} operations={ops} validator={validator} />\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 if (sdk.mode === 'flat') {\n const flatName = resolver.className(sdk.name ?? 'sdk')\n const flatFile = resolver.file({ name: sdk.name ?? 'sdk', extname: '.ts', root, output, group: group ?? undefined })\n const allOps = controllers.flatMap((controller) => controller.operations)\n\n return renderClassFile(flatName, flatFile, allOps)\n }\n\n const classFiles = controllers.map(({ name, file, operations: ops }) => renderClassFile(name, file, ops))\n\n if (!sdk.name) return <>{classFiles}</>\n\n const sdkFile = resolver.file({ name: sdk.name, extname: '.ts', root, output, group: group ?? undefined })\n const facadeName = resolver.className(sdk.name)\n const members = controllers.map(({ name, tag }) => ({ className: name, propName: resolver.propertyName(tag ?? name) }))\n\n return (\n <>\n {classFiles}\n <File key={sdkFile.path} baseName={sdkFile.baseName} path={sdkFile.path} meta={sdkFile.meta} banner={banner(sdkFile)} footer={footer(sdkFile)}>\n <File.Import name={['ClientConfig']} 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={facadeName} members={members} />\n </File>\n </>\n )\n },\n })\n}\n","import { macroSimplifyUnion } from 'kubb/kit'\nimport type { ast } from 'kubb/kit'\n\n/**\n * Macros the client plugins apply by default, ahead of any user macros. `macroSimplifyUnion`\n * drops union members a broader scalar already covers, 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> = [macroSimplifyUnion]\n","import { camelCase, ensureValidVarName, pascalCase } from '@internals/utils'\nimport { createResolver } from 'kubb/kit'\nimport type { PluginContractClient } from './types.ts'\n\n/**\n * Default resolver shared by the client plugins. Functions and files inherit the built-in camelCase\n * `name` and `file`; 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 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 { PluginFetch } from '../types.ts'\n\n/**\n * Built-in operation generator for `@kubb/plugin-fetch`. 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 bundled `client` and returns the `RequestResult`.\n */\nexport const clientGenerator = createClientGenerator<PluginFetch>('fetch')\n","import { fileURLToPath } from 'node:url'\n\n/** Absolute path to the fetch client template, copied into `.kubb/client.ts`. */\nexport const fetchClientTemplatePath = fileURLToPath(new URL('../templates/fetch.ts', import.meta.url))\n\n/** Absolute path to the fetch serializers template, copied into `.kubb/serializers.ts`. */\nexport const fetchSerializersTemplatePath = fileURLToPath(new URL('../templates/serializers.ts', import.meta.url))\n\n/**\n * Absolute path to the Standard Schema runtime template. Pass it to a file node's `copy` field to\n * emit the helper into the generated `.kubb/standardSchema.ts` verbatim.\n */\nexport const standardSchemaTemplatePath = fileURLToPath(new URL('../templates/standardSchema.ts', import.meta.url))\n","import path from 'node:path'\nimport { createSdkGenerator, defaultMacros, isValidatorEnabled, resolverClient } from '@internals/client'\nimport { createGroupConfig } from '@internals/shared'\nimport { definePlugin, Resolver } from 'kubb/kit'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { clientGenerator } from './generators/clientGenerator.tsx'\nimport { fetchClientTemplatePath, fetchSerializersTemplatePath, standardSchemaTemplatePath } from './templates.ts'\nimport type { PluginFetch, ResolvedOptions, ResolverClient } from './types.ts'\n\n/**\n * Canonical plugin name for `@kubb/plugin-fetch`. Used for driver lookups and cross-plugin\n * dependency references.\n */\nexport const pluginFetchName = 'plugin-fetch' satisfies PluginFetch['name']\n\n/**\n * Generates a type-safe HTTP client pinned to the Fetch API. Each operation becomes one async\n * function that takes a single grouped `options` object and returns the shared `RequestResult`\n * contract. The runtime is always bundled into `.kubb/client.ts`, so generated code never imports\n * from `@kubb/plugin-fetch` and the only runtime dependency is the global `fetch`.\n *\n * @example\n * ```ts\n * import { defineConfig } from 'kubb/config'\n * import { pluginTs } from '@kubb/plugin-ts'\n * import { pluginFetch } from '@kubb/plugin-fetch'\n *\n * export default defineConfig({\n * input: './petStore.yaml',\n * output: { path: './src/gen' },\n * plugins: [\n * pluginTs(),\n * pluginFetch({ output: { path: './clients' } }),\n * ],\n * })\n * ```\n */\nexport const pluginFetch = definePlugin<PluginFetch>((options) => {\n const {\n output = { path: 'clients', barrel: { type: 'named' } },\n exclude = [],\n include,\n override = [],\n baseURL,\n validator = false,\n group,\n sdk,\n resolver: userResolver,\n } = options\n\n const resolved: ResolvedOptions = {\n output,\n exclude,\n include,\n override,\n group: createGroupConfig(group),\n baseURL,\n validator,\n sdk: sdk ? { mode: sdk.mode ?? 'tag', name: sdk.name } : undefined,\n resolver: userResolver ? Resolver.merge<ResolverClient>(resolverClient, userResolver) : resolverClient,\n }\n\n // `sdk` swaps the per-operation functions for the class-based SDK; left unset, the standalone\n // functions (which query plugins consume) stay.\n const selectedGenerators = resolved.sdk ? [createSdkGenerator<PluginFetch>()] : [clientGenerator]\n\n return {\n name: pluginFetchName,\n options,\n dependencies: [pluginTsName, isValidatorEnabled(resolved.validator) ? pluginZodName : null].filter((dependency): dependency is string =>\n Boolean(dependency),\n ),\n hooks: {\n 'kubb:plugin:setup'(ctx) {\n ctx.setOptions(resolved)\n ctx.setResolver(resolved.resolver)\n ctx.setMacros([...defaultMacros, ...(options.macros ?? [])])\n\n ctx.addGenerator(...selectedGenerators)\n\n const root = path.resolve(ctx.config.root, ctx.config.output.path)\n const baseURLExpression = baseURL ? (baseURL.includes('${') ? `\\`${baseURL.replaceAll('`', '\\\\`')}\\`` : JSON.stringify(baseURL)) : undefined\n\n ctx.injectFile({\n baseName: 'serializers.ts',\n path: path.resolve(root, '.kubb/serializers.ts'),\n copy: fetchSerializersTemplatePath,\n })\n\n ctx.injectFile({\n baseName: 'client.ts',\n path: path.resolve(root, '.kubb/client.ts'),\n copy: fetchClientTemplatePath,\n footer: baseURLExpression ? `client.setConfig({ baseURL: ${baseURLExpression} })` : undefined,\n })\n\n ctx.injectFile({\n baseName: 'standardSchema.ts',\n path: path.resolve(root, '.kubb/standardSchema.ts'),\n copy: standardSchemaTemplatePath,\n })\n },\n },\n }\n})\n\nexport default pluginFetch\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,SAAgB,aAAa,QAA4D;CACvF,MAAM,uBAAO,IAAI,IAAY;CAE7B,OAAO,OAAO,QAAQ,UAAU;EAC9B,IAAI,KAAK,IAAI,MAAM,IAAI,GAAG,OAAO;EACjC,KAAK,IAAI,MAAM,IAAI;EACnB,OAAO;CACT,CAAC;AACH;;;;;;;;;;;;;;ACJA,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,OAAO,MAAM,UAAU,MAAM,QAAQ,UAAU;CAEvD,OAAO,MAAM,WAAW,GAAG,SAAS,WAAW,uBAC7C,SAAS,KAAK;EAAE,GAAG,mBAAmB,MAAM,KAAK,WAAW;EAAG;EAAM;EAAQ,OAAO,SAAS,KAAA;CAAU,CAAC,CAC1G;AACF;AAsHA,SAAS,iBAAiB,MAAyB,MAA2C;CAC5F,IAAI,CAAC,MACH,OAAO;CAGT,IAAI,OAAO,SAAS,YAClB,OAAO,KAAK,IAAI,KAAK;CAGvB,OAAO,KAAK,OAAO,UAAUA,SAAAA,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,KA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