@liveblocks/core 3.13.0-metadata1 → 3.13.0-rc1
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 +49 -61
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +70 -110
- package/dist/index.d.ts +70 -110
- package/dist/index.js +49 -61
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -360,7 +360,7 @@ declare namespace OpCode {
|
|
|
360
360
|
* These operations are the payload for {@link UpdateStorageServerMsg} messages
|
|
361
361
|
* only.
|
|
362
362
|
*/
|
|
363
|
-
type Op = CreateOp | UpdateObjectOp | DeleteCrdtOp | SetParentKeyOp | DeleteObjectKeyOp |
|
|
363
|
+
type Op = CreateOp | UpdateObjectOp | DeleteCrdtOp | SetParentKeyOp | DeleteObjectKeyOp | AckOp;
|
|
364
364
|
type CreateOp = CreateObjectOp | CreateRegisterOp | CreateMapOp | CreateListOp;
|
|
365
365
|
type UpdateObjectOp = {
|
|
366
366
|
readonly opId?: string;
|
|
@@ -411,15 +411,11 @@ type DeleteCrdtOp = {
|
|
|
411
411
|
readonly id: string;
|
|
412
412
|
readonly type: OpCode.DELETE_CRDT;
|
|
413
413
|
};
|
|
414
|
-
type
|
|
414
|
+
type AckOp = {
|
|
415
415
|
readonly type: OpCode.DELETE_CRDT;
|
|
416
416
|
readonly id: "ACK";
|
|
417
417
|
readonly opId: string;
|
|
418
418
|
};
|
|
419
|
-
type AckOpV8 = {
|
|
420
|
-
readonly type: OpCode.ACK;
|
|
421
|
-
readonly opId: string;
|
|
422
|
-
};
|
|
423
419
|
type SetParentKeyOp = {
|
|
424
420
|
readonly opId?: string;
|
|
425
421
|
readonly id: string;
|
|
@@ -1144,7 +1140,7 @@ declare global {
|
|
|
1144
1140
|
[key: string]: unknown;
|
|
1145
1141
|
}
|
|
1146
1142
|
}
|
|
1147
|
-
type ExtendableTypes = "Presence" | "Storage" | "UserMeta" | "RoomEvent" | "ThreadMetadata" | "
|
|
1143
|
+
type ExtendableTypes = "Presence" | "Storage" | "UserMeta" | "RoomEvent" | "ThreadMetadata" | "RoomInfo" | "GroupInfo" | "ActivitiesData";
|
|
1148
1144
|
type MakeErrorString<K extends ExtendableTypes, Reason extends string = "does not match its requirements"> = `The type you provided for '${K}' ${Reason}. To learn how to fix this, see https://liveblocks.io/docs/errors/${K}`;
|
|
1149
1145
|
type GetOverride<K extends ExtendableTypes, B, Reason extends string = "does not match its requirements"> = GetOverrideOrErrorValue<K, B, MakeErrorString<K, Reason>>;
|
|
1150
1146
|
type GetOverrideOrErrorValue<K extends ExtendableTypes, B, ErrorType> = unknown extends Liveblocks[K] ? B : Liveblocks[K] extends B ? Liveblocks[K] : ErrorType;
|
|
@@ -1152,8 +1148,7 @@ type DP = GetOverride<"Presence", JsonObject, "is not a valid JSON object">;
|
|
|
1152
1148
|
type DS = GetOverride<"Storage", LsonObject, "is not a valid LSON value">;
|
|
1153
1149
|
type DU = GetOverrideOrErrorValue<"UserMeta", BaseUserMeta, Record<"id" | "info", MakeErrorString<"UserMeta">>>;
|
|
1154
1150
|
type DE = GetOverride<"RoomEvent", Json, "is not a valid JSON value">;
|
|
1155
|
-
type
|
|
1156
|
-
type DCM = GetOverride<"CommentMetadata", BaseMetadata>;
|
|
1151
|
+
type DM = GetOverride<"ThreadMetadata", BaseMetadata>;
|
|
1157
1152
|
type DRI = GetOverride<"RoomInfo", BaseRoomInfo>;
|
|
1158
1153
|
type DGI = GetOverride<"GroupInfo", BaseGroupInfo>;
|
|
1159
1154
|
type DAD = GetOverrideOrErrorValue<"ActivitiesData", BaseActivitiesData, {
|
|
@@ -1218,7 +1213,7 @@ type CommentMixedAttachment = CommentAttachment | CommentLocalAttachment;
|
|
|
1218
1213
|
/**
|
|
1219
1214
|
* Represents a comment.
|
|
1220
1215
|
*/
|
|
1221
|
-
type CommentData
|
|
1216
|
+
type CommentData = {
|
|
1222
1217
|
type: "comment";
|
|
1223
1218
|
id: string;
|
|
1224
1219
|
threadId: string;
|
|
@@ -1228,15 +1223,13 @@ type CommentData<CM extends BaseMetadata = DCM> = {
|
|
|
1228
1223
|
editedAt?: Date;
|
|
1229
1224
|
reactions: CommentReaction[];
|
|
1230
1225
|
attachments: CommentAttachment[];
|
|
1231
|
-
metadata: CM;
|
|
1232
1226
|
} & Relax<{
|
|
1233
1227
|
body: CommentBody;
|
|
1234
1228
|
} | {
|
|
1235
1229
|
deletedAt: Date;
|
|
1236
1230
|
}>;
|
|
1237
|
-
type CommentDataPlain
|
|
1231
|
+
type CommentDataPlain = Omit<DateToString<CommentData>, "reactions" | "body"> & {
|
|
1238
1232
|
reactions: DateToString<CommentReaction>[];
|
|
1239
|
-
metadata: CM;
|
|
1240
1233
|
} & Relax<{
|
|
1241
1234
|
body: CommentBody;
|
|
1242
1235
|
} | {
|
|
@@ -1291,22 +1284,22 @@ type SearchCommentsResult = {
|
|
|
1291
1284
|
/**
|
|
1292
1285
|
* Represents a thread of comments.
|
|
1293
1286
|
*/
|
|
1294
|
-
type ThreadData<
|
|
1287
|
+
type ThreadData<M extends BaseMetadata = DM> = {
|
|
1295
1288
|
type: "thread";
|
|
1296
1289
|
id: string;
|
|
1297
1290
|
roomId: string;
|
|
1298
1291
|
createdAt: Date;
|
|
1299
1292
|
updatedAt: Date;
|
|
1300
|
-
comments: CommentData
|
|
1301
|
-
metadata:
|
|
1293
|
+
comments: CommentData[];
|
|
1294
|
+
metadata: M;
|
|
1302
1295
|
resolved: boolean;
|
|
1303
1296
|
};
|
|
1304
|
-
interface ThreadDataWithDeleteInfo<
|
|
1297
|
+
interface ThreadDataWithDeleteInfo<M extends BaseMetadata = DM> extends ThreadData<M> {
|
|
1305
1298
|
deletedAt?: Date;
|
|
1306
1299
|
}
|
|
1307
|
-
type ThreadDataPlain<
|
|
1308
|
-
comments: CommentDataPlain
|
|
1309
|
-
metadata:
|
|
1300
|
+
type ThreadDataPlain<M extends BaseMetadata> = Omit<DateToString<ThreadData<M>>, "comments" | "metadata"> & {
|
|
1301
|
+
comments: CommentDataPlain[];
|
|
1302
|
+
metadata: M;
|
|
1310
1303
|
};
|
|
1311
1304
|
type ThreadDeleteInfo = {
|
|
1312
1305
|
type: "deletedThread";
|
|
@@ -1544,17 +1537,17 @@ type MakeOptionalFieldsNullable<T> = {
|
|
|
1544
1537
|
};
|
|
1545
1538
|
type Patchable<T> = Partial<MakeOptionalFieldsNullable<T>>;
|
|
1546
1539
|
|
|
1547
|
-
interface RoomHttpApi<
|
|
1540
|
+
interface RoomHttpApi<M extends BaseMetadata> {
|
|
1548
1541
|
getThreads(options: {
|
|
1549
1542
|
roomId: string;
|
|
1550
1543
|
cursor?: string;
|
|
1551
1544
|
query?: {
|
|
1552
1545
|
resolved?: boolean;
|
|
1553
1546
|
subscribed?: boolean;
|
|
1554
|
-
metadata?: Partial<QueryMetadata<
|
|
1547
|
+
metadata?: Partial<QueryMetadata<M>>;
|
|
1555
1548
|
};
|
|
1556
1549
|
}): Promise<{
|
|
1557
|
-
threads: ThreadData<
|
|
1550
|
+
threads: ThreadData<M>[];
|
|
1558
1551
|
inboxNotifications: InboxNotificationData[];
|
|
1559
1552
|
subscriptions: SubscriptionData[];
|
|
1560
1553
|
requestedAt: Date;
|
|
@@ -1567,7 +1560,7 @@ interface RoomHttpApi<TM extends BaseMetadata, CM extends BaseMetadata> {
|
|
|
1567
1560
|
signal?: AbortSignal;
|
|
1568
1561
|
}): Promise<{
|
|
1569
1562
|
threads: {
|
|
1570
|
-
updated: ThreadData<
|
|
1563
|
+
updated: ThreadData<M>[];
|
|
1571
1564
|
deleted: ThreadDeleteInfo[];
|
|
1572
1565
|
};
|
|
1573
1566
|
inboxNotifications: {
|
|
@@ -1584,7 +1577,7 @@ interface RoomHttpApi<TM extends BaseMetadata, CM extends BaseMetadata> {
|
|
|
1584
1577
|
searchComments(options: {
|
|
1585
1578
|
roomId: string;
|
|
1586
1579
|
query: {
|
|
1587
|
-
threadMetadata?: Partial<QueryMetadata<
|
|
1580
|
+
threadMetadata?: Partial<QueryMetadata<M>>;
|
|
1588
1581
|
threadResolved?: boolean;
|
|
1589
1582
|
hasAttachments?: boolean;
|
|
1590
1583
|
hasMentions?: boolean;
|
|
@@ -1595,20 +1588,19 @@ interface RoomHttpApi<TM extends BaseMetadata, CM extends BaseMetadata> {
|
|
|
1595
1588
|
}): Promise<{
|
|
1596
1589
|
data: Array<SearchCommentsResult>;
|
|
1597
1590
|
}>;
|
|
1598
|
-
createThread({ roomId, metadata, body, commentId, threadId,
|
|
1591
|
+
createThread({ roomId, metadata, body, commentId, threadId, attachmentIds, }: {
|
|
1599
1592
|
roomId: string;
|
|
1600
1593
|
threadId?: string;
|
|
1601
1594
|
commentId?: string;
|
|
1602
|
-
metadata:
|
|
1603
|
-
commentMetadata: CM | undefined;
|
|
1595
|
+
metadata: M | undefined;
|
|
1604
1596
|
body: CommentBody;
|
|
1605
1597
|
attachmentIds?: string[];
|
|
1606
|
-
}): Promise<ThreadData<
|
|
1598
|
+
}): Promise<ThreadData<M>>;
|
|
1607
1599
|
getThread(options: {
|
|
1608
1600
|
roomId: string;
|
|
1609
1601
|
threadId: string;
|
|
1610
1602
|
}): Promise<{
|
|
1611
|
-
thread?: ThreadData<
|
|
1603
|
+
thread?: ThreadData<M>;
|
|
1612
1604
|
inboxNotification?: InboxNotificationData;
|
|
1613
1605
|
subscription?: SubscriptionData;
|
|
1614
1606
|
}>;
|
|
@@ -1618,31 +1610,23 @@ interface RoomHttpApi<TM extends BaseMetadata, CM extends BaseMetadata> {
|
|
|
1618
1610
|
}): Promise<void>;
|
|
1619
1611
|
editThreadMetadata({ roomId, metadata, threadId, }: {
|
|
1620
1612
|
roomId: string;
|
|
1621
|
-
metadata: Patchable<
|
|
1622
|
-
threadId: string;
|
|
1623
|
-
}): Promise<TM>;
|
|
1624
|
-
editCommentMetadata({ roomId, threadId, commentId, metadata, }: {
|
|
1625
|
-
roomId: string;
|
|
1613
|
+
metadata: Patchable<M>;
|
|
1626
1614
|
threadId: string;
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
}): Promise<CM>;
|
|
1630
|
-
createComment({ roomId, threadId, commentId, body, metadata, attachmentIds, }: {
|
|
1615
|
+
}): Promise<M>;
|
|
1616
|
+
createComment({ roomId, threadId, commentId, body, attachmentIds, }: {
|
|
1631
1617
|
roomId: string;
|
|
1632
1618
|
threadId: string;
|
|
1633
1619
|
commentId?: string;
|
|
1634
1620
|
body: CommentBody;
|
|
1635
|
-
metadata?: CM;
|
|
1636
1621
|
attachmentIds?: string[];
|
|
1637
|
-
}): Promise<CommentData
|
|
1638
|
-
editComment({ roomId, threadId, commentId, body, attachmentIds,
|
|
1622
|
+
}): Promise<CommentData>;
|
|
1623
|
+
editComment({ roomId, threadId, commentId, body, attachmentIds, }: {
|
|
1639
1624
|
roomId: string;
|
|
1640
1625
|
threadId: string;
|
|
1641
1626
|
commentId: string;
|
|
1642
1627
|
body: CommentBody;
|
|
1643
1628
|
attachmentIds?: string[];
|
|
1644
|
-
|
|
1645
|
-
}): Promise<CommentData<CM>>;
|
|
1629
|
+
}): Promise<CommentData>;
|
|
1646
1630
|
deleteComment({ roomId, threadId, commentId, }: {
|
|
1647
1631
|
roomId: string;
|
|
1648
1632
|
threadId: string;
|
|
@@ -1780,7 +1764,7 @@ interface RoomHttpApi<TM extends BaseMetadata, CM extends BaseMetadata> {
|
|
|
1780
1764
|
signal: AbortSignal;
|
|
1781
1765
|
}): Promise<string>;
|
|
1782
1766
|
}
|
|
1783
|
-
interface NotificationHttpApi<
|
|
1767
|
+
interface NotificationHttpApi<M extends BaseMetadata> {
|
|
1784
1768
|
getInboxNotifications(options?: {
|
|
1785
1769
|
cursor?: string;
|
|
1786
1770
|
query?: {
|
|
@@ -1789,7 +1773,7 @@ interface NotificationHttpApi<TM extends BaseMetadata, CM extends BaseMetadata>
|
|
|
1789
1773
|
};
|
|
1790
1774
|
}): Promise<{
|
|
1791
1775
|
inboxNotifications: InboxNotificationData[];
|
|
1792
|
-
threads: ThreadData<
|
|
1776
|
+
threads: ThreadData<M>[];
|
|
1793
1777
|
subscriptions: SubscriptionData[];
|
|
1794
1778
|
nextCursor: string | null;
|
|
1795
1779
|
requestedAt: Date;
|
|
@@ -1807,7 +1791,7 @@ interface NotificationHttpApi<TM extends BaseMetadata, CM extends BaseMetadata>
|
|
|
1807
1791
|
deleted: InboxNotificationDeleteInfo[];
|
|
1808
1792
|
};
|
|
1809
1793
|
threads: {
|
|
1810
|
-
updated: ThreadData<
|
|
1794
|
+
updated: ThreadData<M>[];
|
|
1811
1795
|
deleted: ThreadDeleteInfo[];
|
|
1812
1796
|
};
|
|
1813
1797
|
subscriptions: {
|
|
@@ -1832,16 +1816,16 @@ interface NotificationHttpApi<TM extends BaseMetadata, CM extends BaseMetadata>
|
|
|
1832
1816
|
}): Promise<NotificationSettingsPlain>;
|
|
1833
1817
|
updateNotificationSettings(settings: PartialNotificationSettings): Promise<NotificationSettingsPlain>;
|
|
1834
1818
|
}
|
|
1835
|
-
interface LiveblocksHttpApi<
|
|
1819
|
+
interface LiveblocksHttpApi<M extends BaseMetadata> extends RoomHttpApi<M>, NotificationHttpApi<M> {
|
|
1836
1820
|
getUrlMetadata(url: string): Promise<UrlMetadata>;
|
|
1837
1821
|
getUserThreads_experimental(options?: {
|
|
1838
1822
|
cursor?: string;
|
|
1839
1823
|
query?: {
|
|
1840
1824
|
resolved?: boolean;
|
|
1841
|
-
metadata?: Partial<QueryMetadata<
|
|
1825
|
+
metadata?: Partial<QueryMetadata<M>>;
|
|
1842
1826
|
};
|
|
1843
1827
|
}): Promise<{
|
|
1844
|
-
threads: ThreadData<
|
|
1828
|
+
threads: ThreadData<M>[];
|
|
1845
1829
|
inboxNotifications: InboxNotificationData[];
|
|
1846
1830
|
subscriptions: SubscriptionData[];
|
|
1847
1831
|
nextCursor: string | null;
|
|
@@ -1857,7 +1841,7 @@ interface LiveblocksHttpApi<TM extends BaseMetadata, CM extends BaseMetadata> ex
|
|
|
1857
1841
|
deleted: InboxNotificationDeleteInfo[];
|
|
1858
1842
|
};
|
|
1859
1843
|
threads: {
|
|
1860
|
-
updated: ThreadData<
|
|
1844
|
+
updated: ThreadData<M>[];
|
|
1861
1845
|
deleted: ThreadDeleteInfo[];
|
|
1862
1846
|
};
|
|
1863
1847
|
subscriptions: {
|
|
@@ -1917,7 +1901,6 @@ type CommentsOrNotificationsErrorContext = {
|
|
|
1917
1901
|
commentId: string;
|
|
1918
1902
|
body: CommentBody;
|
|
1919
1903
|
metadata: BaseMetadata;
|
|
1920
|
-
commentMetadata: BaseMetadata;
|
|
1921
1904
|
} | {
|
|
1922
1905
|
type: "DELETE_THREAD_ERROR";
|
|
1923
1906
|
roomId: string;
|
|
@@ -1927,12 +1910,6 @@ type CommentsOrNotificationsErrorContext = {
|
|
|
1927
1910
|
roomId: string;
|
|
1928
1911
|
threadId: string;
|
|
1929
1912
|
metadata: Patchable<BaseMetadata>;
|
|
1930
|
-
} | {
|
|
1931
|
-
type: "EDIT_COMMENT_METADATA_ERROR";
|
|
1932
|
-
roomId: string;
|
|
1933
|
-
threadId: string;
|
|
1934
|
-
commentId: string;
|
|
1935
|
-
metadata: Patchable<BaseMetadata>;
|
|
1936
1913
|
} | {
|
|
1937
1914
|
type: "MARK_THREAD_AS_RESOLVED_ERROR" | "MARK_THREAD_AS_UNRESOLVED_ERROR" | "SUBSCRIBE_TO_THREAD_ERROR" | "UNSUBSCRIBE_FROM_THREAD_ERROR";
|
|
1938
1915
|
roomId: string;
|
|
@@ -1943,7 +1920,6 @@ type CommentsOrNotificationsErrorContext = {
|
|
|
1943
1920
|
threadId: string;
|
|
1944
1921
|
commentId: string;
|
|
1945
1922
|
body: CommentBody;
|
|
1946
|
-
metadata: BaseMetadata;
|
|
1947
1923
|
} | {
|
|
1948
1924
|
type: "DELETE_COMMENT_ERROR";
|
|
1949
1925
|
roomId: string;
|
|
@@ -2020,6 +1996,12 @@ type EnterOptions<P extends JsonObject = DP, S extends LsonObject = DS> = Resolv
|
|
|
2020
1996
|
* the authentication endpoint or connect via WebSocket.
|
|
2021
1997
|
*/
|
|
2022
1998
|
autoConnect?: boolean;
|
|
1999
|
+
/**
|
|
2000
|
+
* @private Preferred storage engine version to use when creating the
|
|
2001
|
+
* room. Only takes effect if the room doesn't exist yet. Version
|
|
2002
|
+
* 2 supports streaming and will become the default in the future.
|
|
2003
|
+
*/
|
|
2004
|
+
engine?: 1 | 2;
|
|
2023
2005
|
} & PartialUnless<P, {
|
|
2024
2006
|
/**
|
|
2025
2007
|
* The initial Presence to use and announce when you enter the Room. The
|
|
@@ -2048,7 +2030,7 @@ type InternalSyncStatus = SyncStatus | "has-local-changes";
|
|
|
2048
2030
|
* of Liveblocks, NEVER USE ANY OF THESE DIRECTLY, because bad things
|
|
2049
2031
|
* will probably happen if you do.
|
|
2050
2032
|
*/
|
|
2051
|
-
type PrivateClientApi<U extends BaseUserMeta,
|
|
2033
|
+
type PrivateClientApi<U extends BaseUserMeta, M extends BaseMetadata> = {
|
|
2052
2034
|
readonly currentUserId: Signal<string | undefined>;
|
|
2053
2035
|
readonly mentionSuggestionsCache: Map<string, MentionData[]>;
|
|
2054
2036
|
readonly resolveMentionSuggestions: ClientOptions<U>["resolveMentionSuggestions"];
|
|
@@ -2056,13 +2038,13 @@ type PrivateClientApi<U extends BaseUserMeta, TM extends BaseMetadata, CM extend
|
|
|
2056
2038
|
readonly roomsInfoStore: BatchStore<DRI | undefined, string>;
|
|
2057
2039
|
readonly groupsInfoStore: BatchStore<DGI | undefined, string>;
|
|
2058
2040
|
readonly getRoomIds: () => string[];
|
|
2059
|
-
readonly httpClient: LiveblocksHttpApi<
|
|
2060
|
-
as<
|
|
2041
|
+
readonly httpClient: LiveblocksHttpApi<M>;
|
|
2042
|
+
as<M2 extends BaseMetadata>(): Client<U, M2>;
|
|
2061
2043
|
createSyncSource(): SyncSource;
|
|
2062
2044
|
emitError(context: LiveblocksErrorContext, cause?: Error): void;
|
|
2063
2045
|
ai: Ai;
|
|
2064
2046
|
};
|
|
2065
|
-
type NotificationsApi<
|
|
2047
|
+
type NotificationsApi<M extends BaseMetadata> = {
|
|
2066
2048
|
/**
|
|
2067
2049
|
* Gets a page (or the initial page) for user inbox notifications and their
|
|
2068
2050
|
* associated threads and thread subscriptions.
|
|
@@ -2089,7 +2071,7 @@ type NotificationsApi<TM extends BaseMetadata, CM extends BaseMetadata> = {
|
|
|
2089
2071
|
};
|
|
2090
2072
|
}): Promise<{
|
|
2091
2073
|
inboxNotifications: InboxNotificationData[];
|
|
2092
|
-
threads: ThreadData<
|
|
2074
|
+
threads: ThreadData<M>[];
|
|
2093
2075
|
subscriptions: SubscriptionData[];
|
|
2094
2076
|
nextCursor: string | null;
|
|
2095
2077
|
requestedAt: Date;
|
|
@@ -2130,7 +2112,7 @@ type NotificationsApi<TM extends BaseMetadata, CM extends BaseMetadata> = {
|
|
|
2130
2112
|
deleted: InboxNotificationDeleteInfo[];
|
|
2131
2113
|
};
|
|
2132
2114
|
threads: {
|
|
2133
|
-
updated: ThreadData<
|
|
2115
|
+
updated: ThreadData<M>[];
|
|
2134
2116
|
deleted: ThreadDeleteInfo[];
|
|
2135
2117
|
};
|
|
2136
2118
|
subscriptions: {
|
|
@@ -2210,23 +2192,23 @@ type NotificationsApi<TM extends BaseMetadata, CM extends BaseMetadata> = {
|
|
|
2210
2192
|
* narrower.
|
|
2211
2193
|
*/
|
|
2212
2194
|
type OpaqueClient = Client<BaseUserMeta>;
|
|
2213
|
-
type Client<U extends BaseUserMeta = DU,
|
|
2195
|
+
type Client<U extends BaseUserMeta = DU, M extends BaseMetadata = DM> = {
|
|
2214
2196
|
/**
|
|
2215
2197
|
* Gets a room. Returns null if {@link Client.enter} has not been called previously.
|
|
2216
2198
|
*
|
|
2217
2199
|
* @param roomId The id of the room
|
|
2218
2200
|
*/
|
|
2219
|
-
getRoom<P extends JsonObject = DP, S extends LsonObject = DS, E extends Json = DE,
|
|
2201
|
+
getRoom<P extends JsonObject = DP, S extends LsonObject = DS, E extends Json = DE, M2 extends BaseMetadata = M>(roomId: string): Room<P, S, U, E, M2> | null;
|
|
2220
2202
|
/**
|
|
2221
2203
|
* Enter a room.
|
|
2222
2204
|
* @param roomId The id of the room
|
|
2223
2205
|
* @param options Optional. You can provide initializers for the Presence or Storage when entering the Room.
|
|
2224
2206
|
* @returns The room and a leave function. Call the returned leave() function when you no longer need the room.
|
|
2225
2207
|
*/
|
|
2226
|
-
enterRoom<P extends JsonObject = DP, S extends LsonObject = DS, E extends Json = DE,
|
|
2208
|
+
enterRoom<P extends JsonObject = DP, S extends LsonObject = DS, E extends Json = DE, M2 extends BaseMetadata = M>(roomId: string, ...args: OptionalTupleUnless<P & S, [
|
|
2227
2209
|
options: EnterOptions<NoInfr<P>, NoInfr<S>>
|
|
2228
2210
|
]>): {
|
|
2229
|
-
room: Room<P, S, U, E,
|
|
2211
|
+
room: Room<P, S, U, E, M2>;
|
|
2230
2212
|
leave: () => void;
|
|
2231
2213
|
};
|
|
2232
2214
|
/**
|
|
@@ -2292,7 +2274,7 @@ type Client<U extends BaseUserMeta = DU, TM extends BaseMetadata = DTM, CM exten
|
|
|
2292
2274
|
* of Liveblocks, NEVER USE ANY OF THESE DIRECTLY, because bad things
|
|
2293
2275
|
* will probably happen if you do.
|
|
2294
2276
|
*/
|
|
2295
|
-
readonly [kInternal]: PrivateClientApi<U,
|
|
2277
|
+
readonly [kInternal]: PrivateClientApi<U, M>;
|
|
2296
2278
|
/**
|
|
2297
2279
|
* Returns the current global sync status of the Liveblocks client. If any
|
|
2298
2280
|
* part of Liveblocks has any local pending changes that haven't been
|
|
@@ -2316,7 +2298,7 @@ type Client<U extends BaseUserMeta = DU, TM extends BaseMetadata = DTM, CM exten
|
|
|
2316
2298
|
readonly error: Observable<LiveblocksError>;
|
|
2317
2299
|
readonly syncStatus: Observable<void>;
|
|
2318
2300
|
};
|
|
2319
|
-
} & NotificationsApi<
|
|
2301
|
+
} & NotificationsApi<M>;
|
|
2320
2302
|
type AuthEndpoint = string | ((room?: string) => Promise<CustomAuthenticationResult>);
|
|
2321
2303
|
/**
|
|
2322
2304
|
* The authentication endpoint that is called to ensure that the current user has access to a room.
|
|
@@ -2522,7 +2504,6 @@ declare const ServerMsgCode: Readonly<{
|
|
|
2522
2504
|
COMMENT_DELETED: 404;
|
|
2523
2505
|
COMMENT_REACTION_ADDED: 405;
|
|
2524
2506
|
COMMENT_REACTION_REMOVED: 406;
|
|
2525
|
-
COMMENT_METADATA_UPDATED: 409;
|
|
2526
2507
|
REJECT_STORAGE_OP: 299;
|
|
2527
2508
|
}>;
|
|
2528
2509
|
declare namespace ServerMsgCode {
|
|
@@ -2543,14 +2524,13 @@ declare namespace ServerMsgCode {
|
|
|
2543
2524
|
type COMMENT_DELETED = typeof ServerMsgCode.COMMENT_DELETED;
|
|
2544
2525
|
type COMMENT_REACTION_ADDED = typeof ServerMsgCode.COMMENT_REACTION_ADDED;
|
|
2545
2526
|
type COMMENT_REACTION_REMOVED = typeof ServerMsgCode.COMMENT_REACTION_REMOVED;
|
|
2546
|
-
type COMMENT_METADATA_UPDATED = typeof ServerMsgCode.COMMENT_METADATA_UPDATED;
|
|
2547
2527
|
type REJECT_STORAGE_OP = typeof ServerMsgCode.REJECT_STORAGE_OP;
|
|
2548
2528
|
}
|
|
2549
2529
|
/**
|
|
2550
2530
|
* Messages that can be sent from the server to the client.
|
|
2551
2531
|
*/
|
|
2552
2532
|
type ServerMsg<P extends JsonObject, U extends BaseUserMeta, E extends Json> = UpdatePresenceServerMsg<P> | UserJoinServerMsg<U> | UserLeftServerMsg | BroadcastedEventServerMsg<E> | RoomStateServerMsg<U> | InitialDocumentStateServerMsg | UpdateStorageServerMsg | YDocUpdateServerMsg | RejectedStorageOpServerMsg | CommentsEventServerMsg;
|
|
2553
|
-
type CommentsEventServerMsg = ThreadCreatedEvent | ThreadDeletedEvent | ThreadMetadataUpdatedEvent | ThreadUpdatedEvent | CommentCreatedEvent | CommentEditedEvent | CommentDeletedEvent | CommentReactionAdded | CommentReactionRemoved
|
|
2533
|
+
type CommentsEventServerMsg = ThreadCreatedEvent | ThreadDeletedEvent | ThreadMetadataUpdatedEvent | ThreadUpdatedEvent | CommentCreatedEvent | CommentEditedEvent | CommentDeletedEvent | CommentReactionAdded | CommentReactionRemoved;
|
|
2554
2534
|
type ThreadCreatedEvent = {
|
|
2555
2535
|
type: ServerMsgCode.THREAD_CREATED;
|
|
2556
2536
|
threadId: string;
|
|
@@ -2594,11 +2574,6 @@ type CommentReactionRemoved = {
|
|
|
2594
2574
|
commentId: string;
|
|
2595
2575
|
emoji: string;
|
|
2596
2576
|
};
|
|
2597
|
-
type CommentMetadataUpdatedEvent = {
|
|
2598
|
-
type: ServerMsgCode.COMMENT_METADATA_UPDATED;
|
|
2599
|
-
threadId: string;
|
|
2600
|
-
commentId: string;
|
|
2601
|
-
};
|
|
2602
2577
|
/**
|
|
2603
2578
|
* Sent by the WebSocket server and broadcasted to all clients to announce that
|
|
2604
2579
|
* a User updated their presence. For example, when a user moves their cursor.
|
|
@@ -3080,12 +3055,12 @@ type SubscribeFn<P extends JsonObject, _TStorage extends LsonObject, U extends B
|
|
|
3080
3055
|
(type: "storage-status", listener: Callback<StorageStatus>): () => void;
|
|
3081
3056
|
(type: "comments", listener: Callback<CommentsEventServerMsg>): () => void;
|
|
3082
3057
|
};
|
|
3083
|
-
type GetThreadsOptions<
|
|
3058
|
+
type GetThreadsOptions<M extends BaseMetadata> = {
|
|
3084
3059
|
cursor?: string;
|
|
3085
3060
|
query?: {
|
|
3086
3061
|
resolved?: boolean;
|
|
3087
3062
|
subscribed?: boolean;
|
|
3088
|
-
metadata?: Partial<QueryMetadata<
|
|
3063
|
+
metadata?: Partial<QueryMetadata<M>>;
|
|
3089
3064
|
};
|
|
3090
3065
|
};
|
|
3091
3066
|
type GetThreadsSinceOptions = {
|
|
@@ -3108,7 +3083,7 @@ type GetSubscriptionSettingsOptions = {
|
|
|
3108
3083
|
* a Room instance using globally augmented types only, which is narrower.
|
|
3109
3084
|
*/
|
|
3110
3085
|
type OpaqueRoom = Room<JsonObject, LsonObject, BaseUserMeta, Json, BaseMetadata>;
|
|
3111
|
-
type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUserMeta = DU, E extends Json = DE,
|
|
3086
|
+
type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUserMeta = DU, E extends Json = DE, M extends BaseMetadata = DM> = {
|
|
3112
3087
|
/**
|
|
3113
3088
|
* @private
|
|
3114
3089
|
*
|
|
@@ -3322,8 +3297,8 @@ type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUs
|
|
|
3322
3297
|
* requestedAt
|
|
3323
3298
|
* } = await room.getThreads({ query: { resolved: false }});
|
|
3324
3299
|
*/
|
|
3325
|
-
getThreads(options?: GetThreadsOptions<
|
|
3326
|
-
threads: ThreadData<
|
|
3300
|
+
getThreads(options?: GetThreadsOptions<M>): Promise<{
|
|
3301
|
+
threads: ThreadData<M>[];
|
|
3327
3302
|
inboxNotifications: InboxNotificationData[];
|
|
3328
3303
|
subscriptions: SubscriptionData[];
|
|
3329
3304
|
requestedAt: Date;
|
|
@@ -3340,7 +3315,7 @@ type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUs
|
|
|
3340
3315
|
*/
|
|
3341
3316
|
getThreadsSince(options: GetThreadsSinceOptions): Promise<{
|
|
3342
3317
|
threads: {
|
|
3343
|
-
updated: ThreadData<
|
|
3318
|
+
updated: ThreadData<M>[];
|
|
3344
3319
|
deleted: ThreadDeleteInfo[];
|
|
3345
3320
|
};
|
|
3346
3321
|
inboxNotifications: {
|
|
@@ -3361,7 +3336,7 @@ type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUs
|
|
|
3361
3336
|
* const { thread, inboxNotification, subscription } = await room.getThread("th_xxx");
|
|
3362
3337
|
*/
|
|
3363
3338
|
getThread(threadId: string): Promise<{
|
|
3364
|
-
thread?: ThreadData<
|
|
3339
|
+
thread?: ThreadData<M>;
|
|
3365
3340
|
inboxNotification?: InboxNotificationData;
|
|
3366
3341
|
subscription?: SubscriptionData;
|
|
3367
3342
|
}>;
|
|
@@ -3379,11 +3354,10 @@ type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUs
|
|
|
3379
3354
|
createThread(options: {
|
|
3380
3355
|
threadId?: string;
|
|
3381
3356
|
commentId?: string;
|
|
3382
|
-
metadata:
|
|
3357
|
+
metadata: M | undefined;
|
|
3383
3358
|
body: CommentBody;
|
|
3384
|
-
commentMetadata?: CM;
|
|
3385
3359
|
attachmentIds?: string[];
|
|
3386
|
-
}): Promise<ThreadData<
|
|
3360
|
+
}): Promise<ThreadData<M>>;
|
|
3387
3361
|
/**
|
|
3388
3362
|
* Deletes a thread.
|
|
3389
3363
|
*
|
|
@@ -3399,21 +3373,9 @@ type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUs
|
|
|
3399
3373
|
* await room.editThreadMetadata({ threadId: "th_xxx", metadata: { x: 100, y: 100 } })
|
|
3400
3374
|
*/
|
|
3401
3375
|
editThreadMetadata(options: {
|
|
3402
|
-
metadata: Patchable<
|
|
3376
|
+
metadata: Patchable<M>;
|
|
3403
3377
|
threadId: string;
|
|
3404
|
-
}): Promise<
|
|
3405
|
-
/**
|
|
3406
|
-
* Edits a comment's metadata.
|
|
3407
|
-
* To delete an existing metadata property, set its value to `null`.
|
|
3408
|
-
*
|
|
3409
|
-
* @example
|
|
3410
|
-
* await room.editCommentMetadata({ threadId: "th_xxx", commentId: "cm_xxx", metadata: { slackChannelId: "C024BE91L", slackMessageTs: "1700311782.001200" } })
|
|
3411
|
-
*/
|
|
3412
|
-
editCommentMetadata(options: {
|
|
3413
|
-
threadId: string;
|
|
3414
|
-
commentId: string;
|
|
3415
|
-
metadata: Patchable<CM>;
|
|
3416
|
-
}): Promise<CM>;
|
|
3378
|
+
}): Promise<M>;
|
|
3417
3379
|
/**
|
|
3418
3380
|
* Marks a thread as resolved.
|
|
3419
3381
|
*
|
|
@@ -3458,9 +3420,8 @@ type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUs
|
|
|
3458
3420
|
threadId: string;
|
|
3459
3421
|
commentId?: string;
|
|
3460
3422
|
body: CommentBody;
|
|
3461
|
-
metadata?: CM;
|
|
3462
3423
|
attachmentIds?: string[];
|
|
3463
|
-
}): Promise<CommentData
|
|
3424
|
+
}): Promise<CommentData>;
|
|
3464
3425
|
/**
|
|
3465
3426
|
* Edits a comment.
|
|
3466
3427
|
*
|
|
@@ -3478,9 +3439,8 @@ type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUs
|
|
|
3478
3439
|
threadId: string;
|
|
3479
3440
|
commentId: string;
|
|
3480
3441
|
body: CommentBody;
|
|
3481
|
-
metadata?: Patchable<CM>;
|
|
3482
3442
|
attachmentIds?: string[];
|
|
3483
|
-
}): Promise<CommentData
|
|
3443
|
+
}): Promise<CommentData>;
|
|
3484
3444
|
/**
|
|
3485
3445
|
* Deletes a comment.
|
|
3486
3446
|
* If it is the last non-deleted comment, the thread also gets deleted.
|
|
@@ -4499,14 +4459,14 @@ declare const MENTION_CHARACTER = "@";
|
|
|
4499
4459
|
* @param data The plain comment data object (usually returned by the API)
|
|
4500
4460
|
* @returns The rich comment data object that can be used by the client.
|
|
4501
4461
|
*/
|
|
4502
|
-
declare function convertToCommentData
|
|
4462
|
+
declare function convertToCommentData(data: CommentDataPlain): CommentData;
|
|
4503
4463
|
/**
|
|
4504
4464
|
* Converts a plain thread data object (usually returned by the API) to a thread data object that can be used by the client.
|
|
4505
4465
|
* This is necessary because the plain data object stores dates as ISO strings, but the client expects them as Date objects.
|
|
4506
4466
|
* @param data The plain thread data object (usually returned by the API)
|
|
4507
4467
|
* @returns The rich thread data object that can be used by the client.
|
|
4508
4468
|
*/
|
|
4509
|
-
declare function convertToThreadData<
|
|
4469
|
+
declare function convertToThreadData<M extends BaseMetadata>(data: ThreadDataPlain<M>): ThreadData<M>;
|
|
4510
4470
|
/**
|
|
4511
4471
|
* Converts a plain comment reaction object (usually returned by the API) to a comment reaction object that can be used by the client.
|
|
4512
4472
|
* This is necessary because the plain data object stores dates as ISO strings, but the client expects them as Date objects.
|
|
@@ -5222,4 +5182,4 @@ type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (EnsureJson
|
|
|
5222
5182
|
[K in keyof T as EnsureJson<T[K]> extends never ? never : K]: EnsureJson<T[K]>;
|
|
5223
5183
|
};
|
|
5224
5184
|
|
|
5225
|
-
export { type
|
|
5185
|
+
export { type AckOp, type ActivityData, type AiAssistantContentPart, type AiAssistantMessage, type AiChat, type AiChatMessage, type AiChatsQuery, type AiKnowledgeRetrievalPart, type AiKnowledgeSource, type AiOpaqueToolDefinition, type AiOpaqueToolInvocationProps, type AiReasoningPart, type AiRetrievalPart, type AiSourcesPart, type AiTextPart, type AiToolDefinition, type AiToolExecuteCallback, type AiToolExecuteContext, type AiToolInvocationPart, type AiToolInvocationProps, type AiToolTypePack, type AiUrlSource, type AiUserMessage, type AiWebRetrievalPart, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type Awaitable, type BaseActivitiesData, type BaseAuthResult, type BaseGroupInfo, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type CommentAttachment, 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 CommentLocalAttachment, type CommentMixedAttachment, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, type CommentsEventServerMsg, type ContextualPromptContext, type ContextualPromptResponse, type CopilotId, CrdtType, type CreateListOp, type CreateManagedPoolOptions, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type Cursor, type CustomAuthenticationResult, type DAD, type DE, type DGI, type DM, type DP, type DRI, type DS, type DU, DefaultMap, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, Deque, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type GroupData, type GroupDataPlain, type GroupMemberData, type GroupMentionData, type GroupScopes, type History, type HistoryVersion, HttpError, type ISODateString, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IdTuple, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InferFromSchema, type InitialDocumentStateServerMsg, type Json, type JsonArray, type JsonObject, type JsonScalar, type KDAD, type LargeMessageStrategy, type LayerKey, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type LiveblocksErrorContext, type LostConnectionEvent, type Lson, type LsonObject, MENTION_CHARACTER, type ManagedPool, type MentionData, type MessageId, MutableSignal, type NoInfr, type NodeMap, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, type NotificationSettings, type NotificationSettingsPlain, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialNotificationSettings, type PartialUnless, type Patchable, Permission, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type Poller, type PrivateClientApi, type PrivateRoomApi, Promise_withResolvers, type QueryMetadata, type QueryParams, type RejectedStorageOpServerMsg, type Relax, type RenderableToolResultResponse, type Resolve, type ResolveGroupsInfoArgs, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomStateServerMsg, type RoomSubscriptionSettings, type SearchCommentsResult, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type SetParentKeyOp, Signal, type SignalType, SortedList, type Status, type StorageStatus, type StorageUpdate, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type SubscriptionData, type SubscriptionDataPlain, type SubscriptionDeleteInfo, type SubscriptionDeleteInfoPlain, type SubscriptionKey, type SyncSource, type SyncStatus, TextEditorType, type ThreadData, type ThreadDataPlain, type ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ToImmutable, type ToJson, type ToolResultResponse, type URLSafeString, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type UploadAttachmentOptions, type UrlMetadata, type User, type UserJoinServerMsg, type UserLeftServerMsg, type UserMentionData, type UserRoomSubscriptionSettings, type UserSubscriptionData, type UserSubscriptionDataPlain, WebsocketCloseCodes, type WithNavigation, type WithOptional, type WithRequired, type YDocUpdateServerMsg, type YjsSyncStatus, asPos, assert, assertNever, autoRetry, b64decode, batch, checkBounds, chunk, cloneLson, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToGroupData, convertToInboxNotificationData, convertToSubscriptionData, convertToThreadData, convertToUserSubscriptionData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createManagedPool, createNotificationSettings, createThreadId, defineAiTool, deprecate, deprecateIf, detectDupes, entries, errorIf, findLastIndex, freeze, generateUrl, getMentionsFromCommentBody, getSubscriptionKey, html, htmlSafe, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isNotificationChannelEnabled, isNumberOperator, isPlainObject, isStartsWithOperator, isUrl, kInternal, keys, legacy_patchImmutableObject, lsonToJson, makeAbortController, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, patchNotificationSettings, raise, resolveMentionsInCommentBody, sanitizeUrl, shallow, shallow2, stableStringify, stringifyCommentBody, throwUsageError, toPlainLson, tryParseJson, url, urljoin, wait, warnOnce, warnOnceIf, withTimeout };
|