@liveblocks/core 2.2.3-alpha2 → 2.4.0-test1
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 +267 -78
- package/dist/index.d.ts +267 -78
- package/dist/index.js +256 -176
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +187 -107
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1715,68 +1715,177 @@ declare type SubscribeFn<P extends JsonObject, _TStorage extends LsonObject, U e
|
|
|
1715
1715
|
* });
|
|
1716
1716
|
*/
|
|
1717
1717
|
(type: "storage-status", listener: Callback<StorageStatus>): () => void;
|
|
1718
|
+
(type: "comments", listener: Callback<CommentsEventServerMsg>): () => void;
|
|
1718
1719
|
};
|
|
1719
1720
|
declare type GetThreadsOptions<M extends BaseMetadata> = {
|
|
1720
1721
|
query?: {
|
|
1721
1722
|
resolved?: boolean;
|
|
1722
1723
|
metadata?: Partial<QueryMetadata<M>>;
|
|
1723
1724
|
};
|
|
1724
|
-
since?: Date;
|
|
1725
1725
|
};
|
|
1726
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
|
+
*/
|
|
1727
1738
|
getThreads(options?: GetThreadsOptions<M>): Promise<{
|
|
1728
1739
|
threads: ThreadData<M>[];
|
|
1729
1740
|
inboxNotifications: InboxNotificationData[];
|
|
1730
|
-
|
|
1731
|
-
deletedInboxNotifications: InboxNotificationDeleteInfo[];
|
|
1732
|
-
meta: {
|
|
1733
|
-
requestedAt: Date;
|
|
1734
|
-
};
|
|
1741
|
+
requestedAt: Date;
|
|
1735
1742
|
}>;
|
|
1736
|
-
|
|
1737
|
-
|
|
1743
|
+
/**
|
|
1744
|
+
* Returns the modified 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;
|
|
1738
1753
|
}): Promise<{
|
|
1739
|
-
|
|
1754
|
+
threads: {
|
|
1755
|
+
modified: ThreadData<M>[];
|
|
1756
|
+
deleted: ThreadDeleteInfo[];
|
|
1757
|
+
};
|
|
1758
|
+
inboxNotifications: {
|
|
1759
|
+
modified: 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>;
|
|
1740
1772
|
inboxNotification?: InboxNotificationData;
|
|
1741
|
-
}
|
|
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
|
+
*/
|
|
1742
1785
|
createThread(options: {
|
|
1743
|
-
threadId
|
|
1744
|
-
commentId
|
|
1786
|
+
threadId?: string;
|
|
1787
|
+
commentId?: string;
|
|
1745
1788
|
metadata: M | undefined;
|
|
1746
1789
|
body: CommentBody;
|
|
1747
1790
|
}): Promise<ThreadData<M>>;
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
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
|
+
*/
|
|
1751
1805
|
editThreadMetadata(options: {
|
|
1752
1806
|
metadata: Patchable<M>;
|
|
1753
1807
|
threadId: string;
|
|
1754
1808
|
}): Promise<M>;
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
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
|
+
*/
|
|
1761
1835
|
createComment(options: {
|
|
1762
1836
|
threadId: string;
|
|
1763
|
-
commentId
|
|
1837
|
+
commentId?: string;
|
|
1764
1838
|
body: CommentBody;
|
|
1765
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
|
+
*/
|
|
1766
1853
|
editComment(options: {
|
|
1767
1854
|
threadId: string;
|
|
1768
1855
|
commentId: string;
|
|
1769
1856
|
body: CommentBody;
|
|
1770
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
|
+
*/
|
|
1771
1868
|
deleteComment(options: {
|
|
1772
1869
|
threadId: string;
|
|
1773
1870
|
commentId: string;
|
|
1774
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
|
+
*/
|
|
1775
1878
|
addReaction(options: {
|
|
1776
1879
|
threadId: string;
|
|
1777
1880
|
commentId: string;
|
|
1778
1881
|
emoji: string;
|
|
1779
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
|
+
*/
|
|
1780
1889
|
removeReaction(options: {
|
|
1781
1890
|
threadId: string;
|
|
1782
1891
|
commentId: string;
|
|
@@ -1797,7 +1906,7 @@ declare type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extend
|
|
|
1797
1906
|
* of Liveblocks, NEVER USE ANY OF THESE DIRECTLY, because bad things
|
|
1798
1907
|
* will probably happen if you do.
|
|
1799
1908
|
*/
|
|
1800
|
-
readonly [kInternal]: PrivateRoomApi
|
|
1909
|
+
readonly [kInternal]: PrivateRoomApi;
|
|
1801
1910
|
/**
|
|
1802
1911
|
* The id of the room.
|
|
1803
1912
|
*/
|
|
@@ -1991,7 +2100,25 @@ declare type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extend
|
|
|
1991
2100
|
* connection. If the room is not connected yet, initiate it.
|
|
1992
2101
|
*/
|
|
1993
2102
|
reconnect(): void;
|
|
1994
|
-
|
|
2103
|
+
/**
|
|
2104
|
+
* Gets the user's notification settings for the current room.
|
|
2105
|
+
*
|
|
2106
|
+
* @example
|
|
2107
|
+
* const settings = await room.getNotificationSettings();
|
|
2108
|
+
*/
|
|
2109
|
+
getNotificationSettings(): Promise<RoomNotificationSettings>;
|
|
2110
|
+
/**
|
|
2111
|
+
* Updates the user's notification settings for the current room.
|
|
2112
|
+
*
|
|
2113
|
+
* @example
|
|
2114
|
+
* await room.updateNotificationSettings({ threads: "replies_and_mentions" });
|
|
2115
|
+
*/
|
|
2116
|
+
updateNotificationSettings(settings: Partial<RoomNotificationSettings>): Promise<RoomNotificationSettings>;
|
|
2117
|
+
/**
|
|
2118
|
+
* Internal use only. Signature might change in the future.
|
|
2119
|
+
*/
|
|
2120
|
+
markInboxNotificationAsRead(notificationId: string): Promise<void>;
|
|
2121
|
+
} & CommentsApi<M>;
|
|
1995
2122
|
/**
|
|
1996
2123
|
* @private
|
|
1997
2124
|
*
|
|
@@ -2000,7 +2127,7 @@ declare type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extend
|
|
|
2000
2127
|
* Liveblocks, NEVER USE ANY OF THESE METHODS DIRECTLY, because bad things
|
|
2001
2128
|
* will probably happen if you do.
|
|
2002
2129
|
*/
|
|
2003
|
-
declare type PrivateRoomApi
|
|
2130
|
+
declare type PrivateRoomApi = {
|
|
2004
2131
|
presenceBuffer: Json | undefined;
|
|
2005
2132
|
undoStack: readonly (readonly Readonly<HistoryOp<JsonObject>>[])[];
|
|
2006
2133
|
nodeCount: number;
|
|
@@ -2013,12 +2140,6 @@ declare type PrivateRoomApi<M extends BaseMetadata> = {
|
|
|
2013
2140
|
explicitClose(event: IWebSocketCloseEvent): void;
|
|
2014
2141
|
rawSend(data: string): void;
|
|
2015
2142
|
};
|
|
2016
|
-
comments: CommentsApi<M>;
|
|
2017
|
-
notifications: {
|
|
2018
|
-
getRoomNotificationSettings(): Promise<RoomNotificationSettings>;
|
|
2019
|
-
updateRoomNotificationSettings(settings: Partial<RoomNotificationSettings>): Promise<RoomNotificationSettings>;
|
|
2020
|
-
markInboxNotificationAsRead(notificationId: string): Promise<void>;
|
|
2021
|
-
};
|
|
2022
2143
|
};
|
|
2023
2144
|
declare type HistoryOp<P extends JsonObject> = Op | {
|
|
2024
2145
|
readonly type: "presence";
|
|
@@ -2058,25 +2179,27 @@ declare class CommentsApiError extends Error {
|
|
|
2058
2179
|
constructor(message: string, status: number, details?: JsonObject | undefined);
|
|
2059
2180
|
}
|
|
2060
2181
|
|
|
2061
|
-
declare type
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2182
|
+
declare type RenameDataField<T, TFieldName extends string> = T extends any ? {
|
|
2183
|
+
[K in keyof T as K extends "data" ? TFieldName : K]: T[K];
|
|
2184
|
+
} : never;
|
|
2185
|
+
declare type AsyncResult<T> = {
|
|
2186
|
+
readonly isLoading: true;
|
|
2187
|
+
readonly data?: never;
|
|
2188
|
+
readonly error?: never;
|
|
2189
|
+
} | {
|
|
2190
|
+
readonly isLoading: false;
|
|
2191
|
+
readonly data: T;
|
|
2192
|
+
readonly error?: never;
|
|
2193
|
+
} | {
|
|
2194
|
+
readonly isLoading: false;
|
|
2195
|
+
readonly data?: never;
|
|
2196
|
+
readonly error: Error;
|
|
2075
2197
|
};
|
|
2076
|
-
declare type
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2198
|
+
declare type AsyncResultWithDataField<T, TDataField extends string> = RenameDataField<AsyncResult<T>, TDataField>;
|
|
2199
|
+
|
|
2200
|
+
declare type BatchStore<O, I> = Observable<void> & {
|
|
2201
|
+
get: (input: I) => Promise<void>;
|
|
2202
|
+
getState: (input: I) => AsyncResult<O> | undefined;
|
|
2080
2203
|
};
|
|
2081
2204
|
|
|
2082
2205
|
declare type Store<T> = {
|
|
@@ -2091,12 +2214,7 @@ declare type Store<T> = {
|
|
|
2091
2214
|
*/
|
|
2092
2215
|
declare type NoInfr<A> = [A][A extends any ? 0 : never];
|
|
2093
2216
|
|
|
2094
|
-
declare type
|
|
2095
|
-
limit?: number;
|
|
2096
|
-
since?: Date;
|
|
2097
|
-
};
|
|
2098
|
-
|
|
2099
|
-
declare type OptimisticUpdate<M extends BaseMetadata> = CreateThreadOptimisticUpdate<M> | DeleteThreadOptimisticUpdate | EditThreadMetadataOptimisticUpdate<M> | MarkThreadAsResolvedOptimisticUpdate | MarkThreadAsUnresolvedOptimisticUpdate | CreateCommentOptimisticUpdate | EditCommentOptimisticUpdate | DeleteCommentOptimisticUpdate | AddReactionOptimisticUpdate | RemoveReactionOptimisticUpdate | MarkInboxNotificationAsReadOptimisticUpdate | MarkAllInboxNotificationsAsReadOptimisticUpdate | UpdateNotificationSettingsOptimisticUpdate;
|
|
2217
|
+
declare type OptimisticUpdate<M extends BaseMetadata> = CreateThreadOptimisticUpdate<M> | DeleteThreadOptimisticUpdate | EditThreadMetadataOptimisticUpdate<M> | MarkThreadAsResolvedOptimisticUpdate | MarkThreadAsUnresolvedOptimisticUpdate | CreateCommentOptimisticUpdate | EditCommentOptimisticUpdate | DeleteCommentOptimisticUpdate | AddReactionOptimisticUpdate | RemoveReactionOptimisticUpdate | MarkInboxNotificationAsReadOptimisticUpdate | MarkAllInboxNotificationsAsReadOptimisticUpdate | DeleteInboxNotificationOptimisticUpdate | DeleteAllInboxNotificationsOptimisticUpdate | UpdateNotificationSettingsOptimisticUpdate;
|
|
2100
2218
|
declare type CreateThreadOptimisticUpdate<M extends BaseMetadata> = {
|
|
2101
2219
|
type: "create-thread";
|
|
2102
2220
|
id: string;
|
|
@@ -2170,23 +2288,28 @@ declare type MarkInboxNotificationAsReadOptimisticUpdate = {
|
|
|
2170
2288
|
readAt: Date;
|
|
2171
2289
|
};
|
|
2172
2290
|
declare type MarkAllInboxNotificationsAsReadOptimisticUpdate = {
|
|
2173
|
-
type: "mark-inbox-notifications-as-read";
|
|
2291
|
+
type: "mark-all-inbox-notifications-as-read";
|
|
2174
2292
|
id: string;
|
|
2175
2293
|
readAt: Date;
|
|
2176
2294
|
};
|
|
2295
|
+
declare type DeleteInboxNotificationOptimisticUpdate = {
|
|
2296
|
+
type: "delete-inbox-notification";
|
|
2297
|
+
id: string;
|
|
2298
|
+
inboxNotificationId: string;
|
|
2299
|
+
deletedAt: Date;
|
|
2300
|
+
};
|
|
2301
|
+
declare type DeleteAllInboxNotificationsOptimisticUpdate = {
|
|
2302
|
+
type: "delete-all-inbox-notifications";
|
|
2303
|
+
id: string;
|
|
2304
|
+
deletedAt: Date;
|
|
2305
|
+
};
|
|
2177
2306
|
declare type UpdateNotificationSettingsOptimisticUpdate = {
|
|
2178
2307
|
type: "update-notification-settings";
|
|
2179
2308
|
id: string;
|
|
2180
2309
|
roomId: string;
|
|
2181
2310
|
settings: Partial<RoomNotificationSettings>;
|
|
2182
2311
|
};
|
|
2183
|
-
declare type QueryState =
|
|
2184
|
-
isLoading: true;
|
|
2185
|
-
error?: never;
|
|
2186
|
-
} | {
|
|
2187
|
-
isLoading: false;
|
|
2188
|
-
error?: Error;
|
|
2189
|
-
};
|
|
2312
|
+
declare type QueryState = AsyncResult<undefined>;
|
|
2190
2313
|
declare type CacheState<M extends BaseMetadata> = {
|
|
2191
2314
|
/**
|
|
2192
2315
|
* Threads by ID.
|
|
@@ -2286,28 +2409,87 @@ declare type EnterOptions<P extends JsonObject = DP, S extends LsonObject = DS>
|
|
|
2286
2409
|
* of Liveblocks, NEVER USE ANY OF THESE DIRECTLY, because bad things
|
|
2287
2410
|
* will probably happen if you do.
|
|
2288
2411
|
*/
|
|
2289
|
-
declare type PrivateClientApi<U extends BaseUserMeta
|
|
2290
|
-
readonly notifications: NotificationsApi<M>;
|
|
2412
|
+
declare type PrivateClientApi<U extends BaseUserMeta> = {
|
|
2291
2413
|
readonly currentUserIdStore: Store<string | null>;
|
|
2292
2414
|
readonly resolveMentionSuggestions: ClientOptions<U>["resolveMentionSuggestions"];
|
|
2293
2415
|
readonly cacheStore: CacheStore<BaseMetadata>;
|
|
2294
|
-
readonly usersStore: BatchStore<U["info"] | undefined,
|
|
2295
|
-
readonly roomsInfoStore: BatchStore<DRI | undefined,
|
|
2416
|
+
readonly usersStore: BatchStore<U["info"] | undefined, string>;
|
|
2417
|
+
readonly roomsInfoStore: BatchStore<DRI | undefined, string>;
|
|
2296
2418
|
readonly getRoomIds: () => string[];
|
|
2297
2419
|
};
|
|
2298
2420
|
declare type NotificationsApi<M extends BaseMetadata> = {
|
|
2299
|
-
|
|
2421
|
+
/**
|
|
2422
|
+
* Gets the current user inbox notifications and their associated threads.
|
|
2423
|
+
* It also returns the request date that can be used for subsequent polling.
|
|
2424
|
+
*
|
|
2425
|
+
* @example
|
|
2426
|
+
* const {
|
|
2427
|
+
* inboxNotifications,
|
|
2428
|
+
* threads,
|
|
2429
|
+
* requestedAt
|
|
2430
|
+
* } = await client.getInboxNotifications();
|
|
2431
|
+
*/
|
|
2432
|
+
getInboxNotifications(): Promise<{
|
|
2300
2433
|
inboxNotifications: InboxNotificationData[];
|
|
2301
2434
|
threads: ThreadData<M>[];
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2435
|
+
requestedAt: Date;
|
|
2436
|
+
}>;
|
|
2437
|
+
/**
|
|
2438
|
+
* Gets the modified and deleted inbox notifications and their associated threads since the requested date.
|
|
2439
|
+
*
|
|
2440
|
+
* @example
|
|
2441
|
+
* const result = await client.getInboxNotifications();
|
|
2442
|
+
* // ... //
|
|
2443
|
+
* await client.getInboxNotificationsSince({ since: result.requestedAt }});
|
|
2444
|
+
*/
|
|
2445
|
+
getInboxNotificationsSince(options: {
|
|
2446
|
+
since: Date;
|
|
2447
|
+
}): Promise<{
|
|
2448
|
+
inboxNotifications: {
|
|
2449
|
+
modified: InboxNotificationData[];
|
|
2450
|
+
deleted: InboxNotificationDeleteInfo[];
|
|
2451
|
+
};
|
|
2452
|
+
threads: {
|
|
2453
|
+
modified: ThreadData<M>[];
|
|
2454
|
+
deleted: ThreadDeleteInfo[];
|
|
2306
2455
|
};
|
|
2456
|
+
requestedAt: Date;
|
|
2307
2457
|
}>;
|
|
2458
|
+
/**
|
|
2459
|
+
* Gets the number of unread inbox notifications for the current user.
|
|
2460
|
+
*
|
|
2461
|
+
* @example
|
|
2462
|
+
* const count = await client.getUnreadInboxNotificationsCount();
|
|
2463
|
+
*/
|
|
2308
2464
|
getUnreadInboxNotificationsCount(): Promise<number>;
|
|
2465
|
+
/**
|
|
2466
|
+
* Marks all inbox notifications as read.
|
|
2467
|
+
*
|
|
2468
|
+
* @example
|
|
2469
|
+
* await client.markAllInboxNotificationsAsRead();
|
|
2470
|
+
*/
|
|
2309
2471
|
markAllInboxNotificationsAsRead(): Promise<void>;
|
|
2472
|
+
/**
|
|
2473
|
+
* Marks an inbox notification as read.
|
|
2474
|
+
*
|
|
2475
|
+
* @example
|
|
2476
|
+
* await client.markInboxNotificationAsRead("in_xxx");
|
|
2477
|
+
*/
|
|
2310
2478
|
markInboxNotificationAsRead(inboxNotificationId: string): Promise<void>;
|
|
2479
|
+
/**
|
|
2480
|
+
* Deletes all inbox notifications for the current user.
|
|
2481
|
+
*
|
|
2482
|
+
* @example
|
|
2483
|
+
* await client.deleteAllInboxNotifications();
|
|
2484
|
+
*/
|
|
2485
|
+
deleteAllInboxNotifications(): Promise<void>;
|
|
2486
|
+
/**
|
|
2487
|
+
* Deletes an inbox notification for the current user.
|
|
2488
|
+
*
|
|
2489
|
+
* @example
|
|
2490
|
+
* await client.deleteInboxNotification("in_xxx");
|
|
2491
|
+
*/
|
|
2492
|
+
deleteInboxNotification(inboxNotificationId: string): Promise<void>;
|
|
2311
2493
|
};
|
|
2312
2494
|
/**
|
|
2313
2495
|
* @private Widest-possible Client type, matching _any_ Client instance. Note
|
|
@@ -2316,7 +2498,7 @@ declare type NotificationsApi<M extends BaseMetadata> = {
|
|
|
2316
2498
|
* narrower.
|
|
2317
2499
|
*/
|
|
2318
2500
|
declare type OpaqueClient = Client<BaseUserMeta>;
|
|
2319
|
-
declare type Client<U extends BaseUserMeta = DU> = {
|
|
2501
|
+
declare type Client<U extends BaseUserMeta = DU, M extends BaseMetadata = DM> = {
|
|
2320
2502
|
/**
|
|
2321
2503
|
* Gets a room. Returns null if {@link Client.enter} has not been called previously.
|
|
2322
2504
|
*
|
|
@@ -2349,8 +2531,8 @@ declare type Client<U extends BaseUserMeta = DU> = {
|
|
|
2349
2531
|
* of Liveblocks, NEVER USE ANY OF THESE DIRECTLY, because bad things
|
|
2350
2532
|
* will probably happen if you do.
|
|
2351
2533
|
*/
|
|
2352
|
-
readonly [kInternal]: PrivateClientApi<U
|
|
2353
|
-
}
|
|
2534
|
+
readonly [kInternal]: PrivateClientApi<U>;
|
|
2535
|
+
} & NotificationsApi<M>;
|
|
2354
2536
|
declare type AuthEndpoint = string | ((room?: string) => Promise<CustomAuthenticationResult>);
|
|
2355
2537
|
/**
|
|
2356
2538
|
* The authentication endpoint that is called to ensure that the current user has access to a room.
|
|
@@ -2589,6 +2771,10 @@ declare function assert(condition: boolean, errmsg: string): asserts condition;
|
|
|
2589
2771
|
*/
|
|
2590
2772
|
declare function nn<T>(value: T, errmsg?: string): NonNullable<T>;
|
|
2591
2773
|
|
|
2774
|
+
declare function createThreadId(): string;
|
|
2775
|
+
declare function createCommentId(): string;
|
|
2776
|
+
declare function createInboxNotificationId(): string;
|
|
2777
|
+
|
|
2592
2778
|
/**
|
|
2593
2779
|
* Displays a deprecation warning in the dev console. Only in dev mode, and
|
|
2594
2780
|
* only once per message/key. In production, this is a no-op.
|
|
@@ -2634,6 +2820,8 @@ declare namespace fancyConsole {
|
|
|
2634
2820
|
*/
|
|
2635
2821
|
declare const freeze: typeof Object.freeze;
|
|
2636
2822
|
|
|
2823
|
+
declare const nanoid: (t?: number) => string;
|
|
2824
|
+
|
|
2637
2825
|
/**
|
|
2638
2826
|
* Converts an object to a query string
|
|
2639
2827
|
* Example:
|
|
@@ -2708,8 +2896,9 @@ declare function wait(millis: number): Promise<void>;
|
|
|
2708
2896
|
declare function withTimeout<T>(promise: Promise<T>, millis: number, errmsg: string): Promise<T>;
|
|
2709
2897
|
/**
|
|
2710
2898
|
* Memoize a promise factory, so that each subsequent call will return the same
|
|
2711
|
-
* pending or success promise
|
|
2712
|
-
*
|
|
2899
|
+
* pending or success promise. If the promise rejects, will retain that failed
|
|
2900
|
+
* promise for a small time period, after which the next attempt will reset the
|
|
2901
|
+
* memoized value.
|
|
2713
2902
|
*/
|
|
2714
2903
|
declare function memoizeOnSuccess<T>(factoryFn: () => Promise<T>): () => Promise<T>;
|
|
2715
2904
|
|
|
@@ -2924,4 +3113,4 @@ declare type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (En
|
|
|
2924
3113
|
[K in keyof T as EnsureJson<T[K]> extends never ? never : K]: EnsureJson<T[K]>;
|
|
2925
3114
|
};
|
|
2926
3115
|
|
|
2927
|
-
export { type AckOp, type ActivityData, type BaseActivitiesData, type BaseAuthResult, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type CacheState, type CacheStore, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, CommentsApiError, type CommentsEventServerMsg, CrdtType, type CreateListOp, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type CustomAuthenticationResult, type DAD, type DE, type DM, type DP, type DRI, type DS, type DU, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type History, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IdTuple, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InitialDocumentStateServerMsg, type Json, type JsonArray, type JsonObject, type JsonScalar, type KDAD, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type LostConnectionEvent, type Lson, type LsonObject, type NoInfr, type NodeMap, NotificationsApiError, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalPromise, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialUnless, type Patchable, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type PrivateClientApi, type PrivateRoomApi, type QueryMetadata, type RejectedStorageOpServerMsg, type Resolve, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomNotificationSettings, type RoomStateServerMsg, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type SetParentKeyOp, type Status, type StorageStatus, type StorageUpdate, type Store, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type ThreadData, type ThreadDataPlain, type ThreadDeleteInfo, type ToImmutable, type ToJson, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type User, type UserJoinServerMsg, type UserLeftServerMsg, WebsocketCloseCodes, type YDocUpdateServerMsg, ackOp, addReaction, applyOptimisticUpdates, asPos, assert, assertNever, b64decode, cloneLson, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToInboxNotificationData, convertToThreadData, createClient, deleteComment, deprecate, deprecateIf, detectDupes, errorIf, freeze, getMentionedIdsFromCommentBody, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, kInternal, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, memoizeOnSuccess, nn, objectToQuery, patchLiveObjectKey, raise, removeReaction, shallow, stringify, stringifyCommentBody, throwUsageError, toPlainLson, tryParseJson, upsertComment, wait, withTimeout };
|
|
3116
|
+
export { type AckOp, type ActivityData, type AsyncResult, type AsyncResultWithDataField, type BaseActivitiesData, type BaseAuthResult, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type CacheState, type CacheStore, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, CommentsApiError, type CommentsEventServerMsg, CrdtType, type CreateListOp, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type CustomAuthenticationResult, type DAD, type DE, type DM, type DP, type DRI, type DS, type DU, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type History, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IdTuple, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InitialDocumentStateServerMsg, type Json, type JsonArray, type JsonObject, type JsonScalar, type KDAD, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type LostConnectionEvent, type Lson, type LsonObject, type NoInfr, type NodeMap, NotificationsApiError, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalPromise, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialUnless, type Patchable, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type PrivateClientApi, type PrivateRoomApi, type QueryMetadata, type RejectedStorageOpServerMsg, type Resolve, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomNotificationSettings, type RoomStateServerMsg, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type SetParentKeyOp, type Status, type StorageStatus, type StorageUpdate, type Store, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type ThreadData, type ThreadDataPlain, type ThreadDeleteInfo, type ToImmutable, type ToJson, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type User, type UserJoinServerMsg, type UserLeftServerMsg, WebsocketCloseCodes, type YDocUpdateServerMsg, ackOp, addReaction, applyOptimisticUpdates, asPos, assert, assertNever, b64decode, cloneLson, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToInboxNotificationData, convertToThreadData, createClient, createCommentId, createInboxNotificationId, createThreadId, deleteComment, deprecate, deprecateIf, detectDupes, errorIf, freeze, getMentionedIdsFromCommentBody, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, kInternal, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, raise, removeReaction, shallow, stringify, stringifyCommentBody, throwUsageError, toPlainLson, tryParseJson, upsertComment, wait, withTimeout };
|