@liveblocks/core 1.1.1-dual2 → 1.1.1-dual3

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.js CHANGED
@@ -145,7 +145,7 @@ var onMessageFromPanel = eventSource.observable;
145
145
  // src/devtools/index.ts
146
146
  var VERSION = true ? (
147
147
  /* istanbul ignore next */
148
- "1.1.1-dual2"
148
+ "1.1.1-dual3"
149
149
  ) : "dev";
150
150
  var _devtoolsSetupHasRun = false;
151
151
  function setupDevTools(getAllRooms) {
@@ -5305,7 +5305,7 @@ function makeCreateSocketDelegateForRoom(liveblocksServer, WebSocketPolyfill) {
5305
5305
  // @ts-ignore (__PACKAGE_VERSION__ will be injected by the build script)
5306
5306
  true ? (
5307
5307
  /* istanbul ignore next */
5308
- "1.1.1-dual2"
5308
+ "1.1.1-dual3"
5309
5309
  ) : "dev"}`
5310
5310
  );
5311
5311
  };
@@ -5570,6 +5570,35 @@ function buildLiveblocksPublicAuthorizeEndpoint(options, roomId) {
5570
5570
  )}/public/authorize`;
5571
5571
  }
5572
5572
 
5573
+ // src/crdts/utils.ts
5574
+ function toPlainLson(lson) {
5575
+ if (lson instanceof LiveObject) {
5576
+ return {
5577
+ liveblocksType: "LiveObject",
5578
+ data: Object.fromEntries(
5579
+ Object.entries(lson.toObject()).map(([key, value]) => [
5580
+ key,
5581
+ value ? toPlainLson(value) : ""
5582
+ ])
5583
+ )
5584
+ };
5585
+ } else if (lson instanceof LiveMap) {
5586
+ return {
5587
+ liveblocksType: "LiveMap",
5588
+ data: Object.fromEntries(
5589
+ [...lson].map(([key, value]) => [key, toPlainLson(value)])
5590
+ )
5591
+ };
5592
+ } else if (lson instanceof LiveList) {
5593
+ return {
5594
+ liveblocksType: "LiveList",
5595
+ data: [...lson].map((item) => toPlainLson(item))
5596
+ };
5597
+ } else {
5598
+ return lson;
5599
+ }
5600
+ }
5601
+
5573
5602
  // src/immutable.ts
