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