@kubb/plugin-vue-query 5.0.0-alpha.9 → 5.0.0-beta.15

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 (47) hide show
  1. package/LICENSE +17 -10
  2. package/README.md +26 -7
  3. package/dist/components-1cEftHJm.cjs +1276 -0
  4. package/dist/components-1cEftHJm.cjs.map +1 -0
  5. package/dist/components-DTSvTMEo.js +1162 -0
  6. package/dist/components-DTSvTMEo.js.map +1 -0
  7. package/dist/components.cjs +1 -1
  8. package/dist/components.d.ts +66 -121
  9. package/dist/components.js +1 -1
  10. package/dist/generators-BEiWCS-U.cjs +698 -0
  11. package/dist/generators-BEiWCS-U.cjs.map +1 -0
  12. package/dist/generators-F6_EduRU.js +681 -0
  13. package/dist/generators-F6_EduRU.js.map +1 -0
  14. package/dist/generators.cjs +1 -1
  15. package/dist/generators.d.ts +5 -501
  16. package/dist/generators.js +1 -1
  17. package/dist/index.cjs +150 -121
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.ts +4 -4
  20. package/dist/index.js +146 -121
  21. package/dist/index.js.map +1 -1
  22. package/dist/types-Bkm7bWT3.d.ts +243 -0
  23. package/extension.yaml +749 -0
  24. package/package.json +60 -65
  25. package/src/components/InfiniteQuery.tsx +71 -159
  26. package/src/components/InfiniteQueryOptions.tsx +120 -163
  27. package/src/components/Mutation.tsx +97 -134
  28. package/src/components/Query.tsx +68 -157
  29. package/src/components/QueryKey.tsx +23 -66
  30. package/src/components/QueryOptions.tsx +97 -143
  31. package/src/generators/infiniteQueryGenerator.tsx +152 -171
  32. package/src/generators/mutationGenerator.tsx +102 -125
  33. package/src/generators/queryGenerator.tsx +125 -137
  34. package/src/index.ts +1 -1
  35. package/src/plugin.ts +126 -177
  36. package/src/resolvers/resolverVueQuery.ts +65 -0
  37. package/src/types.ts +121 -52
  38. package/src/utils.ts +49 -0
  39. package/dist/components-Yjoe78Y7.cjs +0 -1119
  40. package/dist/components-Yjoe78Y7.cjs.map +0 -1
  41. package/dist/components-_AMBl0g-.js +0 -1029
  42. package/dist/components-_AMBl0g-.js.map +0 -1
  43. package/dist/generators-CR34GjVu.js +0 -661
  44. package/dist/generators-CR34GjVu.js.map +0 -1
  45. package/dist/generators-DH8VkK1q.cjs +0 -678
  46. package/dist/generators-DH8VkK1q.cjs.map +0 -1
  47. package/dist/types-CgDFUvfZ.d.ts +0 -211
