@liveblocks/client 0.16.4-beta2 → 0.16.4

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/package.json CHANGED
@@ -1,10 +1,22 @@
1
1
  {
2
2
  "name": "@liveblocks/client",
3
- "version": "0.16.4-beta2",
3
+ "version": "0.16.4",
4
4
  "description": "A client that lets you interact with Liveblocks servers.",
5
5
  "main": "./index.js",
6
6
  "module": "./index.mjs",
7
7
  "types": "./index.d.ts",
8
+ "exports": {
9
+ "./internal": {
10
+ "types": "./internal.d.ts",
11
+ "require": "./internal.js",
12
+ "import": "./internal.mjs"
13
+ },
14
+ ".": {
15
+ "types": "./index.d.ts",
16
+ "require": "./index.js",
17
+ "import": "./index.mjs"
18
+ }
19
+ },
8
20
  "files": [
9
21
  "**"
10
22
  ],
package/shared.d.ts CHANGED
@@ -291,6 +291,27 @@ declare type BroadcastOptions = {
291
291
  * in-client.
292
292
  */
293
293
  declare type StorageUpdate = LiveMapUpdates<string, Lson> | LiveObjectUpdates<LsonObject> | LiveListUpdates<Lson>;
294
+ declare type RoomInitializers<TPresence, TStorage> = Resolve<{
295
+ /**
296
+ * The initial Presence to use and announce when you enter the Room. The
297
+ * Presence is available on all users in the Room (me & others).
298
+ */
299
+ initialPresence?: TPresence | ((roomId: string) => TPresence);
300
+ /**
301
+ * The initial Storage to use when entering a new Room.
302
+ */
303
+ initialStorage?: TStorage | ((roomId: string) => TStorage);
304
+ /**
305
+ * @deprecated Please use `initialPresence` instead. This property is
306
+ * scheduled for removal in 0.18.
307
+ */
308
+ defaultPresence?: () => TPresence;
309
+ /**
310
+ * @deprecated Please use `initialStorage` instead. This property is
311
+ * scheduled for removal in 0.18.
312
+ */
313
+ defaultStorageRoot?: TStorage;
314
+ }>;
294
315
  declare type Client = {
295
316
  /**
296
317
  * Gets a room. Returns null if {@link Client.enter} has not been called previously.
@@ -301,12 +322,9 @@ declare type Client = {
301
322
  /**
302
323
  * Enters a room and returns it.
303
324
  * @param roomId The id of the room
304
- * @param defaultPresence Optional. Should be serializable to JSON. If omitted, an empty object will be used.
325
+ * @param options Optional. You can provide initializers for the Presence or Storage when entering the Room.
305
326
  */
306
- enter<TStorage extends Record<string, any> = Record<string, any>>(roomId: string, options?: {
307
- defaultPresence?: Presence;
308
- defaultStorageRoot?: TStorage;
309
- }): Room;
327
+ enter<TStorage extends Record<string, any> = Record<string, any>>(roomId: string, options?: RoomInitializers<Presence, TStorage>): Room;
310
328
  /**
311
329
  * Leaves a room.
312
330
  * @param roomId The id of the room
@@ -750,4 +768,4 @@ declare class LiveObject<O extends LsonObject = LsonObject> extends AbstractCrdt
750
768
  update(overrides: Partial<O>): void;
751
769
  }
752
770
 
753
- export { BroadcastOptions as B, ClientOptions as C, History as H, Json as J, LiveObject as L, Others as O, Presence as P, Room as R, StorageUpdate as S, User as U, Client as a, LiveMap as b, LiveList as c, JsonObject as d, Lson as e, LsonObject as f, Resolve as g };
771
+ export { AbstractCrdt as A, BroadcastOptions as B, ClientOptions as C, History as H, Json as J, LiveObject as L, Others as O, Presence as P, Room as R, StorageUpdate as S, User as U, Client as a, LiveMap as b, LiveList as c, JsonObject as d, Lson as e, LsonObject as f, Resolve as g, RoomInitializers as h };
package/shared.js CHANGED
@@ -1558,7 +1558,7 @@ function deprecate(message, key) {
1558
1558
  if (!_emittedDeprecationWarnings.has(key)) {
1559
1559
  _emittedDeprecationWarnings.add(key);
1560
1560
 
1561
- console.warn("DEPRECATION WARNING: " + message);
1561
+ console.error("DEPRECATION WARNING: " + message);
1562
1562
  }
1563
1563
  }
1564
1564
  }
@@ -2469,7 +2469,6 @@ exports._inheritsLoose = _inheritsLoose;
2469
2469
  exports._objectWithoutPropertiesLoose = _objectWithoutPropertiesLoose;
2470
2470
  exports._wrapNativeSuper = _wrapNativeSuper;
2471
2471
  exports.compact = compact;
2472
- exports.compare = compare;
2473
2472
  exports.deprecate = deprecate;
2474
2473
  exports.deprecateIf = deprecateIf;
2475
2474
  exports.findNonSerializableValue = findNonSerializableValue;
@@ -2478,11 +2477,6 @@ exports.isJsonArray = isJsonArray;
2478
2477
  exports.isJsonObject = isJsonObject;
2479
2478
  exports.isSameNodeOrChildOf = isSameNodeOrChildOf;
2480
2479
  exports.isTokenValid = isTokenValid;
2481
- exports.makePosition = makePosition;
2482
- exports.max = max;
2483
2480
  exports.mergeStorageUpdates = mergeStorageUpdates;
2484
- exports.min = min;
2485
2481
  exports.parseJson = parseJson;
2486
- exports.pos = pos;
2487
- exports.posCodes = posCodes;
2488
2482
  exports.remove = remove;
package/shared.mjs CHANGED
@@ -1183,7 +1183,7 @@ function deprecate(message, key = message) {
1183
1183
  if (process.env.NODE_ENV !== "production") {
1184
1184
  if (!_emittedDeprecationWarnings.has(key)) {
1185
1185
  _emittedDeprecationWarnings.add(key);
1186
- console.warn(`DEPRECATION WARNING: ${message}`);
1186
+ console.error(`DEPRECATION WARNING: ${message}`);
1187
1187
  }
1188
1188
  }
1189
1189
  }
@@ -1944,4 +1944,4 @@ class LiveObject extends AbstractCrdt {
1944
1944
  }
1945
1945
  }
1946
1946
 
1947
- export { AbstractCrdt as A, ClientMessageType as C, LiveObject as L, OpType as O, ServerMessageType as S, WebsocketCloseCodes as W, isSameNodeOrChildOf as a, LiveList as b, isJsonArray as c, compact as d, isJsonObject as e, LiveMap as f, getTreesDiffOperations as g, LiveRegister as h, isTokenValid as i, findNonSerializableValue as j, deprecate as k, deprecateIf as l, mergeStorageUpdates as m, CrdtType as n, min as o, parseJson as p, max as q, remove as r, makePosition as s, posCodes as t, pos as u, compare as v };
1947
+ export { AbstractCrdt as A, ClientMessageType as C, LiveObject as L, OpType as O, ServerMessageType as S, WebsocketCloseCodes as W, isSameNodeOrChildOf as a, LiveList as b, isJsonArray as c, compact as d, isJsonObject as e, deprecateIf as f, getTreesDiffOperations as g, LiveMap as h, isTokenValid as i, LiveRegister as j, findNonSerializableValue as k, CrdtType as l, mergeStorageUpdates as m, deprecate as n, parseJson as p, remove as r };