@rotorsoft/act 1.34.1 → 1.34.3

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
@@ -40,7 +40,7 @@
40
40
 
41
41
 
42
42
 
43
- var _chunkBTLM7SW4cjs = require('./chunk-BTLM7SW4.cjs');
43
+ var _chunkGBAMBUDNcjs = require('./chunk-GBAMBUDN.cjs');
44
44
 
45
45
 
46
46
 
@@ -74,20 +74,20 @@ var _chunkRF5MV72Kcjs = require('./chunk-RF5MV72K.cjs');
74
74
 
75
75
  // src/signals.ts
76
76
  process.once("SIGINT", async (arg) => {
77
- _chunkBTLM7SW4cjs.log.call(void 0, ).info(arg, "SIGINT");
78
- await _chunkBTLM7SW4cjs.disposeAndExit.call(void 0, "EXIT");
77
+ _chunkGBAMBUDNcjs.log.call(void 0, ).info(arg, "SIGINT");
78
+ await _chunkGBAMBUDNcjs.disposeAndExit.call(void 0, "EXIT");
79
79
  });
80
80
  process.once("SIGTERM", async (arg) => {
81
- _chunkBTLM7SW4cjs.log.call(void 0, ).info(arg, "SIGTERM");
82
- await _chunkBTLM7SW4cjs.disposeAndExit.call(void 0, "EXIT");
81
+ _chunkGBAMBUDNcjs.log.call(void 0, ).info(arg, "SIGTERM");
82
+ await _chunkGBAMBUDNcjs.disposeAndExit.call(void 0, "EXIT");
83
83
  });
84
84
  process.once("uncaughtException", async (arg) => {
85
- _chunkBTLM7SW4cjs.log.call(void 0, ).error(arg, "Uncaught Exception");
86
- await _chunkBTLM7SW4cjs.disposeAndExit.call(void 0, "ERROR");
85
+ _chunkGBAMBUDNcjs.log.call(void 0, ).error(arg, "Uncaught Exception");
86
+ await _chunkGBAMBUDNcjs.disposeAndExit.call(void 0, "ERROR");
87
87
  });
88
88
  process.once("unhandledRejection", async (arg) => {
89
- _chunkBTLM7SW4cjs.log.call(void 0, ).error(arg, "Unhandled Rejection");
90
- await _chunkBTLM7SW4cjs.disposeAndExit.call(void 0, "ERROR");
89
+ _chunkGBAMBUDNcjs.log.call(void 0, ).error(arg, "Unhandled Rejection");
90
+ await _chunkGBAMBUDNcjs.disposeAndExit.call(void 0, "ERROR");
91
91
  });
92
92
 
93
93
  // src/act.ts
