@rotorsoft/act 0.26.1 → 0.27.0

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.cjs CHANGED
@@ -446,6 +446,17 @@ var InMemoryStream = class {
446
446
  };
447
447
  }
448
448
  }
449
+ /**
450
+ * Reset this stream's watermark and state for replay.
451
+ */
452
+ reset() {
453
+ this._at = -1;
454
+ this._retry = 0;
455
+ this._blocked = false;
456
+ this._error = "";
457
+ this._leased_by = void 0;
458
+ this._leased_until = void 0;
459
+ }
449
460
  };
450
461
  var InMemoryStore = class {
451
462
  // stored events
@@ -636,6 +647,24 @@ var InMemoryStore = class {
636
647
  await sleep();
637
648
  return leases.map((l) => this._streams.get(l.stream)?.block(l, l.error)).filter((l) => !!l);
638
649
  }
650
+ /**
651
+ * Reset watermarks for the given streams to -1, clearing retry, blocked,
652
+ * error, and lease state so they can be replayed from the beginning.
653
+ * @param streams - Stream names to reset.
654
+ * @returns Count of streams that were actually reset.
655
+ */
656
+ async reset(streams) {
657
+ await sleep();
658
+ let count = 0;
659
+ for (const name of streams) {
660
+ const s = this._streams.get(name);
661
+ if (s) {
662
+ s.reset();
663
+ count++;
664
+ }
665
+ }
666
+ return count;
667
+ }
639
668
  };
640
669
 
641
670
  // src/ports.ts