@liveblocks/core 1.1.5-test5 → 1.1.6-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.js +19 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
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.
|
|
3
|
+
var PKG_VERSION = "1.1.6-test1";
|
|
4
4
|
var PKG_FORMAT = "cjs";
|
|
5
5
|
|
|
6
6
|
// src/dupe-detection.ts
|
|
7
7
|
var g = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {};
|
|
8
|
-
var crossLinkedDocs = "https://liveblocks.io/errors/cross-linked";
|
|
9
|
-
var dupesDocs = "https://liveblocks.io/errors/dupes";
|
|
8
|
+
var crossLinkedDocs = "https://liveblocks.io/docs/errors/cross-linked";
|
|
9
|
+
var dupesDocs = "https://liveblocks.io/docs/errors/dupes";
|
|
10
10
|
var SPACE = " ";
|
|
11
11
|
function error(msg) {
|
|
12
12
|
if (process.env.NODE_ENV === "production") {
|
|
@@ -1779,6 +1779,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
1779
1779
|
this._items = [];
|
|
1780
1780
|
this._implicitlyDeletedItems = /* @__PURE__ */ new WeakSet();
|
|
1781
1781
|
this._unacknowledgedSets = /* @__PURE__ */ new Map();
|
|
1782
|
+
this._unacknowledgedDeletedIds = /* @__PURE__ */ new Set();
|
|
1782
1783
|
let position = void 0;
|
|
1783
1784
|
for (const item of items) {
|
|
1784
1785
|
const newPosition = makePosition(position);
|
|
@@ -1916,6 +1917,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
1916
1917
|
if (this._pool === void 0) {
|
|
1917
1918
|
throw new Error("Can't attach child if managed pool is not present");
|
|
1918
1919
|
}
|
|
1920
|
+
this._unacknowledgedDeletedIds.delete(nn(op.deletedId));
|
|
1919
1921
|
const delta = [];
|
|
1920
1922
|
const deletedDelta = this._detachItemAssociatedToSetOperation(op.deletedId);
|
|
1921
1923
|
if (deletedDelta) {
|
|
@@ -2026,6 +2028,11 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
2026
2028
|
}
|
|
2027
2029
|
/** @internal */
|
|
2028
2030
|
_applyInsertAck(op) {
|
|
2031
|
+
if (this._unacknowledgedDeletedIds.has(op.id)) {
|
|
2032
|
+
return {
|
|
2033
|
+
modified: false
|
|
2034
|
+
};
|
|
2035
|
+
}
|
|
2029
2036
|
const existingItem = this._items.find((item) => item._id === op.id);
|
|
2030
2037
|
const key = asPos(op.parentKey);
|
|
2031
2038
|
const itemIndexAtPosition = this._indexOfPosition(key);
|
|
@@ -2368,7 +2375,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
2368
2375
|
_optionalChain([this, 'access', _71 => _71._pool, 'optionalAccess', _72 => _72.assertStorageIsWritable, 'call', _73 => _73()]);
|
|
2369
2376
|
if (index < 0 || index > this._items.length) {
|
|
2370
2377
|
throw new Error(
|
|
2371
|
-
`Cannot insert list item at index "
|
|
2378
|
+
`Cannot insert list item at index "${index}". index should be between 0 and ${this._items.length}`
|
|
2372
2379
|
);
|
|
2373
2380
|
}
|
|
2374
2381
|
const before2 = this._items[index - 1] ? this._items[index - 1]._parentPos : void 0;
|
|
@@ -2456,7 +2463,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
2456
2463
|
_optionalChain([this, 'access', _77 => _77._pool, 'optionalAccess', _78 => _78.assertStorageIsWritable, 'call', _79 => _79()]);
|
|
2457
2464
|
if (index < 0 || index >= this._items.length) {
|
|
2458
2465
|
throw new Error(
|
|
2459
|
-
`Cannot delete list item at index "
|
|
2466
|
+
`Cannot delete list item at index "${index}". index should be between 0 and ${this._items.length - 1}`
|
|
2460
2467
|
);
|
|
2461
2468
|
}
|
|
2462
2469
|
const item = this._items[index];
|
|
@@ -2464,8 +2471,8 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
2464
2471
|
this._items.splice(index, 1);
|
|
2465
2472
|
this.invalidate();
|
|
2466
2473
|
if (this._pool) {
|
|
2467
|
-
const
|
|
2468
|
-
if (
|
|
2474
|
+
const childId = item._id;
|
|
2475
|
+
if (childId) {
|
|
2469
2476
|
const storageUpdates = /* @__PURE__ */ new Map();
|
|
2470
2477
|
storageUpdates.set(
|
|
2471
2478
|
nn(this._id),
|
|
@@ -2474,7 +2481,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
2474
2481
|
this._pool.dispatch(
|
|
2475
2482
|
[
|
|
2476
2483
|
{
|
|
2477
|
-
id:
|
|
2484
|
+
id: childId,
|
|
2478
2485
|
opId: this._pool.generateOpId(),
|
|
2479
2486
|
type: 5 /* DELETE_CRDT */
|
|
2480
2487
|
}
|
|
@@ -2523,13 +2530,16 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
2523
2530
|
_optionalChain([this, 'access', _83 => _83._pool, 'optionalAccess', _84 => _84.assertStorageIsWritable, 'call', _85 => _85()]);
|
|
2524
2531
|
if (index < 0 || index >= this._items.length) {
|
|
2525
2532
|
throw new Error(
|
|
2526
|
-
`Cannot set list item at index "
|
|
2533
|
+
`Cannot set list item at index "${index}". index should be between 0 and ${this._items.length - 1}`
|
|
2527
2534
|
);
|
|
2528
2535
|
}
|
|
2529
2536
|
const existingItem = this._items[index];
|
|
2530
2537
|
const position = existingItem._getParentKeyOrThrow();
|
|
2531
2538
|
const existingId = existingItem._id;
|
|
2532
2539
|
existingItem._detach();
|
|
2540
|
+
if (existingId !== void 0) {
|
|
2541
|
+
this._unacknowledgedDeletedIds.add(existingId);
|
|
2542
|
+
}
|
|
2533
2543
|
const value = lsonToLiveNode(item);
|
|
2534
2544
|
value._setParentLink(this, position);
|
|
2535
2545
|
this._items[index] = value;
|