@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.js CHANGED
@@ -376,6 +376,17 @@ var InMemoryStream = class {
376
376
  };
377
377
  }
378
378
  }
379
+ /**
380
+ * Reset this stream's watermark and state for replay.
381
+ */
382
+ reset() {
383
+ this._at = -1;
384
+ this._retry = 0;
385
+ this._blocked = false;
386
+ this._error = "";
387
+ this._leased_by = void 0;
388
+ this._leased_until = void 0;
389
+ }
379
390
  };
380
391
  var InMemoryStore = class {
381
392
  // stored events
@@ -566,6 +577,24 @@ var InMemoryStore = class {
566
577
  await sleep();
567
578
  return leases.map((l) => this._streams.get(l.stream)?.block(l, l.error)).filter((l) => !!l);
568
579
  }
580
+ /**
581
+ * Reset watermarks for the given streams to -1, clearing retry, blocked,
582
+ * error, and lease state so they can be replayed from the beginning.
583
+ * @param streams - Stream names to reset.
584
+ * @returns Count of streams that were actually reset.
585
+ */
586
+ async reset(streams) {
587
+ await sleep();
588
+ let count = 0;
589
+ for (const name of streams) {
590
+ const s = this._streams.get(name);
591
+ if (s) {
592
+ s.reset();
593
+ count++;
594
+ }
595
+ }
596
+ return count;
597
+ }
569
598
  };
570
599
 
571
600
  // src/ports.ts