@rotorsoft/act 1.10.0 → 1.10.1

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 (55) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/@types/act.d.ts +12 -12
  3. package/dist/@types/act.d.ts.map +1 -1
  4. package/dist/@types/adapters/console-logger.d.ts +2 -2
  5. package/dist/@types/adapters/console-logger.d.ts.map +1 -1
  6. package/dist/@types/adapters/in-memory-store.d.ts +6 -6
  7. package/dist/@types/adapters/in-memory-store.d.ts.map +1 -1
  8. package/dist/@types/builders/state-builder.d.ts +2 -2
  9. package/dist/@types/builders/state-builder.d.ts.map +1 -1
  10. package/dist/@types/internal/audit.d.ts +4 -4
  11. package/dist/@types/internal/audit.d.ts.map +1 -1
  12. package/dist/@types/internal/backoff.d.ts +1 -1
  13. package/dist/@types/internal/backoff.d.ts.map +1 -1
  14. package/dist/@types/internal/build-classify.d.ts +11 -11
  15. package/dist/@types/internal/build-classify.d.ts.map +1 -1
  16. package/dist/@types/internal/close-cycle.d.ts +3 -3
  17. package/dist/@types/internal/close-cycle.d.ts.map +1 -1
  18. package/dist/@types/internal/correlate-cycle.d.ts +4 -4
  19. package/dist/@types/internal/correlate-cycle.d.ts.map +1 -1
  20. package/dist/@types/internal/correlator.d.ts +2 -2
  21. package/dist/@types/internal/correlator.d.ts.map +1 -1
  22. package/dist/@types/internal/drain-cycle.d.ts +20 -20
  23. package/dist/@types/internal/drain-cycle.d.ts.map +1 -1
  24. package/dist/@types/internal/drain-ratio.d.ts +1 -1
  25. package/dist/@types/internal/drain-ratio.d.ts.map +1 -1
  26. package/dist/@types/internal/event-sourcing.d.ts +2 -2
  27. package/dist/@types/internal/event-sourcing.d.ts.map +1 -1
  28. package/dist/@types/internal/event-versions.d.ts +2 -2
  29. package/dist/@types/internal/event-versions.d.ts.map +1 -1
  30. package/dist/@types/internal/index.d.ts +7 -7
  31. package/dist/@types/internal/index.d.ts.map +1 -1
  32. package/dist/@types/internal/merge.d.ts +3 -3
  33. package/dist/@types/internal/merge.d.ts.map +1 -1
  34. package/dist/@types/internal/reactions.d.ts +6 -6
  35. package/dist/@types/internal/reactions.d.ts.map +1 -1
  36. package/dist/@types/internal/sensitive.d.ts +2 -2
  37. package/dist/@types/internal/settle.d.ts +3 -3
  38. package/dist/@types/internal/settle.d.ts.map +1 -1
  39. package/dist/@types/internal/tracing.d.ts +5 -5
  40. package/dist/@types/internal/tracing.d.ts.map +1 -1
  41. package/dist/{chunk-3ZTFNAY7.js → chunk-3Z2HU726.js} +134 -133
  42. package/dist/chunk-3Z2HU726.js.map +1 -0
  43. package/dist/{chunk-XSBT63QX.js → chunk-BY5JPOZR.js} +1 -1
  44. package/dist/{chunk-XSBT63QX.js.map → chunk-BY5JPOZR.js.map} +1 -1
  45. package/dist/index.cjs +558 -552
  46. package/dist/index.cjs.map +1 -1
  47. package/dist/index.js +428 -423
  48. package/dist/index.js.map +1 -1
  49. package/dist/test/index.cjs +132 -131
  50. package/dist/test/index.cjs.map +1 -1
  51. package/dist/test/index.js +2 -2
  52. package/dist/types/index.cjs.map +1 -1
  53. package/dist/types/index.js +1 -1
  54. package/package.json +3 -3
  55. package/dist/chunk-3ZTFNAY7.js.map +0 -1
@@ -3,7 +3,7 @@ import {
3
3
  Environments,
4
4
  LogLevels,
5
5
  ValidationError
6
- } from "./chunk-XSBT63QX.js";
6
+ } from "./chunk-BY5JPOZR.js";
7
7
 
8
8
  // src/adapters/console-logger.ts
