@kubb/plugin-swr 5.0.0-alpha.9 → 5.0.0-beta.33

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 (44) hide show
  1. package/LICENSE +17 -10
  2. package/README.md +33 -26
  3. package/dist/components-ByADeLZO.cjs +1029 -0
  4. package/dist/components-ByADeLZO.cjs.map +1 -0
  5. package/dist/components-CBdpiiay.js +933 -0
  6. package/dist/components-CBdpiiay.js.map +1 -0
  7. package/dist/components.cjs +1 -1
  8. package/dist/components.d.ts +45 -51
  9. package/dist/components.js +1 -1
  10. package/dist/generators-Bb5wNYig.cjs +445 -0
  11. package/dist/generators-Bb5wNYig.cjs.map +1 -0
  12. package/dist/generators-D5kJZsB1.js +434 -0
  13. package/dist/generators-D5kJZsB1.js.map +1 -0
  14. package/dist/generators.cjs +1 -1
  15. package/dist/generators.d.ts +4 -500
  16. package/dist/generators.js +1 -1
  17. package/dist/index.cjs +134 -113
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.ts +4 -4
  20. package/dist/index.js +130 -113
  21. package/dist/index.js.map +1 -1
  22. package/dist/types-D9jeG3fE.d.ts +220 -0
  23. package/extension.yaml +199 -0
  24. package/package.json +57 -67
  25. package/src/components/Mutation.tsx +106 -227
  26. package/src/components/MutationKey.tsx +25 -1
  27. package/src/components/Query.tsx +75 -140
  28. package/src/components/QueryOptions.tsx +46 -95
  29. package/src/generators/mutationGenerator.tsx +113 -128
  30. package/src/generators/queryGenerator.tsx +125 -137
  31. package/src/index.ts +2 -2
  32. package/src/plugin.ts +117 -170
  33. package/src/resolvers/resolverSwr.ts +56 -0
  34. package/src/types.ts +115 -59
  35. package/src/utils.ts +10 -0
  36. package/dist/components-DRDGvgXG.js +0 -702
  37. package/dist/components-DRDGvgXG.js.map +0 -1
  38. package/dist/components-jd0l9XKn.cjs +0 -780
  39. package/dist/components-jd0l9XKn.cjs.map +0 -1
  40. package/dist/generators-CRSl6u2M.js +0 -399
  41. package/dist/generators-CRSl6u2M.js.map +0 -1
  42. package/dist/generators-D062obA7.cjs +0 -410
  43. package/dist/generators-D062obA7.cjs.map +0 -1
  44. package/dist/types-BIaGRPjD.d.ts +0 -210
