@liveblocks/core 2.16.1-ai → 2.16.1-ai1
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 +95 -29
- package/dist/index.d.ts +95 -29
- package/dist/index.js +295 -191
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +188 -84
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -151,9 +151,11 @@ type Observable<T> = {
|
|
|
151
151
|
};
|
|
152
152
|
type EventSource<T> = Observable<T> & {
|
|
153
153
|
/**
|
|
154
|
-
* Notify all subscribers about the event.
|
|
154
|
+
* Notify all subscribers about the event. Will return `false` if there
|
|
155
|
+
* weren't any subscribers at the time the .notify() was called, or `true` if
|
|
156
|
+
* there was at least one subscriber.
|
|
155
157
|
*/
|
|
156
|
-
notify(event: T):
|
|
158
|
+
notify(event: T): boolean;
|
|
157
159
|
/**
|
|
158
160
|
* Returns the number of active subscribers.
|
|
159
161
|
*/
|
|
@@ -300,9 +302,6 @@ type LostConnectionEvent = "lost" | "restored" | "failed";
|
|
|
300
302
|
* any value (except null).
|
|
301
303
|
*/
|
|
302
304
|
type BaseAuthResult = NonNullable<Json>;
|
|
303
|
-
declare class LiveblocksError extends Error {
|
|
304
|
-
code: number;
|
|
305
|
-
}
|
|
306
305
|
type Delegates<T extends BaseAuthResult> = {
|
|
307
306
|
authenticate: () => Promise<T>;
|
|
308
307
|
createSocket: (authValue: T) => IWebSocketInstance;
|
|
@@ -1056,7 +1055,7 @@ type StringOperators<T> = T | {
|
|
|
1056
1055
|
* - `startsWith` (`^` in query string)
|
|
1057
1056
|
*/
|
|
1058
1057
|
type QueryMetadata<M extends BaseMetadata> = {
|
|
1059
|
-
[K in keyof M]: string extends M[K] ? StringOperators<M[K]> : M[K];
|
|
1058
|
+
[K in keyof M]: (string extends M[K] ? StringOperators<M[K]> : M[K]) | null;
|
|
1060
1059
|
};
|
|
1061
1060
|
|
|
1062
1061
|
declare global {
|
|
@@ -1522,6 +1521,84 @@ declare namespace DevToolsTreeNode {
|
|
|
1522
1521
|
export type { DevToolsTreeNode_CustomEventTreeNode as CustomEventTreeNode, DevToolsTreeNode_JsonTreeNode as JsonTreeNode, DevToolsTreeNode_LiveTreeNode as LiveTreeNode, DevToolsTreeNode_LsonTreeNode as LsonTreeNode, DevToolsTreeNode_TreeNode as TreeNode, DevToolsTreeNode_UserTreeNode as UserTreeNode };
|
|
1523
1522
|
}
|
|
1524
1523
|
|
|
1524
|
+
type OptionalKeys<T> = {
|
|
1525
|
+
[K in keyof T]-?: undefined extends T[K] ? K : never;
|
|
1526
|
+
}[keyof T];
|
|
1527
|
+
type MakeOptionalFieldsNullable<T> = {
|
|
1528
|
+
[K in keyof T]: K extends OptionalKeys<T> ? T[K] | null : T[K];
|
|
1529
|
+
};
|
|
1530
|
+
type Patchable<T> = Partial<MakeOptionalFieldsNullable<T>>;
|
|
1531
|
+
|
|
1532
|
+
type RoomConnectionErrorContext = {
|
|
1533
|
+
type: "ROOM_CONNECTION_ERROR";
|
|
1534
|
+
code: -1 | 4001 | 4005 | 4006 | (number & {});
|
|
1535
|
+
roomId: string;
|
|
1536
|
+
};
|
|
1537
|
+
type CommentsOrNotificationsErrorContext = {
|
|
1538
|
+
type: "CREATE_THREAD_ERROR";
|
|
1539
|
+
roomId: string;
|
|
1540
|
+
threadId: string;
|
|
1541
|
+
commentId: string;
|
|
1542
|
+
body: CommentBody;
|
|
1543
|
+
metadata: BaseMetadata;
|
|
1544
|
+
} | {
|
|
1545
|
+
type: "DELETE_THREAD_ERROR";
|
|
1546
|
+
roomId: string;
|
|
1547
|
+
threadId: string;
|
|
1548
|
+
} | {
|
|
1549
|
+
type: "EDIT_THREAD_METADATA_ERROR";
|
|
1550
|
+
roomId: string;
|
|
1551
|
+
threadId: string;
|
|
1552
|
+
metadata: Patchable<BaseMetadata>;
|
|
1553
|
+
} | {
|
|
1554
|
+
type: "MARK_THREAD_AS_RESOLVED_ERROR" | "MARK_THREAD_AS_UNRESOLVED_ERROR";
|
|
1555
|
+
roomId: string;
|
|
1556
|
+
threadId: string;
|
|
1557
|
+
} | {
|
|
1558
|
+
type: "CREATE_COMMENT_ERROR" | "EDIT_COMMENT_ERROR";
|
|
1559
|
+
roomId: string;
|
|
1560
|
+
threadId: string;
|
|
1561
|
+
commentId: string;
|
|
1562
|
+
body: CommentBody;
|
|
1563
|
+
} | {
|
|
1564
|
+
type: "DELETE_COMMENT_ERROR";
|
|
1565
|
+
roomId: string;
|
|
1566
|
+
threadId: string;
|
|
1567
|
+
commentId: string;
|
|
1568
|
+
} | {
|
|
1569
|
+
type: "ADD_REACTION_ERROR" | "REMOVE_REACTION_ERROR";
|
|
1570
|
+
roomId: string;
|
|
1571
|
+
threadId: string;
|
|
1572
|
+
commentId: string;
|
|
1573
|
+
emoji: string;
|
|
1574
|
+
} | {
|
|
1575
|
+
type: "MARK_INBOX_NOTIFICATION_AS_READ_ERROR";
|
|
1576
|
+
inboxNotificationId: string;
|
|
1577
|
+
roomId?: string;
|
|
1578
|
+
} | {
|
|
1579
|
+
type: "DELETE_INBOX_NOTIFICATION_ERROR";
|
|
1580
|
+
inboxNotificationId: string;
|
|
1581
|
+
} | {
|
|
1582
|
+
type: "MARK_ALL_INBOX_NOTIFICATIONS_AS_READ_ERROR" | "DELETE_ALL_INBOX_NOTIFICATIONS_ERROR";
|
|
1583
|
+
} | {
|
|
1584
|
+
type: "UPDATE_NOTIFICATION_SETTINGS_ERROR";
|
|
1585
|
+
roomId: string;
|
|
1586
|
+
};
|
|
1587
|
+
type LiveblocksErrorContext = Relax<RoomConnectionErrorContext | CommentsOrNotificationsErrorContext>;
|
|
1588
|
+
declare class LiveblocksError extends Error {
|
|
1589
|
+
readonly context: LiveblocksErrorContext;
|
|
1590
|
+
constructor(message: string, context: LiveblocksErrorContext, cause?: Error);
|
|
1591
|
+
/** Convenience accessor for error.context.roomId (if available) */
|
|
1592
|
+
get roomId(): LiveblocksErrorContext["roomId"];
|
|
1593
|
+
/** @deprecated Prefer using `context.code` instead, to enable type narrowing */
|
|
1594
|
+
get code(): LiveblocksErrorContext["code"];
|
|
1595
|
+
/**
|
|
1596
|
+
* Creates a LiveblocksError from a generic error, by attaching Liveblocks
|
|
1597
|
+
* contextual information like room ID, thread ID, etc.
|
|
1598
|
+
*/
|
|
1599
|
+
static from(context: LiveblocksErrorContext, cause?: Error): LiveblocksError;
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1525
1602
|
/**
|
|
1526
1603
|
* Represents a user connected in a room. Treated as immutable.
|
|
1527
1604
|
*/
|
|
@@ -1575,14 +1652,6 @@ declare enum TextEditorType {
|
|
|
1575
1652
|
TipTap = "tiptap"
|
|
1576
1653
|
}
|
|
1577
1654
|
|
|
1578
|
-
type OptionalKeys<T> = {
|
|
1579
|
-
[K in keyof T]-?: undefined extends T[K] ? K : never;
|
|
1580
|
-
}[keyof T];
|
|
1581
|
-
type MakeOptionalFieldsNullable<T> = {
|
|
1582
|
-
[K in keyof T]: K extends OptionalKeys<T> ? T[K] | null : T[K];
|
|
1583
|
-
};
|
|
1584
|
-
type Patchable<T> = Partial<MakeOptionalFieldsNullable<T>>;
|
|
1585
|
-
|
|
1586
1655
|
type RoomThreadsNotificationSettings = "all" | "replies_and_mentions" | "none";
|
|
1587
1656
|
type RoomNotificationSettings = {
|
|
1588
1657
|
threads: RoomThreadsNotificationSettings;
|
|
@@ -1987,7 +2056,6 @@ type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUs
|
|
|
1987
2056
|
readonly self: Observable<User<P, U>>;
|
|
1988
2057
|
readonly myPresence: Observable<P>;
|
|
1989
2058
|
readonly others: Observable<OthersEvent<P, U>>;
|
|
1990
|
-
readonly error: Observable<LiveblocksError>;
|
|
1991
2059
|
/**
|
|
1992
2060
|
* @deprecated Renamed to `storageBatch`. The `storage` event source will
|
|
1993
2061
|
* soon be replaced by another/incompatible API.
|
|
@@ -2784,6 +2852,7 @@ type PrivateClientApi<U extends BaseUserMeta, M extends BaseMetadata> = {
|
|
|
2784
2852
|
readonly httpClient: LiveblocksHttpApi<M>;
|
|
2785
2853
|
as<M2 extends BaseMetadata>(): Client<U, M2>;
|
|
2786
2854
|
createSyncSource(): SyncSource;
|
|
2855
|
+
emitError(context: LiveblocksErrorContext, cause?: Error): void;
|
|
2787
2856
|
};
|
|
2788
2857
|
type NotificationsApi<M extends BaseMetadata> = {
|
|
2789
2858
|
/**
|
|
@@ -2976,11 +3045,9 @@ type Client<U extends BaseUserMeta = DU, M extends BaseMetadata = DM> = {
|
|
|
2976
3045
|
getSyncStatus(): SyncStatus;
|
|
2977
3046
|
/**
|
|
2978
3047
|
* All possible client events, subscribable from a single place.
|
|
2979
|
-
*
|
|
2980
|
-
* @private These event sources are private for now, but will become public
|
|
2981
|
-
* once they're stable.
|
|
2982
3048
|
*/
|
|
2983
3049
|
readonly events: {
|
|
3050
|
+
readonly error: Observable<LiveblocksError>;
|
|
2984
3051
|
readonly syncStatus: Observable<void>;
|
|
2985
3052
|
};
|
|
2986
3053
|
} & NotificationsApi<M>;
|
|
@@ -3251,10 +3318,14 @@ declare function assert(condition: boolean, errmsg: string): asserts condition;
|
|
|
3251
3318
|
declare function nn<T>(value: T, errmsg?: string): NonNullable<T>;
|
|
3252
3319
|
|
|
3253
3320
|
declare class HttpError extends Error {
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3321
|
+
response: Response;
|
|
3322
|
+
details?: JsonObject;
|
|
3323
|
+
private constructor();
|
|
3324
|
+
static fromResponse(response: Response): Promise<HttpError>;
|
|
3325
|
+
/**
|
|
3326
|
+
* Convenience accessor for response.status.
|
|
3327
|
+
*/
|
|
3328
|
+
get status(): number;
|
|
3258
3329
|
}
|
|
3259
3330
|
/**
|
|
3260
3331
|
* Wraps a promise factory. Will create promises until one succeeds. If
|
|
@@ -3394,7 +3465,7 @@ declare const nanoid: (t?: number) => string;
|
|
|
3394
3465
|
* // resolved:true AND metadata["status"]:open AND metadata["priority"]:3 AND metadata["org"]^"liveblocks:"
|
|
3395
3466
|
* ```
|
|
3396
3467
|
*/
|
|
3397
|
-
type SimpleFilterValue = string | number | boolean;
|
|
3468
|
+
type SimpleFilterValue = string | number | boolean | null;
|
|
3398
3469
|
type OperatorFilterValue = {
|
|
3399
3470
|
startsWith: string;
|
|
3400
3471
|
};
|
|
@@ -3629,11 +3700,6 @@ declare class SortedList<T> {
|
|
|
3629
3700
|
* nested objects are ordered.
|
|
3630
3701
|
*/
|
|
3631
3702
|
declare function stringify(value: unknown): string;
|
|
3632
|
-
/**
|
|
3633
|
-
* Like JSON.stringify(), but returns the same value no matter how keys in any
|
|
3634
|
-
* nested objects are ordered.
|
|
3635
|
-
*/
|
|
3636
|
-
declare function unstringify(value: string): unknown;
|
|
3637
3703
|
|
|
3638
3704
|
type QueryParams = Record<string, string | number | null | undefined> | URLSearchParams;
|
|
3639
3705
|
/**
|
|
@@ -3788,4 +3854,4 @@ declare const CommentsApiError: typeof HttpError;
|
|
|
3788
3854
|
/** @deprecated Use HttpError instead. */
|
|
3789
3855
|
declare const NotificationsApiError: typeof HttpError;
|
|
3790
3856
|
|
|
3791
|
-
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 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,
|
|
3857
|
+
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -151,9 +151,11 @@ type Observable<T> = {
|
|
|
151
151
|
};
|
|
152
152
|
type EventSource<T> = Observable<T> & {
|
|
153
153
|
/**
|
|
154
|
-
* Notify all subscribers about the event.
|
|
154
|
+
* Notify all subscribers about the event. Will return `false` if there
|
|
155
|
+
* weren't any subscribers at the time the .notify() was called, or `true` if
|
|
156
|
+
* there was at least one subscriber.
|
|
155
157
|
*/
|
|
156
|
-
notify(event: T):
|
|
158
|
+
notify(event: T): boolean;
|
|
157
159
|
/**
|
|
158
160
|
* Returns the number of active subscribers.
|
|
159
161
|
*/
|
|
@@ -300,9 +302,6 @@ type LostConnectionEvent = "lost" | "restored" | "failed";
|
|
|
300
302
|
* any value (except null).
|
|
301
303
|
*/
|
|
302
304
|
type BaseAuthResult = NonNullable<Json>;
|
|
303
|
-
declare class LiveblocksError extends Error {
|
|
304
|
-
code: number;
|
|
305
|
-
}
|
|
306
305
|
type Delegates<T extends BaseAuthResult> = {
|
|
307
306
|
authenticate: () => Promise<T>;
|
|
308
307
|
createSocket: (authValue: T) => IWebSocketInstance;
|
|
@@ -1056,7 +1055,7 @@ type StringOperators<T> = T | {
|
|
|
1056
1055
|
* - `startsWith` (`^` in query string)
|
|
1057
1056
|
*/
|
|
1058
1057
|
type QueryMetadata<M extends BaseMetadata> = {
|
|
1059
|
-
[K in keyof M]: string extends M[K] ? StringOperators<M[K]> : M[K];
|
|
1058
|
+
[K in keyof M]: (string extends M[K] ? StringOperators<M[K]> : M[K]) | null;
|
|
1060
1059
|
};
|
|
1061
1060
|
|
|
1062
1061
|
declare global {
|
|
@@ -1522,6 +1521,84 @@ declare namespace DevToolsTreeNode {
|
|
|
1522
1521
|
export type { DevToolsTreeNode_CustomEventTreeNode as CustomEventTreeNode, DevToolsTreeNode_JsonTreeNode as JsonTreeNode, DevToolsTreeNode_LiveTreeNode as LiveTreeNode, DevToolsTreeNode_LsonTreeNode as LsonTreeNode, DevToolsTreeNode_TreeNode as TreeNode, DevToolsTreeNode_UserTreeNode as UserTreeNode };
|
|
1523
1522
|
}
|
|
1524
1523
|
|
|
1524
|
+
type OptionalKeys<T> = {
|
|
1525
|
+
[K in keyof T]-?: undefined extends T[K] ? K : never;
|
|
1526
|
+
}[keyof T];
|
|
1527
|
+
type MakeOptionalFieldsNullable<T> = {
|
|
1528
|
+
[K in keyof T]: K extends OptionalKeys<T> ? T[K] | null : T[K];
|
|
1529
|
+
};
|
|
1530
|
+
type Patchable<T> = Partial<MakeOptionalFieldsNullable<T>>;
|
|
1531
|
+
|
|
1532
|
+
type RoomConnectionErrorContext = {
|
|
1533
|
+
type: "ROOM_CONNECTION_ERROR";
|
|
1534
|
+
code: -1 | 4001 | 4005 | 4006 | (number & {});
|
|
1535
|
+
roomId: string;
|
|
1536
|
+
};
|
|
1537
|
+
type CommentsOrNotificationsErrorContext = {
|
|
1538
|
+
type: "CREATE_THREAD_ERROR";
|
|
1539
|
+
roomId: string;
|
|
1540
|
+
threadId: string;
|
|
1541
|
+
commentId: string;
|
|
1542
|
+
body: CommentBody;
|
|
1543
|
+
metadata: BaseMetadata;
|
|
1544
|
+
} | {
|
|
1545
|
+
type: "DELETE_THREAD_ERROR";
|
|
1546
|
+
roomId: string;
|
|
1547
|
+
threadId: string;
|
|
1548
|
+
} | {
|
|
1549
|
+
type: "EDIT_THREAD_METADATA_ERROR";
|
|
1550
|
+
roomId: string;
|
|
1551
|
+
threadId: string;
|
|
1552
|
+
metadata: Patchable<BaseMetadata>;
|
|
1553
|
+
} | {
|
|
1554
|
+
type: "MARK_THREAD_AS_RESOLVED_ERROR" | "MARK_THREAD_AS_UNRESOLVED_ERROR";
|
|
1555
|
+
roomId: string;
|
|
1556
|
+
threadId: string;
|
|
1557
|
+
} | {
|
|
1558
|
+
type: "CREATE_COMMENT_ERROR" | "EDIT_COMMENT_ERROR";
|
|
1559
|
+
roomId: string;
|
|
1560
|
+
threadId: string;
|
|
1561
|
+
commentId: string;
|
|
1562
|
+
body: CommentBody;
|
|
1563
|
+
} | {
|
|
1564
|
+
type: "DELETE_COMMENT_ERROR";
|
|
1565
|
+
roomId: string;
|
|
1566
|
+
threadId: string;
|
|
1567
|
+
commentId: string;
|
|
1568
|
+
} | {
|
|
1569
|
+
type: "ADD_REACTION_ERROR" | "REMOVE_REACTION_ERROR";
|
|
1570
|
+
roomId: string;
|
|
1571
|
+
threadId: string;
|
|
1572
|
+
commentId: string;
|
|
1573
|
+
emoji: string;
|
|
1574
|
+
} | {
|
|
1575
|
+
type: "MARK_INBOX_NOTIFICATION_AS_READ_ERROR";
|
|
1576
|
+
inboxNotificationId: string;
|
|
1577
|
+
roomId?: string;
|
|
1578
|
+
} | {
|
|
1579
|
+
type: "DELETE_INBOX_NOTIFICATION_ERROR";
|
|
1580
|
+
inboxNotificationId: string;
|
|
1581
|
+
} | {
|
|
1582
|
+
type: "MARK_ALL_INBOX_NOTIFICATIONS_AS_READ_ERROR" | "DELETE_ALL_INBOX_NOTIFICATIONS_ERROR";
|
|
1583
|
+
} | {
|
|
1584
|
+
type: "UPDATE_NOTIFICATION_SETTINGS_ERROR";
|
|
1585
|
+
roomId: string;
|
|
1586
|
+
};
|
|
1587
|
+
type LiveblocksErrorContext = Relax<RoomConnectionErrorContext | CommentsOrNotificationsErrorContext>;
|
|
1588
|
+
declare class LiveblocksError extends Error {
|
|
1589
|
+
readonly context: LiveblocksErrorContext;
|
|
1590
|
+
constructor(message: string, context: LiveblocksErrorContext, cause?: Error);
|
|
1591
|
+
/** Convenience accessor for error.context.roomId (if available) */
|
|
1592
|
+
get roomId(): LiveblocksErrorContext["roomId"];
|
|
1593
|
+
/** @deprecated Prefer using `context.code` instead, to enable type narrowing */
|
|
1594
|
+
get code(): LiveblocksErrorContext["code"];
|
|
1595
|
+
/**
|
|
1596
|
+
* Creates a LiveblocksError from a generic error, by attaching Liveblocks
|
|
1597
|
+
* contextual information like room ID, thread ID, etc.
|
|
1598
|
+
*/
|
|
1599
|
+
static from(context: LiveblocksErrorContext, cause?: Error): LiveblocksError;
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1525
1602
|
/**
|
|
1526
1603
|
* Represents a user connected in a room. Treated as immutable.
|
|
1527
1604
|
*/
|
|
@@ -1575,14 +1652,6 @@ declare enum TextEditorType {
|
|
|
1575
1652
|
TipTap = "tiptap"
|
|
1576
1653
|
}
|
|
1577
1654
|
|
|
1578
|
-
type OptionalKeys<T> = {
|
|
1579
|
-
[K in keyof T]-?: undefined extends T[K] ? K : never;
|
|
1580
|
-
}[keyof T];
|
|
1581
|
-
type MakeOptionalFieldsNullable<T> = {
|
|
1582
|
-
[K in keyof T]: K extends OptionalKeys<T> ? T[K] | null : T[K];
|
|
1583
|
-
};
|
|
1584
|
-
type Patchable<T> = Partial<MakeOptionalFieldsNullable<T>>;
|
|
1585
|
-
|
|
1586
1655
|
type RoomThreadsNotificationSettings = "all" | "replies_and_mentions" | "none";
|
|
1587
1656
|
type RoomNotificationSettings = {
|
|
1588
1657
|
threads: RoomThreadsNotificationSettings;
|
|
@@ -1987,7 +2056,6 @@ type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUs
|
|
|
1987
2056
|
readonly self: Observable<User<P, U>>;
|
|
1988
2057
|
readonly myPresence: Observable<P>;
|
|
1989
2058
|
readonly others: Observable<OthersEvent<P, U>>;
|
|
1990
|
-
readonly error: Observable<LiveblocksError>;
|
|
1991
2059
|
/**
|
|
1992
2060
|
* @deprecated Renamed to `storageBatch`. The `storage` event source will
|
|
1993
2061
|
* soon be replaced by another/incompatible API.
|
|
@@ -2784,6 +2852,7 @@ type PrivateClientApi<U extends BaseUserMeta, M extends BaseMetadata> = {
|
|
|
2784
2852
|
readonly httpClient: LiveblocksHttpApi<M>;
|
|
2785
2853
|
as<M2 extends BaseMetadata>(): Client<U, M2>;
|
|
2786
2854
|
createSyncSource(): SyncSource;
|
|
2855
|
+
emitError(context: LiveblocksErrorContext, cause?: Error): void;
|
|
2787
2856
|
};
|
|
2788
2857
|
type NotificationsApi<M extends BaseMetadata> = {
|
|
2789
2858
|
/**
|
|
@@ -2976,11 +3045,9 @@ type Client<U extends BaseUserMeta = DU, M extends BaseMetadata = DM> = {
|
|
|
2976
3045
|
getSyncStatus(): SyncStatus;
|
|
2977
3046
|
/**
|
|
2978
3047
|
* All possible client events, subscribable from a single place.
|
|
2979
|
-
*
|
|
2980
|
-
* @private These event sources are private for now, but will become public
|
|
2981
|
-
* once they're stable.
|
|
2982
3048
|
*/
|
|
2983
3049
|
readonly events: {
|
|
3050
|
+
readonly error: Observable<LiveblocksError>;
|
|
2984
3051
|
readonly syncStatus: Observable<void>;
|
|
2985
3052
|
};
|
|
2986
3053
|
} & NotificationsApi<M>;
|
|
@@ -3251,10 +3318,14 @@ declare function assert(condition: boolean, errmsg: string): asserts condition;
|
|
|
3251
3318
|
declare function nn<T>(value: T, errmsg?: string): NonNullable<T>;
|
|
3252
3319
|
|
|
3253
3320
|
declare class HttpError extends Error {
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3321
|
+
response: Response;
|
|
3322
|
+
details?: JsonObject;
|
|
3323
|
+
private constructor();
|
|
3324
|
+
static fromResponse(response: Response): Promise<HttpError>;
|
|
3325
|
+
/**
|
|
3326
|
+
* Convenience accessor for response.status.
|
|
3327
|
+
*/
|
|
3328
|
+
get status(): number;
|
|
3258
3329
|
}
|
|
3259
3330
|
/**
|
|
3260
3331
|
* Wraps a promise factory. Will create promises until one succeeds. If
|
|
@@ -3394,7 +3465,7 @@ declare const nanoid: (t?: number) => string;
|
|
|
3394
3465
|
* // resolved:true AND metadata["status"]:open AND metadata["priority"]:3 AND metadata["org"]^"liveblocks:"
|
|
3395
3466
|
* ```
|
|
3396
3467
|
*/
|
|
3397
|
-
type SimpleFilterValue = string | number | boolean;
|
|
3468
|
+
type SimpleFilterValue = string | number | boolean | null;
|
|
3398
3469
|
type OperatorFilterValue = {
|
|
3399
3470
|
startsWith: string;
|
|
3400
3471
|
};
|
|
@@ -3629,11 +3700,6 @@ declare class SortedList<T> {
|
|
|
3629
3700
|
* nested objects are ordered.
|
|
3630
3701
|
*/
|
|
3631
3702
|
declare function stringify(value: unknown): string;
|
|
3632
|
-
/**
|
|
3633
|
-
* Like JSON.stringify(), but returns the same value no matter how keys in any
|
|
3634
|
-
* nested objects are ordered.
|
|
3635
|
-
*/
|
|
3636
|
-
declare function unstringify(value: string): unknown;
|
|
3637
3703
|
|
|
3638
3704
|
type QueryParams = Record<string, string | number | null | undefined> | URLSearchParams;
|
|
3639
3705
|
/**
|
|
@@ -3788,4 +3854,4 @@ declare const CommentsApiError: typeof HttpError;
|
|
|
3788
3854
|
/** @deprecated Use HttpError instead. */
|
|
3789
3855
|
declare const NotificationsApiError: typeof HttpError;
|
|
3790
3856
|
|
|
3791
|
-
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 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,
|
|
3857
|
+
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 };
|