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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/LICENSE +17 -10
  2. package/README.md +1 -3
  3. package/dist/components-D1UhYFgY.js +1277 -0
  4. package/dist/components-D1UhYFgY.js.map +1 -0
  5. package/dist/components-qfOFRSoM.cjs +1367 -0
  6. package/dist/components-qfOFRSoM.cjs.map +1 -0
  7. package/dist/components.cjs +1 -1
  8. package/dist/components.d.ts +118 -109
  9. package/dist/components.js +1 -1
  10. package/dist/generators-C4gs_P1i.cjs +726 -0
  11. package/dist/generators-C4gs_P1i.cjs.map +1 -0
  12. package/dist/generators-CbnIVBgY.js +709 -0
  13. package/dist/generators-CbnIVBgY.js.map +1 -0
  14. package/dist/generators.cjs +1 -1
  15. package/dist/generators.d.ts +5 -472
  16. package/dist/generators.js +1 -1
  17. package/dist/index.cjs +106 -121
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.ts +4 -4
  20. package/dist/index.js +102 -121
  21. package/dist/index.js.map +1 -1
  22. package/dist/types-nVDTfuS1.d.ts +194 -0
  23. package/package.json +61 -64
  24. package/src/components/InfiniteQuery.tsx +104 -153
  25. package/src/components/InfiniteQueryOptions.tsx +122 -162
  26. package/src/components/Mutation.tsx +110 -136
  27. package/src/components/Query.tsx +102 -151
  28. package/src/components/QueryKey.tsx +68 -58
  29. package/src/components/QueryOptions.tsx +147 -139
  30. package/src/generators/infiniteQueryGenerator.tsx +165 -170
  31. package/src/generators/mutationGenerator.tsx +117 -124
  32. package/src/generators/queryGenerator.tsx +138 -136
  33. package/src/index.ts +1 -1
  34. package/src/plugin.ts +124 -175
  35. package/src/resolvers/resolverVueQuery.ts +19 -0
  36. package/src/types.ts +68 -48
  37. package/src/utils.ts +37 -0
  38. package/dist/components-Yjoe78Y7.cjs +0 -1119
  39. package/dist/components-Yjoe78Y7.cjs.map +0 -1
  40. package/dist/components-_AMBl0g-.js +0 -1029
  41. package/dist/components-_AMBl0g-.js.map +0 -1
  42. package/dist/generators-CR34GjVu.js +0 -661
  43. package/dist/generators-CR34GjVu.js.map +0 -1
  44. package/dist/generators-DH8VkK1q.cjs +0 -678
  45. package/dist/generators-DH8VkK1q.cjs.map +0 -1
  46. package/dist/types-CgDFUvfZ.d.ts +0 -211
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["fetchClientSource","axiosClientSource","configSource"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { camelCase, pascalCase } from '@internals/utils'\nimport { createPlugin, type Group, getBarrelFiles, getMode } 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 { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { MutationKey, QueryKey } from './components'\nimport { infiniteQueryGenerator, mutationGenerator, queryGenerator } from './generators'\nimport type { PluginVueQuery } from './types.ts'\n\nexport const pluginVueQueryName = 'plugin-vue-query' satisfies PluginVueQuery['name']\n\nexport const pluginVueQuery = createPlugin<PluginVueQuery>((options) => {\n const {\n output = { path: 'hooks', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n parser = 'client',\n infinite,\n transformers = {},\n paramsType = 'inline',\n pathParamsType = paramsType === 'object' ? 'object' : options.pathParamsType || 'inline',\n mutation = {},\n query = {},\n paramsCasing,\n mutationKey = MutationKey.getTransformer,\n queryKey = QueryKey.getTransformer,\n generators = [queryGenerator, infiniteQueryGenerator, mutationGenerator].filter(Boolean),\n contentType,\n client,\n } = options\n\n const clientName = client?.client ?? 'axios'\n const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : undefined)\n\n return {\n name: pluginVueQueryName,\n options: {\n output,\n client: {\n bundle: client?.bundle,\n baseURL: client?.baseURL,\n client: clientName,\n clientType: client?.clientType ?? 'function',\n dataReturnType: client?.dataReturnType ?? 'data',\n pathParamsType,\n importPath: clientImportPath,\n paramsCasing,\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 queryKey,\n query:\n query === false\n ? false\n : {\n methods: ['get'],\n importPath: '@tanstack/vue-query',\n ...query,\n },\n mutationKey,\n mutation:\n mutation === false\n ? false\n : {\n methods: ['post', 'put', 'patch', 'delete'],\n importPath: '@tanstack/vue-query',\n ...mutation,\n },\n paramsType,\n pathParamsType,\n parser,\n paramsCasing,\n group,\n },\n pre: [pluginOasName, pluginTsName, parser === 'zod' ? pluginZodName : undefined].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: Group['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Controller`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n let resolvedName = camelCase(name)\n\n if (type === 'file' || type === 'function') {\n resolvedName = camelCase(name, {\n isFile: type === 'file',\n })\n }\n if (type === 'type') {\n resolvedName = pascalCase(name)\n }\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async install() {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n const oas = await this.getOas()\n const baseURL = await this.getBaseURL()\n\n if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\n\n const hasClientPlugin = !!this.driver.getPluginByName(pluginClientName)\n\n if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) {\n // pre add bundled\n await this.upsertFile({\n baseName: 'fetch.ts',\n path: path.resolve(root, '.kubb/fetch.ts'),\n sources: [\n {\n name: 'fetch',\n value: this.plugin.options.client.client === 'fetch' ? fetchClientSource : axiosClientSource,\n isExportable: true,\n isIndexable: true,\n },\n ],\n imports: [],\n exports: [],\n })\n }\n\n if (!hasClientPlugin) {\n await this.addFile({\n baseName: 'config.ts',\n path: path.resolve(root, '.kubb/config.ts'),\n sources: [\n {\n name: 'config',\n value: configSource,\n isExportable: false,\n isIndexable: false,\n },\n ],\n imports: [],\n exports: [],\n })\n }\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n driver: this.driver,\n events: this.events,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const files = await operationGenerator.build(...generators)\n await this.upsertFile(...files)\n\n const barrelFiles = await getBarrelFiles(this.fabric.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginName: this.plugin.name,\n },\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;;AAcA,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,UACA,eAAe,EAAE,EACjB,aAAa,UACb,iBAAiB,eAAe,WAAW,WAAW,QAAQ,kBAAkB,U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U;IACV,MAAM,KAAK,QAAQ,MAAM,kBAAkB;IAC3C,SAAS,CACP;KACE,MAAM;KACN,OAAOC;KACP,cAAc;KACd,aAAa;KACd,CACF;IACD,SAAS,EAAE;IACX,SAAS,EAAE;IACZ,CAAC;GAgBJ,MAAM,QAAQ,MAba,IAAI,mBAAmB,KAAK,OAAO,SAAS;IACrE,QAAQ,KAAK;IACb;IACA,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CAAC,CAEqC,MAAM,GAAG,WAAW;AAC3D,SAAM,KAAK,WAAW,GAAG,MAAM;GAE/B,MAAM,cAAc,MAAM,eAAe,KAAK,OAAO,OAAO;IAC1D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,YAAY,KAAK,OAAO,MACzB;IACF,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;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\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,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AAS,CAAC,MAAM;KAChB,GAAG;KACJ;IACP;IACA,UACE,aAAa,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;AACF,OAAI,YAAY,SAAS;AACzB,OAAI,gBACF,KAAI,eAAe,gBAAgB;AAGrC,QAAK,MAAM,OAAO,mBAChB,KAAI,aAAa,IAAI;AAEvB,QAAK,MAAM,OAAO,eAChB,KAAI,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;AAE7G,OAAI,QAAQ,UAAU,CAAC,mBAAmB,CAAC,iBACzC,KAAI,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;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"}
@@ -0,0 +1,194 @@
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
+ }) => unknown[];
10
+ /**
11
+ * Resolver for Vue Query that provides naming methods for hook functions.
12
+ */
13
+ type ResolverVueQuery = Resolver & {
14
+ /**
15
+ * Resolves the hook function name for an operation.
16
+ */
17
+ resolveName(this: ResolverVueQuery, name: string): string;
18
+ };
19
+ /**
20
+ * Customize the queryKey.
21
+ */
22
+ type QueryKey = Transformer;
23
+ /**
24
+ * Customize the mutationKey.
25
+ */
26
+ type MutationKey = Transformer;
27
+ type Query = {
28
+ /**
29
+ * HTTP methods to use for queries.
30
+ *
31
+ * @default ['get']
32
+ */
33
+ methods?: Array<string>;
34
+ /**
35
+ * Path to the useQuery hook for useQuery functionality.
36
+ * Used as `import { useQuery } from '${importPath}'`.
37
+ * Accepts relative and absolute paths.
38
+ * Path is used as-is; relative paths are based on the generated file location.
39
+ * @default '@tanstack/vue-query'
40
+ */
41
+ importPath?: string;
42
+ };
43
+ type Mutation = {
44
+ /**
45
+ * HTTP methods to use for mutations.
46
+ *
47
+ * @default ['post', 'put', 'delete']
48
+ */
49
+ methods?: Array<string>;
50
+ /**
51
+ * Path to the useMutation hook for useMutation functionality.
52
+ * Used as `import { useMutation } from '${importPath}'`.
53
+ * Accepts relative and absolute paths.
54
+ * Path is used as-is; relative paths are based on the generated file location.
55
+ * @default '@tanstack/vue-query'
56
+ */
57
+ importPath?: string;
58
+ };
59
+ type Infinite = {
60
+ /**
61
+ * Specify the params key used for `pageParam`.
62
+ * @default 'id'
63
+ */
64
+ queryParam: string;
65
+ /**
66
+ * Which field of the data is used, set it to undefined when no cursor is known.
67
+ * @deprecated Use `nextParam` and `previousParam` instead for more flexible pagination handling.
68
+ */
69
+ cursorParam?: string | undefined;
70
+ /**
71
+ * Which field of the data is used to get the cursor for the next page.
72
+ * Supports dot notation (e.g. 'pagination.next.id') or array path (e.g. ['pagination', 'next', 'id']) to access nested fields.
73
+ */
74
+ nextParam?: string | string[] | undefined;
75
+ /**
76
+ * Which field of the data is used to get the cursor for the previous page.
77
+ * Supports dot notation (e.g. 'pagination.prev.id') or array path (e.g. ['pagination', 'prev', 'id']) to access nested fields.
78
+ */
79
+ previousParam?: string | string[] | undefined;
80
+ /**
81
+ * The initial value, the value of the first page.
82
+ * @default 0
83
+ */
84
+ initialPageParam: unknown;
85
+ };
86
+ type Options = {
87
+ /**
88
+ * Specify the export location for the files and define the behavior of the output
89
+ * @default { path: 'hooks', barrelType: 'named' }
90
+ */
91
+ output?: Output;
92
+ /**
93
+ * Group the @tanstack/query hooks based on the provided name.
94
+ */
95
+ group?: Group;
96
+ client?: ClientImportPath & Pick<PluginClient['options'], 'clientType' | 'dataReturnType' | 'baseURL' | 'bundle' | 'paramsCasing'>;
97
+ /**
98
+ * Tags, operations, or paths to exclude from generation.
99
+ */
100
+ exclude?: Array<Exclude>;
101
+ /**
102
+ * Tags, operations, or paths to include in generation.
103
+ */
104
+ include?: Array<Include>;
105
+ /**
106
+ * Override options for specific tags, operations, or paths.
107
+ */
108
+ override?: Array<Override<ResolvedOptions>>;
109
+ /**
110
+ * Apply casing to parameter names.
111
+ */
112
+ paramsCasing?: 'camelcase';
113
+ /**
114
+ * How parameters are passed: grouped in an object or spread inline.
115
+ *
116
+ * @default 'inline'
117
+ */
118
+ paramsType?: 'object' | 'inline';
119
+ /**
120
+ * How path parameters are passed: grouped in an object or spread inline.
121
+ *
122
+ * @default 'inline'
123
+ */
124
+ pathParamsType?: PluginClient['options']['pathParamsType'];
125
+ /**
126
+ * Add infinite query hooks.
127
+ */
128
+ infinite?: Partial<Infinite> | false;
129
+ queryKey?: QueryKey;
130
+ /**
131
+ * Configure useQuery behavior.
132
+ */
133
+ query?: Partial<Query> | false;
134
+ mutationKey?: MutationKey;
135
+ /**
136
+ * Configure useMutation behavior.
137
+ */
138
+ mutation?: Partial<Mutation> | false;
139
+ /**
140
+ * Parser to use for validating response data.
141
+ */
142
+ parser?: PluginClient['options']['parser'];
143
+ transformers?: {
144
+ /**
145
+ * Override the default naming for hooks.
146
+ */
147
+ name?: (name: string, type?: string) => string;
148
+ };
149
+ /**
150
+ * Override naming conventions for function names and types.
151
+ */
152
+ resolver?: Partial<ResolverVueQuery> & ThisType<ResolverVueQuery>;
153
+ /**
154
+ * AST visitor to transform generated nodes.
155
+ */
156
+ transformer?: ast.Visitor;
157
+ /**
158
+ * Additional generators alongside the default generators.
159
+ */
160
+ generators?: Array<Generator<PluginVueQuery>>;
161
+ };
162
+ type ResolvedOptions = {
163
+ output: Output;
164
+ group: Group | undefined;
165
+ exclude: NonNullable<Options['exclude']>;
166
+ include: Options['include'];
167
+ override: NonNullable<Options['override']>;
168
+ client: Pick<PluginClient['options'], 'client' | 'clientType' | 'dataReturnType' | 'importPath' | 'baseURL' | 'bundle' | 'paramsCasing'>;
169
+ parser: Required<NonNullable<Options['parser']>>;
170
+ pathParamsType: NonNullable<Options['pathParamsType']>;
171
+ paramsCasing: Options['paramsCasing'];
172
+ paramsType: NonNullable<Options['paramsType']>;
173
+ /**
174
+ * Only used for infinite
175
+ */
176
+ infinite: NonNullable<Infinite> | false;
177
+ queryKey: QueryKey | undefined;
178
+ query: NonNullable<Required<Query>> | false;
179
+ mutationKey: MutationKey | undefined;
180
+ mutation: NonNullable<Required<Mutation>> | false;
181
+ resolver: ResolverVueQuery;
182
+ transformers: NonNullable<Options['transformers']>;
183
+ };
184
+ type PluginVueQuery = PluginFactoryOptions<'plugin-vue-query', Options, ResolvedOptions, ResolverVueQuery>;
185
+ declare global {
186
+ namespace Kubb {
187
+ interface PluginRegistry {
188
+ 'plugin-vue-query': PluginVueQuery;
189
+ }
190
+ }
191
+ }
192
+ //#endregion
193
+ export { Transformer as i, Options as n, PluginVueQuery as r, Infinite as t };
194
+ //# sourceMappingURL=types-nVDTfuS1.d.ts.map
package/package.json CHANGED
@@ -1,37 +1,58 @@
1
1
  {
2
2
  "name": "@kubb/plugin-vue-query",
3
- "version": "5.0.0-alpha.8",
3
+ "version": "5.0.0-beta.3",
4
4
  "description": "Vue Query hooks generator plugin for Kubb, creating type-safe API client hooks from OpenAPI specifications for Vue.js applications.",
5
5
  "keywords": [
6
- "vue-query",
7
- "vue",
8
- "vue.js",
9
- "vue3",
10
- "tanstack-query",
11
- "composables",
12
- "hooks",
13
- "data-fetching",
14
6
  "api-client",
15
- "sdk-generator",
16
- "typescript",
17
- "type-safe",
18
- "openapi",
19
- "swagger",
20
- "oas",
21
7
  "code-generator",
22
8
  "codegen",
9
+ "composables",
10
+ "data-fetching",
11
+ "hooks",
12
+ "kubb",
13
+ "oas",
14
+ "openapi",
23
15
  "plugins",
24
- "kubb"
16
+ "sdk-generator",
17
+ "swagger",
18
+ "tanstack-query",
19
+ "type-safe",
20
+ "typescript",
21
+ "vue",
22
+ "vue-query",
23
+ "vue.js",
24
+ "vue3"
25
25
  ],
26
+ "license": "MIT",
27
+ "author": "stijnvanhulle",
26
28
  "repository": {
27
29
  "type": "git",
28
- "url": "git+https://github.com/kubb-labs/kubb.git",
30
+ "url": "git+https://github.com/kubb-labs/plugins.git",
29
31
  "directory": "packages/plugin-vue-query"
30
32
  },
31
- "license": "MIT",
32
- "author": "stijnvanhulle",
33
- "sideEffects": false,
33
+ "files": [
34
+ "src",
35
+ "dist",
36
+ "plugin.json",
37
+ "!/**/**.test.**",
38
+ "!/**/__tests__/**",
39
+ "!/**/__snapshots__/**"
40
+ ],
34
41
  "type": "module",
42
+ "sideEffects": false,
43
+ "main": "./dist/index.cjs",
44
+ "module": "./dist/index.js",
45
+ "types": "./dist/index.d.ts",
46
+ "typesVersions": {
47
+ "*": {
48
+ "components": [
49
+ "./dist/components.d.ts"
50
+ ],
51
+ "generators": [
52
+ "./dist/generators.d.ts"
53
+ ]
54
+ }
55
+ },
35
56
  "exports": {
36
57
  ".": {
37
58
  "import": "./dist/index.js",
@@ -47,24 +68,25 @@
47
68
  },
48
69
  "./package.json": "./package.json"
49
70
  },
50
- "types": "./dist/index.d.ts",
51
- "typesVersions": {
52
- "*": {
53
- "components": [
54
- "./dist/components.d.ts"
55
- ],
56
- "generators": [
57
- "./dist/generators.d.ts"
58
- ]
59
- }
71
+ "publishConfig": {
72
+ "access": "public",
73
+ "registry": "https://registry.npmjs.org/"
74
+ },
75
+ "dependencies": {
76
+ "@kubb/core": "5.0.0-beta.3",
77
+ "@kubb/renderer-jsx": "5.0.0-beta.3",
78
+ "remeda": "^2.34.0",
79
+ "@kubb/plugin-client": "5.0.0-beta.3",
80
+ "@kubb/plugin-ts": "5.0.0-beta.3",
81
+ "@kubb/plugin-zod": "5.0.0-beta.3"
82
+ },
83
+ "devDependencies": {
84
+ "@internals/tanstack-query": "0.0.0",
85
+ "@internals/utils": "0.0.0"
86
+ },
87
+ "peerDependencies": {
88
+ "@kubb/renderer-jsx": "5.0.0-beta.3"
60
89
  },
61
- "files": [
62
- "src",
63
- "dist",
64
- "!/**/**.test.**",
65
- "!/**/__tests__/**",
66
- "!/**/__snapshots__/**"
67
- ],
68
90
  "size-limit": [
69
91
  {
70
92
  "path": "./dist/*.js",
@@ -72,39 +94,14 @@
72
94
  "gzip": true
73
95
  }
74
96
  ],
75
- "dependencies": {
76
- "@kubb/fabric-core": "0.14.0",
77
- "@kubb/react-fabric": "0.14.0",
78
- "remeda": "^2.33.6",
79
- "@kubb/core": "5.0.0-alpha.8",
80
- "@kubb/oas": "5.0.0-alpha.8",
81
- "@kubb/plugin-oas": "5.0.0-alpha.8",
82
- "@kubb/plugin-ts": "5.0.0-alpha.8",
83
- "@kubb/plugin-client": "5.0.0-alpha.8",
84
- "@kubb/plugin-zod": "5.0.0-alpha.8"
85
- },
86
- "peerDependencies": {
87
- "@kubb/fabric-core": "0.14.0",
88
- "@kubb/react-fabric": "0.14.0"
89
- },
90
97
  "engines": {
91
98
  "node": ">=22"
92
99
  },
93
- "publishConfig": {
94
- "access": "public",
95
- "registry": "https://registry.npmjs.org/"
96
- },
97
- "main": "./dist/index.cjs",
98
- "module": "./dist/index.js",
99
- "devDependencies": {
100
- "@internals/tanstack-query": "0.0.0",
101
- "@internals/utils": "0.0.0"
102
- },
103
100
  "scripts": {
104
101
  "build": "tsdown && size-limit",
105
102
  "clean": "npx rimraf ./dist",
106
- "lint": "bun biome lint .",
107
- "lint:fix": "bun biome lint --fix --unsafe .",
103
+ "lint": "oxlint .",
104
+ "lint:fix": "oxlint --fix .",
108
105
  "release": "pnpm publish --no-git-check",
109
106
  "release:canary": "bash ../../.github/canary.sh && node ../../scripts/build.js canary && pnpm publish --no-git-check",
110
107
  "start": "tsdown --watch",