@navios/react-query 0.6.0 → 0.6.1
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/src/client/types.d.mts +337 -113
- package/dist/src/client/types.d.mts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/lib/_tsup-dts-rollup.d.mts +336 -112
- package/lib/_tsup-dts-rollup.d.ts +336 -112
- package/package.json +1 -1
- package/src/client/__type-tests__/client-instance.spec-d.mts +2 -2
- package/src/client/types.mts +617 -141
package/src/client/types.mts
CHANGED
|
@@ -10,7 +10,7 @@ import type {
|
|
|
10
10
|
import type {
|
|
11
11
|
DataTag,
|
|
12
12
|
InfiniteData,
|
|
13
|
-
|
|
13
|
+
MutationFunctionContext,
|
|
14
14
|
UseMutationResult,
|
|
15
15
|
UseSuspenseInfiniteQueryOptions,
|
|
16
16
|
UseSuspenseQueryOptions,
|
|
@@ -274,6 +274,7 @@ export interface ClientInstance {
|
|
|
274
274
|
Response extends ZodType = ZodType,
|
|
275
275
|
ReqResult = z.output<Response>,
|
|
276
276
|
Result = unknown,
|
|
277
|
+
OnMutateResult = unknown,
|
|
277
278
|
Context = unknown,
|
|
278
279
|
UseKey extends true = true,
|
|
279
280
|
>(config: {
|
|
@@ -285,24 +286,36 @@ export interface ClientInstance {
|
|
|
285
286
|
responseSchema: Response
|
|
286
287
|
processResponse: ProcessResponseFunction<Result, ReqResult>
|
|
287
288
|
useContext?: () => Context
|
|
289
|
+
onMutate?: (
|
|
290
|
+
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, QuerySchema>>,
|
|
291
|
+
context: Context & MutationFunctionContext,
|
|
292
|
+
) => OnMutateResult | Promise<OnMutateResult>
|
|
288
293
|
onSuccess?: (
|
|
289
|
-
queryClient: QueryClient,
|
|
290
294
|
data: NoInfer<Result>,
|
|
291
295
|
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, QuerySchema>>,
|
|
292
|
-
context: Context
|
|
296
|
+
context: Context &
|
|
297
|
+
MutationFunctionContext & { onMutateResult: OnMutateResult | undefined },
|
|
293
298
|
) => void | Promise<void>
|
|
294
299
|
onError?: (
|
|
295
|
-
queryClient: QueryClient,
|
|
296
300
|
error: Error,
|
|
297
301
|
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, QuerySchema>>,
|
|
298
|
-
context: Context
|
|
302
|
+
context: Context &
|
|
303
|
+
MutationFunctionContext & { onMutateResult: OnMutateResult | undefined },
|
|
304
|
+
) => void | Promise<void>
|
|
305
|
+
onSettled?: (
|
|
306
|
+
data: NoInfer<Result> | undefined,
|
|
307
|
+
error: Error | null,
|
|
308
|
+
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, QuerySchema>>,
|
|
309
|
+
context: Context &
|
|
310
|
+
MutationFunctionContext & { onMutateResult: OnMutateResult | undefined },
|
|
299
311
|
) => void | Promise<void>
|
|
300
312
|
}): ((
|
|
301
313
|
params: UrlHasParams<Url> extends true ? { urlParams: UrlParams<Url> } : {},
|
|
302
314
|
) => UseMutationResult<
|
|
303
315
|
Result,
|
|
304
316
|
Error,
|
|
305
|
-
MutationArgs<Url, RequestSchema, QuerySchema
|
|
317
|
+
MutationArgs<Url, RequestSchema, QuerySchema>,
|
|
318
|
+
OnMutateResult
|
|
306
319
|
>) &
|
|
307
320
|
MutationHelpers<Url, Result> &
|
|
308
321
|
EndpointHelper<Method, Url, RequestSchema, Response, QuerySchema>
|
|
@@ -316,6 +329,7 @@ export interface ClientInstance {
|
|
|
316
329
|
Response extends ZodType = ZodType,
|
|
317
330
|
ReqResult = z.output<Response>,
|
|
318
331
|
Result = unknown,
|
|
332
|
+
OnMutateResult = unknown,
|
|
319
333
|
Context = unknown,
|
|
320
334
|
>(config: {
|
|
321
335
|
method: Method
|
|
@@ -325,22 +339,34 @@ export interface ClientInstance {
|
|
|
325
339
|
responseSchema: Response
|
|
326
340
|
processResponse: ProcessResponseFunction<Result, ReqResult>
|
|
327
341
|
useContext?: () => Context
|
|
342
|
+
onMutate?: (
|
|
343
|
+
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, QuerySchema>>,
|
|
344
|
+
context: Context & MutationFunctionContext,
|
|
345
|
+
) => OnMutateResult | Promise<OnMutateResult>
|
|
328
346
|
onSuccess?: (
|
|
329
|
-
queryClient: QueryClient,
|
|
330
347
|
data: NoInfer<Result>,
|
|
331
348
|
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, QuerySchema>>,
|
|
332
|
-
context: Context
|
|
349
|
+
context: Context &
|
|
350
|
+
MutationFunctionContext & { onMutateResult: OnMutateResult | undefined },
|
|
333
351
|
) => void | Promise<void>
|
|
334
352
|
onError?: (
|
|
335
|
-
queryClient: QueryClient,
|
|
336
353
|
error: Error,
|
|
337
354
|
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, QuerySchema>>,
|
|
338
|
-
context: Context
|
|
355
|
+
context: Context &
|
|
356
|
+
MutationFunctionContext & { onMutateResult: OnMutateResult | undefined },
|
|
357
|
+
) => void | Promise<void>
|
|
358
|
+
onSettled?: (
|
|
359
|
+
data: NoInfer<Result> | undefined,
|
|
360
|
+
error: Error | null,
|
|
361
|
+
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, QuerySchema>>,
|
|
362
|
+
context: Context &
|
|
363
|
+
MutationFunctionContext & { onMutateResult: OnMutateResult | undefined },
|
|
339
364
|
) => void | Promise<void>
|
|
340
365
|
}): (() => UseMutationResult<
|
|
341
366
|
Result,
|
|
342
367
|
Error,
|
|
343
|
-
MutationArgs<Url, RequestSchema, QuerySchema
|
|
368
|
+
MutationArgs<Url, RequestSchema, QuerySchema>,
|
|
369
|
+
OnMutateResult
|
|
344
370
|
>) &
|
|
345
371
|
MutationHelpers<Url, Result> &
|
|
346
372
|
EndpointHelper<Method, Url, RequestSchema, Response, QuerySchema>
|
|
@@ -353,6 +379,7 @@ export interface ClientInstance {
|
|
|
353
379
|
Response extends ZodType = ZodType,
|
|
354
380
|
ReqResult = z.output<Response>,
|
|
355
381
|
Result = unknown,
|
|
382
|
+
OnMutateResult = unknown,
|
|
356
383
|
Context = unknown,
|
|
357
384
|
>(config: {
|
|
358
385
|
method: Method
|
|
@@ -361,22 +388,34 @@ export interface ClientInstance {
|
|
|
361
388
|
responseSchema: Response
|
|
362
389
|
processResponse: ProcessResponseFunction<Result, ReqResult>
|
|
363
390
|
useContext?: () => Context
|
|
391
|
+
onMutate?: (
|
|
392
|
+
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
|
|
393
|
+
context: Context & MutationFunctionContext,
|
|
394
|
+
) => OnMutateResult | Promise<OnMutateResult>
|
|
364
395
|
onSuccess?: (
|
|
365
|
-
queryClient: QueryClient,
|
|
366
396
|
data: NoInfer<Result>,
|
|
367
397
|
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
|
|
368
|
-
context: Context
|
|
398
|
+
context: Context &
|
|
399
|
+
MutationFunctionContext & { onMutateResult: OnMutateResult | undefined },
|
|
369
400
|
) => void | Promise<void>
|
|
370
401
|
onError?: (
|
|
371
|
-
queryClient: QueryClient,
|
|
372
402
|
error: Error,
|
|
373
403
|
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
|
|
374
|
-
context: Context
|
|
404
|
+
context: Context &
|
|
405
|
+
MutationFunctionContext & { onMutateResult: OnMutateResult | undefined },
|
|
406
|
+
) => void | Promise<void>
|
|
407
|
+
onSettled?: (
|
|
408
|
+
data: NoInfer<Result> | undefined,
|
|
409
|
+
error: Error | null,
|
|
410
|
+
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
|
|
411
|
+
context: Context &
|
|
412
|
+
MutationFunctionContext & { onMutateResult: OnMutateResult | undefined },
|
|
375
413
|
) => void | Promise<void>
|
|
376
414
|
}): (() => UseMutationResult<
|
|
377
415
|
Result,
|
|
378
416
|
Error,
|
|
379
|
-
MutationArgs<Url, RequestSchema, undefined
|
|
417
|
+
MutationArgs<Url, RequestSchema, undefined>,
|
|
418
|
+
OnMutateResult
|
|
380
419
|
>) &
|
|
381
420
|
MutationHelpers<Url, Result> &
|
|
382
421
|
EndpointHelper<Method, Url, RequestSchema, Response>
|
|
@@ -389,6 +428,7 @@ export interface ClientInstance {
|
|
|
389
428
|
Response extends ZodType = ZodType,
|
|
390
429
|
ReqResult = z.output<Response>,
|
|
391
430
|
Result = unknown,
|
|
431
|
+
OnMutateResult = unknown,
|
|
392
432
|
Context = unknown,
|
|
393
433
|
UseKey extends true = true,
|
|
394
434
|
>(config: {
|
|
@@ -399,24 +439,36 @@ export interface ClientInstance {
|
|
|
399
439
|
responseSchema: Response
|
|
400
440
|
processResponse: ProcessResponseFunction<Result, ReqResult>
|
|
401
441
|
useContext?: () => Context
|
|
442
|
+
onMutate?: (
|
|
443
|
+
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
|
|
444
|
+
context: Context & MutationFunctionContext,
|
|
445
|
+
) => OnMutateResult | Promise<OnMutateResult>
|
|
402
446
|
onSuccess?: (
|
|
403
|
-
queryClient: QueryClient,
|
|
404
447
|
data: NoInfer<Result>,
|
|
405
448
|
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
|
|
406
|
-
context: Context
|
|
449
|
+
context: Context &
|
|
450
|
+
MutationFunctionContext & { onMutateResult: OnMutateResult | undefined },
|
|
407
451
|
) => void | Promise<void>
|
|
408
452
|
onError?: (
|
|
409
|
-
queryClient: QueryClient,
|
|
410
453
|
error: Error,
|
|
411
454
|
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
|
|
412
|
-
context: Context
|
|
455
|
+
context: Context &
|
|
456
|
+
MutationFunctionContext & { onMutateResult: OnMutateResult | undefined },
|
|
457
|
+
) => void | Promise<void>
|
|
458
|
+
onSettled?: (
|
|
459
|
+
data: NoInfer<Result> | undefined,
|
|
460
|
+
error: Error | null,
|
|
461
|
+
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
|
|
462
|
+
context: Context &
|
|
463
|
+
MutationFunctionContext & { onMutateResult: OnMutateResult | undefined },
|
|
413
464
|
) => void | Promise<void>
|
|
414
465
|
}): ((
|
|
415
466
|
params: UrlHasParams<Url> extends true ? { urlParams: UrlParams<Url> } : {},
|
|
416
467
|
) => UseMutationResult<
|
|
417
468
|
Result,
|
|
418
469
|
Error,
|
|
419
|
-
MutationArgs<Url, RequestSchema, undefined
|
|
470
|
+
MutationArgs<Url, RequestSchema, undefined>,
|
|
471
|
+
OnMutateResult
|
|
420
472
|
>) &
|
|
421
473
|
MutationHelpers<Url, Result> &
|
|
422
474
|
EndpointHelper<Method, Url, RequestSchema, Response>
|
|
@@ -433,6 +485,7 @@ export interface ClientInstance {
|
|
|
433
485
|
Response extends ZodType = ZodType,
|
|
434
486
|
ReqResult = z.output<Response>,
|
|
435
487
|
Result = unknown,
|
|
488
|
+
OnMutateResult = unknown,
|
|
436
489
|
Context = unknown,
|
|
437
490
|
UseKey extends true = true,
|
|
438
491
|
>(config: {
|
|
@@ -443,24 +496,36 @@ export interface ClientInstance {
|
|
|
443
496
|
responseSchema: Response
|
|
444
497
|
processResponse: ProcessResponseFunction<Result, ReqResult>
|
|
445
498
|
useContext?: () => Context
|
|
499
|
+
onMutate?: (
|
|
500
|
+
variables: Util_FlatObject<MutationArgs<Url, undefined, QuerySchema>>,
|
|
501
|
+
context: Context & MutationFunctionContext,
|
|
502
|
+
) => OnMutateResult | Promise<OnMutateResult>
|
|
446
503
|
onSuccess?: (
|
|
447
|
-
queryClient: QueryClient,
|
|
448
504
|
data: NoInfer<Result>,
|
|
449
505
|
variables: Util_FlatObject<MutationArgs<Url, undefined, QuerySchema>>,
|
|
450
|
-
context: Context
|
|
506
|
+
context: Context &
|
|
507
|
+
MutationFunctionContext & { onMutateResult: OnMutateResult | undefined },
|
|
451
508
|
) => void | Promise<void>
|
|
452
509
|
onError?: (
|
|
453
|
-
queryClient: QueryClient,
|
|
454
510
|
error: Error,
|
|
455
511
|
variables: Util_FlatObject<MutationArgs<Url, undefined, QuerySchema>>,
|
|
456
|
-
context: Context
|
|
512
|
+
context: Context &
|
|
513
|
+
MutationFunctionContext & { onMutateResult: OnMutateResult | undefined },
|
|
514
|
+
) => void | Promise<void>
|
|
515
|
+
onSettled?: (
|
|
516
|
+
data: NoInfer<Result> | undefined,
|
|
517
|
+
error: Error | null,
|
|
518
|
+
variables: Util_FlatObject<MutationArgs<Url, undefined, QuerySchema>>,
|
|
519
|
+
context: Context &
|
|
520
|
+
MutationFunctionContext & { onMutateResult: OnMutateResult | undefined },
|
|
457
521
|
) => void | Promise<void>
|
|
458
522
|
}): ((
|
|
459
523
|
params: UrlHasParams<Url> extends true ? { urlParams: UrlParams<Url> } : {},
|
|
460
524
|
) => UseMutationResult<
|
|
461
525
|
Result,
|
|
462
526
|
Error,
|
|
463
|
-
MutationArgs<Url, undefined, QuerySchema
|
|
527
|
+
MutationArgs<Url, undefined, QuerySchema>,
|
|
528
|
+
OnMutateResult
|
|
464
529
|
>) &
|
|
465
530
|
MutationHelpers<Url, Result> &
|
|
466
531
|
EndpointHelper<Method, Url, undefined, Response, QuerySchema>
|
|
@@ -473,6 +538,7 @@ export interface ClientInstance {
|
|
|
473
538
|
Response extends ZodType = ZodType,
|
|
474
539
|
ReqResult = z.output<Response>,
|
|
475
540
|
Result = unknown,
|
|
541
|
+
OnMutateResult = unknown,
|
|
476
542
|
Context = unknown,
|
|
477
543
|
>(config: {
|
|
478
544
|
method: Method
|
|
@@ -481,22 +547,34 @@ export interface ClientInstance {
|
|
|
481
547
|
responseSchema: Response
|
|
482
548
|
processResponse: ProcessResponseFunction<Result, ReqResult>
|
|
483
549
|
useContext?: () => Context
|
|
550
|
+
onMutate?: (
|
|
551
|
+
variables: Util_FlatObject<MutationArgs<Url, undefined, QuerySchema>>,
|
|
552
|
+
context: Context & MutationFunctionContext,
|
|
553
|
+
) => OnMutateResult | Promise<OnMutateResult>
|
|
484
554
|
onSuccess?: (
|
|
485
|
-
queryClient: QueryClient,
|
|
486
555
|
data: NoInfer<Result>,
|
|
487
556
|
variables: Util_FlatObject<MutationArgs<Url, undefined, QuerySchema>>,
|
|
488
|
-
context: Context
|
|
557
|
+
context: Context &
|
|
558
|
+
MutationFunctionContext & { onMutateResult: OnMutateResult | undefined },
|
|
489
559
|
) => void | Promise<void>
|
|
490
560
|
onError?: (
|
|
491
|
-
queryClient: QueryClient,
|
|
492
561
|
error: Error,
|
|
493
562
|
variables: Util_FlatObject<MutationArgs<Url, undefined, QuerySchema>>,
|
|
494
|
-
context: Context
|
|
563
|
+
context: Context &
|
|
564
|
+
MutationFunctionContext & { onMutateResult: OnMutateResult | undefined },
|
|
565
|
+
) => void | Promise<void>
|
|
566
|
+
onSettled?: (
|
|
567
|
+
data: NoInfer<Result> | undefined,
|
|
568
|
+
error: Error | null,
|
|
569
|
+
variables: Util_FlatObject<MutationArgs<Url, undefined, QuerySchema>>,
|
|
570
|
+
context: Context &
|
|
571
|
+
MutationFunctionContext & { onMutateResult: OnMutateResult | undefined },
|
|
495
572
|
) => void | Promise<void>
|
|
496
573
|
}): (() => UseMutationResult<
|
|
497
574
|
Result,
|
|
498
575
|
Error,
|
|
499
|
-
MutationArgs<Url, undefined, QuerySchema
|
|
576
|
+
MutationArgs<Url, undefined, QuerySchema>,
|
|
577
|
+
OnMutateResult
|
|
500
578
|
>) &
|
|
501
579
|
MutationHelpers<Url, Result> &
|
|
502
580
|
EndpointHelper<Method, Url, undefined, Response, QuerySchema>
|
|
@@ -508,6 +586,7 @@ export interface ClientInstance {
|
|
|
508
586
|
Response extends ZodType = ZodType,
|
|
509
587
|
ReqResult = z.output<Response>,
|
|
510
588
|
Result = unknown,
|
|
589
|
+
OnMutateResult = unknown,
|
|
511
590
|
Context = unknown,
|
|
512
591
|
UseKey extends true = true,
|
|
513
592
|
>(config: {
|
|
@@ -517,24 +596,36 @@ export interface ClientInstance {
|
|
|
517
596
|
responseSchema: Response
|
|
518
597
|
processResponse: ProcessResponseFunction<Result, ReqResult>
|
|
519
598
|
useContext?: () => Context
|
|
599
|
+
onMutate?: (
|
|
600
|
+
variables: Util_FlatObject<MutationArgs<Url, undefined, undefined>>,
|
|
601
|
+
context: Context & MutationFunctionContext,
|
|
602
|
+
) => OnMutateResult | Promise<OnMutateResult>
|
|
520
603
|
onSuccess?: (
|
|
521
|
-
queryClient: QueryClient,
|
|
522
604
|
data: NoInfer<Result>,
|
|
523
605
|
variables: Util_FlatObject<MutationArgs<Url, undefined, undefined>>,
|
|
524
|
-
context: Context
|
|
606
|
+
context: Context &
|
|
607
|
+
MutationFunctionContext & { onMutateResult: OnMutateResult | undefined },
|
|
525
608
|
) => void | Promise<void>
|
|
526
609
|
onError?: (
|
|
527
|
-
queryClient: QueryClient,
|
|
528
610
|
error: Error,
|
|
529
611
|
variables: Util_FlatObject<MutationArgs<Url, undefined, undefined>>,
|
|
530
|
-
context: Context
|
|
612
|
+
context: Context &
|
|
613
|
+
MutationFunctionContext & { onMutateResult: OnMutateResult | undefined },
|
|
614
|
+
) => void | Promise<void>
|
|
615
|
+
onSettled?: (
|
|
616
|
+
data: NoInfer<Result> | undefined,
|
|
617
|
+
error: Error | null,
|
|
618
|
+
variables: Util_FlatObject<MutationArgs<Url, undefined, undefined>>,
|
|
619
|
+
context: Context &
|
|
620
|
+
MutationFunctionContext & { onMutateResult: OnMutateResult | undefined },
|
|
531
621
|
) => void | Promise<void>
|
|
532
622
|
}): ((
|
|
533
623
|
params: UrlHasParams<Url> extends true ? { urlParams: UrlParams<Url> } : {},
|
|
534
624
|
) => UseMutationResult<
|
|
535
625
|
Result,
|
|
536
626
|
Error,
|
|
537
|
-
MutationArgs<Url, undefined, undefined
|
|
627
|
+
MutationArgs<Url, undefined, undefined>,
|
|
628
|
+
OnMutateResult
|
|
538
629
|
>) &
|
|
539
630
|
MutationHelpers<Url, Result> &
|
|
540
631
|
EndpointHelper<Method, Url, undefined, Response>
|
|
@@ -546,6 +637,7 @@ export interface ClientInstance {
|
|
|
546
637
|
Response extends ZodType = ZodType,
|
|
547
638
|
ReqResult = z.output<Response>,
|
|
548
639
|
Result = unknown,
|
|
640
|
+
OnMutateResult = unknown,
|
|
549
641
|
Context = unknown,
|
|
550
642
|
>(config: {
|
|
551
643
|
method: Method
|
|
@@ -553,22 +645,34 @@ export interface ClientInstance {
|
|
|
553
645
|
responseSchema: Response
|
|
554
646
|
processResponse: ProcessResponseFunction<Result, ReqResult>
|
|
555
647
|
useContext?: () => Context
|
|
648
|
+
onMutate?: (
|
|
649
|
+
variables: Util_FlatObject<MutationArgs<Url, undefined, undefined>>,
|
|
650
|
+
context: Context & MutationFunctionContext,
|
|
651
|
+
) => OnMutateResult | Promise<OnMutateResult>
|
|
556
652
|
onSuccess?: (
|
|
557
|
-
queryClient: QueryClient,
|
|
558
653
|
data: NoInfer<Result>,
|
|
559
654
|
variables: Util_FlatObject<MutationArgs<Url, undefined, undefined>>,
|
|
560
|
-
context: Context
|
|
655
|
+
context: Context &
|
|
656
|
+
MutationFunctionContext & { onMutateResult: OnMutateResult | undefined },
|
|
561
657
|
) => void | Promise<void>
|
|
562
658
|
onError?: (
|
|
563
|
-
queryClient: QueryClient,
|
|
564
659
|
error: Error,
|
|
565
660
|
variables: Util_FlatObject<MutationArgs<Url, undefined, undefined>>,
|
|
566
|
-
context: Context
|
|
661
|
+
context: Context &
|
|
662
|
+
MutationFunctionContext & { onMutateResult: OnMutateResult | undefined },
|
|
663
|
+
) => void | Promise<void>
|
|
664
|
+
onSettled?: (
|
|
665
|
+
data: NoInfer<Result> | undefined,
|
|
666
|
+
error: Error | null,
|
|
667
|
+
variables: Util_FlatObject<MutationArgs<Url, undefined, undefined>>,
|
|
668
|
+
context: Context &
|
|
669
|
+
MutationFunctionContext & { onMutateResult: OnMutateResult | undefined },
|
|
567
670
|
) => void | Promise<void>
|
|
568
671
|
}): (() => UseMutationResult<
|
|
569
672
|
Result,
|
|
570
673
|
Error,
|
|
571
|
-
MutationArgs<Url, undefined, undefined
|
|
674
|
+
MutationArgs<Url, undefined, undefined>,
|
|
675
|
+
OnMutateResult
|
|
572
676
|
>) &
|
|
573
677
|
MutationHelpers<Url, Result> &
|
|
574
678
|
EndpointHelper<Method, Url, undefined, Response>
|
|
@@ -671,6 +775,7 @@ export interface ClientInstance {
|
|
|
671
775
|
Response extends ZodType = ZodType,
|
|
672
776
|
ReqResult = z.output<Response>,
|
|
673
777
|
Result = unknown,
|
|
778
|
+
OnMutateResult = unknown,
|
|
674
779
|
Context = unknown,
|
|
675
780
|
UseKey extends true = true,
|
|
676
781
|
>(
|
|
@@ -687,21 +792,42 @@ export interface ClientInstance {
|
|
|
687
792
|
processResponse: ProcessResponseFunction<Result, ReqResult>
|
|
688
793
|
useKey: UseKey
|
|
689
794
|
useContext?: () => Context
|
|
795
|
+
onMutate?: (
|
|
796
|
+
variables: Util_FlatObject<
|
|
797
|
+
MutationArgs<Url, RequestSchema, QuerySchema>
|
|
798
|
+
>,
|
|
799
|
+
context: Context & MutationFunctionContext,
|
|
800
|
+
) => OnMutateResult | Promise<OnMutateResult>
|
|
690
801
|
onSuccess?: (
|
|
691
|
-
queryClient: QueryClient,
|
|
692
802
|
data: NoInfer<Result>,
|
|
693
803
|
variables: Util_FlatObject<
|
|
694
804
|
MutationArgs<Url, RequestSchema, QuerySchema>
|
|
695
805
|
>,
|
|
696
|
-
context: Context
|
|
806
|
+
context: Context &
|
|
807
|
+
MutationFunctionContext & {
|
|
808
|
+
onMutateResult: OnMutateResult | undefined
|
|
809
|
+
},
|
|
697
810
|
) => void | Promise<void>
|
|
698
811
|
onError?: (
|
|
699
|
-
queryClient: QueryClient,
|
|
700
812
|
error: Error,
|
|
701
813
|
variables: Util_FlatObject<
|
|
702
814
|
MutationArgs<Url, RequestSchema, QuerySchema>
|
|
703
815
|
>,
|
|
704
|
-
context: Context
|
|
816
|
+
context: Context &
|
|
817
|
+
MutationFunctionContext & {
|
|
818
|
+
onMutateResult: OnMutateResult | undefined
|
|
819
|
+
},
|
|
820
|
+
) => void | Promise<void>
|
|
821
|
+
onSettled?: (
|
|
822
|
+
data: NoInfer<Result> | undefined,
|
|
823
|
+
error: Error | null,
|
|
824
|
+
variables: Util_FlatObject<
|
|
825
|
+
MutationArgs<Url, RequestSchema, QuerySchema>
|
|
826
|
+
>,
|
|
827
|
+
context: Context &
|
|
828
|
+
MutationFunctionContext & {
|
|
829
|
+
onMutateResult: OnMutateResult | undefined
|
|
830
|
+
},
|
|
705
831
|
) => void | Promise<void>
|
|
706
832
|
},
|
|
707
833
|
): ((
|
|
@@ -709,7 +835,8 @@ export interface ClientInstance {
|
|
|
709
835
|
) => UseMutationResult<
|
|
710
836
|
Result,
|
|
711
837
|
Error,
|
|
712
|
-
MutationArgs<Url, RequestSchema, QuerySchema
|
|
838
|
+
MutationArgs<Url, RequestSchema, QuerySchema>,
|
|
839
|
+
OnMutateResult
|
|
713
840
|
>) &
|
|
714
841
|
MutationHelpers<Url, Result> &
|
|
715
842
|
EndpointHelper<Method, Url, RequestSchema, Response, QuerySchema>
|
|
@@ -721,6 +848,7 @@ export interface ClientInstance {
|
|
|
721
848
|
Response extends ZodType = ZodType,
|
|
722
849
|
ReqResult = z.output<Response>,
|
|
723
850
|
Result = unknown,
|
|
851
|
+
OnMutateResult = unknown,
|
|
724
852
|
Context = unknown,
|
|
725
853
|
UseKey extends true = true,
|
|
726
854
|
>(
|
|
@@ -737,17 +865,34 @@ export interface ClientInstance {
|
|
|
737
865
|
processResponse: ProcessResponseFunction<Result, ReqResult>
|
|
738
866
|
useKey: UseKey
|
|
739
867
|
useContext?: () => Context
|
|
868
|
+
onMutate?: (
|
|
869
|
+
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
|
|
870
|
+
context: Context & MutationFunctionContext,
|
|
871
|
+
) => OnMutateResult | Promise<OnMutateResult>
|
|
740
872
|
onSuccess?: (
|
|
741
|
-
queryClient: QueryClient,
|
|
742
873
|
data: NoInfer<Result>,
|
|
743
874
|
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
|
|
744
|
-
context: Context
|
|
875
|
+
context: Context &
|
|
876
|
+
MutationFunctionContext & {
|
|
877
|
+
onMutateResult: OnMutateResult | undefined
|
|
878
|
+
},
|
|
745
879
|
) => void | Promise<void>
|
|
746
880
|
onError?: (
|
|
747
|
-
queryClient: QueryClient,
|
|
748
881
|
error: Error,
|
|
749
882
|
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
|
|
750
|
-
context: Context
|
|
883
|
+
context: Context &
|
|
884
|
+
MutationFunctionContext & {
|
|
885
|
+
onMutateResult: OnMutateResult | undefined
|
|
886
|
+
},
|
|
887
|
+
) => void | Promise<void>
|
|
888
|
+
onSettled?: (
|
|
889
|
+
data: NoInfer<Result> | undefined,
|
|
890
|
+
error: Error | null,
|
|
891
|
+
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
|
|
892
|
+
context: Context &
|
|
893
|
+
MutationFunctionContext & {
|
|
894
|
+
onMutateResult: OnMutateResult | undefined
|
|
895
|
+
},
|
|
751
896
|
) => void | Promise<void>
|
|
752
897
|
},
|
|
753
898
|
): ((
|
|
@@ -755,7 +900,8 @@ export interface ClientInstance {
|
|
|
755
900
|
) => UseMutationResult<
|
|
756
901
|
Result,
|
|
757
902
|
Error,
|
|
758
|
-
MutationArgs<Url, RequestSchema, undefined
|
|
903
|
+
MutationArgs<Url, RequestSchema, undefined>,
|
|
904
|
+
OnMutateResult
|
|
759
905
|
>) &
|
|
760
906
|
MutationHelpers<Url, Result> &
|
|
761
907
|
EndpointHelper<Method, Url, RequestSchema, Response, undefined>
|
|
@@ -768,6 +914,7 @@ export interface ClientInstance {
|
|
|
768
914
|
Response extends ZodType = ZodType,
|
|
769
915
|
ReqResult = z.output<Response>,
|
|
770
916
|
Result = unknown,
|
|
917
|
+
OnMutateResult = unknown,
|
|
771
918
|
Context = unknown,
|
|
772
919
|
>(
|
|
773
920
|
endpoint: {
|
|
@@ -782,27 +929,49 @@ export interface ClientInstance {
|
|
|
782
929
|
mutationOptions: {
|
|
783
930
|
processResponse: ProcessResponseFunction<Result, ReqResult>
|
|
784
931
|
useContext?: () => Context
|
|
932
|
+
onMutate?: (
|
|
933
|
+
variables: Util_FlatObject<
|
|
934
|
+
MutationArgs<Url, RequestSchema, QuerySchema>
|
|
935
|
+
>,
|
|
936
|
+
context: Context & MutationFunctionContext,
|
|
937
|
+
) => OnMutateResult | Promise<OnMutateResult>
|
|
785
938
|
onSuccess?: (
|
|
786
|
-
queryClient: QueryClient,
|
|
787
939
|
data: NoInfer<Result>,
|
|
788
940
|
variables: Util_FlatObject<
|
|
789
941
|
MutationArgs<Url, RequestSchema, QuerySchema>
|
|
790
942
|
>,
|
|
791
|
-
context: Context
|
|
943
|
+
context: Context &
|
|
944
|
+
MutationFunctionContext & {
|
|
945
|
+
onMutateResult: OnMutateResult | undefined
|
|
946
|
+
},
|
|
792
947
|
) => void | Promise<void>
|
|
793
948
|
onError?: (
|
|
794
|
-
queryClient: QueryClient,
|
|
795
949
|
error: Error,
|
|
796
950
|
variables: Util_FlatObject<
|
|
797
951
|
MutationArgs<Url, RequestSchema, QuerySchema>
|
|
798
952
|
>,
|
|
799
|
-
context: Context
|
|
953
|
+
context: Context &
|
|
954
|
+
MutationFunctionContext & {
|
|
955
|
+
onMutateResult: OnMutateResult | undefined
|
|
956
|
+
},
|
|
957
|
+
) => void | Promise<void>
|
|
958
|
+
onSettled?: (
|
|
959
|
+
data: NoInfer<Result> | undefined,
|
|
960
|
+
error: Error | null,
|
|
961
|
+
variables: Util_FlatObject<
|
|
962
|
+
MutationArgs<Url, RequestSchema, QuerySchema>
|
|
963
|
+
>,
|
|
964
|
+
context: Context &
|
|
965
|
+
MutationFunctionContext & {
|
|
966
|
+
onMutateResult: OnMutateResult | undefined
|
|
967
|
+
},
|
|
800
968
|
) => void | Promise<void>
|
|
801
969
|
},
|
|
802
970
|
): (() => UseMutationResult<
|
|
803
971
|
Result,
|
|
804
972
|
Error,
|
|
805
|
-
MutationArgs<Url, RequestSchema, QuerySchema
|
|
973
|
+
MutationArgs<Url, RequestSchema, QuerySchema>,
|
|
974
|
+
OnMutateResult
|
|
806
975
|
>) &
|
|
807
976
|
EndpointHelper<Method, Url, RequestSchema, Response, QuerySchema>
|
|
808
977
|
|
|
@@ -813,6 +982,7 @@ export interface ClientInstance {
|
|
|
813
982
|
Response extends ZodType = ZodType,
|
|
814
983
|
ReqResult = z.output<Response>,
|
|
815
984
|
Result = unknown,
|
|
985
|
+
OnMutateResult = unknown,
|
|
816
986
|
Context = unknown,
|
|
817
987
|
>(
|
|
818
988
|
endpoint: {
|
|
@@ -827,23 +997,41 @@ export interface ClientInstance {
|
|
|
827
997
|
mutationOptions: {
|
|
828
998
|
processResponse: ProcessResponseFunction<Result, ReqResult>
|
|
829
999
|
useContext?: () => Context
|
|
1000
|
+
onMutate?: (
|
|
1001
|
+
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
|
|
1002
|
+
context: Context & MutationFunctionContext,
|
|
1003
|
+
) => OnMutateResult | Promise<OnMutateResult>
|
|
830
1004
|
onSuccess?: (
|
|
831
|
-
queryClient: QueryClient,
|
|
832
1005
|
data: NoInfer<Result>,
|
|
833
1006
|
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
|
|
834
|
-
context: Context
|
|
1007
|
+
context: Context &
|
|
1008
|
+
MutationFunctionContext & {
|
|
1009
|
+
onMutateResult: OnMutateResult | undefined
|
|
1010
|
+
},
|
|
835
1011
|
) => void | Promise<void>
|
|
836
1012
|
onError?: (
|
|
837
|
-
queryClient: QueryClient,
|
|
838
1013
|
error: Error,
|
|
839
1014
|
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
|
|
840
|
-
context: Context
|
|
1015
|
+
context: Context &
|
|
1016
|
+
MutationFunctionContext & {
|
|
1017
|
+
onMutateResult: OnMutateResult | undefined
|
|
1018
|
+
},
|
|
1019
|
+
) => void | Promise<void>
|
|
1020
|
+
onSettled?: (
|
|
1021
|
+
data: NoInfer<Result> | undefined,
|
|
1022
|
+
error: Error | null,
|
|
1023
|
+
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
|
|
1024
|
+
context: Context &
|
|
1025
|
+
MutationFunctionContext & {
|
|
1026
|
+
onMutateResult: OnMutateResult | undefined
|
|
1027
|
+
},
|
|
841
1028
|
) => void | Promise<void>
|
|
842
1029
|
},
|
|
843
1030
|
): (() => UseMutationResult<
|
|
844
1031
|
Result,
|
|
845
1032
|
Error,
|
|
846
|
-
MutationArgs<Url, RequestSchema, undefined
|
|
1033
|
+
MutationArgs<Url, RequestSchema, undefined>,
|
|
1034
|
+
OnMutateResult
|
|
847
1035
|
>) &
|
|
848
1036
|
EndpointHelper<Method, Url, RequestSchema, Response, undefined>
|
|
849
1037
|
|
|
@@ -858,6 +1046,7 @@ export interface ClientInstance {
|
|
|
858
1046
|
Response extends ZodType = ZodType,
|
|
859
1047
|
ReqResult = z.output<Response>,
|
|
860
1048
|
Result = unknown,
|
|
1049
|
+
OnMutateResult = unknown,
|
|
861
1050
|
Context = unknown,
|
|
862
1051
|
UseKey extends true = true,
|
|
863
1052
|
>(
|
|
@@ -868,23 +1057,41 @@ export interface ClientInstance {
|
|
|
868
1057
|
processResponse: ProcessResponseFunction<Result, ReqResult>
|
|
869
1058
|
useKey: UseKey
|
|
870
1059
|
useContext?: () => Context
|
|
1060
|
+
onMutate?: (
|
|
1061
|
+
variables: Util_FlatObject<MutationArgs<Url, undefined, QuerySchema>>,
|
|
1062
|
+
context: Context & MutationFunctionContext,
|
|
1063
|
+
) => OnMutateResult | Promise<OnMutateResult>
|
|
871
1064
|
onSuccess?: (
|
|
872
|
-
queryClient: QueryClient,
|
|
873
1065
|
data: NoInfer<Result>,
|
|
874
1066
|
variables: Util_FlatObject<MutationArgs<Url, undefined, QuerySchema>>,
|
|
875
|
-
context: Context
|
|
1067
|
+
context: Context &
|
|
1068
|
+
MutationFunctionContext & {
|
|
1069
|
+
onMutateResult: OnMutateResult | undefined
|
|
1070
|
+
},
|
|
876
1071
|
) => void | Promise<void>
|
|
877
1072
|
onError?: (
|
|
878
|
-
queryClient: QueryClient,
|
|
879
1073
|
error: Error,
|
|
880
1074
|
variables: Util_FlatObject<MutationArgs<Url, undefined, QuerySchema>>,
|
|
881
|
-
context: Context
|
|
1075
|
+
context: Context &
|
|
1076
|
+
MutationFunctionContext & {
|
|
1077
|
+
onMutateResult: OnMutateResult | undefined
|
|
1078
|
+
},
|
|
1079
|
+
) => void | Promise<void>
|
|
1080
|
+
onSettled?: (
|
|
1081
|
+
data: NoInfer<Result> | undefined,
|
|
1082
|
+
error: Error | null,
|
|
1083
|
+
variables: Util_FlatObject<MutationArgs<Url, undefined, QuerySchema>>,
|
|
1084
|
+
context: Context &
|
|
1085
|
+
MutationFunctionContext & {
|
|
1086
|
+
onMutateResult: OnMutateResult | undefined
|
|
1087
|
+
},
|
|
882
1088
|
) => void | Promise<void>
|
|
883
1089
|
},
|
|
884
1090
|
): (() => UseMutationResult<
|
|
885
1091
|
Result,
|
|
886
1092
|
Error,
|
|
887
|
-
MutationArgs<Url, undefined, QuerySchema
|
|
1093
|
+
MutationArgs<Url, undefined, QuerySchema>,
|
|
1094
|
+
OnMutateResult
|
|
888
1095
|
>) &
|
|
889
1096
|
MutationHelpers<Url, Result> &
|
|
890
1097
|
EndpointHelper<Method, Url, undefined, Response, QuerySchema>
|
|
@@ -895,6 +1102,7 @@ export interface ClientInstance {
|
|
|
895
1102
|
Response extends ZodType = ZodType,
|
|
896
1103
|
ReqResult = z.output<Response>,
|
|
897
1104
|
Result = unknown,
|
|
1105
|
+
OnMutateResult = unknown,
|
|
898
1106
|
Context = unknown,
|
|
899
1107
|
UseKey extends true = true,
|
|
900
1108
|
>(
|
|
@@ -905,17 +1113,34 @@ export interface ClientInstance {
|
|
|
905
1113
|
processResponse: ProcessResponseFunction<Result, ReqResult>
|
|
906
1114
|
useKey: UseKey
|
|
907
1115
|
useContext?: () => Context
|
|
1116
|
+
onMutate?: (
|
|
1117
|
+
variables: Util_FlatObject<MutationArgs<Url, undefined, undefined>>,
|
|
1118
|
+
context: Context & MutationFunctionContext,
|
|
1119
|
+
) => OnMutateResult | Promise<OnMutateResult>
|
|
908
1120
|
onSuccess?: (
|
|
909
|
-
queryClient: QueryClient,
|
|
910
1121
|
data: NoInfer<Result>,
|
|
911
1122
|
variables: Util_FlatObject<MutationArgs<Url, undefined, undefined>>,
|
|
912
|
-
context: Context
|
|
1123
|
+
context: Context &
|
|
1124
|
+
MutationFunctionContext & {
|
|
1125
|
+
onMutateResult: OnMutateResult | undefined
|
|
1126
|
+
},
|
|
913
1127
|
) => void | Promise<void>
|
|
914
1128
|
onError?: (
|
|
915
|
-
queryClient: QueryClient,
|
|
916
1129
|
error: Error,
|
|
917
1130
|
variables: Util_FlatObject<MutationArgs<Url, undefined, undefined>>,
|
|
918
|
-
context: Context
|
|
1131
|
+
context: Context &
|
|
1132
|
+
MutationFunctionContext & {
|
|
1133
|
+
onMutateResult: OnMutateResult | undefined
|
|
1134
|
+
},
|
|
1135
|
+
) => void | Promise<void>
|
|
1136
|
+
onSettled?: (
|
|
1137
|
+
data: NoInfer<Result> | undefined,
|
|
1138
|
+
error: Error | null,
|
|
1139
|
+
variables: Util_FlatObject<MutationArgs<Url, undefined, undefined>>,
|
|
1140
|
+
context: Context &
|
|
1141
|
+
MutationFunctionContext & {
|
|
1142
|
+
onMutateResult: OnMutateResult | undefined
|
|
1143
|
+
},
|
|
919
1144
|
) => void | Promise<void>
|
|
920
1145
|
},
|
|
921
1146
|
): ((
|
|
@@ -923,7 +1148,8 @@ export interface ClientInstance {
|
|
|
923
1148
|
) => UseMutationResult<
|
|
924
1149
|
Result,
|
|
925
1150
|
Error,
|
|
926
|
-
MutationArgs<Url, undefined, undefined
|
|
1151
|
+
MutationArgs<Url, undefined, undefined>,
|
|
1152
|
+
OnMutateResult
|
|
927
1153
|
>) &
|
|
928
1154
|
MutationHelpers<Url, Result> &
|
|
929
1155
|
EndpointHelper<Method, Url, undefined, Response, undefined>
|
|
@@ -935,6 +1161,7 @@ export interface ClientInstance {
|
|
|
935
1161
|
Response extends ZodType = ZodType,
|
|
936
1162
|
ReqResult = z.output<Response>,
|
|
937
1163
|
Result = unknown,
|
|
1164
|
+
OnMutateResult = unknown,
|
|
938
1165
|
Context = unknown,
|
|
939
1166
|
>(
|
|
940
1167
|
endpoint: {
|
|
@@ -943,23 +1170,41 @@ export interface ClientInstance {
|
|
|
943
1170
|
mutationOptions: {
|
|
944
1171
|
processResponse: ProcessResponseFunction<Result, ReqResult>
|
|
945
1172
|
useContext?: () => Context
|
|
1173
|
+
onMutate?: (
|
|
1174
|
+
variables: Util_FlatObject<MutationArgs<Url, undefined, QuerySchema>>,
|
|
1175
|
+
context: Context & MutationFunctionContext,
|
|
1176
|
+
) => OnMutateResult | Promise<OnMutateResult>
|
|
946
1177
|
onSuccess?: (
|
|
947
|
-
queryClient: QueryClient,
|
|
948
1178
|
data: NoInfer<Result>,
|
|
949
1179
|
variables: Util_FlatObject<MutationArgs<Url, undefined, QuerySchema>>,
|
|
950
|
-
context: Context
|
|
1180
|
+
context: Context &
|
|
1181
|
+
MutationFunctionContext & {
|
|
1182
|
+
onMutateResult: OnMutateResult | undefined
|
|
1183
|
+
},
|
|
951
1184
|
) => void | Promise<void>
|
|
952
1185
|
onError?: (
|
|
953
|
-
queryClient: QueryClient,
|
|
954
1186
|
error: Error,
|
|
955
1187
|
variables: Util_FlatObject<MutationArgs<Url, undefined, QuerySchema>>,
|
|
956
|
-
context: Context
|
|
1188
|
+
context: Context &
|
|
1189
|
+
MutationFunctionContext & {
|
|
1190
|
+
onMutateResult: OnMutateResult | undefined
|
|
1191
|
+
},
|
|
1192
|
+
) => void | Promise<void>
|
|
1193
|
+
onSettled?: (
|
|
1194
|
+
data: NoInfer<Result> | undefined,
|
|
1195
|
+
error: Error | null,
|
|
1196
|
+
variables: Util_FlatObject<MutationArgs<Url, undefined, QuerySchema>>,
|
|
1197
|
+
context: Context &
|
|
1198
|
+
MutationFunctionContext & {
|
|
1199
|
+
onMutateResult: OnMutateResult | undefined
|
|
1200
|
+
},
|
|
957
1201
|
) => void | Promise<void>
|
|
958
1202
|
},
|
|
959
1203
|
): (() => UseMutationResult<
|
|
960
1204
|
Result,
|
|
961
1205
|
Error,
|
|
962
|
-
MutationArgs<Url, undefined, QuerySchema
|
|
1206
|
+
MutationArgs<Url, undefined, QuerySchema>,
|
|
1207
|
+
OnMutateResult
|
|
963
1208
|
>) &
|
|
964
1209
|
EndpointHelper<Method, Url, undefined, Response, QuerySchema>
|
|
965
1210
|
|
|
@@ -969,6 +1214,7 @@ export interface ClientInstance {
|
|
|
969
1214
|
Response extends ZodType = ZodType,
|
|
970
1215
|
ReqResult = z.output<Response>,
|
|
971
1216
|
Result = unknown,
|
|
1217
|
+
OnMutateResult = unknown,
|
|
972
1218
|
Context = unknown,
|
|
973
1219
|
>(
|
|
974
1220
|
endpoint: {
|
|
@@ -977,23 +1223,41 @@ export interface ClientInstance {
|
|
|
977
1223
|
mutationOptions: {
|
|
978
1224
|
processResponse: ProcessResponseFunction<Result, ReqResult>
|
|
979
1225
|
useContext?: () => Context
|
|
1226
|
+
onMutate?: (
|
|
1227
|
+
variables: Util_FlatObject<MutationArgs<Url, undefined, undefined>>,
|
|
1228
|
+
context: Context & MutationFunctionContext,
|
|
1229
|
+
) => OnMutateResult | Promise<OnMutateResult>
|
|
980
1230
|
onSuccess?: (
|
|
981
|
-
queryClient: QueryClient,
|
|
982
1231
|
data: NoInfer<Result>,
|
|
983
1232
|
variables: Util_FlatObject<MutationArgs<Url, undefined, undefined>>,
|
|
984
|
-
context: Context
|
|
1233
|
+
context: Context &
|
|
1234
|
+
MutationFunctionContext & {
|
|
1235
|
+
onMutateResult: OnMutateResult | undefined
|
|
1236
|
+
},
|
|
985
1237
|
) => void | Promise<void>
|
|
986
1238
|
onError?: (
|
|
987
|
-
queryClient: QueryClient,
|
|
988
1239
|
error: Error,
|
|
989
1240
|
variables: Util_FlatObject<MutationArgs<Url, undefined, undefined>>,
|
|
990
|
-
context: Context
|
|
1241
|
+
context: Context &
|
|
1242
|
+
MutationFunctionContext & {
|
|
1243
|
+
onMutateResult: OnMutateResult | undefined
|
|
1244
|
+
},
|
|
1245
|
+
) => void | Promise<void>
|
|
1246
|
+
onSettled?: (
|
|
1247
|
+
data: NoInfer<Result> | undefined,
|
|
1248
|
+
error: Error | null,
|
|
1249
|
+
variables: Util_FlatObject<MutationArgs<Url, undefined, undefined>>,
|
|
1250
|
+
context: Context &
|
|
1251
|
+
MutationFunctionContext & {
|
|
1252
|
+
onMutateResult: OnMutateResult | undefined
|
|
1253
|
+
},
|
|
991
1254
|
) => void | Promise<void>
|
|
992
1255
|
},
|
|
993
1256
|
): (() => UseMutationResult<
|
|
994
1257
|
Result,
|
|
995
1258
|
Error,
|
|
996
|
-
MutationArgs<Url, undefined, undefined
|
|
1259
|
+
MutationArgs<Url, undefined, undefined>,
|
|
1260
|
+
OnMutateResult
|
|
997
1261
|
>) &
|
|
998
1262
|
EndpointHelper<Method, Url, undefined, Response, undefined>
|
|
999
1263
|
|
|
@@ -1009,6 +1273,7 @@ export interface ClientInstance {
|
|
|
1009
1273
|
Response extends ZodType = ZodType,
|
|
1010
1274
|
ReqResult = z.output<Response>,
|
|
1011
1275
|
Result = unknown,
|
|
1276
|
+
OnMutateResult = unknown,
|
|
1012
1277
|
Context = unknown,
|
|
1013
1278
|
UseKey extends true = true,
|
|
1014
1279
|
>(config: {
|
|
@@ -1020,24 +1285,36 @@ export interface ClientInstance {
|
|
|
1020
1285
|
responseSchema: Response
|
|
1021
1286
|
processResponse: ProcessResponseFunction<Result, ReqResult>
|
|
1022
1287
|
useContext?: () => Context
|
|
1288
|
+
onMutate?: (
|
|
1289
|
+
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, QuerySchema>>,
|
|
1290
|
+
context: Context & MutationFunctionContext,
|
|
1291
|
+
) => OnMutateResult | Promise<OnMutateResult>
|
|
1023
1292
|
onSuccess?: (
|
|
1024
|
-
queryClient: QueryClient,
|
|
1025
1293
|
data: NoInfer<Result>,
|
|
1026
1294
|
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, QuerySchema>>,
|
|
1027
|
-
context: Context
|
|
1295
|
+
context: Context &
|
|
1296
|
+
MutationFunctionContext & { onMutateResult: OnMutateResult | undefined },
|
|
1028
1297
|
) => void | Promise<void>
|
|
1029
1298
|
onError?: (
|
|
1030
|
-
queryClient: QueryClient,
|
|
1031
1299
|
error: Error,
|
|
1032
1300
|
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, QuerySchema>>,
|
|
1033
|
-
context: Context
|
|
1301
|
+
context: Context &
|
|
1302
|
+
MutationFunctionContext & { onMutateResult: OnMutateResult | undefined },
|
|
1303
|
+
) => void | Promise<void>
|
|
1304
|
+
onSettled?: (
|
|
1305
|
+
data: NoInfer<Result> | undefined,
|
|
1306
|
+
error: Error | null,
|
|
1307
|
+
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, QuerySchema>>,
|
|
1308
|
+
context: Context &
|
|
1309
|
+
MutationFunctionContext & { onMutateResult: OnMutateResult | undefined },
|
|
1034
1310
|
) => void | Promise<void>
|
|
1035
1311
|
}): ((
|
|
1036
1312
|
params: UrlHasParams<Url> extends true ? { urlParams: UrlParams<Url> } : {},
|
|
1037
1313
|
) => UseMutationResult<
|
|
1038
1314
|
Result,
|
|
1039
1315
|
Error,
|
|
1040
|
-
MutationArgs<Url, RequestSchema, QuerySchema
|
|
1316
|
+
MutationArgs<Url, RequestSchema, QuerySchema>,
|
|
1317
|
+
OnMutateResult
|
|
1041
1318
|
>) &
|
|
1042
1319
|
MutationHelpers<Url, Result> &
|
|
1043
1320
|
EndpointHelper<Method, Url, RequestSchema, Response, QuerySchema>
|
|
@@ -1050,6 +1327,7 @@ export interface ClientInstance {
|
|
|
1050
1327
|
Response extends ZodType = ZodType,
|
|
1051
1328
|
ReqResult = z.output<Response>,
|
|
1052
1329
|
Result = unknown,
|
|
1330
|
+
OnMutateResult = unknown,
|
|
1053
1331
|
Context = unknown,
|
|
1054
1332
|
>(config: {
|
|
1055
1333
|
method: Method
|
|
@@ -1059,22 +1337,34 @@ export interface ClientInstance {
|
|
|
1059
1337
|
responseSchema: Response
|
|
1060
1338
|
processResponse: ProcessResponseFunction<Result, ReqResult>
|
|
1061
1339
|
useContext?: () => Context
|
|
1340
|
+
onMutate?: (
|
|
1341
|
+
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, QuerySchema>>,
|
|
1342
|
+
context: Context & MutationFunctionContext,
|
|
1343
|
+
) => OnMutateResult | Promise<OnMutateResult>
|
|
1062
1344
|
onSuccess?: (
|
|
1063
|
-
queryClient: QueryClient,
|
|
1064
1345
|
data: NoInfer<Result>,
|
|
1065
1346
|
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, QuerySchema>>,
|
|
1066
|
-
context: Context
|
|
1347
|
+
context: Context &
|
|
1348
|
+
MutationFunctionContext & { onMutateResult: OnMutateResult | undefined },
|
|
1067
1349
|
) => void | Promise<void>
|
|
1068
1350
|
onError?: (
|
|
1069
|
-
queryClient: QueryClient,
|
|
1070
1351
|
error: Error,
|
|
1071
1352
|
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, QuerySchema>>,
|
|
1072
|
-
context: Context
|
|
1353
|
+
context: Context &
|
|
1354
|
+
MutationFunctionContext & { onMutateResult: OnMutateResult | undefined },
|
|
1355
|
+
) => void | Promise<void>
|
|
1356
|
+
onSettled?: (
|
|
1357
|
+
data: NoInfer<Result> | undefined,
|
|
1358
|
+
error: Error | null,
|
|
1359
|
+
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, QuerySchema>>,
|
|
1360
|
+
context: Context &
|
|
1361
|
+
MutationFunctionContext & { onMutateResult: OnMutateResult | undefined },
|
|
1073
1362
|
) => void | Promise<void>
|
|
1074
1363
|
}): (() => UseMutationResult<
|
|
1075
1364
|
Result,
|
|
1076
1365
|
Error,
|
|
1077
|
-
MutationArgs<Url, RequestSchema, QuerySchema
|
|
1366
|
+
MutationArgs<Url, RequestSchema, QuerySchema>,
|
|
1367
|
+
OnMutateResult
|
|
1078
1368
|
>) &
|
|
1079
1369
|
MutationHelpers<Url, Result> &
|
|
1080
1370
|
EndpointHelper<Method, Url, RequestSchema, Response, QuerySchema>
|
|
@@ -1086,6 +1376,7 @@ export interface ClientInstance {
|
|
|
1086
1376
|
Response extends ZodType = ZodType,
|
|
1087
1377
|
ReqResult = z.output<Response>,
|
|
1088
1378
|
Result = unknown,
|
|
1379
|
+
OnMutateResult = unknown,
|
|
1089
1380
|
Context = unknown,
|
|
1090
1381
|
>(config: {
|
|
1091
1382
|
method: Method
|
|
@@ -1094,22 +1385,34 @@ export interface ClientInstance {
|
|
|
1094
1385
|
responseSchema: Response
|
|
1095
1386
|
processResponse: ProcessResponseFunction<Result, ReqResult>
|
|
1096
1387
|
useContext?: () => Context
|
|
1388
|
+
onMutate?: (
|
|
1389
|
+
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
|
|
1390
|
+
context: Context & MutationFunctionContext,
|
|
1391
|
+
) => OnMutateResult | Promise<OnMutateResult>
|
|
1097
1392
|
onSuccess?: (
|
|
1098
|
-
queryClient: QueryClient,
|
|
1099
1393
|
data: NoInfer<Result>,
|
|
1100
1394
|
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
|
|
1101
|
-
context: Context
|
|
1395
|
+
context: Context &
|
|
1396
|
+
MutationFunctionContext & { onMutateResult: OnMutateResult | undefined },
|
|
1102
1397
|
) => void | Promise<void>
|
|
1103
1398
|
onError?: (
|
|
1104
|
-
queryClient: QueryClient,
|
|
1105
1399
|
error: Error,
|
|
1106
1400
|
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
|
|
1107
|
-
context: Context
|
|
1401
|
+
context: Context &
|
|
1402
|
+
MutationFunctionContext & { onMutateResult: OnMutateResult | undefined },
|
|
1403
|
+
) => void | Promise<void>
|
|
1404
|
+
onSettled?: (
|
|
1405
|
+
data: NoInfer<Result> | undefined,
|
|
1406
|
+
error: Error | null,
|
|
1407
|
+
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
|
|
1408
|
+
context: Context &
|
|
1409
|
+
MutationFunctionContext & { onMutateResult: OnMutateResult | undefined },
|
|
1108
1410
|
) => void | Promise<void>
|
|
1109
1411
|
}): (() => UseMutationResult<
|
|
1110
1412
|
Result,
|
|
1111
1413
|
Error,
|
|
1112
|
-
MutationArgs<Url, RequestSchema, undefined
|
|
1414
|
+
MutationArgs<Url, RequestSchema, undefined>,
|
|
1415
|
+
OnMutateResult
|
|
1113
1416
|
>) &
|
|
1114
1417
|
MutationHelpers<Url, Result> &
|
|
1115
1418
|
EndpointHelper<Method, Url, RequestSchema, Response>
|
|
@@ -1121,6 +1424,7 @@ export interface ClientInstance {
|
|
|
1121
1424
|
Response extends ZodType = ZodType,
|
|
1122
1425
|
ReqResult = z.output<Response>,
|
|
1123
1426
|
Result = unknown,
|
|
1427
|
+
OnMutateResult = unknown,
|
|
1124
1428
|
Context = unknown,
|
|
1125
1429
|
UseKey extends true = true,
|
|
1126
1430
|
>(config: {
|
|
@@ -1131,24 +1435,36 @@ export interface ClientInstance {
|
|
|
1131
1435
|
responseSchema: Response
|
|
1132
1436
|
processResponse: ProcessResponseFunction<Result, ReqResult>
|
|
1133
1437
|
useContext?: () => Context
|
|
1438
|
+
onMutate?: (
|
|
1439
|
+
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
|
|
1440
|
+
context: Context & MutationFunctionContext,
|
|
1441
|
+
) => OnMutateResult | Promise<OnMutateResult>
|
|
1134
1442
|
onSuccess?: (
|
|
1135
|
-
queryClient: QueryClient,
|
|
1136
1443
|
data: NoInfer<Result>,
|
|
1137
1444
|
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
|
|
1138
|
-
context: Context
|
|
1445
|
+
context: Context &
|
|
1446
|
+
MutationFunctionContext & { onMutateResult: OnMutateResult | undefined },
|
|
1139
1447
|
) => void | Promise<void>
|
|
1140
1448
|
onError?: (
|
|
1141
|
-
queryClient: QueryClient,
|
|
1142
1449
|
error: Error,
|
|
1143
1450
|
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
|
|
1144
|
-
context: Context
|
|
1451
|
+
context: Context &
|
|
1452
|
+
MutationFunctionContext & { onMutateResult: OnMutateResult | undefined },
|
|
1453
|
+
) => void | Promise<void>
|
|
1454
|
+
onSettled?: (
|
|
1455
|
+
data: NoInfer<Result> | undefined,
|
|
1456
|
+
error: Error | null,
|
|
1457
|
+
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
|
|
1458
|
+
context: Context &
|
|
1459
|
+
MutationFunctionContext & { onMutateResult: OnMutateResult | undefined },
|
|
1145
1460
|
) => void | Promise<void>
|
|
1146
1461
|
}): ((
|
|
1147
1462
|
params: UrlHasParams<Url> extends true ? { urlParams: UrlParams<Url> } : {},
|
|
1148
1463
|
) => UseMutationResult<
|
|
1149
1464
|
Result,
|
|
1150
1465
|
Error,
|
|
1151
|
-
MutationArgs<Url, RequestSchema, undefined
|
|
1466
|
+
MutationArgs<Url, RequestSchema, undefined>,
|
|
1467
|
+
OnMutateResult
|
|
1152
1468
|
>) &
|
|
1153
1469
|
MutationHelpers<Url, Result> &
|
|
1154
1470
|
EndpointHelper<Method, Url, RequestSchema, Response>
|
|
@@ -1164,6 +1480,7 @@ export interface ClientInstance {
|
|
|
1164
1480
|
RequestSchema extends ZodType = ZodType,
|
|
1165
1481
|
QuerySchema extends ZodObject = ZodObject,
|
|
1166
1482
|
Result = Blob,
|
|
1483
|
+
OnMutateResult = unknown,
|
|
1167
1484
|
Context = unknown,
|
|
1168
1485
|
UseKey extends true = true,
|
|
1169
1486
|
>(
|
|
@@ -1174,21 +1491,42 @@ export interface ClientInstance {
|
|
|
1174
1491
|
processResponse?: ProcessResponseFunction<Result, Blob>
|
|
1175
1492
|
useKey: UseKey
|
|
1176
1493
|
useContext?: () => Context
|
|
1494
|
+
onMutate?: (
|
|
1495
|
+
variables: Util_FlatObject<
|
|
1496
|
+
MutationArgs<Url, RequestSchema, QuerySchema>
|
|
1497
|
+
>,
|
|
1498
|
+
context: Context & MutationFunctionContext,
|
|
1499
|
+
) => OnMutateResult | Promise<OnMutateResult>
|
|
1177
1500
|
onSuccess?: (
|
|
1178
|
-
queryClient: QueryClient,
|
|
1179
1501
|
data: NoInfer<Result>,
|
|
1180
1502
|
variables: Util_FlatObject<
|
|
1181
1503
|
MutationArgs<Url, RequestSchema, QuerySchema>
|
|
1182
1504
|
>,
|
|
1183
|
-
context: Context
|
|
1505
|
+
context: Context &
|
|
1506
|
+
MutationFunctionContext & {
|
|
1507
|
+
onMutateResult: OnMutateResult | undefined
|
|
1508
|
+
},
|
|
1184
1509
|
) => void | Promise<void>
|
|
1185
1510
|
onError?: (
|
|
1186
|
-
queryClient: QueryClient,
|
|
1187
1511
|
error: Error,
|
|
1188
1512
|
variables: Util_FlatObject<
|
|
1189
1513
|
MutationArgs<Url, RequestSchema, QuerySchema>
|
|
1190
1514
|
>,
|
|
1191
|
-
context: Context
|
|
1515
|
+
context: Context &
|
|
1516
|
+
MutationFunctionContext & {
|
|
1517
|
+
onMutateResult: OnMutateResult | undefined
|
|
1518
|
+
},
|
|
1519
|
+
) => void | Promise<void>
|
|
1520
|
+
onSettled?: (
|
|
1521
|
+
data: NoInfer<Result> | undefined,
|
|
1522
|
+
error: Error | null,
|
|
1523
|
+
variables: Util_FlatObject<
|
|
1524
|
+
MutationArgs<Url, RequestSchema, QuerySchema>
|
|
1525
|
+
>,
|
|
1526
|
+
context: Context &
|
|
1527
|
+
MutationFunctionContext & {
|
|
1528
|
+
onMutateResult: OnMutateResult | undefined
|
|
1529
|
+
},
|
|
1192
1530
|
) => void | Promise<void>
|
|
1193
1531
|
},
|
|
1194
1532
|
): ((
|
|
@@ -1196,7 +1534,8 @@ export interface ClientInstance {
|
|
|
1196
1534
|
) => UseMutationResult<
|
|
1197
1535
|
Result,
|
|
1198
1536
|
Error,
|
|
1199
|
-
MutationArgs<Url, RequestSchema, QuerySchema
|
|
1537
|
+
MutationArgs<Url, RequestSchema, QuerySchema>,
|
|
1538
|
+
OnMutateResult
|
|
1200
1539
|
>) &
|
|
1201
1540
|
MutationHelpers<Url, Result> &
|
|
1202
1541
|
StreamHelper<Method, Url, RequestSchema, QuerySchema>
|
|
@@ -1208,6 +1547,7 @@ export interface ClientInstance {
|
|
|
1208
1547
|
RequestSchema extends ZodType = ZodType,
|
|
1209
1548
|
QuerySchema extends ZodObject = ZodObject,
|
|
1210
1549
|
Result = Blob,
|
|
1550
|
+
OnMutateResult = unknown,
|
|
1211
1551
|
Context = unknown,
|
|
1212
1552
|
>(
|
|
1213
1553
|
endpoint: {
|
|
@@ -1216,27 +1556,49 @@ export interface ClientInstance {
|
|
|
1216
1556
|
mutationOptions?: {
|
|
1217
1557
|
processResponse?: ProcessResponseFunction<Result, Blob>
|
|
1218
1558
|
useContext?: () => Context
|
|
1559
|
+
onMutate?: (
|
|
1560
|
+
variables: Util_FlatObject<
|
|
1561
|
+
MutationArgs<Url, RequestSchema, QuerySchema>
|
|
1562
|
+
>,
|
|
1563
|
+
context: Context & MutationFunctionContext,
|
|
1564
|
+
) => OnMutateResult | Promise<OnMutateResult>
|
|
1219
1565
|
onSuccess?: (
|
|
1220
|
-
queryClient: QueryClient,
|
|
1221
1566
|
data: NoInfer<Result>,
|
|
1222
1567
|
variables: Util_FlatObject<
|
|
1223
1568
|
MutationArgs<Url, RequestSchema, QuerySchema>
|
|
1224
1569
|
>,
|
|
1225
|
-
context: Context
|
|
1570
|
+
context: Context &
|
|
1571
|
+
MutationFunctionContext & {
|
|
1572
|
+
onMutateResult: OnMutateResult | undefined
|
|
1573
|
+
},
|
|
1226
1574
|
) => void | Promise<void>
|
|
1227
1575
|
onError?: (
|
|
1228
|
-
queryClient: QueryClient,
|
|
1229
1576
|
error: Error,
|
|
1230
1577
|
variables: Util_FlatObject<
|
|
1231
1578
|
MutationArgs<Url, RequestSchema, QuerySchema>
|
|
1232
1579
|
>,
|
|
1233
|
-
context: Context
|
|
1580
|
+
context: Context &
|
|
1581
|
+
MutationFunctionContext & {
|
|
1582
|
+
onMutateResult: OnMutateResult | undefined
|
|
1583
|
+
},
|
|
1584
|
+
) => void | Promise<void>
|
|
1585
|
+
onSettled?: (
|
|
1586
|
+
data: NoInfer<Result> | undefined,
|
|
1587
|
+
error: Error | null,
|
|
1588
|
+
variables: Util_FlatObject<
|
|
1589
|
+
MutationArgs<Url, RequestSchema, QuerySchema>
|
|
1590
|
+
>,
|
|
1591
|
+
context: Context &
|
|
1592
|
+
MutationFunctionContext & {
|
|
1593
|
+
onMutateResult: OnMutateResult | undefined
|
|
1594
|
+
},
|
|
1234
1595
|
) => void | Promise<void>
|
|
1235
1596
|
},
|
|
1236
1597
|
): (() => UseMutationResult<
|
|
1237
1598
|
Result,
|
|
1238
1599
|
Error,
|
|
1239
|
-
MutationArgs<Url, RequestSchema, QuerySchema
|
|
1600
|
+
MutationArgs<Url, RequestSchema, QuerySchema>,
|
|
1601
|
+
OnMutateResult
|
|
1240
1602
|
>) &
|
|
1241
1603
|
StreamHelper<Method, Url, RequestSchema, QuerySchema>
|
|
1242
1604
|
|
|
@@ -1246,6 +1608,7 @@ export interface ClientInstance {
|
|
|
1246
1608
|
Url extends string = string,
|
|
1247
1609
|
RequestSchema extends ZodType = ZodType,
|
|
1248
1610
|
Result = Blob,
|
|
1611
|
+
OnMutateResult = unknown,
|
|
1249
1612
|
Context = unknown,
|
|
1250
1613
|
UseKey extends true = true,
|
|
1251
1614
|
>(
|
|
@@ -1256,17 +1619,34 @@ export interface ClientInstance {
|
|
|
1256
1619
|
processResponse?: ProcessResponseFunction<Result, Blob>
|
|
1257
1620
|
useKey: UseKey
|
|
1258
1621
|
useContext?: () => Context
|
|
1622
|
+
onMutate?: (
|
|
1623
|
+
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
|
|
1624
|
+
context: Context & MutationFunctionContext,
|
|
1625
|
+
) => OnMutateResult | Promise<OnMutateResult>
|
|
1259
1626
|
onSuccess?: (
|
|
1260
|
-
queryClient: QueryClient,
|
|
1261
1627
|
data: NoInfer<Result>,
|
|
1262
1628
|
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
|
|
1263
|
-
context: Context
|
|
1629
|
+
context: Context &
|
|
1630
|
+
MutationFunctionContext & {
|
|
1631
|
+
onMutateResult: OnMutateResult | undefined
|
|
1632
|
+
},
|
|
1264
1633
|
) => void | Promise<void>
|
|
1265
1634
|
onError?: (
|
|
1266
|
-
queryClient: QueryClient,
|
|
1267
1635
|
error: Error,
|
|
1268
1636
|
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
|
|
1269
|
-
context: Context
|
|
1637
|
+
context: Context &
|
|
1638
|
+
MutationFunctionContext & {
|
|
1639
|
+
onMutateResult: OnMutateResult | undefined
|
|
1640
|
+
},
|
|
1641
|
+
) => void | Promise<void>
|
|
1642
|
+
onSettled?: (
|
|
1643
|
+
data: NoInfer<Result> | undefined,
|
|
1644
|
+
error: Error | null,
|
|
1645
|
+
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
|
|
1646
|
+
context: Context &
|
|
1647
|
+
MutationFunctionContext & {
|
|
1648
|
+
onMutateResult: OnMutateResult | undefined
|
|
1649
|
+
},
|
|
1270
1650
|
) => void | Promise<void>
|
|
1271
1651
|
},
|
|
1272
1652
|
): ((
|
|
@@ -1274,7 +1654,8 @@ export interface ClientInstance {
|
|
|
1274
1654
|
) => UseMutationResult<
|
|
1275
1655
|
Result,
|
|
1276
1656
|
Error,
|
|
1277
|
-
MutationArgs<Url, RequestSchema, undefined
|
|
1657
|
+
MutationArgs<Url, RequestSchema, undefined>,
|
|
1658
|
+
OnMutateResult
|
|
1278
1659
|
>) &
|
|
1279
1660
|
MutationHelpers<Url, Result> &
|
|
1280
1661
|
StreamHelper<Method, Url, RequestSchema, undefined>
|
|
@@ -1285,6 +1666,7 @@ export interface ClientInstance {
|
|
|
1285
1666
|
Url extends string = string,
|
|
1286
1667
|
RequestSchema extends ZodType = ZodType,
|
|
1287
1668
|
Result = Blob,
|
|
1669
|
+
OnMutateResult = unknown,
|
|
1288
1670
|
Context = unknown,
|
|
1289
1671
|
>(
|
|
1290
1672
|
endpoint: {
|
|
@@ -1293,23 +1675,41 @@ export interface ClientInstance {
|
|
|
1293
1675
|
mutationOptions?: {
|
|
1294
1676
|
processResponse?: ProcessResponseFunction<Result, Blob>
|
|
1295
1677
|
useContext?: () => Context
|
|
1678
|
+
onMutate?: (
|
|
1679
|
+
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
|
|
1680
|
+
context: Context & MutationFunctionContext,
|
|
1681
|
+
) => OnMutateResult | Promise<OnMutateResult>
|
|
1296
1682
|
onSuccess?: (
|
|
1297
|
-
queryClient: QueryClient,
|
|
1298
1683
|
data: NoInfer<Result>,
|
|
1299
1684
|
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
|
|
1300
|
-
context: Context
|
|
1685
|
+
context: Context &
|
|
1686
|
+
MutationFunctionContext & {
|
|
1687
|
+
onMutateResult: OnMutateResult | undefined
|
|
1688
|
+
},
|
|
1301
1689
|
) => void | Promise<void>
|
|
1302
1690
|
onError?: (
|
|
1303
|
-
queryClient: QueryClient,
|
|
1304
1691
|
error: Error,
|
|
1305
1692
|
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
|
|
1306
|
-
context: Context
|
|
1693
|
+
context: Context &
|
|
1694
|
+
MutationFunctionContext & {
|
|
1695
|
+
onMutateResult: OnMutateResult | undefined
|
|
1696
|
+
},
|
|
1697
|
+
) => void | Promise<void>
|
|
1698
|
+
onSettled?: (
|
|
1699
|
+
data: NoInfer<Result> | undefined,
|
|
1700
|
+
error: Error | null,
|
|
1701
|
+
variables: Util_FlatObject<MutationArgs<Url, RequestSchema, undefined>>,
|
|
1702
|
+
context: Context &
|
|
1703
|
+
MutationFunctionContext & {
|
|
1704
|
+
onMutateResult: OnMutateResult | undefined
|
|
1705
|
+
},
|
|
1307
1706
|
) => void | Promise<void>
|
|
1308
1707
|
},
|
|
1309
1708
|
): (() => UseMutationResult<
|
|
1310
1709
|
Result,
|
|
1311
1710
|
Error,
|
|
1312
|
-
MutationArgs<Url, RequestSchema, undefined
|
|
1711
|
+
MutationArgs<Url, RequestSchema, undefined>,
|
|
1712
|
+
OnMutateResult
|
|
1313
1713
|
>) &
|
|
1314
1714
|
StreamHelper<Method, Url, RequestSchema, undefined>
|
|
1315
1715
|
|
|
@@ -1319,6 +1719,7 @@ export interface ClientInstance {
|
|
|
1319
1719
|
Url extends string = string,
|
|
1320
1720
|
QuerySchema extends ZodObject = ZodObject,
|
|
1321
1721
|
Result = Blob,
|
|
1722
|
+
OnMutateResult = unknown,
|
|
1322
1723
|
Context = unknown,
|
|
1323
1724
|
UseKey extends true = true,
|
|
1324
1725
|
>(
|
|
@@ -1329,17 +1730,34 @@ export interface ClientInstance {
|
|
|
1329
1730
|
processResponse?: ProcessResponseFunction<Result, Blob>
|
|
1330
1731
|
useKey: UseKey
|
|
1331
1732
|
useContext?: () => Context
|
|
1733
|
+
onMutate?: (
|
|
1734
|
+
variables: Util_FlatObject<MutationArgs<Url, undefined, QuerySchema>>,
|
|
1735
|
+
context: Context & MutationFunctionContext,
|
|
1736
|
+
) => OnMutateResult | Promise<OnMutateResult>
|
|
1332
1737
|
onSuccess?: (
|
|
1333
|
-
queryClient: QueryClient,
|
|
1334
1738
|
data: NoInfer<Result>,
|
|
1335
1739
|
variables: Util_FlatObject<MutationArgs<Url, undefined, QuerySchema>>,
|
|
1336
|
-
context: Context
|
|
1740
|
+
context: Context &
|
|
1741
|
+
MutationFunctionContext & {
|
|
1742
|
+
onMutateResult: OnMutateResult | undefined
|
|
1743
|
+
},
|
|
1337
1744
|
) => void | Promise<void>
|
|
1338
1745
|
onError?: (
|
|
1339
|
-
queryClient: QueryClient,
|
|
1340
1746
|
error: Error,
|
|
1341
1747
|
variables: Util_FlatObject<MutationArgs<Url, undefined, QuerySchema>>,
|
|
1342
|
-
context: Context
|
|
1748
|
+
context: Context &
|
|
1749
|
+
MutationFunctionContext & {
|
|
1750
|
+
onMutateResult: OnMutateResult | undefined
|
|
1751
|
+
},
|
|
1752
|
+
) => void | Promise<void>
|
|
1753
|
+
onSettled?: (
|
|
1754
|
+
data: NoInfer<Result> | undefined,
|
|
1755
|
+
error: Error | null,
|
|
1756
|
+
variables: Util_FlatObject<MutationArgs<Url, undefined, QuerySchema>>,
|
|
1757
|
+
context: Context &
|
|
1758
|
+
MutationFunctionContext & {
|
|
1759
|
+
onMutateResult: OnMutateResult | undefined
|
|
1760
|
+
},
|
|
1343
1761
|
) => void | Promise<void>
|
|
1344
1762
|
},
|
|
1345
1763
|
): ((
|
|
@@ -1347,7 +1765,8 @@ export interface ClientInstance {
|
|
|
1347
1765
|
) => UseMutationResult<
|
|
1348
1766
|
Result,
|
|
1349
1767
|
Error,
|
|
1350
|
-
MutationArgs<Url, undefined, QuerySchema
|
|
1768
|
+
MutationArgs<Url, undefined, QuerySchema>,
|
|
1769
|
+
OnMutateResult
|
|
1351
1770
|
>) &
|
|
1352
1771
|
MutationHelpers<Url, Result> &
|
|
1353
1772
|
StreamHelper<Method, Url, undefined, QuerySchema>
|
|
@@ -1358,6 +1777,7 @@ export interface ClientInstance {
|
|
|
1358
1777
|
Url extends string = string,
|
|
1359
1778
|
QuerySchema extends ZodObject = ZodObject,
|
|
1360
1779
|
Result = Blob,
|
|
1780
|
+
OnMutateResult = unknown,
|
|
1361
1781
|
Context = unknown,
|
|
1362
1782
|
>(
|
|
1363
1783
|
endpoint: {
|
|
@@ -1366,23 +1786,41 @@ export interface ClientInstance {
|
|
|
1366
1786
|
mutationOptions?: {
|
|
1367
1787
|
processResponse?: ProcessResponseFunction<Result, Blob>
|
|
1368
1788
|
useContext?: () => Context
|
|
1789
|
+
onMutate?: (
|
|
1790
|
+
variables: Util_FlatObject<MutationArgs<Url, undefined, QuerySchema>>,
|
|
1791
|
+
context: Context & MutationFunctionContext,
|
|
1792
|
+
) => OnMutateResult | Promise<OnMutateResult>
|
|
1369
1793
|
onSuccess?: (
|
|
1370
|
-
queryClient: QueryClient,
|
|
1371
1794
|
data: NoInfer<Result>,
|
|
1372
1795
|
variables: Util_FlatObject<MutationArgs<Url, undefined, QuerySchema>>,
|
|
1373
|
-
context: Context
|
|
1796
|
+
context: Context &
|
|
1797
|
+
MutationFunctionContext & {
|
|
1798
|
+
onMutateResult: OnMutateResult | undefined
|
|
1799
|
+
},
|
|
1374
1800
|
) => void | Promise<void>
|
|
1375
1801
|
onError?: (
|
|
1376
|
-
queryClient: QueryClient,
|
|
1377
1802
|
error: Error,
|
|
1378
1803
|
variables: Util_FlatObject<MutationArgs<Url, undefined, QuerySchema>>,
|
|
1379
|
-
context: Context
|
|
1804
|
+
context: Context &
|
|
1805
|
+
MutationFunctionContext & {
|
|
1806
|
+
onMutateResult: OnMutateResult | undefined
|
|
1807
|
+
},
|
|
1808
|
+
) => void | Promise<void>
|
|
1809
|
+
onSettled?: (
|
|
1810
|
+
data: NoInfer<Result> | undefined,
|
|
1811
|
+
error: Error | null,
|
|
1812
|
+
variables: Util_FlatObject<MutationArgs<Url, undefined, QuerySchema>>,
|
|
1813
|
+
context: Context &
|
|
1814
|
+
MutationFunctionContext & {
|
|
1815
|
+
onMutateResult: OnMutateResult | undefined
|
|
1816
|
+
},
|
|
1380
1817
|
) => void | Promise<void>
|
|
1381
1818
|
},
|
|
1382
1819
|
): (() => UseMutationResult<
|
|
1383
1820
|
Result,
|
|
1384
1821
|
Error,
|
|
1385
|
-
MutationArgs<Url, undefined, QuerySchema
|
|
1822
|
+
MutationArgs<Url, undefined, QuerySchema>,
|
|
1823
|
+
OnMutateResult
|
|
1386
1824
|
>) &
|
|
1387
1825
|
StreamHelper<Method, Url, undefined, QuerySchema>
|
|
1388
1826
|
|
|
@@ -1391,6 +1829,7 @@ export interface ClientInstance {
|
|
|
1391
1829
|
Method extends 'GET' | 'DELETE' | 'OPTIONS' | 'HEAD' = 'GET',
|
|
1392
1830
|
Url extends string = string,
|
|
1393
1831
|
Result = Blob,
|
|
1832
|
+
OnMutateResult = unknown,
|
|
1394
1833
|
Context = unknown,
|
|
1395
1834
|
UseKey extends true = true,
|
|
1396
1835
|
>(
|
|
@@ -1401,17 +1840,34 @@ export interface ClientInstance {
|
|
|
1401
1840
|
processResponse?: ProcessResponseFunction<Result, Blob>
|
|
1402
1841
|
useKey: UseKey
|
|
1403
1842
|
useContext?: () => Context
|
|
1843
|
+
onMutate?: (
|
|
1844
|
+
variables: Util_FlatObject<MutationArgs<Url, undefined, undefined>>,
|
|
1845
|
+
context: Context & MutationFunctionContext,
|
|
1846
|
+
) => OnMutateResult | Promise<OnMutateResult>
|
|
1404
1847
|
onSuccess?: (
|
|
1405
|
-
queryClient: QueryClient,
|
|
1406
1848
|
data: NoInfer<Result>,
|
|
1407
1849
|
variables: Util_FlatObject<MutationArgs<Url, undefined, undefined>>,
|
|
1408
|
-
context: Context
|
|
1850
|
+
context: Context &
|
|
1851
|
+
MutationFunctionContext & {
|
|
1852
|
+
onMutateResult: OnMutateResult | undefined
|
|
1853
|
+
},
|
|
1409
1854
|
) => void | Promise<void>
|
|
1410
1855
|
onError?: (
|
|
1411
|
-
queryClient: QueryClient,
|
|
1412
1856
|
error: Error,
|
|
1413
1857
|
variables: Util_FlatObject<MutationArgs<Url, undefined, undefined>>,
|
|
1414
|
-
context: Context
|
|
1858
|
+
context: Context &
|
|
1859
|
+
MutationFunctionContext & {
|
|
1860
|
+
onMutateResult: OnMutateResult | undefined
|
|
1861
|
+
},
|
|
1862
|
+
) => void | Promise<void>
|
|
1863
|
+
onSettled?: (
|
|
1864
|
+
data: NoInfer<Result> | undefined,
|
|
1865
|
+
error: Error | null,
|
|
1866
|
+
variables: Util_FlatObject<MutationArgs<Url, undefined, undefined>>,
|
|
1867
|
+
context: Context &
|
|
1868
|
+
MutationFunctionContext & {
|
|
1869
|
+
onMutateResult: OnMutateResult | undefined
|
|
1870
|
+
},
|
|
1415
1871
|
) => void | Promise<void>
|
|
1416
1872
|
},
|
|
1417
1873
|
): ((
|
|
@@ -1419,7 +1875,8 @@ export interface ClientInstance {
|
|
|
1419
1875
|
) => UseMutationResult<
|
|
1420
1876
|
Result,
|
|
1421
1877
|
Error,
|
|
1422
|
-
MutationArgs<Url, undefined, undefined
|
|
1878
|
+
MutationArgs<Url, undefined, undefined>,
|
|
1879
|
+
OnMutateResult
|
|
1423
1880
|
>) &
|
|
1424
1881
|
MutationHelpers<Url, Result> &
|
|
1425
1882
|
StreamHelper<Method, Url, undefined, undefined>
|
|
@@ -1429,6 +1886,7 @@ export interface ClientInstance {
|
|
|
1429
1886
|
Method extends 'GET' | 'DELETE' | 'OPTIONS' | 'HEAD' = 'GET',
|
|
1430
1887
|
Url extends string = string,
|
|
1431
1888
|
Result = Blob,
|
|
1889
|
+
OnMutateResult = unknown,
|
|
1432
1890
|
Context = unknown,
|
|
1433
1891
|
>(
|
|
1434
1892
|
endpoint: {
|
|
@@ -1437,23 +1895,41 @@ export interface ClientInstance {
|
|
|
1437
1895
|
mutationOptions?: {
|
|
1438
1896
|
processResponse?: ProcessResponseFunction<Result, Blob>
|
|
1439
1897
|
useContext?: () => Context
|
|
1898
|
+
onMutate?: (
|
|
1899
|
+
variables: Util_FlatObject<MutationArgs<Url, undefined, undefined>>,
|
|
1900
|
+
context: Context & MutationFunctionContext,
|
|
1901
|
+
) => OnMutateResult | Promise<OnMutateResult>
|
|
1440
1902
|
onSuccess?: (
|
|
1441
|
-
queryClient: QueryClient,
|
|
1442
1903
|
data: NoInfer<Result>,
|
|
1443
1904
|
variables: Util_FlatObject<MutationArgs<Url, undefined, undefined>>,
|
|
1444
|
-
context: Context
|
|
1905
|
+
context: Context &
|
|
1906
|
+
MutationFunctionContext & {
|
|
1907
|
+
onMutateResult: OnMutateResult | undefined
|
|
1908
|
+
},
|
|
1445
1909
|
) => void | Promise<void>
|
|
1446
1910
|
onError?: (
|
|
1447
|
-
queryClient: QueryClient,
|
|
1448
1911
|
error: Error,
|
|
1449
1912
|
variables: Util_FlatObject<MutationArgs<Url, undefined, undefined>>,
|
|
1450
|
-
context: Context
|
|
1913
|
+
context: Context &
|
|
1914
|
+
MutationFunctionContext & {
|
|
1915
|
+
onMutateResult: OnMutateResult | undefined
|
|
1916
|
+
},
|
|
1917
|
+
) => void | Promise<void>
|
|
1918
|
+
onSettled?: (
|
|
1919
|
+
data: NoInfer<Result> | undefined,
|
|
1920
|
+
error: Error | null,
|
|
1921
|
+
variables: Util_FlatObject<MutationArgs<Url, undefined, undefined>>,
|
|
1922
|
+
context: Context &
|
|
1923
|
+
MutationFunctionContext & {
|
|
1924
|
+
onMutateResult: OnMutateResult | undefined
|
|
1925
|
+
},
|
|
1451
1926
|
) => void | Promise<void>
|
|
1452
1927
|
},
|
|
1453
1928
|
): (() => UseMutationResult<
|
|
1454
1929
|
Result,
|
|
1455
1930
|
Error,
|
|
1456
|
-
MutationArgs<Url, undefined, undefined
|
|
1931
|
+
MutationArgs<Url, undefined, undefined>,
|
|
1932
|
+
OnMutateResult
|
|
1457
1933
|
>) &
|
|
1458
1934
|
StreamHelper<Method, Url, undefined, undefined>
|
|
1459
1935
|
}
|