@navios/react-query 0.4.0 → 0.5.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.
Files changed (78) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/dist/src/client/declare-client.d.mts +70 -0
  3. package/dist/src/client/declare-client.d.mts.map +1 -0
  4. package/dist/src/client/index.d.mts +3 -0
  5. package/dist/src/client/index.d.mts.map +1 -0
  6. package/dist/src/client/types.d.mts +287 -0
  7. package/dist/src/client/types.d.mts.map +1 -0
  8. package/dist/src/common/index.d.mts +2 -0
  9. package/dist/src/common/index.d.mts.map +1 -0
  10. package/dist/src/common/types.d.mts +21 -0
  11. package/dist/src/common/types.d.mts.map +1 -0
  12. package/dist/src/index.d.mts +13 -8
  13. package/dist/src/index.d.mts.map +1 -1
  14. package/dist/src/mutation/index.d.mts +4 -0
  15. package/dist/src/mutation/index.d.mts.map +1 -0
  16. package/dist/src/mutation/key-creator.d.mts +36 -0
  17. package/dist/src/mutation/key-creator.d.mts.map +1 -0
  18. package/dist/src/mutation/make-hook.d.mts +25 -0
  19. package/dist/src/mutation/make-hook.d.mts.map +1 -0
  20. package/dist/src/mutation/types.d.mts +50 -0
  21. package/dist/src/mutation/types.d.mts.map +1 -0
  22. package/dist/src/query/index.d.mts +5 -0
  23. package/dist/src/query/index.d.mts.map +1 -0
  24. package/dist/src/query/key-creator.d.mts +17 -0
  25. package/dist/src/query/key-creator.d.mts.map +1 -0
  26. package/dist/src/query/make-infinite-options.d.mts +23 -0
  27. package/dist/src/query/make-infinite-options.d.mts.map +1 -0
  28. package/dist/src/query/make-options.d.mts +24 -0
  29. package/dist/src/query/make-options.d.mts.map +1 -0
  30. package/dist/src/query/types.d.mts +83 -0
  31. package/dist/src/query/types.d.mts.map +1 -0
  32. package/dist/tsconfig.tsbuildinfo +1 -1
  33. package/lib/_tsup-dts-rollup.d.mts +500 -250
  34. package/lib/_tsup-dts-rollup.d.ts +500 -250
  35. package/lib/index.d.mts +26 -19
  36. package/lib/index.d.ts +26 -19
  37. package/lib/index.js +92 -66
  38. package/lib/index.js.map +1 -1
  39. package/lib/index.mjs +92 -68
  40. package/lib/index.mjs.map +1 -1
  41. package/package.json +7 -7
  42. package/project.json +9 -1
  43. package/src/__tests__/client-type-check.spec.mts +1 -1
  44. package/src/__tests__/declare-client.spec.mts +1 -1
  45. package/src/__tests__/make-mutation.spec.mts +1 -1
  46. package/src/__tests__/makeDataTag.spec.mts +1 -1
  47. package/src/__tests__/makeInfiniteQueryOptions.spec.mts +1 -2
  48. package/src/__tests__/makeQueryOptions.spec.mts +1 -1
  49. package/src/{declare-client.mts → client/declare-client.mts} +93 -33
  50. package/src/client/index.mts +2 -0
  51. package/src/{types/client-instance.mts → client/types.mts} +429 -145
  52. package/src/common/index.mts +1 -0
  53. package/src/common/types.mts +31 -0
  54. package/src/index.mts +28 -8
  55. package/src/mutation/index.mts +3 -0
  56. package/src/mutation/key-creator.mts +64 -0
  57. package/src/{make-mutation.mts → mutation/make-hook.mts} +19 -8
  58. package/src/mutation/types.mts +106 -0
  59. package/src/query/index.mts +4 -0
  60. package/src/{utils/query-key-creator.mts → query/key-creator.mts} +22 -48
  61. package/src/{make-infinite-query-options.mts → query/make-infinite-options.mts} +28 -14
  62. package/src/{make-query-options.mts → query/make-options.mts} +26 -25
  63. package/src/query/types.mts +163 -0
  64. package/dist/tsdown.config.d.mts +0 -3
  65. package/dist/tsdown.config.d.mts.map +0 -1
  66. package/dist/tsup.config.d.mts +0 -3
  67. package/dist/tsup.config.d.mts.map +0 -1
  68. package/dist/vitest.config.d.mts +0 -3
  69. package/dist/vitest.config.d.mts.map +0 -1
  70. package/src/types/client-endpoint-helper.mts +0 -29
  71. package/src/types/index.mts +0 -7
  72. package/src/types/mutation-args.mts +0 -10
  73. package/src/types/mutation-helpers.mts +0 -13
  74. package/src/types/query-args.mts +0 -8
  75. package/src/types/query-helpers.mts +0 -34
  76. package/src/types/query-url-params-args.mts +0 -6
  77. package/src/types.mts +0 -118
  78. package/src/utils/mutation-key.creator.mts +0 -65
