@kubb/plugin-react-query 3.5.6 → 3.5.7

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.
@@ -21,7 +21,7 @@ function getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
21
21
  mode: pathParamsType === "object" ? "object" : "inlineSpread",
22
22
  children: getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
23
23
  optional: isOptional(typeSchemas.pathParams?.schema)
24
- } : void 0
24
+ } : undefined
25
25
  });
26
26
  }
27
27
  function Url({ name, isExportable = true, isIndexable = true, typeSchemas, baseURL, paramsType, paramsCasing, pathParamsType, operation }) {
@@ -40,15 +40,15 @@ function getParams2({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
40
40
  data: typeSchemas.request?.name ? {
41
41
  type: typeSchemas.request?.name,
42
42
  optional: isOptional(typeSchemas.request?.schema)
43
- } : void 0,
43
+ } : undefined,
44
44
  params: typeSchemas.queryParams?.name ? {
45
45
  type: typeSchemas.queryParams?.name,
46
46
  optional: isOptional(typeSchemas.queryParams?.schema)
47
- } : void 0,
47
+ } : undefined,
48
48
  headers: typeSchemas.headerParams?.name ? {
49
49
  type: typeSchemas.headerParams?.name,
50
50
  optional: isOptional(typeSchemas.headerParams?.schema)
51
- } : void 0
51
+ } : undefined
52
52
  }
53
53
  },
54
54
  config: {
@@ -62,19 +62,19 @@ function getParams2({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
62
62
  mode: pathParamsType === "object" ? "object" : "inlineSpread",
63
63
  children: getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
64
64
  optional: isOptional(typeSchemas.pathParams?.schema)
65
- } : void 0,
65
+ } : undefined,
66
66
  data: typeSchemas.request?.name ? {
67
67
  type: typeSchemas.request?.name,
68
68
  optional: isOptional(typeSchemas.request?.schema)
69
- } : void 0,
69
+ } : undefined,
70
70
  params: typeSchemas.queryParams?.name ? {
71
71
  type: typeSchemas.queryParams?.name,
72
72
  optional: isOptional(typeSchemas.queryParams?.schema)
73
- } : void 0,
73
+ } : undefined,
74
74
  headers: typeSchemas.headerParams?.name ? {
75
75
  type: typeSchemas.headerParams?.name,
76
76
  optional: isOptional(typeSchemas.headerParams?.schema)
77
- } : void 0,
77
+ } : undefined,
78
78
  config: {
79
79
  type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof client }` : "Partial<RequestConfig> & { client?: typeof client }",
80
80
  default: "{}"
@@ -100,8 +100,8 @@ function Client({
100
100
  const contentType = operation.getContentType();
101
101
  const isFormData = contentType === "multipart/form-data";
102
102
  const headers = [
103
- contentType !== "application/json" ? `'Content-Type': '${contentType}'` : void 0,
104
- typeSchemas.headerParams?.name ? "...headers" : void 0
103
+ contentType !== "application/json" ? `'Content-Type': '${contentType}'` : undefined,
104
+ typeSchemas.headerParams?.name ? "...headers" : undefined
105
105
  ].filter(Boolean);
106
106
  const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error"}>`;
107
107
  const generics = [typeSchemas.response.name, TError, typeSchemas.request?.name || "unknown"].filter(Boolean);
@@ -124,14 +124,14 @@ function Client({
124
124
  },
125
125
  baseURL: baseURL && !urlName ? {
126
126
  value: JSON.stringify(baseURL)
127
- } : void 0,
128
- params: typeSchemas.queryParams?.name ? {} : void 0,
127
+ } : undefined,
128
+ params: typeSchemas.queryParams?.name ? {} : undefined,
129
129
  data: typeSchemas.request?.name ? {
130
- value: isFormData ? "formData" : void 0
131
- } : void 0,
130
+ value: isFormData ? "formData" : undefined
131
+ } : undefined,
132
132
  headers: headers.length ? {
133
- value: headers.length ? `{ ${headers.join(", ")}, ...requestConfig.headers }` : void 0
134
- } : void 0,
133
+ value: headers.length ? `{ ${headers.join(", ")}, ...requestConfig.headers }` : undefined
134
+ } : undefined,
135
135
  requestConfig: {
136
136
  mode: "inlineSpread"
137
137
  }
@@ -183,7 +183,7 @@ function Operations({ name, operations }) {
183
183
  method: operation.method
184
184
  };
185
185
  });
