@liveblocks/core 3.13.0-metadata1 → 3.13.0-metadata2
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 +50 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -14
- package/dist/index.d.ts +16 -14
- package/dist/index.js +50 -28
- 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;
|
|
@@ -2020,6 +2016,12 @@ type EnterOptions<P extends JsonObject = DP, S extends LsonObject = DS> = Resolv
|
|
|
2020
2016
|
* the authentication endpoint or connect via WebSocket.
|
|
2021
2017
|
*/
|
|
2022
2018
|
autoConnect?: boolean;
|
|
2019
|
+
/**
|
|
2020
|
+
* @private Preferred storage engine version to use when creating the
|
|
2021
|
+
* room. Only takes effect if the room doesn't exist yet. Version
|
|
2022
|
+
* 2 supports streaming and will become the default in the future.
|
|
2023
|
+
*/
|
|
2024
|
+
engine?: 1 | 2;
|
|
2023
2025
|
} & PartialUnless<P, {
|
|
2024
2026
|
/**
|
|
2025
2027
|
* The initial Presence to use and announce when you enter the Room. The
|
|
@@ -2510,7 +2512,7 @@ declare const ServerMsgCode: Readonly<{
|
|
|
2510
2512
|
USER_LEFT: 102;
|
|
2511
2513
|
BROADCASTED_EVENT: 103;
|
|
2512
2514
|
ROOM_STATE: 104;
|
|
2513
|
-
|
|
2515
|
+
STORAGE_STATE: 200;
|
|
2514
2516
|
UPDATE_STORAGE: 201;
|
|
2515
2517
|
UPDATE_YDOC: 300;
|
|
2516
2518
|
THREAD_CREATED: 400;
|
|
@@ -2531,7 +2533,7 @@ declare namespace ServerMsgCode {
|
|
|
2531
2533
|
type USER_LEFT = typeof ServerMsgCode.USER_LEFT;
|
|
2532
2534
|
type BROADCASTED_EVENT = typeof ServerMsgCode.BROADCASTED_EVENT;
|
|
2533
2535
|
type ROOM_STATE = typeof ServerMsgCode.ROOM_STATE;
|
|
2534
|
-
type
|
|
2536
|
+
type STORAGE_STATE = typeof ServerMsgCode.STORAGE_STATE;
|
|
2535
2537
|
type UPDATE_STORAGE = typeof ServerMsgCode.UPDATE_STORAGE;
|
|
2536
2538
|
type UPDATE_YDOC = typeof ServerMsgCode.UPDATE_YDOC;
|
|
2537
2539
|
type THREAD_CREATED = typeof ServerMsgCode.THREAD_CREATED;
|
|
@@ -2549,7 +2551,7 @@ declare namespace ServerMsgCode {
|
|
|
2549
2551
|
/**
|
|
2550
2552
|
* Messages that can be sent from the server to the client.
|
|
2551
2553
|
*/
|
|
2552
|
-
type ServerMsg<P extends JsonObject, U extends BaseUserMeta, E extends Json> = UpdatePresenceServerMsg<P> | UserJoinServerMsg<U> | UserLeftServerMsg | BroadcastedEventServerMsg<E> | RoomStateServerMsg<U> |
|
|
2554
|
+
type ServerMsg<P extends JsonObject, U extends BaseUserMeta, E extends Json> = UpdatePresenceServerMsg<P> | UserJoinServerMsg<U> | UserLeftServerMsg | BroadcastedEventServerMsg<E> | RoomStateServerMsg<U> | StorageStateServerMsg | UpdateStorageServerMsg | YDocUpdateServerMsg | RejectedStorageOpServerMsg | CommentsEventServerMsg;
|
|
2553
2555
|
type CommentsEventServerMsg = ThreadCreatedEvent | ThreadDeletedEvent | ThreadMetadataUpdatedEvent | ThreadUpdatedEvent | CommentCreatedEvent | CommentEditedEvent | CommentDeletedEvent | CommentReactionAdded | CommentReactionRemoved | CommentMetadataUpdatedEvent;
|
|
2554
2556
|
type ThreadCreatedEvent = {
|
|
2555
2557
|
type: ServerMsgCode.THREAD_CREATED;
|
|
@@ -2745,11 +2747,11 @@ type RoomStateServerMsg<U extends BaseUserMeta> = {
|
|
|
2745
2747
|
};
|
|
2746
2748
|
/**
|
|
2747
2749
|
* Sent by the WebSocket server to a single client in response to the client
|
|
2748
|
-
*
|
|
2749
|
-
* payload includes the entire Storage document.
|
|
2750
|
+
* sending a FetchStorageClientMsg message, to provide the initial Storage
|
|
2751
|
+
* state of the Room. The payload includes the entire Storage document.
|
|
2750
2752
|
*/
|
|
2751
|
-
type
|
|
2752
|
-
readonly type: ServerMsgCode.
|
|
2753
|
+
type StorageStateServerMsg = {
|
|
2754
|
+
readonly type: ServerMsgCode.STORAGE_STATE;
|
|
2753
2755
|
readonly items: IdTuple<SerializedCrdt>[];
|
|
2754
2756
|
};
|
|
2755
2757
|
/**
|
|
@@ -5222,4 +5224,4 @@ type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (EnsureJson
|
|
|
5222
5224
|
[K in keyof T as EnsureJson<T[K]> extends never ? never : K]: EnsureJson<T[K]>;
|
|
5223
5225
|
};
|
|
5224
5226
|
|
|
5225
|
-
export { type
|
|
5227
|
+
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 DCM, type DE, type DGI, type DP, type DRI, type DS, type DTM, 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 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 StorageStateServerMsg, 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 };
|
package/dist/index.d.ts
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;
|
|
@@ -2020,6 +2016,12 @@ type EnterOptions<P extends JsonObject = DP, S extends LsonObject = DS> = Resolv
|
|
|
2020
2016
|
* the authentication endpoint or connect via WebSocket.
|
|
2021
2017
|
*/
|
|
2022
2018
|
autoConnect?: boolean;
|
|
2019
|
+
/**
|
|
2020
|
+
* @private Preferred storage engine version to use when creating the
|
|
2021
|
+
* room. Only takes effect if the room doesn't exist yet. Version
|
|
2022
|
+
* 2 supports streaming and will become the default in the future.
|
|
2023
|
+
*/
|
|
2024
|
+
engine?: 1 | 2;
|
|
2023
2025
|
} & PartialUnless<P, {
|
|
2024
2026
|
/**
|
|
2025
2027
|
* The initial Presence to use and announce when you enter the Room. The
|
|
@@ -2510,7 +2512,7 @@ declare const ServerMsgCode: Readonly<{
|
|
|
2510
2512
|
USER_LEFT: 102;
|
|
2511
2513
|
BROADCASTED_EVENT: 103;
|
|
2512
2514
|
ROOM_STATE: 104;
|
|
2513
|
-
|
|
2515
|
+
STORAGE_STATE: 200;
|
|
2514
2516
|
UPDATE_STORAGE: 201;
|
|
2515
2517
|
UPDATE_YDOC: 300;
|
|
2516
2518
|
THREAD_CREATED: 400;
|
|
@@ -2531,7 +2533,7 @@ declare namespace ServerMsgCode {
|
|
|
2531
2533
|
type USER_LEFT = typeof ServerMsgCode.USER_LEFT;
|
|
2532
2534
|
type BROADCASTED_EVENT = typeof ServerMsgCode.BROADCASTED_EVENT;
|
|
2533
2535
|
type ROOM_STATE = typeof ServerMsgCode.ROOM_STATE;
|
|
2534
|
-
type
|
|
2536
|
+
type STORAGE_STATE = typeof ServerMsgCode.STORAGE_STATE;
|
|
2535
2537
|
type UPDATE_STORAGE = typeof ServerMsgCode.UPDATE_STORAGE;
|
|
2536
2538
|
type UPDATE_YDOC = typeof ServerMsgCode.UPDATE_YDOC;
|
|
2537
2539
|
type THREAD_CREATED = typeof ServerMsgCode.THREAD_CREATED;
|
|
@@ -2549,7 +2551,7 @@ declare namespace ServerMsgCode {
|
|
|
2549
2551
|
/**
|
|
2550
2552
|
* Messages that can be sent from the server to the client.
|
|
2551
2553
|
*/
|
|
2552
|
-
type ServerMsg<P extends JsonObject, U extends BaseUserMeta, E extends Json> = UpdatePresenceServerMsg<P> | UserJoinServerMsg<U> | UserLeftServerMsg | BroadcastedEventServerMsg<E> | RoomStateServerMsg<U> |
|
|
2554
|
+
type ServerMsg<P extends JsonObject, U extends BaseUserMeta, E extends Json> = UpdatePresenceServerMsg<P> | UserJoinServerMsg<U> | UserLeftServerMsg | BroadcastedEventServerMsg<E> | RoomStateServerMsg<U> | StorageStateServerMsg | UpdateStorageServerMsg | YDocUpdateServerMsg | RejectedStorageOpServerMsg | CommentsEventServerMsg;
|
|
2553
2555
|
type CommentsEventServerMsg = ThreadCreatedEvent | ThreadDeletedEvent | ThreadMetadataUpdatedEvent | ThreadUpdatedEvent | CommentCreatedEvent | CommentEditedEvent | CommentDeletedEvent | CommentReactionAdded | CommentReactionRemoved | CommentMetadataUpdatedEvent;
|
|
2554
2556
|
type ThreadCreatedEvent = {
|
|
2555
2557
|
type: ServerMsgCode.THREAD_CREATED;
|
|
@@ -2745,11 +2747,11 @@ type RoomStateServerMsg<U extends BaseUserMeta> = {
|
|
|
2745
2747
|
};
|
|
2746
2748
|
/**
|
|
2747
2749
|
* Sent by the WebSocket server to a single client in response to the client
|
|
2748
|
-
*
|
|
2749
|
-
* payload includes the entire Storage document.
|
|
2750
|
+
* sending a FetchStorageClientMsg message, to provide the initial Storage
|
|
2751
|
+
* state of the Room. The payload includes the entire Storage document.
|
|
2750
2752
|
*/
|
|
2751
|
-
type
|
|
2752
|
-
readonly type: ServerMsgCode.
|
|
2753
|
+
type StorageStateServerMsg = {
|
|
2754
|
+
readonly type: ServerMsgCode.STORAGE_STATE;
|
|
2753
2755
|
readonly items: IdTuple<SerializedCrdt>[];
|
|
2754
2756
|
};
|
|
2755
2757
|
/**
|
|
@@ -5222,4 +5224,4 @@ type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (EnsureJson
|
|
|
5222
5224
|
[K in keyof T as EnsureJson<T[K]> extends never ? never : K]: EnsureJson<T[K]>;
|
|
5223
5225
|
};
|
|
5224
5226
|
|
|
5225
|
-
export { type
|
|
5227
|
+
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 DCM, type DE, type DGI, type DP, type DRI, type DS, type DTM, 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 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 StorageStateServerMsg, 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 };
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ var __export = (target, all) => {
|
|
|
6
6
|
|
|
7
7
|
// src/version.ts
|
|
8
8
|
var PKG_NAME = "@liveblocks/core";
|
|
9
|
-
var PKG_VERSION = "3.13.0-
|
|
9
|
+
var PKG_VERSION = "3.13.0-metadata2";
|
|
10
10
|
var PKG_FORMAT = "esm";
|
|
11
11
|
|
|
12
12
|
// src/dupe-detection.ts
|
|
@@ -3104,7 +3104,7 @@ var ServerMsgCode = Object.freeze({
|
|
|
3104
3104
|
BROADCASTED_EVENT: 103,
|
|
3105
3105
|
ROOM_STATE: 104,
|
|
3106
3106
|
// For Storage
|
|
3107
|
-
|
|
3107
|
+
STORAGE_STATE: 200,
|
|
3108
3108
|
UPDATE_STORAGE: 201,
|
|
3109
3109
|
// For Yjs Docs
|
|
3110
3110
|
UPDATE_YDOC: 300,
|
|
@@ -5941,9 +5941,8 @@ var OpCode = Object.freeze({
|
|
|
5941
5941
|
ACK: 9
|
|
5942
5942
|
// Will only appear in v8+
|
|
5943
5943
|
});
|
|
5944
|
-
function
|
|
5945
|
-
return op.type === OpCode.
|
|
5946
|
-
op.type === OpCode.DELETE_CRDT && op.id === "ACK";
|
|
5944
|
+
function isAckOp(op) {
|
|
5945
|
+
return op.type === OpCode.DELETE_CRDT && op.id === "ACK";
|
|
5947
5946
|
}
|
|
5948
5947
|
|
|
5949
5948
|
// src/crdts/AbstractCrdt.ts
|
|
@@ -6629,17 +6628,17 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6629
6628
|
}
|
|
6630
6629
|
let result;
|
|
6631
6630
|
if (op.intent === "set") {
|
|
6632
|
-
if (source === 1 /*
|
|
6631
|
+
if (source === 1 /* THEIRS */) {
|
|
6633
6632
|
result = this.#applySetRemote(op);
|
|
6634
|
-
} else if (source === 2 /*
|
|
6633
|
+
} else if (source === 2 /* OURS */) {
|
|
6635
6634
|
result = this.#applySetAck(op);
|
|
6636
6635
|
} else {
|
|
6637
6636
|
result = this.#applySetUndoRedo(op);
|
|
6638
6637
|
}
|
|
6639
6638
|
} else {
|
|
6640
|
-
if (source === 1 /*
|
|
6639
|
+
if (source === 1 /* THEIRS */) {
|
|
6641
6640
|
result = this.#applyRemoteInsert(op);
|
|
6642
|
-
} else if (source === 2 /*
|
|
6641
|
+
} else if (source === 2 /* OURS */) {
|
|
6643
6642
|
result = this.#applyInsertAck(op);
|
|
6644
6643
|
} else {
|
|
6645
6644
|
result = this.#applyInsertUndoRedo(op);
|
|
@@ -6802,9 +6801,9 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
6802
6801
|
}
|
|
6803
6802
|
/** @internal */
|
|
6804
6803
|
_setChildKey(newKey, child, source) {
|
|
6805
|
-
if (source === 1 /*
|
|
6804
|
+
if (source === 1 /* THEIRS */) {
|
|
6806
6805
|
return this.#applySetChildKeyRemote(newKey, child);
|
|
6807
|
-
} else if (source === 2 /*
|
|
6806
|
+
} else if (source === 2 /* OURS */) {
|
|
6808
6807
|
return this.#applySetChildKeyAck(newKey, child);
|
|
6809
6808
|
} else {
|
|
6810
6809
|
return this.#applySetChildKeyUndoRedo(newKey, child);
|
|
@@ -7318,7 +7317,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
|
|
|
7318
7317
|
if (this._pool.getNode(id) !== void 0) {
|
|
7319
7318
|
return { modified: false };
|
|
7320
7319
|
}
|
|
7321
|
-
if (source === 2 /*
|
|
7320
|
+
if (source === 2 /* OURS */) {
|
|
7322
7321
|
const lastUpdateOpId = this.#unacknowledgedSet.get(key);
|
|
7323
7322
|
if (lastUpdateOpId === opId) {
|
|
7324
7323
|
this.#unacknowledgedSet.delete(key);
|
|
@@ -7326,7 +7325,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
|
|
|
7326
7325
|
} else if (lastUpdateOpId !== void 0) {
|
|
7327
7326
|
return { modified: false };
|
|
7328
7327
|
}
|
|
7329
|
-
} else if (source === 1 /*
|
|
7328
|
+
} else if (source === 1 /* THEIRS */) {
|
|
7330
7329
|
this.#unacknowledgedSet.delete(key);
|
|
7331
7330
|
}
|
|
7332
7331
|
const previousValue = this.#map.get(key);
|
|
@@ -7719,7 +7718,7 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
|
|
|
7719
7718
|
}
|
|
7720
7719
|
return { modified: false };
|
|
7721
7720
|
}
|
|
7722
|
-
if (source === 0 /*
|
|
7721
|
+
if (source === 0 /* LOCAL */) {
|
|
7723
7722
|
this.#propToLastUpdate.set(key, nn(opId));
|
|
7724
7723
|
} else if (this.#propToLastUpdate.get(key) === void 0) {
|
|
7725
7724
|
} else if (this.#propToLastUpdate.get(key) === opId) {
|
|
@@ -9127,7 +9126,11 @@ function createRoom(options, config) {
|
|
|
9127
9126
|
currentItems.set(id, node._serialize());
|
|
9128
9127
|
}
|
|
9129
9128
|
const ops = getTreesDiffOperations(currentItems, new Map(items));
|
|
9130
|
-
const result = applyOps(
|
|
9129
|
+
const result = applyOps(
|
|
9130
|
+
ops,
|
|
9131
|
+
/* isLocal */
|
|
9132
|
+
false
|
|
9133
|
+
);
|
|
9131
9134
|
notify(result.updates);
|
|
9132
9135
|
}
|
|
9133
9136
|
function _addToRealUndoStack(historyOps) {
|
|
@@ -9208,11 +9211,11 @@ function createRoom(options, config) {
|
|
|
9208
9211
|
} else {
|
|
9209
9212
|
let source;
|
|
9210
9213
|
if (isLocal) {
|
|
9211
|
-
source = 0 /*
|
|
9214
|
+
source = 0 /* LOCAL */;
|
|
9212
9215
|
} else {
|
|
9213
9216
|
const opId = nn(op.opId);
|
|
9214
9217
|
const deleted = context.unacknowledgedOps.delete(opId);
|
|
9215
|
-
source = deleted ? 2 /*
|
|
9218
|
+
source = deleted ? 2 /* OURS */ : 1 /* THEIRS */;
|
|
9216
9219
|
}
|
|
9217
9220
|
const applyOpResult = applyOp(op, source);
|
|
9218
9221
|
if (applyOpResult.modified) {
|
|
@@ -9243,7 +9246,7 @@ function createRoom(options, config) {
|
|
|
9243
9246
|
};
|
|
9244
9247
|
}
|
|
9245
9248
|
function applyOp(op, source) {
|
|
9246
|
-
if (
|
|
9249
|
+
if (isAckOp(op)) {
|
|
9247
9250
|
return { modified: false };
|
|
9248
9251
|
}
|
|
9249
9252
|
switch (op.type) {
|
|
@@ -9254,7 +9257,7 @@ function createRoom(options, config) {
|
|
|
9254
9257
|
if (node === void 0) {
|
|
9255
9258
|
return { modified: false };
|
|
9256
9259
|
}
|
|
9257
|
-
return node._apply(op, source === 0 /*
|
|
9260
|
+
return node._apply(op, source === 0 /* LOCAL */);
|
|
9258
9261
|
}
|
|
9259
9262
|
case OpCode.SET_PARENT_KEY: {
|
|
9260
9263
|
const node = context.pool.nodes.get(op.id);
|
|
@@ -9425,7 +9428,11 @@ function createRoom(options, config) {
|
|
|
9425
9428
|
}
|
|
9426
9429
|
const messages = [];
|
|
9427
9430
|
const inOps = Array.from(offlineOps.values());
|
|
9428
|
-
const result = applyOps(
|
|
9431
|
+
const result = applyOps(
|
|
9432
|
+
inOps,
|
|
9433
|
+
/* isLocal */
|
|
9434
|
+
true
|
|
9435
|
+
);
|
|
9429
9436
|
messages.push({
|
|
9430
9437
|
type: ClientMsgCode.UPDATE_STORAGE,
|
|
9431
9438
|
ops: result.ops
|
|
@@ -9485,13 +9492,16 @@ function createRoom(options, config) {
|
|
|
9485
9492
|
updates.others.push(onRoomStateMessage(message));
|
|
9486
9493
|
break;
|
|
9487
9494
|
}
|
|
9488
|
-
case ServerMsgCode.
|
|
9495
|
+
case ServerMsgCode.STORAGE_STATE: {
|
|
9489
9496
|
processInitialStorage(message);
|
|
9490
9497
|
break;
|
|
9491
9498
|
}
|
|
9492
|
-
// Write event
|
|
9493
9499
|
case ServerMsgCode.UPDATE_STORAGE: {
|
|
9494
|
-
const applyResult = applyOps(
|
|
9500
|
+
const applyResult = applyOps(
|
|
9501
|
+
message.ops,
|
|
9502
|
+
/* isLocal */
|
|
9503
|
+
false
|
|
9504
|
+
);
|
|
9495
9505
|
for (const [key, value] of applyResult.updates.storageUpdates) {
|
|
9496
9506
|
updates.storageUpdates.set(
|
|
9497
9507
|
key,
|
|
@@ -9641,7 +9651,7 @@ function createRoom(options, config) {
|
|
|
9641
9651
|
async function streamStorage() {
|
|
9642
9652
|
if (!managedSocket.authValue) return;
|
|
9643
9653
|
const items = await httpClient.streamStorage({ roomId });
|
|
9644
|
-
processInitialStorage({ type: ServerMsgCode.
|
|
9654
|
+
processInitialStorage({ type: ServerMsgCode.STORAGE_STATE, items });
|
|
9645
9655
|
}
|
|
9646
9656
|
function refreshStorage(options2) {
|
|
9647
9657
|
const messages = context.buffer.messages;
|
|
@@ -9706,7 +9716,11 @@ function createRoom(options, config) {
|
|
|
9706
9716
|
return;
|
|
9707
9717
|
}
|
|
9708
9718
|
context.pausedHistory = null;
|
|
9709
|
-
const result = applyOps(
|
|
9719
|
+
const result = applyOps(
|
|
9720
|
+
historyOps,
|
|
9721
|
+
/* isLocal */
|
|
9722
|
+
true
|
|
9723
|
+
);
|
|
9710
9724
|
notify(result.updates);
|
|
9711
9725
|
context.redoStack.push(result.reverse);
|
|
9712
9726
|
onHistoryChange();
|
|
@@ -9726,7 +9740,11 @@ function createRoom(options, config) {
|
|
|
9726
9740
|
return;
|
|
9727
9741
|
}
|
|
9728
9742
|
context.pausedHistory = null;
|
|
9729
|
-
const result = applyOps(
|
|
9743
|
+
const result = applyOps(
|
|
9744
|
+
historyOps,
|
|
9745
|
+
/* isLocal */
|
|
9746
|
+
true
|
|
9747
|
+
);
|
|
9730
9748
|
notify(result.updates);
|
|
9731
9749
|
context.undoStack.push(result.reverse);
|
|
9732
9750
|
onHistoryChange();
|
|
@@ -10236,7 +10254,7 @@ function makeAuthDelegateForRoom(roomId, authManager) {
|
|
|
10236
10254
|
return authManager.getAuthValue({ requestedScope: "room:read", roomId });
|
|
10237
10255
|
};
|
|
10238
10256
|
}
|
|
10239
|
-
function makeCreateSocketDelegateForRoom(roomId, baseUrl, WebSocketPolyfill) {
|
|
10257
|
+
function makeCreateSocketDelegateForRoom(roomId, baseUrl, WebSocketPolyfill, engine) {
|
|
10240
10258
|
return (authValue) => {
|
|
10241
10259
|
const ws = WebSocketPolyfill ?? (typeof WebSocket === "undefined" ? void 0 : WebSocket);
|
|
10242
10260
|
if (ws === void 0) {
|
|
@@ -10256,6 +10274,9 @@ function makeCreateSocketDelegateForRoom(roomId, baseUrl, WebSocketPolyfill) {
|
|
|
10256
10274
|
return assertNever(authValue, "Unhandled case");
|
|
10257
10275
|
}
|
|
10258
10276
|
url2.searchParams.set("version", PKG_VERSION || "dev");
|
|
10277
|
+
if (engine !== void 0) {
|
|
10278
|
+
url2.searchParams.set("e", String(engine));
|
|
10279
|
+
}
|
|
10259
10280
|
return new ws(url2.toString());
|
|
10260
10281
|
};
|
|
10261
10282
|
}
|
|
@@ -10375,7 +10396,8 @@ function createClient(options) {
|
|
|
10375
10396
|
createSocket: makeCreateSocketDelegateForRoom(
|
|
10376
10397
|
roomId,
|
|
10377
10398
|
baseUrl,
|
|
10378
|
-
clientOptions.polyfills?.WebSocket
|
|
10399
|
+
clientOptions.polyfills?.WebSocket,
|
|
10400
|
+
options2.engine
|
|
10379
10401
|
),
|
|
10380
10402
|
authenticate: makeAuthDelegateForRoom(roomId, authManager)
|
|
10381
10403
|
},
|