@@ -922,7 +922,7 @@ async function run_windowed_closes(windowed, deps, skipped) {
922
922
  if (!await windowed_prune_pending(t.stream, t.before, max_id))
923
923
  return void 0;
924
924
  if (t.archive) await t.archive();
925
- const result = await _chunkBTLM7SW4cjs.store.call(void 0, ).truncate([
925
+ const result = await _chunkGBAMBUDNcjs.store.call(void 0, ).truncate([
926
926
  { stream: t.stream, before: t.before, max_id }
927
927
  ]);
928
928
  return result.get(t.stream);
@@ -935,7 +935,7 @@ async function run_windowed_closes(windowed, deps, skipped) {
935
935
  async function windowed_prune_pending(stream, before, max_id) {
936
936
  let boundary_id;
937
937
  let min_id;
938
- await _chunkBTLM7SW4cjs.store.call(void 0, ).query(
938
+ await _chunkGBAMBUDNcjs.store.call(void 0, ).query(
939
939
  (event) => {
940
940
  if (min_id === void 0 || event.id < min_id) min_id = event.id;
941
941
  if (event.name === _chunkRF5MV72Kcjs.SNAP_EVENT && event.created < before && (max_id === void 0 || event.id <= max_id) && (boundary_id === void 0 || event.id > boundary_id))
@@ -949,7 +949,7 @@ async function probe_min_watermarks(streams, page_size, checkpoint) {
949
949
  const min_at = /* @__PURE__ */ new Map();
950
950
  const matches = source_matcher();
951
951
  await walk_streams(
952
- _chunkBTLM7SW4cjs.store.call(void 0, ),
952
+ _chunkGBAMBUDNcjs.store.call(void 0, ),
953
953
  (position) => {
954
954
  const pending = position.correlated_at === void 0 || position.at < position.correlated_at;
955
955
  const cap = pending ? position.at : Math.max(position.at, checkpoint);
@@ -977,13 +977,13 @@ function source_matcher() {
977
977
  };
978
978
  }
979
979
  async function scan_stream_heads(streams) {
980
- const stats = await _chunkBTLM7SW4cjs.store.call(void 0, ).query_stats(streams, {
980
+ const stats = await _chunkGBAMBUDNcjs.store.call(void 0, ).query_stats(streams, {
981
981
  exclude: [_chunkRF5MV72Kcjs.SNAP_EVENT]
982
982
  });
983
- const domain_heads = await _chunkBTLM7SW4cjs.store.call(void 0, ).query_stats(streams, {
983
+ const domain_heads = await _chunkGBAMBUDNcjs.store.call(void 0, ).query_stats(streams, {
984
984
  exclude: [_chunkRF5MV72Kcjs.SNAP_EVENT, _chunkRF5MV72Kcjs.TOMBSTONE_EVENT]
985
985
  });
986
- const true_heads = await _chunkBTLM7SW4cjs.store.call(void 0, ).query_stats(streams, {});
986
+ const true_heads = await _chunkGBAMBUDNcjs.store.call(void 0, ).query_stats(streams, {});
987
987
  const out = /* @__PURE__ */ new Map();
988
988
  for (const [stream, { head }] of domain_heads) {
989
989
  const marker_head = _optionalChain([stats, 'access', _45 => _45.get, 'call', _46 => _46(stream), 'optionalAccess', _47 => _47.head]);
@@ -1011,7 +1011,7 @@ async function partition_by_safety(stream_info, reactive, skipped, page_size, ca
1011
1011
  const matches = source_matcher();
1012
1012
  const targets = [...stream_info.keys()];
1013
1013
  await walk_streams(
1014
- _chunkBTLM7SW4cjs.store.call(void 0, ),
1014
+ _chunkGBAMBUDNcjs.store.call(void 0, ),
1015
1015
  (position) => {
1016
1016
  const has_work = position.correlated_at !== void 0 && position.at < position.correlated_at;
1017
1017
  if (!has_work) return;
@@ -1077,7 +1077,7 @@ async function run_archive_callbacks(guarded, target_map) {
1077
1077
  }
1078
1078
  }
1079
1079
  async function heads_still_guarded(guarded, guard_events, skipped) {
1080
- const heads = await _chunkBTLM7SW4cjs.store.call(void 0, ).query_stats(guarded, {});
1080
+ const heads = await _chunkGBAMBUDNcjs.store.call(void 0, ).query_stats(guarded, {});
1081
1081
  return guarded.filter((stream) => {
1082
1082
  if (_optionalChain([heads, 'access', _55 => _55.get, 'call', _56 => _56(stream), 'optionalAccess', _57 => _57.head, 'access', _58 => _58.id]) === guard_events.get(stream).id)
1083
1083
  return true;
@@ -1100,13 +1100,13 @@ async function truncate_and_warm_cache(guarded, seed_states, guard_events, corre
1100
1100
  }
1101
1101
  };
1102
1102
  });
1103
- const truncated = await _chunkBTLM7SW4cjs.store.call(void 0, ).truncate(trunc_targets);
1103
+ const truncated = await _chunkGBAMBUDNcjs.store.call(void 0, ).truncate(trunc_targets);
1104
1104
  await Promise.all(
1105
1105
  guarded.map(async (stream) => {
1106
1106
  const entry = truncated.get(stream);
1107
1107
  const state2 = seed_states.get(stream);
1108
1108
  if (state2 && entry) {
1109
- await _chunkBTLM7SW4cjs.cache.call(void 0, ).set(stream, {
1109
+ await _chunkGBAMBUDNcjs.cache.call(void 0, ).set(stream, {
1110
1110
  stream,
1111
1111
  state: state2,
1112
1112
  version: entry.committed.version,
@@ -1115,7 +1115,7 @@ async function truncate_and_warm_cache(guarded, seed_states, guard_events, corre
1115
1115
  snaps: 1
1116
1116
  });
1117
1117
  } else {
1118
- await _chunkBTLM7SW4cjs.cache.call(void 0, ).invalidate(stream);
1118
+ await _chunkGBAMBUDNcjs.cache.call(void 0, ).invalidate(stream);
1119
1119
  }
1120
1120
  })
1121
1121
  );
@@ -1129,7 +1129,7 @@ var _crypto = require('crypto');
1129
1129
  function report_once(seen, key, message) {
1130
1130
  if (seen.has(key)) return;
1131
1131
  seen.add(key);
1132
- _chunkBTLM7SW4cjs.log.call(void 0, ).error(new Error(message));
1132
+ _chunkGBAMBUDNcjs.log.call(void 0, ).error(new Error(message));
1133
1133
  }
1134
1134
 
1135
1135
  // src/internal/correlate-cycle.ts
@@ -1180,7 +1180,7 @@ var CorrelateCycle = (_class3 = class {
1180
1180
  // never lets a resolution re-lane them.
1181
1181
 
1182
1182
  __init11() {this._static_subscriptions = /* @__PURE__ */ new Map()}
1183
- __init12() {this._patterns = new (0, _chunkBTLM7SW4cjs.LruMap)(PATTERN_CACHE_SIZE)}
1183
+ __init12() {this._patterns = new (0, _chunkGBAMBUDNcjs.LruMap)(PATTERN_CACHE_SIZE)}
1184
1184
 
1185
1185
 
1186
1186
 
@@ -1198,7 +1198,7 @@ var CorrelateCycle = (_class3 = class {
1198
1198
  on_init
1199
1199
  }) {;_class3.prototype.__init3.call(this);_class3.prototype.__init4.call(this);_class3.prototype.__init5.call(this);_class3.prototype.__init6.call(this);_class3.prototype.__init7.call(this);_class3.prototype.__init8.call(this);_class3.prototype.__init9.call(this);_class3.prototype.__init10.call(this);_class3.prototype.__init11.call(this);_class3.prototype.__init12.call(this);_class3.prototype.__init13.call(this);
1200
1200
  this._key = shard ? `${registry_key(registry.events)}:${[...shard].sort().join(",")}` : registry_key(registry.events);
1201
- this._dynamic_subscriptions = new (0, _chunkBTLM7SW4cjs.LruMap)(max_subscribed_streams);
1201
+ this._dynamic_subscriptions = new (0, _chunkGBAMBUDNcjs.LruMap)(max_subscribed_streams);
1202
1202
  this._registry = registry;
1203
1203
  this._declared_lanes = declared_lanes;
1204
1204
  this._static_targets = static_targets;
@@ -1256,7 +1256,7 @@ var CorrelateCycle = (_class3 = class {
1256
1256
  /** Would the target's own `fetch` (filtered by `source`) return this event? */
1257
1257
  _in_fetch_window(source, stream) {
1258
1258
  if (source === void 0 || source === stream) return true;
1259
- if (_chunkBTLM7SW4cjs.is_literal_source.call(void 0, source)) return false;
1259
+ if (_chunkGBAMBUDNcjs.is_literal_source.call(void 0, source)) return false;
1260
1260
  let pattern = this._patterns.get(source);
1261
1261
  if (!pattern) {
1262
1262
  pattern = new RegExp(source);
@@ -1299,7 +1299,7 @@ var CorrelateCycle = (_class3 = class {
1299
1299
  const correlated = /* @__PURE__ */ new Map();
1300
1300
  let last_id = after;
1301
1301
  let stopped = false;
1302
- const found = await _chunkBTLM7SW4cjs.store.call(void 0, ).query(
1302
+ const found = await _chunkGBAMBUDNcjs.store.call(void 0, ).query(
1303
1303
  (event) => {
1304
1304
  if (stopped) return;
1305
1305
  const register = this._registry.events[event.name];
@@ -1422,7 +1422,7 @@ var CorrelateCycle = (_class3 = class {
1422
1422
  await Promise.all(
1423
1423
  missed.map(async ([stream, entry]) => {
1424
1424
  let row;
1425
- await _chunkBTLM7SW4cjs.store.call(void 0, ).query_streams(
1425
+ await _chunkGBAMBUDNcjs.store.call(void 0, ).query_streams(
1426
1426
  (position) => {
1427
1427
  row = position;
1428
1428
  },
@@ -1461,7 +1461,7 @@ var CorrelateCycle = (_class3 = class {
1461
1461
  millis: 0
1462
1462
  });
1463
1463
  } catch (error) {
1464
- _chunkBTLM7SW4cjs.log.call(void 0, ).warn(
1464
+ _chunkGBAMBUDNcjs.log.call(void 0, ).warn(
1465
1465
  `Could not hand back the correlation lease during shutdown; it expires on its own within ${CORRELATION_LEASE_MS}ms and correlation resumes normally after that. On a single-writer store this usually means another connection holds the database. Cause: ${String(error)}`
1466
1466
  );
1467
1467
  }
@@ -1614,14 +1614,14 @@ function compute_lag_lead_ratio(handled, lagging, leading) {
1614
1614
  }
1615
1615
 
1616
1616
  // src/internal/drain-ops.ts
1617
- var claim = (lagging, leading, by, millis, lane) => _chunkBTLM7SW4cjs.store.call(void 0, ).claim(lagging, leading, by, millis, lane);
1617
+ var claim = (lagging, leading, by, millis, lane) => _chunkGBAMBUDNcjs.store.call(void 0, ).claim(lagging, leading, by, millis, lane);
1618
1618
  async function fetch(leased, eventLimit) {
1619
1619
  return Promise.all(
1620
1620
  leased.map(async ({ stream, source, at, lagging }) => {
1621
1621
  const events = [];
1622
- const stream_exact = source !== void 0 && _chunkBTLM7SW4cjs.is_literal_source.call(void 0, source) ? true : void 0;
1622
+ const stream_exact = source !== void 0 && _chunkGBAMBUDNcjs.is_literal_source.call(void 0, source) ? true : void 0;
1623
1623
  try {
1624
- await _chunkBTLM7SW4cjs.store.call(void 0, ).query((e) => events.push(e), {
1624
+ await _chunkGBAMBUDNcjs.store.call(void 0, ).query((e) => events.push(e), {
1625
1625
  stream: source,
1626
1626
  stream_exact,
1627
1627
  after: at,
@@ -1641,30 +1641,30 @@ async function fetch(leased, eventLimit) {
1641
1641
  })
1642
1642
  );
1643
1643
  }
1644
- var ack = (leases) => _chunkBTLM7SW4cjs.store.call(void 0, ).ack(leases);
1645
- var block = (leases) => _chunkBTLM7SW4cjs.store.call(void 0, ).block(leases);
1646
- var subscribe = (streams, correlated_at, correlator) => _chunkBTLM7SW4cjs.store.call(void 0, ).subscribe(streams, correlated_at, correlator);
1644
+ var ack = (leases) => _chunkGBAMBUDNcjs.store.call(void 0, ).ack(leases);
1645
+ var block = (leases) => _chunkGBAMBUDNcjs.store.call(void 0, ).block(leases);
1646
+ var subscribe = (streams, correlated_at, correlator) => _chunkGBAMBUDNcjs.store.call(void 0, ).subscribe(streams, correlated_at, correlator);
1647
1647
 
1648
1648
  // src/internal/event-sourcing.ts
1649
1649
  var _actpatch = require('@rotorsoft/act-patch');
1650
1650
  var bare_patch = (_me, state2, partial) => _actpatch.patch.call(void 0, state2, partial);
1651
1651
  var validating_patch = (me, state2, partial, event) => {
1652
1652
  const next = _actpatch.patch.call(void 0, state2, partial);
1653
- return _chunkBTLM7SW4cjs.validate.call(void 0,
1653
+ return _chunkGBAMBUDNcjs.validate.call(void 0,
1654
1654
  `${me.name}.${String(event.name)}#${event.id}`,
1655
1655
  next,
1656
1656
  me.state
1657
1657
  );
1658
1658
  };
1659
1659
  var DEFAULT_BATCH = 500;
1660
- var cache_put = (stream, entry) => _chunkBTLM7SW4cjs.cache.call(void 0, ).set(stream, entry).catch(
1661
- (err) => _chunkBTLM7SW4cjs.log.call(void 0, ).warn(
1660
+ var cache_put = (stream, entry) => _chunkGBAMBUDNcjs.cache.call(void 0, ).set(stream, entry).catch(
1661
+ (err) => _chunkGBAMBUDNcjs.log.call(void 0, ).warn(
1662
1662
  err,
1663
1663
  "cache set skipped; the next load re-folds from the store"
1664
1664
  )
1665
1665
  );
1666
- var cache_drop = (stream) => _chunkBTLM7SW4cjs.cache.call(void 0, ).invalidate(stream).catch(
1667
- (err) => _chunkBTLM7SW4cjs.log.call(void 0, ).warn(
1666
+ var cache_drop = (stream) => _chunkGBAMBUDNcjs.cache.call(void 0, ).invalidate(stream).catch(
1667
+ (err) => _chunkGBAMBUDNcjs.log.call(void 0, ).warn(
1668
1668
  err,
1669
1669
  "cache invalidate skipped; a stale checkpoint re-folds from its event_id"
1670
1670
  )
@@ -1672,7 +1672,7 @@ var cache_drop = (stream) => _chunkBTLM7SW4cjs.cache.call(void 0, ).invalidate(s
1672
1672
  async function snap(snapshot) {
1673
1673
  const { id, stream, name, meta, version } = snapshot.event;
1674
1674
  try {
1675
- const [committed] = await _chunkBTLM7SW4cjs.store.call(void 0, ).commit(
1675
+ const [committed] = await _chunkGBAMBUDNcjs.store.call(void 0, ).commit(
1676
1676
  stream,
1677
1677
  [{ name: _chunkRF5MV72Kcjs.SNAP_EVENT, data: snapshot.state }],
1678
1678
  {
@@ -1685,14 +1685,14 @@ async function snap(snapshot) {
1685
1685
  return committed;
1686
1686
  } catch (error) {
1687
1687
  const reason = error instanceof Error ? error.message : String(error);
1688
- _chunkBTLM7SW4cjs.log.call(void 0, ).warn(
1688
+ _chunkGBAMBUDNcjs.log.call(void 0, ).warn(
1689
1689
  `Snapshot write failed on stream "${stream}": ${reason} \u2014 cold starts will replay full history until snapshots succeed.`
1690
1690
  );
1691
1691
  }
1692
1692
  }
1693
1693
  async function tombstone(stream, expectedVersion, correlation) {
1694
1694
  try {
1695
- const [committed] = await _chunkBTLM7SW4cjs.store.call(void 0, ).commit(
1695
+ const [committed] = await _chunkGBAMBUDNcjs.store.call(void 0, ).commit(
1696
1696
  stream,
1697
1697
  [{ name: _chunkRF5MV72Kcjs.TOMBSTONE_EVENT, data: {} }],
1698
1698
  { correlation, causation: {} },
@@ -1825,14 +1825,14 @@ async function scan(source, opts = {}, callback) {
1825
1825
  async function load(me, target, callback, patch_fn = bare_patch) {
1826
1826
  const { stream, actor, asOf } = target;
1827
1827
  const time_travel = !!asOf && Object.values(asOf).some((v) => v !== void 0);
1828
- const cached = time_travel ? void 0 : await _chunkBTLM7SW4cjs.cache.call(void 0, ).get(stream);
1828
+ const cached = time_travel ? void 0 : await _chunkGBAMBUDNcjs.cache.call(void 0, ).get(stream);
1829
1829
  const cache_hit = !!cached;
1830
1830
  let state2 = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _72 => _72.state]), () => ( (me.init ? me.init() : {})));
1831
1831
  let patches = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _73 => _73.patches]), () => ( 0));
1832
1832
  let snaps = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _74 => _74.snaps]), () => ( 0));
1833
1833
  let replayed = 0;
1834
1834
  let event;
1835
- await _chunkBTLM7SW4cjs.store.call(void 0, ).query(
1835
+ await _chunkGBAMBUDNcjs.store.call(void 0, ).query(
1836
1836
  (raw) => {
1837
1837
  event = me.view(raw, actor);
1838
1838
  if (event.name === _chunkRF5MV72Kcjs.SNAP_EVENT) {
@@ -1845,7 +1845,7 @@ async function load(me, target, callback, patch_fn = bare_patch) {
1845
1845
  patches++;
1846
1846
  replayed++;
1847
1847
  } else if (event.name !== _chunkRF5MV72Kcjs.TOMBSTONE_EVENT) {
1848
- _chunkBTLM7SW4cjs.log.call(void 0, ).warn(
1848
+ _chunkGBAMBUDNcjs.log.call(void 0, ).warn(
1849
1849
  `Skipping unknown event "${String(event.name)}" on stream "${stream}" (id=${event.id}) \u2014 no reducer in state "${me.name}"`
1850
1850
  );
1851
1851
  }
@@ -1897,7 +1897,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
1897
1897
  if (!stream) throw new Error("Missing target stream");
1898
1898
  const reactingTo = _optionalChain([options, 'optionalAccess', _81 => _81.reactingTo]);
1899
1899
  const correlator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _82 => _82.correlator]), () => ( default_correlator));
1900
- const validated = _chunkBTLM7SW4cjs.validate.call(void 0, action2, payload, me.actions[action2]);
1900
+ const validated = _chunkGBAMBUDNcjs.validate.call(void 0, action2, payload, me.actions[action2]);
1901
1901
  const opts = _optionalChain([me, 'access', _83 => _83.options, 'optionalAccess', _84 => _84[action2]]);
1902
1902
  const max_retries = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _85 => _85.maxRetries]), () => ( 0));
1903
1903
  for (let attempt = 0; ; attempt++) {
@@ -1911,32 +1911,25 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
1911
1911
  if (_optionalChain([snapshot, 'access', _86 => _86.event, 'optionalAccess', _87 => _87.name]) === _chunkRF5MV72Kcjs.TOMBSTONE_EVENT)
1912
1912
  throw new (0, _chunkRF5MV72Kcjs.StreamClosedError)(stream);
1913
1913
  const expected = _nullishCoalesce(expectedVersion, () => ( (snapshot.version >= 0 ? snapshot.version : void 0)));
1914
- if (me.given) {
1915
- const invariants = me.given[action2] || [];
1916
- invariants.forEach(({ valid: valid2, description }) => {
1917
- if (!valid2(snapshot.state, actor))
1918
- throw new (0, _chunkRF5MV72Kcjs.InvariantError)(
1919
- action2,
1920
- validated,
1921
- target,
1922
- snapshot,
1923
- description
1924
- );
1925
- });
1926
- }
1927
- if (me.requires) {
1928
- const preconditions = me.requires[action2] || [];
1929
- for (const { holds, description } of preconditions)
1930
- if (!holds(validated, snapshot.state, actor))
1931
- throw new (0, _chunkRF5MV72Kcjs.InvariantError)(
1932
- action2,
1933
- validated,
1934
- target,
1935
- snapshot,
1936
- description,
1937
- "precondition"
1938
- );
1939
- }
1914
+ for (const { valid: valid2, description } of _nullishCoalesce(_optionalChain([me, 'access', _88 => _88.given, 'optionalAccess', _89 => _89[action2]]), () => ( [])))
1915
+ if (!valid2(snapshot.state, actor))
1916
+ throw new (0, _chunkRF5MV72Kcjs.InvariantError)(
1917
+ action2,
1918
+ validated,
1919
+ target,
1920
+ snapshot,
1921
+ description
1922
+ );
1923
+ for (const { holds, description } of _nullishCoalesce(_optionalChain([me, 'access', _90 => _90.requires, 'optionalAccess', _91 => _91[action2]]), () => ( [])))
1924
+ if (!holds(validated, snapshot.state, actor))
1925
+ throw new (0, _chunkRF5MV72Kcjs.InvariantError)(
1926
+ action2,
1927
+ validated,
1928
+ target,
1929
+ snapshot,
1930
+ description,
1931
+ "precondition"
1932
+ );
1940
1933
  const result = me.on[action2](validated, snapshot, target);
1941
1934
  if (!result) return [snapshot];
1942
1935
  if (Array.isArray(result) && result.length === 0) {
@@ -1945,11 +1938,11 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
1945
1938
  const tuples = Array.isArray(result[0]) ? result : [result];
1946
1939
  const valid = tuples.map(([name, data]) => ({
1947
1940
  name,
1948
- data: _chunkBTLM7SW4cjs.validate.call(void 0, name, data, me.events[name])
1941
+ data: _chunkGBAMBUDNcjs.validate.call(void 0, name, data, me.events[name])
1949
1942
  }));
1950
1943
  const emitted = valid.map((e) => me.message(e));
1951
1944
  const meta = {
1952
- correlation: _optionalChain([reactingTo, 'optionalAccess', _88 => _88.meta, 'access', _89 => _89.correlation]) || correlator({
1945
+ correlation: _optionalChain([reactingTo, 'optionalAccess', _92 => _92.meta, 'access', _93 => _93.correlation]) || correlator({
1953
1946
  action: action2,
1954
1947
  state: me.name,
1955
1948
  stream,
@@ -1970,7 +1963,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
1970
1963
  };
1971
1964
  let committed;
1972
1965
  try {
1973
- committed = await _chunkBTLM7SW4cjs.store.call(void 0, ).commit(
1966
+ committed = await _chunkGBAMBUDNcjs.store.call(void 0, ).commit(
1974
1967
  stream,
1975
1968
  emitted,
1976
1969
  meta,
@@ -2002,15 +1995,15 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
2002
1995
  });
2003
1996
  const last = snapshots.at(-1);
2004
1997
  const contiguous = committed[0].version === snapshot.version + 1;
2005
- const snapped = contiguous && _optionalChain([me, 'access', _90 => _90.snap, 'optionalCall', _91 => _91(last)]);
1998
+ const snapped = contiguous && _optionalChain([me, 'access', _94 => _94.snap, 'optionalCall', _95 => _95(last)]);
2006
1999
  const snap_event = snapped ? await snap(last) : void 0;
2007
2000
  if (!me.pii_aware) {
2008
2001
  if (contiguous)
2009
2002
  void cache_put(stream, {
2010
2003
  stream,
2011
2004
  state: last.state,
2012
- version: _nullishCoalesce(_optionalChain([snap_event, 'optionalAccess', _92 => _92.version]), () => ( last.event.version)),
2013
- event_id: _nullishCoalesce(_optionalChain([snap_event, 'optionalAccess', _93 => _93.id]), () => ( last.event.id)),
2005
+ version: _nullishCoalesce(_optionalChain([snap_event, 'optionalAccess', _96 => _96.version]), () => ( last.event.version)),
2006
+ event_id: _nullishCoalesce(_optionalChain([snap_event, 'optionalAccess', _97 => _97.id]), () => ( last.event.id)),
2014
2007
  patches: snap_event ? 0 : last.patches,
2015
2008
  snaps: snap_event ? last.snaps + 1 : last.snaps
2016
2009
  });
@@ -2021,16 +2014,16 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
2021
2014
  if (!(error instanceof _chunkRF5MV72Kcjs.ConcurrencyError)) throw error;
2022
2015
  if (expectedVersion !== void 0) throw error;
2023
2016
  if (attempt >= max_retries) throw error;
2024
- if (_optionalChain([opts, 'optionalAccess', _94 => _94.backoff])) {
2017
+ if (_optionalChain([opts, 'optionalAccess', _98 => _98.backoff])) {
2025
2018
  const delay_ms = compute_backoff_delay(attempt, opts.backoff);
2026
- if (delay_ms > 0) await _chunkBTLM7SW4cjs.sleep.call(void 0, delay_ms);
2019
+ if (delay_ms > 0) await _chunkGBAMBUDNcjs.sleep.call(void 0, delay_ms);
2027
2020
  }
2028
2021
  }
2029
2022
  }
2030
2023
  }
2031
2024
 
2032
2025
  // src/internal/tracing.ts
2033
- var PRETTY = _chunkBTLM7SW4cjs.config.call(void 0, ).env !== "production";
2026
+ var PRETTY = _chunkGBAMBUDNcjs.config.call(void 0, ).env !== "production";
2034
2027
  var C_BLUE = "\x1B[38;5;39m";
2035
2028
  var C_ORANGE = "\x1B[38;5;208m";
2036
2029
  var C_GREEN = "\x1B[38;5;42m";
@@ -2076,9 +2069,9 @@ var as_of_marker = (asOf) => {
2076
2069
  return parts.length ? ` (as-of ${parts.join(" ")})` : " (as-of)";
2077
2070
  };
2078
2071
  var traced = (inner, exit, entry) => (async (...args) => {
2079
- _optionalChain([entry, 'optionalCall', _95 => _95(...args)]);
2072
+ _optionalChain([entry, 'optionalCall', _99 => _99(...args)]);
2080
2073
  const result = await inner(...args);
2081
- _optionalChain([exit, 'optionalCall', _96 => _96(result, ...args)]);
2074
+ _optionalChain([exit, 'optionalCall', _100 => _100(result, ...args)]);
2082
2075
  return result;
2083
2076
  });
2084
2077
  function build_es(logger, correlator = default_correlator, patch_fn = bare_patch) {
@@ -2163,7 +2156,7 @@ function build_drain(logger) {
2163
2156
  subscribe: logger.level !== "trace" ? subscribe : traced(subscribe, (result, streams) => {
2164
2157
  if (!result.subscribed) return;
2165
2158
  const lanes = new Set(streams.map((s) => _nullishCoalesce(s.lane, () => ( "default"))));
2166
- const uniform_lane = lanes.size === 1 ? _optionalChain([streams, 'access', _97 => _97[0], 'optionalAccess', _98 => _98.lane]) : void 0;
2159
+ const uniform_lane = lanes.size === 1 ? _optionalChain([streams, 'access', _101 => _101[0], 'optionalAccess', _102 => _102.lane]) : void 0;
2167
2160
  const data = streams.map(
2168
2161
  ({ stream, lane }) => uniform_lane || !lane || lane === "default" ? hue(C_STREAM, stream) : `${hue(C_STREAM, stream)}${dim(`[${lane}]`)}`
2169
2162
  ).join(" ");
@@ -2175,7 +2168,7 @@ function build_drain(logger) {
2175
2168
  }
2176
2169
  function trace_cycle(logger, leased, fetched, handled, acked, blocked) {
2177
2170
  if (logger.level !== "trace" || !leased.length) return;
2178
- const lane = _optionalChain([leased, 'access', _99 => _99[0], 'optionalAccess', _100 => _100.lane]);
2171
+ const lane = _optionalChain([leased, 'access', _103 => _103[0], 'optionalAccess', _104 => _104.lane]);
2179
2172
  const fetch_by_stream = new Map(fetched.map((f) => [f.stream, f]));
2180
2173
  const acked_by_stream = new Map(acked.map((a) => [a.stream, a.at]));
2181
2174
  const blocked_by_stream = new Map(blocked.map((b) => [b.stream, b.error]));
@@ -2184,8 +2177,8 @@ function trace_cycle(logger, leased, fetched, handled, acked, blocked) {
2184
2177
  );
2185
2178
  const detail = leased.map(({ stream, at, retry }) => {
2186
2179
  const f = fetch_by_stream.get(stream);
2187
- const key = _optionalChain([f, 'optionalAccess', _101 => _101.source]) ? `${hue(C_STREAM, stream)}${dim(`<-${f.source}`)}` : hue(C_STREAM, stream);
2188
- const events = _optionalChain([f, 'optionalAccess', _102 => _102.events, 'access', _103 => _103.length]) ? ` ${dim(
2180
+ const key = _optionalChain([f, 'optionalAccess', _105 => _105.source]) ? `${hue(C_STREAM, stream)}${dim(`<-${f.source}`)}` : hue(C_STREAM, stream);
2181
+ const events = _optionalChain([f, 'optionalAccess', _106 => _106.events, 'access', _107 => _107.length]) ? ` ${dim(
2189
2182
  `[${f.events.map(({ id, name }) => `#${id} ${String(name)}`).join(", ")}]`
2190
2183
  )}` : "";
2191
2184
  const acked_at = acked_by_stream.get(stream);
@@ -2213,10 +2206,10 @@ function trace_cycle(logger, leased, fetched, handled, acked, blocked) {
2213
2206
 
2214
2207
  // src/internal/drain-cycle.ts
2215
2208
  function budget_exhausted(lease, options, store_failing) {
2216
- if (store_failing || !_optionalChain([options, 'optionalAccess', _104 => _104.blockOnError]) || lease.retry <= options.maxRetries)
2209
+ if (store_failing || !_optionalChain([options, 'optionalAccess', _108 => _108.blockOnError]) || lease.retry <= options.maxRetries)
2217
2210
  return void 0;
2218
2211
  const error = `Blocking ${lease.stream} after ${lease.retry} claims with no acknowledged progress \u2014 the retry budget (${options.maxRetries}) was spent without the handler ever reporting an error. That means every attempt lost its lease before it could ack: move the reaction to a lane whose leaseMillis covers the handler, then unblock the stream.`;
2219
- _chunkBTLM7SW4cjs.log.call(void 0, ).error(error);
2212
+ _chunkGBAMBUDNcjs.log.call(void 0, ).error(error);
2220
2213
  return { lease, handled: 0, acked_at: lease.at, error, block: true };
2221
2214
  }
2222
2215
  function fetch_failure_policy(registry) {
@@ -2238,7 +2231,7 @@ function finalize(lease, handled, at, error, options, logger, failed_at) {
2238
2231
  logger.error(
2239
2232
  non_retryable ? `Blocking ${lease.stream} on non-retryable error.` : `Blocking ${lease.stream} after ${lease.retry} retries.`
2240
2233
  );
2241
- const next_attempt_at = block2 ? void 0 : Date.now() + compute_backoff_delay(lease.retry, _nullishCoalesce(options.backoff, () => ( _chunkBTLM7SW4cjs.DEFAULT_BACKOFF)));
2234
+ const next_attempt_at = block2 ? void 0 : Date.now() + compute_backoff_delay(lease.retry, _nullishCoalesce(options.backoff, () => ( _chunkGBAMBUDNcjs.DEFAULT_BACKOFF)));
2242
2235
  return {
2243
2236
  lease,
2244
2237
  handled,
@@ -2277,7 +2270,7 @@ async function run_drain_cycle(deps, cycle) {
2277
2270
  const fetched = await ops.fetch(leased, eventLimit);
2278
2271
  const fetch_map = /* @__PURE__ */ new Map();
2279
2272
  const fetch_window_at = fetched.reduce(
2280
- (max, { at, events }) => Math.max(max, _optionalChain([events, 'access', _105 => _105.at, 'call', _106 => _106(-1), 'optionalAccess', _107 => _107.id]) || at),
2273
+ (max, { at, events }) => Math.max(max, _optionalChain([events, 'access', _109 => _109.at, 'call', _110 => _110(-1), 'optionalAccess', _111 => _111.id]) || at),
2281
2274
  0
2282
2275
  );
2283
2276
  for (const f of fetched) {
@@ -2341,11 +2334,11 @@ async function run_drain_cycle(deps, cycle) {
2341
2334
  deps.logger
2342
2335
  )
2343
2336
  );
2344
- const at = _optionalChain([entry, 'access', _108 => _108.fetch, 'access', _109 => _109.events, 'access', _110 => _110.at, 'call', _111 => _111(-1), 'optionalAccess', _112 => _112.id]) || fetch_window_at;
2337
+ const at = _optionalChain([entry, 'access', _112 => _112.fetch, 'access', _113 => _113.events, 'access', _114 => _114.at, 'call', _115 => _115(-1), 'optionalAccess', _116 => _116.id]) || fetch_window_at;
2345
2338
  const { payloads } = entry;
2346
2339
  const exhausted = budget_exhausted(
2347
2340
  lease,
2348
- _optionalChain([payloads, 'access', _113 => _113[0], 'optionalAccess', _114 => _114.options]),
2341
+ _optionalChain([payloads, 'access', _117 => _117[0], 'optionalAccess', _118 => _118.options]),
2349
2342
  store_failing
2350
2343
  );
2351
2344
  if (exhausted) return Promise.resolve(exhausted);
@@ -2366,7 +2359,7 @@ async function run_drain_cycle(deps, cycle) {
2366
2359
  const acked = submitted.length ? await ops.ack(submitted) : [];
2367
2360
  const expected = submitted.filter((l) => l.due === void 0).length;
2368
2361
  if (acked.length < expected)
2369
- _chunkBTLM7SW4cjs.log.call(void 0, ).warn(
2362
+ _chunkGBAMBUDNcjs.log.call(void 0, ).warn(
2370
2363
  `drain: ${expected - acked.length} of ${expected} acks were dropped \u2014 the lease was taken by another worker mid-handler. That work will be redelivered (at-least-once), but persistent drops mean leaseMillis is too short for this handler.`
2371
2364
  );
2372
2365
  const closeable = handled.filter((h) => h.close !== void 0).map((h) => h.close);
@@ -2434,7 +2427,7 @@ var DrainController = (_class5 = class {
2434
2427
  }
2435
2428
  /** This lane's configured lease, or `undefined`; the shutdown grace basis. */
2436
2429
  get lease_millis() {
2437
- return _optionalChain([this, 'access', _115 => _115._deps, 'access', _116 => _116.defaults, 'optionalAccess', _117 => _117.leaseMillis]);
2430
+ return _optionalChain([this, 'access', _119 => _119._deps, 'access', _120 => _120.defaults, 'optionalAccess', _121 => _121.leaseMillis]);
2438
2431
  }
2439
2432
  get lane() {
2440
2433
  return this._deps.lane;
@@ -2466,9 +2459,9 @@ var DrainController = (_class5 = class {
2466
2459
  if (!this.armed || this._stopped || this._inflight)
2467
2460
  return EMPTY_DRAIN;
2468
2461
  const d = _nullishCoalesce(this._deps.defaults, () => ( {}));
2469
- const streamLimit = _nullishCoalesce(_nullishCoalesce(d.streamLimit, () => ( options.streamLimit)), () => ( _chunkBTLM7SW4cjs.DEFAULT_STREAM_LIMIT));
2470
- const eventLimit = _nullishCoalesce(options.eventLimit, () => ( _chunkBTLM7SW4cjs.DEFAULT_EVENT_LIMIT));
2471
- const leaseMillis = _nullishCoalesce(_nullishCoalesce(d.leaseMillis, () => ( options.leaseMillis)), () => ( _chunkBTLM7SW4cjs.DEFAULT_LEASE_MILLIS));
2462
+ const streamLimit = _nullishCoalesce(_nullishCoalesce(d.streamLimit, () => ( options.streamLimit)), () => ( _chunkGBAMBUDNcjs.DEFAULT_STREAM_LIMIT));
2463
+ const eventLimit = _nullishCoalesce(options.eventLimit, () => ( _chunkGBAMBUDNcjs.DEFAULT_EVENT_LIMIT));
2464
+ const leaseMillis = _nullishCoalesce(_nullishCoalesce(d.leaseMillis, () => ( options.leaseMillis)), () => ( _chunkGBAMBUDNcjs.DEFAULT_LEASE_MILLIS));
2472
2465
  if (this._deps.breaker.state(Date.now()) === "open")
2473
2466
  return EMPTY_DRAIN;
2474
2467
  const pass = this._pass(streamLimit, eventLimit, leaseMillis).finally(
@@ -2727,10 +2720,10 @@ var CloseSignal = class extends Error {
2727
2720
  constructor(opts) {
2728
2721
  super("reaction requested close");
2729
2722
  this.name = "CloseSignal";
2730
- this.stream = _optionalChain([opts, 'optionalAccess', _118 => _118.stream]);
2731
- this.archive = _optionalChain([opts, 'optionalAccess', _119 => _119.archive]);
2732
- this.at = _optionalChain([opts, 'optionalAccess', _120 => _120.at]);
2733
- this.before = _optionalChain([opts, 'optionalAccess', _121 => _121.before]);
2723
+ this.stream = _optionalChain([opts, 'optionalAccess', _122 => _122.stream]);
2724
+ this.archive = _optionalChain([opts, 'optionalAccess', _123 => _123.archive]);
2725
+ this.at = _optionalChain([opts, 'optionalAccess', _124 => _124.at]);
2726
+ this.before = _optionalChain([opts, 'optionalAccess', _125 => _125.before]);
2734
2727
  }
2735
2728
  };
2736
2729
  function build_handle(deps) {
@@ -2877,7 +2870,7 @@ var SettleLoop = (_class6 = class {
2877
2870
  this._pending = true;
2878
2871
  return;
2879
2872
  }
2880
- const delay = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _122 => _122.debounceMs]), () => ( this._default_debounce_ms));
2873
+ const delay = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _126 => _126.debounceMs]), () => ( this._default_debounce_ms));
2881
2874
  const due = Date.now() + delay;
2882
2875
  if (this._timer) {
2883
2876
  if (due >= this._due) return;
@@ -3026,7 +3019,7 @@ var Act = (_class7 = class {
3026
3019
  /** Lanes to arm per event; `"all"` when a dynamic resolver hides the lane. */
3027
3020
 
3028
3021
 
3029
- __init27() {this._logger = _chunkBTLM7SW4cjs.log.call(void 0, )}
3022
+ __init27() {this._logger = _chunkGBAMBUDNcjs.log.call(void 0, )}
3030
3023
  /** This Act's ports: its own bag, or the singleton adapters. */
3031
3024
 
3032
3025
  /** Runs a body so internal `store()`/`cache()` calls resolve to `_ports`. */
@@ -3048,9 +3041,9 @@ var Act = (_class7 = class {
3048
3041
  this._lanes = lanes;
3049
3042
  this._declared_lanes = ["default", ...lanes.map((l) => l.name)];
3050
3043
  validate_only_lanes(options, lanes);
3051
- this._ports = _nullishCoalesce(options.scoped, () => ( _chunkBTLM7SW4cjs.default_scope.call(void 0, )));
3044
+ this._ports = _nullishCoalesce(options.scoped, () => ( _chunkGBAMBUDNcjs.default_scope.call(void 0, )));
3052
3045
  const ports = this._ports;
3053
- this._scoped = _chunkBTLM7SW4cjs.make_run_scoped.call(void 0, {
3046
+ this._scoped = _chunkGBAMBUDNcjs.make_run_scoped.call(void 0, {
3054
3047
  // Getters, not a spread: the singletons resolve lazily, so a later
3055
3048
  // `store(...)` / `cache(...)` still takes effect.
3056
3049
  get store() {
@@ -3060,14 +3053,14 @@ var Act = (_class7 = class {
3060
3053
  return ports.cache;
3061
3054
  },
3062
3055
  // Parsed per build, so a bad window throws on every build.
3063
- autoclose_window: _chunkBTLM7SW4cjs.resolveAutocloseConfig.call(void 0, options).autocloseWindow
3056
+ autoclose_window: _chunkGBAMBUDNcjs.resolveAutocloseConfig.call(void 0, options).autocloseWindow
3064
3057
  });
3065
3058
  this._correlator = _nullishCoalesce(options.correlator, () => ( default_correlator));
3066
3059
  this._es = build_es(this._logger, this._correlator, patch_fn);
3067
3060
  this._cd = build_drain(this._logger);
3068
3061
  const handle = build_handle({
3069
3062
  logger: this._logger,
3070
- reaction_scope: _chunkBTLM7SW4cjs.make_reaction_scope.call(void 0, {
3063
+ reaction_scope: _chunkGBAMBUDNcjs.make_reaction_scope.call(void 0, {
3071
3064
  do: this.do.bind(this),
3072
3065
  load: this.load.bind(this),
3073
3066
  query: this.query.bind(this),
@@ -3097,12 +3090,12 @@ var Act = (_class7 = class {
3097
3090
  this._ports.store,
3098
3091
  options.listen !== false
3099
3092
  );
3100
- _chunkBTLM7SW4cjs.register_weak_disposer.call(void 0, new WeakRef(this), (self) => self.shutdown());
3093
+ _chunkGBAMBUDNcjs.register_weak_disposer.call(void 0, new WeakRef(this), (self) => self.shutdown());
3101
3094
  }
3102
3095
  /** Shared by drain, settle and autoclose; bad knobs throw at build. */
3103
3096
  _build_breaker(options) {
3104
3097
  return new CircuitBreaker(
3105
- _chunkBTLM7SW4cjs.resolveCircuitBreakerConfig.call(void 0, options.circuitBreaker),
3098
+ _chunkGBAMBUDNcjs.resolveCircuitBreakerConfig.call(void 0, options.circuitBreaker),
3106
3099
  {
3107
3100
  on_error: (error, circuit) => this._emit_error(error, circuit),
3108
3101
  // When the cooldown elapses, settle once: its scan or claim is the
@@ -3151,7 +3144,7 @@ var Act = (_class7 = class {
3151
3144
  leaseMillis: cfg.leaseMillis
3152
3145
  }
3153
3146
  });
3154
- if (_optionalChain([cfg, 'optionalAccess', _123 => _123.cycleMs]) !== void 0 && options.drain !== false)
3147
+ if (_optionalChain([cfg, 'optionalAccess', _127 => _127.cycleMs]) !== void 0 && options.drain !== false)
3155
3148
  controller.start(cfg.cycleMs);
3156
3149
  controllers.set(name, controller);
3157
3150
  }
@@ -3171,7 +3164,7 @@ var Act = (_class7 = class {
3171
3164
  /** Audit deps, built after the controllers so the lane set is final. */
3172
3165
  _build_audit_deps() {
3173
3166
  return {
3174
- store: _chunkBTLM7SW4cjs.store,
3167
+ store: _chunkGBAMBUDNcjs.store,
3175
3168
  event_to_state: this._event_to_state,
3176
3169
  // Declared lanes, not this process's controllers: a lane another
3177
3170
  // worker drains is not `unknown-lane`.
@@ -3200,10 +3193,10 @@ var Act = (_class7 = class {
3200
3193
  /** Cold start: an idle deferred stream still fires on time after a restart. */
3201
3194
  async _seed_persisted_defers() {
3202
3195
  const now = Date.now();
3203
- await walk_streams(_chunkBTLM7SW4cjs.store.call(void 0, ), (pos) => {
3196
+ await walk_streams(_chunkGBAMBUDNcjs.store.call(void 0, ), (pos) => {
3204
3197
  if (pos.deferred_at === void 0 || pos.deferred_at <= now) return;
3205
3198
  const controller = this._drain_controllers.get(_nullishCoalesce(pos.lane, () => ( "default")));
3206
- _optionalChain([controller, 'optionalAccess', _124 => _124.seed_defer, 'call', _125 => _125(pos.stream, pos.deferred_at)]);
3199
+ _optionalChain([controller, 'optionalAccess', _128 => _128.seed_defer, 'call', _129 => _129(pos.stream, pos.deferred_at)]);
3207
3200
  });
3208
3201
  }
3209
3202
  _build_settle(options) {
@@ -3239,7 +3232,7 @@ var Act = (_class7 = class {
3239
3232
  */
3240
3233
  shutdown(options) {
3241
3234
  if (!this._shutdown_promise) {
3242
- _chunkBTLM7SW4cjs.resolveShutdownConfig.call(void 0, options);
3235
+ _chunkGBAMBUDNcjs.resolveShutdownConfig.call(void 0, options);
3243
3236
  this._shutdown_promise = (async () => {
3244
3237
  this.stop_correlations();
3245
3238
  this._settle.stop(true);
@@ -3247,7 +3240,7 @@ var Act = (_class7 = class {
3247
3240
  for (const c of this._drain_controllers.values()) c.stop();
3248
3241
  const disposer = await this._notify_disposer;
3249
3242
  if (disposer) await disposer();
3250
- await this._await_inflight(_optionalChain([options, 'optionalAccess', _126 => _126.graceMs]));
3243
+ await this._await_inflight(_optionalChain([options, 'optionalAccess', _130 => _130.graceMs]));
3251
3244
  await this._scoped(() => this._correlate.release_correlation());
3252
3245
  this._emitter.removeAllListeners();
3253
3246
  })();
@@ -3259,10 +3252,10 @@ var Act = (_class7 = class {
3259
3252
  * default for none or 0, and for a running settle), capped.
3260
3253
  */
3261
3254
  _derive_grace_ms(running, settling) {
3262
- let max = settling ? _chunkBTLM7SW4cjs.DEFAULT_LEASE_MILLIS : 0;
3255
+ let max = settling ? _chunkGBAMBUDNcjs.DEFAULT_LEASE_MILLIS : 0;
3263
3256
  for (const c of running)
3264
- max = Math.max(max, c.lease_millis || _chunkBTLM7SW4cjs.DEFAULT_LEASE_MILLIS);
3265
- return Math.min(max, _chunkBTLM7SW4cjs.MAX_SHUTDOWN_GRACE_MS);
3257
+ max = Math.max(max, c.lease_millis || _chunkGBAMBUDNcjs.DEFAULT_LEASE_MILLIS);
3258
+ return Math.min(max, _chunkGBAMBUDNcjs.MAX_SHUTDOWN_GRACE_MS);
3266
3259
  }
3267
3260
  async _await_inflight(grace_ms) {
3268
3261
  const running = [...this._drain_controllers.values()].filter(
@@ -3343,8 +3336,8 @@ var Act = (_class7 = class {
3343
3336
  * @see {@link ValidationError}, {@link InvariantError}, {@link ConcurrencyError}
3344
3337
  */
3345
3338
  async do(action2, target, payload, options) {
3346
- const reacting_to = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _127 => _127.reactingTo]), () => ( _chunkBTLM7SW4cjs.current_reacting.call(void 0, )));
3347
- const do_options = reacting_to === _optionalChain([options, 'optionalAccess', _128 => _128.reactingTo]) ? options : { ...options, reactingTo: reacting_to };
3339
+ const reacting_to = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _131 => _131.reactingTo]), () => ( _chunkGBAMBUDNcjs.current_reacting.call(void 0, )));
3340
+ const do_options = reacting_to === _optionalChain([options, 'optionalAccess', _132 => _132.reactingTo]) ? options : { ...options, reactingTo: reacting_to };
3348
3341
  return this._scoped(async () => {
3349
3342
  const snapshots = await this._es.action(
3350
3343
  this.registry.actions[action2],
@@ -3404,11 +3397,11 @@ var Act = (_class7 = class {
3404
3397
  return this._scoped(async () => {
3405
3398
  let first;
3406
3399
  let last;
3407
- const count = await _chunkBTLM7SW4cjs.store.call(void 0, ).query((e) => {
3400
+ const count = await _chunkGBAMBUDNcjs.store.call(void 0, ).query((e) => {
3408
3401
  const gated = this.registry.query_gate(e.name)(e);
3409
3402
  if (!first) first = gated;
3410
3403
  last = gated;
3411
- _optionalChain([callback, 'optionalCall', _129 => _129(gated)]);
3404
+ _optionalChain([callback, 'optionalCall', _133 => _133(gated)]);
3412
3405
  }, query);
3413
3406
  return { first, last, count };
3414
3407
  });
@@ -3434,7 +3427,7 @@ var Act = (_class7 = class {
3434
3427
  async query_array(query) {
3435
3428
  return this._scoped(async () => {
3436
3429
  const events = [];
3437
- await _chunkBTLM7SW4cjs.store.call(void 0, ).query((e) => {
3430
+ await _chunkGBAMBUDNcjs.store.call(void 0, ).query((e) => {
3438
3431
  events.push(this.registry.query_gate(e.name)(e));
3439
3432
  }, query);
3440
3433
  return events;
@@ -3454,14 +3447,14 @@ var Act = (_class7 = class {
3454
3447
  */
3455
3448
  async forget(stream) {
3456
3449
  return this._scoped(async () => {
3457
- const s = _chunkBTLM7SW4cjs.store.call(void 0, );
3450
+ const s = _chunkGBAMBUDNcjs.store.call(void 0, );
3458
3451
  if (!s.forget_pii) {
3459
3452
  throw new Error(
3460
3453
  `Store does not implement forget_pii \u2014 adapter cannot comply with sensitive-data erasure. Use an adapter that declares pii_isolation: true (e.g. @rotorsoft/act on the in-memory store).`
3461
3454
  );
3462
3455
  }
3463
3456
  const eventCount = await s.forget_pii(stream);
3464
- await _chunkBTLM7SW4cjs.cache.call(void 0, ).invalidate(stream);
3457
+ await _chunkGBAMBUDNcjs.cache.call(void 0, ).invalidate(stream);
3465
3458
  if (eventCount > 0) {
3466
3459
  this.emit("forgotten", { stream, at: /* @__PURE__ */ new Date(), eventCount });
3467
3460
  }
@@ -3495,7 +3488,7 @@ var Act = (_class7 = class {
3495
3488
  * @see {@link correlate} for dynamic stream discovery
3496
3489
  */
3497
3490
  async drain(options = {}) {
3498
- _chunkBTLM7SW4cjs.resolveDrainConfig.call(void 0, options);
3491
+ _chunkGBAMBUDNcjs.resolveDrainConfig.call(void 0, options);
3499
3492
  if (!this._drain)
3500
3493
  return { fetched: [], leased: [], acked: [], blocked: [] };
3501
3494
  return this._scoped(() => this._drain_all(options));
@@ -3535,7 +3528,7 @@ var Act = (_class7 = class {
3535
3528
  }
3536
3529
  if (to_arm.size === 0) return false;
3537
3530
  this._correlate.arm();
3538
- for (const lane of to_arm) _optionalChain([this, 'access', _130 => _130._drain_controllers, 'access', _131 => _131.get, 'call', _132 => _132(lane), 'optionalAccess', _133 => _133.arm, 'call', _134 => _134()]);
3531
+ for (const lane of to_arm) _optionalChain([this, 'access', _134 => _134._drain_controllers, 'access', _135 => _135.get, 'call', _136 => _136(lane), 'optionalAccess', _137 => _137.arm, 'call', _138 => _138()]);
3539
3532
  return true;
3540
3533
  }
3541
3534
  /** In parallel, so a slow lane never holds up a fast one. */
@@ -3561,8 +3554,9 @@ var Act = (_class7 = class {
3561
3554
  * the event), and marks their work so the next drain can claim it.
3562
3555
  *
3563
3556
  * @param query - Only `limit` is used: the most events the pass reads
3564
- * (default 10). The scan always starts at the correlation checkpoint,
3565
- * which every reaction shares, so filters and `after` are ignored.
3557
+ * (10 when the query has none; `0` reads everything). The scan always
3558
+ * starts at the correlation checkpoint, which every reaction shares, so
3559
+ * filters and `after` are ignored.
3566
3560
  * @returns The number of newly subscribed streams and the last scanned event id
3567
3561
  *
3568
3562
  * @example Manual correlation
@@ -3572,8 +3566,8 @@ var Act = (_class7 = class {
3572
3566
  *
3573
3567
  * @see {@link start_correlations} for automatic periodic correlation
3574
3568
  */
3575
- async correlate(query = { limit: 10 }) {
3576
- const pass = await this._correlate_pass(query);
3569
+ async correlate(query = {}) {
3570
+ const pass = await this._correlate_pass({ limit: _nullishCoalesce(query.limit, () => ( 10)) });
3577
3571
  return {
3578
3572
  subscribed: pass.kind === "scanned" ? pass.subscribed : 0,
3579
3573
  last_id: pass.last_id
@@ -3675,9 +3669,9 @@ var Act = (_class7 = class {
3675
3669
  */
3676
3670
  async reset(input) {
3677
3671
  return this._scoped(async () => {
3678
- const count = await _chunkBTLM7SW4cjs.store.call(void 0, ).reset(input);
3672
+ const count = await _chunkGBAMBUDNcjs.store.call(void 0, ).reset(input);
3679
3673
  for (const handler of this._batch_handlers.values())
3680
- _optionalChain([handler, 'access', _135 => _135[FOLD_RESET], 'optionalCall', _136 => _136()]);
3674
+ _optionalChain([handler, 'access', _139 => _139[FOLD_RESET], 'optionalCall', _140 => _140()]);
3681
3675
  if (count > 0) {
3682
3676
  this._wake();
3683
3677
  }
@@ -3711,7 +3705,7 @@ var Act = (_class7 = class {
3711
3705
  */
3712
3706
  async unblock(input) {
3713
3707
  return this._scoped(async () => {
3714
- const count = await _chunkBTLM7SW4cjs.store.call(void 0, ).unblock(input);
3708
+ const count = await _chunkGBAMBUDNcjs.store.call(void 0, ).unblock(input);
3715
3709
  if (count > 0) {
3716
3710
  this._wake();
3717
3711
  }
@@ -3766,7 +3760,7 @@ var Act = (_class7 = class {
3766
3760
  return { ...partial, duration_ms: Date.now() - started };
3767
3761
  }
3768
3762
  const target = _nullishCoalesce(sink, () => ( (() => {
3769
- const s = _chunkBTLM7SW4cjs.store.call(void 0, );
3763
+ const s = _chunkGBAMBUDNcjs.store.call(void 0, );
3770
3764
  if (!s.restore) throw new Error("adapter has no restore capability");
3771
3765
  return s;
3772
3766
  })()));
@@ -3812,11 +3806,11 @@ var Act = (_class7 = class {
3812
3806
  async blocked_streams(options) {
3813
3807
  return this._scoped(async () => {
3814
3808
  const positions = [];
3815
- await _chunkBTLM7SW4cjs.store.call(void 0, ).query_streams(
3809
+ await _chunkGBAMBUDNcjs.store.call(void 0, ).query_streams(
3816
3810
  (p) => {
3817
3811
  positions.push(p);
3818
3812
  },
3819
- { blocked: true, after: _optionalChain([options, 'optionalAccess', _137 => _137.after]), limit: _optionalChain([options, 'optionalAccess', _138 => _138.limit]) }
3813
+ { blocked: true, after: _optionalChain([options, 'optionalAccess', _141 => _141.after]), limit: _optionalChain([options, 'optionalAccess', _142 => _142.limit]) }
3820
3814
  );
3821
3815
  return positions;
3822
3816
  });
@@ -3864,7 +3858,7 @@ var Act = (_class7 = class {
3864
3858
  * @see {@link Store.prioritize} for the underlying primitive
3865
3859
  */
3866
3860
  async prioritize(filter, priority) {
3867
- return this._scoped(() => _chunkBTLM7SW4cjs.store.call(void 0, ).prioritize(filter, priority));
3861
+ return this._scoped(() => _chunkGBAMBUDNcjs.store.call(void 0, ).prioritize(filter, priority));
3868
3862
  }
3869
3863
  /** Shared by `close()` and reaction-requested closes. */
3870
3864
  async _run_close(targets) {
@@ -3944,7 +3938,7 @@ var Act = (_class7 = class {
3944
3938
  * @see {@link correlate} for manual correlation
3945
3939
  */
3946
3940
  settle(options) {
3947
- _chunkBTLM7SW4cjs.resolveSettleConfig.call(void 0, _nullishCoalesce(options, () => ( {})));
3941
+ _chunkGBAMBUDNcjs.resolveSettleConfig.call(void 0, _nullishCoalesce(options, () => ( {})));
3948
3942
  this._schedule(options);
3949
3943
  }
3950
3944
  }, _class7);
@@ -4010,12 +4004,12 @@ function policy_min_after_days(options) {
4010
4004
  const parsed = AutoclosePolicySchema.parse(options);
4011
4005
  const windows = [];
4012
4006
  if (parsed.after) windows.push(parsed.after.days);
4013
- if (_optionalChain([parsed, 'access', _139 => _139.or, 'optionalAccess', _140 => _140.after])) windows.push(parsed.or.after.days);
4007
+ if (_optionalChain([parsed, 'access', _143 => _143.or, 'optionalAccess', _144 => _144.after])) windows.push(parsed.or.after.days);
4014
4008
  return windows.length ? Math.min(...windows) : void 0;
4015
4009
  }
4016
4010
  function policy_keep_days(options) {
4017
4011
  const parsed = AutoclosePolicySchema.parse(options);
4018
- return _optionalChain([parsed, 'access', _141 => _141.keep, 'optionalAccess', _142 => _142.days]);
4012
+ return _optionalChain([parsed, 'access', _145 => _145.keep, 'optionalAccess', _146 => _146.days]);
4019
4013
  }
4020
4014
  function compile_autoclose_policy(options) {
4021
4015
  const parsed = AutoclosePolicySchema.parse(options);
@@ -4047,7 +4041,7 @@ function hour_in_zone(now, timeZone) {
4047
4041
  hour: "2-digit",
4048
4042
  hourCycle: "h23"
4049
4043
  }).formatToParts(now);
4050
- return Number(_optionalChain([parts, 'access', _143 => _143.find, 'call', _144 => _144((p) => p.type === "hour"), 'optionalAccess', _145 => _145.value]));
4044
+ return Number(_optionalChain([parts, 'access', _147 => _147.find, 'call', _148 => _148((p) => p.type === "hour"), 'optionalAccess', _149 => _149.value]));
4051
4045
  }
4052
4046
  function hour_in_range(hour, start, end) {
4053
4047
  return start < end ? hour >= start && hour < end : hour >= start || hour < end;
@@ -4100,13 +4094,13 @@ function synthesize_autoclose_reactions(registry, states, read_window) {
4100
4094
  }),
4101
4095
  // Never block on autoclose: a transient query/store error should retry,
4102
4096
  // not quarantine the synthetic stream.
4103
- options: { blockOnError: false, maxRetries: _chunkBTLM7SW4cjs.DEFAULT_MAX_RETRIES },
4097
+ options: { blockOnError: false, maxRetries: _chunkGBAMBUDNcjs.DEFAULT_MAX_RETRIES },
4104
4098
  handler: async (event) => {
4105
4099
  const aggregate = event.stream;
4106
4100
  const window = read_window();
4107
4101
  if (!in_autoclose_window(window, /* @__PURE__ */ new Date()))
4108
4102
  throw new (0, _chunkRF5MV72Kcjs.DeferSignal)({ at: next_window_open(window, /* @__PURE__ */ new Date()) });
4109
- const stats = await _chunkBTLM7SW4cjs.store.call(void 0, ).query_stats([aggregate], {
4103
+ const stats = await _chunkGBAMBUDNcjs.store.call(void 0, ).query_stats([aggregate], {
4110
4104
  count: true,
4111
4105
  tail: keep_days !== void 0 ? true : void 0,
4112
4106
  exclude: [_chunkRF5MV72Kcjs.TOMBSTONE_EVENT, _chunkRF5MV72Kcjs.SNAP_EVENT]
@@ -4145,7 +4139,7 @@ function synthesize_autoclose_reactions(registry, states, read_window) {
4145
4139
  };
4146
4140
  const key = `__autoclose_${st.name}`;
4147
4141
  for (const event_name of Object.keys(st.events)) {
4148
- _optionalChain([registry, 'access', _146 => _146.events, 'access', _147 => _147[event_name], 'optionalAccess', _148 => _148.reactions, 'access', _149 => _149.set, 'call', _150 => _150(
4142
+ _optionalChain([registry, 'access', _150 => _150.events, 'access', _151 => _151[event_name], 'optionalAccess', _152 => _152.reactions, 'access', _153 => _153.set, 'call', _154 => _154(
4149
4143
  key,
4150
4144
  reaction
4151
4145
  )]);
@@ -4230,7 +4224,7 @@ function autoclose_of(existing, state2) {
4230
4224
  }
4231
4225
  function merge_into_existing(state2, existing, states, actions, events) {
4232
4226
  for (const name of Object.keys(state2.actions)) {
4233
- if (existing.actions[name] === state2.actions[name]) continue;
4227
+ if (existing.on[name] === state2.on[name]) continue;
4234
4228
  if (actions[name]) throw new Error(`Duplicate action "${name}"`);
4235
4229
  }
4236
4230
  for (const name of Object.keys(state2.events)) {
@@ -4345,7 +4339,7 @@ var _this_ = ({ stream }) => ({
4345
4339
 
4346
4340
  // src/builders/builder-utils.ts
4347
4341
  function register_lane(config2, lanes) {
4348
- _chunkBTLM7SW4cjs.resolveLaneConfig.call(void 0, config2);
4342
+ _chunkGBAMBUDNcjs.resolveLaneConfig.call(void 0, config2);
4349
4343
  if (config2.name === _chunkRF5MV72Kcjs.DEFAULT_LANE)
4350
4344
  throw new Error(`Lane "${_chunkRF5MV72Kcjs.DEFAULT_LANE}" is reserved`);
4351
4345
  const existing = lanes.find((l) => l.name === config2.name);
@@ -4389,10 +4383,10 @@ function reaction_on(event, events, builder) {
4389
4383
  // Validate the whole bag at the declaration site so a bad
4390
4384
  // `maxRetries`/`backoff`/`blockOnError` throws ZodError at build,
4391
4385
  // not a NaN gate on the first retry.
4392
- options: _chunkBTLM7SW4cjs.resolveReactionConfig.call(void 0, {
4393
- blockOnError: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _151 => _151.blockOnError]), () => ( _chunkBTLM7SW4cjs.DEFAULT_BLOCK_ON_ERROR)),
4394
- maxRetries: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _152 => _152.maxRetries]), () => ( _chunkBTLM7SW4cjs.DEFAULT_MAX_RETRIES)),
4395
- backoff: _optionalChain([options, 'optionalAccess', _153 => _153.backoff])
4386
+ options: _chunkGBAMBUDNcjs.resolveReactionConfig.call(void 0, {
4387
+ blockOnError: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _155 => _155.blockOnError]), () => ( _chunkGBAMBUDNcjs.DEFAULT_BLOCK_ON_ERROR)),
4388
+ maxRetries: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _156 => _156.maxRetries]), () => ( _chunkGBAMBUDNcjs.DEFAULT_MAX_RETRIES)),
4389
+ backoff: _optionalChain([options, 'optionalAccess', _157 => _157.backoff])
4396
4390
  })
4397
4391
  };
4398
4392
  },
@@ -4411,9 +4405,9 @@ function reaction_on(event, events, builder) {
4411
4405
 
4412
4406
  // src/internal/date-reviver.ts
4413
4407
 
4414
- var def_of = (schema) => _nullishCoalesce(_optionalChain([schema, 'access', _154 => _154._zod, 'optionalAccess', _155 => _155.def]), () => ( schema.def));
4408
+ var def_of = (schema) => _nullishCoalesce(_optionalChain([schema, 'access', _158 => _158._zod, 'optionalAccess', _159 => _159.def]), () => ( schema.def));
4415
4409
  function variant_schema(schema) {
4416
- const shape = _optionalChain([def_of, 'call', _156 => _156(schema), 'optionalAccess', _157 => _157.shape]);
4410
+ const shape = _optionalChain([def_of, 'call', _160 => _160(schema), 'optionalAccess', _161 => _161.shape]);
4417
4411
  if (!shape) {
4418
4412
  const dates = date_reviver_schema(schema);
4419
4413
  return { schema: _nullishCoalesce(dates, () => ( schema)), dated: !!dates };
@@ -4461,7 +4455,7 @@ function date_reviver_schema(schema) {
4461
4455
  return variants.some((v) => v.dated) ? _zod2.z.union(variants.map((v) => v.schema)) : void 0;
4462
4456
  }
4463
4457
  case "nullable":
4464
- return _optionalChain([inner, 'call', _158 => _158(), 'optionalAccess', _159 => _159.nullable, 'call', _160 => _160()]);
4458
+ return _optionalChain([inner, 'call', _162 => _162(), 'optionalAccess', _163 => _163.nullable, 'call', _164 => _164()]);
4465
4459
  case "optional":
4466
4460
  case "nonoptional":
4467
4461
  case "readonly":
@@ -4638,7 +4632,7 @@ function act() {
4638
4632
  let _built = false;
4639
4633
  const read_wrap = (original) => {
4640
4634
  const wrapped = async (events, stream) => {
4641
- const read = events.map((e) => _nullishCoalesce(_optionalChain([_hr, 'access', _161 => _161.get, 'call', _162 => _162(e.name), 'optionalCall', _163 => _163(e)]), () => ( e)));
4635
+ const read = events.map((e) => _nullishCoalesce(_optionalChain([_hr, 'access', _165 => _165.get, 'call', _166 => _166(e.name), 'optionalCall', _167 => _167(e)]), () => ( e)));
4642
4636
  return original(read, stream);
4643
4637
  };
4644
4638
  const reset = original[FOLD_RESET];
@@ -4680,7 +4674,7 @@ function act() {
4680
4674
  });
4681
4675
  }
4682
4676
  for (const [action_name, handler] of Object.entries(state2.on)) {
4683
- const static_target = _optionalChain([handler, 'optionalAccess', _164 => _164._static_emit]);
4677
+ const static_target = _optionalChain([handler, 'optionalAccess', _168 => _168._static_emit]);
4684
4678
  if (static_target && deprecated.has(static_target)) {
4685
4679
  const current = current_version_of(static_target, event_names);
4686
4680
  throw new Error(
@@ -4693,7 +4687,7 @@ function act() {
4693
4687
  const list = deprecation_summary.map(
4694
4688
  (d) => `"${d.deprecated}" (current: "${d.current}", state: "${d.state_name}")`
4695
4689
  ).join(", ");
4696
- _chunkBTLM7SW4cjs.log.call(void 0, ).info(
4690
+ _chunkGBAMBUDNcjs.log.call(void 0, ).info(
4697
4691
  `Act registered ${deprecation_summary.length} deprecated event(s): ${list}. These are legacy versions kept for the read path. Consider truncating closed streams via app.close() when feasible to reduce historical event load. See docs/docs/architecture/event-schema-evolution.md.`
4698
4692
  );
4699
4693
  }
@@ -4735,8 +4729,8 @@ function act() {
4735
4729
  return reaction_on(event, registry.events, builder);
4736
4730
  },
4737
4731
  build: (options) => {
4738
- _chunkBTLM7SW4cjs.resolveActConfig.call(void 0, options);
4739
- const patch_fn = _optionalChain([options, 'optionalAccess', _165 => _165.validateFoldedState]) === true ? validating_patch : bare_patch;
4732
+ _chunkGBAMBUDNcjs.resolveActConfig.call(void 0, options);
4733
+ const patch_fn = _optionalChain([options, 'optionalAccess', _169 => _169.validateFoldedState]) === true ? validating_patch : bare_patch;
4740
4734
  if (!_built) {
4741
4735
  for (const proj of pending_projections) add_projection(proj);
4742
4736
  for (const proj of fold_projections) {
@@ -4754,7 +4748,7 @@ function act() {
4754
4748
  `State projection "${proj.target}" of "${fold.name}" is missing events ${missing.join(", ")} \u2014 pass every partial of the state to .of()`
4755
4749
  );
4756
4750
  const claimed = fold_specs.find((s) => s.target === proj.target);
4757
- if (_optionalChain([claimed, 'optionalAccess', _166 => _166.projection]) === proj) continue;
4751
+ if (_optionalChain([claimed, 'optionalAccess', _170 => _170.projection]) === proj) continue;
4758
4752
  if (batch_handlers.has(proj.target) || claimed)
4759
4753
  throw new Error(
4760
4754
  `Duplicate projection target "${proj.target}" \u2014 a target is served by one batch handler or one state projection, never both`
@@ -4787,7 +4781,7 @@ function act() {
4787
4781
  synthesize_autoclose_reactions(
4788
4782
  registry,
4789
4783
  states,
4790
- _chunkBTLM7SW4cjs.current_autoclose_window
4784
+ _chunkGBAMBUDNcjs.current_autoclose_window
4791
4785
  );
4792
4786
  Object.freeze(registry.actions);
4793
4787
  Object.freeze(registry.events);
@@ -4836,8 +4830,8 @@ function _projection(target) {
4836
4830
  handler,
4837
4831
  resolver: _nullishCoalesce(default_resolver, () => ( _this_)),
4838
4832
  options: {
4839
- blockOnError: _chunkBTLM7SW4cjs.DEFAULT_BLOCK_ON_ERROR,
4840
- maxRetries: _chunkBTLM7SW4cjs.DEFAULT_MAX_RETRIES
4833
+ blockOnError: _chunkGBAMBUDNcjs.DEFAULT_BLOCK_ON_ERROR,
4834
+ maxRetries: _chunkGBAMBUDNcjs.DEFAULT_MAX_RETRIES
4841
4835
  }
4842
4836
  }),
4843
4837
  widened
@@ -4878,7 +4872,7 @@ function _projection(target) {
4878
4872
  throw new Error(
4879
4873
  `Projection "${target}" .of() partials must share one state name \u2014 got "${name}" and "${partial.name}"`
4880
4874
  );
4881
- const config2 = _chunkBTLM7SW4cjs.resolveFoldConfig.call(void 0, options);
4875
+ const config2 = _chunkGBAMBUDNcjs.resolveFoldConfig.call(void 0, options);
4882
4876
  const fold_events = {};
4883
4877
  for (const partial of partials)
4884
4878
  for (const [event_name, schema] of Object.entries(partial.events)) {
@@ -4896,8 +4890,8 @@ function _projection(target) {
4896
4890
  handler: noop,
4897
4891
  resolver: { target },
4898
4892
  options: {
4899
- blockOnError: _chunkBTLM7SW4cjs.DEFAULT_BLOCK_ON_ERROR,
4900
- maxRetries: _chunkBTLM7SW4cjs.DEFAULT_MAX_RETRIES
4893
+ blockOnError: _chunkGBAMBUDNcjs.DEFAULT_BLOCK_ON_ERROR,
4894
+ maxRetries: _chunkGBAMBUDNcjs.DEFAULT_MAX_RETRIES
4901
4895
  }
4902
4896
  }
4903
4897
  ]
@@ -5013,18 +5007,16 @@ function action_builder(state2) {
5013
5007
  throw new Error(`Duplicate action "${action2}"`);
5014
5008
  internal.actions[action2] = schema;
5015
5009
  if (options) {
5016
- _chunkBTLM7SW4cjs.resolveActionConfig.call(void 0, options);
5010
+ _chunkGBAMBUDNcjs.resolveActionConfig.call(void 0, options);
5017
5011
  internal.options ??= {};
5018
5012
  internal.options[action2] = options;
5019
5013
  }
5020
5014
  function given(rules) {
5021
- internal.given ??= {};
5022
- internal.given[action2] = rules;
5015
+ (internal.given ??= {})[action2] = rules;
5023
5016
  return { requires, emit };
5024
5017
  }
5025
5018
  function requires(rules) {
5026
- internal.requires ??= {};
5027
- internal.requires[action2] = rules;
5019
+ (internal.requires ??= {})[action2] = rules;
5028
5020
  return { emit };
5029
5021
  }
5030
5022
  function emit(handler) {
@@ -5307,5 +5299,5 @@ function write_line(writer, line) {
5307
5299
 
5308
5300
 
5309
5301
 
5310
- exports.Act = Act; exports.ActorSchema = _chunkRF5MV72Kcjs.ActorSchema; exports.CausationEventSchema = _chunkRF5MV72Kcjs.CausationEventSchema; exports.CommittedMetaSchema = _chunkRF5MV72Kcjs.CommittedMetaSchema; exports.ConcurrencyError = _chunkRF5MV72Kcjs.ConcurrencyError; exports.ConsoleLogger = _chunkBTLM7SW4cjs.ConsoleLogger; exports.CsvFile = CsvFile; exports.DEFAULT_LANE = _chunkRF5MV72Kcjs.DEFAULT_LANE; exports.DEFAULT_MAX_SUBSCRIBED_STREAMS = _chunkRF5MV72Kcjs.DEFAULT_MAX_SUBSCRIBED_STREAMS; exports.DEFAULT_SETTLE_DEBOUNCE_MS = _chunkRF5MV72Kcjs.DEFAULT_SETTLE_DEBOUNCE_MS; exports.DeferSignal = _chunkRF5MV72Kcjs.DeferSignal; exports.Environments = _chunkRF5MV72Kcjs.Environments; exports.Errors = _chunkRF5MV72Kcjs.Errors; exports.EventMetaSchema = _chunkRF5MV72Kcjs.EventMetaSchema; exports.ExitCodes = _chunkRF5MV72Kcjs.ExitCodes; exports.InMemoryCache = _chunkBTLM7SW4cjs.InMemoryCache; exports.InMemoryStore = _chunkBTLM7SW4cjs.InMemoryStore; exports.InvariantError = _chunkRF5MV72Kcjs.InvariantError; exports.LogLevels = _chunkRF5MV72Kcjs.LogLevels; exports.NonRetryableError = _chunkRF5MV72Kcjs.NonRetryableError; exports.PackageSchema = _chunkBTLM7SW4cjs.PackageSchema; exports.QuerySchema = _chunkRF5MV72Kcjs.QuerySchema; exports.REDACTED = _chunkRF5MV72Kcjs.REDACTED; exports.SHREDDED = _chunkRF5MV72Kcjs.SHREDDED; exports.SNAP_EVENT = _chunkRF5MV72Kcjs.SNAP_EVENT; exports.StoreError = _chunkRF5MV72Kcjs.StoreError; exports.StreamClosedError = _chunkRF5MV72Kcjs.StreamClosedError; exports.TOMBSTONE_EVENT = _chunkRF5MV72Kcjs.TOMBSTONE_EVENT; exports.TargetSchema = _chunkRF5MV72Kcjs.TargetSchema; exports.ValidationError = _chunkRF5MV72Kcjs.ValidationError; exports.ZodEmpty = _chunkRF5MV72Kcjs.ZodEmpty; exports.act = act; exports.cache = _chunkBTLM7SW4cjs.cache; exports.config = _chunkBTLM7SW4cjs.config; exports.dateReviver = _chunkBTLM7SW4cjs.dateReviver; exports.default_scope = _chunkBTLM7SW4cjs.default_scope; exports.dispose = _chunkBTLM7SW4cjs.dispose; exports.disposeAndExit = _chunkBTLM7SW4cjs.disposeAndExit; exports.extend = _chunkBTLM7SW4cjs.extend; exports.is_literal_source = _chunkBTLM7SW4cjs.is_literal_source; exports.log = _chunkBTLM7SW4cjs.log; exports.pii_fields = _chunkRF5MV72Kcjs.pii_fields; exports.port = _chunkBTLM7SW4cjs.port; exports.projection = projection; exports.resolveAutocloseConfig = _chunkBTLM7SW4cjs.resolveAutocloseConfig2; exports.sensitive = _chunkRF5MV72Kcjs.sensitive; exports.sleep = _chunkBTLM7SW4cjs.sleep; exports.slice = slice; exports.state = state; exports.store = _chunkBTLM7SW4cjs.store; exports.validate = _chunkBTLM7SW4cjs.validate;
5302
+ exports.Act = Act; exports.ActorSchema = _chunkRF5MV72Kcjs.ActorSchema; exports.CausationEventSchema = _chunkRF5MV72Kcjs.CausationEventSchema; exports.CommittedMetaSchema = _chunkRF5MV72Kcjs.CommittedMetaSchema; exports.ConcurrencyError = _chunkRF5MV72Kcjs.ConcurrencyError; exports.ConsoleLogger = _chunkGBAMBUDNcjs.ConsoleLogger; exports.CsvFile = CsvFile; exports.DEFAULT_LANE = _chunkRF5MV72Kcjs.DEFAULT_LANE; exports.DEFAULT_MAX_SUBSCRIBED_STREAMS = _chunkRF5MV72Kcjs.DEFAULT_MAX_SUBSCRIBED_STREAMS; exports.DEFAULT_SETTLE_DEBOUNCE_MS = _chunkRF5MV72Kcjs.DEFAULT_SETTLE_DEBOUNCE_MS; exports.DeferSignal = _chunkRF5MV72Kcjs.DeferSignal; exports.Environments = _chunkRF5MV72Kcjs.Environments; exports.Errors = _chunkRF5MV72Kcjs.Errors; exports.EventMetaSchema = _chunkRF5MV72Kcjs.EventMetaSchema; exports.ExitCodes = _chunkRF5MV72Kcjs.ExitCodes; exports.InMemoryCache = _chunkGBAMBUDNcjs.InMemoryCache; exports.InMemoryStore = _chunkGBAMBUDNcjs.InMemoryStore; exports.InvariantError = _chunkRF5MV72Kcjs.InvariantError; exports.LogLevels = _chunkRF5MV72Kcjs.LogLevels; exports.NonRetryableError = _chunkRF5MV72Kcjs.NonRetryableError; exports.PackageSchema = _chunkGBAMBUDNcjs.PackageSchema; exports.QuerySchema = _chunkRF5MV72Kcjs.QuerySchema; exports.REDACTED = _chunkRF5MV72Kcjs.REDACTED; exports.SHREDDED = _chunkRF5MV72Kcjs.SHREDDED; exports.SNAP_EVENT = _chunkRF5MV72Kcjs.SNAP_EVENT; exports.StoreError = _chunkRF5MV72Kcjs.StoreError; exports.StreamClosedError = _chunkRF5MV72Kcjs.StreamClosedError; exports.TOMBSTONE_EVENT = _chunkRF5MV72Kcjs.TOMBSTONE_EVENT; exports.TargetSchema = _chunkRF5MV72Kcjs.TargetSchema; exports.ValidationError = _chunkRF5MV72Kcjs.ValidationError; exports.ZodEmpty = _chunkRF5MV72Kcjs.ZodEmpty; exports.act = act; exports.cache = _chunkGBAMBUDNcjs.cache; exports.config = _chunkGBAMBUDNcjs.config; exports.dateReviver = _chunkGBAMBUDNcjs.dateReviver; exports.default_scope = _chunkGBAMBUDNcjs.default_scope; exports.dispose = _chunkGBAMBUDNcjs.dispose; exports.disposeAndExit = _chunkGBAMBUDNcjs.disposeAndExit; exports.extend = _chunkGBAMBUDNcjs.extend; exports.is_literal_source = _chunkGBAMBUDNcjs.is_literal_source; exports.log = _chunkGBAMBUDNcjs.log; exports.pii_fields = _chunkRF5MV72Kcjs.pii_fields; exports.port = _chunkGBAMBUDNcjs.port; exports.projection = projection; exports.resolveAutocloseConfig = _chunkGBAMBUDNcjs.resolveAutocloseConfig2; exports.sensitive = _chunkRF5MV72Kcjs.sensitive; exports.sleep = _chunkGBAMBUDNcjs.sleep; exports.slice = slice; exports.state = state; exports.store = _chunkGBAMBUDNcjs.store; exports.validate = _chunkGBAMBUDNcjs.validate;
5311
5303
  //# sourceMappingURL=index.cjs.map