@rotorsoft/act 2.1.12 → 2.1.14

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.
Files changed (62) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/@types/act.d.ts.map +1 -1
  3. package/dist/@types/builders/act-builder.d.ts.map +1 -1
  4. package/dist/@types/builders/event-builder.d.ts +7 -3
  5. package/dist/@types/builders/event-builder.d.ts.map +1 -1
  6. package/dist/@types/builders/merge.d.ts.map +1 -1
  7. package/dist/@types/deprecated.d.ts +10 -0
  8. package/dist/@types/deprecated.d.ts.map +1 -1
  9. package/dist/@types/index.d.ts +2 -3
  10. package/dist/@types/index.d.ts.map +1 -1
  11. package/dist/@types/internal/audit.d.ts +2 -0
  12. package/dist/@types/internal/audit.d.ts.map +1 -1
  13. package/dist/@types/internal/config.d.ts +9 -0
  14. package/dist/@types/internal/config.d.ts.map +1 -1
  15. package/dist/@types/internal/pii.d.ts +1 -1
  16. package/dist/@types/{sensitive.d.ts → internal/sensitive.d.ts} +0 -24
  17. package/dist/@types/internal/sensitive.d.ts.map +1 -0
  18. package/dist/@types/ports.d.ts +0 -5
  19. package/dist/@types/ports.d.ts.map +1 -1
  20. package/dist/@types/types/action-rules.d.ts +177 -0
  21. package/dist/@types/types/action-rules.d.ts.map +1 -0
  22. package/dist/@types/types/builders.d.ts +15 -311
  23. package/dist/@types/types/builders.d.ts.map +1 -1
  24. package/dist/@types/types/ports.d.ts +1 -1
  25. package/dist/@types/types/projection.d.ts +135 -0
  26. package/dist/@types/types/projection.d.ts.map +1 -0
  27. package/dist/@types/types/registry.d.ts +7 -4
  28. package/dist/@types/types/registry.d.ts.map +1 -1
  29. package/dist/@types/types/schemas.d.ts +0 -1
  30. package/dist/@types/types/schemas.d.ts.map +1 -1
  31. package/dist/adapter.cjs +3 -3
  32. package/dist/adapter.js +2 -2
  33. package/dist/{chunk-SC6TY4P2.cjs → chunk-DCWPJFXR.cjs} +12 -4
  34. package/dist/chunk-DCWPJFXR.cjs.map +1 -0
  35. package/dist/{chunk-RV34EYSN.js → chunk-EIGZVFT7.js} +11 -3
  36. package/dist/{chunk-RV34EYSN.js.map → chunk-EIGZVFT7.js.map} +1 -1
  37. package/dist/{chunk-BQUOIHOR.js → chunk-GDPBPAML.js} +31 -87
  38. package/dist/chunk-GDPBPAML.js.map +1 -0
  39. package/dist/{chunk-Y2ISPWQL.js → chunk-SCH4GLWM.js} +78 -42
  40. package/dist/{chunk-Y2ISPWQL.js.map → chunk-SCH4GLWM.js.map} +1 -1
  41. package/dist/chunk-UEGKXCSQ.cjs +247 -0
  42. package/dist/chunk-UEGKXCSQ.cjs.map +1 -0
  43. package/dist/{chunk-N74AN6L5.cjs → chunk-WDIBO6AW.cjs} +91 -55
  44. package/dist/chunk-WDIBO6AW.cjs.map +1 -0
  45. package/dist/index.cjs +685 -454
  46. package/dist/index.cjs.map +1 -1
  47. package/dist/index.js +428 -197
  48. package/dist/index.js.map +1 -1
  49. package/dist/test/index.cjs +13 -9
  50. package/dist/test/index.cjs.map +1 -1
  51. package/dist/test/index.js +11 -7
  52. package/dist/test/index.js.map +1 -1
  53. package/dist/types/index.cjs +2 -6
  54. package/dist/types/index.cjs.map +1 -1
  55. package/dist/types/index.js +3 -7
  56. package/package.json +1 -1
  57. package/dist/@types/sensitive.d.ts.map +0 -1
  58. package/dist/chunk-BQUOIHOR.js.map +0 -1
  59. package/dist/chunk-N74AN6L5.cjs.map +0 -1
  60. package/dist/chunk-SC6TY4P2.cjs.map +0 -1
  61. package/dist/chunk-ZTHGF62O.cjs +0 -303
  62. package/dist/chunk-ZTHGF62O.cjs.map +0 -1
package/dist/index.cjs CHANGED
@@ -27,7 +27,7 @@
27
27
 
28
28
 
29
29
 
30
- var _chunkN74AN6L5cjs = require('./chunk-N74AN6L5.cjs');
30
+ var _chunkWDIBO6AWcjs = require('./chunk-WDIBO6AW.cjs');
31
31
 
32
32
 
33
33
 
@@ -36,7 +36,7 @@ var _chunkN74AN6L5cjs = require('./chunk-N74AN6L5.cjs');
36
36
 
37
37
 
38
38
 
39
- var _chunkSC6TY4P2cjs = require('./chunk-SC6TY4P2.cjs');
39
+ var _chunkDCWPJFXRcjs = require('./chunk-DCWPJFXR.cjs');
40
40
 
41
41
 
42
42
 
@@ -66,29 +66,26 @@ var _chunkSC6TY4P2cjs = require('./chunk-SC6TY4P2.cjs');
66
66
 
67
67
 
68
68
 
69
-
70
-
71
-
72
-
73
-
74
- var _chunkZTHGF62Ocjs = require('./chunk-ZTHGF62O.cjs');
69
+ var _chunkUEGKXCSQcjs = require('./chunk-UEGKXCSQ.cjs');
75
70
 
76
71
  // src/signals.ts
77
72
  process.once("SIGINT", async (arg) => {
78
- _chunkN74AN6L5cjs.log.call(void 0, ).info(arg, "SIGINT");
79
- await _chunkN74AN6L5cjs.disposeAndExit.call(void 0, "EXIT");
73
+ _chunkWDIBO6AWcjs.log.call(void 0, ).info(arg, "SIGINT");
74
+ await _chunkWDIBO6AWcjs.disposeAndExit.call(void 0, "EXIT");
80
75
  });
81
76
  process.once("SIGTERM", async (arg) => {
82
- _chunkN74AN6L5cjs.log.call(void 0, ).info(arg, "SIGTERM");
83
- await _chunkN74AN6L5cjs.disposeAndExit.call(void 0, "EXIT");
77
+ _chunkWDIBO6AWcjs.log.call(void 0, ).info(arg, "SIGTERM");
78
+ await _chunkWDIBO6AWcjs.disposeAndExit.call(void 0, "EXIT");
84
79
  });
85
80
  process.once("uncaughtException", async (arg) => {
86
- _chunkN74AN6L5cjs.log.call(void 0, ).error(arg, "Uncaught Exception");
87
- await _chunkN74AN6L5cjs.disposeAndExit.call(void 0, "ERROR");
81
+ process.exitCode = 1;
82
+ _chunkWDIBO6AWcjs.log.call(void 0, ).error(arg, "Uncaught Exception");
83
+ await _chunkWDIBO6AWcjs.disposeAndExit.call(void 0, "ERROR");
88
84
  });
89
85
  process.once("unhandledRejection", async (arg) => {
90
- _chunkN74AN6L5cjs.log.call(void 0, ).error(arg, "Unhandled Rejection");
91
- await _chunkN74AN6L5cjs.disposeAndExit.call(void 0, "ERROR");
86
+ process.exitCode = 1;
87
+ _chunkWDIBO6AWcjs.log.call(void 0, ).error(arg, "Unhandled Rejection");
88
+ await _chunkWDIBO6AWcjs.disposeAndExit.call(void 0, "ERROR");
92
89
  });
93
90
 
94
91
  // src/act.ts
@@ -104,6 +101,7 @@ function parse(name) {
104
101
  }
105
102
  return { base: name, version: 1 };
106
103
  }
104
+ _chunkUEGKXCSQcjs.__name.call(void 0, parse, "parse");
107
105
  function deprecated_event_names(names) {
108
106
  const groups = /* @__PURE__ */ new Map();
109
107
  for (const name of names) {
@@ -129,6 +127,7 @@ function deprecated_event_names(names) {
129
127
  }
130
128
  return deprecated;
131
129
  }
130
+ _chunkUEGKXCSQcjs.__name.call(void 0, deprecated_event_names, "deprecated_event_names");
132
131
  function current_version_of(deprecated_name, all_names) {
133
132
  const target = parse(deprecated_name);
134
133
  let highest;
@@ -139,6 +138,7 @@ function current_version_of(deprecated_name, all_names) {
139
138
  }
140
139
  return highest && highest.version > target.version ? highest.name : void 0;
141
140
  }
141
+ _chunkUEGKXCSQcjs.__name.call(void 0, current_version_of, "current_version_of");
142
142
 
143
143
  // src/internal/walk-streams.ts
144
144
  var DEFAULT_STREAM_PAGE = 500;
@@ -160,6 +160,7 @@ async function walk_streams(store2, callback, query) {
160
160
  after = last;
161
161
  }
162
162
  }
163
+ _chunkUEGKXCSQcjs.__name.call(void 0, walk_streams, "walk_streams");
163
164
 
164
165
  // src/internal/audit.ts
165
166
  var DEFAULTS = {
@@ -196,7 +197,7 @@ async function* audit(deps, categories, options = {}) {
196
197
  if (need_stats) {
197
198
  const stats = await deps.store().query_stats(
198
199
  {},
199
- { count: true, names: true, exclude: [_chunkZTHGF62Ocjs.SNAP_EVENT] }
200
+ { count: true, names: true, exclude: [_chunkUEGKXCSQcjs.SNAP_EVENT] }
200
201
  );
201
202
  for (const [stream, s] of stats) {
202
203
  for (const p of passes) _optionalChain([p, 'access', _4 => _4.on_stat, 'optionalCall', _5 => _5(stream, s)]);
@@ -224,6 +225,7 @@ async function* audit(deps, categories, options = {}) {
224
225
  for (const f of p.drain()) yield f;
225
226
  }
226
227
  }
228
+ _chunkUEGKXCSQcjs.__name.call(void 0, audit, "audit");
227
229
  async function scan_events_resiliently(deps, query, on_event, on_unreadable) {
228
230
  let cursor = _optionalChain([query, 'optionalAccess', _14 => _14.after]);
229
231
  let remaining = _optionalChain([query, 'optionalAccess', _15 => _15.limit]);
@@ -259,7 +261,8 @@ async function scan_events_resiliently(deps, query, on_event, on_unreadable) {
259
261
  }
260
262
  }
261
263
  }
262
- var make_schema_pass = (deps) => {
264
+ _chunkUEGKXCSQcjs.__name.call(void 0, scan_events_resiliently, "scan_events_resiliently");
265
+ var make_schema_pass = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (deps) => {
263
266
  const findings = [];
264
267
  return {
265
268
  category: "schema",
@@ -278,7 +281,7 @@ var make_schema_pass = (deps) => {
278
281
  return;
279
282
  }
280
283
  const schema = state2.events[name];
281
- const sensitive2 = _chunkZTHGF62Ocjs.sensitiveFields.call(void 0, schema);
284
+ const sensitive2 = deps.sensitive_fields(name);
282
285
  let parse_schema = schema;
283
286
  if (sensitive2.length > 0) {
284
287
  const omitter = schema.omit;
@@ -302,10 +305,10 @@ var make_schema_pass = (deps) => {
302
305
  });
303
306
  }
304
307
  },
305
- drain: () => findings
308
+ drain: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, () => findings, "drain")
306
309
  };
307
- };
308
- var classify_deprecated_by_state = (deps) => {
310
+ }, "make_schema_pass");
311
+ var classify_deprecated_by_state = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (deps) => {
309
312
  const names_by_state = /* @__PURE__ */ new Map();
310
313
  for (const [name, state2] of deps.event_to_state) {
311
314
  let set = names_by_state.get(state2);
@@ -322,8 +325,8 @@ var classify_deprecated_by_state = (deps) => {
322
325
  }
323
326
  }
324
327
  return deprecated_to_current;
325
- };
326
- var make_deprecated_load_pass = (deps, options) => {
328
+ }, "classify_deprecated_by_state");
329
+ var make_deprecated_load_pass = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (deps, options) => {
327
330
  const share_min = _nullishCoalesce(_optionalChain([options, 'access', _17 => _17.thresholds, 'optionalAccess', _18 => _18.deprecated_min]), () => ( DEFAULTS.deprecated_min));
328
331
  const totals = /* @__PURE__ */ new Map();
329
332
  const per_stream = /* @__PURE__ */ new Map();
@@ -362,8 +365,8 @@ var make_deprecated_load_pass = (deps, options) => {
362
365
  return findings;
363
366
  }
364
367
  };
365
- };
366
- var make_close_candidate_pass = (deps, options) => {
368
+ }, "make_deprecated_load_pass");
369
+ var make_close_candidate_pass = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (deps, options) => {
367
370
  const idle_days = _nullishCoalesce(_optionalChain([options, 'access', _19 => _19.thresholds, 'optionalAccess', _20 => _20.idle_days]), () => ( DEFAULTS.idle_days));
368
371
  const terminal_events = new Set(_nullishCoalesce(_optionalChain([options, 'access', _21 => _21.thresholds, 'optionalAccess', _22 => _22.terminal_events]), () => ( [])));
369
372
  const idle_cutoff = Date.now() - idle_days * 24 * 60 * 60 * 1e3;
@@ -386,10 +389,10 @@ var make_close_candidate_pass = (deps, options) => {
386
389
  restart_supported: restart_is_supported(deps, head_name)
387
390
  });
388
391
  },
389
- drain: () => findings
392
+ drain: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, () => findings, "drain")
390
393
  };
391
- };
392
- var make_restart_candidate_pass = (deps, options) => {
394
+ }, "make_close_candidate_pass");
395
+ var make_restart_candidate_pass = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (deps, options) => {
393
396
  const threshold = _nullishCoalesce(_optionalChain([options, 'access', _23 => _23.thresholds, 'optionalAccess', _24 => _24.restart_min]), () => ( DEFAULTS.restart_min));
394
397
  const candidates = [];
395
398
  const findings = [];
@@ -412,7 +415,7 @@ var make_restart_candidate_pass = (deps, options) => {
412
415
  {
413
416
  stream,
414
417
  stream_exact: true,
415
- names: [_chunkZTHGF62Ocjs.SNAP_EVENT],
418
+ names: [_chunkUEGKXCSQcjs.SNAP_EVENT],
416
419
  with_snaps: true,
417
420
  // From the start: on its own, `with_snaps` resumes at the latest.
418
421
  after: -1
@@ -426,10 +429,10 @@ var make_restart_candidate_pass = (deps, options) => {
426
429
  });
427
430
  }
428
431
  },
429
- drain: () => findings
432
+ drain: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, () => findings, "drain")
430
433
  };
431
- };
432
- var make_reaction_health_pass = (_deps, options) => {
434
+ }, "make_restart_candidate_pass");
435
+ var make_reaction_health_pass = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (_deps, options) => {
433
436
  const near_block = _nullishCoalesce(_optionalChain([options, 'access', _25 => _25.thresholds, 'optionalAccess', _26 => _26.near_block]), () => ( DEFAULTS.near_block));
434
437
  const stuck_minutes = _nullishCoalesce(_optionalChain([options, 'access', _27 => _27.thresholds, 'optionalAccess', _28 => _28.stuck_minutes]), () => ( DEFAULTS.stuck_minutes));
435
438
  const stuck_cutoff = Date.now() - stuck_minutes * 60 * 1e3;
@@ -470,10 +473,10 @@ var make_reaction_health_pass = (_deps, options) => {
470
473
  });
471
474
  }
472
475
  },
473
- drain: () => findings
476
+ drain: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, () => findings, "drain")
474
477
  };
475
- };
476
- var make_snapshot_drift_pass = (deps, options) => {
478
+ }, "make_reaction_health_pass");
479
+ var make_snapshot_drift_pass = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (deps, options) => {
477
480
  const drift_min = _nullishCoalesce(_optionalChain([options, 'access', _29 => _29.thresholds, 'optionalAccess', _30 => _30.drift_min]), () => ( DEFAULTS.drift_min));
478
481
  const candidates = [];
479
482
  const findings = [];
@@ -525,10 +528,10 @@ var make_snapshot_drift_pass = (deps, options) => {
525
528
  });
526
529
  }
527
530
  },
528
- drain: () => findings
531
+ drain: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, () => findings, "drain")
529
532
  };
530
- };
531
- var make_routing_health_pass = (deps) => {
533
+ }, "make_snapshot_drift_pass");
534
+ var make_routing_health_pass = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (deps) => {
532
535
  const findings = [];
533
536
  const seen_event_names = /* @__PURE__ */ new Set();
534
537
  return {
@@ -560,10 +563,10 @@ var make_routing_health_pass = (deps) => {
560
563
  }
561
564
  return Promise.resolve();
562
565
  },
563
- drain: () => findings
566
+ drain: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, () => findings, "drain")
564
567
  };
565
- };
566
- var make_correlation_gaps_pass = () => {
568
+ }, "make_routing_health_pass");
569
+ var make_correlation_gaps_pass = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, () => {
567
570
  const seen_ids = /* @__PURE__ */ new Set();
568
571
  const checks = [];
569
572
  return {
@@ -572,7 +575,7 @@ var make_correlation_gaps_pass = () => {
572
575
  seen_ids.add(e.id);
573
576
  const causation = _optionalChain([e, 'access', _31 => _31.meta, 'optionalAccess', _32 => _32.causation]);
574
577
  const parent_id = _optionalChain([causation, 'optionalAccess', _33 => _33.event, 'optionalAccess', _34 => _34.id]);
575
- if (parent_id !== void 0 && e.name !== _chunkZTHGF62Ocjs.TOMBSTONE_EVENT) {
578
+ if (parent_id !== void 0 && e.name !== _chunkUEGKXCSQcjs.TOMBSTONE_EVENT) {
576
579
  checks.push({ stream: e.stream, id: e.id, parent_id });
577
580
  }
578
581
  },
@@ -591,8 +594,8 @@ var make_correlation_gaps_pass = () => {
591
594
  return findings;
592
595
  }
593
596
  };
594
- };
595
- var make_clock_anomalies_pass = () => {
597
+ }, "make_correlation_gaps_pass");
598
+ var make_clock_anomalies_pass = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, () => {
596
599
  const findings = [];
597
600
  const last_per_stream = /* @__PURE__ */ new Map();
598
601
  return {
@@ -618,13 +621,14 @@ var make_clock_anomalies_pass = () => {
618
621
  }
619
622
  last_per_stream.set(e.stream, created);
620
623
  },
621
- drain: () => findings
624
+ drain: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, () => findings, "drain")
622
625
  };
623
- };
626
+ }, "make_clock_anomalies_pass");
624
627
  function restart_is_supported(deps, head_event_name) {
625
628
  const state2 = deps.event_to_state.get(head_event_name);
626
629
  return _optionalChain([state2, 'optionalAccess', _35 => _35.snap]) !== void 0;
627
630
  }
631
+ _chunkUEGKXCSQcjs.__name.call(void 0, restart_is_supported, "restart_is_supported");
628
632
  function make_unreadable_events_pass() {
629
633
  const findings = [];
630
634
  return {
@@ -638,9 +642,10 @@ function make_unreadable_events_pass() {
638
642
  error
639
643
  });
640
644
  },
641
- drain: () => findings
645
+ drain: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, () => findings, "drain")
642
646
  };
643
647
  }
