@liveblocks/core 2.16.0 → 2.16.1-ai
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 +42 -95
- package/dist/index.d.ts +42 -95
- package/dist/index.js +221 -296
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +114 -189
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -151,11 +151,9 @@ type Observable<T> = {
|
|
|
151
151
|
};
|
|
152
152
|
type EventSource<T> = Observable<T> & {
|
|
153
153
|
/**
|
|
154
|
-
* Notify all subscribers about the event.
|
|
155
|
-
* weren't any subscribers at the time the .notify() was called, or `true` if
|
|
156
|
-
* there was at least one subscriber.
|
|
154
|
+
* Notify all subscribers about the event.
|
|
157
155
|
*/
|
|
158
|
-
notify(event: T):
|
|
156
|
+
notify(event: T): void;
|
|
159
157
|
/**
|
|
160
158
|
* Returns the number of active subscribers.
|
|
161
159
|
*/
|
|
@@ -302,6 +300,9 @@ type LostConnectionEvent = "lost" | "restored" | "failed";
|
|
|
302
300
|
* any value (except null).
|
|
303
301
|
*/
|
|
304
302
|
type BaseAuthResult = NonNullable<Json>;
|
|
303
|
+
declare class LiveblocksError extends Error {
|
|
304
|
+
code: number;
|
|
305
|
+
}
|
|
305
306
|
type Delegates<T extends BaseAuthResult> = {
|
|
306
307
|
authenticate: () => Promise<T>;
|
|
307
308
|
createSocket: (authValue: T) => IWebSocketInstance;
|
|
@@ -1055,7 +1056,7 @@ type StringOperators<T> = T | {
|
|
|
1055
1056
|
* - `startsWith` (`^` in query string)
|
|
1056
1057
|
*/
|
|
1057
1058
|
type QueryMetadata<M extends BaseMetadata> = {
|
|
1058
|
-
[K in keyof M]:
|
|
1059
|
+
[K in keyof M]: string extends M[K] ? StringOperators<M[K]> : M[K];
|
|
1059
1060
|
};
|
|
1060
1061
|
|
|
1061
1062
|
declare global {
|
|
@@ -1521,84 +1522,6 @@ declare namespace DevToolsTreeNode {
|
|
|
1521
1522
|
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 };
|
|
1522
1523
|
}
|
|
1523
1524
|
|
|
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
|
-
|
|
1602
1525
|
/**
|
|
1603
1526
|
* Represents a user connected in a room. Treated as immutable.
|
|
1604
1527
|
*/
|
|
@@ -1652,6 +1575,14 @@ declare enum TextEditorType {
|
|
|
1652
1575
|
TipTap = "tiptap"
|
|
1653
1576
|
}
|
|
1654
1577
|
|
|
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
|
+
|
|
1655
1586
|
type RoomThreadsNotificationSettings = "all" | "replies_and_mentions" | "none";
|
|
1656
1587
|
type RoomNotificationSettings = {
|
|
1657
1588
|
threads: RoomThreadsNotificationSettings;
|
|
@@ -2056,6 +1987,7 @@ type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUs
|
|
|
2056
1987
|
readonly self: Observable<User<P, U>>;
|
|
2057
1988
|
readonly myPresence: Observable<P>;
|
|
2058
1989
|
readonly others: Observable<OthersEvent<P, U>>;
|
|
1990
|
+
readonly error: Observable<LiveblocksError>;
|
|
2059
1991
|
/**
|
|
2060
1992
|
* @deprecated Renamed to `storageBatch`. The `storage` event source will
|
|
2061
1993
|
* soon be replaced by another/incompatible API.
|
|
@@ -2404,6 +2336,12 @@ type PrivateRoomApi = {
|
|
|
2404
2336
|
}>;
|
|
2405
2337
|
getTextVersion(versionId: string): Promise<Response>;
|
|
2406
2338
|
createTextVersion(): Promise<void>;
|
|
2339
|
+
executeContextualPrompt(options: {
|
|
2340
|
+
prompt: string;
|
|
2341
|
+
selectionText: string;
|
|
2342
|
+
context: string;
|
|
2343
|
+
signal: AbortSignal;
|
|
2344
|
+
}): Promise<string>;
|
|
2407
2345
|
simulate: {
|
|
2408
2346
|
explicitClose(event: IWebSocketCloseEvent): void;
|
|
2409
2347
|
rawSend(data: string): void;
|
|
@@ -2617,6 +2555,13 @@ interface RoomHttpApi<M extends BaseMetadata> {
|
|
|
2617
2555
|
nonce: string | undefined;
|
|
2618
2556
|
messages: ClientMsg<P, E>[];
|
|
2619
2557
|
}): Promise<Response>;
|
|
2558
|
+
executeContextualPrompt({ roomId, selectionText, context, }: {
|
|
2559
|
+
roomId: string;
|
|
2560
|
+
prompt: string;
|
|
2561
|
+
selectionText: string;
|
|
2562
|
+
context: string;
|
|
2563
|
+
signal: AbortSignal;
|
|
2564
|
+
}): Promise<string>;
|
|
2620
2565
|
}
|
|
2621
2566
|
interface NotificationHttpApi<M extends BaseMetadata> {
|
|
2622
2567
|
getInboxNotifications(options?: {
|
|
@@ -2839,7 +2784,6 @@ type PrivateClientApi<U extends BaseUserMeta, M extends BaseMetadata> = {
|
|
|
2839
2784
|
readonly httpClient: LiveblocksHttpApi<M>;
|
|
2840
2785
|
as<M2 extends BaseMetadata>(): Client<U, M2>;
|
|
2841
2786
|
createSyncSource(): SyncSource;
|
|
2842
|
-
emitError(context: LiveblocksErrorContext, cause?: Error): void;
|
|
2843
2787
|
};
|
|
2844
2788
|
type NotificationsApi<M extends BaseMetadata> = {
|
|
2845
2789
|
/**
|
|
@@ -3032,9 +2976,11 @@ type Client<U extends BaseUserMeta = DU, M extends BaseMetadata = DM> = {
|
|
|
3032
2976
|
getSyncStatus(): SyncStatus;
|
|
3033
2977
|
/**
|
|
3034
2978
|
* 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.
|
|
3035
2982
|
*/
|
|
3036
2983
|
readonly events: {
|
|
3037
|
-
readonly error: Observable<LiveblocksError>;
|
|
3038
2984
|
readonly syncStatus: Observable<void>;
|
|
3039
2985
|
};
|
|
3040
2986
|
} & NotificationsApi<M>;
|
|
@@ -3305,14 +3251,10 @@ declare function assert(condition: boolean, errmsg: string): asserts condition;
|
|
|
3305
3251
|
declare function nn<T>(value: T, errmsg?: string): NonNullable<T>;
|
|
3306
3252
|
|
|
3307
3253
|
declare class HttpError extends Error {
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
/**
|
|
3313
|
-
* Convenience accessor for response.status.
|
|
3314
|
-
*/
|
|
3315
|
-
get status(): number;
|
|
3254
|
+
message: string;
|
|
3255
|
+
status: number;
|
|
3256
|
+
details?: JsonObject | undefined;
|
|
3257
|
+
constructor(message: string, status: number, details?: JsonObject | undefined);
|
|
3316
3258
|
}
|
|
3317
3259
|
/**
|
|
3318
3260
|
* Wraps a promise factory. Will create promises until one succeeds. If
|
|
@@ -3452,7 +3394,7 @@ declare const nanoid: (t?: number) => string;
|
|
|
3452
3394
|
* // resolved:true AND metadata["status"]:open AND metadata["priority"]:3 AND metadata["org"]^"liveblocks:"
|
|
3453
3395
|
* ```
|
|
3454
3396
|
*/
|
|
3455
|
-
type SimpleFilterValue = string | number | boolean
|
|
3397
|
+
type SimpleFilterValue = string | number | boolean;
|
|
3456
3398
|
type OperatorFilterValue = {
|
|
3457
3399
|
startsWith: string;
|
|
3458
3400
|
};
|
|
@@ -3687,6 +3629,11 @@ declare class SortedList<T> {
|
|
|
3687
3629
|
* nested objects are ordered.
|
|
3688
3630
|
*/
|
|
3689
3631
|
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;
|
|
3690
3637
|
|
|
3691
3638
|
type QueryParams = Record<string, string | number | null | undefined> | URLSearchParams;
|
|
3692
3639
|
/**
|
|
@@ -3841,4 +3788,4 @@ declare const CommentsApiError: typeof HttpError;
|
|
|
3841
3788
|
/** @deprecated Use HttpError instead. */
|
|
3842
3789
|
declare const NotificationsApiError: typeof HttpError;
|
|
3843
3790
|
|
|
3844
|
-
export { type AckOp, type ActivityData, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type BaseActivitiesData, type BaseAuthResult, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type CommentAttachment, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentLocalAttachment, type CommentMixedAttachment, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, CommentsApiError, type CommentsEventServerMsg, CrdtType, type CreateListOp, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type CustomAuthenticationResult, type DAD, type DE, type DM, type DP, type DRI, type DS, type DU, DefaultMap, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type History, type HistoryVersion, HttpError, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IdTuple, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InitialDocumentStateServerMsg, type Json, type JsonArray, type JsonObject, type JsonScalar, type KDAD, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type
|
|
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, unstringify, url, urljoin, wait, withTimeout };
|
package/dist/index.d.ts
CHANGED
|
@@ -151,11 +151,9 @@ type Observable<T> = {
|
|
|
151
151
|
};
|
|
152
152
|
type EventSource<T> = Observable<T> & {
|
|
153
153
|
/**
|
|
154
|
-
* Notify all subscribers about the event.
|
|
155
|
-
* weren't any subscribers at the time the .notify() was called, or `true` if
|
|
156
|
-
* there was at least one subscriber.
|
|
154
|
+
* Notify all subscribers about the event.
|
|
157
155
|
*/
|
|
158
|
-
notify(event: T):
|
|
156
|
+
notify(event: T): void;
|
|
159
157
|
/**
|
|
160
158
|
* Returns the number of active subscribers.
|
|
161
159
|
*/
|
|
@@ -302,6 +300,9 @@ type LostConnectionEvent = "lost" | "restored" | "failed";
|
|
|
302
300
|
* any value (except null).
|
|
303
301
|
*/
|
|
304
302
|
type BaseAuthResult = NonNullable<Json>;
|
|
303
|
+
declare class LiveblocksError extends Error {
|
|
304
|
+
code: number;
|
|
305
|
+
}
|
|
305
306
|
type Delegates<T extends BaseAuthResult> = {
|
|
306
307
|
authenticate: () => Promise<T>;
|
|
307
308
|
createSocket: (authValue: T) => IWebSocketInstance;
|
|
@@ -1055,7 +1056,7 @@ type StringOperators<T> = T | {
|
|
|
1055
1056
|
* - `startsWith` (`^` in query string)
|
|
1056
1057
|
*/
|
|
1057
1058
|
type QueryMetadata<M extends BaseMetadata> = {
|
|
1058
|
-
[K in keyof M]:
|
|
1059
|
+
[K in keyof M]: string extends M[K] ? StringOperators<M[K]> : M[K];
|
|
1059
1060
|
};
|
|
1060
1061
|
|
|
1061
1062
|
declare global {
|
|
@@ -1521,84 +1522,6 @@ declare namespace DevToolsTreeNode {
|
|
|
1521
1522
|
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 };
|
|
1522
1523
|
}
|
|
1523
1524
|
|
|
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
|
-
|
|
1602
1525
|
/**
|
|
1603
1526
|
* Represents a user connected in a room. Treated as immutable.
|
|
1604
1527
|
*/
|
|
@@ -1652,6 +1575,14 @@ declare enum TextEditorType {
|
|
|
1652
1575
|
TipTap = "tiptap"
|
|
1653
1576
|
}
|
|
1654
1577
|
|
|
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
|
+
|
|
1655
1586
|
type RoomThreadsNotificationSettings = "all" | "replies_and_mentions" | "none";
|
|
1656
1587
|
type RoomNotificationSettings = {
|
|
1657
1588
|
threads: RoomThreadsNotificationSettings;
|
|
@@ -2056,6 +1987,7 @@ type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUs
|
|
|
2056
1987
|
readonly self: Observable<User<P, U>>;
|
|
2057
1988
|
readonly myPresence: Observable<P>;
|
|
2058
1989
|
readonly others: Observable<OthersEvent<P, U>>;
|
|
1990
|
+
readonly error: Observable<LiveblocksError>;
|
|
2059
1991
|
/**
|
|
2060
1992
|
* @deprecated Renamed to `storageBatch`. The `storage` event source will
|
|
2061
1993
|
* soon be replaced by another/incompatible API.
|
|
@@ -2404,6 +2336,12 @@ type PrivateRoomApi = {
|
|
|
2404
2336
|
}>;
|
|
2405
2337
|
getTextVersion(versionId: string): Promise<Response>;
|
|
2406
2338
|
createTextVersion(): Promise<void>;
|
|
2339
|
+
executeContextualPrompt(options: {
|
|
2340
|
+
prompt: string;
|
|
2341
|
+
selectionText: string;
|
|
2342
|
+
context: string;
|
|
2343
|
+
signal: AbortSignal;
|
|
2344
|
+
}): Promise<string>;
|
|
2407
2345
|
simulate: {
|
|
2408
2346
|
explicitClose(event: IWebSocketCloseEvent): void;
|
|
2409
2347
|
rawSend(data: string): void;
|
|
@@ -2617,6 +2555,13 @@ interface RoomHttpApi<M extends BaseMetadata> {
|
|
|
2617
2555
|
nonce: string | undefined;
|
|
2618
2556
|
messages: ClientMsg<P, E>[];
|
|
2619
2557
|
}): Promise<Response>;
|
|
2558
|
+
executeContextualPrompt({ roomId, selectionText, context, }: {
|
|
2559
|
+
roomId: string;
|
|
2560
|
+
prompt: string;
|
|
2561
|
+
selectionText: string;
|
|
2562
|
+
context: string;
|
|
2563
|
+
signal: AbortSignal;
|
|
2564
|
+
}): Promise<string>;
|
|
2620
2565
|
}
|
|
2621
2566
|
interface NotificationHttpApi<M extends BaseMetadata> {
|
|
2622
2567
|
getInboxNotifications(options?: {
|
|
@@ -2839,7 +2784,6 @@ type PrivateClientApi<U extends BaseUserMeta, M extends BaseMetadata> = {
|
|
|
2839
2784
|
readonly httpClient: LiveblocksHttpApi<M>;
|
|
2840
2785
|
as<M2 extends BaseMetadata>(): Client<U, M2>;
|
|
2841
2786
|
createSyncSource(): SyncSource;
|
|
2842
|
-
emitError(context: LiveblocksErrorContext, cause?: Error): void;
|
|
2843
2787
|
};
|
|
2844
2788
|
type NotificationsApi<M extends BaseMetadata> = {
|
|
2845
2789
|
/**
|
|
@@ -3032,9 +2976,11 @@ type Client<U extends BaseUserMeta = DU, M extends BaseMetadata = DM> = {
|
|
|
3032
2976
|
getSyncStatus(): SyncStatus;
|
|
3033
2977
|
/**
|
|
3034
2978
|
* 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.
|
|
3035
2982
|
*/
|
|
3036
2983
|
readonly events: {
|
|
3037
|
-
readonly error: Observable<LiveblocksError>;
|
|
3038
2984
|
readonly syncStatus: Observable<void>;
|
|
3039
2985
|
};
|
|
3040
2986
|
} & NotificationsApi<M>;
|
|
@@ -3305,14 +3251,10 @@ declare function assert(condition: boolean, errmsg: string): asserts condition;
|
|
|
3305
3251
|
declare function nn<T>(value: T, errmsg?: string): NonNullable<T>;
|
|
3306
3252
|
|
|
3307
3253
|
declare class HttpError extends Error {
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
/**
|
|
3313
|
-
* Convenience accessor for response.status.
|
|
3314
|
-
*/
|
|
3315
|
-
get status(): number;
|
|
3254
|
+
message: string;
|
|
3255
|
+
status: number;
|
|
3256
|
+
details?: JsonObject | undefined;
|
|
3257
|
+
constructor(message: string, status: number, details?: JsonObject | undefined);
|
|
3316
3258
|
}
|
|
3317
3259
|
/**
|
|
3318
3260
|
* Wraps a promise factory. Will create promises until one succeeds. If
|
|
@@ -3452,7 +3394,7 @@ declare const nanoid: (t?: number) => string;
|
|
|
3452
3394
|
* // resolved:true AND metadata["status"]:open AND metadata["priority"]:3 AND metadata["org"]^"liveblocks:"
|
|
3453
3395
|
* ```
|
|
3454
3396
|
*/
|
|
3455
|
-
type SimpleFilterValue = string | number | boolean
|
|
3397
|
+
type SimpleFilterValue = string | number | boolean;
|
|
3456
3398
|
type OperatorFilterValue = {
|
|
3457
3399
|
startsWith: string;
|
|
3458
3400
|
};
|
|
@@ -3687,6 +3629,11 @@ declare class SortedList<T> {
|
|
|
3687
3629
|
* nested objects are ordered.
|
|
3688
3630
|
*/
|
|
3689
3631
|
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;
|
|
3690
3637
|
|
|
3691
3638
|
type QueryParams = Record<string, string | number | null | undefined> | URLSearchParams;
|
|
3692
3639
|
/**
|
|
@@ -3841,4 +3788,4 @@ declare const CommentsApiError: typeof HttpError;
|
|
|
3841
3788
|
/** @deprecated Use HttpError instead. */
|
|
3842
3789
|
declare const NotificationsApiError: typeof HttpError;
|
|
3843
3790
|
|
|
3844
|
-
export { type AckOp, type ActivityData, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type BaseActivitiesData, type BaseAuthResult, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type CommentAttachment, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentLocalAttachment, type CommentMixedAttachment, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, CommentsApiError, type CommentsEventServerMsg, CrdtType, type CreateListOp, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type CustomAuthenticationResult, type DAD, type DE, type DM, type DP, type DRI, type DS, type DU, DefaultMap, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type History, type HistoryVersion, HttpError, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IdTuple, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InitialDocumentStateServerMsg, type Json, type JsonArray, type JsonObject, type JsonScalar, type KDAD, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type
|
|
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, unstringify, url, urljoin, wait, withTimeout };
|