@kubb/plugin-swr 5.0.0-beta.42 → 5.0.0-beta.56
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/{components-CD7ZoS3B.cjs → components-C8FJ3-Cb.cjs} +175 -196
- package/dist/components-C8FJ3-Cb.cjs.map +1 -0
- package/dist/{components-BuLagnaM.js → components-CR9NLFcO.js} +176 -197
- package/dist/components-CR9NLFcO.js.map +1 -0
- package/dist/components.cjs +1 -1
- package/dist/components.d.ts +1 -1
- package/dist/components.js +1 -1
- package/dist/{generators-CSinCSzM.js → generators-BB6csINY.js} +67 -91
- package/dist/generators-BB6csINY.js.map +1 -0
- package/dist/{generators-D_Cz5DDw.cjs → generators-mw3FvFJD.cjs} +66 -90
- package/dist/generators-mw3FvFJD.cjs.map +1 -0
- package/dist/generators.cjs +1 -1
- package/dist/generators.d.ts +6 -1
- package/dist/generators.js +1 -1
- package/dist/index.cjs +62 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +63 -13
- package/dist/index.js.map +1 -1
- package/dist/{types-BoANASs2.d.ts → types-Dz_j0Bqv.d.ts} +11 -14
- package/package.json +9 -17
- package/src/components/Mutation.tsx +3 -3
- package/src/components/Query.tsx +3 -3
- package/src/components/QueryOptions.tsx +3 -21
- package/src/generators/mutationGenerator.tsx +11 -7
- package/src/generators/queryGenerator.tsx +3 -7
- package/src/plugin.ts +6 -18
- package/src/resolvers/resolverSwr.ts +2 -2
- package/src/types.ts +9 -12
- package/src/utils.ts +8 -1
- package/dist/components-BuLagnaM.js.map +0 -1
- package/dist/components-CD7ZoS3B.cjs.map +0 -1
- package/dist/generators-CSinCSzM.js.map +0 -1
- package/dist/generators-D_Cz5DDw.cjs.map +0 -1
- package/extension.yaml +0 -199
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components-CR9NLFcO.js","names":["declarationPrinter","MutationKey","declarationPrinter","declarationPrinter","callPrinter","getComments","SharedMutationKey","declarationPrinter","callPrinter","getComments"],"sources":["../../../internals/utils/src/casing.ts","../../../internals/utils/src/reserved.ts","../../../internals/utils/src/url.ts","../../../internals/shared/src/operation.ts","../../../internals/tanstack-query/src/components/MutationKey.tsx","../../../internals/tanstack-query/src/utils.ts","../../../internals/tanstack-query/src/components/QueryKey.tsx","../src/components/Mutation.tsx","../src/components/MutationKey.tsx","../src/components/QueryOptions.tsx","../src/components/Query.tsx"],"sourcesContent":["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 * 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 /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(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","import { camelCase } from './casing.ts'\nimport { isValidVarName } from './reserved.ts'\n\nexport type URLObject = {\n /**\n * The resolved URL string (Express-style or template literal, depending on context).\n */\n url: string\n /**\n * Extracted path parameters as a key-value map, or `null` when the path has none.\n */\n params: Record<string, string> | null\n}\n\n/**\n * Supported identifier casing strategies for path parameters.\n */\nexport type PathCasing = 'camelcase'\n\ntype TemplateOptions = {\n /**\n * Literal text prepended inside the template literal, e.g. a base URL.\n */\n prefix?: string | null\n /**\n * Transform applied to each extracted parameter name before interpolation.\n */\n replacer?: (pathParam: string) => string\n /**\n * Casing strategy applied to path parameter names.\n */\n casing?: PathCasing\n}\n\ntype ObjectOptions = {\n /**\n * Controls whether the `url` is rendered as an Express path or a template literal.\n * @default 'path'\n */\n type?: 'path' | 'template'\n /**\n * Transform applied to each extracted parameter name.\n */\n replacer?: (pathParam: string) => string\n /**\n * When `true`, the result is serialized to a string expression instead of a plain object.\n */\n stringify?: boolean\n /**\n * Casing strategy applied to path parameter names.\n */\n casing?: PathCasing\n}\n\nfunction transformParam(raw: string, casing?: PathCasing): string {\n const param = isValidVarName(raw) ? raw : camelCase(raw)\n return casing === 'camelcase' ? camelCase(param) : param\n}\n\nfunction toParamsObject(\n path: string,\n { replacer, casing }: { replacer?: (pathParam: string) => string; casing?: PathCasing } = {},\n): Record<string, string> | null {\n const params: Record<string, string> = {}\n\n for (const match of path.matchAll(/\\{([^}]+)\\}/g)) {\n const param = transformParam(match[1]!, casing)\n const key = replacer ? replacer(param) : param\n params[key] = key\n }\n\n return Object.keys(params).length > 0 ? params : null\n}\n\n/**\n * Helpers for OpenAPI/Swagger paths, plus a thin wrapper over the native `URL`.\n */\nexport class Url {\n /**\n * Reports whether `url` is a parseable absolute URL. Delegates to the native `URL.canParse`.\n *\n * @example\n * Url.canParse('https://petstore.swagger.io/v2') // true\n * Url.canParse('/pet/{petId}') // false\n */\n static canParse(url: string, base?: string | URL): boolean {\n return URL.canParse(url, base)\n }\n\n /**\n * Converts an OpenAPI/Swagger path to Express-style colon syntax.\n *\n * @example\n * Url.toPath('/pet/{petId}') // '/pet/:petId'\n */\n static toPath(path: string): string {\n return path.replace(/\\{([^}]+)\\}/g, ':$1')\n }\n\n /**\n * Converts an OpenAPI/Swagger path to a TypeScript template literal string.\n * `prefix` is prepended inside the literal, `replacer` transforms each parameter name,\n * and `casing` controls parameter identifier casing.\n *\n * @example\n * Url.toTemplateString('/pet/{petId}') // '`/pet/${petId}`'\n *\n * @example\n * Url.toTemplateString('/pet/{petId}', { prefix: 'https://api' }) // '`https://api/pet/${petId}`'\n */\n static toTemplateString(path: string, { prefix, replacer, casing }: TemplateOptions = {}): string {\n const parts = path.split(/\\{([^}]+)\\}/)\n const result = parts\n .map((part, i) => {\n if (i % 2 === 0) return part\n const param = transformParam(part, casing)\n return `\\${${replacer ? replacer(param) : param}}`\n })\n .join('')\n\n return `\\`${prefix ?? ''}${result}\\``\n }\n\n /**\n * Returns the path and its extracted params as a structured `URLObject`, or as a stringified\n * expression when `stringify` is set.\n *\n * @example\n * Url.toObject('/pet/{petId}')\n * // { url: '/pet/:petId', params: { petId: 'petId' } }\n */\n static toObject(path: string, { type = 'path', replacer, stringify, casing }: ObjectOptions = {}): URLObject | string {\n const object: URLObject = {\n url: type === 'path' ? Url.toPath(path) : Url.toTemplateString(path, { replacer, casing }),\n params: toParamsObject(path, { replacer, casing }),\n }\n\n if (stringify) {\n if (type === 'template') {\n return JSON.stringify(object).replaceAll(\"'\", '').replaceAll(`\"`, '')\n }\n\n if (object.params) {\n return `{ url: '${object.url}', params: ${JSON.stringify(object.params).replaceAll(\"'\", '').replaceAll(`\"`, '')} }`\n }\n\n return `{ url: '${object.url}' }`\n }\n\n return object\n }\n}\n","import { Url } from '@internals/utils'\nimport { ast, type ResolverFileParams } from '@kubb/core'\n\n/**\n * Builds the `ResolverFileParams` every operation generator passes to\n * `resolver.resolveFile`: 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.resolveFile(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\nexport type ContentTypeInfo = {\n contentTypes: string[]\n isMultipleContentTypes: boolean\n contentTypeUnion: string\n defaultContentType: string\n hasFormData: boolean\n}\n\nexport type RequestConfigResolver = {\n resolveDataName(node: ast.OperationNode): string\n}\n\nexport type ResponseStatusNameResolver = {\n resolveResponseStatusName(node: ast.OperationNode, statusCode: ast.StatusCode): string\n}\n\nexport type ResponseNameResolver = ResponseStatusNameResolver & {\n resolveResponseName(node: ast.OperationNode): string\n}\n\nexport type OperationTypeNameResolver = RequestConfigResolver &\n ResponseNameResolver & {\n resolvePathParamsName(node: ast.OperationNode, param: ast.ParameterNode): string\n resolveQueryParamsName(node: ast.OperationNode, param: ast.ParameterNode): string\n resolveHeaderParamsName(node: ast.OperationNode, param: ast.ParameterNode): string\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 paramsCasing?: 'camelcase'\n responseStatusNames?: boolean | 'error'\n exclude?: ReadonlyArray<string | undefined>\n order?: 'params-first' | 'body-response-first'\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 if (link === 'urlPath') {\n return node.path ? `{@link ${Url.toPath(node.path)}}` : null\n }\n\n return node.path ? `{@link ${node.path.replaceAll('{', ':').replaceAll('}', '')}}` : null\n}\n\nexport function getContentTypeInfo(node: ast.OperationNode): ContentTypeInfo {\n const contentTypes = node.requestBody?.content?.map((e) => e.contentType) ?? []\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 type ResponseType = 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream'\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 — a binary type\n * (`application/octet-stream`, `application/pdf`, `image/*`, `audio/*`, `video/*`) maps to `'blob'`\n * and other `text/*` maps to `'text'`. Otherwise `undefined`, leaving the runtime client's\n * `Content-Type` auto-detection in charge.\n */\nexport function getResponseType(node: ast.OperationNode): ResponseType | undefined {\n const contentTypes = getPrimarySuccessResponse(node)?.content?.map((entry) => entry.contentType) ?? []\n if (contentTypes.length !== 1) return undefined\n\n const baseType = contentTypes[0]!.split(';')[0]!.trim().toLowerCase()\n if (baseType === 'application/json' || baseType.endsWith('+json') || baseType === 'text/json') return undefined\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 */\nexport function 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, resolver: RequestConfigResolver): string {\n const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : null\n const { isMultipleContentTypes, contentTypeUnion } = getContentTypeInfo(node)\n const configType = requestName ? `Partial<RequestConfig<${requestName}>>` : 'Partial<RequestConfig>'\n const configProps = ['client?: Client', isMultipleContentTypes ? `contentType?: ${contentTypeUnion}` : null].filter(Boolean).join('; ')\n\n return `${configType} & { ${configProps} }`\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\nexport function getOperationParameters(node: ast.OperationNode, options: { paramsCasing?: 'camelcase' } = {}): OperationParameterGroups {\n const params = ast.caseParams(node.parameters, options.paramsCasing)\n\n return {\n path: params.filter((param) => param.in === 'path'),\n query: params.filter((param) => param.in === 'query'),\n header: params.filter((param) => param.in === 'header'),\n cookie: params.filter((param) => param.in === 'cookie'),\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\n .filter((response) => isErrorStatusCode(response.statusCode))\n .map((response) => resolver.resolveResponseStatusName(node, response.statusCode))\n}\n\nexport function resolveSuccessNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses\n .filter((response) => isSuccessStatusCode(response.statusCode))\n .map((response) => resolver.resolveResponseStatusName(node, response.statusCode))\n}\n\nexport function resolveStatusCodeNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses.map((response) => resolver.resolveResponseStatusName(node, response.statusCode))\n}\n\n/**\n * Builds the discriminated union type string for `dataReturnType: 'full'` return shapes.\n * Each member is `{ status: N; data: StatusNType; statusText: string }`.\n */\nexport function buildStatusUnionType(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string {\n const members = node.responses.map((r) => {\n const typeName = resolver.resolveResponseStatusName(node, r.statusCode)\n const statusCode = Number.parseInt(r.statusCode, 10)\n const statusLiteral = Number.isNaN(statusCode) ? 'number' : String(statusCode)\n return `{ status: ${statusLiteral}; data: ${typeName}; statusText: string }`\n })\n if (members.length === 1) return members[0]!\n return `(${members.join(' | ')})`\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.paramsCasing ?? ''}\\0${options.order ?? ''}\\0${options.responseStatusNames ?? ''}\\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, { paramsCasing: options.paramsCasing })\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 ...path.map((param) => resolver.resolvePathParamsName(node, param)),\n ...query.map((param) => resolver.resolveQueryParamsName(node, param)),\n ...header.map((param) => resolver.resolveHeaderParamsName(node, param)),\n ]\n const bodyAndResponseNames = [node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : null, resolver.resolveResponseName(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.resolveResponseName(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.resolveResponseName(node) : resolver.resolveResponseStatusName(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","import { Url } from '@internals/utils'\nimport { ast } from '@kubb/core'\nimport { functionPrinter } from '@kubb/plugin-ts'\nimport { File, Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport type { Transformer } from '../types.ts'\n\ntype Props = {\n name: string\n node: ast.OperationNode\n paramsCasing: 'camelcase' | undefined\n pathParamsType: 'object' | 'inline'\n transformer: Transformer | null | undefined\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\n\nexport const mutationKeyTransformer: Transformer = ({ node }) => {\n if (!node.path) return []\n return [`{ url: '${Url.toPath(node.path)}' }`]\n}\n\nexport function MutationKey({ name, paramsCasing, node, transformer }: Props): KubbReactNode {\n const paramsNode = ast.createFunctionParameters({ params: [] })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n const keys = (transformer ?? mutationKeyTransformer)({ node, casing: paramsCasing })\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function.Arrow name={name} export params={paramsSignature} singleLine>\n {`[${keys.join(', ')}] as const`}\n </Function.Arrow>\n </File.Source>\n )\n}\n","import { getOperationParameters } from '@internals/shared'\nimport { ast } from '@kubb/core'\nimport type { PluginTs, ResolverTs } from '@kubb/plugin-ts'\nimport type { ParamsCasing, ParamsType, PathParamsType } from './types.ts'\n\n/**\n * Builds the shared `(…params, config = {})` parameter list for a TanStack\n * query-options function. The trailing `config` parameter is typed as a partial\n * `RequestConfig` with an optional `client`. Framework plugins wrap the result\n * when needed, for example vue-query applies `MaybeRefOrGetter`.\n */\nexport function buildQueryOptionsParams(\n node: ast.OperationNode,\n options: { paramsType: ParamsType; paramsCasing: ParamsCasing; pathParamsType: PathParamsType; resolver: ResolverTs },\n): ast.FunctionParametersNode {\n const { paramsType, paramsCasing, pathParamsType, resolver } = options\n const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : undefined\n\n return ast.createOperationParams(node, {\n paramsType,\n pathParamsType: paramsType === 'object' ? 'object' : pathParamsType === 'object' ? 'object' : 'inline',\n paramsCasing,\n resolver,\n extraParams: [\n ast.createFunctionParameter({\n name: 'config',\n type: ast.createParamsType({\n variant: 'reference',\n name: requestName ? `Partial<RequestConfig<${requestName}>> & { client?: Client }` : 'Partial<RequestConfig> & { client?: Client }',\n }),\n default: '{}',\n }),\n ],\n })\n}\n\nexport function transformName(name: string, type: string, transformers?: { name?: (name: string, type?: string) => string }): string {\n return transformers?.name?.(name, type) || name\n}\n\ntype OverrideEntry<TOptions> = {\n type: string\n pattern: string | RegExp\n options?: Partial<TOptions>\n}\n\nfunction matchesPattern(node: ast.OperationNode, ov: { type: string; pattern: string | RegExp }): boolean {\n const { type, pattern } = ov\n const matches = (value: string) => (typeof pattern === 'string' ? value === pattern : pattern.test(value))\n if (type === 'operationId') return matches(node.operationId)\n if (type === 'tag') return node.tags.some((t) => matches(t))\n if (type === 'path') return node.path !== undefined && matches(node.path)\n if (type === 'method') return node.method !== undefined && matches(node.method)\n return false\n}\n\n/**\n * Resolves per-operation overrides (first matching override wins).\n *\n * @example\n * ```ts\n * const opts = resolveOperationOverrides(node, override)\n * const queryOpts = 'query' in opts ? opts.query : defaultQuery\n * ```\n */\nexport function resolveOperationOverrides<TOptions>(node: ast.OperationNode, override?: ReadonlyArray<OverrideEntry<TOptions>>): Partial<TOptions> {\n if (!override) return {}\n const match = override.find((ov) => matchesPattern(node, ov))\n return match?.options ?? {}\n}\n\ntype ZodSchemaNameResolverLike = {\n resolveResponseName?: (node: ast.OperationNode) => string | undefined\n resolveDataName?: (node: ast.OperationNode) => string | undefined\n resolveQueryParamsName?: (node: ast.OperationNode, param: ast.ParameterNode) => string | undefined\n}\n\ntype ParserOption = false | 'zod' | { request?: 'zod'; response?: 'zod' } | undefined\n\n/**\n * Returns `'zod'` when response-direction parsing is enabled.\n * The string shorthand `'zod'` also enables response parsing.\n */\nexport function resolveResponseParser(parser: ParserOption): 'zod' | null {\n if (!parser) return null\n if (parser === 'zod') return 'zod'\n return parser.response ?? null\n}\n\n/**\n * Returns `'zod'` when request body parsing is enabled.\n * The string shorthand `'zod'` also enables request body parsing (existing behavior).\n */\nexport function resolveRequestParser(parser: ParserOption): 'zod' | null {\n if (!parser) return null\n if (parser === 'zod') return 'zod'\n return parser.request ?? null\n}\n\n/**\n * Returns `'zod'` when query-params parsing is enabled.\n * Only the object form `{ request: 'zod' }` enables this. `parser: 'zod'` does not.\n */\nexport function resolveQueryParamsParser(parser: ParserOption): 'zod' | null {\n if (!parser || parser === 'zod') return null\n return parser.request ?? null\n}\n\n/**\n * Collects the Zod schema import names for an operation based on the active parser directions.\n *\n * - `parser: 'zod'`: response and request body names (backward-compatible behavior).\n * - `parser: { request: 'zod' }`: request body and query params names.\n * - `parser: { response: 'zod' }`: response name only.\n * - `parser: { request: 'zod', response: 'zod' }`: all three.\n *\n * Returns an empty array when no resolver is provided or `parser` is falsy.\n */\nexport function resolveZodSchemaNames(node: ast.OperationNode, zodResolver: ZodSchemaNameResolverLike | null | undefined, parser: ParserOption): string[] {\n if (!zodResolver || !parser) return []\n const { query: queryParams } = getOperationParameters(node)\n return [\n resolveResponseParser(parser) === 'zod' ? zodResolver.resolveResponseName?.(node) : null,\n resolveRequestParser(parser) === 'zod' && node.requestBody?.content?.[0]?.schema ? zodResolver.resolveDataName?.(node) : null,\n resolveQueryParamsParser(parser) === 'zod' && queryParams.length > 0 ? zodResolver.resolveQueryParamsName?.(node, queryParams[0]!) : null,\n ].filter((n): n is string => Boolean(n))\n}\n\n/**\n * Resolve the type for a single path parameter.\n *\n * - When the resolver's group name differs from the individual param name\n * (e.g. kubbV4) → `GroupName['paramName']` (member access).\n * - When they match (v5 default) → `TypeName` (direct reference).\n */\nexport function resolvePathParamType(node: ast.OperationNode, param: ast.ParameterNode, resolver: PluginTs['resolver']): ast.ParamsTypeNode {\n const individualName = resolver.resolveParamName(node, param)\n const groupName = resolver.resolvePathParamsName(node, param)\n\n if (groupName !== individualName) {\n return ast.createParamsType({ variant: 'member', base: groupName, key: param.name })\n }\n return ast.createParamsType({ variant: 'reference', name: individualName })\n}\n\ntype QueryGroupResult = { type: ast.ParamsTypeNode; optional: boolean } | null\n\n/**\n * Derive a query-params group type from the resolver.\n * Returns `null` when no query params exist or when the group name\n * equals the individual param name (no real group).\n */\nexport function resolveQueryGroupType(node: ast.OperationNode, params: ast.ParameterNode[], resolver: PluginTs['resolver']): QueryGroupResult {\n if (!params.length) return null\n const firstParam = params[0]!\n const groupName = resolver.resolveQueryParamsName(node, firstParam)\n if (groupName === resolver.resolveParamName(node, firstParam)) return null\n return { type: ast.createParamsType({ variant: 'reference', name: groupName }), optional: params.every((p) => !p.required) }\n}\n\n/**\n * Derive a header-params group type from the resolver.\n */\nexport function resolveHeaderGroupType(node: ast.OperationNode, params: ast.ParameterNode[], resolver: PluginTs['resolver']): QueryGroupResult {\n if (!params.length) return null\n const firstParam = params[0]!\n const groupName = resolver.resolveHeaderParamsName(node, firstParam)\n if (groupName === resolver.resolveParamName(node, firstParam)) return null\n return { type: ast.createParamsType({ variant: 'reference', name: groupName }), optional: params.every((p) => !p.required) }\n}\n\n/**\n * Build a single `FunctionParameterNode` for a query or header group.\n */\nexport function buildGroupParam(\n name: string,\n node: ast.OperationNode,\n params: ast.ParameterNode[],\n groupType: QueryGroupResult,\n resolver: PluginTs['resolver'],\n): ast.FunctionParameterNode[] {\n if (groupType) {\n return [ast.createFunctionParameter({ name, type: groupType.type, optional: groupType.optional })]\n }\n if (params.length) {\n const structProps = params.map((p) => ({\n name: p.name,\n type: ast.createParamsType({ variant: 'reference', name: resolver.resolveParamName(node, p) }),\n optional: !p.required,\n }))\n return [\n ast.createFunctionParameter({\n name,\n type: ast.createParamsType({ variant: 'struct', properties: structProps }),\n optional: params.every((p) => !p.required),\n }),\n ]\n }\n return []\n}\n\n/**\n * Build QueryKey params: pathParams + data + queryParams (NO headers, NO config).\n */\nexport function buildQueryKeyParams(\n node: ast.OperationNode,\n options: {\n pathParamsType: 'object' | 'inline'\n paramsCasing: 'camelcase' | undefined\n resolver: PluginTs['resolver']\n },\n): ast.FunctionParametersNode {\n const { pathParamsType, paramsCasing, resolver } = options\n\n const casedParams = ast.caseParams(node.parameters, paramsCasing)\n const pathParams = casedParams.filter((p) => p.in === 'path')\n const queryParams = casedParams.filter((p) => p.in === 'query')\n\n const queryGroupType = resolveQueryGroupType(node, queryParams, resolver)\n\n const bodyType = node.requestBody?.content?.[0]?.schema ? ast.createParamsType({ variant: 'reference', name: resolver.resolveDataName(node) }) : null\n const bodyRequired = node.requestBody?.required ?? false\n\n const params: Array<ast.FunctionParameterNode | ast.ParameterGroupNode> = []\n\n // Path params\n if (pathParams.length) {\n const pathChildren = pathParams.map((p) =>\n ast.createFunctionParameter({ name: p.name, type: resolvePathParamType(node, p, resolver), optional: !p.required }),\n )\n params.push({\n kind: 'ParameterGroup',\n properties: pathChildren,\n inline: pathParamsType === 'inline',\n default: pathChildren.every((c) => c.optional) ? '{}' : undefined,\n })\n }\n\n // Request body\n if (bodyType) {\n params.push(ast.createFunctionParameter({ name: 'data', type: bodyType, optional: !bodyRequired }))\n }\n\n // Query params\n params.push(...buildGroupParam('params', node, queryParams, queryGroupType, resolver))\n\n return ast.createFunctionParameters({ params })\n}\n\n/**\n * Collect the names of the required params (no default) that drive the `enabled`\n * guard. These are exactly the params that should be made optional in the\n * generated signatures so callers can pass `undefined` to reach the disabled state.\n */\nexport function getEnabledParamNames(paramsNode: ast.FunctionParametersNode): string[] {\n const required: string[] = []\n for (const param of paramsNode.params) {\n if ('kind' in param && (param as ast.ParameterGroupNode).kind === 'ParameterGroup') {\n const group = param as ast.ParameterGroupNode\n for (const child of group.properties) {\n if (!child.optional && child.default === undefined) {\n required.push(child.name)\n }\n }\n } else {\n const fp = param as ast.FunctionParameterNode\n if (!fp.optional && fp.default === undefined) {\n required.push(fp.name)\n }\n }\n }\n return required\n}\n\n/**\n * Return a copy of `paramsNode` with the named params marked optional.\n *\n * Used to align signatures with the `enabled` guard: the guard already disables\n * the query while a param is falsy, so the param should accept `undefined`. The\n * change is type-only — the `queryFn` keeps calling the client with a non-null\n * assertion (see `injectNonNullAssertions`), so the emitted runtime is unchanged.\n */\nexport function markParamsOptional(paramsNode: ast.FunctionParametersNode, names: ReadonlyArray<string>): ast.FunctionParametersNode {\n if (names.length === 0) return paramsNode\n const nameSet = new Set(names)\n const params = paramsNode.params.map((param) => {\n if ('kind' in param && (param as ast.ParameterGroupNode).kind === 'ParameterGroup') {\n const group = param as ast.ParameterGroupNode\n return {\n ...group,\n properties: group.properties.map((child) =>\n nameSet.has(child.name) ? ast.createFunctionParameter({ name: child.name, type: child.type, rest: child.rest, optional: true }) : child,\n ),\n }\n }\n const fp = param as ast.FunctionParameterNode\n return nameSet.has(fp.name) ? ast.createFunctionParameter({ name: fp.name, type: fp.type, rest: fp.rest, optional: true }) : fp\n })\n return ast.createFunctionParameters({ params })\n}\n\n/**\n * Add a non-null assertion (`!`) to the named params inside a printed client-call\n * string. Bridges the type gap created by `markParamsOptional` while keeping the\n * runtime identical (the `!` is erased at compile time).\n *\n * Handles destructured shorthand groups (`{ petId }` → `{ petId: petId! }`) and\n * standalone identifiers (`params` → `params!`).\n */\nexport function injectNonNullAssertions(callStr: string, names: ReadonlyArray<string>): string {\n if (names.length === 0) return callStr\n const nameSet = new Set(names)\n\n // Step 1: destructured shorthand group `{ petId }` → `{ petId: petId! }`\n let result = callStr.replace(/\\{\\s*([\\w,\\s]+)\\s*\\}(?=\\s*,)/g, (match, inner: string) => {\n if (inner.includes(':') || inner.includes('...')) return match\n const keys = inner\n .split(',')\n .map((k: string) => k.trim())\n .filter(Boolean)\n if (!keys.some((k) => nameSet.has(k))) return match\n const rebuilt = keys.map((k) => (nameSet.has(k) ? `${k}: ${k}!` : k)).join(', ')\n return `{ ${rebuilt} }`\n })\n\n // Step 2: standalone identifiers like `params`, `data`\n result = result.replace(/(?<![{.:?])\\b(\\w+)\\b(?=\\s*,)/g, (match, name: string) => (nameSet.has(name) ? `${name}!` : match))\n\n return result\n}\n","import { getOperationParameters } from '@internals/shared'\nimport { Url } from '@internals/utils'\nimport type { ast } from '@kubb/core'\nimport type { PluginTs } from '@kubb/plugin-ts'\nimport { functionPrinter } from '@kubb/plugin-ts'\nimport { File, Function, Type } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport type { Transformer } from '../types.ts'\nimport { buildQueryKeyParams, getEnabledParamNames, markParamsOptional } from '../utils.ts'\n\ntype Props = {\n name: string\n typeName: string\n node: ast.OperationNode\n tsResolver: PluginTs['resolver']\n paramsCasing: 'camelcase' | undefined\n pathParamsType: 'object' | 'inline'\n transformer: Transformer | null | undefined\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\n\nexport const queryKeyTransformer: Transformer = ({ node, casing }) => {\n if (!node.path) return []\n const hasQueryParams = getOperationParameters(node).query.length > 0\n const hasRequestBody = !!node.requestBody?.content?.[0]?.schema\n\n return [\n Url.toObject(node.path, { type: 'path', stringify: true, casing }),\n hasQueryParams ? '...(params ? [params] : [])' : null,\n hasRequestBody ? '...(data ? [data] : [])' : null,\n ].filter(Boolean) as Array<string>\n}\n\nexport function QueryKey({ name, node, tsResolver, paramsCasing, pathParamsType, typeName, transformer }: Props): KubbReactNode {\n const baseParamsNode = buildQueryKeyParams(node, { pathParamsType, paramsCasing, resolver: tsResolver })\n const paramsNode = markParamsOptional(baseParamsNode, getEnabledParamNames(baseParamsNode))\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n const keys = (transformer ?? queryKeyTransformer)({ node, casing: paramsCasing })\n\n return (\n <>\n <File.Source name={name} isExportable isIndexable>\n <Function.Arrow name={name} export params={paramsSignature} singleLine>\n {`[${keys.join(', ')}] as const`}\n </Function.Arrow>\n </File.Source>\n <File.Source name={typeName} isTypeOnly>\n <Type name={typeName}>{`ReturnType<typeof ${name}>`}</Type>\n </File.Source>\n </>\n )\n}\n","import { ast } from '@kubb/core'\nimport type { ResolverTs } from '@kubb/plugin-ts'\nimport { functionPrinter } from '@kubb/plugin-ts'\nimport { File, Function, Type } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport type { PluginSwr } from '../types.ts'\nimport { buildRequestConfigType, buildStatusUnionType, getComments, resolveErrorNames } from '../utils.ts'\n\ntype Props = {\n name: string\n clientName: string\n mutationKeyName: string\n mutationKeyTypeName: string\n mutationArgTypeName: string\n node: ast.OperationNode\n tsResolver: ResolverTs\n paramsCasing: PluginSwr['resolvedOptions']['paramsCasing']\n paramsType: PluginSwr['resolvedOptions']['paramsType']\n pathParamsType: PluginSwr['resolvedOptions']['pathParamsType']\n dataReturnType: PluginSwr['resolvedOptions']['client']['dataReturnType']\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\nconst callPrinter = functionPrinter({ mode: 'call' })\nconst keysPrinter = functionPrinter({ mode: 'keys' })\n\nfunction createMutationArgParams(\n node: ast.OperationNode,\n options: {\n paramsCasing: PluginSwr['resolvedOptions']['paramsCasing']\n resolver: ResolverTs\n },\n): ast.FunctionParametersNode {\n return ast.createOperationParams(node, {\n paramsType: 'inline',\n pathParamsType: 'inline',\n paramsCasing: options.paramsCasing,\n resolver: options.resolver,\n })\n}\n\nfunction buildMutationParamsNode(\n node: ast.OperationNode,\n options: {\n paramsCasing: PluginSwr['resolvedOptions']['paramsCasing']\n dataReturnType: PluginSwr['resolvedOptions']['client']['dataReturnType']\n mutationKeyTypeName: string\n mutationArgTypeName: string\n resolver: ResolverTs\n },\n): ast.FunctionParametersNode {\n const { dataReturnType, mutationKeyTypeName, mutationArgTypeName, resolver } = options\n const responseName = resolver.resolveResponseName(node)\n const errorNames = resolveErrorNames(node, resolver)\n\n const TData = dataReturnType === 'data' ? responseName : buildStatusUnionType(node, resolver)\n const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(' | ') : 'Error'}>`\n\n return ast.createFunctionParameters({\n params: [\n ast.createFunctionParameter({\n name: 'options',\n type: ast.createParamsType({\n variant: 'reference',\n name: `{\n mutation?: SWRMutationConfiguration<${TData}, ${TError}, ${mutationKeyTypeName} | null, ${mutationArgTypeName}> & { throwOnError?: boolean },\n client?: ${buildRequestConfigType(node, resolver)},\n shouldFetch?: boolean,\n}`,\n }),\n default: '{}',\n }),\n ],\n })\n}\n\nexport function Mutation({\n name,\n clientName,\n mutationKeyName,\n mutationKeyTypeName,\n mutationArgTypeName,\n paramsCasing,\n paramsType,\n pathParamsType,\n dataReturnType,\n node,\n tsResolver,\n}: Props): KubbReactNode {\n const responseName = tsResolver.resolveResponseName(node)\n const errorNames = resolveErrorNames(node, tsResolver)\n\n const TData = dataReturnType === 'data' ? responseName : buildStatusUnionType(node, tsResolver)\n const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(' | ') : 'Error'}>`\n\n const mutationArgParamsNode = createMutationArgParams(node, { paramsCasing, resolver: tsResolver })\n const hasMutationParams = mutationArgParamsNode.params.length > 0\n const argTypeBody = hasMutationParams ? (declarationPrinter.print(mutationArgParamsNode) ?? '') : ''\n const argKeysStr = hasMutationParams ? (keysPrinter.print(mutationArgParamsNode) ?? '') : ''\n\n const generics = [TData, TError, `${mutationKeyTypeName} | null`, mutationArgTypeName]\n\n const paramsNode = buildMutationParamsNode(node, {\n paramsCasing,\n dataReturnType,\n mutationKeyTypeName,\n mutationArgTypeName,\n resolver: tsResolver,\n })\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n\n const clientCallParamsNode = ast.createOperationParams(node, {\n paramsType,\n pathParamsType: paramsType === 'object' ? 'object' : pathParamsType === 'object' ? 'object' : 'inline',\n paramsCasing,\n resolver: tsResolver,\n extraParams: [\n ast.createFunctionParameter({\n name: 'config',\n type: ast.createParamsType({\n variant: 'reference',\n name: buildRequestConfigType(node, tsResolver),\n }),\n default: '{}',\n }),\n ],\n })\n const clientCallStr = callPrinter.print(clientCallParamsNode) ?? ''\n\n return (\n <>\n <File.Source name={mutationArgTypeName} isExportable isIndexable isTypeOnly>\n <Type name={mutationArgTypeName} export>\n {hasMutationParams ? `{ ${argTypeBody} }` : 'never'}\n </Type>\n </File.Source>\n <File.Source name={name} isExportable isIndexable>\n <Function name={name} export params={paramsSignature} JSDoc={{ comments: getComments(node) }}>\n {`\n const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {}\n const mutationKey = ${mutationKeyName}()\n\n return useSWRMutation<${generics.join(', ')}>(\n shouldFetch ? mutationKey : null,\n async (_url${hasMutationParams ? `, { arg: { ${argKeysStr} } }` : ''}) => {\n return ${clientName}(${clientCallStr})\n },\n mutationOptions\n )\n `}\n </Function>\n </File.Source>\n </>\n )\n}\n","import type { Transformer } from '@internals/tanstack-query'\nimport { MutationKey as SharedMutationKey } from '@internals/tanstack-query'\nimport type { ast } from '@kubb/core'\nimport { File, Type } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\n\ntype Props = {\n name: string\n typeName: string\n node: ast.OperationNode\n paramsCasing: 'camelcase' | undefined\n pathParamsType: 'object' | 'inline'\n transformer: Transformer | undefined\n}\n\nexport function MutationKey({ name, typeName, node, paramsCasing, pathParamsType, transformer }: Props): KubbReactNode {\n return (\n <>\n <SharedMutationKey name={name} node={node} paramsCasing={paramsCasing} pathParamsType={pathParamsType} transformer={transformer} />\n <File.Source name={typeName} isExportable isIndexable isTypeOnly>\n <Type export name={typeName}>{`ReturnType<typeof ${name}>`}</Type>\n </File.Source>\n </>\n )\n}\n","import type { ast } from '@kubb/core'\nimport type { ResolverTs } from '@kubb/plugin-ts'\nimport { functionPrinter } from '@kubb/plugin-ts'\nimport { File, Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport { buildQueryOptionsParams, getEnabledParamNames, injectNonNullAssertions, markParamsOptional } from '@internals/tanstack-query'\nimport type { PluginSwr } from '../types.ts'\nimport { buildQueryKeyParams } from '../utils.ts'\n\ntype Props = {\n name: string\n clientName: string\n node: ast.OperationNode\n tsResolver: ResolverTs\n paramsCasing: PluginSwr['resolvedOptions']['paramsCasing']\n paramsType: PluginSwr['resolvedOptions']['paramsType']\n pathParamsType: PluginSwr['resolvedOptions']['pathParamsType']\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\nconst callPrinter = functionPrinter({ mode: 'call' })\n\nexport function getQueryOptionsParams(\n node: ast.OperationNode,\n options: {\n paramsType: PluginSwr['resolvedOptions']['paramsType']\n paramsCasing: PluginSwr['resolvedOptions']['paramsCasing']\n pathParamsType: PluginSwr['resolvedOptions']['pathParamsType']\n resolver: ResolverTs\n },\n): ast.FunctionParametersNode {\n return buildQueryOptionsParams(node, options)\n}\n\nexport function QueryOptions({ name, clientName, node, tsResolver, paramsCasing, paramsType, pathParamsType }: Props): KubbReactNode {\n const queryKeyParamsNode = buildQueryKeyParams(node, { pathParamsType, paramsCasing, resolver: tsResolver })\n const enabledNames = getEnabledParamNames(queryKeyParamsNode)\n\n const paramsNode = markParamsOptional(getQueryOptionsParams(node, { paramsType, paramsCasing, pathParamsType, resolver: tsResolver }), enabledNames)\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n const clientCallStr = injectNonNullAssertions(callPrinter.print(paramsNode) ?? '', enabledNames)\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function name={name} export params={paramsSignature}>\n {`\n return {\n fetcher: async () => {\n return ${clientName}(${clientCallStr})\n },\n }\n`}\n </Function>\n </File.Source>\n )\n}\n","import { ast } from '@kubb/core'\nimport type { ResolverTs } from '@kubb/plugin-ts'\nimport { functionPrinter } from '@kubb/plugin-ts'\nimport { File, Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport { getEnabledParamNames, markParamsOptional } from '@internals/tanstack-query'\nimport type { PluginSwr } from '../types.ts'\nimport { buildQueryKeyParams, buildStatusUnionType, getComments, resolveErrorNames } from '../utils.ts'\nimport { getQueryOptionsParams } from './QueryOptions.tsx'\n\ntype Props = {\n name: string\n queryOptionsName: string\n queryKeyName: string\n queryKeyTypeName: string\n node: ast.OperationNode\n tsResolver: ResolverTs\n paramsCasing: PluginSwr['resolvedOptions']['paramsCasing']\n paramsType: PluginSwr['resolvedOptions']['paramsType']\n pathParamsType: PluginSwr['resolvedOptions']['pathParamsType']\n dataReturnType: PluginSwr['resolvedOptions']['client']['dataReturnType']\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\nconst callPrinter = functionPrinter({ mode: 'call' })\n\nfunction buildQueryParamsNode(\n node: ast.OperationNode,\n options: {\n paramsType: PluginSwr['resolvedOptions']['paramsType']\n paramsCasing: PluginSwr['resolvedOptions']['paramsCasing']\n pathParamsType: PluginSwr['resolvedOptions']['pathParamsType']\n dataReturnType: PluginSwr['resolvedOptions']['client']['dataReturnType']\n resolver: ResolverTs\n },\n): ast.FunctionParametersNode {\n const { paramsType, paramsCasing, pathParamsType, dataReturnType, resolver } = options\n const responseName = resolver.resolveResponseName(node)\n const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : undefined\n const errorNames = resolveErrorNames(node, resolver)\n\n const TData = dataReturnType === 'data' ? responseName : buildStatusUnionType(node, resolver)\n const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(' | ') : 'Error'}>`\n\n const optionsParam = ast.createFunctionParameter({\n name: 'options',\n type: ast.createParamsType({\n variant: 'reference',\n name: `{\n query?: SWRConfiguration<${[TData, TError].join(', ')}>,\n client?: ${requestName ? `Partial<RequestConfig<${requestName}>> & { client?: Client }` : 'Partial<RequestConfig> & { client?: Client }'},\n shouldFetch?: boolean,\n immutable?: boolean\n}`,\n }),\n default: '{}',\n })\n\n return ast.createOperationParams(node, {\n paramsType,\n pathParamsType: paramsType === 'object' ? 'object' : pathParamsType === 'object' ? 'object' : 'inline',\n paramsCasing,\n resolver,\n extraParams: [optionsParam],\n })\n}\n\nexport function Query({\n name,\n queryKeyTypeName,\n queryOptionsName,\n queryKeyName,\n paramsType,\n paramsCasing,\n pathParamsType,\n dataReturnType,\n node,\n tsResolver,\n}: Props): KubbReactNode {\n const responseName = tsResolver.resolveResponseName(node)\n const errorNames = resolveErrorNames(node, tsResolver)\n\n const TData = dataReturnType === 'data' ? responseName : buildStatusUnionType(node, tsResolver)\n const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(' | ') : 'Error'}>`\n const generics = [TData, TError, `${queryKeyTypeName} | null`]\n\n const queryKeyParamsNode = buildQueryKeyParams(node, { pathParamsType, paramsCasing, resolver: tsResolver })\n const queryKeyParamsCall = callPrinter.print(queryKeyParamsNode) ?? ''\n const enabledNames = getEnabledParamNames(queryKeyParamsNode)\n\n const queryOptionsParamsNode = getQueryOptionsParams(node, { paramsType, paramsCasing, pathParamsType, resolver: tsResolver })\n const queryOptionsParamsCall = callPrinter.print(queryOptionsParamsNode) ?? ''\n\n const paramsNode = markParamsOptional(\n buildQueryParamsNode(node, { paramsType, paramsCasing, pathParamsType, dataReturnType, resolver: tsResolver }),\n enabledNames,\n )\n const paramsSignature = declarationPrinter.print(paramsNode) ?? ''\n\n // SWR has no `enabled` option; fold the param-presence check into the null-key gate\n // so passing `undefined` for a required param disables the request (mirrors React Query #60).\n const shouldFetchExpr = enabledNames.length ? `shouldFetch && !!(${enabledNames.join(' && ')})` : 'shouldFetch'\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function name={name} export params={paramsSignature} JSDoc={{ comments: getComments(node) }}>\n {`\n const { query: queryOptions, client: config = {}, shouldFetch = true, immutable } = options ?? {}\n\n const queryKey = ${queryKeyName}(${queryKeyParamsCall})\n\n return useSWR<${generics.join(', ')}>(\n ${shouldFetchExpr} ? queryKey : null,\n {\n ...${queryOptionsName}(${queryOptionsParamsCall}),\n ...(immutable ? {\n revalidateIfStale: false,\n revalidateOnFocus: false,\n revalidateOnReconnect: false\n } : { }),\n ...queryOptions,\n }\n )\n `}\n </Function>\n </File.Source>\n )\n}\n"],"mappings":";;;;;;;;;;;;;AAkBA,SAAS,gBAAgB,MAAc,QAAyB;CAC9D,OAAO,KACJ,KAAK,CAAC,CACN,QAAQ,qBAAqB,OAAO,CAAC,CACrC,QAAQ,yBAAyB,OAAO,CAAC,CACzC,QAAQ,gBAAgB,OAAO,CAAC,CAChC,MAAM,eAAe,CAAC,CACtB,OAAO,OAAO,CAAC,CACf,KAAK,MAAM,MAAM;EAChB,IAAI,KAAK,SAAS,KAAK,SAAS,KAAK,YAAY,GAAG,OAAO;EAE3D,QADa,MAAM,KAAK,CAAC,SAAS,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,KAC9E,KAAK,MAAM,CAAC;CAC5B,CAAC,CAAC,CACD,KAAK,EAAE,CAAC,CACR,QAAQ,iBAAiB,EAAE;AAChC;;;;;;;;;;AAWA,SAAgB,UAAU,MAAc,EAAE,SAAS,IAAI,SAAS,OAAgB,CAAC,GAAW;CAC1F,OAAO,gBAAgB,GAAG,OAAO,GAAG,KAAK,GAAG,UAAU,K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,KAAK;CAElG,OACE,oBAAC,KAAK,QAAN;EAAmB;EAAM,cAAA;EAAa,aAAA;YACpC,oBAAC,UAAD;GAAgB;GAAM,QAAA;GAAO,QAAQ;GAAiB,OAAO,EAAE,UAAUC,uBAAY,IAAI,EAAE;aACxF;;;0BAGiB,aAAa,GAAG,mBAAmB;;uBAEtC,SAAS,KAAK,IAAI,EAAE;UACjC,gBAAgB;;eAEX,iBAAiB,GAAG,uBAAuB;;;;;;;;;;EAU1C,CAAA;CACC,CAAA;AAEjB"}
|
package/dist/components.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_components = require("./components-
|
|
2
|
+
const require_components = require("./components-C8FJ3-Cb.cjs");
|
|
3
3
|
exports.Mutation = require_components.Mutation;
|
|
4
4
|
exports.MutationKey = require_components.MutationKey;
|
|
5
5
|
exports.Query = require_components.Query;
|
package/dist/components.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-C0LytTxp.js";
|
|
2
|
-
import { i as Transformer, n as PluginSwr, r as QueryKey } from "./types-
|
|
2
|
+
import { i as Transformer, n as PluginSwr, r as QueryKey } from "./types-Dz_j0Bqv.js";
|
|
3
3
|
import { ast } from "@kubb/core";
|
|
4
4
|
import { ResolverTs } from "@kubb/plugin-ts";
|
|
5
5
|
import { KubbReactNode } from "@kubb/renderer-jsx/types";
|
package/dist/components.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as QueryKey, i as Mutation, n as QueryOptions, r as MutationKey, t as Query } from "./components-
|
|
1
|
+
import { a as QueryKey, i as Mutation, n as QueryOptions, r as MutationKey, t as Query } from "./components-CR9NLFcO.js";
|
|
2
2
|
export { Mutation, MutationKey, Query, QueryKey, QueryOptions };
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import "./chunk-C0LytTxp.js";
|
|
2
|
-
import { a as QueryKey,
|
|
2
|
+
import { a as QueryKey, i as Mutation, l as resolveOperationTypeNames, n as QueryOptions, r as MutationKey, s as resolveZodSchemaNames, t as Query } from "./components-CR9NLFcO.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { ast, defineGenerator } from "@kubb/core";
|
|
5
|
-
import { Client, pluginClientName } from "@kubb/plugin-client";
|
|
5
|
+
import { Client, isParserEnabled, pluginClientName } from "@kubb/plugin-client";
|
|
6
6
|
import { pluginTsName } from "@kubb/plugin-ts";
|
|
7
7
|
import { pluginZodName } from "@kubb/plugin-zod";
|
|
8
8
|
import { File, jsxRenderer } from "@kubb/renderer-jsx";
|
|
9
9
|
import { Fragment, jsx, jsxs } from "@kubb/renderer-jsx/jsx-runtime";
|
|
10
10
|
//#region src/generators/mutationGenerator.tsx
|
|
11
|
+
/**
|
|
12
|
+
* Built-in generator for `useSWRMutation` hooks. Emits one `useFooMutation` hook
|
|
13
|
+
* per POST/PUT/DELETE operation (configurable via `mutation.methods`) plus
|
|
14
|
+
* the matching `fooMutationKey` helper.
|
|
15
|
+
*/
|
|
11
16
|
const mutationGenerator = defineGenerator({
|
|
12
17
|
name: "swr-mutation",
|
|
13
18
|
renderer: jsxRenderer,
|
|
@@ -53,7 +58,7 @@ const mutationGenerator = defineGenerator({
|
|
|
53
58
|
paramsCasing,
|
|
54
59
|
order: "body-response-first"
|
|
55
60
|
});
|
|
56
|
-
const pluginZod = parser
|
|
61
|
+
const pluginZod = isParserEnabled(parser) ? driver.getPlugin(pluginZodName) : void 0;
|
|
57
62
|
const zodResolver = pluginZod ? driver.getResolver(pluginZodName) : void 0;
|
|
58
63
|
const fileZod = zodResolver ? zodResolver.resolveFile({
|
|
59
64
|
name: node.operationId,
|
|
@@ -65,7 +70,7 @@ const mutationGenerator = defineGenerator({
|
|
|
65
70
|
output: pluginZod?.options?.output ?? output,
|
|
66
71
|
group: pluginZod?.options?.group
|
|
67
72
|
}) : void 0;
|
|
68
|
-
const zodSchemaNames = resolveZodSchemaNames(node, zodResolver);
|
|
73
|
+
const zodSchemaNames = resolveZodSchemaNames(node, zodResolver, parser);
|
|
69
74
|
const clientPlugin = driver.getPlugin(pluginClientName);
|
|
70
75
|
const shouldUseClientPlugin = clientPlugin?.name === pluginClientName && clientOptions.clientType !== "class";
|
|
71
76
|
const clientResolver = shouldUseClientPlugin ? driver.getResolver(pluginClientName) : void 0;
|
|
@@ -106,48 +111,31 @@ const mutationGenerator = defineGenerator({
|
|
|
106
111
|
root: meta.file.path,
|
|
107
112
|
path: fileZod.path
|
|
108
113
|
}),
|
|
109
|
-
clientOptions.importPath ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
/* @__PURE__ */ jsx(File.Import, {
|
|
135
|
-
name: [
|
|
136
|
-
"Client",
|
|
137
|
-
"RequestConfig",
|
|
138
|
-
"ResponseErrorConfig"
|
|
139
|
-
],
|
|
140
|
-
root: meta.file.path,
|
|
141
|
-
path: path.resolve(root, ".kubb/client.ts"),
|
|
142
|
-
isTypeOnly: true
|
|
143
|
-
}),
|
|
144
|
-
clientOptions.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
|
|
145
|
-
name: ["ResponseConfig"],
|
|
146
|
-
root: meta.file.path,
|
|
147
|
-
path: path.resolve(root, ".kubb/client.ts"),
|
|
148
|
-
isTypeOnly: true
|
|
149
|
-
})
|
|
150
|
-
] }),
|
|
114
|
+
clientOptions.importPath ? /* @__PURE__ */ jsxs(Fragment, { children: [!shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
|
|
115
|
+
name: "client",
|
|
116
|
+
path: clientOptions.importPath
|
|
117
|
+
}), /* @__PURE__ */ jsx(File.Import, {
|
|
118
|
+
name: [
|
|
119
|
+
"Client",
|
|
120
|
+
"RequestConfig",
|
|
121
|
+
"ResponseErrorConfig"
|
|
122
|
+
],
|
|
123
|
+
path: clientOptions.importPath,
|
|
124
|
+
isTypeOnly: true
|
|
125
|
+
})] }) : /* @__PURE__ */ jsxs(Fragment, { children: [!shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
|
|
126
|
+
name: ["client"],
|
|
127
|
+
root: meta.file.path,
|
|
128
|
+
path: path.resolve(root, ".kubb/client.ts")
|
|
129
|
+
}), /* @__PURE__ */ jsx(File.Import, {
|
|
130
|
+
name: [
|
|
131
|
+
"Client",
|
|
132
|
+
"RequestConfig",
|
|
133
|
+
"ResponseErrorConfig"
|
|
134
|
+
],
|
|
135
|
+
root: meta.file.path,
|
|
136
|
+
path: path.resolve(root, ".kubb/client.ts"),
|
|
137
|
+
isTypeOnly: true
|
|
138
|
+
})] }),
|
|
151
139
|
shouldUseClientPlugin && clientFile && /* @__PURE__ */ jsx(File.Import, {
|
|
152
140
|
name: [resolvedClientName],
|
|
153
141
|
root: meta.file.path,
|
|
@@ -158,6 +146,11 @@ const mutationGenerator = defineGenerator({
|
|
|
158
146
|
root: meta.file.path,
|
|
159
147
|
path: path.resolve(root, ".kubb/config.ts")
|
|
160
148
|
}),
|
|
149
|
+
!shouldUseClientPlugin && parser === "zod" && zodResolver && node.requestBody?.content?.[0]?.schema && /* @__PURE__ */ jsx(File.Import, {
|
|
150
|
+
name: ["z"],
|
|
151
|
+
path: "zod",
|
|
152
|
+
isTypeOnly: true
|
|
153
|
+
}),
|
|
161
154
|
meta.fileTs && importedTypeNames.length > 0 && /* @__PURE__ */ jsx(File.Import, {
|
|
162
155
|
name: Array.from(new Set(importedTypeNames)),
|
|
163
156
|
root: meta.file.path,
|
|
@@ -261,7 +254,7 @@ const queryGenerator = defineGenerator({
|
|
|
261
254
|
exclude: [queryKeyTypeName],
|
|
262
255
|
order: "body-response-first"
|
|
263
256
|
});
|
|
264
|
-
const pluginZod = parser
|
|
257
|
+
const pluginZod = isParserEnabled(parser) ? driver.getPlugin(pluginZodName) : void 0;
|
|
265
258
|
const zodResolver = pluginZod ? driver.getResolver(pluginZodName) : void 0;
|
|
266
259
|
const fileZod = zodResolver ? zodResolver.resolveFile({
|
|
267
260
|
name: node.operationId,
|
|
@@ -273,7 +266,7 @@ const queryGenerator = defineGenerator({
|
|
|
273
266
|
output: pluginZod?.options?.output ?? output,
|
|
274
267
|
group: pluginZod?.options?.group
|
|
275
268
|
}) : void 0;
|
|
276
|
-
const zodSchemaNames = resolveZodSchemaNames(node, zodResolver);
|
|
269
|
+
const zodSchemaNames = resolveZodSchemaNames(node, zodResolver, parser);
|
|
277
270
|
const clientPlugin = driver.getPlugin(pluginClientName);
|
|
278
271
|
const shouldUseClientPlugin = clientPlugin?.name === pluginClientName && clientOptions.clientType !== "class";
|
|
279
272
|
const clientResolver = shouldUseClientPlugin ? driver.getResolver(pluginClientName) : void 0;
|
|
@@ -314,48 +307,31 @@ const queryGenerator = defineGenerator({
|
|
|
314
307
|
root: meta.file.path,
|
|
315
308
|
path: fileZod.path
|
|
316
309
|
}),
|
|
317
|
-
clientOptions.importPath ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
/* @__PURE__ */ jsx(File.Import, {
|
|
343
|
-
name: [
|
|
344
|
-
"Client",
|
|
345
|
-
"RequestConfig",
|
|
346
|
-
"ResponseErrorConfig"
|
|
347
|
-
],
|
|
348
|
-
root: meta.file.path,
|
|
349
|
-
path: path.resolve(root, ".kubb/client.ts"),
|
|
350
|
-
isTypeOnly: true
|
|
351
|
-
}),
|
|
352
|
-
clientOptions.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
|
|
353
|
-
name: ["ResponseConfig"],
|
|
354
|
-
root: meta.file.path,
|
|
355
|
-
path: path.resolve(root, ".kubb/client.ts"),
|
|
356
|
-
isTypeOnly: true
|
|
357
|
-
})
|
|
358
|
-
] }),
|
|
310
|
+
clientOptions.importPath ? /* @__PURE__ */ jsxs(Fragment, { children: [!shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
|
|
311
|
+
name: "client",
|
|
312
|
+
path: clientOptions.importPath
|
|
313
|
+
}), /* @__PURE__ */ jsx(File.Import, {
|
|
314
|
+
name: [
|
|
315
|
+
"Client",
|
|
316
|
+
"RequestConfig",
|
|
317
|
+
"ResponseErrorConfig"
|
|
318
|
+
],
|
|
319
|
+
path: clientOptions.importPath,
|
|
320
|
+
isTypeOnly: true
|
|
321
|
+
})] }) : /* @__PURE__ */ jsxs(Fragment, { children: [!shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
|
|
322
|
+
name: ["client"],
|
|
323
|
+
root: meta.file.path,
|
|
324
|
+
path: path.resolve(root, ".kubb/client.ts")
|
|
325
|
+
}), /* @__PURE__ */ jsx(File.Import, {
|
|
326
|
+
name: [
|
|
327
|
+
"Client",
|
|
328
|
+
"RequestConfig",
|
|
329
|
+
"ResponseErrorConfig"
|
|
330
|
+
],
|
|
331
|
+
root: meta.file.path,
|
|
332
|
+
path: path.resolve(root, ".kubb/client.ts"),
|
|
333
|
+
isTypeOnly: true
|
|
334
|
+
})] }),
|
|
359
335
|
shouldUseClientPlugin && clientFile && /* @__PURE__ */ jsx(File.Import, {
|
|
360
336
|
name: [resolvedClientName],
|
|
361
337
|
root: meta.file.path,
|
|
@@ -432,4 +408,4 @@ const queryGenerator = defineGenerator({
|
|
|
432
408
|
//#endregion
|
|
433
409
|
export { mutationGenerator as n, queryGenerator as t };
|
|
434
410
|
|
|
435
|
-
//# sourceMappingURL=generators-
|
|
411
|
+
//# sourceMappingURL=generators-BB6csINY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generators-BB6csINY.js","names":[],"sources":["../src/generators/mutationGenerator.tsx","../src/generators/queryGenerator.tsx"],"sourcesContent":["import path from 'node:path'\nimport { resolveOperationTypeNames } from '@internals/shared'\nimport { resolveZodSchemaNames } from '@internals/tanstack-query'\nimport { ast, defineGenerator } from '@kubb/core'\nimport { Client, isParserEnabled, pluginClientName } from '@kubb/plugin-client'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, jsxRenderer } from '@kubb/renderer-jsx'\nimport { Mutation, MutationKey } from '../components'\nimport type { PluginSwr } from '../types'\n\n/**\n * Built-in generator for `useSWRMutation` hooks. Emits one `useFooMutation` hook\n * per POST/PUT/DELETE operation (configurable via `mutation.methods`) plus\n * the matching `fooMutationKey` helper.\n */\nexport const mutationGenerator = defineGenerator<PluginSwr>({\n name: 'swr-mutation',\n renderer: jsxRenderer,\n operation(node, ctx) {\n if (!ast.isHttpOperationNode(node)) return null\n const { config, driver, resolver, root } = ctx\n const { output, query, mutation, paramsCasing, paramsType, pathParamsType, parser, client: clientOptions, group } = ctx.options\n\n const pluginTs = driver.getPlugin(pluginTsName)\n if (!pluginTs) return null\n const tsResolver = driver.getResolver(pluginTsName)\n\n const isQuery = query === false || (!!query && query.methods.some((method) => node.method.toLowerCase() === method.toLowerCase()))\n const queryMethods = new Set(query ? query.methods : [])\n const isMutation =\n mutation !== false &&\n !isQuery &&\n (mutation ? mutation.methods : []).some((method) => !queryMethods.has(method) && node.method.toLowerCase() === method.toLowerCase())\n\n if (!isMutation) return null\n\n const importPath = mutation ? mutation.importPath : 'swr/mutation'\n\n const mutationHookName = resolver.resolveMutationName(node)\n const mutationKeyName = resolver.resolveMutationKeyName(node)\n const mutationKeyTypeName = resolver.resolveMutationKeyTypeName(node)\n const mutationArgTypeName = resolver.resolveMutationArgTypeName(node)\n const clientName = resolver.resolveClientName(node)\n\n const meta = {\n file: resolver.resolveFile({ name: mutationHookName, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path }, { root, output, group }),\n fileTs: tsResolver.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n { root, output: pluginTs.options?.output ?? output, group: pluginTs.options?.group },\n ),\n }\n\n const importedTypeNames = resolveOperationTypeNames(node, tsResolver, { paramsCasing, order: 'body-response-first' })\n\n const pluginZod = isParserEnabled(parser) ? driver.getPlugin(pluginZodName) : undefined\n const zodResolver = pluginZod ? driver.getResolver(pluginZodName) : undefined\n const fileZod = zodResolver\n ? zodResolver.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n { root, output: pluginZod?.options?.output ?? output, group: pluginZod?.options?.group },\n )\n : undefined\n const zodSchemaNames = resolveZodSchemaNames(node, zodResolver, parser)\n\n const clientPlugin = driver.getPlugin(pluginClientName)\n const hasClientPlugin = clientPlugin?.name === pluginClientName\n const shouldUseClientPlugin = hasClientPlugin && clientOptions.clientType !== 'class'\n const clientResolver = shouldUseClientPlugin ? driver.getResolver(pluginClientName) : undefined\n\n const clientFile = shouldUseClientPlugin\n ? clientResolver?.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n {\n root,\n output: clientPlugin?.options?.output ?? output,\n group: clientPlugin?.options?.group,\n },\n )\n : undefined\n\n const resolvedClientName = shouldUseClientPlugin ? (clientResolver?.resolveName(node.operationId) ?? clientName) : clientName\n\n return (\n <File\n baseName={meta.file.baseName}\n path={meta.file.path}\n meta={meta.file.meta}\n banner={resolver.resolveBanner(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n footer={resolver.resolveFooter(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n >\n {fileZod && zodSchemaNames.length > 0 && <File.Import name={zodSchemaNames} root={meta.file.path} path={fileZod.path} />}\n {clientOptions.importPath ? (\n <>\n {!shouldUseClientPlugin && <File.Import name={'client'} path={clientOptions.importPath} />}\n <File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={clientOptions.importPath} isTypeOnly />\n </>\n ) : (\n <>\n {!shouldUseClientPlugin && <File.Import name={['client']} root={meta.file.path} path={path.resolve(root, '.kubb/client.ts')} />}\n <File.Import\n name={['Client', 'RequestConfig', 'ResponseErrorConfig']}\n root={meta.file.path}\n path={path.resolve(root, '.kubb/client.ts')}\n isTypeOnly\n />\n </>\n )}\n {shouldUseClientPlugin && clientFile && <File.Import name={[resolvedClientName]} root={meta.file.path} path={clientFile.path} />}\n {!shouldUseClientPlugin && node.requestBody?.content?.some((e) => e.contentType === 'multipart/form-data') && (\n <File.Import name={['buildFormData']} root={meta.file.path} path={path.resolve(root, '.kubb/config.ts')} />\n )}\n {!shouldUseClientPlugin && parser === 'zod' && zodResolver && node.requestBody?.content?.[0]?.schema && (\n <File.Import name={['z']} path=\"zod\" isTypeOnly />\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 <MutationKey\n name={mutationKeyName}\n typeName={mutationKeyTypeName}\n node={node}\n pathParamsType={pathParamsType}\n paramsCasing={paramsCasing}\n transformer={ctx.options.mutationKey}\n />\n\n {!shouldUseClientPlugin && (\n <Client\n name={resolvedClientName}\n baseURL={clientOptions.baseURL}\n dataReturnType={clientOptions.dataReturnType || 'data'}\n paramsCasing={clientOptions.paramsCasing || paramsCasing}\n paramsType={paramsType}\n pathParamsType={pathParamsType}\n parser={parser}\n node={node}\n tsResolver={tsResolver}\n zodResolver={zodResolver}\n />\n )}\n\n {mutation && (\n <>\n <File.Import name={'useSWRMutation'} path={importPath} />\n <File.Import name={['SWRMutationConfiguration']} path={importPath} isTypeOnly />\n <Mutation\n name={mutationHookName}\n clientName={resolvedClientName}\n mutationKeyName={mutationKeyName}\n mutationKeyTypeName={mutationKeyTypeName}\n mutationArgTypeName={mutationArgTypeName}\n node={node}\n tsResolver={tsResolver}\n dataReturnType={clientOptions.dataReturnType || 'data'}\n paramsCasing={paramsCasing}\n paramsType={paramsType}\n pathParamsType={pathParamsType}\n />\n </>\n )}\n </File>\n )\n },\n})\n","import path from 'node:path'\nimport { resolveOperationTypeNames } from '@internals/shared'\nimport { resolveZodSchemaNames } from '@internals/tanstack-query'\nimport { ast, defineGenerator } from '@kubb/core'\nimport { Client, isParserEnabled, pluginClientName } from '@kubb/plugin-client'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, jsxRenderer } from '@kubb/renderer-jsx'\nimport { Query, QueryKey, QueryOptions } from '../components'\nimport type { PluginSwr } from '../types'\n\nexport const queryGenerator = defineGenerator<PluginSwr>({\n name: 'swr-query',\n renderer: jsxRenderer,\n operation(node, ctx) {\n if (!ast.isHttpOperationNode(node)) return null\n const { config, driver, resolver, root } = ctx\n const { output, query, mutation, paramsCasing, paramsType, pathParamsType, parser, client: clientOptions, group } = ctx.options\n\n const pluginTs = driver.getPlugin(pluginTsName)\n if (!pluginTs) return null\n const tsResolver = driver.getResolver(pluginTsName)\n\n const isQuery = query === false || (!!query && query.methods.some((method) => node.method.toLowerCase() === method.toLowerCase()))\n const queryMethods = new Set(query ? query.methods : [])\n const isMutation =\n mutation !== false &&\n !isQuery &&\n (mutation ? mutation.methods : []).some((method) => !queryMethods.has(method) && node.method.toLowerCase() === method.toLowerCase())\n\n if (!isQuery || isMutation) return null\n\n const importPath = query ? query.importPath : 'swr'\n\n const queryName = resolver.resolveQueryName(node)\n const queryOptionsName = resolver.resolveQueryOptionsName(node)\n const queryKeyName = resolver.resolveQueryKeyName(node)\n const queryKeyTypeName = resolver.resolveQueryKeyTypeName(node)\n const clientName = resolver.resolveClientName(node)\n\n const meta = {\n file: resolver.resolveFile({ name: queryName, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path }, { root, output, group }),\n fileTs: tsResolver.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n { root, output: pluginTs.options?.output ?? output, group: pluginTs.options?.group },\n ),\n }\n\n const importedTypeNames = resolveOperationTypeNames(node, tsResolver, {\n paramsCasing,\n exclude: [queryKeyTypeName],\n order: 'body-response-first',\n })\n\n const pluginZod = isParserEnabled(parser) ? driver.getPlugin(pluginZodName) : undefined\n const zodResolver = pluginZod ? driver.getResolver(pluginZodName) : undefined\n const fileZod = zodResolver\n ? zodResolver.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n { root, output: pluginZod?.options?.output ?? output, group: pluginZod?.options?.group },\n )\n : undefined\n const zodSchemaNames = resolveZodSchemaNames(node, zodResolver, parser)\n\n const clientPlugin = driver.getPlugin(pluginClientName)\n const hasClientPlugin = clientPlugin?.name === pluginClientName\n const shouldUseClientPlugin = hasClientPlugin && clientOptions.clientType !== 'class'\n const clientResolver = shouldUseClientPlugin ? driver.getResolver(pluginClientName) : undefined\n\n const clientFile = shouldUseClientPlugin\n ? clientResolver?.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n {\n root,\n output: clientPlugin?.options?.output ?? output,\n group: clientPlugin?.options?.group,\n },\n )\n : undefined\n\n const resolvedClientName = shouldUseClientPlugin ? (clientResolver?.resolveName(node.operationId) ?? clientName) : clientName\n\n return (\n <File\n baseName={meta.file.baseName}\n path={meta.file.path}\n meta={meta.file.meta}\n banner={resolver.resolveBanner(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n footer={resolver.resolveFooter(ctx.meta, { output, config, file: { path: meta.file.path, baseName: meta.file.baseName } })}\n >\n {fileZod && zodSchemaNames.length > 0 && <File.Import name={zodSchemaNames} root={meta.file.path} path={fileZod.path} />}\n {clientOptions.importPath ? (\n <>\n {!shouldUseClientPlugin && <File.Import name={'client'} path={clientOptions.importPath} />}\n <File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={clientOptions.importPath} isTypeOnly />\n </>\n ) : (\n <>\n {!shouldUseClientPlugin && <File.Import name={['client']} root={meta.file.path} path={path.resolve(root, '.kubb/client.ts')} />}\n <File.Import\n name={['Client', 'RequestConfig', 'ResponseErrorConfig']}\n root={meta.file.path}\n path={path.resolve(root, '.kubb/client.ts')}\n isTypeOnly\n />\n </>\n )}\n {shouldUseClientPlugin && clientFile && <File.Import name={[resolvedClientName]} root={meta.file.path} path={clientFile.path} />}\n {!shouldUseClientPlugin && <File.Import name={['buildFormData']} root={meta.file.path} path={path.resolve(root, '.kubb/config.ts')} />}\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 <QueryKey\n name={queryKeyName}\n typeName={queryKeyTypeName}\n node={node}\n tsResolver={tsResolver}\n pathParamsType={pathParamsType}\n paramsCasing={paramsCasing}\n transformer={ctx.options.queryKey}\n />\n\n {!shouldUseClientPlugin && (\n <Client\n name={resolvedClientName}\n baseURL={clientOptions.baseURL}\n dataReturnType={clientOptions.dataReturnType || 'data'}\n paramsCasing={clientOptions.paramsCasing || paramsCasing}\n paramsType={paramsType}\n pathParamsType={pathParamsType}\n parser={parser}\n node={node}\n tsResolver={tsResolver}\n zodResolver={zodResolver}\n />\n )}\n\n <QueryOptions\n name={queryOptionsName}\n clientName={resolvedClientName}\n node={node}\n tsResolver={tsResolver}\n paramsCasing={paramsCasing}\n paramsType={paramsType}\n pathParamsType={pathParamsType}\n />\n\n {query && (\n <>\n <File.Import name={'useSWR'} path={importPath} />\n <File.Import name={['SWRConfiguration']} path={importPath} isTypeOnly />\n <Query\n name={queryName}\n queryOptionsName={queryOptionsName}\n queryKeyName={queryKeyName}\n queryKeyTypeName={queryKeyTypeName}\n node={node}\n tsResolver={tsResolver}\n paramsCasing={paramsCasing}\n paramsType={paramsType}\n pathParamsType={pathParamsType}\n dataReturnType={clientOptions.dataReturnType || 'data'}\n />\n </>\n )}\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;AAgBA,MAAa,oBAAoB,gBAA2B;CAC1D,MAAM;CACN,UAAU;CACV,UAAU,MAAM,KAAK;EACnB,IAAI,CAAC,IAAI,oBAAoB,IAAI,GAAG,OAAO;EAC3C,MAAM,EAAE,QAAQ,QAAQ,UAAU,SAAS;EAC3C,MAAM,EAAE,QAAQ,OAAO,UAAU,cAAc,YAAY,gBAAgB,QAAQ,QAAQ,eAAe,UAAU,IAAI;EAExH,MAAM,WAAW,OAAO,UAAU,YAAY;EAC9C,IAAI,CAAC,UAAU,OAAO;EACtB,MAAM,aAAa,OAAO,YAAY,YAAY;EAElD,MAAM,UAAU,UAAU,SAAU,CAAC,CAAC,SAAS,MAAM,QAAQ,MAAM,WAAW,KAAK,OAAO,YAAY,MAAM,OAAO,YAAY,CAAC;EAChI,MAAM,eAAe,IAAI,IAAI,QAAQ,MAAM,UAAU,CAAC,CAAC;EAMvD,IAAI,EAJF,aAAa,SACb,CAAC,YACA,WAAW,SAAS,UAAU,CAAC,EAAA,CAAG,MAAM,WAAW,CAAC,aAAa,IAAI,MAAM,KAAK,KAAK,OAAO,YAAY,MAAM,OAAO,YAAY,CAAC,IAEpH,OAAO;EAExB,MAAM,aAAa,WAAW,SAAS,aAAa;EAEpD,MAAM,mBAAmB,SAAS,oBAAoB,IAAI;EAC1D,MAAM,kBAAkB,SAAS,uBAAuB,IAAI;EAC5D,MAAM,sBAAsB,SAAS,2BAA2B,IAAI;EACpE,MAAM,sBAAsB,SAAS,2BAA2B,IAAI;EACpE,MAAM,aAAa,SAAS,kBAAkB,IA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