@singi-labs/sifa-sdk 0.12.72 → 0.12.74
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 +24 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +24 -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
package/dist/query/index.js
CHANGED
|
@@ -1595,76 +1595,89 @@ function useUpdateProfileSelf(ownerHandleOrDid, options) {
|
|
|
1595
1595
|
const config = useSifaConfig();
|
|
1596
1596
|
const queryClient = useQueryClient();
|
|
1597
1597
|
return useMutation({
|
|
1598
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
1599
|
+
// handler below and silently drop cache invalidation (#453).
|
|
1600
|
+
...options,
|
|
1598
1601
|
mutationFn: (data) => updateProfileSelf(config, data),
|
|
1599
1602
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1600
1603
|
if (result.success) {
|
|
1601
1604
|
await invalidateProfile(queryClient, ownerHandleOrDid);
|
|
1602
1605
|
}
|
|
1603
1606
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1604
|
-
}
|
|
1605
|
-
...options
|
|
1607
|
+
}
|
|
1606
1608
|
});
|
|
1607
1609
|
}
|
|
1608
1610
|
function useUpdateProfileOverride(ownerHandleOrDid, options) {
|
|
1609
1611
|
const config = useSifaConfig();
|
|
1610
1612
|
const queryClient = useQueryClient();
|
|
1611
1613
|
return useMutation({
|
|
1614
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
1615
|
+
// handler below and silently drop cache invalidation (#453).
|
|
1616
|
+
...options,
|
|
1612
1617
|
mutationFn: (data) => updateProfileOverride(config, data),
|
|
1613
1618
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1614
1619
|
if (result.success) {
|
|
1615
1620
|
await invalidateProfile(queryClient, ownerHandleOrDid);
|
|
1616
1621
|
}
|
|
1617
1622
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1618
|
-
}
|
|
1619
|
-
...options
|
|
1623
|
+
}
|
|
1620
1624
|
});
|
|
1621
1625
|
}
|
|
1622
1626
|
function useRefreshPds(ownerHandleOrDid, options) {
|
|
1623
1627
|
const config = useSifaConfig();
|
|
1624
1628
|
const queryClient = useQueryClient();
|
|
1625
1629
|
return useMutation({
|
|
1630
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
1631
|
+
// handler below and silently drop cache invalidation (#453).
|
|
1632
|
+
...options,
|
|
1626
1633
|
mutationFn: () => refreshPds(config),
|
|
1627
1634
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1628
1635
|
if (result.success) {
|
|
1629
1636
|
await invalidateProfile(queryClient, ownerHandleOrDid);
|
|
1630
1637
|
}
|
|
1631
1638
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1632
|
-
}
|
|
1633
|
-
...options
|
|
1639
|
+
}
|
|
1634
1640
|
});
|
|
1635
1641
|
}
|
|
1636
1642
|
function useUploadAvatar(ownerHandleOrDid, options) {
|
|
1637
1643
|
const config = useSifaConfig();
|
|
1638
1644
|
const queryClient = useQueryClient();
|
|
1639
1645
|
return useMutation({
|
|
1646
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
1647
|
+
// handler below and silently drop cache invalidation (#453).
|
|
1648
|
+
...options,
|
|
1640
1649
|
mutationFn: (file) => uploadAvatar(config, file),
|
|
1641
1650
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1642
1651
|
if (result.success) {
|
|
1643
1652
|
await invalidateProfile(queryClient, ownerHandleOrDid);
|
|
1644
1653
|
}
|
|
1645
1654
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1646
|
-
}
|
|
1647
|
-
...options
|
|
1655
|
+
}
|
|
1648
1656
|
});
|
|
1649
1657
|
}
|
|
1650
1658
|
function useDeleteAvatarOverride(ownerHandleOrDid, options) {
|
|
1651
1659
|
const config = useSifaConfig();
|
|
1652
1660
|
const queryClient = useQueryClient();
|
|
1653
1661
|
return useMutation({
|
|
1662
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
1663
|
+
// handler below and silently drop cache invalidation (#453).
|
|
1664
|
+
...options,
|
|
1654
1665
|
mutationFn: () => deleteAvatarOverride(config),
|
|
1655
1666
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1656
1667
|
if (result.success) {
|
|
1657
1668
|
await invalidateProfile(queryClient, ownerHandleOrDid);
|
|
1658
1669
|
}
|
|
1659
1670
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1660
|
-
}
|
|
1661
|
-
...options
|
|
1671
|
+
}
|
|
1662
1672
|
});
|
|
1663
1673
|
}
|
|
1664
1674
|
function useCreatePosition(ownerDid, options) {
|
|
1665
1675
|
const config = useSifaConfig();
|
|
1666
1676
|
const queryClient = useQueryClient();
|
|
1667
1677
|
return useMutation({
|
|
1678
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
1679
|
+
// handler below and silently drop cache invalidation (#453).
|
|
1680
|
+
...options,
|
|
1668
1681
|
mutationFn: (data) => createPosition(config, data),
|
|
1669
1682
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1670
1683
|
if (result.success) {
|
|
@@ -1672,8 +1685,7 @@ function useCreatePosition(ownerDid, options) {
|
|
|
1672
1685
|
await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.position.byOwner(ownerDid) });
|
|
1673
1686
|
}
|
|
1674
1687
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1675
|
-
}
|
|
1676
|
-
...options
|
|
1688
|
+
}
|
|
1677
1689
|
});
|
|
1678
1690
|
}
|
|
1679
1691
|
async function invalidatePositionCaches(queryClient, ownerHandleOrDid) {
|
|
@@ -1688,84 +1700,96 @@ function useUpdatePosition(ownerHandleOrDid, options) {
|
|
|
1688
1700
|
const config = useSifaConfig();
|
|
1689
1701
|
const queryClient = useQueryClient();
|
|
1690
1702
|
return useMutation({
|
|
1703
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
1704
|
+
// handler below and silently drop cache invalidation (#453).
|
|
1705
|
+
...options,
|
|
1691
1706
|
mutationFn: ({ rkey, data }) => updatePosition(config, rkey, data),
|
|
1692
1707
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1693
1708
|
if (result.success) {
|
|
1694
1709
|
await invalidatePositionCaches(queryClient, ownerHandleOrDid);
|
|
1695
1710
|
}
|
|
1696
1711
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1697
|
-
}
|
|
1698
|
-
...options
|
|
1712
|
+
}
|
|
1699
1713
|
});
|
|
1700
1714
|
}
|
|
1701
1715
|
function useDeletePosition(ownerHandleOrDid, options) {
|
|
1702
1716
|
const config = useSifaConfig();
|
|
1703
1717
|
const queryClient = useQueryClient();
|
|
1704
1718
|
return useMutation({
|
|
1719
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
1720
|
+
// handler below and silently drop cache invalidation (#453).
|
|
1721
|
+
...options,
|
|
1705
1722
|
mutationFn: (rkey) => deletePosition(config, rkey),
|
|
1706
1723
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1707
1724
|
if (result.success) {
|
|
1708
1725
|
await invalidatePositionCaches(queryClient, ownerHandleOrDid);
|
|
1709
1726
|
}
|
|
1710
1727
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1711
|
-
}
|
|
1712
|
-
...options
|
|
1728
|
+
}
|
|
1713
1729
|
});
|
|
1714
1730
|
}
|
|
1715
1731
|
function useSetPositionPrimary(ownerHandleOrDid, options) {
|
|
1716
1732
|
const config = useSifaConfig();
|
|
1717
1733
|
const queryClient = useQueryClient();
|
|
1718
1734
|
return useMutation({
|
|
1735
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
1736
|
+
// handler below and silently drop cache invalidation (#453).
|
|
1737
|
+
...options,
|
|
1719
1738
|
mutationFn: (rkey) => setPositionPrimary(config, rkey),
|
|
1720
1739
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1721
1740
|
if (result.success) {
|
|
1722
1741
|
await invalidatePositionCaches(queryClient, ownerHandleOrDid);
|
|
1723
1742
|
}
|
|
1724
1743
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1725
|
-
}
|
|
1726
|
-
...options
|
|
1744
|
+
}
|
|
1727
1745
|
});
|
|
1728
1746
|
}
|
|
1729
1747
|
function useUnsetPositionPrimary(ownerHandleOrDid, options) {
|
|
1730
1748
|
const config = useSifaConfig();
|
|
1731
1749
|
const queryClient = useQueryClient();
|
|
1732
1750
|
return useMutation({
|
|
1751
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
1752
|
+
// handler below and silently drop cache invalidation (#453).
|
|
1753
|
+
...options,
|
|
1733
1754
|
mutationFn: (rkey) => unsetPositionPrimary(config, rkey),
|
|
1734
1755
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1735
1756
|
if (result.success) {
|
|
1736
1757
|
await invalidatePositionCaches(queryClient, ownerHandleOrDid);
|
|
1737
1758
|
}
|
|
1738
1759
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1739
|
-
}
|
|
1740
|
-
...options
|
|
1760
|
+
}
|
|
1741
1761
|
});
|
|
1742
1762
|
}
|
|
1743
1763
|
function useLinkSkillToPosition(ownerHandleOrDid, options) {
|
|
1744
1764
|
const config = useSifaConfig();
|
|
1745
1765
|
const queryClient = useQueryClient();
|
|
1746
1766
|
return useMutation({
|
|
1767
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
1768
|
+
// handler below and silently drop cache invalidation (#453).
|
|
1769
|
+
...options,
|
|
1747
1770
|
mutationFn: ({ position, skillRef }) => linkSkillToPosition(config, position, skillRef),
|
|
1748
1771
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1749
1772
|
if (result.success) {
|
|
1750
1773
|
await invalidatePositionCaches(queryClient, ownerHandleOrDid);
|
|
1751
1774
|
}
|
|
1752
1775
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1753
|
-
}
|
|
1754
|
-
...options
|
|
1776
|
+
}
|
|
1755
1777
|
});
|
|
1756
1778
|
}
|
|
1757
1779
|
function useUnlinkSkillFromPosition(ownerHandleOrDid, options) {
|
|
1758
1780
|
const config = useSifaConfig();
|
|
1759
1781
|
const queryClient = useQueryClient();
|
|
1760
1782
|
return useMutation({
|
|
1783
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
1784
|
+
// handler below and silently drop cache invalidation (#453).
|
|
1785
|
+
...options,
|
|
1761
1786
|
mutationFn: ({ position, skillRef }) => unlinkSkillFromPosition(config, position, skillRef),
|
|
1762
1787
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1763
1788
|
if (result.success) {
|
|
1764
1789
|
await invalidatePositionCaches(queryClient, ownerHandleOrDid);
|
|
1765
1790
|
}
|
|
1766
1791
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1767
|
-
}
|
|
1768
|
-
...options
|
|
1792
|
+
}
|
|
1769
1793
|
});
|
|
1770
1794
|
}
|
|
1771
1795
|
async function invalidateProfile2(queryClient, ownerHandleOrDid) {
|
|
@@ -1777,42 +1801,48 @@ function useCreateEducation(ownerHandleOrDid, options) {
|
|
|
1777
1801
|
const config = useSifaConfig();
|
|
1778
1802
|
const queryClient = useQueryClient();
|
|
1779
1803
|
return useMutation({
|
|
1804
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
1805
|
+
// handler below and silently drop cache invalidation (#453).
|
|
1806
|
+
...options,
|
|
1780
1807
|
mutationFn: (data) => createEducation(config, data),
|
|
1781
1808
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1782
1809
|
if (result.success) {
|
|
1783
1810
|
await invalidateProfile2(queryClient, ownerHandleOrDid);
|
|
1784
1811
|
}
|
|
1785
1812
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1786
|
-
}
|
|
1787
|
-
...options
|
|
1813
|
+
}
|
|
1788
1814
|
});
|
|
1789
1815
|
}
|
|
1790
1816
|
function useUpdateEducation(ownerHandleOrDid, options) {
|
|
1791
1817
|
const config = useSifaConfig();
|
|
1792
1818
|
const queryClient = useQueryClient();
|
|
1793
1819
|
return useMutation({
|
|
1820
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
1821
|
+
// handler below and silently drop cache invalidation (#453).
|
|
1822
|
+
...options,
|
|
1794
1823
|
mutationFn: ({ rkey, data }) => updateEducation(config, rkey, data),
|
|
1795
1824
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1796
1825
|
if (result.success) {
|
|
1797
1826
|
await invalidateProfile2(queryClient, ownerHandleOrDid);
|
|
1798
1827
|
}
|
|
1799
1828
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1800
|
-
}
|
|
1801
|
-
...options
|
|
1829
|
+
}
|
|
1802
1830
|
});
|
|
1803
1831
|
}
|
|
1804
1832
|
function useDeleteEducation(ownerHandleOrDid, options) {
|
|
1805
1833
|
const config = useSifaConfig();
|
|
1806
1834
|
const queryClient = useQueryClient();
|
|
1807
1835
|
return useMutation({
|
|
1836
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
1837
|
+
// handler below and silently drop cache invalidation (#453).
|
|
1838
|
+
...options,
|
|
1808
1839
|
mutationFn: (rkey) => deleteEducation(config, rkey),
|
|
1809
1840
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1810
1841
|
if (result.success) {
|
|
1811
1842
|
await invalidateProfile2(queryClient, ownerHandleOrDid);
|
|
1812
1843
|
}
|
|
1813
1844
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1814
|
-
}
|
|
1815
|
-
...options
|
|
1845
|
+
}
|
|
1816
1846
|
});
|
|
1817
1847
|
}
|
|
1818
1848
|
async function invalidateProfile3(queryClient, ownerHandleOrDid) {
|
|
@@ -1824,28 +1854,32 @@ function useCreateSkill(ownerHandleOrDid, options) {
|
|
|
1824
1854
|
const config = useSifaConfig();
|
|
1825
1855
|
const queryClient = useQueryClient();
|
|
1826
1856
|
return useMutation({
|
|
1857
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
1858
|
+
// handler below and silently drop cache invalidation (#453).
|
|
1859
|
+
...options,
|
|
1827
1860
|
mutationFn: (data) => createSkill(config, data),
|
|
1828
1861
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1829
1862
|
if (result.success) {
|
|
1830
1863
|
await invalidateProfile3(queryClient, ownerHandleOrDid);
|
|
1831
1864
|
}
|
|
1832
1865
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1833
|
-
}
|
|
1834
|
-
...options
|
|
1866
|
+
}
|
|
1835
1867
|
});
|
|
1836
1868
|
}
|
|
1837
1869
|
function useUpdateSkill(ownerHandleOrDid, options) {
|
|
1838
1870
|
const config = useSifaConfig();
|
|
1839
1871
|
const queryClient = useQueryClient();
|
|
1840
1872
|
return useMutation({
|
|
1873
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
1874
|
+
// handler below and silently drop cache invalidation (#453).
|
|
1875
|
+
...options,
|
|
1841
1876
|
mutationFn: ({ rkey, data }) => updateSkill(config, rkey, data),
|
|
1842
1877
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1843
1878
|
if (result.success) {
|
|
1844
1879
|
await invalidateProfile3(queryClient, ownerHandleOrDid);
|
|
1845
1880
|
}
|
|
1846
1881
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1847
|
-
}
|
|
1848
|
-
...options
|
|
1882
|
+
}
|
|
1849
1883
|
});
|
|
1850
1884
|
}
|
|
1851
1885
|
function useUpdateSkillSubCategories(ownerHandleOrDid, options) {
|
|
@@ -1870,14 +1904,16 @@ function useDeleteSkill(ownerHandleOrDid, options) {
|
|
|
1870
1904
|
const config = useSifaConfig();
|
|
1871
1905
|
const queryClient = useQueryClient();
|
|
1872
1906
|
return useMutation({
|
|
1907
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
1908
|
+
// handler below and silently drop cache invalidation (#453).
|
|
1909
|
+
...options,
|
|
1873
1910
|
mutationFn: (rkey) => deleteSkill(config, rkey),
|
|
1874
1911
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1875
1912
|
if (result.success) {
|
|
1876
1913
|
await invalidateProfile3(queryClient, ownerHandleOrDid);
|
|
1877
1914
|
}
|
|
1878
1915
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1879
|
-
}
|
|
1880
|
-
...options
|
|
1916
|
+
}
|
|
1881
1917
|
});
|
|
1882
1918
|
}
|
|
1883
1919
|
async function invalidateProfile4(queryClient, ownerHandleOrDid) {
|
|
@@ -1889,42 +1925,48 @@ function useCreateRecord(ownerHandleOrDid, options) {
|
|
|
1889
1925
|
const config = useSifaConfig();
|
|
1890
1926
|
const queryClient = useQueryClient();
|
|
1891
1927
|
return useMutation({
|
|
1928
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
1929
|
+
// handler below and silently drop cache invalidation (#453).
|
|
1930
|
+
...options,
|
|
1892
1931
|
mutationFn: ({ collection, data }) => createRecord(config, collection, data),
|
|
1893
1932
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1894
1933
|
if (result.success) {
|
|
1895
1934
|
await invalidateProfile4(queryClient, ownerHandleOrDid);
|
|
1896
1935
|
}
|
|
1897
1936
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1898
|
-
}
|
|
1899
|
-
...options
|
|
1937
|
+
}
|
|
1900
1938
|
});
|
|
1901
1939
|
}
|
|
1902
1940
|
function useUpdateRecord(ownerHandleOrDid, options) {
|
|
1903
1941
|
const config = useSifaConfig();
|
|
1904
1942
|
const queryClient = useQueryClient();
|
|
1905
1943
|
return useMutation({
|
|
1944
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
1945
|
+
// handler below and silently drop cache invalidation (#453).
|
|
1946
|
+
...options,
|
|
1906
1947
|
mutationFn: ({ collection, rkey, data }) => updateRecord(config, collection, rkey, data),
|
|
1907
1948
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1908
1949
|
if (result.success) {
|
|
1909
1950
|
await invalidateProfile4(queryClient, ownerHandleOrDid);
|
|
1910
1951
|
}
|
|
1911
1952
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1912
|
-
}
|
|
1913
|
-
...options
|
|
1953
|
+
}
|
|
1914
1954
|
});
|
|
1915
1955
|
}
|
|
1916
1956
|
function useDeleteRecord(ownerHandleOrDid, options) {
|
|
1917
1957
|
const config = useSifaConfig();
|
|
1918
1958
|
const queryClient = useQueryClient();
|
|
1919
1959
|
return useMutation({
|
|
1960
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
1961
|
+
// handler below and silently drop cache invalidation (#453).
|
|
1962
|
+
...options,
|
|
1920
1963
|
mutationFn: ({ collection, rkey }) => deleteRecord(config, collection, rkey),
|
|
1921
1964
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1922
1965
|
if (result.success) {
|
|
1923
1966
|
await invalidateProfile4(queryClient, ownerHandleOrDid);
|
|
1924
1967
|
}
|
|
1925
1968
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1926
|
-
}
|
|
1927
|
-
...options
|
|
1969
|
+
}
|
|
1928
1970
|
});
|
|
1929
1971
|
}
|
|
1930
1972
|
async function invalidateProfile5(queryClient, ownerHandleOrDid) {
|
|
@@ -1936,42 +1978,48 @@ function useCreateProfileLocation(ownerHandleOrDid, options) {
|
|
|
1936
1978
|
const config = useSifaConfig();
|
|
1937
1979
|
const queryClient = useQueryClient();
|
|
1938
1980
|
return useMutation({
|
|
1981
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
1982
|
+
// handler below and silently drop cache invalidation (#453).
|
|
1983
|
+
...options,
|
|
1939
1984
|
mutationFn: (data) => createProfileLocation(config, data),
|
|
1940
1985
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1941
1986
|
if (result.success) {
|
|
1942
1987
|
await invalidateProfile5(queryClient, ownerHandleOrDid);
|
|
1943
1988
|
}
|
|
1944
1989
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1945
|
-
}
|
|
1946
|
-
...options
|
|
1990
|
+
}
|
|
1947
1991
|
});
|
|
1948
1992
|
}
|
|
1949
1993
|
function useUpdateProfileLocation(ownerHandleOrDid, options) {
|
|
1950
1994
|
const config = useSifaConfig();
|
|
1951
1995
|
const queryClient = useQueryClient();
|
|
1952
1996
|
return useMutation({
|
|
1997
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
1998
|
+
// handler below and silently drop cache invalidation (#453).
|
|
1999
|
+
...options,
|
|
1953
2000
|
mutationFn: ({ rkey, data }) => updateProfileLocation(config, rkey, data),
|
|
1954
2001
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1955
2002
|
if (result.success) {
|
|
1956
2003
|
await invalidateProfile5(queryClient, ownerHandleOrDid);
|
|
1957
2004
|
}
|
|
1958
2005
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1959
|
-
}
|
|
1960
|
-
...options
|
|
2006
|
+
}
|
|
1961
2007
|
});
|
|
1962
2008
|
}
|
|
1963
2009
|
function useDeleteProfileLocation(ownerHandleOrDid, options) {
|
|
1964
2010
|
const config = useSifaConfig();
|
|
1965
2011
|
const queryClient = useQueryClient();
|
|
1966
2012
|
return useMutation({
|
|
2013
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2014
|
+
// handler below and silently drop cache invalidation (#453).
|
|
2015
|
+
...options,
|
|
1967
2016
|
mutationFn: (rkey) => deleteProfileLocation(config, rkey),
|
|
1968
2017
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
1969
2018
|
if (result.success) {
|
|
1970
2019
|
await invalidateProfile5(queryClient, ownerHandleOrDid);
|
|
1971
2020
|
}
|
|
1972
2021
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
1973
|
-
}
|
|
1974
|
-
...options
|
|
2022
|
+
}
|
|
1975
2023
|
});
|
|
1976
2024
|
}
|
|
1977
2025
|
async function invalidateProfileAndExternalAccounts(queryClient, ownerHandleOrDid) {
|
|
@@ -1995,90 +2043,105 @@ function useCreateExternalAccount(ownerHandleOrDid, options) {
|
|
|
1995
2043
|
const config = useSifaConfig();
|
|
1996
2044
|
const queryClient = useQueryClient();
|
|
1997
2045
|
return useMutation({
|
|
2046
|
+
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
2047
|
+
// one below and silently drop cache invalidation (#453).
|
|
2048
|
+
...options,
|
|
1998
2049
|
mutationFn: (data) => createExternalAccount(config, data),
|
|
1999
2050
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2000
2051
|
if (result.success) {
|
|
2001
2052
|
await invalidateProfileAndExternalAccounts(queryClient, ownerHandleOrDid);
|
|
2002
2053
|
}
|
|
2003
2054
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2004
|
-
}
|
|
2005
|
-
...options
|
|
2055
|
+
}
|
|
2006
2056
|
});
|
|
2007
2057
|
}
|
|
2008
2058
|
function useUpdateExternalAccount(ownerHandleOrDid, options) {
|
|
2009
2059
|
const config = useSifaConfig();
|
|
2010
2060
|
const queryClient = useQueryClient();
|
|
2011
2061
|
return useMutation({
|
|
2062
|
+
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
2063
|
+
// one below and silently drop cache invalidation (#453).
|
|
2064
|
+
...options,
|
|
2012
2065
|
mutationFn: ({ rkey, data }) => updateExternalAccount(config, rkey, data),
|
|
2013
2066
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2014
2067
|
if (result.success) {
|
|
2015
2068
|
await invalidateProfileAndExternalAccounts(queryClient, ownerHandleOrDid);
|
|
2016
2069
|
}
|
|
2017
2070
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2018
|
-
}
|
|
2019
|
-
...options
|
|
2071
|
+
}
|
|
2020
2072
|
});
|
|
2021
2073
|
}
|
|
2022
2074
|
function useDeleteExternalAccount(ownerHandleOrDid, options) {
|
|
2023
2075
|
const config = useSifaConfig();
|
|
2024
2076
|
const queryClient = useQueryClient();
|
|
2025
2077
|
return useMutation({
|
|
2078
|
+
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
2079
|
+
// one below and silently drop cache invalidation (#453).
|
|
2080
|
+
...options,
|
|
2026
2081
|
mutationFn: (rkey) => deleteExternalAccount(config, rkey),
|
|
2027
2082
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2028
2083
|
if (result.success) {
|
|
2029
2084
|
await invalidateProfileAndExternalAccounts(queryClient, ownerHandleOrDid);
|
|
2030
2085
|
}
|
|
2031
2086
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2032
|
-
}
|
|
2033
|
-
...options
|
|
2087
|
+
}
|
|
2034
2088
|
});
|
|
2035
2089
|
}
|
|
2036
2090
|
function useSetExternalAccountPrimary(ownerHandleOrDid, options) {
|
|
2037
2091
|
const config = useSifaConfig();
|
|
2038
2092
|
const queryClient = useQueryClient();
|
|
2039
2093
|
return useMutation({
|
|
2094
|
+
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
2095
|
+
// one below and silently drop cache invalidation (#453).
|
|
2096
|
+
...options,
|
|
2040
2097
|
mutationFn: (rkey) => setExternalAccountPrimary(config, rkey),
|
|
2041
2098
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2042
2099
|
if (result.success) {
|
|
2043
2100
|
await invalidateProfileAndExternalAccounts(queryClient, ownerHandleOrDid);
|
|
2044
2101
|
}
|
|
2045
2102
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2046
|
-
}
|
|
2047
|
-
...options
|
|
2103
|
+
}
|
|
2048
2104
|
});
|
|
2049
2105
|
}
|
|
2050
2106
|
function useUnsetExternalAccountPrimary(ownerHandleOrDid, options) {
|
|
2051
2107
|
const config = useSifaConfig();
|
|
2052
2108
|
const queryClient = useQueryClient();
|
|
2053
2109
|
return useMutation({
|
|
2110
|
+
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
2111
|
+
// one below and silently drop cache invalidation (#453).
|
|
2112
|
+
...options,
|
|
2054
2113
|
mutationFn: (rkey) => unsetExternalAccountPrimary(config, rkey),
|
|
2055
2114
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2056
2115
|
if (result.success) {
|
|
2057
2116
|
await invalidateProfileAndExternalAccounts(queryClient, ownerHandleOrDid);
|
|
2058
2117
|
}
|
|
2059
2118
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2060
|
-
}
|
|
2061
|
-
...options
|
|
2119
|
+
}
|
|
2062
2120
|
});
|
|
2063
2121
|
}
|
|
2064
2122
|
function useVerifyExternalAccount(ownerHandleOrDid, options) {
|
|
2065
2123
|
const config = useSifaConfig();
|
|
2066
2124
|
const queryClient = useQueryClient();
|
|
2067
2125
|
return useMutation({
|
|
2126
|
+
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
2127
|
+
// one below and silently drop cache invalidation (#453).
|
|
2128
|
+
...options,
|
|
2068
2129
|
mutationFn: (rkey) => verifyExternalAccount(config, rkey),
|
|
2069
2130
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2070
2131
|
if (result.success) {
|
|
2071
2132
|
await invalidateProfileAndExternalAccounts(queryClient, ownerHandleOrDid);
|
|
2072
2133
|
}
|
|
2073
2134
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2074
|
-
}
|
|
2075
|
-
...options
|
|
2135
|
+
}
|
|
2076
2136
|
});
|
|
2077
2137
|
}
|
|
2078
2138
|
function useCreateEndorsement(endorsedHandleOrDid, options) {
|
|
2079
2139
|
const config = useSifaConfig();
|
|
2080
2140
|
const queryClient = useQueryClient();
|
|
2081
2141
|
return useMutation({
|
|
2142
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2143
|
+
// handler below and silently drop cache invalidation (#453).
|
|
2144
|
+
...options,
|
|
2082
2145
|
mutationFn: (data) => createEndorsement(config, data),
|
|
2083
2146
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2084
2147
|
if (result.success && endorsedHandleOrDid) {
|
|
@@ -2090,8 +2153,7 @@ function useCreateEndorsement(endorsedHandleOrDid, options) {
|
|
|
2090
2153
|
});
|
|
2091
2154
|
}
|
|
2092
2155
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2093
|
-
}
|
|
2094
|
-
...options
|
|
2156
|
+
}
|
|
2095
2157
|
});
|
|
2096
2158
|
}
|
|
2097
2159
|
function usePendingEndorsements(options) {
|
|
@@ -2106,6 +2168,9 @@ function useConfirmEndorsement(subjectHandleOrDid, options) {
|
|
|
2106
2168
|
const config = useSifaConfig();
|
|
2107
2169
|
const queryClient = useQueryClient();
|
|
2108
2170
|
return useMutation({
|
|
2171
|
+
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
2172
|
+
// one below and silently drop cache invalidation (#453).
|
|
2173
|
+
...options,
|
|
2109
2174
|
mutationFn: (data) => confirmEndorsement(config, data),
|
|
2110
2175
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2111
2176
|
if (result.success) {
|
|
@@ -2122,14 +2187,16 @@ function useConfirmEndorsement(subjectHandleOrDid, options) {
|
|
|
2122
2187
|
}
|
|
2123
2188
|
}
|
|
2124
2189
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2125
|
-
}
|
|
2126
|
-
...options
|
|
2190
|
+
}
|
|
2127
2191
|
});
|
|
2128
2192
|
}
|
|
2129
2193
|
function useDismissEndorsement(options) {
|
|
2130
2194
|
const config = useSifaConfig();
|
|
2131
2195
|
const queryClient = useQueryClient();
|
|
2132
2196
|
return useMutation({
|
|
2197
|
+
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
2198
|
+
// one below and silently drop cache invalidation (#453).
|
|
2199
|
+
...options,
|
|
2133
2200
|
mutationFn: (data) => dismissEndorsement(config, data),
|
|
2134
2201
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2135
2202
|
if (result.success) {
|
|
@@ -2138,8 +2205,7 @@ function useDismissEndorsement(options) {
|
|
|
2138
2205
|
});
|
|
2139
2206
|
}
|
|
2140
2207
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2141
|
-
}
|
|
2142
|
-
...options
|
|
2208
|
+
}
|
|
2143
2209
|
});
|
|
2144
2210
|
}
|
|
2145
2211
|
function usePendingConfirmations(options) {
|
|
@@ -2162,6 +2228,9 @@ function useCreateConfirmation(claimerHandleOrDid, options) {
|
|
|
2162
2228
|
const config = useSifaConfig();
|
|
2163
2229
|
const queryClient = useQueryClient();
|
|
2164
2230
|
return useMutation({
|
|
2231
|
+
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
2232
|
+
// one below and silently drop cache invalidation (#453).
|
|
2233
|
+
...options,
|
|
2165
2234
|
mutationFn: (data) => createConfirmation(config, data),
|
|
2166
2235
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2167
2236
|
if (result.success) {
|
|
@@ -2178,14 +2247,16 @@ function useCreateConfirmation(claimerHandleOrDid, options) {
|
|
|
2178
2247
|
}
|
|
2179
2248
|
}
|
|
2180
2249
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2181
|
-
}
|
|
2182
|
-
...options
|
|
2250
|
+
}
|
|
2183
2251
|
});
|
|
2184
2252
|
}
|
|
2185
2253
|
function useDismissConfirmation(options) {
|
|
2186
2254
|
const config = useSifaConfig();
|
|
2187
2255
|
const queryClient = useQueryClient();
|
|
2188
2256
|
return useMutation({
|
|
2257
|
+
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
2258
|
+
// one below and silently drop cache invalidation (#453).
|
|
2259
|
+
...options,
|
|
2189
2260
|
mutationFn: (data) => dismissConfirmation(config, data),
|
|
2190
2261
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2191
2262
|
if (result.success) {
|
|
@@ -2194,14 +2265,16 @@ function useDismissConfirmation(options) {
|
|
|
2194
2265
|
});
|
|
2195
2266
|
}
|
|
2196
2267
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2197
|
-
}
|
|
2198
|
-
...options
|
|
2268
|
+
}
|
|
2199
2269
|
});
|
|
2200
2270
|
}
|
|
2201
2271
|
function useRevokeConfirmation(claimerHandleOrDid, options) {
|
|
2202
2272
|
const config = useSifaConfig();
|
|
2203
2273
|
const queryClient = useQueryClient();
|
|
2204
2274
|
return useMutation({
|
|
2275
|
+
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
2276
|
+
// one below and silently drop cache invalidation (#453).
|
|
2277
|
+
...options,
|
|
2205
2278
|
mutationFn: (data) => revokeConfirmation(config, data),
|
|
2206
2279
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2207
2280
|
if (result.success) {
|
|
@@ -2215,8 +2288,7 @@ function useRevokeConfirmation(claimerHandleOrDid, options) {
|
|
|
2215
2288
|
}
|
|
2216
2289
|
}
|
|
2217
2290
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2218
|
-
}
|
|
2219
|
-
...options
|
|
2291
|
+
}
|
|
2220
2292
|
});
|
|
2221
2293
|
}
|
|
2222
2294
|
async function invalidateProfile6(queryClient, ownerHandleOrDid) {
|
|
@@ -2228,28 +2300,32 @@ function useHideKeytraceClaim(ownerHandleOrDid, options) {
|
|
|
2228
2300
|
const config = useSifaConfig();
|
|
2229
2301
|
const queryClient = useQueryClient();
|
|
2230
2302
|
return useMutation({
|
|
2303
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2304
|
+
// handler below and silently drop cache invalidation (#453).
|
|
2305
|
+
...options,
|
|
2231
2306
|
mutationFn: (rkey) => hideKeytraceClaim(config, rkey),
|
|
2232
2307
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2233
2308
|
if (result.success) {
|
|
2234
2309
|
await invalidateProfile6(queryClient, ownerHandleOrDid);
|
|
2235
2310
|
}
|
|
2236
2311
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2237
|
-
}
|
|
2238
|
-
...options
|
|
2312
|
+
}
|
|
2239
2313
|
});
|
|
2240
2314
|
}
|
|
2241
2315
|
function useUnhideKeytraceClaim(ownerHandleOrDid, options) {
|
|
2242
2316
|
const config = useSifaConfig();
|
|
2243
2317
|
const queryClient = useQueryClient();
|
|
2244
2318
|
return useMutation({
|
|
2319
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2320
|
+
// handler below and silently drop cache invalidation (#453).
|
|
2321
|
+
...options,
|
|
2245
2322
|
mutationFn: (rkey) => unhideKeytraceClaim(config, rkey),
|
|
2246
2323
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2247
2324
|
if (result.success) {
|
|
2248
2325
|
await invalidateProfile6(queryClient, ownerHandleOrDid);
|
|
2249
2326
|
}
|
|
2250
2327
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2251
|
-
}
|
|
2252
|
-
...options
|
|
2328
|
+
}
|
|
2253
2329
|
});
|
|
2254
2330
|
}
|
|
2255
2331
|
async function invalidateProfile7(queryClient, ownerHandleOrDid) {
|
|
@@ -2261,28 +2337,32 @@ function useRevealMarqueDomain(ownerHandleOrDid, options) {
|
|
|
2261
2337
|
const config = useSifaConfig();
|
|
2262
2338
|
const queryClient = useQueryClient();
|
|
2263
2339
|
return useMutation({
|
|
2340
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2341
|
+
// handler below and silently drop cache invalidation (#453).
|
|
2342
|
+
...options,
|
|
2264
2343
|
mutationFn: (domain) => revealMarqueDomain(config, domain),
|
|
2265
2344
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2266
2345
|
if (result.success) {
|
|
2267
2346
|
await invalidateProfile7(queryClient, ownerHandleOrDid);
|
|
2268
2347
|
}
|
|
2269
2348
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2270
|
-
}
|
|
2271
|
-
...options
|
|
2349
|
+
}
|
|
2272
2350
|
});
|
|
2273
2351
|
}
|
|
2274
2352
|
function useUnrevealMarqueDomain(ownerHandleOrDid, options) {
|
|
2275
2353
|
const config = useSifaConfig();
|
|
2276
2354
|
const queryClient = useQueryClient();
|
|
2277
2355
|
return useMutation({
|
|
2356
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2357
|
+
// handler below and silently drop cache invalidation (#453).
|
|
2358
|
+
...options,
|
|
2278
2359
|
mutationFn: (domain) => unrevealMarqueDomain(config, domain),
|
|
2279
2360
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2280
2361
|
if (result.success) {
|
|
2281
2362
|
await invalidateProfile7(queryClient, ownerHandleOrDid);
|
|
2282
2363
|
}
|
|
2283
2364
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2284
|
-
}
|
|
2285
|
-
...options
|
|
2365
|
+
}
|
|
2286
2366
|
});
|
|
2287
2367
|
}
|
|
2288
2368
|
async function invalidateProfile8(queryClient, ownerHandleOrDid) {
|
|
@@ -2295,14 +2375,16 @@ function makeWriteHook(fetcher) {
|
|
|
2295
2375
|
const config = useSifaConfig();
|
|
2296
2376
|
const queryClient = useQueryClient();
|
|
2297
2377
|
return useMutation({
|
|
2378
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2379
|
+
// handler below and silently drop cache invalidation (#453).
|
|
2380
|
+
...options,
|
|
2298
2381
|
mutationFn: (v) => fetcher(config, v),
|
|
2299
2382
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2300
2383
|
if (result.success) {
|
|
2301
2384
|
await invalidateProfile8(queryClient, ownerHandleOrDid);
|
|
2302
2385
|
}
|
|
2303
2386
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2304
|
-
}
|
|
2305
|
-
...options
|
|
2387
|
+
}
|
|
2306
2388
|
});
|
|
2307
2389
|
};
|
|
2308
2390
|
}
|
|
@@ -2340,8 +2422,7 @@ function useRefreshOrcidPublications(ownerHandleOrDid, options) {
|
|
|
2340
2422
|
await invalidateProfile8(queryClient, ownerHandleOrDid);
|
|
2341
2423
|
}
|
|
2342
2424
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2343
|
-
}
|
|
2344
|
-
...options
|
|
2425
|
+
}
|
|
2345
2426
|
});
|
|
2346
2427
|
}
|
|
2347
2428
|
async function invalidateProfile9(queryClient, ownerHandleOrDid) {
|
|
@@ -2528,6 +2609,9 @@ function useFollow(options) {
|
|
|
2528
2609
|
const config = useSifaConfig();
|
|
2529
2610
|
const queryClient = useQueryClient();
|
|
2530
2611
|
return useMutation({
|
|
2612
|
+
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
2613
|
+
// one below and silently drop cache invalidation (#453).
|
|
2614
|
+
...options,
|
|
2531
2615
|
mutationFn: ({ handle, note }) => followUser(config, handle, { note }),
|
|
2532
2616
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2533
2617
|
if (result.success) {
|
|
@@ -2538,14 +2622,16 @@ function useFollow(options) {
|
|
|
2538
2622
|
onError: async (error, variables, onMutateResult, context) => {
|
|
2539
2623
|
await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.follow.all() });
|
|
2540
2624
|
await options?.onError?.(error, variables, onMutateResult, context);
|
|
2541
|
-
}
|
|
2542
|
-
...options
|
|
2625
|
+
}
|
|
2543
2626
|
});
|
|
2544
2627
|
}
|
|
2545
2628
|
function useUnfollow(options) {
|
|
2546
2629
|
const config = useSifaConfig();
|
|
2547
2630
|
const queryClient = useQueryClient();
|
|
2548
2631
|
return useMutation({
|
|
2632
|
+
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
2633
|
+
// one below and silently drop cache invalidation (#453).
|
|
2634
|
+
...options,
|
|
2549
2635
|
mutationFn: ({ handle }) => unfollowUser(config, handle),
|
|
2550
2636
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2551
2637
|
if (result.success) {
|
|
@@ -2556,8 +2642,7 @@ function useUnfollow(options) {
|
|
|
2556
2642
|
onError: async (error, variables, onMutateResult, context) => {
|
|
2557
2643
|
await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.follow.all() });
|
|
2558
2644
|
await options?.onError?.(error, variables, onMutateResult, context);
|
|
2559
|
-
}
|
|
2560
|
-
...options
|
|
2645
|
+
}
|
|
2561
2646
|
});
|
|
2562
2647
|
}
|
|
2563
2648
|
function useFollowers(handle, opts = {}, options) {
|
|
@@ -2783,28 +2868,32 @@ function useCreateReaction(options) {
|
|
|
2783
2868
|
const config = useSifaConfig();
|
|
2784
2869
|
const queryClient = useQueryClient();
|
|
2785
2870
|
return useMutation({
|
|
2871
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2872
|
+
// handler below and silently drop cache invalidation (#453).
|
|
2873
|
+
...options,
|
|
2786
2874
|
mutationFn: ({ targetUri, appId, targetCid }) => createReaction(config, targetUri, appId, targetCid),
|
|
2787
2875
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2788
2876
|
if (result.ok) {
|
|
2789
2877
|
await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.reactions.all() });
|
|
2790
2878
|
}
|
|
2791
2879
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2792
|
-
}
|
|
2793
|
-
...options
|
|
2880
|
+
}
|
|
2794
2881
|
});
|
|
2795
2882
|
}
|
|
2796
2883
|
function useDeleteReaction(options) {
|
|
2797
2884
|
const config = useSifaConfig();
|
|
2798
2885
|
const queryClient = useQueryClient();
|
|
2799
2886
|
return useMutation({
|
|
2887
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2888
|
+
// handler below and silently drop cache invalidation (#453).
|
|
2889
|
+
...options,
|
|
2800
2890
|
mutationFn: ({ targetUri, appId }) => deleteReaction(config, targetUri, appId),
|
|
2801
2891
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2802
2892
|
if (result.success) {
|
|
2803
2893
|
await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.reactions.all() });
|
|
2804
2894
|
}
|
|
2805
2895
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2806
|
-
}
|
|
2807
|
-
...options
|
|
2896
|
+
}
|
|
2808
2897
|
});
|
|
2809
2898
|
}
|
|
2810
2899
|
function useRoadmapVotes(options) {
|
|
@@ -2830,28 +2919,32 @@ function useCastRoadmapVote(options) {
|
|
|
2830
2919
|
const config = useSifaConfig();
|
|
2831
2920
|
const queryClient = useQueryClient();
|
|
2832
2921
|
return useMutation({
|
|
2922
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2923
|
+
// handler below and silently drop cache invalidation (#453).
|
|
2924
|
+
...options,
|
|
2833
2925
|
mutationFn: (key) => castRoadmapVote(config, key),
|
|
2834
2926
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2835
2927
|
if (result.ok) {
|
|
2836
2928
|
await invalidateRoadmap(queryClient);
|
|
2837
2929
|
}
|
|
2838
2930
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2839
|
-
}
|
|
2840
|
-
...options
|
|
2931
|
+
}
|
|
2841
2932
|
});
|
|
2842
2933
|
}
|
|
2843
2934
|
function useRetractRoadmapVote(options) {
|
|
2844
2935
|
const config = useSifaConfig();
|
|
2845
2936
|
const queryClient = useQueryClient();
|
|
2846
2937
|
return useMutation({
|
|
2938
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
2939
|
+
// handler below and silently drop cache invalidation (#453).
|
|
2940
|
+
...options,
|
|
2847
2941
|
mutationFn: (key) => retractRoadmapVote(config, key),
|
|
2848
2942
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2849
2943
|
if (result.success) {
|
|
2850
2944
|
await invalidateRoadmap(queryClient);
|
|
2851
2945
|
}
|
|
2852
2946
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2853
|
-
}
|
|
2854
|
-
...options
|
|
2947
|
+
}
|
|
2855
2948
|
});
|
|
2856
2949
|
}
|
|
2857
2950
|
function useWipePreview(options) {
|
|
@@ -2868,28 +2961,32 @@ function useResetProfile(options) {
|
|
|
2868
2961
|
const config = useSifaConfig();
|
|
2869
2962
|
const queryClient = useQueryClient();
|
|
2870
2963
|
return useMutation({
|
|
2964
|
+
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
2965
|
+
// one below and silently drop cache invalidation (#453).
|
|
2966
|
+
...options,
|
|
2871
2967
|
mutationFn: (deletePdsData) => resetProfile(config, deletePdsData),
|
|
2872
2968
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2873
2969
|
if (result.success) {
|
|
2874
2970
|
await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.all() });
|
|
2875
2971
|
}
|
|
2876
2972
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2877
|
-
}
|
|
2878
|
-
...options
|
|
2973
|
+
}
|
|
2879
2974
|
});
|
|
2880
2975
|
}
|
|
2881
2976
|
function useDeleteAccount(options) {
|
|
2882
2977
|
const config = useSifaConfig();
|
|
2883
2978
|
const queryClient = useQueryClient();
|
|
2884
2979
|
return useMutation({
|
|
2980
|
+
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
2981
|
+
// one below and silently drop cache invalidation (#453).
|
|
2982
|
+
...options,
|
|
2885
2983
|
mutationFn: (deletePdsData) => deleteAccount(config, deletePdsData),
|
|
2886
2984
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2887
2985
|
if (result.success) {
|
|
2888
2986
|
queryClient.clear();
|
|
2889
2987
|
}
|
|
2890
2988
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2891
|
-
}
|
|
2892
|
-
...options
|
|
2989
|
+
}
|
|
2893
2990
|
});
|
|
2894
2991
|
}
|
|
2895
2992
|
function useRepoInventory(options) {
|
|
@@ -2906,12 +3003,14 @@ function useDeleteRepoRecords(options) {
|
|
|
2906
3003
|
const config = useSifaConfig();
|
|
2907
3004
|
const queryClient = useQueryClient();
|
|
2908
3005
|
return useMutation({
|
|
3006
|
+
// Spread first: a consumer-supplied handler would otherwise replace the
|
|
3007
|
+
// one below and silently drop cache invalidation (#453).
|
|
3008
|
+
...options,
|
|
2909
3009
|
mutationFn: (input) => deleteRepoRecords(config, input),
|
|
2910
3010
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
2911
3011
|
await queryClient.invalidateQueries({ queryKey: sifaQueryKeys.all() });
|
|
2912
3012
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
2913
|
-
}
|
|
2914
|
-
...options
|
|
3013
|
+
}
|
|
2915
3014
|
});
|
|
2916
3015
|
}
|
|
2917
3016
|
|
|
@@ -3044,6 +3143,9 @@ function useOrgClaim(handleOrDid, options) {
|
|
|
3044
3143
|
const config = useSifaConfig();
|
|
3045
3144
|
const queryClient = useQueryClient();
|
|
3046
3145
|
return useMutation({
|
|
3146
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
3147
|
+
// handler below and silently drop cache invalidation (#453).
|
|
3148
|
+
...options,
|
|
3047
3149
|
mutationFn: (body) => submitOrgClaim(config, body),
|
|
3048
3150
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
3049
3151
|
if (result.success && handleOrDid) {
|
|
@@ -3052,14 +3154,16 @@ function useOrgClaim(handleOrDid, options) {
|
|
|
3052
3154
|
});
|
|
3053
3155
|
}
|
|
3054
3156
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
3055
|
-
}
|
|
3056
|
-
...options
|
|
3157
|
+
}
|
|
3057
3158
|
});
|
|
3058
3159
|
}
|
|
3059
3160
|
function useUpdateOrgProfile(handleOrDid, options) {
|
|
3060
3161
|
const config = useSifaConfig();
|
|
3061
3162
|
const queryClient = useQueryClient();
|
|
3062
3163
|
return useMutation({
|
|
3164
|
+
// Spread first: a consumer-supplied onSuccess would otherwise replace the
|
|
3165
|
+
// handler below and silently drop cache invalidation (#453).
|
|
3166
|
+
...options,
|
|
3063
3167
|
mutationFn: (body) => updateOrgProfile(config, body),
|
|
3064
3168
|
onSuccess: async (result, variables, onMutateResult, context) => {
|
|
3065
3169
|
if (result.success && handleOrDid) {
|
|
@@ -3068,8 +3172,7 @@ function useUpdateOrgProfile(handleOrDid, options) {
|
|
|
3068
3172
|
});
|
|
3069
3173
|
}
|
|
3070
3174
|
await options?.onSuccess?.(result, variables, onMutateResult, context);
|
|
3071
|
-
}
|
|
3072
|
-
...options
|
|
3175
|
+
}
|
|
3073
3176
|
});
|
|
3074
3177
|
}
|
|
3075
3178
|
function useOrgDomainChallenge(options) {
|