@liveblocks/core 2.5.1 → 2.6.0
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.d.mts +168 -170
- package/dist/index.d.ts +168 -170
- package/dist/index.js +412 -420
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +403 -411
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1723,175 +1723,6 @@ declare type GetThreadsOptions<M extends BaseMetadata> = {
|
|
|
1723
1723
|
metadata?: Partial<QueryMetadata<M>>;
|
|
1724
1724
|
};
|
|
1725
1725
|
};
|
|
1726
|
-
declare type CommentsApi<M extends BaseMetadata> = {
|
|
1727
|
-
/**
|
|
1728
|
-
* Returns the threads within the current room and their associated inbox notifications.
|
|
1729
|
-
* It also returns the request date that can be used for subsequent polling.
|
|
1730
|
-
*
|
|
1731
|
-
* @example
|
|
1732
|
-
* const {
|
|
1733
|
-
* threads,
|
|
1734
|
-
* inboxNotifications,
|
|
1735
|
-
* requestedAt
|
|
1736
|
-
* } = await room.getThreads({ query: { resolved: false }});
|
|
1737
|
-
*/
|
|
1738
|
-
getThreads(options?: GetThreadsOptions<M>): Promise<{
|
|
1739
|
-
threads: ThreadData<M>[];
|
|
1740
|
-
inboxNotifications: InboxNotificationData[];
|
|
1741
|
-
requestedAt: Date;
|
|
1742
|
-
}>;
|
|
1743
|
-
/**
|
|
1744
|
-
* Returns the updated and deleted threads and their associated inbox notifications since the requested date.
|
|
1745
|
-
*
|
|
1746
|
-
* @example
|
|
1747
|
-
* const result = await room.getThreads();
|
|
1748
|
-
* // ... //
|
|
1749
|
-
* await room.getThreadsSince({ since: result.requestedAt });
|
|
1750
|
-
*/
|
|
1751
|
-
getThreadsSince(options: {
|
|
1752
|
-
since: Date;
|
|
1753
|
-
}): Promise<{
|
|
1754
|
-
threads: {
|
|
1755
|
-
updated: ThreadData<M>[];
|
|
1756
|
-
deleted: ThreadDeleteInfo[];
|
|
1757
|
-
};
|
|
1758
|
-
inboxNotifications: {
|
|
1759
|
-
updated: InboxNotificationData[];
|
|
1760
|
-
deleted: InboxNotificationDeleteInfo[];
|
|
1761
|
-
};
|
|
1762
|
-
requestedAt: Date;
|
|
1763
|
-
}>;
|
|
1764
|
-
/**
|
|
1765
|
-
* Returns a thread and the associated inbox notification if it exists.
|
|
1766
|
-
*
|
|
1767
|
-
* @example
|
|
1768
|
-
* const { thread, inboxNotification } = await room.getThread("th_xxx");
|
|
1769
|
-
*/
|
|
1770
|
-
getThread(threadId: string): Promise<{
|
|
1771
|
-
thread?: ThreadData<M>;
|
|
1772
|
-
inboxNotification?: InboxNotificationData;
|
|
1773
|
-
}>;
|
|
1774
|
-
/**
|
|
1775
|
-
* Creates a thread.
|
|
1776
|
-
*
|
|
1777
|
-
* @example
|
|
1778
|
-
* const thread = await room.createThread({
|
|
1779
|
-
* body: {
|
|
1780
|
-
* version: 1,
|
|
1781
|
-
* content: [{ type: "paragraph", children: [{ text: "Hello" }] }],
|
|
1782
|
-
* },
|
|
1783
|
-
* })
|
|
1784
|
-
*/
|
|
1785
|
-
createThread(options: {
|
|
1786
|
-
threadId?: string;
|
|
1787
|
-
commentId?: string;
|
|
1788
|
-
metadata: M | undefined;
|
|
1789
|
-
body: CommentBody;
|
|
1790
|
-
}): Promise<ThreadData<M>>;
|
|
1791
|
-
/**
|
|
1792
|
-
* Deletes a thread.
|
|
1793
|
-
*
|
|
1794
|
-
* @example
|
|
1795
|
-
* await room.deleteThread("th_xxx");
|
|
1796
|
-
*/
|
|
1797
|
-
deleteThread(threadId: string): Promise<void>;
|
|
1798
|
-
/**
|
|
1799
|
-
* Edits a thread's metadata.
|
|
1800
|
-
* To delete an existing metadata property, set its value to `null`.
|
|
1801
|
-
*
|
|
1802
|
-
* @example
|
|
1803
|
-
* await room.editThreadMetadata({ threadId: "th_xxx", metadata: { x: 100, y: 100 } })
|
|
1804
|
-
*/
|
|
1805
|
-
editThreadMetadata(options: {
|
|
1806
|
-
metadata: Patchable<M>;
|
|
1807
|
-
threadId: string;
|
|
1808
|
-
}): Promise<M>;
|
|
1809
|
-
/**
|
|
1810
|
-
* Marks a thread as resolved.
|
|
1811
|
-
*
|
|
1812
|
-
* @example
|
|
1813
|
-
* await room.markThreadAsResolved("th_xxx");
|
|
1814
|
-
*/
|
|
1815
|
-
markThreadAsResolved(threadId: string): Promise<void>;
|
|
1816
|
-
/**
|
|
1817
|
-
* Marks a thread as unresolved.
|
|
1818
|
-
*
|
|
1819
|
-
* @example
|
|
1820
|
-
* await room.markThreadAsUnresolved("th_xxx");
|
|
1821
|
-
*/
|
|
1822
|
-
markThreadAsUnresolved(threadId: string): Promise<void>;
|
|
1823
|
-
/**
|
|
1824
|
-
* Creates a comment.
|
|
1825
|
-
*
|
|
1826
|
-
* @example
|
|
1827
|
-
* await room.createComment({
|
|
1828
|
-
* threadId: "th_xxx",
|
|
1829
|
-
* body: {
|
|
1830
|
-
* version: 1,
|
|
1831
|
-
* content: [{ type: "paragraph", children: [{ text: "Hello" }] }],
|
|
1832
|
-
* },
|
|
1833
|
-
* });
|
|
1834
|
-
*/
|
|
1835
|
-
createComment(options: {
|
|
1836
|
-
threadId: string;
|
|
1837
|
-
commentId?: string;
|
|
1838
|
-
body: CommentBody;
|
|
1839
|
-
}): Promise<CommentData>;
|
|
1840
|
-
/**
|
|
1841
|
-
* Edits a comment.
|
|
1842
|
-
*
|
|
1843
|
-
* @example
|
|
1844
|
-
* await room.editComment({
|
|
1845
|
-
* threadId: "th_xxx",
|
|
1846
|
-
* commentId: "cm_xxx"
|
|
1847
|
-
* body: {
|
|
1848
|
-
* version: 1,
|
|
1849
|
-
* content: [{ type: "paragraph", children: [{ text: "Hello" }] }],
|
|
1850
|
-
* },
|
|
1851
|
-
* });
|
|
1852
|
-
*/
|
|
1853
|
-
editComment(options: {
|
|
1854
|
-
threadId: string;
|
|
1855
|
-
commentId: string;
|
|
1856
|
-
body: CommentBody;
|
|
1857
|
-
}): Promise<CommentData>;
|
|
1858
|
-
/**
|
|
1859
|
-
* Deletes a comment.
|
|
1860
|
-
* If it is the last non-deleted comment, the thread also gets deleted.
|
|
1861
|
-
*
|
|
1862
|
-
* @example
|
|
1863
|
-
* await room.deleteComment({
|
|
1864
|
-
* threadId: "th_xxx",
|
|
1865
|
-
* commentId: "cm_xxx"
|
|
1866
|
-
* });
|
|
1867
|
-
*/
|
|
1868
|
-
deleteComment(options: {
|
|
1869
|
-
threadId: string;
|
|
1870
|
-
commentId: string;
|
|
1871
|
-
}): Promise<void>;
|
|
1872
|
-
/**
|
|
1873
|
-
* Adds a reaction from a comment for the current user.
|
|
1874
|
-
*
|
|
1875
|
-
* @example
|
|
1876
|
-
* await room.addReaction({ threadId: "th_xxx", commentId: "cm_xxx", emoji: "👍" })
|
|
1877
|
-
*/
|
|
1878
|
-
addReaction(options: {
|
|
1879
|
-
threadId: string;
|
|
1880
|
-
commentId: string;
|
|
1881
|
-
emoji: string;
|
|
1882
|
-
}): Promise<CommentUserReaction>;
|
|
1883
|
-
/**
|
|
1884
|
-
* Removes a reaction from a comment.
|
|
1885
|
-
*
|
|
1886
|
-
* @example
|
|
1887
|
-
* await room.removeReaction({ threadId: "th_xxx", commentId: "cm_xxx", emoji: "👍" })
|
|
1888
|
-
*/
|
|
1889
|
-
removeReaction(options: {
|
|
1890
|
-
threadId: string;
|
|
1891
|
-
commentId: string;
|
|
1892
|
-
emoji: string;
|
|
1893
|
-
}): Promise<void>;
|
|
1894
|
-
};
|
|
1895
1726
|
/**
|
|
1896
1727
|
* @private Widest-possible Room type, matching _any_ Room instance. Note that
|
|
1897
1728
|
* this type is different from `Room`-without-type-arguments. That represents
|
|
@@ -2100,6 +1931,173 @@ declare type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extend
|
|
|
2100
1931
|
* connection. If the room is not connected yet, initiate it.
|
|
2101
1932
|
*/
|
|
2102
1933
|
reconnect(): void;
|
|
1934
|
+
/**
|
|
1935
|
+
* Returns the threads within the current room and their associated inbox notifications.
|
|
1936
|
+
* It also returns the request date that can be used for subsequent polling.
|
|
1937
|
+
*
|
|
1938
|
+
* @example
|
|
1939
|
+
* const {
|
|
1940
|
+
* threads,
|
|
1941
|
+
* inboxNotifications,
|
|
1942
|
+
* requestedAt
|
|
1943
|
+
* } = await room.getThreads({ query: { resolved: false }});
|
|
1944
|
+
*/
|
|
1945
|
+
getThreads(options?: GetThreadsOptions<M>): Promise<{
|
|
1946
|
+
threads: ThreadData<M>[];
|
|
1947
|
+
inboxNotifications: InboxNotificationData[];
|
|
1948
|
+
requestedAt: Date;
|
|
1949
|
+
}>;
|
|
1950
|
+
/**
|
|
1951
|
+
* Returns the updated and deleted threads and their associated inbox notifications since the requested date.
|
|
1952
|
+
*
|
|
1953
|
+
* @example
|
|
1954
|
+
* const result = await room.getThreads();
|
|
1955
|
+
* // ... //
|
|
1956
|
+
* await room.getThreadsSince({ since: result.requestedAt });
|
|
1957
|
+
*/
|
|
1958
|
+
getThreadsSince(options: {
|
|
1959
|
+
since: Date;
|
|
1960
|
+
}): Promise<{
|
|
1961
|
+
threads: {
|
|
1962
|
+
updated: ThreadData<M>[];
|
|
1963
|
+
deleted: ThreadDeleteInfo[];
|
|
1964
|
+
};
|
|
1965
|
+
inboxNotifications: {
|
|
1966
|
+
updated: InboxNotificationData[];
|
|
1967
|
+
deleted: InboxNotificationDeleteInfo[];
|
|
1968
|
+
};
|
|
1969
|
+
requestedAt: Date;
|
|
1970
|
+
}>;
|
|
1971
|
+
/**
|
|
1972
|
+
* Returns a thread and the associated inbox notification if it exists.
|
|
1973
|
+
*
|
|
1974
|
+
* @example
|
|
1975
|
+
* const { thread, inboxNotification } = await room.getThread("th_xxx");
|
|
1976
|
+
*/
|
|
1977
|
+
getThread(threadId: string): Promise<{
|
|
1978
|
+
thread?: ThreadData<M>;
|
|
1979
|
+
inboxNotification?: InboxNotificationData;
|
|
1980
|
+
}>;
|
|
1981
|
+
/**
|
|
1982
|
+
* Creates a thread.
|
|
1983
|
+
*
|
|
1984
|
+
* @example
|
|
1985
|
+
* const thread = await room.createThread({
|
|
1986
|
+
* body: {
|
|
1987
|
+
* version: 1,
|
|
1988
|
+
* content: [{ type: "paragraph", children: [{ text: "Hello" }] }],
|
|
1989
|
+
* },
|
|
1990
|
+
* })
|
|
1991
|
+
*/
|
|
1992
|
+
createThread(options: {
|
|
1993
|
+
threadId?: string;
|
|
1994
|
+
commentId?: string;
|
|
1995
|
+
metadata: M | undefined;
|
|
1996
|
+
body: CommentBody;
|
|
1997
|
+
}): Promise<ThreadData<M>>;
|
|
1998
|
+
/**
|
|
1999
|
+
* Deletes a thread.
|
|
2000
|
+
*
|
|
2001
|
+
* @example
|
|
2002
|
+
* await room.deleteThread("th_xxx");
|
|
2003
|
+
*/
|
|
2004
|
+
deleteThread(threadId: string): Promise<void>;
|
|
2005
|
+
/**
|
|
2006
|
+
* Edits a thread's metadata.
|
|
2007
|
+
* To delete an existing metadata property, set its value to `null`.
|
|
2008
|
+
*
|
|
2009
|
+
* @example
|
|
2010
|
+
* await room.editThreadMetadata({ threadId: "th_xxx", metadata: { x: 100, y: 100 } })
|
|
2011
|
+
*/
|
|
2012
|
+
editThreadMetadata(options: {
|
|
2013
|
+
metadata: Patchable<M>;
|
|
2014
|
+
threadId: string;
|
|
2015
|
+
}): Promise<M>;
|
|
2016
|
+
/**
|
|
2017
|
+
* Marks a thread as resolved.
|
|
2018
|
+
*
|
|
2019
|
+
* @example
|
|
2020
|
+
* await room.markThreadAsResolved("th_xxx");
|
|
2021
|
+
*/
|
|
2022
|
+
markThreadAsResolved(threadId: string): Promise<void>;
|
|
2023
|
+
/**
|
|
2024
|
+
* Marks a thread as unresolved.
|
|
2025
|
+
*
|
|
2026
|
+
* @example
|
|
2027
|
+
* await room.markThreadAsUnresolved("th_xxx");
|
|
2028
|
+
*/
|
|
2029
|
+
markThreadAsUnresolved(threadId: string): Promise<void>;
|
|
2030
|
+
/**
|
|
2031
|
+
* Creates a comment.
|
|
2032
|
+
*
|
|
2033
|
+
* @example
|
|
2034
|
+
* await room.createComment({
|
|
2035
|
+
* threadId: "th_xxx",
|
|
2036
|
+
* body: {
|
|
2037
|
+
* version: 1,
|
|
2038
|
+
* content: [{ type: "paragraph", children: [{ text: "Hello" }] }],
|
|
2039
|
+
* },
|
|
2040
|
+
* });
|
|
2041
|
+
*/
|
|
2042
|
+
createComment(options: {
|
|
2043
|
+
threadId: string;
|
|
2044
|
+
commentId?: string;
|
|
2045
|
+
body: CommentBody;
|
|
2046
|
+
}): Promise<CommentData>;
|
|
2047
|
+
/**
|
|
2048
|
+
* Edits a comment.
|
|
2049
|
+
*
|
|
2050
|
+
* @example
|
|
2051
|
+
* await room.editComment({
|
|
2052
|
+
* threadId: "th_xxx",
|
|
2053
|
+
* commentId: "cm_xxx"
|
|
2054
|
+
* body: {
|
|
2055
|
+
* version: 1,
|
|
2056
|
+
* content: [{ type: "paragraph", children: [{ text: "Hello" }] }],
|
|
2057
|
+
* },
|
|
2058
|
+
* });
|
|
2059
|
+
*/
|
|
2060
|
+
editComment(options: {
|
|
2061
|
+
threadId: string;
|
|
2062
|
+
commentId: string;
|
|
2063
|
+
body: CommentBody;
|
|
2064
|
+
}): Promise<CommentData>;
|
|
2065
|
+
/**
|
|
2066
|
+
* Deletes a comment.
|
|
2067
|
+
* If it is the last non-deleted comment, the thread also gets deleted.
|
|
2068
|
+
*
|
|
2069
|
+
* @example
|
|
2070
|
+
* await room.deleteComment({
|
|
2071
|
+
* threadId: "th_xxx",
|
|
2072
|
+
* commentId: "cm_xxx"
|
|
2073
|
+
* });
|
|
2074
|
+
*/
|
|
2075
|
+
deleteComment(options: {
|
|
2076
|
+
threadId: string;
|
|
2077
|
+
commentId: string;
|
|
2078
|
+
}): Promise<void>;
|
|
2079
|
+
/**
|
|
2080
|
+
* Adds a reaction from a comment for the current user.
|
|
2081
|
+
*
|
|
2082
|
+
* @example
|
|
2083
|
+
* await room.addReaction({ threadId: "th_xxx", commentId: "cm_xxx", emoji: "👍" })
|
|
2084
|
+
*/
|
|
2085
|
+
addReaction(options: {
|
|
2086
|
+
threadId: string;
|
|
2087
|
+
commentId: string;
|
|
2088
|
+
emoji: string;
|
|
2089
|
+
}): Promise<CommentUserReaction>;
|
|
2090
|
+
/**
|
|
2091
|
+
* Removes a reaction from a comment.
|
|
2092
|
+
*
|
|
2093
|
+
* @example
|
|
2094
|
+
* await room.removeReaction({ threadId: "th_xxx", commentId: "cm_xxx", emoji: "👍" })
|
|
2095
|
+
*/
|
|
2096
|
+
removeReaction(options: {
|
|
2097
|
+
threadId: string;
|
|
2098
|
+
commentId: string;
|
|
2099
|
+
emoji: string;
|
|
2100
|
+
}): Promise<void>;
|
|
2103
2101
|
/**
|
|
2104
2102
|
* Gets the user's notification settings for the current room.
|
|
2105
2103
|
*
|
|
@@ -2118,7 +2116,7 @@ declare type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extend
|
|
|
2118
2116
|
* Internal use only. Signature might change in the future.
|
|
2119
2117
|
*/
|
|
2120
2118
|
markInboxNotificationAsRead(notificationId: string): Promise<void>;
|
|
2121
|
-
}
|
|
2119
|
+
};
|
|
2122
2120
|
declare type Provider = {
|
|
2123
2121
|
synced: boolean;
|
|
2124
2122
|
getStatus: () => "loading" | "synchronizing" | "synchronized";
|
package/dist/index.d.ts
CHANGED
|
@@ -1723,175 +1723,6 @@ declare type GetThreadsOptions<M extends BaseMetadata> = {
|
|
|
1723
1723
|
metadata?: Partial<QueryMetadata<M>>;
|
|
1724
1724
|
};
|
|
1725
1725
|
};
|
|
1726
|
-
declare type CommentsApi<M extends BaseMetadata> = {
|
|
1727
|
-
/**
|
|
1728
|
-
* Returns the threads within the current room and their associated inbox notifications.
|
|
1729
|
-
* It also returns the request date that can be used for subsequent polling.
|
|
1730
|
-
*
|
|
1731
|
-
* @example
|
|
1732
|
-
* const {
|
|
1733
|
-
* threads,
|
|
1734
|
-
* inboxNotifications,
|
|
1735
|
-
* requestedAt
|
|
1736
|
-
* } = await room.getThreads({ query: { resolved: false }});
|
|
1737
|
-
*/
|
|
1738
|
-
getThreads(options?: GetThreadsOptions<M>): Promise<{
|
|
1739
|
-
threads: ThreadData<M>[];
|
|
1740
|
-
inboxNotifications: InboxNotificationData[];
|
|
1741
|
-
requestedAt: Date;
|
|
1742
|
-
}>;
|
|
1743
|
-
/**
|
|
1744
|
-
* Returns the updated and deleted threads and their associated inbox notifications since the requested date.
|
|
1745
|
-
*
|
|
1746
|
-
* @example
|
|
1747
|
-
* const result = await room.getThreads();
|
|
1748
|
-
* // ... //
|
|
1749
|
-
* await room.getThreadsSince({ since: result.requestedAt });
|
|
1750
|
-
*/
|
|
1751
|
-
getThreadsSince(options: {
|
|
1752
|
-
since: Date;
|
|
1753
|
-
}): Promise<{
|
|
1754
|
-
threads: {
|
|
1755
|
-
updated: ThreadData<M>[];
|
|
1756
|
-
deleted: ThreadDeleteInfo[];
|
|
1757
|
-
};
|
|
1758
|
-
inboxNotifications: {
|
|
1759
|
-
updated: InboxNotificationData[];
|
|
1760
|
-
deleted: InboxNotificationDeleteInfo[];
|
|
1761
|
-
};
|
|
1762
|
-
requestedAt: Date;
|
|
1763
|
-
}>;
|
|
1764
|
-
/**
|
|
1765
|
-
* Returns a thread and the associated inbox notification if it exists.
|
|
1766
|
-
*
|
|
1767
|
-
* @example
|
|
1768
|
-
* const { thread, inboxNotification } = await room.getThread("th_xxx");
|
|
1769
|
-
*/
|
|
1770
|
-
getThread(threadId: string): Promise<{
|
|
1771
|
-
thread?: ThreadData<M>;
|
|
1772
|
-
inboxNotification?: InboxNotificationData;
|
|
1773
|
-
}>;
|
|
1774
|
-
/**
|
|
1775
|
-
* Creates a thread.
|
|
1776
|
-
*
|
|
1777
|
-
* @example
|
|
1778
|
-
* const thread = await room.createThread({
|
|
1779
|
-
* body: {
|
|
1780
|
-
* version: 1,
|
|
1781
|
-
* content: [{ type: "paragraph", children: [{ text: "Hello" }] }],
|
|
1782
|
-
* },
|
|
1783
|
-
* })
|
|
1784
|
-
*/
|
|
1785
|
-
createThread(options: {
|
|
1786
|
-
threadId?: string;
|
|
1787
|
-
commentId?: string;
|
|
1788
|
-
metadata: M | undefined;
|
|
1789
|
-
body: CommentBody;
|
|
1790
|
-
}): Promise<ThreadData<M>>;
|
|
1791
|
-
/**
|
|
1792
|
-
* Deletes a thread.
|
|
1793
|
-
*
|
|
1794
|
-
* @example
|
|
1795
|
-
* await room.deleteThread("th_xxx");
|
|
1796
|
-
*/
|
|
1797
|
-
deleteThread(threadId: string): Promise<void>;
|
|
1798
|
-
/**
|
|
1799
|
-
* Edits a thread's metadata.
|
|
1800
|
-
* To delete an existing metadata property, set its value to `null`.
|
|
1801
|
-
*
|
|
1802
|
-
* @example
|
|
1803
|
-
* await room.editThreadMetadata({ threadId: "th_xxx", metadata: { x: 100, y: 100 } })
|
|
1804
|
-
*/
|
|
1805
|
-
editThreadMetadata(options: {
|
|
1806
|
-
metadata: Patchable<M>;
|
|
1807
|
-
threadId: string;
|
|
1808
|
-
}): Promise<M>;
|
|
1809
|
-
/**
|
|
1810
|
-
* Marks a thread as resolved.
|
|
1811
|
-
*
|
|
1812
|
-
* @example
|
|
1813
|
-
* await room.markThreadAsResolved("th_xxx");
|
|
1814
|
-
*/
|
|
1815
|
-
markThreadAsResolved(threadId: string): Promise<void>;
|
|
1816
|
-
/**
|
|
1817
|
-
* Marks a thread as unresolved.
|
|
1818
|
-
*
|
|
1819
|
-
* @example
|
|
1820
|
-
* await room.markThreadAsUnresolved("th_xxx");
|
|
1821
|
-
*/
|
|
1822
|
-
markThreadAsUnresolved(threadId: string): Promise<void>;
|
|
1823
|
-
/**
|
|
1824
|
-
* Creates a comment.
|
|
1825
|
-
*
|
|
1826
|
-
* @example
|
|
1827
|
-
* await room.createComment({
|
|
1828
|
-
* threadId: "th_xxx",
|
|
1829
|
-
* body: {
|
|
1830
|
-
* version: 1,
|
|
1831
|
-
* content: [{ type: "paragraph", children: [{ text: "Hello" }] }],
|
|
1832
|
-
* },
|
|
1833
|
-
* });
|
|
1834
|
-
*/
|
|
1835
|
-
createComment(options: {
|
|
1836
|
-
threadId: string;
|
|
1837
|
-
commentId?: string;
|
|
1838
|
-
body: CommentBody;
|
|
1839
|
-
}): Promise<CommentData>;
|
|
1840
|
-
/**
|
|
1841
|
-
* Edits a comment.
|
|
1842
|
-
*
|
|
1843
|
-
* @example
|
|
1844
|
-
* await room.editComment({
|
|
1845
|
-
* threadId: "th_xxx",
|
|
1846
|
-
* commentId: "cm_xxx"
|
|
1847
|
-
* body: {
|
|
1848
|
-
* version: 1,
|
|
1849
|
-
* content: [{ type: "paragraph", children: [{ text: "Hello" }] }],
|
|
1850
|
-
* },
|
|
1851
|
-
* });
|
|
1852
|
-
*/
|
|
1853
|
-
editComment(options: {
|
|
1854
|
-
threadId: string;
|
|
1855
|
-
commentId: string;
|
|
1856
|
-
body: CommentBody;
|
|
1857
|
-
}): Promise<CommentData>;
|
|
1858
|
-
/**
|
|
1859
|
-
* Deletes a comment.
|
|
1860
|
-
* If it is the last non-deleted comment, the thread also gets deleted.
|
|
1861
|
-
*
|
|
1862
|
-
* @example
|
|
1863
|
-
* await room.deleteComment({
|
|
1864
|
-
* threadId: "th_xxx",
|
|
1865
|
-
* commentId: "cm_xxx"
|
|
1866
|
-
* });
|
|
1867
|
-
*/
|
|
1868
|
-
deleteComment(options: {
|
|
1869
|
-
threadId: string;
|
|
1870
|
-
commentId: string;
|
|
1871
|
-
}): Promise<void>;
|
|
1872
|
-
/**
|
|
1873
|
-
* Adds a reaction from a comment for the current user.
|
|
1874
|
-
*
|
|
1875
|
-
* @example
|
|
1876
|
-
* await room.addReaction({ threadId: "th_xxx", commentId: "cm_xxx", emoji: "👍" })
|
|
1877
|
-
*/
|
|
1878
|
-
addReaction(options: {
|
|
1879
|
-
threadId: string;
|
|
1880
|
-
commentId: string;
|
|
1881
|
-
emoji: string;
|
|
1882
|
-
}): Promise<CommentUserReaction>;
|
|
1883
|
-
/**
|
|
1884
|
-
* Removes a reaction from a comment.
|
|
1885
|
-
*
|
|
1886
|
-
* @example
|
|
1887
|
-
* await room.removeReaction({ threadId: "th_xxx", commentId: "cm_xxx", emoji: "👍" })
|
|
1888
|
-
*/
|
|
1889
|
-
removeReaction(options: {
|
|
1890
|
-
threadId: string;
|
|
1891
|
-
commentId: string;
|
|
1892
|
-
emoji: string;
|
|
1893
|
-
}): Promise<void>;
|
|
1894
|
-
};
|
|
1895
1726
|
/**
|
|
1896
1727
|
* @private Widest-possible Room type, matching _any_ Room instance. Note that
|
|
1897
1728
|
* this type is different from `Room`-without-type-arguments. That represents
|
|
@@ -2100,6 +1931,173 @@ declare type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extend
|
|
|
2100
1931
|
* connection. If the room is not connected yet, initiate it.
|
|
2101
1932
|
*/
|
|
2102
1933
|
reconnect(): void;
|
|
1934
|
+
/**
|
|
1935
|
+
* Returns the threads within the current room and their associated inbox notifications.
|
|
1936
|
+
* It also returns the request date that can be used for subsequent polling.
|
|
1937
|
+
*
|
|
1938
|
+
* @example
|
|
1939
|
+
* const {
|
|
1940
|
+
* threads,
|
|
1941
|
+
* inboxNotifications,
|
|
1942
|
+
* requestedAt
|
|
1943
|
+
* } = await room.getThreads({ query: { resolved: false }});
|
|
1944
|
+
*/
|
|
1945
|
+
getThreads(options?: GetThreadsOptions<M>): Promise<{
|
|
1946
|
+
threads: ThreadData<M>[];
|
|
1947
|
+
inboxNotifications: InboxNotificationData[];
|
|
1948
|
+
requestedAt: Date;
|
|
1949
|
+
}>;
|
|
1950
|
+
/**
|
|
1951
|
+
* Returns the updated and deleted threads and their associated inbox notifications since the requested date.
|
|
1952
|
+
*
|
|
1953
|
+
* @example
|
|
1954
|
+
* const result = await room.getThreads();
|
|
1955
|
+
* // ... //
|
|
1956
|
+
* await room.getThreadsSince({ since: result.requestedAt });
|
|
1957
|
+
*/
|
|
1958
|
+
getThreadsSince(options: {
|
|
1959
|
+
since: Date;
|
|
1960
|
+
}): Promise<{
|
|
1961
|
+
threads: {
|
|
1962
|
+
updated: ThreadData<M>[];
|
|
1963
|
+
deleted: ThreadDeleteInfo[];
|
|
1964
|
+
};
|
|
1965
|
+
inboxNotifications: {
|
|
1966
|
+
updated: InboxNotificationData[];
|
|
1967
|
+
deleted: InboxNotificationDeleteInfo[];
|
|
1968
|
+
};
|
|
1969
|
+
requestedAt: Date;
|
|
1970
|
+
}>;
|
|
1971
|
+
/**
|
|
1972
|
+
* Returns a thread and the associated inbox notification if it exists.
|
|
1973
|
+
*
|
|
1974
|
+
* @example
|
|
1975
|
+
* const { thread, inboxNotification } = await room.getThread("th_xxx");
|
|
1976
|
+
*/
|
|
1977
|
+
getThread(threadId: string): Promise<{
|
|
1978
|
+
thread?: ThreadData<M>;
|
|
1979
|
+
inboxNotification?: InboxNotificationData;
|
|
1980
|
+
}>;
|
|
1981
|
+
/**
|
|
1982
|
+
* Creates a thread.
|
|
1983
|
+
*
|
|
1984
|
+
* @example
|
|
1985
|
+
* const thread = await room.createThread({
|
|
1986
|
+
* body: {
|
|
1987
|
+
* version: 1,
|
|
1988
|
+
* content: [{ type: "paragraph", children: [{ text: "Hello" }] }],
|
|
1989
|
+
* },
|
|
1990
|
+
* })
|
|
1991
|
+
*/
|
|
1992
|
+
createThread(options: {
|
|
1993
|
+
threadId?: string;
|
|
1994
|
+
commentId?: string;
|
|
1995
|
+
metadata: M | undefined;
|
|
1996
|
+
body: CommentBody;
|
|
1997
|
+
}): Promise<ThreadData<M>>;
|
|
1998
|
+
/**
|
|
1999
|
+
* Deletes a thread.
|
|
2000
|
+
*
|
|
2001
|
+
* @example
|
|
2002
|
+
* await room.deleteThread("th_xxx");
|
|
2003
|
+
*/
|
|
2004
|
+
deleteThread(threadId: string): Promise<void>;
|
|
2005
|
+
/**
|
|
2006
|
+
* Edits a thread's metadata.
|
|
2007
|
+
* To delete an existing metadata property, set its value to `null`.
|
|
2008
|
+
*
|
|
2009
|
+
* @example
|
|
2010
|
+
* await room.editThreadMetadata({ threadId: "th_xxx", metadata: { x: 100, y: 100 } })
|
|
2011
|
+
*/
|
|
2012
|
+
editThreadMetadata(options: {
|
|
2013
|
+
metadata: Patchable<M>;
|
|
2014
|
+
threadId: string;
|
|
2015
|
+
}): Promise<M>;
|
|
2016
|
+
/**
|
|
2017
|
+
* Marks a thread as resolved.
|
|
2018
|
+
*
|
|
2019
|
+
* @example
|
|
2020
|
+
* await room.markThreadAsResolved("th_xxx");
|
|
2021
|
+
*/
|
|
2022
|
+
markThreadAsResolved(threadId: string): Promise<void>;
|
|
2023
|
+
/**
|
|
2024
|
+
* Marks a thread as unresolved.
|
|
2025
|
+
*
|
|
2026
|
+
* @example
|
|
2027
|
+
* await room.markThreadAsUnresolved("th_xxx");
|
|
2028
|
+
*/
|
|
2029
|
+
markThreadAsUnresolved(threadId: string): Promise<void>;
|
|
2030
|
+
/**
|
|
2031
|
+
* Creates a comment.
|
|
2032
|
+
*
|
|
2033
|
+
* @example
|
|
2034
|
+
* await room.createComment({
|
|
2035
|
+
* threadId: "th_xxx",
|
|
2036
|
+
* body: {
|
|
2037
|
+
* version: 1,
|
|
2038
|
+
* content: [{ type: "paragraph", children: [{ text: "Hello" }] }],
|
|
2039
|
+
* },
|
|
2040
|
+
* });
|
|
2041
|
+
*/
|
|
2042
|
+
createComment(options: {
|
|
2043
|
+
threadId: string;
|
|
2044
|
+
commentId?: string;
|
|
2045
|
+
body: CommentBody;
|
|
2046
|
+
}): Promise<CommentData>;
|
|
2047
|
+
/**
|
|
2048
|
+
* Edits a comment.
|
|
2049
|
+
*
|
|
2050
|
+
* @example
|
|
2051
|
+
* await room.editComment({
|
|
2052
|
+
* threadId: "th_xxx",
|
|
2053
|
+
* commentId: "cm_xxx"
|
|
2054
|
+
* body: {
|
|
2055
|
+
* version: 1,
|
|
2056
|
+
* content: [{ type: "paragraph", children: [{ text: "Hello" }] }],
|
|
2057
|
+
* },
|
|
2058
|
+
* });
|
|
2059
|
+
*/
|
|
2060
|
+
editComment(options: {
|
|
2061
|
+
threadId: string;
|
|
2062
|
+
commentId: string;
|
|
2063
|
+
body: CommentBody;
|
|
2064
|
+
}): Promise<CommentData>;
|
|
2065
|
+
/**
|
|
2066
|
+
* Deletes a comment.
|
|
2067
|
+
* If it is the last non-deleted comment, the thread also gets deleted.
|
|
2068
|
+
*
|
|
2069
|
+
* @example
|
|
2070
|
+
* await room.deleteComment({
|
|
2071
|
+
* threadId: "th_xxx",
|
|
2072
|
+
* commentId: "cm_xxx"
|
|
2073
|
+
* });
|
|
2074
|
+
*/
|
|
2075
|
+
deleteComment(options: {
|
|
2076
|
+
threadId: string;
|
|
2077
|
+
commentId: string;
|
|
2078
|
+
}): Promise<void>;
|
|
2079
|
+
/**
|
|
2080
|
+
* Adds a reaction from a comment for the current user.
|
|
2081
|
+
*
|
|
2082
|
+
* @example
|
|
2083
|
+
* await room.addReaction({ threadId: "th_xxx", commentId: "cm_xxx", emoji: "👍" })
|
|
2084
|
+
*/
|
|
2085
|
+
addReaction(options: {
|
|
2086
|
+
threadId: string;
|
|
2087
|
+
commentId: string;
|
|
2088
|
+
emoji: string;
|
|
2089
|
+
}): Promise<CommentUserReaction>;
|
|
2090
|
+
/**
|
|
2091
|
+
* Removes a reaction from a comment.
|
|
2092
|
+
*
|
|
2093
|
+
* @example
|
|
2094
|
+
* await room.removeReaction({ threadId: "th_xxx", commentId: "cm_xxx", emoji: "👍" })
|
|
2095
|
+
*/
|
|
2096
|
+
removeReaction(options: {
|
|
2097
|
+
threadId: string;
|
|
2098
|
+
commentId: string;
|
|
2099
|
+
emoji: string;
|
|
2100
|
+
}): Promise<void>;
|
|
2103
2101
|
/**
|
|
2104
2102
|
* Gets the user's notification settings for the current room.
|
|
2105
2103
|
*
|
|
@@ -2118,7 +2116,7 @@ declare type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extend
|
|
|
2118
2116
|
* Internal use only. Signature might change in the future.
|
|
2119
2117
|
*/
|
|
2120
2118
|
markInboxNotificationAsRead(notificationId: string): Promise<void>;
|
|
2121
|
-
}
|
|
2119
|
+
};
|
|
2122
2120
|
declare type Provider = {
|
|
2123
2121
|
synced: boolean;
|
|
2124
2122
|
getStatus: () => "loading" | "synchronizing" | "synchronized";
|