@kubb/plugin-vue-query 5.0.0-beta.3 → 5.0.0-beta.31

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 (41) hide show
  1. package/README.md +26 -5
  2. package/dist/{components-qfOFRSoM.cjs → components-B6lPYyOP.cjs} +367 -381
  3. package/dist/components-B6lPYyOP.cjs.map +1 -0
  4. package/dist/{components-D1UhYFgY.js → components-BZqujNQv.js} +336 -380
  5. package/dist/components-BZqujNQv.js.map +1 -0
  6. package/dist/components.cjs +1 -1
  7. package/dist/components.d.ts +3 -67
  8. package/dist/components.js +1 -1
  9. package/dist/{generators-CbnIVBgY.js → generators-C-3isXzW.js} +158 -203
  10. package/dist/generators-C-3isXzW.js.map +1 -0
  11. package/dist/{generators-C4gs_P1i.cjs → generators-QHQkbNnm.cjs} +157 -202
  12. package/dist/generators-QHQkbNnm.cjs.map +1 -0
  13. package/dist/generators.cjs +1 -1
  14. package/dist/generators.d.ts +17 -1
  15. package/dist/generators.js +1 -1
  16. package/dist/index.cjs +136 -23
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.ts +29 -1
  19. package/dist/index.js +136 -23
  20. package/dist/index.js.map +1 -1
  21. package/dist/types-D-LjzI_Q.d.ts +270 -0
  22. package/extension.yaml +1273 -0
  23. package/package.json +16 -18
  24. package/src/components/InfiniteQuery.tsx +16 -48
  25. package/src/components/InfiniteQueryOptions.tsx +43 -58
  26. package/src/components/Mutation.tsx +33 -42
  27. package/src/components/Query.tsx +16 -49
  28. package/src/components/QueryKey.tsx +9 -61
  29. package/src/components/QueryOptions.tsx +20 -76
  30. package/src/generators/infiniteQueryGenerator.tsx +55 -63
  31. package/src/generators/mutationGenerator.tsx +50 -61
  32. package/src/generators/queryGenerator.tsx +52 -61
  33. package/src/plugin.ts +46 -30
  34. package/src/resolvers/resolverVueQuery.ts +61 -4
  35. package/src/types.ts +129 -53
  36. package/src/utils.ts +44 -25
  37. package/dist/components-D1UhYFgY.js.map +0 -1
  38. package/dist/components-qfOFRSoM.cjs.map +0 -1
  39. package/dist/generators-C4gs_P1i.cjs.map +0 -1
  40. package/dist/generators-CbnIVBgY.js.map +0 -1
  41. package/dist/types-nVDTfuS1.d.ts +0 -194
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import "./chunk--u3MIqq1.js";
2
- import { c as MutationKey, l as camelCase, o as QueryKey } from "./components-D1UhYFgY.js";
3
- import { n as mutationGenerator, r as infiniteQueryGenerator, t as queryGenerator } from "./generators-CbnIVBgY.js";
2
+ import { m as camelCase, s as queryKeyTransformer, u as mutationKeyTransformer } from "./components-BZqujNQv.js";
3
+ import { n as mutationGenerator, r as infiniteQueryGenerator, t as queryGenerator } from "./generators-C-3isXzW.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";
@@ -9,48 +9,162 @@ import { source as source$1 } from "@kubb/plugin-client/templates/clients/fetch.
9
9
  import { source as source$2 } from "@kubb/plugin-client/templates/config.source";
10
10
  import { pluginTsName } from "@kubb/plugin-ts";
11
11
  import { pluginZodName } from "@kubb/plugin-zod";
