@kubb/plugin-solid-query 3.0.0-alpha.31 → 3.0.0-beta.10

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 (38) hide show
  1. package/README.md +1 -1
  2. package/dist/{chunk-KFG7HL6L.js → chunk-2B3CNYIU.js} +121 -18
  3. package/dist/chunk-2B3CNYIU.js.map +1 -0
  4. package/dist/{chunk-QGUTANLN.cjs → chunk-HUXVNH7U.cjs} +19 -14
  5. package/dist/chunk-HUXVNH7U.cjs.map +1 -0
  6. package/dist/{chunk-P7AOAIRQ.js → chunk-QBNAYIIT.js} +13 -8
  7. package/dist/chunk-QBNAYIIT.js.map +1 -0
  8. package/dist/{chunk-PZTHP4L4.cjs → chunk-SEUXRTS6.cjs} +121 -18
  9. package/dist/chunk-SEUXRTS6.cjs.map +1 -0
  10. package/dist/components.cjs +4 -4
  11. package/dist/components.d.cts +9 -5
  12. package/dist/components.d.ts +9 -5
  13. package/dist/components.js +1 -1
  14. package/dist/generators.cjs +3 -3
  15. package/dist/generators.d.cts +1 -1
  16. package/dist/generators.d.ts +1 -1
  17. package/dist/generators.js +2 -2
  18. package/dist/index.cjs +6 -5
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.cts +1 -1
  21. package/dist/index.d.ts +1 -1
  22. package/dist/index.js +5 -4
  23. package/dist/index.js.map +1 -1
  24. package/dist/types-Dkr7mW4t.d.cts +176 -0
  25. package/dist/types-Dkr7mW4t.d.ts +176 -0
  26. package/package.json +14 -14
  27. package/src/components/Query.tsx +62 -6
  28. package/src/components/QueryOptions.tsx +47 -7
  29. package/src/generators/__snapshots__/findByTagsObject.ts +61 -0
  30. package/src/generators/queryGenerator.tsx +3 -1
  31. package/src/plugin.ts +3 -2
  32. package/src/types.ts +18 -40
  33. package/dist/chunk-KFG7HL6L.js.map +0 -1
  34. package/dist/chunk-P7AOAIRQ.js.map +0 -1
  35. package/dist/chunk-PZTHP4L4.cjs.map +0 -1
  36. package/dist/chunk-QGUTANLN.cjs.map +0 -1
  37. package/dist/types-C9PoljlD.d.cts +0 -114
  38. package/dist/types-C9PoljlD.d.ts +0 -114
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _kubb_core from '@kubb/core';
2
- import { O as Options, P as PluginSolidQuery } from './types-C9PoljlD.js';
2
+ import { O as Options, P as PluginSolidQuery } from './types-Dkr7mW4t.js';
3
3
  import '@kubb/oas';
4
4
  import '@kubb/plugin-oas';
5
5
 
package/dist/index.js CHANGED
@@ -1,9 +1,8 @@
1
- import { queryGenerator } from './chunk-P7AOAIRQ.js';
2
- import './chunk-KFG7HL6L.js';
1
+ import { queryGenerator } from './chunk-QBNAYIIT.js';
2
+ import './chunk-2B3CNYIU.js';
3
3
  import path from 'node:path';
4
4
  import { createPlugin, FileManager, PluginManager } from '@kubb/core';
5
5
  import { camelCase, pascalCase } from '@kubb/core/transformers';
6
- import '@kubb/core/utils';
7
6
  import { pluginOasName, OperationGenerator } from '@kubb/plugin-oas';
8
7
  import { pluginTsName } from '@kubb/plugin-ts';
9
8
  import { pluginZodName } from '@kubb/plugin-zod';