@@ -1,410 +0,0 @@
1
- const require_components = require("./components-jd0l9XKn.cjs");
2
- let node_path = require("node:path");
3
- node_path = require_components.__toESM(node_path);
4
- let _kubb_plugin_client = require("@kubb/plugin-client");
5
- let _kubb_plugin_ts = require("@kubb/plugin-ts");
6
- let _kubb_plugin_zod = require("@kubb/plugin-zod");
7
- let _kubb_plugin_client_components = require("@kubb/plugin-client/components");
8
- let _kubb_plugin_oas_utils = require("@kubb/plugin-oas/utils");
9
- let _kubb_react_fabric = require("@kubb/react-fabric");
10
- let _kubb_react_fabric_jsx_runtime = require("@kubb/react-fabric/jsx-runtime");
11
- let _kubb_core_hooks = require("@kubb/core/hooks");
12
- let _kubb_plugin_oas_generators = require("@kubb/plugin-oas/generators");
13
- let _kubb_plugin_oas_hooks = require("@kubb/plugin-oas/hooks");
14
- let remeda = require("remeda");
15
- //#region src/generators/mutationGenerator.tsx
16
- const mutationGenerator = (0, _kubb_plugin_oas_generators.createReactGenerator)({
17
- name: "swr-mutation",
18
- Operation({ config, operation, generator, plugin }) {
19
- const { options, options: { output } } = plugin;
20
- const driver = (0, _kubb_core_hooks.usePluginDriver)();
21
- const oas = (0, _kubb_plugin_oas_hooks.useOas)();
22
- const { getSchemas, getName, getFile } = (0, _kubb_plugin_oas_hooks.useOperationManager)(generator);
23
- const isQuery = !!options.query && options.query?.methods.some((method) => operation.method === method);
24
- const isMutation = options.mutation !== false && !isQuery && (0, remeda.difference)(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method);
25
- const importPath = options.mutation ? options.mutation.importPath : "swr";
26
- const mutation = {
27
- name: getName(operation, {
28
- type: "function",
29
- prefix: "use"
30
- }),
31
- typeName: getName(operation, { type: "type" }),
32
- file: getFile(operation, { prefix: "use" })
33
- };
34
- const type = {
35
- file: getFile(operation, { pluginName: _kubb_plugin_ts.pluginTsName }),
36
- schemas: getSchemas(operation, {
37
- pluginName: _kubb_plugin_ts.pluginTsName,
38
- type: "type"
39
- })
40
- };
41
- const zod = {
42
- file: getFile(operation, { pluginName: _kubb_plugin_zod.pluginZodName }),
43
- schemas: getSchemas(operation, {
44
- pluginName: _kubb_plugin_zod.pluginZodName,
45
- type: "function"
46
- })
47
- };
48
- const shouldUseClientPlugin = !!driver.getPluginByName(_kubb_plugin_client.pluginClientName) && options.client.clientType !== "class";
49
- const client = {
50
- name: shouldUseClientPlugin ? getName(operation, {
51
- type: "function",
52
- pluginName: _kubb_plugin_client.pluginClientName
53
- }) : getName(operation, { type: "function" }),
54
- file: getFile(operation, { pluginName: _kubb_plugin_client.pluginClientName })
55
- };
56
- const mutationKey = {
57
- name: getName(operation, {
58
- type: "const",
59
- suffix: "MutationKey"
60
- }),
61
- typeName: getName(operation, {
62
- type: "type",
63
- suffix: "MutationKey"
64
- })
65
- };
66
- if (!isMutation) return null;
67
- return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric.File, {
68
- baseName: mutation.file.baseName,
69
- path: mutation.file.path,
70
- meta: mutation.file.meta,
71
- banner: (0, _kubb_plugin_oas_utils.getBanner)({
72
- oas,
73
- output,
74
- config: driver.config
75
- }),
76
- footer: (0, _kubb_plugin_oas_utils.getFooter)({
77
- oas,
78
- output
79
- }),
80
- children: [
81
- options.parser === "zod" && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
82
- name: [zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean),
83
- root: mutation.file.path,
84
- path: zod.file.path
85
- }),
86
- options.client.importPath ? /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
87
- !shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
88
- name: "fetch",
89
- path: options.client.importPath
90
- }),
91
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
92
- name: [
93
- "Client",
94
- "RequestConfig",
95
- "ResponseErrorConfig"
96
- ],
97
- path: options.client.importPath,
98
- isTypeOnly: true
99
- }),
100
- options.client.dataReturnType === "full" && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
101
- name: ["ResponseConfig"],
102
- path: options.client.importPath,
103
- isTypeOnly: true
104
- })
105
- ] }) : /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
106
- !shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
107
- name: ["fetch"],
108
- root: mutation.file.path,
109
- path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts")
110
- }),
111
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
112
- name: [
113
- "Client",
114
- "RequestConfig",
115
- "ResponseErrorConfig"
116
- ],
117
- root: mutation.file.path,
118
- path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
119
- isTypeOnly: true
120
- }),
121
- options.client.dataReturnType === "full" && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
122
- name: ["ResponseConfig"],
123
- root: mutation.file.path,
124
- path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
125
- isTypeOnly: true
126
- })
127
- ] }),
128
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
129
- name: "useSWRMutation",
130
- path: importPath
131
- }),
132
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
133
- name: ["SWRMutationConfiguration", "SWRMutationResponse"],
134
- path: importPath,
135
- isTypeOnly: true
136
- }),
137
- shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
138
- name: [client.name],
139
- root: mutation.file.path,
140
- path: client.file.path
141
- }),
142
- !shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
143
- name: ["buildFormData"],
144
- root: mutation.file.path,
145
- path: node_path.default.resolve(config.root, config.output.path, ".kubb/config.ts")
146
- }),
147
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
148
- name: [
149
- type.schemas.request?.name,
150
- type.schemas.response.name,
151
- type.schemas.pathParams?.name,
152
- type.schemas.queryParams?.name,
153
- type.schemas.headerParams?.name,
154
- ...type.schemas.statusCodes?.map((item) => item.name) || []
155
- ].filter(Boolean),
156
- root: mutation.file.path,
157
- path: type.file.path,
158
- isTypeOnly: true
159
- }),
160
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.MutationKey, {
161
- name: mutationKey.name,
162
- typeName: mutationKey.typeName,
163
- operation,
164
- pathParamsType: options.pathParamsType,
165
- typeSchemas: type.schemas,
166
- paramsCasing: options.paramsCasing,
167
- transformer: options.mutationKey
168
- }),
169
- !shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_plugin_client_components.Client, {
170
- name: client.name,
171
- baseURL: options.client.baseURL,
172
- operation,
173
- typeSchemas: type.schemas,
174
- zodSchemas: zod.schemas,
175
- dataReturnType: options.client.dataReturnType || "data",
176
- paramsCasing: options.client?.paramsCasing || options.paramsCasing,
177
- paramsType: options.paramsType,
178
- pathParamsType: options.pathParamsType,
179
- parser: options.parser
180
- }),
181
- options.mutation && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.Mutation, {
182
- name: mutation.name,
183
- clientName: client.name,
184
- typeName: mutation.typeName,
185
- typeSchemas: type.schemas,
186
- operation,
187
- dataReturnType: options.client.dataReturnType || "data",
188
- paramsType: options.paramsType,
189
- paramsCasing: options.paramsCasing,
190
- pathParamsType: options.pathParamsType,
191
- mutationKeyName: mutationKey.name,
192
- mutationKeyTypeName: mutationKey.typeName,
193
- paramsToTrigger: options.mutation.paramsToTrigger
194
- })
195
- ]
196
- });
197
- }
198
- });
199
- //#endregion
200
- //#region src/generators/queryGenerator.tsx
201
- const queryGenerator = (0, _kubb_plugin_oas_generators.createReactGenerator)({
202
- name: "swr-query",
203
- Operation({ config, operation, generator, plugin }) {
204
- const { options, options: { output } } = plugin;
205
- const driver = (0, _kubb_core_hooks.usePluginDriver)();
206
- const oas = (0, _kubb_plugin_oas_hooks.useOas)();
207
- const { getSchemas, getName, getFile } = (0, _kubb_plugin_oas_hooks.useOperationManager)(generator);
208
- const isQuery = typeof options.query === "boolean" ? true : options.query?.methods.some((method) => operation.method === method);
209
- const isMutation = (0, remeda.difference)(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method);
210
- const importPath = options.query ? options.query.importPath : "swr/mutation";
211
- const query = {
212
- name: getName(operation, {
213
- type: "function",
214
- prefix: "use"
215
- }),
216
- typeName: getName(operation, { type: "type" }),
217
- file: getFile(operation, { prefix: "use" })
218
- };
219
- const shouldUseClientPlugin = !!driver.getPluginByName(_kubb_plugin_client.pluginClientName) && options.client.clientType !== "class";
220
- const client = {
221
- name: shouldUseClientPlugin ? getName(operation, {
222
- type: "function",
223
- pluginName: _kubb_plugin_client.pluginClientName
224
- }) : getName(operation, { type: "function" }),
225
- file: getFile(operation, { pluginName: _kubb_plugin_client.pluginClientName })
226
- };
227
- const queryOptions = { name: getName(operation, {
228
- type: "function",
229
- suffix: "QueryOptions"
230
- }) };
231
- const queryKey = {
232
- name: getName(operation, {
233
- type: "const",
234
- suffix: "QueryKey"
235
- }),
236
- typeName: getName(operation, {
237
- type: "type",
238
- suffix: "QueryKey"
239
- })
240
- };
241
- const type = {
242
- file: getFile(operation, { pluginName: _kubb_plugin_ts.pluginTsName }),
243
- schemas: getSchemas(operation, {
244
- pluginName: _kubb_plugin_ts.pluginTsName,
245
- type: "type"
246
- })
247
- };
248
- const zod = {
249
- file: getFile(operation, { pluginName: _kubb_plugin_zod.pluginZodName }),
250
- schemas: getSchemas(operation, {
251
- pluginName: _kubb_plugin_zod.pluginZodName,
252
- type: "function"
253
- })
254
- };
255
- if (!isQuery || isMutation) return null;
256
- return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric.File, {
257
- baseName: query.file.baseName,
258
- path: query.file.path,
259
- meta: query.file.meta,
260
- banner: (0, _kubb_plugin_oas_utils.getBanner)({
261
- oas,
262
- output,
263
- config: driver.config
264
- }),
265
- footer: (0, _kubb_plugin_oas_utils.getFooter)({
266
- oas,
267
- output
268
- }),
269
- children: [
270
- options.parser === "zod" && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
271
- name: [zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean),
272
- root: query.file.path,
273
- path: zod.file.path
274
- }),
275
- options.client.importPath ? /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
276
- !shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
277
- name: "fetch",
278
- path: options.client.importPath
279
- }),
280
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
281
- name: [
282
- "Client",
283
- "RequestConfig",
284
- "ResponseErrorConfig"
285
- ],
286
- path: options.client.importPath,
287
- isTypeOnly: true
288
- }),
289
- options.client.dataReturnType === "full" && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
290
- name: ["ResponseConfig"],
291
- path: options.client.importPath,
292
- isTypeOnly: true
293
- })
294
- ] }) : /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
295
- !shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
296
- name: ["fetch"],
297
- root: query.file.path,
298
- path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts")
299
- }),
300
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
301
- name: [
302
- "Client",
303
- "RequestConfig",
304
- "ResponseErrorConfig"
305
- ],
306
- root: query.file.path,
307
- path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
308
- isTypeOnly: true
309
- }),
310
- options.client.dataReturnType === "full" && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
311
- name: ["ResponseConfig"],
312
- root: query.file.path,
313
- path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
314
- isTypeOnly: true
315
- })
316
- ] }),
317
- shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
318
- name: [client.name],
319
- root: query.file.path,
320
- path: client.file.path
321
- }),
322
- !shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
323
- name: ["buildFormData"],
324
- root: query.file.path,
325
- path: node_path.default.resolve(config.root, config.output.path, ".kubb/config.ts")
326
- }),
327
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
328
- name: [
329
- type.schemas.request?.name,
330
- type.schemas.response.name,
331
- type.schemas.pathParams?.name,
332
- type.schemas.queryParams?.name,
333
- type.schemas.headerParams?.name,
334
- ...type.schemas.statusCodes?.map((item) => item.name) || []
335
- ].filter(Boolean),
336
- root: query.file.path,
337
- path: type.file.path,
338
- isTypeOnly: true
339
- }),
340
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.QueryKey, {
341
- name: queryKey.name,
342
- typeName: queryKey.typeName,
343
- operation,
344
- pathParamsType: options.pathParamsType,
345
- typeSchemas: type.schemas,
346
- paramsCasing: options.paramsCasing,
347
- transformer: options.queryKey
348
- }),
349
- !shouldUseClientPlugin && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_plugin_client_components.Client, {
350
- name: client.name,
351
- baseURL: options.client.baseURL,
352
- operation,
353
- typeSchemas: type.schemas,
354
- zodSchemas: zod.schemas,
355
- dataReturnType: options.client.dataReturnType || "data",
356
- paramsCasing: options.client.paramsCasing || options.paramsCasing,
357
- paramsType: options.paramsType,
358
- pathParamsType: options.pathParamsType,
359
- parser: options.parser
360
- }),
361
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.QueryOptions, {
362
- name: queryOptions.name,
363
- clientName: client.name,
364
- typeSchemas: type.schemas,
365
- paramsType: options.paramsType,
366
- paramsCasing: options.paramsCasing,
367
- pathParamsType: options.pathParamsType
368
- }),
369
- options.query && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
370
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
371
- name: "useSWR",
372
- path: importPath
373
- }),
374
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
375
- name: ["SWRResponse"],
376
- path: importPath,
377
- isTypeOnly: true
378
- }),
379
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.Query, {
380
- name: query.name,
381
- queryOptionsName: queryOptions.name,
382
- typeSchemas: type.schemas,
383
- paramsType: options.paramsType,
384
- pathParamsType: options.pathParamsType,
385
- operation,
386
- dataReturnType: options.client.dataReturnType || "data",
387
- queryKeyName: queryKey.name,
388
- paramsCasing: options.paramsCasing,
389
- queryKeyTypeName: queryKey.typeName
390
- })
391
- ] })
392
- ]
393
- });
394
- }
395
- });
396
- //#endregion
397
- Object.defineProperty(exports, "mutationGenerator", {
398
- enumerable: true,
399
- get: function() {
400
- return mutationGenerator;
401
- }
402
- });
403
- Object.defineProperty(exports, "queryGenerator", {
404
- enumerable: true,
405
- get: function() {
406
- return queryGenerator;
407
- }
408
- });
409
-
410
- //# sourceMappingURL=generators-D062obA7.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generators-D062obA7.cjs","names":["pluginTsName","pluginZodName","pluginClientName","File","path","MutationKey","Client","Mutation","pluginClientName","pluginTsName","pluginZodName","File","path","QueryKey","Client","QueryOptions","Query"],"sources":["../src/generators/mutationGenerator.tsx","../src/generators/queryGenerator.tsx"],"sourcesContent":["import path from 'node:path'\nimport { usePluginDriver } from '@kubb/core/hooks'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File } from '@kubb/react-fabric'\nimport { difference } from 'remeda'\nimport { Mutation, MutationKey } from '../components'\nimport type { PluginSwr } from '../types'\n\nexport const mutationGenerator = createReactGenerator<PluginSwr>({\n name: 'swr-mutation',\n Operation({ config, operation, generator, plugin }) {\n const {\n options,\n options: { output },\n } = plugin\n const driver = usePluginDriver()\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const isQuery = !!options.query && options.query?.methods.some((method) => operation.method === method)\n const isMutation =\n options.mutation !== false &&\n !isQuery &&\n difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method)\n\n const importPath = options.mutation ? options.mutation.importPath : 'swr'\n\n const mutation = {\n name: getName(operation, { type: 'function', prefix: 'use' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'use' }),\n }\n\n const type = {\n file: getFile(operation, { pluginName: pluginTsName }),\n //todo remove type?\n schemas: getSchemas(operation, { pluginName: pluginTsName, type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginName: pluginZodName }),\n schemas: getSchemas(operation, { pluginName: pluginZodName, type: 'function' }),\n }\n\n const hasClientPlugin = !!driver.getPluginByName(pluginClientName)\n // Class-based clients are not compatible with query hooks, so we generate inline clients\n const shouldUseClientPlugin = hasClientPlugin && options.client.clientType !== 'class'\n const client = {\n name: shouldUseClientPlugin\n ? getName(operation, {\n type: 'function',\n pluginName: pluginClientName,\n })\n : getName(operation, {\n type: 'function',\n }),\n file: getFile(operation, { pluginName: pluginClientName }),\n }\n\n const mutationKey = {\n name: getName(operation, { type: 'const', suffix: 'MutationKey' }),\n typeName: getName(operation, { type: 'type', suffix: 'MutationKey' }),\n }\n\n if (!isMutation) {\n return null\n }\n\n return (\n <File\n baseName={mutation.file.baseName}\n path={mutation.file.path}\n meta={mutation.file.meta}\n banner={getBanner({ oas, output, config: driver.config })}\n footer={getFooter({ oas, output })}\n >\n {options.parser === 'zod' && (\n <File.Import name={[zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean)} root={mutation.file.path} path={zod.file.path} />\n )}\n {options.client.importPath ? (\n <>\n {!shouldUseClientPlugin && <File.Import name={'fetch'} path={options.client.importPath} />}\n <File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />\n {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}\n </>\n ) : (\n <>\n {!shouldUseClientPlugin && (\n <File.Import name={['fetch']} root={mutation.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n )}\n <File.Import\n name={['Client', 'RequestConfig', 'ResponseErrorConfig']}\n root={mutation.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n {options.client.dataReturnType === 'full' && (\n <File.Import\n name={['ResponseConfig']}\n root={mutation.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n )}\n </>\n )}\n <File.Import name=\"useSWRMutation\" path={importPath} />\n <File.Import name={['SWRMutationConfiguration', 'SWRMutationResponse']} path={importPath} isTypeOnly />\n {shouldUseClientPlugin && <File.Import name={[client.name]} root={mutation.file.path} path={client.file.path} />}\n {!shouldUseClientPlugin && (\n <File.Import name={['buildFormData']} root={mutation.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />\n )}\n <File.Import\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\n <MutationKey\n name={mutationKey.name}\n typeName={mutationKey.typeName}\n operation={operation}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n paramsCasing={options.paramsCasing}\n transformer={options.mutationKey}\n />\n\n {!shouldUseClientPlugin && (\n <Client\n name={client.name}\n baseURL={options.client.baseURL}\n operation={operation}\n typeSchemas={type.schemas}\n zodSchemas={zod.schemas}\n dataReturnType={options.client.dataReturnType || 'data'}\n paramsCasing={options.client?.paramsCasing || options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n parser={options.parser}\n />\n )}\n {options.mutation && (\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 || 'data'}\n paramsType={options.paramsType}\n paramsCasing={options.paramsCasing}\n pathParamsType={options.pathParamsType}\n mutationKeyName={mutationKey.name}\n mutationKeyTypeName={mutationKey.typeName}\n paramsToTrigger={options.mutation.paramsToTrigger}\n />\n )}\n </File>\n )\n },\n})\n","import path from 'node:path'\nimport { usePluginDriver } from '@kubb/core/hooks'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File } from '@kubb/react-fabric'\nimport { difference } from 'remeda'\nimport { Query, QueryKey, QueryOptions } from '../components'\nimport type { PluginSwr } from '../types'\n\nexport const queryGenerator = createReactGenerator<PluginSwr>({\n name: 'swr-query',\n Operation({ config, operation, generator, plugin }) {\n const {\n options,\n options: { output },\n } = plugin\n const driver = usePluginDriver()\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const isQuery = typeof options.query === 'boolean' ? true : options.query?.methods.some((method) => operation.method === method)\n const isMutation = difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some(\n (method) => operation.method === method,\n )\n const importPath = options.query ? options.query.importPath : 'swr/mutation'\n\n const query = {\n name: getName(operation, { type: 'function', prefix: 'use' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'use' }),\n }\n\n const hasClientPlugin = !!driver.getPluginByName(pluginClientName)\n // Class-based clients are not compatible with query hooks, so we generate inline clients\n const shouldUseClientPlugin = hasClientPlugin && options.client.clientType !== 'class'\n const client = {\n name: shouldUseClientPlugin\n ? getName(operation, {\n type: 'function',\n pluginName: pluginClientName,\n })\n : getName(operation, {\n type: 'function',\n }),\n file: getFile(operation, { pluginName: pluginClientName }),\n }\n\n const queryOptions = {\n name: getName(operation, { type: 'function', suffix: 'QueryOptions' }),\n }\n const queryKey = {\n name: getName(operation, { type: 'const', suffix: 'QueryKey' }),\n typeName: getName(operation, { type: 'type', suffix: 'QueryKey' }),\n }\n\n const type = {\n file: getFile(operation, { pluginName: pluginTsName }),\n //todo remove type?\n schemas: getSchemas(operation, {\n pluginName: pluginTsName,\n type: 'type',\n }),\n }\n\n const zod = {\n file: getFile(operation, { pluginName: pluginZodName }),\n schemas: getSchemas(operation, {\n pluginName: pluginZodName,\n type: 'function',\n }),\n }\n\n if (!isQuery || isMutation) {\n return null\n }\n\n return (\n <File\n baseName={query.file.baseName}\n path={query.file.path}\n meta={query.file.meta}\n banner={getBanner({ oas, output, config: driver.config })}\n footer={getFooter({ oas, output })}\n >\n {options.parser === 'zod' && (\n <File.Import name={[zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean)} root={query.file.path} path={zod.file.path} />\n )}\n {options.client.importPath ? (\n <>\n {!shouldUseClientPlugin && <File.Import name={'fetch'} path={options.client.importPath} />}\n <File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />\n {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}\n </>\n ) : (\n <>\n {!shouldUseClientPlugin && (\n <File.Import name={['fetch']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n )}\n <File.Import\n name={['Client', 'RequestConfig', 'ResponseErrorConfig']}\n root={query.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n {options.client.dataReturnType === 'full' && (\n <File.Import name={['ResponseConfig']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} isTypeOnly />\n )}\n </>\n )}\n {shouldUseClientPlugin && <File.Import name={[client.name]} root={query.file.path} path={client.file.path} />}\n {!shouldUseClientPlugin && (\n <File.Import name={['buildFormData']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />\n )}\n\n <File.Import\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 <QueryKey\n name={queryKey.name}\n typeName={queryKey.typeName}\n operation={operation}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n paramsCasing={options.paramsCasing}\n transformer={options.queryKey}\n />\n {!shouldUseClientPlugin && (\n <Client\n name={client.name}\n baseURL={options.client.baseURL}\n operation={operation}\n typeSchemas={type.schemas}\n zodSchemas={zod.schemas}\n dataReturnType={options.client.dataReturnType || 'data'}\n paramsCasing={options.client.paramsCasing || options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n parser={options.parser}\n />\n )}\n <QueryOptions\n name={queryOptions.name}\n clientName={client.name}\n typeSchemas={type.schemas}\n paramsType={options.paramsType}\n paramsCasing={options.paramsCasing}\n pathParamsType={options.pathParamsType}\n />\n {options.query && (\n <>\n <File.Import name=\"useSWR\" path={importPath} />\n <File.Import name={['SWRResponse']} path={importPath} isTypeOnly />\n <Query\n name={query.name}\n queryOptionsName={queryOptions.name}\n typeSchemas={type.schemas}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n operation={operation}\n dataReturnType={options.client.dataReturnType || 'data'}\n queryKeyName={queryKey.name}\n paramsCasing={options.paramsCasing}\n queryKeyTypeName={queryKey.typeName}\n />\n </>\n )}\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;AAcA,MAAa,qBAAA,GAAA,4BAAA,sBAAoD;CAC/D,MAAM;CACN,UAAU,EAAE,QAAQ,WAAW,WAAW,UAAU;EAClD,MAAM,EACJ,SACA,SAAS,EAAE,aACT;EACJ,MAAM,UAAA,GAAA,iBAAA,k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,OAAD;MACE,MAAM,MAAM;MACZ,kBAAkB,aAAa;MAC/B,aAAa,KAAK;MAClB,YAAY,QAAQ;MACpB,gBAAgB,QAAQ;MACb;MACX,gBAAgB,QAAQ,OAAO,kBAAkB;MACjD,cAAc,SAAS;MACvB,cAAc,QAAQ;MACtB,kBAAkB,SAAS;MAC3B,CAAA;KACD,EAAA,CAAA;IAEA;;;CAGZ,CAAC"}
@@ -1,210 +0,0 @@
1
- import { t as __name } from "./chunk--u3MIqq1.js";
2
- import { Group, Output, PluginFactoryOptions, ResolveNameParams } from "@kubb/core";
3
- import { ClientImportPath, PluginClient } from "@kubb/plugin-client";
4
- import { Exclude, Include, OperationSchemas, Override, ResolvePathOptions } from "@kubb/plugin-oas";
5
- import { HttpMethod, Oas, Operation, contentType } from "@kubb/oas";
6
- import { FunctionParams } from "@kubb/react-fabric";
7
- import { Generator as Generator$1 } from "@kubb/plugin-oas/generators";
8
- import { FabricReactNode } from "@kubb/react-fabric/types";
9
-
10
- //#region ../../internals/tanstack-query/src/types.d.ts
11
- type ParamsCasing = 'camelcase' | undefined;
12
- type PathParamsType = 'object' | 'inline';
13
- type TransformerProps = {
14
- operation: Operation;
15
- schemas: OperationSchemas;
16
- casing: ParamsCasing;
17
- };
18
- type Transformer = (props: TransformerProps) => unknown[];
19
- //#endregion
20
- //#region ../../internals/tanstack-query/src/components/MutationKey.d.ts
21
- type Props$1 = {
22
- name: string;
23
- typeName: string;
24
- typeSchemas: OperationSchemas;
25
- operation: Operation;
26
- paramsCasing: ParamsCasing;
27
- pathParamsType: PathParamsType;
28
- transformer: Transformer | undefined;
29
- };
30
- type GetParamsProps$1 = {
31
- pathParamsType: PathParamsType;
32
- typeSchemas: OperationSchemas;
33
- };
34
- declare function MutationKey$1({
35
- name,
36
- typeSchemas,
37
- pathParamsType,
38
- paramsCasing,
39
- operation,
40
- typeName,
41
- transformer
42
- }: Props$1): FabricReactNode;
43
- declare namespace MutationKey$1 {
44
- var getParams: ({}: GetParamsProps$1) => FunctionParams;
45
- var getTransformer: Transformer;
46
- }
47
- //#endregion
48
- //#region ../../internals/tanstack-query/src/components/QueryKey.d.ts
49
- type Props = {
50
- name: string;
51
- typeName: string;
52
- typeSchemas: OperationSchemas;
53
- operation: Operation;
54
- paramsCasing: ParamsCasing;
55
- pathParamsType: PathParamsType;
56
- transformer: Transformer | undefined;
57
- };
58
- type GetParamsProps = {
59
- paramsCasing: ParamsCasing;
60
- pathParamsType: PathParamsType;
61
- typeSchemas: OperationSchemas;
62
- };
63
- declare function QueryKey$1({
64
- name,
65
- typeSchemas,
66
- paramsCasing,
67
- pathParamsType,
68
- operation,
69
- typeName,
70
- transformer
71
- }: Props): FabricReactNode;
72
- declare namespace QueryKey$1 {
73
- var getParams: ({
74
- pathParamsType,
75
- paramsCasing,
76
- typeSchemas
77
- }: GetParamsProps) => FunctionParams;
78
- var getTransformer: Transformer;
79
- }
80
- //#endregion
81
- //#region src/types.d.ts
82
- /**
83
- * Customize the queryKey
84
- */
85
- type QueryKey = Transformer;
86
- /**
87
- * Customize the mutationKey
88
- */
89
- type MutationKey = Transformer;
90
- type Query = {
91
- /**
92
- * Define which HttpMethods can be used for queries
93
- * @default ['get']
94
- */
95
- methods?: Array<HttpMethod>;
96
- /**
97
- * Path to the useQuery hook for useQuery functionality.
98
- * Used as `import { useQuery } from '${importPath}'`.
99
- * Accepts relative and absolute paths.
100
- * Path is used as-is; relative paths are based on the generated file location.
101
- * @default 'swr'
102
- */
103
- importPath?: string;
104
- };
105
- type Mutation = {
106
- /**
107
- * Define which HttpMethods can be used for queries
108
- * @default ['post', 'put', 'delete', 'patch']
109
- */
110
- methods?: Array<HttpMethod>;
111
- /**
112
- * Path to the useQuery hook for useQuery functionality.
113
- * Used as `import { useQuery } from '${importPath}'`.
114
- * Accepts relative and absolute paths.
115
- * Path is used as-is; relative paths are based on the generated file location.
116
- * @default 'swr/mutation'
117
- */
118
- importPath?: string;
119
- /**
120
- * When true, mutation parameters (path params, query params, headers, body) is passed via `trigger()` instead of as hook arguments.
121
- * This aligns with React Query's mutation pattern where variables are passed when triggering the mutation.
122
- * @default false
123
- * @deprecated This will become the default behavior in v5. Set to `true` to opt-in early.
124
- */
125
- paramsToTrigger?: boolean;
126
- };
127
- type Options = {
128
- /**
129
- * Specify the export location for the files and define the behavior of the output
130
- * @default { path: 'hooks', barrelType: 'named' }
131
- */
132
- output?: Output<Oas>;
133
- /**
134
- * Define which contentType should be used.
135
- * By default, the first JSON valid mediaType is used
136
- */
137
- contentType?: contentType;
138
- /**
139
- * Group the SWR hooks based on the provided name.
140
- */
141
- group?: Group;
142
- /**
143
- * Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
144
- */
145
- exclude?: Array<Exclude>;
146
- /**
147
- * Array containing include parameters to include tags/operations/methods/paths.
148
- */
149
- include?: Array<Include>;
150
- /**
151
- * Array containing override parameters to override `options` based on tags/operations/methods/paths.
152
- */
153
- override?: Array<Override<ResolvedOptions>>;
154
- client?: ClientImportPath & Pick<PluginClient['options'], 'clientType' | 'dataReturnType' | 'baseURL' | 'bundle' | 'paramsCasing'>;
155
- queryKey?: QueryKey;
156
- query?: Query | false;
157
- mutationKey?: MutationKey;
158
- mutation?: Mutation | false;
159
- /**
160
- * How to style your params, by default no casing is applied
161
- * - 'camelcase' uses camelcase for the params names
162
- */
163
- paramsCasing?: 'camelcase';
164
- /**
165
- * How to pass your params
166
- * - 'object' returns the params and pathParams as an object.
167
- * - 'inline' returns the params as comma separated params.
168
- * @default 'inline'
169
- */
170
- paramsType?: 'object' | 'inline';
171
- /**
172
- * How to pass your pathParams.
173
- * - 'object' returns the pathParams as an object.
174
- * - 'inline': returns the pathParams as comma separated params.
175
- * @default 'inline'
176
- */
177
- pathParamsType?: PluginClient['options']['pathParamsType'];
178
- /**
179
- * Which parser should be used before returning the data to `swr`.
180
- * `'zod'` uses `@kubb/plugin-zod` to parse the data.
181
- */
182
- parser?: PluginClient['options']['parser'];
183
- transformers?: {
184
- /**
185
- * Customize the names based on the type that is provided by the plugin.
186
- */
187
- name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
188
- };
189
- /**
190
- * Define some generators next to the swr generators
191
- */
192
- generators?: Array<Generator$1<PluginSwr>>;
193
- };
194
- type ResolvedOptions = {
195
- output: Output<Oas>;
196
- client: Pick<PluginClient['options'], 'client' | 'clientType' | 'dataReturnType' | 'importPath' | 'baseURL' | 'bundle' | 'paramsCasing'>;
197
- parser: Required<NonNullable<Options['parser']>>;
198
- queryKey: QueryKey | undefined;
199
- query: NonNullable<Required<Query>> | false;
200
- mutationKey: MutationKey | undefined;
201
- mutation: (Required<Pick<Mutation, 'methods' | 'importPath'>> & Pick<Mutation, 'paramsToTrigger'>) | false;
202
- paramsCasing: Options['paramsCasing'];
203
- paramsType: NonNullable<Options['paramsType']>;
204
- pathParamsType: NonNullable<Options['pathParamsType']>;
205
- group: Options['group'];
206
- };
207
- type PluginSwr = PluginFactoryOptions<'plugin-swr', Options, ResolvedOptions, never, ResolvePathOptions>;
208
- //#endregion
209
- export { MutationKey$1 as i, PluginSwr as n, QueryKey$1 as r, Options as t };
210
- //# sourceMappingURL=types-BIaGRPjD.d.ts.map