@liveblocks/core 1.2.0-internal5 → 1.2.0-test1

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
@@ -1,3 +1,10 @@
1
+ /**
2
+ * Throws an error if multiple copies of a Liveblocks package are being loaded
3
+ * at runtime. This likely indicates a packaging issue with the project.
4
+ */
5
+ declare function detectDupes(pkgName: string, pkgVersion: string | false, // false if not built yet
6
+ pkgFormat: string | false): void;
7
+
1
8
  /**
2
9
  * Represents an indefinitely deep arbitrary JSON data structure. There are
3
10
  * four types that make up the Json family:
@@ -550,6 +557,19 @@ declare type Resolve<T> = T extends (...args: unknown[]) => unknown ? T : {
550
557
  [K in keyof T]: T[K];
551
558
  };
552
559
 
560
+ declare type CustomAuthenticationResult = {
561
+ token: string;
562
+ error?: never;
563
+ } | {
564
+ token?: never;
565
+ error: "forbidden";
566
+ reason: string;
567
+ } | {
568
+ token?: never;
569
+ error: string;
570
+ reason: string;
571
+ };
572
+
553
573
  /**
554
574
  * This type is used by clients to define the metadata for a user.
555
575
  */
@@ -625,14 +645,36 @@ interface IWebSocketInstance {
625
645
  interface IWebSocket {
626
646
  new (address: string): IWebSocketInstance;
627
647
  }
648
+ /**
649
+ * The following ranges will be respected by the client:
650
+ *
651
+ * 40xx: client will disconnect
652
+ * 41xx: client will reauthorize
653
+ * 42xx: client will retry without reauthorizing (currently not used)
654
+ *
655
+ */
628
656
  declare enum WebsocketCloseCodes {
657
+ /** Unexpected error happened with the network/infra level. In spirit akin to HTTP 503 */
629
658
  CLOSE_ABNORMAL = 1006,
659
+ /** Unexpected error happened. In spirit akin to HTTP 500 */
660
+ UNEXPECTED_CONDITION = 1011,
661
+ /** Please back off for now, but try again in a few moments */
662
+ TRY_AGAIN_LATER = 1013,
663
+ /** Message wasn't understood, disconnect */
630
664
  INVALID_MESSAGE_FORMAT = 4000,
665
+ /** Server refused to allow connection. Re-authorizing won't help. Disconnect. In spirit akin to HTTP 403 */
631
666
  NOT_ALLOWED = 4001,
667
+ /** Unused */
632
668
  MAX_NUMBER_OF_MESSAGES_PER_SECONDS = 4002,
669
+ /** Unused */
633
670
  MAX_NUMBER_OF_CONCURRENT_CONNECTIONS = 4003,
671
+ /** Unused */
634
672
  MAX_NUMBER_OF_MESSAGES_PER_DAY_PER_APP = 4004,
673
+ /** Room is full, disconnect */
635
674
  MAX_NUMBER_OF_CONCURRENT_CONNECTIONS_PER_ROOM = 4005,
675
+ /** The auth token is expired, reauthorize to get a fresh one. In spirit akin to HTTP 401 */
676
+ TOKEN_EXPIRED = 4109,
677
+ /** Disconnect immediately */
636
678
  CLOSE_WITHOUT_RETRY = 4999
637
679
  }
638
680
 
@@ -657,7 +699,7 @@ declare type Status = "initial" | "connecting" | "connected" | "reconnecting" |
657
699
  */
658
700
  declare type LostConnectionEvent = "lost" | "restored" | "failed";
659
701
  /**
660
- * Arbitrary record that will be used as the authentication "token". It's the
702
+ * Arbitrary record that will be used as the authentication "authValue". It's the
661
703
  * value that is returned by calling the authentication delegate, and will get
662
704
  * passed to the connection factory delegate. This value will be remembered by
663
705
  * the connection manager, but its value will not be interpreted, so it can be
@@ -666,7 +708,223 @@ declare type LostConnectionEvent = "lost" | "restored" | "failed";
666
708
  declare type BaseAuthResult = NonNullable<Json>;
667
709
  declare type Delegates<T extends BaseAuthResult> = {
668
710
  authenticate: () => Promise<T>;
669
- createSocket: (token: T) => IWebSocketInstance;
711
+ createSocket: (authValue: T) => IWebSocketInstance;
712
+ };
713
+
714
+ declare type IdTuple<T> = [id: string, value: T];
715
+ declare enum CrdtType {
716
+ OBJECT = 0,
717
+ LIST = 1,
718
+ MAP = 2,
719
+ REGISTER = 3
720
+ }
721
+ declare type SerializedCrdt = SerializedRootObject | SerializedChild;
722
+ declare type SerializedChild = SerializedObject | SerializedList | SerializedMap | SerializedRegister;
723
+ declare type SerializedRootObject = {
724
+ readonly type: CrdtType.OBJECT;
725
+ readonly data: JsonObject;
726
+ readonly parentId?: never;
727
+ readonly parentKey?: never;
728
+ };
729
+ declare type SerializedObject = {
730
+ readonly type: CrdtType.OBJECT;
731
+ readonly parentId: string;
732
+ readonly parentKey: string;
733
+ readonly data: JsonObject;
734
+ };
735
+ declare type SerializedList = {
736
+ readonly type: CrdtType.LIST;
737
+ readonly parentId: string;
738
+ readonly parentKey: string;
739
+ };
740
+ declare type SerializedMap = {
741
+ readonly type: CrdtType.MAP;
742
+ readonly parentId: string;
743
+ readonly parentKey: string;
744
+ };
745
+ declare type SerializedRegister = {
746
+ readonly type: CrdtType.REGISTER;
747
+ readonly parentId: string;
748
+ readonly parentKey: string;
749
+ readonly data: Json;
750
+ };
751
+ declare function isRootCrdt(crdt: SerializedCrdt): crdt is SerializedRootObject;
752
+ declare function isChildCrdt(crdt: SerializedCrdt): crdt is SerializedChild;
753
+
754
+ declare enum ServerMsgCode {
755
+ UPDATE_PRESENCE = 100,
756
+ USER_JOINED = 101,
757
+ USER_LEFT = 102,
758
+ BROADCASTED_EVENT = 103,
759
+ ROOM_STATE = 104,
760
+ INITIAL_STORAGE_STATE = 200,
761
+ UPDATE_STORAGE = 201,
762
+ REJECT_STORAGE_OP = 299,
763
+ UPDATE_YDOC = 300
764
+ }
765
+ /**
766
+ * Messages that can be sent from the server to the client.
767
+ */
768
+ 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;
769
+ /**
770
+ * Sent by the WebSocket server and broadcasted to all clients to announce that
771
+ * a User updated their presence. For example, when a user moves their cursor.
772
+ *
773
+ * In most cases, the data payload will only include the fields from the
774
+ * Presence that have been changed since the last announcement. However, after
775
+ * a new user joins a room, a "full presence" will be announced so the newly
776
+ * connected user will get each other's user full presence at least once. In
777
+ * those cases, the `targetActor` field indicates the newly connected client,
778
+ * so all other existing clients can ignore this broadcasted message.
779
+ */
780
+ declare type UpdatePresenceServerMsg<TPresence extends JsonObject> = {
781
+ readonly type: ServerMsgCode.UPDATE_PRESENCE;
782
+ /**
783
+ * The User whose Presence has changed.
784
+ */
785
+ readonly actor: number;
786
+ /**
787
+ * When set, signifies that this is a Full Presence™ update, not a patch.
788
+ *
789
+ * The numeric value itself no longer has specific meaning. Historically,
790
+ * this field was intended so that clients could ignore these broadcasted
791
+ * full presence messages, but it turned out that getting a full presence
792
+ * "keyframe" from time to time was useful.
793
+ *
794
+ * So nowadays, the presence (pun intended) of this `targetActor` field
795
+ * is a backward-compatible way of expressing that the `data` contains
796
+ * all presence fields, and isn't a partial "patch".
797
+ */
798
+ readonly targetActor: number;
799
+ /**
800
+ * The partial or full Presence of a User. If the `targetActor` field is set,
801
+ * this will be the full Presence, otherwise it only contain the fields that
802
+ * have changed since the last broadcast.
803
+ */
804
+ readonly data: TPresence;
805
+ } | {
806
+ readonly type: ServerMsgCode.UPDATE_PRESENCE;
807
+ /**
808
+ * The User whose Presence has changed.
809
+ */
810
+ readonly actor: number;
811
+ /**
812
+ * Not set for partial presence updates.
813
+ */
814
+ readonly targetActor?: undefined;
815
+ /**
816
+ * A partial Presence patch to apply to the User. It will only contain the
817
+ * fields that have changed since the last broadcast.
818
+ */
819
+ readonly data: Partial<TPresence>;
820
+ };
821
+ /**
822
+ * Sent by the WebSocket server and broadcasted to all clients to announce that
823
+ * a new User has joined the Room.
824
+ */
825
+ declare type UserJoinServerMsg<TUserMeta extends BaseUserMeta> = {
826
+ readonly type: ServerMsgCode.USER_JOINED;
827
+ readonly actor: number;
828
+ /**
829
+ * The id of the User that has been set in the authentication endpoint.
830
+ * Useful to get additional information about the connected user.
831
+ */
832
+ readonly id: TUserMeta["id"];
833
+ /**
834
+ * Additional user information that has been set in the authentication
835
+ * endpoint.
836
+ */
837
+ readonly info: TUserMeta["info"];
838
+ /**
839
+ * Informs the client what (public) permissions this (other) User has.
840
+ */
841
+ readonly scopes: string[];
842
+ };
843
+ /**
844
+ * Sent by the WebSocket server and broadcasted to all clients to announce that
845
+ * a new User has left the Room.
846
+ */
847
+ declare type UserLeftServerMsg = {
848
+ readonly type: ServerMsgCode.USER_LEFT;
849
+ readonly actor: number;
850
+ };
851
+ /**
852
+ * Sent by the WebSocket server when the ydoc is updated or when requested based on stateVector passed.
853
+ * Contains a base64 encoded update
854
+ */
855
+ declare type YDocUpdate = {
856
+ readonly type: ServerMsgCode.UPDATE_YDOC;
857
+ readonly update: string;
858
+ readonly isSync: boolean;
859
+ };
860
+ /**
861
+ * Sent by the WebSocket server and broadcasted to all clients to announce that
862
+ * a User broadcasted an Event to everyone in the Room.
863
+ */
864
+ declare type BroadcastedEventServerMsg<TRoomEvent extends Json> = {
865
+ readonly type: ServerMsgCode.BROADCASTED_EVENT;
866
+ /**
867
+ * The User who broadcasted the Event.
868
+ */
869
+ readonly actor: number;
870
+ /**
871
+ * The arbitrary payload of the Event. This can be any JSON value. Clients
872
+ * will have to manually verify/decode this event.
873
+ */
874
+ readonly event: TRoomEvent;
875
+ };
876
+ /**
877
+ * Sent by the WebSocket server to a single client in response to the client
878
+ * joining the Room, to provide the initial state of the Room. The payload
879
+ * includes a list of all other Users that already are in the Room.
880
+ */
881
+ declare type RoomStateServerMsg<TUserMeta extends BaseUserMeta> = {
882
+ readonly type: ServerMsgCode.ROOM_STATE;
883
+ /**
884
+ * Informs the client what their actor ID is going to be.
885
+ * @since v1.2 (WS API v7)
886
+ */
887
+ readonly actor: number;
888
+ /**
889
+ * Informs the client what permissions the current User (self) has.
890
+ * @since v1.2 (WS API v7)
891
+ */
892
+ readonly scopes: string[];
893
+ readonly users: {
894
+ readonly [otherActor: number]: TUserMeta & {
895
+ scopes: string[];
896
+ };
897
+ };
898
+ };
899
+ /**
900
+ * Sent by the WebSocket server to a single client in response to the client
901
+ * joining the Room, to provide the initial Storage state of the Room. The
902
+ * payload includes the entire Storage document.
903
+ */
904
+ declare type InitialDocumentStateServerMsg = {
905
+ readonly type: ServerMsgCode.INITIAL_STORAGE_STATE;
906
+ readonly items: IdTuple<SerializedCrdt>[];
907
+ };
908
+ /**
909
+ * Sent by the WebSocket server and broadcasted to all clients to announce that
910
+ * a change occurred in the Storage document.
911
+ *
912
+ * The payload of this message contains a list of Ops (aka incremental
913
+ * mutations to make to the initially loaded document).
914
+ */
915
+ declare type UpdateStorageServerMsg = {
916
+ readonly type: ServerMsgCode.UPDATE_STORAGE;
917
+ readonly ops: Op[];
918
+ };
919
+ /**
920
+ * Sent by the WebSocket server to the client to indicate that certain opIds
921
+ * have been received but were rejected because they caused mutations that are
922
+ * incompatible with the Room's schema.
923
+ */
924
+ declare type RejectedStorageOpServerMsg = {
925
+ readonly type: ServerMsgCode.REJECT_STORAGE_OP;
926
+ readonly opIds: string[];
927
+ readonly reason: string;
670
928
  };
671
929
 
672
930
  declare type ReadonlyArrayWithLegacyMethods<T> = readonly T[] & {
@@ -703,9 +961,16 @@ declare type User<TPresence extends JsonObject, TUserMeta extends BaseUserMeta>
703
961
  */
704
962
  readonly presence: TPresence;
705
963
  /**
706
- * False if the user can modify the room storage, true otherwise.
964
+ * @deprecated Use `!user.canWrite` instead.
965
+ * False if the user can mutate the Room’s Storage and/or YDoc, true if they
966
+ * can only read but not mutate it.
707
967
  */
708
968
  readonly isReadOnly: boolean;
969
+ /**
970
+ * True if the user can mutate the Room’s Storage and/or YDoc, false if they
971
+ * can only read but not mutate it.
972
+ */
973
+ readonly canWrite: boolean;
709
974
  };
710
975
 
711
976
  /**
@@ -978,11 +1243,6 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject, TUs
978
1243
  * The id of the room.
979
1244
  */
980
1245
  readonly id: string;
981
- /**
982
- * A client is considered "self aware" if it knows its own
983
- * metadata and connection ID (from the auth server).
984
- */
985
- isSelfAware(): boolean;
986
1246
  /**
987
1247
  * @deprecated This API will be removed in a future version of Liveblocks.
988
1248
  * Prefer using `.getStatus()` instead.
@@ -1098,6 +1358,7 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject, TUs
1098
1358
  */
1099
1359
  getStorageSnapshot(): LiveObject<TStorage> | null;
1100
1360
  readonly events: {
1361
+ /** @deprecated Prefer `status` instead. */
1101
1362
  readonly connection: Observable<LegacyConnectionStatus>;
1102
1363
  readonly status: Observable<Status>;
1103
1364
  readonly lostConnection: Observable<LostConnectionEvent>;
@@ -1105,7 +1366,8 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject, TUs
1105
1366
  connectionId: number;
1106
1367
  event: TRoomEvent;
1107
1368
  }>;
1108
- readonly me: Observable<TPresence>;
1369
+ readonly self: Observable<User<TPresence, TUserMeta>>;
1370
+ readonly myPresence: Observable<TPresence>;
1109
1371
  readonly others: Observable<{
1110
1372
  others: Others<TPresence, TUserMeta>;
1111
1373
  event: OthersEvent<TPresence, TUserMeta>;
@@ -1120,7 +1382,7 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject, TUs
1120
1382
  */
1121
1383
  readonly storageDidLoad: Observable<void>;
1122
1384
  readonly storageStatus: Observable<StorageStatus>;
1123
- readonly ydoc: Observable<string>;
1385
+ readonly ydoc: Observable<YDocUpdate>;
1124
1386
  };
1125
1387
  /**
1126
1388
  * Batches modifications made during the given function.
@@ -1205,9 +1467,7 @@ declare type Client = {
1205
1467
  */
1206
1468
  leave(roomId: string): void;
1207
1469
  };