12
+ //#region ../../internals/shared/src/group.ts
13
+ /**
14
+ * Builds the `group` config a Kubb plugin passes to `ctx.setOptions`, applying the
15
+ * shared default naming so every plugin groups output consistently:
16
+ *
17
+ * - `path` groups use the second path segment (`/pet/findByStatus` → `pet`).
18
+ * - other groups use `${camelCase(group)}${suffix}` (e.g. `petController`).
19
+ *
20
+ * Returns `null` when grouping is disabled, matching the per-plugin convention.
21
+ *
22
+ * @param group - The user-supplied group option, or `undefined` to disable grouping.
23
+ * @param options.suffix - Appended to non-`path` group names, e.g. `'Controller'` or `'Requests'`.
24
+ * @param options.honorName - When `true`, a user-provided `group.name` overrides the default namer.
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * createGroupConfig(group, { suffix: 'Controller' }) // plugin-ts, plugin-zod
29
+ * createGroupConfig(group, { suffix: 'Controller', honorName: true }) // plugin-faker, plugin-client, …
30
+ * createGroupConfig(group, { suffix: 'Requests', honorName: true }) // plugin-cypress, plugin-mcp
31
+ * ```
32
+ */
33
+ function createGroupConfig(group, options) {
34
+ if (!group) return null;
35
+ const defaultName = (ctx) => {
36
+ if (group.type === "path") return `${ctx.group.split("/")[1]}`;
37
+ return `${camelCase(ctx.group)}${options.suffix}`;
38
+ };
39
+ return {
40
+ ...group,
41
+ name: options.honorName && group.name ? group.name : defaultName
42
+ };
43
+ }
44
+ //#endregion
12
45
  //#region src/resolvers/resolverVueQuery.ts
46
+ function capitalize(name) {
47
+ return `${name.charAt(0).toUpperCase()}${name.slice(1)}`;
48
+ }
13
49
  /**
14
- * Naming convention resolver for Vue Query plugin.
50
+ * Default resolver used by `@kubb/plugin-vue-query`. Decides the names and
51
+ * file paths for every generated TanStack Query composable (`useFooQuery`,
52
+ * `useFooMutation`, `useFooInfiniteQuery`) and its companion helpers.
53
+ *
54
+ * Functions and files use camelCase; composables get the `use` prefix.
55
+ *
56
+ * @example Resolve composable and helper names
57
+ * ```ts
58
+ * import { resolverVueQuery } from '@kubb/plugin-vue-query'
15
59
  *
16
- * Provides default naming helpers using camelCase for functions and file paths.
60
+ * resolverVueQuery.resolveQueryName(operationNode) // 'useGetPetById'
61
+ * resolverVueQuery.resolveQueryKeyName(operationNode) // 'getPetByIdQueryKey'
62
+ * resolverVueQuery.resolveQueryOptionsName(operationNode) // 'getPetByIdQueryOptions'
63
+ * ```
17
64
  */
