@liveblocks/core 1.3.4 → 1.3.6
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 +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +47 -52
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -37
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1129,6 +1129,11 @@ declare type RoomStateServerMsg<TUserMeta extends BaseUserMeta> = {
|
|
|
1129
1129
|
* @since v1.2 (WS API v7)
|
|
1130
1130
|
*/
|
|
1131
1131
|
readonly actor: number;
|
|
1132
|
+
/**
|
|
1133
|
+
* Secure nonce for the current session.
|
|
1134
|
+
* @since v1.2 (WS API v7)
|
|
1135
|
+
*/
|
|
1136
|
+
readonly nonce: string;
|
|
1132
1137
|
/**
|
|
1133
1138
|
* Informs the client what permissions the current User (self) has.
|
|
1134
1139
|
* @since v1.2 (WS API v7)
|
|
@@ -2294,4 +2299,4 @@ declare type EnsureJson<T> = [
|
|
|
2294
2299
|
[K in keyof T]: EnsureJson<T[K]>;
|
|
2295
2300
|
};
|
|
2296
2301
|
|
|
2297
|
-
export { AckOp, AsyncCache, AsyncState, AsyncStateError, AsyncStateInitial, AsyncStateLoading, AsyncStateResolved, AsyncStateSuccess, BaseAuthResult, BaseMetadata, BaseUserMeta, BroadcastEventClientMsg, BroadcastOptions, BroadcastedEventServerMsg, Client, ClientMsg, ClientMsgCode, CommentBody, CommentBodyElement, CommentBodyLink, CommentBodyMention, CommentBodyParagraph, CommentData, CommentsApi, CrdtType, CreateChildOp, CreateListOp, CreateMapOp, CreateObjectOp, CreateOp, CreateRegisterOp, CreateRootObjectOp, CustomAuthenticationResult, Delegates, DeleteCrdtOp, DeleteObjectKeyOp, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, EnsureJson, EventSource, 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, ThreadData, ToImmutable, ToJson, UnsubscribeCallback, UpdateObjectOp, UpdatePresenceClientMsg, UpdatePresenceServerMsg, UpdateStorageClientMsg, UpdateStorageServerMsg, UpdateYDocClientMsg, User, UserJoinServerMsg, UserLeftServerMsg, WebsocketCloseCodes, asPos, assert, assertNever, b64decode, fancyConsole as console, createAsyncCache, createClient, createCommentsApi, deprecate, deprecateIf, detectDupes, errorIf, freeze, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, nn, patchLiveObjectKey, shallow, throwUsageError, toPlainLson, tryParseJson, withTimeout };
|
|
2302
|
+
export { AckOp, AsyncCache, AsyncState, AsyncStateError, AsyncStateInitial, AsyncStateLoading, AsyncStateResolved, AsyncStateSuccess, BaseAuthResult, BaseMetadata, BaseUserMeta, BroadcastEventClientMsg, BroadcastOptions, BroadcastedEventServerMsg, Client, ClientMsg, ClientMsgCode, CommentBody, CommentBodyElement, CommentBodyLink, CommentBodyMention, CommentBodyParagraph, CommentBodyText, CommentData, CommentsApi, CrdtType, CreateChildOp, CreateListOp, CreateMapOp, CreateObjectOp, CreateOp, CreateRegisterOp, CreateRootObjectOp, CustomAuthenticationResult, Delegates, DeleteCrdtOp, DeleteObjectKeyOp, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, EnsureJson, EventSource, 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, ThreadData, ToImmutable, ToJson, UnsubscribeCallback, UpdateObjectOp, UpdatePresenceClientMsg, UpdatePresenceServerMsg, UpdateStorageClientMsg, UpdateStorageServerMsg, UpdateYDocClientMsg, User, UserJoinServerMsg, UserLeftServerMsg, WebsocketCloseCodes, asPos, assert, assertNever, b64decode, fancyConsole as console, createAsyncCache, createClient, createCommentsApi, deprecate, deprecateIf, detectDupes, errorIf, freeze, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, nn, patchLiveObjectKey, shallow, throwUsageError, toPlainLson, tryParseJson, withTimeout };
|
package/dist/index.d.ts
CHANGED
|
@@ -1129,6 +1129,11 @@ declare type RoomStateServerMsg<TUserMeta extends BaseUserMeta> = {
|
|
|
1129
1129
|
* @since v1.2 (WS API v7)
|
|
1130
1130
|
*/
|
|
1131
1131
|
readonly actor: number;
|
|
1132
|
+
/**
|
|
1133
|
+
* Secure nonce for the current session.
|
|
1134
|
+
* @since v1.2 (WS API v7)
|
|
1135
|
+
*/
|
|
1136
|
+
readonly nonce: string;
|
|
1132
1137
|
/**
|
|
1133
1138
|
* Informs the client what permissions the current User (self) has.
|
|
1134
1139
|
* @since v1.2 (WS API v7)
|
|
@@ -2294,4 +2299,4 @@ declare type EnsureJson<T> = [
|
|
|
2294
2299
|
[K in keyof T]: EnsureJson<T[K]>;
|
|
2295
2300
|
};
|
|
2296
2301
|
|
|
2297
|
-
export { AckOp, AsyncCache, AsyncState, AsyncStateError, AsyncStateInitial, AsyncStateLoading, AsyncStateResolved, AsyncStateSuccess, BaseAuthResult, BaseMetadata, BaseUserMeta, BroadcastEventClientMsg, BroadcastOptions, BroadcastedEventServerMsg, Client, ClientMsg, ClientMsgCode, CommentBody, CommentBodyElement, CommentBodyLink, CommentBodyMention, CommentBodyParagraph, CommentData, CommentsApi, CrdtType, CreateChildOp, CreateListOp, CreateMapOp, CreateObjectOp, CreateOp, CreateRegisterOp, CreateRootObjectOp, CustomAuthenticationResult, Delegates, DeleteCrdtOp, DeleteObjectKeyOp, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, EnsureJson, EventSource, 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, ThreadData, ToImmutable, ToJson, UnsubscribeCallback, UpdateObjectOp, UpdatePresenceClientMsg, UpdatePresenceServerMsg, UpdateStorageClientMsg, UpdateStorageServerMsg, UpdateYDocClientMsg, User, UserJoinServerMsg, UserLeftServerMsg, WebsocketCloseCodes, asPos, assert, assertNever, b64decode, fancyConsole as console, createAsyncCache, createClient, createCommentsApi, deprecate, deprecateIf, detectDupes, errorIf, freeze, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, nn, patchLiveObjectKey, shallow, throwUsageError, toPlainLson, tryParseJson, withTimeout };
|
|
2302
|
+
export { AckOp, AsyncCache, AsyncState, AsyncStateError, AsyncStateInitial, AsyncStateLoading, AsyncStateResolved, AsyncStateSuccess, BaseAuthResult, BaseMetadata, BaseUserMeta, BroadcastEventClientMsg, BroadcastOptions, BroadcastedEventServerMsg, Client, ClientMsg, ClientMsgCode, CommentBody, CommentBodyElement, CommentBodyLink, CommentBodyMention, CommentBodyParagraph, CommentBodyText, CommentData, CommentsApi, CrdtType, CreateChildOp, CreateListOp, CreateMapOp, CreateObjectOp, CreateOp, CreateRegisterOp, CreateRootObjectOp, CustomAuthenticationResult, Delegates, DeleteCrdtOp, DeleteObjectKeyOp, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, EnsureJson, EventSource, 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, ThreadData, ToImmutable, ToJson, UnsubscribeCallback, UpdateObjectOp, UpdatePresenceClientMsg, UpdatePresenceServerMsg, UpdateStorageClientMsg, UpdateStorageServerMsg, UpdateYDocClientMsg, User, UserJoinServerMsg, UserLeftServerMsg, WebsocketCloseCodes, asPos, assert, assertNever, b64decode, fancyConsole as console, createAsyncCache, createClient, createCommentsApi, deprecate, deprecateIf, detectDupes, errorIf, freeze, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, nn, patchLiveObjectKey, shallow, throwUsageError, toPlainLson, tryParseJson, withTimeout };
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ var __export = (target, all) => {
|
|
|
6
6
|
|
|
7
7
|
// src/version.ts
|
|
8
8
|
var PKG_NAME = "@liveblocks/core";
|
|
9
|
-
var PKG_VERSION = "1.3.
|
|
9
|
+
var PKG_VERSION = "1.3.6";
|
|
10
10
|
var PKG_FORMAT = "cjs";
|
|
11
11
|
|
|
12
12
|
// src/dupe-detection.ts
|
|
@@ -4596,7 +4596,7 @@ var DerivedRef = class extends ImmutableRef {
|
|
|
4596
4596
|
};
|
|
4597
4597
|
|
|
4598
4598
|
// src/room.ts
|
|
4599
|
-
var
|
|
4599
|
+
var MAX_SOCKET_MESSAGE_SIZE = 1024 * 1024 - 1024;
|
|
4600
4600
|
function makeIdFactory(connectionId) {
|
|
4601
4601
|
let count = 0;
|
|
4602
4602
|
return () => `${connectionId}:${count++}`;
|
|
@@ -4811,17 +4811,35 @@ function createRoom(options, config) {
|
|
|
4811
4811
|
ydoc: makeEventSource(),
|
|
4812
4812
|
comments: makeEventSource()
|
|
4813
4813
|
};
|
|
4814
|
-
function
|
|
4815
|
-
const
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4814
|
+
async function httpSend(authTokenOrPublicApiKey, roomId, nonce, messages) {
|
|
4815
|
+
const baseUrl = new URL(config.liveblocksServer);
|
|
4816
|
+
baseUrl.protocol = "https";
|
|
4817
|
+
const url = new URL(
|
|
4818
|
+
`/v2/c/rooms/${encodeURIComponent(roomId)}/send-message`,
|
|
4819
|
+
baseUrl
|
|
4820
|
+
);
|
|
4821
|
+
const fetcher = _optionalChain([config, 'access', _115 => _115.polyfills, 'optionalAccess', _116 => _116.fetch]) || /* istanbul ignore next */
|
|
4822
|
+
fetch;
|
|
4823
|
+
return fetcher(url.toString(), {
|
|
4824
|
+
method: "POST",
|
|
4825
|
+
headers: {
|
|
4826
|
+
"Content-Type": "application/json",
|
|
4827
|
+
Authorization: `Bearer ${authTokenOrPublicApiKey}`
|
|
4828
|
+
},
|
|
4829
|
+
body: JSON.stringify({ nonce, messages })
|
|
4830
|
+
});
|
|
4831
|
+
}
|
|
4832
|
+
function sendMessages(messages) {
|
|
4833
|
+
const serializedPayload = JSON.stringify(messages);
|
|
4834
|
+
const nonce = _optionalChain([context, 'access', _117 => _117.dynamicSessionInfo, 'access', _118 => _118.current, 'optionalAccess', _119 => _119.nonce]);
|
|
4835
|
+
if (config.unstable_fallbackToHTTP && managedSocket.authValue && nonce) {
|
|
4836
|
+
const size = new TextEncoder().encode(serializedPayload).length;
|
|
4837
|
+
if (size > MAX_SOCKET_MESSAGE_SIZE) {
|
|
4820
4838
|
void httpSend(
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4839
|
+
managedSocket.authValue.type === "public" ? managedSocket.authValue.publicApiKey : managedSocket.authValue.token.raw,
|
|
4840
|
+
config.roomId,
|
|
4841
|
+
nonce,
|
|
4842
|
+
messages
|
|
4825
4843
|
).then((resp) => {
|
|
4826
4844
|
if (!resp.ok && resp.status === 403) {
|
|
4827
4845
|
managedSocket.reconnect();
|
|
@@ -4833,7 +4851,7 @@ function createRoom(options, config) {
|
|
|
4833
4851
|
return;
|
|
4834
4852
|
}
|
|
4835
4853
|
}
|
|
4836
|
-
managedSocket.send(
|
|
4854
|
+
managedSocket.send(serializedPayload);
|
|
4837
4855
|
}
|
|
4838
4856
|
const self = new DerivedRef(
|
|
4839
4857
|
context.staticSessionInfo,
|
|
@@ -5080,7 +5098,7 @@ function createRoom(options, config) {
|
|
|
5080
5098
|
}
|
|
5081
5099
|
context.myPresence.patch(patch);
|
|
5082
5100
|
if (context.activeBatch) {
|
|
5083
|
-
if (_optionalChain([options2, 'optionalAccess',
|
|
5101
|
+
if (_optionalChain([options2, 'optionalAccess', _120 => _120.addToHistory])) {
|
|
5084
5102
|
context.activeBatch.reverseOps.unshift({
|
|
5085
5103
|
type: "presence",
|
|
5086
5104
|
data: oldValues
|
|
@@ -5090,7 +5108,7 @@ function createRoom(options, config) {
|
|
|
5090
5108
|
} else {
|
|
5091
5109
|
flushNowOrSoon();
|
|
5092
5110
|
batchUpdates(() => {
|
|
5093
|
-
if (_optionalChain([options2, 'optionalAccess',
|
|
5111
|
+
if (_optionalChain([options2, 'optionalAccess', _121 => _121.addToHistory])) {
|
|
5094
5112
|
addToUndoStack(
|
|
5095
5113
|
[{ type: "presence", data: oldValues }],
|
|
5096
5114
|
doNotBatchUpdates
|
|
@@ -5133,6 +5151,7 @@ function createRoom(options, config) {
|
|
|
5133
5151
|
function onRoomStateMessage(message, batchedUpdatesWrapper) {
|
|
5134
5152
|
context.dynamicSessionInfo.set({
|
|
5135
5153
|
actor: message.actor,
|
|
5154
|
+
nonce: message.nonce,
|
|
5136
5155
|
scopes: message.scopes
|
|
5137
5156
|
});
|
|
5138
5157
|
context.idFactory = makeIdFactory(message.actor);
|
|
@@ -5267,7 +5286,7 @@ function createRoom(options, config) {
|
|
|
5267
5286
|
const unacknowledgedOps = new Map(context.unacknowledgedOps);
|
|
5268
5287
|
createOrUpdateRootFromMessage(message, doNotBatchUpdates);
|
|
5269
5288
|
applyAndSendOps(unacknowledgedOps, doNotBatchUpdates);
|
|
5270
|
-
_optionalChain([_resolveStoragePromise, 'optionalCall',
|
|
5289
|
+
_optionalChain([_resolveStoragePromise, 'optionalCall', _122 => _122()]);
|
|
5271
5290
|
notifyStorageStatus();
|
|
5272
5291
|
eventHub.storageDidLoad.notify();
|
|
5273
5292
|
break;
|
|
@@ -5290,7 +5309,7 @@ function createRoom(options, config) {
|
|
|
5290
5309
|
if (process.env.NODE_ENV !== "production") {
|
|
5291
5310
|
const traces = /* @__PURE__ */ new Set();
|
|
5292
5311
|
for (const opId of message.opIds) {
|
|
5293
|
-
const trace = _optionalChain([context, 'access',
|
|
5312
|
+
const trace = _optionalChain([context, 'access', _123 => _123.opStackTraces, 'optionalAccess', _124 => _124.get, 'call', _125 => _125(opId)]);
|
|
5294
5313
|
if (trace) {
|
|
5295
5314
|
traces.add(trace);
|
|
5296
5315
|
}
|
|
@@ -5598,7 +5617,7 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
5598
5617
|
/* NOTE: Exposing __internal here only to allow testing implementation details in unit tests */
|
|
5599
5618
|
__internal: {
|
|
5600
5619
|
get presenceBuffer() {
|
|
5601
|
-
return deepClone(_nullishCoalesce(_optionalChain([context, 'access',
|
|
5620
|
+
return deepClone(_nullishCoalesce(_optionalChain([context, 'access', _126 => _126.buffer, 'access', _127 => _127.presenceUpdates, 'optionalAccess', _128 => _128.data]), () => ( null)));
|
|
5602
5621
|
},
|
|
5603
5622
|
// prettier-ignore
|
|
5604
5623
|
get undoStack() {
|
|
@@ -5734,7 +5753,7 @@ function makeClassicSubscribeFn(events) {
|
|
|
5734
5753
|
}
|
|
5735
5754
|
if (isLiveNode(first)) {
|
|
5736
5755
|
const node = first;
|
|
5737
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
5756
|
+
if (_optionalChain([options, 'optionalAccess', _129 => _129.isDeep])) {
|
|
5738
5757
|
const storageCallback = second;
|
|
5739
5758
|
return subscribeToLiveStructureDeeply(node, storageCallback);
|
|
5740
5759
|
} else {
|
|
@@ -5777,18 +5796,6 @@ function makeCreateSocketDelegateForRoom(roomId, liveblocksServer, WebSocketPoly
|
|
|
5777
5796
|
return new ws(url.toString());
|
|
5778
5797
|
};
|
|
5779
5798
|
}
|
|
5780
|
-
async function httpSend(message, token, endpoint, fetchPolyfill) {
|
|
5781
|
-
const fetcher = fetchPolyfill || /* istanbul ignore next */
|
|
5782
|
-
fetch;
|
|
5783
|
-
return fetcher(endpoint, {
|
|
5784
|
-
method: "POST",
|
|
5785
|
-
headers: {
|
|
5786
|
-
"Content-Type": "application/json",
|
|
5787
|
-
Authorization: `Bearer ${token}`
|
|
5788
|
-
},
|
|
5789
|
-
body: message
|
|
5790
|
-
});
|
|
5791
|
-
}
|
|
5792
5799
|
|
|
5793
5800
|
// src/client.ts
|
|
5794
5801
|
var MIN_THROTTLE = 16;
|
|
@@ -5837,17 +5844,13 @@ function createClient(options) {
|
|
|
5837
5844
|
createSocket: makeCreateSocketDelegateForRoom(
|
|
5838
5845
|
roomId,
|
|
5839
5846
|
getServerFromClientOptions(clientOptions),
|
|
5840
|
-
_optionalChain([clientOptions, 'access',
|
|
5847
|
+
_optionalChain([clientOptions, 'access', _130 => _130.polyfills, 'optionalAccess', _131 => _131.WebSocket])
|
|
5841
5848
|
),
|
|
5842
5849
|
authenticate: makeAuthDelegateForRoom(roomId, authManager)
|
|
5843
5850
|
})),
|
|
5844
5851
|
enableDebugLogging: clientOptions.enableDebugLogging,
|
|
5845
|
-
unstable_batchedUpdates: _optionalChain([options2, 'optionalAccess',
|
|
5852
|
+
unstable_batchedUpdates: _optionalChain([options2, 'optionalAccess', _132 => _132.unstable_batchedUpdates]),
|
|
5846
5853
|
liveblocksServer: getServerFromClientOptions(clientOptions),
|
|
5847
|
-
httpSendEndpoint: buildLiveblocksHttpSendEndpoint(
|
|
5848
|
-
clientOptions,
|
|
5849
|
-
roomId
|
|
5850
|
-
),
|
|
5851
5854
|
unstable_fallbackToHTTP: !!clientOptions.unstable_fallbackToHTTP
|
|
5852
5855
|
}
|
|
5853
5856
|
);
|
|
@@ -5857,7 +5860,7 @@ function createClient(options) {
|
|
|
5857
5860
|
const shouldConnect = _nullishCoalesce(options2.shouldInitiallyConnect, () => ( true));
|
|
5858
5861
|
if (shouldConnect) {
|
|
5859
5862
|
if (typeof atob === "undefined") {
|
|
5860
|
-
if (_optionalChain([clientOptions, 'access',
|
|
5863
|
+
if (_optionalChain([clientOptions, 'access', _133 => _133.polyfills, 'optionalAccess', _134 => _134.atob]) === void 0) {
|
|
5861
5864
|
throw new Error(
|
|
5862
5865
|
"You need to polyfill atob to use the client in your environment. Please follow the instructions at https://liveblocks.io/docs/errors/liveblocks-client/atob-polyfill"
|
|
5863
5866
|
);
|
|
@@ -5902,14 +5905,6 @@ function getLostConnectionTimeout(value) {
|
|
|
5902
5905
|
RECOMMENDED_MIN_LOST_CONNECTION_TIMEOUT
|
|
5903
5906
|
);
|
|
5904
5907
|
}
|
|
5905
|
-
function buildLiveblocksHttpSendEndpoint(options, roomId) {
|
|
5906
|
-
if (options.httpSendEndpoint) {
|
|
5907
|
-
return options.httpSendEndpoint.replace("{roomId}", roomId);
|
|
5908
|
-
}
|
|
5909
|
-
return `https://api.liveblocks.io/v2/rooms/${encodeURIComponent(
|
|
5910
|
-
roomId
|
|
5911
|
-
)}/send-message`;
|
|
5912
|
-
}
|
|
5913
5908
|
|
|
5914
5909
|
// src/crdts/utils.ts
|
|
5915
5910
|
function toPlainLson(lson) {
|
|
@@ -6140,12 +6135,12 @@ function legacy_patchImmutableNode(state, path, update) {
|
|
|
6140
6135
|
}
|
|
6141
6136
|
const newState = Object.assign({}, state);
|
|
6142
6137
|
for (const key in update.updates) {
|
|
6143
|
-
if (_optionalChain([update, 'access',
|
|
6138
|
+
if (_optionalChain([update, 'access', _135 => _135.updates, 'access', _136 => _136[key], 'optionalAccess', _137 => _137.type]) === "update") {
|
|
6144
6139
|
const val = update.node.get(key);
|
|
6145
6140
|
if (val !== void 0) {
|
|
6146
6141
|
newState[key] = lsonToJson(val);
|
|
6147
6142
|
}
|
|
6148
|
-
} else if (_optionalChain([update, 'access',
|
|
6143
|
+
} else if (_optionalChain([update, 'access', _138 => _138.updates, 'access', _139 => _139[key], 'optionalAccess', _140 => _140.type]) === "delete") {
|
|
6149
6144
|
delete newState[key];
|
|
6150
6145
|
}
|
|
6151
6146
|
}
|
|
@@ -6206,12 +6201,12 @@ function legacy_patchImmutableNode(state, path, update) {
|
|
|
6206
6201
|
}
|
|
6207
6202
|
const newState = Object.assign({}, state);
|
|
6208
6203
|
for (const key in update.updates) {
|
|
6209
|
-
if (_optionalChain([update, 'access',
|
|
6204
|
+
if (_optionalChain([update, 'access', _141 => _141.updates, 'access', _142 => _142[key], 'optionalAccess', _143 => _143.type]) === "update") {
|
|
6210
6205
|
const value = update.node.get(key);
|
|
6211
6206
|
if (value !== void 0) {
|
|
6212
6207
|
newState[key] = lsonToJson(value);
|
|
6213
6208
|
}
|
|
6214
|
-
} else if (_optionalChain([update, 'access',
|
|
6209
|
+
} else if (_optionalChain([update, 'access', _144 => _144.updates, 'access', _145 => _145[key], 'optionalAccess', _146 => _146.type]) === "delete") {
|
|
6215
6210
|
delete newState[key];
|
|
6216
6211
|
}
|
|
6217
6212
|
}
|
|
@@ -6301,7 +6296,7 @@ function createCacheItem(key, defaultAsyncFunction, options) {
|
|
|
6301
6296
|
let previousState = { isLoading: false };
|
|
6302
6297
|
const eventSource2 = makeEventSource();
|
|
6303
6298
|
function notify() {
|
|
6304
|
-
const isEqual = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
6299
|
+
const isEqual = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _147 => _147.isStateEqual]), () => ( isShallowEqual));
|
|
6305
6300
|
if (!isEqual(previousState, state)) {
|
|
6306
6301
|
previousState = state;
|
|
6307
6302
|
eventSource2.notify(state);
|
|
@@ -6380,7 +6375,7 @@ function createAsyncCache(asyncFunction, options) {
|
|
|
6380
6375
|
return create(key).get();
|
|
6381
6376
|
}
|
|
6382
6377
|
function getState(key) {
|
|
6383
|
-
return _optionalChain([cache, 'access',
|
|
6378
|
+
return _optionalChain([cache, 'access', _148 => _148.get, 'call', _149 => _149(key), 'optionalAccess', _150 => _150.getState, 'call', _151 => _151()]);
|
|
6384
6379
|
}
|
|
6385
6380
|
function revalidate(key) {
|
|
6386
6381
|
return create(key).revalidate();
|