@kubb/plugin-vue-query 5.0.0-beta.22 → 5.0.0-beta.27

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 (39) hide show
  1. package/dist/{components-CARlYXLX.js → components-B4IlVmNa.js} +58 -43
  2. package/dist/components-B4IlVmNa.js.map +1 -0
  3. package/dist/{components-DycYiYNM.cjs → components-CIedagno.cjs} +58 -43
  4. package/dist/components-CIedagno.cjs.map +1 -0
  5. package/dist/components.cjs +1 -1
  6. package/dist/components.d.ts +3 -3
  7. package/dist/components.js +1 -1
  8. package/dist/{generators-BuDRi6qN.js → generators-Bgcwdua5.js} +46 -30
  9. package/dist/generators-Bgcwdua5.js.map +1 -0
  10. package/dist/{generators-DX8VWz4a.cjs → generators-CuDw35Wp.cjs} +46 -30
  11. package/dist/generators-CuDw35Wp.cjs.map +1 -0
  12. package/dist/generators.cjs +1 -1
  13. package/dist/generators.d.ts +17 -1
  14. package/dist/generators.js +1 -1
  15. package/dist/index.cjs +47 -8
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.ts +29 -1
  18. package/dist/index.js +47 -8
  19. package/dist/index.js.map +1 -1
  20. package/dist/{types-Bkm7bWT3.d.ts → types-D-LjzI_Q.d.ts} +73 -46
  21. package/extension.yaml +779 -255
  22. package/package.json +7 -7
  23. package/src/components/InfiniteQuery.tsx +6 -4
  24. package/src/components/InfiniteQueryOptions.tsx +11 -10
  25. package/src/components/Mutation.tsx +7 -5
  26. package/src/components/Query.tsx +6 -4
  27. package/src/components/QueryKey.tsx +3 -3
  28. package/src/components/QueryOptions.tsx +4 -3
  29. package/src/generators/infiniteQueryGenerator.tsx +19 -10
  30. package/src/generators/mutationGenerator.tsx +17 -9
  31. package/src/generators/queryGenerator.tsx +17 -9
  32. package/src/plugin.ts +32 -4
  33. package/src/resolvers/resolverVueQuery.ts +13 -2
  34. package/src/types.ts +72 -45
  35. package/src/utils.ts +8 -1
  36. package/dist/components-CARlYXLX.js.map +0 -1
  37. package/dist/components-DycYiYNM.cjs.map +0 -1
  38. package/dist/generators-BuDRi6qN.js.map +0 -1
  39. package/dist/generators-DX8VWz4a.cjs.map +0 -1
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_generators = require("./generators-DX8VWz4a.cjs");
2
+ const require_generators = require("./generators-CuDw35Wp.cjs");
3
3
  exports.infiniteQueryGenerator = require_generators.infiniteQueryGenerator;
4
4
  exports.mutationGenerator = require_generators.mutationGenerator;
5
5
  exports.queryGenerator = require_generators.queryGenerator;
@@ -1,14 +1,30 @@
1
1
  import { t as __name } from "./chunk--u3MIqq1.js";
2
- import { r as PluginVueQuery } from "./types-Bkm7bWT3.js";
2
+ import { r as PluginVueQuery } from "./types-D-LjzI_Q.js";
3
3
  import * as _$_kubb_core0 from "@kubb/core";
4
4
 
5
5
  //#region src/generators/infiniteQueryGenerator.d.ts
6
+ /**
7
+ * Built-in generator for `useInfiniteQuery` composables. Enabled when
8
+ * `pluginVueQuery({ infinite: { ... } })`. Emits one `useFooInfiniteQuery`
9
+ * composable per query operation, wiring the configured cursor path into
10
+ * TanStack Query's cursor-based pagination.
11
+ */
6
12
  declare const infiniteQueryGenerator: _$_kubb_core0.Generator<PluginVueQuery, unknown>;
7
13
  //#endregion
8
14
  //#region src/generators/mutationGenerator.d.ts
15
+ /**
16
+ * Built-in generator for `useMutation` composables. Emits one
17
+ * `useFooMutation` composable per POST/PUT/DELETE operation (configurable
18
+ * via `mutation.methods`) plus the matching `fooMutationKey` helper.
19
+ */
9
20
  declare const mutationGenerator: _$_kubb_core0.Generator<PluginVueQuery, unknown>;
10
21
  //#endregion
11
22
  //#region src/generators/queryGenerator.d.ts
23
+ /**
24
+ * Built-in generator for `useQuery` composables. Emits one `useFooQuery`
25
+ * composable per GET operation (configurable via `query.methods`) plus the
26
+ * matching `fooQueryKey` / `fooQueryOptions` helpers.
27
+ */
12
28
  declare const queryGenerator: _$_kubb_core0.Generator<PluginVueQuery, unknown>;
13
29
  //#endregion
14
30
  export { infiniteQueryGenerator, mutationGenerator, queryGenerator };
@@ -1,2 +1,2 @@
1
- import { n as mutationGenerator, r as infiniteQueryGenerator, t as queryGenerator } from "./generators-BuDRi6qN.js";
1
+ import { n as mutationGenerator, r as infiniteQueryGenerator, t as queryGenerator } from "./generators-Bgcwdua5.js";
2
2
  export { infiniteQueryGenerator, mutationGenerator, queryGenerator };
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-DycYiYNM.cjs");
6
- const require_generators = require("./generators-DX8VWz4a.cjs");
5
+ const require_components = require("./components-CIedagno.cjs");
6
+ const require_generators = require("./generators-CuDw35Wp.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");
@@ -18,9 +18,20 @@ function capitalize(name) {
18
18
  return `${name.charAt(0).toUpperCase()}${name.slice(1)}`;
19
19
  }