648
+ _chunkUEGKXCSQcjs.__name.call(void 0, make_unreadable_events_pass, "make_unreadable_events_pass");
644
649
  var PASS_FACTORIES = {
645
650
  schema: make_schema_pass,
646
651
  "deprecated-load": make_deprecated_load_pass,
@@ -656,6 +661,9 @@ var PASS_FACTORIES = {
656
661
 
657
662
  // src/internal/circuit-breaker.ts
658
663
  var CircuitBreaker = (_class = class {
664
+ static {
665
+ _chunkUEGKXCSQcjs.__name.call(void 0, this, "CircuitBreaker");
666
+ }
659
667
  __init() {this._failures = 0}
660
668
 
661
669
 
@@ -747,7 +755,7 @@ var CircuitBreaker = (_class = class {
747
755
 
748
756
  // src/internal/classify.ts
749
757
  var ALL_LANES = /* @__PURE__ */ Symbol("act/all-lanes");
750
- var describe_source = (source) => source === void 0 ? "no source (every stream)" : `"${source}"`;
758
+ var describe_source = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (source) => source === void 0 ? "no source (every stream)" : `"${source}"`, "describe_source");
751
759
  function classify_registry(registry, states) {
752
760
  const statics = /* @__PURE__ */ new Map();
753
761
  const target_lanes = /* @__PURE__ */ new Map();
@@ -798,35 +806,43 @@ function classify_registry(registry, states) {
798
806
  event_to_lanes
799
807
  };
800
808
  }
809
+ _chunkUEGKXCSQcjs.__name.call(void 0, classify_registry, "classify_registry");
801
810
 
802
811
  // src/internal/autoclose-policy.ts
803
812
  var DAY_MS = 864e5;
804
813
  function days_after(date, days) {
805
814
  return new Date(date.getTime() + days * DAY_MS);
806
815
  }
816
+ _chunkUEGKXCSQcjs.__name.call(void 0, days_after, "days_after");
807
817
  function days_before_now(days) {
808
818
  return new Date(Date.now() - days * DAY_MS);
809
819
  }
820
+ _chunkUEGKXCSQcjs.__name.call(void 0, days_before_now, "days_before_now");
810
821
  function compile_after(after) {
811
822
  return (_stream, head) => days_after(head.created, after.days) <= /* @__PURE__ */ new Date();
812
823
  }
824
+ _chunkUEGKXCSQcjs.__name.call(void 0, compile_after, "compile_after");
813
825
  function compile_is(is) {
814
826
  const set = new Set(typeof is === "string" ? [is] : is);
815
827
  return (_stream, head) => set.has(head.name);
816
828
  }
829
+ _chunkUEGKXCSQcjs.__name.call(void 0, compile_is, "compile_is");
817
830
  function compile_reaches(reaches) {
818
831
  return (_stream, _head, count) => count >= reaches;
819
832
  }
833
+ _chunkUEGKXCSQcjs.__name.call(void 0, compile_reaches, "compile_reaches");
820
834
  function policy_after_windows(options) {
821
- const parsed = _chunkN74AN6L5cjs.check.call(void 0, "autoclose_policy", options);
835
+ const parsed = _chunkWDIBO6AWcjs.check.call(void 0, "autoclose_policy", options);
822
836
  return [parsed.after, _optionalChain([parsed, 'access', _42 => _42.or, 'optionalAccess', _43 => _43.after])].flatMap((w) => w ? [w.days] : []);
823
837
  }
838
+ _chunkUEGKXCSQcjs.__name.call(void 0, policy_after_windows, "policy_after_windows");
824
839
  function policy_keep_days(options) {
825
- const parsed = _chunkN74AN6L5cjs.check.call(void 0, "autoclose_policy", options);
840
+ const parsed = _chunkWDIBO6AWcjs.check.call(void 0, "autoclose_policy", options);
826
841
  return _optionalChain([parsed, 'access', _44 => _44.keep, 'optionalAccess', _45 => _45.days]);
827
842
  }
843
+ _chunkUEGKXCSQcjs.__name.call(void 0, policy_keep_days, "policy_keep_days");
828
844
  function compile_autoclose_policy(options) {
829
- const parsed = _chunkN74AN6L5cjs.check.call(void 0, "autoclose_policy", options);
845
+ const parsed = _chunkWDIBO6AWcjs.check.call(void 0, "autoclose_policy", options);
830
846
  const and_preds = [];
831
847
  if (parsed.after) and_preds.push(compile_after(parsed.after));
832
848
  if (parsed.is) and_preds.push(compile_is(parsed.is));
@@ -847,6 +863,7 @@ function compile_autoclose_policy(options) {
847
863
  return false;
848
864
  };
849
865
  }
866
+ _chunkUEGKXCSQcjs.__name.call(void 0, compile_autoclose_policy, "compile_autoclose_policy");
850
867
 
851
868
  // src/internal/autoclose-window.ts
852
869
  function hour_in_zone(now, timeZone) {
@@ -857,20 +874,24 @@ function hour_in_zone(now, timeZone) {
857
874
  }).formatToParts(now);
858
875
  return Number(_optionalChain([parts, 'access', _46 => _46.find, 'call', _47 => _47((p) => p.type === "hour"), 'optionalAccess', _48 => _48.value]));
859
876
  }
877
+ _chunkUEGKXCSQcjs.__name.call(void 0, hour_in_zone, "hour_in_zone");
860
878
  function hour_in_range(hour, start, end) {
861
879
  return start < end ? hour >= start && hour < end : hour >= start || hour < end;
862
880
  }
881
+ _chunkUEGKXCSQcjs.__name.call(void 0, hour_in_range, "hour_in_range");
863
882
  function is_dst_gap_open(now, timeZone, start) {
864
883
  const hour = hour_in_zone(now, timeZone);
865
884
  if (hour <= start) return false;
866
885
  const prev = hour_in_zone(new Date(now.getTime() - 36e5), timeZone);
867
886
  return prev === start - 1 && hour === start + 1;
868
887
  }
888
+ _chunkUEGKXCSQcjs.__name.call(void 0, is_dst_gap_open, "is_dst_gap_open");
869
889
  function in_autoclose_window(window, now) {
870
890
  if (!window) return true;
871
891
  const hour = hour_in_zone(now, window.timeZone);
872
892
  return hour_in_range(hour, window.start, window.end) || is_dst_gap_open(now, window.timeZone, window.start);
873
893
  }
894
+ _chunkUEGKXCSQcjs.__name.call(void 0, in_autoclose_window, "in_autoclose_window");
874
895
  function next_window_open(window, now) {
875
896
  const start_ms = now.getTime();
876
897
  for (let h = 0; h <= 48; h++) {
@@ -885,26 +906,30 @@ function next_window_open(window, now) {
885
906
  }
886
907
  return new Date(start_ms + 864e5);
887
908
  }
909
+ _chunkUEGKXCSQcjs.__name.call(void 0, next_window_open, "next_window_open");
888
910
 
889
911
  // src/internal/defer-config.ts
890
912
  function duration_ms(d) {
891
913
  return (_nullishCoalesce(d.days, () => ( 0))) * 864e5 + (_nullishCoalesce(d.hours, () => ( 0))) * 36e5 + (_nullishCoalesce(d.minutes, () => ( 0))) * 6e4;
892
914
  }
915
+ _chunkUEGKXCSQcjs.__name.call(void 0, duration_ms, "duration_ms");
893
916
  function resolve_defer_at(when, event) {
894
- const parsed = _chunkN74AN6L5cjs.check.call(void 0, "defer", when);
917
+ const parsed = _chunkWDIBO6AWcjs.check.call(void 0, "defer", when);
895
918
  if (parsed.after) return event.created.getTime() + duration_ms(parsed.after);
896
919
  return parsed.at.getTime();
897
920
  }
921
+ _chunkUEGKXCSQcjs.__name.call(void 0, resolve_defer_at, "resolve_defer_at");
898
922
  function make_deferred(handler, schedule) {
899
923
  const call = handler;
900
- const deferred = async (event, stream, app) => {
924
+ const deferred = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, async (event, stream, app) => {
901
925
  const when = typeof schedule === "function" ? schedule(event) : schedule;
902
- if (Date.now() < resolve_defer_at(when, event)) throw new (0, _chunkZTHGF62Ocjs.DeferSignal)(when);
926
+ if (Date.now() < resolve_defer_at(when, event)) throw new (0, _chunkUEGKXCSQcjs.DeferSignal)(when);
903
927
  return call(event, stream, app);
904
- };
928
+ }, "deferred");
905
929
  Object.defineProperty(deferred, "name", { value: handler.name });
906
930
  return deferred;
907
931
  }
932
+ _chunkUEGKXCSQcjs.__name.call(void 0, make_deferred, "make_deferred");
908
933
 
909
934
  // src/internal/drain-cycle.ts
910
935
  var _crypto = require('crypto');
@@ -933,10 +958,14 @@ function compute_backoff_delay(retry, opts) {
933
958
  if (opts.jitter) delay = delay * (0.5 + Math.random());
934
959
  return Math.max(0, Math.floor(delay));
935
960
  }
961
+ _chunkUEGKXCSQcjs.__name.call(void 0, compute_backoff_delay, "compute_backoff_delay");
936
962
 
937
963
  // src/internal/defer-timer.ts
938
964
  var MAX_TIMER_DELAY_MS = 2147483647;
939
965
  var DeferTimer = (_class2 = class {
966
+ static {
967
+ _chunkUEGKXCSQcjs.__name.call(void 0, this, "DeferTimer");
968
+ }
940
969
  __init2() {this._due = /* @__PURE__ */ new Map()}
941
970
 
942
971
 
@@ -1026,13 +1055,15 @@ function compute_lag_lead_ratio(handled, lagging, leading) {
1026
1055
  if (total === 0) return RATIO_DEFAULT;
1027
1056
  return Math.max(RATIO_MIN, Math.min(RATIO_MAX, lagging_avg / total));
1028
1057
  }
1058
+ _chunkUEGKXCSQcjs.__name.call(void 0, compute_lag_lead_ratio, "compute_lag_lead_ratio");
1029
1059
 
1030
1060
  // src/internal/report-once.ts
1031
1061
  function report_once(seen, key, message) {
1032
1062
  if (seen.has(key)) return;
1033
1063
  seen.add(key);
1034
- _chunkN74AN6L5cjs.log.call(void 0, ).error(new Error(message));
1064
+ _chunkWDIBO6AWcjs.log.call(void 0, ).error(new Error(message));
1035
1065
  }
1066
+ _chunkUEGKXCSQcjs.__name.call(void 0, report_once, "report_once");
1036
1067
 
1037
1068
  // src/internal/correlation-id.ts
1038
1069
 
@@ -1042,13 +1073,14 @@ var SEG_SPACE = BASE ** SEG_WIDTH;
1042
1073
  function seg(n) {
1043
1074
  return n.toString(BASE).padStart(SEG_WIDTH, "0");
1044
1075
  }
1045
- var default_correlator = ({ state: state2, action: action2 }) => {
1076
+ _chunkUEGKXCSQcjs.__name.call(void 0, seg, "seg");
1077
+ var default_correlator = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, ({ state: state2, action: action2 }) => {
1046
1078
  const s = state2.slice(0, SEG_WIDTH).toLowerCase();
1047
1079
  const a = action2.slice(0, SEG_WIDTH).toLowerCase();
1048
1080
  const ts = seg(Date.now() % SEG_SPACE);
1049
1081
  const rnd = seg(_crypto.randomInt.call(void 0, SEG_SPACE));
1050
1082
  return `${s}-${a}-${ts}${rnd}`;
1051
- };
1083
+ }, "default_correlator");
1052
1084
  function close_correlation(correlator, actor) {
1053
1085
  return correlator({
1054
1086
  state: "$close",
@@ -1057,16 +1089,17 @@ function close_correlation(correlator, actor) {
1057
1089
  actor
1058
1090
  });
1059
1091
  }
1092
+ _chunkUEGKXCSQcjs.__name.call(void 0, close_correlation, "close_correlation");
1060
1093
 
1061
1094
  // src/internal/drain-ops.ts
1062
- var claim = (lagging, leading, by, millis, lane) => _chunkN74AN6L5cjs.store.call(void 0, ).claim(lagging, leading, by, millis, lane);
1095
+ var claim = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (lagging, leading, by, millis, lane) => _chunkWDIBO6AWcjs.store.call(void 0, ).claim(lagging, leading, by, millis, lane), "claim");
1063
1096
  async function fetch(leased, eventLimit) {
1064
1097
  return Promise.all(
1065
1098
  leased.map(async ({ stream, source, at, lagging }) => {
1066
1099
  const events = [];
1067
- const stream_exact = source !== void 0 && _chunkSC6TY4P2cjs.isStreamName.call(void 0, source, stream) ? true : void 0;
1100
+ const stream_exact = source !== void 0 && _chunkDCWPJFXRcjs.isStreamName.call(void 0, source, stream) ? true : void 0;
1068
1101
  try {
1069
- await _chunkN74AN6L5cjs.store.call(void 0, ).query((e) => events.push(e), {
1102
+ await _chunkWDIBO6AWcjs.store.call(void 0, ).query((e) => events.push(e), {
1070
1103
  stream: source,
1071
1104
  stream_exact,
1072
1105
  after: at,
@@ -1086,18 +1119,68 @@ async function fetch(leased, eventLimit) {
1086
1119
  })
1087
1120
  );
1088
1121
  }
1089
- var ack = (leases) => _chunkN74AN6L5cjs.store.call(void 0, ).ack(leases);
1090
- var block = (leases) => _chunkN74AN6L5cjs.store.call(void 0, ).block(leases);
1091
- var subscribe = (streams, correlated_at, correlator) => _chunkN74AN6L5cjs.store.call(void 0, ).subscribe(streams, correlated_at, correlator);
1122
+ _chunkUEGKXCSQcjs.__name.call(void 0, fetch, "fetch");
1123
+ var ack = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (leases) => _chunkWDIBO6AWcjs.store.call(void 0, ).ack(leases), "ack");
1124
+ var block = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (leases) => _chunkWDIBO6AWcjs.store.call(void 0, ).block(leases), "block");
1125
+ var subscribe = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (streams, correlated_at, correlator) => _chunkWDIBO6AWcjs.store.call(void 0, ).subscribe(streams, correlated_at, correlator), "subscribe");
1092
1126
 
1093
1127
  // src/internal/event-sourcing.ts
1094
1128
  var _actpatch = require('@rotorsoft/act-patch');
1095
- var _zod = require('zod');
1129
+ var _zod2 = require('zod');
1096
1130
 
1097
1131
  // src/internal/date-reviver.ts
1098
1132
 
1133
+
1134
+ // src/internal/zod.ts
1135
+ var def_of = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (schema) => _optionalChain([schema, 'optionalAccess', _50 => _50._zod, 'optionalAccess', _51 => _51.def]), "def_of");
1136
+ var SINGLE_INNER = [
1137
+ "optional",
1138
+ "nullable",
1139
+ "default",
1140
+ "prefault",
1141
+ "nonoptional",
1142
+ "readonly",
1143
+ "catch"
1144
+ ];
1145
+ var inner_of = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (def) => SINGLE_INNER.includes(def.type) ? def.innerType : void 0, "inner_of");
1146
+ function wrapped(schema) {
1147
+ const def = def_of(schema);
1148
+ if (!def) return [];
1149
+ if (def.type === "pipe") return [def.in, def.out];
1150
+ if (def.type === "lazy") return [def.getter()];
1151
+ const inner = inner_of(def);
1152
+ return inner ? [inner] : [];
1153
+ }
1154
+ _chunkUEGKXCSQcjs.__name.call(void 0, wrapped, "wrapped");
1155
+ function some_layer(schema, test) {
1156
+ const seen = /* @__PURE__ */ new Set();
1157
+ const visit = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (s) => {
1158
+ if (seen.has(s)) return false;
1159
+ seen.add(s);
1160
+ const def = def_of(s);
1161
+ return !!def && (test(def) || wrapped(s).some(visit));
1162
+ }, "visit");
1163
+ return visit(schema);
1164
+ }
1165
+ _chunkUEGKXCSQcjs.__name.call(void 0, some_layer, "some_layer");
1166
+ function output_of(schema) {
1167
+ const seen = /* @__PURE__ */ new Set();
1168
+ let cur = schema;
1169
+ while (!seen.has(cur)) {
1170
+ seen.add(cur);
1171
+ const def = def_of(cur);
1172
+ if (!def) return cur;
1173
+ const next = def.type === "pipe" ? def.out : wrapped(cur)[0];
1174
+ if (!next) return cur;
1175
+ cur = next;
1176
+ }
1177
+ return cur;
1178
+ }
1179
+ _chunkUEGKXCSQcjs.__name.call(void 0, output_of, "output_of");
1180
+
1181
+ // src/internal/date-reviver.ts
1099
1182
  function variant_schema(schema, walk) {
1100
- const shape = _optionalChain([_chunkZTHGF62Ocjs.def_of.call(void 0, schema), 'optionalAccess', _50 => _50.shape]);
1183
+ const shape = _optionalChain([def_of, 'call', _52 => _52(schema), 'optionalAccess', _53 => _53.shape]);
1101
1184
  if (!shape) {
1102
1185
  const dates = walk(schema);
1103
1186
  return { schema: _nullishCoalesce(dates, () => ( schema)), dated: !!dates };
@@ -1109,37 +1192,39 @@ function variant_schema(schema, walk) {
1109
1192
  if (dates) dated = true;
1110
1193
  next[key] = (_nullishCoalesce(dates, () => ( field))).optional();
1111
1194
  }
1112
- return { schema: _zod.z.looseObject(next), dated };
1195
+ return { schema: _zod2.z.looseObject(next), dated };
1113
1196
  }
1197
+ _chunkUEGKXCSQcjs.__name.call(void 0, variant_schema, "variant_schema");
1114
1198
  function date_reviver_schema(schema) {
1115
1199
  let recursive = false;
1116
- const pass = (tie) => {
1200
+ const pass = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (tie) => {
1117
1201
  const done = /* @__PURE__ */ new Map();
1118
1202
  const active = /* @__PURE__ */ new Set();
1119
- const walk = (node) => {
1203
+ const walk = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (node) => {
1120
1204
  if (done.has(node)) return done.get(node);
1121
1205
  if (active.has(node)) {
1122
1206
  recursive = true;
1123
- return tie ? _zod.z.lazy(() => done.get(node)) : void 0;
1207
+ return tie ? _zod2.z.lazy(() => done.get(node)) : void 0;
1124
1208
  }
1125
1209
  active.add(node);
1126
1210
  const result = build(node, walk);
1127
1211
  active.delete(node);
1128
1212
  done.set(node, result);
1129
1213
  return result;
1130
- };
1214
+ }, "walk");
1131
1215
  return walk(schema);
1132
- };
1216
+ }, "pass");
1133
1217
  const first = pass(false);
1134
1218
  return first && recursive ? pass(true) : first;
1135
1219
  }
1220
+ _chunkUEGKXCSQcjs.__name.call(void 0, date_reviver_schema, "date_reviver_schema");
1136
1221
  function build(schema, walk) {
1137
- const def = _chunkZTHGF62Ocjs.def_of.call(void 0, schema);
1222
+ const def = def_of(schema);
1138
1223
  if (!def) return void 0;
1139
- const inner = () => walk(def.innerType);
1224
+ const inner = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, () => walk(def.innerType), "inner");
1140
1225
  switch (def.type) {
1141
1226
  case "date":
1142
- return _zod.z.coerce.date();
1227
+ return _zod2.z.coerce.date();
1143
1228
  case "object": {
1144
1229
  const shape = def.shape;
1145
1230
  if (!shape) return void 0;
@@ -1148,28 +1233,28 @@ function build(schema, walk) {
1148
1233
  const dates = walk(field);
1149
1234
  if (dates) dated[key] = dates.optional();
1150
1235
  }
1151
- return Object.keys(dated).length ? _zod.z.looseObject(dated) : void 0;
1236
+ return Object.keys(dated).length ? _zod2.z.looseObject(dated) : void 0;
1152
1237
  }
1153
1238
  case "array": {
1154
1239
  const element = walk(def.element);
1155
- return element && _zod.z.array(element);
1240
+ return element && _zod2.z.array(element);
1156
1241
  }
1157
1242
  case "tuple": {
1158
1243
  const items = def.items.map((i) => walk(i));
1159
- return items.some(Boolean) ? _zod.z.tuple(items.map((i) => _nullishCoalesce(i, () => ( _zod.z.unknown())))) : void 0;
1244
+ return items.some(Boolean) ? _zod2.z.tuple(items.map((i) => _nullishCoalesce(i, () => ( _zod2.z.unknown())))) : void 0;
1160
1245
  }
1161
1246
  case "record": {
1162
1247
  const value = walk(def.valueType);
1163
- return value && _zod.z.record(_zod.z.string(), value);
1248
+ return value && _zod2.z.record(_zod2.z.string(), value);
1164
1249
  }
1165
1250
  case "union": {
1166
1251
  const variants = def.options.map(
1167
1252
  (o) => variant_schema(o, walk)
1168
1253
  );
1169
- return variants.some((v) => v.dated) ? _zod.z.union(variants.map((v) => v.schema)) : void 0;
1254
+ return variants.some((v) => v.dated) ? _zod2.z.union(variants.map((v) => v.schema)) : void 0;
1170
1255
  }
1171
1256
  case "nullable":
1172
- return _optionalChain([inner, 'call', _51 => _51(), 'optionalAccess', _52 => _52.nullable, 'call', _53 => _53()]);
1257
+ return _optionalChain([inner, 'call', _54 => _54(), 'optionalAccess', _55 => _55.nullable, 'call', _56 => _56()]);
1173
1258
  case "pipe":
1174
1259
  return walk(def.out);
1175
1260
  case "lazy":
@@ -1180,56 +1265,57 @@ function build(schema, walk) {
1180
1265
  return left && right ? left.pipe(right) : _nullishCoalesce(left, () => ( right));
1181
1266
  }
1182
1267
  default:
1183
- return _chunkZTHGF62Ocjs.inner_of.call(void 0, def) ? inner() : void 0;
1268
+ return inner_of(def) ? inner() : void 0;
1184
1269
  }
1185
1270
  }
1271
+ _chunkUEGKXCSQcjs.__name.call(void 0, build, "build");
1186
1272
 
1187
1273
  // src/internal/event-sourcing.ts
1188
- var bare_patch = (_me, state2, partial) => _actpatch.patch.call(void 0, state2, partial);
1189
- var value_at = (value, path) => path.reduce(
1190
- (at, key) => _optionalChain([at, 'optionalAccess', _54 => _54[key]]),
1274
+ var bare_patch = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (_me, state2, partial) => _actpatch.patch.call(void 0, state2, partial), "bare_patch");
1275
+ var value_at = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (value, path) => path.reduce(
1276
+ (at, key) => _optionalChain([at, 'optionalAccess', _57 => _57[key]]),
1191
1277
  value
1192
- );
1193
- var check_invariants = (target, state2, schema, pii_aware) => {
1278
+ ), "value_at");
1279
+ var check_invariants = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (target, state2, schema, pii_aware) => {
1194
1280
  let result;
1195
1281
  try {
1196
1282
  result = schema.safeParse(state2);
1197
1283
  } catch (error) {
1198
- throw new (0, _chunkZTHGF62Ocjs.ValidationError)(target, state2, error);
1284
+ throw new (0, _chunkUEGKXCSQcjs.ValidationError)(target, state2, error);
1199
1285
  }
1200
1286
  if (result.success) return;
1201
1287
  const issues = pii_aware ? result.error.issues.filter((issue) => {
1202
1288
  const value = value_at(state2, issue.path);
1203
- return value !== _chunkZTHGF62Ocjs.REDACTED && value !== _chunkZTHGF62Ocjs.SHREDDED;
1289
+ return value !== _chunkUEGKXCSQcjs.REDACTED && value !== _chunkUEGKXCSQcjs.SHREDDED;
1204
1290
  }) : result.error.issues;
1205
1291
  if (issues.length)
1206
- throw new (0, _chunkZTHGF62Ocjs.ValidationError)(
1292
+ throw new (0, _chunkUEGKXCSQcjs.ValidationError)(
1207
1293
  target,
1208
1294
  state2,
1209
- _zod.prettifyError.call(void 0, new (0, _zod.ZodError)(issues))
1295
+ _zod2.prettifyError.call(void 0, new (0, _zod2.ZodError)(issues))
1210
1296
  );
1211
- };
1297
+ }, "check_invariants");
1212
1298
  var DEFAULT_BATCH = 500;
1213
- var cache_put = (stream, entry) => _chunkN74AN6L5cjs.cache.call(void 0, ).set(stream, entry).catch(
1214
- (err) => _chunkN74AN6L5cjs.log.call(void 0, ).warn(
1299
+ var cache_put = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (stream, entry) => _chunkWDIBO6AWcjs.cache.call(void 0, ).set(stream, entry).catch(
1300
+ (err) => _chunkWDIBO6AWcjs.log.call(void 0, ).warn(
1215
1301
  err,
1216
1302
  "cache set skipped; the next load re-folds from the store"
1217
1303
  )
1218
- );
1219
- var cache_drop = (stream) => _chunkN74AN6L5cjs.cache.call(void 0, ).invalidate(stream).catch(
1220
- (err) => _chunkN74AN6L5cjs.log.call(void 0, ).warn(
1304
+ ), "cache_put");
1305
+ var cache_drop = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (stream) => _chunkWDIBO6AWcjs.cache.call(void 0, ).invalidate(stream).catch(
1306
+ (err) => _chunkWDIBO6AWcjs.log.call(void 0, ).warn(
1221
1307
  err,
1222
1308
  "cache invalidate skipped; a stale checkpoint re-folds from its event_id"
1223
1309
  )
1224
- );
1310
+ ), "cache_drop");
1225
1311
  async function snap(snapshot) {
1226
1312
  const { id, stream, name, meta, version } = snapshot.event;
1227
1313
  try {
1228
- const [committed] = await _chunkN74AN6L5cjs.store.call(void 0, ).commit(
1314
+ const [committed] = await _chunkWDIBO6AWcjs.store.call(void 0, ).commit(
1229
1315
  [
1230
1316
  {
1231
1317
  stream,
1232
- msgs: [{ name: _chunkZTHGF62Ocjs.SNAP_EVENT, data: snapshot.state }],
1318
+ msgs: [{ name: _chunkUEGKXCSQcjs.SNAP_EVENT, data: snapshot.state }],
1233
1319
  // IMPORTANT! - state events are committed right after the snapshot event
1234
1320
  expectedVersion: version
1235
1321
  }
@@ -1242,18 +1328,19 @@ async function snap(snapshot) {
1242
1328
  return committed;
1243
1329
  } catch (error) {
1244
1330
  const reason = error instanceof Error ? error.message : String(error);
1245
- _chunkN74AN6L5cjs.log.call(void 0, ).warn(
1331
+ _chunkWDIBO6AWcjs.log.call(void 0, ).warn(
1246
1332
  `Snapshot write failed on stream "${stream}": ${reason} \u2014 cold starts will replay full history until snapshots succeed.`
1247
1333
  );
1248
1334
  }
1249
1335
  }
1336
+ _chunkUEGKXCSQcjs.__name.call(void 0, snap, "snap");
1250
1337
  async function tombstone(stream, expectedVersion, correlation) {
1251
1338
  try {
1252
- const [committed] = await _chunkN74AN6L5cjs.store.call(void 0, ).commit(
1339
+ const [committed] = await _chunkWDIBO6AWcjs.store.call(void 0, ).commit(
1253
1340
  [
1254
1341
  {
1255
1342
  stream,
1256
- msgs: [{ name: _chunkZTHGF62Ocjs.TOMBSTONE_EVENT, data: {} }],
1343
+ msgs: [{ name: _chunkUEGKXCSQcjs.TOMBSTONE_EVENT, data: {} }],
1257
1344
  expectedVersion
1258
1345
  }
1259
1346
  ],
@@ -1261,16 +1348,18 @@ async function tombstone(stream, expectedVersion, correlation) {
1261
1348
  );
1262
1349
  return committed;
1263
1350
  } catch (error) {
1264
- if (error instanceof _chunkZTHGF62Ocjs.ConcurrencyError) return void 0;
1351
+ if (error instanceof _chunkUEGKXCSQcjs.ConcurrencyError) return void 0;
1265
1352
  throw error;
1266
1353
  }
1267
1354
  }
1355
+ _chunkUEGKXCSQcjs.__name.call(void 0, tombstone, "tombstone");
1268
1356
  function is_valid(event) {
1269
1357
  if (event.version < 0) return false;
1270
1358
  if (!(event.created instanceof Date) || Number.isNaN(event.created.getTime()))
1271
1359
  return false;
1272
1360
  return true;
1273
1361
  }
1362
+ _chunkUEGKXCSQcjs.__name.call(void 0, is_valid, "is_valid");
1274
1363
  async function scan(source, opts = {}, callback) {
1275
1364
  const {
1276
1365
  drop_snapshots = false,
@@ -1298,9 +1387,9 @@ async function scan(source, opts = {}, callback) {
1298
1387
  if (drop_closed_streams) {
1299
1388
  await source.query(
1300
1389
  (e) => {
1301
- if (e.name === _chunkZTHGF62Ocjs.TOMBSTONE_EVENT) closed_streams.add(e.stream);
1390
+ if (e.name === _chunkUEGKXCSQcjs.TOMBSTONE_EVENT) closed_streams.add(e.stream);
1302
1391
  },
1303
- { names: [_chunkZTHGF62Ocjs.TOMBSTONE_EVENT] }
1392
+ { names: [_chunkUEGKXCSQcjs.TOMBSTONE_EVENT] }
1304
1393
  );
1305
1394
  }
1306
1395
  let max_id;
@@ -1325,20 +1414,20 @@ async function scan(source, opts = {}, callback) {
1325
1414
  if (on_progress) on_progress({ processed, id: event.id, max_id });
1326
1415
  const has_history = started.has(event.stream);
1327
1416
  started.add(event.stream);
1328
- if (drop_snapshots && event.name === _chunkZTHGF62Ocjs.SNAP_EVENT && has_history) {
1417
+ if (drop_snapshots && event.name === _chunkUEGKXCSQcjs.SNAP_EVENT && has_history) {
1329
1418
  dropped_snaps++;
1330
1419
  return;
1331
1420
  }
1332
- if (closed_streams.has(event.stream) && event.name !== _chunkZTHGF62Ocjs.TOMBSTONE_EVENT) {
1421
+ if (closed_streams.has(event.stream) && event.name !== _chunkUEGKXCSQcjs.TOMBSTONE_EVENT) {
1333
1422
  dropped_closed++;
1334
1423
  return;
1335
1424
  }
1336
1425
  let migrated = event;
1337
- const migration = _optionalChain([event_migrations, 'optionalAccess', _55 => _55[event.name]]);
1426
+ const migration = _optionalChain([event_migrations, 'optionalAccess', _58 => _58[event.name]]);
1338
1427
  if (migration) {
1339
- const revived = _optionalChain([migration_dates, 'access', _56 => _56.get, 'call', _57 => _57(event.name), 'optionalAccess', _58 => _58.safeParse, 'call', _59 => _59(event.data)]);
1428
+ const revived = _optionalChain([migration_dates, 'access', _59 => _59.get, 'call', _60 => _60(event.name), 'optionalAccess', _61 => _61.safeParse, 'call', _62 => _62(event.data)]);
1340
1429
  const old_data = migration.from_schema.parse(
1341
- _optionalChain([revived, 'optionalAccess', _60 => _60.success]) ? revived.data : event.data
1430
+ _optionalChain([revived, 'optionalAccess', _63 => _63.success]) ? revived.data : event.data
1342
1431
  );
1343
1432
  const new_data = migration.migrate(old_data);
1344
1433
  migration.to_schema.parse(new_data);
@@ -1376,7 +1465,7 @@ async function scan(source, opts = {}, callback) {
1376
1465
  // A cause missing from the source has no id in the new
1377
1466
  // log; its old id would name another event there.
1378
1467
  id: _nullishCoalesce(id_map.get(cause.id), () => ( -1)),
1379
- name: _nullishCoalesce(_optionalChain([event_migrations, 'optionalAccess', _61 => _61[cause.name], 'optionalAccess', _62 => _62.to]), () => ( cause.name)),
1468
+ name: _nullishCoalesce(_optionalChain([event_migrations, 'optionalAccess', _64 => _64[cause.name], 'optionalAccess', _65 => _65.to]), () => ( cause.name)),
1380
1469
  stream: stream_rename ? stream_rename(cause.stream) : cause.stream
1381
1470
  }
1382
1471
  }
@@ -1402,22 +1491,23 @@ async function scan(source, opts = {}, callback) {
1402
1491
  }
1403
1492
  };
1404
1493
  }
1494
+ _chunkUEGKXCSQcjs.__name.call(void 0, scan, "scan");
1405
1495
  async function load(me, target, callback, patch_fn = bare_patch) {
1406
1496
  const { stream, actor, asOf } = target;
1407
1497
  const time_travel = !!asOf && Object.values(asOf).some((v) => v !== void 0);
1408
1498
  const seeded = time_travel && asOf.limit === void 0 && !asOf.created_after;
1409
- const cached = time_travel ? void 0 : await _chunkN74AN6L5cjs.cache.call(void 0, ).get(stream);
1499
+ const cached = time_travel ? void 0 : await _chunkWDIBO6AWcjs.cache.call(void 0, ).get(stream);
1410
1500
  const cache_hit = !!cached;
1411
- let state2 = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _63 => _63.state]), () => ( (me.init ? me.init() : {})));
1412
- let patches = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _64 => _64.patches]), () => ( 0));
1413
- let snaps = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _65 => _65.snaps]), () => ( 0));
1501
+ let state2 = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _66 => _66.state]), () => ( (me.init ? me.init() : {})));
1502
+ let patches = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _67 => _67.patches]), () => ( 0));
1503
+ let snaps = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _68 => _68.snaps]), () => ( 0));
1414
1504
  let replayed = 0;