@@ -1,5 +1,7 @@
1
1
  import type {
2
2
  BaseEndpointConfig,
3
+ EndpointFunctionArgs,
4
+ HttpMethod,
3
5
  UrlHasParams,
4
6
  UrlParams,
5
7
  Util_FlatObject,
@@ -14,14 +16,55 @@ import type {
14
16
  } from '@tanstack/react-query'
15
17
  import type { z, ZodObject, ZodType } from 'zod/v4'
16
18
 
17
- import type { ProcessResponseFunction, Split } from '../types.mjs'
18
- import type { ClientEndpointHelper } from './client-endpoint-helper.mjs'
19
- import type { ClientMutationArgs } from './mutation-args.mjs'
20
- import type { MutationHelpers } from './mutation-helpers.mjs'
21
- import type { ClientQueryArgs } from './query-args.mjs'
22
- import type { QueryHelpers } from './query-helpers.mjs'
19
+ import type { ProcessResponseFunction, Split } from '../common/types.mjs'
20
+ import type { MutationArgs, MutationHelpers } from '../mutation/types.mjs'
21
+ import type { QueryArgs, QueryHelpers } from '../query/types.mjs'
23
22
 
23
+ /**
24
+ * Helper type that attaches the endpoint to query/mutation results.
25
+ */
26
+ export type EndpointHelper<
27
+ Method extends HttpMethod = HttpMethod,
28
+ Url extends string = string,
29
+ RequestSchema = unknown,
30
+ ResponseSchema extends z.ZodType = z.ZodType,
31
+ QuerySchema = unknown,
32
+ > = {
33
+ endpoint: ((
34
+ params: Util_FlatObject<
35
+ EndpointFunctionArgs<Url, QuerySchema, RequestSchema>
36
+ >,
37
+ ) => Promise<z.output<ResponseSchema>>) & {
38
+ config: BaseEndpointConfig<
39
+ Method,
40
+ Url,
41
+ QuerySchema,
42
+ ResponseSchema,
43
+ RequestSchema
44
+ >
45
+ }
46
+ }
47
+
48
+ // Legacy export for backwards compatibility
49
+ /** @deprecated Use EndpointHelper instead */
50
+ export type ClientEndpointHelper<
51
+ Method extends HttpMethod = HttpMethod,
52
+ Url extends string = string,
53
+ RequestSchema = unknown,
54
+ ResponseSchema extends z.ZodType = z.ZodType,
55
+ QuerySchema = unknown,
56
+ > = EndpointHelper<Method, Url, RequestSchema, ResponseSchema, QuerySchema>
57
+
58
+ /**
59
+ * The main client instance interface.
60
+ * Provides methods for creating queries, infinite queries, and mutations.
61
+ */
24
62
  export interface ClientInstance {
63
+ // ============================================================================
64
+ // QUERY METHODS
65
+ // ============================================================================
66
+
67
+ // Standard query methods (GET, HEAD, OPTIONS) without query schema
25
68
  query<
26
69
  Method extends 'GET' | 'HEAD' | 'OPTIONS' = 'GET',
27
70
  Url extends string = string,
@@ -33,7 +76,7 @@ export interface ClientInstance {
33
76
  responseSchema: Response
34
77
  processResponse?: (data: z.output<Response>) => Result
35
78
  }): ((
36
- params: Util_FlatObject<ClientQueryArgs<Url, undefined>>,
79
+ params: Util_FlatObject<QueryArgs<Url, undefined>>,
37
80
  ) => UseSuspenseQueryOptions<
38
81
  Result,
39
82
  Error,
@@ -41,8 +84,9 @@ export interface ClientInstance {
41
84
  DataTag<Split<Url, '/'>, Result, Error>
42
85
  >) &
43
86
  QueryHelpers<Url, undefined, Result> &
44
- ClientEndpointHelper<Method, Url, undefined, Response>
87
+ EndpointHelper<Method, Url, undefined, Response>
45
88
 
89
+ // Standard query methods (GET, HEAD, OPTIONS) with query schema
46
90
  query<
47
91
  Method extends 'GET' | 'HEAD' | 'OPTIONS' = 'GET',
48
92
  Url extends string = string,
@@ -56,7 +100,7 @@ export interface ClientInstance {
56
100
  responseSchema: Response
57
101
  processResponse?: (data: z.output<Response>) => Result
58
102
  }): ((
59
- params: Util_FlatObject<ClientQueryArgs<Url, QuerySchema>>,
103
+ params: Util_FlatObject<QueryArgs<Url, QuerySchema>>,
60
104
  ) => UseSuspenseQueryOptions<
61
105
  Result,
62
106
  Error,
@@ -64,8 +108,63 @@ export interface ClientInstance {
64
108
  DataTag<Split<Url, '/'>, Result, Error>
65
109
  >) &
66
110
  QueryHelpers<Url, QuerySchema, Result> &
67
- ClientEndpointHelper<Method, Url, undefined, Response, QuerySchema>
111
+ EndpointHelper<Method, Url, undefined, Response, QuerySchema>
68
112
 
113
+ // POST query methods (for search endpoints) without query schema
114
+ query<
115
+ Method extends 'POST' = 'POST',
116
+ Url extends string = string,
117
+ RequestSchema extends ZodType = ZodType,
118
+ Response extends ZodType = ZodType,
119
+ Result = z.output<Response>,
120
+ >(config: {
121
+ method: Method
122
+ url: Url
123
+ requestSchema: RequestSchema
124
+ responseSchema: Response
125
+ processResponse?: (data: z.output<Response>) => Result
126
+ }): ((
127
+ params: Util_FlatObject<QueryArgs<Url, undefined, RequestSchema>>,
128
+ ) => UseSuspenseQueryOptions<
129
+ Result,
130
+ Error,
131
+ Result,
132
+ DataTag<Split<Url, '/'>, Result, Error>
133
+ >) &
134
+ QueryHelpers<Url, undefined, Result, false, RequestSchema> &
135
+ EndpointHelper<Method, Url, RequestSchema, Response>
136
+
137
+ // POST query methods (for search endpoints) with query schema
138
+ query<
139
+ Method extends 'POST' = 'POST',
140
+ Url extends string = string,
141
+ QuerySchema extends ZodObject = ZodObject,
142
+ RequestSchema extends ZodType = ZodType,
143
+ Response extends ZodType = ZodType,
144
+ Result = z.output<Response>,
145
+ >(config: {
146
+ method: Method
147
+ url: Url
148
+ querySchema: QuerySchema
149
+ requestSchema: RequestSchema
150
+ responseSchema: Response
151
+ processResponse?: (data: z.output<Response>) => Result
152
+ }): ((
153
+ params: Util_FlatObject<QueryArgs<Url, QuerySchema, RequestSchema>>,
154
+ ) => UseSuspenseQueryOptions<
155
+ Result,
156
+ Error,
157
+ Result,
158
+ DataTag<Split<Url, '/'>, Result, Error>
159
+ >) &
160
+ QueryHelpers<Url, QuerySchema, Result, false, RequestSchema> &
161
+ EndpointHelper<Method, Url, RequestSchema, Response, QuerySchema>
162
+
163
+ // ============================================================================
164
+ // INFINITE QUERY METHODS
165
+ // ============================================================================
166
+
167
+ // Standard infiniteQuery methods (GET, HEAD, OPTIONS)
69
168
  infiniteQuery<
70
169
  Method extends 'GET' | 'HEAD' | 'OPTIONS' = 'GET',
71
170
  Url extends string = string,
@@ -92,7 +191,7 @@ export interface ClientInstance {
92
191
  allPageParams: z.infer<QuerySchema>[] | undefined,
93
192
  ) => z.input<QuerySchema>
94
193
  }): ((
95
- params: Util_FlatObject<ClientQueryArgs<Url, QuerySchema>>,
194
+ params: Util_FlatObject<QueryArgs<Url, QuerySchema>>,
96
195
  ) => UseSuspenseInfiniteQueryOptions<
97
196
  PageResult,
98
197
  Error,
@@ -101,8 +200,53 @@ export interface ClientInstance {
101
200
  z.output<QuerySchema>
102
201
  >) &
103
202
  QueryHelpers<Url, QuerySchema, PageResult, true> &
104
- ClientEndpointHelper<Method, Url, undefined, Response, QuerySchema>
203
+ EndpointHelper<Method, Url, undefined, Response, QuerySchema>
105
204
 
205
+ // POST infiniteQuery methods (for search endpoints)
206
+ infiniteQuery<
207
+ Method extends 'POST' = 'POST',
208
+ Url extends string = string,
209
+ QuerySchema extends ZodObject = ZodObject,
210
+ RequestSchema extends ZodType = ZodType,
211
+ Response extends ZodType = ZodType,
212
+ PageResult = z.output<Response>,
213
+ Result = InfiniteData<PageResult>,
214
+ >(config: {
215
+ method: Method
216
+ url: Url
217
+ querySchema: QuerySchema
218
+ requestSchema: RequestSchema
219
+ responseSchema: Response
220
+ processResponse?: (data: z.output<Response>) => PageResult
221
+ getNextPageParam: (
222
+ lastPage: PageResult,
223
+ allPages: PageResult[],
224
+ lastPageParam: z.infer<QuerySchema> | undefined,
225
+ allPageParams: z.infer<QuerySchema>[] | undefined,
226
+ ) => z.input<QuerySchema> | undefined
227
+ getPreviousPageParam?: (
228
+ firstPage: PageResult,
229
+ allPages: PageResult[],
230
+ lastPageParam: z.infer<QuerySchema> | undefined,
231
+ allPageParams: z.infer<QuerySchema>[] | undefined,
232
+ ) => z.input<QuerySchema>
233
+ }): ((
234
+ params: Util_FlatObject<QueryArgs<Url, QuerySchema, RequestSchema>>,
235
+ ) => UseSuspenseInfiniteQueryOptions<
236
+ PageResult,
237
+ Error,
238
+ Result,
239
+ DataTag<Split<Url, '/'>, PageResult, Error>,
240
+ z.output<QuerySchema>
241
+ >) &
242
+ QueryHelpers<Url, QuerySchema, PageResult, true, RequestSchema> &
243
+ EndpointHelper<Method, Url, RequestSchema, Response, QuerySchema>
244
+
245
+ // ============================================================================
246
+ // MUTATION METHODS (POST, PUT, PATCH)
247
+ // ============================================================================
248
+
249
+ // With useKey, requestSchema, and querySchema
106
250
  mutation<
107
251
  Method extends 'POST' | 'PUT' | 'PATCH' = 'POST' | 'PUT' | 'PATCH',
108
252
  Url extends string = string,
@@ -125,17 +269,13 @@ export interface ClientInstance {
125
269
  onSuccess?: (
126
270
  queryClient: QueryClient,
127
271
  data: NoInfer<Result>,
128
- variables: Util_FlatObject<
129
- ClientMutationArgs<Url, RequestSchema, QuerySchema>
130
- >,
272
+ variables: Util_FlatObject<MutationArgs<Url, RequestSchema, QuerySchema>>,
131
273
  context: Context,
132
274
  ) => void | Promise<void>
133
275
  onError?: (
134
276
  queryClient: QueryClient,
135
277
  error: Error,
136
- variables: Util_FlatObject<
137
- ClientMutationArgs<Url, RequestSchema, QuerySchema>
138
- >,
278
+ variables: Util_FlatObject<MutationArgs<Url, RequestSchema, QuerySchema>>,
139
279
  context: Context,
140
280
  ) => void | Promise<void>
141
281
  }): ((
@@ -143,11 +283,12 @@ export interface ClientInstance {
143
283
  ) => UseMutationResult<
144
284
  Result,
145
285
  Error,
146
- ClientMutationArgs<Url, RequestSchema, QuerySchema>
286
+ MutationArgs<Url, RequestSchema, QuerySchema>
147
287
  >) &
148
288
  MutationHelpers<Url, Result> &
149
- ClientEndpointHelper<Method, Url, RequestSchema, Response, QuerySchema>
289
+ EndpointHelper<Method, Url, RequestSchema, Response, QuerySchema>
150
290
 
291
+ // Without useKey, with requestSchema and querySchema
151
292
  mutation<
152
293
  Method extends 'POST' | 'PUT' | 'PATCH' = 'POST' | 'PUT' | 'PATCH',
153
294
  Url extends string = string,
@@ -168,26 +309,24 @@ export interface ClientInstance {
168
309
  onSuccess?: (
169
310
  queryClient: QueryClient,
170
311
  data: NoInfer<Result>,
171
- variables: Util_FlatObject<
172
- ClientMutationArgs<Url, RequestSchema, QuerySchema>
173
- >,
312
+ variables: Util_FlatObject<MutationArgs<Url, RequestSchema, QuerySchema>>,
174
313
  context: Context,
175
314
  ) => void | Promise<void>
176
315
  onError?: (
177
316
  queryClient: QueryClient,
178
317
  error: Error,
179
- variables: Util_FlatObject<
180
- ClientMutationArgs<Url, RequestSchema, QuerySchema>
181
- >,
318
+ variables: Util_FlatObject<MutationArgs<Url, RequestSchema, QuerySchema>>,
182
319
  context: Context,
183
320
  ) => void | Promise<void>
184
321
  }): (() => UseMutationResult<
185
322
  Result,
186
323
  Error,
187
- ClientMutationArgs<Url, RequestSchema, QuerySchema>
324
+ MutationArgs<Url, RequestSchema, QuerySchema>
188
325
  >) &
