@kubb/plugin-react-query 5.0.0-alpha.8 → 5.0.0-beta.10

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 (54) hide show
  1. package/LICENSE +17 -10
  2. package/README.md +34 -85
  3. package/dist/components-Dow6tde8.js +1459 -0
  4. package/dist/components-Dow6tde8.js.map +1 -0
  5. package/dist/components-HwdCDefj.cjs +1603 -0
  6. package/dist/components-HwdCDefj.cjs.map +1 -0
  7. package/dist/components.cjs +1 -1
  8. package/dist/components.d.ts +49 -179
  9. package/dist/components.js +1 -1
  10. package/dist/generators-CcOmnTPa.cjs +1454 -0
  11. package/dist/generators-CcOmnTPa.cjs.map +1 -0
  12. package/dist/generators-yfZr_qfT.js +1412 -0
  13. package/dist/generators-yfZr_qfT.js.map +1 -0
  14. package/dist/generators.cjs +1 -1
  15. package/dist/generators.d.ts +9 -476
  16. package/dist/generators.js +1 -1
  17. package/dist/index.cjs +197 -126
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.ts +4 -4
  20. package/dist/index.js +193 -126
  21. package/dist/index.js.map +1 -1
  22. package/dist/types-DG_OxOym.d.ts +363 -0
  23. package/extension.yaml +911 -0
  24. package/package.json +59 -64
  25. package/src/components/InfiniteQuery.tsx +79 -138
  26. package/src/components/InfiniteQueryOptions.tsx +55 -166
  27. package/src/components/Mutation.tsx +74 -111
  28. package/src/components/MutationOptions.tsx +61 -80
  29. package/src/components/Query.tsx +66 -142
  30. package/src/components/QueryOptions.tsx +56 -138
  31. package/src/components/SuspenseInfiniteQuery.tsx +79 -138
  32. package/src/components/SuspenseInfiniteQueryOptions.tsx +55 -166
  33. package/src/components/SuspenseQuery.tsx +66 -152
  34. package/src/generators/customHookOptionsFileGenerator.tsx +37 -51
  35. package/src/generators/hookOptionsGenerator.tsx +111 -174
  36. package/src/generators/infiniteQueryGenerator.tsx +158 -178
  37. package/src/generators/mutationGenerator.tsx +112 -139
  38. package/src/generators/queryGenerator.tsx +128 -142
  39. package/src/generators/suspenseInfiniteQueryGenerator.tsx +157 -156
  40. package/src/generators/suspenseQueryGenerator.tsx +126 -152
  41. package/src/index.ts +1 -1
  42. package/src/plugin.ts +134 -187
  43. package/src/resolvers/resolverReactQuery.ts +107 -0
  44. package/src/types.ts +172 -49
  45. package/src/utils.ts +10 -0
  46. package/dist/components-BHQT9ZLc.cjs +0 -1634
  47. package/dist/components-BHQT9ZLc.cjs.map +0 -1
  48. package/dist/components-CpyHYGOw.js +0 -1520
  49. package/dist/components-CpyHYGOw.js.map +0 -1
  50. package/dist/generators-DP07m3rH.cjs +0 -1469
  51. package/dist/generators-DP07m3rH.cjs.map +0 -1
  52. package/dist/generators-DkQwKTc2.js +0 -1427
  53. package/dist/generators-DkQwKTc2.js.map +0 -1
  54. package/dist/types-D5S7Ny9r.d.ts +0 -270
@@ -1,21 +1,17 @@
1
1
  import { t as __name } from "./chunk--u3MIqq1.js";
2
- import { a as MutationKey, i as QueryKey, r as PluginReactQuery, t as Infinite } from "./types-D5S7Ny9r.js";
3
- import { OperationSchemas } from "@kubb/plugin-oas";
4
- import { Operation } from "@kubb/oas";
5
- import { FunctionParams } from "@kubb/react-fabric";
6
- import { FabricReactNode } from "@kubb/react-fabric/types";
2
+ import { a as MutationKey, i as QueryKey, r as PluginReactQuery, t as Infinite } from "./types-DG_OxOym.js";
3
+ import { ast } from "@kubb/core";
4
+ import { ResolverTs } from "@kubb/plugin-ts";
5
+ import { KubbReactNode } from "@kubb/renderer-jsx/types";
7
6
 
