@kubb/plugin-svelte-query 3.0.0-alpha.20

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 (52) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +123 -0
  3. package/dist/chunk-QPJYCH77.js +376 -0
  4. package/dist/chunk-QPJYCH77.js.map +1 -0
  5. package/dist/chunk-RE36BJQW.cjs +384 -0
  6. package/dist/chunk-RE36BJQW.cjs.map +1 -0
  7. package/dist/chunk-TD7H4OF4.cjs +376 -0
  8. package/dist/chunk-TD7H4OF4.cjs.map +1 -0
  9. package/dist/chunk-V5DEG2OQ.js +369 -0
  10. package/dist/chunk-V5DEG2OQ.js.map +1 -0
  11. package/dist/components.cjs +24 -0
  12. package/dist/components.cjs.map +1 -0
  13. package/dist/components.d.cts +78 -0
  14. package/dist/components.d.ts +78 -0
  15. package/dist/components.js +3 -0
  16. package/dist/components.js.map +1 -0
  17. package/dist/generators.cjs +17 -0
  18. package/dist/generators.cjs.map +1 -0
  19. package/dist/generators.d.cts +10 -0
  20. package/dist/generators.d.ts +10 -0
  21. package/dist/generators.js +4 -0
  22. package/dist/generators.js.map +1 -0
  23. package/dist/index.cjs +131 -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 +124 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/types-64YHTP7S.d.cts +148 -0
  30. package/dist/types-64YHTP7S.d.ts +148 -0
  31. package/package.json +102 -0
  32. package/src/components/Mutation.tsx +133 -0
  33. package/src/components/Query.tsx +120 -0
  34. package/src/components/QueryKey.tsx +73 -0
  35. package/src/components/QueryOptions.tsx +84 -0
  36. package/src/components/index.ts +4 -0
  37. package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +50 -0
  38. package/src/generators/__snapshots__/clientGetImportPath.ts +50 -0
  39. package/src/generators/__snapshots__/clientPostImportPath.ts +38 -0
  40. package/src/generators/__snapshots__/findByTags.ts +50 -0
  41. package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +50 -0
  42. package/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +50 -0
  43. package/src/generators/__snapshots__/findByTagsWithZod.ts +50 -0
  44. package/src/generators/__snapshots__/postAsQuery.ts +48 -0
  45. package/src/generators/__snapshots__/updatePetById.ts +38 -0
  46. package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +40 -0
  47. package/src/generators/index.ts +2 -0
  48. package/src/generators/mutationGenerator.tsx +96 -0
  49. package/src/generators/queryGenerator.tsx +122 -0
  50. package/src/index.ts +2 -0
  51. package/src/plugin.ts +143 -0
  52. package/src/types.ts +153 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Stijn Van Hulle
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,123 @@
1
+ <div align="center">
2
+
3
+ <!-- <img src="assets/logo.png" alt="logo" width="200" height="auto" /> -->
4
+ <h1>@kubb/plugin-svelte-query</h1>
5
+
6
+ <p>
7
+ Swagger integration for React-Query to generate all the different hooks based on an OpenAPI specification.
8
+ </p>
9
+ <img src="https://raw.githubusercontent.com/kubb-labs/kubb/main/assets/banner.png" alt="logo" height="auto" />
10
+
11
+ [![npm version][npm-version-src]][npm-version-href]
12
+ [![npm downloads][npm-downloads-src]][npm-downloads-href]
13
+ [![Coverage][coverage-src]][coverage-href]
14
+ [![License][license-src]][license-href]
15
+
16
+ <h4>
17
+ <a href="https://codesandbox.io/s/github/kubb-labs/kubb/tree/alpha/examples/typescript" target="_blank">View Demo</a>
18
+ <span> · </span>
19
+ <a href="https://kubb.dev/" target="_blank">Documentation</a>
20
+ <span> · </span>
21
+ <a href="https://github.com/kubb-labs/kubb/issues/" target="_blank">Report Bug</a>
22
+ <span> · </span>
23
+ <a href="https://github.com/kubb-labs/kubb/issues/" target="_blank">Request Feature</a>
24
+ </h4>
25
+ </div>
26
+
27
+ ## Supporting Kubb
28
+
29
+ Kubb uses an MIT-licensed open source project with its ongoing development made possible entirely by the support of Sponsors. If you would like to become a sponsor, please consider:
30
+
31
+ - [Become a Sponsor on GitHub](https://github.com/sponsors/stijnvanhulle)
32
+
33
+ <p align="center">
34
+ <a href="https://github.com/sponsors/stijnvanhulle">
35
+ <img src="https://raw.githubusercontent.com/stijnvanhulle/sponsors/main/sponsors.svg" alt="My sponsors" />
36
+ </a>
37
+ </p>
38
+
39
+
40
+ <!-- Badges -->
41
+
42
+ [npm-version-src]: https://img.shields.io/npm/v/@kubb/plugin-svelte-query?flat&colorA=18181B&colorB=f58517
43
+ [npm-version-href]: https://npmjs.com/package/@kubb/plugin-svelte-query
44
+ [npm-downloads-src]: https://img.shields.io/npm/dm/@kubb/plugin-svelte-query?flat&colorA=18181B&colorB=f58517
45
+ [npm-downloads-href]: https://npmjs.com/package/@kubb/plugin-svelte-query
46
+ [license-src]: https://img.shields.io/github/license/kubb-labs/kubb.svg?flat&colorA=18181B&colorB=f58517
47
+ [license-href]: https://github.com/kubb-labs/kubb/blob/main/LICENSE
48
+ [build-src]: https://img.shields.io/github/actions/workflow/status/kubb-labs/kubb/ci.yaml?style=flat&colorA=18181B&colorB=f58517
49
+ [build-href]: https://www.npmjs.com/package/@kubb/plugin-svelte-query
50
+ [minified-src]: https://img.shields.io/bundlephobia/min/@kubb/plugin-svelte-query?style=flat&colorA=18181B&colorB=f58517
51
+ [minified-href]: https://www.npmjs.com/package/@kubb/plugin-svelte-query
52
+ [coverage-src]: https://img.shields.io/codecov/c/github/kubb-labs/kubb?style=flat&colorA=18181B&colorB=f58517
53
+ [coverage-href]: https://www.npmjs.com/package/@kubb/plugin-svelte-query
54
+
55
+ ## options query
56
+
57
+ ### v4
58
+
59
+ UseBaseQueryOptions => react-query only
60
+ UseQueryOptions => vue-query only
61
+ CreateQueryOptions => solid-query only
62
+ CreateQueryOptions => svelte-query only
63
+
64
+ ### v5
65
+
66
+ UseBaseQueryOptions => react-query only https://github.com/TanStack/query/blob/ce1305c27e7ac7988656d171d882a665a286cc6a/packages/react-query/src/types.ts#L18
67
+ QueryObserverOptions => vue-query only https://github.com/TanStack/query/blob/main/packages/vue-query/src/useQuery.ts#L24
68
+ UseQueryOptions => solid-query only
69
+
70
+ ## result query
71
+
72
+ ### v4
73
+
74
+ UseQueryResult => react-query only
75
+ UseQueryReturnType => vue-query only
76
+ CreateQueryResult => solid-query only
77
+ CreateQueryResult => svelte-query only
78
+
79
+ ### v5
80
+
81
+ UseQueryResult => react-query only
82
+ UseQueryReturnType => vue-query only
83
+
84
+ ## queryOptions() query
85
+
86
+ ### v5
87
+
88
+ queryOptions => react-query only
89
+
90
+ ```typescript
91
+ {
92
+ query: {
93
+ types: {
94
+ options: 'UseBaseQueryOptions'
95
+ result: 'UseQueryResult'
96
+ }
97
+ }
98
+ }
99
+ ```
100
+
101
+ ## options mutation
102
+
103
+ ### v4
104
+
105
+ UseMutationOptions => react-query only
106
+ VueMutationObserverOptions => vue-query only
107
+
108
+ ### v5
109
+
110
+ UseMutationOptions => react-query only
111
+ MutationObserverOptions => vue-query only
112
+
113
+ ## result mutation
114
+
115
+ ### v4
116
+
117
+ UseMutationResult => react-query only
118
+ UseMutationReturnType => vue-query only
119
+
120
+ ### v5
121
+
122
+ UseMutationResult => react-query only
123
+ UseMutationReturnType => vue-query only
@@ -0,0 +1,376 @@
1
+ import { Client, Operations, QueryKey, QueryOptions, Query, Mutation } from './chunk-V5DEG2OQ.js';
2
+ import transformers, { camelCase } from '@kubb/core/transformers';
3
+ import path from 'node:path';
4
+ import { createPlugin, FileManager, PluginManager } from '@kubb/core';
5
+ import { renderTemplate } from '@kubb/core/utils';
6
+ import { createReactGenerator, pluginOasName, OperationGenerator } from '@kubb/plugin-oas';
7
+ import { pluginZodName } from '@kubb/plugin-zod';
8
+ import { useOperationManager } from '@kubb/plugin-oas/hooks';
9
+ import { pluginTsName } from '@kubb/plugin-ts';
10
+ import { useApp, File } from '@kubb/react';
11
+ import { jsxs, jsx } from '@kubb/react/jsx-runtime';
12
+
13
+ var clientGenerator = createReactGenerator({
14
+ name: "client",
15
+ Operation({ options, operation }) {
16
+ const {
17
+ plugin: {
18
+ options: { output }
19
+ }
20
+ } = useApp();
21
+ const { getSchemas, getName, getFile } = useOperationManager();
22
+ const client = {
23
+ name: getName(operation, { type: "function" }),
24
+ file: getFile(operation)
25
+ };
26
+ const type = {
27
+ file: getFile(operation, { pluginKey: [pluginTsName] }),
28
+ schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: "type" })
29
+ };
30
+ const zod = {
31
+ file: getFile(operation, { pluginKey: [pluginZodName] }),
32
+ schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: "function" })
33
+ };
34
+ return /* @__PURE__ */ jsxs(File, { baseName: client.file.baseName, path: client.file.path, meta: client.file.meta, banner: output?.banner, footer: output?.footer, children: [
35
+ /* @__PURE__ */ jsx(File.Import, { name: "client", path: options.importPath }),
36
+ /* @__PURE__ */ jsx(File.Import, { name: ["RequestConfig"], path: options.importPath, isTypeOnly: true }),
37
+ options.parser === "zod" && /* @__PURE__ */ jsx(File.Import, { extName: output?.extName, name: [zod.schemas.response.name], root: client.file.path, path: zod.file.path }),
38
+ /* @__PURE__ */ jsx(
39
+ File.Import,
40
+ {
41
+ extName: output?.extName,
42
+ name: [
43
+ type.schemas.request?.name,
44
+ type.schemas.response.name,
45
+ type.schemas.pathParams?.name,
46
+ type.schemas.queryParams?.name,
47
+ type.schemas.headerParams?.name,
48
+ ...type.schemas.statusCodes?.map((item) => item.name) || []
49
+ ].filter(Boolean),
50
+ root: client.file.path,
51
+ path: type.file.path,
52
+ isTypeOnly: true
53
+ }
54
+ ),
55
+ /* @__PURE__ */ jsx(
56
+ Client,
57
+ {
58
+ name: client.name,
59
+ baseURL: options.baseURL,
60
+ dataReturnType: options.dataReturnType,
61
+ pathParamsType: options.pathParamsType,
62
+ typeSchemas: type.schemas,
63
+ operation,
64
+ parser: options.parser,
65
+ zodSchemas: zod.schemas
66
+ }
67
+ )
68
+ ] });
69
+ }
70
+ });
71
+ var operationsGenerator = createReactGenerator({
72
+ name: "client",
73
+ Operations({ operations }) {
74
+ const {
75
+ pluginManager,
76
+ plugin: {
77
+ options: { output }
78
+ }
79
+ } = useApp();
80
+ const name = "operations";
81
+ const file = pluginManager.getFile({ name, extName: ".ts", pluginKey: [pluginClientName] });
82
+ return /* @__PURE__ */ jsx(File, { baseName: file.baseName, path: file.path, meta: file.meta, banner: output?.banner, footer: output?.footer, children: /* @__PURE__ */ jsx(Operations, { name, operations }) });
83
+ }
84
+ });
85
+
86
+ // ../plugin-client/src/plugin.ts
87
+ var pluginClientName = "plugin-client";
88
+ createPlugin((options) => {
89
+ const {
90
+ output = { path: "clients" },
91
+ group,
92
+ exclude = [],
93
+ include,
94
+ override = [],
95
+ transformers: transformers2 = {},
96
+ dataReturnType = "data",
97
+ pathParamsType = "inline",
98
+ operations = false,
99
+ importPath = "@kubb/plugin-client/client",
100
+ parser = "client"
101
+ } = options;
102
+ const template = group?.output ? group.output : `${output.path}/{{tag}}Controller`;
103
+ return {
104
+ name: pluginClientName,
105
+ options: {
106
+ output: {
107
+ exportType: "barrelNamed",
108
+ ...output
109
+ },
110
+ parser,
111
+ dataReturnType,
112
+ importPath,
113
+ pathParamsType,
114
+ baseURL: void 0
115
+ },
116
+ pre: [pluginOasName, parser === "zod" ? pluginZodName : void 0].filter(Boolean),
117
+ resolvePath(baseName, pathMode, options2) {
118
+ const root = path.resolve(this.config.root, this.config.output.path);
119
+ const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path));
120
+ if (mode === "single") {
121
+ return path.resolve(root, output.path);
122
+ }
123
+ if (options2?.tag && group?.type === "tag") {
124
+ const tag = camelCase(options2.tag);
125
+ return path.resolve(root, renderTemplate(template, { tag }), baseName);
126
+ }
127
+ return path.resolve(root, output.path, baseName);
128
+ },
129
+ resolveName(name, type) {
130
+ const resolvedName = camelCase(name, { isFile: type === "file" });
131
+ if (type) {
132
+ return transformers2?.name?.(resolvedName, type) || resolvedName;
133
+ }
134
+ return resolvedName;
135
+ },
136
+ async buildStart() {
137
+ const [swaggerPlugin] = PluginManager.getDependedPlugins(this.plugins, [pluginOasName]);
138
+ const oas = await swaggerPlugin.context.getOas();
139
+ const root = path.resolve(this.config.root, this.config.output.path);
140
+ const mode = FileManager.getMode(path.resolve(root, output.path));
141
+ const baseURL = await swaggerPlugin.context.getBaseURL();
142
+ const operationGenerator = new OperationGenerator(
143
+ {
144
+ ...this.plugin.options,
145
+ baseURL
146
+ },
147
+ {
148
+ oas,
149
+ pluginManager: this.pluginManager,
150
+ plugin: this.plugin,
151
+ contentType: swaggerPlugin.context.contentType,
152
+ exclude,
153
+ include,
154
+ override,
155
+ mode
156
+ }
157
+ );
158
+ const files = await operationGenerator.build(...[clientGenerator, operations ? operationsGenerator : void 0].filter(Boolean));
159
+ await this.addFile(...files);
160
+ if (this.config.output.exportType) {
161
+ const barrelFiles = await this.fileManager.getBarrelFiles({
162
+ root,
163
+ output,
164
+ files: this.fileManager.files,
165
+ meta: {
166
+ pluginKey: this.plugin.key
167
+ },
168
+ logger: this.logger
169
+ });
170
+ await this.addFile(...barrelFiles);
171
+ }
172
+ }
173
+ };
174
+ });
175
+ var queryGenerator = createReactGenerator({
176
+ name: "svelte-query",
177
+ Operation({ options, operation }) {
178
+ const {
179
+ plugin: {
180
+ options: { output }
181
+ }
182
+ } = useApp();
183
+ const { getSchemas, getName, getFile } = useOperationManager();
184
+ const isQuery = typeof options.query === "boolean" ? true : options.query?.methods.some((method) => operation.method === method);
185
+ !isQuery && options.mutation && options.mutation.methods.some((method) => operation.method === method);
186
+ const query = {
187
+ name: getName(operation, { type: "function", prefix: "create" }),
188
+ typeName: getName(operation, { type: "type" }),
189
+ file: getFile(operation, { prefix: "create" })
190
+ };
191
+ const client = {
192
+ name: getName(operation, { type: "function", pluginKey: [pluginClientName] })
193
+ };
194
+ const queryOptions = {
195
+ name: transformers.camelCase(`${operation.getOperationId()} QueryOptions`)
196
+ };
197
+ const queryKey = {
198
+ name: transformers.camelCase(`${operation.getOperationId()} QueryKey`),
199
+ typeName: transformers.pascalCase(`${operation.getOperationId()} QueryKey`)
200
+ };
201
+ const type = {
202
+ file: getFile(operation, { pluginKey: [pluginTsName] }),
203
+ //todo remove type?
204
+ schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: "type" })
205
+ };
206
+ const zod = {
207
+ file: getFile(operation, { pluginKey: [pluginZodName] }),
208
+ schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: "function" })
209
+ };
210
+ if (!isQuery || typeof options.query === "boolean") {
211
+ return null;
212
+ }
213
+ return /* @__PURE__ */ jsxs(File, { baseName: query.file.baseName, path: query.file.path, meta: query.file.meta, banner: output?.banner, footer: output?.footer, children: [
214
+ options.parser === "zod" && /* @__PURE__ */ jsx(File.Import, { extName: output?.extName, name: [zod.schemas.response.name], root: query.file.path, path: zod.file.path }),
215
+ /* @__PURE__ */ jsx(File.Import, { name: ["createQuery", "queryOptions"], path: options.query.importPath }),
216
+ /* @__PURE__ */ jsx(File.Import, { name: ["QueryKey", "WithRequired", "CreateBaseQueryOptions", "CreateQueryResult"], path: options.query.importPath, isTypeOnly: true }),
217
+ /* @__PURE__ */ jsx(File.Import, { name: "client", path: options.client.importPath }),
218
+ /* @__PURE__ */ jsx(File.Import, { name: ["RequestConfig"], path: options.client.importPath, isTypeOnly: true }),
219
+ options.client.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, { name: ["ResponseConfig"], path: options.client.importPath, isTypeOnly: true }),
220
+ /* @__PURE__ */ jsx(
221
+ File.Import,
222
+ {
223
+ extName: output?.extName,
224
+ name: [
225
+ type.schemas.request?.name,
226
+ type.schemas.response.name,
227
+ type.schemas.pathParams?.name,
228
+ type.schemas.queryParams?.name,
229
+ type.schemas.headerParams?.name,
230
+ ...type.schemas.statusCodes?.map((item) => item.name) || []
231
+ ].filter(Boolean),
232
+ root: query.file.path,
233
+ path: type.file.path,
234
+ isTypeOnly: true
235
+ }
236
+ ),
237
+ /* @__PURE__ */ jsx(
238
+ QueryKey,
239
+ {
240
+ name: queryKey.name,
241
+ typeName: queryKey.typeName,
242
+ operation,
243
+ pathParamsType: options.pathParamsType,
244
+ typeSchemas: type.schemas,
245
+ keysFn: options.query.key
246
+ }
247
+ ),
248
+ /* @__PURE__ */ jsx(
249
+ Client,
250
+ {
251
+ name: client.name,
252
+ isExportable: false,
253
+ isIndexable: false,
254
+ baseURL: options.baseURL,
255
+ operation,
256
+ typeSchemas: type.schemas,
257
+ zodSchemas: zod.schemas,
258
+ dataReturnType: options.client.dataReturnType,
259
+ pathParamsType: options.pathParamsType,
260
+ parser: options.parser
261
+ }
262
+ ),
263
+ /* @__PURE__ */ jsx(
264
+ QueryOptions,
265
+ {
266
+ name: queryOptions.name,
267
+ clientName: client.name,
268
+ queryKeyName: queryKey.name,
269
+ typeSchemas: type.schemas,
270
+ pathParamsType: options.pathParamsType
271
+ }
272
+ ),
273
+ /* @__PURE__ */ jsx(
274
+ Query,
275
+ {
276
+ name: query.name,
277
+ queryOptionsName: queryOptions.name,
278
+ typeSchemas: type.schemas,
279
+ pathParamsType: options.pathParamsType,
280
+ operation,
281
+ dataReturnType: options.client.dataReturnType,
282
+ queryKeyName: queryKey.name,
283
+ queryKeyTypeName: queryKey.typeName
284
+ }
285
+ )
286
+ ] });
287
+ }
288
+ });
289
+ var mutationGenerator = createReactGenerator({
290
+ name: "svelte-query",
291
+ Operation({ options, operation }) {
292
+ const {
293
+ plugin: {
294
+ options: { output }
295
+ }
296
+ } = useApp();
297
+ const { getSchemas, getName, getFile } = useOperationManager();
298
+ const isQuery = typeof options.query === "boolean" ? true : options.query?.methods.some((method) => operation.method === method);
299
+ const isMutation = !isQuery && options.mutation && options.mutation.methods.some((method) => operation.method === method);
300
+ const mutation = {
301
+ name: getName(operation, { type: "function", prefix: "create" }),
302
+ typeName: getName(operation, { type: "type" }),
303
+ file: getFile(operation, { prefix: "create" })
304
+ };
305
+ const type = {
306
+ file: getFile(operation, { pluginKey: [pluginTsName] }),
307
+ //todo remove type?
308
+ schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: "type" })
309
+ };
310
+ const zod = {
311
+ file: getFile(operation, { pluginKey: [pluginZodName] }),
312
+ schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: "function" })
313
+ };
314
+ const client = {
315
+ name: getName(operation, { type: "function", pluginKey: [pluginClientName] })
316
+ };
317
+ if (!isMutation || typeof options.mutation === "boolean") {
318
+ return null;
319
+ }
320
+ return /* @__PURE__ */ jsxs(File, { baseName: mutation.file.baseName, path: mutation.file.path, meta: mutation.file.meta, banner: output?.banner, footer: output?.footer, children: [
321
+ options.parser === "zod" && /* @__PURE__ */ jsx(File.Import, { extName: output?.extName, name: [zod.schemas.response.name], root: mutation.file.path, path: zod.file.path }),
322
+ /* @__PURE__ */ jsx(File.Import, { name: ["createMutation"], path: options.mutation.importPath }),
323
+ /* @__PURE__ */ jsx(File.Import, { name: ["CreateMutationOptions"], path: options.mutation.importPath, isTypeOnly: true }),
324
+ /* @__PURE__ */ jsx(File.Import, { name: "client", path: options.client.importPath }),
325
+ /* @__PURE__ */ jsx(File.Import, { name: ["RequestConfig", "ResponseConfig"], path: options.client.importPath, isTypeOnly: true }),
326
+ /* @__PURE__ */ jsx(
327
+ File.Import,
328
+ {
329
+ extName: output?.extName,
330
+ name: [
331
+ type.schemas.request?.name,
332
+ type.schemas.response.name,
333
+ type.schemas.pathParams?.name,
334
+ type.schemas.queryParams?.name,
335
+ type.schemas.headerParams?.name,
336
+ ...type.schemas.statusCodes?.map((item) => item.name) || []
337
+ ].filter(Boolean),
338
+ root: mutation.file.path,
339
+ path: type.file.path,
340
+ isTypeOnly: true
341
+ }
342
+ ),
343
+ /* @__PURE__ */ jsx(
344
+ Client,
345
+ {
346
+ name: client.name,
347
+ isExportable: false,
348
+ isIndexable: false,
349
+ baseURL: options.baseURL,
350
+ operation,
351
+ typeSchemas: type.schemas,
352
+ zodSchemas: zod.schemas,
353
+ dataReturnType: options.client.dataReturnType,
354
+ pathParamsType: options.pathParamsType,
355
+ parser: options.parser
356
+ }
357
+ ),
358
+ /* @__PURE__ */ jsx(
359
+ Mutation,
360
+ {
361
+ name: mutation.name,
362
+ clientName: client.name,
363
+ typeName: mutation.typeName,
364
+ typeSchemas: type.schemas,
365
+ operation,
366
+ dataReturnType: options.client.dataReturnType,
367
+ pathParamsType: options.pathParamsType
368
+ }
369
+ )
370
+ ] });
371
+ }
372
+ });
373
+
374
+ export { mutationGenerator, queryGenerator };
375
+ //# sourceMappingURL=chunk-QPJYCH77.js.map
376
+ //# sourceMappingURL=chunk-QPJYCH77.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../plugin-client/src/generators/clientGenerator.tsx","../../plugin-client/src/generators/operationsGenerator.tsx","../../plugin-client/src/plugin.ts","../src/generators/queryGenerator.tsx","../src/generators/mutationGenerator.tsx"],"names":["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A;AAAA,QAAA;AAAA,UACC,MAAM,QAAS,CAAA,IAAA;AAAA,UACf,YAAY,MAAO,CAAA,IAAA;AAAA,UACnB,UAAU,QAAS,CAAA,QAAA;AAAA,UACnB,aAAa,IAAK,CAAA,OAAA;AAAA,UAClB,SAAA;AAAA,UACA,cAAA,EAAgB,QAAQ,MAAO,CAAA,cAAA;AAAA,UAC/B,gBAAgB,OAAQ,CAAA,cAAA;AAAA,SAAA;AAAA,OAC1B;AAAA,KACF,EAAA,CAAA,CAAA;AAAA,GAEJ;AACF,CAAC","file":"chunk-QPJYCH77.js","sourcesContent":["import { createReactGenerator } from '@kubb/plugin-oas'\nimport { useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, useApp } from '@kubb/react'\nimport { Client } from '../components/Client'\nimport type { PluginClient } from '../types'\n\nexport const clientGenerator = createReactGenerator<PluginClient>({\n name: 'client',\n Operation({ options, operation }) {\n const {\n plugin: {\n options: { output },\n },\n } = useApp<PluginClient>()\n const { getSchemas, getName, getFile } = useOperationManager()\n\n const client = {\n name: getName(operation, { type: 'function' }),\n file: getFile(operation),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n return (\n <File baseName={client.file.baseName} path={client.file.path} meta={client.file.meta} banner={output?.banner} footer={output?.footer}>\n <File.Import name={'client'} path={options.importPath} />\n <File.Import name={['RequestConfig']} path={options.importPath} isTypeOnly />\n {options.parser === 'zod' && <File.Import extName={output?.extName} name={[zod.schemas.response.name]} root={client.file.path} path={zod.file.path} />}\n <File.Import\n extName={output?.extName}\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={client.file.path}\n path={type.file.path}\n isTypeOnly\n />\n\n <Client\n name={client.name}\n baseURL={options.baseURL}\n dataReturnType={options.dataReturnType}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n operation={operation}\n parser={options.parser}\n zodSchemas={zod.schemas}\n />\n </File>\n )\n },\n})\n","import { pluginClientName } from '@kubb/plugin-client'\nimport { createReactGenerator } from '@kubb/plugin-oas'\nimport { File, useApp } from '@kubb/react'\nimport { Operations } from '../components/Operations'\nimport type { PluginClient } from '../types'\n\nexport const operationsGenerator = createReactGenerator<PluginClient>({\n name: 'client',\n Operations({ operations }) {\n const {\n pluginManager,\n plugin: {\n options: { output },\n },\n } = useApp<PluginClient>()\n\n const name = 'operations'\n const file = pluginManager.getFile({ name, extName: '.ts', pluginKey: [pluginClientName] })\n\n return (\n <File baseName={file.baseName} path={file.path} meta={file.meta} banner={output?.banner} footer={output?.footer}>\n <Operations name={name} operations={operations} />\n </File>\n )\n },\n})\n","import path from 'node:path'\n\nimport { FileManager, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\nimport { renderTemplate } from '@kubb/core/utils'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginOas as SwaggerPluginOptions } from '@kubb/plugin-oas'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { operationsGenerator } from './generators'\nimport { clientGenerator } from './generators/clientGenerator.tsx'\nimport type { PluginClient } from './types.ts'\n\nexport const pluginClientName = 'plugin-client' satisfies PluginClient['name']\n\nexport const pluginClient = createPlugin<PluginClient>((options) => {\n const {\n output = { path: 'clients' },\n group,\n exclude = [],\n include,\n override = [],\n transformers = {},\n dataReturnType = 'data',\n pathParamsType = 'inline',\n operations = false,\n importPath = '@kubb/plugin-client/client',\n parser = 'client',\n } = options\n\n const template = group?.output ? group.output : `${output.path}/{{tag}}Controller`\n\n return {\n name: pluginClientName,\n options: {\n output: {\n exportType: 'barrelNamed',\n ...output,\n },\n parser,\n dataReturnType,\n importPath,\n pathParamsType,\n baseURL: undefined,\n },\n pre: [pluginOasName, 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 (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 (options?.tag && group?.type === 'tag') {\n const tag = camelCase(options.tag)\n\n return path.resolve(root, renderTemplate(template, { tag }), baseName)\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n const resolvedName = camelCase(name, { isFile: type === 'file' })\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async buildStart() {\n const [swaggerPlugin]: [Plugin<SwaggerPluginOptions>] = PluginManager.getDependedPlugins<SwaggerPluginOptions>(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(...[clientGenerator, operations ? operationsGenerator : undefined].filter(Boolean))\n\n await this.addFile(...files)\n\n if (this.config.output.exportType) {\n const barrelFiles = await this.fileManager.getBarrelFiles({\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})\n","import transformers from '@kubb/core/transformers'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas'\nimport { useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, useApp } from '@kubb/react'\nimport { Query, QueryKey, QueryOptions } from '../components'\nimport type { PluginSvelteQuery } from '../types'\n\nexport const queryGenerator = createReactGenerator<PluginSvelteQuery>({\n name: 'svelte-query',\n Operation({ options, operation }) {\n const {\n plugin: {\n options: { output },\n },\n } = useApp<PluginSvelteQuery>()\n const { getSchemas, getName, getFile } = useOperationManager()\n\n const isQuery = typeof options.query === 'boolean' ? true : options.query?.methods.some((method) => operation.method === method)\n const isMutation = !isQuery && options.mutation && options.mutation.methods.some((method) => operation.method === method)\n\n const query = {\n name: getName(operation, { type: 'function', prefix: 'create' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'create' }),\n }\n\n const client = {\n name: getName(operation, { type: 'function', pluginKey: [pluginClientName] }),\n }\n\n const queryOptions = {\n name: transformers.camelCase(`${operation.getOperationId()} QueryOptions`),\n }\n\n const queryKey = {\n name: transformers.camelCase(`${operation.getOperationId()} QueryKey`),\n typeName: transformers.pascalCase(`${operation.getOperationId()} QueryKey`),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n //todo remove type?\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n if (!isQuery || typeof options.query === 'boolean') {\n return null\n }\n\n return (\n <File baseName={query.file.baseName} path={query.file.path} meta={query.file.meta} banner={output?.banner} footer={output?.footer}>\n {options.parser === 'zod' && <File.Import extName={output?.extName} name={[zod.schemas.response.name]} root={query.file.path} path={zod.file.path} />}\n <File.Import name={['createQuery', 'queryOptions']} path={options.query.importPath} />\n <File.Import name={['QueryKey', 'WithRequired', 'CreateBaseQueryOptions', 'CreateQueryResult']} path={options.query.importPath} isTypeOnly />\n <File.Import name={'client'} path={options.client.importPath} />\n <File.Import name={['RequestConfig']} path={options.client.importPath} isTypeOnly />\n {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}\n <File.Import\n extName={output?.extName}\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={query.file.path}\n path={type.file.path}\n isTypeOnly\n />\n\n <QueryKey\n name={queryKey.name}\n typeName={queryKey.typeName}\n operation={operation}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n keysFn={options.query.key}\n />\n <Client\n name={client.name}\n isExportable={false}\n isIndexable={false}\n baseURL={options.baseURL}\n operation={operation}\n typeSchemas={type.schemas}\n zodSchemas={zod.schemas}\n dataReturnType={options.client.dataReturnType}\n pathParamsType={options.pathParamsType}\n parser={options.parser}\n />\n <QueryOptions\n name={queryOptions.name}\n clientName={client.name}\n queryKeyName={queryKey.name}\n typeSchemas={type.schemas}\n pathParamsType={options.pathParamsType}\n />\n <Query\n name={query.name}\n queryOptionsName={queryOptions.name}\n typeSchemas={type.schemas}\n pathParamsType={options.pathParamsType}\n operation={operation}\n dataReturnType={options.client.dataReturnType}\n queryKeyName={queryKey.name}\n queryKeyTypeName={queryKey.typeName}\n />\n </File>\n )\n },\n})\n","import { pluginClientName } from '@kubb/plugin-client'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas'\nimport { useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, useApp } from '@kubb/react'\nimport { Mutation } from '../components'\nimport type { PluginSvelteQuery } from '../types'\n\nexport const mutationGenerator = createReactGenerator<PluginSvelteQuery>({\n name: 'svelte-query',\n Operation({ options, operation }) {\n const {\n plugin: {\n options: { output },\n },\n } = useApp<PluginSvelteQuery>()\n const { getSchemas, getName, getFile } = useOperationManager()\n\n const isQuery = typeof options.query === 'boolean' ? true : options.query?.methods.some((method) => operation.method === method)\n const isMutation = !isQuery && options.mutation && options.mutation.methods.some((method) => operation.method === method)\n\n const mutation = {\n name: getName(operation, { type: 'function', prefix: 'create' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'create' }),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n //todo remove type?\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n const client = {\n name: getName(operation, { type: 'function', pluginKey: [pluginClientName] }),\n }\n\n if (!isMutation || typeof options.mutation === 'boolean') {\n return null\n }\n\n return (\n <File baseName={mutation.file.baseName} path={mutation.file.path} meta={mutation.file.meta} banner={output?.banner} footer={output?.footer}>\n {options.parser === 'zod' && (\n <File.Import extName={output?.extName} name={[zod.schemas.response.name]} root={mutation.file.path} path={zod.file.path} />\n )}\n <File.Import name={['createMutation']} path={options.mutation.importPath} />\n <File.Import name={['CreateMutationOptions']} path={options.mutation.importPath} isTypeOnly />\n <File.Import name={'client'} path={options.client.importPath} />\n <File.Import name={['RequestConfig', 'ResponseConfig']} path={options.client.importPath} isTypeOnly />\n <File.Import\n extName={output?.extName}\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={mutation.file.path}\n path={type.file.path}\n isTypeOnly\n />\n <Client\n name={client.name}\n isExportable={false}\n isIndexable={false}\n baseURL={options.baseURL}\n operation={operation}\n typeSchemas={type.schemas}\n zodSchemas={zod.schemas}\n dataReturnType={options.client.dataReturnType}\n pathParamsType={options.pathParamsType}\n parser={options.parser}\n />\n <Mutation\n name={mutation.name}\n clientName={client.name}\n typeName={mutation.typeName}\n typeSchemas={type.schemas}\n operation={operation}\n dataReturnType={options.client.dataReturnType}\n pathParamsType={options.pathParamsType}\n />\n </File>\n )\n },\n})\n"]}