@liveblocks/client 0.17.0-test1 → 0.17.1

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/shared.d.ts CHANGED
@@ -1,34 +1,4 @@
1
- declare type ApplyResult =
2
- | {
3
- reverse: Op[];
4
- modified: StorageUpdate;
5
- }
6
- | {
7
- modified: false;
8
- };
9
- interface Doc {
10
- roomId: string;
11
- generateId: () => string;
12
- generateOpId: () => string;
13
- getItem: (id: string) => LiveNode | undefined;
14
- addItem: (id: string, liveItem: LiveNode) => void;
15
- deleteItem: (id: string) => void;
16
- /**
17
- * Dispatching has three responsibilities:
18
- * - Sends serialized ops to the WebSocket servers
19
- * - Add reverse operations to the undo/redo stack
20
- * - Notify room subscribers with updates (in-client, no networking)
21
- */
22
- dispatch: (
23
- ops: Op[],
24
- reverseOps: Op[],
25
- storageUpdates: Map<string, StorageUpdate>
26
- ) => void;
27
- }
28
1
  declare abstract class AbstractCrdt {
29
- private __doc?;
30
- private __id?;
31
- private _parent;
32
2
  get roomId(): string | null;
33
3
  }
34
4
 
@@ -36,9 +6,6 @@ declare abstract class AbstractCrdt {
36
6
  * The LiveList class represents an ordered collection of items that is synchronized across clients.
37
7
  */
38
8
  declare class LiveList<TItem extends Lson> extends AbstractCrdt {
39
- private _items;
40
- private _implicitlyDeletedItems;
41
- private _unacknowledgedSets;
42
9
  constructor(items?: TItem[]);
43
10
  /**
44
11
  * Returns the number of elements.
@@ -145,7 +112,6 @@ declare class LiveMap<
145
112
  TKey extends string,
146
113
  TValue extends Lson
147
114
  > extends AbstractCrdt {
148
- private _map;
149
115
  constructor(entries?: readonly (readonly [TKey, TValue])[] | undefined);
150
116
  /**
151
117
  * @deprecated Please call as `new LiveMap()` or `new LiveMap([])` instead.
@@ -209,16 +175,7 @@ declare class LiveMap<
209
175
  * If multiple clients update the same property simultaneously, the last modification received by the Liveblocks servers is the winner.
210
176
  */
211
177
  declare class LiveObject<O extends LsonObject> extends AbstractCrdt {
212
- private _map;
213
- private _propToLastUpdate;
214
178
  constructor(obj?: O);
215
- _serialize(
216
- parentId?: undefined,
217
- parentKey?: undefined,
218
- doc?: Doc
219
- ): CreateOp[];
220
- private _applyUpdate;
221
- private _applyDeleteObjectKey;
222
179
  /**
223
180
  * Transform the LiveObject into a javascript object
224
181
  */
@@ -266,36 +223,24 @@ declare function isJsonScalar(data: Json): data is JsonScalar;
266
223
  declare function isJsonArray(data: Json): data is JsonArray;
267
224
  declare function isJsonObject(data: Json): data is JsonObject;
268
225
 
226
+ declare type BaseUserMeta = {
227
+ /**
228
+ * The id of the user that has been set in the authentication endpoint.
229
+ * Useful to get additional information about the connected user.
230
+ */
231
+ id?: string;
232
+ /**
233
+ * Additional user information that has been set in the authentication endpoint.
234
+ */
235
+ info?: Json;
236
+ };
237
+
269
238
  /**
270
239
  * INTERNAL
271
240
  */
272
241
  declare class LiveRegister<TValue extends Json> extends AbstractCrdt {
273
- _data: TValue;
274
242
  constructor(data: TValue);
275
243
  get data(): TValue;
276
- /**
277
- * INTERNAL
278
- */
279
- static _deserialize(
280
- [id, item]: IdTuple<SerializedRegister>,
281
- _parentToChildren: ParentToChildNodeMap,
282
- doc: Doc
283
- ): LiveRegister<Json>;
284
- /**
285
- * INTERNAL
286
- */
287
- _serialize(
288
- parentId: string,
289
- parentKey: string,
290
- doc?: Doc
291
- ): CreateRegisterOp[];
292
- /**
293
- * INTERNAL
294
- */
295
- _toSerializedCrdt(): SerializedRegister;
296
- _attachChild(_op: CreateChildOp): ApplyResult;
297
- _detachChild(_crdt: LiveNode): ApplyResult;
298
- _apply(op: Op, isLocal: boolean): ApplyResult;
299
244
  }
300
245
 
301
246
  declare type LiveStructure =
@@ -321,163 +266,6 @@ declare type LsonObject = {
321
266
  [key: string]: Lson | undefined;
322
267
  };
323
268
 
324
- declare enum OpCode {
325
- INIT = 0,
326
- SET_PARENT_KEY = 1,
327
- CREATE_LIST = 2,
328
- UPDATE_OBJECT = 3,
329
- CREATE_OBJECT = 4,
330
- DELETE_CRDT = 5,
331
- DELETE_OBJECT_KEY = 6,
332
- CREATE_MAP = 7,
333
- CREATE_REGISTER = 8,
334
- }
335
- /**
336
- * These operations are the payload for {@link UpdateStorageServerMsg} messages
337
- * only.
338
- */
339
- declare type Op =
340
- | CreateOp
341
- | UpdateObjectOp
342
- | DeleteCrdtOp
343
- | SetParentKeyOp
344
- | DeleteObjectKeyOp;
345
- declare type CreateOp = CreateRootObjectOp | CreateChildOp;
346
- declare type CreateChildOp =
347
- | CreateObjectOp
348
- | CreateRegisterOp
349
- | CreateMapOp
350
- | CreateListOp;
351
- declare type UpdateObjectOp = {
352
- opId?: string;
353
- id: string;
354
- type: OpCode.UPDATE_OBJECT;
355
- data: Partial<JsonObject>;
356
- };
357
- declare type CreateObjectOp = {
358
- opId?: string;
359
- id: string;
360
- intent?: "set";
361
- deletedId?: string;
362
- type: OpCode.CREATE_OBJECT;
363
- parentId: string;
364
- parentKey: string;
365
- data: JsonObject;
366
- };
367
- declare type CreateRootObjectOp = {
368
- opId?: string;
369
- id: string;
370
- type: OpCode.CREATE_OBJECT;
371
- data: JsonObject;
372
- parentId?: never;
373
- parentKey?: never;
374
- };
375
- declare type CreateListOp = {
376
- opId?: string;
377
- id: string;
378
- intent?: "set";
379
- deletedId?: string;
380
- type: OpCode.CREATE_LIST;
381
- parentId: string;
382
- parentKey: string;
383
- };
384
- declare type CreateMapOp = {
385
- opId?: string;
386
- id: string;
387
- intent?: "set";
388
- deletedId?: string;
389
- type: OpCode.CREATE_MAP;
390
- parentId: string;
391
- parentKey: string;
392
- };
393
- declare type CreateRegisterOp = {
394
- opId?: string;
395
- id: string;
396
- intent?: "set";
397
- deletedId?: string;
398
- type: OpCode.CREATE_REGISTER;
399
- parentId: string;
400
- parentKey: string;
401
- data: Json;
402
- };
403
- declare type DeleteCrdtOp = {
404
- opId?: string;
405
- id: string;
406
- type: OpCode.DELETE_CRDT;
407
- };
408
- declare type SetParentKeyOp = {
409
- opId?: string;
410
- id: string;
411
- type: OpCode.SET_PARENT_KEY;
412
- parentKey: string;
413
- };
414
- declare type DeleteObjectKeyOp = {
415
- opId?: string;
416
- id: string;
417
- type: OpCode.DELETE_OBJECT_KEY;
418
- key: string;
419
- };
420
-
421
- declare type IdTuple<T> = [id: string, value: T];
422
- declare enum CrdtType {
423
- OBJECT = 0,
424
- LIST = 1,
425
- MAP = 2,
426
- REGISTER = 3,
427
- }
428
- declare type SerializedCrdt = SerializedRootObject | SerializedChild;
429
- declare type SerializedChild =
430
- | SerializedObject
431
- | SerializedList
432
- | SerializedMap
433
- | SerializedRegister;
434
- declare type SerializedRootObject = {
435
- type: CrdtType.OBJECT;
436
- data: JsonObject;
437
- parentId?: never;
438
- parentKey?: never;
439
- };
440
- declare type SerializedObject = {
441
- type: CrdtType.OBJECT;
442
- parentId: string;
443
- parentKey: string;
444
- data: JsonObject;
445
- };
446
- declare type SerializedList = {
447
- type: CrdtType.LIST;
448
- parentId: string;
449
- parentKey: string;
450
- };
451
- declare type SerializedMap = {
452
- type: CrdtType.MAP;
453
- parentId: string;
454
- parentKey: string;
455
- };
456
- declare type SerializedRegister = {
457
- type: CrdtType.REGISTER;
458
- parentId: string;
459
- parentKey: string;
460
- data: Json;
461
- };
462
- declare function isRootCrdt(crdt: SerializedCrdt): crdt is SerializedRootObject;
463
- declare function isChildCrdt(crdt: SerializedCrdt): crdt is SerializedChild;
464
-
465
- /**
466
- * Lookup table for nodes (= SerializedCrdt values) by their IDs.
467
- */
468
- declare type NodeMap = Map<
469
- string, // Node ID
470
- SerializedCrdt
471
- >;
472
- /**
473
- * Reverse lookup table for all child nodes (= list of SerializedCrdt values)
474
- * by their parent node's IDs.
475
- */
476
- declare type ParentToChildNodeMap = Map<
477
- string, // Parent's node ID
478
- IdTuple<SerializedChild>[]
479
- >;
480
-
481
269
  /**
482
270
  * This helper type is effectively a no-op, but will force TypeScript to
483
271
  * "evaluate" any named helper types in its definition. This can sometimes make
@@ -508,16 +296,19 @@ declare type Resolve<T> = T extends (...args: unknown[]) => unknown
508
296
  declare type MyPresenceCallback<TPresence extends JsonObject> = (
509
297
  me: TPresence
510
298
  ) => void;
511
- declare type OthersEventCallback<TPresence extends JsonObject> = (
512
- others: Others<TPresence>,
513
- event: OthersEvent<TPresence>
299
+ declare type OthersEventCallback<
300
+ TPresence extends JsonObject,
301
+ TUserMeta extends BaseUserMeta
302
+ > = (
303
+ others: Others<TPresence, TUserMeta>,
304
+ event: OthersEvent<TPresence, TUserMeta>
514
305
  ) => void;
515
- declare type EventCallback = ({
306
+ declare type EventCallback<TRoomEvent extends Json> = ({
516
307
  connectionId,
517
308
  event,
518
309
  }: {
519
310
  connectionId: number;
520
- event: Json;
311
+ event: TRoomEvent;
521
312
  }) => void;
522
313
  declare type ErrorCallback = (error: Error) => void;
523
314
  declare type ConnectionCallback = (state: ConnectionState) => void;
@@ -602,6 +393,7 @@ declare type StorageUpdate =
602
393
  | LiveMapUpdates<string, Lson>
603
394
  | LiveObjectUpdates<LsonObject>
604
395
  | LiveListUpdates<Lson>;
396
+ declare type StorageCallback = (updates: StorageUpdate[]) => void;
605
397
  declare type RoomInitializers<
606
398
  TPresence extends JsonObject,
607
399
  TStorage extends LsonObject
@@ -632,18 +424,28 @@ declare type Client = {
632
424
  *
633
425
  * @param roomId The id of the room
634
426
  */
635
- getRoom<TPresence extends JsonObject, TStorage extends LsonObject>(
427
+ getRoom<
428
+ TPresence extends JsonObject,
429
+ TStorage extends LsonObject = LsonObject,
430
+ TUserMeta extends BaseUserMeta = BaseUserMeta,
431
+ TRoomEvent extends Json = never
432
+ >(
636
433
  roomId: string
637
- ): Room<TPresence, TStorage> | null;
434
+ ): Room<TPresence, TStorage, TUserMeta, TRoomEvent> | null;
638
435
  /**
639
436
  * Enters a room and returns it.
640
437
  * @param roomId The id of the room
641
438
  * @param options Optional. You can provide initializers for the Presence or Storage when entering the Room.
642
439
  */
643
- enter<TPresence extends JsonObject, TStorage extends LsonObject>(
440
+ enter<
441
+ TPresence extends JsonObject,
442
+ TStorage extends LsonObject = LsonObject,
443
+ TUserMeta extends BaseUserMeta = BaseUserMeta,
444
+ TRoomEvent extends Json = never
445
+ >(
644
446
  roomId: string,
645
447
  options?: RoomInitializers<TPresence, TStorage>
646
- ): Room<TPresence, TStorage>;
448
+ ): Room<TPresence, TStorage, TUserMeta, TRoomEvent>;
647
449
  /**
648
450
  * Leaves a room.
649
451
  * @param roomId The id of the room
@@ -653,7 +455,7 @@ declare type Client = {
653
455
  /**
654
456
  * Represents all the other users connected in the room. Treated as immutable.
655
457
  */
656
- interface Others<TPresence extends JsonObject> {
458
+ interface Others<TPresence extends JsonObject, TUserMeta extends BaseUserMeta> {
657
459
  /**
658
460
  * Number of other users in the room.
659
461
  */
@@ -661,20 +463,23 @@ interface Others<TPresence extends JsonObject> {
661
463
  /**
662
464
  * Returns a new Iterator object that contains the users.
663
465
  */
664
- [Symbol.iterator](): IterableIterator<User<TPresence>>;
466
+ [Symbol.iterator](): IterableIterator<User<TPresence, TUserMeta>>;
665
467
  /**
666
468
  * Returns the array of connected users in room.
667
469
  */
668
- toArray(): User<TPresence>[];
470
+ toArray(): User<TPresence, TUserMeta>[];
669
471
  /**
670
472
  * This function let you map over the connected users in the room.
671
473
  */
672
- map<U>(callback: (user: User<TPresence>) => U): U[];
474
+ map<U>(callback: (user: User<TPresence, TUserMeta>) => U): U[];
673
475
  }
674
476
  /**
675
477
  * Represents a user connected in a room. Treated as immutable.
676
478
  */
677
- declare type User<TPresence extends JsonObject> = {
479
+ declare type User<
480
+ TPresence extends JsonObject,
481
+ TUserMeta extends BaseUserMeta
482
+ > = {
678
483
  /**
679
484
  * The connection id of the user. It is unique and increment at every new connection.
680
485
  */
@@ -683,11 +488,11 @@ declare type User<TPresence extends JsonObject> = {
683
488
  * The id of the user that has been set in the authentication endpoint.
684
489
  * Useful to get additional information about the connected user.
685
490
  */
686
- readonly id?: string;
491
+ readonly id: TUserMeta["id"];
687
492
  /**
688
493
  * Additional user information that has been set in the authentication endpoint.
689
494
  */
690
- readonly info?: any;
495
+ readonly info: TUserMeta["info"];
691
496
  /**
692
497
  * The user presence.
693
498
  */
@@ -713,15 +518,26 @@ declare type AuthEndpointCallback = (room: string) => Promise<{
713
518
  token: string;
714
519
  }>;
715
520
  declare type AuthEndpoint = string | AuthEndpointCallback;
521
+ declare type Polyfills = {
522
+ atob?: (data: string) => string;
523
+ fetch?: typeof fetch;
524
+ WebSocket?: any;
525
+ };
716
526
  /**
717
527
  * The authentication endpoint that is called to ensure that the current user has access to a room.
718
528
  * Can be an url or a callback if you need to add additional headers.
719
529
  */
720
530
  declare type ClientOptions = {
721
531
  throttle?: number;
722
- fetchPolyfill?: typeof fetch;
723
- WebSocketPolyfill?: any;
724
- atobPolyfill?: (data: string) => string;
532
+ polyfills?: Polyfills;
533
+ /**
534
+ * Backward-compatible way to set `polyfills.fetch`.
535
+ */
536
+ fetchPolyfill?: Polyfills["fetch"];
537
+ /**
538
+ * Backward-compatible way to set `polyfills.WebSocket`.
539
+ */
540
+ WebSocketPolyfill?: Polyfills["WebSocket"];
725
541
  } & (
726
542
  | {
727
543
  publicApiKey: string;
@@ -743,18 +559,21 @@ declare type Connection =
743
559
  userInfo?: Json;
744
560
  };
745
561
  declare type ConnectionState = Connection["state"];
746
- declare type OthersEvent<TPresence extends JsonObject> =
562
+ declare type OthersEvent<
563
+ TPresence extends JsonObject,
564
+ TUserMeta extends BaseUserMeta
565
+ > =
747
566
  | {
748
567
  type: "leave";
749
- user: User<TPresence>;
568
+ user: User<TPresence, TUserMeta>;
750
569
  }
751
570
  | {
752
571
  type: "enter";
753
- user: User<TPresence>;
572
+ user: User<TPresence, TUserMeta>;
754
573
  }
755
574
  | {
756
575
  type: "update";
757
- user: User<TPresence>;
576
+ user: User<TPresence, TUserMeta>;
758
577
  updates: Partial<TPresence>;
759
578
  }
760
579
  | {
@@ -812,7 +631,12 @@ interface History {
812
631
  */
813
632
  resume: () => void;
814
633
  }
815
- declare type Room<TPresence extends JsonObject, TStorage extends LsonObject> = {
634
+ declare type Room<
635
+ TPresence extends JsonObject,
636
+ TStorage extends LsonObject,
637
+ TUserMeta extends BaseUserMeta,
638
+ TRoomEvent extends Json
639
+ > = {
816
640
  /**
817
641
  * The id of the room.
818
642
  */
@@ -840,7 +664,10 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject> = {
840
664
  * // Do something
841
665
  * });
842
666
  */
843
- (type: "others", listener: OthersEventCallback<TPresence>): () => void;
667
+ (
668
+ type: "others",
669
+ listener: OthersEventCallback<TPresence, TUserMeta>
670
+ ): () => void;
844
671
  /**
845
672
  * Subscribe to events broadcasted by {@link Room.broadcastEvent}
846
673
  *
@@ -851,7 +678,7 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject> = {
851
678
  * // Do something
852
679
  * });
853
680
  */
854
- (type: "event", listener: EventCallback): () => void;
681
+ (type: "event", listener: EventCallback<TRoomEvent>): () => void;
855
682
  /**
856
683
  * Subscribe to errors thrown in the room.
857
684
  */
@@ -861,112 +688,40 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject> = {
861
688
  */
862
689
  (type: "connection", listener: ConnectionCallback): () => void;
863
690
  /**
864
- * Subscribes to changes made on a {@link LiveMap}. Returns an unsubscribe function.
865
- * In a future version, we will also expose what exactly changed in the {@link LiveMap}.
691
+ * Subscribes to changes made on a Live structure. Returns an unsubscribe function.
692
+ * In a future version, we will also expose what exactly changed in the Live structure.
866
693
  *
867
- * @param listener the callback this called when the {@link LiveMap} changes.
694
+ * @param callback The callback this called when the Live structure changes.
868
695
  *
869
696
  * @returns Unsubscribe function.
870
697
  *
871
698
  * @example
872
- * const liveMap = new LiveMap();
699
+ * const liveMap = new LiveMap(); // Could also be LiveList or LiveObject
873
700
  * const unsubscribe = room.subscribe(liveMap, (liveMap) => { });
874
701
  * unsubscribe();
875
702
  */
876
- <TKey extends string, TValue extends Lson>(
877
- liveMap: LiveMap<TKey, TValue>,
878
- listener: (liveMap: LiveMap<TKey, TValue>) => void
879
- ): () => void;
880
- /**
881
- * Subscribes to changes made on a {@link LiveObject}. Returns an unsubscribe function.
882
- * In a future version, we will also expose what exactly changed in the {@link LiveObject}.
883
- *
884
- * @param callback the callback this called when the {@link LiveObject} changes.
885
- *
886
- * @returns Unsubscribe function.
887
- *
888
- * @example
889
- * const liveObject = new LiveObject();
890
- * const unsubscribe = room.subscribe(liveObject, (liveObject) => { });
891
- * unsubscribe();
892
- */
893
- <TData extends JsonObject>(
894
- liveObject: LiveObject<TData>,
895
- callback: (liveObject: LiveObject<TData>) => void
703
+ <L extends LiveStructure>(
704
+ liveStructure: L,
705
+ callback: (node: L) => void
896
706
  ): () => void;
897
707
  /**
898
- * Subscribes to changes made on a {@link LiveList}. Returns an unsubscribe function.
899
- * In a future version, we will also expose what exactly changed in the {@link LiveList}.
708
+ * Subscribes to changes made on a Live structure and all the nested data
709
+ * structures. Returns an unsubscribe function. In a future version, we
710
+ * will also expose what exactly changed in the Live structure.
900
711
  *
901
- * @param callback the callback this called when the {@link LiveList} changes.
712
+ * @param callback The callback this called when the Live structure, or any
713
+ * of its nested values, changes.
902
714
  *
903
715
  * @returns Unsubscribe function.
904
716
  *
905
717
  * @example
906
- * const liveList = new LiveList();
907
- * const unsubscribe = room.subscribe(liveList, (liveList) => { });
718
+ * const liveMap = new LiveMap(); // Could also be LiveList or LiveObject
719
+ * const unsubscribe = room.subscribe(liveMap, (updates) => { }, { isDeep: true });
908
720
  * unsubscribe();
909
721
  */
910
- <TItem extends Lson>(
911
- liveList: LiveList<TItem>,
912
- callback: (liveList: LiveList<TItem>) => void
913
- ): () => void;
914
- /**
915
- * Subscribes to changes made on a {@link LiveMap} and all the nested data structures. Returns an unsubscribe function.
916
- * In a future version, we will also expose what exactly changed in the {@link LiveMap}.
917
- *
918
- * @param callback the callback this called when the {@link LiveMap} changes.
919
- *
920
- * @returns Unsubscribe function.
921
- *
922
- * @example
923
- * const liveMap = new LiveMap();
924
- * const unsubscribe = room.subscribe(liveMap, (liveMap) => { }, { isDeep: true });
925
- * unsubscribe();
926
- */
927
- <TKey extends string, TValue extends Lson>(
928
- liveMap: LiveMap<TKey, TValue>,
929
- callback: (updates: LiveMapUpdates<TKey, TValue>[]) => void,
930
- options: {
931
- isDeep: true;
932
- }
933
- ): () => void;
934
- /**
935
- * Subscribes to changes made on a {@link LiveObject} and all the nested data structures. Returns an unsubscribe function.
936
- * In a future version, we will also expose what exactly changed in the {@link LiveObject}.
937
- *
938
- * @param callback the callback this called when the {@link LiveObject} changes.
939
- *
940
- * @returns Unsubscribe function.
941
- *
942
- * @example
943
- * const liveObject = new LiveObject();
944
- * const unsubscribe = room.subscribe(liveObject, (liveObject) => { }, { isDeep: true });
945
- * unsubscribe();
946
- */
947
- <TData extends LsonObject>(
948
- liveObject: LiveObject<TData>,
949
- callback: (updates: LiveObjectUpdates<TData>[]) => void,
950
- options: {
951
- isDeep: true;
952
- }
953
- ): () => void;
954
- /**
955
- * Subscribes to changes made on a {@link LiveList} and all the nested data structures. Returns an unsubscribe function.
956
- * In a future version, we will also expose what exactly changed in the {@link LiveList}.
957
- *
958
- * @param callback the callback this called when the {@link LiveList} changes.
959
- *
960
- * @returns Unsubscribe function.
961
- *
962
- * @example
963
- * const liveList = new LiveList();
964
- * const unsubscribe = room.subscribe(liveList, (liveList) => { }, { isDeep: true });
965
- * unsubscribe();
966
- */
967
- <TItem extends Lson>(
968
- liveList: LiveList<TItem>,
969
- callback: (updates: LiveListUpdates<TItem>[]) => void,
722
+ <L extends LiveStructure>(
723
+ liveStructure: L,
724
+ callback: StorageCallback,
970
725
  options: {
971
726
  isDeep: true;
972
727
  }
@@ -983,7 +738,7 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject> = {
983
738
  * @example
984
739
  * const user = room.getSelf();
985
740
  */
986
- getSelf(): User<TPresence> | null;
741
+ getSelf(): User<TPresence, TUserMeta> | null;
987
742
  /**
988
743
  * Gets the presence of the current user.
989
744
  *
@@ -997,7 +752,7 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject> = {
997
752
  * @example
998
753
  * const others = room.getOthers();
999
754
  */
1000
- getOthers: () => Others<TPresence>;
755
+ getOthers: () => Others<TPresence, TUserMeta>;
1001
756
  /**
1002
757
  * Updates the presence of the current user. Only pass the properties you want to update. No need to send the full presence.
1003
758
  * @param overrides A partial object that contains the properties you want to update.
@@ -1034,7 +789,7 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject> = {
1034
789
  * }
1035
790
  * });
1036
791
  */
1037
- broadcastEvent: (event: Json, options?: BroadcastOptions) => void;
792
+ broadcastEvent: (event: TRoomEvent, options?: BroadcastOptions) => void;
1038
793
  /**
1039
794
  * Get the room's storage asynchronously.
1040
795
  * The storage's root is a {@link LiveObject}.
@@ -1042,13 +797,7 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject> = {
1042
797
  * @example
1043
798
  * const { root } = await room.getStorage();
1044
799
  */
1045
- getStorage: <
1046
- /**
1047
- * @deprecated This type argument is ignored. If you want to annotate this
1048
- * type manually, please annotate the Room instance instead.
1049
- */
1050
- _ = unknown
1051
- >() => Promise<{
800
+ getStorage: () => Promise<{
1052
801
  root: LiveObject<TStorage>;
1053
802
  }>;
1054
803
  /**
@@ -1078,54 +827,29 @@ declare enum WebsocketCloseCodes {
1078
827
  }
1079
828
 
1080
829
  export {
1081
- SerializedRootObject as A,
1082
- BroadcastOptions as B,
830
+ BaseUserMeta as B,
1083
831
  ClientOptions as C,
1084
- DeleteCrdtOp as D,
1085
- SetParentKeyOp as E,
1086
- UpdateObjectOp as F,
1087
- CrdtType as G,
1088
832
  History as H,
1089
- IdTuple as I,
1090
833
  Json as J,
1091
- OpCode as K,
1092
834
  LiveList as L,
1093
- isJsonArray as M,
1094
- NodeMap as N,
1095
835
  Others as O,
1096
836
  Presence as P,
1097
- isJsonObject as Q,
1098
837
  Room as R,
1099
838
  StorageUpdate as S,
1100
- isJsonScalar as T,
1101
839
  User as U,
1102
- isChildCrdt as V,
1103
840
  WebsocketCloseCodes as W,
1104
- isRootCrdt as X,
1105
841
  Client as a,
1106
842
  LiveMap as b,
1107
843
  LiveObject as c,
1108
- JsonObject as d,
1109
- LiveStructure as e,
1110
- Lson as f,
1111
- LsonObject as g,
1112
- Op as h,
1113
- SerializedCrdt as i,
1114
- CreateChildOp as j,
1115
- CreateListOp as k,
1116
- CreateMapOp as l,
1117
- CreateObjectOp as m,
1118
- CreateOp as n,
1119
- CreateRegisterOp as o,
1120
- CreateRootObjectOp as p,
1121
- DeleteObjectKeyOp as q,
1122
- LiveNode as r,
1123
- ParentToChildNodeMap as s,
1124
- Resolve as t,
1125
- RoomInitializers as u,
1126
- SerializedChild as v,
1127
- SerializedList as w,
1128
- SerializedMap as x,
1129
- SerializedObject as y,
1130
- SerializedRegister as z,
844
+ BroadcastOptions as d,
845
+ JsonObject as e,
846
+ LiveStructure as f,
847
+ Lson as g,
848
+ LsonObject as h,
849
+ LiveNode as i,
850
+ Resolve as j,
851
+ RoomInitializers as k,
852
+ isJsonArray as l,
853
+ isJsonObject as m,
854
+ isJsonScalar as n,
1131
855
  };