@kubb/plugin-solid-query 0.0.0-canary-20241104172400

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 (48) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +53 -0
  3. package/dist/chunk-34VWVEUR.js +341 -0
  4. package/dist/chunk-34VWVEUR.js.map +1 -0
  5. package/dist/chunk-36LQSNHS.js +400 -0
  6. package/dist/chunk-36LQSNHS.js.map +1 -0
  7. package/dist/chunk-642OIIJK.cjs +347 -0
  8. package/dist/chunk-642OIIJK.cjs.map +1 -0
  9. package/dist/chunk-Y6RUU6PO.cjs +406 -0
  10. package/dist/chunk-Y6RUU6PO.cjs.map +1 -0
  11. package/dist/components.cjs +20 -0
  12. package/dist/components.cjs.map +1 -0
  13. package/dist/components.d.cts +69 -0
  14. package/dist/components.d.ts +69 -0
  15. package/dist/components.js +3 -0
  16. package/dist/components.js.map +1 -0
  17. package/dist/generators.cjs +13 -0
  18. package/dist/generators.cjs.map +1 -0
  19. package/dist/generators.d.cts +8 -0
  20. package/dist/generators.d.ts +8 -0
  21. package/dist/generators.js +4 -0
  22. package/dist/generators.js.map +1 -0
  23. package/dist/index.cjs +119 -0
  24. package/dist/index.cjs.map +1 -0
  25. package/dist/index.d.cts +9 -0
  26. package/dist/index.d.ts +9 -0
  27. package/dist/index.js +112 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/types-DXL9Aw6E.d.cts +339 -0
  30. package/dist/types-DXL9Aw6E.d.ts +339 -0
  31. package/package.json +102 -0
  32. package/src/components/Query.tsx +177 -0
  33. package/src/components/QueryKey.tsx +83 -0
  34. package/src/components/QueryOptions.tsx +133 -0
  35. package/src/components/index.ts +3 -0
  36. package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +52 -0
  37. package/src/generators/__snapshots__/clientGetImportPath.ts +52 -0
  38. package/src/generators/__snapshots__/findByTags.ts +52 -0
  39. package/src/generators/__snapshots__/findByTagsObject.ts +61 -0
  40. package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +52 -0
  41. package/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +52 -0
  42. package/src/generators/__snapshots__/findByTagsWithZod.ts +52 -0
  43. package/src/generators/__snapshots__/postAsQuery.ts +51 -0
  44. package/src/generators/index.ts +1 -0
  45. package/src/generators/queryGenerator.tsx +127 -0
  46. package/src/index.ts +2 -0
  47. package/src/plugin.ts +133 -0
  48. package/src/types.ts +106 -0
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ var chunk642OIIJK_cjs = require('./chunk-642OIIJK.cjs');
4
+ require('./chunk-Y6RUU6PO.cjs');
5
+
6
+
7
+
8
+ Object.defineProperty(exports, "queryGenerator", {
9
+ enumerable: true,
10
+ get: function () { return chunk642OIIJK_cjs.queryGenerator; }
11
+ });
12
+ //# sourceMappingURL=generators.cjs.map
13
+ //# sourceMappingURL=generators.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"generators.cjs"}
@@ -0,0 +1,8 @@
1
+ import * as _kubb_plugin_oas from '@kubb/plugin-oas';
2
+ import { P as PluginSolidQuery } from './types-DXL9Aw6E.cjs';
3
+ import '@kubb/core';
4
+ import '@kubb/oas';
5
+
6
+ declare const queryGenerator: _kubb_plugin_oas.Generator<PluginSolidQuery>;
7
+
8
+ export { queryGenerator };
@@ -0,0 +1,8 @@
1
+ import * as _kubb_plugin_oas from '@kubb/plugin-oas';
2
+ import { P as PluginSolidQuery } from './types-DXL9Aw6E.js';
3
+ import '@kubb/core';
4
+ import '@kubb/oas';
5
+
6
+ declare const queryGenerator: _kubb_plugin_oas.Generator<PluginSolidQuery>;
7
+
8
+ export { queryGenerator };
@@ -0,0 +1,4 @@
1
+ export { queryGenerator } from './chunk-34VWVEUR.js';
2
+ import './chunk-36LQSNHS.js';
3
+ //# sourceMappingURL=generators.js.map
4
+ //# sourceMappingURL=generators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"generators.js"}
package/dist/index.cjs ADDED
@@ -0,0 +1,119 @@
1
+ 'use strict';
2
+
3
+ var chunk642OIIJK_cjs = require('./chunk-642OIIJK.cjs');
4
+ var chunkY6RUU6PO_cjs = require('./chunk-Y6RUU6PO.cjs');
5
+ var path = require('path');
6
+ var core = require('@kubb/core');
7
+ var transformers = require('@kubb/core/transformers');
8
+ var pluginOas = require('@kubb/plugin-oas');
9
+ var pluginTs = require('@kubb/plugin-ts');
10
+ var pluginZod = require('@kubb/plugin-zod');
11
+
12
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
13
+
14
+ var path__default = /*#__PURE__*/_interopDefault(path);
15
+
16
+ var pluginSolidQueryName = "plugin-solid-query";
17
+ var pluginSolidQuery = core.createPlugin((options) => {
18
+ const {
19
+ output = { path: "hooks", barrelType: "named" },
20
+ group,
21
+ exclude = [],
22
+ include,
23
+ override = [],
24
+ parser = "client",
25
+ transformers: transformers$1 = {},
26
+ paramsType = "inline",
27
+ pathParamsType = "inline",
28
+ queryKey = chunkY6RUU6PO_cjs.QueryKey.getTransformer,
29
+ generators = [chunk642OIIJK_cjs.queryGenerator].filter(Boolean),
30
+ query = {}
31
+ } = options;
32
+ return {
33
+ name: pluginSolidQueryName,
34
+ options: {
35
+ output,
36
+ client: {
37
+ importPath: "@kubb/plugin-client/client",
38
+ dataReturnType: "data",
39
+ pathParamsType: "inline",
40
+ ...options.client
41
+ },
42
+ queryKey,
43
+ query: {
44
+ methods: ["get"],
45
+ importPath: "@tanstack/solid-query",
46
+ ...query
47
+ },
48
+ paramsType,
49
+ pathParamsType: paramsType === "object" ? "object" : pathParamsType,
50
+ parser
51
+ },
52
+ pre: [pluginOas.pluginOasName, pluginTs.pluginTsName, parser === "zod" ? pluginZod.pluginZodName : void 0].filter(Boolean),
53
+ resolvePath(baseName, pathMode, options2) {
54
+ const root = path__default.default.resolve(this.config.root, this.config.output.path);
55
+ const mode = pathMode ?? core.FileManager.getMode(path__default.default.resolve(root, output.path));
56
+ if (options2?.tag && group?.type === "tag") {
57
+ const groupName = group?.name ? group.name : (ctx) => `${ctx.group}Controller`;
58
+ return path__default.default.resolve(root, output.path, groupName({ group: transformers.camelCase(options2.tag) }), baseName);
59
+ }
60
+ if (mode === "single") {
61
+ return path__default.default.resolve(root, output.path);
62
+ }
63
+ return path__default.default.resolve(root, output.path, baseName);
64
+ },
65
+ resolveName(name, type) {
66
+ let resolvedName = transformers.camelCase(name);
67
+ if (type === "file" || type === "function") {
68
+ resolvedName = transformers.camelCase(name, {
69
+ isFile: type === "file"
70
+ });
71
+ }
72
+ if (type === "type") {
73
+ resolvedName = transformers.pascalCase(name);
74
+ }
75
+ if (type) {
76
+ return transformers$1?.name?.(resolvedName, type) || resolvedName;
77
+ }
78
+ return resolvedName;
79
+ },
80
+ async buildStart() {
81
+ const [swaggerPlugin] = core.PluginManager.getDependedPlugins(this.plugins, [pluginOas.pluginOasName]);
82
+ const oas = await swaggerPlugin.context.getOas();
83
+ const root = path__default.default.resolve(this.config.root, this.config.output.path);
84
+ const mode = core.FileManager.getMode(path__default.default.resolve(root, output.path));
85
+ const baseURL = await swaggerPlugin.context.getBaseURL();
86
+ if (baseURL) {
87
+ this.plugin.options.client.baseURL = baseURL;
88
+ }
89
+ const operationGenerator = new pluginOas.OperationGenerator(this.plugin.options, {
90
+ oas,
91
+ pluginManager: this.pluginManager,
92
+ plugin: this.plugin,
93
+ contentType: swaggerPlugin.context.contentType,
94
+ exclude,
95
+ include,
96
+ override,
97
+ mode
98
+ });
99
+ const files = await operationGenerator.build(...generators);
100
+ await this.addFile(...files);
101
+ const barrelFiles = await this.fileManager.getBarrelFiles({
102
+ type: output.barrelType ?? "named",
103
+ root,
104
+ output,
105
+ files: this.fileManager.files,
106
+ meta: {
107
+ pluginKey: this.plugin.key
108
+ },
109
+ logger: this.logger
110
+ });
111
+ await this.addFile(...barrelFiles);
112
+ }
113
+ };
114
+ });
115
+
116
+ exports.pluginSolidQuery = pluginSolidQuery;
117
+ exports.pluginSolidQueryName = pluginSolidQueryName;
118
+ //# sourceMappingURL=index.cjs.map
119
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/plugin.ts"],"names":["createPlugin","transformers","QueryKey","queryGenerator","pluginOasName","pluginTsName","pluginZodName","options","path","FileManager","camelCase","pascalCase","PluginManager","OperationGenerator"],"mappings":";;;;;;;;;;;;;;;AAeO,IAAM,oBAAuB,GAAA;AAEvB,IAAA,gBAAA,GAAmBA,iBAA+B,CAAA,CAAC,OAAY,KAAA;AAC1E,EAAM,MAAA;AAAA,IACJ,MAAS,GAAA,EAAE,IAAM,EAAA,OAAA,EAAS,YAAY,OAAQ,EAAA;AAAA,IAC9C,KAAA;AAAA,IACA,UAAU,EAAC;AAAA,IACX,OAAA;AAAA,IACA,WAAW,EAAC;AAAA,IACZ,MAAS,GAAA,QAAA;AAAA,kBACTC,iBAAe,EAAC;AAAA,IAChB,UAAa,GAAA,QAAA;AAAA,IACb,cAAiB,GAAA,QAAA;AAAA,IACjB,WAAWC,0BAAS,CAAA,cAAA;AAAA,IACpB,UAAa,GAAA,CAACC,gCAAc,CAAA,CAAE,OAAO,OAAO,CAAA;AAAA,IAC5C,QAAQ;AAAC,GACP,GAAA,OAAA;AAEJ,EAAO,OAAA;AAAA,IACL,IAAM,EAAA,oBAAA;AAAA,IACN,OAAS,EAAA;AAAA,MACP,MAAA;AAAA,MACA,MAAQ,EAAA;AAAA,QACN,UAAY,EAAA,4BAAA;AAAA,QACZ,cAAgB,EAAA,MAAA;AAAA,QAChB,cAAgB,EAAA,QAAA;AAAA,QAChB,GAAG,OAAQ,CAAA;AAAA,OACb;AAAA,MACA,QAAA;AAAA,MACA,KAAO,EAAA;AAAA,QACL,OAAA,EAAS,CAAC,KAAK,CAAA;AAAA,QACf,UAAY,EAAA,uBAAA;AAAA,QACZ,GAAG;AAAA,OACL;AAAA,MACA,UAAA;AAAA,MACA,cAAA,EAAgB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CAAA,MAAA;AAAA,QACb,WAAA,EAAa,cAAc,OAAQ,CAAA,WAAA;AAAA,QACnC,OAAA;AAAA,QACA,OAAA;AAAA,QACA,QAAA;AAAA,QACA;AAAA,OACD,CAAA;AAED,MAAA,MAAM,KAAQ,GAAA,MAAM,kBAAmB,CAAA,KAAA,CAAM,GAAG,UAAU,CAAA;AAC1D,MAAM,MAAA,IAAA,CAAK,OAAQ,CAAA,GAAG,KAAK,CAAA;AAE3B,MAAA,MAAM,WAAc,GAAA,MAAM,IAAK,CAAA,WAAA,CAAY,cAAe,CAAA;AAAA,QACxD,IAAA,EAAM,OAAO,UAAc,IAAA,OAAA;AAAA,QAC3B,IAAA;AAAA,QACA,MAAA;AAAA,QACA,KAAA,EAAO,KAAK,WAAY,CAAA,KAAA;AAAA,QACxB,IAAM,EAAA;AAAA,UACJ,SAAA,EAAW,KAAK,MAAO,CAAA;AAAA,SACzB;AAAA,QACA,QAAQ,IAAK,CAAA;AAAA,OACd,CAAA;AAED,MAAM,MAAA,IAAA,CAAK,OAAQ,CAAA,GAAG,WAAW,CAAA;AAAA;AACnC,GACF;AACF,CAAC","file":"index.cjs","sourcesContent":["import path from 'node:path'\n\nimport { FileManager, type Group, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\n\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginOas } from '@kubb/plugin-oas'\nimport { QueryKey } from './components'\nimport { queryGenerator } from './generators'\nimport type { PluginSolidQuery } from './types.ts'\n\nexport const pluginSolidQueryName = 'plugin-solid-query' satisfies PluginSolidQuery['name']\n\nexport const pluginSolidQuery = createPlugin<PluginSolidQuery>((options) => {\n const {\n output = { path: 'hooks', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n parser = 'client',\n transformers = {},\n paramsType = 'inline',\n pathParamsType = 'inline',\n queryKey = QueryKey.getTransformer,\n generators = [queryGenerator].filter(Boolean),\n query = {},\n } = options\n\n return {\n name: pluginSolidQueryName,\n options: {\n output,\n client: {\n importPath: '@kubb/plugin-client/client',\n dataReturnType: 'data',\n pathParamsType: 'inline',\n ...options.client,\n },\n queryKey,\n query: {\n methods: ['get'],\n importPath: '@tanstack/solid-query',\n ...query,\n },\n paramsType,\n pathParamsType: paramsType === 'object' ? 'object' : pathParamsType,\n parser,\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 ?? FileManager.getMode(path.resolve(root, output.path))\n\n if (options?.tag && group?.type === 'tag') {\n const groupName: Group['name'] = group?.name ? group.name : (ctx) => `${ctx.group}Controller`\n\n return path.resolve(root, output.path, groupName({ group: camelCase(options.tag) }), baseName)\n }\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 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 buildStart() {\n const [swaggerPlugin]: [Plugin<PluginOas>] = PluginManager.getDependedPlugins<PluginOas>(this.plugins, [pluginOasName])\n\n const oas = await swaggerPlugin.context.getOas()\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = FileManager.getMode(path.resolve(root, output.path))\n const baseURL = await swaggerPlugin.context.getBaseURL()\n\n if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType: swaggerPlugin.context.contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const files = await operationGenerator.build(...generators)\n await this.addFile(...files)\n\n const barrelFiles = await this.fileManager.getBarrelFiles({\n type: output.barrelType ?? 'named',\n root,\n output,\n files: this.fileManager.files,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.addFile(...barrelFiles)\n },\n }\n})\n"]}
@@ -0,0 +1,9 @@
1
+ import * as _kubb_core from '@kubb/core';
2
+ import { O as Options, P as PluginSolidQuery } from './types-DXL9Aw6E.cjs';
3
+ import '@kubb/oas';
4
+ import '@kubb/plugin-oas';
5
+
6
+ declare const pluginSolidQueryName = "plugin-solid-query";
7
+ declare const pluginSolidQuery: (options?: Options | undefined) => _kubb_core.UserPluginWithLifeCycle<PluginSolidQuery>;
8
+
9
+ export { PluginSolidQuery, pluginSolidQuery, pluginSolidQueryName };
@@ -0,0 +1,9 @@
1
+ import * as _kubb_core from '@kubb/core';
2
+ import { O as Options, P as PluginSolidQuery } from './types-DXL9Aw6E.js';
3
+ import '@kubb/oas';
4
+ import '@kubb/plugin-oas';
5
+
6
+ declare const pluginSolidQueryName = "plugin-solid-query";
7
+ declare const pluginSolidQuery: (options?: Options | undefined) => _kubb_core.UserPluginWithLifeCycle<PluginSolidQuery>;
8
+
9
+ export { PluginSolidQuery, pluginSolidQuery, pluginSolidQueryName };
package/dist/index.js ADDED
@@ -0,0 +1,112 @@
1
+ import { queryGenerator } from './chunk-34VWVEUR.js';
2
+ import { QueryKey } from './chunk-36LQSNHS.js';
3
+ import path from 'node:path';
4
+ import { createPlugin, FileManager, PluginManager } from '@kubb/core';
5
+ import { camelCase, pascalCase } from '@kubb/core/transformers';
6
+ import { pluginOasName, OperationGenerator } from '@kubb/plugin-oas';
7
+ import { pluginTsName } from '@kubb/plugin-ts';
8
+ import { pluginZodName } from '@kubb/plugin-zod';
9
+
10
+ var pluginSolidQueryName = "plugin-solid-query";
11
+ var pluginSolidQuery = createPlugin((options) => {
12
+ const {
13
+ output = { path: "hooks", barrelType: "named" },
14
+ group,
15
+ exclude = [],
16
+ include,
17
+ override = [],
18
+ parser = "client",
19
+ transformers = {},
20
+ paramsType = "inline",
21
+ pathParamsType = "inline",
22
+ queryKey = QueryKey.getTransformer,
23
+ generators = [queryGenerator].filter(Boolean),
24
+ query = {}
25
+ } = options;
26
+ return {
27
+ name: pluginSolidQueryName,
28
+ options: {
29
+ output,
30
+ client: {
31
+ importPath: "@kubb/plugin-client/client",
32
+ dataReturnType: "data",
33
+ pathParamsType: "inline",
34
+ ...options.client
35
+ },
36
+ queryKey,
37
+ query: {
38
+ methods: ["get"],
39
+ importPath: "@tanstack/solid-query",
40
+ ...query
41
+ },
42
+ paramsType,
43
+ pathParamsType: paramsType === "object" ? "object" : pathParamsType,
44
+ parser
45
+ },
46
+ pre: [pluginOasName, pluginTsName, parser === "zod" ? pluginZodName : void 0].filter(Boolean),
47
+ resolvePath(baseName, pathMode, options2) {
48
+ const root = path.resolve(this.config.root, this.config.output.path);
49
+ const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path));
50
+ if (options2?.tag && group?.type === "tag") {
51
+ const groupName = group?.name ? group.name : (ctx) => `${ctx.group}Controller`;
52
+ return path.resolve(root, output.path, groupName({ group: camelCase(options2.tag) }), baseName);
53
+ }
54
+ if (mode === "single") {
55
+ return path.resolve(root, output.path);
56
+ }
57
+ return path.resolve(root, output.path, baseName);
58
+ },
59
+ resolveName(name, type) {
60
+ let resolvedName = camelCase(name);
61
+ if (type === "file" || type === "function") {
62
+ resolvedName = camelCase(name, {
63
+ isFile: type === "file"
64
+ });
65
+ }
66
+ if (type === "type") {
67
+ resolvedName = pascalCase(name);
68
+ }
69
+ if (type) {
70
+ return transformers?.name?.(resolvedName, type) || resolvedName;
71
+ }
72
+ return resolvedName;
73
+ },
74
+ async buildStart() {
75
+ const [swaggerPlugin] = PluginManager.getDependedPlugins(this.plugins, [pluginOasName]);
76
+ const oas = await swaggerPlugin.context.getOas();
77
+ const root = path.resolve(this.config.root, this.config.output.path);
78
+ const mode = FileManager.getMode(path.resolve(root, output.path));
79
+ const baseURL = await swaggerPlugin.context.getBaseURL();
80
+ if (baseURL) {
81
+ this.plugin.options.client.baseURL = baseURL;
82
+ }
83
+ const operationGenerator = new OperationGenerator(this.plugin.options, {
84
+ oas,
85
+ pluginManager: this.pluginManager,
86
+ plugin: this.plugin,
87
+ contentType: swaggerPlugin.context.contentType,
88
+ exclude,
89
+ include,
90
+ override,
91
+ mode
92
+ });
93
+ const files = await operationGenerator.build(...generators);
94
+ await this.addFile(...files);
95
+ const barrelFiles = await this.fileManager.getBarrelFiles({
96
+ type: output.barrelType ?? "named",
97
+ root,
98
+ output,
99
+ files: this.fileManager.files,
100
+ meta: {
101
+ pluginKey: this.plugin.key
102
+ },
103
+ logger: this.logger
104
+ });
105
+ await this.addFile(...barrelFiles);
106
+ }
107
+ };
108
+ });
109
+
110
+ export { pluginSolidQuery, pluginSolidQueryName };
111
+ //# sourceMappingURL=index.js.map
112
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/plugin.ts"],"names":["options"],"mappings":";;;;;;;;;AAeO,IAAM,oBAAuB,GAAA;AAEvB,IAAA,gBAAA,GAAmB,YAA+B,CAAA,CAAC,OAAY,KAAA;AAC1E,EAAM,MAAA;AAAA,IACJ,MAAS,GAAA,EAAE,IAAM,EAAA,OAAA,EAAS,YAAY,OAAQ,EAAA;AAAA,IAC9C,KAAA;AAAA,IACA,UAAU,EAAC;AAAA,IACX,OAAA;AAAA,IACA,WAAW,EAAC;AAAA,IACZ,MAAS,GAAA,QAAA;AAAA,IACT,eAAe,EAAC;AAAA,IAChB,UAAa,GAAA,QAAA;AAAA,IACb,cAAiB,GAAA,QAAA;AAAA,IACjB,WAAW,QAAS,CAAA,cAAA;AAAA,IACpB,UAAa,GAAA,CAAC,cAAc,CAAA,CAAE,O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AA,IAAA,GAAO,YAAY,OAAQ,CAAA,IAAA,CAAK,QAAQ,IAAM,EAAA,MAAA,CAAO,IAAI,CAAC,CAAA;AAChE,MAAA,MAAM,OAAU,GAAA,MAAM,aAAc,CAAA,OAAA,CAAQ,UAAW,EAAA;AAEvD,MAAA,IAAI,OAAS,EAAA;AACX,QAAK,IAAA,CAAA,MAAA,CAAO,OAAQ,CAAA,MAAA,CAAO,OAAU,GAAA,OAAA;AAAA;AAGvC,MAAA,MAAM,kBAAqB,GAAA,IAAI,kBAAmB,CAAA,IAAA,CAAK,OAAO,OAAS,EAAA;AAAA,QACrE,GAAA;AAAA,QACA,eAAe,IAAK,CAAA,aAAA;AAAA,QACpB,QAAQ,IAAK,CAAA,MAAA;AAAA,QACb,WAAA,EAAa,cAAc,OAAQ,CAAA,WAAA;AAAA,QACnC,OAAA;AAAA,QACA,OAAA;AAAA,QACA,QAAA;AAAA,QACA;AAAA,OACD,CAAA;AAED,MAAA,MAAM,KAAQ,GAAA,MAAM,kBAAmB,CAAA,KAAA,CAAM,GAAG,UAAU,CAAA;AAC1D,MAAM,MAAA,IAAA,CAAK,OAAQ,CAAA,GAAG,KAAK,CAAA;AAE3B,MAAA,MAAM,WAAc,GAAA,MAAM,IAAK,CAAA,WAAA,CAAY,cAAe,CAAA;AAAA,QACxD,IAAA,EAAM,OAAO,UAAc,IAAA,OAAA;AAAA,QAC3B,IAAA;AAAA,QACA,MAAA;AAAA,QACA,KAAA,EAAO,KAAK,WAAY,CAAA,KAAA;AAAA,QACxB,IAAM,EAAA;AAAA,UACJ,SAAA,EAAW,KAAK,MAAO,CAAA;AAAA,SACzB;AAAA,QACA,QAAQ,IAAK,CAAA;AAAA,OACd,CAAA;AAED,MAAM,MAAA,IAAA,CAAK,OAAQ,CAAA,GAAG,WAAW,CAAA;AAAA;AACnC,GACF;AACF,CAAC","file":"index.js","sourcesContent":["import path from 'node:path'\n\nimport { FileManager, type Group, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\n\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginOas } from '@kubb/plugin-oas'\nimport { QueryKey } from './components'\nimport { queryGenerator } from './generators'\nimport type { PluginSolidQuery } from './types.ts'\n\nexport const pluginSolidQueryName = 'plugin-solid-query' satisfies PluginSolidQuery['name']\n\nexport const pluginSolidQuery = createPlugin<PluginSolidQuery>((options) => {\n const {\n output = { path: 'hooks', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n parser = 'client',\n transformers = {},\n paramsType = 'inline',\n pathParamsType = 'inline',\n queryKey = QueryKey.getTransformer,\n generators = [queryGenerator].filter(Boolean),\n query = {},\n } = options\n\n return {\n name: pluginSolidQueryName,\n options: {\n output,\n client: {\n importPath: '@kubb/plugin-client/client',\n dataReturnType: 'data',\n pathParamsType: 'inline',\n ...options.client,\n },\n queryKey,\n query: {\n methods: ['get'],\n importPath: '@tanstack/solid-query',\n ...query,\n },\n paramsType,\n pathParamsType: paramsType === 'object' ? 'object' : pathParamsType,\n parser,\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 ?? FileManager.getMode(path.resolve(root, output.path))\n\n if (options?.tag && group?.type === 'tag') {\n const groupName: Group['name'] = group?.name ? group.name : (ctx) => `${ctx.group}Controller`\n\n return path.resolve(root, output.path, groupName({ group: camelCase(options.tag) }), baseName)\n }\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 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 buildStart() {\n const [swaggerPlugin]: [Plugin<PluginOas>] = PluginManager.getDependedPlugins<PluginOas>(this.plugins, [pluginOasName])\n\n const oas = await swaggerPlugin.context.getOas()\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = FileManager.getMode(path.resolve(root, output.path))\n const baseURL = await swaggerPlugin.context.getBaseURL()\n\n if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType: swaggerPlugin.context.contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const files = await operationGenerator.build(...generators)\n await this.addFile(...files)\n\n const barrelFiles = await this.fileManager.getBarrelFiles({\n type: output.barrelType ?? 'named',\n root,\n output,\n files: this.fileManager.files,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.addFile(...barrelFiles)\n },\n }\n})\n"]}
@@ -0,0 +1,339 @@
1
+ import { PluginFactoryOptions, Output, Group, ResolveNameParams } from '@kubb/core';
2
+ import { HttpMethod, Operation } from '@kubb/oas';
3
+ import { ResolvePathOptions, Exclude, Include, Override, Generator, OperationSchemas } from '@kubb/plugin-oas';
4
+
5
+ type Options$2 = {
6
+ /**
7
+ * Specify the export location for the files and define the behavior of the output
8
+ * @default { path: 'clients', barrelType: 'named' }
9
+ */
10
+ output?: Output;
11
+ /**
12
+ * Group the clients based on the provided name.
13
+ */
14
+ group?: Group;
15
+ /**
16
+ * Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
17
+ */
18
+ exclude?: Array<Exclude>;
19
+ /**
20
+ * Array containing include parameters to include tags/operations/methods/paths.
21
+ */
22
+ include?: Array<Include>;
23
+ /**
24
+ * Array containing override parameters to override `options` based on tags/operations/methods/paths.
25
+ */
26
+ override?: Array<Override<ResolvedOptions$2>>;
27
+ /**
28
+ * Create `operations.ts` file with all operations grouped by methods.
29
+ * @default false
30
+ */
31
+ operations?: boolean;
32
+ /**
33
+ * Path to the client import path that will be used to do the API calls.
34
+ * It will be used as `import client from '${client.importPath}'`.
35
+ * It allows both relative and absolute path but be aware that we will not change the path.
36
+ * @default '@kubb/plugin-client/client'
37
+ */
38
+ importPath?: string;
39
+ /**
40
+ * Allows you to set a custom base url for all generated calls.
41
+ */
42
+ baseURL?: string;
43
+ /**
44
+ * ReturnType that will be used when calling the client.
45
+ * - 'data' will return ResponseConfig[data].
46
+ * - 'full' will return ResponseConfig.
47
+ * @default 'data'
48
+ */
49
+ dataReturnType?: 'data' | 'full';
50
+ /**
51
+ * How to pass your params
52
+ * - 'object' will return the params and pathParams as an object.
53
+ * - 'inline' will return the params as comma separated params.
54
+ * @default 'inline'
55
+ */
56
+ paramsType?: 'object' | 'inline';
57
+ /**
58
+ * How to pass your pathParams.
59
+ * - 'object' will return the pathParams as an object.
60
+ * - 'inline' will return the pathParams as comma separated params.
61
+ * @default 'inline'
62
+ */
63
+ pathParamsType?: 'object' | 'inline';
64
+ /**
65
+ * Which parser can be used before returning the data
66
+ * - 'zod' will use `@kubb/plugin-zod` to parse the data.
67
+ * @default 'client'
68
+ */
69
+ parser?: 'client' | 'zod';
70
+ transformers?: {
71
+ /**
72
+ * Customize the names based on the type that is provided by the plugin.
73
+ */
74
+ name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
75
+ };
76
+ /**
77
+ * Define some generators next to the client generators
78
+ */
79
+ generators?: Array<Generator<PluginClient>>;
80
+ };
81
+ type ResolvedOptions$2 = {
82
+ output: Output;
83
+ group?: Options$2['group'];
84
+ baseURL: string | undefined;
85
+ parser: NonNullable<Options$2['parser']>;
86
+ importPath: NonNullable<Options$2['importPath']>;
87
+ dataReturnType: NonNullable<Options$2['dataReturnType']>;
88
+ pathParamsType: NonNullable<Options$2['pathParamsType']>;
89
+ paramsType: NonNullable<Options$2['paramsType']>;
90
+ };
91
+ type PluginClient = PluginFactoryOptions<'plugin-client', Options$2, ResolvedOptions$2, never, ResolvePathOptions>;
92
+
93
+ type TransformerProps$1 = {
94
+ operation: Operation;
95
+ schemas: OperationSchemas;
96
+ };
97
+ type Transformer$1 = (props: TransformerProps$1) => unknown[];
98
+ type Suspense = object;
99
+ /**
100
+ * Customize the queryKey
101
+ */
102
+ type QueryKey$1 = Transformer$1;
103
+ /**
104
+ * Customize the mutationKey
105
+ */
106
+ type MutationKey = Transformer$1;
107
+ type Query$1 = {
108
+ /**
109
+ * Define which HttpMethods can be used for queries
110
+ * @default ['get']
111
+ */
112
+ methods: Array<HttpMethod>;
113
+ /**
114
+ * Path to the useQuery that will be used to do the useQuery functionality.
115
+ * It will be used as `import { useQuery } from '${importPath}'`.
116
+ * It allows both relative and absolute path.
117
+ * the path will be applied as is, so relative path should be based on the file being generated.
118
+ * @default '@tanstack/react-query'
119
+ */
120
+ importPath?: string;
121
+ };
122
+ type Mutation = {
123
+ /**
124
+ * Define which HttpMethods can be used for mutations
125
+ * @default ['post', 'put', 'delete']
126
+ */
127
+ methods: Array<HttpMethod>;
128
+ /**
129
+ * Path to the useQuery that will be used to do the useQuery functionality.
130
+ * It will be used as `import { useQuery } from '${importPath}'`.
131
+ * It allows both relative and absolute path.
132
+ * the path will be applied as is, so relative path should be based on the file being generated.
133
+ * @default '@tanstack/react-query'
134
+ */
135
+ importPath?: string;
136
+ };
137
+ type Infinite = {
138
+ /**
139
+ * Specify the params key used for `pageParam`.
140
+ * @default 'id'
141
+ */
142
+ queryParam: string;
143
+ /**
144
+ * Which field of the data will be used, set it to undefined when no cursor is known.
145
+ */
146
+ cursorParam?: string | undefined;
147
+ /**
148
+ * The initial value, the value of the first page.
149
+ * @default 0
150
+ */
151
+ initialPageParam: unknown;
152
+ };
153
+ type Options$1 = {
154
+ /**
155
+ * Specify the export location for the files and define the behavior of the output
156
+ * @default { path: 'hooks', barrelType: 'named' }
157
+ */
158
+ output?: Output;
159
+ /**
160
+ * Group the @tanstack/query hooks based on the provided name.
161
+ */
162
+ group?: Group;
163
+ client?: Pick<PluginClient['options'], 'dataReturnType' | 'importPath' | 'baseURL'>;
164
+ /**
165
+ * Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
166
+ */
167
+ exclude?: Array<Exclude>;
168
+ /**
169
+ * Array containing include parameters to include tags/operations/methods/paths.
170
+ */
171
+ include?: Array<Include>;
172
+ /**
173
+ * Array containing override parameters to override `options` based on tags/operations/methods/paths.
174
+ */
175
+ override?: Array<Override<ResolvedOptions$1>>;
176
+ /**
177
+ * How to pass your params
178
+ * - 'object' will return the params and pathParams as an object.
179
+ * - 'inline' will return the params as comma separated params.
180
+ * @default 'inline'
181
+ */
182
+ paramsType?: 'object' | 'inline';
183
+ /**
184
+ * How to pass your pathParams.
185
+ * - 'object' will return the pathParams as an object.
186
+ * - 'inline' will return the pathParams as comma separated params.
187
+ * @default 'inline'
188
+ */
189
+ pathParamsType?: PluginClient['options']['pathParamsType'];
190
+ /**
191
+ * When set, an infiniteQuery hooks will be added.
192
+ */
193
+ infinite?: Partial<Infinite> | false;
194
+ /**
195
+ * When set, a suspenseQuery hooks will be added.
196
+ */
197
+ suspense?: Partial<Suspense> | false;
198
+ queryKey?: QueryKey$1;
199
+ /**
200
+ * Override some useQuery behaviours.
201
+ */
202
+ query?: Partial<Query$1> | false;
203
+ mutationKey?: MutationKey;
204
+ /**
205
+ * Override some useMutation behaviours.
206
+ */
207
+ mutation?: Partial<Mutation> | false;
208
+ /**
209
+ * Which parser should be used before returning the data to `@tanstack/query`.
210
+ * `'zod'` will use `@kubb/plugin-zod` to parse the data.
211
+ */
212
+ parser?: PluginClient['options']['parser'];
213
+ transformers?: {
214
+ /**
215
+ * Customize the names based on the type that is provided by the plugin.
216
+ */
217
+ name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
218
+ };
219
+ /**
220
+ * Define some generators next to the react-query generators
221
+ */
222
+ generators?: Array<Generator<PluginReactQuery>>;
223
+ };
224
+ type ResolvedOptions$1 = {
225
+ output: Output;
226
+ client: Required<Omit<NonNullable<PluginReactQuery['options']['client']>, 'baseURL'>> & {
227
+ baseURL?: string;
228
+ };
229
+ parser: Required<NonNullable<Options$1['parser']>>;
230
+ pathParamsType: NonNullable<Options$1['pathParamsType']>;
231
+ paramsType: NonNullable<Options$1['paramsType']>;
232
+ /**
233
+ * Only used of infinite
234
+ */
235
+ infinite: NonNullable<Infinite> | false;
236
+ suspense: Suspense | false;
237
+ queryKey: QueryKey$1 | undefined;
238
+ query: NonNullable<Required<Query$1>> | false;
239
+ mutationKey: MutationKey | undefined;
240
+ mutation: NonNullable<Required<Mutation>> | false;
241
+ };
242
+ type PluginReactQuery = PluginFactoryOptions<'plugin-react-query', Options$1, ResolvedOptions$1, never, ResolvePathOptions>;
243
+
244
+ type TransformerProps = {
245
+ operation: Operation;
246
+ schemas: OperationSchemas;
247
+ };
248
+ type Transformer = (props: TransformerProps) => unknown[];
249
+ /**
250
+ * Customize the queryKey
251
+ */
252
+ type QueryKey = Transformer;
253
+ type Query = {
254
+ /**
255
+ * Define which HttpMethods can be used for queries
256
+ * @default ['get']
257
+ */
258
+ methods: Array<HttpMethod>;
259
+ /**
260
+ * Path to the useQuery that will be used to do the useQuery functionality.
261
+ * It will be used as `import { useQuery } from '${importPath}'`.
262
+ * It allows both relative and absolute path.
263
+ * the path will be applied as is, so relative path should be based on the file being generated.
264
+ * @default '@tanstack/svelte-query'
265
+ */
266
+ importPath?: string;
267
+ };
268
+ type Options = {
269
+ /**
270
+ * Specify the export location for the files and define the behavior of the output
271
+ * @default { path: 'hooks', barrelType: 'named' }
272
+ */
273
+ output?: Output;
274
+ /**
275
+ * Group the @tanstack/query hooks based on the provided name.
276
+ */
277
+ group?: Group;
278
+ client?: Pick<PluginClient['options'], 'dataReturnType' | 'importPath' | 'baseURL'>;
279
+ /**
280
+ * Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
281
+ */
282
+ exclude?: Array<Exclude>;
283
+ /**
284
+ * Array containing include parameters to include tags/operations/methods/paths.
285
+ */
286
+ include?: Array<Include>;
287
+ /**
288
+ * Array containing override parameters to override `options` based on tags/operations/methods/paths.
289
+ */
290
+ override?: Array<Override<ResolvedOptions>>;
291
+ /**
292
+ * How to pass your params
293
+ * - 'object' will return the params and pathParams as an object.
294
+ * - 'inline' will return the params as comma separated params.
295
+ * @default 'inline'
296
+ */
297
+ paramsType?: 'object' | 'inline';
298
+ /**
299
+ * How to pass your pathParams.
300
+ * - 'object' will return the pathParams as an object.
301
+ * - 'inline' will return the pathParams as comma separated params.
302
+ * @default 'inline'
303
+ */
304
+ pathParamsType?: PluginClient['options']['pathParamsType'];
305
+ queryKey?: QueryKey;
306
+ /**
307
+ * Override some useQuery behaviours.
308
+ */
309
+ query?: Partial<Query> | false;
310
+ /**
311
+ * Which parser should be used before returning the data to `@tanstack/query`.
312
+ * `'zod'` will use `@kubb/plugin-zod` to parse the data.
313
+ */
314
+ parser?: PluginClient['options']['parser'];
315
+ transformers?: {
316
+ /**
317
+ * Customize the names based on the type that is provided by the plugin.
318
+ */
319
+ name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
320
+ };
321
+ /**
322
+ * Define some generators next to the solid-query generators
323
+ */
324
+ generators?: Array<Generator<PluginSolidQuery>>;
325
+ };
326
+ type ResolvedOptions = {
327
+ output: Output;
328
+ client: Required<Omit<NonNullable<PluginReactQuery['options']['client']>, 'baseURL'>> & {
329
+ baseURL?: string;
330
+ };
331
+ parser: Required<NonNullable<Options['parser']>>;
332
+ paramsType: NonNullable<Options['paramsType']>;
333
+ pathParamsType: NonNullable<Options['pathParamsType']>;
334
+ queryKey: QueryKey | undefined;
335
+ query: NonNullable<Required<Query>> | false;
336
+ };
337
+ type PluginSolidQuery = PluginFactoryOptions<'plugin-solid-query', Options, ResolvedOptions, never, ResolvePathOptions>;
338
+
339
+ export type { Options as O, PluginSolidQuery as P, Transformer as T };