1415
1505
  let event;
1416
- await _chunkN74AN6L5cjs.store.call(void 0, ).query(
1506
+ await _chunkWDIBO6AWcjs.store.call(void 0, ).query(
1417
1507
  (raw) => {
1418
- if (seeded && raw.name === _chunkZTHGF62Ocjs.SNAP_EVENT && replayed > 0) return;
1508
+ if (seeded && raw.name === _chunkUEGKXCSQcjs.SNAP_EVENT && replayed > 0) return;
1419
1509
  event = me.view(raw, actor);
1420
- if (event.name === _chunkZTHGF62Ocjs.SNAP_EVENT) {
1510
+ if (event.name === _chunkUEGKXCSQcjs.SNAP_EVENT) {
1421
1511
  state2 = event.data;
1422
1512
  snaps++;
1423
1513
  patches = 0;
@@ -1426,12 +1516,12 @@ async function load(me, target, callback, patch_fn = bare_patch) {
1426
1516
  state2 = patch_fn(me, state2, me.patch[event.name](event, state2), event);
1427
1517
  patches++;
1428
1518
  replayed++;
1429
- } else if (event.name !== _chunkZTHGF62Ocjs.TOMBSTONE_EVENT) {
1430
- _chunkN74AN6L5cjs.log.call(void 0, ).warn(
1519
+ } else if (event.name !== _chunkUEGKXCSQcjs.TOMBSTONE_EVENT) {
1520
+ _chunkWDIBO6AWcjs.log.call(void 0, ).warn(
1431
1521
  `Skipping unknown event "${String(event.name)}" on stream "${stream}" (id=${event.id}) \u2014 no reducer in state "${me.name}"`
1432
1522
  );
1433
1523
  }
1434
- _optionalChain([callback, 'optionalCall', _66 => _66({
1524
+ _optionalChain([callback, 'optionalCall', _69 => _69({
1435
1525
  event,
1436
1526
  state: state2,
1437
1527
  version: event.version,
@@ -1455,7 +1545,7 @@ async function load(me, target, callback, patch_fn = bare_patch) {
1455
1545
  ) : time_travel ? asOf : { with_snaps: true }
1456
1546
  }
1457
1547
  );
1458
- const head_is_tombstone = _optionalChain([event, 'optionalAccess', _67 => _67.name]) === _chunkZTHGF62Ocjs.TOMBSTONE_EVENT;
1548
+ const head_is_tombstone = _optionalChain([event, 'optionalAccess', _70 => _70.name]) === _chunkUEGKXCSQcjs.TOMBSTONE_EVENT;
1459
1549
  if (replayed > 0 && !time_travel && event && !me.pii_aware && !head_is_tombstone) {
1460
1550
  await cache_put(stream, {
1461
1551
  stream,
@@ -1469,15 +1559,16 @@ async function load(me, target, callback, patch_fn = bare_patch) {
1469
1559
  return {
1470
1560
  event,
1471
1561
  state: state2,
1472
- version: _nullishCoalesce(_nullishCoalesce(_optionalChain([event, 'optionalAccess', _68 => _68.version]), () => ( _optionalChain([cached, 'optionalAccess', _69 => _69.version]))), () => ( -1)),
1562
+ version: _nullishCoalesce(_nullishCoalesce(_optionalChain([event, 'optionalAccess', _71 => _71.version]), () => ( _optionalChain([cached, 'optionalAccess', _72 => _72.version]))), () => ( -1)),
1473
1563
  // Captured with `state`, so consumers never race a separate cache lookup.
1474
- id: _nullishCoalesce(_nullishCoalesce(_optionalChain([event, 'optionalAccess', _70 => _70.id]), () => ( _optionalChain([cached, 'optionalAccess', _71 => _71.event_id]))), () => ( -1)),
1564
+ id: _nullishCoalesce(_nullishCoalesce(_optionalChain([event, 'optionalAccess', _73 => _73.id]), () => ( _optionalChain([cached, 'optionalAccess', _74 => _74.event_id]))), () => ( -1)),
1475
1565
  patches,
1476
1566
  snaps,
1477
1567
  cache_hit,
1478
1568
  replayed
1479
1569
  };
1480
1570
  }
1571
+ _chunkUEGKXCSQcjs.__name.call(void 0, load, "load");
1481
1572
  async function load_others(loads, payload, own, actor, patch_fn, refuse) {
1482
1573
  const streams = loads.map((l) => l.target(payload, own.state));
1483
1574
  streams.forEach((stream, i) => {
@@ -1498,8 +1589,8 @@ async function load_others(loads, payload, own, actor, patch_fn, refuse) {
1498
1589
  void 0,
1499
1590
  patch_fn
1500
1591
  );
1501
- if (_optionalChain([snapshot, 'access', _72 => _72.event, 'optionalAccess', _73 => _73.name]) === _chunkZTHGF62Ocjs.TOMBSTONE_EVENT)
1502
- throw new (0, _chunkZTHGF62Ocjs.StreamClosedError)(stream);
1592
+ if (_optionalChain([snapshot, 'access', _75 => _75.event, 'optionalAccess', _76 => _76.name]) === _chunkUEGKXCSQcjs.TOMBSTONE_EVENT)
1593
+ throw new (0, _chunkUEGKXCSQcjs.StreamClosedError)(stream);
1503
1594
  return {
1504
1595
  state: l.state,
1505
1596
  stream,
@@ -1510,15 +1601,16 @@ async function load_others(loads, payload, own, actor, patch_fn, refuse) {
1510
1601
  })
1511
1602
  );
1512
1603
  }
1604
+ _chunkUEGKXCSQcjs.__name.call(void 0, load_others, "load_others");
1513
1605
  async function action(me, action2, target, payload, options, patch_fn = bare_patch) {
1514
1606
  const { stream, expectedVersion, actor } = target;
1515
1607
  if (!stream) throw new Error("Missing target stream");
1516
- const reactingTo = _optionalChain([options, 'optionalAccess', _74 => _74.reactingTo]);
1517
- const correlator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _75 => _75.correlator]), () => ( default_correlator));
1518
- const validated = _chunkN74AN6L5cjs.validate.call(void 0, action2, payload, me.actions[action2]);
1519
- const opts = _optionalChain([me, 'access', _76 => _76.options, 'optionalAccess', _77 => _77[action2]]);
1520
- const max_retries = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _78 => _78.maxRetries]), () => ( 0));
1521
- const loads = _nullishCoalesce(_optionalChain([me, 'access', _79 => _79.loads, 'optionalAccess', _80 => _80[action2]]), () => ( []));
1608
+ const reactingTo = _optionalChain([options, 'optionalAccess', _77 => _77.reactingTo]);
1609
+ const correlator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _78 => _78.correlator]), () => ( default_correlator));
1610
+ const validated = _chunkWDIBO6AWcjs.validate.call(void 0, action2, payload, me.actions[action2]);
1611
+ const opts = _optionalChain([me, 'access', _79 => _79.options, 'optionalAccess', _80 => _80[action2]]);
1612
+ const max_retries = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _81 => _81.maxRetries]), () => ( 0));
1613
+ const loads = _nullishCoalesce(_optionalChain([me, 'access', _82 => _82.loads, 'optionalAccess', _83 => _83[action2]]), () => ( []));
1522
1614
  for (let attempt = 0; ; attempt++) {
1523
1615
  try {
1524
1616
  const snapshot = await load(
@@ -1527,8 +1619,8 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
1527
1619
  void 0,
1528
1620
  patch_fn
1529
1621
  );
1530
- if (_optionalChain([snapshot, 'access', _81 => _81.event, 'optionalAccess', _82 => _82.name]) === _chunkZTHGF62Ocjs.TOMBSTONE_EVENT)
1531
- throw new (0, _chunkZTHGF62Ocjs.StreamClosedError)(stream);
1622
+ if (_optionalChain([snapshot, 'access', _84 => _84.event, 'optionalAccess', _85 => _85.name]) === _chunkUEGKXCSQcjs.TOMBSTONE_EVENT)
1623
+ throw new (0, _chunkUEGKXCSQcjs.StreamClosedError)(stream);
1532
1624
  const own = {
1533
1625
  state: me,
1534
1626
  stream,
@@ -1542,7 +1634,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
1542
1634
  { stream, state: snapshot.state },
1543
1635
  target.actor,
1544
1636
  patch_fn,
1545
- (description) => new (0, _chunkZTHGF62Ocjs.PreconditionError)(
1637
+ (description) => new (0, _chunkUEGKXCSQcjs.PreconditionError)(
1546
1638
  action2,
1547
1639
  validated,
1548
1640
  target,
@@ -1551,11 +1643,11 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
1551
1643
  )
1552
1644
  ) : [];
1553
1645
  const loaded = Object.fromEntries(
1554
- others.map((p, i) => [loads[i].name, _optionalChain([p, 'optionalAccess', _83 => _83.snapshot, 'access', _84 => _84.state])])
1646
+ others.map((p, i) => [loads[i].name, _optionalChain([p, 'optionalAccess', _86 => _86.snapshot, 'access', _87 => _87.state])])
1555
1647
  );
1556
- for (const { holds, description } of _nullishCoalesce(_optionalChain([me, 'access', _85 => _85.requires, 'optionalAccess', _86 => _86[action2]]), () => ( [])))
1648
+ for (const { holds, description } of _nullishCoalesce(_optionalChain([me, 'access', _88 => _88.requires, 'optionalAccess', _89 => _89[action2]]), () => ( [])))
1557
1649
  if (!holds(validated, snapshot.state, actor, loaded))
1558
- throw new (0, _chunkZTHGF62Ocjs.PreconditionError)(
1650
+ throw new (0, _chunkUEGKXCSQcjs.PreconditionError)(
1559
1651
  action2,
1560
1652
  validated,
1561
1653
  target,
@@ -1577,7 +1669,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
1577
1669
  );
1578
1670
  to.events.push({
1579
1671
  name: event,
1580
- data: _chunkN74AN6L5cjs.validate.call(void 0, event, data, to.state.events[event])
1672
+ data: _chunkWDIBO6AWcjs.validate.call(void 0, event, data, to.state.events[event])
1581
1673
  });
1582
1674
  }
1583
1675
  if (!own.events.length)
@@ -1585,10 +1677,10 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
1585
1677
  `Action "${action2}" appends only to the streams it loads; it must append an event to its own stream too`
1586
1678
  );
1587
1679
  const appends = [own, ...others].filter(
1588
- (p) => !!_optionalChain([p, 'optionalAccess', _87 => _87.events, 'access', _88 => _88.length])
1680
+ (p) => !!_optionalChain([p, 'optionalAccess', _90 => _90.events, 'access', _91 => _91.length])
1589
1681
  );
1590
1682
  const meta = {
1591
- correlation: _optionalChain([reactingTo, 'optionalAccess', _89 => _89.meta, 'access', _90 => _90.correlation]) || correlator({
1683
+ correlation: _optionalChain([reactingTo, 'optionalAccess', _92 => _92.meta, 'access', _93 => _93.correlation]) || correlator({
1592
1684
  action: action2,
1593
1685
  state: me.name,
1594
1686
  stream,
@@ -1634,7 +1726,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
1634
1726
  });
1635
1727
  let committed;
1636
1728
  try {
1637
- committed = await _chunkN74AN6L5cjs.store.call(void 0, ).commit(
1729
+ committed = await _chunkWDIBO6AWcjs.store.call(void 0, ).commit(
1638
1730
  appends.map((p) => ({
1639
1731
  stream: p.stream,
1640
1732
  msgs: p.events.map((e) => p.state.message(e)),
@@ -1643,7 +1735,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
1643
1735
  meta
1644
1736
  );
1645
1737
  } catch (error) {
1646
- if (error instanceof _chunkZTHGF62Ocjs.ConcurrencyError) void cache_drop(error.stream);
1738
+ if (error instanceof _chunkUEGKXCSQcjs.ConcurrencyError) void cache_drop(error.stream);
1647
1739
  throw error;
1648
1740
  }
1649
1741
  let row = 0;
@@ -1666,13 +1758,13 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
1666
1758
  };
1667
1759
  });
1668
1760
  const last = appended.at(-1);
1669
- const snap_event = _optionalChain([owner, 'access', _91 => _91.snap, 'optionalCall', _92 => _92(last)]) ? await snap(last) : void 0;
1761
+ const snap_event = _optionalChain([owner, 'access', _94 => _94.snap, 'optionalCall', _95 => _95(last)]) ? await snap(last) : void 0;
1670
1762
  if (!owner.pii_aware)
1671
1763
  void cache_put(append.stream, {
1672
1764
  stream: append.stream,
1673
1765
  state: last.state,
1674
- version: _nullishCoalesce(_optionalChain([snap_event, 'optionalAccess', _93 => _93.version]), () => ( last.event.version)),
1675
- event_id: _nullishCoalesce(_optionalChain([snap_event, 'optionalAccess', _94 => _94.id]), () => ( last.event.id)),
1766
+ version: _nullishCoalesce(_optionalChain([snap_event, 'optionalAccess', _96 => _96.version]), () => ( last.event.version)),
1767
+ event_id: _nullishCoalesce(_optionalChain([snap_event, 'optionalAccess', _97 => _97.id]), () => ( last.event.id)),
1676
1768
  patches: snap_event ? 0 : last.patches,
1677
1769
  snaps: snap_event ? last.snaps + 1 : last.snaps
1678
1770
  });
@@ -1685,19 +1777,20 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
1685
1777
  }
1686
1778
  return snapshots;
1687
1779
  } catch (error) {
1688
- if (!(error instanceof _chunkZTHGF62Ocjs.ConcurrencyError)) throw error;
1780
+ if (!(error instanceof _chunkUEGKXCSQcjs.ConcurrencyError)) throw error;
1689
1781
  if (expectedVersion !== void 0 && error.stream === stream) throw error;
1690
1782
  if (attempt >= max_retries) throw error;
1691
- if (_optionalChain([opts, 'optionalAccess', _95 => _95.backoff])) {
1783
+ if (_optionalChain([opts, 'optionalAccess', _98 => _98.backoff])) {
1692
1784
  const delay_ms = compute_backoff_delay(attempt, opts.backoff);
1693
- if (delay_ms > 0) await _chunkN74AN6L5cjs.sleep.call(void 0, delay_ms);
1785
+ if (delay_ms > 0) await _chunkWDIBO6AWcjs.sleep.call(void 0, delay_ms);
1694
1786
  }
1695
1787
  }
1696
1788
  }
1697
1789
  }
1790
+ _chunkUEGKXCSQcjs.__name.call(void 0, action, "action");
1698
1791
 
1699
1792
  // src/internal/tracing.ts
1700
- var PRETTY = _chunkN74AN6L5cjs.config.call(void 0, ).env !== "production";
1793
+ var PRETTY = _chunkWDIBO6AWcjs.config.call(void 0, ).env !== "production";
1701
1794
  var C_BLUE = "\x1B[38;5;39m";
1702
1795
  var C_ORANGE = "\x1B[38;5;208m";
1703
1796
  var C_GREEN = "\x1B[38;5;42m";
@@ -1706,32 +1799,32 @@ var C_DRAIN = "\x1B[38;5;244m";
1706
1799
  var C_HIT = "\x1B[38;5;82m";
1707
1800
  var C_MISS = "\x1B[38;5;220m";
1708
1801
  var C_RESET = "\x1B[0m";
1709
- var es_caption = (caption, color, body) => PRETTY ? `${color}${body}${C_RESET}` : `${caption}: ${body}`;
1802
+ var es_caption = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (caption, color, body) => PRETTY ? `${color}${body}${C_RESET}` : `${caption}: ${body}`, "es_caption");
1710
1803
  var C_LANE = "\x1B[38;5;183m";
1711
1804
  var C_DIM = "\x1B[38;5;240m";
1712
1805
  var C_ERR = "\x1B[38;5;196m";
1713
1806
  var C_STREAM = "\x1B[38;5;226m";
1714
- var dim = (text) => PRETTY ? `${C_DIM}${text}${C_RESET}` : text;
1715
- var hue = (color, text) => PRETTY ? `${color}${text}${C_RESET}` : text;
1716
- var drain_caption = (caption, lane) => {
1807
+ var dim = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (text) => PRETTY ? `${C_DIM}${text}${C_RESET}` : text, "dim");
1808
+ var hue = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (color, text) => PRETTY ? `${color}${text}${C_RESET}` : text, "hue");
1809
+ var drain_caption = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (caption, lane) => {
1717
1810
  const show_lane = lane && lane !== "default";
1718
1811
  if (PRETTY) {
1719
1812
  const tag = `${C_DRAIN}>> ${caption}${C_RESET}`;
1720
1813
  return show_lane ? `${tag} ${C_LANE}${lane}${C_RESET}` : tag;
1721
1814
  }
1722
1815
  return show_lane ? `>> ${caption} ${lane}` : `>> ${caption}`;
1723
- };
1724
- var cache_marker = (hit) => {
1816
+ }, "drain_caption");
1817
+ var cache_marker = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (hit) => {
1725
1818
  const word = hit ? "hit" : "miss";
1726
1819
  if (!PRETTY) return word;
1727
1820
  return `${hit ? C_HIT : C_MISS}${word}${C_RESET}${C_GREEN}`;
1728
- };
1729
- var stats_marker = (version, replayed, snaps, patches) => {
1821
+ }, "cache_marker");
1822
+ var stats_marker = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (version, replayed, snaps, patches) => {
1730
1823
  const text = `v=${version} replayed=${replayed} snaps=${snaps} patches=${patches}`;
1731
1824
  if (!PRETTY) return text;
1732
1825
  return `${C_DRAIN}${text}${C_RESET}${C_GREEN}`;
1733
- };
1734
- var as_of_marker = (asOf) => {
1826
+ }, "stats_marker");
1827
+ var as_of_marker = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (asOf) => {
1735
1828
  if (!asOf) return "";
1736
1829
  const parts = [];
1737
1830
  if (asOf.before !== void 0) parts.push(`before=${asOf.before}`);
@@ -1741,23 +1834,23 @@ var as_of_marker = (asOf) => {
1741
1834
  parts.push(`created_after=${asOf.created_after.toISOString()}`);
1742
1835
  if (asOf.limit !== void 0) parts.push(`limit=${asOf.limit}`);
1743
1836
  return parts.length ? ` (as-of ${parts.join(" ")})` : " (as-of)";
1744
- };
1745
- var traced = (inner, exit, entry) => (async (...args) => {
1746
- _optionalChain([entry, 'optionalCall', _96 => _96(...args)]);
1837
+ }, "as_of_marker");
1838
+ var traced = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (inner, exit, entry) => (async (...args) => {
1839
+ _optionalChain([entry, 'optionalCall', _99 => _99(...args)]);
1747
1840
  const result = await inner(...args);
1748
- _optionalChain([exit, 'optionalCall', _97 => _97(result, ...args)]);
1841
+ _optionalChain([exit, 'optionalCall', _100 => _100(result, ...args)]);
1749
1842
  return result;
1750
- });
1843
+ }), "traced");
1751
1844
  function build_es(logger, correlator = default_correlator, patch_fn = bare_patch) {
1752
- const bound_action = (me, action_name, target, payload, options) => action(
1845
+ const bound_action = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (me, action_name, target, payload, options) => action(
1753
1846
  me,
1754
1847
  action_name,
1755
1848
  target,
1756
1849
  payload,
1757
- { ...options, correlator: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _98 => _98.correlator]), () => ( correlator)) },
1850
+ { ...options, correlator: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _101 => _101.correlator]), () => ( correlator)) },
1758
1851
  patch_fn
1759
- );
1760
- const bound_load = (me, target, callback) => load(me, target, callback, patch_fn);
1852
+ ), "bound_action");
1853
+ const bound_load = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (me, target, callback) => load(me, target, callback, patch_fn), "bound_load");
1761
1854
  if (logger.level !== "trace") {
1762
1855
  return {
1763
1856
  snap,
@@ -1819,6 +1912,7 @@ function build_es(logger, correlator = default_correlator, patch_fn = bare_patch
1819
1912
  })
1820
1913
  };
1821
1914
  }
