@liveblocks/client 0.16.14 → 0.16.15

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/internal.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { d as JsonObject, J as Json, g as Resolve, e as Lson, A as AbstractCrdt, f as LsonObject, L as LiveObject, S as StorageUpdate } from './shared';
2
- export { g as Resolve, h as RoomInitializers } from './shared';
2
+ export { g as Resolve, h as RoomInitializers, i as isJsonArray, j as isJsonObject, k as isJsonScalar } from './shared';
3
3
 
4
4
  declare type IdTuple<T> = [id: string, value: T];
5
5
  /**
package/internal.js CHANGED
@@ -168,10 +168,11 @@ Object.defineProperty(exports, "ClientMsgCode", {
168
168
  }), exports.assertNever = LiveObject.assertNever, exports.b64decode = LiveObject.b64decode,
169
169
  exports.comparePosition = LiveObject.comparePosition, exports.deprecate = LiveObject.deprecate,
170
170
  exports.deprecateIf = LiveObject.deprecateIf, exports.errorIf = LiveObject.errorIf,
171
- exports.isChildCrdt = LiveObject.isChildCrdt, exports.isRootCrdt = LiveObject.isRootCrdt,
172
- exports.makePosition = LiveObject.makePosition, exports.throwUsageError = LiveObject.throwUsageError,
173
- exports.tryParseJson = LiveObject.tryParseJson, exports.lsonToJson = lsonToJson,
174
- exports.patchImmutableObject = function(state, updates) {
171
+ exports.isChildCrdt = LiveObject.isChildCrdt, exports.isJsonArray = LiveObject.isJsonArray,
172
+ exports.isJsonObject = LiveObject.isJsonObject, exports.isJsonScalar = LiveObject.isJsonScalar,
173
+ exports.isRootCrdt = LiveObject.isRootCrdt, exports.makePosition = LiveObject.makePosition,
174
+ exports.throwUsageError = LiveObject.throwUsageError, exports.tryParseJson = LiveObject.tryParseJson,
175
+ exports.lsonToJson = lsonToJson, exports.patchImmutableObject = function(state, updates) {
175
176
  return updates.reduce((function(state, update) {
176
177
  return function(state, update) {
177
178
  var path = function(node) {
package/internal.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { L as LiveObject, b as LiveList, k as LiveMap, l as LiveRegister, A as AbstractCrdt, n as findNonSerializableValue } from "./shared.mjs";
2
2
 
3
- export { C as ClientMsgCode, s as CrdtType, O as OpCode, S as ServerMsgCode, W as WebsocketCloseCodes, x as assertNever, e as b64decode, u as comparePosition, o as deprecate, j as deprecateIf, p as errorIf, w as isChildCrdt, h as isRootCrdt, v as makePosition, q as throwUsageError, t as tryParseJson } from "./shared.mjs";
3
+ export { C as ClientMsgCode, s as CrdtType, O as OpCode, S as ServerMsgCode, W as WebsocketCloseCodes, x as assertNever, e as b64decode, u as comparePosition, o as deprecate, j as deprecateIf, p as errorIf, w as isChildCrdt, c as isJsonArray, f as isJsonObject, y as isJsonScalar, h as isRootCrdt, v as makePosition, q as throwUsageError, t as tryParseJson } from "./shared.mjs";
4
4
 
5
5
  function lsonObjectToJson(obj) {
6
6
  const result = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liveblocks/client",
3
- "version": "0.16.14",
3
+ "version": "0.16.15",
4
4
  "description": "A client that lets you interact with Liveblocks servers.",
5
5
  "main": "./index.js",
6
6
  "module": "./index.mjs",
package/shared.d.ts CHANGED
@@ -14,6 +14,9 @@ declare type JsonArray = Json[];
14
14
  declare type JsonObject = {
15
15
  [key: string]: Json | undefined;
16
16
  };
17
+ declare function isJsonScalar(data: Json): data is JsonScalar;
18
+ declare function isJsonArray(data: Json): data is JsonArray;
19
+ declare function isJsonObject(data: Json): data is JsonObject;
17
20
 
18
21
  /**
19
22
  * The LiveMap class is similar to a JavaScript Map that is synchronized on all clients.
@@ -780,4 +783,4 @@ declare class LiveObject<O extends LsonObject = LsonObject> extends AbstractCrdt
780
783
  update(overrides: Partial<O>): void;
781
784
  }
782
785
 
783
- 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 };
786
+ 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, isJsonArray as i, isJsonObject as j, isJsonScalar as k };
package/shared.js CHANGED
@@ -197,12 +197,16 @@ var AbstractCrdt = function() {
197
197
  } ]), AbstractCrdt;
198
198
  }();
199
199
 
200
+ function isJsonScalar(data) {
201
+ return null === data || "string" == typeof data || "number" == typeof data || "boolean" == typeof data;
202
+ }
203
+
200
204
  function isJsonArray(data) {
201
205
  return Array.isArray(data);
202
206
  }
203
207
 
204
208
  function isJsonObject(data) {
205
- return null !== data && "object" == typeof data && !isJsonArray(data);
209
+ return !isJsonScalar(data) && !isJsonArray(data);
206
210
  }
207
211
 
208
212
  var _Symbol$iterator$1, _Symbol$iterator2, LiveRegister = function(_AbstractCrdt) {
@@ -1366,7 +1370,7 @@ exports.errorIf = function(condition, message) {
1366
1370
  }
1367
1371
  })), ops;
1368
1372
  }, exports.isChildCrdt = isChildCrdt, exports.isJsonArray = isJsonArray, exports.isJsonObject = isJsonObject,
1369
- exports.isRootCrdt = function(crdt) {
1373
+ exports.isJsonScalar = isJsonScalar, exports.isRootCrdt = function(crdt) {
1370
1374
  return crdt.type === exports.CrdtType.OBJECT && !isChildCrdt(crdt);
1371
1375
  }, exports.isSameNodeOrChildOf = function isSameNodeOrChildOf(node, parent) {
1372
1376
  return node === parent || !!node._parent && isSameNodeOrChildOf(node._parent, parent);
package/shared.mjs CHANGED
@@ -70,12 +70,16 @@ class AbstractCrdt {
70
70
  }
71
71
  }
72
72
 
73
+ function isJsonScalar(data) {
74
+ return null === data || "string" == typeof data || "number" == typeof data || "boolean" == typeof data;
75
+ }
76
+
73
77
  function isJsonArray(data) {
74
78
  return Array.isArray(data);
75
79
  }
76
80
 
77
81
  function isJsonObject(data) {
78
- return null !== data && "object" == typeof data && !isJsonArray(data);
82
+ return !isJsonScalar(data) && !isJsonArray(data);
79
83
  }
80
84
 
81
85
  class LiveRegister extends AbstractCrdt {
@@ -1273,4 +1277,4 @@ class LiveObject extends AbstractCrdt {
1273
1277
  }
1274
1278
  }
1275
1279
 
1276
- export { AbstractCrdt as A, ClientMsgCode as C, LiveObject as L, OpCode as O, ServerMsgCode as S, WebsocketCloseCodes as W, isSameNodeOrChildOf as a, LiveList as b, isJsonArray as c, compact as d, b64decode as e, isJsonObject as f, getTreesDiffOperations as g, isRootCrdt as h, isTokenValid as i, deprecateIf as j, LiveMap as k, LiveRegister as l, mergeStorageUpdates as m, findNonSerializableValue as n, deprecate as o, errorIf as p, throwUsageError as q, remove as r, CrdtType as s, tryParseJson as t, comparePosition as u, makePosition as v, isChildCrdt as w, assertNever as x };
1280
+ export { AbstractCrdt as A, ClientMsgCode as C, LiveObject as L, OpCode as O, ServerMsgCode as S, WebsocketCloseCodes as W, isSameNodeOrChildOf as a, LiveList as b, isJsonArray as c, compact as d, b64decode as e, isJsonObject as f, getTreesDiffOperations as g, isRootCrdt as h, isTokenValid as i, deprecateIf as j, LiveMap as k, LiveRegister as l, mergeStorageUpdates as m, findNonSerializableValue as n, deprecate as o, errorIf as p, throwUsageError as q, remove as r, CrdtType as s, tryParseJson as t, comparePosition as u, makePosition as v, isChildCrdt as w, assertNever as x, isJsonScalar as y };