@kubb/plugin-vue-query 5.0.0-alpha.9 → 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 -501
  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.cjs CHANGED
@@ -1,158 +1,143 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_components = require("./components-Yjoe78Y7.cjs");
3
- const require_generators = require("./generators-DH8VkK1q.cjs");
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
4
+ });
5
+ const require_components = require("./components-qfOFRSoM.cjs");
6
+ const require_generators = require("./generators-C4gs_P1i.cjs");
4
7
  let node_path = require("node:path");
5
- node_path = require_components.__toESM(node_path);
8
+ node_path = require_components.__toESM(node_path, 1);
6
9
  let _kubb_core = require("@kubb/core");
7
10
  let _kubb_plugin_client = require("@kubb/plugin-client");
8
11
  let _kubb_plugin_client_templates_clients_axios_source = require("@kubb/plugin-client/templates/clients/axios.source");
9
12
  let _kubb_plugin_client_templates_clients_fetch_source = require("@kubb/plugin-client/templates/clients/fetch.source");
10
13
  let _kubb_plugin_client_templates_config_source = require("@kubb/plugin-client/templates/config.source");
11
- let _kubb_plugin_oas = require("@kubb/plugin-oas");
12
14
  let _kubb_plugin_ts = require("@kubb/plugin-ts");
13
15
  let _kubb_plugin_zod = require("@kubb/plugin-zod");
16
+ //#region src/resolvers/resolverVueQuery.ts
17
+ /**
18
+ * Naming convention resolver for Vue Query plugin.
19
+ *
20
+ * Provides default naming helpers using camelCase for functions and file paths.
21
+ */
22
+ const resolverVueQuery = (0, _kubb_core.defineResolver)((ctx) => ({
23
+ name: "default",
24
+ pluginName: "plugin-vue-query",
25
+ default(name, type) {
26
+ return require_components.camelCase(name, { isFile: type === "file" });
27
+ },
28
+ resolveName(name) {
29
+ return ctx.default(name, "function");
30
+ }
31
+ }));
32
+ //#endregion
14
33
  //#region src/plugin.ts
15
34
  const pluginVueQueryName = "plugin-vue-query";
