@liveblocks/core 1.2.2-test4 → 1.2.2
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.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +15 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -856,6 +856,7 @@ declare type YDocUpdate = {
|
|
|
856
856
|
readonly type: ServerMsgCode.UPDATE_YDOC;
|
|
857
857
|
readonly update: string;
|
|
858
858
|
readonly isSync: boolean;
|
|
859
|
+
readonly stateVector: string | null;
|
|
859
860
|
};
|
|
860
861
|
/**
|
|
861
862
|
* Sent by the WebSocket server and broadcasted to all clients to announce that
|
package/dist/index.d.ts
CHANGED
|
@@ -856,6 +856,7 @@ declare type YDocUpdate = {
|
|
|
856
856
|
readonly type: ServerMsgCode.UPDATE_YDOC;
|
|
857
857
|
readonly update: string;
|
|
858
858
|
readonly isSync: boolean;
|
|
859
|
+
readonly stateVector: string | null;
|
|
859
860
|
};
|
|
860
861
|
/**
|
|
861
862
|
* Sent by the WebSocket server and broadcasted to all clients to announce that
|
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.2.2
|
|
3
|
+
var PKG_VERSION = "1.2.2";
|
|
4
4
|
var PKG_FORMAT = "cjs";
|
|
5
5
|
|
|
6
6
|
// src/dupe-detection.ts
|
|
@@ -2068,7 +2068,6 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
2068
2068
|
super();
|
|
2069
2069
|
this._items = [];
|
|
2070
2070
|
this._implicitlyDeletedItems = /* @__PURE__ */ new WeakSet();
|
|
2071
|
-
this._unacknowledgedDeletedIds = /* @__PURE__ */ new Set();
|
|
2072
2071
|
this._unacknowledgedSets = /* @__PURE__ */ new Map();
|
|
2073
2072
|
let position = void 0;
|
|
2074
2073
|
for (const item of items) {
|
|
@@ -2212,9 +2211,6 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
2212
2211
|
if (deletedDelta) {
|
|
2213
2212
|
delta.push(deletedDelta);
|
|
2214
2213
|
}
|
|
2215
|
-
if (this._unacknowledgedDeletedIds.has(nn(op.deletedId))) {
|
|
2216
|
-
this._unacknowledgedDeletedIds.delete(nn(op.deletedId));
|
|
2217
|
-
}
|
|
2218
2214
|
const unacknowledgedOpId = this._unacknowledgedSets.get(op.parentKey);
|
|
2219
2215
|
if (unacknowledgedOpId !== void 0) {
|
|
2220
2216
|
if (unacknowledgedOpId !== op.opId) {
|
|
@@ -2320,11 +2316,6 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
2320
2316
|
}
|
|
2321
2317
|
/** @internal */
|
|
2322
2318
|
_applyInsertAck(op) {
|
|
2323
|
-
if (this._unacknowledgedDeletedIds.has(op.id)) {
|
|
2324
|
-
return {
|
|
2325
|
-
modified: false
|
|
2326
|
-
};
|
|
2327
|
-
}
|
|
2328
2319
|
const existingItem = this._items.find((item) => item._id === op.id);
|
|
2329
2320
|
const key = asPos(op.parentKey);
|
|
2330
2321
|
const itemIndexAtPosition = this._indexOfPosition(key);
|
|
@@ -2667,7 +2658,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
2667
2658
|
_optionalChain([this, 'access', _74 => _74._pool, 'optionalAccess', _75 => _75.assertStorageIsWritable, 'call', _76 => _76()]);
|
|
2668
2659
|
if (index < 0 || index > this._items.length) {
|
|
2669
2660
|
throw new Error(
|
|
2670
|
-
`Cannot insert list item at index "
|
|
2661
|
+
`Cannot insert list item at index "${index}". index should be between 0 and ${this._items.length}`
|
|
2671
2662
|
);
|
|
2672
2663
|
}
|
|
2673
2664
|
const before2 = this._items[index - 1] ? this._items[index - 1]._parentPos : void 0;
|
|
@@ -2755,7 +2746,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
2755
2746
|
_optionalChain([this, 'access', _80 => _80._pool, 'optionalAccess', _81 => _81.assertStorageIsWritable, 'call', _82 => _82()]);
|
|
2756
2747
|
if (index < 0 || index >= this._items.length) {
|
|
2757
2748
|
throw new Error(
|
|
2758
|
-
`Cannot delete list item at index "
|
|
2749
|
+
`Cannot delete list item at index "${index}". index should be between 0 and ${this._items.length - 1}`
|
|
2759
2750
|
);
|
|
2760
2751
|
}
|
|
2761
2752
|
const item = this._items[index];
|
|
@@ -2763,8 +2754,8 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
2763
2754
|
this._items.splice(index, 1);
|
|
2764
2755
|
this.invalidate();
|
|
2765
2756
|
if (this._pool) {
|
|
2766
|
-
const
|
|
2767
|
-
if (
|
|
2757
|
+
const childRecordId = item._id;
|
|
2758
|
+
if (childRecordId) {
|
|
2768
2759
|
const storageUpdates = /* @__PURE__ */ new Map();
|
|
2769
2760
|
storageUpdates.set(
|
|
2770
2761
|
nn(this._id),
|
|
@@ -2773,7 +2764,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
2773
2764
|
this._pool.dispatch(
|
|
2774
2765
|
[
|
|
2775
2766
|
{
|
|
2776
|
-
id:
|
|
2767
|
+
id: childRecordId,
|
|
2777
2768
|
opId: this._pool.generateOpId(),
|
|
2778
2769
|
type: 5 /* DELETE_CRDT */
|
|
2779
2770
|
}
|
|
@@ -2822,16 +2813,13 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
2822
2813
|
_optionalChain([this, 'access', _86 => _86._pool, 'optionalAccess', _87 => _87.assertStorageIsWritable, 'call', _88 => _88()]);
|
|
2823
2814
|
if (index < 0 || index >= this._items.length) {
|
|
2824
2815
|
throw new Error(
|
|
2825
|
-
`Cannot set list item at index "
|
|
2816
|
+
`Cannot set list item at index "${index}". index should be between 0 and ${this._items.length - 1}`
|
|
2826
2817
|
);
|
|
2827
2818
|
}
|
|
2828
2819
|
const existingItem = this._items[index];
|
|
2829
2820
|
const position = existingItem._getParentKeyOrThrow();
|
|
2830
2821
|
const existingId = existingItem._id;
|
|
2831
2822
|
existingItem._detach();
|
|
2832
|
-
if (existingId !== void 0) {
|
|
2833
|
-
this._unacknowledgedDeletedIds.add(existingId);
|
|
2834
|
-
}
|
|
2835
2823
|
const value = lsonToLiveNode(item);
|
|
2836
2824
|
value._setParentLink(this, position);
|
|
2837
2825
|
this._items[index] = value;
|
|
@@ -5280,10 +5268,14 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
5280
5268
|
};
|
|
5281
5269
|
}
|
|
5282
5270
|
function fetchYDoc(vector) {
|
|
5283
|
-
context.buffer.messages.
|
|
5284
|
-
type
|
|
5285
|
-
|
|
5286
|
-
|
|
5271
|
+
if (!context.buffer.messages.find((m) => {
|
|
5272
|
+
return m.type === 300 /* FETCH_YDOC */ && m.vector === vector;
|
|
5273
|
+
})) {
|
|
5274
|
+
context.buffer.messages.push({
|
|
5275
|
+
type: 300 /* FETCH_YDOC */,
|
|
5276
|
+
vector
|
|
5277
|
+
});
|
|
5278
|
+
}
|
|
5287
5279
|
flushNowOrSoon();
|
|
5288
5280
|
}
|
|
5289
5281
|
function undo() {
|