8
7
  //#region src/components/InfiniteQuery.d.ts
9
8
  type Props$8 = {
10
- /**
11
- * Name of the function
12
- */
13
9
  name: string;
14
10
  queryOptionsName: string;
15
11
  queryKeyName: string;
16
12
  queryKeyTypeName: string;
17
- typeSchemas: OperationSchemas;
18
- operation: Operation;
13
+ node: ast.OperationNode;
14
+ tsResolver: ResolverTs;
19
15
  paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing'];
20
16
  paramsType: PluginReactQuery['resolvedOptions']['paramsType'];
21
17
  pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType'];
@@ -24,13 +20,6 @@ type Props$8 = {
24
20
  queryParam?: Infinite['queryParam'];
25
21
  customOptions: PluginReactQuery['resolvedOptions']['customOptions'];
26
22
  };
27
- type GetParamsProps$7 = {
28
- paramsType: PluginReactQuery['resolvedOptions']['paramsType'];
29
- paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing'];
30
- pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType'];
31
- typeSchemas: OperationSchemas;
32
- pageParamGeneric: string;
33
- };
34
23
  declare function InfiniteQuery({
35
24
  name,
36
25
  queryKeyTypeName,
@@ -40,28 +29,20 @@ declare function InfiniteQuery({
40
29
  paramsCasing,
41
30
  pathParamsType,
42
31
  dataReturnType,
43
- typeSchemas,
44
- operation,
32
+ node,
33
+ tsResolver,
45
34
  initialPageParam,
46
35
  queryParam,
47
36
  customOptions
48
- }: Props$8): FabricReactNode;
49
- declare namespace InfiniteQuery {
50
- var getParams: ({
51
- paramsType,
52
- paramsCasing,
53
- pathParamsType,
54
- typeSchemas,
55
- pageParamGeneric
56
- }: GetParamsProps$7) => FunctionParams;
57
- }
37
+ }: Props$8): KubbReactNode;
58
38
  //#endregion
59
39
  //#region src/components/InfiniteQueryOptions.d.ts
60
40
  type Props$7 = {
61
41
  name: string;
62
42
  clientName: string;
63
43
  queryKeyName: string;
64
- typeSchemas: OperationSchemas;
44
+ node: ast.OperationNode;
45
+ tsResolver: ResolverTs;
65
46
  paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing'];
66
47
  paramsType: PluginReactQuery['resolvedOptions']['paramsType'];
67
48
  pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType'];
@@ -72,12 +53,6 @@ type Props$7 = {
72
53
  previousParam: Infinite['previousParam'];
73
54
  queryParam: Infinite['queryParam'];
74
55
  };
75
- type GetParamsProps$6 = {
76
- paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing'];
77
- paramsType: PluginReactQuery['resolvedOptions']['paramsType'];
78
- pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType'];
79
- typeSchemas: OperationSchemas;
80
- };
81
56
  declare function InfiniteQueryOptions({
82
57
  name,
83
58
  clientName,
@@ -85,34 +60,24 @@ declare function InfiniteQueryOptions({
85
60
  cursorParam,
86
61
  nextParam,
87
62
  previousParam,
88
- typeSchemas,
63
+ node,
64
+ tsResolver,
89
65
  paramsCasing,
90
66
  paramsType,
91
67
  dataReturnType,
92
68
  pathParamsType,
93
69
  queryParam,
94
70
  queryKeyName
95
- }: Props$7): FabricReactNode;
96
- declare namespace InfiniteQueryOptions {
97
- var getParams: ({
98
- paramsType,
99
- paramsCasing,
100
- pathParamsType,
101
- typeSchemas
102
- }: GetParamsProps$6) => FunctionParams;
103
- }
71
+ }: Props$7): KubbReactNode;
104
72
  //#endregion
105
73
  //#region src/components/Mutation.d.ts
106
74
  type Props$6 = {
107
- /**
108
- * Name of the function
109
- */
110
75
  name: string;
111
76
  typeName: string;
112
77
  mutationOptionsName: string;
113
78
  mutationKeyName: string;
114
- typeSchemas: OperationSchemas;
115
- operation: Operation;
79
+ node: ast.OperationNode;
80
+ tsResolver: ResolverTs;
116
81
  dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType'];
117
82
  paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing'];
118
83
  pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType'];
@@ -122,68 +87,51 @@ declare function Mutation({
122
87
  name,
123
88
  mutationOptionsName,
124
89
  paramsCasing,
125
- pathParamsType,
126
90
  dataReturnType,
127
- typeSchemas,
128
- operation,
91
+ node,
92
+ tsResolver,
129
93
  mutationKeyName,
130
94
  customOptions
131
- }: Props$6): FabricReactNode;
95
+ }: Props$6): KubbReactNode;
132
96
  //#endregion
133
97
  //#region src/components/MutationOptions.d.ts
134
98
  type Props$5 = {
135
99
  name: string;
136
100
  clientName: string;
137
101
  mutationKeyName: string;
138
- typeSchemas: OperationSchemas;
102
+ node: ast.OperationNode;
103
+ tsResolver: ResolverTs;
139
104
  paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing'];
140
105
  paramsType: PluginReactQuery['resolvedOptions']['paramsType'];
141
106
  pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType'];
142
107
  dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType'];
143
108
  };
144
- type GetParamsProps$5 = {
145
- typeSchemas: OperationSchemas;
146
- };
147
109
  declare function MutationOptions({
148
110
  name,
149
111
  clientName,
150
112
  dataReturnType,
151
- typeSchemas,
113
+ node,
114
+ tsResolver,
152
115
  paramsCasing,
153
116
  paramsType,
154
117
  pathParamsType,
155
118
  mutationKeyName
156
- }: Props$5): FabricReactNode;
157
- declare namespace MutationOptions {
158
- var getParams: ({
159
- typeSchemas
160
- }: GetParamsProps$5) => FunctionParams;
161
- }
119
+ }: Props$5): KubbReactNode;
162
120
  //#endregion
