@liveblocks/core 2.16.3-composer1 → 2.17.0-rc1
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 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +70 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +70 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -2441,6 +2441,7 @@ type PartialUnless<C, T> = Record<string, never> extends C ? Partial<T> : [
|
|
|
2441
2441
|
type OptionalTupleUnless<C, T extends any[]> = Record<string, never> extends C ? OptionalTuple<T> : [
|
|
2442
2442
|
C
|
|
2443
2443
|
] extends [never] ? OptionalTuple<T> : T;
|
|
2444
|
+
type LargeMessageStrategy = "default" | "split" | "experimental-fallback-to-http";
|
|
2444
2445
|
|
|
2445
2446
|
interface RoomHttpApi<M extends BaseMetadata> {
|
|
2446
2447
|
getThreads(options: {
|
|
@@ -3048,6 +3049,8 @@ type ClientOptions<U extends BaseUserMeta = DU> = {
|
|
|
3048
3049
|
lostConnectionTimeout?: number;
|
|
3049
3050
|
backgroundKeepAliveTimeout?: number;
|
|
3050
3051
|
polyfills?: Polyfills;
|
|
3052
|
+
largeMessageStrategy?: LargeMessageStrategy;
|
|
3053
|
+
/** @deprecated Use `largeMessageStrategy="experimental-fallback-to-http"` instead. */
|
|
3051
3054
|
unstable_fallbackToHTTP?: boolean;
|
|
3052
3055
|
unstable_streamData?: boolean;
|
|
3053
3056
|
/**
|
|
@@ -3841,4 +3844,4 @@ declare const CommentsApiError: typeof HttpError;
|
|
|
3841
3844
|
/** @deprecated Use HttpError instead. */
|
|
3842
3845
|
declare const NotificationsApiError: typeof HttpError;
|
|
3843
3846
|
|
|
3844
|
-
export { type AckOp, type ActivityData, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type BaseActivitiesData, type BaseAuthResult, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type CommentAttachment, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentLocalAttachment, type CommentMixedAttachment, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, CommentsApiError, type CommentsEventServerMsg, CrdtType, type CreateListOp, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type CustomAuthenticationResult, type DAD, type DE, type DM, type DP, type DRI, type DS, type DU, DefaultMap, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type History, type HistoryVersion, HttpError, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IdTuple, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InitialDocumentStateServerMsg, type Json, type JsonArray, type JsonObject, type JsonScalar, type KDAD, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type LiveblocksErrorContext, type LostConnectionEvent, type Lson, type LsonObject, MutableSignal, type NoInfr, type NodeMap, NotificationsApiError, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalPromise, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialUnless, type Patchable, Permission, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type Poller, type PrivateClientApi, type PrivateRoomApi, Promise_withResolvers, type QueryMetadata, type QueryParams, type RejectedStorageOpServerMsg, type Relax, type Resolve, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomNotificationSettings, type RoomStateServerMsg, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type SetParentKeyOp, Signal, type SignalType, SortedList, type Status, type StorageStatus, type StorageUpdate, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type SyncSource, type SyncStatus, TextEditorType, type ThreadData, type ThreadDataPlain, type ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ToImmutable, type ToJson, type URLSafeString, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type UploadAttachmentOptions, type User, type UserJoinServerMsg, type UserLeftServerMsg, WebsocketCloseCodes, type YDocUpdateServerMsg, type YjsSyncStatus, ackOp, asPos, assert, assertNever, autoRetry, b64decode, batch, chunk, cloneLson, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToInboxNotificationData, convertToThreadData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createThreadId, deprecate, deprecateIf, detectDupes, errorIf, freeze, generateCommentUrl, getMentionedIdsFromCommentBody, html, htmlSafe, isChildCrdt, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, isStartsWithOperator, kInternal, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, raise, resolveUsersInCommentBody, shallow, stringify, stringifyCommentBody, throwUsageError, toAbsoluteUrl, toPlainLson, tryParseJson, url, urljoin, wait, withTimeout };
|
|
3847
|
+
export { type AckOp, type ActivityData, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type BaseActivitiesData, type BaseAuthResult, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type CommentAttachment, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentLocalAttachment, type CommentMixedAttachment, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, CommentsApiError, type CommentsEventServerMsg, CrdtType, type CreateListOp, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type CustomAuthenticationResult, type DAD, type DE, type DM, type DP, type DRI, type DS, type DU, DefaultMap, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type History, type HistoryVersion, HttpError, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IdTuple, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InitialDocumentStateServerMsg, type Json, type JsonArray, type JsonObject, type JsonScalar, type KDAD, type LargeMessageStrategy, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type LiveblocksErrorContext, type LostConnectionEvent, type Lson, type LsonObject, MutableSignal, type NoInfr, type NodeMap, NotificationsApiError, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalPromise, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialUnless, type Patchable, Permission, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type Poller, type PrivateClientApi, type PrivateRoomApi, Promise_withResolvers, type QueryMetadata, type QueryParams, type RejectedStorageOpServerMsg, type Relax, type Resolve, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomNotificationSettings, type RoomStateServerMsg, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type SetParentKeyOp, Signal, type SignalType, SortedList, type Status, type StorageStatus, type StorageUpdate, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type SyncSource, type SyncStatus, TextEditorType, type ThreadData, type ThreadDataPlain, type ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ToImmutable, type ToJson, type URLSafeString, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type UploadAttachmentOptions, type User, type UserJoinServerMsg, type UserLeftServerMsg, WebsocketCloseCodes, type YDocUpdateServerMsg, type YjsSyncStatus, ackOp, asPos, assert, assertNever, autoRetry, b64decode, batch, chunk, cloneLson, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToInboxNotificationData, convertToThreadData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createThreadId, deprecate, deprecateIf, detectDupes, errorIf, freeze, generateCommentUrl, getMentionedIdsFromCommentBody, html, htmlSafe, isChildCrdt, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, isStartsWithOperator, kInternal, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, raise, resolveUsersInCommentBody, shallow, stringify, stringifyCommentBody, throwUsageError, toAbsoluteUrl, toPlainLson, tryParseJson, url, urljoin, wait, withTimeout };
|
package/dist/index.d.ts
CHANGED
|
@@ -2441,6 +2441,7 @@ type PartialUnless<C, T> = Record<string, never> extends C ? Partial<T> : [
|
|
|
2441
2441
|
type OptionalTupleUnless<C, T extends any[]> = Record<string, never> extends C ? OptionalTuple<T> : [
|
|
2442
2442
|
C
|
|
2443
2443
|
] extends [never] ? OptionalTuple<T> : T;
|
|
2444
|
+
type LargeMessageStrategy = "default" | "split" | "experimental-fallback-to-http";
|
|
2444
2445
|
|
|
2445
2446
|
interface RoomHttpApi<M extends BaseMetadata> {
|
|
2446
2447
|
getThreads(options: {
|
|
@@ -3048,6 +3049,8 @@ type ClientOptions<U extends BaseUserMeta = DU> = {
|
|
|
3048
3049
|
lostConnectionTimeout?: number;
|
|
3049
3050
|
backgroundKeepAliveTimeout?: number;
|
|
3050
3051
|
polyfills?: Polyfills;
|
|
3052
|
+
largeMessageStrategy?: LargeMessageStrategy;
|
|
3053
|
+
/** @deprecated Use `largeMessageStrategy="experimental-fallback-to-http"` instead. */
|
|
3051
3054
|
unstable_fallbackToHTTP?: boolean;
|
|
3052
3055
|
unstable_streamData?: boolean;
|
|
3053
3056
|
/**
|
|
@@ -3841,4 +3844,4 @@ declare const CommentsApiError: typeof HttpError;
|
|
|
3841
3844
|
/** @deprecated Use HttpError instead. */
|
|
3842
3845
|
declare const NotificationsApiError: typeof HttpError;
|
|
3843
3846
|
|
|
3844
|
-
export { type AckOp, type ActivityData, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type BaseActivitiesData, type BaseAuthResult, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type CommentAttachment, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentLocalAttachment, type CommentMixedAttachment, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, CommentsApiError, type CommentsEventServerMsg, CrdtType, type CreateListOp, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type CustomAuthenticationResult, type DAD, type DE, type DM, type DP, type DRI, type DS, type DU, DefaultMap, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type History, type HistoryVersion, HttpError, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IdTuple, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InitialDocumentStateServerMsg, type Json, type JsonArray, type JsonObject, type JsonScalar, type KDAD, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type LiveblocksErrorContext, type LostConnectionEvent, type Lson, type LsonObject, MutableSignal, type NoInfr, type NodeMap, NotificationsApiError, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalPromise, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialUnless, type Patchable, Permission, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type Poller, type PrivateClientApi, type PrivateRoomApi, Promise_withResolvers, type QueryMetadata, type QueryParams, type RejectedStorageOpServerMsg, type Relax, type Resolve, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomNotificationSettings, type RoomStateServerMsg, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type SetParentKeyOp, Signal, type SignalType, SortedList, type Status, type StorageStatus, type StorageUpdate, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type SyncSource, type SyncStatus, TextEditorType, type ThreadData, type ThreadDataPlain, type ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ToImmutable, type ToJson, type URLSafeString, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type UploadAttachmentOptions, type User, type UserJoinServerMsg, type UserLeftServerMsg, WebsocketCloseCodes, type YDocUpdateServerMsg, type YjsSyncStatus, ackOp, asPos, assert, assertNever, autoRetry, b64decode, batch, chunk, cloneLson, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToInboxNotificationData, convertToThreadData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createThreadId, deprecate, deprecateIf, detectDupes, errorIf, freeze, generateCommentUrl, getMentionedIdsFromCommentBody, html, htmlSafe, isChildCrdt, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, isStartsWithOperator, kInternal, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, raise, resolveUsersInCommentBody, shallow, stringify, stringifyCommentBody, throwUsageError, toAbsoluteUrl, toPlainLson, tryParseJson, url, urljoin, wait, withTimeout };
|
|
3847
|
+
export { type AckOp, type ActivityData, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type BaseActivitiesData, type BaseAuthResult, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type CommentAttachment, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentLocalAttachment, type CommentMixedAttachment, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, CommentsApiError, type CommentsEventServerMsg, CrdtType, type CreateListOp, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type CustomAuthenticationResult, type DAD, type DE, type DM, type DP, type DRI, type DS, type DU, DefaultMap, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type History, type HistoryVersion, HttpError, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IdTuple, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InitialDocumentStateServerMsg, type Json, type JsonArray, type JsonObject, type JsonScalar, type KDAD, type LargeMessageStrategy, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type LiveblocksErrorContext, type LostConnectionEvent, type Lson, type LsonObject, MutableSignal, type NoInfr, type NodeMap, NotificationsApiError, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalPromise, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialUnless, type Patchable, Permission, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type Poller, type PrivateClientApi, type PrivateRoomApi, Promise_withResolvers, type QueryMetadata, type QueryParams, type RejectedStorageOpServerMsg, type Relax, type Resolve, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomNotificationSettings, type RoomStateServerMsg, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type SetParentKeyOp, Signal, type SignalType, SortedList, type Status, type StorageStatus, type StorageUpdate, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type SyncSource, type SyncStatus, TextEditorType, type ThreadData, type ThreadDataPlain, type ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ToImmutable, type ToJson, type URLSafeString, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type UploadAttachmentOptions, type User, type UserJoinServerMsg, type UserLeftServerMsg, WebsocketCloseCodes, type YDocUpdateServerMsg, type YjsSyncStatus, ackOp, asPos, assert, assertNever, autoRetry, b64decode, batch, chunk, cloneLson, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToInboxNotificationData, convertToThreadData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createThreadId, deprecate, deprecateIf, detectDupes, errorIf, freeze, generateCommentUrl, getMentionedIdsFromCommentBody, html, htmlSafe, isChildCrdt, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, isStartsWithOperator, kInternal, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, raise, resolveUsersInCommentBody, shallow, stringify, stringifyCommentBody, throwUsageError, toAbsoluteUrl, toPlainLson, tryParseJson, url, urljoin, wait, 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 = "2.
|
|
9
|
+
var PKG_VERSION = "2.17.0-rc1";
|
|
10
10
|
var PKG_FORMAT = "cjs";
|
|
11
11
|
|
|
12
12
|
// src/dupe-detection.ts
|
|
@@ -6320,7 +6320,7 @@ function defaultMessageFromContext(context) {
|
|
|
6320
6320
|
}
|
|
6321
6321
|
|
|
6322
6322
|
// src/room.ts
|
|
6323
|
-
var MAX_SOCKET_MESSAGE_SIZE = 1024 * 1024 -
|
|
6323
|
+
var MAX_SOCKET_MESSAGE_SIZE = 1024 * 1024 - 512;
|
|
6324
6324
|
function makeIdFactory(connectionId) {
|
|
6325
6325
|
let count = 0;
|
|
6326
6326
|
return () => `${connectionId}:${count++}`;
|
|
@@ -6589,24 +6589,82 @@ function createRoom(options, config) {
|
|
|
6589
6589
|
async function createTextVersion() {
|
|
6590
6590
|
return httpClient.createTextVersion({ roomId });
|
|
6591
6591
|
}
|
|
6592
|
+
function* chunkOps(msg) {
|
|
6593
|
+
const { ops, ...rest } = msg;
|
|
6594
|
+
if (ops.length < 2) {
|
|
6595
|
+
throw new Error("Cannot split ops into smaller chunks");
|
|
6596
|
+
}
|
|
6597
|
+
const mid = Math.floor(ops.length / 2);
|
|
6598
|
+
const firstHalf = ops.slice(0, mid);
|
|
6599
|
+
const secondHalf = ops.slice(mid);
|
|
6600
|
+
for (const halfOps of [firstHalf, secondHalf]) {
|
|
6601
|
+
const half = { ops: halfOps, ...rest };
|
|
6602
|
+
const text = JSON.stringify([half]);
|
|
6603
|
+
if (!isTooBigForWebSocket(text)) {
|
|
6604
|
+
yield text;
|
|
6605
|
+
} else {
|
|
6606
|
+
yield* chunkOps(half);
|
|
6607
|
+
}
|
|
6608
|
+
}
|
|
6609
|
+
}
|
|
6610
|
+
function* chunkMessages(messages) {
|
|
6611
|
+
if (messages.length < 2) {
|
|
6612
|
+
if (messages[0].type === 201 /* UPDATE_STORAGE */) {
|
|
6613
|
+
yield* chunkOps(messages[0]);
|
|
6614
|
+
return;
|
|
6615
|
+
} else {
|
|
6616
|
+
throw new Error(
|
|
6617
|
+
"Cannot split into chunks smaller than the allowed message size"
|
|
6618
|
+
);
|
|
6619
|
+
}
|
|
6620
|
+
}
|
|
6621
|
+
const mid = Math.floor(messages.length / 2);
|
|
6622
|
+
const firstHalf = messages.slice(0, mid);
|
|
6623
|
+
const secondHalf = messages.slice(mid);
|
|
6624
|
+
for (const half of [firstHalf, secondHalf]) {
|
|
6625
|
+
const text = JSON.stringify(half);
|
|
6626
|
+
if (!isTooBigForWebSocket(text)) {
|
|
6627
|
+
yield text;
|
|
6628
|
+
} else {
|
|
6629
|
+
yield* chunkMessages(half);
|
|
6630
|
+
}
|
|
6631
|
+
}
|
|
6632
|
+
}
|
|
6633
|
+
function isTooBigForWebSocket(text) {
|
|
6634
|
+
if (text.length * 4 < MAX_SOCKET_MESSAGE_SIZE) {
|
|
6635
|
+
return false;
|
|
6636
|
+
}
|
|
6637
|
+
return new TextEncoder().encode(text).length >= MAX_SOCKET_MESSAGE_SIZE;
|
|
6638
|
+
}
|
|
6592
6639
|
function sendMessages(messages) {
|
|
6593
|
-
const
|
|
6594
|
-
const
|
|
6595
|
-
if (
|
|
6596
|
-
|
|
6597
|
-
|
|
6640
|
+
const strategy = _nullishCoalesce(config.largeMessageStrategy, () => ( "default"));
|
|
6641
|
+
const text = JSON.stringify(messages);
|
|
6642
|
+
if (!isTooBigForWebSocket(text)) {
|
|
6643
|
+
return managedSocket.send(text);
|
|
6644
|
+
}
|
|
6645
|
+
switch (strategy) {
|
|
6646
|
+
case "default": {
|
|
6647
|
+
error2("Message is too large for websockets, not sending. Configure largeMessageStrategy option to deal with this.");
|
|
6648
|
+
return;
|
|
6649
|
+
}
|
|
6650
|
+
case "split": {
|
|
6651
|
+
warn("Message is too large for websockets, splitting into smaller chunks");
|
|
6652
|
+
for (const chunk2 of chunkMessages(messages)) {
|
|
6653
|
+
managedSocket.send(chunk2);
|
|
6654
|
+
}
|
|
6655
|
+
return;
|
|
6656
|
+
}
|
|
6657
|
+
case "experimental-fallback-to-http": {
|
|
6658
|
+
warn("Message is too large for websockets, so sending over HTTP instead");
|
|
6659
|
+
const nonce = _nullishCoalesce(_optionalChain([context, 'access', _141 => _141.dynamicSessionInfoSig, 'access', _142 => _142.get, 'call', _143 => _143(), 'optionalAccess', _144 => _144.nonce]), () => ( raise("Session is not authorized to send message over HTTP")));
|
|
6598
6660
|
void httpClient.sendMessages({ roomId, nonce, messages }).then((resp) => {
|
|
6599
6661
|
if (!resp.ok && resp.status === 403) {
|
|
6600
6662
|
managedSocket.reconnect();
|
|
6601
6663
|
}
|
|
6602
6664
|
});
|
|
6603
|
-
warn(
|
|
6604
|
-
"Message was too large for websockets and sent over HTTP instead"
|
|
6605
|
-
);
|
|
6606
6665
|
return;
|
|
6607
6666
|
}
|
|
6608
6667
|
}
|
|
6609
|
-
managedSocket.send(serializedPayload);
|
|
6610
6668
|
}
|
|
6611
6669
|
const self = DerivedSignal.from(
|
|
6612
6670
|
context.staticSessionInfoSig,
|
|
@@ -7877,7 +7935,7 @@ function createClient(options) {
|
|
|
7877
7935
|
enableDebugLogging: clientOptions.enableDebugLogging,
|
|
7878
7936
|
baseUrl,
|
|
7879
7937
|
errorEventSource: liveblocksErrorSource,
|
|
7880
|
-
|
|
7938
|
+
largeMessageStrategy: _nullishCoalesce(clientOptions.largeMessageStrategy, () => ( (clientOptions.unstable_fallbackToHTTP ? "experimental-fallback-to-http" : void 0))),
|
|
7881
7939
|
unstable_streamData: !!clientOptions.unstable_streamData,
|
|
7882
7940
|
roomHttpClient: httpClient,
|
|
7883
7941
|
createSyncSource
|