@kubb/plugin-react-query 3.0.0-beta.9 → 3.0.0
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.
- package/dist/{chunk-D5PFCZWQ.cjs → chunk-EOG7AHFO.cjs} +258 -40
- package/dist/chunk-EOG7AHFO.cjs.map +1 -0
- package/dist/{chunk-U35NELYJ.js → chunk-EY5KE7R7.js} +258 -40
- package/dist/chunk-EY5KE7R7.js.map +1 -0
- package/dist/{chunk-JKG4EZID.cjs → chunk-NBC6BPMV.cjs} +141 -110
- package/dist/chunk-NBC6BPMV.cjs.map +1 -0
- package/dist/{chunk-3OOSVEDM.js → chunk-NZKAIPYC.js} +130 -99
- package/dist/chunk-NZKAIPYC.js.map +1 -0
- package/dist/components.cjs +9 -9
- package/dist/components.d.cts +29 -16
- package/dist/components.d.ts +29 -16
- package/dist/components.js +1 -1
- package/dist/generators.cjs +6 -6
- package/dist/generators.d.cts +1 -1
- package/dist/generators.d.ts +1 -1
- package/dist/generators.js +2 -2
- package/dist/index.cjs +24 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +23 -23
- package/dist/index.js.map +1 -1
- package/dist/{types-LhwfnVo7.d.cts → types-IuxCCG1K.d.cts} +46 -16
- package/dist/{types-LhwfnVo7.d.ts → types-IuxCCG1K.d.ts} +46 -16
- package/package.json +12 -12
- package/src/components/InfiniteQuery.tsx +52 -5
- package/src/components/InfiniteQueryOptions.tsx +47 -6
- package/src/components/Mutation.tsx +3 -1
- package/src/components/MutationKey.tsx +11 -5
- package/src/components/Query.tsx +62 -6
- package/src/components/QueryKey.tsx +17 -7
- package/src/components/QueryOptions.tsx +47 -7
- package/src/components/SuspenseQuery.tsx +52 -5
- package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +1 -1
- package/src/generators/__snapshots__/clientGetImportPath.ts +1 -1
- package/src/generators/__snapshots__/findByTags.ts +1 -1
- package/src/generators/__snapshots__/findByTagsObject.ts +60 -0
- package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +1 -1
- package/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +2 -2
- package/src/generators/__snapshots__/findByTagsWithZod.ts +1 -1
- package/src/generators/__snapshots__/findInfiniteByTags.ts +1 -1
- package/src/generators/__snapshots__/findInfiniteByTagsCursor.ts +1 -1
- package/src/generators/__snapshots__/postAsQuery.ts +1 -1
- package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +1 -3
- package/src/generators/infiniteQueryGenerator.tsx +40 -28
- package/src/generators/mutationGenerator.tsx +25 -16
- package/src/generators/queryGenerator.tsx +24 -17
- package/src/generators/suspenseQueryGenerator.tsx +26 -16
- package/src/plugin.ts +23 -20
- package/src/types.ts +35 -15
- package/dist/chunk-3OOSVEDM.js.map +0 -1
- package/dist/chunk-D5PFCZWQ.cjs.map +0 -1
- package/dist/chunk-JKG4EZID.cjs.map +0 -1
- package/dist/chunk-U35NELYJ.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkEOG7AHFO_cjs = require('./chunk-EOG7AHFO.cjs');
|
|
4
4
|
var path = require('path');
|
|
5
5
|
var core = require('@kubb/core');
|
|
6
6
|
var transformers = require('@kubb/core/transformers');
|
|
@@ -57,12 +57,13 @@ var clientGenerator = pluginOas.createReactGenerator({
|
|
|
57
57
|
}
|
|
58
58
|
),
|
|
59
59
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
60
|
-
|
|
60
|
+
chunkEOG7AHFO_cjs.Client,
|
|
61
61
|
{
|
|
62
62
|
name: client.name,
|
|
63
63
|
baseURL: options.baseURL,
|
|
64
64
|
dataReturnType: options.dataReturnType,
|
|
65
65
|
pathParamsType: options.pathParamsType,
|
|
66
|
+
paramsType: options.paramsType,
|
|
66
67
|
typeSchemas: type.schemas,
|
|
67
68
|
operation,
|
|
68
69
|
parser: options.parser,
|
|
@@ -83,7 +84,7 @@ var operationsGenerator = pluginOas.createReactGenerator({
|
|
|
83
84
|
} = react.useApp();
|
|
84
85
|
const name = "operations";
|
|
85
86
|
const file = pluginManager.getFile({ name, extname: ".ts", pluginKey: [pluginClientName] });
|
|
86
|
-
return /* @__PURE__ */ jsxRuntime.jsx(react.File, { baseName: file.baseName, path: file.path, meta: file.meta, banner: output?.banner, footer: output?.footer, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
87
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.File, { baseName: file.baseName, path: file.path, meta: file.meta, banner: output?.banner, footer: output?.footer, children: /* @__PURE__ */ jsxRuntime.jsx(chunkEOG7AHFO_cjs.Operations, { name, operations }) });
|
|
87
88
|
}
|
|
88
89
|
});
|
|
89
90
|
var groupedClientGenerator = pluginOas.createReactGenerator({
|
|
@@ -141,10 +142,12 @@ core.createPlugin((options) => {
|
|
|
141
142
|
exclude = [],
|
|
142
143
|
include,
|
|
143
144
|
override = [],
|
|
144
|
-
transformers:
|
|
145
|
+
transformers: transformers2 = {},
|
|
145
146
|
dataReturnType = "data",
|
|
146
147
|
pathParamsType = "inline",
|
|
148
|
+
paramsType = "inline",
|
|
147
149
|
operations = false,
|
|
150
|
+
baseURL,
|
|
148
151
|
generators = [clientGenerator, group ? groupedClientGenerator : void 0, operations ? operationsGenerator : void 0].filter(Boolean),
|
|
149
152
|
importPath = "@kubb/plugin-client/client",
|
|
150
153
|
parser = "client"
|
|
@@ -157,8 +160,9 @@ core.createPlugin((options) => {
|
|
|
157
160
|
parser,
|
|
158
161
|
dataReturnType,
|
|
159
162
|
importPath,
|
|
160
|
-
|
|
161
|
-
|
|
163
|
+
paramsType,
|
|
164
|
+
pathParamsType: paramsType === "object" ? "object" : pathParamsType,
|
|
165
|
+
baseURL
|
|
162
166
|
},
|
|
163
167
|
pre: [pluginOas.pluginOasName, parser === "zod" ? pluginZod.pluginZodName : void 0].filter(Boolean),
|
|
164
168
|
resolvePath(baseName, pathMode, options2) {
|
|
@@ -176,7 +180,7 @@ core.createPlugin((options) => {
|
|
|
176
180
|
resolveName(name, type) {
|
|
177
181
|
const resolvedName = transformers.camelCase(name, { isFile: type === "file" });
|
|
178
182
|
if (type) {
|
|
179
|
-
return
|
|
183
|
+
return transformers2?.name?.(resolvedName, type) || resolvedName;
|
|
180
184
|
}
|
|
181
185
|
return resolvedName;
|
|
182
186
|
},
|
|
@@ -185,12 +189,12 @@ core.createPlugin((options) => {
|
|
|
185
189
|
const oas = await swaggerPlugin.context.getOas();
|
|
186
190
|
const root = path__default.default.resolve(this.config.root, this.config.output.path);
|
|
187
191
|
const mode = core.FileManager.getMode(path__default.default.resolve(root, output.path));
|
|
188
|
-
const
|
|
192
|
+
const baseURL2 = await swaggerPlugin.context.getBaseURL();
|
|
189
193
|
const operationGenerator = new pluginOas.OperationGenerator(
|
|
190
|
-
{
|
|
194
|
+
baseURL2 ? {
|
|
191
195
|
...this.plugin.options,
|
|
192
|
-
baseURL
|
|
193
|
-
},
|
|
196
|
+
baseURL: baseURL2
|
|
197
|
+
} : this.plugin.options,
|
|
194
198
|
{
|
|
195
199
|
oas,
|
|
196
200
|
pluginManager: this.pluginManager,
|
|
@@ -228,7 +232,7 @@ var queryGenerator = pluginOas.createReactGenerator({
|
|
|
228
232
|
} = react.useApp();
|
|
229
233
|
const { getSchemas, getName, getFile } = hooks.useOperationManager();
|
|
230
234
|
const isQuery = typeof options.query === "boolean" ? true : options.query?.methods.some((method) => operation.method === method);
|
|
231
|
-
|
|
235
|
+
const importPath = options.query ? options.query.importPath : "@tanstack/react-query";
|
|
232
236
|
const query = {
|
|
233
237
|
name: getName(operation, { type: "function", prefix: "use" }),
|
|
234
238
|
typeName: getName(operation, { type: "type" }),
|
|
@@ -253,13 +257,11 @@ var queryGenerator = pluginOas.createReactGenerator({
|
|
|
253
257
|
file: getFile(operation, { pluginKey: [pluginZod.pluginZodName] }),
|
|
254
258
|
schemas: getSchemas(operation, { pluginKey: [pluginZod.pluginZodName], type: "function" })
|
|
255
259
|
};
|
|
256
|
-
if (!isQuery
|
|
260
|
+
if (!isQuery) {
|
|
257
261
|
return null;
|
|
258
262
|
}
|
|
259
263
|
return /* @__PURE__ */ jsxRuntime.jsxs(react.File, { baseName: query.file.baseName, path: query.file.path, meta: query.file.meta, banner: output?.banner, footer: output?.footer, children: [
|
|
260
264
|
options.parser === "zod" && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: [zod.schemas.response.name], root: query.file.path, path: zod.file.path }),
|
|
261
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["useQuery", "queryOptions"], path: options.query.importPath }),
|
|
262
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["QueryKey", "WithRequired", "QueryObserverOptions", "UseQueryResult"], path: options.query.importPath, isTypeOnly: true }),
|
|
263
265
|
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: "client", path: options.client.importPath }),
|
|
264
266
|
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["RequestConfig"], path: options.client.importPath, isTypeOnly: true }),
|
|
265
267
|
options.client.dataReturnType === "full" && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["ResponseConfig"], path: options.client.importPath, isTypeOnly: true }),
|
|
@@ -280,54 +282,62 @@ var queryGenerator = pluginOas.createReactGenerator({
|
|
|
280
282
|
}
|
|
281
283
|
),
|
|
282
284
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
283
|
-
|
|
285
|
+
chunkEOG7AHFO_cjs.QueryKey,
|
|
284
286
|
{
|
|
285
287
|
name: queryKey.name,
|
|
286
288
|
typeName: queryKey.typeName,
|
|
287
289
|
operation,
|
|
288
290
|
pathParamsType: options.pathParamsType,
|
|
289
291
|
typeSchemas: type.schemas,
|
|
290
|
-
|
|
292
|
+
transformer: options.queryKey
|
|
291
293
|
}
|
|
292
294
|
),
|
|
293
295
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
294
|
-
|
|
296
|
+
chunkEOG7AHFO_cjs.Client,
|
|
295
297
|
{
|
|
296
298
|
name: client.name,
|
|
297
299
|
isExportable: false,
|
|
298
300
|
isIndexable: false,
|
|
299
|
-
baseURL: options.baseURL,
|
|
301
|
+
baseURL: options.client.baseURL,
|
|
300
302
|
operation,
|
|
301
303
|
typeSchemas: type.schemas,
|
|
302
304
|
zodSchemas: zod.schemas,
|
|
303
305
|
dataReturnType: options.client.dataReturnType,
|
|
306
|
+
paramsType: options.paramsType,
|
|
304
307
|
pathParamsType: options.pathParamsType,
|
|
305
308
|
parser: options.parser
|
|
306
309
|
}
|
|
307
310
|
),
|
|
311
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["queryOptions"], path: importPath }),
|
|
308
312
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
309
|
-
|
|
313
|
+
chunkEOG7AHFO_cjs.QueryOptions,
|
|
310
314
|
{
|
|
311
315
|
name: queryOptions.name,
|
|
312
316
|
clientName: client.name,
|
|
313
317
|
queryKeyName: queryKey.name,
|
|
314
318
|
typeSchemas: type.schemas,
|
|
319
|
+
paramsType: options.paramsType,
|
|
315
320
|
pathParamsType: options.pathParamsType
|
|
316
321
|
}
|
|
317
322
|
),
|
|
318
|
-
/* @__PURE__ */ jsxRuntime.
|
|
319
|
-
|
|
320
|
-
{
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
323
|
+
options.query && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
324
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["useQuery"], path: importPath }),
|
|
325
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["QueryKey", "QueryObserverOptions", "UseQueryResult"], path: importPath, isTypeOnly: true }),
|
|
326
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
327
|
+
chunkEOG7AHFO_cjs.Query,
|
|
328
|
+
{
|
|
329
|
+
name: query.name,
|
|
330
|
+
queryOptionsName: queryOptions.name,
|
|
331
|
+
typeSchemas: type.schemas,
|
|
332
|
+
paramsType: options.paramsType,
|
|
333
|
+
pathParamsType: options.pathParamsType,
|
|
334
|
+
operation,
|
|
335
|
+
dataReturnType: options.client.dataReturnType,
|
|
336
|
+
queryKeyName: queryKey.name,
|
|
337
|
+
queryKeyTypeName: queryKey.typeName
|
|
338
|
+
}
|
|
339
|
+
)
|
|
340
|
+
] })
|
|
331
341
|
] });
|
|
332
342
|
}
|
|
333
343
|
});
|
|
@@ -342,6 +352,7 @@ var mutationGenerator = pluginOas.createReactGenerator({
|
|
|
342
352
|
const { getSchemas, getName, getFile } = hooks.useOperationManager();
|
|
343
353
|
const isQuery = typeof options.query === "boolean" ? true : options.query?.methods.some((method) => operation.method === method);
|
|
344
354
|
const isMutation = !isQuery && options.mutation && options.mutation.methods.some((method) => operation.method === method);
|
|
355
|
+
const importPath = options.mutation ? options.mutation.importPath : "@tanstack/react-query";
|
|
345
356
|
const mutation = {
|
|
346
357
|
name: getName(operation, { type: "function", prefix: "use" }),
|
|
347
358
|
typeName: getName(operation, { type: "type" }),
|
|
@@ -363,13 +374,11 @@ var mutationGenerator = pluginOas.createReactGenerator({
|
|
|
363
374
|
name: getName(operation, { type: "const", suffix: "MutationKey" }),
|
|
364
375
|
typeName: getName(operation, { type: "type", suffix: "MutationKey" })
|
|
365
376
|
};
|
|
366
|
-
if (!isMutation
|
|
377
|
+
if (!isMutation) {
|
|
367
378
|
return null;
|
|
368
379
|
}
|
|
369
380
|
return /* @__PURE__ */ jsxRuntime.jsxs(react.File, { baseName: mutation.file.baseName, path: mutation.file.path, meta: mutation.file.meta, banner: output?.banner, footer: output?.footer, children: [
|
|
370
381
|
options.parser === "zod" && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: [zod.schemas.response.name], root: mutation.file.path, path: zod.file.path }),
|
|
371
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["useMutation"], path: options.mutation.importPath }),
|
|
372
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["UseMutationOptions"], path: options.mutation.importPath, isTypeOnly: true }),
|
|
373
382
|
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: "client", path: options.client.importPath }),
|
|
374
383
|
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["RequestConfig", "ResponseConfig"], path: options.client.importPath, isTypeOnly: true }),
|
|
375
384
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -389,44 +398,50 @@ var mutationGenerator = pluginOas.createReactGenerator({
|
|
|
389
398
|
}
|
|
390
399
|
),
|
|
391
400
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
392
|
-
|
|
401
|
+
chunkEOG7AHFO_cjs.MutationKey,
|
|
393
402
|
{
|
|
394
403
|
name: mutationKey.name,
|
|
395
404
|
typeName: mutationKey.typeName,
|
|
396
405
|
operation,
|
|
397
406
|
pathParamsType: options.pathParamsType,
|
|
398
407
|
typeSchemas: type.schemas,
|
|
399
|
-
|
|
408
|
+
transformer: options.mutationKey
|
|
400
409
|
}
|
|
401
410
|
),
|
|
402
411
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
403
|
-
|
|
412
|
+
chunkEOG7AHFO_cjs.Client,
|
|
404
413
|
{
|
|
405
414
|
name: client.name,
|
|
406
415
|
isExportable: false,
|
|
407
416
|
isIndexable: false,
|
|
408
|
-
baseURL: options.baseURL,
|
|
417
|
+
baseURL: options.client.baseURL,
|
|
409
418
|
operation,
|
|
410
419
|
typeSchemas: type.schemas,
|
|
411
420
|
zodSchemas: zod.schemas,
|
|
412
421
|
dataReturnType: options.client.dataReturnType,
|
|
422
|
+
paramsType: options.paramsType,
|
|
413
423
|
pathParamsType: options.pathParamsType,
|
|
414
424
|
parser: options.parser
|
|
415
425
|
}
|
|
416
426
|
),
|
|
417
|
-
/* @__PURE__ */ jsxRuntime.
|
|
418
|
-
|
|
419
|
-
{
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
427
|
+
options.mutation && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
428
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["useMutation"], path: importPath }),
|
|
429
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["UseMutationOptions"], path: importPath, isTypeOnly: true }),
|
|
430
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
431
|
+
chunkEOG7AHFO_cjs.Mutation,
|
|
432
|
+
{
|
|
433
|
+
name: mutation.name,
|
|
434
|
+
clientName: client.name,
|
|
435
|
+
typeName: mutation.typeName,
|
|
436
|
+
typeSchemas: type.schemas,
|
|
437
|
+
operation,
|
|
438
|
+
dataReturnType: options.client.dataReturnType,
|
|
439
|
+
paramsType: options.paramsType,
|
|
440
|
+
pathParamsType: options.pathParamsType,
|
|
441
|
+
mutationKeyName: mutationKey.name
|
|
442
|
+
}
|
|
443
|
+
)
|
|
444
|
+
] })
|
|
430
445
|
] });
|
|
431
446
|
}
|
|
432
447
|
});
|
|
@@ -441,6 +456,7 @@ var infiniteQueryGenerator = pluginOas.createReactGenerator({
|
|
|
441
456
|
const { getSchemas, getName, getFile } = hooks.useOperationManager();
|
|
442
457
|
const isQuery = typeof options.query === "boolean" ? options.query : !!options.query.methods?.some((method) => operation.method === method);
|
|
443
458
|
const isInfinite = isQuery && !!options.infinite;
|
|
459
|
+
const importPath = options.query ? options.query.importPath : "@tanstack/react-query";
|
|
444
460
|
const query = {
|
|
445
461
|
name: getName(operation, { type: "function", prefix: "use", suffix: "infinite" }),
|
|
446
462
|
typeName: getName(operation, { type: "type" }),
|
|
@@ -465,13 +481,11 @@ var infiniteQueryGenerator = pluginOas.createReactGenerator({
|
|
|
465
481
|
file: getFile(operation, { pluginKey: [pluginZod.pluginZodName] }),
|
|
466
482
|
schemas: getSchemas(operation, { pluginKey: [pluginZod.pluginZodName], type: "function" })
|
|
467
483
|
};
|
|
468
|
-
if (!isQuery || !isInfinite
|
|
484
|
+
if (!isQuery || !isInfinite) {
|
|
469
485
|
return null;
|
|
470
486
|
}
|
|
471
487
|
return /* @__PURE__ */ jsxRuntime.jsxs(react.File, { baseName: query.file.baseName, path: query.file.path, meta: query.file.meta, banner: output?.banner, footer: output?.footer, children: [
|
|
472
488
|
options.parser === "zod" && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: [zod.schemas.response.name], root: query.file.path, path: zod.file.path }),
|
|
473
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["useInfiniteQuery", "infiniteQueryOptions"], path: options.query.importPath }),
|
|
474
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["QueryKey", "WithRequired", "InfiniteQueryObserverOptions", "UseInfiniteQueryResult"], path: options.query.importPath, isTypeOnly: true }),
|
|
475
489
|
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: "client", path: options.client.importPath }),
|
|
476
490
|
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["RequestConfig"], path: options.client.importPath, isTypeOnly: true }),
|
|
477
491
|
options.client.dataReturnType === "full" && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["ResponseConfig"], path: options.client.importPath, isTypeOnly: true }),
|
|
@@ -492,58 +506,68 @@ var infiniteQueryGenerator = pluginOas.createReactGenerator({
|
|
|
492
506
|
}
|
|
493
507
|
),
|
|
494
508
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
495
|
-
|
|
509
|
+
chunkEOG7AHFO_cjs.QueryKey,
|
|
496
510
|
{
|
|
497
511
|
name: queryKey.name,
|
|
498
512
|
typeName: queryKey.typeName,
|
|
499
513
|
operation,
|
|
500
514
|
pathParamsType: options.pathParamsType,
|
|
501
515
|
typeSchemas: type.schemas,
|
|
502
|
-
|
|
516
|
+
transformer: options.queryKey
|
|
503
517
|
}
|
|
504
518
|
),
|
|
505
519
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
506
|
-
|
|
520
|
+
chunkEOG7AHFO_cjs.Client,
|
|
507
521
|
{
|
|
508
522
|
name: client.name,
|
|
509
523
|
isExportable: false,
|
|
510
524
|
isIndexable: false,
|
|
511
|
-
baseURL: options.baseURL,
|
|
525
|
+
baseURL: options.client.baseURL,
|
|
512
526
|
operation,
|
|
513
527
|
typeSchemas: type.schemas,
|
|
514
528
|
zodSchemas: zod.schemas,
|
|
515
529
|
dataReturnType: options.client.dataReturnType,
|
|
530
|
+
paramsType: options.paramsType,
|
|
516
531
|
pathParamsType: options.pathParamsType,
|
|
517
532
|
parser: options.parser
|
|
518
533
|
}
|
|
519
534
|
),
|
|
520
|
-
/* @__PURE__ */ jsxRuntime.
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
535
|
+
options.infinite && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
536
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["infiniteQueryOptions"], path: importPath }),
|
|
537
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
538
|
+
chunkEOG7AHFO_cjs.InfiniteQueryOptions,
|
|
539
|
+
{
|
|
540
|
+
name: queryOptions.name,
|
|
541
|
+
clientName: client.name,
|
|
542
|
+
queryKeyName: queryKey.name,
|
|
543
|
+
typeSchemas: type.schemas,
|
|
544
|
+
paramsType: options.paramsType,
|
|
545
|
+
pathParamsType: options.pathParamsType,
|
|
546
|
+
dataReturnType: options.client.dataReturnType,
|
|
547
|
+
cursorParam: options.infinite.cursorParam,
|
|
548
|
+
initialPageParam: options.infinite.initialPageParam,
|
|
549
|
+
queryParam: options.infinite.queryParam
|
|
550
|
+
}
|
|
551
|
+
)
|
|
552
|
+
] }),
|
|
553
|
+
options.infinite && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
554
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["useInfiniteQuery"], path: importPath }),
|
|
555
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["QueryKey", "InfiniteQueryObserverOptions", "UseInfiniteQueryResult"], path: importPath, isTypeOnly: true }),
|
|
556
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
557
|
+
chunkEOG7AHFO_cjs.InfiniteQuery,
|
|
558
|
+
{
|
|
559
|
+
name: query.name,
|
|
560
|
+
queryOptionsName: queryOptions.name,
|
|
561
|
+
typeSchemas: type.schemas,
|
|
562
|
+
paramsType: options.paramsType,
|
|
563
|
+
pathParamsType: options.pathParamsType,
|
|
564
|
+
operation,
|
|
565
|
+
dataReturnType: options.client.dataReturnType,
|
|
566
|
+
queryKeyName: queryKey.name,
|
|
567
|
+
queryKeyTypeName: queryKey.typeName
|
|
568
|
+
}
|
|
569
|
+
)
|
|
570
|
+
] })
|
|
547
571
|
] });
|
|
548
572
|
}
|
|
549
573
|
});
|
|
@@ -558,6 +582,7 @@ var suspenseQueryGenerator = pluginOas.createReactGenerator({
|
|
|
558
582
|
const { getSchemas, getName, getFile } = hooks.useOperationManager();
|
|
559
583
|
const isQuery = typeof options.query === "boolean" ? options.query : !!options.query.methods?.some((method) => operation.method === method);
|
|
560
584
|
const isSuspense = isQuery && !!options.suspense;
|
|
585
|
+
const importPath = options.query ? options.query.importPath : "@tanstack/react-query";
|
|
561
586
|
const query = {
|
|
562
587
|
name: getName(operation, { type: "function", prefix: "use", suffix: "suspense" }),
|
|
563
588
|
typeName: getName(operation, { type: "type" }),
|
|
@@ -582,13 +607,11 @@ var suspenseQueryGenerator = pluginOas.createReactGenerator({
|
|
|
582
607
|
file: getFile(operation, { pluginKey: [pluginZod.pluginZodName] }),
|
|
583
608
|
schemas: getSchemas(operation, { pluginKey: [pluginZod.pluginZodName], type: "function" })
|
|
584
609
|
};
|
|
585
|
-
if (!isQuery || !isSuspense
|
|
610
|
+
if (!isQuery || !isSuspense) {
|
|
586
611
|
return null;
|
|
587
612
|
}
|
|
588
613
|
return /* @__PURE__ */ jsxRuntime.jsxs(react.File, { baseName: query.file.baseName, path: query.file.path, meta: query.file.meta, banner: output?.banner, footer: output?.footer, children: [
|
|
589
614
|
options.parser === "zod" && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: [zod.schemas.response.name], root: query.file.path, path: zod.file.path }),
|
|
590
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["useSuspenseQuery", "queryOptions"], path: options.query.importPath }),
|
|
591
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["QueryKey", "WithRequired", "UseSuspenseQueryOptions", "UseSuspenseQueryResult"], path: options.query.importPath, isTypeOnly: true }),
|
|
592
615
|
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: "client", path: options.client.importPath }),
|
|
593
616
|
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["RequestConfig"], path: options.client.importPath, isTypeOnly: true }),
|
|
594
617
|
options.client.dataReturnType === "full" && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["ResponseConfig"], path: options.client.importPath, isTypeOnly: true }),
|
|
@@ -609,54 +632,62 @@ var suspenseQueryGenerator = pluginOas.createReactGenerator({
|
|
|
609
632
|
}
|
|
610
633
|
),
|
|
611
634
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
612
|
-
|
|
635
|
+
chunkEOG7AHFO_cjs.QueryKey,
|
|
613
636
|
{
|
|
614
637
|
name: queryKey.name,
|
|
615
638
|
typeName: queryKey.typeName,
|
|
616
639
|
operation,
|
|
617
640
|
pathParamsType: options.pathParamsType,
|
|
618
641
|
typeSchemas: type.schemas,
|
|
619
|
-
|
|
642
|
+
transformer: options.queryKey
|
|
620
643
|
}
|
|
621
644
|
),
|
|
622
645
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
623
|
-
|
|
646
|
+
chunkEOG7AHFO_cjs.Client,
|
|
624
647
|
{
|
|
625
648
|
name: client.name,
|
|
626
649
|
isExportable: false,
|
|
627
650
|
isIndexable: false,
|
|
628
|
-
baseURL: options.baseURL,
|
|
651
|
+
baseURL: options.client.baseURL,
|
|
629
652
|
operation,
|
|
630
653
|
typeSchemas: type.schemas,
|
|
631
654
|
zodSchemas: zod.schemas,
|
|
632
655
|
dataReturnType: options.client.dataReturnType,
|
|
656
|
+
paramsType: options.paramsType,
|
|
633
657
|
pathParamsType: options.pathParamsType,
|
|
634
658
|
parser: options.parser
|
|
635
659
|
}
|
|
636
660
|
),
|
|
661
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["queryOptions"], path: importPath }),
|
|
637
662
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
638
|
-
|
|
663
|
+
chunkEOG7AHFO_cjs.QueryOptions,
|
|
639
664
|
{
|
|
640
665
|
name: queryOptions.name,
|
|
641
666
|
clientName: client.name,
|
|
642
667
|
queryKeyName: queryKey.name,
|
|
643
668
|
typeSchemas: type.schemas,
|
|
669
|
+
paramsType: options.paramsType,
|
|
644
670
|
pathParamsType: options.pathParamsType
|
|
645
671
|
}
|
|
646
672
|
),
|
|
647
|
-
/* @__PURE__ */ jsxRuntime.
|
|
648
|
-
|
|
649
|
-
{
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
673
|
+
options.suspense && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
674
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["useSuspenseQuery"], path: importPath }),
|
|
675
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["QueryKey", "UseSuspenseQueryOptions", "UseSuspenseQueryResult"], path: importPath, isTypeOnly: true }),
|
|
676
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
677
|
+
chunkEOG7AHFO_cjs.SuspenseQuery,
|
|
678
|
+
{
|
|
679
|
+
name: query.name,
|
|
680
|
+
queryOptionsName: queryOptions.name,
|
|
681
|
+
typeSchemas: type.schemas,
|
|
682
|
+
paramsType: options.paramsType,
|
|
683
|
+
pathParamsType: options.pathParamsType,
|
|
684
|
+
operation,
|
|
685
|
+
dataReturnType: options.client.dataReturnType,
|
|
686
|
+
queryKeyName: queryKey.name,
|
|
687
|
+
queryKeyTypeName: queryKey.typeName
|
|
688
|
+
}
|
|
689
|
+
)
|
|
690
|
+
] })
|
|
660
691
|
] });
|
|
661
692
|
}
|
|
662
693
|
});
|
|
@@ -665,5 +696,5 @@ exports.infiniteQueryGenerator = infiniteQueryGenerator;
|
|
|
665
696
|
exports.mutationGenerator = mutationGenerator;
|
|
666
697
|
exports.queryGenerator = queryGenerator;
|
|
667
698
|
exports.suspenseQueryGenerator = suspenseQueryGenerator;
|
|
668
|
-
//# sourceMappingURL=chunk-
|
|
669
|
-
//# sourceMappingURL=chunk-
|
|
699
|
+
//# sourceMappingURL=chunk-NBC6BPMV.cjs.map
|
|
700
|
+
//# sourceMappingURL=chunk-NBC6BPMV.cjs.map
|