20
20
  /**
21
- * Naming convention resolver for Vue Query plugin.
21
+ * Default resolver used by `@kubb/plugin-vue-query`. Decides the names and
22
+ * file paths for every generated TanStack Query composable (`useFooQuery`,
23
+ * `useFooMutation`, `useFooInfiniteQuery`) and its companion helpers.
22
24
  *
23
- * Provides default naming helpers using camelCase for functions and file paths.
25
+ * Functions and files use camelCase; composables get the `use` prefix.
26
+ *
27
+ * @example Resolve composable and helper names
28
+ * ```ts
29
+ * import { resolverVueQuery } from '@kubb/plugin-vue-query'
30
+ *
31
+ * resolverVueQuery.resolveQueryName(operationNode) // 'useGetPetById'
32
+ * resolverVueQuery.resolveQueryKeyName(operationNode) // 'getPetByIdQueryKey'
33
+ * resolverVueQuery.resolveQueryOptionsName(operationNode) // 'getPetByIdQueryOptions'
34
+ * ```
24
35
  */
25
36
  const resolverVueQuery = (0, _kubb_core.defineResolver)(() => ({
26
37
  name: "default",
@@ -76,7 +87,35 @@ const resolverVueQuery = (0, _kubb_core.defineResolver)(() => ({
76
87
  }));
77
88
  //#endregion
78
89
  //#region src/plugin.ts
90
+ /**
91
+ * Canonical plugin name for `@kubb/plugin-vue-query`. Used for driver lookups
92
+ * and cross-plugin dependency references.
93
+ */
79
94
  const pluginVueQueryName = "plugin-vue-query";
95
+ /**
96
+ * Generates one TanStack Query composable per OpenAPI operation for Vue's
97
+ * Composition API. Queries become `useFooQuery` (and optionally
98
+ * `useFooInfiniteQuery`); mutations become `useFooMutation`. Each composable
99
+ * is fully typed end to end.
100
+ *
101
+ * @example
102
+ * ```ts
103
+ * import { defineConfig } from 'kubb'
104
+ * import { pluginTs } from '@kubb/plugin-ts'
105
+ * import { pluginVueQuery } from '@kubb/plugin-vue-query'
106
+ *
107
+ * export default defineConfig({
108
+ * input: { path: './petStore.yaml' },
109
+ * output: { path: './src/gen' },
110
+ * plugins: [
111
+ * pluginTs(),
112
+ * pluginVueQuery({
113
+ * output: { path: './hooks' },
114
+ * }),
115
+ * ],
116
+ * })
117
+ * ```
118
+ */
80
119
  const pluginVueQuery = (0, _kubb_core.definePlugin)((options) => {
81
120
  const { output = {
82
121
  path: "hooks",
@@ -95,7 +134,7 @@ const pluginVueQuery = (0, _kubb_core.definePlugin)((options) => {
95
134
  if (group.type === "path") return `${ctx.group.split("/")[1]}`;
96
135
  return `${require_components.camelCase(ctx.group)}Controller`;
97
136
  }
98
- } : void 0;
137
+ } : null;
99
138
  return {
100
139
  name: pluginVueQueryName,
101
140
  options,
@@ -136,9 +175,9 @@ const pluginVueQuery = (0, _kubb_core.definePlugin)((options) => {
136
175
  infinite: infinite ? {
137
176
  queryParam: "id",
138
177
  initialPageParam: 0,
139
- cursorParam: void 0,
140
- nextParam: void 0,
141
- previousParam: void 0,
178
+ cursorParam: null,
179
+ nextParam: null,
180
+ previousParam: null,
142
181
  ...infinite
143
182
  } : false,
144
183
  parser,
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["camelCase","mutationKeyTransformer","queryKeyTransformer","queryGenerator","infiniteQueryGenerator","mutationGenerator","camelCase","pluginTsName","pluginZodName","path","pluginClientName","ast","fetchClientSource","axiosClientSource","configSource"],"sources":["../src/resolvers/resolverVueQuery.ts","../src/plugin.ts"],"sourcesContent":["import { camelCase } from '@internals/utils'\nimport { defineResolver } from '@kubb/core'\nimport type { PluginVueQuery } 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 Vue Query plugin.\n *\n * Provides default naming helpers using camelCase for functions and file paths.\n */\nexport const resolverVueQuery = defineResolver<PluginVueQuery>(() => ({\n name: 'default',\n pluginName: 'plugin-vue-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 resolveInfiniteQueryName(node) {\n return `use${capitalize(this.resolveName(node.operationId))}Infinite`\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 resolveInfiniteQueryOptionsName(node) {\n return `${this.resolveName(node.operationId)}InfiniteQueryOptions`\n },\n resolveQueryKeyName(node) {\n return `${this.resolveName(node.operationId)}QueryKey`\n },\n resolveInfiniteQueryKeyName(node) {\n return `${this.resolveName(node.operationId)}InfiniteQueryKey`\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 resolveInfiniteQueryKeyTypeName(node) {\n return `${capitalize(this.resolveName(node.operationId))}InfiniteQueryKey`\n },\n resolveMutationTypeName(node) {\n return capitalize(this.resolveName(node.operationId))\n },\n resolveClientName(node) {\n return this.resolveName(node.operationId)\n },\n resolveInfiniteClientName(node) {\n return `${this.resolveName(node.operationId)}Infinite`\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 } from '@internals/tanstack-query'\nimport { queryKeyTransformer } from '@internals/tanstack-query'\nimport { infiniteQueryGenerator, mutationGenerator, queryGenerator } from './generators'\nimport { resolverVueQuery } from './resolvers/resolverVueQuery.ts'\nimport type { PluginVueQuery } from './types.ts'\n\nexport const pluginVueQueryName = 'plugin-vue-query' satisfies PluginVueQuery['name']\n\nexport const pluginVueQuery = definePlugin<PluginVueQuery>((options) => {\n const {\n output = { path: 'hooks', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n parser = 'client',\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 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 [queryGenerator, infiniteQueryGenerator, mutationGenerator].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: pluginVueQueryName,\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 ? { ...resolverVueQuery, ...userResolver } : resolverVueQuery\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/vue-query',\n methods: ['get'],\n ...query,\n },\n mutationKey,\n mutation:\n mutation === false\n ? false\n : {\n importPath: '@tanstack/vue-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 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 pluginVueQuery\n"],"mappings":";;;;;;;;;;;;;;;;AAIA,SAAS,WAAW,MAAsB;CACxC,OAAO,GAAG,KAAK,OAAO,EAAE,CAAC,aAAa,GAAG,KAAK,MAAM,EAAE;;;;;;;AAQxD,MAAa,oBAAA,GAAA,WAAA,uBAAyD;CACpE,MAAM;CACN,YAAY;CACZ,QAAQ,MAAM,MAAM;EAClB,OAAOA,mBAAAA,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,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;EACpC,OAAO,GAAG,KAAK,YAAY,KAAK,YAAY,CAAC;;CAE/C,oBAAoB,MAAM;EACxB,OAAO,GAAG,KAAK,YAAY,KAAK,YAAY,CAAC;;CAE/C,4BAA4B,MAAM;EAChC,OAAO,GAAG,KAAK,YAAY,KAAK,YAAY,CAAC;;CAE/C,uBAAuB,MAAM;EAC3B,OAAO,GAAG,KAAK,YAAY,KAAK,YAAY,CAAC;;CAE/C,wBAAwB,MAAM;EAC5B,OAAO,GAAG,WAAW,KAAK,YAAY,KAAK,Y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,IAAI,WAAW,eAAe,UAAUC,mDAAAA,SAAoBC,mDAAAA,OAAkB,CAAC;KACvF,cAAc;KACd,aAAa;KACd,CAAC,CACH;IACF,CAAC;GAGJ,IAAI,CAAC,iBACH,IAAI,WAAW;IACb,UAAU;IACV,MAAMJ,UAAAA,QAAK,QAAQ,MAAM,kBAAkB;IAC3C,SAAS,CACPE,WAAAA,IAAI,aAAa;KACf,MAAM;KACN,OAAO,CAACA,WAAAA,IAAI,WAAWG,4CAAAA,OAAa,CAAC;KACrC,cAAc;KACd,aAAa;KACd,CAAC,CACH;IACF,CAAC;KAGP;EACF;EACD"}
1
+ {"version":3,"file":"index.cjs","names":["camelCase","mutationKeyTransformer","queryKeyTransformer","queryGenerator","infiniteQueryGenerator","mutationGenerator","camelCase","pluginTsName","pluginZodName","path","pluginClientName","ast","fetchClientSource","axiosClientSource","configSource"],"sources":["../src/resolvers/resolverVueQuery.ts","../src/plugin.ts"],"sourcesContent":["import { camelCase } from '@internals/utils'\nimport { defineResolver } from '@kubb/core'\nimport type { PluginVueQuery } 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-vue-query`. Decides the names and\n * file paths for every generated TanStack Query composable (`useFooQuery`,\n * `useFooMutation`, `useFooInfiniteQuery`) and its companion helpers.\n *\n * Functions and files use camelCase; composables get the `use` prefix.\n *\n * @example Resolve composable and helper names\n * ```ts\n * import { resolverVueQuery } from '@kubb/plugin-vue-query'\n *\n * resolverVueQuery.resolveQueryName(operationNode) // 'useGetPetById'\n * resolverVueQuery.resolveQueryKeyName(operationNode) // 'getPetByIdQueryKey'\n * resolverVueQuery.resolveQueryOptionsName(operationNode) // 'getPetByIdQueryOptions'\n * ```\n */\nexport const resolverVueQuery = defineResolver<PluginVueQuery>(() => ({\n name: 'default',\n pluginName: 'plugin-vue-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 resolveInfiniteQueryName(node) {\n return `use${capitalize(this.resolveName(node.operationId))}Infinite`\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 resolveInfiniteQueryOptionsName(node) {\n return `${this.resolveName(node.operationId)}InfiniteQueryOptions`\n },\n resolveQueryKeyName(node) {\n return `${this.resolveName(node.operationId)}QueryKey`\n },\n resolveInfiniteQueryKeyName(node) {\n return `${this.resolveName(node.operationId)}InfiniteQueryKey`\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 resolveInfiniteQueryKeyTypeName(node) {\n return `${capitalize(this.resolveName(node.operationId))}InfiniteQueryKey`\n },\n resolveMutationTypeName(node) {\n return capitalize(this.resolveName(node.operationId))\n },\n resolveClientName(node) {\n return this.resolveName(node.operationId)\n },\n resolveInfiniteClientName(node) {\n return `${this.resolveName(node.operationId)}Infinite`\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 } from '@internals/tanstack-query'\nimport { queryKeyTransformer } from '@internals/tanstack-query'\nimport { infiniteQueryGenerator, mutationGenerator, queryGenerator } from './generators'\nimport { resolverVueQuery } from './resolvers/resolverVueQuery.ts'\nimport type { PluginVueQuery } from './types.ts'\n\n/**\n * Canonical plugin name for `@kubb/plugin-vue-query`. Used for driver lookups\n * and cross-plugin dependency references.\n */\nexport const pluginVueQueryName = 'plugin-vue-query' satisfies PluginVueQuery['name']\n\n/**\n * Generates one TanStack Query composable per OpenAPI operation for Vue's\n * Composition API. Queries become `useFooQuery` (and optionally\n * `useFooInfiniteQuery`); mutations become `useFooMutation`. Each composable\n * is fully typed end to end.\n *\n * @example\n * ```ts\n * import { defineConfig } from 'kubb'\n * import { pluginTs } from '@kubb/plugin-ts'\n * import { pluginVueQuery } from '@kubb/plugin-vue-query'\n *\n * export default defineConfig({\n * input: { path: './petStore.yaml' },\n * output: { path: './src/gen' },\n * plugins: [\n * pluginTs(),\n * pluginVueQuery({\n * output: { path: './hooks' },\n * }),\n * ],\n * })\n * ```\n */\nexport const pluginVueQuery = definePlugin<PluginVueQuery>((options) => {\n const {\n output = { path: 'hooks', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n parser = 'client',\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 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 [queryGenerator, infiniteQueryGenerator, mutationGenerator].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: pluginVueQueryName,\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 ? { ...resolverVueQuery, ...userResolver } : resolverVueQuery\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/vue-query',\n methods: ['get'],\n ...query,\n },\n mutationKey,\n mutation:\n mutation === false\n ? false\n : {\n importPath: '@tanstack/vue-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 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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ACd,aAAa;KACd,CAAC,CACH;IACF,CAAC;GAGJ,IAAI,CAAC,iBACH,IAAI,WAAW;IACb,UAAU;IACV,MAAMJ,UAAAA,QAAK,QAAQ,MAAM,kBAAkB;IAC3C,SAAS,CACPE,WAAAA,IAAI,aAAa;KACf,MAAM;KACN,OAAO,CAACA,WAAAA,IAAI,WAAWG,4CAAAA,OAAa,CAAC;KACrC,cAAc;KACd,aAAa;KACd,CAAC,CACH;IACF,CAAC;KAGP;EACF;EACD"}
package/dist/index.d.ts CHANGED
@@ -1,9 +1,37 @@
1
1
  import { t as __name } from "./chunk--u3MIqq1.js";
2
- import { n as Options, r as PluginVueQuery } from "./types-Bkm7bWT3.js";
2
+ import { n as Options, r as PluginVueQuery } from "./types-D-LjzI_Q.js";
3
3
  import * as _$_kubb_core0 from "@kubb/core";
4
4
 
5
5
  //#region src/plugin.d.ts
6
+ /**
7
+ * Canonical plugin name for `@kubb/plugin-vue-query`. Used for driver lookups
8
+ * and cross-plugin dependency references.
9
+ */
6
10
  declare const pluginVueQueryName = "plugin-vue-query";
11
+ /**
12
+ * Generates one TanStack Query composable per OpenAPI operation for Vue's
13
+ * Composition API. Queries become `useFooQuery` (and optionally
14
+ * `useFooInfiniteQuery`); mutations become `useFooMutation`. Each composable
15
+ * is fully typed end to end.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * import { defineConfig } from 'kubb'
20
+ * import { pluginTs } from '@kubb/plugin-ts'
21
+ * import { pluginVueQuery } from '@kubb/plugin-vue-query'
22
+ *
23
+ * export default defineConfig({
24
+ * input: { path: './petStore.yaml' },
25
+ * output: { path: './src/gen' },
26
+ * plugins: [
27
+ * pluginTs(),
28
+ * pluginVueQuery({
29
+ * output: { path: './hooks' },
30
+ * }),
31
+ * ],
32
+ * })
33
+ * ```
34
+ */
7
35
  declare const pluginVueQuery: (options?: Options | undefined) => _$_kubb_core0.Plugin<PluginVueQuery>;
8
36
  //#endregion
9
37
  export { type PluginVueQuery, pluginVueQuery as default, pluginVueQuery, pluginVueQueryName };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import "./chunk--u3MIqq1.js";
2
- import { f as mutationKeyTransformer, p as camelCase, s as queryKeyTransformer } from "./components-CARlYXLX.js";
3
- import { n as mutationGenerator, r as infiniteQueryGenerator, t as queryGenerator } from "./generators-BuDRi6qN.js";
2
+ import { f as mutationKeyTransformer, p as camelCase, s as queryKeyTransformer } from "./components-B4IlVmNa.js";
3
+ import { n as mutationGenerator, r as infiniteQueryGenerator, t as queryGenerator } from "./generators-Bgcwdua5.js";
4
4
  import path from "node:path";
5
5
  import { ast, definePlugin, defineResolver } from "@kubb/core";
6
6
  import { pluginClientName } from "@kubb/plugin-client";
@@ -14,9 +14,20 @@ function capitalize(name) {
14
14
  return `${name.charAt(0).toUpperCase()}${name.slice(1)}`;
15
15
  }
16
16
  /**
17
- * Naming convention resolver for Vue Query plugin.
17
+ * Default resolver used by `@kubb/plugin-vue-query`. Decides the names and
18
+ * file paths for every generated TanStack Query composable (`useFooQuery`,
19
+ * `useFooMutation`, `useFooInfiniteQuery`) and its companion helpers.
18
20
  *
19
- * Provides default naming helpers using camelCase for functions and file paths.
21
+ * Functions and files use camelCase; composables get the `use` prefix.
22
+ *
23
+ * @example Resolve composable and helper names
24
+ * ```ts
25
+ * import { resolverVueQuery } from '@kubb/plugin-vue-query'
26
+ *
27
+ * resolverVueQuery.resolveQueryName(operationNode) // 'useGetPetById'
28
+ * resolverVueQuery.resolveQueryKeyName(operationNode) // 'getPetByIdQueryKey'
29
+ * resolverVueQuery.resolveQueryOptionsName(operationNode) // 'getPetByIdQueryOptions'
30
+ * ```
20
31
  */
21
32
  const resolverVueQuery = defineResolver(() => ({
22
33
  name: "default",
@@ -72,7 +83,35 @@ const resolverVueQuery = defineResolver(() => ({
72
83
  }));
73
84
  //#endregion
74
85
  //#region src/plugin.ts
86
+ /**
87
+ * Canonical plugin name for `@kubb/plugin-vue-query`. Used for driver lookups
88
+ * and cross-plugin dependency references.
89
+ */
75
90
  const pluginVueQueryName = "plugin-vue-query";
91
+ /**
92
+ * Generates one TanStack Query composable per OpenAPI operation for Vue's
93
+ * Composition API. Queries become `useFooQuery` (and optionally
94
+ * `useFooInfiniteQuery`); mutations become `useFooMutation`. Each composable
95
+ * is fully typed end to end.
96
+ *
97
+ * @example
98
+ * ```ts
99
+ * import { defineConfig } from 'kubb'
100
+ * import { pluginTs } from '@kubb/plugin-ts'
101
+ * import { pluginVueQuery } from '@kubb/plugin-vue-query'
102
+ *
103
+ * export default defineConfig({
104
+ * input: { path: './petStore.yaml' },
105
+ * output: { path: './src/gen' },
106
+ * plugins: [
107
+ * pluginTs(),
108
+ * pluginVueQuery({
109
+ * output: { path: './hooks' },
110
+ * }),
111
+ * ],
112
+ * })
113
+ * ```
114
+ */
76
115
  const pluginVueQuery = definePlugin((options) => {
77
116
  const { output = {
78
117
  path: "hooks",
@@ -91,7 +130,7 @@ const pluginVueQuery = definePlugin((options) => {
91
130
  if (group.type === "path") return `${ctx.group.split("/")[1]}`;
92
131
  return `${camelCase(ctx.group)}Controller`;
93
132
  }
94
- } : void 0;
133
+ } : null;
95
134
  return {
96
135
  name: pluginVueQueryName,
97
136
  options,
@@ -132,9 +171,9 @@ const pluginVueQuery = definePlugin((options) => {
132
171
  infinite: infinite ? {
133
172
  queryParam: "id",
134
173
  initialPageParam: 0,
135
- cursorParam: void 0,
136
- nextParam: void 0,
137
- previousParam: void 0,
174
+ cursorParam: null,
175
+ nextParam: null,
176
+ previousParam: null,
138
177
  ...infinite
139
178
  } : false,
140
179
  parser,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["fetchClientSource","axiosClientSource","configSource"],"sources":["../src/resolvers/resolverVueQuery.ts","../src/plugin.ts"],"sourcesContent":["import { camelCase } from '@internals/utils'\nimport { defineResolver } from '@kubb/core'\nimport type { PluginVueQuery } 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 Vue Query plugin.\n *\n * Provides default naming helpers using camelCase for functions and file paths.\n */\nexport const resolverVueQuery = defineResolver<PluginVueQuery>(() => ({\n name: 'default',\n pluginName: 'plugin-vue-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 resolveInfiniteQueryName(node) {\n return `use${capitalize(this.resolveName(node.operationId))}Infinite`\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 resolveInfiniteQueryOptionsName(node) {\n return `${this.resolveName(node.operationId)}InfiniteQueryOptions`\n },\n resolveQueryKeyName(node) {\n return `${this.resolveName(node.operationId)}QueryKey`\n },\n resolveInfiniteQueryKeyName(node) {\n return `${this.resolveName(node.operationId)}InfiniteQueryKey`\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 resolveInfiniteQueryKeyTypeName(node) {\n return `${capitalize(this.resolveName(node.operationId))}InfiniteQueryKey`\n },\n resolveMutationTypeName(node) {\n return capitalize(this.resolveName(node.operationId))\n },\n resolveClientName(node) {\n return this.resolveName(node.operationId)\n },\n resolveInfiniteClientName(node) {\n return `${this.resolveName(node.operationId)}Infinite`\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 } from '@internals/tanstack-query'\nimport { queryKeyTransformer } from '@internals/tanstack-query'\nimport { infiniteQueryGenerator, mutationGenerator, queryGenerator } from './generators'\nimport { resolverVueQuery } from './resolvers/resolverVueQuery.ts'\nimport type { PluginVueQuery } from './types.ts'\n\nexport const pluginVueQueryName = 'plugin-vue-query' satisfies PluginVueQuery['name']\n\nexport const pluginVueQuery = definePlugin<PluginVueQuery>((options) => {\n const {\n output = { path: 'hooks', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n parser = 'client',\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 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 [queryGenerator, infiniteQueryGenerator, mutationGenerator].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: pluginVueQueryName,\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 ? { ...resolverVueQuery, ...userResolver } : resolverVueQuery\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/vue-query',\n methods: ['get'],\n ...query,\n },\n mutationKey,\n mutation:\n mutation === false\n ? false\n : {\n importPath: '@tanstack/vue-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 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 pluginVueQuery\n"],"mappings":";;;;;;;;;;;;AAIA,SAAS,WAAW,MAAsB;CACxC,OAAO,GAAG,KAAK,OAAO,EAAE,CAAC,aAAa,GAAG,KAAK,MAAM,EAAE;;;;;;;AAQxD,MAAa,mBAAmB,sBAAsC;CACpE,MAAM;CAC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QACT,QACA;KACE,YAAY;KACZ,SAAS;MAAC;MAAQ;MAAO;MAAS;MAAS;KAC3C,GAAG;KACJ;IACP,UAAU,WACN;KACE,YAAY;KACZ,kBAAkB;KAClB,aAAa,KAAA;KACb,WAAW,KAAA;KACX,eAAe,KAAA;KACf,GAAG;KACJ,GACD;IACJ;IACA;IACA;IACA;IACA,OAAO;IACP;IACA;IACA;IACA;IACD,CAAC;GACF,IAAI,YAAY,SAAS;GACzB,IAAI,iBACF,IAAI,eAAe,gBAAgB;GAGrC,KAAK,MAAM,OAAO,oBAChB,IAAI,aAAa,IAAI;GAEvB,KAAK,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"}
1
+ {"version":3,"file":"index.js","names":["fetchClientSource","axiosClientSource","configSource"],"sources":["../src/resolvers/resolverVueQuery.ts","../src/plugin.ts"],"sourcesContent":["import { camelCase } from '@internals/utils'\nimport { defineResolver } from '@kubb/core'\nimport type { PluginVueQuery } 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-vue-query`. Decides the names and\n * file paths for every generated TanStack Query composable (`useFooQuery`,\n * `useFooMutation`, `useFooInfiniteQuery`) and its companion helpers.\n *\n * Functions and files use camelCase; composables get the `use` prefix.\n *\n * @example Resolve composable and helper names\n * ```ts\n * import { resolverVueQuery } from '@kubb/plugin-vue-query'\n *\n * resolverVueQuery.resolveQueryName(operationNode) // 'useGetPetById'\n * resolverVueQuery.resolveQueryKeyName(operationNode) // 'getPetByIdQueryKey'\n * resolverVueQuery.resolveQueryOptionsName(operationNode) // 'getPetByIdQueryOptions'\n * ```\n */\nexport const resolverVueQuery = defineResolver<PluginVueQuery>(() => ({\n name: 'default',\n pluginName: 'plugin-vue-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 resolveInfiniteQueryName(node) {\n return `use${capitalize(this.resolveName(node.operationId))}Infinite`\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 resolveInfiniteQueryOptionsName(node) {\n return `${this.resolveName(node.operationId)}InfiniteQueryOptions`\n },\n resolveQueryKeyName(node) {\n return `${this.resolveName(node.operationId)}QueryKey`\n },\n resolveInfiniteQueryKeyName(node) {\n return `${this.resolveName(node.operationId)}InfiniteQueryKey`\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 resolveInfiniteQueryKeyTypeName(node) {\n return `${capitalize(this.resolveName(node.operationId))}InfiniteQueryKey`\n },\n resolveMutationTypeName(node) {\n return capitalize(this.resolveName(node.operationId))\n },\n resolveClientName(node) {\n return this.resolveName(node.operationId)\n },\n resolveInfiniteClientName(node) {\n return `${this.resolveName(node.operationId)}Infinite`\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 } from '@internals/tanstack-query'\nimport { queryKeyTransformer } from '@internals/tanstack-query'\nimport { infiniteQueryGenerator, mutationGenerator, queryGenerator } from './generators'\nimport { resolverVueQuery } from './resolvers/resolverVueQuery.ts'\nimport type { PluginVueQuery } from './types.ts'\n\n/**\n * Canonical plugin name for `@kubb/plugin-vue-query`. Used for driver lookups\n * and cross-plugin dependency references.\n */\nexport const pluginVueQueryName = 'plugin-vue-query' satisfies PluginVueQuery['name']\n\n/**\n * Generates one TanStack Query composable per OpenAPI operation for Vue's\n * Composition API. Queries become `useFooQuery` (and optionally\n * `useFooInfiniteQuery`); mutations become `useFooMutation`. Each composable\n * is fully typed end to end.\n *\n * @example\n * ```ts\n * import { defineConfig } from 'kubb'\n * import { pluginTs } from '@kubb/plugin-ts'\n * import { pluginVueQuery } from '@kubb/plugin-vue-query'\n *\n * export default defineConfig({\n * input: { path: './petStore.yaml' },\n * output: { path: './src/gen' },\n * plugins: [\n * pluginTs(),\n * pluginVueQuery({\n * output: { path: './hooks' },\n * }),\n * ],\n * })\n * ```\n */\nexport const pluginVueQuery = definePlugin<PluginVueQuery>((options) => {\n const {\n output = { path: 'hooks', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n parser = 'client',\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 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 [queryGenerator, infiniteQueryGenerator, mutationGenerator].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: pluginVueQueryName,\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 ? { ...resolverVueQuery, ...userResolver } : resolverVueQuery\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/vue-query',\n methods: ['get'],\n ...query,\n },\n mutationKey,\n mutation:\n mutation === false\n ? false\n : {\n importPath: '@tanstack/vue-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 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 pluginVueQuery\n"],"mappings":";;;;;;;;;;;;AAIA,SAAS,WAAW,MAAsB;CACxC,OAAO,GAAG,KAAK,OAAO,EAAE,CAAC,aAAa,GAAG,KAAK,MAAM,EAAE;;;;;;;;;;;;;;;;;;AAmBxD,MAAa,mBAAmB,sBAAsC;CACpE,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,oBAAoB,MA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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"}
@@ -6,7 +6,7 @@ import { ClientImportPath, PluginClient } from "@kubb/plugin-client";
6
6
  type Transformer = (props: {
7
7
  node: ast.OperationNode;
8
8
  casing: 'camelcase' | undefined;
9
- }) => unknown[];
9
+ }) => Array<unknown>;
10
10
  /**
11
11
  * Resolver for Vue Query that provides naming methods for hook functions.
12
12
  */
@@ -73,145 +73,172 @@ type ResolverVueQuery = Resolver & {
73
73
  resolveInfiniteClientName(this: ResolverVueQuery, node: ast.OperationNode): string;
74
74
  };
75
75
  /**
76
- * Customize the queryKey.
76
+ * Builds the `queryKey` used by each generated query composable.
77
+ *
78
+ * @note String values are inlined verbatim into generated code. Wrap literal
79
+ * strings in `JSON.stringify(...)`.
77
80
  */
78
81
  type QueryKey = Transformer;
79
82
  /**
80
- * Customize the mutationKey.
83
+ * Builds the `mutationKey` used by each generated mutation composable.
84
+ *
85
+ * @note String values are inlined verbatim into generated code. Wrap literal
86
+ * strings in `JSON.stringify(...)`.
81
87
  */
82
88
  type MutationKey = Transformer;
83
89
  type Query = {
84
90
  /**
85
- * HTTP methods to use for queries.
91
+ * HTTP methods treated as queries.
86
92
  *
87
93
  * @default ['get']
88
94
  */
89
95
  methods?: Array<string>;
90
96
  /**
91
- * Path to the useQuery hook for useQuery functionality.
92
- * Used as `import { useQuery } from '${importPath}'`.
93
- * Accepts relative and absolute paths.
94
- * Path is used as-is; relative paths are based on the generated file location.
97
+ * Module specifier used in the `import { useQuery } from '...'` statement at
98
+ * the top of every generated composable file.
99
+ *
95
100
  * @default '@tanstack/vue-query'
96
101
  */
97
102
  importPath?: string;
98
103
  };
99
104
  type Mutation = {
100
105
  /**
101
- * HTTP methods to use for mutations.
106
+ * HTTP methods treated as mutations.
102
107
  *
103
108
  * @default ['post', 'put', 'delete']
104
109
  */
105
110
  methods?: Array<string>;
106
111
  /**
107
- * Path to the useMutation hook for useMutation functionality.
108
- * Used as `import { useMutation } from '${importPath}'`.
109
- * Accepts relative and absolute paths.
110
- * Path is used as-is; relative paths are based on the generated file location.
112
+ * Module specifier used in the `import { useMutation } from '...'` statement
113
+ * at the top of every generated composable file.
114
+ *
111
115
  * @default '@tanstack/vue-query'
112
116
  */
113
117
  importPath?: string;
114
118
  };
115
119
  type Infinite = {
116
120
  /**
117
- * Specify the params key used for `pageParam`.
121
+ * Name of the query parameter that holds the page cursor.
122
+ *
118
123
  * @default 'id'
119
124
  */
120
- queryParam: string;
125
+ queryParam?: string;
121
126
  /**
122
- * Which field of the data is used, set it to undefined when no cursor is known.
123
- * @deprecated Use `nextParam` and `previousParam` instead for more flexible pagination handling.
127
+ * Path to the cursor field on the response. Leave undefined when the cursor
128
+ * is not known.
129
+ *
130
+ * @deprecated Use `nextParam` and `previousParam` for richer pagination control.
124
131
  */
125
- cursorParam?: string | undefined;
132
+ cursorParam?: string | null;
126
133
  /**
127
- * Which field of the data is used to get the cursor for the next page.
128
- * Supports dot notation (e.g. 'pagination.next.id') or array path (e.g. ['pagination', 'next', 'id']) to access nested fields.
134
+ * Path to the next-page cursor on the response. Supports dot notation
135
+ * (`'pagination.next.id'`) or array form.
129
136
  */
130
- nextParam?: string | string[] | undefined;
137
+ nextParam?: string | Array<string> | null;
131
138
  /**
132
- * Which field of the data is used to get the cursor for the previous page.
133
- * Supports dot notation (e.g. 'pagination.prev.id') or array path (e.g. ['pagination', 'prev', 'id']) to access nested fields.
139
+ * Path to the previous-page cursor on the response. Supports dot notation
140
+ * or array form.
134
141
  */
135
- previousParam?: string | string[] | undefined;
142
+ previousParam?: string | Array<string> | null;
136
143
  /**
137
- * The initial value, the value of the first page.
144
+ * Initial value for `pageParam` on the first fetch.
145
+ *
138
146
  * @default 0
139
147
  */
140
- initialPageParam: unknown;
148
+ initialPageParam?: unknown;
141
149
  };
142
150
  type Options = {
143
151
  /**
144
- * Specify the export location for the files and define the behavior of the output
145
- * @default { path: 'hooks', barrelType: 'named' }
152
+ * Where the generated composables are written and how they are exported.
153
+ *
154
+ * @default { path: 'hooks', barrel: { type: 'named' } }
146
155
  */
147
156
  output?: Output;
148
157
  /**
149
- * Group the @tanstack/query hooks based on the provided name.
158
+ * Split generated files into subfolders based on the operation's tag.
150
159
  */
151
160
  group?: Group;
161
+ /**
162
+ * HTTP client used inside every generated composable. Mirrors a subset of
163
+ * `pluginClient` options.
164
+ */
152
165
  client?: ClientImportPath & Pick<PluginClient['options'], 'clientType' | 'dataReturnType' | 'baseURL' | 'bundle' | 'paramsCasing'>;
153
166
  /**
154
- * Tags, operations, or paths to exclude from generation.
167
+ * Skip operations matching at least one entry in the list.
155
168
  */
156
169
  exclude?: Array<Exclude>;
157
170
  /**
158
- * Tags, operations, or paths to include in generation.
171
+ * Restrict generation to operations matching at least one entry in the list.
159
172
  */
160
173
  include?: Array<Include>;
161
174
  /**
162
- * Override options for specific tags, operations, or paths.
175
+ * Apply a different options object to operations matching a pattern.
163
176
  */
164
177
  override?: Array<Override<ResolvedOptions>>;
165
178
  /**
166
- * Apply casing to parameter names.
179
+ * Rename parameter properties in the generated composables.
180
+ *
181
+ * @note Must match the value of `paramsCasing` on `@kubb/plugin-ts`.
167
182
  */
168
183
  paramsCasing?: 'camelcase';
169
184
  /**
170
- * How parameters are passed: grouped in an object or spread inline.
185
+ * How operation parameters appear in the generated composable signature.
171
186
  *
172
187
  * @default 'inline'
173
188
  */
174
189
  paramsType?: 'object' | 'inline';
175
190
  /**
176
- * How path parameters are passed: grouped in an object or spread inline.
191
+ * How URL path parameters are arranged inside the inline argument list.
177
192
  *
178
193
  * @default 'inline'
179
194
  */
180
195
  pathParamsType?: PluginClient['options']['pathParamsType'];
181
196
  /**
182
- * Add infinite query hooks.
197
+ * Enables `useInfiniteQuery` composables for cursor- or page-based pagination.
198
+ * Pass an object to configure how the cursor is read; pass `false` to skip.
199
+ *
200
+ * @default false
183
201
  */
184
202
  infinite?: Partial<Infinite> | false;
203
+ /**
204
+ * Custom `queryKey` builder.
205
+ */
185
206
  queryKey?: QueryKey;
186
207
  /**
187
- * Configure useQuery behavior.
208
+ * Configures query composables. Set to `false` to skip composable generation
209
+ * and emit only `queryOptions(...)` helpers.
188
210
  */
189
211
  query?: Partial<Query> | false;
212
+ /**
213
+ * Custom `mutationKey` builder.
214
+ */
190
215
  mutationKey?: MutationKey;
191
216
  /**
192
- * Configure useMutation behavior.
217
+ * Configures mutation composables. Set to `false` to skip mutation generation.
193
218
  */
194
219
  mutation?: Partial<Mutation> | false;
195
220
  /**
196
- * Parser to use for validating response data.
221
+ * Validator applied to response bodies before they reach the caller.
222
+ * - `'client'` — no validation.
223
+ * - `'zod'` — pipes responses through schemas from `@kubb/plugin-zod`.
197
224
  */
198
225
  parser?: PluginClient['options']['parser'];
199
226
  /**
200
- * Override naming conventions for function names and types.
227
+ * Override how composable names and file paths are built.
201
228
  */
202
229
  resolver?: Partial<ResolverVueQuery> & ThisType<ResolverVueQuery>;
203
230
  /**
204
- * AST visitor to transform generated nodes.
231
+ * AST visitor applied to each operation node before printing.
205
232
  */
206
233
  transformer?: ast.Visitor;
207
234
  /**
208
- * Additional generators alongside the default generators.
235
+ * Custom generators that run alongside the built-in Vue Query generators.
209
236
  */
210
237
  generators?: Array<Generator<PluginVueQuery>>;
211
238
  };
212
239
  type ResolvedOptions = {
213
240
  output: Output;
214
- group: Group | undefined;
241
+ group: Group | null;
215
242
  exclude: NonNullable<Options['exclude']>;
216
243
  include: Options['include'];
217
244
  override: NonNullable<Options['override']>;
@@ -224,9 +251,9 @@ type ResolvedOptions = {
224
251
  * Only used for infinite
225
252
  */
226
253
  infinite: NonNullable<Infinite> | false;
227
- queryKey: QueryKey | undefined;
254
+ queryKey: QueryKey | null;
228
255
  query: NonNullable<Required<Query>> | false;
229
- mutationKey: MutationKey | undefined;
256
+ mutationKey: MutationKey | null;
230
257
  mutation: NonNullable<Required<Mutation>> | false;
231
258
  resolver: ResolverVueQuery;
232
259
  };
@@ -240,4 +267,4 @@ declare global {
240
267
  }
241
268
  //#endregion
242
269
  export { Transformer as i, Options as n, PluginVueQuery as r, Infinite as t };
243
- //# sourceMappingURL=types-Bkm7bWT3.d.ts.map
270
+ //# sourceMappingURL=types-D-LjzI_Q.d.ts.map