@@ -18,6 +17,7 @@ var pluginSolidQuery = createPlugin((options) => {
18
17
  override = [],
19
18
  parser = "client",
20
19
  transformers = {},
20
+ paramsType = "inline",
21
21
  pathParamsType = "inline",
22
22
  generators = [queryGenerator].filter(Boolean),
23
23
  query = {}
@@ -39,7 +39,8 @@ var pluginSolidQuery = createPlugin((options) => {
39
39
  importPath: "@tanstack/solid-query",
40
40
  ...query
41
41
  },
42
- pathParamsType,
42
+ paramsType,
43
+ pathParamsType: paramsType === "object" ? "object" : pathParamsType,
43
44
  parser
44
45
  },
45
46
  pre: [pluginOasName, pluginTsName, parser === "zod" ? pluginZodName : void 0].filter(Boolean),
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/plugin.ts"],"names":["options"],"mappings":";;;;;;;;;;AAeO,IAAM,oBAAuB,GAAA,q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AA,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,GAAA;AAAA,SACzB;AAAA,QACA,QAAQ,IAAK,CAAA,MAAA;AAAA,OACd,CAAA,CAAA;AAED,MAAM,MAAA,IAAA,CAAK,OAAQ,CAAA,GAAG,WAAW,CAAA,CAAA;AAAA,KACnC;AAAA,GACF,CAAA;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 { renderTemplate } from '@kubb/core/utils'\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 { 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 pathParamsType = 'inline',\n generators = [queryGenerator].filter(Boolean),\n query = {},\n } = options\n\n return {\n name: pluginSolidQueryName,\n options: {\n output,\n baseURL: undefined,\n client: {\n importPath: '@kubb/plugin-client/client',\n dataReturnType: 'data',\n pathParamsType: 'inline',\n ...options.client,\n },\n query: {\n key: (key: unknown[]) => key,\n methods: ['get'],\n importPath: '@tanstack/solid-query',\n ...query,\n },\n 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 const operationGenerator = new OperationGenerator(\n {\n ...this.plugin.options,\n baseURL,\n },\n {\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\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"]}
1
+ {"version":3,"sources":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AA,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 { 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 generators = [queryGenerator].filter(Boolean),\n query = {},\n } = options\n\n return {\n name: pluginSolidQueryName,\n options: {\n output,\n baseURL: undefined,\n client: {\n importPath: '@kubb/plugin-client/client',\n dataReturnType: 'data',\n pathParamsType: 'inline',\n ...options.client,\n },\n query: {\n key: (key: unknown[]) => key,\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 const operationGenerator = new OperationGenerator(\n {\n ...this.plugin.options,\n baseURL,\n },\n {\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\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,176 @@
1
+ import { PluginFactoryOptions, Output, Group, ResolveNameParams } from '@kubb/core';
2
+ import { HttpMethod } from '@kubb/oas';
3
+ import { ResolvePathOptions, Exclude, Include, Override, Generator } from '@kubb/plugin-oas';
4
+
5
+ type Options$1 = {
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$1>>;
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
+ * ReturnType that will be used when calling the client.
41
+ * - 'data' will return ResponseConfig[data].
42
+ * - 'full' will return ResponseConfig.
43
+ * @default 'data'
44
+ */
45
+ dataReturnType?: 'data' | 'full';
46
+ /**
47
+ * How to pass your params
48
+ * - 'object' will return the params and pathParams as an object.
49
+ * - 'inline' will return the params as comma separated params.
50
+ * @default 'inline'
51
+ */
52
+ paramsType?: 'object' | 'inline';
53
+ /**
54
+ * How to pass your pathParams.
55
+ * - 'object' will return the pathParams as an object.
56
+ * - 'inline' will return the pathParams as comma separated params.
57
+ * @default 'inline'
58
+ */
59
+ pathParamsType?: 'object' | 'inline';
60
+ /**
61
+ * Which parser can be used before returning the data
62
+ * - 'zod' will use `@kubb/plugin-zod` to parse the data.
63
+ * @default 'client'
64
+ */
65
+ parser?: 'client' | 'zod';
66
+ transformers?: {
67
+ /**
68
+ * Customize the names based on the type that is provided by the plugin.
69
+ */
70
+ name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
71
+ };
72
+ /**
73
+ * Define some generators next to the client generators
74
+ */
75
+ generators?: Array<Generator<PluginClient>>;
76
+ };
77
+ type ResolvedOptions$1 = {
78
+ output: Output;
79
+ group?: Options$1['group'];
80
+ baseURL: string | undefined;
81
+ parser: NonNullable<Options$1['parser']>;
82
+ importPath: NonNullable<Options$1['importPath']>;
83
+ dataReturnType: NonNullable<Options$1['dataReturnType']>;
84
+ pathParamsType: NonNullable<Options$1['pathParamsType']>;
85
+ paramsType: NonNullable<Options$1['paramsType']>;
86
+ };
87
+ type PluginClient = PluginFactoryOptions<'plugin-client', Options$1, ResolvedOptions$1, never, ResolvePathOptions>;
88
+
89
+ type Query = {
90
+ /**
91
+ * Customize the queryKey, here you can specify a suffix.
92
+ */
93
+ key: (key: unknown[]) => unknown[];
94
+ /**
95
+ * Define which HttpMethods can be used for queries
96
+ * @default ['get']
97
+ */
98
+ methods: Array<HttpMethod>;
99
+ /**
100
+ * Path to the useQuery that will be used to do the useQuery functionality.
101
+ * It will be used as `import { useQuery } from '${importPath}'`.
102
+ * It allows both relative and absolute path.
103
+ * the path will be applied as is, so relative path should be based on the file being generated.
104
+ * @default '@tanstack/svelte-query'
105
+ */
106
+ importPath?: string;
107
+ };
108
+ type Options = {
109
+ /**
110
+ * Specify the export location for the files and define the behavior of the output
111
+ * @default { path: 'hooks', barrelType: 'named' }
112
+ */
113
+ output?: Output;
114
+ /**
115
+ * Group the @tanstack/query hooks based on the provided name.
116
+ */
117
+ group?: Group;
118
+ client?: Pick<PluginClient['options'], 'dataReturnType' | 'importPath'>;
119
+ /**
120
+ * Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
121
+ */
122
+ exclude?: Array<Exclude>;
123
+ /**
124
+ * Array containing include parameters to include tags/operations/methods/paths.
125
+ */
126
+ include?: Array<Include>;
127
+ /**
128
+ * Array containing override parameters to override `options` based on tags/operations/methods/paths.
129
+ */
130
+ override?: Array<Override<ResolvedOptions>>;
131
+ /**
132
+ * How to pass your params
133
+ * - 'object' will return the params and pathParams as an object.
134
+ * - 'inline' will return the params as comma separated params.
135
+ * @default 'inline'
136
+ */
137
+ paramsType?: 'object' | 'inline';
138
+ /**
139
+ * How to pass your pathParams.
140
+ * - 'object' will return the pathParams as an object.
141
+ * - 'inline' will return the pathParams as comma separated params.
142
+ * @default 'inline'
143
+ */
144
+ pathParamsType?: PluginClient['options']['pathParamsType'];
145
+ /**
146
+ * Override some useQuery behaviours.
147
+ */
148
+ query?: Partial<Query> | false;
149
+ /**
150
+ * Which parser should be used before returning the data to `@tanstack/query`.
151
+ * `'zod'` will use `@kubb/plugin-zod` to parse the data.
152
+ */
153
+ parser?: PluginClient['options']['parser'];
154
+ transformers?: {
155
+ /**
156
+ * Customize the names based on the type that is provided by the plugin.
157
+ */
158
+ name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
159
+ };
160
+ /**
161
+ * Define some generators next to the solid-query generators
162
+ */
163
+ generators?: Array<Generator<PluginSolidQuery>>;
164
+ };
165
+ type ResolvedOptions = {
166
+ output: Output;
167
+ baseURL: string | undefined;
168
+ client: Required<NonNullable<PluginSolidQuery['options']['client']>>;
169
+ parser: Required<NonNullable<Options['parser']>>;
170
+ paramsType: NonNullable<Options['paramsType']>;
171
+ pathParamsType: NonNullable<Options['pathParamsType']>;
172
+ query: NonNullable<Required<Query>> | false;
173
+ };
174
+ type PluginSolidQuery = PluginFactoryOptions<'plugin-solid-query', Options, ResolvedOptions, never, ResolvePathOptions>;
175
+
176
+ export type { Options as O, PluginSolidQuery as P };
@@ -0,0 +1,176 @@
1
+ import { PluginFactoryOptions, Output, Group, ResolveNameParams } from '@kubb/core';
2
+ import { HttpMethod } from '@kubb/oas';
3
+ import { ResolvePathOptions, Exclude, Include, Override, Generator } from '@kubb/plugin-oas';
4
+
5
+ type Options$1 = {
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$1>>;
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
+ * ReturnType that will be used when calling the client.
41
+ * - 'data' will return ResponseConfig[data].
42
+ * - 'full' will return ResponseConfig.
43
+ * @default 'data'
44
+ */
45
+ dataReturnType?: 'data' | 'full';
46
+ /**
47
+ * How to pass your params
48
+ * - 'object' will return the params and pathParams as an object.
49
+ * - 'inline' will return the params as comma separated params.
50
+ * @default 'inline'
51
+ */
52
+ paramsType?: 'object' | 'inline';
53
+ /**
54
+ * How to pass your pathParams.
55
+ * - 'object' will return the pathParams as an object.
56
+ * - 'inline' will return the pathParams as comma separated params.
57
+ * @default 'inline'
58
+ */
59
+ pathParamsType?: 'object' | 'inline';
60
+ /**
61
+ * Which parser can be used before returning the data
62
+ * - 'zod' will use `@kubb/plugin-zod` to parse the data.
63
+ * @default 'client'
64
+ */
65
+ parser?: 'client' | 'zod';
66
+ transformers?: {
67
+ /**
68
+ * Customize the names based on the type that is provided by the plugin.
69
+ */
70
+ name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
71
+ };
72
+ /**
73
+ * Define some generators next to the client generators
74
+ */
75
+ generators?: Array<Generator<PluginClient>>;
76
+ };
77
+ type ResolvedOptions$1 = {
78
+ output: Output;
79
+ group?: Options$1['group'];
80
+ baseURL: string | undefined;
81
+ parser: NonNullable<Options$1['parser']>;
82
+ importPath: NonNullable<Options$1['importPath']>;
83
+ dataReturnType: NonNullable<Options$1['dataReturnType']>;
84
+ pathParamsType: NonNullable<Options$1['pathParamsType']>;
85
+ paramsType: NonNullable<Options$1['paramsType']>;
86
+ };
87
+ type PluginClient = PluginFactoryOptions<'plugin-client', Options$1, ResolvedOptions$1, never, ResolvePathOptions>;
88
+
89
+ type Query = {
90
+ /**
91
+ * Customize the queryKey, here you can specify a suffix.
92
+ */
93
+ key: (key: unknown[]) => unknown[];
94
+ /**
95
+ * Define which HttpMethods can be used for queries
96
+ * @default ['get']
97
+ */
98
+ methods: Array<HttpMethod>;
99
+ /**
100
+ * Path to the useQuery that will be used to do the useQuery functionality.
101
+ * It will be used as `import { useQuery } from '${importPath}'`.
102
+ * It allows both relative and absolute path.
103
+ * the path will be applied as is, so relative path should be based on the file being generated.
104
+ * @default '@tanstack/svelte-query'
105
+ */
106
+ importPath?: string;
107
+ };
108
+ type Options = {
109
+ /**
110
+ * Specify the export location for the files and define the behavior of the output
111
+ * @default { path: 'hooks', barrelType: 'named' }
112
+ */
113
+ output?: Output;
114
+ /**
115
+ * Group the @tanstack/query hooks based on the provided name.
116
+ */
117
+ group?: Group;
118
+ client?: Pick<PluginClient['options'], 'dataReturnType' | 'importPath'>;
119
+ /**
120
+ * Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
121
+ */
122
+ exclude?: Array<Exclude>;
123
+ /**
124
+ * Array containing include parameters to include tags/operations/methods/paths.
125
+ */
126
+ include?: Array<Include>;
127
+ /**
128
+ * Array containing override parameters to override `options` based on tags/operations/methods/paths.
129
+ */
130
+ override?: Array<Override<ResolvedOptions>>;
131
+ /**
132
+ * How to pass your params
133
+ * - 'object' will return the params and pathParams as an object.
134
+ * - 'inline' will return the params as comma separated params.
135
+ * @default 'inline'
136
+ */
137
+ paramsType?: 'object' | 'inline';
138
+ /**
139
+ * How to pass your pathParams.
140
+ * - 'object' will return the pathParams as an object.
141
+ * - 'inline' will return the pathParams as comma separated params.
142
+ * @default 'inline'
143
+ */
144
+ pathParamsType?: PluginClient['options']['pathParamsType'];
145
+ /**
146
+ * Override some useQuery behaviours.
147
+ */
148
+ query?: Partial<Query> | false;
149
+ /**
150
+ * Which parser should be used before returning the data to `@tanstack/query`.
151
+ * `'zod'` will use `@kubb/plugin-zod` to parse the data.
152
+ */
153
+ parser?: PluginClient['options']['parser'];
154
+ transformers?: {
155
+ /**
156
+ * Customize the names based on the type that is provided by the plugin.
157
+ */
158
+ name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
159
+ };
160
+ /**
161
+ * Define some generators next to the solid-query generators
162
+ */
163
+ generators?: Array<Generator<PluginSolidQuery>>;
164
+ };
165
+ type ResolvedOptions = {
166
+ output: Output;
167
+ baseURL: string | undefined;
168
+ client: Required<NonNullable<PluginSolidQuery['options']['client']>>;
169
+ parser: Required<NonNullable<Options['parser']>>;
170
+ paramsType: NonNullable<Options['paramsType']>;
171
+ pathParamsType: NonNullable<Options['pathParamsType']>;
172
+ query: NonNullable<Required<Query>> | false;
173
+ };
174
+ type PluginSolidQuery = PluginFactoryOptions<'plugin-solid-query', Options, ResolvedOptions, never, ResolvePathOptions>;
175
+
176
+ export type { Options as O, PluginSolidQuery as P };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-solid-query",
3
- "version": "3.0.0-alpha.31",
3
+ "version": "3.0.0-beta.10",
4
4
  "description": "Generator solid-query hooks",
5
5
  "keywords": [
6
6
  "faker",
@@ -62,24 +62,24 @@
62
62
  "!/**/__tests__/**"
63
63
  ],
64
64
  "dependencies": {
65
- "@kubb/core": "3.0.0-alpha.31",
66
- "@kubb/fs": "3.0.0-alpha.31",
67
- "@kubb/oas": "3.0.0-alpha.31",
68
- "@kubb/plugin-oas": "3.0.0-alpha.31",
69
- "@kubb/plugin-ts": "3.0.0-alpha.31",
70
- "@kubb/plugin-zod": "3.0.0-alpha.31",
71
- "@kubb/react": "3.0.0-alpha.31"
65
+ "@kubb/core": "3.0.0-beta.10",
66
+ "@kubb/fs": "3.0.0-beta.10",
67
+ "@kubb/oas": "3.0.0-beta.10",
68
+ "@kubb/plugin-oas": "3.0.0-beta.10",
69
+ "@kubb/plugin-ts": "3.0.0-beta.10",
70
+ "@kubb/plugin-zod": "3.0.0-beta.10",
71
+ "@kubb/react": "3.0.0-beta.10"
72
72
  },
73
73
  "devDependencies": {
74
- "@types/react": "^18.3.10",
74
+ "@types/react": "^18.3.12",
75
75
  "react": "^18.3.1",
76
- "tsup": "^8.3.0",
77
- "typescript": "^5.6.2",
78
- "@kubb/config-ts": "3.0.0-alpha.31",
79
- "@kubb/config-tsup": "3.0.0-alpha.31"
76
+ "tsup": "^8.3.5",
77
+ "typescript": "^5.6.3",
78
+ "@kubb/config-ts": "3.0.0-beta.10",
79
+ "@kubb/config-tsup": "3.0.0-beta.10"
80
80
  },
81
81
  "peerDependencies": {
82
- "@kubb/react": "3.0.0-alpha.31"
82
+ "@kubb/react": "3.0.0-beta.10"
83
83
  },
84
84
  "engines": {
85
85
  "node": ">=20"
@@ -18,24 +18,68 @@ type Props = {
18
18
  queryKeyTypeName: string
19
19
  typeSchemas: OperationSchemas
20
20
  operation: Operation
21
+ paramsType: PluginSolidQuery['resolvedOptions']['paramsType']
21
22
  pathParamsType: PluginSolidQuery['resolvedOptions']['pathParamsType']
22
23
  dataReturnType: PluginSolidQuery['resolvedOptions']['client']['dataReturnType']
23
24
  }
24
25
 
25
26
  type GetParamsProps = {
27
+ paramsType: PluginSolidQuery['resolvedOptions']['paramsType']
26
28
  pathParamsType: PluginSolidQuery['resolvedOptions']['pathParamsType']
27
29
  dataReturnType: PluginSolidQuery['resolvedOptions']['client']['dataReturnType']
28
30
  typeSchemas: OperationSchemas
29
31
  }
30
32
 
31
- function getParams({ pathParamsType, dataReturnType, typeSchemas }: GetParamsProps) {
33
+ function getParams({ paramsType, pathParamsType, dataReturnType, typeSchemas }: GetParamsProps) {
32
34
  const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`
33
35
 
36
+ if (paramsType === 'object') {
37
+ return FunctionParams.factory({
38
+ data: {
39
+ mode: 'object',
40
+ children: {
41
+ ...getPathParams(typeSchemas.pathParams, { typed: true }),
42
+ data: typeSchemas.request?.name
43
+ ? {
44
+ type: typeSchemas.request?.name,
45
+ optional: isOptional(typeSchemas.request?.schema),
46
+ }
47
+ : undefined,
48
+ params: typeSchemas.queryParams?.name
49
+ ? {
50
+ type: typeSchemas.queryParams?.name,
51
+ optional: isOptional(typeSchemas.queryParams?.schema),
52
+ }
53
+ : undefined,
54
+ headers: typeSchemas.headerParams?.name
55
+ ? {
56
+ type: typeSchemas.headerParams?.name,
57
+ optional: isOptional(typeSchemas.headerParams?.schema),
58
+ }
59
+ : undefined,
60
+ },
61
+ },
62
+ options: {
63
+ type: `
64
+ {
65
+ query?: Partial<CreateBaseQueryOptions<${[TData, typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error', 'TData', 'TQueryData', 'TQueryKey'].join(', ')}>>,
66
+ client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : 'Partial<RequestConfig>'}
67
+ }
68
+ `,
69
+ default: '{}',
70
+ },
71
+ })
72
+ }
73
+
34
74
  return FunctionParams.factory({
35
- pathParams: {
36
- mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',
37
- children: getPathParams(typeSchemas.pathParams, { typed: true }),
38
- },
75
+ pathParams: typeSchemas.pathParams?.name
76
+ ? {
77
+ mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',
78
+ children: getPathParams(typeSchemas.pathParams, { typed: true }),
79
+ type: typeSchemas.pathParams?.name,
80
+ optional: isOptional(typeSchemas.pathParams?.schema),
81
+ }
82
+ : undefined,
39
83
  data: typeSchemas.request?.name
40
84
  ? {
41
85
  type: typeSchemas.request?.name,
@@ -66,7 +110,17 @@ function getParams({ pathParamsType, dataReturnType, typeSchemas }: GetParamsPro
66
110
  })
67
111
  }
68
112
 
69
- export function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, pathParamsType, dataReturnType, typeSchemas, operation }: Props): ReactNode {
113
+ export function Query({
114
+ name,
115
+ queryKeyTypeName,
116
+ queryOptionsName,
117
+ queryKeyName,
118
+ paramsType,
119
+ pathParamsType,
120
+ dataReturnType,
121
+ typeSchemas,
122
+ operation,
123
+ }: Props): ReactNode {
70
124
  const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`
71
125
  const returnType = `CreateQueryResult<${['TData', typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'].join(', ')}> & { queryKey: TQueryKey }`
72
126
  const generics = [`TData = ${TData}`, `TQueryData = ${TData}`, `TQueryKey extends QueryKey = ${queryKeyTypeName}`]
@@ -76,10 +130,12 @@ export function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName,
76
130
  typeSchemas,
77
131
  })
78
132
  const queryOptionsParams = QueryOptions.getParams({
133
+ paramsType,
79
134
  pathParamsType,
80
135
  typeSchemas,
81
136
  })
82
137
  const params = getParams({
138
+ paramsType,
83
139
  pathParamsType,
84
140
  dataReturnType,
85
141
  typeSchemas,
@@ -14,20 +14,59 @@ type Props = {
14
14
  clientName: string
15
15
  queryKeyName: string
16
16
  typeSchemas: OperationSchemas
17
+ paramsType: PluginSolidQuery['resolvedOptions']['paramsType']
17
18
  pathParamsType: PluginSolidQuery['resolvedOptions']['pathParamsType']
18
19
  }
19
20
 
20
21
  type GetParamsProps = {
22
+ paramsType: PluginSolidQuery['resolvedOptions']['paramsType']
21
23
  pathParamsType: PluginSolidQuery['resolvedOptions']['pathParamsType']
22
24
  typeSchemas: OperationSchemas
23
25
  }
24
26
 
25
- function getParams({ pathParamsType, typeSchemas }: GetParamsProps) {
27
+ function getParams({ paramsType, pathParamsType, typeSchemas }: GetParamsProps) {
28
+ if (paramsType === 'object') {
29
+ return FunctionParams.factory({
30
+ data: {
31
+ mode: 'object',
32
+ children: {
33
+ ...getPathParams(typeSchemas.pathParams, { typed: true }),
34
+ data: typeSchemas.request?.name
35
+ ? {
36
+ type: typeSchemas.request?.name,
37
+ optional: isOptional(typeSchemas.request?.schema),
38
+ }
39
+ : undefined,
40
+ params: typeSchemas.queryParams?.name
41
+ ? {
42
+ type: typeSchemas.queryParams?.name,
43
+ optional: isOptional(typeSchemas.queryParams?.schema),
44
+ }
45
+ : undefined,
46
+ headers: typeSchemas.headerParams?.name
47
+ ? {
48
+ type: typeSchemas.headerParams?.name,
49
+ optional: isOptional(typeSchemas.headerParams?.schema),
50
+ }
51
+ : undefined,
52
+ },
53
+ },
54
+ config: {
55
+ type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : 'Partial<RequestConfig>',
56
+ default: '{}',
57
+ },
58
+ })
59
+ }
60
+
26
61
  return FunctionParams.factory({
27
- pathParams: {
28
- mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',
29
- children: getPathParams(typeSchemas.pathParams, { typed: true }),
30
- },
62
+ pathParams: typeSchemas.pathParams?.name
63
+ ? {
64
+ mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',
65
+ children: getPathParams(typeSchemas.pathParams, { typed: true }),
66
+ type: typeSchemas.pathParams?.name,
67
+ optional: isOptional(typeSchemas.pathParams?.schema),
68
+ }
69
+ : undefined,
31
70
  data: typeSchemas.request?.name
32
71
  ? {
33
72
  type: typeSchemas.request?.name,
@@ -53,10 +92,11 @@ function getParams({ pathParamsType, typeSchemas }: GetParamsProps) {
53
92
  })
54
93
  }
55
94
 
56
- export function QueryOptions({ name, clientName, typeSchemas, pathParamsType, queryKeyName }: Props): ReactNode {
57
- const params = getParams({ pathParamsType, typeSchemas })
95
+ export function QueryOptions({ name, clientName, typeSchemas, paramsType, pathParamsType, queryKeyName }: Props): ReactNode {
96
+ const params = getParams({ paramsType, pathParamsType, typeSchemas })
58
97
  const clientParams = Client.getParams({
59
98
  typeSchemas,
99
+ paramsType,
60
100
  pathParamsType,
61
101
  })
62
102
  const queryKeyParams = QueryKey.getParams({