@rotorsoft/act 1.33.17 → 1.33.18

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
@@ -40,7 +40,7 @@ import {
40
40
  sleep,
41
41
  store,
42
42
  validate
43
- } from "./chunk-5KTVG7IM.js";
43
+ } from "./chunk-3OTABSIB.js";
44
44
  import {
45
45
  ActorSchema,
46
46
  CausationEventSchema,
@@ -70,7 +70,7 @@ import {
70
70
  pii_fields,
71
71
  pii_schemas,
72
72
  sensitive
73
- } from "./chunk-CAL4XEVN.js";
73
+ } from "./chunk-SD7SW47Z.js";
74
74
 
75
75
  // src/signals.ts
76
76
  process.once("SIGINT", async (arg) => {
@@ -1296,7 +1296,7 @@ var CorrelateCycle = class {
1296
1296
  this._lease_until = correlating ? now + CORRELATION_LEASE_MS : 0;
1297
1297
  if (correlating === false) return idle();
1298
1298
  }
1299
- const after = Math.max(this._checkpoint, query.after || -1);
1299
+ const after = this._checkpoint;
1300
1300
  const correlated = /* @__PURE__ */ new Map();
1301
1301
  let last_id = after;
1302
1302
  let stopped = false;
@@ -1370,7 +1370,7 @@ var CorrelateCycle = class {
1370
1370
  },
1371
1371
  // Resolvers see `pii: null`: correlate runs actor-less, and one
1372
1372
  // undecryptable row would otherwise stop every stream's reactions.
1373
- { ...query, after, with_pii: false }
1373
+ { after, limit: query.limit, with_pii: false }
1374
1374
  );
1375
1375
  if (this._declared_lanes.size > 1) await this._recall(correlated);
1376
1376
  const read = last_id > after;
@@ -2879,8 +2879,7 @@ var SettleLoop = class {
2879
2879
  this._timer = void 0;
2880
2880
  const {
2881
2881
  debounceMs: _,
2882
- // Every pass scans from correlation's own checkpoint.
2883
- correlate: { after: _after, ...correlate_query } = {},
2882
+ correlate: correlate_query = {},
2884
2883
  maxPasses = Infinity,
2885
2884
  ...drain_options
2886
2885
  } = this._next ?? {};
@@ -2893,7 +2892,7 @@ var SettleLoop = class {
2893
2892
  if (scanned) this._deps.breaker.passed();
2894
2893
  const drain = await this._deps.drain(drain_options);
2895
2894
  passes.push(drain);
2896
- const made_progress = drain.leased.length > 0 || scanned && (pass.subscribed > 0 || pass.read);
2895
+ const made_progress = drain.leased.length > 0 || scanned && pass.read;
2897
2896
  if (!made_progress) break;
2898
2897
  }
2899
2898
  if (passes.length) this._deps.on_settled(merge_drains(passes));
@@ -3552,8 +3551,9 @@ var Act = class {
3552
3551
  * target streams their reactions resolve to (static or computed from
3553
3552
  * the event), and marks their work so the next drain can claim it.
3554
3553
  *
3555
- * @param query - Scan filter — see {@link Query} for fields (typically
3556
- * `{ limit: <count> }`; the scan starts at the checkpoint)
3554
+ * @param query - Only `limit` is used: the most events the pass reads
3555
+ * (default 10). The scan always starts at the correlation checkpoint,
3556
+ * which every reaction shares, so filters and `after` are ignored.
3557
3557
  * @returns The number of newly subscribed streams and the last scanned event id
3558
3558
  *
3559
3559
  * @example Manual correlation
@@ -3563,7 +3563,7 @@ var Act = class {
3563
3563
  *
3564
3564
  * @see {@link start_correlations} for automatic periodic correlation
3565
3565
  */
3566
- async correlate(query = { after: -1, limit: 10 }) {
3566
+ async correlate(query = { limit: 10 }) {
3567
3567
  const pass = await this._correlate_pass(query);
3568
3568
  return {
3569
3569
  subscribed: pass.kind === "scanned" ? pass.subscribed : 0,
@@ -3575,8 +3575,7 @@ var Act = class {
3575
3575
  if (!this._drain) return { kind: "idle", last_id: -1 };
3576
3576
  return this._scoped(async () => {
3577
3577
  const pass = await this._correlate.correlate(query, lease);
3578
- if (pass.kind === "scanned" && (pass.subscribed > 0 || pass.marked > 0))
3579
- this._arm_all();
3578
+ if (pass.kind === "scanned" && pass.marked > 0) this._arm_all();
3580
3579
  return pass;
3581
3580
  });
3582
3581
  }