9
9
  var LEVEL_VALUES = {
@@ -49,7 +49,7 @@ var ConsoleLogger = class _ConsoleLogger {
49
49
  this._pretty = pretty;
50
50
  this.level = level;
51
51
  const threshold = LEVEL_VALUES[level] ?? 30;
52
- const write = pretty ? this._prettyWrite.bind(this, bindings) : this._jsonWrite.bind(this, bindings);
52
+ const write = pretty ? this._pretty_write.bind(this, bindings) : this._json_write.bind(this, bindings);
53
53
  this.fatal = write.bind(this, "fatal", 60);
54
54
  this.error = threshold <= 50 ? write.bind(this, "error", 50) : noop;
55
55
  this.warn = threshold <= 40 ? write.bind(this, "warn", 40) : noop;
@@ -68,24 +68,24 @@ var ConsoleLogger = class _ConsoleLogger {
68
68
  bindings
69
69
  });
70
70
  }
71
- _jsonWrite(bindings, level, _num, objOrMsg, msg) {
71
+ _json_write(bindings, level, _num, obj_or_msg, msg) {
72
72
  let obj;
73
73
  let message;
74
- if (typeof objOrMsg === "string") {
75
- message = objOrMsg;
74
+ if (typeof obj_or_msg === "string") {
75
+ message = obj_or_msg;
76
76
  obj = {};
77
- } else if (objOrMsg instanceof Error) {
78
- message = msg ?? objOrMsg.message;
77
+ } else if (obj_or_msg instanceof Error) {
78
+ message = msg ?? obj_or_msg.message;
79
79
  obj = {
80
- error: { message: objOrMsg.message, name: objOrMsg.name },
81
- stack: objOrMsg.stack
80
+ error: { message: obj_or_msg.message, name: obj_or_msg.name },
81
+ stack: obj_or_msg.stack
82
82
  };
83
- } else if (objOrMsg !== null && typeof objOrMsg === "object") {
83
+ } else if (obj_or_msg !== null && typeof obj_or_msg === "object") {
84
84
  message = msg;
85
- obj = { ...objOrMsg };
85
+ obj = { ...obj_or_msg };
86
86
  } else {
87
87
  message = msg;
88
- obj = { value: objOrMsg };
88
+ obj = { value: obj_or_msg };
89
89
  }
90
90
  const entry = Object.assign({ level, time: Date.now() }, bindings, obj);
91
91
  if (message) entry.msg = message;
@@ -102,29 +102,29 @@ var ConsoleLogger = class _ConsoleLogger {
102
102
  }
103
103
  process.stdout.write(line + "\n");
104
104
  }
105
- _prettyWrite(bindings, level, _num, objOrMsg, msg) {
105
+ _pretty_write(bindings, level, _num, obj_or_msg, msg) {
106
106
  const color = LEVEL_COLORS[level];
107
107
  const tag = `${color}${level.toUpperCase().padEnd(5)}${RESET}`;
108
108
  const ts = (/* @__PURE__ */ new Date()).toISOString().slice(11, 23);
109
109
  let message;
110
110
  let data;
111
- if (typeof objOrMsg === "string") {
112
- message = objOrMsg;
113
- } else if (objOrMsg instanceof Error) {
114
- message = msg ?? objOrMsg.message;
115
- data = objOrMsg.stack;
111
+ if (typeof obj_or_msg === "string") {
112
+ message = obj_or_msg;
113
+ } else if (obj_or_msg instanceof Error) {
114
+ message = msg ?? obj_or_msg.message;
115
+ data = obj_or_msg.stack;
116
116
  } else {
117
117
  message = msg ?? "";
118
- if (objOrMsg !== void 0 && objOrMsg !== null) {
118
+ if (obj_or_msg !== void 0 && obj_or_msg !== null) {
119
119
  try {
120
- data = JSON.stringify(objOrMsg);
120
+ data = JSON.stringify(obj_or_msg);
121
121
  } catch {
122
122
  data = "[unserializable]";
123
123
  }
124
124
  }
125
125
  }
126
- const bindStr = bindings && Object.keys(bindings).length ? ` ${JSON.stringify(bindings)}` : "";
127
- const parts = [ts, tag, message, data, bindStr].filter(Boolean);
126
+ const bind_str = bindings && Object.keys(bindings).length ? ` ${JSON.stringify(bindings)}` : "";
127
+ const parts = [ts, tag, message, data, bind_str].filter(Boolean);
128
128
  process.stdout.write(parts.join(" ") + "\n");
129
129
  }
130
130
  };
@@ -280,14 +280,14 @@ var InMemoryStream = class {
280
280
  * Bump the priority via {@link subscribe}: keeps the maximum across
281
281
  * reactions so the highest-priority registrant wins.
282
282
  */
283
- bumpPriority(priority) {
283
+ bump_priority(priority) {
284
284
  if (priority > this._priority) this._priority = priority;
285
285
  }
286
286
  /**
287
287
  * Set the priority outright via {@link prioritize}: operator
288
288
  * runtime override that ignores the build-time `max()` invariant.
289
289
  */
290
- setPriority(priority) {
290
+ set_priority(priority) {
291
291
  this._priority = priority;
292
292
  }
293
293
  get is_available() {
@@ -409,28 +409,28 @@ var InMemoryStore = class {
409
409
  // stored stream positions and other metadata
410
410
  _streams = /* @__PURE__ */ new Map();
411
411
  // last committed version per stream — O(1) replacement for filter-on-commit
412
- _streamVersions = /* @__PURE__ */ new Map();
412
+ _stream_versions = /* @__PURE__ */ new Map();
413
413
  // max non-snapshot event id per stream — drives the source-pattern probe in claim()
414
414
  // without scanning the full event log.
415
- _maxEventIdByStream = /* @__PURE__ */ new Map();
415
+ _max_event_id_by_stream = /* @__PURE__ */ new Map();
416
416
  // global max non-snapshot event id — fast pre-check for source-less streams in claim()
417
- _maxNonSnapEventId = -1;
417
+ _max_non_snap_event_id = -1;
418
418
  // stream → (event_id → cloned sensitive payload). Two-level so `forget_pii`
419
419
  // is O(1) — drop the inner Map for the stream and the wipe is done — mirroring
420
420
  // the `DELETE WHERE stream = ?` scope that durable adapters get from their
421
421
  // stream index. Entries exist only for events committed with a non-null
422
422
  // `pii` field; absence means "no PII" (returned as `null` on load).
423
423
  _pii = /* @__PURE__ */ new Map();
424
- _resetIndexes() {
424
+ _reset_indexes() {
425
425
  this._events.length = 0;
426
- this._streamVersions.clear();
427
- this._maxEventIdByStream.clear();
428
- this._maxNonSnapEventId = -1;
426
+ this._stream_versions.clear();
427
+ this._max_event_id_by_stream.clear();
428
+ this._max_non_snap_event_id = -1;
429
429
  this._pii.clear();
430
430
  }
431
431
  // Attach the isolated PII payload (or null) to an event before handing it to
432
432
  // a caller. Allocation-free for events without PII — by far the common case.
433
- _withPii(e) {
433
+ _with_pii(e) {
434
434
  const pii = this._pii.get(e.stream)?.get(e.id);
435
435
  return pii ? { ...e, pii } : e;
436
436
  }
@@ -440,7 +440,7 @@ var InMemoryStore = class {
440
440
  */
441
441
  async dispose() {
442
442
  await sleep();
443
- this._resetIndexes();
443
+ this._reset_indexes();
444
444
  }
445
445
  /**
446
446
  * Seed the store with initial data (no-op for in-memory).
@@ -455,7 +455,7 @@ var InMemoryStore = class {
455
455
  */
456
456
  async drop() {
457
457
  await sleep();
458
- this._resetIndexes();
458
+ this._reset_indexes();
459
459
  this._streams = /* @__PURE__ */ new Map();
460
460
  }
461
461
  in_query(query, e) {
@@ -489,7 +489,7 @@ var InMemoryStore = class {
489
489
  if (query.after && e.id <= query.after) break;
490
490
  if (query.created_after && e.created <= query.created_after) break;
491
491
  await Promise.resolve(
492
- callback(this._withPii(e))
492
+ callback(this._with_pii(e))
493
493
  );
494
494
  count++;
495
495
  if (query?.limit && count >= query.limit) break;
@@ -503,7 +503,7 @@ var InMemoryStore = class {
503
503
  if (query?.before && e.id >= query.before) break;
504
504
  if (query?.created_before && e.created >= query.created_before) break;
505
505
  await Promise.resolve(
506
- callback(this._withPii(e))
506
+ callback(this._with_pii(e))
507
507
  );
508
508
  count++;
509
509
  if (query?.limit && count >= query.limit) break;
@@ -522,17 +522,17 @@ var InMemoryStore = class {
522
522
  */
523
523
  async commit(stream, msgs, meta, expectedVersion) {
524
524
  await sleep();
525
- const currentVersion = this._streamVersions.get(stream) ?? -1;
526
- if (typeof expectedVersion === "number" && currentVersion !== expectedVersion) {
525
+ const current_version = this._stream_versions.get(stream) ?? -1;
526
+ if (typeof expectedVersion === "number" && current_version !== expectedVersion) {
527
527
  throw new ConcurrencyError(
528
528
  stream,
529
- currentVersion,
529
+ current_version,
530
530
  msgs,
531
531
  expectedVersion
532
532
  );
533
533
  }
534
- let version = currentVersion + 1;
535
- let lastNonSnapId = -1;
534
+ let version = current_version + 1;
535
+ let last_non_snap_id = -1;
536
536
  const committed = msgs.map(({ name, data, pii }) => {
537
537
  const c = {
538
538
  id: this._events.length,
@@ -545,21 +545,21 @@ var InMemoryStore = class {
545
545
  };
546
546
  this._events.push(c);
547
547
  if (pii != null) {
548
- let perStream = this._pii.get(stream);
549
- if (!perStream) {
550
- perStream = /* @__PURE__ */ new Map();
551
- this._pii.set(stream, perStream);
548
+ let per_stream = this._pii.get(stream);
549
+ if (!per_stream) {
550
+ per_stream = /* @__PURE__ */ new Map();
551
+ this._pii.set(stream, per_stream);
552
552
  }
553
- perStream.set(c.id, structuredClone(pii));
553
+ per_stream.set(c.id, structuredClone(pii));
554
554
  }
555
- if (name !== SNAP_EVENT) lastNonSnapId = c.id;
555
+ if (name !== SNAP_EVENT) last_non_snap_id = c.id;
556
556
  version++;
557
- return this._withPii(c);
557
+ return this._with_pii(c);
558
558
  });
559
- this._streamVersions.set(stream, version - 1);
560
- if (lastNonSnapId >= 0) {
561
- this._maxEventIdByStream.set(stream, lastNonSnapId);
562
- this._maxNonSnapEventId = lastNonSnapId;
559
+ this._stream_versions.set(stream, version - 1);
560
+ if (last_non_snap_id >= 0) {
561
+ this._max_event_id_by_stream.set(stream, last_non_snap_id);
562
+ this._max_non_snap_event_id = last_non_snap_id;
563
563
  }
564
564
  return committed;
565
565
  }
@@ -574,26 +574,26 @@ var InMemoryStore = class {
574
574
  */
575
575
  async claim(lagging, leading, by, millis, lane) {
576
576
  await sleep();
577
- const sourceRegex = /* @__PURE__ */ new Map();
578
- const getRegex = (source) => {
579
- let re = sourceRegex.get(source);
577
+ const source_regex = /* @__PURE__ */ new Map();
578
+ const get_regex = (source) => {
579
+ let re = source_regex.get(source);
580
580
  if (!re) {
581
581
  re = new RegExp(source);
582
- sourceRegex.set(source, re);
582
+ source_regex.set(source, re);
583
583
  }
584
584
  return re;
585
585
  };
586
- const hasWork = (s) => {
586
+ const has_work = (s) => {
587
587
  if (s.at < 0) return true;
588
- if (!s.source) return s.at < this._maxNonSnapEventId;
589
- const re = getRegex(s.source);
590
- for (const [streamName, maxId] of this._maxEventIdByStream) {
591
- if (maxId > s.at && re.test(streamName)) return true;
588
+ if (!s.source) return s.at < this._max_non_snap_event_id;
589
+ const re = get_regex(s.source);
590
+ for (const [stream_name, maxId] of this._max_event_id_by_stream) {
591
+ if (maxId > s.at && re.test(stream_name)) return true;
592
592
  }
593
593
  return false;
594
594
  };
595
595
  const available = [...this._streams.values()].filter(
596
- (s) => s.is_available && hasWork(s) && (lane === void 0 || s.lane === lane)
596
+ (s) => s.is_available && has_work(s) && (lane === void 0 || s.lane === lane)
597
597
  );
598
598
  const lag = available.sort((a, b) => b.priority - a.priority || a.at - b.at).slice(0, lagging).map((s) => ({
599
599
  stream: s.stream,
@@ -637,7 +637,7 @@ var InMemoryStore = class {
637
637
  } of streams) {
638
638
  const existing = this._streams.get(stream);
639
639
  if (existing) {
640
- existing.bumpPriority(priority);
640
+ existing.bump_priority(priority);
641
641
  existing.lane = lane;
642
642
  } else {
643
643
  this._streams.set(
@@ -675,17 +675,17 @@ var InMemoryStore = class {
675
675
  * cached in the closure so callers can apply it across the streams
676
676
  * map without re-compiling per iteration.
677
677
  */
678
- _filterPredicate(filter) {
679
- const streamRe = filter.stream && !filter.stream_exact ? new RegExp(filter.stream) : void 0;
680
- const sourceRe = filter.source && !filter.source_exact ? new RegExp(filter.source) : void 0;
678
+ _filter_predicate(filter) {
679
+ const stream_re = filter.stream && !filter.stream_exact ? new RegExp(filter.stream) : void 0;
680
+ const source_re = filter.source && !filter.source_exact ? new RegExp(filter.source) : void 0;
681
681
  return (s) => {
682
682
  if (filter.stream !== void 0) {
683
- if (filter.stream_exact ? s.stream !== filter.stream : !streamRe.test(s.stream))
683
+ if (filter.stream_exact ? s.stream !== filter.stream : !stream_re.test(s.stream))
684
684
  return false;
685
685
  }
686
686
  if (filter.source !== void 0) {
687
687
  if (s.source === void 0) return false;
688
- if (filter.source_exact ? s.source !== filter.source : !sourceRe.test(s.source))
688
+ if (filter.source_exact ? s.source !== filter.source : !source_re.test(s.source))
689
689
  return false;
690
690
  }
691
691
  if (filter.blocked !== void 0 && s.blocked !== filter.blocked)
@@ -714,7 +714,7 @@ var InMemoryStore = class {
714
714
  }
715
715
  }
716
716
  } else {
717
- const matches = this._filterPredicate(input);
717
+ const matches = this._filter_predicate(input);
718
718
  for (const s of this._streams.values()) {
719
719
  if (matches(s)) {
720
720
  s.reset();
@@ -759,7 +759,7 @@ var InMemoryStore = class {
759
759
  if (s?.unblock()) count++;
760
760
  }
761
761
  } else {
762
- const matches = this._filterPredicate({ ...input, blocked: true });
762
+ const matches = this._filter_predicate({ ...input, blocked: true });
763
763
  for (const s of this._streams.values()) {
764
764
  if (matches(s) && s.unblock()) count++;
765
765
  }
@@ -777,12 +777,12 @@ var InMemoryStore = class {
777
777
  */
778
778
  async prioritize(filter, priority) {
779
779
  await sleep();
780
- const matches = this._filterPredicate(filter);
780
+ const matches = this._filter_predicate(filter);
781
781
  let count = 0;
782
782
  for (const s of this._streams.values()) {
783
783
  if (!matches(s)) continue;
784
784
  if (s.priority !== priority) {
785
- s.setPriority(priority);
785
+ s.set_priority(priority);
786
786
  count++;
787
787
  }
788
788
  }
@@ -798,8 +798,8 @@ var InMemoryStore = class {
798
798
  const limit = query?.limit ?? 100;
799
799
  const after = query?.after;
800
800
  const blocked = query?.blocked;
801
- const streamRe = query?.stream && !query.stream_exact ? new RegExp(query.stream) : void 0;
802
- const sourceRe = query?.source && !query.source_exact ? new RegExp(query.source) : void 0;
801
+ const stream_re = query?.stream && !query.stream_exact ? new RegExp(query.stream) : void 0;
802
+ const source_re = query?.source && !query.source_exact ? new RegExp(query.source) : void 0;
803
803
  const sorted = [...this._streams.values()].sort(
804
804
  (a, b) => a.stream.localeCompare(b.stream)
805
805
  );
@@ -807,12 +807,12 @@ var InMemoryStore = class {
807
807
  for (const s of sorted) {
808
808
  if (after !== void 0 && s.stream <= after) continue;
809
809
  if (query?.stream !== void 0) {
810
- if (query.stream_exact ? s.stream !== query.stream : !streamRe.test(s.stream))
810
+ if (query.stream_exact ? s.stream !== query.stream : !stream_re.test(s.stream))
811
811
  continue;
812
812
  }
813
813
  if (query?.source !== void 0) {
814
814
  if (s.source === void 0) continue;
815
- if (query.source_exact ? s.source !== query.source : !sourceRe.test(s.source))
815
+ if (query.source_exact ? s.source !== query.source : !source_re.test(s.source))
816
816
  continue;
817
817
  }
818
818
  if (blocked !== void 0 && s.blocked !== blocked) continue;
@@ -853,44 +853,44 @@ var InMemoryStore = class {
853
853
  async query_stats(input, options) {
854
854
  await sleep();
855
855
  const exclude = new Set(options?.exclude ?? []);
856
- const wantTail = options?.tail ?? false;
857
- const wantCount = options?.count ?? false;
858
- const wantNames = options?.names ?? false;
856
+ const want_tail = options?.tail ?? false;
857
+ const want_count = options?.count ?? false;
858
+ const want_names = options?.names ?? false;
859
859
  const before = options?.before;
860
- const arrayTargets = Array.isArray(input) ? new Set(input) : null;
860
+ const array_targets = Array.isArray(input) ? new Set(input) : null;
861
861
  const filter = Array.isArray(input) ? null : input;
862
- const streamRe = filter?.stream && !filter.stream_exact ? new RegExp(filter.stream) : void 0;
863
- const scopeCache = /* @__PURE__ */ new Map();
864
- const inScope = (stream) => {
865
- const cached = scopeCache.get(stream);
862
+ const stream_re = filter?.stream && !filter.stream_exact ? new RegExp(filter.stream) : void 0;
863
+ const scope_cache = /* @__PURE__ */ new Map();
864
+ const in_scope = (stream) => {
865
+ const cached = scope_cache.get(stream);
866
866
  if (cached !== void 0) return cached;
867
867
  let ok = true;
868
- if (arrayTargets) {
869
- ok = arrayTargets.has(stream);
868
+ if (array_targets) {
869
+ ok = array_targets.has(stream);
870
870
  } else if (filter?.stream !== void 0) {
871
871
  ok = filter.stream_exact ? stream === filter.stream : (
872
- // biome-ignore lint/style/noNonNullAssertion: streamRe set when stream is regex
873
- streamRe.test(stream)
872
+ // biome-ignore lint/style/noNonNullAssertion: stream_re set when stream is regex
873
+ stream_re.test(stream)
874
874
  );
875
875
  }
876
- scopeCache.set(stream, ok);
876
+ scope_cache.set(stream, ok);
877
877
  return ok;
878
878
  };
879
879
  const acc = /* @__PURE__ */ new Map();
880
880
  for (const e of this._events) {
881
881
  if (before !== void 0 && e.id >= before) continue;
882
- if (!inScope(e.stream)) continue;
882
+ if (!in_scope(e.stream)) continue;
883
883
  if (exclude.has(e.name)) continue;
884
884
  let a = acc.get(e.stream);
885
885
  if (!a) {
886
886
  a = { head: e, count: 0 };
887
- if (wantTail) a.tail = e;
888
- if (wantNames) a.names = {};
887
+ if (want_tail) a.tail = e;
888
+ if (want_names) a.names = {};
889
889
  acc.set(e.stream, a);
890
890
  }
891
891
  a.head = e;
892
892
  a.count++;
893
- if (wantNames) {
893
+ if (want_names) {
894
894
  const n = String(e.name);
895
895
  a.names[n] = (a.names[n] ?? 0) + 1;
896
896
  }
@@ -898,9 +898,9 @@ var InMemoryStore = class {
898
898
  const out = /* @__PURE__ */ new Map();
899
899
  for (const [stream, a] of acc) {
900
900
  const stats = { head: a.head };
901
- if (wantTail) stats.tail = a.tail;
902
- if (wantCount) stats.count = a.count;
903
- if (wantNames) stats.names = a.names;
901
+ if (want_tail) stats.tail = a.tail;
902
+ if (want_count) stats.count = a.count;
903
+ if (want_names) stats.names = a.names;
904
904
  out.set(stream, stats);
905
905
  }
906
906
  return out;
@@ -912,18 +912,18 @@ var InMemoryStore = class {
912
912
  */
913
913
  async truncate(targets) {
914
914
  await sleep();
915
- const deletedCounts = /* @__PURE__ */ new Map();
916
- const streamSet = new Set(targets.map((t) => t.stream));
915
+ const deleted_counts = /* @__PURE__ */ new Map();
916
+ const stream_set = new Set(targets.map((t) => t.stream));
917
917
  for (const e of this._events) {
918
- if (streamSet.has(e.stream)) {
919
- deletedCounts.set(e.stream, (deletedCounts.get(e.stream) ?? 0) + 1);
918
+ if (stream_set.has(e.stream)) {
919
+ deleted_counts.set(e.stream, (deleted_counts.get(e.stream) ?? 0) + 1);
920
920
  }
921
921
  }
922
- this._events = this._events.filter((e) => !streamSet.has(e.stream));
923
- for (const stream of streamSet) {
922
+ this._events = this._events.filter((e) => !stream_set.has(e.stream));
923
+ for (const stream of stream_set) {
924
924
  this._streams.delete(stream);
925
- this._streamVersions.delete(stream);
926
- this._maxEventIdByStream.delete(stream);
925
+ this._stream_versions.delete(stream);
926
+ this._max_event_id_by_stream.delete(stream);
927
927
  }
928
928
  const result = /* @__PURE__ */ new Map();
929
929
  for (const { stream, snapshot, meta } of targets) {
@@ -937,18 +937,19 @@ var InMemoryStore = class {
937
937
  meta: meta ?? { correlation: "", causation: {} }
938
938
  };
939
939
  this._events.push(event);
940
- this._streamVersions.set(stream, 0);
940
+ this._stream_versions.set(stream, 0);
941
941
  if (event.name !== SNAP_EVENT) {
942
- this._maxEventIdByStream.set(stream, event.id);
942
+ this._max_event_id_by_stream.set(stream, event.id);
943
943
  }
944
944
  result.set(stream, {
945
- deleted: deletedCounts.get(stream) ?? 0,
945
+ deleted: deleted_counts.get(stream) ?? 0,
946
946
  committed: event
947
947
  });
948
948
  }
949
949
  let max = -1;
950
- for (const id of this._maxEventIdByStream.values()) if (id > max) max = id;
951
- this._maxNonSnapEventId = max;
950
+ for (const id of this._max_event_id_by_stream.values())
951
+ if (id > max) max = id;
952
+ this._max_non_snap_event_id = max;
952
953
  return result;
953
954
  }
954
955
  /**
@@ -965,34 +966,34 @@ var InMemoryStore = class {
965
966
  */
966
967
  async restore(driver) {
967
968
  await sleep();
968
- const prevEvents = this._events;
969
- const prevStreams = this._streams;
970
- const prevStreamVersions = this._streamVersions;
971
- const prevMaxEventIdByStream = this._maxEventIdByStream;
972
- const prevMaxNonSnapEventId = this._maxNonSnapEventId;
969
+ const prev_events = this._events;
970
+ const prev_streams = this._streams;
971
+ const prev_stream_versions = this._stream_versions;
972
+ const prev_max_event_id_by_stream = this._max_event_id_by_stream;
973
+ const prev_max_non_snap_event_id = this._max_non_snap_event_id;
973
974
  this._events = [];
974
975
  this._streams = /* @__PURE__ */ new Map();
975
- this._streamVersions = /* @__PURE__ */ new Map();
976
- this._maxEventIdByStream = /* @__PURE__ */ new Map();
977
- this._maxNonSnapEventId = -1;
976
+ this._stream_versions = /* @__PURE__ */ new Map();
977
+ this._max_event_id_by_stream = /* @__PURE__ */ new Map();
978
+ this._max_non_snap_event_id = -1;
978
979
  try {
979
980
  await driver(async (event) => {
980
981
  const id = this._events.length;
981
982
  const committed = { ...event, id };
982
983
  this._events.push(committed);
983
- this._streamVersions.set(event.stream, event.version);
984
+ this._stream_versions.set(event.stream, event.version);
984
985
  if (event.name !== SNAP_EVENT) {
985
- this._maxEventIdByStream.set(event.stream, id);
986
- this._maxNonSnapEventId = id;
986
+ this._max_event_id_by_stream.set(event.stream, id);
987
+ this._max_non_snap_event_id = id;
987
988
  }
988
989
  return id;
989
990
  });
990
991
  } catch (err) {
991
- this._events = prevEvents;
992
- this._streams = prevStreams;
993
- this._streamVersions = prevStreamVersions;
994
- this._maxEventIdByStream = prevMaxEventIdByStream;
995
- this._maxNonSnapEventId = prevMaxNonSnapEventId;
992
+ this._events = prev_events;
993
+ this._streams = prev_streams;
994
+ this._stream_versions = prev_stream_versions;
995
+ this._max_event_id_by_stream = prev_max_event_id_by_stream;
996
+ this._max_non_snap_event_id = prev_max_non_snap_event_id;
996
997
  throw err;
997
998
  }
998
999
  }
@@ -1071,16 +1072,16 @@ var FALLBACK_PACKAGE = {
1071
1072
  version: "0.0.0-fallback",
1072
1073
  description: "Synthetic fallback \u2014 package.json could not be loaded"
1073
1074
  };
1074
- var getPackage = () => {
1075
+ var get_package = () => {
1075
1076
  try {
1076
1077
  const raw = fs.readFileSync("package.json");
1077
1078
  return JSON.parse(raw.toString());
1078
1079
  } catch (err) {
1079
- pkgLoadError = err;
1080
+ pkg_load_error = err;
1080
1081
  return FALLBACK_PACKAGE;
1081
1082
  }
1082
1083
  };
1083
- var pkgLoadError;
1084
+ var pkg_load_error;
1084
1085
  var BaseSchema = PackageSchema.extend({
1085
1086
  env: z.enum(Environments),
1086
1087
  logLevel: z.enum(LogLevels),
@@ -1092,7 +1093,7 @@ var env = NODE_ENV || "development";
1092
1093
  var logLevel = LOG_LEVEL || (NODE_ENV === "test" ? "fatal" : NODE_ENV === "production" ? "info" : "trace");
1093
1094
  var logSingleLine = (LOG_SINGLE_LINE || "true") === "true";
1094
1095
  var sleepMs = parseInt(NODE_ENV === "test" ? "0" : SLEEP_MS ?? "100", 10);
1095
- var pkg = getPackage();
1096
+ var pkg = get_package();
1096
1097
  var _validated;
1097
1098
  var config = () => {
1098
1099
  if (!_validated) {
@@ -1100,12 +1101,12 @@ var config = () => {
1100
1101
  { ...pkg, env, logLevel, logSingleLine, sleepMs },
1101
1102
  BaseSchema
1102
1103
  );
1103
- if (pkgLoadError) {
1104
- const msg = pkgLoadError instanceof Error ? pkgLoadError.message : typeof pkgLoadError === "string" ? pkgLoadError : "unknown error";
1104
+ if (pkg_load_error) {
1105
+ const msg = pkg_load_error instanceof Error ? pkg_load_error.message : typeof pkg_load_error === "string" ? pkg_load_error : "unknown error";
1105
1106
  log().warn(
1106
1107
  `[act] Could not read package.json (${msg}); using synthetic name="${FALLBACK_PACKAGE.name}" version="${FALLBACK_PACKAGE.version}".`
1107
1108
  );
1108
- pkgLoadError = void 0;
1109
+ pkg_load_error = void 0;
1109
1110
  }
1110
1111
  }
1111
1112
  return _validated;
@@ -1133,4 +1134,4 @@ export {
1133
1134
  TOMBSTONE_EVENT,
1134
1135
  DEFAULT_LANE
1135
1136
  };
1136
- //# sourceMappingURL=chunk-3ZTFNAY7.js.map
1137
+ //# sourceMappingURL=chunk-3Z2HU726.js.map