163
121
  //#region src/components/Query.d.ts
164
122
  type Props$4 = {
165
- /**
166
- * Name of the function
167
- */
168
123
  name: string;
169
124
  queryOptionsName: string;
170
125
  queryKeyName: string;
171
126
  queryKeyTypeName: string;
172
- typeSchemas: OperationSchemas;
173
- operation: Operation;
127
+ node: ast.OperationNode;
128
+ tsResolver: ResolverTs;
174
129
  paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing'];
175
130
  paramsType: PluginReactQuery['resolvedOptions']['paramsType'];
176
131
  pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType'];
177
132
  dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType'];
178
133
  customOptions: PluginReactQuery['resolvedOptions']['customOptions'];
179
134
  };
180
- type GetParamsProps$4 = {
181
- paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing'];
182
- paramsType: PluginReactQuery['resolvedOptions']['paramsType'];
183
- pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType'];
184
- dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType'];
185
- typeSchemas: OperationSchemas;
186
- };
187
135
  declare function Query({
188
136
  name,
189
137
  queryKeyTypeName,
@@ -193,67 +141,43 @@ declare function Query({
193
141
  paramsCasing,
194
142
  pathParamsType,
195
143
  dataReturnType,
196
- typeSchemas,
197
- operation,
144
+ node,
145
+ tsResolver,
198
146
  customOptions
199
- }: Props$4): FabricReactNode;
200
- declare namespace Query {
201
- var getParams: ({
202
- paramsType,
203
- paramsCasing,
204
- pathParamsType,
205
- dataReturnType,
206
- typeSchemas
207
- }: GetParamsProps$4) => FunctionParams;
208
- }
147
+ }: Props$4): KubbReactNode;
209
148
  //#endregion
210
149
  //#region src/components/QueryOptions.d.ts
211
150
  type Props$3 = {
212
151
  name: string;
213
152
  clientName: string;
214
153
  queryKeyName: string;
215
- typeSchemas: OperationSchemas;
154
+ node: ast.OperationNode;
155
+ tsResolver: ResolverTs;
216
156
  paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing'];
217
157
  paramsType: PluginReactQuery['resolvedOptions']['paramsType'];
218
158
  pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType'];
219
159
  dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType'];
220
160
  };
