@liveblocks/core 1.0.6-test3 → 1.0.6

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.
Files changed (3) hide show
  1. package/dist/index.d.ts +76 -14
  2. package/dist/index.js +169 -159
  3. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1236,20 +1236,10 @@ declare function errorIf(condition: unknown, message: string): void;
1236
1236
  */
1237
1237
  declare const freeze: typeof Object.freeze;
1238
1238
 
1239
- declare function makePosition(before?: string, after?: string): string;
1240
- declare function comparePosition(posA: string, posB: string): number;
1241
-
1242
- /**
1243
- * Shallowly compares two given values.
1244
- *
1245
- * - Two simple values are considered equal if they're strictly equal
1246
- * - Two arrays are considered equal if their members are strictly equal
1247
- * - Two objects are considered equal if their values are strictly equal
1248
- *
1249
- * Testing goes one level deep.
1250
- */
1251
- declare function shallow(a: unknown, b: unknown): boolean;
1252
-
1239
+ declare const brand: unique symbol;
1240
+ declare type Brand<T, TBrand extends string> = T & {
1241
+ [brand]: TBrand;
1242
+ };
1253
1243
  declare function isPlainObject(blob: unknown): blob is {
1254
1244
  [key: string]: unknown;
1255
1245
  };
@@ -1263,6 +1253,78 @@ declare function tryParseJson(rawMessage: string): Json | undefined;
1263
1253
  */
1264
1254
  declare function b64decode(b64value: string): string;
1265
1255
 
1256
+ /**
1257
+ * Positions, aka the Pos type, are efficient encodings of "positions" in
1258
+ * a list, using the following printable subset of the ASCII alphabet:
1259
+ *
1260
+ * !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
1261
+ * ^ ^
1262
+ * Lowest digit Highest digit
1263
+ *
1264
+ * Each Pos is a sequence of characters from the above alphabet, conceptually
1265
+ * codifying a floating point number 0 < n < 1. For example, the string "31007"
1266
+ * would be used to represent the number 0.31007, except that this
1267
+ * representation uses base 96.
1268
+ *
1269
+ * 0 ≃ ' ' (lowest digit)
1270
+ * 1 ≃ '!'
1271
+ * 2 ≃ '"'
1272
+ * ...
1273
+ * 9 ≃ '~' (highest digit)
1274
+ *
1275
+ * So think:
1276
+ * '!' ≃ 0.1
1277
+ * '"' ≃ 0.2
1278
+ * '!"~' ≃ 0.129
1279
+ *
1280
+ * Three rules:
1281
+ * - All "characters" in the string should be valid digits (from the above
1282
+ * alphabet)
1283
+ * - The value 0.0 is not a valid Pos value
1284
+ * - A Pos cannot have trailing "zeroes"
1285
+ *
1286
+ * This representation has the following benefits:
1287
+ *
1288
+ * 1. It's always possible to get a number that lies before, after, or between
1289
+ * two arbitrary Pos values.
1290
+ * 2. Pos values can be compared using normal string comparison.
1291
+ *
1292
+ * Some examples:
1293
+ * - '!' < '"' (like how .1 < .2)
1294
+ * - '!' < '~' (like how .1 < .9)
1295
+ * - '!!' < '!~' (like how .11 < .19)
1296
+ * - '~!' < '~~' (like how .91 < .99)
1297
+ * - '~' < '~!' (like how .9 < .91)
1298
+ * - '!!' < '!O' (like how .1 < .5)
1299
+ * - '!O' < '!~' (like how .5 < .9)
1300
+ *
1301
+ */
1302
+
1303
+ /**
1304
+ * A valid/verified "position" string. These values are used as "parentKey"s by
1305
+ * LiveList children, and define their relative ordering.
1306
+ */
1307
+ declare type Pos = Brand<string, "Pos">;
1308
+ /**
1309
+ * Given two positions, returns the position value that lies in the middle.
1310
+ * When given only a high bound, computes the canonical position "before" it.
1311
+ * When given only a low bound, computes the canonical position "after" it.
1312
+ * When given no bounds at all, returns the "first" canonical position.
1313
+ */
1314
+ declare function makePosition(x?: Pos, y?: Pos): Pos;
1315
+ declare function comparePosition(posA: Pos, posB: Pos): number;
1316
+
1317
+ /**
1318
+ * Shallowly compares two given values.
1319
+ *
1320
+ * - Two simple values are considered equal if they're strictly equal
1321
+ * - Two arrays are considered equal if their members are strictly equal
1322
+ * - Two objects are considered equal if their values are strictly equal
1323
+ *
1324
+ * Testing goes one level deep.
1325
+ */
1326
+ declare function shallow(a: unknown, b: unknown): boolean;
1327
+
1266
1328
  declare type IdTuple<T> = [id: string, value: T];
