@kubb/plugin-react-query 4.5.15 → 4.6.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/{components-0G5mZf1J.cjs → components-C0HQi0Tg.cjs} +319 -25
- package/dist/components-C0HQi0Tg.cjs.map +1 -0
- package/dist/{components-BWrDXrTl.js → components-K4qy3AIg.js} +307 -25
- package/dist/components-K4qy3AIg.js.map +1 -0
- package/dist/components.cjs +3 -1
- package/dist/components.d.cts +121 -30
- package/dist/components.d.ts +121 -30
- package/dist/components.js +2 -2
- package/dist/{generators-DTCyUuOe.cjs → generators-CKLkXi1h.cjs} +225 -2
- package/dist/generators-CKLkXi1h.cjs.map +1 -0
- package/dist/{generators-BAjiYTwQ.js → generators-Df7UUFaq.js} +220 -3
- package/dist/generators-Df7UUFaq.js.map +1 -0
- package/dist/generators.cjs +3 -2
- package/dist/generators.d.cts +4 -1
- package/dist/generators.d.ts +4 -1
- package/dist/generators.js +3 -3
- package/dist/index.cjs +3 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/src/components/SuspenseInfiniteQuery.tsx +212 -0
- package/src/components/SuspenseInfiniteQueryOptions.tsx +230 -0
- package/src/components/index.ts +2 -0
- package/src/generators/__snapshots__/findSuspenseInfiniteByTags.ts +100 -0
- package/src/generators/__snapshots__/findSuspenseInfiniteByTagsCursor.ts +100 -0
- package/src/generators/index.ts +1 -0
- package/src/generators/suspenseInfiniteQueryGenerator.tsx +191 -0
- package/src/plugin.ts +2 -2
- package/dist/components-0G5mZf1J.cjs.map +0 -1
- package/dist/components-BWrDXrTl.js.map +0 -1
- package/dist/generators-BAjiYTwQ.js.map +0 -1
- package/dist/generators-DTCyUuOe.cjs.map +0 -1
package/dist/components.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { FunctionParams } from "@kubb/react-fabric";
|
|
|
3
3
|
import { KubbNode } from "@kubb/react-fabric/types";
|
|
4
4
|
|
|
5
5
|
//#region src/components/InfiniteQuery.d.ts
|
|
6
|
-
type Props$
|
|
6
|
+
type Props$10 = {
|
|
7
7
|
/**
|
|
8
8
|
* Name of the function
|
|
9
9
|
*/
|
|
@@ -20,7 +20,7 @@ type Props$8 = {
|
|
|
20
20
|
initialPageParam: Infinite['initialPageParam'];
|
|
21
21
|
queryParam?: Infinite['queryParam'];
|
|
22
22
|
};
|
|
23
|
-
type GetParamsProps$
|
|
23
|
+
type GetParamsProps$9 = {
|
|
24
24
|
paramsType: PluginReactQuery['resolvedOptions']['paramsType'];
|
|
25
25
|
paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing'];
|
|
26
26
|
pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType'];
|
|
@@ -40,7 +40,7 @@ declare function InfiniteQuery({
|
|
|
40
40
|
operation,
|
|
41
41
|
initialPageParam,
|
|
42
42
|
queryParam
|
|
43
|
-
}: Props$
|
|
43
|
+
}: Props$10): KubbNode;
|
|
44
44
|
declare namespace InfiniteQuery {
|
|
45
45
|
var getParams: ({
|
|
46
46
|
paramsType,
|
|
@@ -48,11 +48,11 @@ declare namespace InfiniteQuery {
|
|
|
48
48
|
pathParamsType,
|
|
49
49
|
typeSchemas,
|
|
50
50
|
pageParamGeneric
|
|
51
|
-
}: GetParamsProps$
|
|
51
|
+
}: GetParamsProps$9) => FunctionParams;
|
|
52
52
|
}
|
|
53
53
|
//#endregion
|
|
54
54
|
//#region src/components/InfiniteQueryOptions.d.ts
|
|
55
|
-
type Props$
|
|
55
|
+
type Props$9 = {
|
|
56
56
|
name: string;
|
|
57
57
|
clientName: string;
|
|
58
58
|
queryKeyName: string;
|
|
@@ -65,7 +65,7 @@ type Props$7 = {
|
|
|
65
65
|
cursorParam: Infinite['cursorParam'];
|
|
66
66
|
queryParam: Infinite['queryParam'];
|
|
67
67
|
};
|
|
68
|
-
type GetParamsProps$
|
|
68
|
+
type GetParamsProps$8 = {
|
|
69
69
|
paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing'];
|
|
70
70
|
paramsType: PluginReactQuery['resolvedOptions']['paramsType'];
|
|
71
71
|
pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType'];
|
|
@@ -83,18 +83,18 @@ declare function InfiniteQueryOptions({
|
|
|
83
83
|
pathParamsType,
|
|
84
84
|
queryParam,
|
|
85
85
|
queryKeyName
|
|
86
|
-
}: Props$
|
|
86
|
+
}: Props$9): KubbNode;
|
|
87
87
|
declare namespace InfiniteQueryOptions {
|
|
88
88
|
var getParams: ({
|
|
89
89
|
paramsType,
|
|
90
90
|
paramsCasing,
|
|
91
91
|
pathParamsType,
|
|
92
92
|
typeSchemas
|
|
93
|
-
}: GetParamsProps$
|
|
93
|
+
}: GetParamsProps$8) => FunctionParams;
|
|
94
94
|
}
|
|
95
95
|
//#endregion
|
|
96
96
|
//#region src/components/Mutation.d.ts
|
|
97
|
-
type Props$
|
|
97
|
+
type Props$8 = {
|
|
98
98
|
/**
|
|
99
99
|
* Name of the function
|
|
100
100
|
*/
|
|
@@ -117,10 +117,10 @@ declare function Mutation({
|
|
|
117
117
|
typeSchemas,
|
|
118
118
|
operation,
|
|
119
119
|
mutationKeyName
|
|
120
|
-
}: Props$
|
|
120
|
+
}: Props$8): KubbNode;
|
|
121
121
|
//#endregion
|
|
122
122
|
//#region src/components/MutationKey.d.ts
|
|
123
|
-
type Props$
|
|
123
|
+
type Props$7 = {
|
|
124
124
|
name: string;
|
|
125
125
|
typeName: string;
|
|
126
126
|
typeSchemas: OperationSchemas;
|
|
@@ -129,7 +129,7 @@ type Props$5 = {
|
|
|
129
129
|
pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType'];
|
|
130
130
|
transformer: Transformer | undefined;
|
|
131
131
|
};
|
|
132
|
-
type GetParamsProps$
|
|
132
|
+
type GetParamsProps$7 = {
|
|
133
133
|
pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType'];
|
|
134
134
|
typeSchemas: OperationSchemas;
|
|
135
135
|
};
|
|
@@ -141,14 +141,14 @@ declare function MutationKey({
|
|
|
141
141
|
operation,
|
|
142
142
|
typeName,
|
|
143
143
|
transformer
|
|
144
|
-
}: Props$
|
|
144
|
+
}: Props$7): KubbNode;
|
|
145
145
|
declare namespace MutationKey {
|
|
146
|
-
var getParams: ({}: GetParamsProps$
|
|
146
|
+
var getParams: ({}: GetParamsProps$7) => FunctionParams;
|
|
147
147
|
var getTransformer: Transformer;
|
|
148
148
|
}
|
|
149
149
|
//#endregion
|
|
150
150
|
//#region src/components/MutationOptions.d.ts
|
|
151
|
-
type Props$
|
|
151
|
+
type Props$6 = {
|
|
152
152
|
name: string;
|
|
153
153
|
clientName: string;
|
|
154
154
|
mutationKeyName: string;
|
|
@@ -158,7 +158,7 @@ type Props$4 = {
|
|
|
158
158
|
pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType'];
|
|
159
159
|
dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType'];
|
|
160
160
|
};
|
|
161
|
-
type GetParamsProps$
|
|
161
|
+
type GetParamsProps$6 = {
|
|
162
162
|
typeSchemas: OperationSchemas;
|
|
163
163
|
};
|
|
164
164
|
declare function MutationOptions({
|
|
@@ -170,15 +170,15 @@ declare function MutationOptions({
|
|
|
170
170
|
paramsType,
|
|
171
171
|
pathParamsType,
|
|
172
172
|
mutationKeyName
|
|
173
|
-
}: Props$
|
|
173
|
+
}: Props$6): KubbNode;
|
|
174
174
|
declare namespace MutationOptions {
|
|
175
175
|
var getParams: ({
|
|
176
176
|
typeSchemas
|
|
177
|
-
}: GetParamsProps$
|
|
177
|
+
}: GetParamsProps$6) => FunctionParams;
|
|
178
178
|
}
|
|
179
179
|
//#endregion
|
|
180
180
|
//#region src/components/Query.d.ts
|
|
181
|
-
type Props$
|
|
181
|
+
type Props$5 = {
|
|
182
182
|
/**
|
|
183
183
|
* Name of the function
|
|
184
184
|
*/
|
|
@@ -193,7 +193,7 @@ type Props$3 = {
|
|
|
193
193
|
pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType'];
|
|
194
194
|
dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType'];
|
|
195
195
|
};
|
|
196
|
-
type GetParamsProps$
|
|
196
|
+
type GetParamsProps$5 = {
|
|
197
197
|
paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing'];
|
|
198
198
|
paramsType: PluginReactQuery['resolvedOptions']['paramsType'];
|
|
199
199
|
pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType'];
|
|
@@ -211,7 +211,7 @@ declare function Query({
|
|
|
211
211
|
dataReturnType,
|
|
212
212
|
typeSchemas,
|
|
213
213
|
operation
|
|
214
|
-
}: Props$
|
|
214
|
+
}: Props$5): KubbNode;
|
|
215
215
|
declare namespace Query {
|
|
216
216
|
var getParams: ({
|
|
217
217
|
paramsType,
|
|
@@ -219,11 +219,11 @@ declare namespace Query {
|
|
|
219
219
|
pathParamsType,
|
|
220
220
|
dataReturnType,
|
|
221
221
|
typeSchemas
|
|
222
|
-
}: GetParamsProps$
|
|
222
|
+
}: GetParamsProps$5) => FunctionParams;
|
|
223
223
|
}
|
|
224
224
|
//#endregion
|
|
225
225
|
//#region src/components/QueryKey.d.ts
|
|
226
|
-
type Props$
|
|
226
|
+
type Props$4 = {
|
|
227
227
|
name: string;
|
|
228
228
|
typeName: string;
|
|
229
229
|
typeSchemas: OperationSchemas;
|
|
@@ -232,7 +232,7 @@ type Props$2 = {
|
|
|
232
232
|
pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType'];
|
|
233
233
|
transformer: Transformer | undefined;
|
|
234
234
|
};
|
|
235
|
-
type GetParamsProps$
|
|
235
|
+
type GetParamsProps$4 = {
|
|
236
236
|
paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing'];
|
|
237
237
|
pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType'];
|
|
238
238
|
typeSchemas: OperationSchemas;
|
|
@@ -245,18 +245,18 @@ declare function QueryKey({
|
|
|
245
245
|
operation,
|
|
246
246
|
typeName,
|
|
247
247
|
transformer
|
|
248
|
-
}: Props$
|
|
248
|
+
}: Props$4): KubbNode;
|
|
249
249
|
declare namespace QueryKey {
|
|
250
250
|
var getParams: ({
|
|
251
251
|
pathParamsType,
|
|
252
252
|
paramsCasing,
|
|
253
253
|
typeSchemas
|
|
254
|
-
}: GetParamsProps$
|
|
254
|
+
}: GetParamsProps$4) => FunctionParams;
|
|
255
255
|
var getTransformer: Transformer;
|
|
256
256
|
}
|
|
257
257
|
//#endregion
|
|
258
258
|
//#region src/components/QueryOptions.d.ts
|
|
259
|
-
type Props$
|
|
259
|
+
type Props$3 = {
|
|
260
260
|
name: string;
|
|
261
261
|
clientName: string;
|
|
262
262
|
queryKeyName: string;
|
|
@@ -266,7 +266,7 @@ type Props$1 = {
|
|
|
266
266
|
pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType'];
|
|
267
267
|
dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType'];
|
|
268
268
|
};
|
|
269
|
-
type GetParamsProps$
|
|
269
|
+
type GetParamsProps$3 = {
|
|
270
270
|
paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing'];
|
|
271
271
|
paramsType: PluginReactQuery['resolvedOptions']['paramsType'];
|
|
272
272
|
pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType'];
|
|
@@ -281,8 +281,99 @@ declare function QueryOptions({
|
|
|
281
281
|
paramsType,
|
|
282
282
|
pathParamsType,
|
|
283
283
|
queryKeyName
|
|
284
|
-
}: Props$
|
|
284
|
+
}: Props$3): KubbNode;
|
|
285
285
|
declare namespace QueryOptions {
|
|
286
|
+
var getParams: ({
|
|
287
|
+
paramsType,
|
|
288
|
+
paramsCasing,
|
|
289
|
+
pathParamsType,
|
|
290
|
+
typeSchemas
|
|
291
|
+
}: GetParamsProps$3) => FunctionParams;
|
|
292
|
+
}
|
|
293
|
+
//#endregion
|
|
294
|
+
//#region src/components/SuspenseInfiniteQuery.d.ts
|
|
295
|
+
type Props$2 = {
|
|
296
|
+
/**
|
|
297
|
+
* Name of the function
|
|
298
|
+
*/
|
|
299
|
+
name: string;
|
|
300
|
+
queryOptionsName: string;
|
|
301
|
+
queryKeyName: string;
|
|
302
|
+
queryKeyTypeName: string;
|
|
303
|
+
typeSchemas: OperationSchemas;
|
|
304
|
+
operation: Operation;
|
|
305
|
+
paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing'];
|
|
306
|
+
paramsType: PluginReactQuery['resolvedOptions']['paramsType'];
|
|
307
|
+
pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType'];
|
|
308
|
+
dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType'];
|
|
309
|
+
initialPageParam: Infinite['initialPageParam'];
|
|
310
|
+
queryParam?: Infinite['queryParam'];
|
|
311
|
+
};
|
|
312
|
+
type GetParamsProps$2 = {
|
|
313
|
+
paramsType: PluginReactQuery['resolvedOptions']['paramsType'];
|
|
314
|
+
paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing'];
|
|
315
|
+
pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType'];
|
|
316
|
+
typeSchemas: OperationSchemas;
|
|
317
|
+
pageParamGeneric: string;
|
|
318
|
+
};
|
|
319
|
+
declare function SuspenseInfiniteQuery({
|
|
320
|
+
name,
|
|
321
|
+
queryKeyTypeName,
|
|
322
|
+
queryOptionsName,
|
|
323
|
+
queryKeyName,
|
|
324
|
+
paramsType,
|
|
325
|
+
paramsCasing,
|
|
326
|
+
pathParamsType,
|
|
327
|
+
dataReturnType,
|
|
328
|
+
typeSchemas,
|
|
329
|
+
operation,
|
|
330
|
+
initialPageParam,
|
|
331
|
+
queryParam
|
|
332
|
+
}: Props$2): KubbNode;
|
|
333
|
+
declare namespace SuspenseInfiniteQuery {
|
|
334
|
+
var getParams: ({
|
|
335
|
+
paramsType,
|
|
336
|
+
paramsCasing,
|
|
337
|
+
pathParamsType,
|
|
338
|
+
typeSchemas,
|
|
339
|
+
pageParamGeneric
|
|
340
|
+
}: GetParamsProps$2) => FunctionParams;
|
|
341
|
+
}
|
|
342
|
+
//#endregion
|
|
343
|
+
//#region src/components/SuspenseInfiniteQueryOptions.d.ts
|
|
344
|
+
type Props$1 = {
|
|
345
|
+
name: string;
|
|
346
|
+
clientName: string;
|
|
347
|
+
queryKeyName: string;
|
|
348
|
+
typeSchemas: OperationSchemas;
|
|
349
|
+
paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing'];
|
|
350
|
+
paramsType: PluginReactQuery['resolvedOptions']['paramsType'];
|
|
351
|
+
pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType'];
|
|
352
|
+
dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType'];
|
|
353
|
+
initialPageParam: Infinite['initialPageParam'];
|
|
354
|
+
cursorParam: Infinite['cursorParam'];
|
|
355
|
+
queryParam: Infinite['queryParam'];
|
|
356
|
+
};
|
|
357
|
+
type GetParamsProps$1 = {
|
|
358
|
+
paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing'];
|
|
359
|
+
paramsType: PluginReactQuery['resolvedOptions']['paramsType'];
|
|
360
|
+
pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType'];
|
|
361
|
+
typeSchemas: OperationSchemas;
|
|
362
|
+
};
|
|
363
|
+
declare function SuspenseInfiniteQueryOptions({
|
|
364
|
+
name,
|
|
365
|
+
clientName,
|
|
366
|
+
initialPageParam,
|
|
367
|
+
cursorParam,
|
|
368
|
+
typeSchemas,
|
|
369
|
+
paramsCasing,
|
|
370
|
+
paramsType,
|
|
371
|
+
dataReturnType,
|
|
372
|
+
pathParamsType,
|
|
373
|
+
queryParam,
|
|
374
|
+
queryKeyName
|
|
375
|
+
}: Props$1): KubbNode;
|
|
376
|
+
declare namespace SuspenseInfiniteQueryOptions {
|
|
286
377
|
var getParams: ({
|
|
287
378
|
paramsType,
|
|
288
379
|
paramsCasing,
|
|
@@ -343,5 +434,5 @@ declare namespace SuspenseQuery {
|
|
|
343
434
|
}: GetParamsProps) => FunctionParams;
|
|
344
435
|
}
|
|
345
436
|
//#endregion
|
|
346
|
-
export { InfiniteQuery, InfiniteQueryOptions, Mutation, MutationKey, MutationOptions, Query, QueryKey, QueryOptions, SuspenseQuery };
|
|
437
|
+
export { InfiniteQuery, InfiniteQueryOptions, Mutation, MutationKey, MutationOptions, Query, QueryKey, QueryOptions, SuspenseInfiniteQuery, SuspenseInfiniteQueryOptions, SuspenseQuery };
|
|
347
438
|
//# sourceMappingURL=components.d.ts.map
|
package/dist/components.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as Mutation, c as InfiniteQueryOptions, d as QueryKey, i as Query, l as InfiniteQuery, n as SuspenseInfiniteQueryOptions, o as MutationOptions, r as SuspenseInfiniteQuery, s as MutationKey, t as SuspenseQuery, u as QueryOptions } from "./components-K4qy3AIg.js";
|
|
2
2
|
|
|
3
|
-
export { InfiniteQuery, InfiniteQueryOptions, Mutation, MutationKey, MutationOptions, Query, QueryKey, QueryOptions, SuspenseQuery };
|
|
3
|
+
export { InfiniteQuery, InfiniteQueryOptions, Mutation, MutationKey, MutationOptions, Query, QueryKey, QueryOptions, SuspenseInfiniteQuery, SuspenseInfiniteQueryOptions, SuspenseQuery };
|
|
@@ -25,7 +25,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
25
|
}) : target, mod));
|
|
26
26
|
|
|
27
27
|
//#endregion
|
|
28
|
-
const require_components = require('./components-
|
|
28
|
+
const require_components = require('./components-C0HQi0Tg.cjs');
|
|
29
29
|
let node_path = require("node:path");
|
|
30
30
|
node_path = __toESM(node_path);
|
|
31
31
|
let __kubb_plugin_client = require("@kubb/plugin-client");
|
|
@@ -653,6 +653,223 @@ const queryGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)({
|
|
|
653
653
|
}
|
|
654
654
|
});
|
|
655
655
|
|
|
656
|
+
//#endregion
|
|
657
|
+
//#region src/generators/suspenseInfiniteQueryGenerator.tsx
|
|
658
|
+
const suspenseInfiniteQueryGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)({
|
|
659
|
+
name: "react-suspense-infinite-query",
|
|
660
|
+
Operation({ config, operation, generator, plugin }) {
|
|
661
|
+
const { options, options: { output } } = plugin;
|
|
662
|
+
const pluginManager = (0, __kubb_core_hooks.usePluginManager)();
|
|
663
|
+
const oas = (0, __kubb_plugin_oas_hooks.useOas)();
|
|
664
|
+
const { getSchemas, getName, getFile } = (0, __kubb_plugin_oas_hooks.useOperationManager)(generator);
|
|
665
|
+
const isQuery = typeof options.query === "boolean" ? true : options.query?.methods.some((method) => operation.method === method);
|
|
666
|
+
const isMutation = (0, remeda.difference)(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method);
|
|
667
|
+
const isSuspense = !!options.suspense;
|
|
668
|
+
const infiniteOptions = options.infinite && typeof options.infinite === "object" ? options.infinite : void 0;
|
|
669
|
+
const importPath = options.query ? options.query.importPath : "@tanstack/react-query";
|
|
670
|
+
const query = {
|
|
671
|
+
name: getName(operation, {
|
|
672
|
+
type: "function",
|
|
673
|
+
prefix: "use",
|
|
674
|
+
suffix: "suspenseInfinite"
|
|
675
|
+
}),
|
|
676
|
+
typeName: getName(operation, { type: "type" }),
|
|
677
|
+
file: getFile(operation, {
|
|
678
|
+
prefix: "use",
|
|
679
|
+
suffix: "suspenseInfinite"
|
|
680
|
+
})
|
|
681
|
+
};
|
|
682
|
+
const hasClientPlugin = !!pluginManager.getPluginByKey([__kubb_plugin_client.pluginClientName]);
|
|
683
|
+
const client = {
|
|
684
|
+
name: hasClientPlugin ? getName(operation, {
|
|
685
|
+
type: "function",
|
|
686
|
+
pluginKey: [__kubb_plugin_client.pluginClientName]
|
|
687
|
+
}) : getName(operation, {
|
|
688
|
+
type: "function",
|
|
689
|
+
suffix: "suspenseInfinite"
|
|
690
|
+
}),
|
|
691
|
+
file: getFile(operation, { pluginKey: [__kubb_plugin_client.pluginClientName] })
|
|
692
|
+
};
|
|
693
|
+
const queryOptions = { name: getName(operation, {
|
|
694
|
+
type: "function",
|
|
695
|
+
suffix: "SuspenseInfiniteQueryOptions"
|
|
696
|
+
}) };
|
|
697
|
+
const queryKey = {
|
|
698
|
+
name: getName(operation, {
|
|
699
|
+
type: "const",
|
|
700
|
+
suffix: "SuspenseInfiniteQueryKey"
|
|
701
|
+
}),
|
|
702
|
+
typeName: getName(operation, {
|
|
703
|
+
type: "type",
|
|
704
|
+
suffix: "SuspenseInfiniteQueryKey"
|
|
705
|
+
})
|
|
706
|
+
};
|
|
707
|
+
const type = {
|
|
708
|
+
file: getFile(operation, { pluginKey: [__kubb_plugin_ts.pluginTsName] }),
|
|
709
|
+
schemas: getSchemas(operation, {
|
|
710
|
+
pluginKey: [__kubb_plugin_ts.pluginTsName],
|
|
711
|
+
type: "type"
|
|
712
|
+
})
|
|
713
|
+
};
|
|
714
|
+
const zod = {
|
|
715
|
+
file: getFile(operation, { pluginKey: [__kubb_plugin_zod.pluginZodName] }),
|
|
716
|
+
schemas: getSchemas(operation, {
|
|
717
|
+
pluginKey: [__kubb_plugin_zod.pluginZodName],
|
|
718
|
+
type: "function"
|
|
719
|
+
})
|
|
720
|
+
};
|
|
721
|
+
if (!isQuery || isMutation || !isSuspense || !infiniteOptions) return null;
|
|
722
|
+
return /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsxs)(__kubb_react_fabric.File, {
|
|
723
|
+
baseName: query.file.baseName,
|
|
724
|
+
path: query.file.path,
|
|
725
|
+
meta: query.file.meta,
|
|
726
|
+
banner: (0, __kubb_plugin_oas_utils.getBanner)({
|
|
727
|
+
oas,
|
|
728
|
+
output,
|
|
729
|
+
config: pluginManager.config
|
|
730
|
+
}),
|
|
731
|
+
footer: (0, __kubb_plugin_oas_utils.getFooter)({
|
|
732
|
+
oas,
|
|
733
|
+
output
|
|
734
|
+
}),
|
|
735
|
+
children: [
|
|
736
|
+
options.parser === "zod" && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
737
|
+
name: [zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean),
|
|
738
|
+
root: query.file.path,
|
|
739
|
+
path: zod.file.path
|
|
740
|
+
}),
|
|
741
|
+
options.client.importPath ? /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsxs)(__kubb_react_fabric_jsx_runtime.Fragment, { children: [
|
|
742
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
743
|
+
name: "fetch",
|
|
744
|
+
path: options.client.importPath
|
|
745
|
+
}),
|
|
746
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
747
|
+
name: ["RequestConfig", "ResponseErrorConfig"],
|
|
748
|
+
path: options.client.importPath,
|
|
749
|
+
isTypeOnly: true
|
|
750
|
+
}),
|
|
751
|
+
options.client.dataReturnType === "full" && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
752
|
+
name: ["ResponseConfig"],
|
|
753
|
+
path: options.client.importPath,
|
|
754
|
+
isTypeOnly: true
|
|
755
|
+
})
|
|
756
|
+
] }) : /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsxs)(__kubb_react_fabric_jsx_runtime.Fragment, { children: [
|
|
757
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
758
|
+
name: ["fetch"],
|
|
759
|
+
root: query.file.path,
|
|
760
|
+
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts")
|
|
761
|
+
}),
|
|
762
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
763
|
+
name: ["RequestConfig", "ResponseErrorConfig"],
|
|
764
|
+
root: query.file.path,
|
|
765
|
+
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
|
|
766
|
+
isTypeOnly: true
|
|
767
|
+
}),
|
|
768
|
+
options.client.dataReturnType === "full" && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
769
|
+
name: ["ResponseConfig"],
|
|
770
|
+
root: query.file.path,
|
|
771
|
+
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
|
|
772
|
+
isTypeOnly: true
|
|
773
|
+
})
|
|
774
|
+
] }),
|
|
775
|
+
hasClientPlugin && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
776
|
+
name: [client.name],
|
|
777
|
+
root: query.file.path,
|
|
778
|
+
path: client.file.path
|
|
779
|
+
}),
|
|
780
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
781
|
+
name: [
|
|
782
|
+
type.schemas.request?.name,
|
|
783
|
+
type.schemas.response.name,
|
|
784
|
+
type.schemas.pathParams?.name,
|
|
785
|
+
type.schemas.queryParams?.name,
|
|
786
|
+
type.schemas.headerParams?.name,
|
|
787
|
+
...type.schemas.statusCodes?.map((item) => item.name) || []
|
|
788
|
+
].filter(Boolean),
|
|
789
|
+
root: query.file.path,
|
|
790
|
+
path: type.file.path,
|
|
791
|
+
isTypeOnly: true
|
|
792
|
+
}),
|
|
793
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(require_components.QueryKey, {
|
|
794
|
+
name: queryKey.name,
|
|
795
|
+
typeName: queryKey.typeName,
|
|
796
|
+
operation,
|
|
797
|
+
paramsCasing: options.paramsCasing,
|
|
798
|
+
pathParamsType: options.pathParamsType,
|
|
799
|
+
typeSchemas: type.schemas,
|
|
800
|
+
transformer: options.queryKey
|
|
801
|
+
}),
|
|
802
|
+
!hasClientPlugin && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_plugin_client_components.Client, {
|
|
803
|
+
name: client.name,
|
|
804
|
+
baseURL: options.client.baseURL,
|
|
805
|
+
operation,
|
|
806
|
+
typeSchemas: type.schemas,
|
|
807
|
+
zodSchemas: zod.schemas,
|
|
808
|
+
dataReturnType: options.client.dataReturnType || "data",
|
|
809
|
+
paramsCasing: options.paramsCasing,
|
|
810
|
+
paramsType: options.paramsType,
|
|
811
|
+
pathParamsType: options.pathParamsType,
|
|
812
|
+
parser: options.parser
|
|
813
|
+
}),
|
|
814
|
+
infiniteOptions && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsxs)(__kubb_react_fabric_jsx_runtime.Fragment, { children: [
|
|
815
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
816
|
+
name: ["InfiniteData"],
|
|
817
|
+
isTypeOnly: true,
|
|
818
|
+
path: importPath
|
|
819
|
+
}),
|
|
820
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
821
|
+
name: ["infiniteQueryOptions"],
|
|
822
|
+
path: importPath
|
|
823
|
+
}),
|
|
824
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(require_components.SuspenseInfiniteQueryOptions, {
|
|
825
|
+
name: queryOptions.name,
|
|
826
|
+
clientName: client.name,
|
|
827
|
+
queryKeyName: queryKey.name,
|
|
828
|
+
typeSchemas: type.schemas,
|
|
829
|
+
paramsCasing: options.paramsCasing,
|
|
830
|
+
paramsType: options.paramsType,
|
|
831
|
+
pathParamsType: options.pathParamsType,
|
|
832
|
+
dataReturnType: options.client.dataReturnType || "data",
|
|
833
|
+
cursorParam: infiniteOptions.cursorParam,
|
|
834
|
+
initialPageParam: infiniteOptions.initialPageParam,
|
|
835
|
+
queryParam: infiniteOptions.queryParam
|
|
836
|
+
})
|
|
837
|
+
] }),
|
|
838
|
+
infiniteOptions && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsxs)(__kubb_react_fabric_jsx_runtime.Fragment, { children: [
|
|
839
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
840
|
+
name: ["useSuspenseInfiniteQuery"],
|
|
841
|
+
path: importPath
|
|
842
|
+
}),
|
|
843
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
844
|
+
name: [
|
|
845
|
+
"QueryKey",
|
|
846
|
+
"QueryClient",
|
|
847
|
+
"UseSuspenseInfiniteQueryOptions",
|
|
848
|
+
"UseSuspenseInfiniteQueryResult"
|
|
849
|
+
],
|
|
850
|
+
path: importPath,
|
|
851
|
+
isTypeOnly: true
|
|
852
|
+
}),
|
|
853
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(require_components.SuspenseInfiniteQuery, {
|
|
854
|
+
name: query.name,
|
|
855
|
+
queryOptionsName: queryOptions.name,
|
|
856
|
+
typeSchemas: type.schemas,
|
|
857
|
+
paramsCasing: options.paramsCasing,
|
|
858
|
+
paramsType: options.paramsType,
|
|
859
|
+
pathParamsType: options.pathParamsType,
|
|
860
|
+
operation,
|
|
861
|
+
dataReturnType: options.client.dataReturnType || "data",
|
|
862
|
+
queryKeyName: queryKey.name,
|
|
863
|
+
queryKeyTypeName: queryKey.typeName,
|
|
864
|
+
initialPageParam: infiniteOptions.initialPageParam,
|
|
865
|
+
queryParam: infiniteOptions.queryParam
|
|
866
|
+
})
|
|
867
|
+
] })
|
|
868
|
+
]
|
|
869
|
+
});
|
|
870
|
+
}
|
|
871
|
+
});
|
|
872
|
+
|
|
656
873
|
//#endregion
|
|
657
874
|
//#region src/generators/suspenseQueryGenerator.tsx
|
|
658
875
|
const suspenseQueryGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)({
|
|
@@ -882,10 +1099,16 @@ Object.defineProperty(exports, 'queryGenerator', {
|
|
|
882
1099
|
return queryGenerator;
|
|
883
1100
|
}
|
|
884
1101
|
});
|
|
1102
|
+
Object.defineProperty(exports, 'suspenseInfiniteQueryGenerator', {
|
|
1103
|
+
enumerable: true,
|
|
1104
|
+
get: function () {
|
|
1105
|
+
return suspenseInfiniteQueryGenerator;
|
|
1106
|
+
}
|
|
1107
|
+
});
|
|
885
1108
|
Object.defineProperty(exports, 'suspenseQueryGenerator', {
|
|
886
1109
|
enumerable: true,
|
|
887
1110
|
get: function () {
|
|
888
1111
|
return suspenseQueryGenerator;
|
|
889
1112
|
}
|
|
890
1113
|
});
|
|
891
|
-
//# sourceMappingURL=generators-
|
|
1114
|
+
//# sourceMappingURL=generators-CKLkXi1h.cjs.map
|