186
- return /* @__PURE__ */ jsx(File.Source, { name, isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsx(Const, { name, export: true, asConst: true, children: JSON.stringify(operationsObject, void 0, 2) }) });
186
+ return /* @__PURE__ */ jsx(File.Source, { name, isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsx(Const, { name, export: true, asConst: true, children: JSON.stringify(operationsObject, undefined, 2) }) });
187
187
  }
188
188
  function getParams3({}) {
189
189
  return FunctionParams.factory({});
@@ -209,19 +209,19 @@ function getParams4({ paramsCasing, dataReturnType, typeSchemas }) {
209
209
  data: typeSchemas.request?.name ? {
210
210
  type: typeSchemas.request?.name,
211
211
  optional: isOptional(typeSchemas.request?.schema)
212
- } : void 0,
212
+ } : undefined,
213
213
  params: typeSchemas.queryParams?.name ? {
214
214
  type: typeSchemas.queryParams?.name,
215
215
  optional: isOptional(typeSchemas.queryParams?.schema)
216
- } : void 0,
216
+ } : undefined,
217
217
  headers: typeSchemas.headerParams?.name ? {
218
218
  type: typeSchemas.headerParams?.name,
219
219
  optional: isOptional(typeSchemas.headerParams?.schema)
220
- } : void 0
220
+ } : undefined
221
221
  });
222
222
  const TRequest = mutationParams.toConstructor({ valueAsType: true });
223
223
  const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error"}>`;