1208
- declare type AuthEndpoint = string | ((room: string) => Promise<{
1209
- token: string;
1210
- }>);
1470
+ declare type AuthEndpoint = string | ((room: string) => Promise<CustomAuthenticationResult>);
1211
1471
  /**
1212
1472
  * The authentication endpoint that is called to ensure that the current user has access to a room.
1213
1473
  * Can be an url or a callback if you need to add additional headers.
@@ -1497,221 +1757,6 @@ declare type UpdateYDocClientMsg = {
1497
1757
  readonly update: string;
1498
1758
  };
1499
1759
 
1500
- declare type IdTuple<T> = [id: string, value: T];
1501
- declare enum CrdtType {
1502
- OBJECT = 0,
1503
- LIST = 1,
1504
- MAP = 2,
1505
- REGISTER = 3
1506
- }
1507
- declare type SerializedCrdt = SerializedRootObject | SerializedChild;
1508
- declare type SerializedChild = SerializedObject | SerializedList | SerializedMap | SerializedRegister;
1509
- declare type SerializedRootObject = {
1510
- readonly type: CrdtType.OBJECT;
1511
- readonly data: JsonObject;
1512
- readonly parentId?: never;
1513
- readonly parentKey?: never;
1514
- };
1515
- declare type SerializedObject = {
1516
- readonly type: CrdtType.OBJECT;
1517
- readonly parentId: string;
1518
- readonly parentKey: string;
1519
- readonly data: JsonObject;
1520
- };
1521
- declare type SerializedList = {
1522
- readonly type: CrdtType.LIST;
1523
- readonly parentId: string;
1524
- readonly parentKey: string;
1525
- };
1526
- declare type SerializedMap = {
1527
- readonly type: CrdtType.MAP;
1528
- readonly parentId: string;
1529
- readonly parentKey: string;
1530
- };
1531
- declare type SerializedRegister = {
1532
- readonly type: CrdtType.REGISTER;
1533
- readonly parentId: string;
1534
- readonly parentKey: string;
1535
- readonly data: Json;
1536
- };
1537
- declare function isRootCrdt(crdt: SerializedCrdt): crdt is SerializedRootObject;
1538
- declare function isChildCrdt(crdt: SerializedCrdt): crdt is SerializedChild;
1539
-
1540
- declare enum ServerMsgCode {
1541
- UPDATE_PRESENCE = 100,
1542
- USER_JOINED = 101,
1543
- USER_LEFT = 102,
1544
- BROADCASTED_EVENT = 103,
1545
- ROOM_STATE = 104,
1546
- INITIAL_STORAGE_STATE = 200,
1547
- UPDATE_STORAGE = 201,
1548
- REJECT_STORAGE_OP = 299,
1549
- UPDATE_YDOC = 300
1550
- }
1551
- /**
1552
- * Messages that can be sent from the server to the client.
1553
- */
1554
- 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;
1555
- /**
1556
- * Sent by the WebSocket server and broadcasted to all clients to announce that
1557
- * a User updated their presence. For example, when a user moves their cursor.
1558
- *
1559
- * In most cases, the data payload will only include the fields from the
1560
- * Presence that have been changed since the last announcement. However, after
1561
- * a new user joins a room, a "full presence" will be announced so the newly
1562
- * connected user will get each other's user full presence at least once. In
1563
- * those cases, the `targetActor` field indicates the newly connected client,
1564
- * so all other existing clients can ignore this broadcasted message.
1565
- */
1566
- declare type UpdatePresenceServerMsg<TPresence extends JsonObject> = {
1567
- readonly type: ServerMsgCode.UPDATE_PRESENCE;
1568
- /**
1569
- * The User whose Presence has changed.
1570
- */
1571
- readonly actor: number;
1572
- /**
1573
- * When set, signifies that this is a Full Presence™ update, not a patch.
1574
- *
1575
- * The numeric value itself no longer has specific meaning. Historically,
1576
- * this field was intended so that clients could ignore these broadcasted
1577
- * full presence messages, but it turned out that getting a full presence
1578
- * "keyframe" from time to time was useful.
1579
- *
1580
- * So nowadays, the presence (pun intended) of this `targetActor` field
1581
- * is a backward-compatible way of expressing that the `data` contains
1582
- * all presence fields, and isn't a partial "patch".
1583
- */
1584
- readonly targetActor: number;
1585
- /**
1586
- * The partial or full Presence of a User. If the `targetActor` field is set,
1587
- * this will be the full Presence, otherwise it only contain the fields that
1588
- * have changed since the last broadcast.
1589
- */
1590
- readonly data: TPresence;
1591
- } | {
1592
- readonly type: ServerMsgCode.UPDATE_PRESENCE;
1593
- /**
1594
- * The User whose Presence has changed.
1595
- */
1596
- readonly actor: number;
1597
- /**
1598
- * Not set for partial presence updates.
1599
- */
1600
- readonly targetActor?: undefined;
1601
- /**
1602
- * A partial Presence patch to apply to the User. It will only contain the
1603
- * fields that have changed since the last broadcast.
1604
- */
1605
- readonly data: Partial<TPresence>;
1606
- };
1607
- /**
1608
- * Sent by the WebSocket server and broadcasted to all clients to announce that
1609
- * a new User has joined the Room.
1610
- */
1611
- declare type UserJoinServerMsg<TUserMeta extends BaseUserMeta> = {
1612
- readonly type: ServerMsgCode.USER_JOINED;
1613
- readonly actor: number;
1614
- /**
1615
- * The id of the User that has been set in the authentication endpoint.
1616
- * Useful to get additional information about the connected user.
1617
- */
1618
- readonly id: TUserMeta["id"];
1619
- /**
1620
- * Additional user information that has been set in the authentication
1621
- * endpoint.
1622
- */
1623
- readonly info: TUserMeta["info"];
1624
- /**
1625
- * Permissions that the user has in the Room.
1626
- */
1627
- readonly scopes: string[];
1628
- };
1629
- /**
1630
- * Sent by the WebSocket server and broadcasted to all clients to announce that
1631
- * a new User has left the Room.
1632
- */
1633
- declare type UserLeftServerMsg = {
1634
- readonly type: ServerMsgCode.USER_LEFT;
1635
- readonly actor: number;
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
- */
1641
- declare type YDocUpdate = {
1642
- readonly type: ServerMsgCode.UPDATE_YDOC;
1643
- readonly update: string;
1644
- };
1645
- /**
1646
- * Sent by the WebSocket server and broadcasted to all clients to announce that
1647
- * a User broadcasted an Event to everyone in the Room.
1648
- */
1649
- declare type BroadcastedEventServerMsg<TRoomEvent extends Json> = {
1650
- readonly type: ServerMsgCode.BROADCASTED_EVENT;
1651
- /**
1652
- * The User who broadcasted the Event.
1653
- */
1654
- readonly actor: number;
1655
- /**
1656
- * The arbitrary payload of the Event. This can be any JSON value. Clients
1657
- * will have to manually verify/decode this event.
1658
- */
1659
- readonly event: TRoomEvent;
1660
- };
1661
- /**
1662
- * Sent by the WebSocket server to a single client in response to the client
1663
- * joining the Room, to provide the initial state of the Room. The payload
1664
- * includes a list of all other Users that already are in the Room.
1665
- */
1666
- declare type RoomStateServerMsg<TUserMeta extends BaseUserMeta> = {
1667
- readonly type: ServerMsgCode.ROOM_STATE;
1668
- /**
1669
- * Informs the client what their actor ID is going to be.
1670
- * @since v1.2 (WS API v7)
1671
- */
1672
- readonly actor: number;
1673
- /**
1674
- * Informs the client what permissions the current User (self) has.
1675
- * @since v1.2 (WS API v7)
1676
- */
1677
- readonly scopes: string[];
1678
- readonly users: {
1679
- readonly [actor: number]: TUserMeta & {
1680
- scopes: string[];
1681
- };
1682
- };
1683
- };
1684
- /**
1685
- * Sent by the WebSocket server to a single client in response to the client
1686
- * joining the Room, to provide the initial Storage state of the Room. The
1687
- * payload includes the entire Storage document.
1688
- */
1689
- declare type InitialDocumentStateServerMsg = {
1690
- readonly type: ServerMsgCode.INITIAL_STORAGE_STATE;
1691
- readonly items: IdTuple<SerializedCrdt>[];
1692
- };
1693
- /**
1694
- * Sent by the WebSocket server and broadcasted to all clients to announce that
1695
- * a change occurred in the Storage document.
1696
- *
1697
- * The payload of this message contains a list of Ops (aka incremental
1698
- * mutations to make to the initially loaded document).
1699
- */
1700
- declare type UpdateStorageServerMsg = {
1701
- readonly type: ServerMsgCode.UPDATE_STORAGE;
1702
- readonly ops: Op[];
1703
- };
1704
- /**
1705
- * Sent by the WebSocket server to the client to indicate that certain opIds
1706
- * have been received but were rejected because they caused mutations that are
1707
- * incompatible with the Room's schema.
1708
- */
1709
- declare type RejectedStorageOpServerMsg = {
1710
- readonly type: ServerMsgCode.REJECT_STORAGE_OP;
1711
- readonly opIds: string[];
1712
- readonly reason: string;
1713
- };
1714
-
1715
1760
  /**
1716
1761
  * Lookup table for nodes (= SerializedCrdt values) by their IDs.
1717
1762
  */
@@ -1875,19 +1920,6 @@ declare namespace protocol {
1875
1920
  };
1876
1921
  }
