@glimt/record 0.0.28 → 0.0.30

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 CHANGED
@@ -9387,6 +9387,15 @@ class DoubleLinkedList {
9387
9387
  }
9388
9388
  }
9389
9389
  const moveKey = (id, parentId) => `${id}@${parentId}`;
9390
+ function makeid(length = 8) {
9391
+ var result2 = "";
9392
+ var characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
9393
+ var charactersLength = characters.length;
9394
+ for (var i2 = 0; i2 < length; i2++) {
9395
+ result2 += characters.charAt(Math.floor(Math.random() * charactersLength));
9396
+ }
9397
+ return result2;
9398
+ }
9390
9399
  class MutationBuffer {
9391
9400
  constructor() {
9392
9401
  __publicField(this, "frozen", false);
@@ -9423,6 +9432,7 @@ class MutationBuffer {
9423
9432
  __publicField(this, "canvasManager");
9424
9433
  __publicField(this, "processedNodeManager");
9425
9434
  __publicField(this, "unattachedDoc");
9435
+ __publicField(this, "myId", makeid());
9426
9436
  __publicField(this, "stormBatches", []);
9427
9437
  __publicField(this, "stormInfo");
9428
9438
  __publicField(this, "stormSettings", {
@@ -9433,7 +9443,11 @@ class MutationBuffer {
9433
9443
  __publicField(this, "handleStormMutations", (muts) => {
9434
9444
  const time = Date.now();
9435
9445
  if (this.stormInfo == null) {
9436
- console.log("detected probable mutation storm start");
9446
+ console.log(
9447
+ "detected probable mutation storm start",
9448
+ "buffer id:",
9449
+ this.myId
9450
+ );
9437
9451
  this.stormInfo = {
9438
9452
  startedAt: time,
9439
9453
  totalMutations: 0,
@@ -9442,7 +9456,12 @@ class MutationBuffer {
9442
9456
  };
9443
9457
  }
9444
9458
  this.stormInfo.totalMutations += muts.length;
9445
- console.log("current storm mutations", this.stormInfo.totalMutations);
9459
+ console.log(
9460
+ "current storm mutations",
9461
+ this.stormInfo.totalMutations,
9462
+ "buffer id:",
9463
+ this.myId
9464
+ );
9446
9465
  if (this.stormInfo.totalMutations >= this.stormSettings.mutationLimit) {
9447
9466
  this.stormInfo.stormExceededLimit = true;
9448
9467
  this.stormBatches = [];
@@ -9465,7 +9484,12 @@ class MutationBuffer {
9465
9484
  "totalMutations:",
9466
9485
  this.stormInfo.totalMutations,
9467
9486
  "stormExceededLimit:",
9468
- stormExceededLimit
9487
+ stormExceededLimit,
9488
+ "storm duration:",
9489
+ Date.now() - this.stormInfo.startedAt,
9490
+ "ms",
9491
+ "buffer id:",
9492
+ this.myId
9469
9493
  );
9470
9494
  clearTimeout(this.stormInfo.timeout);
9471
9495
  this.stormInfo = null;
@@ -9496,7 +9520,9 @@ class MutationBuffer {
9496
9520
  performance.now() - start,
9497
9521
  "ms",
9498
9522
  "overrideStorm",
9499
- overrideStorm
9523
+ overrideStorm,
9524
+ "buffer id:",
9525
+ this.myId
9500
9526
  );
9501
9527
  this.emit();
9502
9528
  });