16
- const pluginVueQuery = (0, _kubb_core.createPlugin)((options) => {
35
+ const pluginVueQuery = (0, _kubb_core.definePlugin)((options) => {
17
36
  const { output = {
18
37
  path: "hooks",
19
38
  barrelType: "named"
20
- }, group, exclude = [], include, override = [], parser = "client", infinite, transformers = {}, paramsType = "inline", pathParamsType = paramsType === "object" ? "object" : options.pathParamsType || "inline", mutation = {}, query = {}, paramsCasing, mutationKey = require_components.MutationKey.getTransformer, queryKey = require_components.QueryKey.getTransformer, generators = [
39
+ }, group, exclude = [], include, override = [], parser = "client", infinite = false, transformers = {}, paramsType = "inline", pathParamsType = paramsType === "object" ? "object" : options.pathParamsType || "inline", mutation = {}, query = {}, mutationKey = require_components.MutationKey.getTransformer, queryKey = require_components.QueryKey.getTransformer, paramsCasing, client, resolver: userResolver, transformer: userTransformer, generators: userGenerators = [] } = options;
40
+ const clientName = client?.client ?? "axios";
41
+ const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : void 0);
42
+ const selectedGenerators = options.generators ?? [
21
43
  require_generators.queryGenerator,
22
44
  require_generators.infiniteQueryGenerator,
23
45
  require_generators.mutationGenerator
24
- ].filter(Boolean), contentType, client } = options;
25
- const clientName = client?.client ?? "axios";
26
- const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : void 0);
46
+ ].filter(Boolean);
47
+ const groupConfig = group ? {
48
+ ...group,
49
+ name: group.name ? group.name : (ctx) => {
50
+ if (group.type === "path") return `${ctx.group.split("/")[1]}`;
51
+ return `${require_components.camelCase(ctx.group)}Controller`;
52
+ }
53
+ } : void 0;
27
54
  return {
28
55
  name: pluginVueQueryName,
29
- options: {
30
- output,
31
- client: {
32
- bundle: client?.bundle,
33
- baseURL: client?.baseURL,
34
- client: clientName,
35
- clientType: client?.clientType ?? "function",
36
- dataReturnType: client?.dataReturnType ?? "data",
56
+ options,
57
+ dependencies: [_kubb_plugin_ts.pluginTsName, parser === "zod" ? _kubb_plugin_zod.pluginZodName : void 0].filter(Boolean),
58
+ hooks: { "kubb:plugin:setup"(ctx) {
59
+ const resolver = userResolver ? {
60
+ ...resolverVueQuery,
61
+ ...userResolver
62
+ } : resolverVueQuery;
63
+ ctx.setOptions({
64
+ output,
65
+ transformers,
66
+ client: {
67
+ bundle: client?.bundle,
68
+ baseURL: client?.baseURL,
69
+ client: clientName,
70
+ clientType: client?.clientType ?? "function",
71
+ importPath: clientImportPath,
72
+ dataReturnType: client?.dataReturnType ?? "data",
73
+ paramsCasing
74
+ },
75
+ queryKey,
76
+ query: query === false ? false : {
77
+ importPath: "@tanstack/vue-query",
78
+ methods: ["get"],
79
+ ...query
80
+ },
81
+ mutationKey,
82
+ mutation: mutation === false ? false : {
83
+ importPath: "@tanstack/vue-query",
84
+ methods: [
85
+ "post",
86
+ "put",
87
+ "patch",
88
+ "delete"
89
+ ],
90
+ ...mutation
91
+ },
92
+ infinite: infinite ? {
93
+ queryParam: "id",
94
+ initialPageParam: 0,
95
+ cursorParam: void 0,
96
+ nextParam: void 0,
97
+ previousParam: void 0,
98
+ ...infinite
99
+ } : false,
100
+ parser,
101
+ paramsType,
37
102
  pathParamsType,
38
- importPath: clientImportPath,
39
- paramsCasing
40
- },
41
- infinite: infinite ? {
42
- queryParam: "id",
43
- initialPageParam: 0,
44
- cursorParam: void 0,
45
- nextParam: void 0,
46
- previousParam: void 0,
47
- ...infinite
48
- } : false,
49
- queryKey,
50
- query: query === false ? false : {
51
- methods: ["get"],
52
- importPath: "@tanstack/vue-query",
53
- ...query
54
- },
55
- mutationKey,
56
- mutation: mutation === false ? false : {
57
- methods: [
58
- "post",
59
- "put",
60
- "patch",
61
- "delete"
62
- ],
63
- importPath: "@tanstack/vue-query",
64
- ...mutation
65
- },
66
- paramsType,
67
- pathParamsType,
68
- parser,
69
- paramsCasing,
70
- group
71
- },
72
- pre: [
73
- _kubb_plugin_oas.pluginOasName,
74
- _kubb_plugin_ts.pluginTsName,
75
- parser === "zod" ? _kubb_plugin_zod.pluginZodName : void 0
76
- ].filter(Boolean),
77
- resolvePath(baseName, pathMode, options) {
78
- const root = node_path.default.resolve(this.config.root, this.config.output.path);
79
- if ((pathMode ?? (0, _kubb_core.getMode)(node_path.default.resolve(root, output.path))) === "single")
80
- /**
81
- * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend
82
- * Other plugins then need to call addOrAppend instead of just add from the fileManager class
83
- */
84
- return node_path.default.resolve(root, output.path);
85
- if (group && (options?.group?.path || options?.group?.tag)) {
86
- const groupName = group?.name ? group.name : (ctx) => {
87
- if (group?.type === "path") return `${ctx.group.split("/")[1]}`;
88
- return `${require_components.camelCase(ctx.group)}Controller`;
89
- };
90
- return node_path.default.resolve(root, output.path, groupName({ group: group.type === "path" ? options.group.path : options.group.tag }), baseName);
91
- }
92
- return node_path.default.resolve(root, output.path, baseName);
93
- },
94
- resolveName(name, type) {
95
- let resolvedName = require_components.camelCase(name);
96
- if (type === "file" || type === "function") resolvedName = require_components.camelCase(name, { isFile: type === "file" });
97
- if (type === "type") resolvedName = require_components.pascalCase(name);
98
- if (type) return transformers?.name?.(resolvedName, type) || resolvedName;
99
- return resolvedName;
100
- },
101
- async install() {
102
- const root = node_path.default.resolve(this.config.root, this.config.output.path);
103
- const mode = (0, _kubb_core.getMode)(node_path.default.resolve(root, output.path));
104
- const oas = await this.getOas();
105
- const baseURL = await this.getBaseURL();
106
- if (baseURL) this.plugin.options.client.baseURL = baseURL;
107
- const hasClientPlugin = !!this.driver.getPluginByName(_kubb_plugin_client.pluginClientName);
108
- if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) await this.upsertFile({
103
+ paramsCasing,
104
+ group: groupConfig,
105
+ exclude,
106
+ include,
107
+ override,
108
+ resolver
109
+ });
110
+ ctx.setResolver(resolver);
111
+ if (userTransformer) ctx.setTransformer(userTransformer);
112
+ for (const gen of selectedGenerators) ctx.addGenerator(gen);
113
+ for (const gen of userGenerators) ctx.addGenerator(gen);
114
+ const root = node_path.default.resolve(ctx.config.root, ctx.config.output.path);
115
+ const hasClientPlugin = !!ctx.config.plugins?.some((p) => p.name === _kubb_plugin_client.pluginClientName);
116
+ if (client?.bundle && !hasClientPlugin && !clientImportPath) ctx.injectFile({
109
117
  baseName: "fetch.ts",
110
118
  path: node_path.default.resolve(root, ".kubb/fetch.ts"),
111
- sources: [{
119
+ sources: [_kubb_core.ast.createSource({
112
120
  name: "fetch",
113
- value: this.plugin.options.client.client === "fetch" ? _kubb_plugin_client_templates_clients_fetch_source.source : _kubb_plugin_client_templates_clients_axios_source.source,
121
+ nodes: [_kubb_core.ast.createText(clientName === "fetch" ? _kubb_plugin_client_templates_clients_fetch_source.source : _kubb_plugin_client_templates_clients_axios_source.source)],
114
122
  isExportable: true,
115
123
  isIndexable: true
116
- }],
117
- imports: [],
118
- exports: []
124
+ })]
119
125
  });
120
- if (!hasClientPlugin) await this.addFile({
126
+ if (!hasClientPlugin) ctx.injectFile({
121
127
  baseName: "config.ts",
122
128
  path: node_path.default.resolve(root, ".kubb/config.ts"),
123
- sources: [{
129
+ sources: [_kubb_core.ast.createSource({
124
130
  name: "config",
125
- value: _kubb_plugin_client_templates_config_source.source,
131
+ nodes: [_kubb_core.ast.createText(_kubb_plugin_client_templates_config_source.source)],
126
132
  isExportable: false,
127
133
  isIndexable: false
128
- }],
129
- imports: [],
130
- exports: []
134
+ })]
131
135
  });
132
- const files = await new _kubb_plugin_oas.OperationGenerator(this.plugin.options, {
133
- fabric: this.fabric,
134
- oas,
135
- driver: this.driver,
136
- events: this.events,
137
- plugin: this.plugin,
138
- contentType,
139
- exclude,
140
- include,
141
- override,
142
- mode
143
- }).build(...generators);
144
- await this.upsertFile(...files);
145
- const barrelFiles = await (0, _kubb_core.getBarrelFiles)(this.fabric.files, {
146
- type: output.barrelType ?? "named",
147
- root,
148
- output,
149
- meta: { pluginName: this.plugin.name }
150
- });
151
- await this.upsertFile(...barrelFiles);
152
- }
136
+ } }
153
137
  };
154
138
  });
155
139
  //#endregion
140
+ exports.default = pluginVueQuery;
156
141
  exports.pluginVueQuery = pluginVueQuery;
157
142
  exports.pluginVueQueryName = pluginVueQueryName;
158
143
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["MutationKey","QueryKey","queryGenerator","infiniteQueryGenerator","mutationGenerator","pluginOasName","pluginTsName","pluginZodName","path","camelCase","pascalCase","pluginClientName","fetchClientSource","axiosClientSource","configSource","OperationGenerator"],"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,kBAAA,GAAA,WAAA,eAA+C,YAAY;CACtE,MAAM,EACJ,SAAS;EAAE,MAAM;EAAS,YAAY;EAAS,EAC/C,OACA,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,SAAS,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M,KAAK,WAAW;IACpB,UAAU;IACV,MAAMH,UAAAA,QAAK,QAAQ,MAAM,iBAAiB;IAC1C,SAAS,CACP;KACE,MAAM;KACN,OAAO,KAAK,OAAO,QAAQ,OAAO,WAAW,UAAUI,mDAAAA,SAAoBC,mDAAAA;KAC3E,cAAc;KACd,aAAa;KACd,CACF;IACD,SAAS,EAAE;IACX,SAAS,EAAE;IACZ,CAAC;AAGJ,OAAI,CAAC,gBACH,OAAM,KAAK,QAAQ;IACjB,UAAU;IACV,MAAML,UAAAA,QAAK,QAAQ,MAAM,kBAAkB;IAC3C,SAAS,CACP;KACE,MAAM;KACN,OAAOM,4CAAAA;KACP,cAAc;KACd,aAAa;KACd,CACF;IACD,SAAS,EAAE;IACX,SAAS,EAAE;IACZ,CAAC;GAgBJ,MAAM,QAAQ,MAba,IAAIC,iBAAAA,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,OAAA,GAAA,WAAA,gBAAqB,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.cjs","names":["camelCase","MutationKey","QueryKey","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\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,oBAAA,GAAA,WAAA,iBAAmD,SAAS;CACvE,MAAM;CACN,YAAY;CACZ,QAAQ,MAAM,MAAM;AAClB,SAAOA,mBAAAA,UAAU,MAAM,EAAE,QAAQ,SAAS,QAAQ,CAAC;;CAErD,YAAY,MAAM;AAChB,SAAO,IAAI,QAAQ,MAAM,WAAW;;CAEvC,EAAE;;;ACHH,MAAa,qBAAqB;AAElC,MAAa,kBAAA,GAAA,WAAA,eAA+C,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,cAAcC,mBAAAA,YAAY,gBAC1B,WAAWC,mBAAAA,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;EAACC,mBAAAA;EAAgBC,mBAAAA;EAAwBC,mBAAAA;EAAkB,CAAC,OAAO,QAAQ;CAE5H,MAAM,cAAc,QACf;EACC,GAAG;EACH,MAAM,MAAM,OACR,MAAM,QACL,QAA2B;AAC1B,OAAI,MAAM,SAAS,OAC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AC,mBAAmB,CAAC,iBACzC,KAAI,WAAW;IACb,UAAU;IACV,MAAMD,UAAAA,QAAK,QAAQ,MAAM,iBAAiB;IAC1C,SAAS,CACPE,WAAAA,IAAI,aAAa;KACf,MAAM;KACN,OAAO,CAACA,WAAAA,IAAI,WAAW,eAAe,UAAUC,mDAAAA,SAAoBC,mDAAAA,OAAkB,CAAC;KACvF,cAAc;KACd,aAAa;KACd,CAAC,CACH;IACF,CAAC;AAGJ,OAAI,CAAC,gBACH,KAAI,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,10 +1,10 @@
1
1
  import { t as __name } from "./chunk--u3MIqq1.js";
2
- import { n as Options, r as PluginVueQuery } from "./types-CgDFUvfZ.js";
3
- import * as _kubb_core0 from "@kubb/core";
2
+ import { n as Options, r as PluginVueQuery } from "./types-nVDTfuS1.js";
3
+ import * as _$_kubb_core0 from "@kubb/core";
4
4
 
5
5
  //#region src/plugin.d.ts
6
6
  declare const pluginVueQueryName = "plugin-vue-query";
7
- declare const pluginVueQuery: (options?: Options | undefined) => _kubb_core0.UserPluginWithLifeCycle<PluginVueQuery>;
7
+ declare const pluginVueQuery: (options?: Options | undefined) => _$_kubb_core0.Plugin<PluginVueQuery>;
8
8
  //#endregion
9
- export { type PluginVueQuery, pluginVueQuery, pluginVueQueryName };
9
+ export { type PluginVueQuery, pluginVueQuery as default, pluginVueQuery, pluginVueQueryName };
10
10
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,157 +1,138 @@
1
1
  import "./chunk--u3MIqq1.js";
2
- import { c as camelCase, l as pascalCase, r as MutationKey, s as QueryKey } from "./components-_AMBl0g-.js";
3
- import { n as mutationGenerator, r as infiniteQueryGenerator, t as queryGenerator } from "./generators-CR34GjVu.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";
4
4
  import path from "node:path";
5
- import { createPlugin, getBarrelFiles, getMode } from "@kubb/core";
5
+ import { ast, definePlugin, defineResolver } from "@kubb/core";
6
6
  import { pluginClientName } from "@kubb/plugin-client";
7
7
  import { source } from "@kubb/plugin-client/templates/clients/axios.source";
8
8
  import { source as source$1 } from "@kubb/plugin-client/templates/clients/fetch.source";
9
9
  import { source as source$2 } from "@kubb/plugin-client/templates/config.source";
10
- import { OperationGenerator, pluginOasName } from "@kubb/plugin-oas";
11
10
  import { pluginTsName } from "@kubb/plugin-ts";
12
11
  import { pluginZodName } from "@kubb/plugin-zod";
12
+ //#region src/resolvers/resolverVueQuery.ts
13
+ /**
14
+ * Naming convention resolver for Vue Query plugin.
15
+ *
16
+ * Provides default naming helpers using camelCase for functions and file paths.
17
+ */
18
+ const resolverVueQuery = defineResolver((ctx) => ({
19
+ name: "default",
20
+ pluginName: "plugin-vue-query",
21
+ default(name, type) {
22
+ return camelCase(name, { isFile: type === "file" });
23
+ },
24
+ resolveName(name) {
25
+ return ctx.default(name, "function");
26
+ }
27
+ }));
28
+ //#endregion
13
29
  //#region src/plugin.ts
14
30
  const pluginVueQueryName = "plugin-vue-query";
15
- const pluginVueQuery = createPlugin((options) => {
31
+ const pluginVueQuery = definePlugin((options) => {
16
32
  const { output = {
17
33
  path: "hooks",
18
34
  barrelType: "named"
19
- }, group, exclude = [], include, override = [], parser = "client", infinite, transformers = {}, paramsType = "inline", pathParamsType = paramsType === "object" ? "object" : options.pathParamsType || "inline", mutation = {}, query = {}, paramsCasing, mutationKey = MutationKey.getTransformer, queryKey = QueryKey.getTransformer, generators = [
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;
36
+ const clientName = client?.client ?? "axios";
37
+ const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : void 0);
38
+ const selectedGenerators = options.generators ?? [
20
39
  queryGenerator,
21
40
  infiniteQueryGenerator,
22
41
  mutationGenerator
23
- ].filter(Boolean), contentType, client } = options;
24
- const clientName = client?.client ?? "axios";
25
- const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : void 0);
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;
26
50
  return {
27
51
  name: pluginVueQueryName,
28
- options: {
29
- output,
30
- client: {
31
- bundle: client?.bundle,
32
- baseURL: client?.baseURL,
33
- client: clientName,
34
- clientType: client?.clientType ?? "function",
35
- dataReturnType: client?.dataReturnType ?? "data",
52
+ options,
53
+ dependencies: [pluginTsName, parser === "zod" ? pluginZodName : void 0].filter(Boolean),
54
+ hooks: { "kubb:plugin:setup"(ctx) {
55
+ const resolver = userResolver ? {
56
+ ...resolverVueQuery,
57
+ ...userResolver
58
+ } : resolverVueQuery;
59
+ ctx.setOptions({
60
+ output,
61
+ transformers,
62
+ client: {
63
+ bundle: client?.bundle,
64
+ baseURL: client?.baseURL,
65
+ client: clientName,
66
+ clientType: client?.clientType ?? "function",
67
+ importPath: clientImportPath,
68
+ dataReturnType: client?.dataReturnType ?? "data",
69
+ paramsCasing
70
+ },
71
+ queryKey,
72
+ query: query === false ? false : {
73
+ importPath: "@tanstack/vue-query",
74
+ methods: ["get"],
75
+ ...query
76
+ },
77
+ mutationKey,
78
+ mutation: mutation === false ? false : {
79
+ importPath: "@tanstack/vue-query",
80
+ methods: [
81
+ "post",
82
+ "put",
83
+ "patch",
84
+ "delete"
85
+ ],
86
+ ...mutation
87
+ },
88
+ infinite: infinite ? {
89
+ queryParam: "id",
90
+ initialPageParam: 0,
91
+ cursorParam: void 0,
92
+ nextParam: void 0,
93
+ previousParam: void 0,
94
+ ...infinite
95
+ } : false,
96
+ parser,
97
+ paramsType,
36
98
  pathParamsType,
37
- importPath: clientImportPath,
38
- paramsCasing
39
- },
40
- infinite: infinite ? {
41
- queryParam: "id",
42
- initialPageParam: 0,
43
- cursorParam: void 0,
44
- nextParam: void 0,
45
- previousParam: void 0,
46
- ...infinite
47
- } : false,
48
- queryKey,
49
- query: query === false ? false : {
50
- methods: ["get"],
51
- importPath: "@tanstack/vue-query",
52
- ...query
53
- },
54
- mutationKey,
55
- mutation: mutation === false ? false : {
56
- methods: [
57
- "post",
58
- "put",
59
- "patch",
60
- "delete"
61
- ],
62
- importPath: "@tanstack/vue-query",
63
- ...mutation
64
- },
65
- paramsType,
66
- pathParamsType,
67
- parser,
68
- paramsCasing,
69
- group
70
- },
71
- pre: [
72
- pluginOasName,
73
- pluginTsName,
74
- parser === "zod" ? pluginZodName : void 0
75
- ].filter(Boolean),
76
- resolvePath(baseName, pathMode, options) {
77
- const root = path.resolve(this.config.root, this.config.output.path);
78
- if ((pathMode ?? getMode(path.resolve(root, output.path))) === "single")
79
- /**
80
- * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend
81
- * Other plugins then need to call addOrAppend instead of just add from the fileManager class
82
- */
83
- return path.resolve(root, output.path);
84
- if (group && (options?.group?.path || options?.group?.tag)) {
85
- const groupName = group?.name ? group.name : (ctx) => {
86
- if (group?.type === "path") return `${ctx.group.split("/")[1]}`;
87
- return `${camelCase(ctx.group)}Controller`;
88
- };
89
- return path.resolve(root, output.path, groupName({ group: group.type === "path" ? options.group.path : options.group.tag }), baseName);
90
- }
91
- return path.resolve(root, output.path, baseName);
92
- },
93
- resolveName(name, type) {
94
- let resolvedName = camelCase(name);
95
- if (type === "file" || type === "function") resolvedName = camelCase(name, { isFile: type === "file" });
96
- if (type === "type") resolvedName = pascalCase(name);
97
- if (type) return transformers?.name?.(resolvedName, type) || resolvedName;
98
- return resolvedName;
99
- },
100
- async install() {
101
- const root = path.resolve(this.config.root, this.config.output.path);
102
- const mode = getMode(path.resolve(root, output.path));
103
- const oas = await this.getOas();
104
- const baseURL = await this.getBaseURL();
105
- if (baseURL) this.plugin.options.client.baseURL = baseURL;
106
- const hasClientPlugin = !!this.driver.getPluginByName(pluginClientName);
107
- if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) await this.upsertFile({
99
+ paramsCasing,
100
+ group: groupConfig,
101
+ exclude,
102
+ include,
103
+ override,
104
+ resolver
105
+ });
106
+ ctx.setResolver(resolver);
107
+ if (userTransformer) ctx.setTransformer(userTransformer);
108
+ for (const gen of selectedGenerators) ctx.addGenerator(gen);
109
+ for (const gen of userGenerators) ctx.addGenerator(gen);
110
+ const root = path.resolve(ctx.config.root, ctx.config.output.path);
111
+ const hasClientPlugin = !!ctx.config.plugins?.some((p) => p.name === pluginClientName);
112
+ if (client?.bundle && !hasClientPlugin && !clientImportPath) ctx.injectFile({
108
113
  baseName: "fetch.ts",
109
114
  path: path.resolve(root, ".kubb/fetch.ts"),
110
- sources: [{
115
+ sources: [ast.createSource({
111
116
  name: "fetch",
112
- value: this.plugin.options.client.client === "fetch" ? source$1 : source,
117
+ nodes: [ast.createText(clientName === "fetch" ? source$1 : source)],
113
118
  isExportable: true,
114
119
  isIndexable: true
115
- }],
116
- imports: [],
117
- exports: []
120
+ })]
118
121
  });
119
- if (!hasClientPlugin) await this.addFile({
122
+ if (!hasClientPlugin) ctx.injectFile({
120
123
  baseName: "config.ts",
121
124
  path: path.resolve(root, ".kubb/config.ts"),
122
- sources: [{
125
+ sources: [ast.createSource({
123
126
  name: "config",
124
- value: source$2,
127
+ nodes: [ast.createText(source$2)],
125
128
  isExportable: false,
126
129
  isIndexable: false
127
- }],
128
- imports: [],
129
- exports: []
130
- });
131
- const files = await new OperationGenerator(this.plugin.options, {
132
- fabric: this.fabric,
133
- oas,
134
- driver: this.driver,
135
- events: this.events,
136
- plugin: this.plugin,
137
- contentType,
138
- exclude,
139
- include,
140
- override,
141
- mode
142
- }).build(...generators);
143
- await this.upsertFile(...files);
144
- const barrelFiles = await getBarrelFiles(this.fabric.files, {
145
- type: output.barrelType ?? "named",
146
- root,
147
- output,
148
- meta: { pluginName: this.plugin.name }
130
+ })]
149
131
  });
150
- await this.upsertFile(...barrelFiles);
151
- }
132
+ } }
152
133
  };
153
134
  });
154
135
  //#endregion
155
- export { pluginVueQuery, pluginVueQueryName };
136
+ export { pluginVueQuery as default, pluginVueQuery, pluginVueQueryName };
156
137
 
157
138
  //# sourceMappingURL=index.js.map