1877
1922
 
1878
- /**
1879
- * PRIVATE / INTERNAL APIS
1880
- * -----------------------
1881
- *
1882
- * This module is intended for internal use only, PLEASE DO NOT RELY ON ANY OF
1883
- * THE EXPORTS IN HERE. These are implementation details that can change at any
1884
- * time and without announcement. This module purely exists to share code
1885
- * between the several Liveblocks packages.
1886
- *
1887
- * But since you're so deep inside Liveblocks code... we're hiring!
1888
- * https://join.team/liveblocks ;)
1889
- */
1890
-
1891
1923
  /**
1892
1924
  * Helper type to help users adopt to Lson types from interface definitions.
1893
1925
  * You should only use this to wrap interfaces you don't control. For more
@@ -1900,4 +1932,4 @@ declare type EnsureJson<T> = [
1900
1932
  [K in keyof T]: EnsureJson<T[K]>;
1901
1933
  };
1902
1934
 
1903
- 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 };
1935
+ export { AckOp, BaseAuthResult, BaseUserMeta, BroadcastEventClientMsg, BroadcastOptions, BroadcastedEventServerMsg, Client, ClientMsg, ClientMsgCode, CrdtType, CreateChildOp, CreateListOp, CreateMapOp, CreateObjectOp, CreateOp, CreateRegisterOp, CreateRootObjectOp, CustomAuthenticationResult, 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, detectDupes, errorIf, freeze, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isPlainObject, isRootCrdt, legacy_patchImmutableObject, lsonToJson, makePosition, nn, patchLiveObjectKey, shallow, throwUsageError, toPlainLson, tryParseJson, withTimeout };