@liveblocks/core 3.8.0-next4 → 3.8.0

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.cts CHANGED
@@ -512,6 +512,7 @@ type UpdateDelta = {
512
512
  type: "update";
513
513
  } | {
514
514
  type: "delete";
515
+ deletedItem: Lson;
515
516
  };
516
517
 
517
518
  /**
@@ -1295,6 +1296,12 @@ type ThreadDeleteInfo = {
1295
1296
  type StringOperators<T> = T | {
1296
1297
  startsWith: string;
1297
1298
  };
1299
+ type NumberOperators<T> = T | {
1300
+ lt?: number;
1301
+ gt?: number;
1302
+ lte?: number;
1303
+ gte?: number;
1304
+ };
1298
1305
  /**
1299
1306
  * This type can be used to build a metadata query string (compatible
1300
1307
  * with `@liveblocks/query-parser`) through a type-safe API.
@@ -1304,7 +1311,7 @@ type StringOperators<T> = T | {
1304
1311
  * - `startsWith` (`^` in query string)
1305
1312
  */
1306
1313
  type QueryMetadata<M extends BaseMetadata> = {
1307
- [K in keyof M]: (string extends M[K] ? StringOperators<M[K]> : M[K]) | null;
1314
+ [K in keyof M]: (string extends M[K] ? StringOperators<M[K]> : M[K]) | (number extends M[K] ? NumberOperators<M[K]> : M[K]) | null;
1308
1315
  };
1309
1316
 