224
- const generics = [TData, TError, TRequest ? `{${TRequest}}` : void 0].filter(Boolean).join(", ");
224
+ const generics = [TData, TError, TRequest ? `{${TRequest}}` : undefined].filter(Boolean).join(", ");
225
225
  return FunctionParams.factory({
226
226
  options: {
227
227
  type: `
@@ -266,15 +266,15 @@ function Mutation({
266
266
  data: typeSchemas.request?.name ? {
267
267
  type: typeSchemas.request?.name,
268
268
  optional: isOptional(typeSchemas.request?.schema)
269
- } : void 0,
269
+ } : undefined,
270
270
  params: typeSchemas.queryParams?.name ? {
271
271
  type: typeSchemas.queryParams?.name,
272
272
  optional: isOptional(typeSchemas.queryParams?.schema)
273
- } : void 0,
273
+ } : undefined,
274
274
  headers: typeSchemas.headerParams?.name ? {
275
275
  type: typeSchemas.headerParams?.name,
276
276
  optional: isOptional(typeSchemas.headerParams?.schema)
277
- } : void 0
277
+ } : undefined
278
278
  });
279
279
  const dataParams = FunctionParams.factory({
280
280
  data: {
@@ -285,7 +285,7 @@ function Mutation({
285
285
  if (value) {
286
286
  acc[key] = {
287
287
  ...value,
288
- type: void 0
288
+ type: undefined
289
289
  };
290
290
  }
291
291
  return acc;
@@ -295,7 +295,7 @@ function Mutation({
295
295
  const TRequest = mutationParams.toConstructor({ valueAsType: true });
296
296
  const TData = dataReturnType === "data" ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`;
297
297
  const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(" | ") || "Error"}>`;
298
- const generics = [TData, TError, TRequest ? `{${TRequest}}` : void 0].filter(Boolean).join(", ");
298
+ const generics = [TData, TError, TRequest ? `{${TRequest}}` : undefined].filter(Boolean).join(", ");
299
299
  return /* @__PURE__ */ jsx(File.Source, { name, isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsx(
300
300
  Function,
301
301
  {
@@ -329,11 +329,11 @@ function getParams5({ pathParamsType, paramsCasing, typeSchemas }) {
329
329
  data: typeSchemas.request?.name ? {
330
330
  type: typeSchemas.request?.name,
331
331
  optional: isOptional(typeSchemas.request?.schema)
332
- } : void 0,
332
+ } : undefined,
333
333
  params: typeSchemas.queryParams?.name ? {
334
334
  type: typeSchemas.queryParams?.name,
335
335
  optional: isOptional(typeSchemas.queryParams?.schema)
336
- } : void 0
336
+ } : undefined
337
337
  });
338
338
  }
339
339
  var getTransformer2 = ({ operation, schemas, casing }) => {
@@ -343,8 +343,8 @@ var getTransformer2 = ({ operation, schemas, casing }) => {
343
343
  type: "path",
344
344
  stringify: true
345
345
  }),
346
- schemas.queryParams?.name ? "...(params ? [params] : [])" : void 0,
347
- schemas.request?.name ? "...(data ? [data] : [])" : void 0
346
+ schemas.queryParams?.name ? "...(params ? [params] : [])" : undefined,
347
+ schemas.request?.name ? "...(data ? [data] : [])" : undefined
348
348
  ].filter(Boolean);
349
349
  return keys;
350
350
  };
@@ -372,15 +372,15 @@ function getParams6({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
372
372
  data: typeSchemas.request?.name ? {
373
373
  type: typeSchemas.request?.name,
374
374
  optional: isOptional(typeSchemas.request?.schema)
375
- } : void 0,
375
+ } : undefined,
376
376
  params: typeSchemas.queryParams?.name ? {
377
377
  type: typeSchemas.queryParams?.name,
378
378
  optional: isOptional(typeSchemas.queryParams?.schema)
379
- } : void 0,
379
+ } : undefined,
380
380
  headers: typeSchemas.headerParams?.name ? {
381
381
  type: typeSchemas.headerParams?.name,
382
382
  optional: isOptional(typeSchemas.headerParams?.schema)
383
- } : void 0
383
+ } : undefined
384
384
  }
385
385
  },
386
386
  config: {
@@ -394,19 +394,19 @@ function getParams6({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
394
394
  mode: pathParamsType === "object" ? "object" : "inlineSpread",
395
395
  children: getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
396
396
  optional: isOptional(typeSchemas.pathParams?.schema)
397
- } : void 0,
397
+ } : undefined,
398
398
  data: typeSchemas.request?.name ? {
399
399
  type: typeSchemas.request?.name,
400
400
  optional: isOptional(typeSchemas.request?.schema)
401
- } : void 0,
401
+ } : undefined,
402
402
  params: typeSchemas.queryParams?.name ? {
403
403
  type: typeSchemas.queryParams?.name,
404
404
  optional: isOptional(typeSchemas.queryParams?.schema)
405
- } : void 0,
405
+ } : undefined,
406
406
  headers: typeSchemas.headerParams?.name ? {
407
407
  type: typeSchemas.headerParams?.name,
408
408
  optional: isOptional(typeSchemas.headerParams?.schema)
409
- } : void 0,
409
+ } : undefined,
410
410
  config: {
411
411
  type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof client }` : "Partial<RequestConfig> & { client?: typeof client }",
412
412
  default: "{}"
@@ -428,7 +428,7 @@ function QueryOptions({ name, clientName, dataReturnType, typeSchemas, paramsCas
428
428
  typeSchemas,
429
429
  paramsCasing
430
430
  });
431
- const enabled = Object.entries(queryKeyParams.flatParams).map(([key, item]) => item && !item.optional ? key : void 0).filter(Boolean).join("&& ");
431
+ const enabled = Object.entries(queryKeyParams.flatParams).map(([key, item]) => item && !item.optional ? key : undefined).filter(Boolean).join("&& ");
432
432
  const enabledText = enabled ? `enabled: !!(${enabled}),` : "";
433
433
  return /* @__PURE__ */ jsx(File.Source, { name, isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsx(Function, { name, export: true, params: params.toConstructor(), children: `
434
434
  const queryKey = ${queryKeyName}(${queryKeyParams.toCall()})
@@ -455,15 +455,15 @@ function getParams7({ paramsType, paramsCasing, pathParamsType, dataReturnType,
455
455
  data: typeSchemas.request?.name ? {
456
456
  type: typeSchemas.request?.name,
457
457
  optional: isOptional(typeSchemas.request?.schema)
458
- } : void 0,
458
+ } : undefined,
459
459
  params: typeSchemas.queryParams?.name ? {
460
460
  type: typeSchemas.queryParams?.name,
461
461
  optional: isOptional(typeSchemas.queryParams?.schema)
462
- } : void 0,
462
+ } : undefined,
463
463
  headers: typeSchemas.headerParams?.name ? {
464
464
  type: typeSchemas.headerParams?.name,
465
465
  optional: isOptional(typeSchemas.headerParams?.schema)
466
- } : void 0
466
+ } : undefined
467
467
  }
468
468
  },
469
469
  options: {
@@ -482,19 +482,19 @@ function getParams7({ paramsType, paramsCasing, pathParamsType, dataReturnType,
482
482
  mode: pathParamsType === "object" ? "object" : "inlineSpread",
483
483
  children: getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
484
484
  optional: isOptional(typeSchemas.pathParams?.schema)
485
- } : void 0,
485
+ } : undefined,
486
486
  data: typeSchemas.request?.name ? {
487
487
  type: typeSchemas.request?.name,
488
488
  optional: isOptional(typeSchemas.request?.schema)
489
- } : void 0,
489
+ } : undefined,
490
490
  params: typeSchemas.queryParams?.name ? {
491
491
  type: typeSchemas.queryParams?.name,
492
492
  optional: isOptional(typeSchemas.queryParams?.schema)
493
- } : void 0,
493
+ } : undefined,
494
494
  headers: typeSchemas.headerParams?.name ? {
495
495
  type: typeSchemas.headerParams?.name,
496
496
  optional: isOptional(typeSchemas.headerParams?.schema)
497
- } : void 0,
497
+ } : undefined,
498
498
  options: {
499
499
  type: `
500
500
  {
@@ -579,15 +579,15 @@ function getParams8({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
579
579
  data: typeSchemas.request?.name ? {
580
580
  type: typeSchemas.request?.name,
581
581
  optional: isOptional(typeSchemas.request?.schema)
582
- } : void 0,
582
+ } : undefined,
583
583
  params: typeSchemas.queryParams?.name ? {
584
584
  type: typeSchemas.queryParams?.name,
585
585
  optional: isOptional(typeSchemas.queryParams?.schema)
586
- } : void 0,
586
+ } : undefined,
587
587
  headers: typeSchemas.headerParams?.name ? {
588
588
  type: typeSchemas.headerParams?.name,
589
589
  optional: isOptional(typeSchemas.headerParams?.schema)
590
- } : void 0
590
+ } : undefined
591
591
  }
592
592
  },
593
593
  config: {
@@ -601,19 +601,19 @@ function getParams8({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
601
601
  mode: pathParamsType === "object" ? "object" : "inlineSpread",
602
602
  children: getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
603
603
  optional: isOptional(typeSchemas.pathParams?.schema)
604
- } : void 0,
604
+ } : undefined,
605
605
  data: typeSchemas.request?.name ? {
606
606
  type: typeSchemas.request?.name,
607
607
  optional: isOptional(typeSchemas.request?.schema)
608
- } : void 0,
608
+ } : undefined,
609
609
  params: typeSchemas.queryParams?.name ? {
610
610
  type: typeSchemas.queryParams?.name,
611
611
  optional: isOptional(typeSchemas.queryParams?.schema)
612
- } : void 0,
612
+ } : undefined,
613
613
  headers: typeSchemas.headerParams?.name ? {
614
614
  type: typeSchemas.headerParams?.name,
615
615
  optional: isOptional(typeSchemas.headerParams?.schema)
616
- } : void 0,
616
+ } : undefined,
617
617
  config: {
618
618
  type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof client }` : "Partial<RequestConfig> & { client?: typeof client }",
619
619
  default: "{}"
@@ -649,17 +649,17 @@ function InfiniteQueryOptions({
649
649
  });
650
650
  const queryOptions = [
651
651
  `initialPageParam: ${typeof initialPageParam === "string" ? JSON.stringify(initialPageParam) : initialPageParam}`,
652
- cursorParam ? `getNextPageParam: (lastPage) => lastPage['${cursorParam}']` : void 0,
653
- cursorParam ? `getPreviousPageParam: (firstPage) => firstPage['${cursorParam}']` : void 0,
654
- !cursorParam && dataReturnType === "full" ? "getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage.data) && lastPage.data.length === 0 ? undefined : lastPageParam + 1" : void 0,
655
- !cursorParam && dataReturnType === "data" ? "getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage) && lastPage.length === 0 ? undefined : lastPageParam + 1" : void 0,
656
- !cursorParam ? "getPreviousPageParam: (_firstPage, _allPages, firstPageParam) => firstPageParam <= 1 ? undefined : firstPageParam - 1" : void 0
652
+ cursorParam ? `getNextPageParam: (lastPage) => lastPage['${cursorParam}']` : undefined,
653
+ cursorParam ? `getPreviousPageParam: (firstPage) => firstPage['${cursorParam}']` : undefined,
654
+ !cursorParam && dataReturnType === "full" ? "getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage.data) && lastPage.data.length === 0 ? undefined : lastPageParam + 1" : undefined,
655
+ !cursorParam && dataReturnType === "data" ? "getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage) && lastPage.length === 0 ? undefined : lastPageParam + 1" : undefined,
656
+ !cursorParam ? "getPreviousPageParam: (_firstPage, _allPages, firstPageParam) => firstPageParam <= 1 ? undefined : firstPageParam - 1" : undefined
657
657
  ].filter(Boolean);
658
658
  const infiniteOverrideParams = queryParam && typeSchemas.queryParams?.name ? `
659
659
  if(params) {
660
660
  params['${queryParam}'] = pageParam as unknown as ${typeSchemas.queryParams?.name}['${queryParam}']
661
661
  }` : "";
662
- const enabled = Object.entries(queryKeyParams.flatParams).map(([key, item]) => item && !item.optional ? key : void 0).filter(Boolean).join("&& ");
662
+ const enabled = Object.entries(queryKeyParams.flatParams).map(([key, item]) => item && !item.optional ? key : undefined).filter(Boolean).join("&& ");
663
663
  const enabledText = enabled ? `enabled: !!(${enabled}),` : "";
664
664
  if (infiniteOverrideParams) {
665
665
  return /* @__PURE__ */ jsx(File.Source, { name, isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsx(Function, { name, export: true, params: params.toConstructor(), children: `
@@ -702,15 +702,15 @@ function getParams9({ paramsType, paramsCasing, pathParamsType, dataReturnType,
702
702
  data: typeSchemas.request?.name ? {
703
703
  type: typeSchemas.request?.name,
704
704
  optional: isOptional(typeSchemas.request?.schema)
705
- } : void 0,
705
+ } : undefined,
706
706
  params: typeSchemas.queryParams?.name ? {
707
707
  type: typeSchemas.queryParams?.name,
708
708
  optional: isOptional(typeSchemas.queryParams?.schema)
709
- } : void 0,
709
+ } : undefined,
710
710
  headers: typeSchemas.headerParams?.name ? {
711
711
  type: typeSchemas.headerParams?.name,
712
712
  optional: isOptional(typeSchemas.headerParams?.schema)
713
- } : void 0
713
+ } : undefined
714
714
  }