@@ -0,0 +1,681 @@
1
+ import "./chunk--u3MIqq1.js";
2
+ import { a as QueryOptions, c as resolveZodSchemaNames, d as MutationKey, i as InfiniteQuery, l as getOperationParameters, n as Mutation, o as QueryKey, r as InfiniteQueryOptions, t as Query, u as resolveOperationTypeNames } from "./components-DTSvTMEo.js";
3
+ import path from "node:path";
4
+ import { defineGenerator } from "@kubb/core";
5
+ import { Client, pluginClientName } from "@kubb/plugin-client";
6
+ import { pluginTsName } from "@kubb/plugin-ts";
7
+ import { pluginZodName } from "@kubb/plugin-zod";
8
+ import { File, jsxRendererSync } from "@kubb/renderer-jsx";
9
+ import { Fragment, jsx, jsxs } from "@kubb/renderer-jsx/jsx-runtime";
10
+ import { difference } from "remeda";
11
+ //#region src/generators/infiniteQueryGenerator.tsx
12
+ const infiniteQueryGenerator = defineGenerator({
13
+ name: "vue-query-infinite",
14
+ renderer: jsxRendererSync,
15
+ operation(node, ctx) {
16
+ const { config, driver, resolver, root, inputNode } = ctx;
17
+ const { output, query, mutation, infinite, paramsCasing, paramsType, pathParamsType, parser, client: clientOptions, group } = ctx.options;
18
+ const pluginTs = driver.getPlugin(pluginTsName);
19
+ if (!pluginTs) return null;
20
+ const tsResolver = driver.getResolver(pluginTsName);
21
+ const isQuery = query === false || !!query && query.methods.some((method) => node.method.toLowerCase() === method.toLowerCase());
22
+ const isMutation = mutation !== false && !isQuery && difference(mutation ? mutation.methods : [], query ? query.methods : []).some((method) => node.method.toLowerCase() === method.toLowerCase());
23
+ const infiniteOptions = infinite && typeof infinite === "object" ? infinite : void 0;
24
+ if (!isQuery || isMutation || !infiniteOptions) return null;
25
+ const normalizeKey = (key) => key.replace(/\?$/, "");
26
+ const queryParamKeys = getOperationParameters(node).query.map((p) => p.name);
27
+ const hasQueryParam = infiniteOptions.queryParam ? queryParamKeys.some((k) => normalizeKey(k) === infiniteOptions.queryParam) : false;
28
+ const hasCursorParam = !infiniteOptions.cursorParam || true;
29
+ if (!hasQueryParam || !hasCursorParam) return null;
30
+ const importPath = query ? query.importPath : "@tanstack/vue-query";
31
+ const queryName = resolver.resolveInfiniteQueryName(node);
32
+ const queryOptionsName = resolver.resolveInfiniteQueryOptionsName(node);
33
+ const queryKeyName = resolver.resolveInfiniteQueryKeyName(node);
34
+ const queryKeyTypeName = resolver.resolveInfiniteQueryKeyTypeName(node);
35
+ const clientBaseName = resolver.resolveInfiniteClientName(node);
36
+ const meta = {
37
+ file: resolver.resolveFile({
38
+ name: queryName,
39
+ extname: ".ts",
40
+ tag: node.tags[0] ?? "default",
41
+ path: node.path
42
+ }, {
43
+ root,
44
+ output,
45
+ group
46
+ }),
47
+ fileTs: tsResolver.resolveFile({
48
+ name: node.operationId,
49
+ extname: ".ts",
50
+ tag: node.tags[0] ?? "default",
51
+ path: node.path
52
+ }, {
53
+ root,
54
+ output: pluginTs.options?.output ?? output,
55
+ group: pluginTs.options?.group
56
+ })
57
+ };
58
+ const importedTypeNames = resolveOperationTypeNames(node, tsResolver, {
59
+ paramsCasing,
60
+ exclude: [queryKeyTypeName],
61
+ order: "body-response-first"
62
+ });
63
+ const pluginZod = parser === "zod" ? driver.getPlugin(pluginZodName) : void 0;
64
+ const zodResolver = pluginZod ? driver.getResolver(pluginZodName) : void 0;
65
+ const fileZod = zodResolver ? zodResolver.resolveFile({
66
+ name: node.operationId,
67
+ extname: ".ts",
68
+ tag: node.tags[0] ?? "default",
69
+ path: node.path
70
+ }, {
71
+ root,
72
+ output: pluginZod?.options?.output ?? output,
73
+ group: pluginZod?.options?.group
74
+ }) : void 0;
75
+ const zodSchemaNames = resolveZodSchemaNames(node, zodResolver);
76
+ const clientPlugin = driver.getPlugin(pluginClientName);
77
+ const shouldUseClientPlugin = clientPlugin?.name === pluginClientName && clientOptions.clientType !== "class";
78
+ const clientResolver = shouldUseClientPlugin ? driver.getResolver(pluginClientName) : void 0;
79
+ const clientFile = shouldUseClientPlugin ? clientResolver?.resolveFile({
80
+ name: node.operationId,
81
+ extname: ".ts",
82
+ tag: node.tags[0] ?? "default",
83
+ path: node.path
84
+ }, {
85
+ root,
86
+ output: clientPlugin?.options?.output ?? output,
87
+ group: clientPlugin?.options?.group
88
+ }) : void 0;
89
+ const resolvedClientName = shouldUseClientPlugin ? clientResolver?.resolveName(node.operationId) ?? clientBaseName : clientBaseName;
90
+ return /* @__PURE__ */ jsxs(File, {
91
+ baseName: meta.file.baseName,
92
+ path: meta.file.path,
93
+ meta: meta.file.meta,
94
+ banner: resolver.resolveBanner(inputNode, {
95
+ output,
96
+ config
97
+ }),
98
+ footer: resolver.resolveFooter(inputNode, {
99
+ output,
100
+ config
101
+ }),
102
+ children: [
103
+ fileZod && zodSchemaNames.length > 0 && /* @__PURE__ */ jsx(File.Import, {
104
+ name: zodSchemaNames,
105
+ root: meta.file.path,
106
+ path: fileZod.path
107
+ }),
108
+ clientOptions.importPath ? /* @__PURE__ */ jsxs(Fragment, { children: [
109
+ !shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
110
+ name: "fetch",
111
+ path: clientOptions.importPath
112
+ }),
113
+ /* @__PURE__ */ jsx(File.Import, {
114
+ name: [
115
+ "Client",
116
+ "RequestConfig",
117
+ "ResponseErrorConfig"
118
+ ],
119
+ path: clientOptions.importPath,
120
+ isTypeOnly: true
121
+ }),
122
+ clientOptions.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
123
+ name: ["ResponseConfig"],
124
+ path: clientOptions.importPath,
125
+ isTypeOnly: true
126
+ })
127
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
128
+ !shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
129
+ name: ["fetch"],
130
+ root: meta.file.path,
131
+ path: path.resolve(root, ".kubb/fetch.ts")
132
+ }),
133
+ /* @__PURE__ */ jsx(File.Import, {
134
+ name: [
135
+ "Client",
136
+ "RequestConfig",
137
+ "ResponseErrorConfig"
138
+ ],
139
+ root: meta.file.path,
140
+ path: path.resolve(root, ".kubb/fetch.ts"),
141
+ isTypeOnly: true
142
+ }),
143
+ clientOptions.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
144
+ name: ["ResponseConfig"],
145
+ root: meta.file.path,
146
+ path: path.resolve(root, ".kubb/fetch.ts"),
147
+ isTypeOnly: true
148
+ })
149
+ ] }),
150
+ /* @__PURE__ */ jsx(File.Import, {
151
+ name: ["toValue"],
152
+ path: "vue"
153
+ }),
154
+ /* @__PURE__ */ jsx(File.Import, {
155
+ name: ["MaybeRefOrGetter"],
156
+ path: "vue",
157
+ isTypeOnly: true
158
+ }),
159
+ shouldUseClientPlugin && clientFile && /* @__PURE__ */ jsx(File.Import, {
160
+ name: [resolvedClientName],
161
+ root: meta.file.path,
162
+ path: clientFile.path
163
+ }),
164
+ !shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
165
+ name: ["buildFormData"],
166
+ root: meta.file.path,
167
+ path: path.resolve(root, ".kubb/config.ts")
168
+ }),
169
+ meta.fileTs && importedTypeNames.length > 0 && /* @__PURE__ */ jsx(File.Import, {
170
+ name: Array.from(new Set(importedTypeNames)),
171
+ root: meta.file.path,
172
+ path: meta.fileTs.path,
173
+ isTypeOnly: true
174
+ }),
175
+ /* @__PURE__ */ jsx(QueryKey, {
176
+ name: queryKeyName,
177
+ typeName: queryKeyTypeName,
178
+ node,
179
+ tsResolver,
180
+ pathParamsType,
181
+ paramsCasing,
182
+ transformer: ctx.options.queryKey
183
+ }),
184
+ !shouldUseClientPlugin && /* @__PURE__ */ jsx(Client, {
185
+ name: resolvedClientName,
186
+ baseURL: clientOptions.baseURL,
187
+ dataReturnType: clientOptions.dataReturnType || "data",
188
+ paramsCasing: clientOptions.paramsCasing || paramsCasing,
189
+ paramsType,
190
+ pathParamsType,
191
+ parser,
192
+ node,
193
+ tsResolver,
194
+ zodResolver
195
+ }),
196
+ /* @__PURE__ */ jsx(File.Import, {
197
+ name: ["InfiniteData"],
198
+ isTypeOnly: true,
199
+ path: importPath
200
+ }),
201
+ /* @__PURE__ */ jsx(File.Import, {
202
+ name: ["infiniteQueryOptions"],
203
+ path: importPath
204
+ }),
205
+ /* @__PURE__ */ jsx(InfiniteQueryOptions, {
206
+ name: queryOptionsName,
207
+ clientName: resolvedClientName,
208
+ queryKeyName,
209
+ node,
210
+ tsResolver,
211
+ paramsCasing,
212
+ paramsType,
213
+ pathParamsType,
214
+ dataReturnType: clientOptions.dataReturnType || "data",
215
+ cursorParam: infiniteOptions.cursorParam,
216
+ nextParam: infiniteOptions.nextParam,
217
+ previousParam: infiniteOptions.previousParam,
218
+ initialPageParam: infiniteOptions.initialPageParam,
219
+ queryParam: infiniteOptions.queryParam
220
+ }),
221
+ /* @__PURE__ */ jsx(File.Import, {
222
+ name: ["useInfiniteQuery"],
223
+ path: importPath
224
+ }),
225
+ /* @__PURE__ */ jsx(File.Import, {
226
+ name: [
227
+ "QueryKey",
228
+ "QueryClient",
229
+ "UseInfiniteQueryOptions",
230
+ "UseInfiniteQueryReturnType"
231
+ ],
232
+ path: importPath,
233
+ isTypeOnly: true
234
+ }),
235
+ /* @__PURE__ */ jsx(InfiniteQuery, {
236
+ name: queryName,
237
+ queryOptionsName,
238
+ queryKeyName,
239
+ queryKeyTypeName,
240
+ node,
241
+ tsResolver,
242
+ paramsCasing,
243
+ paramsType,
244
+ pathParamsType,
245
+ dataReturnType: clientOptions.dataReturnType || "data",
246
+ initialPageParam: infiniteOptions.initialPageParam,
247
+ queryParam: infiniteOptions.queryParam
248
+ })
249
+ ]
250
+ });
251
+ }
252
+ });
253
+ //#endregion
254
+ //#region src/generators/mutationGenerator.tsx
255
+ const mutationGenerator = defineGenerator({
256
+ name: "vue-query-mutation",
257
+ renderer: jsxRendererSync,
258
+ operation(node, ctx) {
259
+ const { config, driver, resolver, root, inputNode } = ctx;
260
+ const { output, query, mutation, paramsCasing, paramsType, pathParamsType, parser, client: clientOptions, group } = ctx.options;
261
+ const pluginTs = driver.getPlugin(pluginTsName);
262
+ if (!pluginTs) return null;
263
+ const tsResolver = driver.getResolver(pluginTsName);
264
+ const isQuery = query === false || !!query && query.methods.some((method) => node.method.toLowerCase() === method.toLowerCase());
265
+ if (!(mutation !== false && !isQuery && difference(mutation ? mutation.methods : [], query ? query.methods : []).some((method) => node.method.toLowerCase() === method.toLowerCase()))) return null;
266
+ const importPath = mutation ? mutation.importPath : "@tanstack/vue-query";
267
+ const mutationHookName = resolver.resolveMutationName(node);
268
+ const mutationTypeName = resolver.resolveMutationTypeName(node);
269
+ const mutationKeyName = resolver.resolveMutationKeyName(node);
270
+ const clientName = resolver.resolveClientName(node);
271
+ const meta = {
272
+ file: resolver.resolveFile({
273
+ name: mutationHookName,
274
+ extname: ".ts",
275
+ tag: node.tags[0] ?? "default",
276
+ path: node.path
277
+ }, {
278
+ root,
279
+ output,
280
+ group
281
+ }),
282
+ fileTs: tsResolver.resolveFile({
283
+ name: node.operationId,
284
+ extname: ".ts",
285
+ tag: node.tags[0] ?? "default",
286
+ path: node.path
287
+ }, {
288
+ root,
289
+ output: pluginTs.options?.output ?? output,
290
+ group: pluginTs.options?.group
291
+ })
292
+ };
293
+ const importedTypeNames = resolveOperationTypeNames(node, tsResolver, {
294
+ paramsCasing,
295
+ order: "body-response-first"
296
+ });
297
+ const pluginZod = parser === "zod" ? driver.getPlugin(pluginZodName) : void 0;
298
+ const zodResolver = pluginZod ? driver.getResolver(pluginZodName) : void 0;
299
+ const fileZod = zodResolver ? zodResolver.resolveFile({
300
+ name: node.operationId,
301
+ extname: ".ts",
302
+ tag: node.tags[0] ?? "default",
303
+ path: node.path
304
+ }, {
305
+ root,
306
+ output: pluginZod?.options?.output ?? output,
307
+ group: pluginZod?.options?.group
308
+ }) : void 0;
309
+ const zodSchemaNames = resolveZodSchemaNames(node, zodResolver);
310
+ const clientPlugin = driver.getPlugin(pluginClientName);
311
+ const shouldUseClientPlugin = clientPlugin?.name === pluginClientName && clientOptions.clientType !== "class";
312
+ const clientResolver = shouldUseClientPlugin ? driver.getResolver(pluginClientName) : void 0;
313
+ const clientFile = shouldUseClientPlugin ? clientResolver?.resolveFile({
314
+ name: node.operationId,
315
+ extname: ".ts",
316
+ tag: node.tags[0] ?? "default",
317
+ path: node.path
318
+ }, {
319
+ root,
320
+ output: clientPlugin?.options?.output ?? output,
321
+ group: clientPlugin?.options?.group
322
+ }) : void 0;
323
+ const resolvedClientName = shouldUseClientPlugin ? clientResolver?.resolveName(node.operationId) ?? clientName : clientName;
324
+ return /* @__PURE__ */ jsxs(File, {
325
+ baseName: meta.file.baseName,
326
+ path: meta.file.path,
327
+ meta: meta.file.meta,
328
+ banner: resolver.resolveBanner(inputNode, {
329
+ output,
330
+ config
331
+ }),
332
+ footer: resolver.resolveFooter(inputNode, {
333
+ output,
334
+ config
335
+ }),
336
+ children: [
337
+ fileZod && zodSchemaNames.length > 0 && /* @__PURE__ */ jsx(File.Import, {
338
+ name: zodSchemaNames,
339
+ root: meta.file.path,
340
+ path: fileZod.path
341
+ }),
342
+ clientOptions.importPath ? /* @__PURE__ */ jsxs(Fragment, { children: [
343
+ !shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
344
+ name: "fetch",
345
+ path: clientOptions.importPath
346
+ }),
347
+ /* @__PURE__ */ jsx(File.Import, {
348
+ name: [
349
+ "Client",
350
+ "RequestConfig",
351
+ "ResponseErrorConfig"
352
+ ],
353
+ path: clientOptions.importPath,
354
+ isTypeOnly: true
355
+ }),
356
+ clientOptions.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
357
+ name: ["ResponseConfig"],
358
+ path: clientOptions.importPath,
359
+ isTypeOnly: true
360
+ })
361
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
362
+ !shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
363
+ name: ["fetch"],
364
+ root: meta.file.path,
365
+ path: path.resolve(root, ".kubb/fetch.ts")
366
+ }),
367
+ /* @__PURE__ */ jsx(File.Import, {
368
+ name: [
369
+ "Client",
370
+ "RequestConfig",
371
+ "ResponseErrorConfig"
372
+ ],
373
+ root: meta.file.path,
374
+ path: path.resolve(root, ".kubb/fetch.ts"),
375
+ isTypeOnly: true
376
+ }),
377
+ clientOptions.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
378
+ name: ["ResponseConfig"],
379
+ root: meta.file.path,
380
+ path: path.resolve(root, ".kubb/fetch.ts"),
381
+ isTypeOnly: true
382
+ })
383
+ ] }),
384
+ /* @__PURE__ */ jsx(File.Import, {
385
+ name: ["MaybeRefOrGetter"],
386
+ path: "vue",
387
+ isTypeOnly: true
388
+ }),
389
+ shouldUseClientPlugin && clientFile && /* @__PURE__ */ jsx(File.Import, {
390
+ name: [resolvedClientName],
391
+ root: meta.file.path,
392
+ path: clientFile.path
393
+ }),
394
+ !shouldUseClientPlugin && node.requestBody?.content?.some((e) => e.contentType === "multipart/form-data") && /* @__PURE__ */ jsx(File.Import, {
395
+ name: ["buildFormData"],
396
+ root: meta.file.path,
397
+ path: path.resolve(root, ".kubb/config.ts")
398
+ }),
399
+ meta.fileTs && importedTypeNames.length > 0 && /* @__PURE__ */ jsx(File.Import, {
400
+ name: Array.from(new Set(importedTypeNames)),
401
+ root: meta.file.path,
402
+ path: meta.fileTs.path,
403
+ isTypeOnly: true
404
+ }),
405
+ /* @__PURE__ */ jsx(MutationKey, {
406
+ name: mutationKeyName,
407
+ node,
408
+ pathParamsType,
409
+ paramsCasing,
410
+ transformer: ctx.options.mutationKey
411
+ }),
412
+ !shouldUseClientPlugin && /* @__PURE__ */ jsx(Client, {
413
+ name: resolvedClientName,
414
+ baseURL: clientOptions.baseURL,
415
+ dataReturnType: clientOptions.dataReturnType || "data",
416
+ paramsCasing: clientOptions.paramsCasing || paramsCasing,
417
+ paramsType,
418
+ pathParamsType,
419
+ parser,
420
+ node,
421
+ tsResolver,
422
+ zodResolver
423
+ }),
424
+ mutation && /* @__PURE__ */ jsxs(Fragment, { children: [
425
+ /* @__PURE__ */ jsx(File.Import, {
426
+ name: ["useMutation"],
427
+ path: importPath
428
+ }),
429
+ /* @__PURE__ */ jsx(File.Import, {
430
+ name: ["MutationObserverOptions", "QueryClient"],
431
+ path: importPath,
432
+ isTypeOnly: true
433
+ }),
434
+ /* @__PURE__ */ jsx(Mutation, {
435
+ name: mutationHookName,
436
+ clientName: resolvedClientName,
437
+ typeName: mutationTypeName,
438
+ node,
439
+ tsResolver,
440
+ paramsCasing,
441
+ dataReturnType: clientOptions.dataReturnType || "data",
442
+ paramsType,
443
+ pathParamsType,
444
+ mutationKeyName
445
+ })
446
+ ] })
447
+ ]
448
+ });
449
+ }
450
+ });
451
+ //#endregion
452
+ //#region src/generators/queryGenerator.tsx
453
+ const queryGenerator = defineGenerator({
454
+ name: "vue-query",
455
+ renderer: jsxRendererSync,
456
+ operation(node, ctx) {
457
+ const { config, driver, resolver, root, inputNode } = ctx;
458
+ const { output, query, mutation, paramsCasing, paramsType, pathParamsType, parser, client: clientOptions, group } = ctx.options;
459
+ const pluginTs = driver.getPlugin(pluginTsName);
460
+ if (!pluginTs) return null;
461
+ const tsResolver = driver.getResolver(pluginTsName);
462
+ const isQuery = query === false || !!query && query.methods.some((method) => node.method.toLowerCase() === method.toLowerCase());
463
+ const isMutation = mutation !== false && !isQuery && difference(mutation ? mutation.methods : [], query ? query.methods : []).some((method) => node.method.toLowerCase() === method.toLowerCase());
464
+ if (!isQuery || isMutation) return null;
465
+ const importPath = query ? query.importPath : "@tanstack/vue-query";
466
+ const queryName = resolver.resolveQueryName(node);
467
+ const queryOptionsName = resolver.resolveQueryOptionsName(node);
468
+ const queryKeyName = resolver.resolveQueryKeyName(node);
469
+ const queryKeyTypeName = resolver.resolveQueryKeyTypeName(node);
470
+ const clientName = resolver.resolveClientName(node);
471
+ const meta = {
472
+ file: resolver.resolveFile({
473
+ name: queryName,
474
+ extname: ".ts",
475
+ tag: node.tags[0] ?? "default",
476
+ path: node.path
477
+ }, {
478
+ root,
479
+ output,
480
+ group
481
+ }),
482
+ fileTs: tsResolver.resolveFile({
483
+ name: node.operationId,
484
+ extname: ".ts",
485
+ tag: node.tags[0] ?? "default",
486
+ path: node.path
487
+ }, {
488
+ root,
489
+ output: pluginTs.options?.output ?? output,
490
+ group: pluginTs.options?.group
491
+ })
492
+ };
493
+ const importedTypeNames = resolveOperationTypeNames(node, tsResolver, {
494
+ paramsCasing,
495
+ exclude: [queryKeyTypeName],
496
+ order: "body-response-first"
497
+ });
498
+ const pluginZod = parser === "zod" ? driver.getPlugin(pluginZodName) : void 0;
499
+ const zodResolver = pluginZod ? driver.getResolver(pluginZodName) : void 0;
500
+ const fileZod = zodResolver ? zodResolver.resolveFile({
501
+ name: node.operationId,
502
+ extname: ".ts",
503
+ tag: node.tags[0] ?? "default",
504
+ path: node.path
505
+ }, {
506
+ root,
507
+ output: pluginZod?.options?.output ?? output,
508
+ group: pluginZod?.options?.group
509
+ }) : void 0;
510
+ const zodSchemaNames = resolveZodSchemaNames(node, zodResolver);
511
+ const clientPlugin = driver.getPlugin(pluginClientName);
512
+ const shouldUseClientPlugin = clientPlugin?.name === pluginClientName && clientOptions.clientType !== "class";
513
+ const clientResolver = shouldUseClientPlugin ? driver.getResolver(pluginClientName) : void 0;
514
+ const clientFile = shouldUseClientPlugin ? clientResolver?.resolveFile({
515
+ name: node.operationId,
516
+ extname: ".ts",
517
+ tag: node.tags[0] ?? "default",
518
+ path: node.path
519
+ }, {
520
+ root,
521
+ output: clientPlugin?.options?.output ?? output,
522
+ group: clientPlugin?.options?.group
523
+ }) : void 0;
524
+ const resolvedClientName = shouldUseClientPlugin ? clientResolver?.resolveName(node.operationId) ?? clientName : clientName;
525
+ return /* @__PURE__ */ jsxs(File, {
526
+ baseName: meta.file.baseName,
527
+ path: meta.file.path,
528
+ meta: meta.file.meta,
529
+ banner: resolver.resolveBanner(inputNode, {
530
+ output,
531
+ config
532
+ }),
533
+ footer: resolver.resolveFooter(inputNode, {
534
+ output,
535
+ config
536
+ }),
537
+ children: [
538
+ fileZod && zodSchemaNames.length > 0 && /* @__PURE__ */ jsx(File.Import, {
539
+ name: zodSchemaNames,
540
+ root: meta.file.path,
541
+ path: fileZod.path
542
+ }),
543
+ clientOptions.importPath ? /* @__PURE__ */ jsxs(Fragment, { children: [
544
+ !shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
545
+ name: "fetch",
546
+ path: clientOptions.importPath
547
+ }),
548
+ /* @__PURE__ */ jsx(File.Import, {
549
+ name: [
550
+ "Client",
551
+ "RequestConfig",
552
+ "ResponseErrorConfig"
553
+ ],
554
+ path: clientOptions.importPath,
555
+ isTypeOnly: true
556
+ }),
557
+ clientOptions.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
558
+ name: ["ResponseConfig"],
559
+ path: clientOptions.importPath,
560
+ isTypeOnly: true
561
+ })
562
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
563
+ !shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
564
+ name: ["fetch"],
565
+ root: meta.file.path,
566
+ path: path.resolve(root, ".kubb/fetch.ts")
567
+ }),
568
+ /* @__PURE__ */ jsx(File.Import, {
569
+ name: [
570
+ "Client",
571
+ "RequestConfig",
572
+ "ResponseErrorConfig"
573
+ ],
574
+ root: meta.file.path,
575
+ path: path.resolve(root, ".kubb/fetch.ts"),
576
+ isTypeOnly: true
577
+ }),
578
+ clientOptions.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
579
+ name: ["ResponseConfig"],
580
+ root: meta.file.path,
581
+ path: path.resolve(root, ".kubb/fetch.ts"),
582
+ isTypeOnly: true
583
+ })
584
+ ] }),
585
+ /* @__PURE__ */ jsx(File.Import, {
586
+ name: ["toValue"],
587
+ path: "vue"
588
+ }),
589
+ /* @__PURE__ */ jsx(File.Import, {
590
+ name: ["MaybeRefOrGetter"],
591
+ path: "vue",
592
+ isTypeOnly: true
593
+ }),
594
+ shouldUseClientPlugin && clientFile && /* @__PURE__ */ jsx(File.Import, {
595
+ name: [resolvedClientName],
596
+ root: meta.file.path,
597
+ path: clientFile.path
598
+ }),
599
+ !shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
600
+ name: ["buildFormData"],
601
+ root: meta.file.path,
602
+ path: path.resolve(root, ".kubb/config.ts")
603
+ }),
604
+ meta.fileTs && importedTypeNames.length > 0 && /* @__PURE__ */ jsx(File.Import, {
605
+ name: Array.from(new Set(importedTypeNames)),
606
+ root: meta.file.path,
607
+ path: meta.fileTs.path,
608
+ isTypeOnly: true
609
+ }),
610
+ /* @__PURE__ */ jsx(QueryKey, {
611
+ name: queryKeyName,
612
+ typeName: queryKeyTypeName,
613
+ node,
614
+ tsResolver,
615
+ pathParamsType,
616
+ paramsCasing,
617
+ transformer: ctx.options.queryKey
618
+ }),
619
+ !shouldUseClientPlugin && /* @__PURE__ */ jsx(Client, {
620
+ name: resolvedClientName,
621
+ baseURL: clientOptions.baseURL,
622
+ dataReturnType: clientOptions.dataReturnType || "data",
623
+ paramsCasing: clientOptions.paramsCasing || paramsCasing,
624
+ paramsType,
625
+ pathParamsType,
626
+ parser,
627
+ node,
628
+ tsResolver,
629
+ zodResolver
630
+ }),
631
+ /* @__PURE__ */ jsx(File.Import, {
632
+ name: ["queryOptions"],
633
+ path: importPath
634
+ }),
635
+ /* @__PURE__ */ jsx(QueryOptions, {
636
+ name: queryOptionsName,
637
+ clientName: resolvedClientName,
638
+ queryKeyName,
639
+ node,
640
+ tsResolver,
641
+ paramsCasing,
642
+ paramsType,
643
+ pathParamsType,
644
+ dataReturnType: clientOptions.dataReturnType || "data"
645
+ }),
646
+ query && /* @__PURE__ */ jsxs(Fragment, { children: [
647
+ /* @__PURE__ */ jsx(File.Import, {
648
+ name: ["useQuery"],
649
+ path: importPath
650
+ }),
651
+ /* @__PURE__ */ jsx(File.Import, {
652
+ name: [
653
+ "QueryKey",
654
+ "QueryClient",
655
+ "UseQueryOptions",
656
+ "UseQueryReturnType"
657
+ ],
658
+ path: importPath,
659
+ isTypeOnly: true
660
+ }),
661
+ /* @__PURE__ */ jsx(Query, {
662
+ name: queryName,
663
+ queryOptionsName,
664
+ queryKeyName,
665
+ queryKeyTypeName,
666
+ node,
667
+ tsResolver,
668
+ paramsCasing,
669
+ paramsType,
670
+ pathParamsType,
671
+ dataReturnType: clientOptions.dataReturnType || "data"
672
+ })
673
+ ] })
674
+ ]
675
+ });
676
+ }
677
+ });
678
+ //#endregion
679
+ export { mutationGenerator as n, infiniteQueryGenerator as r, queryGenerator as t };
680
+
681
+ //# sourceMappingURL=generators-F6_EduRU.js.map