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