@glimt/record 0.0.30 → 0.0.31
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/record.cjs +35 -6
- package/dist/record.cjs.map +1 -1
- package/dist/record.js +35 -6
- package/dist/record.js.map +1 -1
- package/dist/record.umd.cjs +35 -6
- package/dist/record.umd.cjs.map +2 -2
- package/dist/record.umd.min.cjs +23 -23
- package/dist/record.umd.min.cjs.map +3 -3
- package/package.json +1 -1
package/dist/record.cjs
CHANGED
|
@@ -9306,6 +9306,34 @@ var NodeType = /* @__PURE__ */ ((NodeType2) => {
|
|
|
9306
9306
|
NodeType2[NodeType2["Comment"] = 5] = "Comment";
|
|
9307
9307
|
return NodeType2;
|
|
9308
9308
|
})(NodeType || {});
|
|
9309
|
+
class StormSnapshotManager {
|
|
9310
|
+
constructor() {
|
|
9311
|
+
__publicField(this, "fullSnapshotTaker", null);
|
|
9312
|
+
__publicField(this, "lastFullSnapshot", -1);
|
|
9313
|
+
__publicField(this, "intervalBetweenSnapshots", 150);
|
|
9314
|
+
}
|
|
9315
|
+
bindFullSnapshotTaker(takeFullSnapshot2) {
|
|
9316
|
+
this.fullSnapshotTaker = takeFullSnapshot2;
|
|
9317
|
+
}
|
|
9318
|
+
requestFullSnapshot(bufferId) {
|
|
9319
|
+
if (!this.fullSnapshotTaker) {
|
|
9320
|
+
console.log(
|
|
9321
|
+
"requestFullSnapshot: no full snapshot taker",
|
|
9322
|
+
"bufferId:",
|
|
9323
|
+
bufferId
|
|
9324
|
+
);
|
|
9325
|
+
return;
|
|
9326
|
+
}
|
|
9327
|
+
if (Date.now() - this.lastFullSnapshot < this.intervalBetweenSnapshots) {
|
|
9328
|
+
console.log("requestFullSnapshot: too soon", "bufferId:", bufferId);
|
|
9329
|
+
return;
|
|
9330
|
+
}
|
|
9331
|
+
console.log("taking full snapshot", "bufferId:", bufferId);
|
|
9332
|
+
this.fullSnapshotTaker();
|
|
9333
|
+
this.lastFullSnapshot = Date.now();
|
|
9334
|
+
}
|
|
9335
|
+
}
|
|
9336
|
+
const stormSnapshotManager = new StormSnapshotManager();
|
|
9309
9337
|
function isNodeInLinkedList(n2) {
|
|
9310
9338
|
return "__ln" in n2;
|
|
9311
9339
|
}
|
|
@@ -9432,7 +9460,7 @@ class MutationBuffer {
|
|
|
9432
9460
|
__publicField(this, "canvasManager");
|
|
9433
9461
|
__publicField(this, "processedNodeManager");
|
|
9434
9462
|
__publicField(this, "unattachedDoc");
|
|
9435
|
-
__publicField(this, "
|
|
9463
|
+
__publicField(this, "bufId", makeid());
|
|
9436
9464
|
__publicField(this, "stormBatches", []);
|
|
9437
9465
|
__publicField(this, "stormInfo");
|
|
9438
9466
|
__publicField(this, "stormSettings", {
|
|
@@ -9446,7 +9474,7 @@ class MutationBuffer {
|
|
|
9446
9474
|
console.log(
|
|
9447
9475
|
"detected probable mutation storm start",
|
|
9448
9476
|
"buffer id:",
|
|
9449
|
-
this.
|
|
9477
|
+
this.bufId
|
|
9450
9478
|
);
|
|
9451
9479
|
this.stormInfo = {
|
|
9452
9480
|
startedAt: time,
|
|
@@ -9460,7 +9488,7 @@ class MutationBuffer {
|
|
|
9460
9488
|
"current storm mutations",
|
|
9461
9489
|
this.stormInfo.totalMutations,
|
|
9462
9490
|
"buffer id:",
|
|
9463
|
-
this.
|
|
9491
|
+
this.bufId
|
|
9464
9492
|
);
|
|
9465
9493
|
if (this.stormInfo.totalMutations >= this.stormSettings.mutationLimit) {
|
|
9466
9494
|
this.stormInfo.stormExceededLimit = true;
|
|
@@ -9489,7 +9517,7 @@ class MutationBuffer {
|
|
|
9489
9517
|
Date.now() - this.stormInfo.startedAt,
|
|
9490
9518
|
"ms",
|
|
9491
9519
|
"buffer id:",
|
|
9492
|
-
this.
|
|
9520
|
+
this.bufId
|
|
9493
9521
|
);
|
|
9494
9522
|
clearTimeout(this.stormInfo.timeout);
|
|
9495
9523
|
this.stormInfo = null;
|
|
@@ -9502,7 +9530,7 @@ class MutationBuffer {
|
|
|
9502
9530
|
this.processInternalMutations(muts, true);
|
|
9503
9531
|
} else {
|
|
9504
9532
|
this.stormBatches = [];
|
|
9505
|
-
|
|
9533
|
+
stormSnapshotManager.requestFullSnapshot(this.bufId);
|
|
9506
9534
|
}
|
|
9507
9535
|
});
|
|
9508
9536
|
__publicField(this, "processInternalMutations", (muts, overrideStorm = false) => {
|
|
@@ -9522,7 +9550,7 @@ class MutationBuffer {
|
|
|
9522
9550
|
"overrideStorm",
|
|
9523
9551
|
overrideStorm,
|
|
9524
9552
|
"buffer id:",
|
|
9525
|
-
this.
|
|
9553
|
+
this.bufId
|
|
9526
9554
|
);
|
|
9527
9555
|
this.emit();
|
|
9528
9556
|
});
|
|
@@ -12647,6 +12675,7 @@ record.takeFullSnapshot = (isCheckout) => {
|
|
|
12647
12675
|
}
|
|
12648
12676
|
takeFullSnapshot$1(isCheckout);
|
|
12649
12677
|
};
|
|
12678
|
+
stormSnapshotManager.bindFullSnapshotTaker(takeFullSnapshot$1);
|
|
12650
12679
|
record.mirror = mirror;
|
|
12651
12680
|
var n;
|
|
12652
12681
|
!function(t2) {
|