@liveblocks/core 2.15.1 → 2.16.0-rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -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
- declare type CustomAuthenticationResult = {
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
@@ -28,13 +82,13 @@ declare type CustomAuthenticationResult = {
28
82
  * - JsonObject a JSON value whose outer type is an object
29
83
  *
30
84
  */
31
- declare type Json = JsonScalar | JsonArray | JsonObject;
32
- declare type JsonScalar = string | number | boolean | null;
33
- declare type JsonArray = Json[];
85
+ type Json = JsonScalar | JsonArray | JsonObject;
86
+ type JsonScalar = string | number | boolean | null;
87
+ type JsonArray = Json[];
34
88
  /**
35
89
  * Any valid JSON object.
36
90
  */
37
- declare type JsonObject = {
91
+ type JsonObject = {
38
92
  [key: string]: Json | undefined;
39
93
  };
40
94
  declare function isJsonScalar(data: Json): data is JsonScalar;
@@ -46,7 +100,7 @@ declare function isJsonObject(data: Json): data is JsonObject;
46
100
  * object is fine, but _if_ it has a name field, it _must_ be a string."
47
101
  * (Ditto for avatar.)
48
102
  */
49
- declare type IUserInfo = {
103
+ type IUserInfo = {
50
104
  [key: string]: Json | undefined;
51
105
  name?: string;
52
106
  avatar?: string;
@@ -54,7 +108,7 @@ declare type IUserInfo = {
54
108
  /**
55
109
  * This type is used by clients to define the metadata for a user.
56
110
  */
57
- declare type BaseUserMeta = {
111
+ type BaseUserMeta = {
58
112
  /**
59
113
  * The id of the user that has been set in the authentication endpoint.
60
114
  * Useful to get additional information about the connected user.
@@ -74,9 +128,9 @@ declare enum Permission {
74
128
  CommentsRead = "comments:read"
75
129
  }
76
130
 
77
- declare type Callback<T> = (event: T) => void;
78
- declare type UnsubscribeCallback = () => void;
79
- declare type Observable<T> = {
131
+ type Callback<T> = (event: T) => void;
132
+ type UnsubscribeCallback = () => void;
133
+ type Observable<T> = {
80
134
  /**
81
135
  * Register a callback function to be called whenever the event source emits
82
136
  * an event.
@@ -95,11 +149,13 @@ declare type Observable<T> = {
95
149
  */
96
150
  waitUntil(predicate?: (event: T) => boolean): Promise<T>;
97
151
  };
98
- declare type EventSource<T> = Observable<T> & {
152
+ type EventSource<T> = Observable<T> & {
99
153
  /**
100
- * 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.
101
157
  */
102
- notify(event: T): void;
158
+ notify(event: T): boolean;
103
159
  /**
104
160
  * Returns the number of active subscribers.
105
161
  */
@@ -227,7 +283,7 @@ declare enum WebsocketCloseCodes {
227
283
  * a Room, as returned by `room.getStatus()`. Can be used to implement
228
284
  * a connection status badge.
229
285
  */
230
- declare type Status = "initial" | "connecting" | "connected" | "reconnecting" | "disconnected";
286
+ type Status = "initial" | "connecting" | "connected" | "reconnecting" | "disconnected";
231
287
  /**
232
288
  * Used to report about app-level reconnection issues.
233
289
  *
@@ -237,7 +293,7 @@ declare type Status = "initial" | "connecting" | "connected" | "reconnecting" |
237
293
  * to inform your users about, for example, by throwing a toast message on
238
294
  * screen, or show a "trying to reconnect" banner.
239
295
  */
240
- declare type LostConnectionEvent = "lost" | "restored" | "failed";
296
+ type LostConnectionEvent = "lost" | "restored" | "failed";
241
297
  /**
242
298
  * Arbitrary record that will be used as the authentication "authValue". It's the
243
299
  * value that is returned by calling the authentication delegate, and will get
@@ -245,11 +301,8 @@ declare type LostConnectionEvent = "lost" | "restored" | "failed";
245
301
  * the connection manager, but its value will not be interpreted, so it can be
246
302
  * any value (except null).
247
303
  */
248
- declare type BaseAuthResult = NonNullable<Json>;
249
- declare class LiveblocksError extends Error {
250
- code: number;
251
- }
252
- declare type Delegates<T extends BaseAuthResult> = {
304
+ type BaseAuthResult = NonNullable<Json>;
305
+ type Delegates<T extends BaseAuthResult> = {
253
306
  authenticate: () => Promise<T>;
254
307
  createSocket: (authValue: T) => IWebSocketInstance;
255
308
  canZombie: () => boolean;
@@ -270,15 +323,15 @@ declare enum OpCode {
270
323
  * These operations are the payload for {@link UpdateStorageServerMsg} messages
271
324
  * only.
272
325
  */
273
- declare type Op = AckOp | CreateOp | UpdateObjectOp | DeleteCrdtOp | SetParentKeyOp | DeleteObjectKeyOp;
274
- declare type CreateOp = CreateObjectOp | CreateRegisterOp | CreateMapOp | CreateListOp;
275
- declare type UpdateObjectOp = {
326
+ type Op = AckOp | CreateOp | UpdateObjectOp | DeleteCrdtOp | SetParentKeyOp | DeleteObjectKeyOp;
327
+ type CreateOp = CreateObjectOp | CreateRegisterOp | CreateMapOp | CreateListOp;
328
+ type UpdateObjectOp = {
276
329
  readonly opId?: string;
277
330
  readonly id: string;
278
331
  readonly type: OpCode.UPDATE_OBJECT;
279
332
  readonly data: Partial<JsonObject>;
280
333
  };
281
- declare type CreateObjectOp = {
334
+ type CreateObjectOp = {
282
335
  readonly opId?: string;
283
336
  readonly id: string;
284
337
  readonly intent?: "set";
@@ -288,7 +341,7 @@ declare type CreateObjectOp = {
288
341
  readonly parentKey: string;
289
342
  readonly data: JsonObject;
290
343
  };
291
- declare type CreateListOp = {
344
+ type CreateListOp = {
292
345
  readonly opId?: string;
293
346
  readonly id: string;
294
347
  readonly intent?: "set";
@@ -297,7 +350,7 @@ declare type CreateListOp = {
297
350
  readonly parentId: string;
298
351
  readonly parentKey: string;
299
352
  };
300
- declare type CreateMapOp = {
353
+ type CreateMapOp = {
301
354
  readonly opId?: string;
302
355
  readonly id: string;
303
356
  readonly intent?: "set";
@@ -306,7 +359,7 @@ declare type CreateMapOp = {
306
359
  readonly parentId: string;
307
360
  readonly parentKey: string;
308
361
  };
309
- declare type CreateRegisterOp = {
362
+ type CreateRegisterOp = {
310
363
  readonly opId?: string;
311
364
  readonly id: string;
312
365
  readonly intent?: "set";
@@ -316,12 +369,12 @@ declare type CreateRegisterOp = {
316
369
  readonly parentKey: string;
317
370
  readonly data: Json;
318
371
  };
319
- declare type DeleteCrdtOp = {
372
+ type DeleteCrdtOp = {
320
373
  readonly opId?: string;
321
374
  readonly id: string;
322
375
  readonly type: OpCode.DELETE_CRDT;
323
376
  };
324
- declare type AckOp = {
377
+ type AckOp = {
325
378
  readonly type: OpCode.DELETE_CRDT;
326
379
  readonly id: "ACK";
327
380
  readonly opId: string;
@@ -345,13 +398,13 @@ declare type AckOp = {
345
398
  * node does not exist, but as a side-effect the Op will get acknowledged.
346
399
  */
347
400
  declare function ackOp(opId: string): AckOp;
348
- declare type SetParentKeyOp = {
401
+ type SetParentKeyOp = {
349
402
  readonly opId?: string;
350
403
  readonly id: string;
351
404
  readonly type: OpCode.SET_PARENT_KEY;
352
405
  readonly parentKey: string;
353
406
  };
354
- declare type DeleteObjectKeyOp = {
407
+ type DeleteObjectKeyOp = {
355
408
  readonly opId?: string;
356
409
  readonly id: string;
357
410
  readonly type: OpCode.DELETE_OBJECT_KEY;
@@ -362,15 +415,15 @@ declare type DeleteObjectKeyOp = {
362
415
  * Represents an indefinitely deep arbitrary immutable data
363
416
  * structure, as returned by the .toImmutable().
364
417
  */
365
- declare type Immutable = Scalar | ImmutableList | ImmutableObject | ImmutableMap;
366
- declare type Scalar = string | number | boolean | null;
367
- declare type ImmutableList = readonly Immutable[];
368
- declare type ImmutableObject = {
418
+ type Immutable = Scalar | ImmutableList | ImmutableObject | ImmutableMap;
419
+ type Scalar = string | number | boolean | null;
420
+ type ImmutableList = readonly Immutable[];
421
+ type ImmutableObject = {
369
422
  readonly [key: string]: Immutable | undefined;
370
423
  };
371
- declare type ImmutableMap = ReadonlyMap<string, Immutable>;
424
+ type ImmutableMap = ReadonlyMap<string, Immutable>;
372
425
 
373
- declare type UpdateDelta = {
426
+ type UpdateDelta = {
374
427
  type: "update";
375
428
  } | {
376
429
  type: "delete";
@@ -418,20 +471,20 @@ declare type UpdateDelta = {
418
471
  *
419
472
  */
420
473
 
421
- declare type PlainLsonFields = Record<string, PlainLson>;
422
- declare type PlainLsonObject = {
474
+ type PlainLsonFields = Record<string, PlainLson>;
475
+ type PlainLsonObject = {
423
476
  liveblocksType: "LiveObject";
424
477
  data: PlainLsonFields;
425
478
  };
426
- declare type PlainLsonMap = {
479
+ type PlainLsonMap = {
427
480
  liveblocksType: "LiveMap";
428
481
  data: PlainLsonFields;
429
482
  };
430
- declare type PlainLsonList = {
483
+ type PlainLsonList = {
431
484
  liveblocksType: "LiveList";
432
485
  data: PlainLson[];
433
486
  };
434
- declare type PlainLson = PlainLsonObject | PlainLsonMap | PlainLsonList | Json;
487
+ type PlainLson = PlainLsonObject | PlainLsonMap | PlainLsonList | Json;
435
488
 
436
489
  /**
437
490
  * Helper type to convert any valid Lson type to the equivalent Json type.
@@ -449,7 +502,7 @@ declare type PlainLson = PlainLsonObject | PlainLsonMap | PlainLsonList | Json;
449
502
  * // { readonly a: null, readonly b: readonly string[], readonly c?: number }
450
503
  *
451
504
  */
452
- declare type ToImmutable<L extends Lson | LsonObject> = L extends LiveList<infer I> ? readonly ToImmutable<I>[] : L extends LiveObject<infer O> ? ToImmutable<O> : L extends LiveMap<infer K, infer V> ? ReadonlyMap<K, ToImmutable<V>> : L extends LsonObject ? {
505
+ type ToImmutable<L extends Lson | LsonObject> = L extends LiveList<infer I> ? readonly ToImmutable<I>[] : L extends LiveObject<infer O> ? ToImmutable<O> : L extends LiveMap<infer K, infer V> ? ReadonlyMap<K, ToImmutable<V>> : L extends LsonObject ? {
453
506
  readonly [K in keyof L]: ToImmutable<Exclude<L[K], undefined>> | (undefined extends L[K] ? undefined : never);
454
507
  } : L extends Json ? L : never;
455
508
  /**
@@ -461,7 +514,7 @@ declare function toPlainLson(lson: Lson): PlainLson;
461
514
  * A LiveMap notification that is sent in-client to any subscribers whenever
462
515
  * one or more of the values inside the LiveMap instance have changed.
463
516
  */
464
- declare type LiveMapUpdates<TKey extends string, TValue extends Lson> = {
517
+ type LiveMapUpdates<TKey extends string, TValue extends Lson> = {
465
518
  type: "LiveMap";
466
519
  node: LiveMap<TKey, TValue>;
467
520
  updates: {
@@ -528,16 +581,16 @@ declare class LiveMap<TKey extends string, TValue extends Lson> extends Abstract
528
581
  clone(): LiveMap<TKey, TValue>;
529
582
  }
530
583
 
531
- declare type StorageCallback = (updates: StorageUpdate[]) => void;
532
- declare type LiveMapUpdate = LiveMapUpdates<string, Lson>;
533
- declare type LiveObjectUpdate = LiveObjectUpdates<LsonObject>;
534
- declare type LiveListUpdate = LiveListUpdates<Lson>;
584
+ type StorageCallback = (updates: StorageUpdate[]) => void;
585
+ type LiveMapUpdate = LiveMapUpdates<string, Lson>;
586
+ type LiveObjectUpdate = LiveObjectUpdates<LsonObject>;
587
+ type LiveListUpdate = LiveListUpdates<Lson>;
535
588
  /**
536
589
  * The payload of notifications sent (in-client) when LiveStructures change.
537
590
  * Messages of this kind are not originating from the network, but are 100%
538
591
  * in-client.
539
592
  */
540
- declare type StorageUpdate = LiveMapUpdate | LiveObjectUpdate | LiveListUpdate;
593
+ type StorageUpdate = LiveMapUpdate | LiveObjectUpdate | LiveListUpdate;
541
594
 
542
595
  declare abstract class AbstractCrdt {
543
596
  #private;
@@ -553,7 +606,7 @@ declare abstract class AbstractCrdt {
553
606
  abstract clone(): Lson;
554
607
  }
555
608
 
556
- declare type LiveListUpdateDelta = {
609
+ type LiveListUpdateDelta = {
557
610
  type: "insert";
558
611
  index: number;
559
612
  item: Lson;
@@ -575,7 +628,7 @@ declare type LiveListUpdateDelta = {
575
628
  * A LiveList notification that is sent in-client to any subscribers whenever
576
629
  * one or more of the items inside the LiveList instance have changed.
577
630
  */
578
- declare type LiveListUpdates<TItem extends Lson> = {
631
+ type LiveListUpdates<TItem extends Lson> = {
579
632
  type: "LiveList";
580
633
  node: LiveList<TItem>;
581
634
  updates: LiveListUpdateDelta[];
@@ -694,23 +747,23 @@ declare class LiveRegister<TValue extends Json> extends AbstractCrdt {
694
747
  clone(): TValue;
695
748
  }
696
749
 
697
- declare type LiveStructure = LiveObject<LsonObject> | LiveList<Lson> | LiveMap<string, Lson>;
750
+ type LiveStructure = LiveObject<LsonObject> | LiveList<Lson> | LiveMap<string, Lson>;
698
751
  /**
699
752
  * Think of Lson as a sibling of the Json data tree, except that the nested
700
753
  * data structure can contain a mix of Json values and LiveStructure instances.
701
754
  */
702
- declare type Lson = Json | LiveStructure;
755
+ type Lson = Json | LiveStructure;
703
756
  /**
704
757
  * LiveNode is the internal tree for managing Live data structures. The key
705
758
  * difference with Lson is that all the Json values get represented in
706
759
  * a LiveRegister node.
707
760
  */
708
- declare type LiveNode = LiveStructure | LiveRegister<Json>;
761
+ type LiveNode = LiveStructure | LiveRegister<Json>;
709
762
  /**
710
763
  * A mapping of keys to Lson values. A Lson value is any valid JSON
711
764
  * value or a Live storage data structure (LiveMap, LiveList, etc.)
712
765
  */
713
- declare type LsonObject = {
766
+ type LsonObject = {
714
767
  [key: string]: Lson | undefined;
715
768
  };
716
769
  /**
@@ -729,13 +782,13 @@ declare type LsonObject = {
729
782
  * // { a: null, b: string[], c?: number }
730
783
  *
731
784
  */
732
- declare type ToJson<T extends Lson | LsonObject> = T extends Json ? T : T extends LsonObject ? {
785
+ type ToJson<T extends Lson | LsonObject> = T extends Json ? T : T extends LsonObject ? {
733
786
  [K in keyof T]: ToJson<Exclude<T[K], undefined>> | (undefined extends T[K] ? undefined : never);
734
787
  } : T extends LiveList<infer I> ? ToJson<I>[] : T extends LiveObject<infer O> ? ToJson<O> : T extends LiveMap<infer KS, infer V> ? {
735
788
  [K in KS]: ToJson<V>;
736
789
  } : never;
737
790
 
738
- declare type LiveObjectUpdateDelta<O extends {
791
+ type LiveObjectUpdateDelta<O extends {
739
792
  [key: string]: unknown;
740
793
  }> = {
741
794
  [K in keyof O]?: UpdateDelta | undefined;
@@ -744,7 +797,7 @@ declare type LiveObjectUpdateDelta<O extends {
744
797
  * A LiveObject notification that is sent in-client to any subscribers whenever
745
798
  * one or more of the entries inside the LiveObject instance have changed.
746
799
  */
747
- declare type LiveObjectUpdates<TData extends LsonObject> = {
800
+ type LiveObjectUpdates<TData extends LsonObject> = {
748
801
  type: "LiveObject";
749
802
  node: LiveObject<TData>;
750
803
  updates: LiveObjectUpdateDelta<TData>;
@@ -786,11 +839,11 @@ declare class LiveObject<O extends LsonObject> extends AbstractCrdt {
786
839
  clone(): LiveObject<O>;
787
840
  }
788
841
 
789
- declare type DateToString<T> = {
842
+ type DateToString<T> = {
790
843
  [P in keyof T]: T[P] extends Date ? string : T[P] extends Date | null ? string | null : T[P] extends Date | undefined ? string | undefined : T[P];
791
844
  };
792
845
 
793
- declare type InboxNotificationThreadData = {
846
+ type InboxNotificationThreadData = {
794
847
  kind: "thread";
795
848
  id: string;
796
849
  roomId: string;
@@ -798,7 +851,7 @@ declare type InboxNotificationThreadData = {
798
851
  notifiedAt: Date;
799
852
  readAt: Date | null;
800
853
  };
801
- declare type InboxNotificationTextMentionData = {
854
+ type InboxNotificationTextMentionData = {
802
855
  kind: "textMention";
803
856
  id: string;
804
857
  roomId: string;
@@ -807,14 +860,14 @@ declare type InboxNotificationTextMentionData = {
807
860
  createdBy: string;
808
861
  mentionId: string;
809
862
  };
810
- declare type InboxNotificationTextMentionDataPlain = DateToString<InboxNotificationTextMentionData>;
811
- declare type ActivityData = Record<string, string | boolean | number | undefined>;
812
- declare type InboxNotificationActivity<K extends keyof DAD = keyof DAD> = {
863
+ type InboxNotificationTextMentionDataPlain = DateToString<InboxNotificationTextMentionData>;
864
+ type ActivityData = Record<string, string | boolean | number | undefined>;
865
+ type InboxNotificationActivity<K extends keyof DAD = keyof DAD> = {
813
866
  id: string;
814
867
  createdAt: Date;
815
868
  data: DAD[K];
816
869
  };
817
- declare type InboxNotificationCustomData<K extends keyof DAD = keyof DAD> = {
870
+ type InboxNotificationCustomData<K extends keyof DAD = keyof DAD> = {
818
871
  kind: K;
819
872
  id: string;
820
873
  roomId?: string;
@@ -823,24 +876,24 @@ declare type InboxNotificationCustomData<K extends keyof DAD = keyof DAD> = {
823
876
  readAt: Date | null;
824
877
  activities: InboxNotificationActivity<K>[];
825
878
  };
826
- declare type InboxNotificationData = InboxNotificationThreadData | InboxNotificationCustomData | InboxNotificationTextMentionData;
827
- declare type InboxNotificationThreadDataPlain = DateToString<InboxNotificationThreadData>;
828
- declare type InboxNotificationCustomDataPlain = Omit<DateToString<InboxNotificationCustomData>, "activities"> & {
879
+ type InboxNotificationData = InboxNotificationThreadData | InboxNotificationCustomData | InboxNotificationTextMentionData;
880
+ type InboxNotificationThreadDataPlain = DateToString<InboxNotificationThreadData>;
881
+ type InboxNotificationCustomDataPlain = Omit<DateToString<InboxNotificationCustomData>, "activities"> & {
829
882
  activities: DateToString<InboxNotificationActivity>[];
830
883
  };
831
- declare type InboxNotificationDataPlain = InboxNotificationThreadDataPlain | InboxNotificationCustomDataPlain | InboxNotificationTextMentionDataPlain;
832
- declare type InboxNotificationDeleteInfo = {
884
+ type InboxNotificationDataPlain = InboxNotificationThreadDataPlain | InboxNotificationCustomDataPlain | InboxNotificationTextMentionDataPlain;
885
+ type InboxNotificationDeleteInfo = {
833
886
  type: "deletedInboxNotification";
834
887
  id: string;
835
888
  roomId: string;
836
889
  deletedAt: Date;
837
890
  };
838
891
 
839
- declare type BaseActivitiesData = {
892
+ type BaseActivitiesData = {
840
893
  [key: `$${string}`]: ActivityData;
841
894
  };
842
895
 
843
- declare type BaseRoomInfo = {
896
+ type BaseRoomInfo = {
844
897
  [key: string]: Json | undefined;
845
898
  /**
846
899
  * The name of the room.
@@ -852,22 +905,22 @@ declare type BaseRoomInfo = {
852
905
  url?: string;
853
906
  };
854
907
 
855
- declare type BaseMetadata = Record<string, string | boolean | number | undefined>;
856
- declare type CommentReaction = {
908
+ type BaseMetadata = Record<string, string | boolean | number | undefined>;
909
+ type CommentReaction = {
857
910
  emoji: string;
858
911
  createdAt: Date;
859
912
  users: {
860
913
  id: string;
861
914
  }[];
862
915
  };
863
- declare type CommentAttachment = {
916
+ type CommentAttachment = {
864
917
  type: "attachment";
865
918
  id: string;
866
919
  name: string;
867
920
  size: number;
868
921
  mimeType: string;
869
922
  };
870
- declare type CommentLocalAttachmentIdle = {
923
+ type CommentLocalAttachmentIdle = {
871
924
  type: "localAttachment";
872
925
  status: "idle";
873
926
  id: string;
@@ -876,7 +929,7 @@ declare type CommentLocalAttachmentIdle = {
876
929
  mimeType: string;
877
930
  file: File;
878
931
  };
879
- declare type CommentLocalAttachmentUploading = {
932
+ type CommentLocalAttachmentUploading = {
880
933
  type: "localAttachment";
881
934
  status: "uploading";
882
935
  id: string;
@@ -885,7 +938,7 @@ declare type CommentLocalAttachmentUploading = {
885
938
  mimeType: string;
886
939
  file: File;
887
940
  };
888
- declare type CommentLocalAttachmentUploaded = {
941
+ type CommentLocalAttachmentUploaded = {
889
942
  type: "localAttachment";
890
943
  status: "uploaded";
891
944
  id: string;
@@ -894,7 +947,7 @@ declare type CommentLocalAttachmentUploaded = {
894
947
  mimeType: string;
895
948
  file: File;
896
949
  };
897
- declare type CommentLocalAttachmentError = {
950
+ type CommentLocalAttachmentError = {
898
951
  type: "localAttachment";
899
952
  status: "error";
900
953
  id: string;
@@ -904,12 +957,12 @@ declare type CommentLocalAttachmentError = {
904
957
  file: File;
905
958
  error: Error;
906
959
  };
907
- declare type CommentLocalAttachment = CommentLocalAttachmentIdle | CommentLocalAttachmentUploading | CommentLocalAttachmentUploaded | CommentLocalAttachmentError;
908
- declare type CommentMixedAttachment = CommentAttachment | CommentLocalAttachment;
960
+ type CommentLocalAttachment = CommentLocalAttachmentIdle | CommentLocalAttachmentUploading | CommentLocalAttachmentUploaded | CommentLocalAttachmentError;
961
+ type CommentMixedAttachment = CommentAttachment | CommentLocalAttachment;
909
962
  /**
910
963
  * Represents a comment.
911
964
  */
912
- declare type CommentData = {
965
+ type CommentData = {
913
966
  type: "comment";
914
967
  id: string;
915
968
  threadId: string;
@@ -919,59 +972,55 @@ declare type CommentData = {
919
972
  editedAt?: Date;
920
973
  reactions: CommentReaction[];
921
974
  attachments: CommentAttachment[];
922
- } & ({
975
+ } & Relax<{
923
976
  body: CommentBody;
924
- deletedAt?: never;
925
977
  } | {
926
- body?: never;
927
978
  deletedAt: Date;
928
- });
929
- declare type CommentDataPlain = Omit<DateToString<CommentData>, "reactions" | "body"> & {
979
+ }>;
980
+ type CommentDataPlain = Omit<DateToString<CommentData>, "reactions" | "body"> & {
930
981
  reactions: DateToString<CommentReaction>[];
931
- } & ({
982
+ } & Relax<{
932
983
  body: CommentBody;
933
- deletedAt?: never;
934
984
  } | {
935
- body?: never;
936
985
  deletedAt: string;
937
- });
938
- declare type CommentBodyBlockElement = CommentBodyParagraph;
939
- declare type CommentBodyInlineElement = CommentBodyText | CommentBodyMention | CommentBodyLink;
940
- declare type CommentBodyElement = CommentBodyBlockElement | CommentBodyInlineElement;
941
- declare type CommentBodyParagraph = {
986
+ }>;
987
+ type CommentBodyBlockElement = CommentBodyParagraph;
988
+ type CommentBodyInlineElement = CommentBodyText | CommentBodyMention | CommentBodyLink;
989
+ type CommentBodyElement = CommentBodyBlockElement | CommentBodyInlineElement;
990
+ type CommentBodyParagraph = {
942
991
  type: "paragraph";
943
992
  children: CommentBodyInlineElement[];
944
993
  };
945
- declare type CommentBodyMention = {
994
+ type CommentBodyMention = {
946
995
  type: "mention";
947
996
  id: string;
948
997
  };
949
- declare type CommentBodyLink = {
998
+ type CommentBodyLink = {
950
999
  type: "link";
951
1000
  url: string;
952
1001
  text?: string;
953
1002
  };
954
- declare type CommentBodyText = {
1003
+ type CommentBodyText = {
955
1004
  bold?: boolean;
956
1005
  italic?: boolean;
957
1006
  strikethrough?: boolean;
958
1007
  code?: boolean;
959
1008
  text: string;
960
1009
  };
961
- declare type CommentBody = {
1010
+ type CommentBody = {
962
1011
  version: 1;
963
1012
  content: CommentBodyBlockElement[];
964
1013
  };
965
- declare type CommentUserReaction = {
1014
+ type CommentUserReaction = {
966
1015
  emoji: string;
967
1016
  createdAt: Date;
968
1017
  userId: string;
969
1018
  };
970
- declare type CommentUserReactionPlain = DateToString<CommentUserReaction>;
1019
+ type CommentUserReactionPlain = DateToString<CommentUserReaction>;
971
1020
  /**
972
1021
  * Represents a thread of comments.
973
1022
  */
974
- declare type ThreadData<M extends BaseMetadata = DM> = {
1023
+ type ThreadData<M extends BaseMetadata = DM> = {
975
1024
  type: "thread";
976
1025
  id: string;
977
1026
  roomId: string;
@@ -984,17 +1033,17 @@ declare type ThreadData<M extends BaseMetadata = DM> = {
984
1033
  interface ThreadDataWithDeleteInfo<M extends BaseMetadata = DM> extends ThreadData<M> {
985
1034
  deletedAt?: Date;
986
1035
  }
987
- declare type ThreadDataPlain<M extends BaseMetadata> = Omit<DateToString<ThreadData<M>>, "comments" | "metadata"> & {
1036
+ type ThreadDataPlain<M extends BaseMetadata> = Omit<DateToString<ThreadData<M>>, "comments" | "metadata"> & {
988
1037
  comments: CommentDataPlain[];
989
1038
  metadata: M;
990
1039
  };
991
- declare type ThreadDeleteInfo = {
1040
+ type ThreadDeleteInfo = {
992
1041
  type: "deletedThread";
993
1042
  id: string;
994
1043
  roomId: string;
995
1044
  deletedAt: Date;
996
1045
  };
997
- declare type StringOperators<T> = T | {
1046
+ type StringOperators<T> = T | {
998
1047
  startsWith: string;
999
1048
  };
1000
1049
  /**
@@ -1005,8 +1054,8 @@ declare type StringOperators<T> = T | {
1005
1054
  * - to strings:
1006
1055
  * - `startsWith` (`^` in query string)
1007
1056
  */
1008
- declare type QueryMetadata<M extends BaseMetadata> = {
1009
- [K in keyof M]: string extends M[K] ? StringOperators<M[K]> : M[K];
1057
+ type QueryMetadata<M extends BaseMetadata> = {
1058
+ [K in keyof M]: (string extends M[K] ? StringOperators<M[K]> : M[K]) | null;
1010
1059
  };
1011
1060
 
1012
1061
  declare global {
@@ -1017,20 +1066,20 @@ declare global {
1017
1066
  [key: string]: unknown;
1018
1067
  }
1019
1068
  }
1020
- declare type ExtendableTypes = "Presence" | "Storage" | "UserMeta" | "RoomEvent" | "ThreadMetadata" | "RoomInfo" | "ActivitiesData";
1021
- declare type MakeErrorString<K extends ExtendableTypes, Reason extends string = "does not match its requirements"> = `The type you provided for '${K}' ${Reason}. To learn how to fix this, see https://liveblocks.io/docs/errors/${K}`;
1022
- declare type GetOverride<K extends ExtendableTypes, B, Reason extends string = "does not match its requirements"> = GetOverrideOrErrorValue<K, B, MakeErrorString<K, Reason>>;
1023
- declare type GetOverrideOrErrorValue<K extends ExtendableTypes, B, ErrorType> = unknown extends Liveblocks[K] ? B : Liveblocks[K] extends B ? Liveblocks[K] : ErrorType;
1024
- declare type DP = GetOverride<"Presence", JsonObject, "is not a valid JSON object">;
1025
- declare type DS = GetOverride<"Storage", LsonObject, "is not a valid LSON value">;
1026
- declare type DU = GetOverrideOrErrorValue<"UserMeta", BaseUserMeta, Record<"id" | "info", MakeErrorString<"UserMeta">>>;
1027
- declare type DE = GetOverride<"RoomEvent", Json, "is not a valid JSON value">;
1028
- declare type DM = GetOverride<"ThreadMetadata", BaseMetadata>;
1029
- declare type DRI = GetOverride<"RoomInfo", BaseRoomInfo>;
1030
- declare type DAD = GetOverrideOrErrorValue<"ActivitiesData", BaseActivitiesData, {
1069
+ type ExtendableTypes = "Presence" | "Storage" | "UserMeta" | "RoomEvent" | "ThreadMetadata" | "RoomInfo" | "ActivitiesData";
1070
+ type MakeErrorString<K extends ExtendableTypes, Reason extends string = "does not match its requirements"> = `The type you provided for '${K}' ${Reason}. To learn how to fix this, see https://liveblocks.io/docs/errors/${K}`;
1071
+ type GetOverride<K extends ExtendableTypes, B, Reason extends string = "does not match its requirements"> = GetOverrideOrErrorValue<K, B, MakeErrorString<K, Reason>>;
1072
+ type GetOverrideOrErrorValue<K extends ExtendableTypes, B, ErrorType> = unknown extends Liveblocks[K] ? B : Liveblocks[K] extends B ? Liveblocks[K] : ErrorType;
1073
+ type DP = GetOverride<"Presence", JsonObject, "is not a valid JSON object">;
1074
+ type DS = GetOverride<"Storage", LsonObject, "is not a valid LSON value">;
1075
+ type DU = GetOverrideOrErrorValue<"UserMeta", BaseUserMeta, Record<"id" | "info", MakeErrorString<"UserMeta">>>;
1076
+ type DE = GetOverride<"RoomEvent", Json, "is not a valid JSON value">;
1077
+ type DM = GetOverride<"ThreadMetadata", BaseMetadata>;
1078
+ type DRI = GetOverride<"RoomInfo", BaseRoomInfo>;
1079
+ type DAD = GetOverrideOrErrorValue<"ActivitiesData", BaseActivitiesData, {
1031
1080
  [K in keyof Liveblocks["ActivitiesData"]]: "At least one of the custom notification kinds you provided for 'ActivitiesData' does not match its requirements. To learn how to fix this, see https://liveblocks.io/docs/errors/ActivitiesData";
1032
1081
  }>;
1033
- declare type KDAD = keyof DAD extends `$${string}` ? keyof DAD : "Custom notification kinds must start with '$' but your custom 'ActivitiesData' type contains at least one kind which doesn't. To learn how to fix this, see https://liveblocks.io/docs/errors/ActivitiesData";
1082
+ type KDAD = keyof DAD extends `$${string}` ? keyof DAD : "Custom notification kinds must start with '$' but your custom 'ActivitiesData' type contains at least one kind which doesn't. To learn how to fix this, see https://liveblocks.io/docs/errors/ActivitiesData";
1034
1083
 
1035
1084
  /**
1036
1085
  * Use this symbol to brand an object property as internal.
@@ -1051,29 +1100,30 @@ declare type KDAD = keyof DAD extends `$${string}` ? keyof DAD : "Custom notific
1051
1100
  */
1052
1101
  declare const kInternal: unique symbol;
1053
1102
 
1054
- declare type RenameDataField<T, TFieldName extends string> = T extends any ? {
1103
+ type RenameDataField<T, TFieldName extends string> = T extends any ? {
1055
1104
  [K in keyof T as K extends "data" ? TFieldName : K]: T[K];
1056
1105
  } : never;
1057
- declare type AsyncLoading<F extends string = "data"> = RenameDataField<{
1106
+ type AsyncLoading<F extends string = "data"> = RenameDataField<{
1058
1107
  readonly isLoading: true;
1059
1108
  readonly data?: never;
1060
1109
  readonly error?: never;
1061
1110
  }, F>;
1062
- declare type AsyncSuccess<T, F extends string = "data"> = RenameDataField<{
1111
+ type AsyncSuccess<T, F extends string = "data"> = RenameDataField<{
1063
1112
  readonly isLoading: false;
1064
1113
  readonly data: T;
1065
1114
  readonly error?: never;
1066
1115
  }, F>;
1067
- declare type AsyncError<F extends string = "data"> = RenameDataField<{
1116
+ type AsyncError<F extends string = "data"> = RenameDataField<{
1068
1117
  readonly isLoading: false;
1069
1118
  readonly data?: never;
1070
1119
  readonly error: Error;
1071
1120
  }, F>;
1072
- declare type AsyncResult<T, F extends string = "data"> = AsyncLoading<F> | AsyncSuccess<T, F> | AsyncError<F>;
1121
+ type AsyncResult<T, F extends string = "data"> = AsyncLoading<F> | AsyncSuccess<T, F> | AsyncError<F>;
1073
1122
 
1074
- declare type BatchStore<O, I> = Observable<void> & {
1075
- get: (input: I) => Promise<void>;
1076
- getState: (input: I) => AsyncResult<O> | undefined;
1123
+ type BatchStore<O, I> = {
1124
+ subscribe: (callback: Callback<void>) => UnsubscribeCallback;
1125
+ enqueue: (input: I) => Promise<void>;
1126
+ getItemState: (input: I) => AsyncResult<O> | undefined;
1077
1127
  invalidate: (inputs?: I[]) => void;
1078
1128
  };
1079
1129
 
@@ -1088,12 +1138,12 @@ declare enum ClientMsgCode {
1088
1138
  /**
1089
1139
  * Messages that can be sent from the client to the server.
1090
1140
  */
1091
- declare type ClientMsg<P extends JsonObject, E extends Json> = BroadcastEventClientMsg<E> | UpdatePresenceClientMsg<P> | UpdateStorageClientMsg | FetchStorageClientMsg | FetchYDocClientMsg | UpdateYDocClientMsg;
1092
- declare type BroadcastEventClientMsg<E extends Json> = {
1141
+ type ClientMsg<P extends JsonObject, E extends Json> = BroadcastEventClientMsg<E> | UpdatePresenceClientMsg<P> | UpdateStorageClientMsg | FetchStorageClientMsg | FetchYDocClientMsg | UpdateYDocClientMsg;
1142
+ type BroadcastEventClientMsg<E extends Json> = {
1093
1143
  type: ClientMsgCode.BROADCAST_EVENT;
1094
1144
  event: E;
1095
1145
  };
1096
- declare type UpdatePresenceClientMsg<P extends JsonObject> = {
1146
+ type UpdatePresenceClientMsg<P extends JsonObject> = {
1097
1147
  readonly type: ClientMsgCode.UPDATE_PRESENCE;
1098
1148
  /**
1099
1149
  * Set this to any number to signify that this is a Full Presence™
@@ -1119,56 +1169,56 @@ declare type UpdatePresenceClientMsg<P extends JsonObject> = {
1119
1169
  readonly targetActor?: undefined;
1120
1170
  readonly data: Partial<P>;
1121
1171
  };
1122
- declare type UpdateStorageClientMsg = {
1172
+ type UpdateStorageClientMsg = {
1123
1173
  readonly type: ClientMsgCode.UPDATE_STORAGE;
1124
1174
  readonly ops: Op[];
1125
1175
  };
1126
- declare type FetchStorageClientMsg = {
1176
+ type FetchStorageClientMsg = {
1127
1177
  readonly type: ClientMsgCode.FETCH_STORAGE;
1128
1178
  };
1129
- declare type FetchYDocClientMsg = {
1179
+ type FetchYDocClientMsg = {
1130
1180
  readonly type: ClientMsgCode.FETCH_YDOC;
1131
1181
  readonly vector: string;
1132
1182
  readonly guid?: string;
1133
1183
  };
1134
- declare type UpdateYDocClientMsg = {
1184
+ type UpdateYDocClientMsg = {
1135
1185
  readonly type: ClientMsgCode.UPDATE_YDOC;
1136
1186
  readonly update: string;
1137
1187
  readonly guid?: string;
1138
1188
  };
1139
1189
 
1140
- declare type IdTuple<T> = [id: string, value: T];
1190
+ type IdTuple<T> = [id: string, value: T];
1141
1191
  declare enum CrdtType {
1142
1192
  OBJECT = 0,
1143
1193
  LIST = 1,
1144
1194
  MAP = 2,
1145
1195
  REGISTER = 3
1146
1196
  }
1147
- declare type SerializedCrdt = SerializedRootObject | SerializedChild;
1148
- declare type SerializedChild = SerializedObject | SerializedList | SerializedMap | SerializedRegister;
1149
- declare type SerializedRootObject = {
1197
+ type SerializedCrdt = SerializedRootObject | SerializedChild;
1198
+ type SerializedChild = SerializedObject | SerializedList | SerializedMap | SerializedRegister;
1199
+ type SerializedRootObject = {
1150
1200
  readonly type: CrdtType.OBJECT;
1151
1201
  readonly data: JsonObject;
1152
1202
  readonly parentId?: never;
1153
1203
  readonly parentKey?: never;
1154
1204
  };
1155
- declare type SerializedObject = {
1205
+ type SerializedObject = {
1156
1206
  readonly type: CrdtType.OBJECT;
1157
1207
  readonly parentId: string;
1158
1208
  readonly parentKey: string;
1159
1209
  readonly data: JsonObject;
1160
1210
  };
1161
- declare type SerializedList = {
1211
+ type SerializedList = {
1162
1212
  readonly type: CrdtType.LIST;
1163
1213
  readonly parentId: string;
1164
1214
  readonly parentKey: string;
1165
1215
  };
1166
- declare type SerializedMap = {
1216
+ type SerializedMap = {
1167
1217
  readonly type: CrdtType.MAP;
1168
1218
  readonly parentId: string;
1169
1219
  readonly parentKey: string;
1170
1220
  };
1171
- declare type SerializedRegister = {
1221
+ type SerializedRegister = {
1172
1222
  readonly type: CrdtType.REGISTER;
1173
1223
  readonly parentId: string;
1174
1224
  readonly parentKey: string;
@@ -1200,46 +1250,46 @@ declare enum ServerMsgCode {
1200
1250
  /**
1201
1251
  * Messages that can be sent from the server to the client.
1202
1252
  */
1203
- declare type ServerMsg<P extends JsonObject, U extends BaseUserMeta, E extends Json> = UpdatePresenceServerMsg<P> | UserJoinServerMsg<U> | UserLeftServerMsg | BroadcastedEventServerMsg<E> | RoomStateServerMsg<U> | InitialDocumentStateServerMsg | UpdateStorageServerMsg | RejectedStorageOpServerMsg | YDocUpdateServerMsg | CommentsEventServerMsg;
1204
- declare type CommentsEventServerMsg = ThreadCreatedEvent | ThreadDeletedEvent | ThreadMetadataUpdatedEvent | ThreadUpdatedEvent | CommentCreatedEvent | CommentEditedEvent | CommentDeletedEvent | CommentReactionAdded | CommentReactionRemoved;
1205
- declare type ThreadCreatedEvent = {
1253
+ type ServerMsg<P extends JsonObject, U extends BaseUserMeta, E extends Json> = UpdatePresenceServerMsg<P> | UserJoinServerMsg<U> | UserLeftServerMsg | BroadcastedEventServerMsg<E> | RoomStateServerMsg<U> | InitialDocumentStateServerMsg | UpdateStorageServerMsg | RejectedStorageOpServerMsg | YDocUpdateServerMsg | CommentsEventServerMsg;
1254
+ type CommentsEventServerMsg = ThreadCreatedEvent | ThreadDeletedEvent | ThreadMetadataUpdatedEvent | ThreadUpdatedEvent | CommentCreatedEvent | CommentEditedEvent | CommentDeletedEvent | CommentReactionAdded | CommentReactionRemoved;
1255
+ type ThreadCreatedEvent = {
1206
1256
  type: ServerMsgCode.THREAD_CREATED;
1207
1257
  threadId: string;
1208
1258
  };
1209
- declare type ThreadDeletedEvent = {
1259
+ type ThreadDeletedEvent = {
1210
1260
  type: ServerMsgCode.THREAD_DELETED;
1211
1261
  threadId: string;
1212
1262
  };
1213
- declare type ThreadMetadataUpdatedEvent = {
1263
+ type ThreadMetadataUpdatedEvent = {
1214
1264
  type: ServerMsgCode.THREAD_METADATA_UPDATED;
1215
1265
  threadId: string;
1216
1266
  };
1217
- declare type ThreadUpdatedEvent = {
1267
+ type ThreadUpdatedEvent = {
1218
1268
  type: ServerMsgCode.THREAD_UPDATED;
1219
1269
  threadId: string;
1220
1270
  };
1221
- declare type CommentCreatedEvent = {
1271
+ type CommentCreatedEvent = {
1222
1272
  type: ServerMsgCode.COMMENT_CREATED;
1223
1273
  threadId: string;
1224
1274
  commentId: string;
1225
1275
  };
1226
- declare type CommentEditedEvent = {
1276
+ type CommentEditedEvent = {
1227
1277
  type: ServerMsgCode.COMMENT_EDITED;
1228
1278
  threadId: string;
1229
1279
  commentId: string;
1230
1280
  };
1231
- declare type CommentDeletedEvent = {
1281
+ type CommentDeletedEvent = {
1232
1282
  type: ServerMsgCode.COMMENT_DELETED;
1233
1283
  threadId: string;
1234
1284
  commentId: string;
1235
1285
  };
1236
- declare type CommentReactionAdded = {
1286
+ type CommentReactionAdded = {
1237
1287
  type: ServerMsgCode.COMMENT_REACTION_ADDED;
1238
1288
  threadId: string;
1239
1289
  commentId: string;
1240
1290
  emoji: string;
1241
1291
  };
1242
- declare type CommentReactionRemoved = {
1292
+ type CommentReactionRemoved = {
1243
1293
  type: ServerMsgCode.COMMENT_REACTION_REMOVED;
1244
1294
  threadId: string;
1245
1295
  commentId: string;
@@ -1256,7 +1306,7 @@ declare type CommentReactionRemoved = {
1256
1306
  * those cases, the `targetActor` field indicates the newly connected client,
1257
1307
  * so all other existing clients can ignore this broadcasted message.
1258
1308
  */
1259
- declare type UpdatePresenceServerMsg<P extends JsonObject> = {
1309
+ type UpdatePresenceServerMsg<P extends JsonObject> = {
1260
1310
  readonly type: ServerMsgCode.UPDATE_PRESENCE;
1261
1311
  /**
1262
1312
  * The User whose Presence has changed.
@@ -1301,7 +1351,7 @@ declare type UpdatePresenceServerMsg<P extends JsonObject> = {
1301
1351
  * Sent by the WebSocket server and broadcasted to all clients to announce that
1302
1352
  * a new User has joined the Room.
1303
1353
  */
1304
- declare type UserJoinServerMsg<U extends BaseUserMeta> = {
1354
+ type UserJoinServerMsg<U extends BaseUserMeta> = {
1305
1355
  readonly type: ServerMsgCode.USER_JOINED;
1306
1356
  readonly actor: number;
1307
1357
  /**
@@ -1323,7 +1373,7 @@ declare type UserJoinServerMsg<U extends BaseUserMeta> = {
1323
1373
  * Sent by the WebSocket server and broadcasted to all clients to announce that
1324
1374
  * a new User has left the Room.
1325
1375
  */
1326
- declare type UserLeftServerMsg = {
1376
+ type UserLeftServerMsg = {
1327
1377
  readonly type: ServerMsgCode.USER_LEFT;
1328
1378
  readonly actor: number;
1329
1379
  };
@@ -1331,7 +1381,7 @@ declare type UserLeftServerMsg = {
1331
1381
  * Sent by the WebSocket server when the ydoc is updated or when requested based on stateVector passed.
1332
1382
  * Contains a base64 encoded update
1333
1383
  */
1334
- declare type YDocUpdateServerMsg = {
1384
+ type YDocUpdateServerMsg = {
1335
1385
  readonly type: ServerMsgCode.UPDATE_YDOC;
1336
1386
  readonly update: string;
1337
1387
  readonly isSync: boolean;
@@ -1342,7 +1392,7 @@ declare type YDocUpdateServerMsg = {
1342
1392
  * Sent by the WebSocket server and broadcasted to all clients to announce that
1343
1393
  * a User broadcasted an Event to everyone in the Room.
1344
1394
  */
1345
- declare type BroadcastedEventServerMsg<E extends Json> = {
1395
+ type BroadcastedEventServerMsg<E extends Json> = {
1346
1396
  readonly type: ServerMsgCode.BROADCASTED_EVENT;
1347
1397
  /**
1348
1398
  * The User who broadcast the Event. Absent when this event is broadcast from
@@ -1360,7 +1410,7 @@ declare type BroadcastedEventServerMsg<E extends Json> = {
1360
1410
  * joining the Room, to provide the initial state of the Room. The payload
1361
1411
  * includes a list of all other Users that already are in the Room.
1362
1412
  */
1363
- declare type RoomStateServerMsg<U extends BaseUserMeta> = {
1413
+ type RoomStateServerMsg<U extends BaseUserMeta> = {
1364
1414
  readonly type: ServerMsgCode.ROOM_STATE;
1365
1415
  /**
1366
1416
  * Informs the client what their actor ID is going to be.
@@ -1388,7 +1438,7 @@ declare type RoomStateServerMsg<U extends BaseUserMeta> = {
1388
1438
  * joining the Room, to provide the initial Storage state of the Room. The
1389
1439
  * payload includes the entire Storage document.
1390
1440
  */
1391
- declare type InitialDocumentStateServerMsg = {
1441
+ type InitialDocumentStateServerMsg = {
1392
1442
  readonly type: ServerMsgCode.INITIAL_STORAGE_STATE;
1393
1443
  readonly items: IdTuple<SerializedCrdt>[];
1394
1444
  };
@@ -1399,7 +1449,7 @@ declare type InitialDocumentStateServerMsg = {
1399
1449
  * The payload of this message contains a list of Ops (aka incremental
1400
1450
  * mutations to make to the initially loaded document).
1401
1451
  */
1402
- declare type UpdateStorageServerMsg = {
1452
+ type UpdateStorageServerMsg = {
1403
1453
  readonly type: ServerMsgCode.UPDATE_STORAGE;
1404
1454
  readonly ops: Op[];
1405
1455
  };
@@ -1408,13 +1458,13 @@ declare type UpdateStorageServerMsg = {
1408
1458
  * have been received but were rejected because they caused mutations that are
1409
1459
  * incompatible with the Room's schema.
1410
1460
  */
1411
- declare type RejectedStorageOpServerMsg = {
1461
+ type RejectedStorageOpServerMsg = {
1412
1462
  readonly type: ServerMsgCode.REJECT_STORAGE_OP;
1413
1463
  readonly opIds: string[];
1414
1464
  readonly reason: string;
1415
1465
  };
1416
1466
 
1417
- declare type HistoryVersion = {
1467
+ type HistoryVersion = {
1418
1468
  type: "historyVersion";
1419
1469
  kind: "yjs";
1420
1470
  createdAt: Date;
@@ -1424,20 +1474,20 @@ declare type HistoryVersion = {
1424
1474
  }[];
1425
1475
  };
1426
1476
 
1427
- declare type JsonTreeNode = {
1477
+ type JsonTreeNode = {
1428
1478
  readonly type: "Json";
1429
1479
  readonly id: string;
1430
1480
  readonly key: string;
1431
1481
  readonly payload: Json;
1432
1482
  };
1433
- declare type LiveTreeNode<TName extends `Live${string}` = `Live${string}`> = {
1483
+ type LiveTreeNode<TName extends `Live${string}` = `Live${string}`> = {
1434
1484
  readonly type: TName;
1435
1485
  readonly id: string;
1436
1486
  readonly key: string;
1437
1487
  readonly payload: LsonTreeNode[];
1438
1488
  };
1439
- declare type LsonTreeNode = LiveTreeNode | JsonTreeNode;
1440
- declare type UserTreeNode = {
1489
+ type LsonTreeNode = LiveTreeNode | JsonTreeNode;
1490
+ type UserTreeNode = {
1441
1491
  readonly type: "User";
1442
1492
  readonly id: string;
1443
1493
  readonly key: string;
@@ -1449,14 +1499,14 @@ declare type UserTreeNode = {
1449
1499
  readonly isReadOnly: boolean;
1450
1500
  };
1451
1501
  };
1452
- declare type CustomEventTreeNode = {
1502
+ type CustomEventTreeNode = {
1453
1503
  readonly type: "CustomEvent";
1454
1504
  readonly id: string;
1455
1505
  readonly key: string;
1456
1506
  readonly connectionId: number;
1457
1507
  readonly payload: Json;
1458
1508
  };
1459
- declare type TreeNode = LsonTreeNode | UserTreeNode | CustomEventTreeNode;
1509
+ type TreeNode = LsonTreeNode | UserTreeNode | CustomEventTreeNode;
1460
1510
 
1461
1511
  type DevToolsTreeNode_CustomEventTreeNode = CustomEventTreeNode;
1462
1512
  type DevToolsTreeNode_JsonTreeNode = JsonTreeNode;
@@ -1468,36 +1518,88 @@ declare namespace DevToolsTreeNode {
1468
1518
  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 };
1469
1519
  }
1470
1520
 
1471
- /**
1472
- * This helper type is effectively a no-op, but will force TypeScript to
1473
- * "evaluate" any named helper types in its definition. This can sometimes make
1474
- * API signatures clearer in IDEs.
1475
- *
1476
- * For example, in:
1477
- *
1478
- * type Payload<T> = { data: T };
1479
- *
1480
- * let r1: Payload<string>;
1481
- * let r2: Resolve<Payload<string>>;
1482
- *
1483
- * The inferred type of `r1` is going to be `Payload<string>` which shows up in
1484
- * editor hints, and it may be unclear what's inside if you don't know the
1485
- * definition of `Payload`.
1486
- *
1487
- * The inferred type of `r2` is going to be `{ data: string }`, which may be
1488
- * more helpful.
1489
- *
1490
- * This trick comes from:
1491
- * https://effectivetypescript.com/2022/02/25/gentips-4-display/
1492
- */
1493
- declare type Resolve<T> = T extends (...args: unknown[]) => unknown ? T : {
1494
- [K in keyof T]: T[K];
1521
+ type OptionalKeys<T> = {
1522
+ [K in keyof T]-?: undefined extends T[K] ? K : never;
1523
+ }[keyof T];
1524
+ type MakeOptionalFieldsNullable<T> = {
1525
+ [K in keyof T]: K extends OptionalKeys<T> ? T[K] | null : T[K];
1495
1526
  };
1527
+ type Patchable<T> = Partial<MakeOptionalFieldsNullable<T>>;
1528
+
1529
+ type RoomConnectionErrorContext = {
1530
+ type: "ROOM_CONNECTION_ERROR";
1531
+ code: -1 | 4001 | 4005 | 4006 | (number & {});
1532
+ roomId: string;
1533
+ };
1534
+ type CommentsOrNotificationsErrorContext = {
1535
+ type: "CREATE_THREAD_ERROR";
1536
+ roomId: string;
1537
+ threadId: string;
1538
+ commentId: string;
1539
+ body: CommentBody;
1540
+ metadata: BaseMetadata;
1541
+ } | {
1542
+ type: "DELETE_THREAD_ERROR";
1543
+ roomId: string;
1544
+ threadId: string;
1545
+ } | {
1546
+ type: "EDIT_THREAD_METADATA_ERROR";
1547
+ roomId: string;
1548
+ threadId: string;
1549
+ metadata: Patchable<BaseMetadata>;
1550
+ } | {
1551
+ type: "MARK_THREAD_AS_RESOLVED_ERROR" | "MARK_THREAD_AS_UNRESOLVED_ERROR";
1552
+ roomId: string;
1553
+ threadId: string;
1554
+ } | {
1555
+ type: "CREATE_COMMENT_ERROR" | "EDIT_COMMENT_ERROR";
1556
+ roomId: string;
1557
+ threadId: string;
1558
+ commentId: string;
1559
+ body: CommentBody;
1560
+ } | {
1561
+ type: "DELETE_COMMENT_ERROR";
1562
+ roomId: string;
1563
+ threadId: string;
1564
+ commentId: string;
1565
+ } | {
1566
+ type: "ADD_REACTION_ERROR" | "REMOVE_REACTION_ERROR";
1567
+ roomId: string;
1568
+ threadId: string;
1569
+ commentId: string;
1570
+ emoji: string;
1571
+ } | {
1572
+ type: "MARK_INBOX_NOTIFICATION_AS_READ_ERROR";
1573
+ inboxNotificationId: string;
1574
+ roomId?: string;
1575
+ } | {
1576
+ type: "DELETE_INBOX_NOTIFICATION_ERROR";
1577
+ inboxNotificationId: string;
1578
+ } | {
1579
+ type: "MARK_ALL_INBOX_NOTIFICATIONS_AS_READ_ERROR" | "DELETE_ALL_INBOX_NOTIFICATIONS_ERROR";
1580
+ } | {
1581
+ type: "UPDATE_NOTIFICATION_SETTINGS_ERROR";
1582
+ roomId: string;
1583
+ };
1584
+ type LiveblocksErrorContext = Relax<RoomConnectionErrorContext | CommentsOrNotificationsErrorContext>;
1585
+ declare class LiveblocksError extends Error {
1586
+ readonly context: LiveblocksErrorContext;
1587
+ constructor(message: string, context: LiveblocksErrorContext, cause?: Error);
1588
+ /** Convenience accessor for error.context.roomId (if available) */
1589
+ get roomId(): LiveblocksErrorContext["roomId"];
1590
+ /** @deprecated Prefer using `context.code` instead, to enable type narrowing */
1591
+ get code(): LiveblocksErrorContext["code"];
1592
+ /**
1593
+ * Creates a LiveblocksError from a generic error, by attaching Liveblocks
1594
+ * contextual information like room ID, thread ID, etc.
1595
+ */
1596
+ static from(context: LiveblocksErrorContext, cause?: Error): LiveblocksError;
1597
+ }
1496
1598
 
1497
1599
  /**
1498
1600
  * Represents a user connected in a room. Treated as immutable.
1499
1601
  */
1500
- declare type User<P extends JsonObject = DP, U extends BaseUserMeta = DU> = {
1602
+ type User<P extends JsonObject = DP, U extends BaseUserMeta = DU> = {
1501
1603
  /**
1502
1604
  * The connection ID of the User. It is unique and increment at every new connection.
1503
1605
  */
@@ -1526,7 +1628,7 @@ declare type User<P extends JsonObject = DP, U extends BaseUserMeta = DU> = {
1526
1628
  readonly canComment: boolean;
1527
1629
  };
1528
1630
 
1529
- declare type InternalOthersEvent<P extends JsonObject, U extends BaseUserMeta> = {
1631
+ type InternalOthersEvent<P extends JsonObject, U extends BaseUserMeta> = Relax<{
1530
1632
  type: "leave";
1531
1633
  user: User<P, U>;
1532
1634
  } | {
@@ -1538,9 +1640,8 @@ declare type InternalOthersEvent<P extends JsonObject, U extends BaseUserMeta> =
1538
1640
  updates: Partial<P>;
1539
1641
  } | {
1540
1642
  type: "reset";
1541
- user?: never;
1542
- };
1543
- declare type OthersEvent<P extends JsonObject = DP, U extends BaseUserMeta = DU> = Resolve<InternalOthersEvent<P, U> & {
1643
+ }>;
1644
+ type OthersEvent<P extends JsonObject = DP, U extends BaseUserMeta = DU> = Resolve<InternalOthersEvent<P, U> & {
1544
1645
  others: readonly User<P, U>[];
1545
1646
  }>;
1546
1647
  declare enum TextEditorType {
@@ -1548,20 +1649,12 @@ declare enum TextEditorType {
1548
1649
  TipTap = "tiptap"
1549
1650
  }
1550
1651
 
1551
- declare type OptionalKeys<T> = {
1552
- [K in keyof T]-?: undefined extends T[K] ? K : never;
1553
- }[keyof T];
1554
- declare type MakeOptionalFieldsNullable<T> = {
1555
- [K in keyof T]: K extends OptionalKeys<T> ? T[K] | null : T[K];
1556
- };
1557
- declare type Patchable<T> = Partial<MakeOptionalFieldsNullable<T>>;
1558
-
1559
- declare type RoomThreadsNotificationSettings = "all" | "replies_and_mentions" | "none";
1560
- declare type RoomNotificationSettings = {
1652
+ type RoomThreadsNotificationSettings = "all" | "replies_and_mentions" | "none";
1653
+ type RoomNotificationSettings = {
1561
1654
  threads: RoomThreadsNotificationSettings;
1562
1655
  };
1563
1656
 
1564
- declare type LegacyOthersEvent<P extends JsonObject, U extends BaseUserMeta> = {
1657
+ type LegacyOthersEvent<P extends JsonObject, U extends BaseUserMeta> = {
1565
1658
  type: "leave";
1566
1659
  user: User<P, U>;
1567
1660
  } | {
@@ -1574,8 +1667,8 @@ declare type LegacyOthersEvent<P extends JsonObject, U extends BaseUserMeta> = {
1574
1667
  } | {
1575
1668
  type: "reset";
1576
1669
  };
1577
- declare type LegacyOthersEventCallback<P extends JsonObject, U extends BaseUserMeta> = (others: readonly User<P, U>[], event: LegacyOthersEvent<P, U>) => void;
1578
- declare type RoomEventMessage<P extends JsonObject, U extends BaseUserMeta, E extends Json> = {
1670
+ type LegacyOthersEventCallback<P extends JsonObject, U extends BaseUserMeta> = (others: readonly User<P, U>[], event: LegacyOthersEvent<P, U>) => void;
1671
+ type RoomEventMessage<P extends JsonObject, U extends BaseUserMeta, E extends Json> = {
1579
1672
  /**
1580
1673
  * The connection ID of the client that sent the event.
1581
1674
  * If this message was broadcast from the server (via the REST API), then
@@ -1590,7 +1683,7 @@ declare type RoomEventMessage<P extends JsonObject, U extends BaseUserMeta, E ex
1590
1683
  user: User<P, U> | null;
1591
1684
  event: E;
1592
1685
  };
1593
- declare type StorageStatus = "not-loaded" | "loading" | "synchronizing" | "synchronized";
1686
+ type StorageStatus = "not-loaded" | "loading" | "synchronizing" | "synchronized";
1594
1687
  interface History {
1595
1688
  /**
1596
1689
  * Undoes the last operation executed by the current client.
@@ -1668,11 +1761,11 @@ interface History {
1668
1761
  */
1669
1762
  resume: () => void;
1670
1763
  }
1671
- declare type HistoryEvent = {
1764
+ type HistoryEvent = {
1672
1765
  canUndo: boolean;
1673
1766
  canRedo: boolean;
1674
1767
  };
1675
- declare type BroadcastOptions = {
1768
+ type BroadcastOptions = {
1676
1769
  /**
1677
1770
  * Whether or not event is queued if the connection is currently closed.
1678
1771
  *
@@ -1680,7 +1773,7 @@ declare type BroadcastOptions = {
1680
1773
  */
1681
1774
  shouldQueueEventIfNotReady: boolean;
1682
1775
  };
1683
- declare type SubscribeFn<P extends JsonObject, _TStorage extends LsonObject, U extends BaseUserMeta, E extends Json> = {
1776
+ type SubscribeFn<P extends JsonObject, _TStorage extends LsonObject, U extends BaseUserMeta, E extends Json> = {
1684
1777
  /**
1685
1778
  * Subscribe to the current user presence updates.
1686
1779
  *
@@ -1813,25 +1906,25 @@ declare type SubscribeFn<P extends JsonObject, _TStorage extends LsonObject, U e
1813
1906
  (type: "storage-status", listener: Callback<StorageStatus>): () => void;
1814
1907
  (type: "comments", listener: Callback<CommentsEventServerMsg>): () => void;
1815
1908
  };
1816
- declare type GetThreadsOptions<M extends BaseMetadata> = {
1909
+ type GetThreadsOptions<M extends BaseMetadata> = {
1817
1910
  cursor?: string;
1818
1911
  query?: {
1819
1912
  resolved?: boolean;
1820
1913
  metadata?: Partial<QueryMetadata<M>>;
1821
1914
  };
1822
1915
  };
1823
- declare type GetThreadsSinceOptions = {
1916
+ type GetThreadsSinceOptions = {
1824
1917
  since: Date;
1825
1918
  signal?: AbortSignal;
1826
1919
  };
1827
- declare type UploadAttachmentOptions = {
1920
+ type UploadAttachmentOptions = {
1828
1921
  signal?: AbortSignal;
1829
1922
  };
1830
- declare type ListTextVersionsSinceOptions = {
1923
+ type ListTextVersionsSinceOptions = {
1831
1924
  since: Date;
1832
1925
  signal?: AbortSignal;
1833
1926
  };
1834
- declare type GetNotificationSettingsOptions = {
1927
+ type GetNotificationSettingsOptions = {
1835
1928
  signal?: AbortSignal;
1836
1929
  };
1837
1930
  /**
@@ -1839,8 +1932,8 @@ declare type GetNotificationSettingsOptions = {
1839
1932
  * this type is different from `Room`-without-type-arguments. That represents
1840
1933
  * a Room instance using globally augmented types only, which is narrower.
1841
1934
  */
1842
- declare type OpaqueRoom = Room<JsonObject, LsonObject, BaseUserMeta, Json, BaseMetadata>;
1843
- declare type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUserMeta = DU, E extends Json = DE, M extends BaseMetadata = DM> = {
1935
+ type OpaqueRoom = Room<JsonObject, LsonObject, BaseUserMeta, Json, BaseMetadata>;
1936
+ type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUserMeta = DU, E extends Json = DE, M extends BaseMetadata = DM> = {
1844
1937
  /**
1845
1938
  * @private
1846
1939
  *
@@ -1960,7 +2053,6 @@ declare type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extend
1960
2053
  readonly self: Observable<User<P, U>>;
1961
2054
  readonly myPresence: Observable<P>;
1962
2055
  readonly others: Observable<OthersEvent<P, U>>;
1963
- readonly error: Observable<LiveblocksError>;
1964
2056
  /**
1965
2057
  * @deprecated Renamed to `storageBatch`. The `storage` event source will
1966
2058
  * soon be replaced by another/incompatible API.
@@ -2254,7 +2346,7 @@ declare type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extend
2254
2346
  */
2255
2347
  markInboxNotificationAsRead(notificationId: string): Promise<void>;
2256
2348
  };
2257
- declare type YjsSyncStatus = "loading" | "synchronizing" | "synchronized";
2349
+ type YjsSyncStatus = "loading" | "synchronizing" | "synchronized";
2258
2350
  /**
2259
2351
  * Interface that @liveblocks/yjs must respect.
2260
2352
  * This interface type is declare in @liveblocks/core, so we don't have to
@@ -2287,7 +2379,7 @@ interface SyncSource {
2287
2379
  * Liveblocks, NEVER USE ANY OF THESE METHODS DIRECTLY, because bad things
2288
2380
  * will probably happen if you do.
2289
2381
  */
2290
- declare type PrivateRoomApi = {
2382
+ type PrivateRoomApi = {
2291
2383
  presenceBuffer: Json | undefined;
2292
2384
  undoStack: readonly (readonly Readonly<HistoryOp<JsonObject>>[])[];
2293
2385
  nodeCount: number;
@@ -2315,11 +2407,11 @@ declare type PrivateRoomApi = {
2315
2407
  };
2316
2408
  attachmentUrlsStore: BatchStore<string, string>;
2317
2409
  };
2318
- declare type HistoryOp<P extends JsonObject> = Op | {
2410
+ type HistoryOp<P extends JsonObject> = Op | {
2319
2411
  readonly type: "presence";
2320
2412
  readonly data: P;
2321
2413
  };
2322
- declare type Polyfills = {
2414
+ type Polyfills = {
2323
2415
  atob?: (data: string) => string;
2324
2416
  fetch?: typeof fetch;
2325
2417
  WebSocket?: IWebSocket;
@@ -2331,19 +2423,19 @@ declare type Polyfills = {
2331
2423
  * into:
2332
2424
  * [foo?: string; bar?: number]
2333
2425
  */
2334
- declare type OptionalTuple<T extends any[]> = {
2426
+ type OptionalTuple<T extends any[]> = {
2335
2427
  [K in keyof T]?: T[K];
2336
2428
  };
2337
2429
  /**
2338
2430
  * Returns Partial<T> if all fields on C are optional, T otherwise.
2339
2431
  */
2340
- declare type PartialUnless<C, T> = Record<string, never> extends C ? Partial<T> : [
2432
+ type PartialUnless<C, T> = Record<string, never> extends C ? Partial<T> : [
2341
2433
  C
2342
2434
  ] extends [never] ? Partial<T> : T;
2343
2435
  /**
2344
2436
  * Returns OptionalTupleUnless<T> if all fields on C are optional, T otherwise.
2345
2437
  */
2346
- declare type OptionalTupleUnless<C, T extends any[]> = Record<string, never> extends C ? OptionalTuple<T> : [
2438
+ type OptionalTupleUnless<C, T extends any[]> = Record<string, never> extends C ? OptionalTuple<T> : [
2347
2439
  C
2348
2440
  ] extends [never] ? OptionalTuple<T> : T;
2349
2441
 
@@ -2587,7 +2679,7 @@ interface LiveblocksHttpApi<M extends BaseMetadata> extends RoomHttpApi<M>, Noti
2587
2679
  * Back-port of TypeScript 5.4's built-in NoInfer utility type.
2588
2680
  * See https://stackoverflow.com/a/56688073/148872
2589
2681
  */
2590
- declare type NoInfr<A> = [A][A extends any ? 0 : never];
2682
+ type NoInfr<A> = [A][A extends any ? 0 : never];
2591
2683
 
2592
2684
  declare const kTrigger: unique symbol;
2593
2685
  /**
@@ -2597,7 +2689,7 @@ declare const kTrigger: unique symbol;
2597
2689
  * Nesting batches is supported.
2598
2690
  */
2599
2691
  declare function batch(callback: Callback<void>): void;
2600
- declare type SignalType<S extends ISignal<any>> = S extends ISignal<infer T> ? T : never;
2692
+ type SignalType<S extends ISignal<any>> = S extends ISignal<infer T> ? T : never;
2601
2693
  interface ISignal<T> {
2602
2694
  get(): T;
2603
2695
  subscribe(callback: Callback<void>): UnsubscribeCallback;
@@ -2631,10 +2723,10 @@ declare class Signal<T> extends AbstractSignal<T> {
2631
2723
  }
2632
2724
  declare class DerivedSignal<T> extends AbstractSignal<T> {
2633
2725
  #private;
2634
- static from<Ts extends [unknown, ...unknown[]], V>(...args: [...signals: {
2726
+ static from<Ts extends unknown[], V>(...args: [...signals: {
2635
2727
  [K in keyof Ts]: ISignal<Ts[K]>;
2636
2728
  }, transform: (...values: Ts) => V]): DerivedSignal<V>;
2637
- static from<Ts extends [unknown, ...unknown[]], V>(...args: [...signals: {
2729
+ static from<Ts extends unknown[], V>(...args: [...signals: {
2638
2730
  [K in keyof Ts]: ISignal<Ts[K]>;
2639
2731
  }, transform: (...values: Ts) => V, equals: (a: V, b: V) => boolean]): DerivedSignal<V>;
2640
2732
  private constructor();
@@ -2673,9 +2765,9 @@ declare class MutableSignal<T extends object> extends AbstractSignal<T> {
2673
2765
  mutate(callback?: (state: T) => void | boolean): void;
2674
2766
  }
2675
2767
 
2676
- declare type OptionalPromise<T> = T | Promise<T>;
2768
+ type OptionalPromise<T> = T | Promise<T>;
2677
2769
 
2678
- declare type ResolveMentionSuggestionsArgs = {
2770
+ type ResolveMentionSuggestionsArgs = {
2679
2771
  /**
2680
2772
  * The ID of the current room.
2681
2773
  */
@@ -2685,19 +2777,19 @@ declare type ResolveMentionSuggestionsArgs = {
2685
2777
  */
2686
2778
  text: string;
2687
2779
  };
2688
- declare type ResolveUsersArgs = {
2780
+ type ResolveUsersArgs = {
2689
2781
  /**
2690
2782
  * The IDs of the users to resolve.
2691
2783
  */
2692
2784
  userIds: string[];
2693
2785
  };
2694
- declare type ResolveRoomsInfoArgs = {
2786
+ type ResolveRoomsInfoArgs = {
2695
2787
  /**
2696
2788
  * The IDs of the rooms to resolve.
2697
2789
  */
2698
2790
  roomIds: string[];
2699
2791
  };
2700
- declare type EnterOptions<P extends JsonObject = DP, S extends LsonObject = DS> = Resolve<{
2792
+ type EnterOptions<P extends JsonObject = DP, S extends LsonObject = DS> = Resolve<{
2701
2793
  /**
2702
2794
  * Whether or not the room automatically connects to Liveblock servers.
2703
2795
  * Default is true.
@@ -2718,7 +2810,7 @@ declare type EnterOptions<P extends JsonObject = DP, S extends LsonObject = DS>
2718
2810
  */
2719
2811
  initialStorage: S | ((roomId: string) => S);
2720
2812
  }>>;
2721
- declare type SyncStatus = "synchronizing" | "synchronized";
2813
+ type SyncStatus = "synchronizing" | "synchronized";
2722
2814
  /**
2723
2815
  * "synchronizing" - Liveblocks is in the process of writing changes
2724
2816
  * "synchronized" - Liveblocks has persisted all pending changes
@@ -2726,7 +2818,7 @@ declare type SyncStatus = "synchronizing" | "synchronized";
2726
2818
  * we're not yet "synchronizing" it until a user
2727
2819
  * interaction, like the draft text in a comment box.
2728
2820
  */
2729
- declare type InternalSyncStatus = SyncStatus | "has-local-changes";
2821
+ type InternalSyncStatus = SyncStatus | "has-local-changes";
2730
2822
  /**
2731
2823
  * @private
2732
2824
  *
@@ -2734,7 +2826,7 @@ declare type InternalSyncStatus = SyncStatus | "has-local-changes";
2734
2826
  * of Liveblocks, NEVER USE ANY OF THESE DIRECTLY, because bad things
2735
2827
  * will probably happen if you do.
2736
2828
  */
2737
- declare type PrivateClientApi<U extends BaseUserMeta, M extends BaseMetadata> = {
2829
+ type PrivateClientApi<U extends BaseUserMeta, M extends BaseMetadata> = {
2738
2830
  readonly currentUserId: Signal<string | undefined>;
2739
2831
  readonly mentionSuggestionsCache: Map<string, string[]>;
2740
2832
  readonly resolveMentionSuggestions: ClientOptions<U>["resolveMentionSuggestions"];
@@ -2744,8 +2836,9 @@ declare type PrivateClientApi<U extends BaseUserMeta, M extends BaseMetadata> =
2744
2836
  readonly httpClient: LiveblocksHttpApi<M>;
2745
2837
  as<M2 extends BaseMetadata>(): Client<U, M2>;
2746
2838
  createSyncSource(): SyncSource;
2839
+ emitError(context: LiveblocksErrorContext, cause?: Error): void;
2747
2840
  };
2748
- declare type NotificationsApi<M extends BaseMetadata> = {
2841
+ type NotificationsApi<M extends BaseMetadata> = {
2749
2842
  /**
2750
2843
  * Gets a page (or the initial page) for user inbox notifications and their
2751
2844
  * associated threads.
@@ -2846,8 +2939,8 @@ declare type NotificationsApi<M extends BaseMetadata> = {
2846
2939
  * represents a Client instance using globally augmented types only, which is
2847
2940
  * narrower.
2848
2941
  */
2849
- declare type OpaqueClient = Client<BaseUserMeta>;
2850
- declare type Client<U extends BaseUserMeta = DU, M extends BaseMetadata = DM> = {
2942
+ type OpaqueClient = Client<BaseUserMeta>;
2943
+ type Client<U extends BaseUserMeta = DU, M extends BaseMetadata = DM> = {
2851
2944
  /**
2852
2945
  * Gets a room. Returns null if {@link Client.enter} has not been called previously.
2853
2946
  *
@@ -2936,20 +3029,18 @@ declare type Client<U extends BaseUserMeta = DU, M extends BaseMetadata = DM> =
2936
3029
  getSyncStatus(): SyncStatus;
2937
3030
  /**
2938
3031
  * All possible client events, subscribable from a single place.
2939
- *
2940
- * @private These event sources are private for now, but will become public
2941
- * once they're stable.
2942
3032
  */
2943
3033
  readonly events: {
3034
+ readonly error: Observable<LiveblocksError>;
2944
3035
  readonly syncStatus: Observable<void>;
2945
3036
  };
2946
3037
  } & NotificationsApi<M>;
2947
- declare type AuthEndpoint = string | ((room?: string) => Promise<CustomAuthenticationResult>);
3038
+ type AuthEndpoint = string | ((room?: string) => Promise<CustomAuthenticationResult>);
2948
3039
  /**
2949
3040
  * The authentication endpoint that is called to ensure that the current user has access to a room.
2950
3041
  * Can be an url or a callback if you need to add additional headers.
2951
3042
  */
2952
- declare type ClientOptions<U extends BaseUserMeta = DU> = {
3043
+ type ClientOptions<U extends BaseUserMeta = DU> = {
2953
3044
  throttle?: number;
2954
3045
  lostConnectionTimeout?: number;
2955
3046
  backgroundKeepAliveTimeout?: number;
@@ -2976,13 +3067,11 @@ declare type ClientOptions<U extends BaseUserMeta = DU> = {
2976
3067
  * the server yet.
2977
3068
  */
2978
3069
  preventUnsavedChanges?: boolean;
2979
- } & ({
3070
+ } & Relax<{
2980
3071
  publicApiKey: string;
2981
- authEndpoint?: never;
2982
3072
  } | {
2983
- publicApiKey?: never;
2984
3073
  authEndpoint: AuthEndpoint;
2985
- });
3074
+ }>;
2986
3075
  /**
2987
3076
  * Create a client that will be responsible to communicate with liveblocks servers.
2988
3077
  *
@@ -3010,7 +3099,7 @@ declare type ClientOptions<U extends BaseUserMeta = DU> = {
3010
3099
  */
3011
3100
  declare function createClient<U extends BaseUserMeta = DU>(options: ClientOptions<U>): Client<U>;
3012
3101
 
3013
- declare type CommentBodyParagraphElementArgs = {
3102
+ type CommentBodyParagraphElementArgs = {
3014
3103
  /**
3015
3104
  * The paragraph element.
3016
3105
  */
@@ -3020,13 +3109,13 @@ declare type CommentBodyParagraphElementArgs = {
3020
3109
  */
3021
3110
  children: string;
3022
3111
  };
3023
- declare type CommentBodyTextElementArgs = {
3112
+ type CommentBodyTextElementArgs = {
3024
3113
  /**
3025
3114
  * The text element.
3026
3115
  */
3027
3116
  element: CommentBodyText;
3028
3117
  };
3029
- declare type CommentBodyLinkElementArgs = {
3118
+ type CommentBodyLinkElementArgs = {
3030
3119
  /**
3031
3120
  * The link element.
3032
3121
  */
@@ -3036,7 +3125,7 @@ declare type CommentBodyLinkElementArgs = {
3036
3125
  */
3037
3126
  href: string;
3038
3127
  };
3039
- declare type CommentBodyMentionElementArgs<U extends BaseUserMeta = DU> = {
3128
+ type CommentBodyMentionElementArgs<U extends BaseUserMeta = DU> = {
3040
3129
  /**
3041
3130
  * The mention element.
3042
3131
  */
@@ -3046,7 +3135,7 @@ declare type CommentBodyMentionElementArgs<U extends BaseUserMeta = DU> = {
3046
3135
  */
3047
3136
  user?: U["info"];
3048
3137
  };
3049
- declare type StringifyCommentBodyElements<U extends BaseUserMeta = DU> = {
3138
+ type StringifyCommentBodyElements<U extends BaseUserMeta = DU> = {
3050
3139
  /**
3051
3140
  * The element used to display paragraphs.
3052
3141
  */
@@ -3064,7 +3153,7 @@ declare type StringifyCommentBodyElements<U extends BaseUserMeta = DU> = {
3064
3153
  */
3065
3154
  mention: (args: CommentBodyMentionElementArgs<U>, index: number) => string;
3066
3155
  };
3067
- declare type StringifyCommentBodyOptions<U extends BaseUserMeta = DU> = {
3156
+ type StringifyCommentBodyOptions<U extends BaseUserMeta = DU> = {
3068
3157
  /**
3069
3158
  * Which format to convert the comment to.
3070
3159
  */
@@ -3153,13 +3242,13 @@ declare function convertToInboxNotificationData(data: InboxNotificationDataPlain
3153
3242
  /**
3154
3243
  * Lookup table for nodes (= SerializedCrdt values) by their IDs.
3155
3244
  */
3156
- declare type NodeMap = Map<string, // Node ID
3245
+ type NodeMap = Map<string, // Node ID
3157
3246
  SerializedCrdt>;
3158
3247
  /**
3159
3248
  * Reverse lookup table for all child nodes (= list of SerializedCrdt values)
3160
3249
  * by their parent node's IDs.
3161
3250
  */
3162
- declare type ParentToChildNodeMap = Map<string, // Parent's node ID
3251
+ type ParentToChildNodeMap = Map<string, // Parent's node ID
3163
3252
  IdTuple<SerializedChild>[]>;
3164
3253
 
3165
3254
  declare function isLiveNode(value: unknown): value is LiveNode;
@@ -3213,10 +3302,14 @@ declare function assert(condition: boolean, errmsg: string): asserts condition;
3213
3302
  declare function nn<T>(value: T, errmsg?: string): NonNullable<T>;
3214
3303
 
3215
3304
  declare class HttpError extends Error {
3216
- message: string;
3217
- status: number;
3218
- details?: JsonObject | undefined;
3219
- constructor(message: string, status: number, details?: JsonObject | undefined);
3305
+ response: Response;
3306
+ details?: JsonObject;
3307
+ private constructor();
3308
+ static fromResponse(response: Response): Promise<HttpError>;
3309
+ /**
3310
+ * Convenience accessor for response.status.
3311
+ */
3312
+ get status(): number;
3220
3313
  }
3221
3314
  /**
3222
3315
  * Wraps a promise factory. Will create promises until one succeeds. If
@@ -3250,6 +3343,36 @@ declare function createCommentId(): string;
3250
3343
  declare function createCommentAttachmentId(): string;
3251
3344
  declare function createInboxNotificationId(): string;
3252
3345
 
3346
+ /**
3347
+ * Like ES6 map, but takes a default (factory) function which will be used
3348
+ * to create entries for missing keys on the fly.
3349
+ *
3350
+ * Useful for code like:
3351
+ *
3352
+ * const map = new DefaultMap(() => []);
3353
+ * map.getOrCreate('foo').push('hello');
3354
+ * map.getOrCreate('foo').push('world');
3355
+ * map.getOrCreate('foo')
3356
+ * // ['hello', 'world']
3357
+ *
3358
+ */
3359
+ declare class DefaultMap<K, V> extends Map<K, V> {
3360
+ #private;
3361
+ /**
3362
+ * If the default function is not provided to the constructor, it has to be
3363
+ * provided in each .getOrCreate() call individually.
3364
+ */
3365
+ constructor(defaultFn?: (key: K) => V, entries?: readonly (readonly [K, V])[] | null);
3366
+ /**
3367
+ * Gets the value at the given key, or creates it.
3368
+ *
3369
+ * Difference from normal Map: if the key does not exist, it will be created
3370
+ * on the fly using the factory function, and that value will get returned
3371
+ * instead of `undefined`.
3372
+ */
3373
+ getOrCreate(key: K, defaultFn?: (key: K) => V): V;
3374
+ }
3375
+
3253
3376
  /**
3254
3377
  * Displays a deprecation warning in the dev console. Only in dev mode, and
3255
3378
  * only once per message/key. In production, this is a no-op.
@@ -3295,6 +3418,16 @@ declare namespace fancyConsole {
3295
3418
  */
3296
3419
  declare const freeze: typeof Object.freeze;
3297
3420
 
3421
+ declare function isPlainObject(blob: unknown): blob is {
3422
+ [key: string]: unknown;
3423
+ };
3424
+ /**
3425
+ * Check if value is of shape { startsWith: string }
3426
+ */
3427
+ declare function isStartsWithOperator(blob: unknown): blob is {
3428
+ startsWith: string;
3429
+ };
3430
+
3298
3431
  declare const nanoid: (t?: number) => string;
3299
3432
 
3300
3433
  /**
@@ -3302,35 +3435,32 @@ declare const nanoid: (t?: number) => string;
3302
3435
  * Example:
3303
3436
  * ```ts
3304
3437
  * const query = objectToQuery({
3305
- resolved: true,
3306
- metadata: {
3307
- status: "open",
3308
- priority: 3,
3309
- org: {
3310
- startsWith: "liveblocks:",
3311
- },
3312
- },
3313
- });
3314
-
3315
- console.log(query);
3316
- // resolved:true AND metadata["status"]:open AND metadata["priority"]:3 AND metadata["org"]^"liveblocks:"
3317
-
3318
- * ```
3319
- *
3438
+ * resolved: true,
3439
+ * metadata: {
3440
+ * status: "open",
3441
+ * priority: 3,
3442
+ * org: {
3443
+ * startsWith: "liveblocks:",
3444
+ * },
3445
+ * },
3446
+ * });
3320
3447
  *
3448
+ * console.log(query);
3449
+ * // resolved:true AND metadata["status"]:open AND metadata["priority"]:3 AND metadata["org"]^"liveblocks:"
3450
+ * ```
3321
3451
  */
3322
- declare type SimpleFilterValue = string | number | boolean;
3323
- declare type OperatorFilterValue = {
3452
+ type SimpleFilterValue = string | number | boolean | null;
3453
+ type OperatorFilterValue = {
3324
3454
  startsWith: string;
3325
3455
  };
3326
- declare type FilterValue = SimpleFilterValue | OperatorFilterValue;
3456
+ type FilterValue = SimpleFilterValue | OperatorFilterValue;
3327
3457
  declare function objectToQuery(obj: {
3328
3458
  [key: string]: FilterValue | {
3329
3459
  [key: string]: FilterValue | undefined;
3330
3460
  } | undefined;
3331
3461
  }): string;
3332
3462
 
3333
- declare type Poller = {
3463
+ type Poller = {
3334
3464
  /**
3335
3465
  * Increments the subscriber count for this poller. If it becomes > 0, the
3336
3466
  * poller will be enabled.
@@ -3383,17 +3513,14 @@ declare function makePoller(callback: (signal: AbortSignal) => Promise<void> | v
3383
3513
  }): Poller;
3384
3514
 
3385
3515
  declare const brand: unique symbol;
3386
- declare type Brand<T, TBrand extends string> = T & {
3516
+ type Brand<T, TBrand extends string> = T & {
3387
3517
  [brand]: TBrand;
3388
3518
  };
3389
- declare type DistributiveOmit<T, K extends PropertyKey> = T extends any ? Omit<T, K> : never;
3519
+ type DistributiveOmit<T, K extends PropertyKey> = T extends any ? Omit<T, K> : never;
3390
3520
  /**
3391
3521
  * Throw an error, but as an expression instead of a statement.
3392
3522
  */
3393
3523
  declare function raise(msg: string): never;
3394
- declare function isPlainObject(blob: unknown): blob is {
3395
- [key: string]: unknown;
3396
- };
3397
3524
  /**
3398
3525
  * Creates a new object by mapping a function over all values. Keys remain the
3399
3526
  * same. Think Array.prototype.map(), but for values in an object.
@@ -3410,7 +3537,7 @@ declare function tryParseJson(rawMessage: string): Json | undefined;
3410
3537
  * Decode base64 string.
3411
3538
  */
3412
3539
  declare function b64decode(b64value: string): string;
3413
- declare type RemoveUndefinedValues<T> = {
3540
+ type RemoveUndefinedValues<T> = {
3414
3541
  [K in keyof T]-?: Exclude<T[K], undefined>;
3415
3542
  };
3416
3543
  /**
@@ -3487,7 +3614,7 @@ declare function memoizeOnSuccess<T>(factoryFn: () => Promise<T>): () => Promise
3487
3614
  * A valid/verified "position" string. These values are used as "parentKey"s by
3488
3615
  * LiveList children, and define their relative ordering.
3489
3616
  */
3490
- declare type Pos = Brand<string, "Pos">;
3617
+ type Pos = Brand<string, "Pos">;
3491
3618
  /**
3492
3619
  * Given two positions, returns the position value that lies in the middle.
3493
3620
  * When given only a high bound, computes the canonical position "before" it.
@@ -3552,14 +3679,13 @@ declare class SortedList<T> {
3552
3679
  [Symbol.iterator](): IterableIterator<T>;
3553
3680
  }
3554
3681
 
3555
- declare type OmitFirstTupleElement<T extends any[]> = T extends [any, ...infer R] ? R : never;
3556
3682
  /**
3557
- * Like JSON.stringify(), but returns the same value no matter how the keys in
3558
- * objects are ordered.
3683
+ * Like JSON.stringify(), but returns the same value no matter how keys in any
3684
+ * nested objects are ordered.
3559
3685
  */
3560
- declare function stringify(object: Parameters<typeof JSON.stringify>[0], ...args: OmitFirstTupleElement<Parameters<typeof JSON.stringify>>): string;
3686
+ declare function stringify(value: unknown): string;
3561
3687
 
3562
- declare type QueryParams = Record<string, string | number | null | undefined> | URLSearchParams;
3688
+ type QueryParams = Record<string, string | number | null | undefined> | URLSearchParams;
3563
3689
  /**
3564
3690
  * Concatenates a path to an existing URL.
3565
3691
  */
@@ -3568,7 +3694,7 @@ declare function urljoin(baseUrl: string | URL, path: string, params?: QueryPara
3568
3694
  * A string that is guaranteed to be URL safe (where all arguments are properly
3569
3695
  * encoded), only obtainable as the result of using `url` template strings.
3570
3696
  */
3571
- declare type URLSafeString = Brand<string, "URLSafeString">;
3697
+ type URLSafeString = Brand<string, "URLSafeString">;
3572
3698
  /**
3573
3699
  * Builds a URL where each "hole" in the template string will automatically be
3574
3700
  * encodeURIComponent()-escaped, so it's impossible to build invalid URLs.
@@ -3578,7 +3704,7 @@ declare function url(strings: TemplateStringsArray, ...values: string[]): URLSaf
3578
3704
  /**
3579
3705
  * Definition of all messages the Panel can send to the Client.
3580
3706
  */
3581
- declare type PanelToClientMessage =
3707
+ type PanelToClientMessage =
3582
3708
  /**
3583
3709
  * Initial message from the panel to the client, used for two purposes.
3584
3710
  * 1. First, it’s eavesdropped by the background script, which uses this
@@ -3612,7 +3738,7 @@ declare type PanelToClientMessage =
3612
3738
  /**
3613
3739
  * Definition of all messages the Client can send to the Panel.
3614
3740
  */
3615
- declare type ClientToPanelMessage =
3741
+ type ClientToPanelMessage =
3616
3742
  /**
3617
3743
  * Initial message sent by the client to test if a dev panel is listening.
3618
3744
  * This is necessary in cases where the dev panel is already opened and
@@ -3679,11 +3805,11 @@ declare type ClientToPanelMessage =
3679
3805
  roomId: string;
3680
3806
  update: YDocUpdateServerMsg | UpdateYDocClientMsg;
3681
3807
  };
3682
- declare type FullPanelToClientMessage = PanelToClientMessage & {
3808
+ type FullPanelToClientMessage = PanelToClientMessage & {
3683
3809
  source: "liveblocks-devtools-panel";
3684
3810
  tabId: number;
3685
3811
  };
3686
- declare type FullClientToPanelMessage = ClientToPanelMessage & {
3812
+ type FullClientToPanelMessage = ClientToPanelMessage & {
3687
3813
  source: "liveblocks-devtools-client";
3688
3814
  };
3689
3815
 
@@ -3701,7 +3827,7 @@ declare namespace protocol {
3701
3827
  * information, see
3702
3828
  * https://liveblocks.io/docs/guides/limits#lson-constraint-and-interfaces
3703
3829
  */
3704
- declare type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (EnsureJson<I>)[] : [
3830
+ type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (EnsureJson<I>)[] : [
3705
3831
  unknown
3706
3832
  ] extends [T] ? Json | undefined : T extends Date ? string : T extends (...args: any[]) => any ? never : {
3707
3833
  [K in keyof T as EnsureJson<T[K]> extends never ? never : K]: EnsureJson<T[K]>;
@@ -3712,4 +3838,4 @@ declare const CommentsApiError: typeof HttpError;
3712
3838
  /** @deprecated Use HttpError instead. */
3713
3839
  declare const NotificationsApiError: typeof HttpError;
3714
3840
 
3715
- 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, 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, 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 };
3841
+ 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 };