@liveblocks/core 1.1.6-test1 → 1.1.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.
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/version.ts
2
2
  var PKG_NAME = "@liveblocks/core";
3
- var PKG_VERSION = "1.1.6-test1";
3
+ var PKG_VERSION = "1.1.6";
4
4
  var PKG_FORMAT = "cjs";
5
5
 
6
6
  // src/dupe-detection.ts
@@ -20,6 +20,7 @@ function detectDupes(pkgName, pkgVersion, pkgFormat) {
20
20
  const pkgBuildInfo = pkgFormat ? `${pkgVersion || "dev"} (${pkgFormat})` : pkgVersion || "dev";
21
21
  if (!g[pkgId]) {
22
22
  g[pkgId] = pkgBuildInfo;
23
+ } else if (g[pkgId] === pkgBuildInfo) {
23
24
  } else {
24
25
  const msg = [
25
26
  `Multiple copies of Liveblocks are being loaded in your project. This will cause issues! See ${dupesDocs + SPACE}`,
@@ -1779,7 +1780,6 @@ var LiveList = class _LiveList extends AbstractCrdt {
1779
1780
  this._items = [];
1780
1781
  this._implicitlyDeletedItems = /* @__PURE__ */ new WeakSet();
1781
1782
  this._unacknowledgedSets = /* @__PURE__ */ new Map();
1782
- this._unacknowledgedDeletedIds = /* @__PURE__ */ new Set();
1783
1783
  let position = void 0;
1784
1784
  for (const item of items) {
1785
1785
  const newPosition = makePosition(position);
@@ -1917,7 +1917,6 @@ var LiveList = class _LiveList extends AbstractCrdt {
1917
1917
  if (this._pool === void 0) {
1918
1918
  throw new Error("Can't attach child if managed pool is not present");
1919
1919
  }
1920
- this._unacknowledgedDeletedIds.delete(nn(op.deletedId));
1921
1920
  const delta = [];
1922
1921
  const deletedDelta = this._detachItemAssociatedToSetOperation(op.deletedId);
1923
1922
  if (deletedDelta) {
@@ -2028,11 +2027,6 @@ var LiveList = class _LiveList extends AbstractCrdt {
2028
2027
  }
2029
2028
  /** @internal */
2030
2029
  _applyInsertAck(op) {
2031
- if (this._unacknowledgedDeletedIds.has(op.id)) {
2032
- return {
2033
- modified: false
2034
- };
2035
- }
2036
2030
  const existingItem = this._items.find((item) => item._id === op.id);
2037
2031
  const key = asPos(op.parentKey);
2038
2032
  const itemIndexAtPosition = this._indexOfPosition(key);
@@ -2375,7 +2369,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
2375
2369
  _optionalChain([this, 'access', _71 => _71._pool, 'optionalAccess', _72 => _72.assertStorageIsWritable, 'call', _73 => _73()]);
2376
2370
  if (index < 0 || index > this._items.length) {
2377
2371
  throw new Error(
2378
- `Cannot insert list item at index "${index}". index should be between 0 and ${this._items.length}`
2372
+ `Cannot insert list item at index "${index}". index should be between 0 and ${this._items.length}`
2379
2373
  );
2380
2374
  }
2381
2375
  const before2 = this._items[index - 1] ? this._items[index - 1]._parentPos : void 0;
@@ -2463,7 +2457,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
2463
2457
  _optionalChain([this, 'access', _77 => _77._pool, 'optionalAccess', _78 => _78.assertStorageIsWritable, 'call', _79 => _79()]);
2464
2458
  if (index < 0 || index >= this._items.length) {
2465
2459
  throw new Error(
2466
- `Cannot delete list item at index "${index}". index should be between 0 and ${this._items.length - 1}`
2460
+ `Cannot delete list item at index "${index}". index should be between 0 and ${this._items.length - 1}`
2467
2461
  );
2468
2462
  }
2469
2463
  const item = this._items[index];
@@ -2471,8 +2465,8 @@ var LiveList = class _LiveList extends AbstractCrdt {
2471
2465
  this._items.splice(index, 1);
2472
2466
  this.invalidate();
2473
2467
  if (this._pool) {
2474
- const childId = item._id;
2475
- if (childId) {
2468
+ const childRecordId = item._id;
2469
+ if (childRecordId) {
2476
2470
  const storageUpdates = /* @__PURE__ */ new Map();
2477
2471
  storageUpdates.set(
2478
2472
  nn(this._id),
@@ -2481,7 +2475,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
2481
2475
  this._pool.dispatch(
2482
2476
  [
2483
2477
  {
2484
- id: childId,
2478
+ id: childRecordId,
2485
2479
  opId: this._pool.generateOpId(),
2486
2480
  type: 5 /* DELETE_CRDT */
2487
2481
  }
@@ -2530,16 +2524,13 @@ var LiveList = class _LiveList extends AbstractCrdt {
2530
2524
  _optionalChain([this, 'access', _83 => _83._pool, 'optionalAccess', _84 => _84.assertStorageIsWritable, 'call', _85 => _85()]);
2531
2525
  if (index < 0 || index >= this._items.length) {
2532
2526
  throw new Error(
2533
- `Cannot set list item at index "${index}". index should be between 0 and ${this._items.length - 1}`
2527
+ `Cannot set list item at index "${index}". index should be between 0 and ${this._items.length - 1}`
2534
2528
  );
2535
2529
  }
2536
2530
  const existingItem = this._items[index];
2537
2531
  const position = existingItem._getParentKeyOrThrow();
2538
2532
  const existingId = existingItem._id;
2539
2533
  existingItem._detach();
2540
- if (existingId !== void 0) {
2541
- this._unacknowledgedDeletedIds.add(existingId);
2542
- }
2543
2534
  const value = lsonToLiveNode(item);
2544
2535
  value._setParentLink(this, position);
2545
2536
  this._items[index] = value;