@liveblocks/core 1.5.3 → 1.6.0-subdocs2

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.mts CHANGED
@@ -999,10 +999,12 @@ declare type FetchStorageClientMsg = {
999
999
  declare type FetchYDocClientMsg = {
1000
1000
  readonly type: ClientMsgCode.FETCH_YDOC;
1001
1001
  readonly vector: string;
1002
+ readonly guid?: string;
1002
1003
  };
1003
1004
  declare type UpdateYDocClientMsg = {
1004
1005
  readonly type: ClientMsgCode.UPDATE_YDOC;
1005
1006
  readonly update: string;
1007
+ readonly guid?: string;
1006
1008
  };
1007
1009
 
1008
1010
  declare type IdTuple<T> = [id: string, value: T];
@@ -1194,6 +1196,7 @@ declare type YDocUpdateServerMsg = {
1194
1196
  readonly update: string;
1195
1197
  readonly isSync: boolean;
1196
1198
  readonly stateVector: string | null;
1199
+ readonly guid?: string;
1197
1200
  };
1198
1201
  /**
1199
1202
  * Sent by the WebSocket server and broadcasted to all clients to announce that
@@ -1686,11 +1689,11 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject, TUs
1686
1689
  *
1687
1690
  * @param {string} data the doc update to send to the server, base64 encoded uint8array
1688
1691
  */
1689
- updateYDoc(data: string): void;
1692
+ updateYDoc(data: string, guid?: string): void;
1690
1693
  /**
1691
1694
  * Sends a request for the current document from liveblocks server
1692
1695
  */
1693
- fetchYDoc(stateVector: string): void;
1696
+ fetchYDoc(stateVector: string, guid?: string): void;
1694
1697
  /**
1695
1698
  * Broadcasts an event to other users in the room. Event broadcasted to the room can be listened with {@link Room.subscribe}("event").
1696
1699
  * @param {any} event the event to broadcast. Should be serializable to JSON
package/dist/index.d.ts CHANGED
@@ -999,10 +999,12 @@ declare type FetchStorageClientMsg = {
999
999
  declare type FetchYDocClientMsg = {
1000
1000
  readonly type: ClientMsgCode.FETCH_YDOC;
1001
1001
  readonly vector: string;
1002
+ readonly guid?: string;
1002
1003
  };
1003
1004
  declare type UpdateYDocClientMsg = {
1004
1005
  readonly type: ClientMsgCode.UPDATE_YDOC;
1005
1006
  readonly update: string;
1007
+ readonly guid?: string;
1006
1008
  };
1007
1009
 
1008
1010
  declare type IdTuple<T> = [id: string, value: T];
@@ -1194,6 +1196,7 @@ declare type YDocUpdateServerMsg = {
1194
1196
  readonly update: string;
1195
1197
  readonly isSync: boolean;
1196
1198
  readonly stateVector: string | null;
1199
+ readonly guid?: string;
1197
1200
  };
1198
1201
  /**
1199
1202
  * Sent by the WebSocket server and broadcasted to all clients to announce that
@@ -1686,11 +1689,11 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject, TUs
1686
1689
  *
1687
1690
  * @param {string} data the doc update to send to the server, base64 encoded uint8array
1688
1691
  */
1689
- updateYDoc(data: string): void;
1692
+ updateYDoc(data: string, guid?: string): void;
1690
1693
  /**
1691
1694
  * Sends a request for the current document from liveblocks server
1692
1695
  */
1693
- fetchYDoc(stateVector: string): void;
1696
+ fetchYDoc(stateVector: string, guid?: string): void;
1694
1697
  /**
1695
1698
  * Broadcasts an event to other users in the room. Event broadcasted to the room can be listened with {@link Room.subscribe}("event").
1696
1699
  * @param {any} event the event to broadcast. Should be serializable to JSON
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 = "1.5.3";
9
+ var PKG_VERSION = "1.6.0-subdocs2";
10
10
  var PKG_FORMAT = "cjs";
11
11
 
12
12
  // src/dupe-detection.ts
@@ -5570,10 +5570,11 @@ ${Array.from(traces).join("\n\n")}`
5570
5570
  }
5571
5571
  return messages;
5572
5572
  }
5573
- function updateYDoc(update) {
5573
+ function updateYDoc(update, guid) {
5574
5574
  const clientMsg = {
5575
5575
  type: 301 /* UPDATE_YDOC */,
5576
- update
5576
+ update,
5577
+ guid
5577
5578
  };
5578
5579
  context.buffer.messages.push(clientMsg);
5579
5580
  eventHub.ydoc.notify(clientMsg);
@@ -5636,13 +5637,14 @@ ${Array.from(traces).join("\n\n")}`
5636
5637
  root: nn(context.root)
5637
5638
  };
5638
5639
  }
5639
- function fetchYDoc(vector) {
5640
+ function fetchYDoc(vector, guid) {
5640
5641
  if (!context.buffer.messages.find((m) => {
5641
- return m.type === 300 /* FETCH_YDOC */ && m.vector === vector;
5642
+ return m.type === 300 /* FETCH_YDOC */ && m.vector === vector && m.guid === guid;
5642
5643
  })) {
5643
5644
  context.buffer.messages.push({
5644
5645
  type: 300 /* FETCH_YDOC */,
5645
- vector
5646
+ vector,
5647
+ guid
5646
5648
  });
5647
5649
  }
5648
5650
  flushNowOrSoon();