@liveblocks/core 3.6.0 → 3.7.0-preview1
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 +297 -194
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +119 -14
- package/dist/index.d.ts +119 -14
- package/dist/index.js +174 -71
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -225,7 +225,9 @@ declare function makeEventSource<T>(): EventSource<T>;
|
|
|
225
225
|
type BatchStore<O, I> = {
|
|
226
226
|
subscribe: (callback: Callback<void>) => UnsubscribeCallback;
|
|
227
227
|
enqueue: (input: I) => Promise<void>;
|
|
228
|
+
fill: (input: I, data: O) => void;
|
|
228
229
|
getItemState: (input: I) => AsyncResult<O> | undefined;
|
|
230
|
+
getData: (input: I) => O | undefined;
|
|
229
231
|
invalidate: (inputs?: I[]) => void;
|
|
230
232
|
};
|
|
231
233
|
|
|
@@ -1030,6 +1032,17 @@ type DateToString<T> = {
|
|
|
1030
1032
|
[P in keyof T]: T[P] extends Date ? string : T[P] extends Date | null ? string | null : T[P] extends Date | undefined ? string | undefined : T[P];
|
|
1031
1033
|
};
|
|
1032
1034
|
|
|
1035
|
+
type MentionData = Relax<UserMentionData | GroupMentionData>;
|
|
1036
|
+
type UserMentionData = {
|
|
1037
|
+
kind: "user";
|
|
1038
|
+
id: string;
|
|
1039
|
+
};
|
|
1040
|
+
type GroupMentionData = {
|
|
1041
|
+
kind: "group";
|
|
1042
|
+
id: string;
|
|
1043
|
+
userIds?: string[];
|
|
1044
|
+
};
|
|
1045
|
+
|
|
1033
1046
|
type InboxNotificationThreadData = {
|
|
1034
1047
|
kind: "thread";
|
|
1035
1048
|
id: string;
|
|
@@ -1046,6 +1059,7 @@ type InboxNotificationTextMentionData = {
|
|
|
1046
1059
|
readAt: Date | null;
|
|
1047
1060
|
createdBy: string;
|
|
1048
1061
|
mentionId: string;
|
|
1062
|
+
mention: MentionData;
|
|
1049
1063
|
};
|
|
1050
1064
|
type InboxNotificationTextMentionDataPlain = DateToString<InboxNotificationTextMentionData>;
|
|
1051
1065
|
type ActivityData = Record<string, string | boolean | number | undefined>;
|
|
@@ -1080,6 +1094,22 @@ type BaseActivitiesData = {
|
|
|
1080
1094
|
[key: `$${string}`]: ActivityData;
|
|
1081
1095
|
};
|
|
1082
1096
|
|
|
1097
|
+
type BaseGroupInfo = {
|
|
1098
|
+
[key: string]: Json | undefined;
|
|
1099
|
+
/**
|
|
1100
|
+
* The name of the group.
|
|
1101
|
+
*/
|
|
1102
|
+
name?: string;
|
|
1103
|
+
/**
|
|
1104
|
+
* The avatar of the group.
|
|
1105
|
+
*/
|
|
1106
|
+
avatar?: string;
|
|
1107
|
+
/**
|
|
1108
|
+
* The description of the group.
|
|
1109
|
+
*/
|
|
1110
|
+
description?: string;
|
|
1111
|
+
};
|
|
1112
|
+
|
|
1083
1113
|
type BaseRoomInfo = {
|
|
1084
1114
|
[key: string]: Json | undefined;
|
|
1085
1115
|
/**
|
|
@@ -1100,7 +1130,7 @@ declare global {
|
|
|
1100
1130
|
[key: string]: unknown;
|
|
1101
1131
|
}
|
|
1102
1132
|
}
|
|
1103
|
-
type ExtendableTypes = "Presence" | "Storage" | "UserMeta" | "RoomEvent" | "ThreadMetadata" | "RoomInfo" | "ActivitiesData";
|
|
1133
|
+
type ExtendableTypes = "Presence" | "Storage" | "UserMeta" | "RoomEvent" | "ThreadMetadata" | "RoomInfo" | "GroupInfo" | "ActivitiesData";
|
|
1104
1134
|
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}`;
|
|
1105
1135
|
type GetOverride<K extends ExtendableTypes, B, Reason extends string = "does not match its requirements"> = GetOverrideOrErrorValue<K, B, MakeErrorString<K, Reason>>;
|
|
1106
1136
|
type GetOverrideOrErrorValue<K extends ExtendableTypes, B, ErrorType> = unknown extends Liveblocks[K] ? B : Liveblocks[K] extends B ? Liveblocks[K] : ErrorType;
|
|
@@ -1110,6 +1140,7 @@ type DU = GetOverrideOrErrorValue<"UserMeta", BaseUserMeta, Record<"id" | "info"
|
|
|
1110
1140
|
type DE = GetOverride<"RoomEvent", Json, "is not a valid JSON value">;
|
|
1111
1141
|
type DM = GetOverride<"ThreadMetadata", BaseMetadata>;
|
|
1112
1142
|
type DRI = GetOverride<"RoomInfo", BaseRoomInfo>;
|
|
1143
|
+
type DGI = GetOverride<"GroupInfo", BaseGroupInfo>;
|
|
1113
1144
|
type DAD = GetOverrideOrErrorValue<"ActivitiesData", BaseActivitiesData, {
|
|
1114
1145
|
[K in keyof Liveblocks["ActivitiesData"]]: "At least one of the custom notification kinds you provided for 'ActivitiesData' does not match its requirements. To learn how to fix this, see https://liveblocks.io/docs/errors/ActivitiesData";
|
|
1115
1146
|
}>;
|
|
@@ -1201,12 +1232,18 @@ type CommentBodyParagraph = {
|
|
|
1201
1232
|
type: "paragraph";
|
|
1202
1233
|
children: CommentBodyInlineElement[];
|
|
1203
1234
|
};
|
|
1204
|
-
type CommentBodyMention = Relax<CommentBodyUserMention>;
|
|
1235
|
+
type CommentBodyMention = Relax<CommentBodyUserMention | CommentBodyGroupMention>;
|
|
1205
1236
|
type CommentBodyUserMention = {
|
|
1206
1237
|
type: "mention";
|
|
1207
1238
|
kind: "user";
|
|
1208
1239
|
id: string;
|
|
1209
1240
|
};
|
|
1241
|
+
type CommentBodyGroupMention = {
|
|
1242
|
+
type: "mention";
|
|
1243
|
+
kind: "group";
|
|
1244
|
+
id: string;
|
|
1245
|
+
userIds?: string[];
|
|
1246
|
+
};
|
|
1210
1247
|
type CommentBodyLink = {
|
|
1211
1248
|
type: "link";
|
|
1212
1249
|
url: string;
|
|
@@ -1270,6 +1307,26 @@ type QueryMetadata<M extends BaseMetadata> = {
|
|
|
1270
1307
|
[K in keyof M]: (string extends M[K] ? StringOperators<M[K]> : M[K]) | null;
|
|
1271
1308
|
};
|
|
1272
1309
|
|
|
1310
|
+
type GroupMemberData = {
|
|
1311
|
+
id: string;
|
|
1312
|
+
addedAt: Date;
|
|
1313
|
+
};
|
|
1314
|
+
type GroupScopes = Partial<{
|
|
1315
|
+
mention: true;
|
|
1316
|
+
}>;
|
|
1317
|
+
type GroupData = {
|
|
1318
|
+
type: "group";
|
|
1319
|
+
id: string;
|
|
1320
|
+
tenantId: string;
|
|
1321
|
+
createdAt: Date;
|
|
1322
|
+
updatedAt: Date;
|
|
1323
|
+
scopes: GroupScopes;
|
|
1324
|
+
members: GroupMemberData[];
|
|
1325
|
+
};
|
|
1326
|
+
type GroupDataPlain = Omit<DateToString<GroupData>, "members"> & {
|
|
1327
|
+
members: DateToString<GroupMemberData>[];
|
|
1328
|
+
};
|
|
1329
|
+
|
|
1273
1330
|
/**
|
|
1274
1331
|
* Pre-defined notification channels support list.
|
|
1275
1332
|
*/
|
|
@@ -1593,10 +1650,10 @@ interface RoomHttpApi<M extends BaseMetadata> {
|
|
|
1593
1650
|
getChatAttachmentUrl(options: {
|
|
1594
1651
|
attachmentId: string;
|
|
1595
1652
|
}): Promise<string>;
|
|
1596
|
-
createTextMention({ roomId,
|
|
1653
|
+
createTextMention({ roomId, mentionId, mention, }: {
|
|
1597
1654
|
roomId: string;
|
|
1598
|
-
userId: string;
|
|
1599
1655
|
mentionId: string;
|
|
1656
|
+
mention: MentionData;
|
|
1600
1657
|
}): Promise<void>;
|
|
1601
1658
|
deleteTextMention({ roomId, mentionId, }: {
|
|
1602
1659
|
roomId: string;
|
|
@@ -1735,6 +1792,8 @@ interface LiveblocksHttpApi<M extends BaseMetadata> extends RoomHttpApi<M>, Noti
|
|
|
1735
1792
|
requestedAt: Date;
|
|
1736
1793
|
permissionHints: Record<string, Permission[]>;
|
|
1737
1794
|
}>;
|
|
1795
|
+
groupsStore: BatchStore<GroupData | undefined, string>;
|
|
1796
|
+
getGroup(groupId: string): Promise<GroupData | undefined>;
|
|
1738
1797
|
}
|
|
1739
1798
|
|
|
1740
1799
|
/**
|
|
@@ -1841,12 +1900,6 @@ declare class LiveblocksError extends Error {
|
|
|
1841
1900
|
static from(context: LiveblocksErrorContext, cause?: Error): LiveblocksError;
|
|
1842
1901
|
}
|
|
1843
1902
|
|
|
1844
|
-
type MentionData = Relax<UserMentionData>;
|
|
1845
|
-
type UserMentionData = {
|
|
1846
|
-
kind: "user";
|
|
1847
|
-
id: string;
|
|
1848
|
-
};
|
|
1849
|
-
|
|
1850
1903
|
type ResolveMentionSuggestionsArgs = {
|
|
1851
1904
|
/**
|
|
1852
1905
|
* The ID of the current room.
|
|
@@ -1869,6 +1922,12 @@ type ResolveRoomsInfoArgs = {
|
|
|
1869
1922
|
*/
|
|
1870
1923
|
roomIds: string[];
|
|
1871
1924
|
};
|
|
1925
|
+
type ResolveGroupsInfoArgs = {
|
|
1926
|
+
/**
|
|
1927
|
+
* The IDs of the groups to resolve.
|
|
1928
|
+
*/
|
|
1929
|
+
groupIds: string[];
|
|
1930
|
+
};
|
|
1872
1931
|
type EnterOptions<P extends JsonObject = DP, S extends LsonObject = DS> = Resolve<{
|
|
1873
1932
|
/**
|
|
1874
1933
|
* Whether or not the room automatically connects to Liveblock servers.
|
|
@@ -1912,6 +1971,7 @@ type PrivateClientApi<U extends BaseUserMeta, M extends BaseMetadata> = {
|
|
|
1912
1971
|
readonly resolveMentionSuggestions: ClientOptions<U>["resolveMentionSuggestions"];
|
|
1913
1972
|
readonly usersStore: BatchStore<U["info"] | undefined, string>;
|
|
1914
1973
|
readonly roomsInfoStore: BatchStore<DRI | undefined, string>;
|
|
1974
|
+
readonly groupsInfoStore: BatchStore<DGI | undefined, string>;
|
|
1915
1975
|
readonly getRoomIds: () => string[];
|
|
1916
1976
|
readonly httpClient: LiveblocksHttpApi<M>;
|
|
1917
1977
|
as<M2 extends BaseMetadata>(): Client<U, M2>;
|
|
@@ -2107,6 +2167,18 @@ type Client<U extends BaseUserMeta = DU, M extends BaseMetadata = DM> = {
|
|
|
2107
2167
|
* client.resolvers.invalidateRoomsInfo(["room-1", "room-2"]);
|
|
2108
2168
|
*/
|
|
2109
2169
|
invalidateRoomsInfo(roomIds?: string[]): void;
|
|
2170
|
+
/**
|
|
2171
|
+
* Invalidate some or all groups info that were previously cached by `resolveGroupsInfo`.
|
|
2172
|
+
*
|
|
2173
|
+
* @example
|
|
2174
|
+
* // Invalidate all groups
|
|
2175
|
+
* client.resolvers.invalidateGroupsInfo();
|
|
2176
|
+
*
|
|
2177
|
+
* @example
|
|
2178
|
+
* // Invalidate specific groups
|
|
2179
|
+
* client.resolvers.invalidateGroupsInfo(["group-1", "group-2"]);
|
|
2180
|
+
*/
|
|
2181
|
+
invalidateGroupsInfo(groupIds?: string[]): void;
|
|
2110
2182
|
/**
|
|
2111
2183
|
* Invalidate all mention suggestions cached by `resolveMentionSuggestions`.
|
|
2112
2184
|
*
|
|
@@ -2174,6 +2246,11 @@ type ClientOptions<U extends BaseUserMeta = DU> = {
|
|
|
2174
2246
|
* You should return a list of room info objects of the same size, in the same order.
|
|
2175
2247
|
*/
|
|
2176
2248
|
resolveRoomsInfo?: (args: ResolveRoomsInfoArgs) => Awaitable<(DRI | undefined)[] | undefined>;
|
|
2249
|
+
/**
|
|
2250
|
+
* A function that returns group info from group IDs.
|
|
2251
|
+
* You should return a list of group info objects of the same size, in the same order.
|
|
2252
|
+
*/
|
|
2253
|
+
resolveGroupsInfo?: (args: ResolveGroupsInfoArgs) => Awaitable<(DGI | undefined)[] | undefined>;
|
|
2177
2254
|
/**
|
|
2178
2255
|
* Prevent the current browser tab from being closed if there are any locally
|
|
2179
2256
|
* pending Liveblocks changes that haven't been submitted to or confirmed by
|
|
@@ -3376,7 +3453,7 @@ type PrivateRoomApi = {
|
|
|
3376
3453
|
getSelf_forDevTools(): UserTreeNode | null;
|
|
3377
3454
|
getOthers_forDevTools(): readonly UserTreeNode[];
|
|
3378
3455
|
reportTextEditor(editor: TextEditorType, rootKey: string): Promise<void>;
|
|
3379
|
-
createTextMention(
|
|
3456
|
+
createTextMention(mentionId: string, mention: MentionData): Promise<void>;
|
|
3380
3457
|
deleteTextMention(mentionId: string): Promise<void>;
|
|
3381
3458
|
listTextVersions(): Promise<{
|
|
3382
3459
|
versions: HistoryVersion[];
|
|
@@ -4154,9 +4231,13 @@ type CommentBodyMentionElementArgs<U extends BaseUserMeta = DU> = {
|
|
|
4154
4231
|
*/
|
|
4155
4232
|
element: CommentBodyMention;
|
|
4156
4233
|
/**
|
|
4157
|
-
* The mention's user info, if the `
|
|
4234
|
+
* The mention's user info, if the mention is a user mention and the `resolveUsers` option was provided.
|
|
4158
4235
|
*/
|
|
4159
4236
|
user?: U["info"];
|
|
4237
|
+
/**
|
|
4238
|
+
* The mention's group info, if the mention is a group mention and the `resolveGroupsInfo` option was provided.
|
|
4239
|
+
*/
|
|
4240
|
+
group?: DGI;
|
|
4160
4241
|
};
|
|
4161
4242
|
type StringifyCommentBodyElements<U extends BaseUserMeta = DU> = {
|
|
4162
4243
|
/**
|
|
@@ -4195,6 +4276,11 @@ type StringifyCommentBodyOptions<U extends BaseUserMeta = DU> = {
|
|
|
4195
4276
|
* You should return a list of user objects of the same size, in the same order.
|
|
4196
4277
|
*/
|
|
4197
4278
|
resolveUsers?: (args: ResolveUsersArgs) => Awaitable<(U["info"] | undefined)[] | undefined>;
|
|
4279
|
+
/**
|
|
4280
|
+
* A function that returns group info from group IDs.
|
|
4281
|
+
* You should return a list of group info objects of the same size, in the same order.
|
|
4282
|
+
*/
|
|
4283
|
+
resolveGroupsInfo?: (args: ResolveGroupsInfoArgs) => Awaitable<(DGI | undefined)[] | undefined>;
|
|
4198
4284
|
};
|
|
4199
4285
|
declare function isCommentBodyText(element: CommentBodyElement): element is CommentBodyText;
|
|
4200
4286
|
declare function isCommentBodyMention(element: CommentBodyElement): element is CommentBodyMention;
|
|
@@ -4206,7 +4292,10 @@ declare function isCommentBodyLink(element: CommentBodyElement): element is Comm
|
|
|
4206
4292
|
* `(mention) => mention.kind === "user"` to only get user mentions.
|
|
4207
4293
|
*/
|
|
4208
4294
|
declare function getMentionsFromCommentBody(body: CommentBody, predicate?: (mention: CommentBodyMention) => boolean): CommentBodyMention[];
|
|
4209
|
-
declare function
|
|
4295
|
+
declare function resolveMentionsInCommentBody<U extends BaseUserMeta>(body: CommentBody, resolveUsers?: (args: ResolveUsersArgs) => Awaitable<(U["info"] | undefined)[] | undefined>, resolveGroupsInfo?: (args: ResolveGroupsInfoArgs) => Awaitable<(DGI | undefined)[] | undefined>): Promise<{
|
|
4296
|
+
users: Map<string, U["info"]>;
|
|
4297
|
+
groups: Map<string, DGI>;
|
|
4298
|
+
}>;
|
|
4210
4299
|
declare function htmlSafe(value: string): HtmlSafeString;
|
|
4211
4300
|
declare class HtmlSafeString {
|
|
4212
4301
|
#private;
|
|
@@ -4224,6 +4313,8 @@ declare function html(strings: TemplateStringsArray, ...values: (string | string
|
|
|
4224
4313
|
*/
|
|
4225
4314
|
declare function stringifyCommentBody(body: CommentBody, options?: StringifyCommentBodyOptions<BaseUserMeta>): Promise<string>;
|
|
4226
4315
|
|
|
4316
|
+
declare const MENTION_CHARACTER = "@";
|
|
4317
|
+
|
|
4227
4318
|
/**
|
|
4228
4319
|
* Converts a plain comment data object (usually returned by the API) to a comment data object that can be used by the client.
|
|
4229
4320
|
* This is necessary because the plain data object stores dates as ISO strings, but the client expects them as Date objects.
|
|
@@ -4266,6 +4357,7 @@ declare function convertToSubscriptionData(data: SubscriptionDataPlain): Subscri
|
|
|
4266
4357
|
* @returns The rich user subscription data object that can be used by the client.
|
|
4267
4358
|
*/
|
|
4268
4359
|
declare function convertToUserSubscriptionData(data: UserSubscriptionDataPlain): UserSubscriptionData;
|
|
4360
|
+
declare function convertToGroupData(data: GroupDataPlain): GroupData;
|
|
4269
4361
|
|
|
4270
4362
|
/**
|
|
4271
4363
|
* Lookup table for nodes (= SerializedCrdt values) by their IDs.
|
|
@@ -4782,6 +4874,19 @@ declare function sanitizeUrl(url: string): string | null;
|
|
|
4782
4874
|
declare function generateUrl(url: string, params?: Record<string, string | number | undefined>, hash?: string): string;
|
|
4783
4875
|
declare function isUrl(string: string): boolean;
|
|
4784
4876
|
|
|
4877
|
+
/**
|
|
4878
|
+
* Emit a warning only once.
|
|
4879
|
+
*
|
|
4880
|
+
* Only has effect in dev mode. In production, this is a no-op.
|
|
4881
|
+
*/
|
|
4882
|
+
declare function warnOnce(message: string, key?: string): void;
|
|
4883
|
+
/**
|
|
4884
|
+
* Emit a warning only once if a condition is met.
|
|
4885
|
+
*
|
|
4886
|
+
* Only has effect in dev mode. In production, this is a no-op.
|
|
4887
|
+
*/
|
|
4888
|
+
declare function warnOnceIf(condition: boolean | (() => boolean), message: string, key?: string): void;
|
|
4889
|
+
|
|
4785
4890
|
/**
|
|
4786
4891
|
* Definition of all messages the Panel can send to the Client.
|
|
4787
4892
|
*/
|
|
@@ -4914,4 +5019,4 @@ type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (EnsureJson
|
|
|
4914
5019
|
[K in keyof T as EnsureJson<T[K]> extends never ? never : K]: EnsureJson<T[K]>;
|
|
4915
5020
|
};
|
|
4916
5021
|
|
|
4917
|
-
export { type AckOp, type ActivityData, type AiAssistantContentPart, type AiAssistantMessage, type AiChat, type AiChatMessage, type AiChatsQuery, type AiKnowledgeSource, type AiOpaqueToolDefinition, type AiOpaqueToolInvocationProps, type AiReasoningPart, type AiRetrievalPart, type AiTextPart, type AiToolDefinition, type AiToolExecuteCallback, type AiToolExecuteContext, type AiToolInvocationPart, type AiToolInvocationProps, type AiToolTypePack, type AiUserMessage, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type Awaitable, type BaseActivitiesData, type BaseAuthResult, 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 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 History, type HistoryVersion, HttpError, 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, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type LiveblocksErrorContext, type LostConnectionEvent, type Lson, type LsonObject, 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 ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomStateServerMsg, type RoomSubscriptionSettings, 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 User, type UserJoinServerMsg, type UserLeftServerMsg, type UserMentionData, type UserRoomSubscriptionSettings, type UserSubscriptionData, type UserSubscriptionDataPlain, WebsocketCloseCodes, type WithNavigation, type WithOptional, type WithRequired, type YDocUpdateServerMsg, type YjsSyncStatus, ackOp, asPos, assert, assertNever, autoRetry, b64decode, batch, checkBounds, chunk, cloneLson, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToInboxNotificationData, convertToSubscriptionData, convertToThreadData, convertToUserSubscriptionData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createManagedPool, createNotificationSettings, createThreadId, defineAiTool, deprecate, deprecateIf, detectDupes, entries, errorIf, findLastIndex, freeze, generateUrl, getMentionsFromCommentBody, getSubscriptionKey, html, htmlSafe, isChildCrdt, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isNotificationChannelEnabled, isPlainObject, isRootCrdt, isStartsWithOperator, isUrl, kInternal, keys, legacy_patchImmutableObject, lsonToJson, makeAbortController, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, patchNotificationSettings, raise,
|
|
5022
|
+
export { type AckOp, type ActivityData, type AiAssistantContentPart, type AiAssistantMessage, type AiChat, type AiChatMessage, type AiChatsQuery, type AiKnowledgeSource, type AiOpaqueToolDefinition, type AiOpaqueToolInvocationProps, type AiReasoningPart, type AiRetrievalPart, type AiTextPart, type AiToolDefinition, type AiToolExecuteCallback, type AiToolExecuteContext, type AiToolInvocationPart, type AiToolInvocationProps, type AiToolTypePack, type AiUserMessage, 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 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, 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 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 User, type UserJoinServerMsg, type UserLeftServerMsg, type UserMentionData, type UserRoomSubscriptionSettings, type UserSubscriptionData, type UserSubscriptionDataPlain, WebsocketCloseCodes, type WithNavigation, type WithOptional, type WithRequired, type YDocUpdateServerMsg, type YjsSyncStatus, ackOp, 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, isChildCrdt, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isNotificationChannelEnabled, isPlainObject, isRootCrdt, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -225,7 +225,9 @@ declare function makeEventSource<T>(): EventSource<T>;
|
|
|
225
225
|
type BatchStore<O, I> = {
|
|
226
226
|
subscribe: (callback: Callback<void>) => UnsubscribeCallback;
|
|
227
227
|
enqueue: (input: I) => Promise<void>;
|
|
228
|
+
fill: (input: I, data: O) => void;
|
|
228
229
|
getItemState: (input: I) => AsyncResult<O> | undefined;
|
|
230
|
+
getData: (input: I) => O | undefined;
|
|
229
231
|
invalidate: (inputs?: I[]) => void;
|
|
230
232
|
};
|
|
231
233
|
|
|
@@ -1030,6 +1032,17 @@ type DateToString<T> = {
|
|
|
1030
1032
|
[P in keyof T]: T[P] extends Date ? string : T[P] extends Date | null ? string | null : T[P] extends Date | undefined ? string | undefined : T[P];
|
|
1031
1033
|
};
|
|
1032
1034
|
|
|
1035
|
+
type MentionData = Relax<UserMentionData | GroupMentionData>;
|
|
1036
|
+
type UserMentionData = {
|
|
1037
|
+
kind: "user";
|
|
1038
|
+
id: string;
|
|
1039
|
+
};
|
|
1040
|
+
type GroupMentionData = {
|
|
1041
|
+
kind: "group";
|
|
1042
|
+
id: string;
|
|
1043
|
+
userIds?: string[];
|
|
1044
|
+
};
|
|
1045
|
+
|
|
1033
1046
|
type InboxNotificationThreadData = {
|
|
1034
1047
|
kind: "thread";
|
|
1035
1048
|
id: string;
|
|
@@ -1046,6 +1059,7 @@ type InboxNotificationTextMentionData = {
|
|
|
1046
1059
|
readAt: Date | null;
|
|
1047
1060
|
createdBy: string;
|
|
1048
1061
|
mentionId: string;
|
|
1062
|
+
mention: MentionData;
|
|
1049
1063
|
};
|
|
1050
1064
|
type InboxNotificationTextMentionDataPlain = DateToString<InboxNotificationTextMentionData>;
|
|
1051
1065
|
type ActivityData = Record<string, string | boolean | number | undefined>;
|
|
@@ -1080,6 +1094,22 @@ type BaseActivitiesData = {
|
|
|
1080
1094
|
[key: `$${string}`]: ActivityData;
|
|
1081
1095
|
};
|
|
1082
1096
|
|
|
1097
|
+
type BaseGroupInfo = {
|
|
1098
|
+
[key: string]: Json | undefined;
|
|
1099
|
+
/**
|
|
1100
|
+
* The name of the group.
|
|
1101
|
+
*/
|
|
1102
|
+
name?: string;
|
|
1103
|
+
/**
|
|
1104
|
+
* The avatar of the group.
|
|
1105
|
+
*/
|
|
1106
|
+
avatar?: string;
|
|
1107
|
+
/**
|
|
1108
|
+
* The description of the group.
|
|
1109
|
+
*/
|
|
1110
|
+
description?: string;
|
|
1111
|
+
};
|
|
1112
|
+
|
|
1083
1113
|
type BaseRoomInfo = {
|
|
1084
1114
|
[key: string]: Json | undefined;
|
|
1085
1115
|
/**
|
|
@@ -1100,7 +1130,7 @@ declare global {
|
|
|
1100
1130
|
[key: string]: unknown;
|
|
1101
1131
|
}
|
|
1102
1132
|
}
|
|
1103
|
-
type ExtendableTypes = "Presence" | "Storage" | "UserMeta" | "RoomEvent" | "ThreadMetadata" | "RoomInfo" | "ActivitiesData";
|
|
1133
|
+
type ExtendableTypes = "Presence" | "Storage" | "UserMeta" | "RoomEvent" | "ThreadMetadata" | "RoomInfo" | "GroupInfo" | "ActivitiesData";
|
|
1104
1134
|
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}`;
|
|
1105
1135
|
type GetOverride<K extends ExtendableTypes, B, Reason extends string = "does not match its requirements"> = GetOverrideOrErrorValue<K, B, MakeErrorString<K, Reason>>;
|
|
1106
1136
|
type GetOverrideOrErrorValue<K extends ExtendableTypes, B, ErrorType> = unknown extends Liveblocks[K] ? B : Liveblocks[K] extends B ? Liveblocks[K] : ErrorType;
|
|
@@ -1110,6 +1140,7 @@ type DU = GetOverrideOrErrorValue<"UserMeta", BaseUserMeta, Record<"id" | "info"
|
|
|
1110
1140
|
type DE = GetOverride<"RoomEvent", Json, "is not a valid JSON value">;
|
|
1111
1141
|
type DM = GetOverride<"ThreadMetadata", BaseMetadata>;
|
|
1112
1142
|
type DRI = GetOverride<"RoomInfo", BaseRoomInfo>;
|
|
1143
|
+
type DGI = GetOverride<"GroupInfo", BaseGroupInfo>;
|
|
1113
1144
|
type DAD = GetOverrideOrErrorValue<"ActivitiesData", BaseActivitiesData, {
|
|
1114
1145
|
[K in keyof Liveblocks["ActivitiesData"]]: "At least one of the custom notification kinds you provided for 'ActivitiesData' does not match its requirements. To learn how to fix this, see https://liveblocks.io/docs/errors/ActivitiesData";
|
|
1115
1146
|
}>;
|
|
@@ -1201,12 +1232,18 @@ type CommentBodyParagraph = {
|
|
|
1201
1232
|
type: "paragraph";
|
|
1202
1233
|
children: CommentBodyInlineElement[];
|
|
1203
1234
|
};
|
|
1204
|
-
type CommentBodyMention = Relax<CommentBodyUserMention>;
|
|
1235
|
+
type CommentBodyMention = Relax<CommentBodyUserMention | CommentBodyGroupMention>;
|
|
1205
1236
|
type CommentBodyUserMention = {
|
|
1206
1237
|
type: "mention";
|
|
1207
1238
|
kind: "user";
|
|
1208
1239
|
id: string;
|
|
1209
1240
|
};
|
|
1241
|
+
type CommentBodyGroupMention = {
|
|
1242
|
+
type: "mention";
|
|
1243
|
+
kind: "group";
|
|
1244
|
+
id: string;
|
|
1245
|
+
userIds?: string[];
|
|
1246
|
+
};
|
|
1210
1247
|
type CommentBodyLink = {
|
|
1211
1248
|
type: "link";
|
|
1212
1249
|
url: string;
|
|
@@ -1270,6 +1307,26 @@ type QueryMetadata<M extends BaseMetadata> = {
|
|
|
1270
1307
|
[K in keyof M]: (string extends M[K] ? StringOperators<M[K]> : M[K]) | null;
|
|
1271
1308
|
};
|
|
1272
1309
|
|
|
1310
|
+
type GroupMemberData = {
|
|
1311
|
+
id: string;
|
|
1312
|
+
addedAt: Date;
|
|
1313
|
+
};
|
|
1314
|
+
type GroupScopes = Partial<{
|
|
1315
|
+
mention: true;
|
|
1316
|
+
}>;
|
|
1317
|
+
type GroupData = {
|
|
1318
|
+
type: "group";
|
|
1319
|
+
id: string;
|
|
1320
|
+
tenantId: string;
|
|
1321
|
+
createdAt: Date;
|
|
1322
|
+
updatedAt: Date;
|
|
1323
|
+
scopes: GroupScopes;
|
|
1324
|
+
members: GroupMemberData[];
|
|
1325
|
+
};
|
|
1326
|
+
type GroupDataPlain = Omit<DateToString<GroupData>, "members"> & {
|
|
1327
|
+
members: DateToString<GroupMemberData>[];
|
|
1328
|
+
};
|
|
1329
|
+
|
|
1273
1330
|
/**
|
|
1274
1331
|
* Pre-defined notification channels support list.
|
|
1275
1332
|
*/
|
|
@@ -1593,10 +1650,10 @@ interface RoomHttpApi<M extends BaseMetadata> {
|
|
|
1593
1650
|
getChatAttachmentUrl(options: {
|
|
1594
1651
|
attachmentId: string;
|
|
1595
1652
|
}): Promise<string>;
|
|
1596
|
-
createTextMention({ roomId,
|
|
1653
|
+
createTextMention({ roomId, mentionId, mention, }: {
|
|
1597
1654
|
roomId: string;
|
|
1598
|
-
userId: string;
|
|
1599
1655
|
mentionId: string;
|
|
1656
|
+
mention: MentionData;
|
|
1600
1657
|
}): Promise<void>;
|
|
1601
1658
|
deleteTextMention({ roomId, mentionId, }: {
|
|
1602
1659
|
roomId: string;
|
|
@@ -1735,6 +1792,8 @@ interface LiveblocksHttpApi<M extends BaseMetadata> extends RoomHttpApi<M>, Noti
|
|
|
1735
1792
|
requestedAt: Date;
|
|
1736
1793
|
permissionHints: Record<string, Permission[]>;
|
|
1737
1794
|
}>;
|
|
1795
|
+
groupsStore: BatchStore<GroupData | undefined, string>;
|
|
1796
|
+
getGroup(groupId: string): Promise<GroupData | undefined>;
|
|
1738
1797
|
}
|
|
1739
1798
|
|
|
1740
1799
|
/**
|
|
@@ -1841,12 +1900,6 @@ declare class LiveblocksError extends Error {
|
|
|
1841
1900
|
static from(context: LiveblocksErrorContext, cause?: Error): LiveblocksError;
|
|
1842
1901
|
}
|
|
1843
1902
|
|
|
1844
|
-
type MentionData = Relax<UserMentionData>;
|
|
1845
|
-
type UserMentionData = {
|
|
1846
|
-
kind: "user";
|
|
1847
|
-
id: string;
|
|
1848
|
-
};
|
|
1849
|
-
|
|
1850
1903
|
type ResolveMentionSuggestionsArgs = {
|
|
1851
1904
|
/**
|
|
1852
1905
|
* The ID of the current room.
|
|
@@ -1869,6 +1922,12 @@ type ResolveRoomsInfoArgs = {
|
|
|
1869
1922
|
*/
|
|
1870
1923
|
roomIds: string[];
|
|
1871
1924
|
};
|
|
1925
|
+
type ResolveGroupsInfoArgs = {
|
|
1926
|
+
/**
|
|
1927
|
+
* The IDs of the groups to resolve.
|
|
1928
|
+
*/
|
|
1929
|
+
groupIds: string[];
|
|
1930
|
+
};
|
|
1872
1931
|
type EnterOptions<P extends JsonObject = DP, S extends LsonObject = DS> = Resolve<{
|
|
1873
1932
|
/**
|
|
1874
1933
|
* Whether or not the room automatically connects to Liveblock servers.
|
|
@@ -1912,6 +1971,7 @@ type PrivateClientApi<U extends BaseUserMeta, M extends BaseMetadata> = {
|
|
|
1912
1971
|
readonly resolveMentionSuggestions: ClientOptions<U>["resolveMentionSuggestions"];
|
|
1913
1972
|
readonly usersStore: BatchStore<U["info"] | undefined, string>;
|
|
1914
1973
|
readonly roomsInfoStore: BatchStore<DRI | undefined, string>;
|
|
1974
|
+
readonly groupsInfoStore: BatchStore<DGI | undefined, string>;
|
|
1915
1975
|
readonly getRoomIds: () => string[];
|
|
1916
1976
|
readonly httpClient: LiveblocksHttpApi<M>;
|
|
1917
1977
|
as<M2 extends BaseMetadata>(): Client<U, M2>;
|
|
@@ -2107,6 +2167,18 @@ type Client<U extends BaseUserMeta = DU, M extends BaseMetadata = DM> = {
|
|
|
2107
2167
|
* client.resolvers.invalidateRoomsInfo(["room-1", "room-2"]);
|
|
2108
2168
|
*/
|
|
2109
2169
|
invalidateRoomsInfo(roomIds?: string[]): void;
|
|
2170
|
+
/**
|
|
2171
|
+
* Invalidate some or all groups info that were previously cached by `resolveGroupsInfo`.
|
|
2172
|
+
*
|
|
2173
|
+
* @example
|
|
2174
|
+
* // Invalidate all groups
|
|
2175
|
+
* client.resolvers.invalidateGroupsInfo();
|
|
2176
|
+
*
|
|
2177
|
+
* @example
|
|
2178
|
+
* // Invalidate specific groups
|
|
2179
|
+
* client.resolvers.invalidateGroupsInfo(["group-1", "group-2"]);
|
|
2180
|
+
*/
|
|
2181
|
+
invalidateGroupsInfo(groupIds?: string[]): void;
|
|
2110
2182
|
/**
|
|
2111
2183
|
* Invalidate all mention suggestions cached by `resolveMentionSuggestions`.
|
|
2112
2184
|
*
|
|
@@ -2174,6 +2246,11 @@ type ClientOptions<U extends BaseUserMeta = DU> = {
|
|
|
2174
2246
|
* You should return a list of room info objects of the same size, in the same order.
|
|
2175
2247
|
*/
|
|
2176
2248
|
resolveRoomsInfo?: (args: ResolveRoomsInfoArgs) => Awaitable<(DRI | undefined)[] | undefined>;
|
|
2249
|
+
/**
|
|
2250
|
+
* A function that returns group info from group IDs.
|
|
2251
|
+
* You should return a list of group info objects of the same size, in the same order.
|
|
2252
|
+
*/
|
|
2253
|
+
resolveGroupsInfo?: (args: ResolveGroupsInfoArgs) => Awaitable<(DGI | undefined)[] | undefined>;
|
|
2177
2254
|
/**
|
|
2178
2255
|
* Prevent the current browser tab from being closed if there are any locally
|
|
2179
2256
|
* pending Liveblocks changes that haven't been submitted to or confirmed by
|
|
@@ -3376,7 +3453,7 @@ type PrivateRoomApi = {
|
|
|
3376
3453
|
getSelf_forDevTools(): UserTreeNode | null;
|
|
3377
3454
|
getOthers_forDevTools(): readonly UserTreeNode[];
|
|
3378
3455
|
reportTextEditor(editor: TextEditorType, rootKey: string): Promise<void>;
|
|
3379
|
-
createTextMention(
|
|
3456
|
+
createTextMention(mentionId: string, mention: MentionData): Promise<void>;
|
|
3380
3457
|
deleteTextMention(mentionId: string): Promise<void>;
|
|
3381
3458
|
listTextVersions(): Promise<{
|
|
3382
3459
|
versions: HistoryVersion[];
|
|
@@ -4154,9 +4231,13 @@ type CommentBodyMentionElementArgs<U extends BaseUserMeta = DU> = {
|
|
|
4154
4231
|
*/
|
|
4155
4232
|
element: CommentBodyMention;
|
|
4156
4233
|
/**
|
|
4157
|
-
* The mention's user info, if the `
|
|
4234
|
+
* The mention's user info, if the mention is a user mention and the `resolveUsers` option was provided.
|
|
4158
4235
|
*/
|
|
4159
4236
|
user?: U["info"];
|
|
4237
|
+
/**
|
|
4238
|
+
* The mention's group info, if the mention is a group mention and the `resolveGroupsInfo` option was provided.
|
|
4239
|
+
*/
|
|
4240
|
+
group?: DGI;
|
|
4160
4241
|
};
|
|
4161
4242
|
type StringifyCommentBodyElements<U extends BaseUserMeta = DU> = {
|
|
4162
4243
|
/**
|
|
@@ -4195,6 +4276,11 @@ type StringifyCommentBodyOptions<U extends BaseUserMeta = DU> = {
|
|
|
4195
4276
|
* You should return a list of user objects of the same size, in the same order.
|
|
4196
4277
|
*/
|
|
4197
4278
|
resolveUsers?: (args: ResolveUsersArgs) => Awaitable<(U["info"] | undefined)[] | undefined>;
|
|
4279
|
+
/**
|
|
4280
|
+
* A function that returns group info from group IDs.
|
|
4281
|
+
* You should return a list of group info objects of the same size, in the same order.
|
|
4282
|
+
*/
|
|
4283
|
+
resolveGroupsInfo?: (args: ResolveGroupsInfoArgs) => Awaitable<(DGI | undefined)[] | undefined>;
|
|
4198
4284
|
};
|
|
4199
4285
|
declare function isCommentBodyText(element: CommentBodyElement): element is CommentBodyText;
|
|
4200
4286
|
declare function isCommentBodyMention(element: CommentBodyElement): element is CommentBodyMention;
|
|
@@ -4206,7 +4292,10 @@ declare function isCommentBodyLink(element: CommentBodyElement): element is Comm
|
|
|
4206
4292
|
* `(mention) => mention.kind === "user"` to only get user mentions.
|
|
4207
4293
|
*/
|
|
4208
4294
|
declare function getMentionsFromCommentBody(body: CommentBody, predicate?: (mention: CommentBodyMention) => boolean): CommentBodyMention[];
|
|
4209
|
-
declare function
|
|
4295
|
+
declare function resolveMentionsInCommentBody<U extends BaseUserMeta>(body: CommentBody, resolveUsers?: (args: ResolveUsersArgs) => Awaitable<(U["info"] | undefined)[] | undefined>, resolveGroupsInfo?: (args: ResolveGroupsInfoArgs) => Awaitable<(DGI | undefined)[] | undefined>): Promise<{
|
|
4296
|
+
users: Map<string, U["info"]>;
|
|
4297
|
+
groups: Map<string, DGI>;
|
|
4298
|
+
}>;
|
|
4210
4299
|
declare function htmlSafe(value: string): HtmlSafeString;
|
|
4211
4300
|
declare class HtmlSafeString {
|
|
4212
4301
|
#private;
|
|
@@ -4224,6 +4313,8 @@ declare function html(strings: TemplateStringsArray, ...values: (string | string
|
|
|
4224
4313
|
*/
|
|
4225
4314
|
declare function stringifyCommentBody(body: CommentBody, options?: StringifyCommentBodyOptions<BaseUserMeta>): Promise<string>;
|
|
4226
4315
|
|
|
4316
|
+
declare const MENTION_CHARACTER = "@";
|
|
4317
|
+
|
|
4227
4318
|
/**
|
|
4228
4319
|
* Converts a plain comment data object (usually returned by the API) to a comment data object that can be used by the client.
|
|
4229
4320
|
* This is necessary because the plain data object stores dates as ISO strings, but the client expects them as Date objects.
|
|
@@ -4266,6 +4357,7 @@ declare function convertToSubscriptionData(data: SubscriptionDataPlain): Subscri
|
|
|
4266
4357
|
* @returns The rich user subscription data object that can be used by the client.
|
|
4267
4358
|
*/
|
|
4268
4359
|
declare function convertToUserSubscriptionData(data: UserSubscriptionDataPlain): UserSubscriptionData;
|
|
4360
|
+
declare function convertToGroupData(data: GroupDataPlain): GroupData;
|
|
4269
4361
|
|
|
4270
4362
|
/**
|
|
4271
4363
|
* Lookup table for nodes (= SerializedCrdt values) by their IDs.
|
|
@@ -4782,6 +4874,19 @@ declare function sanitizeUrl(url: string): string | null;
|
|
|
4782
4874
|
declare function generateUrl(url: string, params?: Record<string, string | number | undefined>, hash?: string): string;
|
|
4783
4875
|
declare function isUrl(string: string): boolean;
|
|
4784
4876
|
|
|
4877
|
+
/**
|
|
4878
|
+
* Emit a warning only once.
|
|
4879
|
+
*
|
|
4880
|
+
* Only has effect in dev mode. In production, this is a no-op.
|
|
4881
|
+
*/
|
|
4882
|
+
declare function warnOnce(message: string, key?: string): void;
|
|
4883
|
+
/**
|
|
4884
|
+
* Emit a warning only once if a condition is met.
|
|
4885
|
+
*
|
|
4886
|
+
* Only has effect in dev mode. In production, this is a no-op.
|
|
4887
|
+
*/
|
|
4888
|
+
declare function warnOnceIf(condition: boolean | (() => boolean), message: string, key?: string): void;
|
|
4889
|
+
|
|
4785
4890
|
/**
|
|
4786
4891
|
* Definition of all messages the Panel can send to the Client.
|
|
4787
4892
|
*/
|
|
@@ -4914,4 +5019,4 @@ type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (EnsureJson
|
|
|
4914
5019
|
[K in keyof T as EnsureJson<T[K]> extends never ? never : K]: EnsureJson<T[K]>;
|
|
4915
5020
|
};
|
|
4916
5021
|
|
|
4917
|
-
export { type AckOp, type ActivityData, type AiAssistantContentPart, type AiAssistantMessage, type AiChat, type AiChatMessage, type AiChatsQuery, type AiKnowledgeSource, type AiOpaqueToolDefinition, type AiOpaqueToolInvocationProps, type AiReasoningPart, type AiRetrievalPart, type AiTextPart, type AiToolDefinition, type AiToolExecuteCallback, type AiToolExecuteContext, type AiToolInvocationPart, type AiToolInvocationProps, type AiToolTypePack, type AiUserMessage, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type Awaitable, type BaseActivitiesData, type BaseAuthResult, 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 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 History, type HistoryVersion, HttpError, 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, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type LiveblocksErrorContext, type LostConnectionEvent, type Lson, type LsonObject, 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 ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomStateServerMsg, type RoomSubscriptionSettings, 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 User, type UserJoinServerMsg, type UserLeftServerMsg, type UserMentionData, type UserRoomSubscriptionSettings, type UserSubscriptionData, type UserSubscriptionDataPlain, WebsocketCloseCodes, type WithNavigation, type WithOptional, type WithRequired, type YDocUpdateServerMsg, type YjsSyncStatus, ackOp, asPos, assert, assertNever, autoRetry, b64decode, batch, checkBounds, chunk, cloneLson, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToInboxNotificationData, convertToSubscriptionData, convertToThreadData, convertToUserSubscriptionData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createManagedPool, createNotificationSettings, createThreadId, defineAiTool, deprecate, deprecateIf, detectDupes, entries, errorIf, findLastIndex, freeze, generateUrl, getMentionsFromCommentBody, getSubscriptionKey, html, htmlSafe, isChildCrdt, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isNotificationChannelEnabled, isPlainObject, isRootCrdt, isStartsWithOperator, isUrl, kInternal, keys, legacy_patchImmutableObject, lsonToJson, makeAbortController, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, patchNotificationSettings, raise,
|
|
5022
|
+
export { type AckOp, type ActivityData, type AiAssistantContentPart, type AiAssistantMessage, type AiChat, type AiChatMessage, type AiChatsQuery, type AiKnowledgeSource, type AiOpaqueToolDefinition, type AiOpaqueToolInvocationProps, type AiReasoningPart, type AiRetrievalPart, type AiTextPart, type AiToolDefinition, type AiToolExecuteCallback, type AiToolExecuteContext, type AiToolInvocationPart, type AiToolInvocationProps, type AiToolTypePack, type AiUserMessage, 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 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, 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 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 User, type UserJoinServerMsg, type UserLeftServerMsg, type UserMentionData, type UserRoomSubscriptionSettings, type UserSubscriptionData, type UserSubscriptionDataPlain, WebsocketCloseCodes, type WithNavigation, type WithOptional, type WithRequired, type YDocUpdateServerMsg, type YjsSyncStatus, ackOp, 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, isChildCrdt, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isNotificationChannelEnabled, isPlainObject, isRootCrdt, 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 };
|