715
715
  },
716
716
  options: {
@@ -729,19 +729,19 @@ function getParams9({ paramsType, paramsCasing, pathParamsType, dataReturnType,
729
729
  mode: pathParamsType === "object" ? "object" : "inlineSpread",
730
730
  children: getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
731
731
  optional: isOptional(typeSchemas.pathParams?.schema)
732
- } : void 0,
732
+ } : undefined,
733
733
  data: typeSchemas.request?.name ? {
734
734
  type: typeSchemas.request?.name,
735
735
  optional: isOptional(typeSchemas.request?.schema)
736
- } : void 0,
736
+ } : undefined,
737
737
  params: typeSchemas.queryParams?.name ? {
738
738
  type: typeSchemas.queryParams?.name,
739
739
  optional: isOptional(typeSchemas.queryParams?.schema)
740
- } : void 0,
740
+ } : undefined,
741
741
  headers: typeSchemas.headerParams?.name ? {
742
742
  type: typeSchemas.headerParams?.name,
743
743
  optional: isOptional(typeSchemas.headerParams?.schema)
744
- } : void 0,
744
+ } : undefined,
745
745
  options: {
746
746
  type: `
747
747
  {
@@ -828,15 +828,15 @@ function getParams10({ paramsType, paramsCasing, pathParamsType, dataReturnType,
828
828
  data: typeSchemas.request?.name ? {
829
829
  type: typeSchemas.request?.name,
830
830
  optional: isOptional(typeSchemas.request?.schema)
831
- } : void 0,
831
+ } : undefined,
832
832
  params: typeSchemas.queryParams?.name ? {
833
833
  type: typeSchemas.queryParams?.name,
834
834
  optional: isOptional(typeSchemas.queryParams?.schema)
835
- } : void 0,
835
+ } : undefined,
836
836
  headers: typeSchemas.headerParams?.name ? {
837
837
  type: typeSchemas.headerParams?.name,
838
838
  optional: isOptional(typeSchemas.headerParams?.schema)
839
- } : void 0
839
+ } : undefined
840
840
  }
841
841
  },
842
842
  options: {
@@ -855,19 +855,19 @@ function getParams10({ paramsType, paramsCasing, pathParamsType, dataReturnType,
855
855
  mode: pathParamsType === "object" ? "object" : "inlineSpread",
856
856
  children: getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
857
857
  optional: isOptional(typeSchemas.pathParams?.schema)
858
- } : void 0,
858
+ } : undefined,
859
859
  data: typeSchemas.request?.name ? {
860
860
  type: typeSchemas.request?.name,
861
861
  optional: isOptional(typeSchemas.request?.schema)
862
- } : void 0,
862
+ } : undefined,
863
863
  params: typeSchemas.queryParams?.name ? {
864
864
  type: typeSchemas.queryParams?.name,
865
865
  optional: isOptional(typeSchemas.queryParams?.schema)
866
- } : void 0,
866
+ } : undefined,
867
867
  headers: typeSchemas.headerParams?.name ? {
868
868
  type: typeSchemas.headerParams?.name,
869
869
  optional: isOptional(typeSchemas.headerParams?.schema)
870
- } : void 0,
870
+ } : undefined,
871
871
  options: {
872
872
  type: `
873
873
  {