189
- ClientEndpointHelper<Method, Url, RequestSchema, Response, QuerySchema>
326
+ MutationHelpers<Url, Result> &
327
+ EndpointHelper<Method, Url, RequestSchema, Response, QuerySchema>
190
328
 
329
+ // Without useKey, with requestSchema only
191
330
  mutation<
192
331
  Method extends 'POST' | 'PUT' | 'PATCH' = 'POST' | 'PUT' | 'PATCH',
193
332
  Url extends string = string,
@@ -206,27 +345,24 @@ export interface ClientInstance {
206
345
  onSuccess?: (
207
346
  queryClient: QueryClient,
208
347
  data: NoInfer<Result>,
209
- variables: Util_FlatObject<
210
- ClientMutationArgs<Url, RequestSchema, undefined>
211
- >,
348
+ variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
212
349
  context: Context,
213
350
  ) => void | Promise<void>
214
351
  onError?: (
215
352
  queryClient: QueryClient,
216
353
  error: Error,
217
- variables: Util_FlatObject<
218
- ClientMutationArgs<Url, RequestSchema, undefined>
219
- >,
354
+ variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
220
355
  context: Context,
221
356
  ) => void | Promise<void>
222
357
  }): (() => UseMutationResult<
223
358
  Result,
224
359
  Error,
225
- ClientMutationArgs<Url, RequestSchema, undefined>
360
+ MutationArgs<Url, RequestSchema, undefined>
226
361
  >) &