1310
1317
  type GroupMemberData = {
@@ -1704,7 +1711,7 @@ interface RoomHttpApi<M extends BaseMetadata> {
1704
1711
  streamStorage(options: {
1705
1712
  roomId: string;
1706
1713
  }): Promise<IdTuple<SerializedCrdt>[]>;
1707
- sendMessages<P extends JsonObject, E extends Json>(options: {
1714
+ sendMessagesOverHTTP<P extends JsonObject, E extends Json>(options: {
1708
1715
  roomId: string;
1709
1716
  nonce: string | undefined;
1710
1717
  messages: ClientMsg<P, E>[];
@@ -4619,6 +4626,12 @@ declare function isPlainObject(blob: unknown): blob is {
4619
4626
  declare function isStartsWithOperator(blob: unknown): blob is {
4620
4627
  startsWith: string;
4621
4628
  };
4629
+ declare function isNumberOperator(blob: unknown): blob is {
4630
+ lt?: number;
4631
+ gt?: number;
4632
+ lte?: number;
4633
+ gte?: number;
4634
+ };
4622
4635
 
4623
4636
  declare const nanoid: (t?: number) => string;
4624
4637
 
@@ -4634,16 +4647,34 @@ declare const nanoid: (t?: number) => string;
4634
4647
  * org: {
4635
4648
  * startsWith: "liveblocks:",
4636
4649
  * },
4650
+ * posX: {
4651
+ * gt: 100,
4652
+ * lt: 200,
4653
+ * },
4654
+ * posY: {
4655
+ * gte: 50,
4656
+ * lte: 300,
4657
+ * },
4637
4658
  * },
4638
4659
  * });
4639
4660
  *
4640
4661
  * console.log(query);
4641
- * // resolved:true AND metadata["status"]:open AND metadata["priority"]:3 AND metadata["org"]^"liveblocks:"
4662
+ * // resolved:true AND metadata["status"]:open AND metadata["priority"]:3 AND metadata["org"]^"liveblocks:" AND metadata["posX"]>100 AND metadata["posX"]<200 AND metadata["posY"]>=50 AND metadata["posY"]<=300
4642
4663
  * ```
4643
4664
  */
4644
4665
  type SimpleFilterValue = string | number | boolean | null;
4645
4666
  type OperatorFilterValue = {
4646
4667
  startsWith: string;
4668
+ gt?: never;
4669
+ lt?: never;
4670
+ gte?: never;
4671
+ lte?: never;
4672
+ } | {
4673
+ lt?: number;
4674
+ gt?: number;
4675
+ lte?: number;
4676
+ gte?: number;
4677
+ startsWith?: never;
4647
4678
  };
4648
4679
  type FilterValue = SimpleFilterValue | OperatorFilterValue;
4649
4680
  declare function objectToQuery(obj: {
@@ -5044,4 +5075,4 @@ type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (EnsureJson
5044
5075
  [K in keyof T as EnsureJson<T[K]> extends never ? never : K]: EnsureJson<T[K]>;
5045
5076
  };
5046
5077
 
5047
- export { type AckOp, type ActivityData, type AiAssistantContentPart, type AiAssistantMessage, type AiChat, type AiChatMessage, type AiChatsQuery, type AiKnowledgeSource, type AiOpaqueToolDefinition, type AiOpaqueToolInvocationProps, type AiReasoningPart, type AiRetrievalPart, type AiTextPart, type AiToolDefinition, type AiToolExecuteCallback, type AiToolExecuteContext, type AiToolInvocationPart, type AiToolInvocationProps, type AiToolTypePack, type AiUserMessage, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type Awaitable, type BaseActivitiesData, type BaseAuthResult, type BaseGroupInfo, 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, type CommentsEventServerMsg, type ContextualPromptContext, type ContextualPromptResponse, type CopilotId, CrdtType, type CreateListOp, type CreateManagedPoolOptions, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type Cursor, type CustomAuthenticationResult, type DAD, type DE, type DGI, type DM, type DP, type DRI, type DS, type DU, DefaultMap, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, Deque, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type GroupData, type GroupDataPlain, type GroupMemberData, type GroupMentionData, type GroupScopes, type History, type HistoryVersion, HttpError, type ISODateString, 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 InferFromSchema, 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, MENTION_CHARACTER, type ManagedPool, type MentionData, type MessageId, MutableSignal, type NoInfr, type NodeMap, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, type NotificationSettings, type NotificationSettingsPlain, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialNotificationSettings, 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 RenderableToolResultResponse, type Resolve, type ResolveGroupsInfoArgs, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomStateServerMsg, type RoomSubscriptionSettings, 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 SubscriptionData, type SubscriptionDataPlain, type SubscriptionDeleteInfo, type SubscriptionDeleteInfoPlain, type SubscriptionKey, type SyncSource, type SyncStatus, TextEditorType, type ThreadData, type ThreadDataPlain, type ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ToImmutable, type ToJson, type ToolResultResponse, 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 UserMentionData, type UserRoomSubscriptionSettings, type UserSubscriptionData, type UserSubscriptionDataPlain, WebsocketCloseCodes, type WithNavigation, type WithOptional, type WithRequired, type YDocUpdateServerMsg, type YjsSyncStatus, ackOp, asPos, assert, assertNever, autoRetry, b64decode, batch, checkBounds, chunk, cloneLson, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToGroupData, convertToInboxNotificationData, convertToSubscriptionData, convertToThreadData, convertToUserSubscriptionData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createManagedPool, createNotificationSettings, createThreadId, defineAiTool, deprecate, deprecateIf, detectDupes, entries, errorIf, findLastIndex, freeze, generateUrl, getMentionsFromCommentBody, getSubscriptionKey, html, htmlSafe, isChildCrdt, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isNotificationChannelEnabled, isPlainObject, isRootCrdt, isStartsWithOperator, isUrl, kInternal, keys, legacy_patchImmutableObject, lsonToJson, makeAbortController, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, patchNotificationSettings, raise, resolveMentionsInCommentBody, sanitizeUrl, shallow, shallow2, stableStringify, stringifyCommentBody, throwUsageError, toPlainLson, tryParseJson, url, urljoin, wait, warnOnce, warnOnceIf, withTimeout };
5078
+ export { type AckOp, type ActivityData, type AiAssistantContentPart, type AiAssistantMessage, type AiChat, type AiChatMessage, type AiChatsQuery, type AiKnowledgeSource, type AiOpaqueToolDefinition, type AiOpaqueToolInvocationProps, type AiReasoningPart, type AiRetrievalPart, type AiTextPart, type AiToolDefinition, type AiToolExecuteCallback, type AiToolExecuteContext, type AiToolInvocationPart, type AiToolInvocationProps, type AiToolTypePack, type AiUserMessage, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type Awaitable, type BaseActivitiesData, type BaseAuthResult, type BaseGroupInfo, 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, type CommentsEventServerMsg, type ContextualPromptContext, type ContextualPromptResponse, type CopilotId, CrdtType, type CreateListOp, type CreateManagedPoolOptions, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type Cursor, type CustomAuthenticationResult, type DAD, type DE, type DGI, type DM, type DP, type DRI, type DS, type DU, DefaultMap, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, Deque, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type GroupData, type GroupDataPlain, type GroupMemberData, type GroupMentionData, type GroupScopes, type History, type HistoryVersion, HttpError, type ISODateString, 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 InferFromSchema, 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, MENTION_CHARACTER, type ManagedPool, type MentionData, type MessageId, MutableSignal, type NoInfr, type NodeMap, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, type NotificationSettings, type NotificationSettingsPlain, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialNotificationSettings, 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 RenderableToolResultResponse, type Resolve, type ResolveGroupsInfoArgs, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomStateServerMsg, type RoomSubscriptionSettings, 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 SubscriptionData, type SubscriptionDataPlain, type SubscriptionDeleteInfo, type SubscriptionDeleteInfoPlain, type SubscriptionKey, type SyncSource, type SyncStatus, TextEditorType, type ThreadData, type ThreadDataPlain, type ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ToImmutable, type ToJson, type ToolResultResponse, 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 UserMentionData, type UserRoomSubscriptionSettings, type UserSubscriptionData, type UserSubscriptionDataPlain, WebsocketCloseCodes, type WithNavigation, type WithOptional, type WithRequired, type YDocUpdateServerMsg, type YjsSyncStatus, ackOp, asPos, assert, assertNever, autoRetry, b64decode, batch, checkBounds, chunk, cloneLson, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToGroupData, convertToInboxNotificationData, convertToSubscriptionData, convertToThreadData, convertToUserSubscriptionData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createManagedPool, createNotificationSettings, createThreadId, defineAiTool, deprecate, deprecateIf, detectDupes, entries, errorIf, findLastIndex, freeze, generateUrl, getMentionsFromCommentBody, getSubscriptionKey, html, htmlSafe, isChildCrdt, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isNotificationChannelEnabled, isNumberOperator, isPlainObject, isRootCrdt, isStartsWithOperator, isUrl, kInternal, keys, legacy_patchImmutableObject, lsonToJson, makeAbortController, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, patchNotificationSettings, raise, resolveMentionsInCommentBody, sanitizeUrl, shallow, shallow2, stableStringify, stringifyCommentBody, throwUsageError, toPlainLson, tryParseJson, url, urljoin, wait, warnOnce, warnOnceIf, withTimeout };
package/dist/index.d.ts CHANGED
@@ -512,6 +512,7 @@ type UpdateDelta = {
512
512
  type: "update";
513
513
  } | {
514
514
  type: "delete";
515
+ deletedItem: Lson;
515
516
  };
516
517
 
517
518
  /**
@@ -1295,6 +1296,12 @@ type ThreadDeleteInfo = {
1295
1296
  type StringOperators<T> = T | {
1296
1297
  startsWith: string;
1297
1298
  };
1299
+ type NumberOperators<T> = T | {
1300
+ lt?: number;
1301
+ gt?: number;
1302
+ lte?: number;
1303
+ gte?: number;
1304
+ };
1298
1305
  /**
1299
1306
  * This type can be used to build a metadata query string (compatible
1300
1307
  * with `@liveblocks/query-parser`) through a type-safe API.
@@ -1304,7 +1311,7 @@ type StringOperators<T> = T | {
1304
1311
  * - `startsWith` (`^` in query string)
1305
1312
  */
1306
1313
  type QueryMetadata<M extends BaseMetadata> = {
1307
- [K in keyof M]: (string extends M[K] ? StringOperators<M[K]> : M[K]) | null;
1314
+ [K in keyof M]: (string extends M[K] ? StringOperators<M[K]> : M[K]) | (number extends M[K] ? NumberOperators<M[K]> : M[K]) | null;
1308
1315
  };
1309
1316
 
1310
1317
  type GroupMemberData = {
@@ -1704,7 +1711,7 @@ interface RoomHttpApi<M extends BaseMetadata> {
1704
1711
  streamStorage(options: {
1705
1712
  roomId: string;
1706
1713
  }): Promise<IdTuple<SerializedCrdt>[]>;
1707
- sendMessages<P extends JsonObject, E extends Json>(options: {
1714
+ sendMessagesOverHTTP<P extends JsonObject, E extends Json>(options: {
1708
1715
  roomId: string;
1709
1716
  nonce: string | undefined;
1710
1717
  messages: ClientMsg<P, E>[];
@@ -4619,6 +4626,12 @@ declare function isPlainObject(blob: unknown): blob is {
4619
4626
  declare function isStartsWithOperator(blob: unknown): blob is {
4620
4627
  startsWith: string;
4621
4628
  };
4629
+ declare function isNumberOperator(blob: unknown): blob is {
4630
+ lt?: number;
4631
+ gt?: number;
4632
+ lte?: number;
4633
+ gte?: number;
4634
+ };
4622
4635
 
4623
4636
  declare const nanoid: (t?: number) => string;
4624
4637
 
@@ -4634,16 +4647,34 @@ declare const nanoid: (t?: number) => string;
4634
4647
  * org: {
4635
4648
  * startsWith: "liveblocks:",
4636
4649
  * },
4650
+ * posX: {
4651
+ * gt: 100,
4652
+ * lt: 200,
4653
+ * },
4654
+ * posY: {
4655
+ * gte: 50,
4656
+ * lte: 300,
4657
+ * },
4637
4658
  * },
4638
4659
  * });
4639
4660
  *
4640
4661
  * console.log(query);
4641
- * // resolved:true AND metadata["status"]:open AND metadata["priority"]:3 AND metadata["org"]^"liveblocks:"
4662
+ * // resolved:true AND metadata["status"]:open AND metadata["priority"]:3 AND metadata["org"]^"liveblocks:" AND metadata["posX"]>100 AND metadata["posX"]<200 AND metadata["posY"]>=50 AND metadata["posY"]<=300
4642
4663
  * ```
4643
4664
  */
4644
4665
  type SimpleFilterValue = string | number | boolean | null;
4645
4666
  type OperatorFilterValue = {
4646
4667
  startsWith: string;
4668
+ gt?: never;
4669
+ lt?: never;
4670
+ gte?: never;
4671
+ lte?: never;
4672
+ } | {
4673
+ lt?: number;
4674
+ gt?: number;
4675
+ lte?: number;
4676
+ gte?: number;
4677
+ startsWith?: never;
4647
4678
  };
4648
4679
  type FilterValue = SimpleFilterValue | OperatorFilterValue;
4649
4680
  declare function objectToQuery(obj: {
@@ -5044,4 +5075,4 @@ type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (EnsureJson
5044
5075
  [K in keyof T as EnsureJson<T[K]> extends never ? never : K]: EnsureJson<T[K]>;
5045
5076
  };
5046
5077
 
5047
- export { type AckOp, type ActivityData, type AiAssistantContentPart, type AiAssistantMessage, type AiChat, type AiChatMessage, type AiChatsQuery, type AiKnowledgeSource, type AiOpaqueToolDefinition, type AiOpaqueToolInvocationProps, type AiReasoningPart, type AiRetrievalPart, type AiTextPart, type AiToolDefinition, type AiToolExecuteCallback, type AiToolExecuteContext, type AiToolInvocationPart, type AiToolInvocationProps, type AiToolTypePack, type AiUserMessage, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type Awaitable, type BaseActivitiesData, type BaseAuthResult, type BaseGroupInfo, 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, type CommentsEventServerMsg, type ContextualPromptContext, type ContextualPromptResponse, type CopilotId, CrdtType, type CreateListOp, type CreateManagedPoolOptions, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type Cursor, type CustomAuthenticationResult, type DAD, type DE, type DGI, type DM, type DP, type DRI, type DS, type DU, DefaultMap, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, Deque, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type GroupData, type GroupDataPlain, type GroupMemberData, type GroupMentionData, type GroupScopes, type History, type HistoryVersion, HttpError, type ISODateString, 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 InferFromSchema, 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, MENTION_CHARACTER, type ManagedPool, type MentionData, type MessageId, MutableSignal, type NoInfr, type NodeMap, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, type NotificationSettings, type NotificationSettingsPlain, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialNotificationSettings, 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 RenderableToolResultResponse, type Resolve, type ResolveGroupsInfoArgs, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomStateServerMsg, type RoomSubscriptionSettings, 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 SubscriptionData, type SubscriptionDataPlain, type SubscriptionDeleteInfo, type SubscriptionDeleteInfoPlain, type SubscriptionKey, type SyncSource, type SyncStatus, TextEditorType, type ThreadData, type ThreadDataPlain, type ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ToImmutable, type ToJson, type ToolResultResponse, 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 UserMentionData, type UserRoomSubscriptionSettings, type UserSubscriptionData, type UserSubscriptionDataPlain, WebsocketCloseCodes, type WithNavigation, type WithOptional, type WithRequired, type YDocUpdateServerMsg, type YjsSyncStatus, ackOp, asPos, assert, assertNever, autoRetry, b64decode, batch, checkBounds, chunk, cloneLson, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToGroupData, convertToInboxNotificationData, convertToSubscriptionData, convertToThreadData, convertToUserSubscriptionData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createManagedPool, createNotificationSettings, createThreadId, defineAiTool, deprecate, deprecateIf, detectDupes, entries, errorIf, findLastIndex, freeze, generateUrl, getMentionsFromCommentBody, getSubscriptionKey, html, htmlSafe, isChildCrdt, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isNotificationChannelEnabled, isPlainObject, isRootCrdt, isStartsWithOperator, isUrl, kInternal, keys, legacy_patchImmutableObject, lsonToJson, makeAbortController, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, patchNotificationSettings, raise, resolveMentionsInCommentBody, sanitizeUrl, shallow, shallow2, stableStringify, stringifyCommentBody, throwUsageError, toPlainLson, tryParseJson, url, urljoin, wait, warnOnce, warnOnceIf, withTimeout };
5078
+ export { type AckOp, type ActivityData, type AiAssistantContentPart, type AiAssistantMessage, type AiChat, type AiChatMessage, type AiChatsQuery, type AiKnowledgeSource, type AiOpaqueToolDefinition, type AiOpaqueToolInvocationProps, type AiReasoningPart, type AiRetrievalPart, type AiTextPart, type AiToolDefinition, type AiToolExecuteCallback, type AiToolExecuteContext, type AiToolInvocationPart, type AiToolInvocationProps, type AiToolTypePack, type AiUserMessage, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type Awaitable, type BaseActivitiesData, type BaseAuthResult, type BaseGroupInfo, 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, type CommentsEventServerMsg, type ContextualPromptContext, type ContextualPromptResponse, type CopilotId, CrdtType, type CreateListOp, type CreateManagedPoolOptions, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type Cursor, type CustomAuthenticationResult, type DAD, type DE, type DGI, type DM, type DP, type DRI, type DS, type DU, DefaultMap, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, Deque, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type GroupData, type GroupDataPlain, type GroupMemberData, type GroupMentionData, type GroupScopes, type History, type HistoryVersion, HttpError, type ISODateString, 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 InferFromSchema, 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, MENTION_CHARACTER, type ManagedPool, type MentionData, type MessageId, MutableSignal, type NoInfr, type NodeMap, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, type NotificationSettings, type NotificationSettingsPlain, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialNotificationSettings, 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 RenderableToolResultResponse, type Resolve, type ResolveGroupsInfoArgs, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomStateServerMsg, type RoomSubscriptionSettings, 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 SubscriptionData, type SubscriptionDataPlain, type SubscriptionDeleteInfo, type SubscriptionDeleteInfoPlain, type SubscriptionKey, type SyncSource, type SyncStatus, TextEditorType, type ThreadData, type ThreadDataPlain, type ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ToImmutable, type ToJson, type ToolResultResponse, 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 UserMentionData, type UserRoomSubscriptionSettings, type UserSubscriptionData, type UserSubscriptionDataPlain, WebsocketCloseCodes, type WithNavigation, type WithOptional, type WithRequired, type YDocUpdateServerMsg, type YjsSyncStatus, ackOp, asPos, assert, assertNever, autoRetry, b64decode, batch, checkBounds, chunk, cloneLson, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToGroupData, convertToInboxNotificationData, convertToSubscriptionData, convertToThreadData, convertToUserSubscriptionData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createManagedPool, createNotificationSettings, createThreadId, defineAiTool, deprecate, deprecateIf, detectDupes, entries, errorIf, findLastIndex, freeze, generateUrl, getMentionsFromCommentBody, getSubscriptionKey, html, htmlSafe, isChildCrdt, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isNotificationChannelEnabled, isNumberOperator, isPlainObject, isRootCrdt, isStartsWithOperator, isUrl, kInternal, keys, legacy_patchImmutableObject, lsonToJson, makeAbortController, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, patchNotificationSettings, raise, resolveMentionsInCommentBody, sanitizeUrl, shallow, shallow2, stableStringify, stringifyCommentBody, throwUsageError, toPlainLson, tryParseJson, url, urljoin, wait, warnOnce, warnOnceIf, 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 = "3.8.0-next4";
9
+ var PKG_VERSION = "3.8.0";
10
10
  var PKG_FORMAT = "esm";
11
11
 
12
12
  // src/dupe-detection.ts
@@ -927,6 +927,9 @@ function isPlainObject(blob) {
927
927
  function isStartsWithOperator(blob) {
928
928
  return isPlainObject(blob) && typeof blob.startsWith === "string";
929
929
  }
930
+ function isNumberOperator(blob) {
931
+ return isPlainObject(blob) && (typeof blob.lt === "number" || typeof blob.gt === "number" || typeof blob.lte === "number" || typeof blob.gte === "number");
932
+ }
930
933
 
931
934
  // src/lib/autoRetry.ts
932
935
  var HttpError = class _HttpError extends Error {
@@ -1281,7 +1284,7 @@ function objectToQuery(obj) {
1281
1284
  if (isSimpleValue(value)) {
1282
1285
  keyValuePairs.push([key, value]);
1283
1286
  } else if (isPlainObject(value)) {
1284
- if (isStartsWithOperator(value)) {
1287
+ if (isStartsWithOperator(value) || isNumberOperator(value)) {
1285
1288
  keyValuePairsWithOperator.push([key, value]);
1286
1289
  } else {
1287
1290
  indexedKeys.push([key, value]);
@@ -1302,7 +1305,7 @@ function objectToQuery(obj) {
1302
1305
  }
1303
1306
  if (isSimpleValue(nestedValue)) {
1304
1307
  nKeyValuePairs.push([formatFilterKey(key, nestedKey), nestedValue]);
1305
- } else if (isStartsWithOperator(nestedValue)) {
1308
+ } else if (isStartsWithOperator(nestedValue) || isNumberOperator(nestedValue)) {
1306
1309
  nKeyValuePairsWithOperator.push([
1307
1310
  formatFilterKey(key, nestedKey),
1308
1311
  nestedValue
@@ -1338,6 +1341,34 @@ var getFiltersFromKeyValuePairsWithOperator = (keyValuePairsWithOperator) => {
1338
1341
  value: value.startsWith
1339
1342
  });
1340
1343
  }
1344
+ if ("lt" in value && typeof value.lt === "number") {
1345
+ filters.push({
1346
+ key,
1347
+ operator: "<",
1348
+ value: value.lt
1349
+ });
1350
+ }
1351
+ if ("gt" in value && typeof value.gt === "number") {
1352
+ filters.push({
1353
+ key,
1354
+ operator: ">",
1355
+ value: value.gt
1356
+ });
1357
+ }
1358
+ if ("gte" in value && typeof value.gte === "number") {
1359
+ filters.push({
1360
+ key,
1361
+ operator: ">=",
1362
+ value: value.gte
1363
+ });
1364
+ }
1365
+ if ("lte" in value && typeof value.lte === "number") {
1366
+ filters.push({
1367
+ key,
1368
+ operator: "<=",
1369
+ value: value.lte
1370
+ });
1371
+ }
1341
1372
  });
1342
1373
  return filters;
1343
1374
  };
@@ -2143,7 +2174,7 @@ function createApiClient({
2143
2174
  );
2144
2175
  return await result.json();
2145
2176
  }
2146
- async function sendMessages(options) {
2177
+ async function sendMessagesOverHTTP(options) {
2147
2178
  return httpClient.rawPost(
2148
2179
  url`/v2/c/rooms/${options.roomId}/send-message`,
2149
2180
  await authManager.getAuthValue({
@@ -2394,7 +2425,7 @@ function createApiClient({
2394
2425
  getChatAttachmentUrl,
2395
2426
  // Room storage
2396
2427
  streamStorage,
2397
- sendMessages,
2428
+ sendMessagesOverHTTP,
2398
2429
  // Notifications
2399
2430
  getInboxNotifications,
2400
2431
  getInboxNotificationsSince,
@@ -7090,7 +7121,12 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
7090
7121
  const storageUpdate = {
7091
7122
  node: this,
7092
7123
  type: "LiveMap",
7093
- updates: { [parentKey]: { type: "delete" } }
7124
+ updates: {
7125
+ [parentKey]: {
7126
+ type: "delete",
7127
+ deletedItem: liveNodeToLson(child)
7128
+ }
7129
+ }
7094
7130
  };
7095
7131
  return { modified: storageUpdate, reverse };
7096
7132
  }
@@ -7183,7 +7219,12 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
7183
7219
  storageUpdates.set(thisId, {
7184
7220
  node: this,
7185
7221
  type: "LiveMap",
7186
- updates: { [key]: { type: "delete" } }
7222
+ updates: {
7223
+ [key]: {
7224
+ type: "delete",
7225
+ deletedItem: liveNodeToLson(item)
7226
+ }
7227
+ }
7187
7228
  });
7188
7229
  this._pool.dispatch(
7189
7230
  [
@@ -7587,13 +7628,13 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
7587
7628
  }
7588
7629
  #applyDeleteObjectKey(op, isLocal) {
7589
7630
  const key = op.key;
7590
- if (this.#map.has(key) === false) {
7631
+ const oldValue = this.#map.get(key);
7632
+ if (oldValue === void 0) {
7591
7633
  return { modified: false };
7592
7634
  }
7593
7635
  if (!isLocal && this.#propToLastUpdate.get(key) !== void 0) {
7594
7636
  return { modified: false };
7595
7637
  }
7596
- const oldValue = this.#map.get(key);
7597
7638
  const id = nn(this._id);
7598
7639
  let reverse = [];
7599
7640
  if (isLiveNode(oldValue)) {
@@ -7614,7 +7655,9 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
7614
7655
  modified: {
7615
7656
  node: this,
7616
7657
  type: "LiveObject",
7617
- updates: { [op.key]: { type: "delete" } }
7658
+ updates: {
7659
+ [op.key]: { type: "delete", deletedItem: oldValue }
7660
+ }
7618
7661
  },
7619
7662
  reverse
7620
7663
  };
@@ -7679,7 +7722,9 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
7679
7722
  storageUpdates.set(this._id, {
7680
7723
  node: this,
7681
7724
  type: "LiveObject",
7682
- updates: { [key]: { type: "delete" } }
7725
+ updates: {
7726
+ [key]: { type: "delete", deletedItem: oldValue }
7727
+ }
7683
7728
  });
7684
7729
  this._pool.dispatch(
7685
7730
  [
@@ -8759,13 +8804,22 @@ function createRoom(options, config) {
8759
8804
  }
8760
8805
  return;
8761
8806
  }
8807
+ // NOTE: This strategy is experimental as it will not work in all situations.
8808
+ // It should only be used for broadcasting, presence updates, but isn't suitable
8809
+ // for Storage or Yjs updates yet (because through this channel the server does
8810
+ // not respond with acks or rejections, causing the client's reported status to
8811
+ // be stuck in "synchronizing" forever).
8762
8812
  case "experimental-fallback-to-http": {
8763
8813
  warn("Message is too large for websockets, so sending over HTTP instead");
8764
8814
  const nonce = context.dynamicSessionInfoSig.get()?.nonce ?? raise("Session is not authorized to send message over HTTP");
8765
- void httpClient.sendMessages({ roomId, nonce, messages }).then((resp) => {
8815
+ void httpClient.sendMessagesOverHTTP({ roomId, nonce, messages }).then((resp) => {
8766
8816
  if (!resp.ok && resp.status === 403) {
8767
8817
  managedSocket.reconnect();
8768
8818
  }
8819
+ }).catch((err) => {
8820
+ error2(
8821
+ `Failed to deliver message over HTTP: ${String(err)}`
8822
+ );
8769
8823
  });
8770
8824
  return;
8771
8825
  }
@@ -10030,12 +10084,6 @@ function createClient(options) {
10030
10084
  );
10031
10085
  } else if (resp.token.parsed.k === "sec-legacy" /* SECRET_LEGACY */) {
10032
10086
  throw new StopRetrying("AI Copilots requires an ID or Access token");
10033
- } else {
10034
- if (!resp.token.parsed.ai) {
10035
- throw new StopRetrying(
10036
- "AI Copilots is not yet enabled for this account. To get started, see https://liveblocks.io/docs/get-started/ai-copilots#Quickstart"
10037
- );
10038
- }
10039
10087
  }
10040
10088
  return resp;
10041
10089
  },
@@ -11237,6 +11285,7 @@ export {
11237
11285
  isJsonScalar,
11238
11286
  isLiveNode,
11239
11287
  isNotificationChannelEnabled,
11288
+ isNumberOperator,
11240
11289
  isPlainObject,
11241
11290
  isRootCrdt,
11242
11291
  isStartsWithOperator,