@liveblocks/core 3.14.0-pre2 → 3.14.0-pre3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -666,7 +666,6 @@ type PlainLsonList = {
666
666
  };
667
667
  type PlainLson = PlainLsonObject | PlainLsonMap | PlainLsonList | Json;
668
668
 
669
- type IdTuple<T> = [id: string, value: T];
670
669
  type CrdtType = (typeof CrdtType)[keyof typeof CrdtType];
671
670
  declare const CrdtType: Readonly<{
672
671
  OBJECT: 0;
@@ -682,7 +681,6 @@ declare namespace CrdtType {
682
681
  }
683
682
  type SerializedCrdt = SerializedRootObject | SerializedChild;
684
683
  type SerializedChild = SerializedObject | SerializedList | SerializedMap | SerializedRegister;
685
- type NodeStream = Iterable<IdTuple<SerializedCrdt>>;
686
684
  type SerializedRootObject = {
687
685
  readonly type: CrdtType.OBJECT;
688
686
  readonly data: JsonObject;
@@ -711,6 +709,19 @@ type SerializedRegister = {
711
709
  readonly parentKey: string;
712
710
  readonly data: Json;
713
711
  };
712
+ type StorageNode = RootStorageNode | ChildStorageNode;
713
+ type ChildStorageNode = ObjectStorageNode | ListStorageNode | MapStorageNode | RegisterStorageNode;
714
+ type RootStorageNode = [id: "root", value: SerializedRootObject];
715
+ type ObjectStorageNode = [id: string, value: SerializedObject];
716
+ type ListStorageNode = [id: string, value: SerializedList];
717
+ type MapStorageNode = [id: string, value: SerializedMap];
718
+ type RegisterStorageNode = [id: string, value: SerializedRegister];
719
+ type NodeStream = Iterable<StorageNode>;
720
+ declare function isRootStorageNode(node: StorageNode): node is RootStorageNode;
721
+ declare function isObjectStorageNode(node: StorageNode): node is RootStorageNode | ObjectStorageNode;
722
+ declare function isListStorageNode(node: StorageNode): node is ListStorageNode;
723
+ declare function isMapStorageNode(node: StorageNode): node is MapStorageNode;
724
+ declare function isRegisterStorageNode(node: StorageNode): node is RegisterStorageNode;
714
725
  type CompactNode = CompactRootNode | CompactChildNode;
715
726
  type CompactChildNode = CompactObjectNode | CompactListNode | CompactMapNode | CompactRegisterNode;
716
727
  type CompactRootNode = readonly [id: "root", data: JsonObject];
@@ -740,7 +751,7 @@ type CompactRegisterNode = readonly [
740
751
  parentKey: string,
741
752
  data: Json
742
753
  ];
743
- declare function compactNodesToNodeStream(nodes: CompactNode[]): NodeStream;
754
+ declare function compactNodesToNodeStream(compactNodes: CompactNode[]): NodeStream;
744
755
  declare function nodeStreamToCompactNodes(nodes: NodeStream): Iterable<CompactNode>;
745
756
 
746
757
  type LiveObjectUpdateDelta<O extends {
@@ -1883,7 +1894,7 @@ interface RoomHttpApi<TM extends BaseMetadata, CM extends BaseMetadata> {
1883
1894
  }>;
1884
1895
  streamStorage(options: {
1885
1896
  roomId: string;
1886
- }): Promise<IdTuple<SerializedCrdt>[]>;
1897
+ }): Promise<StorageNode[]>;
1887
1898
  sendMessagesOverHTTP<P extends JsonObject, E extends Json>(options: {
1888
1899
  roomId: string;
1889
1900
  nonce: string | undefined;
@@ -2869,7 +2880,7 @@ type RoomStateServerMsg<U extends BaseUserMeta> = {
2869
2880
  */
2870
2881
  type StorageStateServerMsg_V7 = {
2871
2882
  readonly type: ServerMsgCode.STORAGE_STATE_V7;
2872
- readonly items: IdTuple<SerializedCrdt>[];
2883
+ readonly items: StorageNode[];
2873
2884
  };
2874
2885
  /**
2875
2886
  * Sent by the WebSocket server to a single client in response to the client
@@ -4613,7 +4624,7 @@ SerializedCrdt>;
4613
4624
  * by their parent node's IDs.
4614
4625
  */
4615
4626
  type ParentToChildNodeMap = Map<string, // Parent's node ID
4616
- IdTuple<SerializedChild>[]>;
4627
+ ChildStorageNode[]>;
4617
4628
 
4618
4629
  declare function isLiveNode(value: unknown): value is LiveNode;
4619
4630
  declare function cloneLson<L extends Lson | undefined>(value: L): L;
@@ -5288,4 +5299,4 @@ type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (EnsureJson
5288
5299
  [K in keyof T as EnsureJson<T[K]> extends never ? never : K]: EnsureJson<T[K]>;
5289
5300
  };
5290
5301
 
5291
- export { 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 ClientWireOp, 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 CompactChildNode, type CompactListNode, type CompactMapNode, type CompactNode, type CompactObjectNode, type CompactRegisterNode, type CompactRootNode, 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 HasOpId, 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 IgnoredOp, 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 ServerWireOp, type SetParentKeyOp, Signal, type SignalType, SortedList, type Status, type StorageChunkServerMsg, 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, compactNodesToNodeStream, 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, nodeStreamToCompactNodes, objectToQuery, patchLiveObjectKey, patchNotificationSettings, raise, resolveMentionsInCommentBody, sanitizeUrl, shallow, shallow2, stableStringify, stringifyCommentBody, throwUsageError, toPlainLson, tryParseJson, url, urljoin, wait, warnOnce, warnOnceIf, withTimeout };
5302
+ export { 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 ChildStorageNode, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type ClientWireOp, 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 CompactChildNode, type CompactListNode, type CompactMapNode, type CompactNode, type CompactObjectNode, type CompactRegisterNode, type CompactRootNode, 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 HasOpId, type History, type HistoryVersion, HttpError, type ISODateString, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IgnoredOp, 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, type ListStorageNode, 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 MapStorageNode, type MentionData, type MessageId, MutableSignal, type NoInfr, type NodeMap, type NodeStream, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, type NotificationSettings, type NotificationSettingsPlain, type ObjectStorageNode, 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 RegisterStorageNode, 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 RootStorageNode, type SearchCommentsResult, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type ServerWireOp, type SetParentKeyOp, Signal, type SignalType, SortedList, type Status, type StorageChunkServerMsg, type StorageNode, 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, compactNodesToNodeStream, 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, isListStorageNode, isLiveNode, isMapStorageNode, isNotificationChannelEnabled, isNumberOperator, isObjectStorageNode, isPlainObject, isRegisterStorageNode, isRootStorageNode, isStartsWithOperator, isUrl, kInternal, keys, legacy_patchImmutableObject, lsonToJson, makeAbortController, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, nodeStreamToCompactNodes, 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
@@ -666,7 +666,6 @@ type PlainLsonList = {
666
666
  };
667
667
  type PlainLson = PlainLsonObject | PlainLsonMap | PlainLsonList | Json;
668
668
 
669
- type IdTuple<T> = [id: string, value: T];
670
669
  type CrdtType = (typeof CrdtType)[keyof typeof CrdtType];
671
670
  declare const CrdtType: Readonly<{
672
671
  OBJECT: 0;
@@ -682,7 +681,6 @@ declare namespace CrdtType {
682
681
  }
683
682
  type SerializedCrdt = SerializedRootObject | SerializedChild;
684
683
  type SerializedChild = SerializedObject | SerializedList | SerializedMap | SerializedRegister;
685
- type NodeStream = Iterable<IdTuple<SerializedCrdt>>;
686
684
  type SerializedRootObject = {
687
685
  readonly type: CrdtType.OBJECT;
688
686
  readonly data: JsonObject;
@@ -711,6 +709,19 @@ type SerializedRegister = {
711
709
  readonly parentKey: string;
712
710
  readonly data: Json;
713
711
  };
712
+ type StorageNode = RootStorageNode | ChildStorageNode;
713
+ type ChildStorageNode = ObjectStorageNode | ListStorageNode | MapStorageNode | RegisterStorageNode;
714
+ type RootStorageNode = [id: "root", value: SerializedRootObject];
715
+ type ObjectStorageNode = [id: string, value: SerializedObject];
716
+ type ListStorageNode = [id: string, value: SerializedList];
717
+ type MapStorageNode = [id: string, value: SerializedMap];
718
+ type RegisterStorageNode = [id: string, value: SerializedRegister];
719
+ type NodeStream = Iterable<StorageNode>;
720
+ declare function isRootStorageNode(node: StorageNode): node is RootStorageNode;
721
+ declare function isObjectStorageNode(node: StorageNode): node is RootStorageNode | ObjectStorageNode;
722
+ declare function isListStorageNode(node: StorageNode): node is ListStorageNode;
723
+ declare function isMapStorageNode(node: StorageNode): node is MapStorageNode;
724
+ declare function isRegisterStorageNode(node: StorageNode): node is RegisterStorageNode;
714
725
  type CompactNode = CompactRootNode | CompactChildNode;
715
726
  type CompactChildNode = CompactObjectNode | CompactListNode | CompactMapNode | CompactRegisterNode;
716
727
  type CompactRootNode = readonly [id: "root", data: JsonObject];
@@ -740,7 +751,7 @@ type CompactRegisterNode = readonly [
740
751
  parentKey: string,
741
752
  data: Json
742
753
  ];
743
- declare function compactNodesToNodeStream(nodes: CompactNode[]): NodeStream;
754
+ declare function compactNodesToNodeStream(compactNodes: CompactNode[]): NodeStream;
744
755
  declare function nodeStreamToCompactNodes(nodes: NodeStream): Iterable<CompactNode>;
745
756
 
746
757
  type LiveObjectUpdateDelta<O extends {
@@ -1883,7 +1894,7 @@ interface RoomHttpApi<TM extends BaseMetadata, CM extends BaseMetadata> {
1883
1894
  }>;
1884
1895
  streamStorage(options: {
1885
1896
  roomId: string;
1886
- }): Promise<IdTuple<SerializedCrdt>[]>;
1897
+ }): Promise<StorageNode[]>;
1887
1898
  sendMessagesOverHTTP<P extends JsonObject, E extends Json>(options: {
1888
1899
  roomId: string;
1889
1900
  nonce: string | undefined;
@@ -2869,7 +2880,7 @@ type RoomStateServerMsg<U extends BaseUserMeta> = {
2869
2880
  */
2870
2881
  type StorageStateServerMsg_V7 = {
2871
2882
  readonly type: ServerMsgCode.STORAGE_STATE_V7;
2872
- readonly items: IdTuple<SerializedCrdt>[];
2883
+ readonly items: StorageNode[];
2873
2884
  };
2874
2885
  /**
2875
2886
  * Sent by the WebSocket server to a single client in response to the client
@@ -4613,7 +4624,7 @@ SerializedCrdt>;
4613
4624
  * by their parent node's IDs.
4614
4625
  */
4615
4626
  type ParentToChildNodeMap = Map<string, // Parent's node ID
4616
- IdTuple<SerializedChild>[]>;
4627
+ ChildStorageNode[]>;
4617
4628
 
4618
4629
  declare function isLiveNode(value: unknown): value is LiveNode;
4619
4630
  declare function cloneLson<L extends Lson | undefined>(value: L): L;
@@ -5288,4 +5299,4 @@ type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (EnsureJson
5288
5299
  [K in keyof T as EnsureJson<T[K]> extends never ? never : K]: EnsureJson<T[K]>;
5289
5300
  };
5290
5301
 
5291
- export { 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 ClientWireOp, 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 CompactChildNode, type CompactListNode, type CompactMapNode, type CompactNode, type CompactObjectNode, type CompactRegisterNode, type CompactRootNode, 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 HasOpId, 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 IgnoredOp, 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 ServerWireOp, type SetParentKeyOp, Signal, type SignalType, SortedList, type Status, type StorageChunkServerMsg, 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, compactNodesToNodeStream, 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, nodeStreamToCompactNodes, objectToQuery, patchLiveObjectKey, patchNotificationSettings, raise, resolveMentionsInCommentBody, sanitizeUrl, shallow, shallow2, stableStringify, stringifyCommentBody, throwUsageError, toPlainLson, tryParseJson, url, urljoin, wait, warnOnce, warnOnceIf, withTimeout };
5302
+ export { 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 ChildStorageNode, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type ClientWireOp, 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 CompactChildNode, type CompactListNode, type CompactMapNode, type CompactNode, type CompactObjectNode, type CompactRegisterNode, type CompactRootNode, 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 HasOpId, type History, type HistoryVersion, HttpError, type ISODateString, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IgnoredOp, 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, type ListStorageNode, 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 MapStorageNode, type MentionData, type MessageId, MutableSignal, type NoInfr, type NodeMap, type NodeStream, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, type NotificationSettings, type NotificationSettingsPlain, type ObjectStorageNode, 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 RegisterStorageNode, 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 RootStorageNode, type SearchCommentsResult, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type ServerWireOp, type SetParentKeyOp, Signal, type SignalType, SortedList, type Status, type StorageChunkServerMsg, type StorageNode, 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, compactNodesToNodeStream, 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, isListStorageNode, isLiveNode, isMapStorageNode, isNotificationChannelEnabled, isNumberOperator, isObjectStorageNode, isPlainObject, isRegisterStorageNode, isRootStorageNode, isStartsWithOperator, isUrl, kInternal, keys, legacy_patchImmutableObject, lsonToJson, makeAbortController, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, nodeStreamToCompactNodes, 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.14.0-pre2";
9
+ var PKG_VERSION = "3.14.0-pre3";
10
10
  var PKG_FORMAT = "esm";
11
11
 
12
12
  // src/dupe-detection.ts
@@ -3227,7 +3227,7 @@ var BACKOFF_DELAYS_SLOW = [2e3, 3e4, 6e4, 3e5];
3227
3227
  var HEARTBEAT_INTERVAL = 3e4;
3228
3228
  var PONG_TIMEOUT = 2e3;
3229
3229
  var AUTH_TIMEOUT = 1e4;
3230
- var SOCKET_CONNECT_TIMEOUT = 1e4;
3230
+ var SOCKET_CONNECT_TIMEOUT = 2e4;
3231
3231
  var StopRetrying = class extends Error {
3232
3232
  constructor(reason) {
3233
3233
  super(reason);
@@ -6215,61 +6215,79 @@ var AbstractCrdt = class {
6215
6215
  }
6216
6216
  };
6217
6217
 
6218
- // src/protocol/SerializedCrdt.ts
6218
+ // src/protocol/StorageNode.ts
6219
6219
  var CrdtType = Object.freeze({
6220
6220
  OBJECT: 0,
6221
6221
  LIST: 1,
6222
6222
  MAP: 2,
6223
6223
  REGISTER: 3
6224
6224
  });
6225
- function isRootNode(node) {
6225
+ function isRootStorageNode(node) {
6226
6226
  return node[0] === "root";
6227
6227
  }
6228
- function isRootCrdt(id, _) {
6229
- return id === "root";
6228
+ function isObjectStorageNode(node) {
6229
+ return node[1].type === CrdtType.OBJECT;
6230
6230
  }
6231
- function* compactNodesToNodeStream(nodes) {
6232
- for (const node of nodes) {
6233
- const id = node[0];
6234
- if (isRootNode(node)) {
6235
- yield [id, { type: CrdtType.OBJECT, data: node[1] }];
6231
+ function isListStorageNode(node) {
6232
+ return node[1].type === CrdtType.LIST;
6233
+ }
6234
+ function isMapStorageNode(node) {
6235
+ return node[1].type === CrdtType.MAP;
6236
+ }
6237
+ function isRegisterStorageNode(node) {
6238
+ return node[1].type === CrdtType.REGISTER;
6239
+ }
6240
+ function isCompactRootNode(node) {
6241
+ return node[0] === "root";
6242
+ }
6243
+ function* compactNodesToNodeStream(compactNodes) {
6244
+ for (const cnode of compactNodes) {
6245
+ if (isCompactRootNode(cnode)) {
6246
+ yield [cnode[0], { type: CrdtType.OBJECT, data: cnode[1] }];
6236
6247
  continue;
6237
6248
  }
6238
- switch (node[1]) {
6249
+ switch (cnode[1]) {
6239
6250
  case CrdtType.OBJECT:
6240
- yield [id, { type: CrdtType.OBJECT, parentId: node[2], parentKey: node[3], data: node[4] }];
6251
+ yield [cnode[0], { type: CrdtType.OBJECT, parentId: cnode[2], parentKey: cnode[3], data: cnode[4] }];
6241
6252
  break;
6242
6253
  case CrdtType.LIST:
6243
- yield [id, { type: CrdtType.LIST, parentId: node[2], parentKey: node[3] }];
6254
+ yield [cnode[0], { type: CrdtType.LIST, parentId: cnode[2], parentKey: cnode[3] }];
6244
6255
  break;
6245
6256
  case CrdtType.MAP:
6246
- yield [id, { type: CrdtType.MAP, parentId: node[2], parentKey: node[3] }];
6257
+ yield [cnode[0], { type: CrdtType.MAP, parentId: cnode[2], parentKey: cnode[3] }];
6247
6258
  break;
6248
6259
  case CrdtType.REGISTER:
6249
- yield [id, { type: CrdtType.REGISTER, parentId: node[2], parentKey: node[3], data: node[4] }];
6260
+ yield [cnode[0], { type: CrdtType.REGISTER, parentId: cnode[2], parentKey: cnode[3], data: cnode[4] }];
6250
6261
  break;
6262
+ default:
6251
6263
  }
6252
6264
  }
6253
6265
  }
6254
6266
  function* nodeStreamToCompactNodes(nodes) {
6255
- for (const [id, node] of nodes) {
6256
- switch (node.type) {
6257
- case CrdtType.OBJECT:
6258
- if (isRootCrdt(id, node)) {
6259
- yield [id, node.data];
6260
- } else {
6261
- yield [id, CrdtType.OBJECT, node.parentId, node.parentKey, node.data];
6262
- }
6263
- break;
6264
- case CrdtType.LIST:
6265
- yield [id, CrdtType.LIST, node.parentId, node.parentKey];
6266
- break;
6267
- case CrdtType.MAP:
6268
- yield [id, CrdtType.MAP, node.parentId, node.parentKey];
6269
- break;
6270
- case CrdtType.REGISTER:
6271
- yield [id, CrdtType.REGISTER, node.parentId, node.parentKey, node.data];
6272
- break;
6267
+ for (const node of nodes) {
6268
+ if (isObjectStorageNode(node)) {
6269
+ if (isRootStorageNode(node)) {
6270
+ const id = node[0];
6271
+ const crdt = node[1];
6272
+ yield [id, crdt.data];
6273
+ } else {
6274
+ const id = node[0];
6275
+ const crdt = node[1];
6276
+ yield [id, CrdtType.OBJECT, crdt.parentId, crdt.parentKey, crdt.data];
6277
+ }
6278
+ } else if (isListStorageNode(node)) {
6279
+ const id = node[0];
6280
+ const crdt = node[1];
6281
+ yield [id, CrdtType.LIST, crdt.parentId, crdt.parentKey];
6282
+ } else if (isMapStorageNode(node)) {
6283
+ const id = node[0];
6284
+ const crdt = node[1];
6285
+ yield [id, CrdtType.MAP, crdt.parentId, crdt.parentKey];
6286
+ } else if (isRegisterStorageNode(node)) {
6287
+ const id = node[0];
6288
+ const crdt = node[1];
6289
+ yield [id, CrdtType.REGISTER, crdt.parentId, crdt.parentKey, crdt.data];
6290
+ } else {
6273
6291
  }
6274
6292
  }
6275
6293
  }
@@ -6375,15 +6393,16 @@ var LiveList = class _LiveList extends AbstractCrdt {
6375
6393
  }
6376
6394
  }
6377
6395
  /** @internal */
6378
- static _deserialize([id], parentToChildren, pool) {
6396
+ static _deserialize([id, _], parentToChildren, pool) {
6379
6397
  const list = new _LiveList([]);
6380
6398
  list._attach(id, pool);
6381
6399
  const children = parentToChildren.get(id);
6382
6400
  if (children === void 0) {
6383
6401
  return list;
6384
6402
  }
6385
- for (const [id2, crdt] of children) {
6386
- const child = deserialize([id2, crdt], parentToChildren, pool);
6403
+ for (const node of children) {
6404
+ const crdt = node[1];
6405
+ const child = deserialize(node, parentToChildren, pool);
6387
6406
  child._setParentLink(list, crdt.parentKey);
6388
6407
  list._insertAndSort(child);
6389
6408
  }
@@ -7400,8 +7419,9 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
7400
7419
  if (children === void 0) {
7401
7420
  return map;
7402
7421
  }
7403
- for (const [id2, crdt] of children) {
7404
- const child = deserialize([id2, crdt], parentToChildren, pool);
7422
+ for (const node of children) {
7423
+ const crdt = node[1];
7424
+ const child = deserialize(node, parentToChildren, pool);
7405
7425
  child._setParentLink(map, crdt.parentKey);
7406
7426
  map.#map.set(crdt.parentKey, child);
7407
7427
  map.invalidate();
@@ -7702,9 +7722,6 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
7702
7722
 
7703
7723
  // src/crdts/LiveObject.ts
7704
7724
  var MAX_LIVE_OBJECT_SIZE = 128 * 1024;
7705
- function isRootCrdt2(id, _) {
7706
- return id === "root";
7707
- }
7708
7725
  var LiveObject = class _LiveObject extends AbstractCrdt {
7709
7726
  #map;
7710
7727
  /**
@@ -7734,16 +7751,16 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
7734
7751
  static #buildRootAndParentToChildren(nodes) {
7735
7752
  const parentToChildren = /* @__PURE__ */ new Map();
7736
7753
  let root = null;
7737
- for (const [id, crdt] of nodes) {
7738
- if (isRootCrdt2(id, crdt)) {
7739
- root = crdt;
7754
+ for (const node of nodes) {
7755
+ if (isRootStorageNode(node)) {
7756
+ root = node[1];
7740
7757
  } else {
7741
- const tuple = [id, crdt];
7758
+ const crdt = node[1];
7742
7759
  const children = parentToChildren.get(crdt.parentId);
7743
7760
  if (children !== void 0) {
7744
- children.push(tuple);
7761
+ children.push(node);
7745
7762
  } else {
7746
- parentToChildren.set(crdt.parentId, [tuple]);
7763
+ parentToChildren.set(crdt.parentId, [node]);
7747
7764
  }
7748
7765
  }
7749
7766
  }
@@ -7808,8 +7825,9 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
7808
7825
  if (children === void 0) {
7809
7826
  return liveObj;
7810
7827
  }
7811
- for (const [id, crdt] of children) {
7812
- const child = deserializeToLson([id, crdt], parentToChildren, pool);
7828
+ for (const node of children) {
7829
+ const child = deserializeToLson(node, parentToChildren, pool);
7830
+ const crdt = node[1];
7813
7831
  if (isLiveStructure(child)) {
7814
7832
  child._setParentLink(liveObj, crdt.parentKey);
7815
7833
  }
@@ -8296,42 +8314,30 @@ function isSameNodeOrChildOf(node, parent) {
8296
8314
  }
8297
8315
  return false;
8298
8316
  }
8299
- function deserialize([id, crdt], parentToChildren, pool) {
8300
- switch (crdt.type) {
8301
- case CrdtType.OBJECT: {
8302
- return LiveObject._deserialize([id, crdt], parentToChildren, pool);
8303
- }
8304
- case CrdtType.LIST: {
8305
- return LiveList._deserialize([id, crdt], parentToChildren, pool);
8306
- }
8307
- case CrdtType.MAP: {
8308
- return LiveMap._deserialize([id, crdt], parentToChildren, pool);
8309
- }
8310
- case CrdtType.REGISTER: {
8311
- return LiveRegister._deserialize([id, crdt], parentToChildren, pool);
8312
- }
8313
- default: {
8314
- throw new Error("Unexpected CRDT type");
8315
- }
8316
- }
8317
- }
8318
- function deserializeToLson([id, crdt], parentToChildren, pool) {
8319
- switch (crdt.type) {
8320
- case CrdtType.OBJECT: {
8321
- return LiveObject._deserialize([id, crdt], parentToChildren, pool);
8322
- }
8323
- case CrdtType.LIST: {
8324
- return LiveList._deserialize([id, crdt], parentToChildren, pool);
8325
- }
8326
- case CrdtType.MAP: {
8327
- return LiveMap._deserialize([id, crdt], parentToChildren, pool);
8328
- }
8329
- case CrdtType.REGISTER: {
8330
- return crdt.data;
8331
- }
8332
- default: {
8333
- throw new Error("Unexpected CRDT type");
8334
- }
8317
+ function deserialize(node, parentToChildren, pool) {
8318
+ if (isObjectStorageNode(node)) {
8319
+ return LiveObject._deserialize(node, parentToChildren, pool);
8320
+ } else if (isListStorageNode(node)) {
8321
+ return LiveList._deserialize(node, parentToChildren, pool);
8322
+ } else if (isMapStorageNode(node)) {
8323
+ return LiveMap._deserialize(node, parentToChildren, pool);
8324
+ } else if (isRegisterStorageNode(node)) {
8325
+ return LiveRegister._deserialize(node, parentToChildren, pool);
8326
+ } else {
8327
+ throw new Error("Unexpected CRDT type");
8328
+ }
8329
+ }
8330
+ function deserializeToLson(node, parentToChildren, pool) {
8331
+ if (isObjectStorageNode(node)) {
8332
+ return LiveObject._deserialize(node, parentToChildren, pool);
8333
+ } else if (isListStorageNode(node)) {
8334
+ return LiveList._deserialize(node, parentToChildren, pool);
8335
+ } else if (isMapStorageNode(node)) {
8336
+ return LiveMap._deserialize(node, parentToChildren, pool);
8337
+ } else if (isRegisterStorageNode(node)) {
8338
+ return node[1].data;
8339
+ } else {
8340
+ throw new Error("Unexpected CRDT type");
8335
8341
  }
8336
8342
  }
8337
8343
  function isLiveStructure(value) {
@@ -9236,9 +9242,12 @@ function createRoom(options, config) {
9236
9242
  );
9237
9243
  function createOrUpdateRootFromMessage(nodes) {
9238
9244
  if (context.root !== void 0) {
9239
- updateRoot(new Map(nodes));
9245
+ updateRoot(nodes);
9240
9246
  } else {
9241
- context.root = LiveObject._fromItems(nodes, context.pool);
9247
+ context.root = LiveObject._fromItems(
9248
+ nodes,
9249
+ context.pool
9250
+ );
9242
9251
  }
9243
9252
  const canWrite = self.get()?.canWrite ?? true;
9244
9253
  const stackSizeBefore = context.undoStack.length;
@@ -9263,8 +9272,8 @@ function createRoom(options, config) {
9263
9272
  return;
9264
9273
  }
9265
9274
  const currentItems = /* @__PURE__ */ new Map();
9266
- for (const [id, node] of context.pool.nodes) {
9267
- currentItems.set(id, node._serialize());
9275
+ for (const [id, crdt] of context.pool.nodes) {
9276
+ currentItems.set(id, crdt._serialize());
9268
9277
  }
9269
9278
  const ops = getTreesDiffOperations(currentItems, nodes);
9270
9279
  const result = applyRemoteOps(ops);
@@ -9799,7 +9808,9 @@ function createRoom(options, config) {
9799
9808
  }
9800
9809
  async function streamStorage() {
9801
9810
  if (!managedSocket.authValue) return;
9802
- const nodes = new Map(await httpClient.streamStorage({ roomId }));
9811
+ const nodes = new Map(
9812
+ await httpClient.streamStorage({ roomId })
9813
+ );
9803
9814
  processInitialStorage(nodes);
9804
9815
  }
9805
9816
  function refreshStorage(options2) {
@@ -11681,10 +11692,15 @@ export {
11681
11692
  isJsonArray,
11682
11693
  isJsonObject,
11683
11694
  isJsonScalar,
11695
+ isListStorageNode,
11684
11696
  isLiveNode,
11697
+ isMapStorageNode,
11685
11698
  isNotificationChannelEnabled,
11686
11699
  isNumberOperator,
11700
+ isObjectStorageNode,
11687
11701
  isPlainObject,
11702
+ isRegisterStorageNode,
11703
+ isRootStorageNode,
11688
11704
  isStartsWithOperator,
11689
11705
  isUrl,
11690
11706
  kInternal,