227
362
  MutationHelpers<Url, Result> &
228
- ClientEndpointHelper<Method, Url, RequestSchema, Response>
363
+ EndpointHelper<Method, Url, RequestSchema, Response>
229
364
 
365
+ // With useKey and requestSchema only
230
366
  mutation<
231
367
  Method extends 'POST' | 'PUT' | 'PATCH' = 'POST' | 'PUT' | 'PATCH',
232
368
  Url extends string = string,
@@ -247,17 +383,13 @@ export interface ClientInstance {
247
383
  onSuccess?: (
248
384
  queryClient: QueryClient,
249
385
  data: NoInfer<Result>,
250
- variables: Util_FlatObject<
251
- ClientMutationArgs<Url, RequestSchema, undefined>
252
- >,
386
+ variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
253
387
  context: Context,
254
388
  ) => void | Promise<void>
255
389
  onError?: (
256
390
  queryClient: QueryClient,
257
391
  error: Error,
258
- variables: Util_FlatObject<
259
- ClientMutationArgs<Url, RequestSchema, undefined>
260
- >,
392
+ variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
261
393
  context: Context,
262
394
  ) => void | Promise<void>
263
395
  }): ((
@@ -265,11 +397,16 @@ export interface ClientInstance {
265
397
  ) => UseMutationResult<
266
398
  Result,
267
399
  Error,
268
- ClientMutationArgs<Url, RequestSchema, undefined>
400
+ MutationArgs<Url, RequestSchema, undefined>
269
401
  >) &
270
402
  MutationHelpers<Url, Result> &
271
- ClientEndpointHelper<Method, Url, RequestSchema, Response>
403
+ EndpointHelper<Method, Url, RequestSchema, Response>
404
+
405
+ // ============================================================================
406
+ // DELETE MUTATION METHODS
407
+ // ============================================================================
272
408
 
409
+ // DELETE with useKey and querySchema
273
410
  mutation<
274
411
  Method extends 'DELETE' = 'DELETE',
275
412
  Url extends string = string,
@@ -290,17 +427,13 @@ export interface ClientInstance {
290
427
  onSuccess?: (
291
428
  queryClient: QueryClient,
292
429
  data: NoInfer<Result>,
293
- variables: Util_FlatObject<
294
- ClientMutationArgs<Url, undefined, QuerySchema>
295
- >,
430
+ variables: Util_FlatObject<MutationArgs<Url, undefined, QuerySchema>>,
296
431
  context: Context,
297
432
  ) => void | Promise<void>
298
433
  onError?: (
299
434
  queryClient: QueryClient,
300
435
  error: Error,
301
- variables: Util_FlatObject<
302
- ClientMutationArgs<Url, undefined, QuerySchema>
303
- >,
436
+ variables: Util_FlatObject<MutationArgs<Url, undefined, QuerySchema>>,
304
437
  context: Context,
305
438
  ) => void | Promise<void>
306
439
  }): ((
@@ -308,11 +441,12 @@ export interface ClientInstance {
308
441
  ) => UseMutationResult<
309
442
  Result,
310
443
  Error,
311
- ClientMutationArgs<Url, undefined, QuerySchema>
444
+ MutationArgs<Url, undefined, QuerySchema>
312
445
  >) &
313
446
  MutationHelpers<Url, Result> &
314
- ClientEndpointHelper<Method, Url, undefined, Response, QuerySchema>
447
+ EndpointHelper<Method, Url, undefined, Response, QuerySchema>
315
448
 
449
+ // DELETE without useKey, with querySchema
316
450
  mutation<
317
451
  Method extends 'DELETE' = 'DELETE',
318
452
  Url extends string = string,
@@ -331,26 +465,24 @@ export interface ClientInstance {
331
465
  onSuccess?: (
332
466
  queryClient: QueryClient,
333
467
  data: NoInfer<Result>,
334
- variables: Util_FlatObject<
335
- ClientMutationArgs<Url, undefined, QuerySchema>
336
- >,
468
+ variables: Util_FlatObject<MutationArgs<Url, undefined, QuerySchema>>,
337
469
  context: Context,
338
470
  ) => void | Promise<void>
339
471
  onError?: (
340
472
  queryClient: QueryClient,
341
473
  error: Error,
342
- variables: Util_FlatObject<
343
- ClientMutationArgs<Url, undefined, QuerySchema>
344
- >,
474
+ variables: Util_FlatObject<MutationArgs<Url, undefined, QuerySchema>>,
345
475
  context: Context,
346
476
  ) => void | Promise<void>
347
477
  }): (() => UseMutationResult<
348
478
  Result,
349
479
  Error,
350
- ClientMutationArgs<Url, undefined, QuerySchema>
480
+ MutationArgs<Url, undefined, QuerySchema>
351
481
  >) &
352
- ClientEndpointHelper<Method, Url, undefined, Response, QuerySchema>
482
+ MutationHelpers<Url, Result> &
483
+ EndpointHelper<Method, Url, undefined, Response, QuerySchema>
353
484
 
485
+ // DELETE with useKey only (no schemas)
354
486
  mutation<
355
487
  Method extends 'DELETE' = 'DELETE',
356
488
  Url extends string = string,
@@ -369,13 +501,13 @@ export interface ClientInstance {
369
501
  onSuccess?: (
370
502
  queryClient: QueryClient,
371
503
  data: NoInfer<Result>,
372
- variables: Util_FlatObject<ClientMutationArgs<Url, undefined, undefined>>,
504
+ variables: Util_FlatObject<MutationArgs<Url, undefined, undefined>>,
373
505
  context: Context,
374
506
  ) => void | Promise<void>
375
507
  onError?: (
376
508
  queryClient: QueryClient,
377
509
  error: Error,
378
- variables: Util_FlatObject<ClientMutationArgs<Url, undefined, undefined>>,
510
+ variables: Util_FlatObject<MutationArgs<Url, undefined, undefined>>,
379
511
  context: Context,
380
512
  ) => void | Promise<void>
381
513
  }): ((
@@ -383,11 +515,12 @@ export interface ClientInstance {
383
515
  ) => UseMutationResult<
384
516
  Result,
385
517
  Error,
386
- ClientMutationArgs<Url, undefined, undefined>
518
+ MutationArgs<Url, undefined, undefined>
387
519
  >) &
388
520
  MutationHelpers<Url, Result> &
389
- ClientEndpointHelper<Method, Url, undefined, Response>
521
+ EndpointHelper<Method, Url, undefined, Response>
390
522
 
523
+ // DELETE without useKey (no schemas)
391
524
  mutation<
392
525
  Method extends 'DELETE' = 'DELETE',
393
526
  Url extends string = string,
@@ -404,21 +537,26 @@ export interface ClientInstance {
404
537
  onSuccess?: (
405
538
  queryClient: QueryClient,
406
539
  data: NoInfer<Result>,
407
- variables: Util_FlatObject<ClientMutationArgs<Url, undefined, undefined>>,
540
+ variables: Util_FlatObject<MutationArgs<Url, undefined, undefined>>,
408
541
  context: Context,
409
542
  ) => void | Promise<void>
410
543
  onError?: (
411
544
  queryClient: QueryClient,
412
545
  error: Error,
413
- variables: Util_FlatObject<ClientMutationArgs<Url, undefined, undefined>>,
546
+ variables: Util_FlatObject<MutationArgs<Url, undefined, undefined>>,
414
547
  context: Context,
415
548
  ) => void | Promise<void>
416
549
  }): (() => UseMutationResult<
417
550
  Result,
418
551
  Error,
419
- ClientMutationArgs<Url, undefined, undefined>
552
+ MutationArgs<Url, undefined, undefined>
420
553
  >) &