1267
1329
  declare enum CrdtType {
1268
1330
  OBJECT = 0,
package/dist/index.js CHANGED
@@ -117,7 +117,7 @@ var onMessageFromPanel = eventSource.observable;
117
117
  // src/devtools/index.ts
118
118
  var VERSION = true ? (
119
119
  /* istanbul ignore next */
120
- "1.0.6-test3"
120
+ "1.0.6"
121
121
  ) : "dev";
122
122
  var _devtoolsSetupHasRun = false;
123
123
  function setupDevTools(getAllRooms) {
@@ -345,6 +345,132 @@ function nn(value, errmsg = "Expected value to be non-nullable") {
345
345
  return value;
346
346
  }
347
347
 
348
+ // src/lib/position.ts
349
+ var MIN_CODE = 32;
350
+ var MAX_CODE = 126;
351
+ var NUM_DIGITS = MAX_CODE - MIN_CODE + 1;
352
+ var ZERO = nthDigit(0);
353
+ var ONE = nthDigit(1);
354
+ var ZERO_NINE = ZERO + nthDigit(-1);
355
+ function nthDigit(n) {
356
+ const code = MIN_CODE + (n < 0 ? NUM_DIGITS + n : n);
357
+ if (code < MIN_CODE || code > MAX_CODE) {
358
+ throw new Error(`Invalid n value: ${n}`);
359
+ }
360
+ return String.fromCharCode(code);
361
+ }
362
+ function makePosition(x, y) {
363
+ if (x !== void 0 && y !== void 0) {
364
+ return between(x, y);
365
+ } else if (x !== void 0) {
366
+ return after(x);
367
+ } else if (y !== void 0) {
368
+ return before(y);
369
+ } else {
370
+ return ONE;
371
+ }
372
+ }
373
+ function before(pos) {
374
+ const lastIndex = pos.length - 1;
375
+ for (let i = 0; i <= lastIndex; i++) {
376
+ const code = pos.charCodeAt(i);
377
+ if (code <= MIN_CODE) {
378
+ continue;
379
+ }
380
+ if (i === lastIndex) {
381
+ if (code === MIN_CODE + 1) {
382
+ return pos.substring(0, i) + ZERO_NINE;
383
+ } else {
384
+ return pos.substring(0, i) + String.fromCharCode(code - 1);
385
+ }
386
+ } else {
387
+ return pos.substring(0, i + 1);
388
+ }
389
+ }
390
+ return ONE;
391
+ }
392
+ function after(pos) {
393
+ for (let i = 0; i <= pos.length - 1; i++) {
394
+ const code = pos.charCodeAt(i);
395
+ if (code >= MAX_CODE) {
396
+ continue;
397
+ }
398
+ return pos.substring(0, i) + String.fromCharCode(code + 1);
399
+ }
400
+ return pos + ONE;
401
+ }
402
+ function between(lo, hi) {
403
+ if (lo < hi) {
404
+ return _between(lo, hi);
405
+ } else if (lo > hi) {
406
+ return _between(hi, lo);
407
+ } else {
408
+ throw new Error("Cannot compute value between two equal positions");
409
+ }
410
+ }
411
+ function _between(lo, hi) {
412
+ let index = 0;
413
+ const loLen = lo.length;
414
+ const hiLen = hi.length;
415
+ while (true) {
416
+ const loCode = index < loLen ? lo.charCodeAt(index) : MIN_CODE;
417
+ const hiCode = index < hiLen ? hi.charCodeAt(index) : MAX_CODE;
418
+ if (loCode === hiCode) {
419
+ index++;
420
+ continue;
421
+ }
422
+ if (hiCode - loCode === 1) {
423
+ const prefix = lo.substring(0, index + 1);
424
+ const suffix = lo.substring(index + 1);
425
+ const nines = "";
426
+ return prefix + _between(suffix, nines);
427
+ } else {
428
+ return takeN(lo, index) + String.fromCharCode(hiCode + loCode >> 1);
429
+ }
430
+ }
431
+ }
432
+ function takeN(pos, n) {
433
+ return n < pos.length ? pos.substring(0, n) : pos + ZERO.repeat(n - pos.length);
434
+ }
435
+ var MIN_NON_ZERO_CODE = MIN_CODE + 1;
436
+ function isPos(str) {
437
+ if (str === "") {
438
+ return false;
439
+ }
440
+ const lastIdx = str.length - 1;
441
+ const last = str.charCodeAt(lastIdx);
442
+ if (last < MIN_NON_ZERO_CODE || last > MAX_CODE) {
443
+ return false;
444
+ }
445
+ for (let i = 0; i < lastIdx; i++) {
446
+ const code = str.charCodeAt(i);
447
+ if (code < MIN_CODE || code > MAX_CODE) {
448
+ return false;
449
+ }
450
+ }
451
+ return true;
452
+ }
453
+ function convertToPos(str) {
454
+ const codes = [];
455
+ for (let i = 0; i < str.length; i++) {
456
+ const code = str.charCodeAt(i);
457
+ codes.push(code < MIN_CODE ? MIN_CODE : code > MAX_CODE ? MAX_CODE : code);
458
+ }
459
+ while (codes.length > 0 && codes[codes.length - 1] === MIN_CODE) {
460
+ codes.length--;
461
+ }
462
+ return codes.length > 0 ? String.fromCharCode(...codes) : (
463
+ // Edge case: the str was a 0-only string, which is invalid. Default back to .1
464
+ ONE
465
+ );
466
+ }
467
+ function asPos(str) {
468
+ return isPos(str) ? str : convertToPos(str);
469
+ }
470
+ function comparePosition(posA, posB) {
471
+ return posA === posB ? 0 : posA < posB ? -1 : 1;
472
+ }
473
+
348
474
  // src/protocol/Op.ts
349
475
  var OpCode = /* @__PURE__ */ ((OpCode2) => {
350
476
  OpCode2[OpCode2["INIT"] = 0] = "INIT";
@@ -366,12 +492,12 @@ function isAckOp(op) {
366
492
  function crdtAsLiveNode(value) {
367
493
  return value;
368
494
  }
369
- function HasParent(node, key) {
370
- return Object.freeze({ type: "HasParent", node, key });
495
+ function HasParent(node, key, pos = asPos(key)) {
496
+ return Object.freeze({ type: "HasParent", node, key, pos });
371
497
  }
372
498
  var NoParent = Object.freeze({ type: "NoParent" });
373
- function Orphaned(oldKey) {
374
- return Object.freeze({ type: "Orphaned", oldKey });
499
+ function Orphaned(oldKey, oldPos = asPos(oldKey)) {
500
+ return Object.freeze({ type: "Orphaned", oldKey, oldPos });
375
501
  }
376
502
  var AbstractCrdt = class {
377
503
  constructor() {
@@ -392,6 +518,19 @@ var AbstractCrdt = class {
392
518
  }
393
519
  }
394
520
  /** @internal */
521
+ get _parentPos() {
522
+ switch (this.parent.type) {
523
+ case "HasParent":
524
+ return this.parent.pos;
525
+ case "NoParent":
526
+ throw new Error("Parent key is missing");
527
+ case "Orphaned":
528
+ return this.parent.oldPos;
529
+ default:
530
+ return assertNever(this.parent, "Unknown state");
531
+ }
532
+ }
533
+ /** @internal */
395
534
  get _pool() {
396
535
  return this.__pool;
397
536
  }
@@ -407,19 +546,6 @@ var AbstractCrdt = class {
407
546
  return this._parent;
408
547
  }
409
548
  /** @internal */
410
- get _parentNode() {
411
- switch (this.parent.type) {
412
- case "HasParent":
413
- return this.parent.node;
414
- case "NoParent":
415
- return null;
416
- case "Orphaned":
417
- return null;
418
- default:
419
- return assertNever(this.parent, "Unknown state");
420
- }
421
- }
422
- /** @internal */
423
549
  get _parentKey() {
424
550
  switch (this.parent.type) {
425
551
  case "HasParent":
@@ -479,7 +605,7 @@ var AbstractCrdt = class {
479
605
  }
480
606
  switch (this.parent.type) {
481
607
  case "HasParent": {
482
- this._parent = Orphaned(this.parent.key);
608
+ this._parent = Orphaned(this.parent.key, this.parent.pos);
483
609
  break;
484
610
  }
485
611
  case "NoParent": {
@@ -487,7 +613,6 @@ var AbstractCrdt = class {
487
613
  break;
488
614
  }
489
615
  case "Orphaned": {
490
- this._parent = Orphaned(this.parent.oldKey);
491
616
  break;
492
617
  }
493
618
  default:
@@ -609,110 +734,6 @@ function nanoid(length = 7) {
609
734
  ).join("");
610
735
  }
611
736
 
612
- // src/lib/position.ts
613
- var min = 32;
614
- var max = 126;
615
- function makePosition(before, after) {
616
- if (before !== void 0 && after !== void 0) {
617
- return pos(makePositionFromCodes(posCodes(before), posCodes(after)));
618
- } else if (before !== void 0) {
619
- return getNextPosition(before);
620
- } else if (after !== void 0) {
621
- return getPreviousPosition(after);
622
- }
623
- return pos([min + 1]);
624
- }
625
- function getPreviousPosition(after) {
626
- const result = [];
627
- const afterCodes = posCodes(after);
628
- for (let i = 0; i < afterCodes.length; i++) {
629
- const code = afterCodes[i];
630
- if (code <= min + 1) {
631
- result.push(min);
632
- if (afterCodes.length - 1 === i) {
633
- result.push(max);
634
- break;
635
- }
636
- } else {
637
- result.push(code - 1);
638
- break;
639
- }
640
- }
641
- return pos(result);
642
- }
643
- function getNextPosition(before) {
644
- const result = [];
645
- const beforeCodes = posCodes(before);
646
- for (let i = 0; i < beforeCodes.length; i++) {
647
- const code = beforeCodes[i];
648
- if (code === max) {
649
- result.push(code);
650
- if (beforeCodes.length - 1 === i) {
651
- result.push(min + 1);
652
- break;
653
- }
654
- } else {
655
- result.push(code + 1);
656
- break;
657
- }
658
- }
659
- return pos(result);
660
- }
661
- function makePositionFromCodes(before, after) {
662
- let index = 0;
663
- const result = [];
664
- while (true) {
665
- const beforeDigit = before[index] || min;
666
- const afterDigit = after[index] || max;
667
- if (beforeDigit > afterDigit) {
668
- throw new Error(
669
- `Impossible to generate position between ${before} and ${after}`
670
- );
671
- }
672
- if (beforeDigit === afterDigit) {
673
- result.push(beforeDigit);
674
- index++;
675
- continue;
676
- }
677
- if (afterDigit - beforeDigit === 1) {
678
- result.push(beforeDigit);
679
- result.push(...makePositionFromCodes(before.slice(index + 1), []));
680
- break;
681
- }
682
- const mid = afterDigit + beforeDigit >> 1;
683
- result.push(mid);
684
- break;
685
- }
686
- return result;
687
- }
688
- function posCodes(str) {
689
- const codes = [];
690
- for (let i = 0; i < str.length; i++) {
691
- codes.push(str.charCodeAt(i));
692
- }
693
- return codes;
694
- }
695
- function pos(codes) {
696
- return String.fromCharCode(...codes);
697
- }
698
- function comparePosition(posA, posB) {
699
- const aCodes = posCodes(posA);
700
- const bCodes = posCodes(posB);
701
- const maxLength = Math.max(aCodes.length, bCodes.length);
702
- for (let i = 0; i < maxLength; i++) {
703
- const a = aCodes[i] === void 0 ? min : aCodes[i];
704
- const b = bCodes[i] === void 0 ? min : bCodes[i];
705
- if (a === b) {
706
- continue;
707
- } else {
708
- return a - b;
709
- }
710
- }
711
- throw new Error(
712
- `Impossible to compare similar position "${posA}" and "${posB}"`
713
- );
714
- }
715
-
716
737
  // src/crdts/LiveRegister.ts
717
738
  var LiveRegister = class extends AbstractCrdt {
718
739
  constructor(data) {
@@ -788,10 +809,7 @@ var LiveRegister = class extends AbstractCrdt {
788
809
 
789
810
  // src/crdts/LiveList.ts
790
811
  function compareNodePosition(itemA, itemB) {
791
- return comparePosition(
792
- itemA._getParentKeyOrThrow(),
793
- itemB._getParentKeyOrThrow()
794
- );
812
+ return comparePosition(itemA._parentPos, itemB._parentPos);
795
813
  }
796
814
  var LiveList = class extends AbstractCrdt {
797
815
  constructor(items = []) {
@@ -1033,7 +1051,7 @@ var LiveList = class extends AbstractCrdt {
1033
1051
  if (this._pool === void 0) {
1034
1052
  throw new Error("Can't attach child if managed pool is not present");
1035
1053
  }
1036
- const key = op.parentKey;
1054
+ const key = asPos(op.parentKey);
1037
1055
  const existingItemIndex = this._indexOfPosition(key);
1038
1056
  if (existingItemIndex !== -1) {
1039
1057
  this._shiftItemPosition(existingItemIndex, key);
@@ -1047,7 +1065,7 @@ var LiveList = class extends AbstractCrdt {
1047
1065
  /** @internal */
1048
1066
  _applyInsertAck(op) {
1049
1067
  const existingItem = this._items.find((item) => item._id === op.id);
1050
- const key = op.parentKey;
1068
+ const key = asPos(op.parentKey);
1051
1069
  const itemIndexAtPosition = this._indexOfPosition(key);
1052
1070
  if (existingItem) {
1053
1071
  if (existingItem._parentKey === key) {
@@ -1108,9 +1126,9 @@ var LiveList = class extends AbstractCrdt {
1108
1126
  const existingItemIndex = this._indexOfPosition(key);
1109
1127
  let newKey = key;
1110
1128
  if (existingItemIndex !== -1) {
1111
- const before = (_b = this._items[existingItemIndex]) == null ? void 0 : _b._getParentKeyOrThrow();
1112
- const after = (_c = this._items[existingItemIndex + 1]) == null ? void 0 : _c._getParentKeyOrThrow();
1113
- newKey = makePosition(before, after);
1129
+ const before2 = (_b = this._items[existingItemIndex]) == null ? void 0 : _b._parentPos;
1130
+ const after2 = (_c = this._items[existingItemIndex + 1]) == null ? void 0 : _c._parentPos;
1131
+ newKey = makePosition(before2, after2);
1114
1132
  child._setParentLink(this, newKey);
1115
1133
  }
1116
1134
  this._insertAndSort(child);
@@ -1248,10 +1266,7 @@ var LiveList = class extends AbstractCrdt {
1248
1266
  } else {
1249
1267
  this._items[existingItemIndex]._setParentLink(
1250
1268
  this,
1251
- makePosition(
1252
- newKey,
1253
- (_a = this._items[existingItemIndex + 1]) == null ? void 0 : _a._getParentKeyOrThrow()
1254
- )
1269
+ makePosition(newKey, (_a = this._items[existingItemIndex + 1]) == null ? void 0 : _a._parentPos)
1255
1270
  );
1256
1271
  const previousIndex = this._items.indexOf(child);
1257
1272
  child._setParentLink(this, newKey);
@@ -1278,10 +1293,7 @@ var LiveList = class extends AbstractCrdt {
1278
1293
  if (existingItemIndex !== -1) {
1279
1294
  this._items[existingItemIndex]._setParentLink(
1280
1295
  this,
1281
- makePosition(
1282
- newKey,
1283
- (_a = this._items[existingItemIndex + 1]) == null ? void 0 : _a._getParentKeyOrThrow()
1284
- )
1296
+ makePosition(newKey, (_a = this._items[existingItemIndex + 1]) == null ? void 0 : _a._parentPos)
1285
1297
  );
1286
1298
  }
1287
1299
  child._setParentLink(this, newKey);
@@ -1300,10 +1312,7 @@ var LiveList = class extends AbstractCrdt {
1300
1312
  if (existingItemIndex !== -1) {
1301
1313
  this._items[existingItemIndex]._setParentLink(
1302
1314
  this,
1303
- makePosition(
1304
- newKey,
1305
- (_b = this._items[existingItemIndex + 1]) == null ? void 0 : _b._getParentKeyOrThrow()
1306
- )
1315
+ makePosition(newKey, (_b = this._items[existingItemIndex + 1]) == null ? void 0 : _b._parentPos)
1307
1316
  );
1308
1317
  }
1309
1318
  child._setParentLink(this, newKey);
@@ -1332,10 +1341,7 @@ var LiveList = class extends AbstractCrdt {
1332
1341
  if (existingItemIndex !== -1) {
1333
1342
  this._items[existingItemIndex]._setParentLink(
1334
1343
  this,
1335
- makePosition(
1336
- newKey,
1337
- (_a = this._items[existingItemIndex + 1]) == null ? void 0 : _a._getParentKeyOrThrow()
1338
- )
1344
+ makePosition(newKey, (_a = this._items[existingItemIndex + 1]) == null ? void 0 : _a._parentPos)
1339
1345
  );
1340
1346
  }
1341
1347
  child._setParentLink(this, newKey);
@@ -1410,9 +1416,9 @@ var LiveList = class extends AbstractCrdt {
1410
1416
  `Cannot insert list item at index "${index}". index should be between 0 and ${this._items.length}`
1411
1417
  );
1412
1418
  }
1413
- const before = this._items[index - 1] ? this._items[index - 1]._getParentKeyOrThrow() : void 0;
1414
- const after = this._items[index] ? this._items[index]._getParentKeyOrThrow() : void 0;
1415
- const position = makePosition(before, after);
1419
+ const before2 = this._items[index - 1] ? this._items[index - 1]._parentPos : void 0;
1420
+ const after2 = this._items[index] ? this._items[index]._parentPos : void 0;
1421
+ const position = makePosition(before2, after2);
1416
1422
  const value = lsonToLiveNode(element);
1417
1423
  value._setParentLink(this, position);
1418
1424
  this._insertAndSort(value);
@@ -1453,11 +1459,11 @@ var LiveList = class extends AbstractCrdt {
1453
1459
  let beforePosition = null;
1454
1460
  let afterPosition = null;
1455
1461
  if (index < targetIndex) {
1456
- afterPosition = targetIndex === this._items.length - 1 ? void 0 : this._items[targetIndex + 1]._getParentKeyOrThrow();
1457
- beforePosition = this._items[targetIndex]._getParentKeyOrThrow();
1462
+ afterPosition = targetIndex === this._items.length - 1 ? void 0 : this._items[targetIndex + 1]._parentPos;
1463
+ beforePosition = this._items[targetIndex]._parentPos;
1458
1464
  } else {
1459
- afterPosition = this._items[targetIndex]._getParentKeyOrThrow();
1460
- beforePosition = targetIndex === 0 ? void 0 : this._items[targetIndex - 1]._getParentKeyOrThrow();
1465
+ afterPosition = this._items[targetIndex]._parentPos;
1466
+ beforePosition = targetIndex === 0 ? void 0 : this._items[targetIndex - 1]._parentPos;
1461
1467
  }
1462
1468
  const position = makePosition(beforePosition, afterPosition);
1463
1469
  const item = this._items[index];
@@ -1712,7 +1718,7 @@ var LiveList = class extends AbstractCrdt {
1712
1718
  var _a;
1713
1719
  const shiftedPosition = makePosition(
1714
1720
  key,
1715
- this._items.length > index + 1 ? (_a = this._items[index + 1]) == null ? void 0 : _a._getParentKeyOrThrow() : void 0
1721
+ this._items.length > index + 1 ? (_a = this._items[index + 1]) == null ? void 0 : _a._parentPos : void 0
1716
1722
  );
1717
1723
  this._items[index]._setParentLink(this, shiftedPosition);
1718
1724
  }
@@ -3592,7 +3598,11 @@ function makeStateMachine(config, initialPresence, initialStorage) {
3592
3598
  return { modified: false };
3593
3599
  }
3594
3600
  if (node.parent.type === "HasParent" && isLiveList(node.parent.node)) {
3595
- return node.parent.node._setChildKey(op.parentKey, node, source);
3601
+ return node.parent.node._setChildKey(
3602
+ asPos(op.parentKey),
3603
+ node,
3604
+ source
3605
+ );
3596
3606
  }
3597
3607
  return { modified: false };
3598
3608
  }
@@ -4501,7 +4511,7 @@ function prepareCreateWebSocket(liveblocksServer, WebSocketPolyfill) {
4501
4511
  // @ts-ignore (__PACKAGE_VERSION__ will be injected by the build script)
4502
4512
  true ? (
4503
4513
  /* istanbul ignore next */
4504
- "1.0.6-test3"
4514
+ "1.0.6"
4505
4515
  ) : "dev"}`
4506
4516
  );
4507
4517
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liveblocks/core",
3
- "version": "1.0.6-test3",
3
+ "version": "1.0.6",
4
4
  "description": "Shared code and foundational internals for Liveblocks",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",