18
- const resolverVueQuery = defineResolver((ctx) => ({
65
+ const resolverVueQuery = defineResolver(() => ({
19
66
  name: "default",
20
67
  pluginName: "plugin-vue-query",
21
68
  default(name, type) {
22
69
  return camelCase(name, { isFile: type === "file" });
23
70
  },
24
71
  resolveName(name) {
25
- return ctx.default(name, "function");
72
+ return this.default(name, "function");
73
+ },
74
+ resolvePathName(name, type) {
75
+ return this.default(name, type);
76
+ },
77
+ resolveQueryName(node) {
78
+ return `use${capitalize(this.resolveName(node.operationId))}`;
79
+ },
80
+ resolveInfiniteQueryName(node) {
81
+ return `use${capitalize(this.resolveName(node.operationId))}Infinite`;
82
+ },
83
+ resolveMutationName(node) {
84
+ return `use${capitalize(this.resolveName(node.operationId))}`;
85
+ },
86
+ resolveQueryOptionsName(node) {
87
+ return `${this.resolveName(node.operationId)}QueryOptions`;
88
+ },
89
+ resolveInfiniteQueryOptionsName(node) {
90
+ return `${this.resolveName(node.operationId)}InfiniteQueryOptions`;
91
+ },
92
+ resolveQueryKeyName(node) {
93
+ return `${this.resolveName(node.operationId)}QueryKey`;
94
+ },
95
+ resolveInfiniteQueryKeyName(node) {
96
+ return `${this.resolveName(node.operationId)}InfiniteQueryKey`;
97
+ },
98
+ resolveMutationKeyName(node) {
99
+ return `${this.resolveName(node.operationId)}MutationKey`;
100
+ },
101
+ resolveQueryKeyTypeName(node) {
102
+ return `${capitalize(this.resolveName(node.operationId))}QueryKey`;
103
+ },
104
+ resolveInfiniteQueryKeyTypeName(node) {
105
+ return `${capitalize(this.resolveName(node.operationId))}InfiniteQueryKey`;
106
+ },
107
+ resolveMutationTypeName(node) {
108
+ return capitalize(this.resolveName(node.operationId));
109
+ },
110
+ resolveClientName(node) {
111
+ return this.resolveName(node.operationId);
112
+ },
113
+ resolveInfiniteClientName(node) {
114
+ return `${this.resolveName(node.operationId)}Infinite`;
26
115
  }
27
116
  }));
28
117
  //#endregion
29
118
  //#region src/plugin.ts
119
+ /**
120
+ * Canonical plugin name for `@kubb/plugin-vue-query`. Used for driver lookups
121
+ * and cross-plugin dependency references.
122
+ */
30
123
  const pluginVueQueryName = "plugin-vue-query";
124
+ /**
125
+ * Generates one TanStack Query composable per OpenAPI operation for Vue's
126
+ * Composition API. Queries become `useFooQuery` (and optionally
127
+ * `useFooInfiniteQuery`); mutations become `useFooMutation`. Each composable
128
+ * is fully typed end to end.
129
+ *
130
+ * @example
131
+ * ```ts
132
+ * import { defineConfig } from 'kubb'
133
+ * import { pluginTs } from '@kubb/plugin-ts'
134
+ * import { pluginVueQuery } from '@kubb/plugin-vue-query'
135
+ *
136
+ * export default defineConfig({
137
+ * input: { path: './petStore.yaml' },
138
+ * output: { path: './src/gen' },
139
+ * plugins: [
140
+ * pluginTs(),
141
+ * pluginVueQuery({
142
+ * output: { path: './hooks' },
143
+ * }),
144
+ * ],
145
+ * })
146
+ * ```
147
+ */
31
148
  const pluginVueQuery = definePlugin((options) => {
32
149
  const { output = {
33
150
  path: "hooks",
34
151
  barrelType: "named"
35
- }, group, exclude = [], include, override = [], parser = "client", infinite = false, transformers = {}, paramsType = "inline", pathParamsType = paramsType === "object" ? "object" : options.pathParamsType || "inline", mutation = {}, query = {}, mutationKey = MutationKey.getTransformer, queryKey = QueryKey.getTransformer, paramsCasing, client, resolver: userResolver, transformer: userTransformer, generators: userGenerators = [] } = options;
152
+ }, group, exclude = [], include, override = [], parser = false, infinite = false, paramsType = "inline", pathParamsType = paramsType === "object" ? "object" : options.pathParamsType || "inline", mutation = {}, query = {}, mutationKey = mutationKeyTransformer, queryKey = queryKeyTransformer, paramsCasing, client, resolver: userResolver, transformer: userTransformer, generators: userGenerators = [] } = options;
36
153
  const clientName = client?.client ?? "axios";
37
154
  const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : void 0);
38
155
  const selectedGenerators = options.generators ?? [
39
156
  queryGenerator,
40
157
  infiniteQueryGenerator,
41
158
  mutationGenerator
42
- ].filter(Boolean);
43
- const groupConfig = group ? {
44
- ...group,
45
- name: group.name ? group.name : (ctx) => {
46
- if (group.type === "path") return `${ctx.group.split("/")[1]}`;
47
- return `${camelCase(ctx.group)}Controller`;
48
- }
49
- } : void 0;
159
+ ].filter((generator) => Boolean(generator));
160
+ const groupConfig = createGroupConfig(group, {
161
+ suffix: "Controller",
162
+ honorName: true
163
+ });
50
164
  return {
51
165
  name: pluginVueQueryName,
52
166
  options,
53
- dependencies: [pluginTsName, parser === "zod" ? pluginZodName : void 0].filter(Boolean),
167
+ dependencies: [pluginTsName, parser === "zod" ? pluginZodName : void 0].filter((dependency) => Boolean(dependency)),
54
168
  hooks: { "kubb:plugin:setup"(ctx) {
55
169
  const resolver = userResolver ? {
56
170
  ...resolverVueQuery,
@@ -58,7 +172,6 @@ const pluginVueQuery = definePlugin((options) => {
58
172
  } : resolverVueQuery;
59
173
  ctx.setOptions({
60
174
  output,
61
- transformers,
62
175
  client: {
63
176
  bundle: client?.bundle,
64
177
  baseURL: client?.baseURL,
@@ -88,9 +201,9 @@ const pluginVueQuery = definePlugin((options) => {
88
201
  infinite: infinite ? {
89
202
  queryParam: "id",
90
203
  initialPageParam: 0,
91
- cursorParam: void 0,
92
- nextParam: void 0,
93
- previousParam: void 0,
204
+ cursorParam: null,
205
+ nextParam: null,
206
+ previousParam: null,
94
207
  ...infinite
95
208
  } : false,
96
209
  parser,
@@ -110,10 +223,10 @@ const pluginVueQuery = definePlugin((options) => {
110
223
  const root = path.resolve(ctx.config.root, ctx.config.output.path);
111
224
  const hasClientPlugin = !!ctx.config.plugins?.some((p) => p.name === pluginClientName);
112
225
  if (client?.bundle && !hasClientPlugin && !clientImportPath) ctx.injectFile({
113
- baseName: "fetch.ts",
114
- path: path.resolve(root, ".kubb/fetch.ts"),
226
+ baseName: "client.ts",
227
+ path: path.resolve(root, ".kubb/client.ts"),
115
228
  sources: [ast.createSource({
116
- name: "fetch",
229
+ name: "client",
117
230
  nodes: [ast.createText(clientName === "fetch" ? source$1 : source)],
118
231
  isExportable: true,
119
232
  isIndexable: true
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\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>((ctx) => ({\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 ctx.default(name, 'function')\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 { MutationKey } from './components/MutationKey.tsx'\nimport { QueryKey } from './components/QueryKey.tsx'\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 transformers = {},\n paramsType = 'inline',\n pathParamsType = paramsType === 'object' ? 'object' : options.pathParamsType || 'inline',\n mutation = {},\n query = {},\n mutationKey = MutationKey.getTransformer,\n queryKey = QueryKey.getTransformer,\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 = options.generators ?? [queryGenerator, infiniteQueryGenerator, mutationGenerator].filter(Boolean)\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(Boolean),\n hooks: {\n 'kubb:plugin:setup'(ctx) {\n const resolver = userResolver ? { ...resolverVueQuery, ...userResolver } : resolverVueQuery\n\n ctx.setOptions({\n output,\n transformers,\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":";;;;;;;;;;;;;;;;;AASA,MAAa,mBAAmB,gBAAgC,SAAS;CACvE,MAAM;CACN,YAAY;CACZ,QAAQ,MAAM,MAAM;AAClB,SAAO,UAAU,MAAM,EAAE,QAAQ,SAAS,QAAQ,CAAC;;CAErD,YAAY,MAAM;AAChB,SAAO,IAAI,QAAQ,MAAM,WAAW;;CAEvC,EAAE;;;ACHH,MAAa,qBAAqB;AAElC,MAAa,iBAAiB,cAA8B,YAAY;CACtE,MAAM,EACJ,SAAS;EAAE,MAAM;EAAS,YAAY;EAAS,EAC/C,OACA,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,SAAS,UACT,WAAW,OACX,eAAe,EAAE,EACjB,aAAa,UACb,iBAAiB,eAAe,WAAW,WAAW,QAAQ,kBAAkB,UAChF,WAAW,EAAE,EACb,QAAQ,EAAE,EACV,cAAc,YAAY,gBAC1B,WAAW,SAAS,gBACpB,cACA,QACA,UAAU,cACV,aAAa,iBACb,YAAY,iBAAiB,EAAE,KAC7B;CAEJ,MAAM,aAAa,QAAQ,UAAU;CACrC,MAAM,mBAAmB,QAAQ,eAAe,CAAC,QAAQ,SAAS,+BAA+B,eAAe,KAAA;CAEhH,MAAM,qBAAqB,QAAQ,cAAc;EAAC;EAAgB;EAAwB;EAAkB,CAAC,OAAO,QAAQ;CAE5H,MAAM,cAAc,QACf;EACC,GAAG;EACH,MAAM,MAAM,OACR,MAAM,QACL,QAA2B;AAC1B,OAAI,MAAM,SAAS,OACjB,QAAO,GAAG,IAAI,MAAM,MAAM,IAAI,CAAC;AAEjC,UAAO,GAAG,UAAU,IAAI,MAAM,CAAC;;EAEtC,GACD,KAAA;AAEJ,QAAO;EACL,MAA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oBC,OAAkB,CAAC;KACvF,cAAc;KACd,aAAa;KACd,CAAC,CACH;IACF,CAAC;AAGJ,OAAI,CAAC,gBACH,KAAI,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":["../../../internals/shared/src/group.ts","../src/resolvers/resolverVueQuery.ts","../src/plugin.ts"],"sourcesContent":["import { camelCase } from '@internals/utils'\nimport type { Group } from '@kubb/core'\n\n/**\n * Builds the `group` config a Kubb plugin passes to `ctx.setOptions`, applying the\n * shared default naming so every plugin groups output consistently:\n *\n * - `path` groups use the second path segment (`/pet/findByStatus` → `pet`).\n * - other groups use `${camelCase(group)}${suffix}` (e.g. `petController`).\n *\n * Returns `null` when grouping is disabled, matching the per-plugin convention.\n *\n * @param group - The user-supplied group option, or `undefined` to disable grouping.\n * @param options.suffix - Appended to non-`path` group names, e.g. `'Controller'` or `'Requests'`.\n * @param options.honorName - When `true`, a user-provided `group.name` overrides the default namer.\n *\n * @example\n * ```ts\n * createGroupConfig(group, { suffix: 'Controller' }) // plugin-ts, plugin-zod\n * createGroupConfig(group, { suffix: 'Controller', honorName: true }) // plugin-faker, plugin-client, …\n * createGroupConfig(group, { suffix: 'Requests', honorName: true }) // plugin-cypress, plugin-mcp\n * ```\n */\nexport function createGroupConfig(group: Group | undefined, options: { suffix: string; honorName?: boolean }): Group | null {\n if (!group) {\n return null\n }\n\n const defaultName = (ctx: { group: string }): string => {\n if (group.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n\n return `${camelCase(ctx.group)}${options.suffix}`\n }\n\n return {\n ...group,\n name: options.honorName && group.name ? group.name : defaultName,\n } satisfies Group\n}\n","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 { createGroupConfig } from '@internals/shared'\nimport { ast, definePlugin } from '@kubb/core'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { source as axiosClientSource } from '@kubb/plugin-client/templates/clients/axios.source'\nimport { source as fetchClientSource } from '@kubb/plugin-client/templates/clients/fetch.source'\nimport { source as configSource } from '@kubb/plugin-client/templates/config.source'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { mutationKeyTransformer } 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 = false,\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 = createGroupConfig(group, { suffix: 'Controller', honorName: true })\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: 'client.ts',\n path: path.resolve(root, '.kubb/client.ts'),\n sources: [\n ast.createSource({\n name: 'client',\n nodes: [ast.createText(clientName === 'fetch' ? fetchClientSource : axiosClientSource)],\n isExportable: true,\n isIndexable: true,\n }),\n ],\n })\n }\n\n if (!hasClientPlugin) {\n ctx.injectFile({\n baseName: 'config.ts',\n path: path.resolve(root, '.kubb/config.ts'),\n sources: [\n ast.createSource({\n name: 'config',\n nodes: [ast.createText(configSource)],\n isExportable: false,\n isIndexable: false,\n }),\n ],\n })\n }\n },\n },\n }\n})\n\nexport default pluginVueQuery\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAgB,kBAAkB,OAA0B,SAAgE;CAC1H,IAAI,CAAC,OACH,OAAO;CAGT,MAAM,eAAe,QAAmC;EACtD,IAAI,MAAM,SAAS,QACjB,OAAO,GAAG,IAAI,MAAM,MAAM,IAAI,CAAC;EAGjC,OAAO,GAAG,UAAU,IAAI,MAAM,GAAG,QAAQ;;CAG3C,OAAO;EACL,GAAG;EACH,MAAM,QAAQ,aAAa,MAAM,OAAO,MAAM,OAAO;EACtD;;;;ACnCH,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;;CAEv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,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,kBAAkB;IAC3C,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"}
@@ -0,0 +1,270 @@
1
+ import { t as __name } from "./chunk--u3MIqq1.js";
2
+ import { Exclude, Generator, Group, Include, Output, Override, PluginFactoryOptions, Resolver, ast } from "@kubb/core";
3
+ import { ClientImportPath, PluginClient } from "@kubb/plugin-client";
4
+
5
+ //#region src/types.d.ts
6
+ type Transformer = (props: {
7
+ node: ast.OperationNode;
8
+ casing: 'camelcase' | undefined;
9
+ }) => Array<unknown>;
10
+ /**
11
+ * Resolver for Vue Query that provides naming methods for hook functions.
12
+ */
13
+ type ResolverVueQuery = Resolver & {
14
+ /**
15
+ * Resolves the base function name for an operation.
16
+ */
17
+ resolveName(this: ResolverVueQuery, name: string): string;
18
+ /**
19
+ * Resolves the output file name for a hook module.
20
+ */
21
+ resolvePathName(this: ResolverVueQuery, name: string, type?: 'file' | 'function' | 'type' | 'const'): string;
22
+ /**
23
+ * Resolves a query hook function name.
24
+ */
25
+ resolveQueryName(this: ResolverVueQuery, node: ast.OperationNode): string;
26
+ /**
27
+ * Resolves an infinite query hook function name.
28
+ */
29
+ resolveInfiniteQueryName(this: ResolverVueQuery, node: ast.OperationNode): string;
30
+ /**
31
+ * Resolves a mutation hook function name.
32
+ */
33
+ resolveMutationName(this: ResolverVueQuery, node: ast.OperationNode): string;
34
+ /**
35
+ * Resolves the query options helper name.
36
+ */
37
+ resolveQueryOptionsName(this: ResolverVueQuery, node: ast.OperationNode): string;
38
+ /**
39
+ * Resolves the infinite query options helper name.
40
+ */
41
+ resolveInfiniteQueryOptionsName(this: ResolverVueQuery, node: ast.OperationNode): string;
42
+ /**
43
+ * Resolves the query key helper name.
44
+ */
45
+ resolveQueryKeyName(this: ResolverVueQuery, node: ast.OperationNode): string;
46
+ /**
47
+ * Resolves the infinite query key helper name.
48
+ */
49
+ resolveInfiniteQueryKeyName(this: ResolverVueQuery, node: ast.OperationNode): string;
50
+ /**
51
+ * Resolves the mutation key helper name.
52
+ */
53
+ resolveMutationKeyName(this: ResolverVueQuery, node: ast.OperationNode): string;
54
+ /**
55
+ * Resolves the query key type name.
56
+ */
57
+ resolveQueryKeyTypeName(this: ResolverVueQuery, node: ast.OperationNode): string;
58
+ /**
59
+ * Resolves the infinite query key type name.
60
+ */
61
+ resolveInfiniteQueryKeyTypeName(this: ResolverVueQuery, node: ast.OperationNode): string;
62
+ /**
63
+ * Resolves the mutation type name.
64
+ */
65
+ resolveMutationTypeName(this: ResolverVueQuery, node: ast.OperationNode): string;
66
+ /**
67
+ * Resolves the client function name generated inline by query hooks.
68
+ */
69
+ resolveClientName(this: ResolverVueQuery, node: ast.OperationNode): string;
70
+ /**
71
+ * Resolves the client function name generated inline by infinite query hooks.
72
+ */
73
+ resolveInfiniteClientName(this: ResolverVueQuery, node: ast.OperationNode): string;
74
+ };
75
+ /**
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(...)`.
80
+ */
81
+ type QueryKey = Transformer;
82
+ /**
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(...)`.
87
+ */
88
+ type MutationKey = Transformer;
89
+ type Query = {
90
+ /**
91
+ * HTTP methods treated as queries.
92
+ *
93
+ * @default ['get']
94
+ */
95
+ methods?: Array<string>;
96
+ /**
97
+ * Module specifier used in the `import { useQuery } from '...'` statement at
98
+ * the top of every generated composable file.
99
+ *
100
+ * @default '@tanstack/vue-query'
101
+ */
102
+ importPath?: string;
103
+ };
104
+ type Mutation = {
105
+ /**
106
+ * HTTP methods treated as mutations.
107
+ *
108
+ * @default ['post', 'put', 'delete']
109
+ */
110
+ methods?: Array<string>;
111
+ /**
112
+ * Module specifier used in the `import { useMutation } from '...'` statement
113
+ * at the top of every generated composable file.
114
+ *
115
+ * @default '@tanstack/vue-query'
116
+ */
117
+ importPath?: string;
118
+ };
119
+ type Infinite = {
120
+ /**
121
+ * Name of the query parameter that holds the page cursor.
122
+ *
123
+ * @default 'id'
124
+ */
125
+ queryParam?: string;
126
+ /**
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.
131
+ */
132
+ cursorParam?: string | null;
133
+ /**
134
+ * Path to the next-page cursor on the response. Supports dot notation
135
+ * (`'pagination.next.id'`) or array form.
136
+ */
137
+ nextParam?: string | Array<string> | null;
138
+ /**
139
+ * Path to the previous-page cursor on the response. Supports dot notation
140
+ * or array form.
141
+ */
142
+ previousParam?: string | Array<string> | null;
143
+ /**
144
+ * Initial value for `pageParam` on the first fetch.
145
+ *
146
+ * @default 0
147
+ */
148
+ initialPageParam?: unknown;
149
+ };
150
+ type Options = {
151
+ /**
152
+ * Where the generated composables are written and how they are exported.
153
+ *
154
+ * @default { path: 'hooks', barrel: { type: 'named' } }
155
+ */
156
+ output?: Output;
157
+ /**
158
+ * Split generated files into subfolders based on the operation's tag.
159
+ */
160
+ group?: Group;
161
+ /**
162
+ * HTTP client used inside every generated composable. Mirrors a subset of
163
+ * `pluginClient` options.
164
+ */
165
+ client?: ClientImportPath & Pick<PluginClient['options'], 'clientType' | 'dataReturnType' | 'baseURL' | 'bundle' | 'paramsCasing'>;
166
+ /**
167
+ * Skip operations matching at least one entry in the list.
168
+ */
169
+ exclude?: Array<Exclude>;
170
+ /**
171
+ * Restrict generation to operations matching at least one entry in the list.
172
+ */
173
+ include?: Array<Include>;
174
+ /**
175
+ * Apply a different options object to operations matching a pattern.
176
+ */
177
+ override?: Array<Override<ResolvedOptions>>;
178
+ /**
179
+ * Rename parameter properties in the generated composables.
180
+ *
181
+ * @note Must match the value of `paramsCasing` on `@kubb/plugin-ts`.
182
+ */
183
+ paramsCasing?: 'camelcase';
184
+ /**
185
+ * How operation parameters appear in the generated composable signature.
186
+ *
187
+ * @default 'inline'
188
+ */
189
+ paramsType?: 'object' | 'inline';
190
+ /**
191
+ * How URL path parameters are arranged inside the inline argument list.
192
+ *
193
+ * @default 'inline'
194
+ */
195
+ pathParamsType?: PluginClient['options']['pathParamsType'];
196
+ /**
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
201
+ */
202
+ infinite?: Partial<Infinite> | false;
203
+ /**
204
+ * Custom `queryKey` builder.
205
+ */
206
+ queryKey?: QueryKey;
207
+ /**
208
+ * Configures query composables. Set to `false` to skip composable generation
209
+ * and emit only `queryOptions(...)` helpers.
210
+ */
211
+ query?: Partial<Query> | false;
212
+ /**
213
+ * Custom `mutationKey` builder.
214
+ */
215
+ mutationKey?: MutationKey;
216
+ /**
217
+ * Configures mutation composables. Set to `false` to skip mutation generation.
218
+ */
219
+ mutation?: Partial<Mutation> | false;
220
+ /**
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`.
224
+ */
225
+ parser?: PluginClient['options']['parser'];
226
+ /**
227
+ * Override how composable names and file paths are built.
228
+ */
229
+ resolver?: Partial<ResolverVueQuery> & ThisType<ResolverVueQuery>;
230
+ /**
231
+ * AST visitor applied to each operation node before printing.
232
+ */
233
+ transformer?: ast.Visitor;
234
+ /**
235
+ * Custom generators that run alongside the built-in Vue Query generators.
236
+ */
237
+ generators?: Array<Generator<PluginVueQuery>>;
238
+ };
239
+ type ResolvedOptions = {
240
+ output: Output;
241
+ group: Group | null;
242
+ exclude: NonNullable<Options['exclude']>;
243
+ include: Options['include'];
244
+ override: NonNullable<Options['override']>;
245
+ client: Pick<PluginClient['options'], 'client' | 'clientType' | 'dataReturnType' | 'importPath' | 'baseURL' | 'bundle' | 'paramsCasing'>;
246
+ parser: Required<NonNullable<Options['parser']>>;
247
+ pathParamsType: NonNullable<Options['pathParamsType']>;
248
+ paramsCasing: Options['paramsCasing'];
249
+ paramsType: NonNullable<Options['paramsType']>;
250
+ /**
251
+ * Only used for infinite
252
+ */
253
+ infinite: NonNullable<Infinite> | false;
254
+ queryKey: QueryKey | null;
255
+ query: NonNullable<Required<Query>> | false;
256
+ mutationKey: MutationKey | null;
257
+ mutation: NonNullable<Required<Mutation>> | false;
258
+ resolver: ResolverVueQuery;
259
+ };
260
+ type PluginVueQuery = PluginFactoryOptions<'plugin-vue-query', Options, ResolvedOptions, ResolverVueQuery>;
261
+ declare global {
262
+ namespace Kubb {
263
+ interface PluginRegistry {
264
+ 'plugin-vue-query': PluginVueQuery;
265
+ }
266
+ }
267
+ }
268
+ //#endregion
269
+ export { Transformer as i, Options as n, PluginVueQuery as r, Infinite as t };
270
+ //# sourceMappingURL=types-D-LjzI_Q.d.ts.map