@liveblocks/core 1.1.0-yjs4 → 1.1.0-yjs5

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.ts CHANGED
@@ -1083,11 +1083,11 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject, TUs
1083
1083
  *
1084
1084
  * @param {string} data the doc update to send to the server, base64 encoded uint8array
1085
1085
  */
1086
- updateDoc(data: string): void;
1086
+ updateYDoc(data: string): void;
1087
1087
  /**
1088
1088
  * Sends a request for the current document from liveblocks server
1089
1089
  */
1090
- getDoc(stateVector?: string): void;
1090
+ getYDoc(stateVector: string): void;
1091
1091
  /**
1092
1092
  * Broadcasts an event to other users in the room. Event broadcasted to the room can be listened with {@link Room.subscribe}("event").
1093
1093
  * @param {any} event the event to broadcast. Should be serializable to JSON
@@ -1145,7 +1145,7 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject, TUs
1145
1145
  */
1146
1146
  readonly storageDidLoad: Observable<void>;
1147
1147
  readonly storageStatus: Observable<StorageStatus>;
1148
- readonly docUpdated: Observable<string[]>;
1148
+ readonly docUpdated: Observable<string>;
1149
1149
  };
1150
1150
  /**
1151
1151
  * Batches modifications made during the given function.
@@ -1469,13 +1469,13 @@ declare enum ClientMsgCode {
1469
1469
  BROADCAST_EVENT = 103,
1470
1470
  FETCH_STORAGE = 200,
1471
1471
  UPDATE_STORAGE = 201,
1472
- FETCH_DOC = 300,
1473
- UPDATE_DOC = 301
1472
+ FETCH_YDOC_UPDATE = 300,
1473
+ UPDATE_YDOC = 301
1474
1474
  }
1475
1475
  /**
1476
1476
  * Messages that can be sent from the client to the server.
1477
1477
  */
