@liveblocks/core 1.1.6 → 1.1.8
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 +224 -211
- package/dist/index.d.ts +224 -211
- package/dist/index.js +43 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +43 -20
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -557,6 +557,19 @@ declare type Resolve<T> = T extends (...args: unknown[]) => unknown ? T : {
|
|
|
557
557
|
[K in keyof T]: T[K];
|
|
558
558
|
};
|
|
559
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
|
+
|
|
560
573
|
/**
|
|
561
574
|
* This type is used by clients to define the metadata for a user.
|
|
562
575
|
*/
|
|
@@ -676,6 +689,212 @@ declare type Delegates<T extends BaseAuthResult> = {
|
|
|
676
689
|
createSocket: (token: T) => IWebSocketInstance;
|
|
677
690
|
};
|
|
678
691
|
|
|
692
|
+
declare type IdTuple<T> = [id: string, value: T];
|
|
693
|
+
declare enum CrdtType {
|
|
694
|
+
OBJECT = 0,
|
|
695
|
+
LIST = 1,
|
|
696
|
+
MAP = 2,
|
|
697
|
+
REGISTER = 3
|
|
698
|
+
}
|
|
699
|
+
declare type SerializedCrdt = SerializedRootObject | SerializedChild;
|
|
700
|
+
declare type SerializedChild = SerializedObject | SerializedList | SerializedMap | SerializedRegister;
|
|
701
|
+
declare type SerializedRootObject = {
|
|
702
|
+
readonly type: CrdtType.OBJECT;
|
|
703
|
+
readonly data: JsonObject;
|
|
704
|
+
readonly parentId?: never;
|
|
705
|
+
readonly parentKey?: never;
|
|
706
|
+
};
|
|
707
|
+
declare type SerializedObject = {
|
|
708
|
+
readonly type: CrdtType.OBJECT;
|
|
709
|
+
readonly parentId: string;
|
|
710
|
+
readonly parentKey: string;
|
|
711
|
+
readonly data: JsonObject;
|
|
712
|
+
};
|
|
713
|
+
declare type SerializedList = {
|
|
714
|
+
readonly type: CrdtType.LIST;
|
|
715
|
+
readonly parentId: string;
|
|
716
|
+
readonly parentKey: string;
|
|
717
|
+
};
|
|
718
|
+
declare type SerializedMap = {
|
|
719
|
+
readonly type: CrdtType.MAP;
|
|
720
|
+
readonly parentId: string;
|
|
721
|
+
readonly parentKey: string;
|
|
722
|
+
};
|
|
723
|
+
declare type SerializedRegister = {
|
|
724
|
+
readonly type: CrdtType.REGISTER;
|
|
725
|
+
readonly parentId: string;
|
|
726
|
+
readonly parentKey: string;
|
|
727
|
+
readonly data: Json;
|
|
728
|
+
};
|
|
729
|
+
declare function isRootCrdt(crdt: SerializedCrdt): crdt is SerializedRootObject;
|
|
730
|
+
declare function isChildCrdt(crdt: SerializedCrdt): crdt is SerializedChild;
|
|
731
|
+
|
|
732
|
+
declare enum ServerMsgCode {
|
|
733
|
+
UPDATE_PRESENCE = 100,
|
|
734
|
+
USER_JOINED = 101,
|
|
735
|
+
USER_LEFT = 102,
|
|
736
|
+
BROADCASTED_EVENT = 103,
|
|
737
|
+
ROOM_STATE = 104,
|
|
738
|
+
INITIAL_STORAGE_STATE = 200,
|
|
739
|
+
UPDATE_STORAGE = 201,
|
|
740
|
+
REJECT_STORAGE_OP = 299,
|
|
741
|
+
UPDATE_YDOC = 300
|
|
742
|
+
}
|
|
743
|
+
/**
|
|
744
|
+
* Messages that can be sent from the server to the client.
|
|
745
|
+
*/
|
|
746
|
+
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;
|
|
747
|
+
/**
|
|
748
|
+
* Sent by the WebSocket server and broadcasted to all clients to announce that
|
|
749
|
+
* a User updated their presence. For example, when a user moves their cursor.
|
|
750
|
+
*
|
|
751
|
+
* In most cases, the data payload will only include the fields from the
|
|
752
|
+
* Presence that have been changed since the last announcement. However, after
|
|
753
|
+
* a new user joins a room, a "full presence" will be announced so the newly
|
|
754
|
+
* connected user will get each other's user full presence at least once. In
|
|
755
|
+
* those cases, the `targetActor` field indicates the newly connected client,
|
|
756
|
+
* so all other existing clients can ignore this broadcasted message.
|
|
757
|
+
*/
|
|
758
|
+
declare type UpdatePresenceServerMsg<TPresence extends JsonObject> = {
|
|
759
|
+
readonly type: ServerMsgCode.UPDATE_PRESENCE;
|
|
760
|
+
/**
|
|
761
|
+
* The User whose Presence has changed.
|
|
762
|
+
*/
|
|
763
|
+
readonly actor: number;
|
|
764
|
+
/**
|
|
765
|
+
* When set, signifies that this is a Full Presence™ update, not a patch.
|
|
766
|
+
*
|
|
767
|
+
* The numeric value itself no longer has specific meaning. Historically,
|
|
768
|
+
* this field was intended so that clients could ignore these broadcasted
|
|
769
|
+
* full presence messages, but it turned out that getting a full presence
|
|
770
|
+
* "keyframe" from time to time was useful.
|
|
771
|
+
*
|
|
772
|
+
* So nowadays, the presence (pun intended) of this `targetActor` field
|
|
773
|
+
* is a backward-compatible way of expressing that the `data` contains
|
|
774
|
+
* all presence fields, and isn't a partial "patch".
|
|
775
|
+
*/
|
|
776
|
+
readonly targetActor: number;
|
|
777
|
+
/**
|
|
778
|
+
* The partial or full Presence of a User. If the `targetActor` field is set,
|
|
779
|
+
* this will be the full Presence, otherwise it only contain the fields that
|
|
780
|
+
* have changed since the last broadcast.
|
|
781
|
+
*/
|
|
782
|
+
readonly data: TPresence;
|
|
783
|
+
} | {
|
|
784
|
+
readonly type: ServerMsgCode.UPDATE_PRESENCE;
|
|
785
|
+
/**
|
|
786
|
+
* The User whose Presence has changed.
|
|
787
|
+
*/
|
|
788
|
+
readonly actor: number;
|
|
789
|
+
/**
|
|
790
|
+
* Not set for partial presence updates.
|
|
791
|
+
*/
|
|
792
|
+
readonly targetActor?: undefined;
|
|
793
|
+
/**
|
|
794
|
+
* A partial Presence patch to apply to the User. It will only contain the
|
|
795
|
+
* fields that have changed since the last broadcast.
|
|
796
|
+
*/
|
|
797
|
+
readonly data: Partial<TPresence>;
|
|
798
|
+
};
|
|
799
|
+
/**
|
|
800
|
+
* Sent by the WebSocket server and broadcasted to all clients to announce that
|
|
801
|
+
* a new User has joined the Room.
|
|
802
|
+
*/
|
|
803
|
+
declare type UserJoinServerMsg<TUserMeta extends BaseUserMeta> = {
|
|
804
|
+
readonly type: ServerMsgCode.USER_JOINED;
|
|
805
|
+
readonly actor: number;
|
|
806
|
+
/**
|
|
807
|
+
* The id of the User that has been set in the authentication endpoint.
|
|
808
|
+
* Useful to get additional information about the connected user.
|
|
809
|
+
*/
|
|
810
|
+
readonly id: TUserMeta["id"];
|
|
811
|
+
/**
|
|
812
|
+
* Additional user information that has been set in the authentication
|
|
813
|
+
* endpoint.
|
|
814
|
+
*/
|
|
815
|
+
readonly info: TUserMeta["info"];
|
|
816
|
+
/**
|
|
817
|
+
* Permissions that the user has in the Room.
|
|
818
|
+
*/
|
|
819
|
+
readonly scopes: string[];
|
|
820
|
+
};
|
|
821
|
+
/**
|
|
822
|
+
* Sent by the WebSocket server and broadcasted to all clients to announce that
|
|
823
|
+
* a new User has left the Room.
|
|
824
|
+
*/
|
|
825
|
+
declare type UserLeftServerMsg = {
|
|
826
|
+
readonly type: ServerMsgCode.USER_LEFT;
|
|
827
|
+
readonly actor: number;
|
|
828
|
+
};
|
|
829
|
+
/**
|
|
830
|
+
* Sent by the WebSocket server when the ydoc is updated or when requested based on stateVector passed.
|
|
831
|
+
* Contains a base64 encoded update
|
|
832
|
+
*/
|
|
833
|
+
declare type YDocUpdate = {
|
|
834
|
+
readonly type: ServerMsgCode.UPDATE_YDOC;
|
|
835
|
+
readonly update: string;
|
|
836
|
+
readonly isSync: boolean;
|
|
837
|
+
};
|
|
838
|
+
/**
|
|
839
|
+
* Sent by the WebSocket server and broadcasted to all clients to announce that
|
|
840
|
+
* a User broadcasted an Event to everyone in the Room.
|
|
841
|
+
*/
|
|
842
|
+
declare type BroadcastedEventServerMsg<TRoomEvent extends Json> = {
|
|
843
|
+
readonly type: ServerMsgCode.BROADCASTED_EVENT;
|
|
844
|
+
/**
|
|
845
|
+
* The User who broadcasted the Event.
|
|
846
|
+
*/
|
|
847
|
+
readonly actor: number;
|
|
848
|
+
/**
|
|
849
|
+
* The arbitrary payload of the Event. This can be any JSON value. Clients
|
|
850
|
+
* will have to manually verify/decode this event.
|
|
851
|
+
*/
|
|
852
|
+
readonly event: TRoomEvent;
|
|
853
|
+
};
|
|
854
|
+
/**
|
|
855
|
+
* Sent by the WebSocket server to a single client in response to the client
|
|
856
|
+
* joining the Room, to provide the initial state of the Room. The payload
|
|
857
|
+
* includes a list of all other Users that already are in the Room.
|
|
858
|
+
*/
|
|
859
|
+
declare type RoomStateServerMsg<TUserMeta extends BaseUserMeta> = {
|
|
860
|
+
readonly type: ServerMsgCode.ROOM_STATE;
|
|
861
|
+
readonly users: {
|
|
862
|
+
readonly [actor: number]: TUserMeta & {
|
|
863
|
+
scopes: string[];
|
|
864
|
+
};
|
|
865
|
+
};
|
|
866
|
+
};
|
|
867
|
+
/**
|
|
868
|
+
* Sent by the WebSocket server to a single client in response to the client
|
|
869
|
+
* joining the Room, to provide the initial Storage state of the Room. The
|
|
870
|
+
* payload includes the entire Storage document.
|
|
871
|
+
*/
|
|
872
|
+
declare type InitialDocumentStateServerMsg = {
|
|
873
|
+
readonly type: ServerMsgCode.INITIAL_STORAGE_STATE;
|
|
874
|
+
readonly items: IdTuple<SerializedCrdt>[];
|
|
875
|
+
};
|
|
876
|
+
/**
|
|
877
|
+
* Sent by the WebSocket server and broadcasted to all clients to announce that
|
|
878
|
+
* a change occurred in the Storage document.
|
|
879
|
+
*
|
|
880
|
+
* The payload of this message contains a list of Ops (aka incremental
|
|
881
|
+
* mutations to make to the initially loaded document).
|
|
882
|
+
*/
|
|
883
|
+
declare type UpdateStorageServerMsg = {
|
|
884
|
+
readonly type: ServerMsgCode.UPDATE_STORAGE;
|
|
885
|
+
readonly ops: Op[];
|
|
886
|
+
};
|
|
887
|
+
/**
|
|
888
|
+
* Sent by the WebSocket server to the client to indicate that certain opIds
|
|
889
|
+
* have been received but were rejected because they caused mutations that are
|
|
890
|
+
* incompatible with the Room's schema.
|
|
891
|
+
*/
|
|
892
|
+
declare type RejectedStorageOpServerMsg = {
|
|
893
|
+
readonly type: ServerMsgCode.REJECT_STORAGE_OP;
|
|
894
|
+
readonly opIds: string[];
|
|
895
|
+
readonly reason: string;
|
|
896
|
+
};
|
|
897
|
+
|
|
679
898
|
declare type ReadonlyArrayWithLegacyMethods<T> = readonly T[] & {
|
|
680
899
|
/**
|
|
681
900
|
* @deprecated Prefer the normal .length property on arrays.
|
|
@@ -1112,7 +1331,8 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject, TUs
|
|
|
1112
1331
|
connectionId: number;
|
|
1113
1332
|
event: TRoomEvent;
|
|
1114
1333
|
}>;
|
|
1115
|
-
readonly
|
|
1334
|
+
readonly self: Observable<User<TPresence, TUserMeta>>;
|
|
1335
|
+
readonly myPresence: Observable<TPresence>;
|
|
1116
1336
|
readonly others: Observable<{
|
|
1117
1337
|
others: Others<TPresence, TUserMeta>;
|
|
1118
1338
|
event: OthersEvent<TPresence, TUserMeta>;
|
|
@@ -1127,7 +1347,7 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject, TUs
|
|
|
1127
1347
|
*/
|
|
1128
1348
|
readonly storageDidLoad: Observable<void>;
|
|
1129
1349
|
readonly storageStatus: Observable<StorageStatus>;
|
|
1130
|
-
readonly ydoc: Observable<
|
|
1350
|
+
readonly ydoc: Observable<YDocUpdate>;
|
|
1131
1351
|
};
|
|
1132
1352
|
/**
|
|
1133
1353
|
* Batches modifications made during the given function.
|
|
@@ -1212,9 +1432,7 @@ declare type Client = {
|
|
|
1212
1432
|
*/
|
|
1213
1433
|
leave(roomId: string): void;
|
|
1214
1434
|
};
|
|
1215
|
-
declare type AuthEndpoint = string | ((room: string) => Promise<
|
|
1216
|
-
token: string;
|
|
1217
|
-
}>);
|
|
1435
|
+
declare type AuthEndpoint = string | ((room: string) => Promise<CustomAuthenticationResult>);
|
|
1218
1436
|
/**
|
|
1219
1437
|
* The authentication endpoint that is called to ensure that the current user has access to a room.
|
|
1220
1438
|
* Can be an url or a callback if you need to add additional headers.
|
|
@@ -1504,211 +1722,6 @@ declare type UpdateYDocClientMsg = {
|
|
|
1504
1722
|
readonly update: string;
|
|
1505
1723
|
};
|
|
1506
1724
|
|
|
1507
|
-
declare type IdTuple<T> = [id: string, value: T];
|
|
1508
|
-
declare enum CrdtType {
|
|
1509
|
-
OBJECT = 0,
|
|
1510
|
-
LIST = 1,
|
|
1511
|
-
MAP = 2,
|
|
1512
|
-
REGISTER = 3
|
|
1513
|
-
}
|
|
1514
|
-
declare type SerializedCrdt = SerializedRootObject | SerializedChild;
|
|
1515
|
-
declare type SerializedChild = SerializedObject | SerializedList | SerializedMap | SerializedRegister;
|
|
1516
|
-
declare type SerializedRootObject = {
|
|
1517
|
-
readonly type: CrdtType.OBJECT;
|
|
1518
|
-
readonly data: JsonObject;
|
|
1519
|
-
readonly parentId?: never;
|
|
1520
|
-
readonly parentKey?: never;
|
|
1521
|
-
};
|
|
1522
|
-
declare type SerializedObject = {
|
|
1523
|
-
readonly type: CrdtType.OBJECT;
|
|
1524
|
-
readonly parentId: string;
|
|
1525
|
-
readonly parentKey: string;
|
|
1526
|
-
readonly data: JsonObject;
|
|
1527
|
-
};
|
|
1528
|
-
declare type SerializedList = {
|
|
1529
|
-
readonly type: CrdtType.LIST;
|
|
1530
|
-
readonly parentId: string;
|
|
1531
|
-
readonly parentKey: string;
|
|
1532
|
-
};
|
|
1533
|
-
declare type SerializedMap = {
|
|
1534
|
-
readonly type: CrdtType.MAP;
|
|
1535
|
-
readonly parentId: string;
|
|
1536
|
-
readonly parentKey: string;
|
|
1537
|
-
};
|
|
1538
|
-
declare type SerializedRegister = {
|
|
1539
|
-
readonly type: CrdtType.REGISTER;
|
|
1540
|
-
readonly parentId: string;
|
|
1541
|
-
readonly parentKey: string;
|
|
1542
|
-
readonly data: Json;
|
|
1543
|
-
};
|
|
1544
|
-
declare function isRootCrdt(crdt: SerializedCrdt): crdt is SerializedRootObject;
|
|
1545
|
-
declare function isChildCrdt(crdt: SerializedCrdt): crdt is SerializedChild;
|
|
1546
|
-
|
|
1547
|
-
declare enum ServerMsgCode {
|
|
1548
|
-
UPDATE_PRESENCE = 100,
|
|
1549
|
-
USER_JOINED = 101,
|
|
1550
|
-
USER_LEFT = 102,
|
|
1551
|
-
BROADCASTED_EVENT = 103,
|
|
1552
|
-
ROOM_STATE = 104,
|
|
1553
|
-
INITIAL_STORAGE_STATE = 200,
|
|
1554
|
-
UPDATE_STORAGE = 201,
|
|
1555
|
-
REJECT_STORAGE_OP = 299,
|
|
1556
|
-
UPDATE_YDOC = 300
|
|
1557
|
-
}
|
|
1558
|
-
/**
|
|
1559
|
-
* Messages that can be sent from the server to the client.
|
|
1560
|
-
*/
|
|
1561
|
-
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;
|
|
1562
|
-
/**
|
|
1563
|
-
* Sent by the WebSocket server and broadcasted to all clients to announce that
|
|
1564
|
-
* a User updated their presence. For example, when a user moves their cursor.
|
|
1565
|
-
*
|
|
1566
|
-
* In most cases, the data payload will only include the fields from the
|
|
1567
|
-
* Presence that have been changed since the last announcement. However, after
|
|
1568
|
-
* a new user joins a room, a "full presence" will be announced so the newly
|
|
1569
|
-
* connected user will get each other's user full presence at least once. In
|
|
1570
|
-
* those cases, the `targetActor` field indicates the newly connected client,
|
|
1571
|
-
* so all other existing clients can ignore this broadcasted message.
|
|
1572
|
-
*/
|
|
1573
|
-
declare type UpdatePresenceServerMsg<TPresence extends JsonObject> = {
|
|
1574
|
-
readonly type: ServerMsgCode.UPDATE_PRESENCE;
|
|
1575
|
-
/**
|
|
1576
|
-
* The User whose Presence has changed.
|
|
1577
|
-
*/
|
|
1578
|
-
readonly actor: number;
|
|
1579
|
-
/**
|
|
1580
|
-
* When set, signifies that this is a Full Presence™ update, not a patch.
|
|
1581
|
-
*
|
|
1582
|
-
* The numeric value itself no longer has specific meaning. Historically,
|
|
1583
|
-
* this field was intended so that clients could ignore these broadcasted
|
|
1584
|
-
* full presence messages, but it turned out that getting a full presence
|
|
1585
|
-
* "keyframe" from time to time was useful.
|
|
1586
|
-
*
|
|
1587
|
-
* So nowadays, the presence (pun intended) of this `targetActor` field
|
|
1588
|
-
* is a backward-compatible way of expressing that the `data` contains
|
|
1589
|
-
* all presence fields, and isn't a partial "patch".
|
|
1590
|
-
*/
|
|
1591
|
-
readonly targetActor: number;
|
|
1592
|
-
/**
|
|
1593
|
-
* The partial or full Presence of a User. If the `targetActor` field is set,
|
|
1594
|
-
* this will be the full Presence, otherwise it only contain the fields that
|
|
1595
|
-
* have changed since the last broadcast.
|
|
1596
|
-
*/
|
|
1597
|
-
readonly data: TPresence;
|
|
1598
|
-
} | {
|
|
1599
|
-
readonly type: ServerMsgCode.UPDATE_PRESENCE;
|
|
1600
|
-
/**
|
|
1601
|
-
* The User whose Presence has changed.
|
|
1602
|
-
*/
|
|
1603
|
-
readonly actor: number;
|
|
1604
|
-
/**
|
|
1605
|
-
* Not set for partial presence updates.
|
|
1606
|
-
*/
|
|
1607
|
-
readonly targetActor?: undefined;
|
|
1608
|
-
/**
|
|
1609
|
-
* A partial Presence patch to apply to the User. It will only contain the
|
|
1610
|
-
* fields that have changed since the last broadcast.
|
|
1611
|
-
*/
|
|
1612
|
-
readonly data: Partial<TPresence>;
|
|
1613
|
-
};
|
|
1614
|
-
/**
|
|
1615
|
-
* Sent by the WebSocket server and broadcasted to all clients to announce that
|
|
1616
|
-
* a new User has joined the Room.
|
|
1617
|
-
*/
|
|
1618
|
-
declare type UserJoinServerMsg<TUserMeta extends BaseUserMeta> = {
|
|
1619
|
-
readonly type: ServerMsgCode.USER_JOINED;
|
|
1620
|
-
readonly actor: number;
|
|
1621
|
-
/**
|
|
1622
|
-
* The id of the User that has been set in the authentication endpoint.
|
|
1623
|
-
* Useful to get additional information about the connected user.
|
|
1624
|
-
*/
|
|
1625
|
-
readonly id: TUserMeta["id"];
|
|
1626
|
-
/**
|
|
1627
|
-
* Additional user information that has been set in the authentication
|
|
1628
|
-
* endpoint.
|
|
1629
|
-
*/
|
|
1630
|
-
readonly info: TUserMeta["info"];
|
|
1631
|
-
/**
|
|
1632
|
-
* Permissions that the user has in the Room.
|
|
1633
|
-
*/
|
|
1634
|
-
readonly scopes: string[];
|
|
1635
|
-
};
|
|
1636
|
-
/**
|
|
1637
|
-
* Sent by the WebSocket server and broadcasted to all clients to announce that
|
|
1638
|
-
* a new User has left the Room.
|
|
1639
|
-
*/
|
|
1640
|
-
declare type UserLeftServerMsg = {
|
|
1641
|
-
readonly type: ServerMsgCode.USER_LEFT;
|
|
1642
|
-
readonly actor: number;
|
|
1643
|
-
};
|
|
1644
|
-
/**
|
|
1645
|
-
* Sent by the WebSocket server when the ydoc is updated or when requested based on stateVector passed.
|
|
1646
|
-
* Contains a base64 encoded update
|
|
1647
|
-
*/
|
|
1648
|
-
declare type YDocUpdate = {
|
|
1649
|
-
readonly type: ServerMsgCode.UPDATE_YDOC;
|
|
1650
|
-
readonly update: string;
|
|
1651
|
-
};
|
|
1652
|
-
/**
|
|
1653
|
-
* Sent by the WebSocket server and broadcasted to all clients to announce that
|
|
1654
|
-
* a User broadcasted an Event to everyone in the Room.
|
|
1655
|
-
*/
|
|
1656
|
-
declare type BroadcastedEventServerMsg<TRoomEvent extends Json> = {
|
|
1657
|
-
readonly type: ServerMsgCode.BROADCASTED_EVENT;
|
|
1658
|
-
/**
|
|
1659
|
-
* The User who broadcasted the Event.
|
|
1660
|
-
*/
|
|
1661
|
-
readonly actor: number;
|
|
1662
|
-
/**
|
|
1663
|
-
* The arbitrary payload of the Event. This can be any JSON value. Clients
|
|
1664
|
-
* will have to manually verify/decode this event.
|
|
1665
|
-
*/
|
|
1666
|
-
readonly event: TRoomEvent;
|
|
1667
|
-
};
|
|
1668
|
-
/**
|
|
1669
|
-
* Sent by the WebSocket server to a single client in response to the client
|
|
1670
|
-
* joining the Room, to provide the initial state of the Room. The payload
|
|
1671
|
-
* includes a list of all other Users that already are in the Room.
|
|
1672
|
-
*/
|
|
1673
|
-
declare type RoomStateServerMsg<TUserMeta extends BaseUserMeta> = {
|
|
1674
|
-
readonly type: ServerMsgCode.ROOM_STATE;
|
|
1675
|
-
readonly users: {
|
|
1676
|
-
readonly [actor: number]: TUserMeta & {
|
|
1677
|
-
scopes: string[];
|
|
1678
|
-
};
|
|
1679
|
-
};
|
|
1680
|
-
};
|
|
1681
|
-
/**
|
|
1682
|
-
* Sent by the WebSocket server to a single client in response to the client
|
|
1683
|
-
* joining the Room, to provide the initial Storage state of the Room. The
|
|
1684
|
-
* payload includes the entire Storage document.
|
|
1685
|
-
*/
|
|
1686
|
-
declare type InitialDocumentStateServerMsg = {
|
|
1687
|
-
readonly type: ServerMsgCode.INITIAL_STORAGE_STATE;
|
|
1688
|
-
readonly items: IdTuple<SerializedCrdt>[];
|
|
1689
|
-
};
|
|
1690
|
-
/**
|
|
1691
|
-
* Sent by the WebSocket server and broadcasted to all clients to announce that
|
|
1692
|
-
* a change occurred in the Storage document.
|
|
1693
|
-
*
|
|
1694
|
-
* The payload of this message contains a list of Ops (aka incremental
|
|
1695
|
-
* mutations to make to the initially loaded document).
|
|
1696
|
-
*/
|
|
1697
|
-
declare type UpdateStorageServerMsg = {
|
|
1698
|
-
readonly type: ServerMsgCode.UPDATE_STORAGE;
|
|
1699
|
-
readonly ops: Op[];
|
|
1700
|
-
};
|
|
1701
|
-
/**
|
|
1702
|
-
* Sent by the WebSocket server to the client to indicate that certain opIds
|
|
1703
|
-
* have been received but were rejected because they caused mutations that are
|
|
1704
|
-
* incompatible with the Room's schema.
|
|
1705
|
-
*/
|
|
1706
|
-
declare type RejectedStorageOpServerMsg = {
|
|
1707
|
-
readonly type: ServerMsgCode.REJECT_STORAGE_OP;
|
|
1708
|
-
readonly opIds: string[];
|
|
1709
|
-
readonly reason: string;
|
|
1710
|
-
};
|
|
1711
|
-
|
|
1712
1725
|
/**
|
|
1713
1726
|
* Lookup table for nodes (= SerializedCrdt values) by their IDs.
|
|
1714
1727
|
*/
|
|
@@ -1884,4 +1897,4 @@ declare type EnsureJson<T> = [
|
|
|
1884
1897
|
[K in keyof T]: EnsureJson<T[K]>;
|
|
1885
1898
|
};
|
|
1886
1899
|
|
|
1887
|
-
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, detectDupes, errorIf, freeze, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isPlainObject, isRootCrdt, legacy_patchImmutableObject, lsonToJson, makePosition, nn, patchLiveObjectKey, shallow, throwUsageError, toPlainLson, tryParseJson, withTimeout };
|
|
1900
|
+
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 };
|