5574
5603
  function lsonObjectToJson(obj) {
5575
5604
  const result = {};
@@ -5958,4 +5987,5 @@ var WebsocketCloseCodes = /* @__PURE__ */ ((WebsocketCloseCodes2) => {
5958
5987
 
5959
5988
 
5960
5989
 
5961
- exports.ClientMsgCode = ClientMsgCode; exports.CrdtType = CrdtType; exports.LiveList = LiveList; exports.LiveMap = LiveMap; exports.LiveObject = LiveObject; exports.OpCode = OpCode; exports.ServerMsgCode = ServerMsgCode; exports.WebsocketCloseCodes = WebsocketCloseCodes; exports.asArrayWithLegacyMethods = asArrayWithLegacyMethods; exports.asPos = asPos; exports.assert = assert; exports.assertNever = assertNever; exports.b64decode = b64decode; exports.createClient = createClient; exports.deprecate = deprecate; exports.deprecateIf = deprecateIf; exports.errorIf = errorIf; exports.freeze = freeze; exports.isChildCrdt = isChildCrdt; exports.isJsonArray = isJsonArray; exports.isJsonObject = isJsonObject; exports.isJsonScalar = isJsonScalar; exports.isPlainObject = isPlainObject; exports.isRootCrdt = isRootCrdt; exports.legacy_patchImmutableObject = legacy_patchImmutableObject; exports.lsonToJson = lsonToJson; exports.makePosition = makePosition; exports.nn = nn; exports.patchLiveObjectKey = patchLiveObjectKey; exports.shallow = shallow; exports.throwUsageError = throwUsageError; exports.tryParseJson = tryParseJson; exports.withTimeout = withTimeout;
5990
+
5991
+ exports.ClientMsgCode = ClientMsgCode; exports.CrdtType = CrdtType; exports.LiveList = LiveList; exports.LiveMap = LiveMap; exports.LiveObject = LiveObject; exports.OpCode = OpCode; exports.ServerMsgCode = ServerMsgCode; exports.WebsocketCloseCodes = WebsocketCloseCodes; exports.asArrayWithLegacyMethods = asArrayWithLegacyMethods; exports.asPos = asPos; exports.assert = assert; exports.assertNever = assertNever; exports.b64decode = b64decode; exports.createClient = createClient; exports.deprecate = deprecate; exports.deprecateIf = deprecateIf; exports.errorIf = errorIf; exports.freeze = freeze; exports.isChildCrdt = isChildCrdt; exports.isJsonArray = isJsonArray; exports.isJsonObject = isJsonObject; exports.isJsonScalar = isJsonScalar; exports.isPlainObject = isPlainObject; exports.isRootCrdt = isRootCrdt; exports.legacy_patchImmutableObject = legacy_patchImmutableObject; exports.lsonToJson = lsonToJson; exports.makePosition = makePosition; exports.nn = nn; exports.patchLiveObjectKey = patchLiveObjectKey; exports.shallow = shallow; exports.throwUsageError = throwUsageError; exports.toPlainLson = toPlainLson; exports.tryParseJson = tryParseJson; exports.withTimeout = withTimeout;
package/dist/index.mjs CHANGED
@@ -145,7 +145,7 @@ var onMessageFromPanel = eventSource.observable;
145
145
  // src/devtools/index.ts
146
146
  var VERSION = true ? (
147
147
  /* istanbul ignore next */
148
- "1.1.1-dual2"
148
+ "1.1.1-dual3"
149
149
  ) : "dev";
150
150
  var _devtoolsSetupHasRun = false;
151
151
  function setupDevTools(getAllRooms) {
@@ -5305,7 +5305,7 @@ function makeCreateSocketDelegateForRoom(liveblocksServer, WebSocketPolyfill) {
5305
5305
  // @ts-ignore (__PACKAGE_VERSION__ will be injected by the build script)
5306
5306
  true ? (
5307
5307
  /* istanbul ignore next */
5308
- "1.1.1-dual2"
5308
+ "1.1.1-dual3"
5309
5309
  ) : "dev"}`
5310
5310
  );
5311
5311
  };
@@ -5570,6 +5570,35 @@ function buildLiveblocksPublicAuthorizeEndpoint(options, roomId) {
5570
5570
  )}/public/authorize`;
5571
5571
  }
5572
5572
 
5573
+ // src/crdts/utils.ts
5574
+ function toPlainLson(lson) {
5575
+ if (lson instanceof LiveObject) {
5576
+ return {
5577
+ liveblocksType: "LiveObject",
5578
+ data: Object.fromEntries(
5579
+ Object.entries(lson.toObject()).map(([key, value]) => [
5580
+ key,
5581
+ value ? toPlainLson(value) : ""
5582
+ ])
5583
+ )
5584
+ };
5585
+ } else if (lson instanceof LiveMap) {
5586
+ return {
5587
+ liveblocksType: "LiveMap",
5588
+ data: Object.fromEntries(
5589
+ [...lson].map(([key, value]) => [key, toPlainLson(value)])
5590
+ )
5591
+ };
5592
+ } else if (lson instanceof LiveList) {
5593
+ return {
5594
+ liveblocksType: "LiveList",
5595
+ data: [...lson].map((item) => toPlainLson(item))
5596
+ };
5597
+ } else {
5598
+ return lson;
5599
+ }
5600
+ }
5601
+
5573
5602
  // src/immutable.ts
5574
5603
  function lsonObjectToJson(obj) {
5575
5604
  const result = {};
@@ -5956,6 +5985,7 @@ export {
5956
5985
  patchLiveObjectKey,
5957
5986
  shallow,
5958
5987
  throwUsageError,
5988
+ toPlainLson,
5959
5989
  tryParseJson,
5960
5990
  withTimeout
5961
5991
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liveblocks/core",
3
- "version": "1.1.1-dual2",
3
+ "version": "1.1.1-dual3",
4
4
  "description": "Shared code and foundational internals for Liveblocks",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",