@rotorsoft/act 1.25.3 → 1.26.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
@@ -22,7 +22,7 @@ import {
22
22
  sleep,
23
23
  store,
24
24
  validate
25
- } from "./chunk-NHJQCCBS.js";
25
+ } from "./chunk-BAIMGDI4.js";
26
26
  import {
27
27
  ActorSchema,
28
28
  CausationEventSchema,
@@ -1693,8 +1693,10 @@ var CorrelateCycle = class {
1693
1693
  this._initialized = true;
1694
1694
  }
1695
1695
  async _run_init() {
1696
- const { watermark } = await store().subscribe([...this._static_targets]);
1697
- this._checkpoint = this._has_dynamic_resolvers ? Math.max(-1, watermark - this._cold_start_back_scan) : watermark;
1696
+ const { watermark, correlated_at } = await store().subscribe([
1697
+ ...this._static_targets
1698
+ ]);
1699
+ this._checkpoint = !this._has_dynamic_resolvers ? watermark : correlated_at >= 0 ? correlated_at : Math.max(-1, watermark - this._cold_start_back_scan);
1698
1700
  this._on_init?.();
1699
1701
  for (const { stream } of this._static_targets) {
1700
1702
  this._subscribed.set(stream, Number.POSITIVE_INFINITY);
@@ -1774,7 +1776,7 @@ var CorrelateCycle = class {
1774
1776
  lane
1775
1777
  })
1776
1778
  );
1777
- const { subscribed } = await this._cd.subscribe(streams);
1779
+ const { subscribed } = await this._cd.subscribe(streams, last_id);
1778
1780
  this._checkpoint = last_id;
1779
1781
  if (subscribed) {
1780
1782
  for (const { stream, priority } of streams) {
@@ -1960,7 +1962,7 @@ async function fetch(leased, eventLimit) {
1960
1962
  }
1961
1963
  var ack = (leases) => store().ack(leases);
1962
1964
  var block = (leases) => store().block(leases);
1963
- var subscribe = (streams) => store().subscribe(streams);
1965
+ var subscribe = (streams, correlated_at) => store().subscribe(streams, correlated_at);
1964
1966
 
1965
1967
  // src/internal/event-sourcing.ts
1966
1968
  import { patch } from "@rotorsoft/act-patch";