@liveblocks/core 1.1.0 → 1.1.1-yjs1
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 +36 -30
- package/dist/index.js +41 -59
- package/package.json +2 -2
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.
|
|
@@ -1077,6 +1052,17 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject, TUs
|
|
|
1077
1052
|
*/
|
|
1078
1053
|
addToHistory: boolean;
|
|
1079
1054
|
}): void;
|
|
1055
|
+
/**
|
|
1056
|
+
*
|
|
1057
|
+
* Sends YJS document updates to liveblocks server
|
|
1058
|
+
*
|
|
1059
|
+
* @param {string} data the doc update to send to the server, base64 encoded uint8array
|
|
1060
|
+
*/
|
|
1061
|
+
updateYDoc(data: string): void;
|
|
1062
|
+
/**
|
|
1063
|
+
* Sends a request for the current document from liveblocks server
|
|
1064
|
+
*/
|
|
1065
|
+
getYDoc(stateVector: string): void;
|
|
1080
1066
|
/**
|
|
1081
1067
|
* Broadcasts an event to other users in the room. Event broadcasted to the room can be listened with {@link Room.subscribe}("event").
|
|
1082
1068
|
* @param {any} event the event to broadcast. Should be serializable to JSON
|
|
@@ -1134,6 +1120,7 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject, TUs
|
|
|
1134
1120
|
*/
|
|
1135
1121
|
readonly storageDidLoad: Observable<void>;
|
|
1136
1122
|
readonly storageStatus: Observable<StorageStatus>;
|
|
1123
|
+
readonly docUpdated: Observable<string>;
|
|
1137
1124
|
};
|
|
1138
1125
|
/**
|
|
1139
1126
|
* Batches modifications made during the given function.
|
|
@@ -1456,12 +1443,14 @@ declare enum ClientMsgCode {
|
|
|
1456
1443
|
UPDATE_PRESENCE = 100,
|
|
1457
1444
|
BROADCAST_EVENT = 103,
|
|
1458
1445
|
FETCH_STORAGE = 200,
|
|
1459
|
-
UPDATE_STORAGE = 201
|
|
1446
|
+
UPDATE_STORAGE = 201,
|
|
1447
|
+
FETCH_YDOC = 300,
|
|
1448
|
+
UPDATE_YDOC = 301
|
|
1460
1449
|
}
|
|
1461
1450
|
/**
|
|
1462
1451
|
* Messages that can be sent from the client to the server.
|
|
1463
1452
|
*/
|
|
1464
|
-
declare type ClientMsg<TPresence extends JsonObject, TRoomEvent extends Json> = BroadcastEventClientMsg<TRoomEvent> | UpdatePresenceClientMsg<TPresence> | UpdateStorageClientMsg | FetchStorageClientMsg;
|
|
1453
|
+
declare type ClientMsg<TPresence extends JsonObject, TRoomEvent extends Json> = BroadcastEventClientMsg<TRoomEvent> | UpdatePresenceClientMsg<TPresence> | UpdateStorageClientMsg | FetchStorageClientMsg | FetchYDocClientMsg | UpdateYDocClientMsg;
|
|
1465
1454
|
declare type BroadcastEventClientMsg<TRoomEvent extends Json> = {
|
|
1466
1455
|
type: ClientMsgCode.BROADCAST_EVENT;
|
|
1467
1456
|
event: TRoomEvent;
|
|
@@ -1499,6 +1488,14 @@ declare type UpdateStorageClientMsg = {
|
|
|
1499
1488
|
declare type FetchStorageClientMsg = {
|
|
1500
1489
|
readonly type: ClientMsgCode.FETCH_STORAGE;
|
|
1501
1490
|
};
|
|
1491
|
+
declare type FetchYDocClientMsg = {
|
|
1492
|
+
readonly type: ClientMsgCode.FETCH_YDOC;
|
|
1493
|
+
readonly vector: string;
|
|
1494
|
+
};
|
|
1495
|
+
declare type UpdateYDocClientMsg = {
|
|
1496
|
+
readonly type: ClientMsgCode.UPDATE_YDOC;
|
|
1497
|
+
readonly update: string;
|
|
1498
|
+
};
|
|
1502
1499
|
|
|
1503
1500
|
declare type IdTuple<T> = [id: string, value: T];
|
|
1504
1501
|
declare enum CrdtType {
|
|
@@ -1548,12 +1545,13 @@ declare enum ServerMsgCode {
|
|
|
1548
1545
|
ROOM_STATE = 104,
|
|
1549
1546
|
INITIAL_STORAGE_STATE = 200,
|
|
1550
1547
|
UPDATE_STORAGE = 201,
|
|
1551
|
-
REJECT_STORAGE_OP = 299
|
|
1548
|
+
REJECT_STORAGE_OP = 299,
|
|
1549
|
+
UPDATE_YDOC = 300
|
|
1552
1550
|
}
|
|
1553
1551
|
/**
|
|
1554
1552
|
* Messages that can be sent from the server to the client.
|
|
1555
1553
|
*/
|
|
1556
|
-
declare type ServerMsg<TPresence extends JsonObject, TUserMeta extends BaseUserMeta, TRoomEvent extends Json> = UpdatePresenceServerMsg<TPresence> | UserJoinServerMsg<TUserMeta> | UserLeftServerMsg | BroadcastedEventServerMsg<TRoomEvent> | RoomStateServerMsg<TUserMeta> | InitialDocumentStateServerMsg | UpdateStorageServerMsg | RejectedStorageOpServerMsg;
|
|
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;
|
|
1557
1555
|
/**
|
|
1558
1556
|
* Sent by the WebSocket server and broadcasted to all clients to announce that
|
|
1559
1557
|
* a User updated their presence. For example, when a user moves their cursor.
|
|
@@ -1636,6 +1634,14 @@ declare type UserLeftServerMsg = {
|
|
|
1636
1634
|
readonly type: ServerMsgCode.USER_LEFT;
|
|
1637
1635
|
readonly actor: number;
|
|
1638
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
|
+
};
|
|
1639
1645
|
/**
|
|
1640
1646
|
* Sent by the WebSocket server and broadcasted to all clients to announce that
|
|
1641
1647
|
* a User broadcasted an Event to everyone in the Room.
|
|
@@ -1884,4 +1890,4 @@ declare type EnsureJson<T> = [
|
|
|
1884
1890
|
[K in keyof T]: EnsureJson<T[K]>;
|
|
1885
1891
|
};
|
|
1886
1892
|
|
|
1887
|
-
export { AckOp,
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -17,18 +17,6 @@ var __spreadValues = (a, b) => {
|
|
|
17
17
|
return a;
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
var __objRest = (source, exclude) => {
|
|
21
|
-
var target = {};
|
|
22
|
-
for (var prop in source)
|
|
23
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
-
target[prop] = source[prop];
|
|
25
|
-
if (source != null && __getOwnPropSymbols)
|
|
26
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
-
target[prop] = source[prop];
|
|
29
|
-
}
|
|
30
|
-
return target;
|
|
31
|
-
};
|
|
32
20
|
var __async = (__this, __arguments, generator) => {
|
|
33
21
|
return new Promise((resolve, reject) => {
|
|
34
22
|
var fulfilled = (value) => {
|
|
@@ -157,7 +145,7 @@ var onMessageFromPanel = eventSource.observable;
|
|
|
157
145
|
// src/devtools/index.ts
|
|
158
146
|
var VERSION = true ? (
|
|
159
147
|
/* istanbul ignore next */
|
|
160
|
-
"1.1.
|
|
148
|
+
"1.1.1-yjs1"
|
|
161
149
|
) : "dev";
|
|
162
150
|
var _devtoolsSetupHasRun = false;
|
|
163
151
|
function setupDevTools(getAllRooms) {
|
|
@@ -3924,13 +3912,6 @@ function isJsonObject(data) {
|
|
|
3924
3912
|
}
|
|
3925
3913
|
|
|
3926
3914
|
// src/protocol/AuthToken.ts
|
|
3927
|
-
function hasJwtMeta(data) {
|
|
3928
|
-
if (!isPlainObject(data)) {
|
|
3929
|
-
return false;
|
|
3930
|
-
}
|
|
3931
|
-
const { iat, exp } = data;
|
|
3932
|
-
return typeof iat === "number" && typeof exp === "number";
|
|
3933
|
-
}
|
|
3934
3915
|
function isTokenExpired(token) {
|
|
3935
3916
|
const now = Date.now() / 1e3;
|
|
3936
3917
|
const valid = now <= token.exp - 300 && now >= token.iat - 300;
|
|
@@ -3939,44 +3920,23 @@ function isTokenExpired(token) {
|
|
|
3939
3920
|
function isStringList(value) {
|
|
3940
3921
|
return Array.isArray(value) && value.every((i) => typeof i === "string");
|
|
3941
3922
|
}
|
|
3942
|
-
function
|
|
3943
|
-
return typeof data.
|
|
3923
|
+
function isMinimalTokenPayload(data) {
|
|
3924
|
+
return isPlainObject(data) && typeof data.iat === "number" && typeof data.exp === "number" && typeof data.actor === "number" && (data.id === void 0 || typeof data.id === "string") && isStringList(data.scopes);
|
|
3944
3925
|
}
|
|
3945
|
-
function
|
|
3946
|
-
|
|
3947
|
-
}
|
|
3948
|
-
function isAuthToken(data) {
|
|
3949
|
-
return isAppOnlyAuthToken(data) || isRoomAuthToken(data);
|
|
3950
|
-
}
|
|
3951
|
-
function parseJwtToken(token) {
|
|
3952
|
-
const tokenParts = token.split(".");
|
|
3926
|
+
function parseAuthToken(rawTokenString) {
|
|
3927
|
+
const tokenParts = rawTokenString.split(".");
|
|
3953
3928
|
if (tokenParts.length !== 3) {
|
|
3954
3929
|
throw new Error("Authentication error: invalid JWT token");
|
|
3955
3930
|
}
|
|
3956
|
-
const
|
|
3957
|
-
if (
|
|
3958
|
-
return data;
|
|
3959
|
-
} else {
|
|
3960
|
-
throw new Error("Authentication error: missing JWT metadata");
|
|
3961
|
-
}
|
|
3962
|
-
}
|
|
3963
|
-
function parseRoomAuthToken(tokenString) {
|
|
3964
|
-
const data = parseJwtToken(tokenString);
|
|
3965
|
-
if (!(data && isRoomAuthToken(data))) {
|
|
3931
|
+
const payload = tryParseJson(b64decode(tokenParts[1]));
|
|
3932
|
+
if (!(payload && isMinimalTokenPayload(payload))) {
|
|
3966
3933
|
throw new Error(
|
|
3967
3934
|
"Authentication error: we expected a room token but did not get one. Hint: if you are using a callback, ensure the room is passed when creating the token. For more information: https://liveblocks.io/docs/api-reference/liveblocks-client#createClientCallback"
|
|
3968
3935
|
);
|
|
3969
3936
|
}
|
|
3970
|
-
const _a = data, {
|
|
3971
|
-
maxConnections: _legacyField
|
|
3972
|
-
} = _a, parsedToken = __objRest(_a, [
|
|
3973
|
-
// If this legacy field is found on the token, pretend it wasn't there,
|
|
3974
|
-
// to make all internally used token payloads uniform
|
|
3975
|
-
"maxConnections"
|
|
3976
|
-
]);
|
|
3977
3937
|
return {
|
|
3978
|
-
raw:
|
|
3979
|
-
parsed:
|
|
3938
|
+
raw: rawTokenString,
|
|
3939
|
+
parsed: payload
|
|
3980
3940
|
};
|
|
3981
3941
|
}
|
|
3982
3942
|
|
|
@@ -3986,6 +3946,8 @@ var ClientMsgCode = /* @__PURE__ */ ((ClientMsgCode2) => {
|
|
|
3986
3946
|
ClientMsgCode2[ClientMsgCode2["BROADCAST_EVENT"] = 103] = "BROADCAST_EVENT";
|
|
3987
3947
|
ClientMsgCode2[ClientMsgCode2["FETCH_STORAGE"] = 200] = "FETCH_STORAGE";
|
|
3988
3948
|
ClientMsgCode2[ClientMsgCode2["UPDATE_STORAGE"] = 201] = "UPDATE_STORAGE";
|
|
3949
|
+
ClientMsgCode2[ClientMsgCode2["FETCH_YDOC"] = 300] = "FETCH_YDOC";
|
|
3950
|
+
ClientMsgCode2[ClientMsgCode2["UPDATE_YDOC"] = 301] = "UPDATE_YDOC";
|
|
3989
3951
|
return ClientMsgCode2;
|
|
3990
3952
|
})(ClientMsgCode || {});
|
|
3991
3953
|
|
|
@@ -3999,6 +3961,7 @@ var ServerMsgCode = /* @__PURE__ */ ((ServerMsgCode2) => {
|
|
|
3999
3961
|
ServerMsgCode2[ServerMsgCode2["INITIAL_STORAGE_STATE"] = 200] = "INITIAL_STORAGE_STATE";
|
|
4000
3962
|
ServerMsgCode2[ServerMsgCode2["UPDATE_STORAGE"] = 201] = "UPDATE_STORAGE";
|
|
4001
3963
|
ServerMsgCode2[ServerMsgCode2["REJECT_STORAGE_OP"] = 299] = "REJECT_STORAGE_OP";
|
|
3964
|
+
ServerMsgCode2[ServerMsgCode2["UPDATE_YDOC"] = 300] = "UPDATE_YDOC";
|
|
4002
3965
|
return ServerMsgCode2;
|
|
4003
3966
|
})(ServerMsgCode || {});
|
|
4004
3967
|
|
|
@@ -4431,7 +4394,8 @@ function createRoom(options, config) {
|
|
|
4431
4394
|
storage: makeEventSource(),
|
|
4432
4395
|
history: makeEventSource(),
|
|
4433
4396
|
storageDidLoad: makeEventSource(),
|
|
4434
|
-
storageStatus: makeEventSource()
|
|
4397
|
+
storageStatus: makeEventSource(),
|
|
4398
|
+
docUpdated: makeEventSource()
|
|
4435
4399
|
};
|
|
4436
4400
|
function sendMessages(messageOrMessages) {
|
|
4437
4401
|
var _a2, _b2;
|
|
@@ -4852,6 +4816,10 @@ function createRoom(options, config) {
|
|
|
4852
4816
|
}
|
|
4853
4817
|
break;
|
|
4854
4818
|
}
|
|
4819
|
+
case 300 /* UPDATE_YDOC */: {
|
|
4820
|
+
eventHub.docUpdated.notify(message.update);
|
|
4821
|
+
break;
|
|
4822
|
+
}
|
|
4855
4823
|
case 104 /* ROOM_STATE */: {
|
|
4856
4824
|
updates.others.push(onRoomStateMessage(message));
|
|
4857
4825
|
break;
|
|
@@ -4970,6 +4938,13 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
4970
4938
|
}
|
|
4971
4939
|
return messages;
|
|
4972
4940
|
}
|
|
4941
|
+
function updateYDoc(update) {
|
|
4942
|
+
context.buffer.messages.push({
|
|
4943
|
+
type: 301 /* UPDATE_YDOC */,
|
|
4944
|
+
update
|
|
4945
|
+
});
|
|
4946
|
+
flushNowOrSoon();
|
|
4947
|
+
}
|
|
4973
4948
|
function broadcastEvent(event, options2 = {
|
|
4974
4949
|
shouldQueueEventIfNotReady: false
|
|
4975
4950
|
}) {
|
|
@@ -5029,6 +5004,13 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
5029
5004
|
};
|
|
5030
5005
|
});
|
|
5031
5006
|
}
|
|
5007
|
+
function getYDoc(vector) {
|
|
5008
|
+
context.buffer.messages.push({
|
|
5009
|
+
type: 300 /* FETCH_YDOC */,
|
|
5010
|
+
vector
|
|
5011
|
+
});
|
|
5012
|
+
flushNowOrSoon();
|
|
5013
|
+
}
|
|
5032
5014
|
function undo() {
|
|
5033
5015
|
if (context.activeBatch) {
|
|
5034
5016
|
throw new Error("undo is not allowed during a batch");
|
|
@@ -5150,7 +5132,8 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
5150
5132
|
storage: eventHub.storage.observable,
|
|
5151
5133
|
history: eventHub.history.observable,
|
|
5152
5134
|
storageDidLoad: eventHub.storageDidLoad.observable,
|
|
5153
|
-
storageStatus: eventHub.storageStatus.observable
|
|
5135
|
+
storageStatus: eventHub.storageStatus.observable,
|
|
5136
|
+
docUpdated: eventHub.docUpdated.observable
|
|
5154
5137
|
};
|
|
5155
5138
|
return {
|
|
5156
5139
|
/* NOTE: Exposing __internal here only to allow testing implementation details in unit tests */
|
|
@@ -5185,6 +5168,7 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
5185
5168
|
destroy: () => managedSocket.destroy(),
|
|
5186
5169
|
// Presence
|
|
5187
5170
|
updatePresence,
|
|
5171
|
+
updateYDoc,
|
|
5188
5172
|
broadcastEvent,
|
|
5189
5173
|
// Storage
|
|
5190
5174
|
batch,
|
|
@@ -5196,6 +5180,7 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
5196
5180
|
pause: pauseHistory,
|
|
5197
5181
|
resume: resumeHistory
|
|
5198
5182
|
},
|
|
5183
|
+
getYDoc,
|
|
5199
5184
|
getStorage,
|
|
5200
5185
|
getStorageSnapshot,
|
|
5201
5186
|
getStorageStatus,
|
|
@@ -5311,7 +5296,7 @@ function makeCreateSocketDelegateForRoom(liveblocksServer, WebSocketPolyfill) {
|
|
|
5311
5296
|
// @ts-ignore (__PACKAGE_VERSION__ will be injected by the build script)
|
|
5312
5297
|
true ? (
|
|
5313
5298
|
/* istanbul ignore next */
|
|
5314
|
-
"1.1.
|
|
5299
|
+
"1.1.1-yjs1"
|
|
5315
5300
|
) : "dev"}`
|
|
5316
5301
|
);
|
|
5317
5302
|
};
|
|
@@ -5342,7 +5327,7 @@ function makeAuthDelegateForRoom(roomId, authentication, fetchPolyfill) {
|
|
|
5342
5327
|
return fetchAuthEndpoint(fetcher, authentication.url, {
|
|
5343
5328
|
room: roomId,
|
|
5344
5329
|
publicApiKey: authentication.publicApiKey
|
|
5345
|
-
}).then(({ token }) =>
|
|
5330
|
+
}).then(({ token }) => parseAuthToken(token));
|
|
5346
5331
|
});
|
|
5347
5332
|
} else if (authentication.type === "private") {
|
|
5348
5333
|
return () => __async(this, null, function* () {
|
|
@@ -5353,7 +5338,7 @@ function makeAuthDelegateForRoom(roomId, authentication, fetchPolyfill) {
|
|
|
5353
5338
|
}
|
|
5354
5339
|
return fetchAuthEndpoint(fetcher, authentication.url, {
|
|
5355
5340
|
room: roomId
|
|
5356
|
-
}).then(({ token }) =>
|
|
5341
|
+
}).then(({ token }) => parseAuthToken(token));
|
|
5357
5342
|
});
|
|
5358
5343
|
} else if (authentication.type === "custom") {
|
|
5359
5344
|
return () => __async(this, null, function* () {
|
|
@@ -5363,7 +5348,7 @@ function makeAuthDelegateForRoom(roomId, authentication, fetchPolyfill) {
|
|
|
5363
5348
|
'We expect the authentication callback to return a token, but it does not. Hint: the return value should look like: { token: "..." }'
|
|
5364
5349
|
);
|
|
5365
5350
|
}
|
|
5366
|
-
return
|
|
5351
|
+
return parseAuthToken(response.token);
|
|
5367
5352
|
});
|
|
5368
5353
|
} else {
|
|
5369
5354
|
throw new Error("Internal error. Unexpected authentication type");
|
|
@@ -5964,7 +5949,4 @@ var WebsocketCloseCodes = /* @__PURE__ */ ((WebsocketCloseCodes2) => {
|
|
|
5964
5949
|
|
|
5965
5950
|
|
|
5966
5951
|
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
5970
|
-
exports.ClientMsgCode = ClientMsgCode; exports.CrdtType = CrdtType; exports.LiveList = LiveList; exports.LiveMap = LiveMap; exports.LiveObject = LiveObject; exports.OpCode = OpCode; exports.ServerMsgCode = ServerMsgCode; exports.WebsocketCloseCodes = WebsocketCloseCodes; exports.asArrayWithLegacyMethods = asArrayWithLegacyMethods; exports.asPos = asPos; exports.assert = assert; exports.assertNever = assertNever; exports.b64decode = b64decode; exports.createClient = createClient; exports.deprecate = deprecate; exports.deprecateIf = deprecateIf; exports.errorIf = errorIf; exports.freeze = freeze; exports.isAppOnlyAuthToken = isAppOnlyAuthToken; exports.isAuthToken = isAuthToken; exports.isChildCrdt = isChildCrdt; exports.isJsonArray = isJsonArray; exports.isJsonObject = isJsonObject; exports.isJsonScalar = isJsonScalar; exports.isPlainObject = isPlainObject; exports.isRoomAuthToken = isRoomAuthToken; exports.isRootCrdt = isRootCrdt; exports.legacy_patchImmutableObject = legacy_patchImmutableObject; exports.lsonToJson = lsonToJson; exports.makePosition = makePosition; exports.nn = nn; exports.patchLiveObjectKey = patchLiveObjectKey; exports.shallow = shallow; exports.throwUsageError = throwUsageError; exports.tryParseJson = tryParseJson; exports.withTimeout = withTimeout;
|
|
5952
|
+
exports.ClientMsgCode = ClientMsgCode; exports.CrdtType = CrdtType; exports.LiveList = LiveList; exports.LiveMap = LiveMap; exports.LiveObject = LiveObject; exports.OpCode = OpCode; exports.ServerMsgCode = ServerMsgCode; exports.WebsocketCloseCodes = WebsocketCloseCodes; exports.asArrayWithLegacyMethods = asArrayWithLegacyMethods; exports.asPos = asPos; exports.assert = assert; exports.assertNever = assertNever; exports.b64decode = b64decode; exports.createClient = createClient; exports.deprecate = deprecate; exports.deprecateIf = deprecateIf; exports.errorIf = errorIf; exports.freeze = freeze; exports.isChildCrdt = isChildCrdt; exports.isJsonArray = isJsonArray; exports.isJsonObject = isJsonObject; exports.isJsonScalar = isJsonScalar; exports.isPlainObject = isPlainObject; exports.isRootCrdt = isRootCrdt; exports.legacy_patchImmutableObject = legacy_patchImmutableObject; exports.lsonToJson = lsonToJson; exports.makePosition = makePosition; exports.nn = nn; exports.patchLiveObjectKey = patchLiveObjectKey; exports.shallow = shallow; exports.throwUsageError = throwUsageError; exports.tryParseJson = tryParseJson; exports.withTimeout = withTimeout;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@liveblocks/core",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1-yjs1",
|
|
4
4
|
"description": "Shared code and foundational internals for Liveblocks",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"scripts": {
|
|
21
21
|
"dev": "tsup --watch",
|
|
22
22
|
"build": "tsup",
|
|
23
|
-
"format": "eslint --fix src
|
|
23
|
+
"format": "(eslint --fix src/ || true) && prettier --write src/",
|
|
24
24
|
"lint": "eslint src/",
|
|
25
25
|
"test": "jest --silent --verbose --color=always",
|
|
26
26
|
"test:types": "tsd",
|