@liveblocks/core 1.5.2 → 1.5.3-test1

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.mjs CHANGED
@@ -6,7 +6,7 @@ var __export = (target, all) => {
6
6
 
7
7
  // src/version.ts
8
8
  var PKG_NAME = "@liveblocks/core";
9
- var PKG_VERSION = "1.5.2";
9
+ var PKG_VERSION = "1.5.3-test1";
10
10
  var PKG_FORMAT = "esm";
11
11
 
12
12
  // src/dupe-detection.ts
@@ -3759,17 +3759,14 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
3759
3759
  }
3760
3760
  const opId = pool?.generateOpId();
3761
3761
  const ops = [];
3762
- const op = parentId !== void 0 && parentKey !== void 0 ? {
3762
+ const op = {
3763
3763
  type: 4 /* CREATE_OBJECT */,
3764
3764
  id: this._id,
3765
3765
  opId,
3766
3766
  parentId,
3767
3767
  parentKey,
3768
3768
  data: {}
3769
- } : (
3770
- // Root object
3771
- { type: 4 /* CREATE_OBJECT */, id: this._id, opId, data: {} }
3772
- );
3769
+ };
3773
3770
  ops.push(op);
3774
3771
  for (const [key, value] of this._map) {
3775
3772
  if (isLiveNode(value)) {
@@ -4377,18 +4374,18 @@ function getTreesDiffOperations(currentItems, newItems) {
4377
4374
  });
4378
4375
  break;
4379
4376
  case 0 /* OBJECT */:
4380
- ops.push(
4381
- crdt.parentId ? {
4382
- type: 4 /* CREATE_OBJECT */,
4383
- id,
4384
- parentId: crdt.parentId,
4385
- parentKey: crdt.parentKey,
4386
- data: crdt.data
4387
- } : (
4388
- // Root object
4389
- { type: 4 /* CREATE_OBJECT */, id, data: crdt.data }
4390
- )
4391
- );
4377
+ if (crdt.parentId === void 0 || crdt.parentKey === void 0) {
4378
+ throw new Error(
4379
+ "Internal error. Cannot serialize storage root into an operation"
4380
+ );
4381
+ }
4382
+ ops.push({
4383
+ type: 4 /* CREATE_OBJECT */,
4384
+ id,
4385
+ parentId: crdt.parentId,
4386
+ parentKey: crdt.parentKey,
4387
+ data: crdt.data
4388
+ });
4392
4389
  break;
4393
4390
  case 2 /* MAP */:
4394
4391
  ops.push({