@liveblocks/core 1.1.0-yjs5 → 1.1.1-dual1

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
@@ -669,31 +669,6 @@ declare type Delegates<T extends BaseAuthResult> = {
669
669
  createSocket: (token: T) => IWebSocketInstance;
670
670
  };
671
671
 
672
- declare type AppOnlyAuthToken = {
673
- appId: string;
674
- roomId?: never;
675
- scopes: string[];
676
- };
677
- declare type RoomAuthToken = {
678
- appId: string;
679
- roomId: string;
680
- scopes: string[];
681
- actor: number;
682
- maxConnectionsPerRoom?: number;
683
- info?: Json;
684
- groupIds?: string[];
685
- } & ({
686
- id: string;
687
- anonymousId?: never;
688
- } | {
689
- id?: never;
690
- anonymousId: string;
691
- });
692
- declare type AuthToken = AppOnlyAuthToken | RoomAuthToken;
693
- declare function isAppOnlyAuthToken(data: JsonObject): data is AppOnlyAuthToken;
694
- declare function isRoomAuthToken(data: JsonObject): data is RoomAuthToken;
695
- declare function isAuthToken(data: JsonObject): data is AuthToken;
696
-
697
672
  declare type ReadonlyArrayWithLegacyMethods<T> = readonly T[] & {
698
673
  /**
699
674
  * @deprecated Prefer the normal .length property on arrays.
@@ -711,11 +686,11 @@ declare function asArrayWithLegacyMethods<T>(arr: readonly T[]): ReadonlyArrayWi
711
686
  */
712
687
  declare type User<TPresence extends JsonObject, TUserMeta extends BaseUserMeta> = {
713
688
  /**
714
- * The connection id of the user. It is unique and increment at every new connection.
689
+ * The connection ID of the User. It is unique and increment at every new connection.
715
690
  */
716
691
  readonly connectionId: number;
717
692
  /**
718
- * The id of the user that has been set in the authentication endpoint.
693
+ * The ID of the User that has been set in the authentication endpoint.
719
694
  * Useful to get additional information about the connected user.
720
695
  */
721
696
  readonly id: TUserMeta["id"];
@@ -724,7 +699,7 @@ declare type User<TPresence extends JsonObject, TUserMeta extends BaseUserMeta>
724
699
  */
725
700
  readonly info: TUserMeta["info"];
726
701
  /**
727
- * The user presence.
702
+ * The user’s presence data.
728
703
  */
729
704
  readonly presence: TPresence;
730
705
  /**
@@ -1079,7 +1054,7 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject, TUs
1079
1054
  }): void;
1080
1055
  /**
1081
1056
  *
1082
- * Sends YJS document updates to liveblocks server
1057
+ * Sends Yjs document updates to liveblocks server
1083
1058
  *
1084
1059
  * @param {string} data the doc update to send to the server, base64 encoded uint8array
1085
1060
  */
@@ -1087,7 +1062,7 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject, TUs
1087
1062
  /**
1088
1063
  * Sends a request for the current document from liveblocks server
1089
1064
  */
1090
- getYDoc(stateVector: string): void;
1065
+ fetchYDoc(stateVector: string): void;
1091
1066
  /**
1092
1067
  * Broadcasts an event to other users in the room. Event broadcasted to the room can be listened with {@link Room.subscribe}("event").
1093
1068
  * @param {any} event the event to broadcast. Should be serializable to JSON
@@ -1145,7 +1120,7 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject, TUs
1145
1120
  */
1146
1121
  readonly storageDidLoad: Observable<void>;
1147
1122
  readonly storageStatus: Observable<StorageStatus>;
1148
- readonly docUpdated: Observable<string>;
1123
+ readonly ydoc: Observable<string>;
1149
1124
  };
1150
1125
  /**
1151
1126
  * Batches modifications made during the given function.
@@ -1469,7 +1444,7 @@ declare enum ClientMsgCode {
1469
1444
  BROADCAST_EVENT = 103,
1470
1445
  FETCH_STORAGE = 200,
1471
1446
  UPDATE_STORAGE = 201,
1472
- FETCH_YDOC_UPDATE = 300,
1447
+ FETCH_YDOC = 300,
1473
1448
  UPDATE_YDOC = 301
1474
1449
  }
1475
1450
  /**
@@ -1514,7 +1489,7 @@ declare type FetchStorageClientMsg = {
1514
1489
  readonly type: ClientMsgCode.FETCH_STORAGE;
1515
1490
  };
1516
1491
  declare type FetchYDocClientMsg = {
1517
- readonly type: ClientMsgCode.FETCH_YDOC_UPDATE;
1492
+ readonly type: ClientMsgCode.FETCH_YDOC;
1518
1493
  readonly vector: string;
1519
1494
  };
1520
1495
  declare type UpdateYDocClientMsg = {
@@ -1571,7 +1546,7 @@ declare enum ServerMsgCode {
1571
1546
  INITIAL_STORAGE_STATE = 200,
1572
1547
  UPDATE_STORAGE = 201,
1573
1548
  REJECT_STORAGE_OP = 299,
1574
- YDOC_UPDATE = 300
1549
+ UPDATE_YDOC = 300
1575
1550
  }
1576
1551
  /**
1577
1552
  * Messages that can be sent from the server to the client.
@@ -1659,8 +1634,12 @@ declare type UserLeftServerMsg = {
1659
1634
  readonly type: ServerMsgCode.USER_LEFT;
1660
1635
  readonly actor: number;
1661
1636
  };
1637
+ /**
1638
+ * Sent by the WebSocket server when the ydoc is updated or when requested based on stateVector passed.
1639
+ * Contains a base64 encoded update
1640
+ */
1662
1641
  declare type YDocUpdate = {
1663
- readonly type: ServerMsgCode.YDOC_UPDATE;
1642
+ readonly type: ServerMsgCode.UPDATE_YDOC;
1664
1643
  readonly update: string;
1665
1644
  };
1666
1645
  /**
@@ -1911,4 +1890,4 @@ declare type EnsureJson<T> = [
1911
1890
  [K in keyof T]: EnsureJson<T[K]>;
1912
1891
  };
1913
1892
 
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 };
1893
+ export { AckOp, 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, 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, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isPlainObject, isRootCrdt, legacy_patchImmutableObject, lsonToJson, makePosition, nn, patchLiveObjectKey, shallow, throwUsageError, toPlainLson, tryParseJson, withTimeout };