1478
- declare type ClientMsg<TPresence extends JsonObject, TRoomEvent extends Json> = BroadcastEventClientMsg<TRoomEvent> | UpdatePresenceClientMsg<TPresence> | UpdateStorageClientMsg | FetchStorageClientMsg | FetchDocClientMsg | UpdateDocClientMsg;
1478
+ declare type ClientMsg<TPresence extends JsonObject, TRoomEvent extends Json> = BroadcastEventClientMsg<TRoomEvent> | UpdatePresenceClientMsg<TPresence> | UpdateStorageClientMsg | FetchStorageClientMsg | FetchYDocClientMsg | UpdateYDocClientMsg;
1479
1479
  declare type BroadcastEventClientMsg<TRoomEvent extends Json> = {
1480
1480
  type: ClientMsgCode.BROADCAST_EVENT;
1481
1481
  event: TRoomEvent;
@@ -1513,13 +1513,13 @@ declare type UpdateStorageClientMsg = {
1513
1513
  declare type FetchStorageClientMsg = {
1514
1514
  readonly type: ClientMsgCode.FETCH_STORAGE;
1515
1515
  };
1516
- declare type FetchDocClientMsg = {
1517
- readonly type: ClientMsgCode.FETCH_DOC;
1518
- readonly vector?: string;
1516
+ declare type FetchYDocClientMsg = {
1517
+ readonly type: ClientMsgCode.FETCH_YDOC_UPDATE;
1518
+ readonly vector: string;
1519
1519
  };
1520
- declare type UpdateDocClientMsg = {
1521
- readonly type: ClientMsgCode.UPDATE_DOC;
1522
- readonly data: string;
1520
+ declare type UpdateYDocClientMsg = {
1521
+ readonly type: ClientMsgCode.UPDATE_YDOC;
1522
+ readonly update: string;
1523
1523
  };
1524
1524
 
1525
1525
  declare type IdTuple<T> = [id: string, value: T];
@@ -1571,13 +1571,12 @@ declare enum ServerMsgCode {
1571
1571
  INITIAL_STORAGE_STATE = 200,
1572
1572
  UPDATE_STORAGE = 201,
1573
1573
  REJECT_STORAGE_OP = 299,
1574
- FETCH_DOC = 300,
1575
- DOC_UPDATE = 301
1574
+ YDOC_UPDATE = 300
1576
1575
  }
1577
1576
  /**
1578
1577
  * Messages that can be sent from the server to the client.
1579
1578
  */
1580
- declare type ServerMsg<TPresence extends JsonObject, TUserMeta extends BaseUserMeta, TRoomEvent extends Json> = UpdatePresenceServerMsg<TPresence> | UserJoinServerMsg<TUserMeta> | UserLeftServerMsg | BroadcastedEventServerMsg<TRoomEvent> | RoomStateServerMsg<TUserMeta> | InitialDocumentStateServerMsg | UpdateStorageServerMsg | RejectedStorageOpServerMsg | FetchDoc;
1579
+ declare type ServerMsg<TPresence extends JsonObject, TUserMeta extends BaseUserMeta, TRoomEvent extends Json> = UpdatePresenceServerMsg<TPresence> | UserJoinServerMsg<TUserMeta> | UserLeftServerMsg | BroadcastedEventServerMsg<TRoomEvent> | RoomStateServerMsg<TUserMeta> | InitialDocumentStateServerMsg | UpdateStorageServerMsg | RejectedStorageOpServerMsg | YDocUpdate;
1581
1580
  /**
1582
1581
  * Sent by the WebSocket server and broadcasted to all clients to announce that
1583
1582
  * a User updated their presence. For example, when a user moves their cursor.
@@ -1660,9 +1659,9 @@ declare type UserLeftServerMsg = {
1660
1659
  readonly type: ServerMsgCode.USER_LEFT;
1661
1660
  readonly actor: number;
1662
1661
  };
1663
- declare type FetchDoc = {
1664
- readonly type: ServerMsgCode.FETCH_DOC;
1665
- readonly data: string[];
1662
+ declare type YDocUpdate = {
1663
+ readonly type: ServerMsgCode.YDOC_UPDATE;
1664
+ readonly update: string;
1666
1665
  };
1667
1666
  /**
1668
1667
  * Sent by the WebSocket server and broadcasted to all clients to announce that
@@ -1912,4 +1911,4 @@ declare type EnsureJson<T> = [
1912
1911
  [K in keyof T]: EnsureJson<T[K]>;
1913
1912
  };
1914
1913
 
1915
- export { AckOp, AppOnlyAuthToken, AuthToken, BaseAuthResult, BaseUserMeta, BroadcastEventClientMsg, BroadcastOptions, BroadcastedEventServerMsg, Client, ClientMsg, ClientMsgCode, CrdtType, CreateChildOp, CreateListOp, CreateMapOp, CreateObjectOp, CreateOp, CreateRegisterOp, CreateRootObjectOp, Delegates, DeleteCrdtOp, DeleteObjectKeyOp, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, EnsureJson, FetchDocClientMsg, FetchStorageClientMsg, History, IWebSocket, IWebSocketCloseEvent, IWebSocketEvent, IWebSocketInstance, IWebSocketMessageEvent, IdTuple, Immutable, InitialDocumentStateServerMsg, Json, JsonArray, JsonObject, JsonScalar, LegacyConnectionStatus, LiveList, LiveListUpdate, LiveMap, LiveMapUpdate, LiveNode, LiveObject, LiveObjectUpdate, LiveStructure, LostConnectionEvent, Lson, LsonObject, NodeMap, Op, OpCode, Others, ParentToChildNodeMap, PlainLson, PlainLsonFields, PlainLsonList, PlainLsonMap, PlainLsonObject, RejectedStorageOpServerMsg, Resolve, Room, RoomAuthToken, RoomInitializers, RoomStateServerMsg, SerializedChild, SerializedCrdt, SerializedList, SerializedMap, SerializedObject, SerializedRegister, SerializedRootObject, ServerMsg, ServerMsgCode, SetParentKeyOp, Status, StorageStatus, StorageUpdate, ToImmutable, ToJson, UpdateDocClientMsg, UpdateObjectOp, UpdatePresenceClientMsg, UpdatePresenceServerMsg, UpdateStorageClientMsg, UpdateStorageServerMsg, User, UserJoinServerMsg, UserLeftServerMsg, WebsocketCloseCodes, asArrayWithLegacyMethods, asPos, assert, assertNever, b64decode, createClient, deprecate, deprecateIf, errorIf, freeze, isAppOnlyAuthToken, isAuthToken, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isPlainObject, isRoomAuthToken, isRootCrdt, legacy_patchImmutableObject, lsonToJson, makePosition, nn, patchLiveObjectKey, shallow, throwUsageError, toPlainLson, tryParseJson, withTimeout };
1914
+ export { AckOp, AppOnlyAuthToken, AuthToken, BaseAuthResult, BaseUserMeta, BroadcastEventClientMsg, BroadcastOptions, BroadcastedEventServerMsg, Client, ClientMsg, ClientMsgCode, CrdtType, CreateChildOp, CreateListOp, CreateMapOp, CreateObjectOp, CreateOp, CreateRegisterOp, CreateRootObjectOp, Delegates, DeleteCrdtOp, DeleteObjectKeyOp, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, EnsureJson, FetchStorageClientMsg, FetchYDocClientMsg, History, IWebSocket, IWebSocketCloseEvent, IWebSocketEvent, IWebSocketInstance, IWebSocketMessageEvent, IdTuple, Immutable, InitialDocumentStateServerMsg, Json, JsonArray, JsonObject, JsonScalar, LegacyConnectionStatus, LiveList, LiveListUpdate, LiveMap, LiveMapUpdate, LiveNode, LiveObject, LiveObjectUpdate, LiveStructure, LostConnectionEvent, Lson, LsonObject, NodeMap, Op, OpCode, Others, ParentToChildNodeMap, PlainLson, PlainLsonFields, PlainLsonList, PlainLsonMap, PlainLsonObject, RejectedStorageOpServerMsg, Resolve, Room, RoomAuthToken, RoomInitializers, RoomStateServerMsg, SerializedChild, SerializedCrdt, SerializedList, SerializedMap, SerializedObject, SerializedRegister, SerializedRootObject, ServerMsg, ServerMsgCode, SetParentKeyOp, Status, StorageStatus, StorageUpdate, ToImmutable, ToJson, UpdateObjectOp, UpdatePresenceClientMsg, UpdatePresenceServerMsg, UpdateStorageClientMsg, UpdateStorageServerMsg, UpdateYDocClientMsg, User, UserJoinServerMsg, UserLeftServerMsg, WebsocketCloseCodes, asArrayWithLegacyMethods, asPos, assert, assertNever, b64decode, createClient, deprecate, deprecateIf, errorIf, freeze, isAppOnlyAuthToken, isAuthToken, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isPlainObject, isRoomAuthToken, isRootCrdt, legacy_patchImmutableObject, lsonToJson, makePosition, nn, patchLiveObjectKey, shallow, throwUsageError, toPlainLson, tryParseJson, withTimeout };
package/dist/index.js CHANGED
@@ -157,7 +157,7 @@ var onMessageFromPanel = eventSource.observable;
157
157
  // src/devtools/index.ts
158
158
  var VERSION = true ? (
159
159
  /* istanbul ignore next */
160
- "1.1.0-yjs4"
160
+ "1.1.0-yjs5"
161
161
  ) : "dev";
162
162
  var _devtoolsSetupHasRun = false;
163
163
  function setupDevTools(getAllRooms) {
@@ -3986,8 +3986,8 @@ var ClientMsgCode = /* @__PURE__ */ ((ClientMsgCode2) => {
3986
3986
  ClientMsgCode2[ClientMsgCode2["BROADCAST_EVENT"] = 103] = "BROADCAST_EVENT";
3987
3987
  ClientMsgCode2[ClientMsgCode2["FETCH_STORAGE"] = 200] = "FETCH_STORAGE";
3988
3988
  ClientMsgCode2[ClientMsgCode2["UPDATE_STORAGE"] = 201] = "UPDATE_STORAGE";
3989
- ClientMsgCode2[ClientMsgCode2["FETCH_DOC"] = 300] = "FETCH_DOC";
3990
- ClientMsgCode2[ClientMsgCode2["UPDATE_DOC"] = 301] = "UPDATE_DOC";
3989
+ ClientMsgCode2[ClientMsgCode2["FETCH_YDOC_UPDATE"] = 300] = "FETCH_YDOC_UPDATE";
3990
+ ClientMsgCode2[ClientMsgCode2["UPDATE_YDOC"] = 301] = "UPDATE_YDOC";
3991
3991
  return ClientMsgCode2;
3992
3992
  })(ClientMsgCode || {});
3993
3993
 
@@ -4001,8 +4001,7 @@ var ServerMsgCode = /* @__PURE__ */ ((ServerMsgCode2) => {
4001
4001
  ServerMsgCode2[ServerMsgCode2["INITIAL_STORAGE_STATE"] = 200] = "INITIAL_STORAGE_STATE";
4002
4002
  ServerMsgCode2[ServerMsgCode2["UPDATE_STORAGE"] = 201] = "UPDATE_STORAGE";
4003
4003
  ServerMsgCode2[ServerMsgCode2["REJECT_STORAGE_OP"] = 299] = "REJECT_STORAGE_OP";
4004
- ServerMsgCode2[ServerMsgCode2["FETCH_DOC"] = 300] = "FETCH_DOC";
4005
- ServerMsgCode2[ServerMsgCode2["DOC_UPDATE"] = 301] = "DOC_UPDATE";
4004
+ ServerMsgCode2[ServerMsgCode2["YDOC_UPDATE"] = 300] = "YDOC_UPDATE";
4006
4005
  return ServerMsgCode2;
4007
4006
  })(ServerMsgCode || {});
4008
4007
 
@@ -4857,8 +4856,8 @@ function createRoom(options, config) {
4857
4856
  }
4858
4857
  break;
4859
4858
  }
4860
- case 300 /* FETCH_DOC */: {
4861
- eventHub.docUpdated.notify(message.data);
4859
+ case 300 /* YDOC_UPDATE */: {
4860
+ eventHub.docUpdated.notify(message.update);
4862
4861
  break;
4863
4862
  }
4864
4863
  case 104 /* ROOM_STATE */: {
@@ -4979,10 +4978,10 @@ ${Array.from(traces).join("\n\n")}`
4979
4978
  }
4980
4979
  return messages;
4981
4980
  }
4982
- function updateDoc(data) {
4981
+ function updateYDoc(update) {
4983
4982
  context.buffer.messages.push({
4984
- type: 301 /* UPDATE_DOC */,
4985
- data
4983
+ type: 301 /* UPDATE_YDOC */,
4984
+ update
4986
4985
  });
4987
4986
  flushNowOrSoon();
4988
4987
  }
@@ -5045,8 +5044,11 @@ ${Array.from(traces).join("\n\n")}`
5045
5044
  };
5046
5045
  });
5047
5046
  }
5048
- function getDoc(vector = "") {
5049
- context.buffer.messages.push({ type: 300 /* FETCH_DOC */, vector });
5047
+ function getYDoc(vector) {
5048
+ context.buffer.messages.push({
5049
+ type: 300 /* FETCH_YDOC_UPDATE */,
5050
+ vector
5051
+ });
5050
5052
  flushNowOrSoon();
5051
5053
  }
5052
5054
  function undo() {
@@ -5206,7 +5208,7 @@ ${Array.from(traces).join("\n\n")}`
5206
5208
  destroy: () => managedSocket.destroy(),
5207
5209
  // Presence
5208
5210
  updatePresence,
5209
- updateDoc,
5211
+ updateYDoc,
5210
5212
  broadcastEvent,
5211
5213
  // Storage
5212
5214
  batch,
@@ -5218,7 +5220,7 @@ ${Array.from(traces).join("\n\n")}`
5218
5220
  pause: pauseHistory,
5219
5221
  resume: resumeHistory
5220
5222
  },
5221
- getDoc,
5223
+ getYDoc,
5222
5224
  getStorage,
5223
5225
  getStorageSnapshot,
5224
5226
  getStorageStatus,
@@ -5334,7 +5336,7 @@ function makeCreateSocketDelegateForRoom(liveblocksServer, WebSocketPolyfill) {
5334
5336
  // @ts-ignore (__PACKAGE_VERSION__ will be injected by the build script)
5335
5337
  true ? (
5336
5338
  /* istanbul ignore next */
5337
- "1.1.0-yjs4"
5339
+ "1.1.0-yjs5"
5338
5340
  ) : "dev"}`
5339
5341
  );
5340
5342
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liveblocks/core",
3
- "version": "1.1.0-yjs4",
3
+ "version": "1.1.0-yjs5",
4
4
  "description": "Shared code and foundational internals for Liveblocks",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",