@kubb/plugin-react-query 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.
Files changed (46) hide show
  1. package/dist/{components-IArDg-DO.js → components-DL0Cai7l.js} +211 -255
  2. package/dist/components-DL0Cai7l.js.map +1 -0
  3. package/dist/{components-DQAYLQW0.cjs → components-yMQOuFmI.cjs} +215 -259
  4. package/dist/components-yMQOuFmI.cjs.map +1 -0
  5. package/dist/components.cjs +1 -1
  6. package/dist/components.d.ts +1 -1
  7. package/dist/components.js +1 -1
  8. package/dist/{generators-B86BJkmW.js → generators-BG-Vcvfg.js} +151 -231
  9. package/dist/generators-BG-Vcvfg.js.map +1 -0
  10. package/dist/{generators-BqGaMUH6.cjs → generators-zGKP8yII.cjs} +149 -229
  11. package/dist/generators-zGKP8yII.cjs.map +1 -0
  12. package/dist/generators.cjs +1 -1
  13. package/dist/generators.d.ts +1 -1
  14. package/dist/generators.js +1 -1
  15. package/dist/index.cjs +35 -12
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.ts +1 -1
  18. package/dist/index.js +36 -13
  19. package/dist/index.js.map +1 -1
  20. package/dist/{types-Dh4HNR9K.d.ts → types-X7D0NSvJ.d.ts} +11 -15
  21. package/package.json +10 -17
  22. package/src/components/InfiniteQuery.tsx +4 -5
  23. package/src/components/InfiniteQueryOptions.tsx +24 -27
  24. package/src/components/Mutation.tsx +5 -6
  25. package/src/components/MutationOptions.tsx +2 -2
  26. package/src/components/Query.tsx +5 -6
  27. package/src/components/QueryOptions.tsx +6 -25
  28. package/src/components/SuspenseInfiniteQuery.tsx +4 -5
  29. package/src/components/SuspenseInfiniteQueryOptions.tsx +24 -25
  30. package/src/components/SuspenseQuery.tsx +5 -6
  31. package/src/generators/customHookOptionsFileGenerator.tsx +2 -2
  32. package/src/generators/hookOptionsGenerator.tsx +2 -2
  33. package/src/generators/infiniteQueryGenerator.tsx +5 -9
  34. package/src/generators/mutationGenerator.tsx +8 -9
  35. package/src/generators/queryGenerator.tsx +5 -9
  36. package/src/generators/suspenseInfiniteQueryGenerator.tsx +5 -9
  37. package/src/generators/suspenseQueryGenerator.tsx +5 -9
  38. package/src/plugin.ts +4 -4
  39. package/src/resolvers/resolverReactQuery.ts +2 -2
  40. package/src/types.ts +9 -13
  41. package/src/utils.ts +1 -0
  42. package/dist/components-DQAYLQW0.cjs.map +0 -1
  43. package/dist/components-IArDg-DO.js.map +0 -1
  44. package/dist/generators-B86BJkmW.js.map +0 -1
  45. package/dist/generators-BqGaMUH6.cjs.map +0 -1
  46. package/extension.yaml +0 -1484
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generators-zGKP8yII.cjs","names":["jsxRenderer","path","fs","File","Function","jsxRenderer","ast","resolveOperationOverrides","operationFileEntry","File","getOperationParameters","Type","jsxRenderer","ast","pluginTsName","getOperationParameters","operationFileEntry","resolveOperationTypeNames","pluginZodName","resolveZodSchemaNames","pluginClientName","File","path","QueryKey","Client","InfiniteQueryOptions","InfiniteQuery","jsxRenderer","ast","pluginTsName","operationFileEntry","resolveOperationTypeNames","pluginZodName","resolveZodSchemaNames","pluginClientName","File","path","MutationKey","Client","MutationOptions","Mutation","jsxRenderer","ast","pluginTsName","operationFileEntry","resolveOperationTypeNames","pluginZodName","resolveZodSchemaNames","pluginClientName","File","path","QueryKey","Client","QueryOptions","Query","jsxRenderer","ast","pluginTsName","getOperationParameters","operationFileEntry","resolveOperationTypeNames","pluginZodName","resolveZodSchemaNames","pluginClientName","File","path","QueryKey","Client","SuspenseInfiniteQueryOptions","SuspenseInfiniteQuery","jsxRenderer","ast","pluginTsName","operationFileEntry","resolveOperationTypeNames","pluginZodName","resolveZodSchemaNames","pluginClientName","File","path","QueryKey","Client","QueryOptions","SuspenseQuery"],"sources":["../src/generators/customHookOptionsFileGenerator.tsx","../src/generators/hookOptionsGenerator.tsx","../src/generators/infiniteQueryGenerator.tsx","../src/generators/mutationGenerator.tsx","../src/generators/queryGenerator.tsx","../src/generators/suspenseInfiniteQueryGenerator.tsx","../src/generators/suspenseQueryGenerator.tsx"],"sourcesContent":["import fs from 'node:fs'\nimport path from 'node:path'\n\nimport { defineGenerator } from '@kubb/core'\nimport { File, Function, jsxRenderer } from '@kubb/renderer-jsx'\nimport type { PluginReactQuery } from '../types'\n\n/**\n * Scaffolds the user-editable `useCustomHookOptions` file when\n * `pluginReactQuery({ customOptions: { ... } })` is configured. The file is\n * only created when it does not already exist, so user edits persist across\n * regeneration.\n */\nexport const customHookOptionsFileGenerator = defineGenerator<PluginReactQuery>({\n name: 'react-query-custom-hook-options-file',\n renderer: jsxRenderer,\n operations(nodes, ctx) {\n const { resolver, config, root } = ctx\n const { output, customOptions, query, group } = ctx.options\n\n if (!customOptions) return null\n\n const override = output.override ?? config.output.override ?? false\n const { importPath, name } = customOptions\n const hookOptionsName = resolver.resolveHookOptionsName()\n const customHookOptionsName = resolver.resolveCustomHookOptionsName()\n\n const reactQueryImportPath = query ? query.importPath : '@tanstack/react-query'\n\n let hookFilePath: string\n const firstNode = nodes[0]\n if (firstNode) {\n const hookName = resolver.resolveQueryName(firstNode)\n const hookFile = resolver.resolveFile(\n { name: hookName, extname: '.ts', tag: firstNode.tags[0] ?? 'default', path: firstNode.path },\n { root, output, group: group ?? undefined },\n )\n hookFilePath = hookFile.path\n } else {\n hookFilePath = path.resolve(root, 'index.ts')\n }\n\n const ensureExtension = (filePath: string, extname: string) => {\n if (path.extname(filePath) === '') return filePath + extname\n return filePath\n }\n\n const basePath = path.dirname(hookFilePath)\n const actualFilePath = ensureExtension(importPath, '.ts')\n const file = {\n baseName: path.basename(actualFilePath) as `${string}.${string}`,\n name: path.basename(actualFilePath, path.extname(actualFilePath)),\n path: path.resolve(basePath, actualFilePath),\n }\n\n if (fs.existsSync(file.path) && !override) return null\n\n return (\n <File baseName={file.baseName} path={file.path}>\n <File.Import name={['QueryClient']} path={reactQueryImportPath} isTypeOnly />\n <File.Import name={['useQueryClient']} path={reactQueryImportPath} />\n <File.Import name={[hookOptionsName]} root={file.path} path={path.resolve(root, './index.ts')} />\n <File.Source name={file.name} isExportable isIndexable>\n <Function name={customHookOptionsName} params=\"{ queryClient }: { queryClient: QueryClient }\" returnType={`Partial<${hookOptionsName}>`}>\n {`return {\n // TODO: Define custom hook options here\n // Example:\n // useUpdatePetHook: {\n // onSuccess: () => {\n // void queryClient.invalidateQueries({ queryKey: ['pet'] })\n // }\n // }\n }`}\n </Function>\n <Function\n name={name}\n generics={`T extends keyof ${hookOptionsName}`}\n params=\"{ hookName, operationId }: { hookName: T, operationId: string }\"\n returnType={`${hookOptionsName}[T]`}\n export\n >\n {`const queryClient = useQueryClient()\n const customOptions = ${customHookOptionsName}({ queryClient })\n return customOptions[hookName] ?? {}`}\n </Function>\n </File.Source>\n </File>\n )\n },\n})\n","import { getOperationParameters, operationFileEntry } from '@internals/shared'\nimport { ast, defineGenerator } from '@kubb/core'\nimport { File, jsxRenderer, Type } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport type { PluginReactQuery } from '../types'\nimport { resolveOperationOverrides } from '../utils.ts'\n\ntype QueryOption = PluginReactQuery['resolvedOptions']['query']\ntype MutationOption = PluginReactQuery['resolvedOptions']['mutation']\n\n/**\n * Emits the `HookOptions` type used by `customOptions`. Enabled when\n * `pluginReactQuery({ customOptions: { ... } })`. The generated type lists\n * every hook keyed by name so user-supplied options stay in sync with the\n * generated hooks at compile time.\n */\nexport const hookOptionsGenerator = defineGenerator<PluginReactQuery>({\n name: 'react-query-hook-options',\n renderer: jsxRenderer,\n operations(nodes, ctx) {\n const { resolver, config, root } = ctx\n const { output, customOptions, query, mutation, suspense, infinite, group, override } = ctx.options\n\n if (!customOptions) return null\n\n const name = resolver.resolveHookOptionsName()\n const resolvedFile = resolver.resolveFile({ name, extname: '.ts' }, { root, output, group: group ?? undefined })\n const hookOptionsFile = {\n ...resolvedFile,\n baseName: `${name}.ts` as const,\n path: resolvedFile.path.replace(/[^/\\\\]+\\.ts$/, `${name}.ts`),\n }\n\n const imports: Array<KubbReactNode> = []\n const hookOptions: Record<string, string> = {}\n\n for (const node of nodes) {\n if (!ast.isHttpOperationNode(node)) continue\n const opOverrides = resolveOperationOverrides(node, override)\n const nodeQuery: QueryOption = 'query' in opOverrides ? (opOverrides.query as QueryOption) : query\n const nodeMutation: MutationOption = 'mutation' in opOverrides ? (opOverrides.mutation as MutationOption) : mutation\n const nodeInfinite = 'infinite' in opOverrides ? opOverrides.infinite : infinite\n const nodeInfiniteOptions = nodeInfinite && typeof nodeInfinite === 'object' ? nodeInfinite : null\n\n // query: false means \"still a query but skip the useQuery hook\"\n const isQueryOp =\n nodeQuery === false\n ? !!query && query.methods.some((m) => node.method.toLowerCase() === m.toLowerCase())\n : !!nodeQuery && nodeQuery.methods.some((m) => node.method.toLowerCase() === m.toLowerCase())\n const nodeQueryMethods = new Set(nodeQuery ? nodeQuery.methods : [])\n const isMutationOp =\n nodeMutation !== false &&\n !isQueryOp &&\n (nodeMutation ? nodeMutation.methods : []).some((m) => !nodeQueryMethods.has(m) && node.method.toLowerCase() === m.toLowerCase())\n const isSuspenseOp = !!suspense\n const isInfiniteOp = !!nodeInfiniteOptions\n\n if (isQueryOp) {\n const queryOptionsName = resolver.resolveQueryOptionsName(node)\n const queryHookName = resolver.resolveQueryName(node)\n const queryHookFile = resolver.resolveFile(operationFileEntry(node, queryHookName), { root, output, group: group ?? undefined })\n imports.push(<File.Import name={[queryOptionsName]} root={hookOptionsFile.path} path={queryHookFile.path} />)\n hookOptions[queryHookName] = `Partial<ReturnType<typeof ${queryOptionsName}>>`\n\n if (isSuspenseOp) {\n const suspenseOptionsName = resolver.resolveSuspenseQueryOptionsName(node)\n const suspenseHookName = resolver.resolveSuspenseQueryName(node)\n const suspenseHookFile = resolver.resolveFile(operationFileEntry(node, suspenseHookName), { root, output, group: group ?? undefined })\n imports.push(<File.Import name={[suspenseOptionsName]} root={hookOptionsFile.path} path={suspenseHookFile.path} />)\n hookOptions[suspenseHookName] = `Partial<ReturnType<typeof ${suspenseOptionsName}>>`\n }\n\n if (isInfiniteOp) {\n // Validate queryParam\n const normalizeKey = (key: string) => key.replace(/\\?$/, '')\n const queryParamKeys = getOperationParameters(node).query.map((p) => p.name)\n const hasQueryParam = nodeInfiniteOptions!.queryParam ? queryParamKeys.some((k) => normalizeKey(k) === nodeInfiniteOptions!.queryParam) : false\n\n if (hasQueryParam) {\n const infiniteOptionsName = resolver.resolveInfiniteQueryOptionsName(node)\n const infiniteHookName = resolver.resolveInfiniteQueryName(node)\n const infiniteHookFile = resolver.resolveFile(operationFileEntry(node, infiniteHookName), { root, output, group: group ?? undefined })\n imports.push(<File.Import name={[infiniteOptionsName]} root={hookOptionsFile.path} path={infiniteHookFile.path} />)\n hookOptions[infiniteHookName] = `Partial<ReturnType<typeof ${infiniteOptionsName}>>`\n\n if (isSuspenseOp) {\n const suspenseInfiniteOptionsName = resolver.resolveSuspenseInfiniteQueryOptionsName(node)\n const suspenseInfiniteHookName = resolver.resolveSuspenseInfiniteQueryName(node)\n const suspenseInfiniteHookFile = resolver.resolveFile(operationFileEntry(node, suspenseInfiniteHookName), {\n root,\n output,\n group: group ?? undefined,\n })\n imports.push(<File.Import name={[suspenseInfiniteOptionsName]} root={hookOptionsFile.path} path={suspenseInfiniteHookFile.path} />)\n hookOptions[suspenseInfiniteHookName] = `Partial<ReturnType<typeof ${suspenseInfiniteOptionsName}>>`\n }\n }\n }\n }\n\n if (isMutationOp) {\n const mutationOptionsName = resolver.resolveMutationOptionsName(node)\n const mutationHookName = resolver.resolveMutationName(node)\n const mutationHookFile = resolver.resolveFile(operationFileEntry(node, mutationHookName), { root, output, group: group ?? undefined })\n imports.push(<File.Import name={[mutationOptionsName]} root={hookOptionsFile.path} path={mutationHookFile.path} />)\n hookOptions[mutationHookName] = `Partial<ReturnType<typeof ${mutationOptionsName}>>`\n }\n }\n\n return (\n <File\n baseName={hookOptionsFile.baseName}\n path={hookOptionsFile.path}\n meta={hookOptionsFile.meta}\n banner={resolver.resolveBanner(ctx.meta, { output, config, file: { path: hookOptionsFile.path, baseName: hookOptionsFile.baseName } })}\n footer={resolver.resolveFooter(ctx.meta, { output, config, file: { path: hookOptionsFile.path, baseName: hookOptionsFile.baseName } })}\n >\n {imports}\n <File.Source name={name} isExportable isIndexable isTypeOnly>\n <Type export name={name}>\n {`{ ${Object.keys(hookOptions)\n .map((key) => `${JSON.stringify(key)}: ${hookOptions[key]}`)\n .join(', ')} }`}\n </Type>\n </File.Source>\n </File>\n )\n },\n})\n","import path from 'node:path'\nimport { getOperationParameters, operationFileEntry, 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 { InfiniteQuery, InfiniteQueryOptions, QueryKey } from '../components'\nimport type { PluginReactQuery } from '../types'\n\n/**\n * Built-in generator for `useInfiniteQuery` hooks. Enabled when\n * `pluginReactQuery({ infinite: { ... } })`. Emits one `useFooInfiniteQuery`\n * hook per query operation, wiring the configured `nextParam` /\n * `previousParam` paths into TanStack Query's cursor-based pagination.\n */\nexport const infiniteQueryGenerator = defineGenerator<PluginReactQuery>({\n name: 'react-infinite-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, infinite, paramsCasing, paramsType, pathParamsType, parser, client: clientOptions, group, customOptions } = 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 const infiniteOptions = infinite && typeof infinite === 'object' ? infinite : null\n\n if (!isQuery || isMutation || !infiniteOptions) return null\n\n // Validate queryParam exists in operation's query parameters\n const normalizeKey = (key: string) => key.replace(/\\?$/, '')\n const queryParamKeys = getOperationParameters(node).query.map((p) => p.name)\n const hasQueryParam = infiniteOptions.queryParam ? queryParamKeys.some((k) => normalizeKey(k) === infiniteOptions.queryParam) : false\n // cursorParam validation against response schema keys is skipped in v5 (complex schema inspection)\n const hasCursorParam = !infiniteOptions.cursorParam || true\n\n if (!hasQueryParam || !hasCursorParam) return null\n\n const importPath = query ? query.importPath : '@tanstack/react-query'\n\n const queryName = resolver.resolveInfiniteQueryName(node)\n const queryOptionsName = resolver.resolveInfiniteQueryOptionsName(node)\n const queryKeyName = resolver.resolveInfiniteQueryKeyName(node)\n const queryKeyTypeName = resolver.resolveInfiniteQueryKeyTypeName(node)\n const clientBaseName = resolver.resolveInfiniteClientName(node)\n\n const meta = {\n file: resolver.resolveFile(operationFileEntry(node, queryName), { root, output, group: group ?? undefined }),\n fileTs: tsResolver.resolveFile(operationFileEntry(node, node.operationId), {\n root,\n output: pluginTs.options?.output ?? output,\n group: pluginTs.options?.group ?? undefined,\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) : null\n const zodResolver = pluginZod ? driver.getResolver(pluginZodName) : null\n const fileZod = zodResolver\n ? zodResolver.resolveFile(operationFileEntry(node, node.operationId), {\n root,\n output: pluginZod?.options?.output ?? output,\n group: pluginZod?.options?.group ?? undefined,\n })\n : null\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) : null\n\n const clientFile = shouldUseClientPlugin\n ? clientResolver?.resolveFile(operationFileEntry(node, node.operationId), {\n root,\n output: clientPlugin?.options?.output ?? output,\n group: clientPlugin?.options?.group ?? undefined,\n })\n : null\n\n const resolvedClientName = shouldUseClientPlugin ? (clientResolver?.resolveName(node.operationId) ?? clientBaseName) : clientBaseName\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 {customOptions && <File.Import name={[customOptions.name]} path={customOptions.importPath} />}\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 <File.Import name={['InfiniteData']} isTypeOnly path={importPath} />\n <File.Import name={['infiniteQueryOptions']} path={importPath} />\n\n <InfiniteQueryOptions\n name={queryOptionsName}\n clientName={resolvedClientName}\n queryKeyName={queryKeyName}\n node={node}\n tsResolver={tsResolver}\n paramsCasing={paramsCasing}\n paramsType={paramsType}\n pathParamsType={pathParamsType}\n dataReturnType={clientOptions.dataReturnType || 'data'}\n cursorParam={infiniteOptions.cursorParam}\n nextParam={infiniteOptions.nextParam}\n previousParam={infiniteOptions.previousParam}\n initialPageParam={infiniteOptions.initialPageParam}\n queryParam={infiniteOptions.queryParam}\n />\n\n <File.Import name={['useInfiniteQuery']} path={importPath} />\n <File.Import name={['QueryKey', 'QueryClient', 'InfiniteQueryObserverOptions', 'UseInfiniteQueryResult']} path={importPath} isTypeOnly />\n\n <InfiniteQuery\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 initialPageParam={infiniteOptions.initialPageParam}\n queryParam={infiniteOptions.queryParam}\n customOptions={customOptions}\n />\n </File>\n )\n },\n})\n","import path from 'node:path'\nimport { operationFileEntry, 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, MutationOptions } from '../components'\nimport type { PluginReactQuery } from '../types'\n\n/**\n * Built-in generator for `useMutation` hooks. Emits one `useFooMutation` hook\n * per POST/PUT/DELETE operation (configurable via `mutation.methods`) plus\n * the matching `fooMutationKey` / `fooMutationOptions` helpers.\n */\nexport const mutationGenerator = defineGenerator<PluginReactQuery>({\n name: 'react-query-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, customOptions } = 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 : '@tanstack/react-query'\n\n const mutationHookName = resolver.resolveMutationName(node)\n const mutationTypeName = resolver.resolveMutationTypeName(node)\n const mutationOptionsName = resolver.resolveMutationOptionsName(node)\n const mutationKeyName = resolver.resolveMutationKeyName(node)\n const clientName = resolver.resolveClientName(node)\n\n const meta = {\n file: resolver.resolveFile(operationFileEntry(node, mutationHookName), { root, output, group: group ?? undefined }),\n fileTs: tsResolver.resolveFile(operationFileEntry(node, node.operationId), {\n root,\n output: pluginTs.options?.output ?? output,\n group: pluginTs.options?.group ?? undefined,\n }),\n }\n\n const importedTypeNames = resolveOperationTypeNames(node, tsResolver, { paramsCasing, order: 'body-response-first' })\n\n const pluginZod = isParserEnabled(parser) ? driver.getPlugin(pluginZodName) : null\n const zodResolver = pluginZod ? driver.getResolver(pluginZodName) : null\n const fileZod = zodResolver\n ? zodResolver.resolveFile(operationFileEntry(node, node.operationId), {\n root,\n output: pluginZod?.options?.output ?? output,\n group: pluginZod?.options?.group ?? undefined,\n })\n : null\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) : null\n\n const clientFile = shouldUseClientPlugin\n ? clientResolver?.resolveFile(operationFileEntry(node, node.operationId), {\n root,\n output: clientPlugin?.options?.output ?? output,\n group: clientPlugin?.options?.group ?? undefined,\n })\n : null\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 {customOptions && <File.Import name={[customOptions.name]} path={customOptions.importPath} />}\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 name={mutationKeyName} node={node} pathParamsType={pathParamsType} paramsCasing={paramsCasing} transformer={ctx.options.mutationKey} />\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 <File.Import name={['mutationOptions']} path={importPath} />\n\n <MutationOptions\n name={mutationOptionsName}\n clientName={resolvedClientName}\n mutationKeyName={mutationKeyName}\n node={node}\n tsResolver={tsResolver}\n paramsCasing={paramsCasing}\n paramsType={paramsType}\n pathParamsType={pathParamsType}\n dataReturnType={clientOptions.dataReturnType || 'data'}\n />\n\n {mutation && (\n <>\n <File.Import name={['useMutation']} path={importPath} />\n <File.Import name={['UseMutationOptions', 'UseMutationResult', 'QueryClient']} path={importPath} isTypeOnly />\n <Mutation\n name={mutationHookName}\n typeName={mutationTypeName}\n mutationOptionsName={mutationOptionsName}\n mutationKeyName={mutationKeyName}\n node={node}\n tsResolver={tsResolver}\n dataReturnType={clientOptions.dataReturnType || 'data'}\n paramsCasing={paramsCasing}\n pathParamsType={pathParamsType}\n customOptions={customOptions}\n />\n </>\n )}\n </File>\n )\n },\n})\n","import path from 'node:path'\nimport { operationFileEntry, 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 { PluginReactQuery } from '../types'\n\n/**\n * Built-in generator for `useQuery` hooks. Emits one `useFooQuery` hook per\n * GET operation (configurable via `query.methods`) plus the matching\n * `fooQueryKey` / `fooQueryOptions` helpers.\n */\nexport const queryGenerator = defineGenerator<PluginReactQuery>({\n name: 'react-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, customOptions } = ctx.options\n\n const pluginTs = driver.getPlugin(pluginTsName)\n if (!pluginTs) return null\n const tsResolver = driver.getResolver(pluginTsName)\n\n // query: false means \"this IS a query op, but skip the useQuery hook\"\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 : '@tanstack/react-query'\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(operationFileEntry(node, queryName), { root, output, group: group ?? undefined }),\n fileTs: tsResolver.resolveFile(operationFileEntry(node, node.operationId), {\n root,\n output: pluginTs.options?.output ?? output,\n group: pluginTs.options?.group ?? undefined,\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) : null\n const zodResolver = pluginZod ? driver.getResolver(pluginZodName) : null\n const fileZod = zodResolver\n ? zodResolver.resolveFile(operationFileEntry(node, node.operationId), {\n root,\n output: pluginZod?.options?.output ?? output,\n group: pluginZod?.options?.group ?? undefined,\n })\n : null\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) : null\n\n const clientFile = shouldUseClientPlugin\n ? clientResolver?.resolveFile(operationFileEntry(node, node.operationId), {\n root,\n output: clientPlugin?.options?.output ?? output,\n group: clientPlugin?.options?.group ?? undefined,\n })\n : null\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 {customOptions && <File.Import name={[customOptions.name]} path={customOptions.importPath} />}\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 <File.Import name={['queryOptions']} path={importPath} />\n\n <QueryOptions\n name={queryOptionsName}\n clientName={resolvedClientName}\n queryKeyName={queryKeyName}\n node={node}\n tsResolver={tsResolver}\n paramsCasing={paramsCasing}\n paramsType={paramsType}\n pathParamsType={pathParamsType}\n dataReturnType={clientOptions.dataReturnType || 'data'}\n />\n\n {query && (\n <>\n <File.Import name={['useQuery']} path={importPath} />\n <File.Import name={['QueryKey', 'QueryClient', 'QueryObserverOptions', 'UseQueryResult']} 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 customOptions={customOptions}\n />\n </>\n )}\n </File>\n )\n },\n})\n","import path from 'node:path'\nimport { getOperationParameters, operationFileEntry, 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 { QueryKey, SuspenseInfiniteQuery, SuspenseInfiniteQueryOptions } from '../components'\nimport type { PluginReactQuery } from '../types'\n\n/**\n * Built-in generator for `useSuspenseInfiniteQuery` hooks. Enabled when both\n * `suspense` and `infinite` are configured. Combines suspense semantics with\n * cursor-based pagination — handlers throw promises while loading and pull\n * additional pages on demand.\n */\nexport const suspenseInfiniteQueryGenerator = defineGenerator<PluginReactQuery>({\n name: 'react-suspense-infinite-query',\n renderer: jsxRenderer,\n operation(node, ctx) {\n if (!ast.isHttpOperationNode(node)) return null\n const { config, driver, resolver, root } = ctx\n const {\n output,\n query,\n mutation,\n infinite,\n suspense,\n paramsCasing,\n paramsType,\n pathParamsType,\n parser,\n client: clientOptions,\n group,\n customOptions,\n } = 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 const isSuspense = !!suspense\n const infiniteOptions = infinite && typeof infinite === 'object' ? infinite : null\n\n if (!isQuery || isMutation || !isSuspense || !infiniteOptions) return null\n\n // Validate queryParam exists in operation's query parameters\n const normalizeKey = (key: string) => key.replace(/\\?$/, '')\n const queryParamKeys = getOperationParameters(node).query.map((p) => p.name)\n const hasQueryParam = infiniteOptions.queryParam ? queryParamKeys.some((k) => normalizeKey(k) === infiniteOptions.queryParam) : false\n const hasCursorParam = !infiniteOptions.cursorParam || true\n\n if (!hasQueryParam || !hasCursorParam) return null\n\n const importPath = query ? query.importPath : '@tanstack/react-query'\n\n const queryName = resolver.resolveSuspenseInfiniteQueryName(node)\n const queryOptionsName = resolver.resolveSuspenseInfiniteQueryOptionsName(node)\n const queryKeyName = resolver.resolveSuspenseInfiniteQueryKeyName(node)\n const queryKeyTypeName = resolver.resolveSuspenseInfiniteQueryKeyTypeName(node)\n const clientBaseName = resolver.resolveSuspenseInfiniteClientName(node)\n\n const meta = {\n file: resolver.resolveFile(operationFileEntry(node, queryName), { root, output, group: group ?? undefined }),\n fileTs: tsResolver.resolveFile(operationFileEntry(node, node.operationId), {\n root,\n output: pluginTs.options?.output ?? output,\n group: pluginTs.options?.group ?? undefined,\n }),\n }\n\n const importedTypeNames = resolveOperationTypeNames(node, tsResolver, { paramsCasing, order: 'body-response-first' })\n\n const pluginZod = isParserEnabled(parser) ? driver.getPlugin(pluginZodName) : null\n const zodResolver = pluginZod ? driver.getResolver(pluginZodName) : null\n const fileZod = zodResolver\n ? zodResolver.resolveFile(operationFileEntry(node, node.operationId), {\n root,\n output: pluginZod?.options?.output ?? output,\n group: pluginZod?.options?.group ?? undefined,\n })\n : null\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) : null\n\n const clientFile = shouldUseClientPlugin\n ? clientResolver?.resolveFile(operationFileEntry(node, node.operationId), {\n root,\n output: clientPlugin?.options?.output ?? output,\n group: clientPlugin?.options?.group ?? undefined,\n })\n : null\n\n const resolvedClientName = shouldUseClientPlugin ? (clientResolver?.resolveName(node.operationId) ?? clientBaseName) : clientBaseName\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 {customOptions && <File.Import name={[customOptions.name]} path={customOptions.importPath} />}\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 <File.Import name={['InfiniteData']} isTypeOnly path={importPath} />\n <File.Import name={['infiniteQueryOptions']} path={importPath} />\n\n <SuspenseInfiniteQueryOptions\n name={queryOptionsName}\n clientName={resolvedClientName}\n queryKeyName={queryKeyName}\n node={node}\n tsResolver={tsResolver}\n paramsCasing={paramsCasing}\n paramsType={paramsType}\n pathParamsType={pathParamsType}\n dataReturnType={clientOptions.dataReturnType || 'data'}\n cursorParam={infiniteOptions.cursorParam}\n nextParam={infiniteOptions.nextParam}\n previousParam={infiniteOptions.previousParam}\n initialPageParam={infiniteOptions.initialPageParam}\n queryParam={infiniteOptions.queryParam}\n />\n\n <File.Import name={['useSuspenseInfiniteQuery']} path={importPath} />\n <File.Import name={['QueryKey', 'QueryClient', 'UseSuspenseInfiniteQueryOptions', 'UseSuspenseInfiniteQueryResult']} path={importPath} isTypeOnly />\n\n <SuspenseInfiniteQuery\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 initialPageParam={infiniteOptions.initialPageParam}\n queryParam={infiniteOptions.queryParam}\n customOptions={customOptions}\n />\n </File>\n )\n },\n})\n","import path from 'node:path'\nimport { operationFileEntry, 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 { QueryKey, QueryOptions, SuspenseQuery } from '../components'\nimport type { PluginReactQuery } from '../types'\n\n/**\n * Built-in generator for `useSuspenseQuery` hooks. Enabled when\n * `pluginReactQuery({ suspense: {} })`. Emits one `useFooSuspenseQuery` hook\n * per query operation. Suspense queries throw promises while loading and\n * require a `<Suspense>` boundary in the React tree. TanStack Query v5+ only.\n */\nexport const suspenseQueryGenerator = defineGenerator<PluginReactQuery>({\n name: 'react-suspense-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, suspense, paramsCasing, paramsType, pathParamsType, parser, client: clientOptions, group, customOptions } = ctx.options\n\n const pluginTs = driver.getPlugin(pluginTsName)\n if (!pluginTs) return null\n const tsResolver = driver.getResolver(pluginTsName)\n\n // query: false means \"this IS a query op\" (suspense hooks still generate)\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 const isSuspense = !!suspense\n\n if (!isQuery || isMutation || !isSuspense) return null\n\n const importPath = query ? query.importPath : '@tanstack/react-query'\n\n const queryName = resolver.resolveSuspenseQueryName(node)\n const queryOptionsName = resolver.resolveSuspenseQueryOptionsName(node)\n const queryKeyName = resolver.resolveSuspenseQueryKeyName(node)\n const queryKeyTypeName = resolver.resolveSuspenseQueryKeyTypeName(node)\n const clientName = resolver.resolveSuspenseClientName(node)\n\n const meta = {\n file: resolver.resolveFile(operationFileEntry(node, queryName), { root, output, group: group ?? undefined }),\n fileTs: tsResolver.resolveFile(operationFileEntry(node, node.operationId), {\n root,\n output: pluginTs.options?.output ?? output,\n group: pluginTs.options?.group ?? undefined,\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) : null\n const zodResolver = pluginZod ? driver.getResolver(pluginZodName) : null\n const fileZod = zodResolver\n ? zodResolver.resolveFile(operationFileEntry(node, node.operationId), {\n root,\n output: pluginZod?.options?.output ?? output,\n group: pluginZod?.options?.group ?? undefined,\n })\n : null\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) : null\n\n const clientFile = shouldUseClientPlugin\n ? clientResolver?.resolveFile(operationFileEntry(node, node.operationId), {\n root,\n output: clientPlugin?.options?.output ?? output,\n group: clientPlugin?.options?.group ?? undefined,\n })\n : null\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 {customOptions && <File.Import name={[customOptions.name]} path={customOptions.importPath} />}\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 <File.Import name={['queryOptions']} path={importPath} />\n\n <QueryOptions\n name={queryOptionsName}\n clientName={resolvedClientName}\n queryKeyName={queryKeyName}\n node={node}\n tsResolver={tsResolver}\n paramsCasing={paramsCasing}\n paramsType={paramsType}\n pathParamsType={pathParamsType}\n dataReturnType={clientOptions.dataReturnType || 'data'}\n suspense\n />\n\n {suspense && (\n <>\n <File.Import name={['useSuspenseQuery']} path={importPath} />\n <File.Import name={['QueryKey', 'QueryClient', 'UseSuspenseQueryOptions', 'UseSuspenseQueryResult']} path={importPath} isTypeOnly />\n <SuspenseQuery\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 customOptions={customOptions}\n />\n </>\n )}\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;AAaA,MAAa,kCAAA,GAAA,WAAA,gBAAA,CAAmE;CAC9E,MAAM;CACN,UAAUA,mBAAAA;CACV,WAAW,OAAO,KAAK;EACrB,MAAM,EAAE,UAAU,QAAQ,SAAS;EACnC,MAAM,EAAE,QAAQ,eAAe,OAAO,UAAU,IAAI;EAEpD,IAAI,CAAC,eAAe,OAAO;EAE3B,MAAM,WAAW,OAAO,YAAY,OAAO,OAAO,YAAY;EAC9D,MAAM,EAAE,YAAY,SAAS;EAC7B,MAAM,kBAAkB,SAAS,uBAAuB;EACxD,MAAM,wBAAwB,SAAS,6BAA6B;EAEpE,MAAM,uBAAuB,QAAQ,MAAM,aAAa;EAExD,IAAI;EACJ,MAAM,YAAY,MAAM;EACxB,IAAI,WAAW;GACb,MAAM,WAAW,SAAS,iBAAiB,SAAS;GAKpD,eAJiB,SAAS,YACxB;IAAE,MAAM;IAAU,SAAS;IAAO,KAAK,UAAU,KAAK,MAAM;IAAW,MAAM,UAAU;GAAK,GAC5F;IAAE;IAAM;IAAQ,OAAO,SAAS,KAAA;GAAU,CAEtB,CAAC,CAAC;EAC1B,OACE,eAAeC,UAAAA,QAAK,QAAQ,MAAM,UAAU;EAG9C,MAAM,mBAAmB,UAAkB,YAAoB;GAC7D,IAAIA,UAAAA,QAAK,QAAQ,QAAQ,MAAM,IAAI,OAAO,WAAW;GACrD,OAAO;EACT;EAEA,MAAM,WAAWA,UAAAA,QAAK,QAAQ,YAAY;EAC1C,MAAM,iBAAiB,gBAAgB,YAAY,KAAK;EACxD,MAAM,OAAO;GACX,UAAUA,UAAAA,QAAK,SAAS,cAAc;GACtC,MAAMA,UAAAA,QAAK,SAAS,gBAAgBA,UAAAA,QAAK,QAAQ,cAAc,CAAC;GA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,mBAAAA,KAAK,QAAN;MAAa,MAAM,CAAC,kBAAkB;MAAG,MAAM;KAAa,CAAA;KAC5D,iBAAA,GAAA,+BAAA,IAAA,CAACA,mBAAAA,KAAK,QAAN;MAAa,MAAM;OAAC;OAAY;OAAe;OAA2B;MAAwB;MAAG,MAAM;MAAY,YAAA;KAAY,CAAA;KACnI,iBAAA,GAAA,+BAAA,IAAA,CAACK,mBAAAA,eAAD;MACE,MAAM;MACY;MACJ;MACI;MACZ;MACM;MACE;MACF;MACI;MAChB,gBAAgB,cAAc,kBAAkB;MACjC;KAChB,CAAA;IACD,EAAA,CAAA;GAEA;;CAEV;AACF,CAAC"}
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_generators = require("./generators-BqGaMUH6.cjs");
2
+ const require_generators = require("./generators-zGKP8yII.cjs");
3
3
  exports.customHookOptionsFileGenerator = require_generators.customHookOptionsFileGenerator;
4
4
  exports.hookOptionsGenerator = require_generators.hookOptionsGenerator;
5
5
  exports.infiniteQueryGenerator = require_generators.infiniteQueryGenerator;
@@ -1,5 +1,5 @@
1
1
  import { t as __name } from "./chunk-C0LytTxp.js";
2
- import { r as PluginReactQuery } from "./types-Dh4HNR9K.js";
2
+ import { r as PluginReactQuery } from "./types-X7D0NSvJ.js";
3
3
 
4
4
  //#region src/generators/customHookOptionsFileGenerator.d.ts
5
5
  /**
@@ -1,2 +1,2 @@
1
- import { a as infiniteQueryGenerator, i as mutationGenerator, n as suspenseInfiniteQueryGenerator, o as hookOptionsGenerator, r as queryGenerator, s as customHookOptionsFileGenerator, t as suspenseQueryGenerator } from "./generators-B86BJkmW.js";
1
+ import { a as infiniteQueryGenerator, i as mutationGenerator, n as suspenseInfiniteQueryGenerator, o as hookOptionsGenerator, r as queryGenerator, s as customHookOptionsFileGenerator, t as suspenseQueryGenerator } from "./generators-BG-Vcvfg.js";
2
2
  export { customHookOptionsFileGenerator, hookOptionsGenerator, infiniteQueryGenerator, mutationGenerator, queryGenerator, suspenseInfiniteQueryGenerator, suspenseQueryGenerator };
package/dist/index.cjs CHANGED
@@ -2,8 +2,8 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_components = require("./components-DQAYLQW0.cjs");
6
- const require_generators = require("./generators-BqGaMUH6.cjs");
5
+ const require_components = require("./components-yMQOuFmI.cjs");
6
+ const require_generators = require("./generators-zGKP8yII.cjs");
7
7
  let node_path = require("node:path");
8
8
  node_path = require_components.__toESM(node_path, 1);
9
9
  let _kubb_core = require("@kubb/core");
@@ -13,32 +13,55 @@ let _kubb_plugin_client_templates_clients_fetch_source = require("@kubb/plugin-c
13
13
  let _kubb_plugin_client_templates_config_source = require("@kubb/plugin-client/templates/config.source");
14
14
  let _kubb_plugin_ts = require("@kubb/plugin-ts");
15
15
  let _kubb_plugin_zod = require("@kubb/plugin-zod");
16
+ //#region ../../internals/utils/src/fs.ts
17
+ /**
18
+ * Builds a nested file path from a dotted name. Splits on dots that precede a letter
19
+ * (so version numbers embedded in operationIds like `v2025.0` stay intact), camelCases
20
+ * every earlier segment, applies `caseLast` to the final segment, and joins with `/`.
21
+ *
22
+ * Empty segments are dropped before joining. They arise when the name starts with a dot
23
+ * followed by a letter (e.g. `..Schema` splits into `['..', 'Schema']` and `'..'` cases to
24
+ * an empty string). Without this a leading `/` would form, which `path.resolve` reads as an
25
+ * absolute path, letting generated files escape the configured output directory.
26
+ *
27
+ * @example Nested path from a dotted name
28
+ * `toFilePath('pet.petId') // 'pet/petId'`
29
+ *
30
+ * @example PascalCase the final segment
31
+ * `toFilePath('pet.Pet', pascalCase) // 'pet/Pet'`
32
+ *
33
+ * @example Suffix applied to the final segment only
34
+ * `toFilePath('tag.tag', (part) => camelCase(part, { suffix: 'schema' })) // 'tag/tagSchema'`
35
+ */
36
+ function toFilePath(name, caseLast = require_components.camelCase) {
37
+ const parts = name.split(/\.(?=[a-zA-Z])/);
38
+ return parts.map((part, i) => i === parts.length - 1 ? caseLast(part) : require_components.camelCase(part)).filter(Boolean).join("/");
39
+ }
40
+ //#endregion
16
41
  //#region ../../internals/shared/src/group.ts
17
42
  /**
18
43
  * Builds the `group` config a Kubb plugin passes to `ctx.setOptions`, applying the
19
44
  * shared default naming so every plugin groups output consistently:
20
45
  *
21
46
  * - `path` groups use the second path segment (`/pet/findByStatus` → `pet`).
22
- * - other groups use `${camelCase(group)}${suffix}` (e.g. `petController`).
47
+ * - other groups use the camelCased group (`pet store``petStore`).
23
48
  *
24
49
  * A user-provided `group.name` always wins over the default namer, so callers stay in
25
50
  * control of their output folders. Returns `null` when grouping is disabled, matching the
26
51
  * per-plugin convention.
27
52
  *
28
53
  * @param group - The user-supplied group option, or `undefined` to disable grouping.
29
- * @param options.suffix - Appended to non-`path` group names, e.g. `'Controller'` or `'Requests'`.
30
54
  *
31
55
  * @example
32
56
  * ```ts
33
- * createGroupConfig(group, { suffix: 'Controller' }) // plugin-ts, plugin-client, …
34
- * createGroupConfig(group, { suffix: 'Requests' }) // plugin-cypress, plugin-mcp
57
+ * createGroupConfig(group) // shared across every plugin
35
58
  * ```
36
59
  */
37
- function createGroupConfig(group, options) {
60
+ function createGroupConfig(group) {
38
61
  if (!group) return null;
39
62
  const defaultName = (ctx) => {
40
63
  if (group.type === "path") return `${ctx.group.split("/")[1]}`;
41
- return `${require_components.camelCase(ctx.group)}${options.suffix}`;
64
+ return require_components.camelCase(ctx.group);
42
65
  };
43
66
  return {
44
67
  ...group,
@@ -73,7 +96,7 @@ const resolverReactQuery = (0, _kubb_core.defineResolver)(() => ({
73
96
  name: "default",
74
97
  pluginName: "plugin-react-query",
75
98
  default(name, type) {
76
- return require_components.camelCase(name, { isFile: type === "file" });
99
+ return type === "file" ? toFilePath(name) : require_components.camelCase(name);
77
100
  },
78
101
  resolveName(name) {
79
102
  return this.default(name, "function");
@@ -195,7 +218,7 @@ const pluginReactQueryName = "plugin-react-query";
195
218
  const pluginReactQuery = (0, _kubb_core.definePlugin)((options) => {
196
219
  const { output = {
197
220
  path: "hooks",
198
- barrelType: "named"
221
+ barrel: { type: "named" }
199
222
  }, group, exclude = [], include, override = [], parser = false, suspense = {}, infinite = false, paramsType = "inline", pathParamsType = paramsType === "object" ? "object" : options.pathParamsType || "inline", mutation = {}, query = {}, mutationKey = require_components.mutationKeyTransformer, queryKey = require_components.queryKeyTransformer, customOptions, paramsCasing, client, resolver: userResolver, transformer: userTransformer, generators: userGenerators = [] } = options;
200
223
  const clientName = client?.client ?? "axios";
201
224
  const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : void 0);
@@ -208,11 +231,11 @@ const pluginReactQuery = (0, _kubb_core.definePlugin)((options) => {
208
231
  require_generators.hookOptionsGenerator,
209
232
  require_generators.customHookOptionsFileGenerator
210
233
  ].filter((generator) => Boolean(generator));
211
- const groupConfig = createGroupConfig(group, { suffix: "Controller" });
234
+ const groupConfig = createGroupConfig(group);
212
235
  return {
213
236
  name: pluginReactQueryName,
214
237
  options,
215
- dependencies: [_kubb_plugin_ts.pluginTsName, parser === "zod" ? _kubb_plugin_zod.pluginZodName : void 0].filter((dependency) => Boolean(dependency)),
238
+ dependencies: [_kubb_plugin_ts.pluginTsName, (0, _kubb_plugin_client.isParserEnabled)(parser) ? _kubb_plugin_zod.pluginZodName : void 0].filter((dependency) => Boolean(dependency)),
216
239
  hooks: { "kubb:plugin:setup"(ctx) {
217
240
  const resolver = userResolver ? {
218
241
  ...resolverReactQuery,
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["camelCase","camelCase","mutationKeyTransformer","queryKeyTransformer","queryGenerator","suspenseQueryGenerator","infiniteQueryGenerator","suspenseInfiniteQueryGenerator","mutationGenerator","hookOptionsGenerator","customHookOptionsFileGenerator","pluginTsName","pluginZodName","path","pluginClientName","ast","fetchClientSource","axiosClientSource","configSource"],"sources":["../../../internals/shared/src/group.ts","../src/resolvers/resolverReactQuery.ts","../src/plugin.ts"],"sourcesContent":["import { camelCase } from '@internals/utils'\nimport type { Group } from '@kubb/core'\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 `${camelCase(group)}${suffix}` (e.g. `petController`).\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 * @param options.suffix - Appended to non-`path` group names, e.g. `'Controller'` or `'Requests'`.\n *\n * @example\n * ```ts\n * createGroupConfig(group, { suffix: 'Controller' }) // plugin-ts, plugin-client, …\n * createGroupConfig(group, { suffix: 'Requests' }) // plugin-cypress, plugin-mcp\n * ```\n */\nexport function createGroupConfig(group: Group | undefined, options: { suffix: string }): 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)}${options.suffix}`\n }\n\n return {\n ...group,\n name: group.name ? group.name : defaultName,\n } satisfies Group\n}\n","import { camelCase } from '@internals/utils'\nimport { defineResolver } from '@kubb/core'\nimport type { PluginReactQuery } from '../types.ts'\n\nfunction capitalize(name: string): string {\n return `${name.charAt(0).toUpperCase()}${name.slice(1)}`\n}\n\n/**\n * Default resolver used by `@kubb/plugin-react-query`. Decides the names and\n * file paths for every generated TanStack Query hook (`useFooQuery`,\n * `useFooMutation`, `useFooInfiniteQuery`, ...) and its companion helpers\n * (`fooQueryKey`, `fooQueryOptions`).\n *\n * Functions and files use camelCase; hooks get the `use` prefix; suspense and\n * infinite variants are suffixed with `Suspense`/`Infinite`.\n *\n * @example Resolve hook and helper names\n * ```ts\n * import { resolverReactQuery } from '@kubb/plugin-react-query'\n *\n * resolverReactQuery.resolveQueryName(operationNode) // 'useGetPetById'\n * resolverReactQuery.resolveMutationName(operationNode) // 'useUpdatePet'\n * resolverReactQuery.resolveQueryKeyName(operationNode) // 'getPetByIdQueryKey'\n * resolverReactQuery.resolveQueryOptionsName(operationNode) // 'getPetByIdQueryOptions'\n * ```\n */\nexport const resolverReactQuery = defineResolver<PluginReactQuery>(() => ({\n name: 'default',\n pluginName: 'plugin-react-query',\n default(name, type) {\n return camelCase(name, { isFile: type === 'file' })\n },\n resolveName(name) {\n return this.default(name, 'function')\n },\n resolvePathName(name, type) {\n return this.default(name, type)\n },\n resolveQueryName(node) {\n return `use${capitalize(this.resolveName(node.operationId))}`\n },\n resolveSuspenseQueryName(node) {\n return `use${capitalize(this.resolveName(node.operationId))}Suspense`\n },\n resolveInfiniteQueryName(node) {\n return `use${capitalize(this.resolveName(node.operationId))}Infinite`\n },\n resolveSuspenseInfiniteQueryName(node) {\n return `use${capitalize(this.resolveName(node.operationId))}SuspenseInfinite`\n },\n resolveMutationName(node) {\n return `use${capitalize(this.resolveName(node.operationId))}`\n },\n resolveQueryOptionsName(node) {\n return `${this.resolveName(node.operationId)}QueryOptions`\n },\n resolveSuspenseQueryOptionsName(node) {\n return `${this.resolveName(node.operationId)}SuspenseQueryOptions`\n },\n resolveInfiniteQueryOptionsName(node) {\n return `${this.resolveName(node.operationId)}InfiniteQueryOptions`\n },\n resolveSuspenseInfiniteQueryOptionsName(node) {\n return `${this.resolveName(node.operationId)}SuspenseInfiniteQueryOptions`\n },\n resolveMutationOptionsName(node) {\n return `${this.resolveName(node.operationId)}MutationOptions`\n },\n resolveQueryKeyName(node) {\n return `${this.resolveName(node.operationId)}QueryKey`\n },\n resolveSuspenseQueryKeyName(node) {\n return `${this.resolveName(node.operationId)}SuspenseQueryKey`\n },\n resolveInfiniteQueryKeyName(node) {\n return `${this.resolveName(node.operationId)}InfiniteQueryKey`\n },\n resolveSuspenseInfiniteQueryKeyName(node) {\n return `${this.resolveName(node.operationId)}SuspenseInfiniteQueryKey`\n },\n resolveMutationKeyName(node) {\n return `${this.resolveName(node.operationId)}MutationKey`\n },\n resolveQueryKeyTypeName(node) {\n return `${capitalize(this.resolveName(node.operationId))}QueryKey`\n },\n resolveSuspenseQueryKeyTypeName(node) {\n return `${capitalize(this.resolveName(node.operationId))}SuspenseQueryKey`\n },\n resolveInfiniteQueryKeyTypeName(node) {\n return `${capitalize(this.resolveName(node.operationId))}InfiniteQueryKey`\n },\n resolveSuspenseInfiniteQueryKeyTypeName(node) {\n return `${capitalize(this.resolveName(node.operationId))}SuspenseInfiniteQueryKey`\n },\n resolveMutationTypeName(node) {\n return capitalize(this.resolveName(node.operationId))\n },\n resolveClientName(node) {\n return this.resolveName(node.operationId)\n },\n resolveSuspenseClientName(node) {\n return `${this.resolveName(node.operationId)}Suspense`\n },\n resolveInfiniteClientName(node) {\n return `${this.resolveName(node.operationId)}Infinite`\n },\n resolveSuspenseInfiniteClientName(node) {\n return `${this.resolveName(node.operationId)}SuspenseInfinite`\n },\n resolveHookOptionsName() {\n return 'HookOptions'\n },\n resolveCustomHookOptionsName() {\n return 'getCustomHookOptions'\n },\n}))\n","import path from 'node:path'\nimport { createGroupConfig } from '@internals/shared'\nimport { ast, definePlugin } from '@kubb/core'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { source as axiosClientSource } from '@kubb/plugin-client/templates/clients/axios.source'\nimport { source as fetchClientSource } from '@kubb/plugin-client/templates/clients/fetch.source'\nimport { source as configSource } from '@kubb/plugin-client/templates/config.source'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { mutationKeyTransformer, queryKeyTransformer } from '@internals/tanstack-query'\nimport {\n customHookOptionsFileGenerator,\n hookOptionsGenerator,\n infiniteQueryGenerator,\n mutationGenerator,\n queryGenerator,\n suspenseInfiniteQueryGenerator,\n suspenseQueryGenerator,\n} from './generators'\nimport { resolverReactQuery } from './resolvers/resolverReactQuery.ts'\nimport type { PluginReactQuery } from './types.ts'\n\n/**\n * Canonical plugin name for `@kubb/plugin-react-query`. Used for driver lookups\n * and cross-plugin dependency references.\n */\nexport const pluginReactQueryName = 'plugin-react-query' satisfies PluginReactQuery['name']\n\n/**\n * Generates one TanStack Query hook per OpenAPI operation for React. Queries\n * become `useFooQuery`/`useFooSuspenseQuery`/`useFooInfiniteQuery`; mutations\n * become `useFooMutation`. Each hook is fully typed: query keys, input\n * variables, response data, and error shape all come from the spec.\n *\n * @example\n * ```ts\n * import { defineConfig } from 'kubb'\n * import { pluginTs } from '@kubb/plugin-ts'\n * import { pluginReactQuery } from '@kubb/plugin-react-query'\n *\n * export default defineConfig({\n * input: { path: './petStore.yaml' },\n * output: { path: './src/gen' },\n * plugins: [\n * pluginTs(),\n * pluginReactQuery({\n * output: { path: './hooks' },\n * suspense: {},\n * }),\n * ],\n * })\n * ```\n */\nexport const pluginReactQuery = definePlugin<PluginReactQuery>((options) => {\n const {\n output = { path: 'hooks', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n parser = false,\n suspense = {},\n infinite = false,\n paramsType = 'inline',\n pathParamsType = paramsType === 'object' ? 'object' : options.pathParamsType || 'inline',\n mutation = {},\n query = {},\n mutationKey = mutationKeyTransformer,\n queryKey = queryKeyTransformer,\n customOptions,\n paramsCasing,\n client,\n resolver: userResolver,\n transformer: userTransformer,\n generators: userGenerators = [],\n } = options\n\n const clientName = client?.client ?? 'axios'\n const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : undefined)\n\n const selectedGenerators =\n options.generators ??\n [\n queryGenerator,\n suspenseQueryGenerator,\n infiniteQueryGenerator,\n suspenseInfiniteQueryGenerator,\n mutationGenerator,\n hookOptionsGenerator,\n customHookOptionsFileGenerator,\n ].filter((generator): generator is NonNullable<typeof generator> => Boolean(generator))\n\n const groupConfig = createGroupConfig(group, { suffix: 'Controller' })\n\n return {\n name: pluginReactQueryName,\n options,\n dependencies: [pluginTsName, parser === 'zod' ? pluginZodName : undefined].filter((dependency): dependency is string => Boolean(dependency)),\n hooks: {\n 'kubb:plugin:setup'(ctx) {\n const resolver = userResolver ? { ...resolverReactQuery, ...userResolver } : resolverReactQuery\n\n ctx.setOptions({\n output,\n client: {\n bundle: client?.bundle,\n baseURL: client?.baseURL,\n client: clientName,\n clientType: client?.clientType ?? 'function',\n importPath: clientImportPath,\n dataReturnType: client?.dataReturnType ?? 'data',\n paramsCasing,\n },\n queryKey,\n query:\n query === false\n ? false\n : {\n importPath: '@tanstack/react-query',\n methods: ['get'],\n ...query,\n },\n mutationKey,\n mutation:\n mutation === false\n ? false\n : {\n importPath: '@tanstack/react-query',\n methods: ['post', 'put', 'patch', 'delete'],\n ...mutation,\n },\n infinite: infinite\n ? {\n queryParam: 'id',\n initialPageParam: 0,\n cursorParam: null,\n nextParam: null,\n previousParam: null,\n ...infinite,\n }\n : false,\n suspense,\n customOptions: customOptions ? { name: 'useCustomHookOptions', ...customOptions } : null,\n parser,\n paramsType,\n pathParamsType,\n paramsCasing,\n group: groupConfig,\n exclude,\n include,\n override,\n resolver,\n })\n ctx.setResolver(resolver)\n if (userTransformer) {\n ctx.setTransformer(userTransformer)\n }\n\n for (const gen of selectedGenerators) {\n ctx.addGenerator(gen)\n }\n for (const gen of userGenerators) {\n ctx.addGenerator(gen)\n }\n\n const root = path.resolve(ctx.config.root, ctx.config.output.path)\n const hasClientPlugin = !!ctx.config.plugins?.some((p) => (p as { name?: string }).name === pluginClientName)\n\n if (client?.bundle && !hasClientPlugin && !clientImportPath) {\n ctx.injectFile({\n baseName: 'client.ts',\n path: path.resolve(root, '.kubb/client.ts'),\n sources: [\n ast.createSource({\n name: 'client',\n nodes: [ast.createText(clientName === 'fetch' ? fetchClientSource : axiosClientSource)],\n isExportable: true,\n isIndexable: true,\n }),\n ],\n })\n }\n\n if (!hasClientPlugin) {\n ctx.injectFile({\n baseName: 'config.ts',\n path: path.resolve(root, '.kubb/config.ts'),\n sources: [\n ast.createSource({\n name: 'config',\n nodes: [ast.createText(configSource)],\n isExportable: false,\n isIndexable: false,\n }),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Ae,UAAUC,mDAAAA,SAAoBC,mDAAAA,MAAiB,CAAC;KACtF,cAAc;KACd,aAAa;IACf,CAAC,CACH;GACF,CAAC;GAGH,IAAI,CAAC,iBACH,IAAI,WAAW;IACb,UAAU;IACV,MAAMJ,UAAAA,QAAK,QAAQ,MAAM,iBAAiB;IAC1C,SAAS,CACPE,WAAAA,IAAI,aAAa;KACf,MAAM;KACN,OAAO,CAACA,WAAAA,IAAI,WAAWG,4CAAAA,MAAY,CAAC;KACpC,cAAc;KACd,aAAa;IACf,CAAC,CACH;GACF,CAAC;EAEL,EACF;CACF;AACF,CAAC"}
1
+ {"version":3,"file":"index.cjs","names":["camelCase","camelCase","camelCase","mutationKeyTransformer","queryKeyTransformer","queryGenerator","suspenseQueryGenerator","infiniteQueryGenerator","suspenseInfiniteQueryGenerator","mutationGenerator","hookOptionsGenerator","customHookOptionsFileGenerator","pluginTsName","pluginZodName","path","pluginClientName","ast","fetchClientSource","axiosClientSource","configSource"],"sources":["../../../internals/utils/src/fs.ts","../../../internals/shared/src/group.ts","../src/resolvers/resolverReactQuery.ts","../src/plugin.ts"],"sourcesContent":["import { posix } from 'node:path'\nimport { camelCase } from './casing.ts'\n\nfunction toSlash(p: string): string {\n if (p.startsWith('\\\\\\\\?\\\\')) return p\n return p.replaceAll('\\\\', '/')\n}\n\n/**\n * Returns the relative path from `rootDir` to `filePath`, always using forward slashes\n * and prefixed with `./` when not already traversing upward.\n *\n * @example\n * ```ts\n * getRelativePath('/src/components', '/src/components/Button.tsx') // './Button.tsx'\n * getRelativePath('/src/components', '/src/utils/helpers.ts') // '../utils/helpers.ts'\n * ```\n */\nexport function getRelativePath(rootDir?: string | null, filePath?: string | null): string {\n if (!rootDir || !filePath) {\n throw new Error(`Root and file should be filled in when retrieving the relativePath, ${rootDir || ''} ${filePath || ''}`)\n }\n\n const relativePath = posix.relative(toSlash(rootDir), toSlash(filePath))\n\n return relativePath.startsWith('../') ? relativePath : `./${relativePath}`\n}\n\n/**\n * Builds a nested file path from a dotted name. Splits on dots that precede a letter\n * (so version numbers embedded in operationIds like `v2025.0` stay intact), camelCases\n * every earlier segment, applies `caseLast` to the final segment, and joins with `/`.\n *\n * Empty segments are dropped before joining. They arise when the name starts with a dot\n * followed by a letter (e.g. `..Schema` splits into `['..', 'Schema']` and `'..'` cases to\n * an empty string). Without this a leading `/` would form, which `path.resolve` reads as an\n * absolute path, letting generated files escape the configured output directory.\n *\n * @example Nested path from a dotted name\n * `toFilePath('pet.petId') // 'pet/petId'`\n *\n * @example PascalCase the final segment\n * `toFilePath('pet.Pet', pascalCase) // 'pet/Pet'`\n *\n * @example Suffix applied to the final segment only\n * `toFilePath('tag.tag', (part) => camelCase(part, { suffix: 'schema' })) // 'tag/tagSchema'`\n */\nexport function toFilePath(name: string, caseLast: (part: string) => string = camelCase): string {\n const parts = name.split(/\\.(?=[a-zA-Z])/)\n return parts\n .map((part, i) => (i === parts.length - 1 ? caseLast(part) : camelCase(part)))\n .filter(Boolean)\n .join('/')\n}\n","import { camelCase } from '@internals/utils'\nimport type { Group } from '@kubb/core'\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 { camelCase, toFilePath } from '@internals/utils'\nimport { defineResolver } from '@kubb/core'\nimport type { PluginReactQuery } from '../types.ts'\n\nfunction capitalize(name: string): string {\n return `${name.charAt(0).toUpperCase()}${name.slice(1)}`\n}\n\n/**\n * Default resolver used by `@kubb/plugin-react-query`. Decides the names and\n * file paths for every generated TanStack Query hook (`useFooQuery`,\n * `useFooMutation`, `useFooInfiniteQuery`, ...) and its companion helpers\n * (`fooQueryKey`, `fooQueryOptions`).\n *\n * Functions and files use camelCase; hooks get the `use` prefix; suspense and\n * infinite variants are suffixed with `Suspense`/`Infinite`.\n *\n * @example Resolve hook and helper names\n * ```ts\n * import { resolverReactQuery } from '@kubb/plugin-react-query'\n *\n * resolverReactQuery.resolveQueryName(operationNode) // 'useGetPetById'\n * resolverReactQuery.resolveMutationName(operationNode) // 'useUpdatePet'\n * resolverReactQuery.resolveQueryKeyName(operationNode) // 'getPetByIdQueryKey'\n * resolverReactQuery.resolveQueryOptionsName(operationNode) // 'getPetByIdQueryOptions'\n * ```\n */\nexport const resolverReactQuery = defineResolver<PluginReactQuery>(() => ({\n name: 'default',\n pluginName: 'plugin-react-query',\n default(name, type) {\n return type === 'file' ? toFilePath(name) : camelCase(name)\n },\n resolveName(name) {\n return this.default(name, 'function')\n },\n resolvePathName(name, type) {\n return this.default(name, type)\n },\n resolveQueryName(node) {\n return `use${capitalize(this.resolveName(node.operationId))}`\n },\n resolveSuspenseQueryName(node) {\n return `use${capitalize(this.resolveName(node.operationId))}Suspense`\n },\n resolveInfiniteQueryName(node) {\n return `use${capitalize(this.resolveName(node.operationId))}Infinite`\n },\n resolveSuspenseInfiniteQueryName(node) {\n return `use${capitalize(this.resolveName(node.operationId))}SuspenseInfinite`\n },\n resolveMutationName(node) {\n return `use${capitalize(this.resolveName(node.operationId))}`\n },\n resolveQueryOptionsName(node) {\n return `${this.resolveName(node.operationId)}QueryOptions`\n },\n resolveSuspenseQueryOptionsName(node) {\n return `${this.resolveName(node.operationId)}SuspenseQueryOptions`\n },\n resolveInfiniteQueryOptionsName(node) {\n return `${this.resolveName(node.operationId)}InfiniteQueryOptions`\n },\n resolveSuspenseInfiniteQueryOptionsName(node) {\n return `${this.resolveName(node.operationId)}SuspenseInfiniteQueryOptions`\n },\n resolveMutationOptionsName(node) {\n return `${this.resolveName(node.operationId)}MutationOptions`\n },\n resolveQueryKeyName(node) {\n return `${this.resolveName(node.operationId)}QueryKey`\n },\n resolveSuspenseQueryKeyName(node) {\n return `${this.resolveName(node.operationId)}SuspenseQueryKey`\n },\n resolveInfiniteQueryKeyName(node) {\n return `${this.resolveName(node.operationId)}InfiniteQueryKey`\n },\n resolveSuspenseInfiniteQueryKeyName(node) {\n return `${this.resolveName(node.operationId)}SuspenseInfiniteQueryKey`\n },\n resolveMutationKeyName(node) {\n return `${this.resolveName(node.operationId)}MutationKey`\n },\n resolveQueryKeyTypeName(node) {\n return `${capitalize(this.resolveName(node.operationId))}QueryKey`\n },\n resolveSuspenseQueryKeyTypeName(node) {\n return `${capitalize(this.resolveName(node.operationId))}SuspenseQueryKey`\n },\n resolveInfiniteQueryKeyTypeName(node) {\n return `${capitalize(this.resolveName(node.operationId))}InfiniteQueryKey`\n },\n resolveSuspenseInfiniteQueryKeyTypeName(node) {\n return `${capitalize(this.resolveName(node.operationId))}SuspenseInfiniteQueryKey`\n },\n resolveMutationTypeName(node) {\n return capitalize(this.resolveName(node.operationId))\n },\n resolveClientName(node) {\n return this.resolveName(node.operationId)\n },\n resolveSuspenseClientName(node) {\n return `${this.resolveName(node.operationId)}Suspense`\n },\n resolveInfiniteClientName(node) {\n return `${this.resolveName(node.operationId)}Infinite`\n },\n resolveSuspenseInfiniteClientName(node) {\n return `${this.resolveName(node.operationId)}SuspenseInfinite`\n },\n resolveHookOptionsName() {\n return 'HookOptions'\n },\n resolveCustomHookOptionsName() {\n return 'getCustomHookOptions'\n },\n}))\n","import path from 'node:path'\nimport { createGroupConfig } from '@internals/shared'\nimport { ast, definePlugin } from '@kubb/core'\nimport { isParserEnabled, pluginClientName } from '@kubb/plugin-client'\nimport { source as axiosClientSource } from '@kubb/plugin-client/templates/clients/axios.source'\nimport { source as fetchClientSource } from '@kubb/plugin-client/templates/clients/fetch.source'\nimport { source as configSource } from '@kubb/plugin-client/templates/config.source'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { mutationKeyTransformer, queryKeyTransformer } from '@internals/tanstack-query'\nimport {\n customHookOptionsFileGenerator,\n hookOptionsGenerator,\n infiniteQueryGenerator,\n mutationGenerator,\n queryGenerator,\n suspenseInfiniteQueryGenerator,\n suspenseQueryGenerator,\n} from './generators'\nimport { resolverReactQuery } from './resolvers/resolverReactQuery.ts'\nimport type { PluginReactQuery } from './types.ts'\n\n/**\n * Canonical plugin name for `@kubb/plugin-react-query`. Used for driver lookups\n * and cross-plugin dependency references.\n */\nexport const pluginReactQueryName = 'plugin-react-query' satisfies PluginReactQuery['name']\n\n/**\n * Generates one TanStack Query hook per OpenAPI operation for React. Queries\n * become `useFooQuery`/`useFooSuspenseQuery`/`useFooInfiniteQuery`; mutations\n * become `useFooMutation`. Each hook is fully typed: query keys, input\n * variables, response data, and error shape all come from the spec.\n *\n * @example\n * ```ts\n * import { defineConfig } from 'kubb'\n * import { pluginTs } from '@kubb/plugin-ts'\n * import { pluginReactQuery } from '@kubb/plugin-react-query'\n *\n * export default defineConfig({\n * input: { path: './petStore.yaml' },\n * output: { path: './src/gen' },\n * plugins: [\n * pluginTs(),\n * pluginReactQuery({\n * output: { path: './hooks' },\n * suspense: {},\n * }),\n * ],\n * })\n * ```\n */\nexport const pluginReactQuery = definePlugin<PluginReactQuery>((options) => {\n const {\n output = { path: 'hooks', barrel: { type: 'named' } },\n group,\n exclude = [],\n include,\n override = [],\n parser = false,\n suspense = {},\n infinite = false,\n paramsType = 'inline',\n pathParamsType = paramsType === 'object' ? 'object' : options.pathParamsType || 'inline',\n mutation = {},\n query = {},\n mutationKey = mutationKeyTransformer,\n queryKey = queryKeyTransformer,\n customOptions,\n paramsCasing,\n client,\n resolver: userResolver,\n transformer: userTransformer,\n generators: userGenerators = [],\n } = options\n\n const clientName = client?.client ?? 'axios'\n const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : undefined)\n\n const selectedGenerators =\n options.generators ??\n [\n queryGenerator,\n suspenseQueryGenerator,\n infiniteQueryGenerator,\n suspenseInfiniteQueryGenerator,\n mutationGenerator,\n hookOptionsGenerator,\n customHookOptionsFileGenerator,\n ].filter((generator): generator is NonNullable<typeof generator> => Boolean(generator))\n\n const groupConfig = createGroupConfig(group)\n\n return {\n name: pluginReactQueryName,\n options,\n dependencies: [pluginTsName, isParserEnabled(parser) ? pluginZodName : undefined].filter((dependency): dependency is string => Boolean(dependency)),\n hooks: {\n 'kubb:plugin:setup'(ctx) {\n const resolver = userResolver ? { ...resolverReactQuery, ...userResolver } : resolverReactQuery\n\n ctx.setOptions({\n output,\n client: {\n bundle: client?.bundle,\n baseURL: client?.baseURL,\n client: clientName,\n clientType: client?.clientType ?? 'function',\n importPath: clientImportPath,\n dataReturnType: client?.dataReturnType ?? 'data',\n paramsCasing,\n },\n queryKey,\n query:\n query === false\n ? false\n : {\n importPath: '@tanstack/react-query',\n methods: ['get'],\n ...query,\n },\n mutationKey,\n mutation:\n mutation === false\n ? false\n : {\n importPath: '@tanstack/react-query',\n methods: ['post', 'put', 'patch', 'delete'],\n ...mutation,\n },\n infinite: infinite\n ? {\n queryParam: 'id',\n initialPageParam: 0,\n cursorParam: null,\n nextParam: null,\n previousParam: null,\n ...infinite,\n }\n : false,\n suspense,\n customOptions: customOptions ? { name: 'useCustomHookOptions', ...customOptions } : null,\n parser,\n paramsType,\n pathParamsType,\n paramsCasing,\n group: groupConfig,\n exclude,\n include,\n override,\n resolver,\n })\n ctx.setResolver(resolver)\n if (userTransformer) {\n ctx.setTransformer(userTransformer)\n }\n\n for (const gen of selectedGenerators) {\n ctx.addGenerator(gen)\n }\n for (const gen of userGenerators) {\n ctx.addGenerator(gen)\n }\n\n const root = path.resolve(ctx.config.root, ctx.config.output.path)\n const hasClientPlugin = !!ctx.config.plugins?.some((p) => (p as { name?: string }).name === pluginClientName)\n\n if (client?.bundle && !hasClientPlugin && !clientImportPath) {\n ctx.injectFile({\n baseName: 'client.ts',\n path: path.resolve(root, '.kubb/client.ts'),\n sources: [\n ast.createSource({\n name: 'client',\n nodes: [ast.createText(clientName === 'fetch' ? fetchClientSource : axiosClientSource)],\n isExportable: true,\n isIndexable: true,\n }),\n ],\n })\n }\n\n if (!hasClientPlugin) {\n ctx.injectFile({\n baseName: 'config.ts',\n path: path.resolve(root, '.kubb/config.ts'),\n sources: [\n ast.createSource({\n name: 'config',\n nodes: [ast.createText(configSource)],\n isExportable: false,\n isIndexable: false,\n }),\n ],\n })\n }\n },\n },\n }\n})\n\nexport default pluginReactQuery\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,SAAgB,WAAW,MAAc,WAAqCA,mBAAAA,WAAmB;CAC/F,MAAM,QAAQ,KAAK,MAAM,gBAAgB;CACzC,OAAO,MACJ,KAAK,MAAM,MAAO,MAAM,MAAM,SAAS,IAAI,SAAS,IAAI,IAAIA,mBAAAA,UAAU,IAAI,CAAE,CAAC,CAC7E,OAAO,OAAO,CAAC,CACf,KAAK,GAAG;AACb;;;;;;;;;;;;;;;;;;;;;AChCA,SAAgB,kBAAkB,OAAwC;CACxE,IAAI,CAAC,OACH,OAAO;CAGT,MAAM,eAAe,QAAmC;EACtD,IAAI,MAAM,SAAS,QACjB,OAAO,GAAG,IAAI,MAAM,MAAM,GAAG,CAAC,CAAC;EAGjC,OAAOC,mBAAAA,UAAU,IAAI,KAAK;CAC5B;CAEA,OAAO;EACL,GAAG;EACH,MAAM,MAAM,OAAO,MAAM,OAAO;CAClC;AACF;;;AClCA,SAAS,WAAW,MAAsB;CACxC,OAAO,GAAG,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,KAAK,MAAM,CAAC;AACvD;;;;;;;;;;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N,UAAU,WACN;KACE,YAAY;KACZ,kBAAkB;KAClB,aAAa;KACb,WAAW;KACX,eAAe;KACf,GAAG;IACL,IACA;IACJ;IACA,eAAe,gBAAgB;KAAE,MAAM;KAAwB,GAAG;IAAc,IAAI;IACpF;IACA;IACA;IACA;IACA,OAAO;IACP;IACA;IACA;IACA;GACF,CAAC;GACD,IAAI,YAAY,QAAQ;GACxB,IAAI,iBACF,IAAI,eAAe,eAAe;GAGpC,KAAK,MAAM,OAAO,oBAChB,IAAI,aAAa,GAAG;GAEtB,KAAK,MAAM,OAAO,gBAChB,IAAI,aAAa,GAAG;GAGtB,MAAM,OAAOC,UAAAA,QAAK,QAAQ,IAAI,OAAO,MAAM,IAAI,OAAO,OAAO,IAAI;GACjE,MAAM,kBAAkB,CAAC,CAAC,IAAI,OAAO,SAAS,MAAM,MAAO,EAAwB,SAASC,oBAAAA,gBAAgB;GAE5G,IAAI,QAAQ,UAAU,CAAC,mBAAmB,CAAC,kBACzC,IAAI,WAAW;IACb,UAAU;IACV,MAAMD,UAAAA,QAAK,QAAQ,MAAM,iBAAiB;IAC1C,SAAS,CACPE,WAAAA,IAAI,aAAa;KACf,MAAM;KACN,OAAO,CAACA,WAAAA,IAAI,WAAW,eAAe,UAAUC,mDAAAA,SAAoBC,mDAAAA,MAAiB,CAAC;KACtF,cAAc;KACd,aAAa;IACf,CAAC,CACH;GACF,CAAC;GAGH,IAAI,CAAC,iBACH,IAAI,WAAW;IACb,UAAU;IACV,MAAMJ,UAAAA,QAAK,QAAQ,MAAM,iBAAiB;IAC1C,SAAS,CACPE,WAAAA,IAAI,aAAa;KACf,MAAM;KACN,OAAO,CAACA,WAAAA,IAAI,WAAWG,4CAAAA,MAAY,CAAC;KACpC,cAAc;KACd,aAAa;IACf,CAAC,CACH;GACF,CAAC;EAEL,EACF;CACF;AACF,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { t as __name } from "./chunk-C0LytTxp.js";
2
- import { n as Options, r as PluginReactQuery } from "./types-Dh4HNR9K.js";
2
+ import { n as Options, r as PluginReactQuery } from "./types-X7D0NSvJ.js";
3
3
 
4
4
  //#region src/plugin.d.ts
5
5
  /**
package/dist/index.js CHANGED
@@ -1,40 +1,63 @@
1
1
  import "./chunk-C0LytTxp.js";
2
- import { d as queryKeyTransformer, h as mutationKeyTransformer, y as camelCase } from "./components-IArDg-DO.js";
3
- import { a as infiniteQueryGenerator, i as mutationGenerator, n as suspenseInfiniteQueryGenerator, o as hookOptionsGenerator, r as queryGenerator, s as customHookOptionsFileGenerator, t as suspenseQueryGenerator } from "./generators-B86BJkmW.js";
2
+ import { d as queryKeyTransformer, h as mutationKeyTransformer, y as camelCase } from "./components-DL0Cai7l.js";
3
+ import { a as infiniteQueryGenerator, i as mutationGenerator, n as suspenseInfiniteQueryGenerator, o as hookOptionsGenerator, r as queryGenerator, s as customHookOptionsFileGenerator, t as suspenseQueryGenerator } from "./generators-BG-Vcvfg.js";
4
4
  import path from "node:path";
5
5
  import { ast, definePlugin, defineResolver } from "@kubb/core";
6
- import { pluginClientName } from "@kubb/plugin-client";
6
+ import { isParserEnabled, pluginClientName } from "@kubb/plugin-client";
7
7
  import { source } from "@kubb/plugin-client/templates/clients/axios.source";
8
8
  import { source as source$1 } from "@kubb/plugin-client/templates/clients/fetch.source";
9
9
  import { source as source$2 } from "@kubb/plugin-client/templates/config.source";
10
10
  import { pluginTsName } from "@kubb/plugin-ts";
11
11
  import { pluginZodName } from "@kubb/plugin-zod";
12
+ //#region ../../internals/utils/src/fs.ts
13
+ /**
14
+ * Builds a nested file path from a dotted name. Splits on dots that precede a letter
15
+ * (so version numbers embedded in operationIds like `v2025.0` stay intact), camelCases
16
+ * every earlier segment, applies `caseLast` to the final segment, and joins with `/`.
17
+ *
18
+ * Empty segments are dropped before joining. They arise when the name starts with a dot
19
+ * followed by a letter (e.g. `..Schema` splits into `['..', 'Schema']` and `'..'` cases to
20
+ * an empty string). Without this a leading `/` would form, which `path.resolve` reads as an
21
+ * absolute path, letting generated files escape the configured output directory.
22
+ *
23
+ * @example Nested path from a dotted name
24
+ * `toFilePath('pet.petId') // 'pet/petId'`
25
+ *
26
+ * @example PascalCase the final segment
27
+ * `toFilePath('pet.Pet', pascalCase) // 'pet/Pet'`
28
+ *
29
+ * @example Suffix applied to the final segment only
30
+ * `toFilePath('tag.tag', (part) => camelCase(part, { suffix: 'schema' })) // 'tag/tagSchema'`
31
+ */
32
+ function toFilePath(name, caseLast = camelCase) {
33
+ const parts = name.split(/\.(?=[a-zA-Z])/);
34
+ return parts.map((part, i) => i === parts.length - 1 ? caseLast(part) : camelCase(part)).filter(Boolean).join("/");
35
+ }
36
+ //#endregion
12
37
  //#region ../../internals/shared/src/group.ts
13
38
  /**
14
39
  * Builds the `group` config a Kubb plugin passes to `ctx.setOptions`, applying the
15
40
  * shared default naming so every plugin groups output consistently:
16
41
  *
17
42
  * - `path` groups use the second path segment (`/pet/findByStatus` → `pet`).
18
- * - other groups use `${camelCase(group)}${suffix}` (e.g. `petController`).
43
+ * - other groups use the camelCased group (`pet store``petStore`).
19
44
  *
20
45
  * A user-provided `group.name` always wins over the default namer, so callers stay in
21
46
  * control of their output folders. Returns `null` when grouping is disabled, matching the
22
47
  * per-plugin convention.
23
48
  *
24
49
  * @param group - The user-supplied group option, or `undefined` to disable grouping.
25
- * @param options.suffix - Appended to non-`path` group names, e.g. `'Controller'` or `'Requests'`.
26
50
  *
27
51
  * @example
28
52
  * ```ts
29
- * createGroupConfig(group, { suffix: 'Controller' }) // plugin-ts, plugin-client, …
30
- * createGroupConfig(group, { suffix: 'Requests' }) // plugin-cypress, plugin-mcp
53
+ * createGroupConfig(group) // shared across every plugin
31
54
  * ```
32
55
  */
33
- function createGroupConfig(group, options) {
56
+ function createGroupConfig(group) {
34
57
  if (!group) return null;
35
58
  const defaultName = (ctx) => {
36
59
  if (group.type === "path") return `${ctx.group.split("/")[1]}`;
37
- return `${camelCase(ctx.group)}${options.suffix}`;
60
+ return camelCase(ctx.group);
38
61
  };
39
62
  return {
40
63
  ...group,
@@ -69,7 +92,7 @@ const resolverReactQuery = defineResolver(() => ({
69
92
  name: "default",
70
93
  pluginName: "plugin-react-query",
71
94
  default(name, type) {
72
- return camelCase(name, { isFile: type === "file" });
95
+ return type === "file" ? toFilePath(name) : camelCase(name);
73
96
  },
74
97
  resolveName(name) {
75
98
  return this.default(name, "function");
@@ -191,7 +214,7 @@ const pluginReactQueryName = "plugin-react-query";
191
214
  const pluginReactQuery = definePlugin((options) => {
192
215
  const { output = {
193
216
  path: "hooks",
194
- barrelType: "named"
217
+ barrel: { type: "named" }
195
218
  }, group, exclude = [], include, override = [], parser = false, suspense = {}, infinite = false, paramsType = "inline", pathParamsType = paramsType === "object" ? "object" : options.pathParamsType || "inline", mutation = {}, query = {}, mutationKey = mutationKeyTransformer, queryKey = queryKeyTransformer, customOptions, paramsCasing, client, resolver: userResolver, transformer: userTransformer, generators: userGenerators = [] } = options;
196
219
  const clientName = client?.client ?? "axios";
197
220
  const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : void 0);
@@ -204,11 +227,11 @@ const pluginReactQuery = definePlugin((options) => {
204
227
  hookOptionsGenerator,
205
228
  customHookOptionsFileGenerator
206
229
  ].filter((generator) => Boolean(generator));
207
- const groupConfig = createGroupConfig(group, { suffix: "Controller" });
230
+ const groupConfig = createGroupConfig(group);
208
231
  return {
209
232
  name: pluginReactQueryName,
210
233
  options,
211
- dependencies: [pluginTsName, parser === "zod" ? pluginZodName : void 0].filter((dependency) => Boolean(dependency)),
234
+ dependencies: [pluginTsName, isParserEnabled(parser) ? pluginZodName : void 0].filter((dependency) => Boolean(dependency)),
212
235
  hooks: { "kubb:plugin:setup"(ctx) {
213
236
  const resolver = userResolver ? {
214
237
  ...resolverReactQuery,