@liveblocks/core 3.13.0-ack1 → 3.13.0-vincent1
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 +125 -54
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +75 -35
- package/dist/index.d.ts +75 -35
- package/dist/index.js +124 -53
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -592,6 +592,7 @@ declare namespace CrdtType {
|
|
|
592
592
|
}
|
|
593
593
|
type SerializedCrdt = SerializedRootObject | SerializedChild;
|
|
594
594
|
type SerializedChild = SerializedObject | SerializedList | SerializedMap | SerializedRegister;
|
|
595
|
+
type NodeStream = Iterable<IdTuple<SerializedCrdt>>;
|
|
595
596
|
type SerializedRootObject = {
|
|
596
597
|
readonly type: CrdtType.OBJECT;
|
|
597
598
|
readonly data: JsonObject;
|
|
@@ -620,6 +621,40 @@ type SerializedRegister = {
|
|
|
620
621
|
readonly parentKey: string;
|
|
621
622
|
readonly data: Json;
|
|
622
623
|
};
|
|
624
|
+
type CompactNode = CompactRootNode | CompactChildNode;
|
|
625
|
+
type CompactChildNode = CompactObjectNode | CompactListNode | CompactMapNode | CompactRegisterNode;
|
|
626
|
+
type CompactRootNode = readonly [
|
|
627
|
+
id: "root",
|
|
628
|
+
type: CrdtType.OBJECT,
|
|
629
|
+
data: JsonObject
|
|
630
|
+
];
|
|
631
|
+
type CompactObjectNode = readonly [
|
|
632
|
+
id: string,
|
|
633
|
+
type: CrdtType.OBJECT,
|
|
634
|
+
parentId: string,
|
|
635
|
+
parentKey: string,
|
|
636
|
+
data: JsonObject
|
|
637
|
+
];
|
|
638
|
+
type CompactListNode = readonly [
|
|
639
|
+
id: string,
|
|
640
|
+
type: CrdtType.LIST,
|
|
641
|
+
parentId: string,
|
|
642
|
+
parentKey: string
|
|
643
|
+
];
|
|
644
|
+
type CompactMapNode = readonly [
|
|
645
|
+
id: string,
|
|
646
|
+
type: CrdtType.MAP,
|
|
647
|
+
parentId: string,
|
|
648
|
+
parentKey: string
|
|
649
|
+
];
|
|
650
|
+
type CompactRegisterNode = readonly [
|
|
651
|
+
id: string,
|
|
652
|
+
type: CrdtType.REGISTER,
|
|
653
|
+
parentId: string,
|
|
654
|
+
parentKey: string,
|
|
655
|
+
data: Json
|
|
656
|
+
];
|
|
657
|
+
declare function nodeStreamToCompactNodes(nodes: NodeStream): Iterable<CompactNode>;
|
|
623
658
|
|
|
624
659
|
type LiveObjectUpdateDelta<O extends {
|
|
625
660
|
[key: string]: unknown;
|
|
@@ -653,7 +688,7 @@ declare class LiveObject<O extends LsonObject> extends AbstractCrdt {
|
|
|
653
688
|
*/
|
|
654
689
|
static detectLargeObjects: boolean;
|
|
655
690
|
/** @private Do not use this API directly */
|
|
656
|
-
static _fromItems<O extends LsonObject>(
|
|
691
|
+
static _fromItems<O extends LsonObject>(nodes: NodeStream, pool: ManagedPool): LiveObject<O>;
|
|
657
692
|
constructor(obj?: O);
|
|
658
693
|
/**
|
|
659
694
|
* Transform the LiveObject into a javascript object
|
|
@@ -1996,6 +2031,12 @@ type EnterOptions<P extends JsonObject = DP, S extends LsonObject = DS> = Resolv
|
|
|
1996
2031
|
* the authentication endpoint or connect via WebSocket.
|
|
1997
2032
|
*/
|
|
1998
2033
|
autoConnect?: boolean;
|
|
2034
|
+
/**
|
|
2035
|
+
* @private Preferred storage engine version to use when creating the
|
|
2036
|
+
* room. Only takes effect if the room doesn't exist yet. Version
|
|
2037
|
+
* 2 supports streaming and will become the default in the future.
|
|
2038
|
+
*/
|
|
2039
|
+
engine?: 1 | 2;
|
|
1999
2040
|
} & PartialUnless<P, {
|
|
2000
2041
|
/**
|
|
2001
2042
|
* The initial Presence to use and announce when you enter the Room. The
|
|
@@ -2486,9 +2527,9 @@ declare const ServerMsgCode: Readonly<{
|
|
|
2486
2527
|
USER_LEFT: 102;
|
|
2487
2528
|
BROADCASTED_EVENT: 103;
|
|
2488
2529
|
ROOM_STATE: 104;
|
|
2489
|
-
|
|
2530
|
+
STORAGE_STATE_V7: 200;
|
|
2531
|
+
STORAGE_CHUNK: 210;
|
|
2490
2532
|
UPDATE_STORAGE: 201;
|
|
2491
|
-
STORAGE_ACK: 202;
|
|
2492
2533
|
UPDATE_YDOC: 300;
|
|
2493
2534
|
THREAD_CREATED: 400;
|
|
2494
2535
|
THREAD_DELETED: 407;
|
|
@@ -2507,9 +2548,9 @@ declare namespace ServerMsgCode {
|
|
|
2507
2548
|
type USER_LEFT = typeof ServerMsgCode.USER_LEFT;
|
|
2508
2549
|
type BROADCASTED_EVENT = typeof ServerMsgCode.BROADCASTED_EVENT;
|
|
2509
2550
|
type ROOM_STATE = typeof ServerMsgCode.ROOM_STATE;
|
|
2510
|
-
type
|
|
2551
|
+
type STORAGE_STATE_V7 = typeof ServerMsgCode.STORAGE_STATE_V7;
|
|
2552
|
+
type STORAGE_CHUNK = typeof ServerMsgCode.STORAGE_CHUNK;
|
|
2511
2553
|
type UPDATE_STORAGE = typeof ServerMsgCode.UPDATE_STORAGE;
|
|
2512
|
-
type STORAGE_ACK = typeof ServerMsgCode.STORAGE_ACK;
|
|
2513
2554
|
type UPDATE_YDOC = typeof ServerMsgCode.UPDATE_YDOC;
|
|
2514
2555
|
type THREAD_CREATED = typeof ServerMsgCode.THREAD_CREATED;
|
|
2515
2556
|
type THREAD_DELETED = typeof ServerMsgCode.THREAD_DELETED;
|
|
@@ -2525,7 +2566,7 @@ declare namespace ServerMsgCode {
|
|
|
2525
2566
|
/**
|
|
2526
2567
|
* Messages that can be sent from the server to the client.
|
|
2527
2568
|
*/
|
|
2528
|
-
type ServerMsg<P extends JsonObject, U extends BaseUserMeta, E extends Json> = UpdatePresenceServerMsg<P> | UserJoinServerMsg<U> | UserLeftServerMsg | BroadcastedEventServerMsg<E> | RoomStateServerMsg<U> |
|
|
2569
|
+
type ServerMsg<P extends JsonObject, U extends BaseUserMeta, E extends Json> = UpdatePresenceServerMsg<P> | UserJoinServerMsg<U> | UserLeftServerMsg | BroadcastedEventServerMsg<E> | RoomStateServerMsg<U> | StorageStateServerMsg_V7 | StorageChunkServerMsg | UpdateStorageServerMsg | YDocUpdateServerMsg | RejectedStorageOpServerMsg | CommentsEventServerMsg;
|
|
2529
2570
|
type CommentsEventServerMsg = ThreadCreatedEvent | ThreadDeletedEvent | ThreadMetadataUpdatedEvent | ThreadUpdatedEvent | CommentCreatedEvent | CommentEditedEvent | CommentDeletedEvent | CommentReactionAdded | CommentReactionRemoved;
|
|
2530
2571
|
type ThreadCreatedEvent = {
|
|
2531
2572
|
type: ServerMsgCode.THREAD_CREATED;
|
|
@@ -2689,40 +2730,47 @@ type BroadcastedEventServerMsg<E extends Json> = {
|
|
|
2689
2730
|
*/
|
|
2690
2731
|
type RoomStateServerMsg<U extends BaseUserMeta> = {
|
|
2691
2732
|
readonly type: ServerMsgCode.ROOM_STATE;
|
|
2692
|
-
/**
|
|
2693
|
-
* Informs the client what their actor ID is going to be.
|
|
2694
|
-
* @since v1.2 (WS API v7)
|
|
2695
|
-
*/
|
|
2733
|
+
/** Informs the client what their actor ID is going to be. */
|
|
2696
2734
|
readonly actor: number;
|
|
2697
|
-
/**
|
|
2698
|
-
* Secure nonce for the current session.
|
|
2699
|
-
* @since v1.2 (WS API v7)
|
|
2700
|
-
*/
|
|
2735
|
+
/** Secure nonce for the current session. */
|
|
2701
2736
|
readonly nonce: string;
|
|
2702
|
-
/**
|
|
2703
|
-
* Informs the client what permissions the current User (self) has.
|
|
2704
|
-
* @since v1.2 (WS API v7)
|
|
2705
|
-
*/
|
|
2737
|
+
/** Informs the client what permissions the current User (self) has. */
|
|
2706
2738
|
readonly scopes: string[];
|
|
2707
2739
|
readonly users: {
|
|
2708
2740
|
readonly [otherActor: number]: U & {
|
|
2709
2741
|
scopes: string[];
|
|
2710
2742
|
};
|
|
2711
2743
|
};
|
|
2712
|
-
/**
|
|
2713
|
-
* Metadata sent from the server to the client.
|
|
2714
|
-
*/
|
|
2744
|
+
/** Metadata sent from the server to the client. */
|
|
2715
2745
|
readonly meta: JsonObject;
|
|
2716
2746
|
};
|
|
2717
2747
|
/**
|
|
2718
|
-
*
|
|
2719
|
-
* joining the Room, to provide the initial Storage state of the Room. The
|
|
2720
|
-
* payload includes the entire Storage document.
|
|
2748
|
+
* No longer used as of WS API v8.
|
|
2721
2749
|
*/
|
|
2722
|
-
type
|
|
2723
|
-
readonly type: ServerMsgCode.
|
|
2750
|
+
type StorageStateServerMsg_V7 = {
|
|
2751
|
+
readonly type: ServerMsgCode.STORAGE_STATE_V7;
|
|
2724
2752
|
readonly items: IdTuple<SerializedCrdt>[];
|
|
2725
2753
|
};
|
|
2754
|
+
/**
|
|
2755
|
+
* Sent by the WebSocket server to a single client in response to the client
|
|
2756
|
+
* sending a FetchStorageClientMsg message, to provide the initial Storage
|
|
2757
|
+
* state of the Room.
|
|
2758
|
+
*
|
|
2759
|
+
* The server will respond with 0+ STORAGE_CHUNK messages with
|
|
2760
|
+
* done=false, followed by exactly one STORAGE_CHUNK message with
|
|
2761
|
+
* done=true.
|
|
2762
|
+
*
|
|
2763
|
+
* If the room is using the new storage engine that supports streaming, then
|
|
2764
|
+
* potentially multiple chunks might get sent.
|
|
2765
|
+
*
|
|
2766
|
+
* If the room is using the old storage engine, then all nodes will be sent in
|
|
2767
|
+
* a single/large chunk (non-streaming).
|
|
2768
|
+
*/
|
|
2769
|
+
type StorageChunkServerMsg = {
|
|
2770
|
+
readonly type: ServerMsgCode.STORAGE_CHUNK;
|
|
2771
|
+
readonly done: boolean;
|
|
2772
|
+
readonly nodes: CompactNode[];
|
|
2773
|
+
};
|
|
2726
2774
|
/**
|
|
2727
2775
|
* Sent by the WebSocket server and broadcasted to all clients to announce that
|
|
2728
2776
|
* a change occurred in the Storage document.
|
|
@@ -2734,14 +2782,6 @@ type UpdateStorageServerMsg = {
|
|
|
2734
2782
|
readonly type: ServerMsgCode.UPDATE_STORAGE;
|
|
2735
2783
|
readonly ops: Op[];
|
|
2736
2784
|
};
|
|
2737
|
-
/**
|
|
2738
|
-
* Sent back to client that initiated a storage mutation, to acknowledge which
|
|
2739
|
-
* mutations have been persisted.
|
|
2740
|
-
*/
|
|
2741
|
-
type StorageAckServerMsg = {
|
|
2742
|
-
readonly type: ServerMsgCode.STORAGE_ACK;
|
|
2743
|
-
readonly opIds: string[];
|
|
2744
|
-
};
|
|
2745
2785
|
/**
|
|
2746
2786
|
* Sent by the WebSocket server to the client to indicate that certain opIds
|
|
2747
2787
|
* have been rejected, possibly due to lack of permissions or exceeding
|
|
@@ -5186,4 +5226,4 @@ type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (EnsureJson
|
|
|
5186
5226
|
[K in keyof T as EnsureJson<T[K]> extends never ? never : K]: EnsureJson<T[K]>;
|
|
5187
5227
|
};
|
|
5188
5228
|
|
|
5189
|
-
export { type AckOp, type ActivityData, type AiAssistantContentPart, type AiAssistantMessage, type AiChat, type AiChatMessage, type AiChatsQuery, type AiKnowledgeRetrievalPart, type AiKnowledgeSource, type AiOpaqueToolDefinition, type AiOpaqueToolInvocationProps, type AiReasoningPart, type AiRetrievalPart, type AiSourcesPart, type AiTextPart, type AiToolDefinition, type AiToolExecuteCallback, type AiToolExecuteContext, type AiToolInvocationPart, type AiToolInvocationProps, type AiToolTypePack, type AiUrlSource, type AiUserMessage, type AiWebRetrievalPart, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type Awaitable, type BaseActivitiesData, type BaseAuthResult, type BaseGroupInfo, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type CommentAttachment, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentLocalAttachment, type CommentMixedAttachment, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, type CommentsEventServerMsg, type ContextualPromptContext, type ContextualPromptResponse, type CopilotId, CrdtType, type CreateListOp, type CreateManagedPoolOptions, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type Cursor, type CustomAuthenticationResult, type DAD, type DE, type DGI, type DM, type DP, type DRI, type DS, type DU, DefaultMap, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, Deque, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type GroupData, type GroupDataPlain, type GroupMemberData, type GroupMentionData, type GroupScopes, type History, type HistoryVersion, HttpError, type ISODateString, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IdTuple, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InferFromSchema, type
|
|
5229
|
+
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 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 DE, type DGI, type DM, type DP, type DRI, type DS, type DU, DefaultMap, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, Deque, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type GroupData, type GroupDataPlain, type GroupMemberData, type GroupMentionData, type GroupScopes, type History, type HistoryVersion, HttpError, type ISODateString, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IdTuple, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InferFromSchema, type 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 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, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -592,6 +592,7 @@ declare namespace CrdtType {
|
|
|
592
592
|
}
|
|
593
593
|
type SerializedCrdt = SerializedRootObject | SerializedChild;
|
|
594
594
|
type SerializedChild = SerializedObject | SerializedList | SerializedMap | SerializedRegister;
|
|
595
|
+
type NodeStream = Iterable<IdTuple<SerializedCrdt>>;
|
|
595
596
|
type SerializedRootObject = {
|
|
596
597
|
readonly type: CrdtType.OBJECT;
|
|
597
598
|
readonly data: JsonObject;
|
|
@@ -620,6 +621,40 @@ type SerializedRegister = {
|
|
|
620
621
|
readonly parentKey: string;
|
|
621
622
|
readonly data: Json;
|
|
622
623
|
};
|
|
624
|
+
type CompactNode = CompactRootNode | CompactChildNode;
|
|
625
|
+
type CompactChildNode = CompactObjectNode | CompactListNode | CompactMapNode | CompactRegisterNode;
|
|
626
|
+
type CompactRootNode = readonly [
|
|
627
|
+
id: "root",
|
|
628
|
+
type: CrdtType.OBJECT,
|
|
629
|
+
data: JsonObject
|
|
630
|
+
];
|
|
631
|
+
type CompactObjectNode = readonly [
|
|
632
|
+
id: string,
|
|
633
|
+
type: CrdtType.OBJECT,
|
|
634
|
+
parentId: string,
|
|
635
|
+
parentKey: string,
|
|
636
|
+
data: JsonObject
|
|
637
|
+
];
|
|
638
|
+
type CompactListNode = readonly [
|
|
639
|
+
id: string,
|
|
640
|
+
type: CrdtType.LIST,
|
|
641
|
+
parentId: string,
|
|
642
|
+
parentKey: string
|
|
643
|
+
];
|
|
644
|
+
type CompactMapNode = readonly [
|
|
645
|
+
id: string,
|
|
646
|
+
type: CrdtType.MAP,
|
|
647
|
+
parentId: string,
|
|
648
|
+
parentKey: string
|
|
649
|
+
];
|
|
650
|
+
type CompactRegisterNode = readonly [
|
|
651
|
+
id: string,
|
|
652
|
+
type: CrdtType.REGISTER,
|
|
653
|
+
parentId: string,
|
|
654
|
+
parentKey: string,
|
|
655
|
+
data: Json
|
|
656
|
+
];
|
|
657
|
+
declare function nodeStreamToCompactNodes(nodes: NodeStream): Iterable<CompactNode>;
|
|
623
658
|
|
|
624
659
|
type LiveObjectUpdateDelta<O extends {
|
|
625
660
|
[key: string]: unknown;
|
|
@@ -653,7 +688,7 @@ declare class LiveObject<O extends LsonObject> extends AbstractCrdt {
|
|
|
653
688
|
*/
|
|
654
689
|
static detectLargeObjects: boolean;
|
|
655
690
|
/** @private Do not use this API directly */
|
|
656
|
-
static _fromItems<O extends LsonObject>(
|
|
691
|
+
static _fromItems<O extends LsonObject>(nodes: NodeStream, pool: ManagedPool): LiveObject<O>;
|
|
657
692
|
constructor(obj?: O);
|
|
658
693
|
/**
|
|
659
694
|
* Transform the LiveObject into a javascript object
|
|
@@ -1996,6 +2031,12 @@ type EnterOptions<P extends JsonObject = DP, S extends LsonObject = DS> = Resolv
|
|
|
1996
2031
|
* the authentication endpoint or connect via WebSocket.
|
|
1997
2032
|
*/
|
|
1998
2033
|
autoConnect?: boolean;
|
|
2034
|
+
/**
|
|
2035
|
+
* @private Preferred storage engine version to use when creating the
|
|
2036
|
+
* room. Only takes effect if the room doesn't exist yet. Version
|
|
2037
|
+
* 2 supports streaming and will become the default in the future.
|
|
2038
|
+
*/
|
|
2039
|
+
engine?: 1 | 2;
|
|
1999
2040
|
} & PartialUnless<P, {
|
|
2000
2041
|
/**
|
|
2001
2042
|
* The initial Presence to use and announce when you enter the Room. The
|
|
@@ -2486,9 +2527,9 @@ declare const ServerMsgCode: Readonly<{
|
|
|
2486
2527
|
USER_LEFT: 102;
|
|
2487
2528
|
BROADCASTED_EVENT: 103;
|
|
2488
2529
|
ROOM_STATE: 104;
|
|
2489
|
-
|
|
2530
|
+
STORAGE_STATE_V7: 200;
|
|
2531
|
+
STORAGE_CHUNK: 210;
|
|
2490
2532
|
UPDATE_STORAGE: 201;
|
|
2491
|
-
STORAGE_ACK: 202;
|
|
2492
2533
|
UPDATE_YDOC: 300;
|
|
2493
2534
|
THREAD_CREATED: 400;
|
|
2494
2535
|
THREAD_DELETED: 407;
|
|
@@ -2507,9 +2548,9 @@ declare namespace ServerMsgCode {
|
|
|
2507
2548
|
type USER_LEFT = typeof ServerMsgCode.USER_LEFT;
|
|
2508
2549
|
type BROADCASTED_EVENT = typeof ServerMsgCode.BROADCASTED_EVENT;
|
|
2509
2550
|
type ROOM_STATE = typeof ServerMsgCode.ROOM_STATE;
|
|
2510
|
-
type
|
|
2551
|
+
type STORAGE_STATE_V7 = typeof ServerMsgCode.STORAGE_STATE_V7;
|
|
2552
|
+
type STORAGE_CHUNK = typeof ServerMsgCode.STORAGE_CHUNK;
|
|
2511
2553
|
type UPDATE_STORAGE = typeof ServerMsgCode.UPDATE_STORAGE;
|
|
2512
|
-
type STORAGE_ACK = typeof ServerMsgCode.STORAGE_ACK;
|
|
2513
2554
|
type UPDATE_YDOC = typeof ServerMsgCode.UPDATE_YDOC;
|
|
2514
2555
|
type THREAD_CREATED = typeof ServerMsgCode.THREAD_CREATED;
|
|
2515
2556
|
type THREAD_DELETED = typeof ServerMsgCode.THREAD_DELETED;
|
|
@@ -2525,7 +2566,7 @@ declare namespace ServerMsgCode {
|
|
|
2525
2566
|
/**
|
|
2526
2567
|
* Messages that can be sent from the server to the client.
|
|
2527
2568
|
*/
|
|
2528
|
-
type ServerMsg<P extends JsonObject, U extends BaseUserMeta, E extends Json> = UpdatePresenceServerMsg<P> | UserJoinServerMsg<U> | UserLeftServerMsg | BroadcastedEventServerMsg<E> | RoomStateServerMsg<U> |
|
|
2569
|
+
type ServerMsg<P extends JsonObject, U extends BaseUserMeta, E extends Json> = UpdatePresenceServerMsg<P> | UserJoinServerMsg<U> | UserLeftServerMsg | BroadcastedEventServerMsg<E> | RoomStateServerMsg<U> | StorageStateServerMsg_V7 | StorageChunkServerMsg | UpdateStorageServerMsg | YDocUpdateServerMsg | RejectedStorageOpServerMsg | CommentsEventServerMsg;
|
|
2529
2570
|
type CommentsEventServerMsg = ThreadCreatedEvent | ThreadDeletedEvent | ThreadMetadataUpdatedEvent | ThreadUpdatedEvent | CommentCreatedEvent | CommentEditedEvent | CommentDeletedEvent | CommentReactionAdded | CommentReactionRemoved;
|
|
2530
2571
|
type ThreadCreatedEvent = {
|
|
2531
2572
|
type: ServerMsgCode.THREAD_CREATED;
|
|
@@ -2689,40 +2730,47 @@ type BroadcastedEventServerMsg<E extends Json> = {
|
|
|
2689
2730
|
*/
|
|
2690
2731
|
type RoomStateServerMsg<U extends BaseUserMeta> = {
|
|
2691
2732
|
readonly type: ServerMsgCode.ROOM_STATE;
|
|
2692
|
-
/**
|
|
2693
|
-
* Informs the client what their actor ID is going to be.
|
|
2694
|
-
* @since v1.2 (WS API v7)
|
|
2695
|
-
*/
|
|
2733
|
+
/** Informs the client what their actor ID is going to be. */
|
|
2696
2734
|
readonly actor: number;
|
|
2697
|
-
/**
|
|
2698
|
-
* Secure nonce for the current session.
|
|
2699
|
-
* @since v1.2 (WS API v7)
|
|
2700
|
-
*/
|
|
2735
|
+
/** Secure nonce for the current session. */
|
|
2701
2736
|
readonly nonce: string;
|
|
2702
|
-
/**
|
|
2703
|
-
* Informs the client what permissions the current User (self) has.
|
|
2704
|
-
* @since v1.2 (WS API v7)
|
|
2705
|
-
*/
|
|
2737
|
+
/** Informs the client what permissions the current User (self) has. */
|
|
2706
2738
|
readonly scopes: string[];
|
|
2707
2739
|
readonly users: {
|
|
2708
2740
|
readonly [otherActor: number]: U & {
|
|
2709
2741
|
scopes: string[];
|
|
2710
2742
|
};
|
|
2711
2743
|
};
|
|
2712
|
-
/**
|
|
2713
|
-
* Metadata sent from the server to the client.
|
|
2714
|
-
*/
|
|
2744
|
+
/** Metadata sent from the server to the client. */
|
|
2715
2745
|
readonly meta: JsonObject;
|
|
2716
2746
|
};
|
|
2717
2747
|
/**
|
|
2718
|
-
*
|
|
2719
|
-
* joining the Room, to provide the initial Storage state of the Room. The
|
|
2720
|
-
* payload includes the entire Storage document.
|
|
2748
|
+
* No longer used as of WS API v8.
|
|
2721
2749
|
*/
|
|
2722
|
-
type
|
|
2723
|
-
readonly type: ServerMsgCode.
|
|
2750
|
+
type StorageStateServerMsg_V7 = {
|
|
2751
|
+
readonly type: ServerMsgCode.STORAGE_STATE_V7;
|
|
2724
2752
|
readonly items: IdTuple<SerializedCrdt>[];
|
|
2725
2753
|
};
|
|
2754
|
+
/**
|
|
2755
|
+
* Sent by the WebSocket server to a single client in response to the client
|
|
2756
|
+
* sending a FetchStorageClientMsg message, to provide the initial Storage
|
|
2757
|
+
* state of the Room.
|
|
2758
|
+
*
|
|
2759
|
+
* The server will respond with 0+ STORAGE_CHUNK messages with
|
|
2760
|
+
* done=false, followed by exactly one STORAGE_CHUNK message with
|
|
2761
|
+
* done=true.
|
|
2762
|
+
*
|
|
2763
|
+
* If the room is using the new storage engine that supports streaming, then
|
|
2764
|
+
* potentially multiple chunks might get sent.
|
|
2765
|
+
*
|
|
2766
|
+
* If the room is using the old storage engine, then all nodes will be sent in
|
|
2767
|
+
* a single/large chunk (non-streaming).
|
|
2768
|
+
*/
|
|
2769
|
+
type StorageChunkServerMsg = {
|
|
2770
|
+
readonly type: ServerMsgCode.STORAGE_CHUNK;
|
|
2771
|
+
readonly done: boolean;
|
|
2772
|
+
readonly nodes: CompactNode[];
|
|
2773
|
+
};
|
|
2726
2774
|
/**
|
|
2727
2775
|
* Sent by the WebSocket server and broadcasted to all clients to announce that
|
|
2728
2776
|
* a change occurred in the Storage document.
|
|
@@ -2734,14 +2782,6 @@ type UpdateStorageServerMsg = {
|
|
|
2734
2782
|
readonly type: ServerMsgCode.UPDATE_STORAGE;
|
|
2735
2783
|
readonly ops: Op[];
|
|
2736
2784
|
};
|
|
2737
|
-
/**
|
|
2738
|
-
* Sent back to client that initiated a storage mutation, to acknowledge which
|
|
2739
|
-
* mutations have been persisted.
|
|
2740
|
-
*/
|
|
2741
|
-
type StorageAckServerMsg = {
|
|
2742
|
-
readonly type: ServerMsgCode.STORAGE_ACK;
|
|
2743
|
-
readonly opIds: string[];
|
|
2744
|
-
};
|
|
2745
2785
|
/**
|
|
2746
2786
|
* Sent by the WebSocket server to the client to indicate that certain opIds
|
|
2747
2787
|
* have been rejected, possibly due to lack of permissions or exceeding
|
|
@@ -5186,4 +5226,4 @@ type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (EnsureJson
|
|
|
5186
5226
|
[K in keyof T as EnsureJson<T[K]> extends never ? never : K]: EnsureJson<T[K]>;
|
|
5187
5227
|
};
|
|
5188
5228
|
|
|
5189
|
-
export { type AckOp, type ActivityData, type AiAssistantContentPart, type AiAssistantMessage, type AiChat, type AiChatMessage, type AiChatsQuery, type AiKnowledgeRetrievalPart, type AiKnowledgeSource, type AiOpaqueToolDefinition, type AiOpaqueToolInvocationProps, type AiReasoningPart, type AiRetrievalPart, type AiSourcesPart, type AiTextPart, type AiToolDefinition, type AiToolExecuteCallback, type AiToolExecuteContext, type AiToolInvocationPart, type AiToolInvocationProps, type AiToolTypePack, type AiUrlSource, type AiUserMessage, type AiWebRetrievalPart, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type Awaitable, type BaseActivitiesData, type BaseAuthResult, type BaseGroupInfo, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type CommentAttachment, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentLocalAttachment, type CommentMixedAttachment, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, type CommentsEventServerMsg, type ContextualPromptContext, type ContextualPromptResponse, type CopilotId, CrdtType, type CreateListOp, type CreateManagedPoolOptions, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type Cursor, type CustomAuthenticationResult, type DAD, type DE, type DGI, type DM, type DP, type DRI, type DS, type DU, DefaultMap, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, Deque, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type GroupData, type GroupDataPlain, type GroupMemberData, type GroupMentionData, type GroupScopes, type History, type HistoryVersion, HttpError, type ISODateString, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IdTuple, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InferFromSchema, type
|
|
5229
|
+
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 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 DE, type DGI, type DM, type DP, type DRI, type DS, type DU, DefaultMap, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, Deque, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type GroupData, type GroupDataPlain, type GroupMemberData, type GroupMentionData, type GroupScopes, type History, type HistoryVersion, HttpError, type ISODateString, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IdTuple, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InferFromSchema, type 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 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, 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 };
|