421
- ClientEndpointHelper<Method, Url, undefined, Response>
554
+ MutationHelpers<Url, Result> &
555
+ EndpointHelper<Method, Url, undefined, Response>
556
+
557
+ // ============================================================================
558
+ // FROM ENDPOINT METHODS
559
+ // ============================================================================
422
560
 
423
561
  queryFromEndpoint<
424
562
  Method extends 'GET' | 'HEAD' | 'OPTIONS' = 'GET',
@@ -427,14 +565,14 @@ export interface ClientInstance {
427
565
  Response extends ZodType = ZodType,
428
566
  Result = z.output<Response>,
429
567
  >(
430
- endpoint: any & {
568
+ endpoint: {
431
569
  config: BaseEndpointConfig<Method, Url, QuerySchema, Response>
432
570
  },
433
571
  options?: {
434
572
  processResponse?: (data: z.output<Response>) => Result
435
573
  },
436
574
  ): (
437
- params: UrlHasParams<Url> extends true ? { urlParams: UrlParams<Url> } : {},
575
+ params: Util_FlatObject<QueryArgs<Url, QuerySchema>>,
438
576
  ) => UseSuspenseQueryOptions<
439
577
  Result,
440
578
  Error,
@@ -449,14 +587,14 @@ export interface ClientInstance {
449
587
  Response extends ZodType = ZodType,
450
588
  Result = z.output<Response>,
451
589
  >(
452
- endpoint: any & {
590
+ endpoint: {
453
591
  config: BaseEndpointConfig<Method, Url, undefined, Response>
454
592
  },
455
593
  options?: {
456
594
  processResponse?: (data: z.output<Response>) => Result
457
595
  },
458
596
  ): ((
459
- params: UrlHasParams<Url> extends true ? { urlParams: UrlParams<Url> } : {},
597
+ params: Util_FlatObject<QueryArgs<Url, undefined>>,
460
598
  ) => UseSuspenseQueryOptions<
461
599
  Result,
462
600
  Error,
@@ -473,7 +611,7 @@ export interface ClientInstance {
473
611
  PageResult = z.output<Response>,
474
612
  Result = InfiniteData<PageResult>,
475
613
  >(
476
- endpoint: any & {
614
+ endpoint: {
477
615
  config: BaseEndpointConfig<Method, Url, QuerySchema, Response>
478
616
  },
479
617
  options: {
@@ -492,7 +630,7 @@ export interface ClientInstance {
492
630
  ) => z.input<QuerySchema>
493
631
  },
494
632
  ): ((
495
- params: UrlHasParams<Url> extends true ? { urlParams: UrlParams<Url> } : {},
633
+ params: Util_FlatObject<QueryArgs<Url, QuerySchema>>,
496
634
  ) => UseSuspenseInfiniteQueryOptions<
497
635
  PageResult,
498
636
  Error,
@@ -502,6 +640,10 @@ export interface ClientInstance {
502
640
  >) &
503
641
  QueryHelpers<Url, QuerySchema, PageResult, true>
504
642
 
643
+ // ============================================================================
644
+ // MUTATION FROM ENDPOINT METHODS (POST, PUT, PATCH)
645
+ // ============================================================================
646
+
505
647
  mutationFromEndpoint<
506
648
  Method extends 'POST' | 'PUT' | 'PATCH' = 'POST' | 'PUT' | 'PATCH',
507
649
  Url extends string = string,
@@ -513,7 +655,7 @@ export interface ClientInstance {
513
655
  Context = unknown,
514
656
  UseKey extends true = true,
515
657
  >(
516
- endpoint: any & {
658
+ endpoint: {
517
659
  config: BaseEndpointConfig<
518
660
  Method,
519
661
  Url,
@@ -530,7 +672,7 @@ export interface ClientInstance {
530
672
  queryClient: QueryClient,
531
673
  data: NoInfer<Result>,
532
674
  variables: Util_FlatObject<
533
- ClientMutationArgs<Url, RequestSchema, QuerySchema>
675
+ MutationArgs<Url, RequestSchema, QuerySchema>
534
676
  >,
535
677
  context: Context,
536
678
  ) => void | Promise<void>
@@ -538,20 +680,20 @@ export interface ClientInstance {
538
680
  queryClient: QueryClient,
539
681
  error: Error,
540
682
  variables: Util_FlatObject<
541
- ClientMutationArgs<Url, RequestSchema, QuerySchema>
683
+ MutationArgs<Url, RequestSchema, QuerySchema>
542
684
  >,
543
685
  context: Context,
544
686
  ) => void | Promise<void>
545
687
  },
546
688
  ): ((
547
- params: UrlHasParams<Url> extends true ? UrlParams<Url> : {},
689
+ params: Util_FlatObject<MutationArgs<Url, RequestSchema, QuerySchema>>,
548
690
  ) => UseMutationResult<
549
691
  Result,
550
692
  Error,
551
- ClientMutationArgs<Url, RequestSchema, QuerySchema>
693
+ MutationArgs<Url, RequestSchema, QuerySchema>
552
694
  >) &
553
695
  MutationHelpers<Url, Result> &
554
- ClientEndpointHelper<Method, Url, RequestSchema, Response, QuerySchema>
696
+ EndpointHelper<Method, Url, RequestSchema, Response, QuerySchema>
555
697
 
556
698
  mutationFromEndpoint<
557
699
  Method extends 'POST' | 'PUT' | 'PATCH' = 'POST' | 'PUT' | 'PATCH',
@@ -563,7 +705,7 @@ export interface ClientInstance {
563
705
  Context = unknown,
564
706
  UseKey extends true = true,
565
707
  >(
566
- endpoint: any & {
708
+ endpoint: {
567
709
  config: BaseEndpointConfig<
568
710
  Method,
569
711
  Url,
@@ -579,29 +721,25 @@ export interface ClientInstance {
579
721
  onSuccess?: (
580
722
  queryClient: QueryClient,
581
723
  data: NoInfer<Result>,
582
- variables: Util_FlatObject<
583
- ClientMutationArgs<Url, RequestSchema, undefined>
584
- >,
724
+ variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
585
725
  context: Context,
586
726
  ) => void | Promise<void>
587
727
  onError?: (
588
728
  queryClient: QueryClient,
589
729
  error: Error,
590
- variables: Util_FlatObject<
591
- ClientMutationArgs<Url, RequestSchema, undefined>
592
- >,
730
+ variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
593
731
  context: Context,
594
732
  ) => void | Promise<void>
595
733
  },
596
734
  ): ((
597
- params: UrlHasParams<Url> extends true ? UrlParams<Url> : {},
735
+ params: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
598
736
  ) => UseMutationResult<
599
737
  Result,
600
738
  Error,
601
- ClientMutationArgs<Url, RequestSchema, undefined>
739
+ MutationArgs<Url, RequestSchema, undefined>
602
740
  >) &
603
741
  MutationHelpers<Url, Result> &
604
- ClientEndpointHelper<Method, Url, RequestSchema, Response, undefined>
742
+ EndpointHelper<Method, Url, RequestSchema, Response, undefined>
605
743
 
606
744
  mutationFromEndpoint<
607
745
  Method extends 'POST' | 'PUT' | 'PATCH' = 'POST' | 'PUT' | 'PATCH',
@@ -613,7 +751,7 @@ export interface ClientInstance {
613
751
  Result = unknown,
614
752
  Context = unknown,
615
753
  >(
616
- endpoint: any & {
754
+ endpoint: {
617
755
  config: BaseEndpointConfig<
618
756
  Method,
619
757
  Url,
@@ -629,7 +767,7 @@ export interface ClientInstance {
629
767
  queryClient: QueryClient,
630
768
  data: NoInfer<Result>,
631
769
  variables: Util_FlatObject<
632
- ClientMutationArgs<Url, RequestSchema, QuerySchema>
770
+ MutationArgs<Url, RequestSchema, QuerySchema>
633
771
  >,
634
772
  context: Context,
635
773
  ) => void | Promise<void>
@@ -637,17 +775,19 @@ export interface ClientInstance {
637
775
  queryClient: QueryClient,
638
776
  error: Error,
639
777
  variables: Util_FlatObject<
640
- ClientMutationArgs<Url, RequestSchema, QuerySchema>
778
+ MutationArgs<Url, RequestSchema, QuerySchema>
641
779
  >,
642
780
  context: Context,
643
781
  ) => void | Promise<void>
644
782
  },
645
- ): (() => UseMutationResult<
783
+ ): ((
784
+ params: Util_FlatObject<MutationArgs<Url, RequestSchema, QuerySchema>>,
785
+ ) => UseMutationResult<
646
786
  Result,
647
787
  Error,
648
- ClientMutationArgs<Url, RequestSchema, QuerySchema>
788
+ MutationArgs<Url, RequestSchema, QuerySchema>
649
789
  >) &
650
- ClientEndpointHelper<Method, Url, RequestSchema, Response, QuerySchema>
790
+ EndpointHelper<Method, Url, RequestSchema, Response, QuerySchema>
651
791
 
652
792
  mutationFromEndpoint<
653
793
  Method extends 'POST' | 'PUT' | 'PATCH' = 'POST' | 'PUT' | 'PATCH',
@@ -658,7 +798,7 @@ export interface ClientInstance {
658
798
  Result = unknown,
659
799
  Context = unknown,
660
800
  >(
661
- endpoint: any & {
801
+ endpoint: {
662
802
  config: BaseEndpointConfig<
663
803
  Method,
664
804
  Url,
@@ -673,26 +813,28 @@ export interface ClientInstance {
673
813
  onSuccess?: (
674
814
  queryClient: QueryClient,
675
815
  data: NoInfer<Result>,
676
- variables: Util_FlatObject<
677
- ClientMutationArgs<Url, RequestSchema, undefined>
678
- >,
816
+ variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
679
817
  context: Context,
680
818
  ) => void | Promise<void>
681
819
  onError?: (
682
820
  queryClient: QueryClient,
683
821
  error: Error,
684
- variables: Util_FlatObject<
685
- ClientMutationArgs<Url, RequestSchema, undefined>
686
- >,
822
+ variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
687
823
  context: Context,
688
824
  ) => void | Promise<void>
689
825
  },
690
- ): (() => UseMutationResult<
826
+ ): ((
827
+ params: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
828
+ ) => UseMutationResult<
691
829
  Result,
692
830
  Error,
693
- ClientMutationArgs<Url, RequestSchema, undefined>
831
+ MutationArgs<Url, RequestSchema, undefined>
694
832
  >) &
695
- ClientEndpointHelper<Method, Url, RequestSchema, Response, undefined>
833
+ EndpointHelper<Method, Url, RequestSchema, Response, undefined>
834
+
835
+ // ============================================================================
836
+ // DELETE MUTATION FROM ENDPOINT METHODS
837
+ // ============================================================================
696
838
 
697
839
  mutationFromEndpoint<
698
840
  Method extends 'DELETE' = 'DELETE',
@@ -704,7 +846,7 @@ export interface ClientInstance {
704
846
  Context = unknown,
705
847
  UseKey extends true = true,
706
848
  >(
707
- endpoint: any & {
849
+ endpoint: {
708
850
  config: BaseEndpointConfig<Method, Url, QuerySchema, Response>
709
851
  },
710
852
  mutationOptions: {
@@ -714,29 +856,25 @@ export interface ClientInstance {
714
856
  onSuccess?: (
715
857
  queryClient: QueryClient,
716
858
  data: NoInfer<Result>,
717
- variables: Util_FlatObject<
718
- ClientMutationArgs<Url, undefined, QuerySchema>
719
- >,
859
+ variables: Util_FlatObject<MutationArgs<Url, undefined, QuerySchema>>,
720
860
  context: Context,
721
861
  ) => void | Promise<void>
722
862
  onError?: (
723
863
  queryClient: QueryClient,
724
864
  error: Error,
725
- variables: Util_FlatObject<
726
- ClientMutationArgs<Url, undefined, QuerySchema>
727
- >,
865
+ variables: Util_FlatObject<MutationArgs<Url, undefined, QuerySchema>>,
728
866
  context: Context,
729
867
  ) => void | Promise<void>
730
868
  },
731
869
  ): ((
732
- params: UrlHasParams<Url> extends true ? UrlParams<Url> : {},
870
+ params: Util_FlatObject<MutationArgs<Url, undefined, QuerySchema>>,
733
871
  ) => UseMutationResult<
734
872
  Result,
735
873
  Error,
736
- ClientMutationArgs<Url, undefined, QuerySchema>
874
+ MutationArgs<Url, undefined, QuerySchema>
737
875
  >) &
738
876
  MutationHelpers<Url, Result> &
739
- ClientEndpointHelper<Method, Url, undefined, Response, QuerySchema>
877
+ EndpointHelper<Method, Url, undefined, Response, QuerySchema>
740
878
 
741
879
  mutationFromEndpoint<
742
880
  Method extends 'DELETE' = 'DELETE',
@@ -747,7 +885,7 @@ export interface ClientInstance {
747
885
  Context = unknown,
748
886
  UseKey extends true = true,
749
887
  >(
750
- endpoint: any & {
888
+ endpoint: {
751
889
  config: BaseEndpointConfig<Method, Url, undefined, Response>
752
890
  },
753
891
  mutationOptions: {
@@ -757,29 +895,25 @@ export interface ClientInstance {
757
895
  onSuccess?: (
758
896
  queryClient: QueryClient,
759
897
  data: NoInfer<Result>,
760
- variables: Util_FlatObject<
761
- ClientMutationArgs<Url, undefined, undefined>
762
- >,
898
+ variables: Util_FlatObject<MutationArgs<Url, undefined, undefined>>,
763
899
  context: Context,
764
900
  ) => void | Promise<void>
765
901
  onError?: (
766
902
  queryClient: QueryClient,
767
903
  error: Error,
768
- variables: Util_FlatObject<
769
- ClientMutationArgs<Url, undefined, undefined>
770
- >,
904
+ variables: Util_FlatObject<MutationArgs<Url, undefined, undefined>>,
771
905
  context: Context,
772
906
  ) => void | Promise<void>
773
907
  },
774
908
  ): ((
775
- params: UrlHasParams<Url> extends true ? UrlParams<Url> : {},
909
+ params: Util_FlatObject<MutationArgs<Url, undefined, undefined>>,
776
910
  ) => UseMutationResult<
777
911
  Result,
778
912
  Error,
779
- ClientMutationArgs<Url, undefined, undefined>
913
+ MutationArgs<Url, undefined, undefined>
780
914
  >) &
781
915
  MutationHelpers<Url, Result> &
782
- ClientEndpointHelper<Method, Url, undefined, Response, undefined>
916
+ EndpointHelper<Method, Url, undefined, Response, undefined>
783
917
 
784
918
  mutationFromEndpoint<
785
919
  Method extends 'DELETE' = 'DELETE',
@@ -790,7 +924,7 @@ export interface ClientInstance {
790
924
  Result = unknown,
791
925
  Context = unknown,
792
926
  >(
793
- endpoint: any & {
927
+ endpoint: {
794
928
  config: BaseEndpointConfig<Method, Url, QuerySchema, Response>
795
929
  },
796
930
  mutationOptions: {
@@ -799,26 +933,24 @@ export interface ClientInstance {
799
933
  onSuccess?: (
800
934
  queryClient: QueryClient,
801
935
  data: NoInfer<Result>,
802
- variables: Util_FlatObject<
803
- ClientMutationArgs<Url, undefined, QuerySchema>
804
- >,
936
+ variables: Util_FlatObject<MutationArgs<Url, undefined, QuerySchema>>,
805
937
  context: Context,
806
938
  ) => void | Promise<void>
807
939
  onError?: (
808
940
  queryClient: QueryClient,
809
941
  error: Error,
810
- variables: Util_FlatObject<
811
- ClientMutationArgs<Url, undefined, QuerySchema>
812
- >,
942
+ variables: Util_FlatObject<MutationArgs<Url, undefined, QuerySchema>>,
813
943
  context: Context,
814
944
  ) => void | Promise<void>
815
945
  },
816
- ): (() => UseMutationResult<
946
+ ): ((
947
+ params: Util_FlatObject<MutationArgs<Url, undefined, QuerySchema>>,
948
+ ) => UseMutationResult<
817
949
  Result,
818
950
  Error,
819
- ClientMutationArgs<Url, undefined, QuerySchema>
951
+ MutationArgs<Url, undefined, QuerySchema>
820
952
  >) &
821
- ClientEndpointHelper<Method, Url, undefined, Response, QuerySchema>
953
+ EndpointHelper<Method, Url, undefined, Response, QuerySchema>
822
954
 
823
955
  mutationFromEndpoint<
824
956
  Method extends 'DELETE' = 'DELETE',
@@ -828,7 +960,7 @@ export interface ClientInstance {
828
960
  Result = unknown,
829
961
  Context = unknown,
830
962
  >(
831
- endpoint: any & {
963
+ endpoint: {
832
964
  config: BaseEndpointConfig<Method, Url, undefined, Response>
833
965
  },
834
966
  mutationOptions: {
@@ -837,26 +969,178 @@ export interface ClientInstance {
837
969
  onSuccess?: (
838
970
  queryClient: QueryClient,
839
971
  data: NoInfer<Result>,
840
- variables: Util_FlatObject<
841
- ClientMutationArgs<Url, undefined, undefined>
842
- >,
972
+ variables: Util_FlatObject<MutationArgs<Url, undefined, undefined>>,
843
973
  context: Context,
844
974
  ) => void | Promise<void>
845
975
  onError?: (
846
976
  queryClient: QueryClient,
847
977
  error: Error,
848
- variables: Util_FlatObject<
849
- ClientMutationArgs<Url, undefined, undefined>
850
- >,
978
+ variables: Util_FlatObject<MutationArgs<Url, undefined, undefined>>,
851
979
  context: Context,
852
980
  ) => void | Promise<void>
853
981
  },
854
982
  ): ((
983
+ params: Util_FlatObject<MutationArgs<Url, undefined, undefined>>,
984
+ ) => UseMutationResult<
985
+ Result,
986
+ Error,
987
+ MutationArgs<Url, undefined, undefined>
988
+ >) &
989
+ EndpointHelper<Method, Url, undefined, Response, undefined>
990
+
991
+ // ============================================================================
992
+ // MULTIPART MUTATION METHODS
993
+ // ============================================================================
994
+
995
+ multipartMutation<
996
+ Method extends 'POST' | 'PUT' | 'PATCH' = 'POST' | 'PUT' | 'PATCH',
997
+ Url extends string = string,
998
+ RequestSchema extends ZodType = ZodType,
999
+ QuerySchema extends ZodObject = ZodObject,
1000
+ Response extends ZodType = ZodType,
1001
+ ReqResult = z.output<Response>,
1002
+ Result = unknown,
1003
+ Context = unknown,
1004
+ UseKey extends true = true,
1005
+ >(config: {
1006
+ method: Method
1007
+ url: Url
1008
+ useKey: UseKey
1009
+ requestSchema: RequestSchema
1010
+ querySchema: QuerySchema
1011
+ responseSchema: Response
1012
+ processResponse: ProcessResponseFunction<Result, ReqResult>
1013
+ useContext?: () => Context
1014
+ onSuccess?: (
1015
+ queryClient: QueryClient,
1016
+ data: NoInfer<Result>,
1017
+ variables: Util_FlatObject<MutationArgs<Url, RequestSchema, QuerySchema>>,
1018
+ context: Context,
1019
+ ) => void | Promise<void>
1020
+ onError?: (
1021
+ queryClient: QueryClient,
1022
+ error: Error,
1023
+ variables: Util_FlatObject<MutationArgs<Url, RequestSchema, QuerySchema>>,
1024
+ context: Context,
1025
+ ) => void | Promise<void>
1026
+ }): ((
1027
+ params: UrlHasParams<Url> extends true ? { urlParams: UrlParams<Url> } : {},
1028
+ ) => UseMutationResult<
1029
+ Result,
1030
+ Error,
1031
+ MutationArgs<Url, RequestSchema, QuerySchema>
1032
+ >) &
1033
+ MutationHelpers<Url, Result> &
1034
+ EndpointHelper<Method, Url, RequestSchema, Response, QuerySchema>
1035
+
1036
+ multipartMutation<
1037
+ Method extends 'POST' | 'PUT' | 'PATCH' = 'POST' | 'PUT' | 'PATCH',
1038
+ Url extends string = string,
1039
+ RequestSchema extends ZodType = ZodType,
1040
+ QuerySchema extends ZodObject = ZodObject,
1041
+ Response extends ZodType = ZodType,
1042
+ ReqResult = z.output<Response>,
1043
+ Result = unknown,
1044
+ Context = unknown,
1045
+ >(config: {
1046
+ method: Method
1047
+ url: Url
1048
+ requestSchema: RequestSchema
1049
+ querySchema: QuerySchema
1050
+ responseSchema: Response
1051
+ processResponse: ProcessResponseFunction<Result, ReqResult>
1052
+ useContext?: () => Context
1053
+ onSuccess?: (
1054
+ queryClient: QueryClient,
1055
+ data: NoInfer<Result>,
1056
+ variables: Util_FlatObject<MutationArgs<Url, RequestSchema, QuerySchema>>,
1057
+ context: Context,
1058
+ ) => void | Promise<void>
1059
+ onError?: (
1060
+ queryClient: QueryClient,
1061
+ error: Error,
1062
+ variables: Util_FlatObject<MutationArgs<Url, RequestSchema, QuerySchema>>,
1063
+ context: Context,
1064
+ ) => void | Promise<void>
1065
+ }): (() => UseMutationResult<
1066
+ Result,
1067
+ Error,
1068
+ MutationArgs<Url, RequestSchema, QuerySchema>
1069
+ >) &
1070
+ MutationHelpers<Url, Result> &
1071
+ EndpointHelper<Method, Url, RequestSchema, Response, QuerySchema>
1072
+
1073
+ multipartMutation<
1074
+ Method extends 'POST' | 'PUT' | 'PATCH' = 'POST' | 'PUT' | 'PATCH',
1075
+ Url extends string = string,
1076
+ RequestSchema extends ZodType = ZodType,
1077
+ Response extends ZodType = ZodType,
1078
+ ReqResult = z.output<Response>,
1079
+ Result = unknown,
1080
+ Context = unknown,
1081
+ >(config: {
1082
+ method: Method
1083
+ url: Url
1084
+ requestSchema: RequestSchema
1085
+ responseSchema: Response
1086
+ processResponse: ProcessResponseFunction<Result, ReqResult>
1087
+ useContext?: () => Context
1088
+ onSuccess?: (
1089
+ queryClient: QueryClient,
1090
+ data: NoInfer<Result>,
1091
+ variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
1092
+ context: Context,
1093
+ ) => void | Promise<void>
1094
+ onError?: (
1095
+ queryClient: QueryClient,
1096
+ error: Error,
1097
+ variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
1098
+ context: Context,
1099
+ ) => void | Promise<void>
1100
+ }): (() => UseMutationResult<
1101
+ Result,
1102
+ Error,
1103
+ MutationArgs<Url, RequestSchema, undefined>
1104
+ >) &
1105
+ MutationHelpers<Url, Result> &
1106
+ EndpointHelper<Method, Url, RequestSchema, Response>
1107
+
1108
+ multipartMutation<
1109
+ Method extends 'POST' | 'PUT' | 'PATCH' = 'POST' | 'PUT' | 'PATCH',
1110
+ Url extends string = string,
1111
+ RequestSchema extends ZodType = ZodType,
1112
+ Response extends ZodType = ZodType,
1113
+ ReqResult = z.output<Response>,
1114
+ Result = unknown,
1115
+ Context = unknown,
1116
+ UseKey extends true = true,
1117
+ >(config: {
1118
+ method: Method
1119
+ url: Url
1120
+ useKey: UseKey
1121
+ requestSchema: RequestSchema
1122
+ responseSchema: Response
1123
+ processResponse: ProcessResponseFunction<Result, ReqResult>
1124
+ useContext?: () => Context
1125
+ onSuccess?: (
1126
+ queryClient: QueryClient,
1127
+ data: NoInfer<Result>,
1128
+ variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
1129
+ context: Context,
1130
+ ) => void | Promise<void>
1131
+ onError?: (
1132
+ queryClient: QueryClient,
1133
+ error: Error,
1134
+ variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
1135
+ context: Context,
1136
+ ) => void | Promise<void>
1137
+ }): ((
855
1138
  params: UrlHasParams<Url> extends true ? UrlParams<Url> : {},
856
1139
  ) => UseMutationResult<
857
1140
  Result,
858
1141
  Error,
859
- ClientMutationArgs<Url, undefined, undefined>
1142
+ MutationArgs<Url, RequestSchema, undefined>
860
1143
  >) &
861
- ClientEndpointHelper<Method, Url, undefined, Response, undefined>
1144
+ MutationHelpers<Url, Result> &
1145
+ EndpointHelper<Method, Url, RequestSchema, Response>
862
1146
  }