@liveblocks/core 3.13.0-vincent1 → 3.13.0-vincent3
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 +21 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -18
- package/dist/index.d.ts +14 -18
- package/dist/index.js +21 -19
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -342,7 +342,6 @@ declare const OpCode: Readonly<{
|
|
|
342
342
|
DELETE_OBJECT_KEY: 6;
|
|
343
343
|
CREATE_MAP: 7;
|
|
344
344
|
CREATE_REGISTER: 8;
|
|
345
|
-
ACK: 9;
|
|
346
345
|
}>;
|
|
347
346
|
declare namespace OpCode {
|
|
348
347
|
type INIT = typeof OpCode.INIT;
|
|
@@ -354,7 +353,6 @@ declare namespace OpCode {
|
|
|
354
353
|
type DELETE_OBJECT_KEY = typeof OpCode.DELETE_OBJECT_KEY;
|
|
355
354
|
type CREATE_MAP = typeof OpCode.CREATE_MAP;
|
|
356
355
|
type CREATE_REGISTER = typeof OpCode.CREATE_REGISTER;
|
|
357
|
-
type ACK = typeof OpCode.ACK;
|
|
358
356
|
}
|
|
359
357
|
/**
|
|
360
358
|
* These operations are the payload for {@link UpdateStorageServerMsg} messages
|
|
@@ -623,11 +621,7 @@ type SerializedRegister = {
|
|
|
623
621
|
};
|
|
624
622
|
type CompactNode = CompactRootNode | CompactChildNode;
|
|
625
623
|
type CompactChildNode = CompactObjectNode | CompactListNode | CompactMapNode | CompactRegisterNode;
|
|
626
|
-
type CompactRootNode = readonly [
|
|
627
|
-
id: "root",
|
|
628
|
-
type: CrdtType.OBJECT,
|
|
629
|
-
data: JsonObject
|
|
630
|
-
];
|
|
624
|
+
type CompactRootNode = readonly [id: "root", data: JsonObject];
|
|
631
625
|
type CompactObjectNode = readonly [
|
|
632
626
|
id: string,
|
|
633
627
|
type: CrdtType.OBJECT,
|
|
@@ -2529,6 +2523,7 @@ declare const ServerMsgCode: Readonly<{
|
|
|
2529
2523
|
ROOM_STATE: 104;
|
|
2530
2524
|
STORAGE_STATE_V7: 200;
|
|
2531
2525
|
STORAGE_CHUNK: 210;
|
|
2526
|
+
STORAGE_STREAM_END: 211;
|
|
2532
2527
|
UPDATE_STORAGE: 201;
|
|
2533
2528
|
UPDATE_YDOC: 300;
|
|
2534
2529
|
THREAD_CREATED: 400;
|
|
@@ -2550,6 +2545,7 @@ declare namespace ServerMsgCode {
|
|
|
2550
2545
|
type ROOM_STATE = typeof ServerMsgCode.ROOM_STATE;
|
|
2551
2546
|
type STORAGE_STATE_V7 = typeof ServerMsgCode.STORAGE_STATE_V7;
|
|
2552
2547
|
type STORAGE_CHUNK = typeof ServerMsgCode.STORAGE_CHUNK;
|
|
2548
|
+
type STORAGE_STREAM_END = typeof ServerMsgCode.STORAGE_STREAM_END;
|
|
2553
2549
|
type UPDATE_STORAGE = typeof ServerMsgCode.UPDATE_STORAGE;
|
|
2554
2550
|
type UPDATE_YDOC = typeof ServerMsgCode.UPDATE_YDOC;
|
|
2555
2551
|
type THREAD_CREATED = typeof ServerMsgCode.THREAD_CREATED;
|
|
@@ -2566,7 +2562,7 @@ declare namespace ServerMsgCode {
|
|
|
2566
2562
|
/**
|
|
2567
2563
|
* Messages that can be sent from the server to the client.
|
|
2568
2564
|
*/
|
|
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;
|
|
2565
|
+
type ServerMsg<P extends JsonObject, U extends BaseUserMeta, E extends Json> = UpdatePresenceServerMsg<P> | UserJoinServerMsg<U> | UserLeftServerMsg | BroadcastedEventServerMsg<E> | RoomStateServerMsg<U> | StorageStateServerMsg_V7 | StorageChunkServerMsg | StorageEndServerMsg | UpdateStorageServerMsg | YDocUpdateServerMsg | RejectedStorageOpServerMsg | CommentsEventServerMsg;
|
|
2570
2566
|
type CommentsEventServerMsg = ThreadCreatedEvent | ThreadDeletedEvent | ThreadMetadataUpdatedEvent | ThreadUpdatedEvent | CommentCreatedEvent | CommentEditedEvent | CommentDeletedEvent | CommentReactionAdded | CommentReactionRemoved;
|
|
2571
2567
|
type ThreadCreatedEvent = {
|
|
2572
2568
|
type: ServerMsgCode.THREAD_CREATED;
|
|
@@ -2753,24 +2749,24 @@ type StorageStateServerMsg_V7 = {
|
|
|
2753
2749
|
};
|
|
2754
2750
|
/**
|
|
2755
2751
|
* Sent by the WebSocket server to a single client in response to the client
|
|
2756
|
-
* sending a FetchStorageClientMsg message, to provide the initial
|
|
2757
|
-
* state of the Room.
|
|
2752
|
+
* sending a FetchStorageClientMsg message, to provide one chunk of the initial
|
|
2753
|
+
* Storage state of the Room.
|
|
2758
2754
|
*
|
|
2759
|
-
* The server will respond with
|
|
2760
|
-
*
|
|
2761
|
-
* done=true.
|
|
2755
|
+
* The server will respond with 1+ STORAGE_CHUNK messages, followed by exactly
|
|
2756
|
+
* one STORAGE_STREAM_END message to mark the end of the transmission.
|
|
2762
2757
|
*
|
|
2763
2758
|
* If the room is using the new storage engine that supports streaming, then
|
|
2764
|
-
* potentially multiple chunks might get sent.
|
|
2765
|
-
*
|
|
2766
|
-
*
|
|
2767
|
-
* a single/large chunk (non-streaming).
|
|
2759
|
+
* potentially multiple chunks might get sent. If the room is using the old
|
|
2760
|
+
* storage engine, then all nodes will be sent in a single/large chunk
|
|
2761
|
+
* (non-streaming).
|
|
2768
2762
|
*/
|
|
2769
2763
|
type StorageChunkServerMsg = {
|
|
2770
2764
|
readonly type: ServerMsgCode.STORAGE_CHUNK;
|
|
2771
|
-
readonly done: boolean;
|
|
2772
2765
|
readonly nodes: CompactNode[];
|
|
2773
2766
|
};
|
|
2767
|
+
type StorageEndServerMsg = {
|
|
2768
|
+
readonly type: ServerMsgCode.STORAGE_STREAM_END;
|
|
2769
|
+
};
|
|
2774
2770
|
/**
|
|
2775
2771
|
* Sent by the WebSocket server and broadcasted to all clients to announce that
|
|
2776
2772
|
* a change occurred in the Storage document.
|
package/dist/index.d.ts
CHANGED
|
@@ -342,7 +342,6 @@ declare const OpCode: Readonly<{
|
|
|
342
342
|
DELETE_OBJECT_KEY: 6;
|
|
343
343
|
CREATE_MAP: 7;
|
|
344
344
|
CREATE_REGISTER: 8;
|
|
345
|
-
ACK: 9;
|
|
346
345
|
}>;
|
|
347
346
|
declare namespace OpCode {
|
|
348
347
|
type INIT = typeof OpCode.INIT;
|
|
@@ -354,7 +353,6 @@ declare namespace OpCode {
|
|
|
354
353
|
type DELETE_OBJECT_KEY = typeof OpCode.DELETE_OBJECT_KEY;
|
|
355
354
|
type CREATE_MAP = typeof OpCode.CREATE_MAP;
|
|
356
355
|
type CREATE_REGISTER = typeof OpCode.CREATE_REGISTER;
|
|
357
|
-
type ACK = typeof OpCode.ACK;
|
|
358
356
|
}
|
|
359
357
|
/**
|
|
360
358
|
* These operations are the payload for {@link UpdateStorageServerMsg} messages
|
|
@@ -623,11 +621,7 @@ type SerializedRegister = {
|
|
|
623
621
|
};
|
|
624
622
|
type CompactNode = CompactRootNode | CompactChildNode;
|
|
625
623
|
type CompactChildNode = CompactObjectNode | CompactListNode | CompactMapNode | CompactRegisterNode;
|
|
626
|
-
type CompactRootNode = readonly [
|
|
627
|
-
id: "root",
|
|
628
|
-
type: CrdtType.OBJECT,
|
|
629
|
-
data: JsonObject
|
|
630
|
-
];
|
|
624
|
+
type CompactRootNode = readonly [id: "root", data: JsonObject];
|
|
631
625
|
type CompactObjectNode = readonly [
|
|
632
626
|
id: string,
|
|
633
627
|
type: CrdtType.OBJECT,
|
|
@@ -2529,6 +2523,7 @@ declare const ServerMsgCode: Readonly<{
|
|
|
2529
2523
|
ROOM_STATE: 104;
|
|
2530
2524
|
STORAGE_STATE_V7: 200;
|
|
2531
2525
|
STORAGE_CHUNK: 210;
|
|
2526
|
+
STORAGE_STREAM_END: 211;
|
|
2532
2527
|
UPDATE_STORAGE: 201;
|
|
2533
2528
|
UPDATE_YDOC: 300;
|
|
2534
2529
|
THREAD_CREATED: 400;
|
|
@@ -2550,6 +2545,7 @@ declare namespace ServerMsgCode {
|
|
|
2550
2545
|
type ROOM_STATE = typeof ServerMsgCode.ROOM_STATE;
|
|
2551
2546
|
type STORAGE_STATE_V7 = typeof ServerMsgCode.STORAGE_STATE_V7;
|
|
2552
2547
|
type STORAGE_CHUNK = typeof ServerMsgCode.STORAGE_CHUNK;
|
|
2548
|
+
type STORAGE_STREAM_END = typeof ServerMsgCode.STORAGE_STREAM_END;
|
|
2553
2549
|
type UPDATE_STORAGE = typeof ServerMsgCode.UPDATE_STORAGE;
|
|
2554
2550
|
type UPDATE_YDOC = typeof ServerMsgCode.UPDATE_YDOC;
|
|
2555
2551
|
type THREAD_CREATED = typeof ServerMsgCode.THREAD_CREATED;
|
|
@@ -2566,7 +2562,7 @@ declare namespace ServerMsgCode {
|
|
|
2566
2562
|
/**
|
|
2567
2563
|
* Messages that can be sent from the server to the client.
|
|
2568
2564
|
*/
|
|
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;
|
|
2565
|
+
type ServerMsg<P extends JsonObject, U extends BaseUserMeta, E extends Json> = UpdatePresenceServerMsg<P> | UserJoinServerMsg<U> | UserLeftServerMsg | BroadcastedEventServerMsg<E> | RoomStateServerMsg<U> | StorageStateServerMsg_V7 | StorageChunkServerMsg | StorageEndServerMsg | UpdateStorageServerMsg | YDocUpdateServerMsg | RejectedStorageOpServerMsg | CommentsEventServerMsg;
|
|
2570
2566
|
type CommentsEventServerMsg = ThreadCreatedEvent | ThreadDeletedEvent | ThreadMetadataUpdatedEvent | ThreadUpdatedEvent | CommentCreatedEvent | CommentEditedEvent | CommentDeletedEvent | CommentReactionAdded | CommentReactionRemoved;
|
|
2571
2567
|
type ThreadCreatedEvent = {
|
|
2572
2568
|
type: ServerMsgCode.THREAD_CREATED;
|
|
@@ -2753,24 +2749,24 @@ type StorageStateServerMsg_V7 = {
|
|
|
2753
2749
|
};
|
|
2754
2750
|
/**
|
|
2755
2751
|
* Sent by the WebSocket server to a single client in response to the client
|
|
2756
|
-
* sending a FetchStorageClientMsg message, to provide the initial
|
|
2757
|
-
* state of the Room.
|
|
2752
|
+
* sending a FetchStorageClientMsg message, to provide one chunk of the initial
|
|
2753
|
+
* Storage state of the Room.
|
|
2758
2754
|
*
|
|
2759
|
-
* The server will respond with
|
|
2760
|
-
*
|
|
2761
|
-
* done=true.
|
|
2755
|
+
* The server will respond with 1+ STORAGE_CHUNK messages, followed by exactly
|
|
2756
|
+
* one STORAGE_STREAM_END message to mark the end of the transmission.
|
|
2762
2757
|
*
|
|
2763
2758
|
* If the room is using the new storage engine that supports streaming, then
|
|
2764
|
-
* potentially multiple chunks might get sent.
|
|
2765
|
-
*
|
|
2766
|
-
*
|
|
2767
|
-
* a single/large chunk (non-streaming).
|
|
2759
|
+
* potentially multiple chunks might get sent. If the room is using the old
|
|
2760
|
+
* storage engine, then all nodes will be sent in a single/large chunk
|
|
2761
|
+
* (non-streaming).
|
|
2768
2762
|
*/
|
|
2769
2763
|
type StorageChunkServerMsg = {
|
|
2770
2764
|
readonly type: ServerMsgCode.STORAGE_CHUNK;
|
|
2771
|
-
readonly done: boolean;
|
|
2772
2765
|
readonly nodes: CompactNode[];
|
|
2773
2766
|
};
|
|
2767
|
+
type StorageEndServerMsg = {
|
|
2768
|
+
readonly type: ServerMsgCode.STORAGE_STREAM_END;
|
|
2769
|
+
};
|
|
2774
2770
|
/**
|
|
2775
2771
|
* Sent by the WebSocket server and broadcasted to all clients to announce that
|
|
2776
2772
|
* a change occurred in the Storage document.
|
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-vincent3";
|
|
10
10
|
var PKG_FORMAT = "esm";
|
|
11
11
|
|
|
12
12
|
// src/dupe-detection.ts
|
|
@@ -3094,6 +3094,8 @@ var ServerMsgCode = Object.freeze({
|
|
|
3094
3094
|
// Only sent in V7
|
|
3095
3095
|
STORAGE_CHUNK: 210,
|
|
3096
3096
|
// Used in V8+
|
|
3097
|
+
STORAGE_STREAM_END: 211,
|
|
3098
|
+
// Used in V8+
|
|
3097
3099
|
UPDATE_STORAGE: 201,
|
|
3098
3100
|
// For Yjs Docs
|
|
3099
3101
|
UPDATE_YDOC: 300,
|
|
@@ -5925,9 +5927,7 @@ var OpCode = Object.freeze({
|
|
|
5925
5927
|
DELETE_CRDT: 5,
|
|
5926
5928
|
DELETE_OBJECT_KEY: 6,
|
|
5927
5929
|
CREATE_MAP: 7,
|
|
5928
|
-
CREATE_REGISTER: 8
|
|
5929
|
-
ACK: 9
|
|
5930
|
-
// Will only appear in v8+
|
|
5930
|
+
CREATE_REGISTER: 8
|
|
5931
5931
|
});
|
|
5932
5932
|
function isAckOp(op) {
|
|
5933
5933
|
return op.type === OpCode.DELETE_CRDT && op.id === "ACK";
|
|
@@ -6153,21 +6153,23 @@ function isRootCrdt(id, _) {
|
|
|
6153
6153
|
}
|
|
6154
6154
|
function* compactNodesToNodeStream(nodes) {
|
|
6155
6155
|
for (const node of nodes) {
|
|
6156
|
+
const id = node[0];
|
|
6157
|
+
if (isRootNode(node)) {
|
|
6158
|
+
yield [id, { type: CrdtType.OBJECT, data: node[1] }];
|
|
6159
|
+
continue;
|
|
6160
|
+
}
|
|
6156
6161
|
switch (node[1]) {
|
|
6157
6162
|
case CrdtType.OBJECT:
|
|
6158
|
-
yield
|
|
6159
|
-
// prettier-ignore
|
|
6160
|
-
[node[0], { type: CrdtType.OBJECT, parentId: node[2], parentKey: node[3], data: node[4] }]
|
|
6161
|
-
);
|
|
6163
|
+
yield [id, { type: CrdtType.OBJECT, parentId: node[2], parentKey: node[3], data: node[4] }];
|
|
6162
6164
|
break;
|
|
6163
6165
|
case CrdtType.LIST:
|
|
6164
|
-
yield [
|
|
6166
|
+
yield [id, { type: CrdtType.LIST, parentId: node[2], parentKey: node[3] }];
|
|
6165
6167
|
break;
|
|
6166
6168
|
case CrdtType.MAP:
|
|
6167
|
-
yield [
|
|
6169
|
+
yield [id, { type: CrdtType.MAP, parentId: node[2], parentKey: node[3] }];
|
|
6168
6170
|
break;
|
|
6169
6171
|
case CrdtType.REGISTER:
|
|
6170
|
-
yield [
|
|
6172
|
+
yield [id, { type: CrdtType.REGISTER, parentId: node[2], parentKey: node[3], data: node[4] }];
|
|
6171
6173
|
break;
|
|
6172
6174
|
}
|
|
6173
6175
|
}
|
|
@@ -6176,10 +6178,11 @@ function* nodeStreamToCompactNodes(nodes) {
|
|
|
6176
6178
|
for (const [id, node] of nodes) {
|
|
6177
6179
|
switch (node.type) {
|
|
6178
6180
|
case CrdtType.OBJECT:
|
|
6179
|
-
if (isRootCrdt(id, node))
|
|
6180
|
-
yield [id,
|
|
6181
|
-
else
|
|
6181
|
+
if (isRootCrdt(id, node)) {
|
|
6182
|
+
yield [id, node.data];
|
|
6183
|
+
} else {
|
|
6182
6184
|
yield [id, CrdtType.OBJECT, node.parentId, node.parentKey, node.data];
|
|
6185
|
+
}
|
|
6183
6186
|
break;
|
|
6184
6187
|
case CrdtType.LIST:
|
|
6185
6188
|
yield [id, CrdtType.LIST, node.parentId, node.parentKey];
|
|
@@ -9539,13 +9542,12 @@ function createRoom(options, config) {
|
|
|
9539
9542
|
updates.others.push(onRoomStateMessage(message));
|
|
9540
9543
|
break;
|
|
9541
9544
|
}
|
|
9542
|
-
case ServerMsgCode.STORAGE_CHUNK:
|
|
9545
|
+
case ServerMsgCode.STORAGE_CHUNK:
|
|
9543
9546
|
partialNodes.append(compactNodesToNodeStream(message.nodes));
|
|
9544
|
-
if (message.done) {
|
|
9545
|
-
processInitialStorage(partialNodes.clear());
|
|
9546
|
-
}
|
|
9547
9547
|
break;
|
|
9548
|
-
|
|
9548
|
+
case ServerMsgCode.STORAGE_STREAM_END:
|
|
9549
|
+
processInitialStorage(partialNodes.clear());
|
|
9550
|
+
break;
|
|
9549
9551
|
case ServerMsgCode.UPDATE_STORAGE: {
|
|
9550
9552
|
const applyResult = applyOps(
|
|
9551
9553
|
message.ops,
|