@liveblocks/core 1.9.2-portal1 → 1.9.3
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 +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +59 -27
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +41 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -775,13 +775,13 @@ declare type Options = {
|
|
|
775
775
|
declare type PartialNullable<T> = {
|
|
776
776
|
[P in keyof T]?: T[P] | null | undefined;
|
|
777
777
|
};
|
|
778
|
-
declare type
|
|
778
|
+
declare type GetThreadsOptions<TThreadMetadata extends BaseMetadata> = {
|
|
779
779
|
query?: {
|
|
780
780
|
metadata?: Partial<TThreadMetadata>;
|
|
781
781
|
};
|
|
782
782
|
};
|
|
783
783
|
declare type CommentsApi<TThreadMetadata extends BaseMetadata> = {
|
|
784
|
-
getThreads(options?:
|
|
784
|
+
getThreads(options?: GetThreadsOptions<TThreadMetadata>): Promise<ThreadData<TThreadMetadata>[]>;
|
|
785
785
|
createThread(options: {
|
|
786
786
|
threadId: string;
|
|
787
787
|
commentId: string;
|
|
@@ -1947,6 +1947,7 @@ declare type ClientOptions = {
|
|
|
1947
1947
|
backgroundKeepAliveTimeout?: number;
|
|
1948
1948
|
polyfills?: Polyfills;
|
|
1949
1949
|
unstable_fallbackToHTTP?: boolean;
|
|
1950
|
+
unstable_streamData?: boolean;
|
|
1950
1951
|
/**
|
|
1951
1952
|
* @deprecated Use `polyfills: { fetch: ... }` instead.
|
|
1952
1953
|
* This option will be removed in a future release.
|
|
@@ -2587,4 +2588,4 @@ declare type EnsureJson<T> = [
|
|
|
2587
2588
|
[K in keyof T]: EnsureJson<T[K]>;
|
|
2588
2589
|
};
|
|
2589
2590
|
|
|
2590
|
-
export { type AckOp, type AsyncCache, type AsyncState, type AsyncStateError, type AsyncStateInitial, type AsyncStateLoading, type AsyncStateResolved, type AsyncStateSuccess, type BaseAuthResult, type BaseMetadata, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type Client, type ClientMsg, ClientMsgCode, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyResolveUsersArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, type CommentsApi, CommentsApiError, CrdtType, type CreateListOp, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type CustomAuthenticationResult, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type History, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IdTuple, type Immutable, type InitialDocumentStateServerMsg, type Json, type JsonArray, type JsonObject, type JsonScalar, type LegacyConnectionStatus, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, type LostConnectionEvent, type Lson, type LsonObject, type NodeMap, type Op, OpCode, type Others, type OthersEvent, type ParentToChildNodeMap, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type RejectedStorageOpServerMsg, type Resolve, type Room, type RoomEventMessage, type RoomInitializers, type RoomStateServerMsg, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type SetParentKeyOp, type Status, type StorageStatus, type StorageUpdate, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type ThreadData, type ThreadDataPlain, type
|
|
2591
|
+
export { type AckOp, type AsyncCache, type AsyncState, type AsyncStateError, type AsyncStateInitial, type AsyncStateLoading, type AsyncStateResolved, type AsyncStateSuccess, type BaseAuthResult, type BaseMetadata, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type Client, type ClientMsg, ClientMsgCode, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyResolveUsersArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, type CommentsApi, CommentsApiError, CrdtType, type CreateListOp, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type CustomAuthenticationResult, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type History, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IdTuple, type Immutable, type InitialDocumentStateServerMsg, type Json, type JsonArray, type JsonObject, type JsonScalar, type LegacyConnectionStatus, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, type LostConnectionEvent, type Lson, type LsonObject, type NodeMap, type Op, OpCode, type Others, type OthersEvent, type ParentToChildNodeMap, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type RejectedStorageOpServerMsg, type Resolve, type Room, type RoomEventMessage, type RoomInitializers, type RoomStateServerMsg, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type SetParentKeyOp, type Status, type StorageStatus, type StorageUpdate, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type ThreadData, type ThreadDataPlain, type ToImmutable, type ToJson, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type User, type UserJoinServerMsg, type UserLeftServerMsg, WebsocketCloseCodes, type YDocUpdateServerMsg, ackOp, asPos, assert, assertNever, b64decode, cloneLson, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToThreadData, createAsyncCache, createClient, createCommentsApi, deprecate, deprecateIf, detectDupes, errorIf, freeze, getMentionedIdsFromCommentBody, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, nn, patchLiveObjectKey, raise, shallow, stringify, stringifyCommentBody, throwUsageError, toPlainLson, tryParseJson, withTimeout };
|
package/dist/index.d.ts
CHANGED
|
@@ -775,13 +775,13 @@ declare type Options = {
|
|
|
775
775
|
declare type PartialNullable<T> = {
|
|
776
776
|
[P in keyof T]?: T[P] | null | undefined;
|
|
777
777
|
};
|
|
778
|
-
declare type
|
|
778
|
+
declare type GetThreadsOptions<TThreadMetadata extends BaseMetadata> = {
|
|
779
779
|
query?: {
|
|
780
780
|
metadata?: Partial<TThreadMetadata>;
|
|
781
781
|
};
|
|
782
782
|
};
|
|
783
783
|
declare type CommentsApi<TThreadMetadata extends BaseMetadata> = {
|
|
784
|
-
getThreads(options?:
|
|
784
|
+
getThreads(options?: GetThreadsOptions<TThreadMetadata>): Promise<ThreadData<TThreadMetadata>[]>;
|
|
785
785
|
createThread(options: {
|
|
786
786
|
threadId: string;
|
|
787
787
|
commentId: string;
|
|
@@ -1947,6 +1947,7 @@ declare type ClientOptions = {
|
|
|
1947
1947
|
backgroundKeepAliveTimeout?: number;
|
|
1948
1948
|
polyfills?: Polyfills;
|
|
1949
1949
|
unstable_fallbackToHTTP?: boolean;
|
|
1950
|
+
unstable_streamData?: boolean;
|
|
1950
1951
|
/**
|
|
1951
1952
|
* @deprecated Use `polyfills: { fetch: ... }` instead.
|
|
1952
1953
|
* This option will be removed in a future release.
|
|
@@ -2587,4 +2588,4 @@ declare type EnsureJson<T> = [
|
|
|
2587
2588
|
[K in keyof T]: EnsureJson<T[K]>;
|
|
2588
2589
|
};
|
|
2589
2590
|
|
|
2590
|
-
export { type AckOp, type AsyncCache, type AsyncState, type AsyncStateError, type AsyncStateInitial, type AsyncStateLoading, type AsyncStateResolved, type AsyncStateSuccess, type BaseAuthResult, type BaseMetadata, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type Client, type ClientMsg, ClientMsgCode, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyResolveUsersArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, type CommentsApi, CommentsApiError, CrdtType, type CreateListOp, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type CustomAuthenticationResult, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type History, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IdTuple, type Immutable, type InitialDocumentStateServerMsg, type Json, type JsonArray, type JsonObject, type JsonScalar, type LegacyConnectionStatus, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, type LostConnectionEvent, type Lson, type LsonObject, type NodeMap, type Op, OpCode, type Others, type OthersEvent, type ParentToChildNodeMap, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type RejectedStorageOpServerMsg, type Resolve, type Room, type RoomEventMessage, type RoomInitializers, type RoomStateServerMsg, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type SetParentKeyOp, type Status, type StorageStatus, type StorageUpdate, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type ThreadData, type ThreadDataPlain, type
|
|
2591
|
+
export { type AckOp, type AsyncCache, type AsyncState, type AsyncStateError, type AsyncStateInitial, type AsyncStateLoading, type AsyncStateResolved, type AsyncStateSuccess, type BaseAuthResult, type BaseMetadata, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type Client, type ClientMsg, ClientMsgCode, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyResolveUsersArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, type CommentsApi, CommentsApiError, CrdtType, type CreateListOp, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type CustomAuthenticationResult, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type History, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IdTuple, type Immutable, type InitialDocumentStateServerMsg, type Json, type JsonArray, type JsonObject, type JsonScalar, type LegacyConnectionStatus, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, type LostConnectionEvent, type Lson, type LsonObject, type NodeMap, type Op, OpCode, type Others, type OthersEvent, type ParentToChildNodeMap, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type RejectedStorageOpServerMsg, type Resolve, type Room, type RoomEventMessage, type RoomInitializers, type RoomStateServerMsg, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type SetParentKeyOp, type Status, type StorageStatus, type StorageUpdate, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type ThreadData, type ThreadDataPlain, type ToImmutable, type ToJson, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type User, type UserJoinServerMsg, type UserLeftServerMsg, WebsocketCloseCodes, type YDocUpdateServerMsg, ackOp, asPos, assert, assertNever, b64decode, cloneLson, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToThreadData, createAsyncCache, createClient, createCommentsApi, deprecate, deprecateIf, detectDupes, errorIf, freeze, getMentionedIdsFromCommentBody, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, nn, patchLiveObjectKey, raise, shallow, stringify, stringifyCommentBody, 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.9.
|
|
9
|
+
var PKG_VERSION = "1.9.3";
|
|
10
10
|
var PKG_FORMAT = "cjs";
|
|
11
11
|
|
|
12
12
|
// src/dupe-detection.ts
|
|
@@ -5371,6 +5371,21 @@ function createRoom(options, config) {
|
|
|
5371
5371
|
ydoc: makeEventSource(),
|
|
5372
5372
|
comments: makeEventSource()
|
|
5373
5373
|
};
|
|
5374
|
+
async function streamFetch(authTokenOrPublicApiKey, roomId) {
|
|
5375
|
+
const url = new URL(
|
|
5376
|
+
`/v2/c/rooms/${encodeURIComponent(roomId)}/storage`,
|
|
5377
|
+
config.baseUrl
|
|
5378
|
+
).toString();
|
|
5379
|
+
const fetcher = _optionalChain([config, 'access', _134 => _134.polyfills, 'optionalAccess', _135 => _135.fetch]) || /* istanbul ignore next */
|
|
5380
|
+
fetch;
|
|
5381
|
+
return fetcher(url.toString(), {
|
|
5382
|
+
method: "GET",
|
|
5383
|
+
headers: {
|
|
5384
|
+
"Content-Type": "application/json",
|
|
5385
|
+
Authorization: `Bearer ${authTokenOrPublicApiKey}`
|
|
5386
|
+
}
|
|
5387
|
+
});
|
|
5388
|
+
}
|
|
5374
5389
|
async function httpPostToRoom(endpoint, body) {
|
|
5375
5390
|
if (!managedSocket.authValue) {
|
|
5376
5391
|
throw new Error("Not authorized");
|
|
@@ -5380,7 +5395,7 @@ function createRoom(options, config) {
|
|
|
5380
5395
|
`/v2/c/rooms/${encodeURIComponent(config.roomId)}${endpoint}`,
|
|
5381
5396
|
config.baseUrl
|
|
5382
5397
|
).toString();
|
|
5383
|
-
const fetcher = _optionalChain([config, 'access',
|
|
5398
|
+
const fetcher = _optionalChain([config, 'access', _136 => _136.polyfills, 'optionalAccess', _137 => _137.fetch]) || /* istanbul ignore next */
|
|
5384
5399
|
fetch;
|
|
5385
5400
|
return fetcher(url, {
|
|
5386
5401
|
method: "POST",
|
|
@@ -5393,7 +5408,7 @@ function createRoom(options, config) {
|
|
|
5393
5408
|
}
|
|
5394
5409
|
function sendMessages(messages) {
|
|
5395
5410
|
const serializedPayload = JSON.stringify(messages);
|
|
5396
|
-
const nonce = _optionalChain([context, 'access',
|
|
5411
|
+
const nonce = _optionalChain([context, 'access', _138 => _138.dynamicSessionInfo, 'access', _139 => _139.current, 'optionalAccess', _140 => _140.nonce]);
|
|
5397
5412
|
if (config.unstable_fallbackToHTTP && nonce) {
|
|
5398
5413
|
const size = new TextEncoder().encode(serializedPayload).length;
|
|
5399
5414
|
if (size > MAX_SOCKET_MESSAGE_SIZE) {
|
|
@@ -5655,7 +5670,7 @@ function createRoom(options, config) {
|
|
|
5655
5670
|
}
|
|
5656
5671
|
context.myPresence.patch(patch);
|
|
5657
5672
|
if (context.activeBatch) {
|
|
5658
|
-
if (_optionalChain([options2, 'optionalAccess',
|
|
5673
|
+
if (_optionalChain([options2, 'optionalAccess', _141 => _141.addToHistory])) {
|
|
5659
5674
|
context.activeBatch.reverseOps.unshift({
|
|
5660
5675
|
type: "presence",
|
|
5661
5676
|
data: oldValues
|
|
@@ -5665,7 +5680,7 @@ function createRoom(options, config) {
|
|
|
5665
5680
|
} else {
|
|
5666
5681
|
flushNowOrSoon();
|
|
5667
5682
|
batchUpdates(() => {
|
|
5668
|
-
if (_optionalChain([options2, 'optionalAccess',
|
|
5683
|
+
if (_optionalChain([options2, 'optionalAccess', _142 => _142.addToHistory])) {
|
|
5669
5684
|
addToUndoStack(
|
|
5670
5685
|
[{ type: "presence", data: oldValues }],
|
|
5671
5686
|
doNotBatchUpdates
|
|
@@ -5842,12 +5857,7 @@ function createRoom(options, config) {
|
|
|
5842
5857
|
break;
|
|
5843
5858
|
}
|
|
5844
5859
|
case 200 /* INITIAL_STORAGE_STATE */: {
|
|
5845
|
-
|
|
5846
|
-
createOrUpdateRootFromMessage(message, doNotBatchUpdates);
|
|
5847
|
-
applyAndSendOps(unacknowledgedOps, doNotBatchUpdates);
|
|
5848
|
-
_optionalChain([_resolveStoragePromise, 'optionalCall', _141 => _141()]);
|
|
5849
|
-
notifyStorageStatus();
|
|
5850
|
-
eventHub.storageDidLoad.notify();
|
|
5860
|
+
processInitialStorage(message);
|
|
5851
5861
|
break;
|
|
5852
5862
|
}
|
|
5853
5863
|
case 201 /* UPDATE_STORAGE */: {
|
|
@@ -5868,7 +5878,7 @@ function createRoom(options, config) {
|
|
|
5868
5878
|
if (process.env.NODE_ENV !== "production") {
|
|
5869
5879
|
const traces = /* @__PURE__ */ new Set();
|
|
5870
5880
|
for (const opId of message.opIds) {
|
|
5871
|
-
const trace = _optionalChain([context, 'access',
|
|
5881
|
+
const trace = _optionalChain([context, 'access', _143 => _143.opStackTraces, 'optionalAccess', _144 => _144.get, 'call', _145 => _145(opId)]);
|
|
5872
5882
|
if (trace) {
|
|
5873
5883
|
traces.add(trace);
|
|
5874
5884
|
}
|
|
@@ -5993,9 +6003,30 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
5993
6003
|
}
|
|
5994
6004
|
let _getStorage$ = null;
|
|
5995
6005
|
let _resolveStoragePromise = null;
|
|
6006
|
+
function processInitialStorage(message) {
|
|
6007
|
+
const unacknowledgedOps = new Map(context.unacknowledgedOps);
|
|
6008
|
+
createOrUpdateRootFromMessage(message, doNotBatchUpdates);
|
|
6009
|
+
applyAndSendOps(unacknowledgedOps, doNotBatchUpdates);
|
|
6010
|
+
_optionalChain([_resolveStoragePromise, 'optionalCall', _146 => _146()]);
|
|
6011
|
+
notifyStorageStatus();
|
|
6012
|
+
eventHub.storageDidLoad.notify();
|
|
6013
|
+
}
|
|
6014
|
+
async function streamStorage() {
|
|
6015
|
+
if (!managedSocket.authValue) {
|
|
6016
|
+
return;
|
|
6017
|
+
}
|
|
6018
|
+
const result = await streamFetch(
|
|
6019
|
+
managedSocket.authValue.type === "public" ? managedSocket.authValue.publicApiKey : managedSocket.authValue.token.raw,
|
|
6020
|
+
config.roomId
|
|
6021
|
+
);
|
|
6022
|
+
const items = await result.json();
|
|
6023
|
+
processInitialStorage({ type: 200 /* INITIAL_STORAGE_STATE */, items });
|
|
6024
|
+
}
|
|
5996
6025
|
function refreshStorage(options2) {
|
|
5997
6026
|
const messages = context.buffer.messages;
|
|
5998
|
-
if (
|
|
6027
|
+
if (config.unstable_streamData) {
|
|
6028
|
+
void streamStorage();
|
|
6029
|
+
} else if (!messages.some((msg) => msg.type === 200 /* FETCH_STORAGE */)) {
|
|
5999
6030
|
messages.push({ type: 200 /* FETCH_STORAGE */ });
|
|
6000
6031
|
}
|
|
6001
6032
|
if (options2.flush) {
|
|
@@ -6181,7 +6212,7 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
6181
6212
|
/* NOTE: Exposing __internal here only to allow testing implementation details in unit tests */
|
|
6182
6213
|
__internal: {
|
|
6183
6214
|
get presenceBuffer() {
|
|
6184
|
-
return deepClone(_nullishCoalesce(_optionalChain([context, 'access',
|
|
6215
|
+
return deepClone(_nullishCoalesce(_optionalChain([context, 'access', _147 => _147.buffer, 'access', _148 => _148.presenceUpdates, 'optionalAccess', _149 => _149.data]), () => ( null)));
|
|
6185
6216
|
},
|
|
6186
6217
|
// prettier-ignore
|
|
6187
6218
|
get undoStack() {
|
|
@@ -6323,7 +6354,7 @@ function makeClassicSubscribeFn(events) {
|
|
|
6323
6354
|
}
|
|
6324
6355
|
if (isLiveNode(first)) {
|
|
6325
6356
|
const node = first;
|
|
6326
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
6357
|
+
if (_optionalChain([options, 'optionalAccess', _150 => _150.isDeep])) {
|
|
6327
6358
|
const storageCallback = second;
|
|
6328
6359
|
return subscribeToLiveStructureDeeply(node, storageCallback);
|
|
6329
6360
|
} else {
|
|
@@ -6448,14 +6479,15 @@ function createClient(options) {
|
|
|
6448
6479
|
createSocket: makeCreateSocketDelegateForRoom(
|
|
6449
6480
|
roomId,
|
|
6450
6481
|
baseUrl,
|
|
6451
|
-
_optionalChain([clientOptions, 'access',
|
|
6482
|
+
_optionalChain([clientOptions, 'access', _151 => _151.polyfills, 'optionalAccess', _152 => _152.WebSocket])
|
|
6452
6483
|
),
|
|
6453
6484
|
authenticate: makeAuthDelegateForRoom(roomId, authManager)
|
|
6454
6485
|
})),
|
|
6455
6486
|
enableDebugLogging: clientOptions.enableDebugLogging,
|
|
6456
|
-
unstable_batchedUpdates: _optionalChain([options2, 'optionalAccess',
|
|
6487
|
+
unstable_batchedUpdates: _optionalChain([options2, 'optionalAccess', _153 => _153.unstable_batchedUpdates]),
|
|
6457
6488
|
baseUrl,
|
|
6458
|
-
unstable_fallbackToHTTP: !!clientOptions.unstable_fallbackToHTTP
|
|
6489
|
+
unstable_fallbackToHTTP: !!clientOptions.unstable_fallbackToHTTP,
|
|
6490
|
+
unstable_streamData: !!clientOptions.unstable_streamData
|
|
6459
6491
|
}
|
|
6460
6492
|
);
|
|
6461
6493
|
const newRoomInfo = {
|
|
@@ -6468,7 +6500,7 @@ function createClient(options) {
|
|
|
6468
6500
|
const shouldConnect = _nullishCoalesce(_nullishCoalesce(options2.autoConnect, () => ( options2.shouldInitiallyConnect)), () => ( true));
|
|
6469
6501
|
if (shouldConnect) {
|
|
6470
6502
|
if (typeof atob === "undefined") {
|
|
6471
|
-
if (_optionalChain([clientOptions, 'access',
|
|
6503
|
+
if (_optionalChain([clientOptions, 'access', _154 => _154.polyfills, 'optionalAccess', _155 => _155.atob]) === void 0) {
|
|
6472
6504
|
throw new Error(
|
|
6473
6505
|
"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"
|
|
6474
6506
|
);
|
|
@@ -6484,11 +6516,11 @@ function createClient(options) {
|
|
|
6484
6516
|
return room;
|
|
6485
6517
|
}
|
|
6486
6518
|
function getRoom(roomId) {
|
|
6487
|
-
const room = _optionalChain([roomsById, 'access',
|
|
6519
|
+
const room = _optionalChain([roomsById, 'access', _156 => _156.get, 'call', _157 => _157(roomId), 'optionalAccess', _158 => _158.room]);
|
|
6488
6520
|
return room ? room : null;
|
|
6489
6521
|
}
|
|
6490
6522
|
function forceLeave(roomId) {
|
|
6491
|
-
const unsubs = _nullishCoalesce(_optionalChain([roomsById, 'access',
|
|
6523
|
+
const unsubs = _nullishCoalesce(_optionalChain([roomsById, 'access', _159 => _159.get, 'call', _160 => _160(roomId), 'optionalAccess', _161 => _161.unsubs]), () => ( /* @__PURE__ */ new Set()));
|
|
6492
6524
|
for (const unsub of unsubs) {
|
|
6493
6525
|
unsub();
|
|
6494
6526
|
}
|
|
@@ -6769,12 +6801,12 @@ function legacy_patchImmutableNode(state, path, update) {
|
|
|
6769
6801
|
}
|
|
6770
6802
|
const newState = Object.assign({}, state);
|
|
6771
6803
|
for (const key in update.updates) {
|
|
6772
|
-
if (_optionalChain([update, 'access',
|
|
6804
|
+
if (_optionalChain([update, 'access', _162 => _162.updates, 'access', _163 => _163[key], 'optionalAccess', _164 => _164.type]) === "update") {
|
|
6773
6805
|
const val = update.node.get(key);
|
|
6774
6806
|
if (val !== void 0) {
|
|
6775
6807
|
newState[key] = lsonToJson(val);
|
|
6776
6808
|
}
|
|
6777
|
-
} else if (_optionalChain([update, 'access',
|
|
6809
|
+
} else if (_optionalChain([update, 'access', _165 => _165.updates, 'access', _166 => _166[key], 'optionalAccess', _167 => _167.type]) === "delete") {
|
|
6778
6810
|
delete newState[key];
|
|
6779
6811
|
}
|
|
6780
6812
|
}
|
|
@@ -6835,12 +6867,12 @@ function legacy_patchImmutableNode(state, path, update) {
|
|
|
6835
6867
|
}
|
|
6836
6868
|
const newState = Object.assign({}, state);
|
|
6837
6869
|
for (const key in update.updates) {
|
|
6838
|
-
if (_optionalChain([update, 'access',
|
|
6870
|
+
if (_optionalChain([update, 'access', _168 => _168.updates, 'access', _169 => _169[key], 'optionalAccess', _170 => _170.type]) === "update") {
|
|
6839
6871
|
const value = update.node.get(key);
|
|
6840
6872
|
if (value !== void 0) {
|
|
6841
6873
|
newState[key] = lsonToJson(value);
|
|
6842
6874
|
}
|
|
6843
|
-
} else if (_optionalChain([update, 'access',
|
|
6875
|
+
} else if (_optionalChain([update, 'access', _171 => _171.updates, 'access', _172 => _172[key], 'optionalAccess', _173 => _173.type]) === "delete") {
|
|
6844
6876
|
delete newState[key];
|
|
6845
6877
|
}
|
|
6846
6878
|
}
|
|
@@ -6930,7 +6962,7 @@ function createCacheItem(key, asyncFunction, options) {
|
|
|
6930
6962
|
let previousState = { isLoading: false };
|
|
6931
6963
|
const eventSource2 = makeEventSource();
|
|
6932
6964
|
function notify() {
|
|
6933
|
-
const isEqual = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
6965
|
+
const isEqual = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _174 => _174.isStateEqual]), () => ( isShallowEqual));
|
|
6934
6966
|
if (!isEqual(previousState, state)) {
|
|
6935
6967
|
previousState = state;
|
|
6936
6968
|
eventSource2.notify(state);
|
|
@@ -6998,7 +7030,7 @@ function createAsyncCache(asyncFunction, options) {
|
|
|
6998
7030
|
return create(key).get();
|
|
6999
7031
|
}
|
|
7000
7032
|
function getState(key) {
|
|
7001
|
-
return _optionalChain([cache, 'access',
|
|
7033
|
+
return _optionalChain([cache, 'access', _175 => _175.get, 'call', _176 => _176(key), 'optionalAccess', _177 => _177.getState, 'call', _178 => _178()]);
|
|
7002
7034
|
}
|
|
7003
7035
|
function revalidate(key) {
|
|
7004
7036
|
return create(key).revalidate();
|