@liveblocks/client 0.15.9 → 0.15.11

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/lib/index.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * The LiveList class represents an ordered collection of items that is synchorinized across clients.
3
3
  */
4
4
  declare class LiveList<T> extends AbstractCrdt {
5
- #private;
5
+ private _items;
6
6
  constructor(items?: T[]);
7
7
  /**
8
8
  * Returns the number of elements.
@@ -105,7 +105,7 @@ declare class LiveList<T> extends AbstractCrdt {
105
105
  * If multiple clients update the same property simultaneously, the last modification received by the Liveblocks servers is the winner.
106
106
  */
107
107
  declare class LiveMap<TKey extends string, TValue> extends AbstractCrdt {
108
- #private;
108
+ private _map;
109
109
  constructor(entries?: readonly (readonly [TKey, TValue])[] | null | undefined);
110
110
  /**
111
111
  * Returns a specified element from the LiveMap.
@@ -232,20 +232,27 @@ declare type Client = {
232
232
  */
233
233
  leave(roomId: string): void;
234
234
  };
235
- declare type ReadonlyArrayWithLegacyMethods<T> = readonly T[] & {
235
+ /**
236
+ * Represents all the other users connected in the room. Treated as immutable.
237
+ */
238
+ interface Others<TPresence extends Presence = Presence> {
236
239
  /**
237
- * @deprecated Prefer the normal .length property on arrays.
240
+ * Number of other users in the room.
238
241
  */
239
242
  readonly count: number;
240
243
  /**
241
- * @deprecated Calling .toArray() is no longer needed
244
+ * Returns a new Iterator object that contains the users.
242
245
  */
243
- toArray(): T[];
244
- };
245
- /**
246
- * A read-only array containing all other users connected to the room.
247
- */
248
- declare type Others<P extends Presence = Presence> = ReadonlyArrayWithLegacyMethods<User<P>>;
246
+ [Symbol.iterator](): IterableIterator<User<TPresence>>;
247
+ /**
248
+ * Returns the array of connected users in room.
249
+ */
250
+ toArray(): User<TPresence>[];
251
+ /**
252
+ * This function let you map over the connected users in the room.
253
+ */
254
+ map<U>(callback: (user: User<TPresence>) => U): U[];
255
+ }
249
256
  /**
250
257
  * Represents a user connected in a room. Treated as immutable.
251
258
  */
@@ -268,9 +275,7 @@ declare type User<TPresence extends Presence = Presence> = {
268
275
  */
269
276
  readonly presence?: TPresence;
270
277
  };
271
- declare type Presence = {
272
- [key: string]: any;
273
- };
278
+ declare type Presence = Record<string, unknown>;
274
279
  declare type AuthEndpointCallback = (room: string) => Promise<{
275
280
  token: string;
276
281
  }>;
@@ -618,7 +623,10 @@ declare type Room = {
618
623
  };
619
624
 
620
625
  declare abstract class AbstractCrdt {
621
- #private;
626
+ private __parent?;
627
+ private __doc?;
628
+ private __id?;
629
+ private __parentKey?;
622
630
  get roomId(): string | null;
623
631
  }
624
632
 
@@ -628,8 +636,11 @@ declare abstract class AbstractCrdt {
628
636
  * If multiple clients update the same property simultaneously, the last modification received by the Liveblocks servers is the winner.
629
637
  */
630
638
  declare class LiveObject<T extends Record<string, any> = Record<string, any>> extends AbstractCrdt {
631
- #private;
639
+ private _map;
640
+ private _propToLastUpdate;
632
641
  constructor(object?: T);
642
+ private _applyUpdate;
643
+ private _applyDeleteObjectKey;
633
644
  /**
634
645
  * Transform the LiveObject into a javascript object
635
646
  */