@liveblocks/core 2.18.2-test1 → 2.18.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 CHANGED
@@ -2739,7 +2739,9 @@ interface NotificationHttpApi<M extends BaseMetadata> {
2739
2739
  markInboxNotificationAsRead(inboxNotificationId: string): Promise<void>;
2740
2740
  deleteAllInboxNotifications(): Promise<void>;
2741
2741
  deleteInboxNotification(inboxNotificationId: string): Promise<void>;
2742
- getUserNotificationSettings(): Promise<UserNotificationSettings>;
2742
+ getUserNotificationSettings(options?: {
2743
+ signal?: AbortSignal;
2744
+ }): Promise<UserNotificationSettings>;
2743
2745
  updateUserNotificationSettings(settings: PartialUserNotificationSettings): Promise<UserNotificationSettings>;
2744
2746
  }
2745
2747
  interface LiveblocksHttpApi<M extends BaseMetadata> extends RoomHttpApi<M>, NotificationHttpApi<M> {
@@ -3814,10 +3816,10 @@ declare class SortedList<T> {
3814
3816
  }
3815
3817
 
3816
3818
  /**
3817
- * Like JSON.stringify(), but returns the same value no matter how keys in any
3818
- * nested objects are ordered.
3819
+ * Like JSON.stringify(), but using stable (sorted) object key order, so that
3820
+ * it returns the same value for the same keys, no matter their order.
3819
3821
  */
3820
- declare function stringify(value: unknown): string;
3822
+ declare function stableStringify(value: unknown): string;
3821
3823
 
3822
3824
  type QueryParams = Record<string, string | number | null | undefined> | URLSearchParams;
3823
3825
  /**
@@ -3972,4 +3974,4 @@ declare const CommentsApiError: typeof HttpError;
3972
3974
  /** @deprecated Use HttpError instead. */
3973
3975
  declare const NotificationsApiError: typeof HttpError;
3974
3976
 
3975
- export { type AckOp, type ActivityData, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type Awaitable, 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, type ContextualPromptContext, type ContextualPromptResponse, 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, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, NotificationsApiError, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialUnless, type PartialUserNotificationSettings, 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, type UserNotificationSettings, 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, entries, errorIf, freeze, generateCommentUrl, getMentionedIdsFromCommentBody, html, htmlSafe, isChildCrdt, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isNotificationChannelEnabled, isPlainObject, isRootCrdt, isStartsWithOperator, kInternal, keys, 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 };
3977
+ export { type AckOp, type ActivityData, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type Awaitable, 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, type ContextualPromptContext, type ContextualPromptResponse, 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, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, NotificationsApiError, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialUnless, type PartialUserNotificationSettings, 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, type UserNotificationSettings, 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, entries, errorIf, freeze, generateCommentUrl, getMentionedIdsFromCommentBody, html, htmlSafe, isChildCrdt, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isNotificationChannelEnabled, isPlainObject, isRootCrdt, isStartsWithOperator, kInternal, keys, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, raise, resolveUsersInCommentBody, shallow, stableStringify, stringifyCommentBody, throwUsageError, toAbsoluteUrl, toPlainLson, tryParseJson, url, urljoin, wait, withTimeout };
package/dist/index.d.ts CHANGED
@@ -2739,7 +2739,9 @@ interface NotificationHttpApi<M extends BaseMetadata> {
2739
2739
  markInboxNotificationAsRead(inboxNotificationId: string): Promise<void>;
2740
2740
  deleteAllInboxNotifications(): Promise<void>;
2741
2741
  deleteInboxNotification(inboxNotificationId: string): Promise<void>;
2742
- getUserNotificationSettings(): Promise<UserNotificationSettings>;
2742
+ getUserNotificationSettings(options?: {
2743
+ signal?: AbortSignal;
2744
+ }): Promise<UserNotificationSettings>;
2743
2745
  updateUserNotificationSettings(settings: PartialUserNotificationSettings): Promise<UserNotificationSettings>;
2744
2746
  }
2745
2747
  interface LiveblocksHttpApi<M extends BaseMetadata> extends RoomHttpApi<M>, NotificationHttpApi<M> {
@@ -3814,10 +3816,10 @@ declare class SortedList<T> {
3814
3816
  }
3815
3817
 
3816
3818
  /**
3817
- * Like JSON.stringify(), but returns the same value no matter how keys in any
3818
- * nested objects are ordered.
3819
+ * Like JSON.stringify(), but using stable (sorted) object key order, so that
3820
+ * it returns the same value for the same keys, no matter their order.
3819
3821
  */
3820
- declare function stringify(value: unknown): string;
3822
+ declare function stableStringify(value: unknown): string;
3821
3823
 
3822
3824
  type QueryParams = Record<string, string | number | null | undefined> | URLSearchParams;
3823
3825
  /**
@@ -3972,4 +3974,4 @@ declare const CommentsApiError: typeof HttpError;
3972
3974
  /** @deprecated Use HttpError instead. */
3973
3975
  declare const NotificationsApiError: typeof HttpError;
3974
3976
 
3975
- export { type AckOp, type ActivityData, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type Awaitable, 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, type ContextualPromptContext, type ContextualPromptResponse, 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, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, NotificationsApiError, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialUnless, type PartialUserNotificationSettings, 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, type UserNotificationSettings, 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, entries, errorIf, freeze, generateCommentUrl, getMentionedIdsFromCommentBody, html, htmlSafe, isChildCrdt, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isNotificationChannelEnabled, isPlainObject, isRootCrdt, isStartsWithOperator, kInternal, keys, 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 };
3977
+ export { type AckOp, type ActivityData, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type Awaitable, 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, type ContextualPromptContext, type ContextualPromptResponse, 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, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, NotificationsApiError, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialUnless, type PartialUserNotificationSettings, 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, type UserNotificationSettings, 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, entries, errorIf, freeze, generateCommentUrl, getMentionedIdsFromCommentBody, html, htmlSafe, isChildCrdt, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isNotificationChannelEnabled, isPlainObject, isRootCrdt, isStartsWithOperator, kInternal, keys, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, raise, resolveUsersInCommentBody, shallow, stableStringify, 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.18.2-test1";
9
+ var PKG_VERSION = "2.18.3";
10
10
  var PKG_FORMAT = "cjs";
11
11
 
12
12
  // src/dupe-detection.ts
@@ -731,9 +731,18 @@ function replacer(_key, value) {
731
731
  return sorted;
732
732
  }, {}) : value;
733
733
  }
734
- function stringify(value) {
734
+ function stableStringify(value) {
735
735
  return JSON.stringify(value, replacer);
736
736
  }
737
+ function stringifyOrLog(value) {
738
+ try {
739
+ return JSON.stringify(value);
740
+ } catch (err) {
741
+ console.error(`Could not stringify: ${err.message}`);
742
+ console.error(value);
743
+ throw err;
744
+ }
745
+ }
737
746
 
738
747
  // src/lib/batch.ts
739
748
  var DEFAULT_SIZE = 50;
@@ -810,7 +819,7 @@ var Batch = (_class = class {
810
819
  }
811
820
  get(input) {
812
821
  const existingCall = this.#queue.find(
813
- (call2) => stringify(call2.input) === stringify(input)
822
+ (call2) => stableStringify(call2.input) === stableStringify(input)
814
823
  );
815
824
  if (existingCall) {
816
825
  return existingCall.promise;
@@ -829,7 +838,7 @@ var Batch = (_class = class {
829
838
  function createBatchStore(batch2) {
830
839
  const signal = new MutableSignal(/* @__PURE__ */ new Map());
831
840
  function getCacheKey(args) {
832
- return stringify(args);
841
+ return stableStringify(args);
833
842
  }
834
843
  function update(cacheKey, state) {
835
844
  signal.mutate((cache) => {
@@ -1938,7 +1947,7 @@ var HttpClient = class {
1938
1947
  async rawPost(endpoint, authValue, body) {
1939
1948
  return await this.#rawFetch(endpoint, authValue, {
1940
1949
  method: "POST",
1941
- body: JSON.stringify(body)
1950
+ body: stringifyOrLog(body)
1942
1951
  });
1943
1952
  }
1944
1953
  /**
@@ -1967,7 +1976,7 @@ var HttpClient = class {
1967
1976
  {
1968
1977
  ...options,
1969
1978
  method: "POST",
1970
- body: JSON.stringify(body)
1979
+ body: stringifyOrLog(body)
1971
1980
  },
1972
1981
  params
1973
1982
  );
@@ -3333,7 +3342,7 @@ async function fetchAuthEndpoint(fetch, endpoint, body) {
3333
3342
  headers: {
3334
3343
  "Content-Type": "application/json"
3335
3344
  },
3336
- body: JSON.stringify(body)
3345
+ body: stringifyOrLog(body)
3337
3346
  });
3338
3347
  if (!res.ok) {
3339
3348
  const reason = `${(await res.text()).trim() || "reason not provided in auth response"} (${res.status} returned by POST ${endpoint})`;
@@ -3355,7 +3364,7 @@ async function fetchAuthEndpoint(fetch, endpoint, body) {
3355
3364
  }
3356
3365
  if (!isPlainObject(data) || typeof data.token !== "string") {
3357
3366
  throw new Error(
3358
- `Expected a JSON response of the form \`{ token: "..." }\` when doing a POST request on "${endpoint}", but got ${JSON.stringify(
3367
+ `Expected a JSON response of the form \`{ token: "..." }\` when doing a POST request on "${endpoint}", but got ${stringifyOrLog(
3359
3368
  data
3360
3369
  )}`
3361
3370
  );
@@ -5978,7 +5987,7 @@ function getTreesDiffOperations(currentItems, newItems) {
5978
5987
  const currentCrdt = currentItems.get(id);
5979
5988
  if (currentCrdt) {
5980
5989
  if (crdt.type === 0 /* OBJECT */) {
5981
- if (currentCrdt.type !== 0 /* OBJECT */ || JSON.stringify(crdt.data) !== JSON.stringify(currentCrdt.data)) {
5990
+ if (currentCrdt.type !== 0 /* OBJECT */ || stringifyOrLog(crdt.data) !== stringifyOrLog(currentCrdt.data)) {
5982
5991
  ops.push({
5983
5992
  type: 3 /* UPDATE_OBJECT */,
5984
5993
  id,
@@ -6160,7 +6169,7 @@ var Deque = class {
6160
6169
  if (this.#size < 1) return void 0;
6161
6170
  this.#back--;
6162
6171
  const value = this.#data[this.#back - 1];
6163
- delete this.#data[this.#back];
6172
+ delete this.#data[this.#back - 1];
6164
6173
  this.#size--;
6165
6174
  return value;
6166
6175
  }
@@ -6714,7 +6723,7 @@ function createRoom(options, config) {
6714
6723
  const secondHalf = ops.slice(mid);
6715
6724
  for (const halfOps of [firstHalf, secondHalf]) {
6716
6725
  const half = { ops: halfOps, ...rest };
6717
- const text = JSON.stringify([half]);
6726
+ const text = stringifyOrLog([half]);
6718
6727
  if (!isTooBigForWebSocket(text)) {
6719
6728
  yield text;
6720
6729
  } else {
@@ -6737,7 +6746,7 @@ function createRoom(options, config) {
6737
6746
  const firstHalf = messages.slice(0, mid);
6738
6747
  const secondHalf = messages.slice(mid);
6739
6748
  for (const half of [firstHalf, secondHalf]) {
6740
- const text = JSON.stringify(half);
6749
+ const text = stringifyOrLog(half);
6741
6750
  if (!isTooBigForWebSocket(text)) {
6742
6751
  yield text;
6743
6752
  } else {
@@ -6753,7 +6762,7 @@ function createRoom(options, config) {
6753
6762
  }
6754
6763
  function sendMessages(messages) {
6755
6764
  const strategy = _nullishCoalesce(config.largeMessageStrategy, () => ( "default"));
6756
- const text = JSON.stringify(messages);
6765
+ const text = stringifyOrLog(messages);
6757
6766
  if (!isTooBigForWebSocket(text)) {
6758
6767
  return managedSocket.send(text);
6759
6768
  }
@@ -8484,7 +8493,7 @@ var stringifyCommentBodyHtmlElements = {
8484
8493
  text: ({ element }) => {
8485
8494
  let children = element.text;
8486
8495
  if (!children) {
8487
- return children;
8496
+ return html`${children}`;
8488
8497
  }
8489
8498
  if (element.bold) {
8490
8499
  children = html`<strong>${children}</strong>`;
@@ -8498,13 +8507,13 @@ var stringifyCommentBodyHtmlElements = {
8498
8507
  if (element.code) {
8499
8508
  children = html`<code>${children}</code>`;
8500
8509
  }
8501
- return children;
8510
+ return html`${children}`;
8502
8511
  },
8503
8512
  link: ({ element, href }) => {
8504
- return html`<a href="${href}" target="_blank" rel="noopener noreferrer">${_nullishCoalesce(element.text, () => ( element.url))}</a>`;
8513
+ return html`<a href="${href}" target="_blank" rel="noopener noreferrer">${element.text ? html`${element.text}` : element.url}</a>`;
8505
8514
  },
8506
8515
  mention: ({ element, user }) => {
8507
- return html`<span data-mention>@${_nullishCoalesce(_optionalChain([user, 'optionalAccess', _191 => _191.name]), () => ( element.id))}</span>`;
8516
+ return html`<span data-mention>@${_optionalChain([user, 'optionalAccess', _191 => _191.name]) ? html`${_optionalChain([user, 'optionalAccess', _192 => _192.name])}` : element.id}</span>`;
8508
8517
  }
8509
8518
  };
8510
8519
  var stringifyCommentBodyMarkdownElements = {
@@ -8534,19 +8543,19 @@ var stringifyCommentBodyMarkdownElements = {
8534
8543
  return markdown`[${_nullishCoalesce(element.text, () => ( element.url))}](${href})`;
8535
8544
  },
8536
8545
  mention: ({ element, user }) => {
8537
- return markdown`@${_nullishCoalesce(_optionalChain([user, 'optionalAccess', _192 => _192.name]), () => ( element.id))}`;
8546
+ return markdown`@${_nullishCoalesce(_optionalChain([user, 'optionalAccess', _193 => _193.name]), () => ( element.id))}`;
8538
8547
  }
8539
8548
  };
8540
8549
  async function stringifyCommentBody(body, options) {
8541
- const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _193 => _193.format]), () => ( "plain"));
8542
- const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _194 => _194.separator]), () => ( (format === "markdown" ? "\n\n" : "\n")));
8550
+ const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _194 => _194.format]), () => ( "plain"));
8551
+ const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _195 => _195.separator]), () => ( (format === "markdown" ? "\n\n" : "\n")));
8543
8552
  const elements = {
8544
8553
  ...format === "html" ? stringifyCommentBodyHtmlElements : format === "markdown" ? stringifyCommentBodyMarkdownElements : stringifyCommentBodyPlainElements,
8545
- ..._optionalChain([options, 'optionalAccess', _195 => _195.elements])
8554
+ ..._optionalChain([options, 'optionalAccess', _196 => _196.elements])
8546
8555
  };
8547
8556
  const resolvedUsers = await resolveUsersInCommentBody(
8548
8557
  body,
8549
- _optionalChain([options, 'optionalAccess', _196 => _196.resolveUsers])
8558
+ _optionalChain([options, 'optionalAccess', _197 => _197.resolveUsers])
8550
8559
  );
8551
8560
  const blocks = body.content.flatMap((block, blockIndex) => {
8552
8561
  switch (block.type) {
@@ -8837,12 +8846,12 @@ function legacy_patchImmutableNode(state, path, update) {
8837
8846
  }
8838
8847
  const newState = Object.assign({}, state);
8839
8848
  for (const key in update.updates) {
8840
- if (_optionalChain([update, 'access', _197 => _197.updates, 'access', _198 => _198[key], 'optionalAccess', _199 => _199.type]) === "update") {
8849
+ if (_optionalChain([update, 'access', _198 => _198.updates, 'access', _199 => _199[key], 'optionalAccess', _200 => _200.type]) === "update") {
8841
8850
  const val = update.node.get(key);
8842
8851
  if (val !== void 0) {
8843
8852
  newState[key] = lsonToJson(val);
8844
8853
  }
8845
- } else if (_optionalChain([update, 'access', _200 => _200.updates, 'access', _201 => _201[key], 'optionalAccess', _202 => _202.type]) === "delete") {
8854
+ } else if (_optionalChain([update, 'access', _201 => _201.updates, 'access', _202 => _202[key], 'optionalAccess', _203 => _203.type]) === "delete") {
8846
8855
  delete newState[key];
8847
8856
  }
8848
8857
  }
@@ -8903,12 +8912,12 @@ function legacy_patchImmutableNode(state, path, update) {
8903
8912
  }
8904
8913
  const newState = Object.assign({}, state);
8905
8914
  for (const key in update.updates) {
8906
- if (_optionalChain([update, 'access', _203 => _203.updates, 'access', _204 => _204[key], 'optionalAccess', _205 => _205.type]) === "update") {
8915
+ if (_optionalChain([update, 'access', _204 => _204.updates, 'access', _205 => _205[key], 'optionalAccess', _206 => _206.type]) === "update") {
8907
8916
  const value = update.node.get(key);
8908
8917
  if (value !== void 0) {
8909
8918
  newState[key] = lsonToJson(value);
8910
8919
  }
8911
- } else if (_optionalChain([update, 'access', _206 => _206.updates, 'access', _207 => _207[key], 'optionalAccess', _208 => _208.type]) === "delete") {
8920
+ } else if (_optionalChain([update, 'access', _207 => _207.updates, 'access', _208 => _208[key], 'optionalAccess', _209 => _209.type]) === "delete") {
8912
8921
  delete newState[key];
8913
8922
  }
8914
8923
  }
@@ -8979,9 +8988,9 @@ function makePoller(callback, intervalMs, options) {
8979
8988
  const startTime = performance.now();
8980
8989
  const doc = typeof document !== "undefined" ? document : void 0;
8981
8990
  const win = typeof window !== "undefined" ? window : void 0;
8982
- const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _209 => _209.maxStaleTimeMs]), () => ( Number.POSITIVE_INFINITY));
8991
+ const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _210 => _210.maxStaleTimeMs]), () => ( Number.POSITIVE_INFINITY));
8983
8992
  const context = {
8984
- inForeground: _optionalChain([doc, 'optionalAccess', _210 => _210.visibilityState]) !== "hidden",
8993
+ inForeground: _optionalChain([doc, 'optionalAccess', _211 => _211.visibilityState]) !== "hidden",
8985
8994
  lastSuccessfulPollAt: startTime,
8986
8995
  count: 0,
8987
8996
  backoff: 0
@@ -9059,11 +9068,11 @@ function makePoller(callback, intervalMs, options) {
9059
9068
  pollNowIfStale();
9060
9069
  }
9061
9070
  function onVisibilityChange() {
9062
- setInForeground(_optionalChain([doc, 'optionalAccess', _211 => _211.visibilityState]) !== "hidden");
9071
+ setInForeground(_optionalChain([doc, 'optionalAccess', _212 => _212.visibilityState]) !== "hidden");
9063
9072
  }
9064
- _optionalChain([doc, 'optionalAccess', _212 => _212.addEventListener, 'call', _213 => _213("visibilitychange", onVisibilityChange)]);
9065
- _optionalChain([win, 'optionalAccess', _214 => _214.addEventListener, 'call', _215 => _215("online", onVisibilityChange)]);
9066
- _optionalChain([win, 'optionalAccess', _216 => _216.addEventListener, 'call', _217 => _217("focus", pollNowIfStale)]);
9073
+ _optionalChain([doc, 'optionalAccess', _213 => _213.addEventListener, 'call', _214 => _214("visibilitychange", onVisibilityChange)]);
9074
+ _optionalChain([win, 'optionalAccess', _215 => _215.addEventListener, 'call', _216 => _216("online", onVisibilityChange)]);
9075
+ _optionalChain([win, 'optionalAccess', _217 => _217.addEventListener, 'call', _218 => _218("focus", pollNowIfStale)]);
9067
9076
  fsm.start();
9068
9077
  return {
9069
9078
  inc,
@@ -9290,5 +9299,5 @@ var NotificationsApiError = HttpError;
9290
9299
 
9291
9300
 
9292
9301
 
9293
- exports.ClientMsgCode = ClientMsgCode; exports.CommentsApiError = CommentsApiError; exports.CrdtType = CrdtType; exports.DefaultMap = DefaultMap; exports.DerivedSignal = DerivedSignal; exports.HttpError = HttpError; exports.LiveList = LiveList; exports.LiveMap = LiveMap; exports.LiveObject = LiveObject; exports.LiveblocksError = LiveblocksError; exports.MutableSignal = MutableSignal; exports.NotificationsApiError = NotificationsApiError; exports.OpCode = OpCode; exports.Permission = Permission; exports.Promise_withResolvers = Promise_withResolvers; exports.ServerMsgCode = ServerMsgCode; exports.Signal = Signal; exports.SortedList = SortedList; exports.TextEditorType = TextEditorType; exports.WebsocketCloseCodes = WebsocketCloseCodes; exports.ackOp = ackOp; exports.asPos = asPos; exports.assert = assert; exports.assertNever = assertNever; exports.autoRetry = autoRetry; exports.b64decode = b64decode; exports.batch = batch; exports.chunk = chunk; exports.cloneLson = cloneLson; exports.compactObject = compactObject; exports.console = fancy_console_exports; exports.convertToCommentData = convertToCommentData; exports.convertToCommentUserReaction = convertToCommentUserReaction; exports.convertToInboxNotificationData = convertToInboxNotificationData; exports.convertToThreadData = convertToThreadData; exports.createClient = createClient; exports.createCommentAttachmentId = createCommentAttachmentId; exports.createCommentId = createCommentId; exports.createInboxNotificationId = createInboxNotificationId; exports.createThreadId = createThreadId; exports.deprecate = deprecate; exports.deprecateIf = deprecateIf; exports.detectDupes = detectDupes; exports.entries = entries; exports.errorIf = errorIf; exports.freeze = freeze; exports.generateCommentUrl = generateCommentUrl; exports.getMentionedIdsFromCommentBody = getMentionedIdsFromCommentBody; exports.html = html; exports.htmlSafe = htmlSafe; exports.isChildCrdt = isChildCrdt; exports.isCommentBodyLink = isCommentBodyLink; exports.isCommentBodyMention = isCommentBodyMention; exports.isCommentBodyText = isCommentBodyText; exports.isJsonArray = isJsonArray; exports.isJsonObject = isJsonObject; exports.isJsonScalar = isJsonScalar; exports.isLiveNode = isLiveNode; exports.isNotificationChannelEnabled = isNotificationChannelEnabled; exports.isPlainObject = isPlainObject; exports.isRootCrdt = isRootCrdt; exports.isStartsWithOperator = isStartsWithOperator; exports.kInternal = kInternal; exports.keys = keys; exports.legacy_patchImmutableObject = legacy_patchImmutableObject; exports.lsonToJson = lsonToJson; exports.makeEventSource = makeEventSource; exports.makePoller = makePoller; exports.makePosition = makePosition; exports.mapValues = mapValues; exports.memoizeOnSuccess = memoizeOnSuccess; exports.nanoid = nanoid; exports.nn = nn; exports.objectToQuery = objectToQuery; exports.patchLiveObjectKey = patchLiveObjectKey; exports.raise = raise; exports.resolveUsersInCommentBody = resolveUsersInCommentBody; exports.shallow = shallow; exports.stringify = stringify; exports.stringifyCommentBody = stringifyCommentBody; exports.throwUsageError = throwUsageError; exports.toAbsoluteUrl = toAbsoluteUrl; exports.toPlainLson = toPlainLson; exports.tryParseJson = tryParseJson; exports.url = url; exports.urljoin = urljoin; exports.wait = wait; exports.withTimeout = withTimeout;
9302
+ exports.ClientMsgCode = ClientMsgCode; exports.CommentsApiError = CommentsApiError; exports.CrdtType = CrdtType; exports.DefaultMap = DefaultMap; exports.DerivedSignal = DerivedSignal; exports.HttpError = HttpError; exports.LiveList = LiveList; exports.LiveMap = LiveMap; exports.LiveObject = LiveObject; exports.LiveblocksError = LiveblocksError; exports.MutableSignal = MutableSignal; exports.NotificationsApiError = NotificationsApiError; exports.OpCode = OpCode; exports.Permission = Permission; exports.Promise_withResolvers = Promise_withResolvers; exports.ServerMsgCode = ServerMsgCode; exports.Signal = Signal; exports.SortedList = SortedList; exports.TextEditorType = TextEditorType; exports.WebsocketCloseCodes = WebsocketCloseCodes; exports.ackOp = ackOp; exports.asPos = asPos; exports.assert = assert; exports.assertNever = assertNever; exports.autoRetry = autoRetry; exports.b64decode = b64decode; exports.batch = batch; exports.chunk = chunk; exports.cloneLson = cloneLson; exports.compactObject = compactObject; exports.console = fancy_console_exports; exports.convertToCommentData = convertToCommentData; exports.convertToCommentUserReaction = convertToCommentUserReaction; exports.convertToInboxNotificationData = convertToInboxNotificationData; exports.convertToThreadData = convertToThreadData; exports.createClient = createClient; exports.createCommentAttachmentId = createCommentAttachmentId; exports.createCommentId = createCommentId; exports.createInboxNotificationId = createInboxNotificationId; exports.createThreadId = createThreadId; exports.deprecate = deprecate; exports.deprecateIf = deprecateIf; exports.detectDupes = detectDupes; exports.entries = entries; exports.errorIf = errorIf; exports.freeze = freeze; exports.generateCommentUrl = generateCommentUrl; exports.getMentionedIdsFromCommentBody = getMentionedIdsFromCommentBody; exports.html = html; exports.htmlSafe = htmlSafe; exports.isChildCrdt = isChildCrdt; exports.isCommentBodyLink = isCommentBodyLink; exports.isCommentBodyMention = isCommentBodyMention; exports.isCommentBodyText = isCommentBodyText; exports.isJsonArray = isJsonArray; exports.isJsonObject = isJsonObject; exports.isJsonScalar = isJsonScalar; exports.isLiveNode = isLiveNode; exports.isNotificationChannelEnabled = isNotificationChannelEnabled; exports.isPlainObject = isPlainObject; exports.isRootCrdt = isRootCrdt; exports.isStartsWithOperator = isStartsWithOperator; exports.kInternal = kInternal; exports.keys = keys; exports.legacy_patchImmutableObject = legacy_patchImmutableObject; exports.lsonToJson = lsonToJson; exports.makeEventSource = makeEventSource; exports.makePoller = makePoller; exports.makePosition = makePosition; exports.mapValues = mapValues; exports.memoizeOnSuccess = memoizeOnSuccess; exports.nanoid = nanoid; exports.nn = nn; exports.objectToQuery = objectToQuery; exports.patchLiveObjectKey = patchLiveObjectKey; exports.raise = raise; exports.resolveUsersInCommentBody = resolveUsersInCommentBody; exports.shallow = shallow; exports.stableStringify = stableStringify; exports.stringifyCommentBody = stringifyCommentBody; exports.throwUsageError = throwUsageError; exports.toAbsoluteUrl = toAbsoluteUrl; exports.toPlainLson = toPlainLson; exports.tryParseJson = tryParseJson; exports.url = url; exports.urljoin = urljoin; exports.wait = wait; exports.withTimeout = withTimeout;
9294
9303
  //# sourceMappingURL=index.js.map