221
- type GetParamsProps$3 = {
222
- paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing'];
223
- paramsType: PluginReactQuery['resolvedOptions']['paramsType'];
224
- pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType'];
225
- typeSchemas: OperationSchemas;
226
- };
227
161
  declare function QueryOptions({
228
162
  name,
229
163
  clientName,
230
164
  dataReturnType,
231
- typeSchemas,
165
+ node,
166
+ tsResolver,
232
167
  paramsCasing,
233
168
  paramsType,
234
169
  pathParamsType,
235
170
  queryKeyName
236
- }: Props$3): FabricReactNode;
237
- declare namespace QueryOptions {
238
- var getParams: ({
239
- paramsType,
240
- paramsCasing,
241
- pathParamsType,
242
- typeSchemas
243
- }: GetParamsProps$3) => FunctionParams;
244
- }
171
+ }: Props$3): KubbReactNode;
245
172
  //#endregion
246
173
  //#region src/components/SuspenseInfiniteQuery.d.ts
247
174
  type Props$2 = {
248
- /**
249
- * Name of the function
250
- */
251
175
  name: string;
252
176
  queryOptionsName: string;
253
177
  queryKeyName: string;
254
178
  queryKeyTypeName: string;
255
- typeSchemas: OperationSchemas;
256
- operation: Operation;
179
+ node: ast.OperationNode;
180
+ tsResolver: ResolverTs;
257
181
  paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing'];
258
182
  paramsType: PluginReactQuery['resolvedOptions']['paramsType'];
259
183
  pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType'];
@@ -262,13 +186,6 @@ type Props$2 = {
262
186
  initialPageParam: Infinite['initialPageParam'];
263
187
  queryParam?: Infinite['queryParam'];
264
188
  };
265
- type GetParamsProps$2 = {
266
- paramsType: PluginReactQuery['resolvedOptions']['paramsType'];
267
- paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing'];
268
- pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType'];
269
- typeSchemas: OperationSchemas;
270
- pageParamGeneric: string;
271
- };
272
189
  declare function SuspenseInfiniteQuery({
273
190
  name,
274
191
  queryKeyTypeName,
@@ -278,28 +195,20 @@ declare function SuspenseInfiniteQuery({
278
195
  paramsCasing,
279
196
  pathParamsType,
280
197
  dataReturnType,
281
- typeSchemas,
282
- operation,
198
+ node,
199
+ tsResolver,
283
200
  customOptions,
284
201
  initialPageParam,
285
202
  queryParam
286
- }: Props$2): FabricReactNode;
287
- declare namespace SuspenseInfiniteQuery {
288
- var getParams: ({
289
- paramsType,
290
- paramsCasing,
291
- pathParamsType,
292
- typeSchemas,
293
- pageParamGeneric
294
- }: GetParamsProps$2) => FunctionParams;
295
- }
203
+ }: Props$2): KubbReactNode;
296
204
  //#endregion
297
205
  //#region src/components/SuspenseInfiniteQueryOptions.d.ts
298
206
  type Props$1 = {
299
207
  name: string;
300
208
  clientName: string;
301
209
  queryKeyName: string;
302
- typeSchemas: OperationSchemas;
210
+ node: ast.OperationNode;
211
+ tsResolver: ResolverTs;
303
212
  paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing'];
304
213
  paramsType: PluginReactQuery['resolvedOptions']['paramsType'];
305
214
  pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType'];
@@ -310,12 +219,6 @@ type Props$1 = {
310
219
  previousParam: Infinite['previousParam'];
311
220
  queryParam: Infinite['queryParam'];
312
221
  };
313
- type GetParamsProps$1 = {
314
- paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing'];
315
- paramsType: PluginReactQuery['resolvedOptions']['paramsType'];
316
- pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType'];
317
- typeSchemas: OperationSchemas;
318
- };
319
222
  declare function SuspenseInfiniteQueryOptions({
320
223
  name,
321
224
  clientName,
@@ -323,54 +226,30 @@ declare function SuspenseInfiniteQueryOptions({
323
226
  cursorParam,
324
227
  nextParam,
325
228
  previousParam,
326
- typeSchemas,
229
+ node,
230
+ tsResolver,
327
231
  paramsCasing,
328
232
  paramsType,
329
233
  dataReturnType,
330
234
  pathParamsType,
331
235
  queryParam,
332
236
  queryKeyName
333
- }: Props$1): FabricReactNode;
334
- declare namespace SuspenseInfiniteQueryOptions {
335
- var getParams: ({
336
- paramsType,
337
- paramsCasing,
338
- pathParamsType,
339
- typeSchemas
340
- }: GetParamsProps$1) => FunctionParams;
341
- }
237
+ }: Props$1): KubbReactNode;
342
238
  //#endregion
343
239
  //#region src/components/SuspenseQuery.d.ts
344
240
  type Props = {
345
- /**
346
- * Name of the function
347
- */
348
241
  name: string;
349
242
  queryOptionsName: string;
350
243
  queryKeyName: string;
351
244
  queryKeyTypeName: string;
352
- typeSchemas: OperationSchemas;
353
- operation: Operation;
245
+ node: ast.OperationNode;
246
+ tsResolver: ResolverTs;
354
247
  paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing'];
355
248
  paramsType: PluginReactQuery['resolvedOptions']['paramsType'];
356
249
  pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType'];
357
250
  dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType'];
358
251
  customOptions: PluginReactQuery['resolvedOptions']['customOptions'];
359
252
  };
360
- type GetParamsProps = {
361
- paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing'];
362
- paramsType: PluginReactQuery['resolvedOptions']['paramsType'];
363
- pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType'];
364
- dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType'];
365
- typeSchemas: OperationSchemas;
366
- };
367
- /**
368
- * Generates a strongly-typed React Query Suspense hook function for an OpenAPI operation.
369
- *
370
- * The generated function wraps `useSuspenseQuery`, providing type-safe parameters and return types based on the supplied OpenAPI schemas and configuration.
371
- *
372
- * @returns A React component source node containing the generated query function.
373
- */
374
253
  declare function SuspenseQuery({
375
254
  name,
376
255
  queryKeyTypeName,
@@ -380,19 +259,10 @@ declare function SuspenseQuery({
380
259
  paramsCasing,
381
260
  pathParamsType,
382
261
  dataReturnType,
383
- typeSchemas,
384
- operation,
262
+ node,
263
+ tsResolver,
385
264
  customOptions
386
- }: Props): FabricReactNode;
387
- declare namespace SuspenseQuery {
388
- var getParams: ({
389
- paramsType,
390
- paramsCasing,
391
- pathParamsType,
392
- dataReturnType,
393
- typeSchemas
394
- }: GetParamsProps) => FunctionParams;
395
- }
265
+ }: Props): KubbReactNode;
396
266
  //#endregion
397
267
  export { InfiniteQuery, InfiniteQueryOptions, Mutation, MutationKey, MutationOptions, Query, QueryKey, QueryOptions, SuspenseInfiniteQuery, SuspenseInfiniteQueryOptions, SuspenseQuery };
398
268
  //# sourceMappingURL=components.d.ts.map
@@ -1,2 +1,2 @@
1
- import { a as Mutation, c as InfiniteQuery, d as MutationKey, i as Query, l as QueryOptions, n as SuspenseInfiniteQueryOptions, o as MutationOptions, r as SuspenseInfiniteQuery, s as InfiniteQueryOptions, t as SuspenseQuery, u as QueryKey } from "./components-CpyHYGOw.js";
1
+ import { a as Mutation, c as InfiniteQuery, g as MutationKey, i as Query, l as QueryOptions, n as SuspenseInfiniteQueryOptions, o as MutationOptions, r as SuspenseInfiniteQuery, s as InfiniteQueryOptions, t as SuspenseQuery, u as QueryKey } from "./components-Dow6tde8.js";
2
2
  export { InfiniteQuery, InfiniteQueryOptions, Mutation, MutationKey, MutationOptions, Query, QueryKey, QueryOptions, SuspenseInfiniteQuery, SuspenseInfiniteQueryOptions, SuspenseQuery };