@liveblocks/core 2.16.0-toolbars5 → 2.17.0-channels1
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 +157 -49
- package/dist/index.d.ts +157 -49
- package/dist/index.js +148 -111
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +53 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -5,18 +5,72 @@
|
|
|
5
5
|
declare function detectDupes(pkgName: string, pkgVersion: string | false, // false if not built yet
|
|
6
6
|
pkgFormat: string | false): void;
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* This helper type is effectively a no-op, but will force TypeScript to
|
|
10
|
+
* "evaluate" any named helper types in its definition. This can sometimes make
|
|
11
|
+
* API signatures clearer in IDEs.
|
|
12
|
+
*
|
|
13
|
+
* For example, in:
|
|
14
|
+
*
|
|
15
|
+
* type Payload<T> = { data: T };
|
|
16
|
+
*
|
|
17
|
+
* let r1: Payload<string>;
|
|
18
|
+
* let r2: Resolve<Payload<string>>;
|
|
19
|
+
*
|
|
20
|
+
* The inferred type of `r1` is going to be `Payload<string>` which shows up in
|
|
21
|
+
* editor hints, and it may be unclear what's inside if you don't know the
|
|
22
|
+
* definition of `Payload`.
|
|
23
|
+
*
|
|
24
|
+
* The inferred type of `r2` is going to be `{ data: string }`, which may be
|
|
25
|
+
* more helpful.
|
|
26
|
+
*
|
|
27
|
+
* This trick comes from:
|
|
28
|
+
* https://effectivetypescript.com/2022/02/25/gentips-4-display/
|
|
29
|
+
*/
|
|
30
|
+
type Resolve<T> = T extends (...args: unknown[]) => unknown ? T : {
|
|
31
|
+
[K in keyof T]: T[K];
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Relaxes a discriminated union type definition, by explicitly adding
|
|
36
|
+
* properties defined in any other member as 'never'.
|
|
37
|
+
*
|
|
38
|
+
* This makes accessing the members much more relaxed in TypeScript.
|
|
39
|
+
*
|
|
40
|
+
* For example:
|
|
41
|
+
* type MyUnion = Relax<
|
|
42
|
+
* | { foo: string }
|
|
43
|
+
* | { foo: number; bar: string; }
|
|
44
|
+
* | { qux: boolean }
|
|
45
|
+
* >;
|
|
46
|
+
*
|
|
47
|
+
* // With Relax, accessing is much easier:
|
|
48
|
+
* union.foo; // string | number | undefined
|
|
49
|
+
* union.bar; // string | undefined
|
|
50
|
+
* union.qux; // boolean
|
|
51
|
+
* union.whatever; // Error: Property 'whatever' does not exist on type 'MyUnion'
|
|
52
|
+
*
|
|
53
|
+
* // Without Relax, these would all be type errors:
|
|
54
|
+
* union.foo; // Error: Property 'foo' does not exist on type 'MyUnion'
|
|
55
|
+
* union.bar; // Error: Property 'bar' does not exist on type 'MyUnion'
|
|
56
|
+
* union.qux; // Error: Property 'qux' does not exist on type 'MyUnion'
|
|
57
|
+
*/
|
|
58
|
+
type Relax<T> = DistributiveRelax<T, T extends any ? keyof T : never>;
|
|
59
|
+
type DistributiveRelax<T, Ks extends string | number | symbol> = T extends any ? Resolve<{
|
|
60
|
+
[K in keyof T]: T[K];
|
|
61
|
+
} & {
|
|
62
|
+
[K in Exclude<Ks, keyof T>]?: never;
|
|
63
|
+
}> : never;
|
|
64
|
+
|
|
65
|
+
type CustomAuthenticationResult = Relax<{
|
|
9
66
|
token: string;
|
|
10
|
-
error?: never;
|
|
11
67
|
} | {
|
|
12
|
-
token?: never;
|
|
13
68
|
error: "forbidden";
|
|
14
69
|
reason: string;
|
|
15
70
|
} | {
|
|
16
|
-
token?: never;
|
|
17
71
|
error: string;
|
|
18
72
|
reason: string;
|
|
19
|
-
}
|
|
73
|
+
}>;
|
|
20
74
|
|
|
21
75
|
/**
|
|
22
76
|
* Represents an indefinitely deep arbitrary JSON data structure. There are
|
|
@@ -919,22 +973,18 @@ type CommentData = {
|
|
|
919
973
|
editedAt?: Date;
|
|
920
974
|
reactions: CommentReaction[];
|
|
921
975
|
attachments: CommentAttachment[];
|
|
922
|
-
} &
|
|
976
|
+
} & Relax<{
|
|
923
977
|
body: CommentBody;
|
|
924
|
-
deletedAt?: never;
|
|
925
978
|
} | {
|
|
926
|
-
body?: never;
|
|
927
979
|
deletedAt: Date;
|
|
928
|
-
}
|
|
980
|
+
}>;
|
|
929
981
|
type CommentDataPlain = Omit<DateToString<CommentData>, "reactions" | "body"> & {
|
|
930
982
|
reactions: DateToString<CommentReaction>[];
|
|
931
|
-
} &
|
|
983
|
+
} & Relax<{
|
|
932
984
|
body: CommentBody;
|
|
933
|
-
deletedAt?: never;
|
|
934
985
|
} | {
|
|
935
|
-
body?: never;
|
|
936
986
|
deletedAt: string;
|
|
937
|
-
}
|
|
987
|
+
}>;
|
|
938
988
|
type CommentBodyBlockElement = CommentBodyParagraph;
|
|
939
989
|
type CommentBodyInlineElement = CommentBodyText | CommentBodyMention | CommentBodyLink;
|
|
940
990
|
type CommentBodyElement = CommentBodyBlockElement | CommentBodyInlineElement;
|
|
@@ -1131,11 +1181,13 @@ type FetchYDocClientMsg = {
|
|
|
1131
1181
|
readonly type: ClientMsgCode.FETCH_YDOC;
|
|
1132
1182
|
readonly vector: string;
|
|
1133
1183
|
readonly guid?: string;
|
|
1184
|
+
readonly v2?: boolean;
|
|
1134
1185
|
};
|
|
1135
1186
|
type UpdateYDocClientMsg = {
|
|
1136
1187
|
readonly type: ClientMsgCode.UPDATE_YDOC;
|
|
1137
1188
|
readonly update: string;
|
|
1138
1189
|
readonly guid?: string;
|
|
1190
|
+
readonly v2?: boolean;
|
|
1139
1191
|
};
|
|
1140
1192
|
|
|
1141
1193
|
type IdTuple<T> = [id: string, value: T];
|
|
@@ -1338,6 +1390,7 @@ type YDocUpdateServerMsg = {
|
|
|
1338
1390
|
readonly isSync: boolean;
|
|
1339
1391
|
readonly stateVector: string | null;
|
|
1340
1392
|
readonly guid?: string;
|
|
1393
|
+
readonly v2?: boolean;
|
|
1341
1394
|
};
|
|
1342
1395
|
/**
|
|
1343
1396
|
* Sent by the WebSocket server and broadcasted to all clients to announce that
|
|
@@ -1469,32 +1522,6 @@ declare namespace DevToolsTreeNode {
|
|
|
1469
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 };
|
|
1470
1523
|
}
|
|
1471
1524
|
|
|
1472
|
-
/**
|
|
1473
|
-
* This helper type is effectively a no-op, but will force TypeScript to
|
|
1474
|
-
* "evaluate" any named helper types in its definition. This can sometimes make
|
|
1475
|
-
* API signatures clearer in IDEs.
|
|
1476
|
-
*
|
|
1477
|
-
* For example, in:
|
|
1478
|
-
*
|
|
1479
|
-
* type Payload<T> = { data: T };
|
|
1480
|
-
*
|
|
1481
|
-
* let r1: Payload<string>;
|
|
1482
|
-
* let r2: Resolve<Payload<string>>;
|
|
1483
|
-
*
|
|
1484
|
-
* The inferred type of `r1` is going to be `Payload<string>` which shows up in
|
|
1485
|
-
* editor hints, and it may be unclear what's inside if you don't know the
|
|
1486
|
-
* definition of `Payload`.
|
|
1487
|
-
*
|
|
1488
|
-
* The inferred type of `r2` is going to be `{ data: string }`, which may be
|
|
1489
|
-
* more helpful.
|
|
1490
|
-
*
|
|
1491
|
-
* This trick comes from:
|
|
1492
|
-
* https://effectivetypescript.com/2022/02/25/gentips-4-display/
|
|
1493
|
-
*/
|
|
1494
|
-
type Resolve<T> = T extends (...args: unknown[]) => unknown ? T : {
|
|
1495
|
-
[K in keyof T]: T[K];
|
|
1496
|
-
};
|
|
1497
|
-
|
|
1498
1525
|
/**
|
|
1499
1526
|
* Represents a user connected in a room. Treated as immutable.
|
|
1500
1527
|
*/
|
|
@@ -1527,7 +1554,7 @@ type User<P extends JsonObject = DP, U extends BaseUserMeta = DU> = {
|
|
|
1527
1554
|
readonly canComment: boolean;
|
|
1528
1555
|
};
|
|
1529
1556
|
|
|
1530
|
-
type InternalOthersEvent<P extends JsonObject, U extends BaseUserMeta> = {
|
|
1557
|
+
type InternalOthersEvent<P extends JsonObject, U extends BaseUserMeta> = Relax<{
|
|
1531
1558
|
type: "leave";
|
|
1532
1559
|
user: User<P, U>;
|
|
1533
1560
|
} | {
|
|
@@ -1539,8 +1566,7 @@ type InternalOthersEvent<P extends JsonObject, U extends BaseUserMeta> = {
|
|
|
1539
1566
|
updates: Partial<P>;
|
|
1540
1567
|
} | {
|
|
1541
1568
|
type: "reset";
|
|
1542
|
-
|
|
1543
|
-
};
|
|
1569
|
+
}>;
|
|
1544
1570
|
type OthersEvent<P extends JsonObject = DP, U extends BaseUserMeta = DU> = Resolve<InternalOthersEvent<P, U> & {
|
|
1545
1571
|
others: readonly User<P, U>[];
|
|
1546
1572
|
}>;
|
|
@@ -1909,11 +1935,11 @@ type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUs
|
|
|
1909
1935
|
*
|
|
1910
1936
|
* @param {string} data the doc update to send to the server, base64 encoded uint8array
|
|
1911
1937
|
*/
|
|
1912
|
-
updateYDoc(data: string, guid?: string): void;
|
|
1938
|
+
updateYDoc(data: string, guid?: string, isV2?: boolean): void;
|
|
1913
1939
|
/**
|
|
1914
1940
|
* Sends a request for the current document from liveblocks server
|
|
1915
1941
|
*/
|
|
1916
|
-
fetchYDoc(stateVector: string, guid?: string): void;
|
|
1942
|
+
fetchYDoc(stateVector: string, guid?: string, isV2?: boolean): void;
|
|
1917
1943
|
/**
|
|
1918
1944
|
* Broadcasts an event to other users in the room. Event broadcasted to the room can be listened with {@link Room.subscribe}("event").
|
|
1919
1945
|
* @param {any} event the event to broadcast. Should be serializable to JSON
|
|
@@ -2348,6 +2374,55 @@ type OptionalTupleUnless<C, T extends any[]> = Record<string, never> extends C ?
|
|
|
2348
2374
|
C
|
|
2349
2375
|
] extends [never] ? OptionalTuple<T> : T;
|
|
2350
2376
|
|
|
2377
|
+
/**
|
|
2378
|
+
* Pre-defined notification channels support list.
|
|
2379
|
+
*/
|
|
2380
|
+
type NotificationChannel = "email" | "slack" | "teams" | "webPush";
|
|
2381
|
+
/**
|
|
2382
|
+
* `K` represents custom notification kinds
|
|
2383
|
+
* defined in the augmentation `ActivitiesData` (e.g `liveblocks.config.ts`).
|
|
2384
|
+
* It means the type `NotificationKind` will be shaped like:
|
|
2385
|
+
* thread | textMention | $customKind1 | $customKind2 | ...
|
|
2386
|
+
*/
|
|
2387
|
+
type NotificationKind<K extends keyof DAD = keyof DAD> = "thread" | "textMention" | K;
|
|
2388
|
+
/**
|
|
2389
|
+
* A channel notification setting is a set of notification kinds.
|
|
2390
|
+
* One setting can have multiple kinds (+ augmentation)
|
|
2391
|
+
*/
|
|
2392
|
+
type ChannelNotificationSetting = {
|
|
2393
|
+
[K in NotificationKind]: boolean;
|
|
2394
|
+
};
|
|
2395
|
+
/**
|
|
2396
|
+
* Channels notification settings are a set of channel notification setting.
|
|
2397
|
+
* One channel for one setting.
|
|
2398
|
+
*/
|
|
2399
|
+
type ChannelsNotificationSettings = {
|
|
2400
|
+
[C in NotificationChannel]: ChannelNotificationSetting;
|
|
2401
|
+
};
|
|
2402
|
+
/**
|
|
2403
|
+
* It creates a deep partial specific for `ChannelsNotificationSettings`
|
|
2404
|
+
* to offer a nice DX when updating the settings (e.g not being forced to define every keys)
|
|
2405
|
+
* and at the same the some preserver the augmentation for custom kinds (e.g `liveblocks.config.ts`).
|
|
2406
|
+
*/
|
|
2407
|
+
type DeepPartialWithAugmentation<T> = T extends object ? {
|
|
2408
|
+
[P in keyof T]?: T[P] extends {
|
|
2409
|
+
[K in NotificationKind]: boolean;
|
|
2410
|
+
} ? Partial<T[P]> & {
|
|
2411
|
+
[K in keyof DAD]?: boolean;
|
|
2412
|
+
} : DeepPartialWithAugmentation<T[P]>;
|
|
2413
|
+
} : T;
|
|
2414
|
+
/**
|
|
2415
|
+
* Partial channels notification settings
|
|
2416
|
+
* with augmentation preserved gracefully
|
|
2417
|
+
*/
|
|
2418
|
+
type PartialChannelsNotificationSettings = DeepPartialWithAugmentation<ChannelsNotificationSettings>;
|
|
2419
|
+
/**
|
|
2420
|
+
*
|
|
2421
|
+
* Utility to check if a channel notification setting
|
|
2422
|
+
* is enabled for every notification kinds.
|
|
2423
|
+
*/
|
|
2424
|
+
declare function isChannelNotificationSettingEnabled(setting: ChannelNotificationSetting): boolean;
|
|
2425
|
+
|
|
2351
2426
|
interface RoomHttpApi<M extends BaseMetadata> {
|
|
2352
2427
|
getThreads(options: {
|
|
2353
2428
|
roomId: string;
|
|
@@ -2552,6 +2627,8 @@ interface NotificationHttpApi<M extends BaseMetadata> {
|
|
|
2552
2627
|
markInboxNotificationAsRead(inboxNotificationId: string): Promise<void>;
|
|
2553
2628
|
deleteAllInboxNotifications(): Promise<void>;
|
|
2554
2629
|
deleteInboxNotification(inboxNotificationId: string): Promise<void>;
|
|
2630
|
+
getChannelsNotificationSettings(): Promise<ChannelsNotificationSettings>;
|
|
2631
|
+
updateChannelsNotificationSettings(settings: PartialChannelsNotificationSettings): Promise<ChannelsNotificationSettings>;
|
|
2555
2632
|
}
|
|
2556
2633
|
interface LiveblocksHttpApi<M extends BaseMetadata> extends RoomHttpApi<M>, NotificationHttpApi<M> {
|
|
2557
2634
|
getUserThreads_experimental(options?: {
|
|
@@ -2840,6 +2917,27 @@ type NotificationsApi<M extends BaseMetadata> = {
|
|
|
2840
2917
|
* await client.deleteInboxNotification("in_xxx");
|
|
2841
2918
|
*/
|
|
2842
2919
|
deleteInboxNotification(inboxNotificationId: string): Promise<void>;
|
|
2920
|
+
/**
|
|
2921
|
+
* Gets channels notifications settings for a user for a project.
|
|
2922
|
+
*
|
|
2923
|
+
* @example
|
|
2924
|
+
* const channelsNotificationSettings = await client.getChannelsNotificationSettings();
|
|
2925
|
+
*/
|
|
2926
|
+
getChannelsNotificationSettings(options?: {
|
|
2927
|
+
signal?: AbortSignal;
|
|
2928
|
+
}): Promise<ChannelsNotificationSettings>;
|
|
2929
|
+
/**
|
|
2930
|
+
* Update channels notifications for a user for a project.
|
|
2931
|
+
*
|
|
2932
|
+
* @example
|
|
2933
|
+
* await client.updateChannelsNotificationSettings({
|
|
2934
|
+
* email: {
|
|
2935
|
+
* thread: true,
|
|
2936
|
+
* textMention: false,
|
|
2937
|
+
* }
|
|
2938
|
+
* })
|
|
2939
|
+
*/
|
|
2940
|
+
updateChannelsNotificationSettings(settings: PartialChannelsNotificationSettings): Promise<ChannelsNotificationSettings>;
|
|
2843
2941
|
};
|
|
2844
2942
|
/**
|
|
2845
2943
|
* @private Widest-possible Client type, matching _any_ Client instance. Note
|
|
@@ -2977,13 +3075,11 @@ type ClientOptions<U extends BaseUserMeta = DU> = {
|
|
|
2977
3075
|
* the server yet.
|
|
2978
3076
|
*/
|
|
2979
3077
|
preventUnsavedChanges?: boolean;
|
|
2980
|
-
} &
|
|
3078
|
+
} & Relax<{
|
|
2981
3079
|
publicApiKey: string;
|
|
2982
|
-
authEndpoint?: never;
|
|
2983
3080
|
} | {
|
|
2984
|
-
publicApiKey?: never;
|
|
2985
3081
|
authEndpoint: AuthEndpoint;
|
|
2986
|
-
}
|
|
3082
|
+
}>;
|
|
2987
3083
|
/**
|
|
2988
3084
|
* Create a client that will be responsible to communicate with liveblocks servers.
|
|
2989
3085
|
*
|
|
@@ -3429,6 +3525,18 @@ type DistributiveOmit<T, K extends PropertyKey> = T extends any ? Omit<T, K> : n
|
|
|
3429
3525
|
* Throw an error, but as an expression instead of a statement.
|
|
3430
3526
|
*/
|
|
3431
3527
|
declare function raise(msg: string): never;
|
|
3528
|
+
/**
|
|
3529
|
+
* Drop-in replacement for Object.entries() that retains better types.
|
|
3530
|
+
*/
|
|
3531
|
+
declare function entries<O extends {
|
|
3532
|
+
[key: string]: unknown;
|
|
3533
|
+
}, K extends keyof O>(obj: O): [K, O[K]][];
|
|
3534
|
+
/**
|
|
3535
|
+
* Drop-in replacement for Object.keys() that retains better types.
|
|
3536
|
+
*/
|
|
3537
|
+
declare function keys<O extends {
|
|
3538
|
+
[key: string]: unknown;
|
|
3539
|
+
}, K extends keyof O>(obj: O): K[];
|
|
3432
3540
|
/**
|
|
3433
3541
|
* Creates a new object by mapping a function over all values. Keys remain the
|
|
3434
3542
|
* same. Think Array.prototype.map(), but for values in an object.
|
|
@@ -3751,4 +3859,4 @@ declare const CommentsApiError: typeof HttpError;
|
|
|
3751
3859
|
/** @deprecated Use HttpError instead. */
|
|
3752
3860
|
declare const NotificationsApiError: typeof HttpError;
|
|
3753
3861
|
|
|
3754
|
-
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 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 };
|
|
3862
|
+
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 ChannelNotificationSetting, type ChannelsNotificationSettings, 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, type NotificationChannel, type NotificationKind, NotificationsApiError, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalPromise, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialChannelsNotificationSettings, 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, entries, errorIf, freeze, generateCommentUrl, getMentionedIdsFromCommentBody, html, htmlSafe, isChannelNotificationSettingEnabled, isChildCrdt, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, isStartsWithOperator, kInternal, keys, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, raise, resolveUsersInCommentBody, shallow, stringify, stringifyCommentBody, throwUsageError, toAbsoluteUrl, toPlainLson, tryParseJson, unstringify, url, urljoin, wait, withTimeout };
|
package/dist/index.d.ts
CHANGED
|
@@ -5,18 +5,72 @@
|
|
|
5
5
|
declare function detectDupes(pkgName: string, pkgVersion: string | false, // false if not built yet
|
|
6
6
|
pkgFormat: string | false): void;
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* This helper type is effectively a no-op, but will force TypeScript to
|
|
10
|
+
* "evaluate" any named helper types in its definition. This can sometimes make
|
|
11
|
+
* API signatures clearer in IDEs.
|
|
12
|
+
*
|
|
13
|
+
* For example, in:
|
|
14
|
+
*
|
|
15
|
+
* type Payload<T> = { data: T };
|
|
16
|
+
*
|
|
17
|
+
* let r1: Payload<string>;
|
|
18
|
+
* let r2: Resolve<Payload<string>>;
|
|
19
|
+
*
|
|
20
|
+
* The inferred type of `r1` is going to be `Payload<string>` which shows up in
|
|
21
|
+
* editor hints, and it may be unclear what's inside if you don't know the
|
|
22
|
+
* definition of `Payload`.
|
|
23
|
+
*
|
|
24
|
+
* The inferred type of `r2` is going to be `{ data: string }`, which may be
|
|
25
|
+
* more helpful.
|
|
26
|
+
*
|
|
27
|
+
* This trick comes from:
|
|
28
|
+
* https://effectivetypescript.com/2022/02/25/gentips-4-display/
|
|
29
|
+
*/
|
|
30
|
+
type Resolve<T> = T extends (...args: unknown[]) => unknown ? T : {
|
|
31
|
+
[K in keyof T]: T[K];
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Relaxes a discriminated union type definition, by explicitly adding
|
|
36
|
+
* properties defined in any other member as 'never'.
|
|
37
|
+
*
|
|
38
|
+
* This makes accessing the members much more relaxed in TypeScript.
|
|
39
|
+
*
|
|
40
|
+
* For example:
|
|
41
|
+
* type MyUnion = Relax<
|
|
42
|
+
* | { foo: string }
|
|
43
|
+
* | { foo: number; bar: string; }
|
|
44
|
+
* | { qux: boolean }
|
|
45
|
+
* >;
|
|
46
|
+
*
|
|
47
|
+
* // With Relax, accessing is much easier:
|
|
48
|
+
* union.foo; // string | number | undefined
|
|
49
|
+
* union.bar; // string | undefined
|
|
50
|
+
* union.qux; // boolean
|
|
51
|
+
* union.whatever; // Error: Property 'whatever' does not exist on type 'MyUnion'
|
|
52
|
+
*
|
|
53
|
+
* // Without Relax, these would all be type errors:
|
|
54
|
+
* union.foo; // Error: Property 'foo' does not exist on type 'MyUnion'
|
|
55
|
+
* union.bar; // Error: Property 'bar' does not exist on type 'MyUnion'
|
|
56
|
+
* union.qux; // Error: Property 'qux' does not exist on type 'MyUnion'
|
|
57
|
+
*/
|
|
58
|
+
type Relax<T> = DistributiveRelax<T, T extends any ? keyof T : never>;
|
|
59
|
+
type DistributiveRelax<T, Ks extends string | number | symbol> = T extends any ? Resolve<{
|
|
60
|
+
[K in keyof T]: T[K];
|
|
61
|
+
} & {
|
|
62
|
+
[K in Exclude<Ks, keyof T>]?: never;
|
|
63
|
+
}> : never;
|
|
64
|
+
|
|
65
|
+
type CustomAuthenticationResult = Relax<{
|
|
9
66
|
token: string;
|
|
10
|
-
error?: never;
|
|
11
67
|
} | {
|
|
12
|
-
token?: never;
|
|
13
68
|
error: "forbidden";
|
|
14
69
|
reason: string;
|
|
15
70
|
} | {
|
|
16
|
-
token?: never;
|
|
17
71
|
error: string;
|
|
18
72
|
reason: string;
|
|
19
|
-
}
|
|
73
|
+
}>;
|
|
20
74
|
|
|
21
75
|
/**
|
|
22
76
|
* Represents an indefinitely deep arbitrary JSON data structure. There are
|
|
@@ -919,22 +973,18 @@ type CommentData = {
|
|
|
919
973
|
editedAt?: Date;
|
|
920
974
|
reactions: CommentReaction[];
|
|
921
975
|
attachments: CommentAttachment[];
|
|
922
|
-
} &
|
|
976
|
+
} & Relax<{
|
|
923
977
|
body: CommentBody;
|
|
924
|
-
deletedAt?: never;
|
|
925
978
|
} | {
|
|
926
|
-
body?: never;
|
|
927
979
|
deletedAt: Date;
|
|
928
|
-
}
|
|
980
|
+
}>;
|
|
929
981
|
type CommentDataPlain = Omit<DateToString<CommentData>, "reactions" | "body"> & {
|
|
930
982
|
reactions: DateToString<CommentReaction>[];
|
|
931
|
-
} &
|
|
983
|
+
} & Relax<{
|
|
932
984
|
body: CommentBody;
|
|
933
|
-
deletedAt?: never;
|
|
934
985
|
} | {
|
|
935
|
-
body?: never;
|
|
936
986
|
deletedAt: string;
|
|
937
|
-
}
|
|
987
|
+
}>;
|
|
938
988
|
type CommentBodyBlockElement = CommentBodyParagraph;
|
|
939
989
|
type CommentBodyInlineElement = CommentBodyText | CommentBodyMention | CommentBodyLink;
|
|
940
990
|
type CommentBodyElement = CommentBodyBlockElement | CommentBodyInlineElement;
|
|
@@ -1131,11 +1181,13 @@ type FetchYDocClientMsg = {
|
|
|
1131
1181
|
readonly type: ClientMsgCode.FETCH_YDOC;
|
|
1132
1182
|
readonly vector: string;
|
|
1133
1183
|
readonly guid?: string;
|
|
1184
|
+
readonly v2?: boolean;
|
|
1134
1185
|
};
|
|
1135
1186
|
type UpdateYDocClientMsg = {
|
|
1136
1187
|
readonly type: ClientMsgCode.UPDATE_YDOC;
|
|
1137
1188
|
readonly update: string;
|
|
1138
1189
|
readonly guid?: string;
|
|
1190
|
+
readonly v2?: boolean;
|
|
1139
1191
|
};
|
|
1140
1192
|
|
|
1141
1193
|
type IdTuple<T> = [id: string, value: T];
|
|
@@ -1338,6 +1390,7 @@ type YDocUpdateServerMsg = {
|
|
|
1338
1390
|
readonly isSync: boolean;
|
|
1339
1391
|
readonly stateVector: string | null;
|
|
1340
1392
|
readonly guid?: string;
|
|
1393
|
+
readonly v2?: boolean;
|
|
1341
1394
|
};
|
|
1342
1395
|
/**
|
|
1343
1396
|
* Sent by the WebSocket server and broadcasted to all clients to announce that
|
|
@@ -1469,32 +1522,6 @@ declare namespace DevToolsTreeNode {
|
|
|
1469
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 };
|
|
1470
1523
|
}
|
|
1471
1524
|
|
|
1472
|
-
/**
|
|
1473
|
-
* This helper type is effectively a no-op, but will force TypeScript to
|
|
1474
|
-
* "evaluate" any named helper types in its definition. This can sometimes make
|
|
1475
|
-
* API signatures clearer in IDEs.
|
|
1476
|
-
*
|
|
1477
|
-
* For example, in:
|
|
1478
|
-
*
|
|
1479
|
-
* type Payload<T> = { data: T };
|
|
1480
|
-
*
|
|
1481
|
-
* let r1: Payload<string>;
|
|
1482
|
-
* let r2: Resolve<Payload<string>>;
|
|
1483
|
-
*
|
|
1484
|
-
* The inferred type of `r1` is going to be `Payload<string>` which shows up in
|
|
1485
|
-
* editor hints, and it may be unclear what's inside if you don't know the
|
|
1486
|
-
* definition of `Payload`.
|
|
1487
|
-
*
|
|
1488
|
-
* The inferred type of `r2` is going to be `{ data: string }`, which may be
|
|
1489
|
-
* more helpful.
|
|
1490
|
-
*
|
|
1491
|
-
* This trick comes from:
|
|
1492
|
-
* https://effectivetypescript.com/2022/02/25/gentips-4-display/
|
|
1493
|
-
*/
|
|
1494
|
-
type Resolve<T> = T extends (...args: unknown[]) => unknown ? T : {
|
|
1495
|
-
[K in keyof T]: T[K];
|
|
1496
|
-
};
|
|
1497
|
-
|
|
1498
1525
|
/**
|
|
1499
1526
|
* Represents a user connected in a room. Treated as immutable.
|
|
1500
1527
|
*/
|
|
@@ -1527,7 +1554,7 @@ type User<P extends JsonObject = DP, U extends BaseUserMeta = DU> = {
|
|
|
1527
1554
|
readonly canComment: boolean;
|
|
1528
1555
|
};
|
|
1529
1556
|
|
|
1530
|
-
type InternalOthersEvent<P extends JsonObject, U extends BaseUserMeta> = {
|
|
1557
|
+
type InternalOthersEvent<P extends JsonObject, U extends BaseUserMeta> = Relax<{
|
|
1531
1558
|
type: "leave";
|
|
1532
1559
|
user: User<P, U>;
|
|
1533
1560
|
} | {
|
|
@@ -1539,8 +1566,7 @@ type InternalOthersEvent<P extends JsonObject, U extends BaseUserMeta> = {
|
|
|
1539
1566
|
updates: Partial<P>;
|
|
1540
1567
|
} | {
|
|
1541
1568
|
type: "reset";
|
|
1542
|
-
|
|
1543
|
-
};
|
|
1569
|
+
}>;
|
|
1544
1570
|
type OthersEvent<P extends JsonObject = DP, U extends BaseUserMeta = DU> = Resolve<InternalOthersEvent<P, U> & {
|
|
1545
1571
|
others: readonly User<P, U>[];
|
|
1546
1572
|
}>;
|
|
@@ -1909,11 +1935,11 @@ type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUs
|
|
|
1909
1935
|
*
|
|
1910
1936
|
* @param {string} data the doc update to send to the server, base64 encoded uint8array
|
|
1911
1937
|
*/
|
|
1912
|
-
updateYDoc(data: string, guid?: string): void;
|
|
1938
|
+
updateYDoc(data: string, guid?: string, isV2?: boolean): void;
|
|
1913
1939
|
/**
|
|
1914
1940
|
* Sends a request for the current document from liveblocks server
|
|
1915
1941
|
*/
|
|
1916
|
-
fetchYDoc(stateVector: string, guid?: string): void;
|
|
1942
|
+
fetchYDoc(stateVector: string, guid?: string, isV2?: boolean): void;
|
|
1917
1943
|
/**
|
|
1918
1944
|
* Broadcasts an event to other users in the room. Event broadcasted to the room can be listened with {@link Room.subscribe}("event").
|
|
1919
1945
|
* @param {any} event the event to broadcast. Should be serializable to JSON
|
|
@@ -2348,6 +2374,55 @@ type OptionalTupleUnless<C, T extends any[]> = Record<string, never> extends C ?
|
|
|
2348
2374
|
C
|
|
2349
2375
|
] extends [never] ? OptionalTuple<T> : T;
|
|
2350
2376
|
|
|
2377
|
+
/**
|
|
2378
|
+
* Pre-defined notification channels support list.
|
|
2379
|
+
*/
|
|
2380
|
+
type NotificationChannel = "email" | "slack" | "teams" | "webPush";
|
|
2381
|
+
/**
|
|
2382
|
+
* `K` represents custom notification kinds
|
|
2383
|
+
* defined in the augmentation `ActivitiesData` (e.g `liveblocks.config.ts`).
|
|
2384
|
+
* It means the type `NotificationKind` will be shaped like:
|
|
2385
|
+
* thread | textMention | $customKind1 | $customKind2 | ...
|
|
2386
|
+
*/
|
|
2387
|
+
type NotificationKind<K extends keyof DAD = keyof DAD> = "thread" | "textMention" | K;
|
|
2388
|
+
/**
|
|
2389
|
+
* A channel notification setting is a set of notification kinds.
|
|
2390
|
+
* One setting can have multiple kinds (+ augmentation)
|
|
2391
|
+
*/
|
|
2392
|
+
type ChannelNotificationSetting = {
|
|
2393
|
+
[K in NotificationKind]: boolean;
|
|
2394
|
+
};
|
|
2395
|
+
/**
|
|
2396
|
+
* Channels notification settings are a set of channel notification setting.
|
|
2397
|
+
* One channel for one setting.
|
|
2398
|
+
*/
|
|
2399
|
+
type ChannelsNotificationSettings = {
|
|
2400
|
+
[C in NotificationChannel]: ChannelNotificationSetting;
|
|
2401
|
+
};
|
|
2402
|
+
/**
|
|
2403
|
+
* It creates a deep partial specific for `ChannelsNotificationSettings`
|
|
2404
|
+
* to offer a nice DX when updating the settings (e.g not being forced to define every keys)
|
|
2405
|
+
* and at the same the some preserver the augmentation for custom kinds (e.g `liveblocks.config.ts`).
|
|
2406
|
+
*/
|
|
2407
|
+
type DeepPartialWithAugmentation<T> = T extends object ? {
|
|
2408
|
+
[P in keyof T]?: T[P] extends {
|
|
2409
|
+
[K in NotificationKind]: boolean;
|
|
2410
|
+
} ? Partial<T[P]> & {
|
|
2411
|
+
[K in keyof DAD]?: boolean;
|
|
2412
|
+
} : DeepPartialWithAugmentation<T[P]>;
|
|
2413
|
+
} : T;
|
|
2414
|
+
/**
|
|
2415
|
+
* Partial channels notification settings
|
|
2416
|
+
* with augmentation preserved gracefully
|
|
2417
|
+
*/
|
|
2418
|
+
type PartialChannelsNotificationSettings = DeepPartialWithAugmentation<ChannelsNotificationSettings>;
|
|
2419
|
+
/**
|
|
2420
|
+
*
|
|
2421
|
+
* Utility to check if a channel notification setting
|
|
2422
|
+
* is enabled for every notification kinds.
|
|
2423
|
+
*/
|
|
2424
|
+
declare function isChannelNotificationSettingEnabled(setting: ChannelNotificationSetting): boolean;
|
|
2425
|
+
|
|
2351
2426
|
interface RoomHttpApi<M extends BaseMetadata> {
|
|
2352
2427
|
getThreads(options: {
|
|
2353
2428
|
roomId: string;
|
|
@@ -2552,6 +2627,8 @@ interface NotificationHttpApi<M extends BaseMetadata> {
|
|
|
2552
2627
|
markInboxNotificationAsRead(inboxNotificationId: string): Promise<void>;
|
|
2553
2628
|
deleteAllInboxNotifications(): Promise<void>;
|
|
2554
2629
|
deleteInboxNotification(inboxNotificationId: string): Promise<void>;
|
|
2630
|
+
getChannelsNotificationSettings(): Promise<ChannelsNotificationSettings>;
|
|
2631
|
+
updateChannelsNotificationSettings(settings: PartialChannelsNotificationSettings): Promise<ChannelsNotificationSettings>;
|
|
2555
2632
|
}
|
|
2556
2633
|
interface LiveblocksHttpApi<M extends BaseMetadata> extends RoomHttpApi<M>, NotificationHttpApi<M> {
|
|
2557
2634
|
getUserThreads_experimental(options?: {
|
|
@@ -2840,6 +2917,27 @@ type NotificationsApi<M extends BaseMetadata> = {
|
|
|
2840
2917
|
* await client.deleteInboxNotification("in_xxx");
|
|
2841
2918
|
*/
|
|
2842
2919
|
deleteInboxNotification(inboxNotificationId: string): Promise<void>;
|
|
2920
|
+
/**
|
|
2921
|
+
* Gets channels notifications settings for a user for a project.
|
|
2922
|
+
*
|
|
2923
|
+
* @example
|
|
2924
|
+
* const channelsNotificationSettings = await client.getChannelsNotificationSettings();
|
|
2925
|
+
*/
|
|
2926
|
+
getChannelsNotificationSettings(options?: {
|
|
2927
|
+
signal?: AbortSignal;
|
|
2928
|
+
}): Promise<ChannelsNotificationSettings>;
|
|
2929
|
+
/**
|
|
2930
|
+
* Update channels notifications for a user for a project.
|
|
2931
|
+
*
|
|
2932
|
+
* @example
|
|
2933
|
+
* await client.updateChannelsNotificationSettings({
|
|
2934
|
+
* email: {
|
|
2935
|
+
* thread: true,
|
|
2936
|
+
* textMention: false,
|
|
2937
|
+
* }
|
|
2938
|
+
* })
|
|
2939
|
+
*/
|
|
2940
|
+
updateChannelsNotificationSettings(settings: PartialChannelsNotificationSettings): Promise<ChannelsNotificationSettings>;
|
|
2843
2941
|
};
|
|
2844
2942
|
/**
|
|
2845
2943
|
* @private Widest-possible Client type, matching _any_ Client instance. Note
|
|
@@ -2977,13 +3075,11 @@ type ClientOptions<U extends BaseUserMeta = DU> = {
|
|
|
2977
3075
|
* the server yet.
|
|
2978
3076
|
*/
|
|
2979
3077
|
preventUnsavedChanges?: boolean;
|
|
2980
|
-
} &
|
|
3078
|
+
} & Relax<{
|
|
2981
3079
|
publicApiKey: string;
|
|
2982
|
-
authEndpoint?: never;
|
|
2983
3080
|
} | {
|
|
2984
|
-
publicApiKey?: never;
|
|
2985
3081
|
authEndpoint: AuthEndpoint;
|
|
2986
|
-
}
|
|
3082
|
+
}>;
|
|
2987
3083
|
/**
|
|
2988
3084
|
* Create a client that will be responsible to communicate with liveblocks servers.
|
|
2989
3085
|
*
|
|
@@ -3429,6 +3525,18 @@ type DistributiveOmit<T, K extends PropertyKey> = T extends any ? Omit<T, K> : n
|
|
|
3429
3525
|
* Throw an error, but as an expression instead of a statement.
|
|
3430
3526
|
*/
|
|
3431
3527
|
declare function raise(msg: string): never;
|
|
3528
|
+
/**
|
|
3529
|
+
* Drop-in replacement for Object.entries() that retains better types.
|
|
3530
|
+
*/
|
|
3531
|
+
declare function entries<O extends {
|
|
3532
|
+
[key: string]: unknown;
|
|
3533
|
+
}, K extends keyof O>(obj: O): [K, O[K]][];
|
|
3534
|
+
/**
|
|
3535
|
+
* Drop-in replacement for Object.keys() that retains better types.
|
|
3536
|
+
*/
|
|
3537
|
+
declare function keys<O extends {
|
|
3538
|
+
[key: string]: unknown;
|
|
3539
|
+
}, K extends keyof O>(obj: O): K[];
|
|
3432
3540
|
/**
|
|
3433
3541
|
* Creates a new object by mapping a function over all values. Keys remain the
|
|
3434
3542
|
* same. Think Array.prototype.map(), but for values in an object.
|
|
@@ -3751,4 +3859,4 @@ declare const CommentsApiError: typeof HttpError;
|
|
|
3751
3859
|
/** @deprecated Use HttpError instead. */
|
|
3752
3860
|
declare const NotificationsApiError: typeof HttpError;
|
|
3753
3861
|
|
|
3754
|
-
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 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 };
|
|
3862
|
+
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 ChannelNotificationSetting, type ChannelsNotificationSettings, 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, type NotificationChannel, type NotificationKind, NotificationsApiError, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalPromise, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialChannelsNotificationSettings, 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, entries, errorIf, freeze, generateCommentUrl, getMentionedIdsFromCommentBody, html, htmlSafe, isChannelNotificationSettingEnabled, isChildCrdt, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, isStartsWithOperator, kInternal, keys, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, raise, resolveUsersInCommentBody, shallow, stringify, stringifyCommentBody, throwUsageError, toAbsoluteUrl, toPlainLson, tryParseJson, unstringify, url, urljoin, wait, withTimeout };
|