@kubb/plugin-react-query 5.0.0-beta.22 → 5.0.0-beta.25

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 (45) hide show
  1. package/dist/{components-D4SQmw7N.cjs → components-C1_zAoAO.cjs} +51 -51
  2. package/dist/components-C1_zAoAO.cjs.map +1 -0
  3. package/dist/{components-BTwB9V-K.js → components-C91DnOOV.js} +51 -51
  4. package/dist/components-C91DnOOV.js.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-BZ_sX2lp.js → generators-9srJC_zb.js} +97 -57
  9. package/dist/generators-9srJC_zb.js.map +1 -0
  10. package/dist/{generators-C4bV7v9Z.cjs → generators-DS3JH1hR.cjs} +97 -57
  11. package/dist/generators-DS3JH1hR.cjs.map +1 -0
  12. package/dist/generators.cjs +1 -1
  13. package/dist/generators.d.ts +41 -1
  14. package/dist/generators.js +1 -1
  15. package/dist/index.cjs +51 -11
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.ts +30 -1
  18. package/dist/index.js +51 -11
  19. package/dist/index.js.map +1 -1
  20. package/dist/{types-DG_OxOym.d.ts → types-DiZPLTXl.d.ts} +92 -55
  21. package/extension.yaml +904 -325
  22. package/package.json +7 -7
  23. package/src/components/InfiniteQuery.tsx +4 -4
  24. package/src/components/InfiniteQueryOptions.tsx +8 -8
  25. package/src/components/Mutation.tsx +2 -2
  26. package/src/components/MutationOptions.tsx +1 -1
  27. package/src/components/Query.tsx +1 -1
  28. package/src/components/QueryOptions.tsx +1 -1
  29. package/src/components/SuspenseInfiniteQuery.tsx +4 -4
  30. package/src/components/SuspenseInfiniteQueryOptions.tsx +8 -8
  31. package/src/components/SuspenseQuery.tsx +1 -1
  32. package/src/generators/customHookOptionsFileGenerator.tsx +7 -1
  33. package/src/generators/hookOptionsGenerator.tsx +14 -8
  34. package/src/generators/infiniteQueryGenerator.tsx +19 -10
  35. package/src/generators/mutationGenerator.tsx +17 -9
  36. package/src/generators/queryGenerator.tsx +17 -9
  37. package/src/generators/suspenseInfiniteQueryGenerator.tsx +19 -10
  38. package/src/generators/suspenseQueryGenerator.tsx +18 -9
  39. package/src/plugin.ts +34 -5
  40. package/src/resolvers/resolverReactQuery.ts +15 -4
  41. package/src/types.ts +89 -52
  42. package/dist/components-BTwB9V-K.js.map +0 -1
  43. package/dist/components-D4SQmw7N.cjs.map +0 -1
  44. package/dist/generators-BZ_sX2lp.js.map +0 -1
  45. package/dist/generators-C4bV7v9Z.cjs.map +0 -1
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["fetchClientSource","axiosClientSource","configSource"],"sources":["../src/resolvers/resolverReactQuery.ts","../src/plugin.ts"],"sourcesContent":["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 * Naming convention resolver for React Query plugin.\n *\n * Provides default naming helpers using camelCase for functions and file paths.\n *\n * @example\n * `resolverReactQuery.default('list pets', 'function') // → 'listPets'`\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 { camelCase } from '@internals/utils'\nimport { ast, definePlugin, type Group } 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\nexport const pluginReactQueryName = 'plugin-react-query' satisfies PluginReactQuery['name']\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 = 'client',\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 = group\n ? ({\n ...group,\n name: group.name\n ? group.name\n : (ctx: { group: string }) => {\n if (group.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Controller`\n },\n } satisfies Group)\n : undefined\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: undefined,\n nextParam: undefined,\n previousParam: undefined,\n ...infinite,\n }\n : false,\n suspense,\n customOptions: customOptions ? { name: 'useCustomHookOptions', ...customOptions } : undefined,\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: 'fetch.ts',\n path: path.resolve(root, '.kubb/fetch.ts'),\n sources: [\n ast.createSource({\n name: 'fetch',\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":";;;;;;;;;;;;AAIA,SAAS,WAAW,MAAsB;CACxC,OAAO,GAAG,KAAK,OAAO,EAAE,CAAC,aAAa,GAAG,KAAK,MAAM,EAAE;;;;;;;;;;AAWxD,MAAa,qBAAqB,sBAAwC;CACxE,MAAM;CACN,YAAY;CACZ,QAAQ,MAAM,MAAM;EAClB,OAAO,UAAU,MAAM,EAAE,QAAQ,SAAS,QAAQ,CAAC;;CAErD,YAAY,MAAM;EAChB,OAAO,KAAK,QAAQ,MAAM,WAAW;;CAEvC,gBAAgB,MAAM,MAAM;EAC1B,OAAO,KAAK,QAAQ,MAAM,KAAK;;CAEjC,iBAAiB,MAAM;EACrB,OAAO,MAAM,WAAW,KAAK,YAAY,KAAK,YAAY,CAAC;;CAE7D,yBAAyB,MAAM;EAC7B,OAAO,MAAM,WAAW,KAAK,YAAY,KAAK,YAAY,CAAC,CAAC;;CAE9D,yBAAyB,MAAM;EAC7B,OAAO,MAAM,WAAW,KAAK,YAAY,KAAK,YAAY,CAAC,CAAC;;CAE9D,iCAAiC,MAAM;EACrC,OAAO,MAAM,WAAW,KAAK,YAAY,KAAK,YAAY,CAAC,CAAC;;CAE9D,oBAAoB,MAAM;EACxB,OAAO,MAAM,WAAW,KAAK,YAAY,KAAK,YAAY,CAAC;;CAE7D,wBAAwB,MAAM;EAC5B,OAAO,GAAG,KAAK,YAAY,KAAK,YAAY,CAAC;;CAE/C,gCAAgC,MAAM;EACp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I,aAAa;KACf,MAAM;KACN,OAAO,CAAC,IAAI,WAAWC,SAAa,CAAC;KACrC,cAAc;KACd,aAAa;KACd,CAAC,CACH;IACF,CAAC;KAGP;EACF;EACD"}
1
+ {"version":3,"file":"index.js","names":["fetchClientSource","axiosClientSource","configSource"],"sources":["../src/resolvers/resolverReactQuery.ts","../src/plugin.ts"],"sourcesContent":["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 { camelCase } from '@internals/utils'\nimport { ast, definePlugin, type Group } 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 = 'client',\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 = group\n ? ({\n ...group,\n name: group.name\n ? group.name\n : (ctx: { group: string }) => {\n if (group.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Controller`\n },\n } satisfies Group)\n : null\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: 'fetch.ts',\n path: path.resolve(root, '.kubb/fetch.ts'),\n sources: [\n ast.createSource({\n name: 'fetch',\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":";;;;;;;;;;;;AAIA,SAAS,WAAW,MAAsB;CACxC,OAAO,GAAG,KAAK,OAAO,EAAE,CAAC,aAAa,GAAG,KAAK,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;AAsBxD,MAAa,qBAAqB,sBAAwC;CACxE,MAAM;CACN,YAAY;CACZ,QAAQ,MAAM,MAAM;EAClB,OAAO,UAAU,MAAM,EAAE,QAAQ,SAAS,QAAQ,CAAC;;CAErD,YAAY,MAAM;EAChB,OAAO,KAAK,QAAQ,MAAM,WAAW;;CA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MAAM,OAAO,gBAChB,IAAI,aAAa,IAAI;GAGvB,MAAM,OAAO,KAAK,QAAQ,IAAI,OAAO,MAAM,IAAI,OAAO,OAAO,KAAK;GAClE,MAAM,kBAAkB,CAAC,CAAC,IAAI,OAAO,SAAS,MAAM,MAAO,EAAwB,SAAS,iBAAiB;GAE7G,IAAI,QAAQ,UAAU,CAAC,mBAAmB,CAAC,kBACzC,IAAI,WAAW;IACb,UAAU;IACV,MAAM,KAAK,QAAQ,MAAM,iBAAiB;IAC1C,SAAS,CACP,IAAI,aAAa;KACf,MAAM;KACN,OAAO,CAAC,IAAI,WAAW,eAAe,UAAUA,WAAoBC,OAAkB,CAAC;KACvF,cAAc;KACd,aAAa;KACd,CAAC,CACH;IACF,CAAC;GAGJ,IAAI,CAAC,iBACH,IAAI,WAAW;IACb,UAAU;IACV,MAAM,KAAK,QAAQ,MAAM,kBAAkB;IAC3C,SAAS,CACP,IAAI,aAAa;KACf,MAAM;KACN,OAAO,CAAC,IAAI,WAAWC,SAAa,CAAC;KACrC,cAAc;KACd,aAAa;KACd,CAAC,CACH;IACF,CAAC;KAGP;EACF;EACD"}
@@ -17,7 +17,7 @@ type Props$1 = {
17
17
  node: ast.OperationNode;
18
18
  paramsCasing: 'camelcase' | undefined;
19
19
  pathParamsType: 'object' | 'inline';
20
- transformer: Transformer | undefined;
20
+ transformer: Transformer | null | undefined;
21
21
  };
22
22
  declare function MutationKey$1({
23
23
  name,
@@ -34,7 +34,7 @@ type Props = {
34
34
  tsResolver: PluginTs['resolver'];
35
35
  paramsCasing: 'camelcase' | undefined;
36
36
  pathParamsType: 'object' | 'inline';
37
- transformer: Transformer | undefined;
37
+ transformer: Transformer | null | undefined;
38
38
  };
39
39
  declare function QueryKey$1({
40
40
  name,
@@ -169,167 +169,204 @@ type ResolverReactQuery = Resolver & {
169
169
  };
170
170
  type Suspense = object;
171
171
  /**
172
- * Customize the queryKey.
172
+ * Builds the `queryKey` used by each generated query hook.
173
+ *
174
+ * @note String values are inlined verbatim into generated code. Wrap literal
175
+ * strings in `JSON.stringify(...)`.
173
176
  */
174
177
  type QueryKey = Transformer;
175
178
  /**
176
- * Customize the mutationKey.
179
+ * Builds the `mutationKey` used by each generated mutation hook.
180
+ *
181
+ * @note String values are inlined verbatim into generated code. Wrap literal
182
+ * strings in `JSON.stringify(...)`.
177
183
  */
178
184
  type MutationKey = Transformer;
179
185
  type Query = {
180
186
  /**
181
- * HTTP methods to use for queries.
187
+ * HTTP methods treated as queries. Operations using these methods produce
188
+ * `useQuery`-style hooks.
182
189
  *
183
190
  * @default ['get']
184
191
  */
185
192
  methods?: Array<string>;
186
193
  /**
187
- * Path to the useQuery hook for useQuery functionality.
188
- * Used as `import { useQuery } from '${importPath}'`.
189
- * Accepts relative and absolute paths.
190
- * Path is used as-is; relative paths are based on the generated file location.
194
+ * Module specifier used in the `import { useQuery } from '...'` statement at
195
+ * the top of every generated hook file. Useful for routing through a wrapper
196
+ * that injects a default `queryClient`.
197
+ *
191
198
  * @default '@tanstack/react-query'
192
199
  */
193
200
  importPath?: string;
194
201
  };
195
202
  type Mutation = {
196
203
  /**
197
- * HTTP methods to use for mutations.
204
+ * HTTP methods treated as mutations. Operations using these methods produce
205
+ * `useMutation`-style hooks.
198
206
  *
199
207
  * @default ['post', 'put', 'delete']
200
208
  */
201
209
  methods?: Array<string>;
202
210
  /**
203
- * Path to the useMutation hook for useMutation functionality.
204
- * Used as `import { useMutation } from '${importPath}'`.
205
- * Accepts relative and absolute paths.
206
- * Path is used as-is; relative paths are based on the generated file location.
211
+ * Module specifier used in the `import { useMutation } from '...'` statement
212
+ * at the top of every generated hook file.
213
+ *
207
214
  * @default '@tanstack/react-query'
208
215
  */
209
216
  importPath?: string;
210
217
  };
211
218
  type Infinite = {
212
219
  /**
213
- * Specify the params key used for `pageParam`.
220
+ * Name of the query parameter that holds the page cursor.
221
+ *
214
222
  * @default 'id'
215
223
  */
216
- queryParam: string;
224
+ queryParam?: string;
217
225
  /**
218
- * Which field of the data is used, set it to undefined when no cursor is known.
219
- * @deprecated Use `nextParam` and `previousParam` instead for more flexible pagination handling.
226
+ * Path to the cursor field on the response. Leave undefined when the cursor
227
+ * is not known.
228
+ *
229
+ * @deprecated Use `nextParam` and `previousParam` for richer pagination control.
220
230
  */
221
- cursorParam?: string | undefined;
231
+ cursorParam?: string | null;
222
232
  /**
223
- * Which field of the data is used to get the cursor for the next page.
224
- * Supports dot notation (e.g. 'pagination.next.id') or array path (e.g. ['pagination', 'next', 'id']) to access nested fields.
233
+ * Path to the next-page cursor on the response. Supports dot notation
234
+ * (`'pagination.next.id'`) or array form (`['pagination', 'next', 'id']`).
225
235
  */
226
- nextParam?: string | string[] | undefined;
236
+ nextParam?: string | Array<string> | null;
227
237
  /**
228
- * Which field of the data is used to get the cursor for the previous page.
229
- * Supports dot notation (e.g. 'pagination.prev.id') or array path (e.g. ['pagination', 'prev', 'id']) to access nested fields.
238
+ * Path to the previous-page cursor on the response. Supports dot notation
239
+ * or array form.
230
240
  */
231
- previousParam?: string | string[] | undefined;
241
+ previousParam?: string | Array<string> | null;
232
242
  /**
233
- * The initial value, the value of the first page.
243
+ * Initial value for `pageParam` on the first fetch.
244
+ *
234
245
  * @default 0
235
246
  */
236
- initialPageParam: unknown;
247
+ initialPageParam?: unknown;
237
248
  };
238
249
  type CustomOptions = {
239
250
  /**
240
- * Path to the hook that is used to customize the hook options.
241
- * It used as `import ${customOptions.name} from '${customOptions.importPath}'`.
242
- * It allows both relative and absolute paths but be aware that we will not change the path.
251
+ * Module specifier of your custom-options hook. Imported as
252
+ * `import ${name} from '${importPath}'`.
243
253
  */
244
254
  importPath: string;
245
255
  /**
246
- * Name of the exported hook that is used to customize the hook options.
247
- * It used as `import ${customOptions.name} from '${customOptions.importPath}'`.
256
+ * Exported function name of your custom-options hook.
257
+ *
248
258
  * @default 'useCustomHookOptions'
249
259
  */
250
260
  name?: string;
251
261
  };
252
262
  type Options = {
253
263
  /**
254
- * Specify the export location for the files and define the behavior of the output
255
- * @default { path: 'hooks', barrelType: 'named' }
264
+ * Where the generated hooks are written and how they are exported.
265
+ *
266
+ * @default { path: 'hooks', barrel: { type: 'named' } }
256
267
  */
257
268
  output?: Output;
258
269
  /**
259
- * Group the @tanstack/query hooks based on the provided name.
270
+ * Split generated files into subfolders based on the operation's tag.
260
271
  */
261
272
  group?: Group;
273
+ /**
274
+ * HTTP client used inside every generated hook. Mirrors a subset of
275
+ * `pluginClient` options.
276
+ */
262
277
  client?: ClientImportPath & Pick<PluginClient['options'], 'clientType' | 'dataReturnType' | 'baseURL' | 'bundle' | 'paramsCasing'>;
263
278
  /**
264
- * Tags, operations, or paths to exclude from generation.
279
+ * Skip operations matching at least one entry in the list.
265
280
  */
266
281
  exclude?: Array<Exclude>;
267
282
  /**
268
- * Tags, operations, or paths to include in generation.
283
+ * Restrict generation to operations matching at least one entry in the list.
269
284
  */
270
285
  include?: Array<Include>;
271
286
  /**
272
- * Override options for specific tags, operations, or paths.
287
+ * Apply a different options object to operations matching a pattern.
273
288
  */
274
289
  override?: Array<Override<ResolvedOptions>>;
275
290
  /**
276
- * Apply casing to parameter names.
291
+ * Rename parameter properties in the generated hooks.
292
+ *
293
+ * @note Must match the value of `paramsCasing` on `@kubb/plugin-ts`.
277
294
  */
278
295
  paramsCasing?: 'camelcase';
279
296
  /**
280
- * How parameters are passed: grouped in an object or spread inline.
297
+ * How operation parameters appear in the generated hook signature.
298
+ * - `'inline'` — positional arguments.
299
+ * - `'object'` — single destructured object argument.
281
300
  *
282
301
  * @default 'inline'
283
302
  */
284
303
  paramsType?: 'object' | 'inline';
285
304
  /**
286
- * How path parameters are passed: grouped in an object or spread inline.
305
+ * How URL path parameters are arranged inside the inline argument list.
287
306
  *
288
307
  * @default 'inline'
289
308
  */
290
309
  pathParamsType?: PluginClient['options']['pathParamsType'];
291
310
  /**
292
- * Add infinite query hooks.
311
+ * Enables `useInfiniteQuery` hooks for cursor- or page-based pagination.
312
+ * Pass an object to configure how the cursor is read; pass `false` to skip.
313
+ *
314
+ * @default false
293
315
  */
294
316
  infinite?: Partial<Infinite> | false;
295
317
  /**
296
- * Add suspense query hooks.
318
+ * Adds `useSuspenseQuery` hooks alongside the regular `useQuery` ones.
319
+ * Pass an empty object (`{}`) to enable. TanStack Query v5+ only.
297
320
  */
298
321
  suspense?: Partial<Suspense> | false;
322
+ /**
323
+ * Custom `queryKey` builder. Use to add a version namespace, swap to
324
+ * operation IDs, or shape keys to match an existing invalidation strategy.
325
+ */
299
326
  queryKey?: QueryKey;
300
327
  /**
301
- * Configure useQuery behavior.
328
+ * Configures query hooks. Set to `false` to skip generating hooks entirely
329
+ * and emit only `queryOptions(...)` helpers.
302
330
  */
303
331
  query?: Partial<Query> | false;
332
+ /**
333
+ * Custom `mutationKey` builder. Useful when you batch invalidations or read
334
+ * mutation state via `useMutationState`.
335
+ */
304
336
  mutationKey?: MutationKey;
305
337
  /**
306
- * Configure useMutation behavior.
338
+ * Configures mutation hooks. Set to `false` to skip mutation generation.
307
339
  */
308
340
  mutation?: Partial<Mutation> | false;
309
341
  /**
310
- * Use a custom hook to customize hook options and generate a HookOptions type.
342
+ * Wires every generated hook through a user-supplied function that returns
343
+ * extra options (`onSuccess`, `onError`, `select`, ...). Also emits a
344
+ * `HookOptions` type so the wrapper stays in sync with generated hooks.
311
345
  */
312
346
  customOptions?: CustomOptions;
313
347
  /**
314
- * Parser to use for validating response data.
348
+ * Validator applied to response bodies before they reach the caller.
349
+ * - `'client'` — no validation. Trusts the API.
350
+ * - `'zod'` — pipes responses through schemas from `@kubb/plugin-zod`.
315
351
  */
316
352
  parser?: PluginClient['options']['parser'];
317
353
  /**
318
- * Override naming conventions for function names and types.
354
+ * Override how hook names and file paths are built. Methods you omit fall
355
+ * back to the default `resolverReactQuery`.
319
356
  */
320
357
  resolver?: Partial<ResolverReactQuery> & ThisType<ResolverReactQuery>;
321
358
  /**
322
- * AST visitor to transform generated nodes.
359
+ * AST visitor applied to each operation node before printing.
323
360
  */
324
361
  transformer?: ast.Visitor;
325
362
  /**
326
- * Additional generators alongside the default generators.
363
+ * Custom generators that run alongside the built-in React Query generators.
327
364
  */
328
365
  generators?: Array<Generator<PluginReactQuery>>;
329
366
  };
330
367
  type ResolvedOptions = {
331
368
  output: Output;
332
- group: Group | undefined;
369
+ group: Group | null;
333
370
  exclude: NonNullable<Options['exclude']>;
334
371
  include: Options['include'];
335
372
  override: NonNullable<Options['override']>;
@@ -343,11 +380,11 @@ type ResolvedOptions = {
343
380
  */
344
381
  infinite: NonNullable<Infinite> | false;
345
382
  suspense: Suspense | false;
346
- queryKey: QueryKey | undefined;
383
+ queryKey: QueryKey | null;
347
384
  query: NonNullable<Required<Query>> | false;
348
- mutationKey: MutationKey | undefined;
385
+ mutationKey: MutationKey | null;
349
386
  mutation: NonNullable<Required<Mutation>> | false;
350
- customOptions: NonNullable<Required<CustomOptions>> | undefined;
387
+ customOptions: NonNullable<Required<CustomOptions>> | null;
351
388
  resolver: ResolverReactQuery;
352
389
  };
353
390
  type PluginReactQuery = PluginFactoryOptions<'plugin-react-query', Options, ResolvedOptions, ResolverReactQuery>;
@@ -360,4 +397,4 @@ declare global {
360
397
  }
361
398
  //#endregion
362
399
  export { MutationKey$1 as a, QueryKey$1 as i, Options as n, PluginReactQuery as r, Infinite as t };
363
- //# sourceMappingURL=types-DG_OxOym.d.ts.map
400
+ //# sourceMappingURL=types-DiZPLTXl.d.ts.map