1915
+ _chunkUEGKXCSQcjs.__name.call(void 0, build_es, "build_es");
1822
1916
  function build_drain(logger) {
1823
1917
  return {
1824
1918
  claim,
@@ -1828,7 +1922,7 @@ function build_drain(logger) {
1828
1922
  subscribe: logger.level !== "trace" ? subscribe : traced(subscribe, (result, streams) => {
1829
1923
  if (!result.subscribed) return;
1830
1924
  const lanes = new Set(streams.map((s) => _nullishCoalesce(s.lane, () => ( "default"))));
1831
- const uniform_lane = lanes.size === 1 ? _optionalChain([streams, 'access', _99 => _99[0], 'optionalAccess', _100 => _100.lane]) : void 0;
1925
+ const uniform_lane = lanes.size === 1 ? _optionalChain([streams, 'access', _102 => _102[0], 'optionalAccess', _103 => _103.lane]) : void 0;
1832
1926
  const data = streams.map(
1833
1927
  ({ stream, lane }) => uniform_lane || !lane || lane === "default" ? hue(C_STREAM, stream) : `${hue(C_STREAM, stream)}${dim(`[${lane}]`)}`
1834
1928
  ).join(" ");
@@ -1838,9 +1932,10 @@ function build_drain(logger) {
1838
1932
  })
1839
1933
  };
1840
1934
  }
1935
+ _chunkUEGKXCSQcjs.__name.call(void 0, build_drain, "build_drain");
1841
1936
  function trace_cycle(logger, leased, fetched, handled, acked, blocked) {
1842
1937
  if (logger.level !== "trace" || !leased.length) return;
1843
- const lane = _optionalChain([leased, 'access', _101 => _101[0], 'optionalAccess', _102 => _102.lane]);
1938
+ const lane = _optionalChain([leased, 'access', _104 => _104[0], 'optionalAccess', _105 => _105.lane]);
1844
1939
  const fetch_by_stream = new Map(fetched.map((f) => [f.stream, f]));
1845
1940
  const acked_by_stream = new Map(acked.map((a) => [a.stream, a.at]));
1846
1941
  const blocked_by_stream = new Map(blocked.map((b) => [b.stream, b.error]));
@@ -1849,8 +1944,8 @@ function trace_cycle(logger, leased, fetched, handled, acked, blocked) {
1849
1944
  );
1850
1945
  const detail = leased.map(({ stream, at, retry }) => {
1851
1946
  const f = fetch_by_stream.get(stream);
1852
- const key = _optionalChain([f, 'optionalAccess', _103 => _103.source]) ? `${hue(C_STREAM, stream)}${dim(`<-${f.source}`)}` : hue(C_STREAM, stream);
1853
- const events = _optionalChain([f, 'optionalAccess', _104 => _104.events, 'access', _105 => _105.length]) ? ` ${dim(
1947
+ const key = _optionalChain([f, 'optionalAccess', _106 => _106.source]) ? `${hue(C_STREAM, stream)}${dim(`<-${f.source}`)}` : hue(C_STREAM, stream);
1948
+ const events = _optionalChain([f, 'optionalAccess', _107 => _107.events, 'access', _108 => _108.length]) ? ` ${dim(
1854
1949
  `[${f.events.map(({ id, name }) => `#${id} ${String(name)}`).join(", ")}]`
1855
1950
  )}` : "";
1856
1951
  const acked_at = acked_by_stream.get(stream);
@@ -1875,15 +1970,17 @@ function trace_cycle(logger, leased, fetched, handled, acked, blocked) {
1875
1970
  }).join(", ");
1876
1971
  logger.trace(`${drain_caption("drained", lane)} ${detail}`);
1877
1972
  }
1973
+ _chunkUEGKXCSQcjs.__name.call(void 0, trace_cycle, "trace_cycle");
1878
1974
 
1879
1975
  // src/internal/drain-cycle.ts
1880
1976
  function budget_exhausted(lease, options, store_failing) {
1881
- if (store_failing || !_optionalChain([options, 'optionalAccess', _106 => _106.blockOnError]) || lease.retry <= options.maxRetries)
1977
+ if (store_failing || !_optionalChain([options, 'optionalAccess', _109 => _109.blockOnError]) || lease.retry <= options.maxRetries)
1882
1978
  return void 0;
1883
1979
  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.`;
1884
- _chunkN74AN6L5cjs.log.call(void 0, ).error(error);
1980
+ _chunkWDIBO6AWcjs.log.call(void 0, ).error(error);
1885
1981
  return { lease, handled: 0, acked_at: lease.at, error, block: true };
1886
1982
  }
1983
+ _chunkUEGKXCSQcjs.__name.call(void 0, budget_exhausted, "budget_exhausted");
1887
1984
  function fetch_failure_policy(registry) {
1888
1985
  let blockOnError = true;
1889
1986
  let maxRetries = 0;
@@ -1894,16 +1991,17 @@ function fetch_failure_policy(registry) {
1894
1991
  }
1895
1992
  return { blockOnError, maxRetries };
1896
1993
  }
1994
+ _chunkUEGKXCSQcjs.__name.call(void 0, fetch_failure_policy, "fetch_failure_policy");
1897
1995
  function finalize(lease, handled, at, error, options, logger, failed_at) {
1898
1996
  if (!error) return { lease, handled, acked_at: at };
1899
1997
  logger.error(error);
1900
- const non_retryable = error instanceof _chunkZTHGF62Ocjs.NonRetryableError;
1998
+ const non_retryable = error instanceof _chunkUEGKXCSQcjs.NonRetryableError;
1901
1999
  const block2 = options.blockOnError && (non_retryable || lease.retry >= options.maxRetries);
1902
2000
  if (block2)
1903
2001
  logger.error(
1904
2002
  non_retryable ? `Blocking ${lease.stream} on non-retryable error.` : `Blocking ${lease.stream} after ${lease.retry} retries.`
1905
2003
  );
1906
- const next_attempt_at = block2 ? void 0 : Date.now() + compute_backoff_delay(lease.retry, _nullishCoalesce(options.backoff, () => ( _chunkN74AN6L5cjs.DEFAULT_BACKOFF)));
2004
+ const next_attempt_at = block2 ? void 0 : Date.now() + compute_backoff_delay(lease.retry, _nullishCoalesce(options.backoff, () => ( _chunkWDIBO6AWcjs.DEFAULT_BACKOFF)));
1907
2005
  return {
1908
2006
  lease,
1909
2007
  handled,
@@ -1914,6 +2012,7 @@ function finalize(lease, handled, at, error, options, logger, failed_at) {
1914
2012
  failed_at
1915
2013
  };
1916
2014
  }
2015
+ _chunkUEGKXCSQcjs.__name.call(void 0, finalize, "finalize");
1917
2016
  function warn_misrouted(seen, stream, handler, event) {
1918
2017
  report_once(
1919
2018
  seen,
@@ -1921,6 +2020,7 @@ function warn_misrouted(seen, stream, handler, event) {
1921
2020
  `Reaction "${handler}" on "${event}" resolved to target "${stream}", which a projection already serves. A target is served by one batch handler or one state projection, so this reaction can never run \u2014 and delivering to it would hand the projection an aggregate from another stream. Skipping it. The equivalent static \`.to({ target })\` is rejected at build; a dynamic resolver's target is only knowable here.`
1922
2021
  );
1923
2022
  }
2023
+ _chunkUEGKXCSQcjs.__name.call(void 0, warn_misrouted, "warn_misrouted");
1924
2024
  async function run_drain_cycle(deps, cycle) {
1925
2025
  const { ops, registry, batch_handlers, handle, handle_batch, lane } = deps;
1926
2026
  const {
@@ -1942,7 +2042,7 @@ async function run_drain_cycle(deps, cycle) {
1942
2042
  const fetched = await ops.fetch(leased, eventLimit);
1943
2043
  const fetch_map = /* @__PURE__ */ new Map();
1944
2044
  const fetch_window_at = fetched.reduce(
1945
- (max, { at, events }) => Math.max(max, _optionalChain([events, 'access', _107 => _107.at, 'call', _108 => _108(-1), 'optionalAccess', _109 => _109.id]) || at),
2045
+ (max, { at, events }) => Math.max(max, _optionalChain([events, 'access', _110 => _110.at, 'call', _111 => _111(-1), 'optionalAccess', _112 => _112.id]) || at),
1946
2046
  0
1947
2047
  );
1948
2048
  for (const f of fetched) {
@@ -2006,11 +2106,11 @@ async function run_drain_cycle(deps, cycle) {
2006
2106
  deps.logger
2007
2107
  )
2008
2108
  );
2009
- const at = _optionalChain([entry, 'access', _110 => _110.fetch, 'access', _111 => _111.events, 'access', _112 => _112.at, 'call', _113 => _113(-1), 'optionalAccess', _114 => _114.id]) || fetch_window_at;
2109
+ const at = _optionalChain([entry, 'access', _113 => _113.fetch, 'access', _114 => _114.events, 'access', _115 => _115.at, 'call', _116 => _116(-1), 'optionalAccess', _117 => _117.id]) || fetch_window_at;
2010
2110
  const { payloads } = entry;
2011
2111
  const exhausted = budget_exhausted(
2012
2112
  lease,
2013
- _optionalChain([payloads, 'access', _115 => _115[0], 'optionalAccess', _116 => _116.options]),
2113
+ _optionalChain([payloads, 'access', _118 => _118[0], 'optionalAccess', _119 => _119.options]),
2014
2114
  store_failing
2015
2115
  );
2016
2116
  if (exhausted) return Promise.resolve(exhausted);
@@ -2031,12 +2131,13 @@ async function run_drain_cycle(deps, cycle) {
2031
2131
  const acked = submitted.length ? await ops.ack(submitted) : [];
2032
2132
  const expected = submitted.filter((l) => l.due === void 0).length;
2033
2133
  if (acked.length < expected)
2034
- _chunkN74AN6L5cjs.log.call(void 0, ).warn(
2134
+ _chunkWDIBO6AWcjs.log.call(void 0, ).warn(
2035
2135
  `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.`
2036
2136
  );
2037
2137
  const closeable = handled.filter((h) => h.close !== void 0).map((h) => h.close);
2038
2138
  return { leased, fetched, handled, acked, blocked, closeable };
2039
2139
  }
2140
+ _chunkUEGKXCSQcjs.__name.call(void 0, run_drain_cycle, "run_drain_cycle");
2040
2141
  var EMPTY_DRAIN = {
2041
2142
  fetched: [],
2042
2143
  leased: [],
@@ -2051,8 +2152,12 @@ function merge_drains(drains) {
2051
2152
  blocked: drains.flatMap((d) => d.blocked)
2052
2153
  };
2053
2154
  }
2155
+ _chunkUEGKXCSQcjs.__name.call(void 0, merge_drains, "merge_drains");
2054
2156
  var RETRY = "";
2055
2157
  var DrainController = (_class3 = class {
2158
+ static {
2159
+ _chunkUEGKXCSQcjs.__name.call(void 0, this, "DrainController");
2160
+ }
2056
2161
  // Armed while `_raised` is ahead of `_lowered` (the raise count the last
2057
2162
  // empty claim saw), so a claim never lowers over a raise that landed
2058
2163
  // during it.
@@ -2095,7 +2200,7 @@ var DrainController = (_class3 = class {
2095
2200
  }
2096
2201
  /** This lane's configured lease, or `undefined`; the shutdown grace basis. */
2097
2202
  get lease_millis() {
2098
- return _optionalChain([this, 'access', _117 => _117._deps, 'access', _118 => _118.defaults, 'optionalAccess', _119 => _119.leaseMillis]);
2203
+ return _optionalChain([this, 'access', _120 => _120._deps, 'access', _121 => _121.defaults, 'optionalAccess', _122 => _122.leaseMillis]);
2099
2204
  }
2100
2205
  get lane() {
2101
2206
  return this._deps.lane;
@@ -2106,12 +2211,12 @@ var DrainController = (_class3 = class {
2106
2211
  */
2107
2212
  start(cycleMs) {
2108
2213
  const run = this._deps.run_scoped;
2109
- const tick = async () => {
2214
+ const tick = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, async () => {
2110
2215
  if (this.armed) await run(() => this.drain());
2111
2216
  if (this._stopped) return;
2112
2217
  this._worker = setTimeout(tick, cycleMs);
2113
2218
  this._worker.unref();
2114
- };
2219
+ }, "tick");
2115
2220
  this._worker = setTimeout(tick, cycleMs);
2116
2221
  this._worker.unref();
2117
2222
  }
@@ -2127,9 +2232,9 @@ var DrainController = (_class3 = class {
2127
2232
  if (!this.armed || this._stopped || this._inflight)
2128
2233
  return EMPTY_DRAIN;
2129
2234
  const d = _nullishCoalesce(this._deps.defaults, () => ( {}));
2130
- const streamLimit = _nullishCoalesce(_nullishCoalesce(d.streamLimit, () => ( options.streamLimit)), () => ( _chunkN74AN6L5cjs.DEFAULT_STREAM_LIMIT));
2131
- const eventLimit = _nullishCoalesce(options.eventLimit, () => ( _chunkN74AN6L5cjs.DEFAULT_EVENT_LIMIT));
2132
- const leaseMillis = _nullishCoalesce(_nullishCoalesce(d.leaseMillis, () => ( options.leaseMillis)), () => ( _chunkN74AN6L5cjs.DEFAULT_LEASE_MILLIS));
2235
+ const streamLimit = _nullishCoalesce(_nullishCoalesce(d.streamLimit, () => ( options.streamLimit)), () => ( _chunkWDIBO6AWcjs.DEFAULT_STREAM_LIMIT));
2236
+ const eventLimit = _nullishCoalesce(options.eventLimit, () => ( _chunkWDIBO6AWcjs.DEFAULT_EVENT_LIMIT));
2237
+ const leaseMillis = _nullishCoalesce(_nullishCoalesce(d.leaseMillis, () => ( options.leaseMillis)), () => ( _chunkWDIBO6AWcjs.DEFAULT_LEASE_MILLIS));
2133
2238
  if (this._deps.breaker.state(Date.now()) === "open")
2134
2239
  return EMPTY_DRAIN;
2135
2240
  const pass = this._pass(streamLimit, eventLimit, leaseMillis).finally(
@@ -2189,6 +2294,9 @@ var DrainController = (_class3 = class {
2189
2294
 
2190
2295
  // src/internal/reaction-dispatch.ts
2191
2296
  var CloseSignal = class extends Error {
2297
+ static {
2298
+ _chunkUEGKXCSQcjs.__name.call(void 0, this, "CloseSignal");
2299
+ }
2192
2300
  /**
2193
2301
  * Stream to close. Omitted → the reaction's own lease stream (a self-close).
2194
2302
  * The synthesized autoclose reaction sets it to the aggregate stream, since
@@ -2221,11 +2329,11 @@ var CloseSignal = class extends Error {
2221
2329
  constructor(opts) {
2222
2330
  super("reaction requested close");
2223
2331
  this.name = "CloseSignal";
2224
- this.stream = _optionalChain([opts, 'optionalAccess', _120 => _120.stream]);
2225
- this.archive = _optionalChain([opts, 'optionalAccess', _121 => _121.archive]);
2226
- this.at = _optionalChain([opts, 'optionalAccess', _122 => _122.at]);
2227
- this.before = _optionalChain([opts, 'optionalAccess', _123 => _123.before]);
2228
- this.defer = _optionalChain([opts, 'optionalAccess', _124 => _124.defer]);
2332
+ this.stream = _optionalChain([opts, 'optionalAccess', _123 => _123.stream]);
2333
+ this.archive = _optionalChain([opts, 'optionalAccess', _124 => _124.archive]);
2334
+ this.at = _optionalChain([opts, 'optionalAccess', _125 => _125.at]);
2335
+ this.before = _optionalChain([opts, 'optionalAccess', _126 => _126.before]);
2336
+ this.defer = _optionalChain([opts, 'optionalAccess', _127 => _127.defer]);
2229
2337
  }
2230
2338
  };
2231
2339
  function build_handle(deps) {
@@ -2255,7 +2363,7 @@ function build_handle(deps) {
2255
2363
  handled++;
2256
2364
  }
2257
2365
  } catch (error) {
2258
- if (error instanceof _chunkZTHGF62Ocjs.DeferSignal) {
2366
+ if (error instanceof _chunkUEGKXCSQcjs.DeferSignal) {
2259
2367
  let defer;
2260
2368
  try {
2261
2369
  defer = resolve_defer_at(error.when, event);
@@ -2279,7 +2387,7 @@ function build_handle(deps) {
2279
2387
  // Advance to the live head the handler evaluated against (when
2280
2388
  // provided) so the close-cycle guard sees this reaction caught up.
2281
2389
  acked_at: _nullishCoalesce(error.at, () => ( event.id)),
2282
- defer: _optionalChain([error, 'access', _125 => _125.defer, 'optionalAccess', _126 => _126.getTime, 'call', _127 => _127()]),
2390
+ defer: _optionalChain([error, 'access', _128 => _128.defer, 'optionalAccess', _129 => _129.getTime, 'call', _130 => _130()]),
2283
2391
  // Close the signalled stream (the autoclose reaction's aggregate,
2284
2392
  // which differs from its synthetic lease stream); a self-closing
2285
2393
  // user reaction omits it and closes its own lease stream. A
@@ -2304,6 +2412,7 @@ function build_handle(deps) {
2304
2412
  return finalize(lease, handled, at, void 0, payloads[0].options, logger);
2305
2413
  };
2306
2414
  }
2415
+ _chunkUEGKXCSQcjs.__name.call(void 0, build_handle, "build_handle");
2307
2416
  function build_handle_batch(logger) {
2308
2417
  return async (lease, payloads, batchHandler) => {
2309
2418
  const stream = lease.stream;
@@ -2332,6 +2441,7 @@ function build_handle_batch(logger) {
2332
2441
  }
2333
2442
  };
2334
2443
  }
2444
+ _chunkUEGKXCSQcjs.__name.call(void 0, build_handle_batch, "build_handle_batch");
2335
2445
 
2336
2446
  // src/internal/autoclose-reaction.ts
2337
2447
  var AUTOCLOSE_TARGET_PREFIX = "__autoclose__:";
@@ -2352,22 +2462,22 @@ function synthesize_autoclose_reactions(registry, states, read_window) {
2352
2462
  // An anchored stream name would read as a pattern, and a store may refuse
2353
2463
  // it at subscribe, stopping every reaction. Such a stream has no
2354
2464
  // autoclose: `app.close` still closes it.
2355
- resolver: (e) => _chunkSC6TY4P2cjs.isStreamName.call(void 0, e.stream) ? {
2465
+ resolver: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (e) => _chunkDCWPJFXRcjs.isStreamName.call(void 0, e.stream) ? {
2356
2466
  target: `${AUTOCLOSE_TARGET_PREFIX}${e.stream}`,
2357
2467
  source: e.stream
2358
- } : void 0,
2468
+ } : void 0, "resolver"),
2359
2469
  // Never block on autoclose: a transient query/store error should retry,
2360
2470
  // not quarantine the synthetic stream.
2361
- options: { blockOnError: false, maxRetries: _chunkN74AN6L5cjs.DEFAULT_MAX_RETRIES },
2362
- handler: async (event) => {
2471
+ options: { blockOnError: false, maxRetries: _chunkWDIBO6AWcjs.DEFAULT_MAX_RETRIES },
2472
+ handler: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, async (event) => {
2363
2473
  const aggregate = event.stream;
2364
2474
  const window = read_window();
2365
2475
  if (!in_autoclose_window(window, /* @__PURE__ */ new Date()))
2366
- throw new (0, _chunkZTHGF62Ocjs.DeferSignal)({ at: next_window_open(window, /* @__PURE__ */ new Date()) });
2367
- const stats = await _chunkN74AN6L5cjs.store.call(void 0, ).query_stats([aggregate], {
2476
+ throw new (0, _chunkUEGKXCSQcjs.DeferSignal)({ at: next_window_open(window, /* @__PURE__ */ new Date()) });
2477
+ const stats = await _chunkWDIBO6AWcjs.store.call(void 0, ).query_stats([aggregate], {
2368
2478
  count: true,
2369
2479
  tail: keep_days !== void 0 ? true : void 0,
2370
- exclude: [_chunkZTHGF62Ocjs.TOMBSTONE_EVENT, _chunkZTHGF62Ocjs.SNAP_EVENT]
2480
+ exclude: [_chunkUEGKXCSQcjs.TOMBSTONE_EVENT, _chunkUEGKXCSQcjs.SNAP_EVENT]
2371
2481
  });
2372
2482
  const entry = stats.get(aggregate);
2373
2483
  if (!entry) return;
@@ -2405,18 +2515,19 @@ function synthesize_autoclose_reactions(registry, states, read_window) {
2405
2515
  dues.push(days_after(entry.tail.created, keep_days));
2406
2516
  const future = dues.map((d) => d.getTime()).filter((t) => t > Date.now());
2407
2517
  if (future.length)
2408
- throw new (0, _chunkZTHGF62Ocjs.DeferSignal)({ at: new Date(Math.min(...future)) });
2409
- }
2518
+ throw new (0, _chunkUEGKXCSQcjs.DeferSignal)({ at: new Date(Math.min(...future)) });
2519
+ }, "handler")
2410
2520
  };
2411
2521
  const key = `__autoclose_${st.name}`;
2412
2522
  for (const event_name of Object.keys(st.events)) {
2413
- _optionalChain([registry, 'access', _128 => _128.events, 'access', _129 => _129[event_name], 'optionalAccess', _130 => _130.reactions, 'access', _131 => _131.set, 'call', _132 => _132(
2523
+ _optionalChain([registry, 'access', _131 => _131.events, 'access', _132 => _132[event_name], 'optionalAccess', _133 => _133.reactions, 'access', _134 => _134.set, 'call', _135 => _135(
2414
2524
  key,
2415
2525
  reaction
2416
2526
  )]);
2417
2527
  }
2418
2528
  }
2419
2529
  }
2530
+ _chunkUEGKXCSQcjs.__name.call(void 0, synthesize_autoclose_reactions, "synthesize_autoclose_reactions");
2420
2531
 
2421
2532
  // src/internal/close-cycle.ts
2422
2533
  var CLOSE_CATCH_UP_LIMIT = 1e3;
@@ -2430,16 +2541,20 @@ async function catch_up_correlation(cursor, correlate, until) {
2430
2541
  }
2431
2542
  return cursor.checkpoint;
2432
2543
  }
2544
+ _chunkUEGKXCSQcjs.__name.call(void 0, catch_up_correlation, "catch_up_correlation");
2433
2545
  var CloseLock = (_class4 = class {constructor() { _class4.prototype.__init9.call(this); }
2546
+ static {
2547
+ _chunkUEGKXCSQcjs.__name.call(void 0, this, "CloseLock");
2548
+ }
2434
2549
  __init9() {this._tails = /* @__PURE__ */ new Map()}
2435
2550
  /** Run `work` after every earlier close of `stream` has settled. */
2436
2551
  run(stream, work) {
2437
2552
  const prev = _nullishCoalesce(this._tails.get(stream), () => ( Promise.resolve()));
2438
2553
  const next = prev.then(work, work);
2439
2554
  this._tails.set(stream, next);
2440
- const cleanup = () => {
2555
+ const cleanup = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, () => {
2441
2556
  if (this._tails.get(stream) === next) this._tails.delete(stream);
2442
- };
2557
+ }, "cleanup");
2443
2558
  next.then(cleanup, cleanup);
2444
2559
  return next;
2445
2560
  }
@@ -2465,11 +2580,12 @@ async function run_close_cycle(targets, deps) {
2465
2580
  deps,
2466
2581
  () => run_full_closes(full, target_map, deps, skipped)
2467
2582
  );
2468
- const retired = [...truncated.entries()].filter(([, r]) => r.committed.name === _chunkZTHGF62Ocjs.TOMBSTONE_EVENT).map(([stream]) => stream);
2469
- if (retired.length) _optionalChain([deps, 'access', _133 => _133.forget_subscribed, 'optionalCall', _134 => _134(retired)]);
2583
+ const retired = [...truncated.entries()].filter(([, r]) => r.committed.name === _chunkUEGKXCSQcjs.TOMBSTONE_EVENT).map(([stream]) => stream);
2584
+ if (retired.length) _optionalChain([deps, 'access', _136 => _136.forget_subscribed, 'optionalCall', _137 => _137(retired)]);
2470
2585
  for (const [stream, entry] of windowed_result) truncated.set(stream, entry);
2471
2586
  return { truncated, skipped };
2472
2587
  }
2588
+ _chunkUEGKXCSQcjs.__name.call(void 0, run_close_cycle, "run_close_cycle");
2473
2589
  function with_stream_locks(streams, deps, work) {
2474
2590
  const with_lock = _nullishCoalesce(deps.with_stream_lock, () => ( ((_stream, w) => w())));
2475
2591
  return [...streams].sort().reduceRight(
@@ -2477,6 +2593,7 @@ function with_stream_locks(streams, deps, work) {
2477
2593
  work
2478
2594
  )();
2479
2595
  }
2596
+ _chunkUEGKXCSQcjs.__name.call(void 0, with_stream_locks, "with_stream_locks");
2480
2597
  async function run_full_closes(full, target_map, deps, skipped) {
2481
2598
  const none = /* @__PURE__ */ new Map();
2482
2599
  const streams = full.map((t) => t.stream);
@@ -2486,7 +2603,7 @@ async function run_full_closes(full, target_map, deps, skipped) {
2486
2603
  const info = stream_info.get(target.stream);
2487
2604
  if (!info) continue;
2488
2605
  const owner = deps.event_to_state.get(info.last_event_name);
2489
- if (_optionalChain([owner, 'optionalAccess', _135 => _135.pii_aware])) {
2606
+ if (_optionalChain([owner, 'optionalAccess', _138 => _138.pii_aware])) {
2490
2607
  deps.logger.error(
2491
2608
  `Refusing to close "${target.stream}" with restart: state "${owner.name}" carries sensitive fields, so a restart seed would persist redacted values while deleting the originals. Close it without restart to retire the stream, or leave it open.`
2492
2609
  );
@@ -2532,6 +2649,7 @@ async function run_full_closes(full, target_map, deps, skipped) {
2532
2649
  deps.correlation
2533
2650
  );
2534
2651
  }
2652
+ _chunkUEGKXCSQcjs.__name.call(void 0, run_full_closes, "run_full_closes");
2535
2653
  async function run_windowed_closes(windowed, deps, skipped) {
2536
2654
  const checkpoint = deps.reactive ? await deps.catch_up_correlation(Number.MAX_SAFE_INTEGER) : -1;
2537
2655
  const min_at = deps.reactive ? await probe_min_watermarks(
@@ -2547,7 +2665,7 @@ async function run_windowed_closes(windowed, deps, skipped) {
2547
2665
  if (!await windowed_prune_pending(t.stream, t.before, max_id))
2548
2666
  return void 0;
2549
2667
  if (t.archive) await t.archive();
2550
- const result = await _chunkN74AN6L5cjs.store.call(void 0, ).truncate([
2668
+ const result = await _chunkWDIBO6AWcjs.store.call(void 0, ).truncate([
2551
2669
  { stream: t.stream, before: t.before, max_id }
2552
2670
  ]);
2553
2671
  return result.get(t.stream);
@@ -2557,24 +2675,26 @@ async function run_windowed_closes(windowed, deps, skipped) {
2557
2675
  }
2558
2676
  return truncated;
2559
2677
  }
2678
+ _chunkUEGKXCSQcjs.__name.call(void 0, run_windowed_closes, "run_windowed_closes");
2560
2679
  async function windowed_prune_pending(stream, before, max_id) {
2561
2680
  let boundary_id;
2562
2681
  let min_id;
2563
- await _chunkN74AN6L5cjs.store.call(void 0, ).query(
2682
+ await _chunkWDIBO6AWcjs.store.call(void 0, ).query(
2564
2683
  (event) => {
2565
2684
  if (min_id === void 0 || event.id < min_id) min_id = event.id;
2566
- if (event.name === _chunkZTHGF62Ocjs.SNAP_EVENT && event.created < before && (max_id === void 0 || event.id <= max_id) && (boundary_id === void 0 || event.id > boundary_id))
2685
+ if (event.name === _chunkUEGKXCSQcjs.SNAP_EVENT && event.created < before && (max_id === void 0 || event.id <= max_id) && (boundary_id === void 0 || event.id > boundary_id))
2567
2686
  boundary_id = event.id;
2568
2687
  },
2569
2688
  { stream, stream_exact: true, with_snaps: true, after: -1 }
2570
2689
  );
2571
2690
  return boundary_id !== void 0 && min_id < boundary_id;
2572
2691
  }
2692
+ _chunkUEGKXCSQcjs.__name.call(void 0, windowed_prune_pending, "windowed_prune_pending");
2573
2693
  async function probe_min_watermarks(streams, page_size, checkpoint) {
2574
2694
  const min_at = /* @__PURE__ */ new Map();
2575
2695
  const matches = source_matcher();
2576
2696
  await walk_streams(
2577
- _chunkN74AN6L5cjs.store.call(void 0, ),
2697
+ _chunkWDIBO6AWcjs.store.call(void 0, ),
2578
2698
  (position) => {
2579
2699
  const pending = position.correlated_at === void 0 || position.at < position.correlated_at;
2580
2700
  const cap = pending ? position.at : Math.max(position.at, checkpoint);
@@ -2589,11 +2709,12 @@ async function probe_min_watermarks(streams, page_size, checkpoint) {
2589
2709
  );
2590
2710
  return min_at;
2591
2711
  }
2712
+ _chunkUEGKXCSQcjs.__name.call(void 0, probe_min_watermarks, "probe_min_watermarks");
2592
2713
  function source_matcher() {
2593
2714
  const compiled = /* @__PURE__ */ new Map();
2594
2715
  return (source, target, stream) => {
2595
2716
  if (!source) return true;
2596
- if (_chunkSC6TY4P2cjs.isStreamName.call(void 0, source, target)) return source === stream;
2717
+ if (_chunkDCWPJFXRcjs.isStreamName.call(void 0, source, target)) return source === stream;
2597
2718
  let re = compiled.get(source);
2598
2719
  if (!re) {
2599
2720
  re = new RegExp(source);
@@ -2602,18 +2723,19 @@ function source_matcher() {
2602
2723
  return re.test(stream);
2603
2724
  };
2604
2725
  }
2726
+ _chunkUEGKXCSQcjs.__name.call(void 0, source_matcher, "source_matcher");
2605
2727
  async function scan_stream_heads(streams) {
2606
- const stats = await _chunkN74AN6L5cjs.store.call(void 0, ).query_stats(streams, {
2607
- exclude: [_chunkZTHGF62Ocjs.SNAP_EVENT]
2728
+ const stats = await _chunkWDIBO6AWcjs.store.call(void 0, ).query_stats(streams, {
2729
+ exclude: [_chunkUEGKXCSQcjs.SNAP_EVENT]
2608
2730
  });
2609
- const domain_heads = await _chunkN74AN6L5cjs.store.call(void 0, ).query_stats(streams, {
2610
- exclude: [_chunkZTHGF62Ocjs.SNAP_EVENT, _chunkZTHGF62Ocjs.TOMBSTONE_EVENT]
2731
+ const domain_heads = await _chunkWDIBO6AWcjs.store.call(void 0, ).query_stats(streams, {
2732
+ exclude: [_chunkUEGKXCSQcjs.SNAP_EVENT, _chunkUEGKXCSQcjs.TOMBSTONE_EVENT]
2611
2733
  });
2612
- const true_heads = await _chunkN74AN6L5cjs.store.call(void 0, ).query_stats(streams, {});
2734
+ const true_heads = await _chunkWDIBO6AWcjs.store.call(void 0, ).query_stats(streams, {});
2613
2735
  const out = /* @__PURE__ */ new Map();
2614
2736
  for (const [stream, { head }] of domain_heads) {
2615
- const marker_head = _optionalChain([stats, 'access', _136 => _136.get, 'call', _137 => _137(stream), 'optionalAccess', _138 => _138.head]);
2616
- const interrupted = _optionalChain([marker_head, 'optionalAccess', _139 => _139.name]) === _chunkZTHGF62Ocjs.TOMBSTONE_EVENT;
2737
+ const marker_head = _optionalChain([stats, 'access', _139 => _139.get, 'call', _140 => _140(stream), 'optionalAccess', _141 => _141.head]);
2738
+ const interrupted = _optionalChain([marker_head, 'optionalAccess', _142 => _142.name]) === _chunkUEGKXCSQcjs.TOMBSTONE_EVENT;
2617
2739
  out.set(stream, {
2618
2740
  max_id: head.id,
2619
2741
  version: true_heads.get(stream).head.version,
@@ -2623,6 +2745,7 @@ async function scan_stream_heads(streams) {
2623
2745
  }
2624
2746
  return out;
2625
2747
  }
2748
+ _chunkUEGKXCSQcjs.__name.call(void 0, scan_stream_heads, "scan_stream_heads");
2626
2749
  async function partition_by_safety(stream_info, reactive, skipped, page_size, catch_up_correlation2) {
2627
2750
  if (!reactive) return [...stream_info.keys()];
2628
2751
  let needed = -1;
@@ -2636,7 +2759,7 @@ async function partition_by_safety(stream_info, reactive, skipped, page_size, ca
2636
2759
  const pending_set = /* @__PURE__ */ new Set();
2637
2760
  const matches = source_matcher();
2638
2761
  await walk_streams(
2639
- _chunkN74AN6L5cjs.store.call(void 0, ),
2762
+ _chunkWDIBO6AWcjs.store.call(void 0, ),
2640
2763
  (position) => {
2641
2764
  const has_work = position.correlated_at !== void 0 && position.at < position.correlated_at;
2642
2765
  if (!has_work) return;
@@ -2656,6 +2779,7 @@ async function partition_by_safety(stream_info, reactive, skipped, page_size, ca
2656
2779
  }
2657
2780
  return safe;
2658
2781
  }
2782
+ _chunkUEGKXCSQcjs.__name.call(void 0, partition_by_safety, "partition_by_safety");
2659
2783
  async function guard_with_tombstones(safe, stream_info, correlation, tombstone2, skipped) {
2660
2784
  const guarded = [];
2661
2785
  const guard_events = /* @__PURE__ */ new Map();
@@ -2678,10 +2802,11 @@ async function guard_with_tombstones(safe, stream_info, correlation, tombstone2,
2678
2802
  );
2679
2803
  return { guarded, guard_events };
2680
2804
  }
2805
+ _chunkUEGKXCSQcjs.__name.call(void 0, guard_with_tombstones, "guard_with_tombstones");
2681
2806
  async function load_restart_seeds(guarded, target_map, stream_info, event_to_state, load2, logger) {
2682
2807
  const seed_states = /* @__PURE__ */ new Map();
2683
2808
  await Promise.all(
2684
- guarded.filter((s) => _optionalChain([target_map, 'access', _140 => _140.get, 'call', _141 => _141(s), 'optionalAccess', _142 => _142.restart])).map(async (stream) => {
2809
+ guarded.filter((s) => _optionalChain([target_map, 'access', _143 => _143.get, 'call', _144 => _144(s), 'optionalAccess', _145 => _145.restart])).map(async (stream) => {
2685
2810
  const last_event_name = stream_info.get(stream).last_event_name;
2686
2811
  const owner_state = event_to_state.get(last_event_name);
2687
2812
  if (!owner_state) {
@@ -2696,21 +2821,24 @@ async function load_restart_seeds(guarded, target_map, stream_info, event_to_sta
2696
2821
  );
2697
2822
  return seed_states;
2698
2823
  }
2824
+ _chunkUEGKXCSQcjs.__name.call(void 0, load_restart_seeds, "load_restart_seeds");
2699
2825
  async function run_archive_callbacks(guarded, target_map) {
2700
2826
  for (const stream of guarded) {
2701
- const archive_fn = _optionalChain([target_map, 'access', _143 => _143.get, 'call', _144 => _144(stream), 'optionalAccess', _145 => _145.archive]);
2827
+ const archive_fn = _optionalChain([target_map, 'access', _146 => _146.get, 'call', _147 => _147(stream), 'optionalAccess', _148 => _148.archive]);
2702
2828
  if (archive_fn) await archive_fn();
2703
2829
  }
2704
2830
  }
2831
+ _chunkUEGKXCSQcjs.__name.call(void 0, run_archive_callbacks, "run_archive_callbacks");
2705
2832
  async function heads_still_guarded(guarded, guard_events, skipped) {
2706
- const heads = await _chunkN74AN6L5cjs.store.call(void 0, ).query_stats(guarded, {});
2833
+ const heads = await _chunkWDIBO6AWcjs.store.call(void 0, ).query_stats(guarded, {});
2707
2834
  return guarded.filter((stream) => {
2708
- if (_optionalChain([heads, 'access', _146 => _146.get, 'call', _147 => _147(stream), 'optionalAccess', _148 => _148.head, 'access', _149 => _149.id]) === guard_events.get(stream).id)
2835
+ if (_optionalChain([heads, 'access', _149 => _149.get, 'call', _150 => _150(stream), 'optionalAccess', _151 => _151.head, 'access', _152 => _152.id]) === guard_events.get(stream).id)
2709
2836
  return true;
2710
2837
  skipped.push(stream);
2711
2838
  return false;
2712
2839
  });
2713
2840
  }
2841
+ _chunkUEGKXCSQcjs.__name.call(void 0, heads_still_guarded, "heads_still_guarded");
2714
2842
  async function truncate_and_warm_cache(guarded, seed_states, guard_events, correlation) {
2715
2843
  const trunc_targets = guarded.map((stream) => {
2716
2844
  const snapshot = seed_states.get(stream);
@@ -2721,18 +2849,18 @@ async function truncate_and_warm_cache(guarded, seed_states, guard_events, corre
2721
2849
  meta: {
2722
2850
  correlation,
2723
2851
  causation: {
2724
- event: { id: guard.id, name: _chunkZTHGF62Ocjs.TOMBSTONE_EVENT, stream: guard.stream }
2852
+ event: { id: guard.id, name: _chunkUEGKXCSQcjs.TOMBSTONE_EVENT, stream: guard.stream }
2725
2853
  }
2726
2854
  }
2727
2855
  };
2728
2856
  });
2729
- const truncated = await _chunkN74AN6L5cjs.store.call(void 0, ).truncate(trunc_targets);
2857
+ const truncated = await _chunkWDIBO6AWcjs.store.call(void 0, ).truncate(trunc_targets);
2730
2858
  await Promise.all(
2731
2859
  guarded.map(async (stream) => {
2732
2860
  const entry = truncated.get(stream);
2733
2861
  const state2 = seed_states.get(stream);
2734
2862
  if (state2 && entry) {
2735
- await _chunkN74AN6L5cjs.cache.call(void 0, ).set(stream, {
2863
+ await _chunkWDIBO6AWcjs.cache.call(void 0, ).set(stream, {
2736
2864
  stream,
2737
2865
  state: state2,
2738
2866
  version: entry.committed.version,
@@ -2741,21 +2869,22 @@ async function truncate_and_warm_cache(guarded, seed_states, guard_events, corre
2741
2869
  snaps: 1
2742
2870
  });
2743
2871
  } else {
2744
- await _chunkN74AN6L5cjs.cache.call(void 0, ).invalidate(stream);
2872
+ await _chunkWDIBO6AWcjs.cache.call(void 0, ).invalidate(stream);
2745
2873
  }
2746
2874
  })
2747
2875
  );
2748
2876
  return truncated;
2749
2877
  }
2878
+ _chunkUEGKXCSQcjs.__name.call(void 0, truncate_and_warm_cache, "truncate_and_warm_cache");
2750
2879
 
2751
2880
  // src/internal/correlate-cycle.ts
2752
2881
 
2753
2882
  var COLD_START_BACK_SCAN = 1e4;
2754
2883
  var CORRELATION_LEASE_MS = 5e3;
2755
- var registry_key = (events) => {
2884
+ var registry_key = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (events) => {
2756
2885
  const shape = Object.keys(events).filter((name) => events[name].reactions.size > 0).sort().map((name) => [name, [...events[name].reactions.keys()].sort()]);
2757
2886
  return _crypto.createHash.call(void 0, "sha256").update(JSON.stringify(shape)).digest("hex").slice(0, 32);
2758
- };
2887
+ }, "registry_key");
2759
2888
  var PATTERN_CACHE_SIZE = 32;
2760
2889
  function report_undeclared_lane(seen, handler, target, lane, declared) {
2761
2890
  report_once(
@@ -2764,6 +2893,7 @@ function report_undeclared_lane(seen, handler, target, lane, declared) {
2764
2893
  `Reaction "${handler}" resolved onto undeclared lane "${lane}" \u2014 for example target "${target}". Declared lanes: ${[...declared].map((l) => `"${l}"`).join(", ")}. No controller claims it, so the stream would never drain \u2014 running it on "default" instead. The equivalent static \`.to({ lane })\` is rejected at build; a dynamic resolver's lane is only knowable here.`
2765
2894
  );
2766
2895
  }
2896
+ _chunkUEGKXCSQcjs.__name.call(void 0, report_undeclared_lane, "report_undeclared_lane");
2767
2897
  function report_bad_priority(seen, handler, target, priority) {
2768
2898
  report_once(
2769
2899
  seen,
@@ -2771,6 +2901,7 @@ function report_bad_priority(seen, handler, target, priority) {
2771
2901
  `Reaction "${handler}" resolved priority ${String(priority)} for target "${target}", which isn't a 32-bit integer. Running it at priority 0 instead. The equivalent static \`.to({ priority })\` is rejected at build; a dynamic resolver's priority is only knowable here.`
2772
2902
  );
2773
2903
  }
2904
+ _chunkUEGKXCSQcjs.__name.call(void 0, report_bad_priority, "report_bad_priority");
2774
2905
  function report_lane_conflict(seen, handler, target, kept, dropped) {
2775
2906
  report_once(
2776
2907
  seen,
@@ -2778,7 +2909,11 @@ function report_lane_conflict(seen, handler, target, kept, dropped) {
2778
2909
  `Reaction "${handler}" resolved lane "${dropped}" for a stream already on "${kept}" \u2014 for example "${target}". These are conflicting lane assignments from two dynamic resolutions at equal priority. Keeping "${kept}", the lane it was first discovered on \u2014 re-laning a live stream would move it out from under a worker holding its lease. The reaction resolving "${dropped}" runs inside the "${kept}" lane's budget, and a process restricted to "${dropped}" via onlyLanes never runs it. The equivalent static declaration is rejected at build; align the resolvers, or split the target.`
2779
2910
  );
2780
2911
  }
2912
+ _chunkUEGKXCSQcjs.__name.call(void 0, report_lane_conflict, "report_lane_conflict");
2781
2913
  var CorrelateCycle = (_class5 = class {
2914
+ static {
2915
+ _chunkUEGKXCSQcjs.__name.call(void 0, this, "CorrelateCycle");
2916
+ }
2782
2917
  __init10() {this._checkpoint = -1}
2783
2918
  // Lease holder id; per instance, so a restart never inherits a stale claim.
2784
2919
  __init11() {this._by = _crypto.randomUUID.call(void 0, )}
@@ -2800,7 +2935,7 @@ var CorrelateCycle = (_class5 = class {
2800
2935
  // never lets a resolution re-lane them.
2801
2936
 
2802
2937
  __init18() {this._static_subscriptions = /* @__PURE__ */ new Map()}
2803
- __init19() {this._patterns = new (0, _chunkN74AN6L5cjs.LruMap)(PATTERN_CACHE_SIZE)}
2938
+ __init19() {this._patterns = new (0, _chunkWDIBO6AWcjs.LruMap)(PATTERN_CACHE_SIZE)}
2804
2939
 
2805
2940
 
2806
2941
 
@@ -2818,7 +2953,7 @@ var CorrelateCycle = (_class5 = class {
2818
2953
  on_init
2819
2954
  }) {;_class5.prototype.__init10.call(this);_class5.prototype.__init11.call(this);_class5.prototype.__init12.call(this);_class5.prototype.__init13.call(this);_class5.prototype.__init14.call(this);_class5.prototype.__init15.call(this);_class5.prototype.__init16.call(this);_class5.prototype.__init17.call(this);_class5.prototype.__init18.call(this);_class5.prototype.__init19.call(this);_class5.prototype.__init20.call(this);
2820
2955
  this._key = shard ? `${registry_key(registry.events)}:${[...shard].sort().join(",")}` : registry_key(registry.events);
2821
- this._dynamic_subscriptions = new (0, _chunkN74AN6L5cjs.LruMap)(max_subscribed_streams);
2956
+ this._dynamic_subscriptions = new (0, _chunkWDIBO6AWcjs.LruMap)(max_subscribed_streams);
2822
2957
  this._registry = registry;
2823
2958
  this._declared_lanes = declared_lanes;
2824
2959
  this._static_targets = static_targets;
@@ -2850,7 +2985,7 @@ var CorrelateCycle = (_class5 = class {
2850
2985
  lane
2851
2986
  });
2852
2987
  }
2853
- await _optionalChain([this, 'access', _150 => _150._on_init, 'optionalCall', _151 => _151()]);
2988
+ await _optionalChain([this, 'access', _153 => _153._on_init, 'optionalCall', _154 => _154()]);
2854
2989
  }
2855
2990
  /**
2856
2991
  * Replace the log with no pass in flight, then cold-start: a pass that
@@ -2876,7 +3011,7 @@ var CorrelateCycle = (_class5 = class {
2876
3011
  // Would the target's own `fetch` (filtered by `source`) return this event?
2877
3012
  _in_fetch_window(source, stream) {
2878
3013
  if (source === void 0 || source === stream) return true;
2879
- if (_chunkSC6TY4P2cjs.isStreamName.call(void 0, source)) return false;
3014
+ if (_chunkDCWPJFXRcjs.isStreamName.call(void 0, source)) return false;
2880
3015
  let pattern = this._patterns.get(source);
2881
3016
  if (!pattern) {
2882
3017
  pattern = new RegExp(source);
@@ -2898,10 +3033,10 @@ var CorrelateCycle = (_class5 = class {
2898
3033
  async _scan(limit, lease) {
2899
3034
  await this._init();
2900
3035
  const epoch = this._epoch;
2901
- const idle = () => ({
3036
+ const idle = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, () => ({
2902
3037
  kind: "idle",
2903
3038
  last_id: this._checkpoint
2904
- });
3039
+ }), "idle");
2905
3040
  if (this._raised === this._lowered) return idle();
2906
3041
  const raised = this._raised;
2907
3042
  const now = Date.now();
@@ -2919,7 +3054,7 @@ var CorrelateCycle = (_class5 = class {
2919
3054
  const correlated = /* @__PURE__ */ new Map();
2920
3055
  let last_id = after;
2921
3056
  let stopped = false;
2922
- const found = await _chunkN74AN6L5cjs.store.call(void 0, ).query(
3057
+ const found = await _chunkWDIBO6AWcjs.store.call(void 0, ).query(
2923
3058
  (event) => {
2924
3059
  if (stopped) return;
2925
3060
  const register = this._registry.events[event.name];
@@ -2939,7 +3074,7 @@ var CorrelateCycle = (_class5 = class {
2939
3074
  }
2940
3075
  if (!resolved) continue;
2941
3076
  try {
2942
- _chunkN74AN6L5cjs.check.call(void 0, "target", resolved);
3077
+ _chunkWDIBO6AWcjs.check.call(void 0, "target", resolved);
2943
3078
  } catch (e2) {
2944
3079
  report_bad_priority(
2945
3080
  this._reported,
@@ -2975,9 +3110,9 @@ var CorrelateCycle = (_class5 = class {
2975
3110
  correlated_at: void 0
2976
3111
  };
2977
3112
  const seen_in_scan = correlated.has(resolved.target);
2978
- const held_lane = _nullishCoalesce((seen_in_scan ? entry.lane : _optionalChain([recorded, 'optionalAccess', _152 => _152.lane])), () => ( _chunkZTHGF62Ocjs.DEFAULT_LANE));
2979
- const held_priority = seen_in_scan ? entry.priority : _optionalChain([recorded, 'optionalAccess', _153 => _153.priority]);
2980
- const resolved_lane = _nullishCoalesce(lane, () => ( _chunkZTHGF62Ocjs.DEFAULT_LANE));
3113
+ const held_lane = _nullishCoalesce((seen_in_scan ? entry.lane : _optionalChain([recorded, 'optionalAccess', _155 => _155.lane])), () => ( _chunkUEGKXCSQcjs.DEFAULT_LANE));
3114
+ const held_priority = seen_in_scan ? entry.priority : _optionalChain([recorded, 'optionalAccess', _156 => _156.priority]);
3115
+ const resolved_lane = _nullishCoalesce(lane, () => ( _chunkUEGKXCSQcjs.DEFAULT_LANE));
2981
3116
  if (held_priority === priority && held_lane !== resolved_lane)
2982
3117
  report_lane_conflict(
2983
3118
  this._reported,
@@ -3031,7 +3166,7 @@ var CorrelateCycle = (_class5 = class {
3031
3166
  ).length;
3032
3167
  this._checkpoint = last_id;
3033
3168
  for (const { stream, priority, lane } of streams) {
3034
- if (_optionalChain([correlated, 'access', _154 => _154.get, 'call', _155 => _155(stream), 'optionalAccess', _156 => _156.upgraded]))
3169
+ if (_optionalChain([correlated, 'access', _157 => _157.get, 'call', _158 => _158(stream), 'optionalAccess', _159 => _159.upgraded]))
3035
3170
  this._dynamic_subscriptions.set(stream, {
3036
3171
  priority,
3037
3172
  lane
@@ -3051,7 +3186,7 @@ var CorrelateCycle = (_class5 = class {
3051
3186
  await Promise.all(
3052
3187
  missed.map(async ([stream, entry]) => {
3053
3188
  let row;
3054
- await _chunkN74AN6L5cjs.store.call(void 0, ).query_streams(
3189
+ await _chunkWDIBO6AWcjs.store.call(void 0, ).query_streams(
3055
3190
  (position) => {
3056
3191
  row = position;
3057
3192
  },
@@ -3063,8 +3198,8 @@ var CorrelateCycle = (_class5 = class {
3063
3198
  lane: row.lane
3064
3199
  });
3065
3200
  if (entry.priority > row.priority) return;
3066
- const held_lane = _nullishCoalesce(row.lane, () => ( _chunkZTHGF62Ocjs.DEFAULT_LANE));
3067
- const resolved_lane = _nullishCoalesce(entry.lane, () => ( _chunkZTHGF62Ocjs.DEFAULT_LANE));
3201
+ const held_lane = _nullishCoalesce(row.lane, () => ( _chunkUEGKXCSQcjs.DEFAULT_LANE));
3202
+ const resolved_lane = _nullishCoalesce(entry.lane, () => ( _chunkUEGKXCSQcjs.DEFAULT_LANE));
3068
3203
  if (entry.priority === row.priority && held_lane !== resolved_lane)
3069
3204
  report_lane_conflict(
3070
3205
  this._reported,
@@ -3090,7 +3225,7 @@ var CorrelateCycle = (_class5 = class {
3090
3225
  millis: 0
3091
3226
  });
3092
3227
  } catch (error) {
3093
- _chunkN74AN6L5cjs.log.call(void 0, ).warn(
3228
+ _chunkWDIBO6AWcjs.log.call(void 0, ).warn(
3094
3229
  `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(_nullishCoalesce(error.cause, () => ( error)))}`
3095
3230
  );
3096
3231
  }
@@ -3109,12 +3244,13 @@ function pii_split(emitted, fields) {
3109
3244
  }
3110
3245
  return { name: emitted.name, data, pii };
3111
3246
  }
3247
+ _chunkUEGKXCSQcjs.__name.call(void 0, pii_split, "pii_split");
3112
3248
  function pii_gate(event, fields, predicate, actor) {
3113
3249
  const data = event.data;
3114
3250
  const { pii, ...rest } = event;
3115
3251
  if (pii == null) {
3116
3252
  const shredded = { ...data };
3117
- for (const f of fields) shredded[f] = _chunkZTHGF62Ocjs.SHREDDED;
3253
+ for (const f of fields) shredded[f] = _chunkUEGKXCSQcjs.SHREDDED;
3118
3254
  return { ...rest, data: shredded };
3119
3255
  }
3120
3256
  const allowed = !!actor && !!predicate && predicate(event, actor);
@@ -3125,13 +3261,15 @@ function pii_gate(event, fields, predicate, actor) {
3125
3261
  };
3126
3262
  }
3127
3263
  const redacted = { ...data };
3128
- for (const f of fields) redacted[f] = _chunkZTHGF62Ocjs.REDACTED;
3264
+ for (const f of fields) redacted[f] = _chunkUEGKXCSQcjs.REDACTED;
3129
3265
  return { ...rest, data: redacted };
3130
3266
  }
3131
- var IDENTITY_GATE = (event) => event;
3267
+ _chunkUEGKXCSQcjs.__name.call(void 0, pii_gate, "pii_gate");
3268
+ var IDENTITY_GATE = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (event) => event, "IDENTITY_GATE");
3132
3269
  function make_gate(fields, predicate) {
3133
3270
  return (event, actor) => pii_gate(event, fields, predicate, actor);
3134
3271
  }
3272
+ _chunkUEGKXCSQcjs.__name.call(void 0, make_gate, "make_gate");
3135
3273
  function pii_strip(event, fields) {
3136
3274
  const data = event.data;
3137
3275
  const stripped = {};
@@ -3144,21 +3282,22 @@ function pii_strip(event, fields) {
3144
3282
  data: stripped
3145
3283
  };
3146
3284
  }
3285
+ _chunkUEGKXCSQcjs.__name.call(void 0, pii_strip, "pii_strip");
3147
3286
 
3148
3287
  // src/internal/projection-fold.ts
3149
3288
  var FOLD_RESET = /* @__PURE__ */ Symbol("act.fold.reset");
3150
3289
  function make_fold_handler(me, flush, config2, sensitive_fields) {
3151
3290
  const load_me = {
3152
3291
  ...me,
3153
- view: (raw, actor) => {
3292
+ view: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (raw, actor) => {
3154
3293
  const viewed = me.view(raw, actor);
3155
3294
  const fields = sensitive_fields(viewed.name);
3156
3295
  return fields.length ? pii_strip(viewed, fields) : viewed;
3157
- }
3296
+ }, "view")
3158
3297
  };
3159
3298
  const cache2 = /* @__PURE__ */ new Map();
3160
- const row = ({ dirty: _, ...row2 }) => row2;
3161
- const flush_dirty = async () => {
3299
+ const row = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, ({ dirty: _, ...row2 }) => row2, "row");
3300
+ const flush_dirty = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, async () => {
3162
3301
  const rows = [];
3163
3302
  const flushed = [];
3164
3303
  for (const f of cache2.values())
@@ -3169,8 +3308,8 @@ function make_fold_handler(me, flush, config2, sensitive_fields) {
3169
3308
  if (rows.length === 0) return;
3170
3309
  await flush(rows);
3171
3310
  for (const f of flushed) f.dirty = false;
3172
- };
3173
- const first_sight = async (stream) => {
3311
+ }, "flush_dirty");
3312
+ const first_sight = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, async (stream) => {
3174
3313
  if (cache2.size >= config2.maxCachedStates) {
3175
3314
  const oldest = cache2.keys().next().value;
3176
3315
  const evictee = cache2.get(oldest);
@@ -3189,8 +3328,8 @@ function make_fold_handler(me, flush, config2, sensitive_fields) {
3189
3328
  };
3190
3329
  cache2.set(stream, seated);
3191
3330
  return seated;
3192
- };
3193
- const handler = async (events) => {
3331
+ }, "first_sight");
3332
+ const handler = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, async (events) => {
3194
3333
  let folded_since_flush = 0;
3195
3334
  for (const event of events) {
3196
3335
  const stream = event.stream;
@@ -3227,13 +3366,17 @@ function make_fold_handler(me, flush, config2, sensitive_fields) {
3227
3366
  }
3228
3367
  }
3229
3368
  await flush_dirty();
3230
- };
3231
- Object.defineProperty(handler, FOLD_RESET, { value: () => cache2.clear() });
3369
+ }, "handler");
3370
+ Object.defineProperty(handler, FOLD_RESET, { value: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, () => cache2.clear(), "value") });
3232
3371
  return handler;
3233
3372
  }
3373
+ _chunkUEGKXCSQcjs.__name.call(void 0, make_fold_handler, "make_fold_handler");
3234
3374
 
3235
3375
  // src/internal/settle.ts
3236
3376
  var SettleLoop = (_class6 = class {
3377
+ static {
3378
+ _chunkUEGKXCSQcjs.__name.call(void 0, this, "SettleLoop");
3379
+ }
3237
3380
  __init21() {this._timer = void 0}
3238
3381
  // The cycle in flight, set while one runs. Shutdown waits for it
3239
3382
  // (`stop()` cancels scheduling only). Never rejects.
@@ -3270,7 +3413,7 @@ var SettleLoop = (_class6 = class {
3270
3413
  this._pending = true;
3271
3414
  return;
3272
3415
  }
3273
- const delay = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _157 => _157.debounceMs]), () => ( this._default_debounce_ms));
3416
+ const delay = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _160 => _160.debounceMs]), () => ( this._default_debounce_ms));
3274
3417
  const due = Date.now() + delay;
3275
3418
  if (this._timer) {
3276
3419
  if (due >= this._due) return;
@@ -3334,6 +3477,9 @@ var SettleLoop = (_class6 = class {
3334
3477
 
3335
3478
  // src/act.ts
3336
3479
  var Act = (_class7 = class {
3480
+ static {
3481
+ _chunkUEGKXCSQcjs.__name.call(void 0, this, "Act");
3482
+ }
3337
3483
  __init26() {this._emitter = new (0, _events2.default)()}
3338
3484
 
3339
3485
 
@@ -3420,7 +3566,7 @@ var Act = (_class7 = class {
3420
3566
  // Lanes to arm per event; `"all"` when a dynamic resolver hides the lane.
3421
3567
 
3422
3568
 
3423
- __init27() {this._logger = _chunkN74AN6L5cjs.log.call(void 0, )}
3569
+ __init27() {this._logger = _chunkWDIBO6AWcjs.log.call(void 0, )}
3424
3570
  // This Act's ports: its own bag, or the singleton adapters.
3425
3571
 
3426
3572
  // Runs a body so internal `store()`/`cache()` calls resolve to `_ports`.
@@ -3449,10 +3595,11 @@ var Act = (_class7 = class {
3449
3595
  throw new Error(
3450
3596
  `ActOptions.onlyLanes references undeclared lane(s): ${undeclared.map((l) => `"${l}"`).join(", ")}`
3451
3597
  );
3452
- if (options.scoped) _chunkN74AN6L5cjs.check.call(void 0, "store", options.scoped.store);
3453
- this._ports = _nullishCoalesce(options.scoped, () => ( _chunkN74AN6L5cjs.unscoped_ports.call(void 0, )));
3598
+ _chunkWDIBO6AWcjs.check.call(void 0, "act", options);
3599
+ if (options.scoped) _chunkWDIBO6AWcjs.check.call(void 0, "store", options.scoped.store);
3600
+ this._ports = _nullishCoalesce(options.scoped, () => ( _chunkWDIBO6AWcjs.unscoped_ports.call(void 0, )));
3454
3601
  const ports = this._ports;
3455
- this._scoped = _chunkN74AN6L5cjs.make_run_scoped.call(void 0, {
3602
+ this._scoped = _chunkWDIBO6AWcjs.make_run_scoped.call(void 0, {
3456
3603
  // Getters, not a spread: the singletons resolve lazily, so a later
3457
3604
  // `store(...)` / `cache(...)` still takes effect.
3458
3605
  get store() {
@@ -3462,14 +3609,14 @@ var Act = (_class7 = class {
3462
3609
  return ports.cache;
3463
3610
  },
3464
3611
  // Parsed per build, so a bad window throws on every build.
3465
- autoclose_window: _chunkN74AN6L5cjs.check.call(void 0, "autoclose", options).autocloseWindow
3612
+ autoclose_window: _chunkWDIBO6AWcjs.check.call(void 0, "autoclose", options).autocloseWindow
3466
3613
  });
3467
3614
  this._correlator = _nullishCoalesce(options.correlator, () => ( default_correlator));
3468
3615
  this._es = build_es(this._logger, this._correlator, patch_fn);
3469
3616
  this._cd = build_drain(this._logger);
3470
3617
  const handle = build_handle({
3471
3618
  logger: this._logger,
3472
- reaction_scope: _chunkN74AN6L5cjs.make_reaction_scope.call(void 0, {
3619
+ reaction_scope: _chunkWDIBO6AWcjs.make_reaction_scope.call(void 0, {
3473
3620
  do: this.do.bind(this),
3474
3621
  load: this.load.bind(this),
3475
3622
  query: this.query.bind(this),
@@ -3499,24 +3646,24 @@ var Act = (_class7 = class {
3499
3646
  this._ports.store,
3500
3647
  options.listen !== false
3501
3648
  );
3502
- _chunkN74AN6L5cjs.register_weak_disposer.call(void 0, new WeakRef(this), (self) => self.shutdown());
3649
+ _chunkWDIBO6AWcjs.register_weak_disposer.call(void 0, new WeakRef(this), (self) => self.shutdown());
3503
3650
  }
3504
3651
  // Shared by drain, settle and autoclose; bad knobs throw at build.
3505
3652
  _build_breaker(options) {
3506
3653
  return new CircuitBreaker(
3507
- _chunkN74AN6L5cjs.check.call(void 0, "circuit_breaker", _nullishCoalesce(options.circuitBreaker, () => ( {}))),
3654
+ _chunkWDIBO6AWcjs.check.call(void 0, "circuit_breaker", _nullishCoalesce(options.circuitBreaker, () => ( {}))),
3508
3655
  {
3509
- on_error: (error, circuit) => this._emit_error(error, circuit),
3656
+ on_error: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (error, circuit) => this._emit_error(error, circuit), "on_error"),
3510
3657
  // When the cooldown elapses, settle once: its scan or claim is the
3511
3658
  // half-open probe that closes or re-opens the breaker.
3512
- on_retry: () => this._schedule()
3659
+ on_retry: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, () => this._schedule(), "on_retry")
3513
3660
  }
3514
3661
  );
3515
3662
  }
3516
3663
  // Apps that declare no lanes pass no lane filter to `claim`.
3517
3664
  _build_drain_controllers(options, lanes, handle, handle_batch) {
3518
3665
  const all_lanes = this._declared_lanes;
3519
- const only_set = _optionalChain([options, 'access', _158 => _158.onlyLanes, 'optionalAccess', _159 => _159.length]) ? new Set(options.onlyLanes) : void 0;
3666
+ const only_set = _optionalChain([options, 'access', _161 => _161.onlyLanes, 'optionalAccess', _162 => _162.length]) ? new Set(options.onlyLanes) : void 0;
3520
3667
  const active_lanes = only_set ? all_lanes.filter((n) => only_set.has(n)) : all_lanes;
3521
3668
  const single_default_lane = lanes.length === 0;
3522
3669
  const controllers = /* @__PURE__ */ new Map();
@@ -3529,22 +3676,22 @@ var Act = (_class7 = class {
3529
3676
  batch_handlers: this._batch_handlers,
3530
3677
  handle,
3531
3678
  handle_batch,
3532
- on_acked: (acked) => this.emit("acked", acked),
3533
- on_blocked: (blocked) => this.emit("blocked", blocked),
3679
+ on_acked: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (acked) => this.emit("acked", acked), "on_acked"),
3680
+ on_blocked: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (blocked) => this.emit("blocked", blocked), "on_blocked"),
3534
3681
  // Reaction-requested close: the same machinery as `app.close`.
3535
3682
  // A store failure reaches the breaker; anything else (the archive
3536
3683
  // callback is app code) is logged here, never counted.
3537
- on_close: async (targets) => {
3684
+ on_close: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, async (targets) => {
3538
3685
  try {
3539
3686
  await this._run_close(targets);
3540
3687
  } catch (error) {
3541
- if (error instanceof _chunkZTHGF62Ocjs.StoreError) throw error;
3688
+ if (error instanceof _chunkUEGKXCSQcjs.StoreError) throw error;
3542
3689
  this._logger.error(
3543
3690
  error,
3544
3691
  `Reaction-requested close of ${targets.map((t) => `"${t.stream}"`).join(", ")} failed; the policy retries it (a full close the next day, a prune on the stream's next commit), or close it now with app.close(...) once the cause is fixed.`
3545
3692
  );
3546
3693
  }
3547
- },
3694
+ }, "on_close"),
3548
3695
  breaker: this._breaker,
3549
3696
  run_scoped: this._scoped,
3550
3697
  lane: single_default_lane ? void 0 : name,
@@ -3553,7 +3700,7 @@ var Act = (_class7 = class {
3553
3700
  leaseMillis: cfg.leaseMillis
3554
3701
  }
3555
3702
  });
3556
- if (_optionalChain([cfg, 'optionalAccess', _160 => _160.cycleMs]) !== void 0 && this._drain)
3703
+ if (_optionalChain([cfg, 'optionalAccess', _163 => _163.cycleMs]) !== void 0 && this._drain)
3557
3704
  controller.start(cfg.cycleMs);
3558
3705
  controllers.set(name, controller);
3559
3706
  }
@@ -3572,8 +3719,9 @@ var Act = (_class7 = class {
3572
3719
  // Audit deps, built after the controllers so the lane set is final.
3573
3720
  _build_audit_deps() {
3574
3721
  return {
3575
- store: _chunkN74AN6L5cjs.store,
3722
+ store: _chunkWDIBO6AWcjs.store,
3576
3723
  event_to_state: this._event_to_state,
3724
+ sensitive_fields: this.registry.sensitive_fields,
3577
3725
  // Declared lanes, not this process's controllers: a lane another
3578
3726
  // worker drains is not `unknown-lane`.
3579
3727
  declared_lanes: new Set(this._declared_lanes),
@@ -3585,39 +3733,39 @@ var Act = (_class7 = class {
3585
3733
  registry: this.registry,
3586
3734
  static_targets: classification.static_targets,
3587
3735
  cd: this._cd,
3588
- max_subscribed_streams: _nullishCoalesce(options.maxSubscribedStreams, () => ( _chunkZTHGF62Ocjs.DEFAULT_MAX_SUBSCRIBED_STREAMS)),
3736
+ max_subscribed_streams: _nullishCoalesce(options.maxSubscribedStreams, () => ( _chunkUEGKXCSQcjs.DEFAULT_MAX_SUBSCRIBED_STREAMS)),
3589
3737
  // Declared lanes (not active ones): a lane another process claims is
3590
3738
  // still a valid destination.
3591
3739
  declared_lanes: new Set(this._declared_lanes),
3592
3740
  // Built after the controllers, so their keys are the active lanes.
3593
3741
  shard: this._drain_controllers.size < this._declared_lanes.length ? [...this._drain_controllers.keys()] : void 0,
3594
3742
  // Only reached on a draining app: writer-only ones never correlate.
3595
- on_init: async () => {
3743
+ on_init: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, async () => {
3596
3744
  this._arm_all();
3597
3745
  await this._seed_persisted_defers();
3598
- }
3746
+ }, "on_init")
3599
3747
  });
3600
3748
  }
3601
3749
  // Cold start: an idle deferred stream still fires on time after a restart.
3602
3750
  async _seed_persisted_defers() {
3603
3751
  const now = Date.now();
3604
- await walk_streams(_chunkN74AN6L5cjs.store.call(void 0, ), (pos) => {
3752
+ await walk_streams(_chunkWDIBO6AWcjs.store.call(void 0, ), (pos) => {
3605
3753
  if (pos.deferred_at === void 0 || pos.deferred_at <= now) return;
3606
3754
  const controller = this._drain_controllers.get(_nullishCoalesce(pos.lane, () => ( "default")));
3607
- _optionalChain([controller, 'optionalAccess', _161 => _161.seed_defer, 'call', _162 => _162(pos.stream, pos.deferred_at)]);
3755
+ _optionalChain([controller, 'optionalAccess', _164 => _164.seed_defer, 'call', _165 => _165(pos.stream, pos.deferred_at)]);
3608
3756
  });
3609
3757
  }
3610
3758
  _build_settle(options) {
3611
3759
  return new SettleLoop(
3612
3760
  {
3613
- correlate: (q) => this._correlate_pass(_nullishCoalesce(_nullishCoalesce(q.limit, () => ( this._poll_limit)), () => ( 100)), true),
3761
+ correlate: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (q) => this._correlate_pass(_nullishCoalesce(_nullishCoalesce(q.limit, () => ( this._poll_limit)), () => ( 100)), true), "correlate"),
3614
3762
  // `settle()` validated the options, and `_schedule` skips writer-only
3615
3763
  // instances, so the loop drains through the internal path.
3616
- drain: (o) => this._scoped(() => this._drain_all(o)),
3617
- on_settled: (drain) => this.emit("settled", drain),
3764
+ drain: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (o) => this._scoped(() => this._drain_all(o)), "drain"),
3765
+ on_settled: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (drain) => this.emit("settled", drain), "on_settled"),
3618
3766
  breaker: this._breaker
3619
3767
  },
3620
- _nullishCoalesce(options.settleDebounceMs, () => ( _chunkZTHGF62Ocjs.DEFAULT_SETTLE_DEBOUNCE_MS))
3768
+ _nullishCoalesce(options.settleDebounceMs, () => ( _chunkUEGKXCSQcjs.DEFAULT_SETTLE_DEBOUNCE_MS))
3621
3769
  );
3622
3770
  }
3623
3771
 
@@ -3637,7 +3785,7 @@ var Act = (_class7 = class {
3637
3785
  */
3638
3786
  shutdown(options) {
3639
3787
  if (!this._shutdown_promise) {
3640
- _chunkN74AN6L5cjs.check.call(void 0, "shutdown", _nullishCoalesce(options, () => ( {})));
3788
+ _chunkWDIBO6AWcjs.check.call(void 0, "shutdown", _nullishCoalesce(options, () => ( {})));
3641
3789
  this._shutdown_promise = (async () => {
3642
3790
  this.stop_correlations();
3643
3791
  this._settle.stop(true);
@@ -3645,7 +3793,7 @@ var Act = (_class7 = class {
3645
3793
  for (const c of this._drain_controllers.values()) c.stop();
3646
3794
  const disposer = await this._notify_disposer;
3647
3795
  if (disposer) await disposer();
3648
- await this._await_inflight(_optionalChain([options, 'optionalAccess', _163 => _163.graceMs]));
3796
+ await this._await_inflight(_optionalChain([options, 'optionalAccess', _166 => _166.graceMs]));
3649
3797
  await this._scoped(() => this._correlate.release_correlation());
3650
3798
  this._emitter.removeAllListeners();
3651
3799
  })();
@@ -3655,10 +3803,10 @@ var Act = (_class7 = class {
3655
3803
  // The largest `leaseMillis` among lanes with a cycle in flight (the
3656
3804
  // default for none or 0, and for a running settle), capped.
3657
3805
  _derive_grace_ms(running, settling) {
3658
- let max = settling ? _chunkN74AN6L5cjs.DEFAULT_LEASE_MILLIS : 0;
3806
+ let max = settling ? _chunkWDIBO6AWcjs.DEFAULT_LEASE_MILLIS : 0;
3659
3807
  for (const c of running)
3660
- max = Math.max(max, c.lease_millis || _chunkN74AN6L5cjs.DEFAULT_LEASE_MILLIS);
3661
- return Math.min(max, _chunkN74AN6L5cjs.MAX_SHUTDOWN_GRACE_MS);
3808
+ max = Math.max(max, c.lease_millis || _chunkWDIBO6AWcjs.DEFAULT_LEASE_MILLIS);
3809
+ return Math.min(max, _chunkWDIBO6AWcjs.MAX_SHUTDOWN_GRACE_MS);
3662
3810
  }
3663
3811
  async _await_inflight(grace_ms) {
3664
3812
  const running = [...this._drain_controllers.values()].filter(
@@ -3742,8 +3890,8 @@ var Act = (_class7 = class {
3742
3890
  * @see {@link ValidationError}, {@link PreconditionError}, {@link ConcurrencyError}
3743
3891
  */
3744
3892
  async do(action2, target, payload, options) {
3745
- const reacting_to = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _164 => _164.reactingTo]), () => ( _chunkN74AN6L5cjs.current_reacting.call(void 0, )));
3746
- const do_options = reacting_to === _optionalChain([options, 'optionalAccess', _165 => _165.reactingTo]) ? options : { ...options, reactingTo: reacting_to };
3893
+ const reacting_to = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _167 => _167.reactingTo]), () => ( _chunkWDIBO6AWcjs.current_reacting.call(void 0, )));
3894
+ const do_options = reacting_to === _optionalChain([options, 'optionalAccess', _168 => _168.reactingTo]) ? options : { ...options, reactingTo: reacting_to };
3747
3895
  return this._scoped(async () => {
3748
3896
  const snapshots = await this._es.action(
3749
3897
  this.registry.actions[action2],
@@ -3816,11 +3964,11 @@ var Act = (_class7 = class {
3816
3964
  return this._scoped(async () => {
3817
3965
  let first;
3818
3966
  let last;
3819
- const count = await _chunkN74AN6L5cjs.store.call(void 0, ).query((e) => {
3967
+ const count = await _chunkWDIBO6AWcjs.store.call(void 0, ).query((e) => {
3820
3968
  const gated = this.registry.query_gate(e.name)(e);
3821
3969
  if (!first) first = gated;
3822
3970
  last = gated;
3823
- _optionalChain([callback, 'optionalCall', _166 => _166(gated)]);
3971
+ _optionalChain([callback, 'optionalCall', _169 => _169(gated)]);
3824
3972
  }, query);
3825
3973
  return { first, last, count };
3826
3974
  });
@@ -3862,14 +4010,14 @@ var Act = (_class7 = class {
3862
4010
  */
3863
4011
  async forget(stream) {
3864
4012
  return this._scoped(async () => {
3865
- const s = _chunkN74AN6L5cjs.store.call(void 0, );
4013
+ const s = _chunkWDIBO6AWcjs.store.call(void 0, );
3866
4014
  if (!s.forget_pii) {
3867
4015
  throw new Error(
3868
4016
  `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).`
3869
4017
  );
3870
4018
  }
3871
4019
  const eventCount = await s.forget_pii(stream);
3872
- await _chunkN74AN6L5cjs.cache.call(void 0, ).invalidate(stream);
4020
+ await _chunkWDIBO6AWcjs.cache.call(void 0, ).invalidate(stream);
3873
4021
  if (eventCount > 0) {
3874
4022
  this.emit("forgotten", { stream, at: /* @__PURE__ */ new Date(), eventCount });
3875
4023
  }
@@ -3903,7 +4051,7 @@ var Act = (_class7 = class {
3903
4051
  * @see {@link correlate} for dynamic stream discovery
3904
4052
  */
3905
4053
  async drain(options = {}) {
3906
- _chunkN74AN6L5cjs.check.call(void 0, "drain", options);
4054
+ _chunkWDIBO6AWcjs.check.call(void 0, "drain", options);
3907
4055
  if (!this._drain)
3908
4056
  return { fetched: [], leased: [], acked: [], blocked: [] };
3909
4057
  return this._scoped(() => this._drain_all(options));
@@ -3941,7 +4089,7 @@ var Act = (_class7 = class {
3941
4089
  }
3942
4090
  if (to_arm.size === 0) return false;
3943
4091
  this._correlate.arm();
3944
- for (const lane of to_arm) _optionalChain([this, 'access', _167 => _167._drain_controllers, 'access', _168 => _168.get, 'call', _169 => _169(lane), 'optionalAccess', _170 => _170.arm, 'call', _171 => _171()]);
4092
+ for (const lane of to_arm) _optionalChain([this, 'access', _170 => _170._drain_controllers, 'access', _171 => _171.get, 'call', _172 => _172(lane), 'optionalAccess', _173 => _173.arm, 'call', _174 => _174()]);
3945
4093
  return true;
3946
4094
  }
3947
4095
  // In parallel, so a slow lane never holds up a fast one.
@@ -3980,6 +4128,7 @@ var Act = (_class7 = class {
3980
4128
  * @see {@link start_correlations} for automatic periodic correlation
3981
4129
  */
3982
4130
  async correlate(query = {}) {
4131
+ _chunkWDIBO6AWcjs.check.call(void 0, "page", query);
3983
4132
  const pass = await this._correlate_pass(_nullishCoalesce(query.limit, () => ( 10)));
3984
4133
  return {
3985
4134
  subscribed: pass.kind === "scanned" ? pass.subscribed : 0,
@@ -4025,6 +4174,8 @@ var Act = (_class7 = class {
4025
4174
  * @see {@link stop_correlations} to stop the poll
4026
4175
  */
4027
4176
  start_correlations(query = {}, frequency = 1e4) {
4177
+ _chunkWDIBO6AWcjs.check.call(void 0, "page", query);
4178
+ _chunkWDIBO6AWcjs.check.call(void 0, "poll", { frequency });
4028
4179
  if (this._poll) return false;
4029
4180
  this._poll_limit = query.limit || void 0;
4030
4181
  this._poll = setInterval(() => {
@@ -4061,7 +4212,7 @@ var Act = (_class7 = class {
4061
4212
  // and an extra clear costs one head load per stream.
4062
4213
  _reset_folds() {
4063
4214
  for (const handler of this._batch_handlers.values())
4064
- _optionalChain([handler, 'access', _172 => _172[FOLD_RESET], 'optionalCall', _173 => _173()]);
4215
+ _optionalChain([handler, 'access', _175 => _175[FOLD_RESET], 'optionalCall', _176 => _176()]);
4065
4216
  }
4066
4217
  /**
4067
4218
  * Reset reaction stream watermarks and settle them, replaying their
@@ -4090,7 +4241,7 @@ var Act = (_class7 = class {
4090
4241
  */
4091
4242
  async reset(input) {
4092
4243
  return this._scoped(async () => {
4093
- const count = await _chunkN74AN6L5cjs.store.call(void 0, ).reset(input);
4244
+ const count = await _chunkWDIBO6AWcjs.store.call(void 0, ).reset(input);
4094
4245
  this._reset_folds();
4095
4246
  if (count > 0) {
4096
4247
  this._wake();
@@ -4125,7 +4276,7 @@ var Act = (_class7 = class {
4125
4276
  */
4126
4277
  async unblock(input) {
4127
4278
  return this._scoped(async () => {
4128
- const count = await _chunkN74AN6L5cjs.store.call(void 0, ).unblock(input);
4279
+ const count = await _chunkWDIBO6AWcjs.store.call(void 0, ).unblock(input);
4129
4280
  if (count > 0) {
4130
4281
  this._wake();
4131
4282
  }
@@ -4173,7 +4324,7 @@ var Act = (_class7 = class {
4173
4324
  * @see {@link Store.restore} for the underlying driver-pattern primitive.
4174
4325
  */
4175
4326
  async restore(source, opts = {}, sink) {
4176
- _chunkN74AN6L5cjs.check.call(void 0, "scan", opts);
4327
+ _chunkWDIBO6AWcjs.check.call(void 0, "scan", opts);
4177
4328
  return this._scoped(async () => {
4178
4329
  const started = Date.now();
4179
4330
  if (opts.dry_run) {
@@ -4181,19 +4332,19 @@ var Act = (_class7 = class {
4181
4332
  return { ...partial, duration_ms: Date.now() - started };
4182
4333
  }
4183
4334
  const target = _nullishCoalesce(sink, () => ( (() => {
4184
- const s = _chunkN74AN6L5cjs.store.call(void 0, );
4335
+ const s = _chunkWDIBO6AWcjs.store.call(void 0, );
4185
4336
  if (!s.restore) throw new Error("adapter has no restore capability");
4186
4337
  return s;
4187
4338
  })()));
4188
4339
  let kept = 0;
4189
4340
  let migrated = 0;
4190
4341
  let dropped = { closed_streams: 0, snapshots: 0 };
4191
- const run = () => target.restore(async (callback) => {
4342
+ const run = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, () => target.restore(async (callback) => {
4192
4343
  const partial = await scan(source, opts, callback);
4193
4344
  kept = partial.kept;
4194
4345
  migrated = partial.migrated;
4195
4346
  dropped = partial.dropped;
4196
- });
4347
+ }), "run");
4197
4348
  if (sink) await run();
4198
4349
  else {
4199
4350
  await this._correlate.restart(run);
@@ -4226,13 +4377,14 @@ var Act = (_class7 = class {
4226
4377
  * ```
4227
4378
  */
4228
4379
  async blocked_streams(options) {
4380
+ _chunkWDIBO6AWcjs.check.call(void 0, "page", _nullishCoalesce(options, () => ( {})));
4229
4381
  return this._scoped(async () => {
4230
4382
  const positions = [];
4231
- await _chunkN74AN6L5cjs.store.call(void 0, ).query_streams(
4383
+ await _chunkWDIBO6AWcjs.store.call(void 0, ).query_streams(
4232
4384
  (p) => {
4233
4385
  positions.push(p);
4234
4386
  },
4235
- { blocked: true, after: _optionalChain([options, 'optionalAccess', _174 => _174.after]), limit: _optionalChain([options, 'optionalAccess', _175 => _175.limit]) }
4387
+ { blocked: true, after: _optionalChain([options, 'optionalAccess', _177 => _177.after]), limit: _optionalChain([options, 'optionalAccess', _178 => _178.limit]) }
4236
4388
  );
4237
4389
  return positions;
4238
4390
  });
@@ -4254,7 +4406,7 @@ var Act = (_class7 = class {
4254
4406
  * ```
4255
4407
  */
4256
4408
  async *audit(categories, options) {
4257
- _chunkN74AN6L5cjs.check.call(void 0, "audit", _nullishCoalesce(options, () => ( {})));
4409
+ _chunkWDIBO6AWcjs.check.call(void 0, "audit", _nullishCoalesce(options, () => ( {})));
4258
4410
  const it = audit(this._audit_deps, categories, options)[Symbol.asyncIterator]();
4259
4411
  while (true) {
4260
4412
  const { value, done } = await this._scoped(() => it.next());
@@ -4282,26 +4434,26 @@ var Act = (_class7 = class {
4282
4434
  * @see {@link Store.prioritize} for the underlying primitive
4283
4435
  */
4284
4436
  async prioritize(filter, priority) {
4285
- _chunkN74AN6L5cjs.check.call(void 0, "target", { priority });
4286
- return this._scoped(() => _chunkN74AN6L5cjs.store.call(void 0, ).prioritize(filter, priority));
4437
+ _chunkWDIBO6AWcjs.check.call(void 0, "target", { priority });
4438
+ return this._scoped(() => _chunkWDIBO6AWcjs.store.call(void 0, ).prioritize(filter, priority));
4287
4439
  }
4288
4440
  // Shared by `close()` and reaction-requested closes.
4289
4441
  async _run_close(targets) {
4290
4442
  const close_actor = { id: "$close", name: "close" };
4291
4443
  const result = await run_close_cycle(targets, {
4292
4444
  reactive: this._reactive,
4293
- catch_up_correlation: (until) => catch_up_correlation(
4445
+ catch_up_correlation: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (until) => catch_up_correlation(
4294
4446
  this._correlate,
4295
4447
  (limit) => this.correlate({ limit }),
4296
4448
  until
4297
- ),
4449
+ ), "catch_up_correlation"),
4298
4450
  event_to_state: this._event_to_state,
4299
4451
  load: this._es.load,
4300
4452
  tombstone: this._es.tombstone,
4301
4453
  logger: this._logger,
4302
4454
  correlation: close_correlation(this._correlator, close_actor),
4303
- with_stream_lock: (stream, work) => this._close_lock.run(stream, work),
4304
- forget_subscribed: (streams) => this._correlate.forget_subscribed(streams)
4455
+ with_stream_lock: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (stream, work) => this._close_lock.run(stream, work), "with_stream_lock"),
4456
+ forget_subscribed: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (streams) => this._correlate.forget_subscribed(streams), "forget_subscribed")
4305
4457
  });
4306
4458
  this.emit("closed", result);
4307
4459
  return result;
@@ -4363,7 +4515,7 @@ var Act = (_class7 = class {
4363
4515
  * @see {@link correlate} for manual correlation
4364
4516
  */
4365
4517
  settle(options) {
4366
- _chunkN74AN6L5cjs.check.call(void 0, "settle", _nullishCoalesce(options, () => ( {})));
4518
+ _chunkWDIBO6AWcjs.check.call(void 0, "settle", _nullishCoalesce(options, () => ( {})));
4367
4519
  this._schedule(options);
4368
4520
  }
4369
4521
  }, _class7);
@@ -4371,11 +4523,12 @@ var Act = (_class7 = class {
4371
4523
  // src/builders/merge.ts
4372
4524
 
4373
4525
  function base_type_name(schema) {
4374
- let def = _chunkZTHGF62Ocjs.def_of.call(void 0, schema);
4375
- for (let inner = _chunkZTHGF62Ocjs.inner_of.call(void 0, def); inner; inner = _chunkZTHGF62Ocjs.inner_of.call(void 0, def))
4376
- def = _chunkZTHGF62Ocjs.def_of.call(void 0, inner);
4526
+ let def = def_of(schema);
4527
+ for (let inner = inner_of(def); inner; inner = inner_of(def))
4528
+ def = def_of(inner);
4377
4529
  return def.type === "array" ? `array of ${base_type_name(def.element)}` : def.type;
4378
4530
  }
4531
+ _chunkUEGKXCSQcjs.__name.call(void 0, base_type_name, "base_type_name");
4379
4532
  function merge_schemas(existing, incoming, state_name) {
4380
4533
  if (existing === incoming) return existing;
4381
4534
  const existing_object = as_object(existing, "existing", state_name);
@@ -4395,15 +4548,18 @@ function merge_schemas(existing, incoming, state_name) {
4395
4548
  }
4396
4549
  return existing_object.extend(incoming_shape);
4397
4550
  }
4551
+ _chunkUEGKXCSQcjs.__name.call(void 0, merge_schemas, "merge_schemas");
4398
4552
  function as_object(schema, side, state_name) {
4399
- if (schema instanceof _zod.ZodObject) return schema;
4553
+ if (schema instanceof _zod2.ZodObject) return schema;
4400
4554
  throw new Error(
4401
4555
  `Cannot merge state schemas for "${state_name}": the ${side} partial's schema is a ${schema.constructor.name}, not a z.object. Partials of the same state are merged by extending their shapes, so declare every partial's state as a plain z.object({ ... }).`
4402
4556
  );
4403
4557
  }
4558
+ _chunkUEGKXCSQcjs.__name.call(void 0, as_object, "as_object");
4404
4559
  function merge_inits(existing, incoming) {
4405
4560
  return () => ({ ...existing(), ...incoming() });
4406
4561
  }
4562
+ _chunkUEGKXCSQcjs.__name.call(void 0, merge_inits, "merge_inits");
4407
4563
  function register_state(state2, states, actions, events) {
4408
4564
  const existing = states.get(state2.name);
4409
4565
  if (existing) {
@@ -4412,22 +4568,30 @@ function register_state(state2, states, actions, events) {
4412
4568
  register_new_state(state2, states, actions, events);
4413
4569
  }
4414
4570
  }
4571
+ _chunkUEGKXCSQcjs.__name.call(void 0, register_state, "register_state");
4572
+ var shared_name = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (name) => new Error(
4573
+ `Action and event share the name "${name}" \u2014 action and event names must be unique across the application. Rename one of them.`
4574
+ ), "shared_name");
4415
4575
  function register_new_state(state2, states, actions, events) {
4416
4576
  states.set(state2.name, state2);
4417
4577
  for (const name of Object.keys(state2.actions)) {
4418
4578
  if (actions[name]) throw new Error(`Duplicate action "${name}"`);
4579
+ if (events[name]) throw shared_name(name);
4419
4580
  actions[name] = state2;
4420
4581
  }
4421
4582
  for (const name of Object.keys(state2.events)) {
4422
4583
  if (events[name]) throw new Error(`Duplicate event "${name}"`);
4584
+ if (actions[name]) throw shared_name(name);
4423
4585
  events[name] = { schema: state2.events[name], reactions: /* @__PURE__ */ new Map() };
4424
4586
  }
4425
4587
  }
4588
+ _chunkUEGKXCSQcjs.__name.call(void 0, register_new_state, "register_new_state");
4426
4589
  function pick_declared(existing, incoming, what, state_name) {
4427
4590
  if (existing && incoming && existing !== incoming)
4428
4591
  throw new Error(`Duplicate ${what} for state "${state_name}"`);
4429
4592
  return _nullishCoalesce(incoming, () => ( existing));
4430
4593
  }
4594
+ _chunkUEGKXCSQcjs.__name.call(void 0, pick_declared, "pick_declared");
4431
4595
  function autoclose_of(existing, state2) {
4432
4596
  pick_declared(
4433
4597
  existing.autoclose,
@@ -4443,10 +4607,12 @@ function autoclose_of(existing, state2) {
4443
4607
  autoclose_keep_days: owner.autoclose_keep_days
4444
4608
  };
4445
4609
  }
4610
+ _chunkUEGKXCSQcjs.__name.call(void 0, autoclose_of, "autoclose_of");
4446
4611
  function merge_into_existing(state2, existing, states, actions, events) {
4447
4612
  for (const name of Object.keys(state2.actions)) {
4448
4613
  if (existing.on[name] === state2.on[name]) continue;
4449
4614
  if (actions[name]) throw new Error(`Duplicate action "${name}"`);
4615
+ if (events[name] || state2.events[name]) throw shared_name(name);
4450
4616
  }
4451
4617
  for (const name of Object.keys(state2.events)) {
4452
4618
  if (existing.events[name] === state2.events[name]) continue;
@@ -4456,6 +4622,7 @@ function merge_into_existing(state2, existing, states, actions, events) {
4456
4622
  );
4457
4623
  }
4458
4624
  if (events[name]) throw new Error(`Duplicate event "${name}"`);
4625
+ if (actions[name]) throw shared_name(name);
4459
4626
  }
4460
4627
  const merged_patch = merge_patches(existing.patch, state2.patch, state2.name);
4461
4628
  const merged = {
@@ -4498,6 +4665,7 @@ function merge_into_existing(state2, existing, states, actions, events) {
4498
4665
  events[name] = { schema: state2.events[name], reactions: /* @__PURE__ */ new Map() };
4499
4666
  }
4500
4667
  }
4668
+ _chunkUEGKXCSQcjs.__name.call(void 0, merge_into_existing, "merge_into_existing");
4501
4669
  function merge_patches(existing, incoming, state_name) {
4502
4670
  const merged = { ...existing };
4503
4671
  for (const name of Object.keys(incoming)) {
@@ -4520,6 +4688,7 @@ function merge_patches(existing, incoming, state_name) {
4520
4688
  }
4521
4689
  return merged;
4522
4690
  }
4691
+ _chunkUEGKXCSQcjs.__name.call(void 0, merge_patches, "merge_patches");
4523
4692
  function merge_event_register(target, source) {
4524
4693
  for (const [event_name, source_reg] of Object.entries(source)) {
4525
4694
  const target_reg = target[event_name];
@@ -4534,6 +4703,7 @@ function merge_event_register(target, source) {
4534
4703
  }
4535
4704
  }
4536
4705
  }
4706
+ _chunkUEGKXCSQcjs.__name.call(void 0, merge_event_register, "merge_event_register");
4537
4707
  function merge_projection(proj, events) {
4538
4708
  for (const event_name of Object.keys(proj.events)) {
4539
4709
  const proj_register = proj.events[event_name];
@@ -4553,16 +4723,17 @@ function merge_projection(proj, events) {
4553
4723
  }
4554
4724
  }
4555
4725
  }
4556
- var _this_ = ({ stream }) => ({
4726
+ _chunkUEGKXCSQcjs.__name.call(void 0, merge_projection, "merge_projection");
4727
+ var _this_ = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, ({ stream }) => ({
4557
4728
  source: stream,
4558
4729
  target: stream
4559
- });
4730
+ }), "_this_");
4560
4731
 
4561
4732
  // src/builders/builder-utils.ts
4562
4733
  function register_lane(config2, lanes) {
4563
- _chunkN74AN6L5cjs.check.call(void 0, "lane", config2);
4564
- if (config2.name === _chunkZTHGF62Ocjs.DEFAULT_LANE)
4565
- throw new Error(`Lane "${_chunkZTHGF62Ocjs.DEFAULT_LANE}" is reserved`);
4734
+ _chunkWDIBO6AWcjs.check.call(void 0, "lane", config2);
4735
+ if (config2.name === _chunkUEGKXCSQcjs.DEFAULT_LANE)
4736
+ throw new Error(`Lane "${_chunkUEGKXCSQcjs.DEFAULT_LANE}" is reserved`);
4566
4737
  const existing = lanes.find((l) => l.name === config2.name);
4567
4738
  if (!existing) return void lanes.push(config2);
4568
4739
  if (existing.leaseMillis !== config2.leaseMillis || existing.streamLimit !== config2.streamLimit || existing.cycleMs !== config2.cycleMs)
@@ -4570,6 +4741,7 @@ function register_lane(config2, lanes) {
4570
4741
  `Lane "${config2.name}" was already declared with a different config`
4571
4742
  );
4572
4743
  }
4744
+ _chunkUEGKXCSQcjs.__name.call(void 0, register_lane, "register_lane");
4573
4745
  function add_reaction(events, event, name, kind, make, builder) {
4574
4746
  if (!name)
4575
4747
  throw new Error(
@@ -4584,65 +4756,95 @@ function add_reaction(events, event, name, kind, make, builder) {
4584
4756
  events[event].reactions.set(name, reaction);
4585
4757
  return Object.assign(builder, {
4586
4758
  to(resolver) {
4587
- if (typeof resolver === "object") _chunkN74AN6L5cjs.check.call(void 0, "target", resolver);
4759
+ if (typeof resolver === "object") _chunkWDIBO6AWcjs.check.call(void 0, "target", resolver);
4588
4760
  reaction.resolver = typeof resolver === "string" ? { target: resolver } : resolver;
4589
4761
  return builder;
4590
4762
  }
4591
4763
  });
4592
4764
  }
4765
+ _chunkUEGKXCSQcjs.__name.call(void 0, add_reaction, "add_reaction");
4593
4766
  function reaction_on(event, events, builder) {
4594
- const register = (handler, options, schedule) => add_reaction(
4767
+ const register = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (handler, options, schedule) => add_reaction(
4595
4768
  events,
4596
4769
  event,
4597
4770
  handler.name,
4598
4771
  "Reaction",
4599
4772
  () => {
4600
4773
  if (schedule && typeof schedule !== "function")
4601
- _chunkN74AN6L5cjs.check.call(void 0, "defer", schedule);
4774
+ _chunkWDIBO6AWcjs.check.call(void 0, "defer", schedule);
4602
4775
  return {
4603
4776
  handler: schedule ? make_deferred(handler, schedule) : handler,
4604
4777
  resolver: _this_,
4605
4778
  // Validate the whole bag at the declaration site so a bad
4606
4779
  // `maxRetries`/`backoff`/`blockOnError` throws ZodError at build,
4607
4780
  // not a NaN gate on the first retry.
4608
- options: _chunkN74AN6L5cjs.check.call(void 0, "reaction", {
4609
- blockOnError: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _176 => _176.blockOnError]), () => ( _chunkN74AN6L5cjs.DEFAULT_BLOCK_ON_ERROR)),
4610
- maxRetries: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _177 => _177.maxRetries]), () => ( _chunkN74AN6L5cjs.DEFAULT_MAX_RETRIES)),
4611
- backoff: _optionalChain([options, 'optionalAccess', _178 => _178.backoff])
4781
+ options: _chunkWDIBO6AWcjs.check.call(void 0, "reaction", {
4782
+ blockOnError: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _179 => _179.blockOnError]), () => ( _chunkWDIBO6AWcjs.DEFAULT_BLOCK_ON_ERROR)),
4783
+ maxRetries: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _180 => _180.maxRetries]), () => ( _chunkWDIBO6AWcjs.DEFAULT_MAX_RETRIES)),
4784
+ backoff: _optionalChain([options, 'optionalAccess', _181 => _181.backoff])
4612
4785
  })
4613
4786
  };
4614
4787
  },
4615
4788
  builder
4616
- );
4789
+ ), "register");
4617
4790
  return {
4618
- do: (handler, options) => register(handler, options),
4619
- defer: (schedule) => ({
4620
- do: (handler, options) => register(handler, options, schedule)
4621
- })
4791
+ do: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (handler, options) => register(handler, options), "do"),
4792
+ defer: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (schedule) => ({
4793
+ do: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (handler, options) => register(handler, options, schedule), "do")
4794
+ }), "defer")
4622
4795
  };
4623
4796
  }
4797
+ _chunkUEGKXCSQcjs.__name.call(void 0, reaction_on, "reaction_on");
4624
4798
 
4625
4799
  // src/builders/event-builder.ts
4626
4800
 
4801
+
4802
+ // src/internal/sensitive.ts
4803
+ var SENSITIVE = /* @__PURE__ */ Symbol.for("act.sensitive");
4804
+ var is_pii = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (schema) => some_layer(schema, (def) => def[SENSITIVE] === true), "is_pii");
4805
+ function pii_schemas(schema) {
4806
+ const shape = schema.shape;
4807
+ if (shape && typeof shape === "object") {
4808
+ const fields = {};
4809
+ for (const key of Object.keys(shape))
4810
+ if (is_pii(shape[key])) fields[key] = shape[key];
4811
+ return fields;
4812
+ }
4813
+ const options = schema.options;
4814
+ if (Array.isArray(options)) {
4815
+ const fields = {};
4816
+ for (const option of options)
4817
+ for (const [key, field] of Object.entries(
4818
+ pii_schemas(option)
4819
+ ))
4820
+ fields[key] ??= field;
4821
+ return fields;
4822
+ }
4823
+ return {};
4824
+ }
4825
+ _chunkUEGKXCSQcjs.__name.call(void 0, pii_schemas, "pii_schemas");
4826
+
4827
+ // src/builders/event-builder.ts
4627
4828
  function event_tags(schema) {
4628
- const pii = _chunkZTHGF62Ocjs.pii_schemas.call(void 0, schema);
4829
+ const pii = pii_schemas(schema);
4629
4830
  const pii_dates = {};
4630
4831
  for (const [key, field] of Object.entries(pii)) {
4631
4832
  const dates = date_reviver_schema(field);
4632
4833
  if (dates) pii_dates[key] = dates.optional();
4633
4834
  }
4634
4835
  const data_reviver_schema = date_reviver_schema(schema);
4635
- const revive = (schema2) => (data) => {
4836
+ const revive = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (schema2) => (data) => {
4636
4837
  const revived = schema2.safeParse(data);
4637
4838
  return revived.success ? revived.data : data;
4638
- };
4839
+ }, "revive");
4639
4840
  const dated_pii = Object.keys(pii_dates).length > 0;
4640
4841
  return {
4641
4842
  sensitive: pii,
4642
4843
  date_reviver: data_reviver_schema && revive(data_reviver_schema),
4643
- pii_date_reviver: dated_pii ? revive(_zod.z.looseObject(pii_dates)) : void 0
4844
+ pii_date_reviver: dated_pii ? revive(_zod2.z.looseObject(pii_dates)) : void 0
4644
4845
  };
4645
4846
  }
4847
+ _chunkUEGKXCSQcjs.__name.call(void 0, event_tags, "event_tags");
4646
4848
  function make_event_reader(tags, disclosure, predicate = null) {
4647
4849
  const { date_reviver, pii_date_reviver } = tags;
4648
4850
  const sensitive2 = Object.keys(tags.sensitive);
@@ -4662,8 +4864,9 @@ function make_event_reader(tags, disclosure, predicate = null) {
4662
4864
  );
4663
4865
  });
4664
4866
  }
4867
+ _chunkUEGKXCSQcjs.__name.call(void 0, make_event_reader, "make_event_reader");
4665
4868
  function build_events(registry, states, lanes, owners) {
4666
- const declared = /* @__PURE__ */ new Set([_chunkZTHGF62Ocjs.DEFAULT_LANE, ...lanes.map((l) => l.name)]);
4869
+ const declared = /* @__PURE__ */ new Set([_chunkUEGKXCSQcjs.DEFAULT_LANE, ...lanes.map((l) => l.name)]);
4667
4870
  const lane_errors = [];
4668
4871
  const tags = /* @__PURE__ */ new Map();
4669
4872
  const sensitive2 = /* @__PURE__ */ new Map();
@@ -4696,9 +4899,9 @@ function build_events(registry, states, lanes, owners) {
4696
4899
  handler_readers.set(event_name, handler_reader);
4697
4900
  for (const [name, reaction] of def.reactions) {
4698
4901
  const inner = reaction.handler;
4699
- const wrapped = (evt, stream, app) => inner(handler_reader(evt), stream, app);
4700
- Object.defineProperty(wrapped, "name", { value: inner.name });
4701
- reaction.handler = wrapped;
4902
+ const wrapped2 = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (evt, stream, app) => inner(handler_reader(evt), stream, app), "wrapped");
4903
+ Object.defineProperty(wrapped2, "name", { value: inner.name });
4904
+ reaction.handler = wrapped2;
4702
4905
  def.reactions.set(name, reaction);
4703
4906
  }
4704
4907
  }
@@ -4738,17 +4941,23 @@ function build_events(registry, states, lanes, owners) {
4738
4941
  if (reader) readers.set(event_name, reader);
4739
4942
  }
4740
4943
  const snap2 = make_event_reader(event_tags(state2.state), "redact", null);
4741
- if (snap2) readers.set(_chunkZTHGF62Ocjs.SNAP_EVENT, snap2);
4944
+ if (snap2) readers.set(_chunkUEGKXCSQcjs.SNAP_EVENT, snap2);
4742
4945
  if (readers.size === 0) continue;
4743
4946
  state2.view = (event, actor) => (_nullishCoalesce(readers.get(event.name), () => ( IDENTITY_GATE)))(event, actor);
4744
4947
  }
4948
+ for (const [action_name, state2] of Object.entries(registry.actions)) {
4949
+ const fields = Object.keys(pii_schemas(state2.actions[action_name]));
4950
+ if (fields.length > 0) sensitive2.set(action_name, fields);
4951
+ }
4745
4952
  const advisory = advised.size > 0 ? `Act has ${advised.size} sensitive field(s) whose type isn't a string: ${[...advised].join(", ")}. A caller who may not see one reads "[REDACTED]" or "[SHREDDED]" there instead, which its type doesn't allow. Declare sensitive fields as strings. See docs/docs/guides/sensitive-data.md.` : void 0;
4746
4953
  return { sensitive: sensitive2, advisory, query_readers, handler_readers };
4747
4954
  }
4955
+ _chunkUEGKXCSQcjs.__name.call(void 0, build_events, "build_events");
4748
4956
  function reads_as_string(schema) {
4749
- const type = _optionalChain([_chunkZTHGF62Ocjs.def_of.call(void 0, _chunkZTHGF62Ocjs.output_of.call(void 0, schema)), 'optionalAccess', _179 => _179.type]);
4957
+ const type = _optionalChain([def_of, 'call', _182 => _182(output_of(schema)), 'optionalAccess', _183 => _183.type]);
4750
4958
  return type === "string" || type === "transform";
4751
4959
  }
4960
+ _chunkUEGKXCSQcjs.__name.call(void 0, reads_as_string, "reads_as_string");
4752
4961
 
4753
4962
  // src/builders/act-builder.ts
4754
4963
  function register_batch_handler(proj, batch_handlers) {
@@ -4761,6 +4970,7 @@ function register_batch_handler(proj, batch_handlers) {
4761
4970
  }
4762
4971
  batch_handlers.set(proj.target, proj.batchHandler);
4763
4972
  }
4973
+ _chunkUEGKXCSQcjs.__name.call(void 0, register_batch_handler, "register_batch_handler");
4764
4974
  function act() {
4765
4975
  const states = /* @__PURE__ */ new Map();
4766
4976
  const _sf = /* @__PURE__ */ new Map();
@@ -4774,44 +4984,44 @@ function act() {
4774
4984
  const registry = {
4775
4985
  actions: {},
4776
4986
  events: {},
4777
- sensitive_fields: (event_name) => _nullishCoalesce(_sf.get(event_name), () => ( [])),
4778
- query_gate: (event_name) => _nullishCoalesce(_qg.get(event_name), () => ( IDENTITY_GATE)),
4779
- disclosure_predicate: (state_name) => _nullishCoalesce(_dp.get(state_name), () => ( null)),
4780
- deprecated_events: (state_name) => _nullishCoalesce(_de.get(state_name), () => ( EMPTY_DEPRECATED)),
4781
- autoclose_policy: (state_name) => _nullishCoalesce(_ac.get(state_name), () => ( null)),
4782
- autoclose_archiver: (state_name) => _nullishCoalesce(_aa.get(state_name), () => ( null))
4987
+ sensitive_fields: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (name) => _nullishCoalesce(_sf.get(name), () => ( [])), "sensitive_fields"),
4988
+ query_gate: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (event_name) => _nullishCoalesce(_qg.get(event_name), () => ( IDENTITY_GATE)), "query_gate"),
4989
+ disclosure_predicate: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (state_name) => _nullishCoalesce(_dp.get(state_name), () => ( null)), "disclosure_predicate"),
4990
+ deprecated_events: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (state_name) => _nullishCoalesce(_de.get(state_name), () => ( EMPTY_DEPRECATED)), "deprecated_events"),
4991
+ autoclose_policy: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (state_name) => _nullishCoalesce(_ac.get(state_name), () => ( null)), "autoclose_policy"),
4992
+ autoclose_archiver: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (state_name) => _nullishCoalesce(_aa.get(state_name), () => ( null)), "autoclose_archiver")
4783
4993
  };
4784
4994
  const pending_projections = [];
4785
4995
  const projection_reactions = /* @__PURE__ */ new Set();
4786
- const record_projection_reactions = (proj) => {
4996
+ const record_projection_reactions = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (proj) => {
4787
4997
  if (!proj.batchHandler && !proj.fold) return;
4788
4998
  for (const register of Object.values(
4789
4999
  proj.events
4790
5000
  ))
4791
5001
  for (const reaction of register.reactions.values())
4792
5002
  projection_reactions.add(reaction);
4793
- };
5003
+ }, "record_projection_reactions");
4794
5004
  const fold_projections = [];
4795
5005
  const batch_handlers = /* @__PURE__ */ new Map();
4796
- const add_projection = (proj) => {
5006
+ const add_projection = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (proj) => {
4797
5007
  record_projection_reactions(proj);
4798
5008
  merge_projection(proj, registry.events);
4799
5009
  register_batch_handler(proj, batch_handlers);
4800
5010
  if (proj.fold) fold_projections.push(proj);
4801
- };
5011
+ }, "add_projection");
4802
5012
  const fold_specs = [];
4803
5013
  const lanes = [];
4804
5014
  let _built = false;
4805
- const read_wrap = (original) => {
4806
- const wrapped = async (events, stream) => {
4807
- const read = events.map((e) => _nullishCoalesce(_optionalChain([_hr, 'access', _180 => _180.get, 'call', _181 => _181(e.name), 'optionalCall', _182 => _182(e)]), () => ( e)));
5015
+ const read_wrap = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (original) => {
5016
+ const wrapped2 = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, async (events, stream) => {
5017
+ const read = events.map((e) => _nullishCoalesce(_optionalChain([_hr, 'access', _184 => _184.get, 'call', _185 => _185(e.name), 'optionalCall', _186 => _186(e)]), () => ( e)));
4808
5018
  return original(read, stream);
4809
- };
5019
+ }, "wrapped");
4810
5020
  const reset = original[FOLD_RESET];
4811
- if (reset) Object.defineProperty(wrapped, FOLD_RESET, { value: reset });
4812
- return wrapped;
4813
- };
4814
- const make_batch_handlers = () => {
5021
+ if (reset) Object.defineProperty(wrapped2, FOLD_RESET, { value: reset });
5022
+ return wrapped2;
5023
+ }, "read_wrap");
5024
+ const make_batch_handlers = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, () => {
4815
5025
  const handlers = new Map(batch_handlers);
4816
5026
  for (const spec of fold_specs) {
4817
5027
  handlers.set(
@@ -4828,8 +5038,8 @@ function act() {
4828
5038
  );
4829
5039
  }
4830
5040
  return handlers;
4831
- };
4832
- const finalize_deprecations = () => {
5041
+ }, "make_batch_handlers");
5042
+ const finalize_deprecations = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, () => {
4833
5043
  const deprecation_summary = [];
4834
5044
  for (const state2 of states.values()) {
4835
5045
  const event_names = Object.keys(state2.events);
@@ -4845,7 +5055,7 @@ function act() {
4845
5055
  });
4846
5056
  }
4847
5057
  for (const [action_name, handler] of Object.entries(state2.on)) {
4848
- const static_target = _optionalChain([handler, 'optionalAccess', _183 => _183._static_emit]);
5058
+ const static_target = _optionalChain([handler, 'optionalAccess', _187 => _187._static_emit]);
4849
5059
  if (static_target && deprecated.has(static_target)) {
4850
5060
  const current = current_version_of(static_target, event_names);
4851
5061
  throw new Error(
@@ -4858,23 +5068,23 @@ function act() {
4858
5068
  const list = deprecation_summary.map(
4859
5069
  (d) => `"${d.deprecated}" (current: "${d.current}", state: "${d.state_name}")`
4860
5070
  ).join(", ");
4861
- _chunkN74AN6L5cjs.log.call(void 0, ).info(
5071
+ _chunkWDIBO6AWcjs.log.call(void 0, ).info(
4862
5072
  `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.`
4863
5073
  );
4864
5074
  }
4865
- };
4866
- const closed = (method) => {
5075
+ }, "finalize_deprecations");
5076
+ const closed = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (method) => {
4867
5077
  throw new Error(
4868
5078
  `act().${method}() was called after build(); the registry is already classified. Register everything before build() \u2014 build() itself may be called repeatedly (e.g. once per tenant with ActOptions.scoped).`
4869
5079
  );
4870
- };
5080
+ }, "closed");
4871
5081
  const builder = {
4872
- withState: (state2) => {
5082
+ withState: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (state2) => {
4873
5083
  if (_built) closed("withState");
4874
5084
  register_state(state2, states, registry.actions, registry.events);
4875
5085
  return builder;
4876
- },
4877
- withSlice: (input) => {
5086
+ }, "withState"),
5087
+ withSlice: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (input) => {
4878
5088
  if (_built) closed("withSlice");
4879
5089
  for (const s of input.states.values()) {
4880
5090
  register_state(s, states, registry.actions, registry.events);
@@ -4883,24 +5093,23 @@ function act() {
4883
5093
  pending_projections.push(...input.projections);
4884
5094
  for (const lane of input.lanes) register_lane(lane, lanes);
4885
5095
  return builder;
4886
- },
4887
- withProjection: (proj) => {
5096
+ }, "withSlice"),
5097
+ withProjection: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (proj) => {
4888
5098
  if (_built) closed("withProjection");
4889
5099
  add_projection(proj);
4890
5100
  return builder;
4891
- },
4892
- withActor: () => builder,
4893
- withLane: (config2) => {
5101
+ }, "withProjection"),
5102
+ withActor: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, () => builder, "withActor"),
5103
+ withLane: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (config2) => {
4894
5104
  if (_built) closed("withLane");
4895
5105
  register_lane(config2, lanes);
4896
5106
  return builder;
4897
- },
4898
- on: (event) => {
5107
+ }, "withLane"),
5108
+ on: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (event) => {
4899
5109
  if (_built) closed("on");
4900
5110
  return reaction_on(event, registry.events, builder);
4901
- },
4902
- build: (options) => {
4903
- _chunkN74AN6L5cjs.check.call(void 0, "act", _nullishCoalesce(options, () => ( {})));
5111
+ }, "on"),
5112
+ build: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (options) => {
4904
5113
  if (!_built) {
4905
5114
  for (const proj of pending_projections) add_projection(proj);
4906
5115
  for (const proj of fold_projections) {
@@ -4918,7 +5127,7 @@ function act() {
4918
5127
  `State projection "${proj.target}" of "${fold.name}" is missing events ${missing.join(", ")} \u2014 pass every partial of the state to .of()`
4919
5128
  );
4920
5129
  const claimed = fold_specs.find((s) => s.target === proj.target);
4921
- if (_optionalChain([claimed, 'optionalAccess', _184 => _184.projection]) === proj) continue;
5130
+ if (_optionalChain([claimed, 'optionalAccess', _188 => _188.projection]) === proj) continue;
4922
5131
  if (batch_handlers.has(proj.target) || claimed)
4923
5132
  throw new Error(
4924
5133
  `Duplicate projection target "${proj.target}" \u2014 a target is served by one batch handler or one state projection, never both`
@@ -4940,7 +5149,7 @@ function act() {
4940
5149
  for (const [name, gate] of built.query_readers) _qg.set(name, gate);
4941
5150
  for (const [name, gate] of built.handler_readers) _hr.set(name, gate);
4942
5151
  finalize_deprecations();
4943
- if (built.advisory) _chunkN74AN6L5cjs.log.call(void 0, ).warn(built.advisory);
5152
+ if (built.advisory) _chunkWDIBO6AWcjs.log.call(void 0, ).warn(built.advisory);
4944
5153
  for (const [name, state2] of states) {
4945
5154
  if (!state2.loads) continue;
4946
5155
  const resolved = {};
@@ -4952,7 +5161,7 @@ function act() {
4952
5161
  `Action "${action2}" loads "${l.state.name}", which is not registered \u2014 add it via withState/withSlice before build()`
4953
5162
  );
4954
5163
  const deprecated = l.events.find(
4955
- (e) => _optionalChain([_de, 'access', _185 => _185.get, 'call', _186 => _186(registered.name), 'optionalAccess', _187 => _187.has, 'call', _188 => _188(e)])
5164
+ (e) => _optionalChain([_de, 'access', _189 => _189.get, 'call', _190 => _190(registered.name), 'optionalAccess', _191 => _191.has, 'call', _192 => _192(e)])
4956
5165
  );
4957
5166
  if (deprecated)
4958
5167
  throw new Error(
@@ -4984,7 +5193,7 @@ function act() {
4984
5193
  synthesize_autoclose_reactions(
4985
5194
  registry,
4986
5195
  states,
4987
- _chunkN74AN6L5cjs.current_autoclose_window
5196
+ _chunkWDIBO6AWcjs.current_autoclose_window
4988
5197
  );
4989
5198
  Object.freeze(registry.actions);
4990
5199
  Object.freeze(registry.events);
@@ -4998,18 +5207,19 @@ function act() {
4998
5207
  options,
4999
5208
  lanes
5000
5209
  );
5001
- },
5210
+ }, "build"),
5002
5211
  events: registry.events
5003
5212
  };
5004
5213
  return builder;
5005
5214
  }
5215
+ _chunkUEGKXCSQcjs.__name.call(void 0, act, "act");
5006
5216
 
5007
5217
  // src/builders/projection-builder.ts
5008
5218
  function _projection(target) {
5009
5219
  const events = {};
5010
5220
  const default_resolver = typeof target === "string" ? { target } : void 0;
5011
5221
  const base = {
5012
- on: (entry) => {
5222
+ on: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (entry) => {
5013
5223
  const keys = Object.keys(entry);
5014
5224
  if (keys.length !== 1) throw new Error(".on() requires exactly one key");
5015
5225
  const event = keys[0];
@@ -5021,7 +5231,7 @@ function _projection(target) {
5021
5231
  };
5022
5232
  }
5023
5233
  return {
5024
- do: (handler) => {
5234
+ do: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (handler) => {
5025
5235
  const widened = base;
5026
5236
  return add_reaction(
5027
5237
  events,
@@ -5032,38 +5242,38 @@ function _projection(target) {
5032
5242
  handler,
5033
5243
  resolver: _nullishCoalesce(default_resolver, () => ( _this_)),
5034
5244
  options: {
5035
- blockOnError: _chunkN74AN6L5cjs.DEFAULT_BLOCK_ON_ERROR,
5036
- maxRetries: _chunkN74AN6L5cjs.DEFAULT_MAX_RETRIES
5245
+ blockOnError: _chunkWDIBO6AWcjs.DEFAULT_BLOCK_ON_ERROR,
5246
+ maxRetries: _chunkWDIBO6AWcjs.DEFAULT_MAX_RETRIES
5037
5247
  }
5038
5248
  }),
5039
5249
  widened
5040
5250
  );
5041
- }
5251
+ }, "do")
5042
5252
  };
5043
- },
5044
- build: () => ({
5253
+ }, "on"),
5254
+ build: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, () => ({
5045
5255
  _tag: "Projection",
5046
5256
  events,
5047
5257
  ...target !== void 0 && { target }
5048
- }),
5258
+ }), "build"),
5049
5259
  events
5050
5260
  };
5051
5261
  if (typeof target === "string") {
5052
5262
  return Object.assign(base, {
5053
- batch: (handler) => ({
5054
- build: () => ({
5263
+ batch: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (handler) => ({
5264
+ build: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, () => ({
5055
5265
  _tag: "Projection",
5056
5266
  events,
5057
5267
  target,
5058
5268
  batchHandler: handler
5059
- })
5060
- }),
5061
- of: (...args) => {
5269
+ }), "build")
5270
+ }), "batch"),
5271
+ of: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (...args) => {
5062
5272
  if (Object.keys(events).length > 0)
5063
5273
  throw new Error(
5064
5274
  `Projection "${target}" mixes .of() with .on() handlers \u2014 a projection either folds a state or declares handlers, never both`
5065
5275
  );
5066
- const is_state = (a) => !!a && typeof a.init === "function";
5276
+ const is_state = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (a) => !!a && typeof a.init === "function", "is_state");
5067
5277
  const partials = args.filter(is_state);
5068
5278
  const options = _nullishCoalesce(args.find((a) => !is_state(a)), () => ( {}));
5069
5279
  if (partials.length === 0)
@@ -5074,7 +5284,7 @@ function _projection(target) {
5074
5284
  throw new Error(
5075
5285
  `Projection "${target}" .of() partials must share one state name \u2014 got "${name}" and "${partial.name}"`
5076
5286
  );
5077
- const config2 = _chunkN74AN6L5cjs.check.call(void 0, "fold", options);
5287
+ const config2 = _chunkWDIBO6AWcjs.check.call(void 0, "fold", options);
5078
5288
  const fold_events = {};
5079
5289
  for (const partial of partials)
5080
5290
  for (const [event_name, schema] of Object.entries(partial.events)) {
@@ -5092,8 +5302,8 @@ function _projection(target) {
5092
5302
  handler: noop,
5093
5303
  resolver: { target },
5094
5304
  options: {
5095
- blockOnError: _chunkN74AN6L5cjs.DEFAULT_BLOCK_ON_ERROR,
5096
- maxRetries: _chunkN74AN6L5cjs.DEFAULT_MAX_RETRIES
5305
+ blockOnError: _chunkWDIBO6AWcjs.DEFAULT_BLOCK_ON_ERROR,
5306
+ maxRetries: _chunkWDIBO6AWcjs.DEFAULT_MAX_RETRIES
5097
5307
  }
5098
5308
  }
5099
5309
  ]
@@ -5101,23 +5311,25 @@ function _projection(target) {
5101
5311
  };
5102
5312
  }
5103
5313
  return {
5104
- flush: (handler) => ({
5105
- build: () => ({
5314
+ flush: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (handler) => ({
5315
+ build: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, () => ({
5106
5316
  _tag: "Projection",
5107
5317
  events: fold_events,
5108
5318
  target,
5109
5319
  fold: { name, flush: handler, config: config2 }
5110
- })
5111
- })
5320
+ }), "build")
5321
+ }), "flush")
5112
5322
  };
5113
- }
5323
+ }, "of")
5114
5324
  });
5115
5325
  }
5116
5326
  return base;
5117
5327
  }
5328
+ _chunkUEGKXCSQcjs.__name.call(void 0, _projection, "_projection");
5118
5329
  function projection(target) {
5119
5330
  return _projection(target);
5120
5331
  }
5332
+ _chunkUEGKXCSQcjs.__name.call(void 0, projection, "projection");
5121
5333
 
5122
5334
  // src/builders/slice-builder.ts
5123
5335
  function slice() {
@@ -5127,30 +5339,31 @@ function slice() {
5127
5339
  const projections = [];
5128
5340
  const lanes = [];
5129
5341
  const builder = {
5130
- withState: (state2) => {
5342
+ withState: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (state2) => {
5131
5343
  register_state(state2, states, actions, events);
5132
5344
  return builder;
5133
- },
5134
- withProjection: (proj) => {
5345
+ }, "withState"),
5346
+ withProjection: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (proj) => {
5135
5347
  projections.push(proj);
5136
5348
  return builder;
5137
- },
5138
- withLane: (config2) => {
5349
+ }, "withProjection"),
5350
+ withLane: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (config2) => {
5139
5351
  register_lane(config2, lanes);
5140
5352
  return builder;
5141
- },
5142
- on: (event) => reaction_on(event, events, builder),
5143
- build: () => ({
5353
+ }, "withLane"),
5354
+ on: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (event) => reaction_on(event, events, builder), "on"),
5355
+ build: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, () => ({
5144
5356
  _tag: "Slice",
5145
5357
  states,
5146
5358
  events,
5147
5359
  projections,
5148
5360
  lanes
5149
- }),
5361
+ }), "build"),
5150
5362
  events
5151
5363
  };
5152
5364
  return builder;
5153
5365
  }
5366
+ _chunkUEGKXCSQcjs.__name.call(void 0, slice, "slice");
5154
5367
 
5155
5368
  // src/builders/state-builder.ts
5156
5369
  function state(entry) {
@@ -5182,8 +5395,8 @@ function state(entry) {
5182
5395
  // `act().build()` flips both on states with `sensitive(...)`
5183
5396
  // events to bake in the gate / split and gate the cache write.
5184
5397
  pii_aware: false,
5185
- view: (event) => event,
5186
- message: (validated) => validated
5398
+ view: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (event) => event, "view"),
5399
+ message: /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (validated) => validated, "message")
5187
5400
  };
5188
5401
  const builder = action_builder(internal);
5189
5402
  return Object.assign(builder, {
@@ -5197,6 +5410,7 @@ function state(entry) {
5197
5410
  }
5198
5411
  };
5199
5412
  }
5413
+ _chunkUEGKXCSQcjs.__name.call(void 0, state, "state");
5200
5414
  function action_builder(state2) {
5201
5415
  const internal = state2;
5202
5416
  const builder = {
@@ -5209,7 +5423,7 @@ function action_builder(state2) {
5209
5423
  throw new Error(`Duplicate action "${action2}"`);
5210
5424
  internal.actions[action2] = schema;
5211
5425
  if (options) {
5212
- _chunkN74AN6L5cjs.check.call(void 0, "action", options);
5426
+ _chunkWDIBO6AWcjs.check.call(void 0, "action", options);
5213
5427
  internal.options ??= {};
5214
5428
  internal.options[action2] = options;
5215
5429
  }
@@ -5233,10 +5447,12 @@ function action_builder(state2) {
5233
5447
  (internal.loads ??= {})[action2] = loads;
5234
5448
  return { loads: load2, requires, emit };
5235
5449
  }
5450
+ _chunkUEGKXCSQcjs.__name.call(void 0, load2, "load");
5236
5451
  function requires(rules) {
5237
5452
  (internal.requires ??= {})[action2] = rules;
5238
5453
  return { emit };
5239
5454
  }
5455
+ _chunkUEGKXCSQcjs.__name.call(void 0, requires, "requires");
5240
5456
  function emit(handler) {
5241
5457
  if (typeof handler === "string") {
5242
5458
  const event_name = handler;
@@ -5252,6 +5468,7 @@ function action_builder(state2) {
5252
5468
  }
5253
5469
  return builder;
5254
5470
  }
5471
+ _chunkUEGKXCSQcjs.__name.call(void 0, emit, "emit");
5255
5472
  return { loads: load2, requires, emit };
5256
5473
  },
5257
5474
  snap(snap2) {
@@ -5302,6 +5519,7 @@ function action_builder(state2) {
5302
5519
  };
5303
5520
  return builder;
5304
5521
  }
5522
+ _chunkUEGKXCSQcjs.__name.call(void 0, action_builder, "action_builder");
5305
5523
 
5306
5524
  // src/csv.ts
5307
5525
  var _fs = require('fs');
@@ -5316,6 +5534,9 @@ var CSV_COLUMNS = [
5316
5534
  "meta"
5317
5535
  ];
5318
5536
  var CsvFile = class {
5537
+ static {
5538
+ _chunkUEGKXCSQcjs.__name.call(void 0, this, "CsvFile");
5539
+ }
5319
5540
 
5320
5541
 
5321
5542
  constructor(options) {
@@ -5409,6 +5630,7 @@ async function* linesFromFile(path) {
5409
5630
  stream.close();
5410
5631
  }
5411
5632
  }
5633
+ _chunkUEGKXCSQcjs.__name.call(void 0, linesFromFile, "linesFromFile");
5412
5634
  async function* linesFromBlob(blob) {
5413
5635
  let start = 0;
5414
5636
  while (start < blob.length) {
@@ -5419,6 +5641,7 @@ async function* linesFromBlob(blob) {
5419
5641
  await Promise.resolve();
5420
5642
  }
5421
5643
  }
5644
+ _chunkUEGKXCSQcjs.__name.call(void 0, linesFromBlob, "linesFromBlob");
5422
5645
  function parse_csv_line(line) {
5423
5646
  const fields = [];
5424
5647
  let i = 0;
@@ -5452,10 +5675,12 @@ function parse_csv_line(line) {
5452
5675
  }
5453
5676
  return fields;
5454
5677
  }
5678
+ _chunkUEGKXCSQcjs.__name.call(void 0, parse_csv_line, "parse_csv_line");
5455
5679
  function csv_escape(value) {
5456
5680
  if (/[",\n\r]/.test(value)) return `"${value.replace(/"/g, '""')}"`;
5457
5681
  return value;
5458
5682
  }
5683
+ _chunkUEGKXCSQcjs.__name.call(void 0, csv_escape, "csv_escape");
5459
5684
  function write_line(writer, line) {
5460
5685
  return new Promise((resolve, reject) => {
5461
5686
  writer.write(`${line}
@@ -5465,33 +5690,39 @@ function write_line(writer, line) {
5465
5690
  });
5466
5691
  });
5467
5692
  }
5693
+ _chunkUEGKXCSQcjs.__name.call(void 0, write_line, "write_line");
5468
5694
 
5469
5695
  // src/deprecated.ts
5470
- var check_appends = _chunkSC6TY4P2cjs.checkAppends;
5471
- var throw_if_stale = _chunkSC6TY4P2cjs.checkVersion;
5472
- var concurrency_error = _chunkSC6TY4P2cjs.concurrencyError;
5473
- var seed_event = _chunkSC6TY4P2cjs.seedEvent;
5474
- var fair_slots = _chunkSC6TY4P2cjs.fairSlots;
5475
- var is_literal_source = _chunkSC6TY4P2cjs.isStreamName;
5476
- var notification_of = _chunkSC6TY4P2cjs.parseNotification;
5477
- var DEFAULT_QUERY_STREAMS_LIMIT2 = _chunkZTHGF62Ocjs.DEFAULT_QUERY_STREAMS_LIMIT;
5478
- var ActorSchema2 = _chunkZTHGF62Ocjs.ActorSchema;
5479
- var TargetSchema2 = _chunkZTHGF62Ocjs.TargetSchema;
5480
- var EventMetaSchema2 = _chunkZTHGF62Ocjs.EventMetaSchema;
5481
- var CausationEventSchema2 = _chunkZTHGF62Ocjs.CausationEventSchema;
5482
- var CommittedMetaSchema2 = _chunkZTHGF62Ocjs.CommittedMetaSchema;
5483
- var QuerySchema2 = _chunkZTHGF62Ocjs.QuerySchema;
5484
- var Environments2 = _chunkZTHGF62Ocjs.Environments;
5485
- var LogLevels2 = _chunkZTHGF62Ocjs.LogLevels;
5486
- var ExitCodes2 = _chunkZTHGF62Ocjs.ExitCodes;
5487
- var DEFAULT_LANE2 = _chunkZTHGF62Ocjs.DEFAULT_LANE;
5488
- var DEFAULT_MAX_SUBSCRIBED_STREAMS2 = _chunkZTHGF62Ocjs.DEFAULT_MAX_SUBSCRIBED_STREAMS;
5489
- var DEFAULT_SETTLE_DEBOUNCE_MS2 = _chunkZTHGF62Ocjs.DEFAULT_SETTLE_DEBOUNCE_MS;
5490
- var PackageSchema = _chunkN74AN6L5cjs.package_schema;
5491
- var default_scope = _chunkN74AN6L5cjs.unscoped_ports;
5492
- var extend = (source, schema, target) => ({ ...target, ..._chunkN74AN6L5cjs.validate.call(void 0, "config", source, schema) });
5696
+ var check_appends = _chunkDCWPJFXRcjs.checkAppends;
5697
+ var throw_if_stale = _chunkDCWPJFXRcjs.checkVersion;
5698
+ var concurrency_error = _chunkDCWPJFXRcjs.concurrencyError;
5699
+ var seed_event = _chunkDCWPJFXRcjs.seedEvent;
5700
+ var fair_slots = _chunkDCWPJFXRcjs.fairSlots;
5701
+ var is_literal_source = _chunkDCWPJFXRcjs.isStreamName;
5702
+ var notification_of = _chunkDCWPJFXRcjs.parseNotification;
5703
+ var DEFAULT_QUERY_STREAMS_LIMIT2 = _chunkUEGKXCSQcjs.DEFAULT_QUERY_STREAMS_LIMIT;
5704
+ var ActorSchema2 = _chunkUEGKXCSQcjs.ActorSchema;
5705
+ var TargetSchema2 = _chunkUEGKXCSQcjs.TargetSchema;
5706
+ var EventMetaSchema2 = _chunkUEGKXCSQcjs.EventMetaSchema;
5707
+ var CausationEventSchema2 = _chunkUEGKXCSQcjs.CausationEventSchema;
5708
+ var CommittedMetaSchema2 = _chunkUEGKXCSQcjs.CommittedMetaSchema;
5709
+ var QuerySchema2 = _chunkUEGKXCSQcjs.QuerySchema;
5710
+ var Environments2 = _chunkUEGKXCSQcjs.Environments;
5711
+ var LogLevels2 = _chunkUEGKXCSQcjs.LogLevels;
5712
+ var ExitCodes2 = _chunkUEGKXCSQcjs.ExitCodes;
5713
+ var DEFAULT_LANE2 = _chunkUEGKXCSQcjs.DEFAULT_LANE;
5714
+ var DEFAULT_MAX_SUBSCRIBED_STREAMS2 = _chunkUEGKXCSQcjs.DEFAULT_MAX_SUBSCRIBED_STREAMS;
5715
+ var DEFAULT_SETTLE_DEBOUNCE_MS2 = _chunkUEGKXCSQcjs.DEFAULT_SETTLE_DEBOUNCE_MS;
5716
+ var PackageSchema = _chunkWDIBO6AWcjs.package_schema;
5717
+ var default_scope = _chunkWDIBO6AWcjs.unscoped_ports;
5718
+ var extend = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (source, schema, target) => ({ ...target, ..._chunkWDIBO6AWcjs.validate.call(void 0, "config", source, schema) }), "extend");
5493
5719
  var ISO_8601 = /^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])T([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])(\.\d+)?(Z|[+-][0-2][0-9]:[0-5][0-9])?$/;
5494
- var dateReviver = (_key, value) => typeof value === "string" && ISO_8601.test(value) ? new Date(value) : value;
5720
+ var dateReviver = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (_key, value) => typeof value === "string" && ISO_8601.test(value) ? new Date(value) : value, "dateReviver");
5721
+ function sensitiveFields(schema) {
5722
+ return Object.keys(pii_schemas(schema));
5723
+ }
5724
+ _chunkUEGKXCSQcjs.__name.call(void 0, sensitiveFields, "sensitiveFields");
5725
+ var pii_fields = sensitiveFields;
5495
5726
 
5496
5727
 
5497
5728
 
@@ -5551,5 +5782,5 @@ var dateReviver = (_key, value) => typeof value === "string" && ISO_8601.test(va
5551
5782
 
5552
5783
 
5553
5784
 
5554
- exports.Act = Act; exports.ActorSchema = ActorSchema2; exports.CausationEventSchema = CausationEventSchema2; exports.CommittedMetaSchema = CommittedMetaSchema2; exports.ConcurrencyError = _chunkZTHGF62Ocjs.ConcurrencyError; exports.ConsoleLogger = _chunkN74AN6L5cjs.ConsoleLogger; exports.CsvFile = CsvFile; exports.DEFAULT_LANE = DEFAULT_LANE2; exports.DEFAULT_MAX_SUBSCRIBED_STREAMS = DEFAULT_MAX_SUBSCRIBED_STREAMS2; exports.DEFAULT_QUERY_STREAMS_LIMIT = DEFAULT_QUERY_STREAMS_LIMIT2; exports.DEFAULT_SETTLE_DEBOUNCE_MS = DEFAULT_SETTLE_DEBOUNCE_MS2; exports.DeferSignal = _chunkZTHGF62Ocjs.DeferSignal; exports.Environments = Environments2; exports.Errors = _chunkZTHGF62Ocjs.Errors; exports.EventMetaSchema = EventMetaSchema2; exports.ExitCodes = ExitCodes2; exports.InMemoryCache = _chunkN74AN6L5cjs.InMemoryCache; exports.InMemoryStore = _chunkN74AN6L5cjs.InMemoryStore; exports.LogLevels = LogLevels2; exports.NonRetryableError = _chunkZTHGF62Ocjs.NonRetryableError; exports.PackageSchema = PackageSchema; exports.PreconditionError = _chunkZTHGF62Ocjs.PreconditionError; exports.QuerySchema = QuerySchema2; exports.REDACTED = _chunkZTHGF62Ocjs.REDACTED; exports.SHREDDED = _chunkZTHGF62Ocjs.SHREDDED; exports.SNAP_EVENT = _chunkZTHGF62Ocjs.SNAP_EVENT; exports.StoreError = _chunkZTHGF62Ocjs.StoreError; exports.StreamClosedError = _chunkZTHGF62Ocjs.StreamClosedError; exports.TOMBSTONE_EVENT = _chunkZTHGF62Ocjs.TOMBSTONE_EVENT; exports.TargetSchema = TargetSchema2; exports.ValidationError = _chunkZTHGF62Ocjs.ValidationError; exports.ZodEmpty = _chunkZTHGF62Ocjs.ZodEmpty; exports.act = act; exports.cache = _chunkN74AN6L5cjs.cache; exports.check_appends = check_appends; exports.concurrency_error = concurrency_error; exports.config = _chunkN74AN6L5cjs.config; exports.dateReviver = dateReviver; exports.default_scope = default_scope; exports.dispose = _chunkN74AN6L5cjs.dispose; exports.disposeAndExit = _chunkN74AN6L5cjs.disposeAndExit; exports.extend = extend; exports.fair_slots = fair_slots; exports.is_literal_source = is_literal_source; exports.log = _chunkN74AN6L5cjs.log; exports.notification_of = notification_of; exports.pii_fields = _chunkZTHGF62Ocjs.pii_fields; exports.port = _chunkN74AN6L5cjs.port; exports.projection = projection; exports.seed_event = seed_event; exports.sensitive = _chunkZTHGF62Ocjs.sensitive; exports.sensitiveFields = _chunkZTHGF62Ocjs.sensitiveFields; exports.sleep = _chunkN74AN6L5cjs.sleep; exports.slice = slice; exports.state = state; exports.store = _chunkN74AN6L5cjs.store; exports.throw_if_stale = throw_if_stale; exports.validate = _chunkN74AN6L5cjs.validate;
5785
+ exports.Act = Act; exports.ActorSchema = ActorSchema2; exports.CausationEventSchema = CausationEventSchema2; exports.CommittedMetaSchema = CommittedMetaSchema2; exports.ConcurrencyError = _chunkUEGKXCSQcjs.ConcurrencyError; exports.ConsoleLogger = _chunkWDIBO6AWcjs.ConsoleLogger; exports.CsvFile = CsvFile; exports.DEFAULT_LANE = DEFAULT_LANE2; exports.DEFAULT_MAX_SUBSCRIBED_STREAMS = DEFAULT_MAX_SUBSCRIBED_STREAMS2; exports.DEFAULT_QUERY_STREAMS_LIMIT = DEFAULT_QUERY_STREAMS_LIMIT2; exports.DEFAULT_SETTLE_DEBOUNCE_MS = DEFAULT_SETTLE_DEBOUNCE_MS2; exports.DeferSignal = _chunkUEGKXCSQcjs.DeferSignal; exports.Environments = Environments2; exports.Errors = _chunkUEGKXCSQcjs.Errors; exports.EventMetaSchema = EventMetaSchema2; exports.ExitCodes = ExitCodes2; exports.InMemoryCache = _chunkWDIBO6AWcjs.InMemoryCache; exports.InMemoryStore = _chunkWDIBO6AWcjs.InMemoryStore; exports.LogLevels = LogLevels2; exports.NonRetryableError = _chunkUEGKXCSQcjs.NonRetryableError; exports.PackageSchema = PackageSchema; exports.PreconditionError = _chunkUEGKXCSQcjs.PreconditionError; exports.QuerySchema = QuerySchema2; exports.REDACTED = _chunkUEGKXCSQcjs.REDACTED; exports.SHREDDED = _chunkUEGKXCSQcjs.SHREDDED; exports.SNAP_EVENT = _chunkUEGKXCSQcjs.SNAP_EVENT; exports.StoreError = _chunkUEGKXCSQcjs.StoreError; exports.StreamClosedError = _chunkUEGKXCSQcjs.StreamClosedError; exports.TOMBSTONE_EVENT = _chunkUEGKXCSQcjs.TOMBSTONE_EVENT; exports.TargetSchema = TargetSchema2; exports.ValidationError = _chunkUEGKXCSQcjs.ValidationError; exports.ZodEmpty = _chunkUEGKXCSQcjs.ZodEmpty; exports.act = act; exports.cache = _chunkWDIBO6AWcjs.cache; exports.check_appends = check_appends; exports.concurrency_error = concurrency_error; exports.config = _chunkWDIBO6AWcjs.config; exports.dateReviver = dateReviver; exports.default_scope = default_scope; exports.dispose = _chunkWDIBO6AWcjs.dispose; exports.disposeAndExit = _chunkWDIBO6AWcjs.disposeAndExit; exports.extend = extend; exports.fair_slots = fair_slots; exports.is_literal_source = is_literal_source; exports.log = _chunkWDIBO6AWcjs.log; exports.notification_of = notification_of; exports.pii_fields = pii_fields; exports.port = _chunkWDIBO6AWcjs.port; exports.projection = projection; exports.seed_event = seed_event; exports.sensitive = _chunkUEGKXCSQcjs.sensitive; exports.sensitiveFields = sensitiveFields; exports.sleep = _chunkWDIBO6AWcjs.sleep; exports.slice = slice; exports.state = state; exports.store = _chunkWDIBO6AWcjs.store; exports.throw_if_stale = throw_if_stale; exports.validate = _chunkWDIBO6AWcjs.validate;
5555
5786
  //# sourceMappingURL=index.cjs.map