@liveblocks/core 1.2.0-internal6 → 1.2.0
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 +59 -28
- package/dist/index.d.ts +59 -28
- package/dist/index.js +966 -746
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +912 -692
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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 "
|
|
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,7 @@ 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: (
|
|
711
|
+
createSocket: (authValue: T) => IWebSocketInstance;
|
|
670
712
|
};
|
|
671
713
|
|
|
672
714
|
declare type IdTuple<T> = [id: string, value: T];
|
|
@@ -794,7 +836,7 @@ declare type UserJoinServerMsg<TUserMeta extends BaseUserMeta> = {
|
|
|
794
836
|
*/
|
|
795
837
|
readonly info: TUserMeta["info"];
|
|
796
838
|
/**
|
|
797
|
-
*
|
|
839
|
+
* Informs the client what (public) permissions this (other) User has.
|
|
798
840
|
*/
|
|
799
841
|
readonly scopes: string[];
|
|
800
842
|
};
|
|
@@ -849,7 +891,7 @@ declare type RoomStateServerMsg<TUserMeta extends BaseUserMeta> = {
|
|
|
849
891
|
*/
|
|
850
892
|
readonly scopes: string[];
|
|
851
893
|
readonly users: {
|
|
852
|
-
readonly [
|
|
894
|
+
readonly [otherActor: number]: TUserMeta & {
|
|
853
895
|
scopes: string[];
|
|
854
896
|
};
|
|
855
897
|
};
|
|
@@ -919,9 +961,16 @@ declare type User<TPresence extends JsonObject, TUserMeta extends BaseUserMeta>
|
|
|
919
961
|
*/
|
|
920
962
|
readonly presence: TPresence;
|
|
921
963
|
/**
|
|
922
|
-
*
|
|
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.
|
|
923
967
|
*/
|
|
924
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;
|
|
925
974
|
};
|
|
926
975
|
|
|
927
976
|
/**
|
|
@@ -1194,11 +1243,6 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject, TUs
|
|
|
1194
1243
|
* The id of the room.
|
|
1195
1244
|
*/
|
|
1196
1245
|
readonly id: string;
|
|
1197
|
-
/**
|
|
1198
|
-
* A client is considered "self aware" if it knows its own
|
|
1199
|
-
* metadata and connection ID (from the auth server).
|
|
1200
|
-
*/
|
|
1201
|
-
isSelfAware(): boolean;
|
|
1202
1246
|
/**
|
|
1203
1247
|
* @deprecated This API will be removed in a future version of Liveblocks.
|
|
1204
1248
|
* Prefer using `.getStatus()` instead.
|
|
@@ -1314,6 +1358,7 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject, TUs
|
|
|
1314
1358
|
*/
|
|
1315
1359
|
getStorageSnapshot(): LiveObject<TStorage> | null;
|
|
1316
1360
|
readonly events: {
|
|
1361
|
+
/** @deprecated Prefer `status` instead. */
|
|
1317
1362
|
readonly connection: Observable<LegacyConnectionStatus>;
|
|
1318
1363
|
readonly status: Observable<Status>;
|
|
1319
1364
|
readonly lostConnection: Observable<LostConnectionEvent>;
|
|
@@ -1321,7 +1366,8 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject, TUs
|
|
|
1321
1366
|
connectionId: number;
|
|
1322
1367
|
event: TRoomEvent;
|
|
1323
1368
|
}>;
|
|
1324
|
-
readonly
|
|
1369
|
+
readonly self: Observable<User<TPresence, TUserMeta>>;
|
|
1370
|
+
readonly myPresence: Observable<TPresence>;
|
|
1325
1371
|
readonly others: Observable<{
|
|
1326
1372
|
others: Others<TPresence, TUserMeta>;
|
|
1327
1373
|
event: OthersEvent<TPresence, TUserMeta>;
|
|
@@ -1421,9 +1467,7 @@ declare type Client = {
|
|
|
1421
1467
|
*/
|
|
1422
1468
|
leave(roomId: string): void;
|
|
1423
1469
|
};
|
|
1424
|
-
declare type AuthEndpoint = string | ((room: string) => Promise<
|
|
1425
|
-
token: string;
|
|
1426
|
-
}>);
|
|
1470
|
+
declare type AuthEndpoint = string | ((room: string) => Promise<CustomAuthenticationResult>);
|
|
1427
1471
|
/**
|
|
1428
1472
|
* The authentication endpoint that is called to ensure that the current user has access to a room.
|
|
1429
1473
|
* Can be an url or a callback if you need to add additional headers.
|
|
@@ -1876,19 +1920,6 @@ declare namespace protocol {
|
|
|
1876
1920
|
};
|
|
1877
1921
|
}
|
|
1878
1922
|
|
|
1879
|
-
/**
|
|
1880
|
-
* PRIVATE / INTERNAL APIS
|
|
1881
|
-
* -----------------------
|
|
1882
|
-
*
|
|
1883
|
-
* This module is intended for internal use only, PLEASE DO NOT RELY ON ANY OF
|
|
1884
|
-
* THE EXPORTS IN HERE. These are implementation details that can change at any
|
|
1885
|
-
* time and without announcement. This module purely exists to share code
|
|
1886
|
-
* between the several Liveblocks packages.
|
|
1887
|
-
*
|
|
1888
|
-
* But since you're so deep inside Liveblocks code... we're hiring!
|
|
1889
|
-
* https://join.team/liveblocks ;)
|
|
1890
|
-
*/
|
|
1891
|
-
|
|
1892
1923
|
/**
|
|
1893
1924
|
* Helper type to help users adopt to Lson types from interface definitions.
|
|
1894
1925
|
* You should only use this to wrap interfaces you don't control. For more
|
|
@@ -1901,4 +1932,4 @@ declare type EnsureJson<T> = [
|
|
|
1901
1932
|
[K in keyof T]: EnsureJson<T[K]>;
|
|
1902
1933
|
};
|
|
1903
1934
|
|
|
1904
|
-
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 };
|
package/dist/index.d.ts
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 "
|
|
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,7 @@ 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: (
|
|
711
|
+
createSocket: (authValue: T) => IWebSocketInstance;
|
|
670
712
|
};
|
|
671
713
|
|
|
672
714
|
declare type IdTuple<T> = [id: string, value: T];
|
|
@@ -794,7 +836,7 @@ declare type UserJoinServerMsg<TUserMeta extends BaseUserMeta> = {
|
|
|
794
836
|
*/
|
|
795
837
|
readonly info: TUserMeta["info"];
|
|
796
838
|
/**
|
|
797
|
-
*
|
|
839
|
+
* Informs the client what (public) permissions this (other) User has.
|
|
798
840
|
*/
|
|
799
841
|
readonly scopes: string[];
|
|
800
842
|
};
|
|
@@ -849,7 +891,7 @@ declare type RoomStateServerMsg<TUserMeta extends BaseUserMeta> = {
|
|
|
849
891
|
*/
|
|
850
892
|
readonly scopes: string[];
|
|
851
893
|
readonly users: {
|
|
852
|
-
readonly [
|
|
894
|
+
readonly [otherActor: number]: TUserMeta & {
|
|
853
895
|
scopes: string[];
|
|
854
896
|
};
|
|
855
897
|
};
|
|
@@ -919,9 +961,16 @@ declare type User<TPresence extends JsonObject, TUserMeta extends BaseUserMeta>
|
|
|
919
961
|
*/
|
|
920
962
|
readonly presence: TPresence;
|
|
921
963
|
/**
|
|
922
|
-
*
|
|
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.
|
|
923
967
|
*/
|
|
924
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;
|
|
925
974
|
};
|
|
926
975
|
|
|
927
976
|
/**
|
|
@@ -1194,11 +1243,6 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject, TUs
|
|
|
1194
1243
|
* The id of the room.
|
|
1195
1244
|
*/
|
|
1196
1245
|
readonly id: string;
|
|
1197
|
-
/**
|
|
1198
|
-
* A client is considered "self aware" if it knows its own
|
|
1199
|
-
* metadata and connection ID (from the auth server).
|
|
1200
|
-
*/
|
|
1201
|
-
isSelfAware(): boolean;
|
|
1202
1246
|
/**
|
|
1203
1247
|
* @deprecated This API will be removed in a future version of Liveblocks.
|
|
1204
1248
|
* Prefer using `.getStatus()` instead.
|
|
@@ -1314,6 +1358,7 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject, TUs
|
|
|
1314
1358
|
*/
|
|
1315
1359
|
getStorageSnapshot(): LiveObject<TStorage> | null;
|
|
1316
1360
|
readonly events: {
|
|
1361
|
+
/** @deprecated Prefer `status` instead. */
|
|
1317
1362
|
readonly connection: Observable<LegacyConnectionStatus>;
|
|
1318
1363
|
readonly status: Observable<Status>;
|
|
1319
1364
|
readonly lostConnection: Observable<LostConnectionEvent>;
|
|
@@ -1321,7 +1366,8 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject, TUs
|
|
|
1321
1366
|
connectionId: number;
|
|
1322
1367
|
event: TRoomEvent;
|
|
1323
1368
|
}>;
|
|
1324
|
-
readonly
|
|
1369
|
+
readonly self: Observable<User<TPresence, TUserMeta>>;
|
|
1370
|
+
readonly myPresence: Observable<TPresence>;
|
|
1325
1371
|
readonly others: Observable<{
|
|
1326
1372
|
others: Others<TPresence, TUserMeta>;
|
|
1327
1373
|
event: OthersEvent<TPresence, TUserMeta>;
|
|
@@ -1421,9 +1467,7 @@ declare type Client = {
|
|
|
1421
1467
|
*/
|
|
1422
1468
|
leave(roomId: string): void;
|
|
1423
1469
|
};
|
|
1424
|
-
declare type AuthEndpoint = string | ((room: string) => Promise<
|
|
1425
|
-
token: string;
|
|
1426
|
-
}>);
|
|
1470
|
+
declare type AuthEndpoint = string | ((room: string) => Promise<CustomAuthenticationResult>);
|
|
1427
1471
|
/**
|
|
1428
1472
|
* The authentication endpoint that is called to ensure that the current user has access to a room.
|
|
1429
1473
|
* Can be an url or a callback if you need to add additional headers.
|
|
@@ -1876,19 +1920,6 @@ declare namespace protocol {
|
|
|
1876
1920
|
};
|
|
1877
1921
|
}
|
|
1878
1922
|
|
|
1879
|
-
/**
|
|
1880
|
-
* PRIVATE / INTERNAL APIS
|
|
1881
|
-
* -----------------------
|
|
1882
|
-
*
|
|
1883
|
-
* This module is intended for internal use only, PLEASE DO NOT RELY ON ANY OF
|
|
1884
|
-
* THE EXPORTS IN HERE. These are implementation details that can change at any
|
|
1885
|
-
* time and without announcement. This module purely exists to share code
|
|
1886
|
-
* between the several Liveblocks packages.
|
|
1887
|
-
*
|
|
1888
|
-
* But since you're so deep inside Liveblocks code... we're hiring!
|
|
1889
|
-
* https://join.team/liveblocks ;)
|
|
1890
|
-
*/
|
|
1891
|
-
|
|
1892
1923
|
/**
|
|
1893
1924
|
* Helper type to help users adopt to Lson types from interface definitions.
|
|
1894
1925
|
* You should only use this to wrap interfaces you don't control. For more
|
|
@@ -1901,4 +1932,4 @@ declare type EnsureJson<T> = [
|
|
|
1901
1932
|
[K in keyof T]: EnsureJson<T[K]>;
|
|
1902
1933
|
};
|
|
1903
1934
|
|
|
1904
|
-
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 };
|