@singi-labs/sifa-sdk 0.12.71 → 0.12.73
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/index.cjs +23 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +23 -2
- package/dist/index.js.map +1 -1
- package/dist/query/hooks/index.cjs +201 -102
- package/dist/query/hooks/index.cjs.map +1 -1
- package/dist/query/hooks/index.js +201 -102
- package/dist/query/hooks/index.js.map +1 -1
- package/dist/query/index.cjs +209 -106
- package/dist/query/index.cjs.map +1 -1
- package/dist/query/index.js +209 -106
- package/dist/query/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -360,70 +360,80 @@ function useUpdateProfileSelf(ownerHandleOrDid, options) {
|
|
|
360
360
|
const config = useSifaConfig();
|
|
361
361
|
const queryClient = reactQuery.useQueryClient();
|
|
362
362
|
return reactQuery.useMutation({
|
|
363
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
364
|
+
// handler below and silently drop cache invalidation (#453).
|
|
365
|
+
...options,
|
|
363
366
|
mutationFn: (data) => updateProfileSelf(config, data),
|
|
364
367
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
365
368
|
if (result.success) {
|
|
366
369
|
await invalidateProfile(queryClient, ownerHandleOrDid);
|
|
367
370
|
}
|
|
368
371
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
369
|
-
}
|
|
370
|
-
...options
|
|
372
|
+
}
|
|
371
373
|
});
|
|
372
374
|
}
|
|
373
375
|
function useUpdateProfileOverride(ownerHandleOrDid, options) {
|
|
374
376
|
const config = useSifaConfig();
|
|
375
377
|
const queryClient = reactQuery.useQueryClient();
|
|
376
378
|
return reactQuery.useMutation({
|
|
379
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
380
|
+
// handler below and silently drop cache invalidation (#453).
|
|
381
|
+
...options,
|
|
377
382
|
mutationFn: (data) => updateProfileOverride(config, data),
|
|
378
383
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
379
384
|
if (result.success) {
|
|
380
385
|
await invalidateProfile(queryClient, ownerHandleOrDid);
|
|
381
386
|
}
|
|
382
387
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
383
|
-
}
|
|
384
|
-
...options
|
|
388
|
+
}
|
|
385
389
|
});
|
|
386
390
|
}
|
|
387
391
|
function useRefreshPds(ownerHandleOrDid, options) {
|
|
388
392
|
const config = useSifaConfig();
|
|
389
393
|
const queryClient = reactQuery.useQueryClient();
|
|
390
394
|
return reactQuery.useMutation({
|
|
395
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
396
|
+
// handler below and silently drop cache invalidation (#453).
|
|
397
|
+
...options,
|
|
391
398
|
mutationFn: () => refreshPds(config),
|
|
392
399
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
393
400
|
if (result.success) {
|
|
394
401
|
await invalidateProfile(queryClient, ownerHandleOrDid);
|
|
395
402
|
}
|
|
396
403
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
397
|
-
}
|
|
398
|
-
...options
|
|
404
|
+
}
|
|
399
405
|
});
|
|
400
406
|
}
|
|
401
407
|
function useUploadAvatar(ownerHandleOrDid, options) {
|
|
402
408
|
const config = useSifaConfig();
|
|
403
409
|
const queryClient = reactQuery.useQueryClient();
|
|
404
410
|
return reactQuery.useMutation({
|
|
411
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
412
|
+
// handler below and silently drop cache invalidation (#453).
|
|
413
|
+
...options,
|
|
405
414
|
mutationFn: (file) => uploadAvatar(config, file),
|
|
406
415
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
407
416
|
if (result.success) {
|
|
408
417
|
await invalidateProfile(queryClient, ownerHandleOrDid);
|
|
409
418
|
}
|
|
410
419
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
411
|
-
}
|
|
412
|
-
...options
|
|
420
|
+
}
|
|
413
421
|
});
|
|
414
422
|
}
|
|
415
423
|
function useDeleteAvatarOverride(ownerHandleOrDid, options) {
|
|
416
424
|
const config = useSifaConfig();
|
|
417
425
|
const queryClient = reactQuery.useQueryClient();
|
|
418
426
|
return reactQuery.useMutation({
|
|
427
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
428
|
+
// handler below and silently drop cache invalidation (#453).
|
|
429
|
+
...options,
|
|
419
430
|
mutationFn: () => deleteAvatarOverride(config),
|
|
420
431
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
421
432
|
if (result.success) {
|
|
422
433
|
await invalidateProfile(queryClient, ownerHandleOrDid);
|
|
423
434
|
}
|
|
424
435
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
425
|
-
}
|
|
426
|
-
...options
|
|
436
|
+
}
|
|
427
437
|
});
|
|
428
438
|
}
|
|
429
439
|
|
|
@@ -496,6 +506,9 @@ function useCreatePosition(ownerDid, options) {
|
|
|
496
506
|
const config = useSifaConfig();
|
|
497
507
|
const queryClient = reactQuery.useQueryClient();
|
|
498
508
|
return reactQuery.useMutation({
|
|
509
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
510
|
+
// handler below and silently drop cache invalidation (#453).
|
|
511
|
+
...options,
|
|
499
512
|
mutationFn: (data) => createPosition(config, data),
|
|
500
513
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
501
514
|
if (result.success) {
|
|
@@ -503,8 +516,7 @@ function useCreatePosition(ownerDid, options) {
|
|
|
503
516
|
await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.position.byOwner(ownerDid) });
|
|
504
517
|
}
|
|
505
518
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
506
|
-
}
|
|
507
|
-
...options
|
|
519
|
+
}
|
|
508
520
|
});
|
|
509
521
|
}
|
|
510
522
|
async function invalidatePositionCaches(queryClient, ownerHandleOrDid) {
|
|
@@ -519,84 +531,96 @@ function useUpdatePosition(ownerHandleOrDid, options) {
|
|
|
519
531
|
const config = useSifaConfig();
|
|
520
532
|
const queryClient = reactQuery.useQueryClient();
|
|
521
533
|
return reactQuery.useMutation({
|
|
534
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
535
|
+
// handler below and silently drop cache invalidation (#453).
|
|
536
|
+
...options,
|
|
522
537
|
mutationFn: ({ rkey, data }) => updatePosition(config, rkey, data),
|
|
523
538
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
524
539
|
if (result.success) {
|
|
525
540
|
await invalidatePositionCaches(queryClient, ownerHandleOrDid);
|
|
526
541
|
}
|
|
527
542
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
528
|
-
}
|
|
529
|
-
...options
|
|
543
|
+
}
|
|
530
544
|
});
|
|
531
545
|
}
|
|
532
546
|
function useDeletePosition(ownerHandleOrDid, options) {
|
|
533
547
|
const config = useSifaConfig();
|
|
534
548
|
const queryClient = reactQuery.useQueryClient();
|
|
535
549
|
return reactQuery.useMutation({
|
|
550
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
551
|
+
// handler below and silently drop cache invalidation (#453).
|
|
552
|
+
...options,
|
|
536
553
|
mutationFn: (rkey) => deletePosition(config, rkey),
|
|
537
554
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
538
555
|
if (result.success) {
|
|
539
556
|
await invalidatePositionCaches(queryClient, ownerHandleOrDid);
|
|
540
557
|
}
|
|
541
558
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
542
|
-
}
|
|
543
|
-
...options
|
|
559
|
+
}
|
|
544
560
|
});
|
|
545
561
|
}
|
|
546
562
|
function useSetPositionPrimary(ownerHandleOrDid, options) {
|
|
547
563
|
const config = useSifaConfig();
|
|
548
564
|
const queryClient = reactQuery.useQueryClient();
|
|
549
565
|
return reactQuery.useMutation({
|
|
566
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
567
|
+
// handler below and silently drop cache invalidation (#453).
|
|
568
|
+
...options,
|
|
550
569
|
mutationFn: (rkey) => setPositionPrimary(config, rkey),
|
|
551
570
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
552
571
|
if (result.success) {
|
|
553
572
|
await invalidatePositionCaches(queryClient, ownerHandleOrDid);
|
|
554
573
|
}
|
|
555
574
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
556
|
-
}
|
|
557
|
-
...options
|
|
575
|
+
}
|
|
558
576
|
});
|
|
559
577
|
}
|
|
560
578
|
function useUnsetPositionPrimary(ownerHandleOrDid, options) {
|
|
561
579
|
const config = useSifaConfig();
|
|
562
580
|
const queryClient = reactQuery.useQueryClient();
|
|
563
581
|
return reactQuery.useMutation({
|
|
582
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
583
|
+
// handler below and silently drop cache invalidation (#453).
|
|
584
|
+
...options,
|
|
564
585
|
mutationFn: (rkey) => unsetPositionPrimary(config, rkey),
|
|
565
586
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
566
587
|
if (result.success) {
|
|
567
588
|
await invalidatePositionCaches(queryClient, ownerHandleOrDid);
|
|
568
589
|
}
|
|
569
590
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
570
|
-
}
|
|
571
|
-
...options
|
|
591
|
+
}
|
|
572
592
|
});
|
|
573
593
|
}
|
|
574
594
|
function useLinkSkillToPosition(ownerHandleOrDid, options) {
|
|
575
595
|
const config = useSifaConfig();
|
|
576
596
|
const queryClient = reactQuery.useQueryClient();
|
|
577
597
|
return reactQuery.useMutation({
|
|
598
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
599
|
+
// handler below and silently drop cache invalidation (#453).
|
|
600
|
+
...options,
|
|
578
601
|
mutationFn: ({ position, skillRef }) => linkSkillToPosition(config, position, skillRef),
|
|
579
602
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
580
603
|
if (result.success) {
|
|
581
604
|
await invalidatePositionCaches(queryClient, ownerHandleOrDid);
|
|
582
605
|
}
|
|
583
606
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
584
|
-
}
|
|
585
|
-
...options
|
|
607
|
+
}
|
|
586
608
|
});
|
|
587
609
|
}
|
|
588
610
|
function useUnlinkSkillFromPosition(ownerHandleOrDid, options) {
|
|
589
611
|
const config = useSifaConfig();
|
|
590
612
|
const queryClient = reactQuery.useQueryClient();
|
|
591
613
|
return reactQuery.useMutation({
|
|
614
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
615
|
+
// handler below and silently drop cache invalidation (#453).
|
|
616
|
+
...options,
|
|
592
617
|
mutationFn: ({ position, skillRef }) => unlinkSkillFromPosition(config, position, skillRef),
|
|
593
618
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
594
619
|
if (result.success) {
|
|
595
620
|
await invalidatePositionCaches(queryClient, ownerHandleOrDid);
|
|
596
621
|
}
|
|
597
622
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
598
|
-
}
|
|
599
|
-
...options
|
|
623
|
+
}
|
|
600
624
|
});
|
|
601
625
|
}
|
|
602
626
|
|
|
@@ -624,42 +648,48 @@ function useCreateEducation(ownerHandleOrDid, options) {
|
|
|
624
648
|
const config = useSifaConfig();
|
|
625
649
|
const queryClient = reactQuery.useQueryClient();
|
|
626
650
|
return reactQuery.useMutation({
|
|
651
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
652
|
+
// handler below and silently drop cache invalidation (#453).
|
|
653
|
+
...options,
|
|
627
654
|
mutationFn: (data) => createEducation(config, data),
|
|
628
655
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
629
656
|
if (result.success) {
|
|
630
657
|
await invalidateProfile2(queryClient, ownerHandleOrDid);
|
|
631
658
|
}
|
|
632
659
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
633
|
-
}
|
|
634
|
-
...options
|
|
660
|
+
}
|
|
635
661
|
});
|
|
636
662
|
}
|
|
637
663
|
function useUpdateEducation(ownerHandleOrDid, options) {
|
|
638
664
|
const config = useSifaConfig();
|
|
639
665
|
const queryClient = reactQuery.useQueryClient();
|
|
640
666
|
return reactQuery.useMutation({
|
|
667
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
668
|
+
// handler below and silently drop cache invalidation (#453).
|
|
669
|
+
...options,
|
|
641
670
|
mutationFn: ({ rkey, data }) => updateEducation(config, rkey, data),
|
|
642
671
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
643
672
|
if (result.success) {
|
|
644
673
|
await invalidateProfile2(queryClient, ownerHandleOrDid);
|
|
645
674
|
}
|
|
646
675
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
647
|
-
}
|
|
648
|
-
...options
|
|
676
|
+
}
|
|
649
677
|
});
|
|
650
678
|
}
|
|
651
679
|
function useDeleteEducation(ownerHandleOrDid, options) {
|
|
652
680
|
const config = useSifaConfig();
|
|
653
681
|
const queryClient = reactQuery.useQueryClient();
|
|
654
682
|
return reactQuery.useMutation({
|
|
683
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
684
|
+
// handler below and silently drop cache invalidation (#453).
|
|
685
|
+
...options,
|
|
655
686
|
mutationFn: (rkey) => deleteEducation(config, rkey),
|
|
656
687
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
657
688
|
if (result.success) {
|
|
658
689
|
await invalidateProfile2(queryClient, ownerHandleOrDid);
|
|
659
690
|
}
|
|
660
691
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
661
|
-
}
|
|
662
|
-
...options
|
|
692
|
+
}
|
|
663
693
|
});
|
|
664
694
|
}
|
|
665
695
|
|
|
@@ -693,28 +723,32 @@ function useCreateSkill(ownerHandleOrDid, options) {
|
|
|
693
723
|
const config = useSifaConfig();
|
|
694
724
|
const queryClient = reactQuery.useQueryClient();
|
|
695
725
|
return reactQuery.useMutation({
|
|
726
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
727
|
+
// handler below and silently drop cache invalidation (#453).
|
|
728
|
+
...options,
|
|
696
729
|
mutationFn: (data) => createSkill(config, data),
|
|
697
730
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
698
731
|
if (result.success) {
|
|
699
732
|
await invalidateProfile3(queryClient, ownerHandleOrDid);
|
|
700
733
|
}
|
|
701
734
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
702
|
-
}
|
|
703
|
-
...options
|
|
735
|
+
}
|
|
704
736
|
});
|
|
705
737
|
}
|
|
706
738
|
function useUpdateSkill(ownerHandleOrDid, options) {
|
|
707
739
|
const config = useSifaConfig();
|
|
708
740
|
const queryClient = reactQuery.useQueryClient();
|
|
709
741
|
return reactQuery.useMutation({
|
|
742
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
743
|
+
// handler below and silently drop cache invalidation (#453).
|
|
744
|
+
...options,
|
|
710
745
|
mutationFn: ({ rkey, data }) => updateSkill(config, rkey, data),
|
|
711
746
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
712
747
|
if (result.success) {
|
|
713
748
|
await invalidateProfile3(queryClient, ownerHandleOrDid);
|
|
714
749
|
}
|
|
715
750
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
716
|
-
}
|
|
717
|
-
...options
|
|
751
|
+
}
|
|
718
752
|
});
|
|
719
753
|
}
|
|
720
754
|
function useUpdateSkillSubCategories(ownerHandleOrDid, options) {
|
|
@@ -739,14 +773,16 @@ function useDeleteSkill(ownerHandleOrDid, options) {
|
|
|
739
773
|
const config = useSifaConfig();
|
|
740
774
|
const queryClient = reactQuery.useQueryClient();
|
|
741
775
|
return reactQuery.useMutation({
|
|
776
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
777
|
+
// handler below and silently drop cache invalidation (#453).
|
|
778
|
+
...options,
|
|
742
779
|
mutationFn: (rkey) => deleteSkill(config, rkey),
|
|
743
780
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
744
781
|
if (result.success) {
|
|
745
782
|
await invalidateProfile3(queryClient, ownerHandleOrDid);
|
|
746
783
|
}
|
|
747
784
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
748
|
-
}
|
|
749
|
-
...options
|
|
785
|
+
}
|
|
750
786
|
});
|
|
751
787
|
}
|
|
752
788
|
|
|
@@ -778,42 +814,48 @@ function useCreateRecord(ownerHandleOrDid, options) {
|
|
|
778
814
|
const config = useSifaConfig();
|
|
779
815
|
const queryClient = reactQuery.useQueryClient();
|
|
780
816
|
return reactQuery.useMutation({
|
|
817
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
818
|
+
// handler below and silently drop cache invalidation (#453).
|
|
819
|
+
...options,
|
|
781
820
|
mutationFn: ({ collection, data }) => createRecord(config, collection, data),
|
|
782
821
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
783
822
|
if (result.success) {
|
|
784
823
|
await invalidateProfile4(queryClient, ownerHandleOrDid);
|
|
785
824
|
}
|
|
786
825
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
787
|
-
}
|
|
788
|
-
...options
|
|
826
|
+
}
|
|
789
827
|
});
|
|
790
828
|
}
|
|
791
829
|
function useUpdateRecord(ownerHandleOrDid, options) {
|
|
792
830
|
const config = useSifaConfig();
|
|
793
831
|
const queryClient = reactQuery.useQueryClient();
|
|
794
832
|
return reactQuery.useMutation({
|
|
833
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
834
|
+
// handler below and silently drop cache invalidation (#453).
|
|
835
|
+
...options,
|
|
795
836
|
mutationFn: ({ collection, rkey, data }) => updateRecord(config, collection, rkey, data),
|
|
796
837
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
797
838
|
if (result.success) {
|
|
798
839
|
await invalidateProfile4(queryClient, ownerHandleOrDid);
|
|
799
840
|
}
|
|
800
841
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
801
|
-
}
|
|
802
|
-
...options
|
|
842
|
+
}
|
|
803
843
|
});
|
|
804
844
|
}
|
|
805
845
|
function useDeleteRecord(ownerHandleOrDid, options) {
|
|
806
846
|
const config = useSifaConfig();
|
|
807
847
|
const queryClient = reactQuery.useQueryClient();
|
|
808
848
|
return reactQuery.useMutation({
|
|
849
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
850
|
+
// handler below and silently drop cache invalidation (#453).
|
|
851
|
+
...options,
|
|
809
852
|
mutationFn: ({ collection, rkey }) => deleteRecord(config, collection, rkey),
|
|
810
853
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
811
854
|
if (result.success) {
|
|
812
855
|
await invalidateProfile4(queryClient, ownerHandleOrDid);
|
|
813
856
|
}
|
|
814
857
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
815
|
-
}
|
|
816
|
-
...options
|
|
858
|
+
}
|
|
817
859
|
});
|
|
818
860
|
}
|
|
819
861
|
|
|
@@ -841,42 +883,48 @@ function useCreateProfileLocation(ownerHandleOrDid, options) {
|
|
|
841
883
|
const config = useSifaConfig();
|
|
842
884
|
const queryClient = reactQuery.useQueryClient();
|
|
843
885
|
return reactQuery.useMutation({
|
|
886
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
887
|
+
// handler below and silently drop cache invalidation (#453).
|
|
888
|
+
...options,
|
|
844
889
|
mutationFn: (data) => createProfileLocation(config, data),
|
|
845
890
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
846
891
|
if (result.success) {
|
|
847
892
|
await invalidateProfile5(queryClient, ownerHandleOrDid);
|
|
848
893
|
}
|
|
849
894
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
850
|
-
}
|
|
851
|
-
...options
|
|
895
|
+
}
|
|
852
896
|
});
|
|
853
897
|
}
|
|
854
898
|
function useUpdateProfileLocation(ownerHandleOrDid, options) {
|
|
855
899
|
const config = useSifaConfig();
|
|
856
900
|
const queryClient = reactQuery.useQueryClient();
|
|
857
901
|
return reactQuery.useMutation({
|
|
902
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
903
|
+
// handler below and silently drop cache invalidation (#453).
|
|
904
|
+
...options,
|
|
858
905
|
mutationFn: ({ rkey, data }) => updateProfileLocation(config, rkey, data),
|
|
859
906
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
860
907
|
if (result.success) {
|
|
861
908
|
await invalidateProfile5(queryClient, ownerHandleOrDid);
|
|
862
909
|
}
|
|
863
910
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
864
|
-
}
|
|
865
|
-
...options
|
|
911
|
+
}
|
|
866
912
|
});
|
|
867
913
|
}
|
|
868
914
|
function useDeleteProfileLocation(ownerHandleOrDid, options) {
|
|
869
915
|
const config = useSifaConfig();
|
|
870
916
|
const queryClient = reactQuery.useQueryClient();
|
|
871
917
|
return reactQuery.useMutation({
|
|
918
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
919
|
+
// handler below and silently drop cache invalidation (#453).
|
|
920
|
+
...options,
|
|
872
921
|
mutationFn: (rkey) => deleteProfileLocation(config, rkey),
|
|
873
922
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
874
923
|
if (result.success) {
|
|
875
924
|
await invalidateProfile5(queryClient, ownerHandleOrDid);
|
|
876
925
|
}
|
|
877
926
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
878
|
-
}
|
|
879
|
-
...options
|
|
927
|
+
}
|
|
880
928
|
});
|
|
881
929
|
}
|
|
882
930
|
|
|
@@ -962,84 +1010,96 @@ function useCreateExternalAccount(ownerHandleOrDid, options) {
|
|
|
962
1010
|
const config = useSifaConfig();
|
|
963
1011
|
const queryClient = reactQuery.useQueryClient();
|
|
964
1012
|
return reactQuery.useMutation({
|
|
1013
|
+
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
1014
|
+
// one below and silently drop cache invalidation (#453).
|
|
1015
|
+
...options,
|
|
965
1016
|
mutationFn: (data) => createExternalAccount(config, data),
|
|
966
1017
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
967
1018
|
if (result.success) {
|
|
968
1019
|
await invalidateProfileAndExternalAccounts(queryClient, ownerHandleOrDid);
|
|
969
1020
|
}
|
|
970
1021
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
971
|
-
}
|
|
972
|
-
...options
|
|
1022
|
+
}
|
|
973
1023
|
});
|
|
974
1024
|
}
|
|
975
1025
|
function useUpdateExternalAccount(ownerHandleOrDid, options) {
|
|
976
1026
|
const config = useSifaConfig();
|
|
977
1027
|
const queryClient = reactQuery.useQueryClient();
|
|
978
1028
|
return reactQuery.useMutation({
|
|
1029
|
+
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
1030
|
+
// one below and silently drop cache invalidation (#453).
|
|
1031
|
+
...options,
|
|
979
1032
|
mutationFn: ({ rkey, data }) => updateExternalAccount(config, rkey, data),
|
|
980
1033
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
981
1034
|
if (result.success) {
|
|
982
1035
|
await invalidateProfileAndExternalAccounts(queryClient, ownerHandleOrDid);
|
|
983
1036
|
}
|
|
984
1037
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
985
|
-
}
|
|
986
|
-
...options
|
|
1038
|
+
}
|
|
987
1039
|
});
|
|
988
1040
|
}
|
|
989
1041
|
function useDeleteExternalAccount(ownerHandleOrDid, options) {
|
|
990
1042
|
const config = useSifaConfig();
|
|
991
1043
|
const queryClient = reactQuery.useQueryClient();
|
|
992
1044
|
return reactQuery.useMutation({
|
|
1045
|
+
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
1046
|
+
// one below and silently drop cache invalidation (#453).
|
|
1047
|
+
...options,
|
|
993
1048
|
mutationFn: (rkey) => deleteExternalAccount(config, rkey),
|
|
994
1049
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
995
1050
|
if (result.success) {
|
|
996
1051
|
await invalidateProfileAndExternalAccounts(queryClient, ownerHandleOrDid);
|
|
997
1052
|
}
|
|
998
1053
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
999
|
-
}
|
|
1000
|
-
...options
|
|
1054
|
+
}
|
|
1001
1055
|
});
|
|
1002
1056
|
}
|
|
1003
1057
|
function useSetExternalAccountPrimary(ownerHandleOrDid, options) {
|
|
1004
1058
|
const config = useSifaConfig();
|
|
1005
1059
|
const queryClient = reactQuery.useQueryClient();
|
|
1006
1060
|
return reactQuery.useMutation({
|
|
1061
|
+
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
1062
|
+
// one below and silently drop cache invalidation (#453).
|
|
1063
|
+
...options,
|
|
1007
1064
|
mutationFn: (rkey) => setExternalAccountPrimary(config, rkey),
|
|
1008
1065
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1009
1066
|
if (result.success) {
|
|
1010
1067
|
await invalidateProfileAndExternalAccounts(queryClient, ownerHandleOrDid);
|
|
1011
1068
|
}
|
|
1012
1069
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1013
|
-
}
|
|
1014
|
-
...options
|
|
1070
|
+
}
|
|
1015
1071
|
});
|
|
1016
1072
|
}
|
|
1017
1073
|
function useUnsetExternalAccountPrimary(ownerHandleOrDid, options) {
|
|
1018
1074
|
const config = useSifaConfig();
|
|
1019
1075
|
const queryClient = reactQuery.useQueryClient();
|
|
1020
1076
|
return reactQuery.useMutation({
|
|
1077
|
+
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
1078
|
+
// one below and silently drop cache invalidation (#453).
|
|
1079
|
+
...options,
|
|
1021
1080
|
mutationFn: (rkey) => unsetExternalAccountPrimary(config, rkey),
|
|
1022
1081
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1023
1082
|
if (result.success) {
|
|
1024
1083
|
await invalidateProfileAndExternalAccounts(queryClient, ownerHandleOrDid);
|
|
1025
1084
|
}
|
|
1026
1085
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1027
|
-
}
|
|
1028
|
-
...options
|
|
1086
|
+
}
|
|
1029
1087
|
});
|
|
1030
1088
|
}
|
|
1031
1089
|
function useVerifyExternalAccount(ownerHandleOrDid, options) {
|
|
1032
1090
|
const config = useSifaConfig();
|
|
1033
1091
|
const queryClient = reactQuery.useQueryClient();
|
|
1034
1092
|
return reactQuery.useMutation({
|
|
1093
|
+
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
1094
|
+
// one below and silently drop cache invalidation (#453).
|
|
1095
|
+
...options,
|
|
1035
1096
|
mutationFn: (rkey) => verifyExternalAccount(config, rkey),
|
|
1036
1097
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1037
1098
|
if (result.success) {
|
|
1038
1099
|
await invalidateProfileAndExternalAccounts(queryClient, ownerHandleOrDid);
|
|
1039
1100
|
}
|
|
1040
1101
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1041
|
-
}
|
|
1042
|
-
...options
|
|
1102
|
+
}
|
|
1043
1103
|
});
|
|
1044
1104
|
}
|
|
1045
1105
|
|
|
@@ -1053,6 +1113,9 @@ function useCreateEndorsement(endorsedHandleOrDid, options) {
|
|
|
1053
1113
|
const config = useSifaConfig();
|
|
1054
1114
|
const queryClient = reactQuery.useQueryClient();
|
|
1055
1115
|
return reactQuery.useMutation({
|
|
1116
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
1117
|
+
// handler below and silently drop cache invalidation (#453).
|
|
1118
|
+
...options,
|
|
1056
1119
|
mutationFn: (data) => createEndorsement(config, data),
|
|
1057
1120
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1058
1121
|
if (result.success && endorsedHandleOrDid) {
|
|
@@ -1064,8 +1127,7 @@ function useCreateEndorsement(endorsedHandleOrDid, options) {
|
|
|
1064
1127
|
});
|
|
1065
1128
|
}
|
|
1066
1129
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1067
|
-
}
|
|
1068
|
-
...options
|
|
1130
|
+
}
|
|
1069
1131
|
});
|
|
1070
1132
|
}
|
|
1071
1133
|
|
|
@@ -1126,6 +1188,9 @@ function useCreateConfirmation(claimerHandleOrDid, options) {
|
|
|
1126
1188
|
const config = useSifaConfig();
|
|
1127
1189
|
const queryClient = reactQuery.useQueryClient();
|
|
1128
1190
|
return reactQuery.useMutation({
|
|
1191
|
+
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
1192
|
+
// one below and silently drop cache invalidation (#453).
|
|
1193
|
+
...options,
|
|
1129
1194
|
mutationFn: (data) => createConfirmation(config, data),
|
|
1130
1195
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1131
1196
|
if (result.success) {
|
|
@@ -1142,14 +1207,16 @@ function useCreateConfirmation(claimerHandleOrDid, options) {
|
|
|
1142
1207
|
}
|
|
1143
1208
|
}
|
|
1144
1209
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1145
|
-
}
|
|
1146
|
-
...options
|
|
1210
|
+
}
|
|
1147
1211
|
});
|
|
1148
1212
|
}
|
|
1149
1213
|
function useDismissConfirmation(options) {
|
|
1150
1214
|
const config = useSifaConfig();
|
|
1151
1215
|
const queryClient = reactQuery.useQueryClient();
|
|
1152
1216
|
return reactQuery.useMutation({
|
|
1217
|
+
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
1218
|
+
// one below and silently drop cache invalidation (#453).
|
|
1219
|
+
...options,
|
|
1153
1220
|
mutationFn: (data) => dismissConfirmation(config, data),
|
|
1154
1221
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1155
1222
|
if (result.success) {
|
|
@@ -1158,14 +1225,16 @@ function useDismissConfirmation(options) {
|
|
|
1158
1225
|
});
|
|
1159
1226
|
}
|
|
1160
1227
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1161
|
-
}
|
|
1162
|
-
...options
|
|
1228
|
+
}
|
|
1163
1229
|
});
|
|
1164
1230
|
}
|
|
1165
1231
|
function useRevokeConfirmation(claimerHandleOrDid, options) {
|
|
1166
1232
|
const config = useSifaConfig();
|
|
1167
1233
|
const queryClient = reactQuery.useQueryClient();
|
|
1168
1234
|
return reactQuery.useMutation({
|
|
1235
|
+
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
1236
|
+
// one below and silently drop cache invalidation (#453).
|
|
1237
|
+
...options,
|
|
1169
1238
|
mutationFn: (data) => revokeConfirmation(config, data),
|
|
1170
1239
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1171
1240
|
if (result.success) {
|
|
@@ -1179,8 +1248,7 @@ function useRevokeConfirmation(claimerHandleOrDid, options) {
|
|
|
1179
1248
|
}
|
|
1180
1249
|
}
|
|
1181
1250
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1182
|
-
}
|
|
1183
|
-
...options
|
|
1251
|
+
}
|
|
1184
1252
|
});
|
|
1185
1253
|
}
|
|
1186
1254
|
|
|
@@ -1212,28 +1280,32 @@ function useHideKeytraceClaim(ownerHandleOrDid, options) {
|
|
|
1212
1280
|
const config = useSifaConfig();
|
|
1213
1281
|
const queryClient = reactQuery.useQueryClient();
|
|
1214
1282
|
return reactQuery.useMutation({
|
|
1283
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
1284
|
+
// handler below and silently drop cache invalidation (#453).
|
|
1285
|
+
...options,
|
|
1215
1286
|
mutationFn: (rkey) => hideKeytraceClaim(config, rkey),
|
|
1216
1287
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1217
1288
|
if (result.success) {
|
|
1218
1289
|
await invalidateProfile6(queryClient, ownerHandleOrDid);
|
|
1219
1290
|
}
|
|
1220
1291
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1221
|
-
}
|
|
1222
|
-
...options
|
|
1292
|
+
}
|
|
1223
1293
|
});
|
|
1224
1294
|
}
|
|
1225
1295
|
function useUnhideKeytraceClaim(ownerHandleOrDid, options) {
|
|
1226
1296
|
const config = useSifaConfig();
|
|
1227
1297
|
const queryClient = reactQuery.useQueryClient();
|
|
1228
1298
|
return reactQuery.useMutation({
|
|
1299
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
1300
|
+
// handler below and silently drop cache invalidation (#453).
|
|
1301
|
+
...options,
|
|
1229
1302
|
mutationFn: (rkey) => unhideKeytraceClaim(config, rkey),
|
|
1230
1303
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1231
1304
|
if (result.success) {
|
|
1232
1305
|
await invalidateProfile6(queryClient, ownerHandleOrDid);
|
|
1233
1306
|
}
|
|
1234
1307
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1235
|
-
}
|
|
1236
|
-
...options
|
|
1308
|
+
}
|
|
1237
1309
|
});
|
|
1238
1310
|
}
|
|
1239
1311
|
|
|
@@ -1265,28 +1337,32 @@ function useRevealMarqueDomain(ownerHandleOrDid, options) {
|
|
|
1265
1337
|
const config = useSifaConfig();
|
|
1266
1338
|
const queryClient = reactQuery.useQueryClient();
|
|
1267
1339
|
return reactQuery.useMutation({
|
|
1340
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
1341
|
+
// handler below and silently drop cache invalidation (#453).
|
|
1342
|
+
...options,
|
|
1268
1343
|
mutationFn: (domain) => revealMarqueDomain(config, domain),
|
|
1269
1344
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1270
1345
|
if (result.success) {
|
|
1271
1346
|
await invalidateProfile7(queryClient, ownerHandleOrDid);
|
|
1272
1347
|
}
|
|
1273
1348
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1274
|
-
}
|
|
1275
|
-
...options
|
|
1349
|
+
}
|
|
1276
1350
|
});
|
|
1277
1351
|
}
|
|
1278
1352
|
function useUnrevealMarqueDomain(ownerHandleOrDid, options) {
|
|
1279
1353
|
const config = useSifaConfig();
|
|
1280
1354
|
const queryClient = reactQuery.useQueryClient();
|
|
1281
1355
|
return reactQuery.useMutation({
|
|
1356
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
1357
|
+
// handler below and silently drop cache invalidation (#453).
|
|
1358
|
+
...options,
|
|
1282
1359
|
mutationFn: (domain) => unrevealMarqueDomain(config, domain),
|
|
1283
1360
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1284
1361
|
if (result.success) {
|
|
1285
1362
|
await invalidateProfile7(queryClient, ownerHandleOrDid);
|
|
1286
1363
|
}
|
|
1287
1364
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1288
|
-
}
|
|
1289
|
-
...options
|
|
1365
|
+
}
|
|
1290
1366
|
});
|
|
1291
1367
|
}
|
|
1292
1368
|
|
|
@@ -1355,14 +1431,16 @@ function makeWriteHook(fetcher) {
|
|
|
1355
1431
|
const config = useSifaConfig();
|
|
1356
1432
|
const queryClient = reactQuery.useQueryClient();
|
|
1357
1433
|
return reactQuery.useMutation({
|
|
1434
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
1435
|
+
// handler below and silently drop cache invalidation (#453).
|
|
1436
|
+
...options,
|
|
1358
1437
|
mutationFn: (v) => fetcher(config, v),
|
|
1359
1438
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1360
1439
|
if (result.success) {
|
|
1361
1440
|
await invalidateProfile8(queryClient, ownerHandleOrDid);
|
|
1362
1441
|
}
|
|
1363
1442
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1364
|
-
}
|
|
1365
|
-
...options
|
|
1443
|
+
}
|
|
1366
1444
|
});
|
|
1367
1445
|
};
|
|
1368
1446
|
}
|
|
@@ -1400,8 +1478,7 @@ function useRefreshOrcidPublications(ownerHandleOrDid, options) {
|
|
|
1400
1478
|
await invalidateProfile8(queryClient, ownerHandleOrDid);
|
|
1401
1479
|
}
|
|
1402
1480
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1403
|
-
}
|
|
1404
|
-
...options
|
|
1481
|
+
}
|
|
1405
1482
|
});
|
|
1406
1483
|
}
|
|
1407
1484
|
|
|
@@ -1811,6 +1888,9 @@ function useFollow(options) {
|
|
|
1811
1888
|
const config = useSifaConfig();
|
|
1812
1889
|
const queryClient = reactQuery.useQueryClient();
|
|
1813
1890
|
return reactQuery.useMutation({
|
|
1891
|
+
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
1892
|
+
// one below and silently drop cache invalidation (#453).
|
|
1893
|
+
...options,
|
|
1814
1894
|
mutationFn: ({ handle, note }) => followUser(config, handle, { note }),
|
|
1815
1895
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1816
1896
|
if (result.success) {
|
|
@@ -1821,14 +1901,16 @@ function useFollow(options) {
|
|
|
1821
1901
|
onError: async (error, variables, onMutateResult, context) => {
|
|
1822
1902
|
await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.follow.all() });
|
|
1823
1903
|
await options?.onError?.(error, variables, onMutateResult, context);
|
|
1824
|
-
}
|
|
1825
|
-
...options
|
|
1904
|
+
}
|
|
1826
1905
|
});
|
|
1827
1906
|
}
|
|
1828
1907
|
function useUnfollow(options) {
|
|
1829
1908
|
const config = useSifaConfig();
|
|
1830
1909
|
const queryClient = reactQuery.useQueryClient();
|
|
1831
1910
|
return reactQuery.useMutation({
|
|
1911
|
+
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
1912
|
+
// one below and silently drop cache invalidation (#453).
|
|
1913
|
+
...options,
|
|
1832
1914
|
mutationFn: ({ handle }) => unfollowUser(config, handle),
|
|
1833
1915
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1834
1916
|
if (result.success) {
|
|
@@ -1839,8 +1921,7 @@ function useUnfollow(options) {
|
|
|
1839
1921
|
onError: async (error, variables, onMutateResult, context) => {
|
|
1840
1922
|
await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.follow.all() });
|
|
1841
1923
|
await options?.onError?.(error, variables, onMutateResult, context);
|
|
1842
|
-
}
|
|
1843
|
-
...options
|
|
1924
|
+
}
|
|
1844
1925
|
});
|
|
1845
1926
|
}
|
|
1846
1927
|
function useFollowers(handle, opts = {}, options) {
|
|
@@ -2381,28 +2462,32 @@ function useCreateReaction(options) {
|
|
|
2381
2462
|
const config = useSifaConfig();
|
|
2382
2463
|
const queryClient = reactQuery.useQueryClient();
|
|
2383
2464
|
return reactQuery.useMutation({
|
|
2465
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2466
|
+
// handler below and silently drop cache invalidation (#453).
|
|
2467
|
+
...options,
|
|
2384
2468
|
mutationFn: ({ targetUri, appId, targetCid }) => createReaction(config, targetUri, appId, targetCid),
|
|
2385
2469
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2386
2470
|
if (result.ok) {
|
|
2387
2471
|
await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.reactions.all() });
|
|
2388
2472
|
}
|
|
2389
2473
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2390
|
-
}
|
|
2391
|
-
...options
|
|
2474
|
+
}
|
|
2392
2475
|
});
|
|
2393
2476
|
}
|
|
2394
2477
|
function useDeleteReaction(options) {
|
|
2395
2478
|
const config = useSifaConfig();
|
|
2396
2479
|
const queryClient = reactQuery.useQueryClient();
|
|
2397
2480
|
return reactQuery.useMutation({
|
|
2481
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2482
|
+
// handler below and silently drop cache invalidation (#453).
|
|
2483
|
+
...options,
|
|
2398
2484
|
mutationFn: ({ targetUri, appId }) => deleteReaction(config, targetUri, appId),
|
|
2399
2485
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2400
2486
|
if (result.success) {
|
|
2401
2487
|
await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.reactions.all() });
|
|
2402
2488
|
}
|
|
2403
2489
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2404
|
-
}
|
|
2405
|
-
...options
|
|
2490
|
+
}
|
|
2406
2491
|
});
|
|
2407
2492
|
}
|
|
2408
2493
|
|
|
@@ -2493,28 +2578,32 @@ function useCastRoadmapVote(options) {
|
|
|
2493
2578
|
const config = useSifaConfig();
|
|
2494
2579
|
const queryClient = reactQuery.useQueryClient();
|
|
2495
2580
|
return reactQuery.useMutation({
|
|
2581
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2582
|
+
// handler below and silently drop cache invalidation (#453).
|
|
2583
|
+
...options,
|
|
2496
2584
|
mutationFn: (key) => castRoadmapVote(config, key),
|
|
2497
2585
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2498
2586
|
if (result.ok) {
|
|
2499
2587
|
await invalidateRoadmap(queryClient);
|
|
2500
2588
|
}
|
|
2501
2589
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2502
|
-
}
|
|
2503
|
-
...options
|
|
2590
|
+
}
|
|
2504
2591
|
});
|
|
2505
2592
|
}
|
|
2506
2593
|
function useRetractRoadmapVote(options) {
|
|
2507
2594
|
const config = useSifaConfig();
|
|
2508
2595
|
const queryClient = reactQuery.useQueryClient();
|
|
2509
2596
|
return reactQuery.useMutation({
|
|
2597
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2598
|
+
// handler below and silently drop cache invalidation (#453).
|
|
2599
|
+
...options,
|
|
2510
2600
|
mutationFn: (key) => retractRoadmapVote(config, key),
|
|
2511
2601
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2512
2602
|
if (result.success) {
|
|
2513
2603
|
await invalidateRoadmap(queryClient);
|
|
2514
2604
|
}
|
|
2515
2605
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2516
|
-
}
|
|
2517
|
-
...options
|
|
2606
|
+
}
|
|
2518
2607
|
});
|
|
2519
2608
|
}
|
|
2520
2609
|
|
|
@@ -2558,28 +2647,32 @@ function useResetProfile(options) {
|
|
|
2558
2647
|
const config = useSifaConfig();
|
|
2559
2648
|
const queryClient = reactQuery.useQueryClient();
|
|
2560
2649
|
return reactQuery.useMutation({
|
|
2650
|
+
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
2651
|
+
// one below and silently drop cache invalidation (#453).
|
|
2652
|
+
...options,
|
|
2561
2653
|
mutationFn: (deletePdsData) => resetProfile(config, deletePdsData),
|
|
2562
2654
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2563
2655
|
if (result.success) {
|
|
2564
2656
|
await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.all() });
|
|
2565
2657
|
}
|
|
2566
2658
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2567
|
-
}
|
|
2568
|
-
...options
|
|
2659
|
+
}
|
|
2569
2660
|
});
|
|
2570
2661
|
}
|
|
2571
2662
|
function useDeleteAccount(options) {
|
|
2572
2663
|
const config = useSifaConfig();
|
|
2573
2664
|
const queryClient = reactQuery.useQueryClient();
|
|
2574
2665
|
return reactQuery.useMutation({
|
|
2666
|
+
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
2667
|
+
// one below and silently drop cache invalidation (#453).
|
|
2668
|
+
...options,
|
|
2575
2669
|
mutationFn: (deletePdsData) => deleteAccount(config, deletePdsData),
|
|
2576
2670
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2577
2671
|
if (result.success) {
|
|
2578
2672
|
queryClient.clear();
|
|
2579
2673
|
}
|
|
2580
2674
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2581
|
-
}
|
|
2582
|
-
...options
|
|
2675
|
+
}
|
|
2583
2676
|
});
|
|
2584
2677
|
}
|
|
2585
2678
|
|
|
@@ -2612,12 +2705,14 @@ function useDeleteRepoRecords(options) {
|
|
|
2612
2705
|
const config = useSifaConfig();
|
|
2613
2706
|
const queryClient = reactQuery.useQueryClient();
|
|
2614
2707
|
return reactQuery.useMutation({
|
|
2708
|
+
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
2709
|
+
// one below and silently drop cache invalidation (#453).
|
|
2710
|
+
...options,
|
|
2615
2711
|
mutationFn: (input) => deleteRepoRecords(config, input),
|
|
2616
2712
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2617
2713
|
await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.all() });
|
|
2618
2714
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2619
|
-
}
|
|
2620
|
-
...options
|
|
2715
|
+
}
|
|
2621
2716
|
});
|
|
2622
2717
|
}
|
|
2623
2718
|
var httpUrlNullable = zod.z.string().refine((s) => /^https?:\/\//i.test(s), { message: "must be an http(s) URL" }).nullable();
|
|
@@ -2803,6 +2898,9 @@ function useOrgClaim(handleOrDid, options) {
|
|
|
2803
2898
|
const config = useSifaConfig();
|
|
2804
2899
|
const queryClient = reactQuery.useQueryClient();
|
|
2805
2900
|
return reactQuery.useMutation({
|
|
2901
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2902
|
+
// handler below and silently drop cache invalidation (#453).
|
|
2903
|
+
...options,
|
|
2806
2904
|
mutationFn: (body) => submitOrgClaim(config, body),
|
|
2807
2905
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2808
2906
|
if (result.success && handleOrDid) {
|
|
@@ -2811,14 +2909,16 @@ function useOrgClaim(handleOrDid, options) {
|
|
|
2811
2909
|
});
|
|
2812
2910
|
}
|
|
2813
2911
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2814
|
-
}
|
|
2815
|
-
...options
|
|
2912
|
+
}
|
|
2816
2913
|
});
|
|
2817
2914
|
}
|
|
2818
2915
|
function useUpdateOrgProfile(handleOrDid, options) {
|
|
2819
2916
|
const config = useSifaConfig();
|
|
2820
2917
|
const queryClient = reactQuery.useQueryClient();
|
|
2821
2918
|
return reactQuery.useMutation({
|
|
2919
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2920
|
+
// handler below and silently drop cache invalidation (#453).
|
|
2921
|
+
...options,
|
|
2822
2922
|
mutationFn: (body) => updateOrgProfile(config, body),
|
|
2823
2923
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2824
2924
|
if (result.success && handleOrDid) {
|
|
@@ -2827,8 +2927,7 @@ function useUpdateOrgProfile(handleOrDid, options) {
|
|
|
2827
2927
|
});
|
|
2828
2928
|
}
|
|
2829
2929
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2830
|
-
}
|
|
2831
|
-
...options
|
|
2930
|
+
}
|
|
2832
2931
|
});
|
|
2833
2932
|
}
|
|
2834
2933
|
function useOrgDomainChallenge(options) {
|