@rotorsoft/act 1.9.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 (67) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/@types/act.d.ts +46 -14
  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/act-builder.d.ts.map +1 -1
  9. package/dist/@types/builders/state-builder.d.ts +33 -3
  10. package/dist/@types/builders/state-builder.d.ts.map +1 -1
  11. package/dist/@types/internal/audit.d.ts +4 -4
  12. package/dist/@types/internal/audit.d.ts.map +1 -1
  13. package/dist/@types/internal/backoff.d.ts +1 -1
  14. package/dist/@types/internal/backoff.d.ts.map +1 -1
  15. package/dist/@types/internal/build-classify.d.ts +11 -11
  16. package/dist/@types/internal/build-classify.d.ts.map +1 -1
  17. package/dist/@types/internal/close-cycle.d.ts +3 -3
  18. package/dist/@types/internal/close-cycle.d.ts.map +1 -1
  19. package/dist/@types/internal/correlate-cycle.d.ts +4 -4
  20. package/dist/@types/internal/correlate-cycle.d.ts.map +1 -1
  21. package/dist/@types/internal/correlator.d.ts +2 -2
  22. package/dist/@types/internal/correlator.d.ts.map +1 -1
  23. package/dist/@types/internal/drain-cycle.d.ts +20 -20
  24. package/dist/@types/internal/drain-cycle.d.ts.map +1 -1
  25. package/dist/@types/internal/drain-ratio.d.ts +1 -1
  26. package/dist/@types/internal/drain-ratio.d.ts.map +1 -1
  27. package/dist/@types/internal/event-sourcing.d.ts +9 -4
  28. package/dist/@types/internal/event-sourcing.d.ts.map +1 -1
  29. package/dist/@types/internal/event-versions.d.ts +2 -2
  30. package/dist/@types/internal/event-versions.d.ts.map +1 -1
  31. package/dist/@types/internal/index.d.ts +8 -7
  32. package/dist/@types/internal/index.d.ts.map +1 -1
  33. package/dist/@types/internal/merge.d.ts +3 -3
  34. package/dist/@types/internal/merge.d.ts.map +1 -1
  35. package/dist/@types/internal/reactions.d.ts +11 -10
  36. package/dist/@types/internal/reactions.d.ts.map +1 -1
  37. package/dist/@types/internal/sensitive.d.ts +147 -0
  38. package/dist/@types/internal/sensitive.d.ts.map +1 -0
  39. package/dist/@types/internal/settle.d.ts +3 -3
  40. package/dist/@types/internal/settle.d.ts.map +1 -1
  41. package/dist/@types/internal/tracing.d.ts +5 -5
  42. package/dist/@types/internal/tracing.d.ts.map +1 -1
  43. package/dist/@types/types/action.d.ts +57 -0
  44. package/dist/@types/types/action.d.ts.map +1 -1
  45. package/dist/@types/types/registry.d.ts +9 -1
  46. package/dist/@types/types/registry.d.ts.map +1 -1
  47. package/dist/@types/types/schemas.d.ts +36 -0
  48. package/dist/@types/types/schemas.d.ts.map +1 -1
  49. package/dist/{chunk-F4S2JOPN.js → chunk-3Z2HU726.js} +134 -133
  50. package/dist/chunk-3Z2HU726.js.map +1 -0
  51. package/dist/chunk-BY5JPOZR.js +267 -0
  52. package/dist/chunk-BY5JPOZR.js.map +1 -0
  53. package/dist/index.cjs +835 -616
  54. package/dist/index.cjs.map +1 -1
  55. package/dist/index.js +567 -439
  56. package/dist/index.js.map +1 -1
  57. package/dist/test/index.cjs +194 -187
  58. package/dist/test/index.cjs.map +1 -1
  59. package/dist/test/index.js +11 -11
  60. package/dist/test/index.js.map +1 -1
  61. package/dist/types/index.cjs +52 -34
  62. package/dist/types/index.cjs.map +1 -1
  63. package/dist/types/index.js +9 -3
  64. package/package.json +3 -3
  65. package/dist/chunk-F4S2JOPN.js.map +0 -1
  66. package/dist/chunk-PMAZTOSO.js +0 -164
  67. package/dist/chunk-PMAZTOSO.js.map +0 -1
@@ -4,13 +4,13 @@
4
4
  *
5
5
  * Two layers of the drain pipeline:
6
6
  *
7
- * - {@link runDrainCycle} — pure function for one round-trip of
7
+ * - {@link run_drain_cycle} — pure function for one round-trip of
8
8
  * claim → fetch → group → dispatch → ack/block. No orchestrator state.
9
9
  * Reusable for property tests and standalone benchmarks.
10
10
  *
11
11
  * - {@link DrainController} — stateful driver that owns the armed flag,
12
12
  * the concurrency lock, and the adaptive lag/lead ratio. Wraps
13
- * `runDrainCycle` with the lifecycle decisions Act used to make inline.
13
+ * `run_drain_cycle` with the lifecycle decisions Act used to make inline.
14
14
  *
15
15
  * @internal
16
16
  */
@@ -18,7 +18,7 @@ import type { BatchHandler, BlockedLease, Drain, DrainOptions, Fetch, Lease, Log
18
18
  import type { DrainOps } from "./drain.js";
19
19
  /**
20
20
  * Outcome of processing a single leased stream — produced by Act's `handle`
21
- * / `handleBatch` dispatchers, consumed by `runDrainCycle` to drive ack/block.
21
+ * / `handle_batch` dispatchers, consumed by `run_drain_cycle` to drive ack/block.
22
22
  *
23
23
  * @internal
24
24
  */
@@ -41,7 +41,7 @@ export type HandleResult = Readonly<{
41
41
  * where the reaction defined `options.backoff`. Undefined means "no
42
42
  * backoff configured" — drain re-attempts as soon as the lease expires.
43
43
  */
44
- nextAttemptAt?: number;
44
+ next_attempt_at?: number;
45
45
  /**
46
46
  * Event id that threw, when a handler error occurred. Distinct from
47
47
  * {@link acked_at}: `failed_at = acked_at + 1` in dense streams, but
@@ -57,12 +57,12 @@ export type HandleResult = Readonly<{
57
57
  */
58
58
  export type Handle<TEvents extends Schemas> = (lease: Lease, payloads: ReactionPayload<TEvents>[]) => Promise<HandleResult>;
59
59
  /**
60
- * Bulk reaction dispatcher signature (matches `Act.handleBatch`).
60
+ * Bulk reaction dispatcher signature (matches `Act.handle_batch`).
61
61
  * @internal
62
62
  */
63
63
  export type HandleBatch<TEvents extends Schemas> = (lease: Lease, payloads: ReactionPayload<TEvents>[], batchHandler: BatchHandler<TEvents>) => Promise<HandleResult>;
64
64
  /**
65
- * One drain cycle's results. Returned by {@link runDrainCycle}; consumed by
65
+ * One drain cycle's results. Returned by {@link run_drain_cycle}; consumed by
66
66
  * `Act.drain()` to update lifecycle state, the lag/lead ratio, and emit the
67
67
  * `acked` / `blocked` lifecycle events.
68
68
  *
@@ -82,7 +82,7 @@ export type DrainCycle<TEvents extends Schemas> = {
82
82
  * Returns `undefined` when nothing was claimed — caller can short-circuit
83
83
  * the rest of the drain pass.
84
84
  *
85
- * **Deferred streams.** When `isDeferred(stream)` returns `true`, the
85
+ * **Deferred streams.** When `is_deferred(stream)` returns `true`, the
86
86
  * cycle skips dispatch for that lease — no handle, no ack, no block. The
87
87
  * lease holds for `leaseMillis` via the existing claim mechanism, which
88
88
  * blocks competing workers from re-attempting during the backoff window
@@ -92,10 +92,10 @@ export type DrainCycle<TEvents extends Schemas> = {
92
92
  *
93
93
  * @internal
94
94
  */
95
- export declare function runDrainCycle<TEvents extends Schemas, TActions extends Schemas, TSchemaReg extends SchemaRegister<TActions>>(ops: DrainOps<TEvents>, registry: Registry<TSchemaReg, TEvents, TActions>, batchHandlers: Map<string, BatchHandler<TEvents>>, handle: Handle<TEvents>, handleBatch: HandleBatch<TEvents>, lagging: number, leading: number, eventLimit: number, leaseMillis: number, isDeferred?: (stream: string) => boolean, lane?: string): Promise<DrainCycle<TEvents> | undefined>;
95
+ export declare function run_drain_cycle<TEvents extends Schemas, TActions extends Schemas, TSchemaReg extends SchemaRegister<TActions>>(ops: DrainOps<TEvents>, registry: Registry<TSchemaReg, TEvents, TActions>, batch_handlers: Map<string, BatchHandler<TEvents>>, handle: Handle<TEvents>, handle_batch: HandleBatch<TEvents>, lagging: number, leading: number, eventLimit: number, leaseMillis: number, is_deferred?: (stream: string) => boolean, lane?: string): Promise<DrainCycle<TEvents> | undefined>;
96
96
  /**
97
97
  * Dependencies the {@link DrainController} needs from the orchestrator.
98
- * The lifecycle event sinks (`onAcked` / `onBlocked`) are callbacks so
98
+ * The lifecycle event sinks (`on_acked` / `on_blocked`) are callbacks so
99
99
  * this module doesn't reach back into Act's emitter.
100
100
  *
101
101
  * @internal
@@ -104,11 +104,11 @@ export type DrainControllerDeps<TEvents extends Schemas, TActions extends Schema
104
104
  readonly logger: Logger;
105
105
  readonly ops: DrainOps<TEvents>;
106
106
  readonly registry: Registry<TSchemaReg, TEvents, TActions>;
107
- readonly batchHandlers: Map<string, BatchHandler<TEvents>>;
107
+ readonly batch_handlers: Map<string, BatchHandler<TEvents>>;
108
108
  readonly handle: Handle<TEvents>;
109
- readonly handleBatch: HandleBatch<TEvents>;
110
- readonly onAcked: (acked: Lease[]) => void;
111
- readonly onBlocked: (blocked: BlockedLease[]) => void;
109
+ readonly handle_batch: HandleBatch<TEvents>;
110
+ readonly on_acked: (acked: Lease[]) => void;
111
+ readonly on_blocked: (blocked: BlockedLease[]) => void;
112
112
  /** Lane this controller drains. Undefined = spans all lanes (legacy single-controller). */
113
113
  readonly lane?: string;
114
114
  /** Per-lane defaults applied when caller doesn't override via DrainOptions. */
@@ -119,7 +119,7 @@ export type DrainControllerDeps<TEvents extends Schemas, TActions extends Schema
119
119
  };
120
120
  };
121
121
  /**
122
- * Stateful driver around {@link runDrainCycle}. Owns:
122
+ * Stateful driver around {@link run_drain_cycle}. Owns:
123
123
  *
124
124
  * - `_armed` — has any commit / reset / cold-start signaled work to do?
125
125
  * - `_locked` — concurrent-call guard (overlapping `drain()` calls return
@@ -136,14 +136,14 @@ export declare class DrainController<TEvents extends Schemas, TActions extends S
136
136
  private _locked;
137
137
  private _ratio;
138
138
  /**
139
- * Per-stream backoff: `stream → nextAttemptAt` (ms since epoch). Set by
140
- * `_finalize` via `HandleResult.nextAttemptAt`; cleared on successful
139
+ * Per-stream backoff: `stream → next_attempt_at` (ms since epoch). Set by
140
+ * `_finalize` via `HandleResult.next_attempt_at`; cleared on successful
141
141
  * ack or terminal block. Lives in process memory — per-worker pacing
142
142
  * by design (see {@link BackoffOptions} for the multi-worker trade-off).
143
143
  */
144
144
  private _backoff;
145
- /** Timer re-arming drain at the earliest pending `nextAttemptAt`. */
146
- private _backoffTimer;
145
+ /** Timer re-arming drain at the earliest pending `next_attempt_at`. */
146
+ private _backoff_timer;
147
147
  /** Worker timer (ACT-1103). Set when `start()` is active, undefined otherwise. */
148
148
  private _worker;
149
149
  private _stopped;
@@ -158,14 +158,14 @@ export declare class DrainController<TEvents extends Schemas, TActions extends S
158
158
  /** Read-only flag — true while a commit / reset is unprocessed. */
159
159
  get armed(): boolean;
160
160
  /** Returns true when `stream` is currently within a backoff window. */
161
- private isDeferred;
161
+ private is_deferred;
162
162
  /**
163
163
  * Schedule the next drain re-arm at the earliest pending backoff
164
164
  * expiry. Called only when the backoff map is non-empty (caller guard).
165
165
  * Idempotent — collapses many simultaneously deferred streams into a
166
166
  * single timer.
167
167
  */
168
- private scheduleBackoffWake;
168
+ private schedule_backoff_wake;
169
169
  /** Lane this controller drains (undefined = legacy single-lane span). */
170
170
  get lane(): string | undefined;
171
171
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"drain-cycle.d.ts","sourceRoot":"","sources":["../../../src/internal/drain-cycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,YAAY,EACZ,KAAK,EACL,KAAK,EACL,MAAM,EACN,eAAe,EACf,QAAQ,EACR,cAAc,EACd,OAAO,EACR,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAI3C;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC;IAClC,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;;OAMG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC,CA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IAQZ,4EAA4E;IACtE,KAAK,CAAC,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;CA8EjE"}
@@ -22,5 +22,5 @@ import type { HandleResult } from "./drain-cycle.js";
22
22
  * the frontier sizes used to claim them. Returns `RATIO_DEFAULT` when no
23
23
  * progress was made (nothing to base a decision on).
24
24
  */
25
- export declare function computeLagLeadRatio(handled: ReadonlyArray<HandleResult>, lagging: number, leading: number): number;
25
+ export declare function compute_lag_lead_ratio(handled: ReadonlyArray<HandleResult>, lagging: number, leading: number): number;
26
26
  //# sourceMappingURL=drain-ratio.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"drain-ratio.d.ts","sourceRoot":"","sources":["../../../src/internal/drain-ratio.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAQrD;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,aAAa,CAAC,YAAY,CAAC,EACpC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GACd,MAAM,CAYR"}
1
+ {"version":3,"file":"drain-ratio.d.ts","sourceRoot":"","sources":["../../../src/internal/drain-ratio.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAQrD;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,aAAa,CAAC,YAAY,CAAC,EACpC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GACd,MAAM,CAYR"}
@@ -14,10 +14,11 @@
14
14
  *
15
15
  * @internal
16
16
  */
17
+ import type { Actor } from "../types/action.js";
17
18
  import type { AsOf, Committed, Correlator, EventSource, ScanOptions, ScanResult, Schema, Schemas, Snapshot, State, Target } from "../types/index.js";
18
19
  /**
19
20
  * Internal action signature seen by the orchestrator — the {@link Correlator}
20
- * is bound at `buildEs` time, so callers don't pass it through.
21
+ * is bound at `build_es` time, so callers don't pass it through.
21
22
  *
22
23
  * @internal
23
24
  */
@@ -95,15 +96,19 @@ export declare function scan(source: EventSource, opts?: ScanOptions, callback?:
95
96
  * @template TState The type of state
96
97
  * @template TEvents The type of events
97
98
  * @template TActions The type of actions
98
- * @param me The state machine definition
99
+ * @param me The state machine definition.
99
100
  * @param stream The stream (instance) to load
100
101
  * @param callback (Optional) Callback to receive the loaded snapshot as it is built
102
+ * @param asOf (Optional) Time-travel cursor; bypasses the cache.
103
+ * @param actor (Optional) Passed through to the state's `view` delegate
104
+ * when constructing the snapshot.event — semantics are the state's to
105
+ * define (see {@link state}).
101
106
  * @returns The snapshot of the loaded state
102
107
  *
103
108
  * @example
104
109
  * const snapshot = await load(Counter, "counter1");
105
110
  */
106
- export declare function load<TState extends Schema, TEvents extends Schemas, TActions extends Schemas>(me: State<TState, TEvents, TActions>, stream: string, callback?: (snapshot: Snapshot<TState, TEvents>) => void, asOf?: AsOf): Promise<Snapshot<TState, TEvents>>;
111
+ export declare function load<TState extends Schema, TEvents extends Schemas, TActions extends Schemas>(me: State<TState, TEvents, TActions>, stream: string, callback?: (snapshot: Snapshot<TState, TEvents>) => void, asOf?: AsOf, actor?: Actor): Promise<Snapshot<TState, TEvents>>;
107
112
  /**
108
113
  * Executes an action and emits an event to be committed by the store.
109
114
  *
@@ -121,7 +126,7 @@ export declare function load<TState extends Schema, TEvents extends Schemas, TAc
121
126
  *
122
127
  * @template TState The type of state
123
128
  * @template TEvents The type of events
124
- * @template TActions The type of actionSchemas
129
+ * @template TActions The type of action_schemas
125
130
  * @template TKey The type of action to execute
126
131
  * @param me The state machine definition
127
132
  * @param action The action to execute
@@ -1 +1 @@
1
- {"version":3,"file":"event-sourcing.d.ts","sourceRoot":"","sources":["../../../src/internal/event-sourcing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AASH,OAAO,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O,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EACjC,UAAU,CAAC,EAAE,SAAS,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC,EAC9C,cAAc,UAAQ,EACtB,UAAU,GAAE,UAA+B,GAC1C,OAAO,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,CAgLtC"}
@@ -29,7 +29,7 @@
29
29
  *
30
30
  * @internal
31
31
  */
32
- export declare function deprecatedEventNames(names: Iterable<string>): Set<string>;
32
+ export declare function deprecated_event_names(names: Iterable<string>): Set<string>;
33
33
  /**
34
34
  * Given a deprecated event name and the full set of event names in its
35
35
  * registry, returns the current (highest-version) sibling. Used to build
@@ -40,5 +40,5 @@ export declare function deprecatedEventNames(names: Iterable<string>): Set<strin
40
40
  *
41
41
  * @internal
42
42
  */
43
- export declare function currentVersionOf(deprecatedName: string, allNames: Iterable<string>): string | undefined;
43
+ export declare function current_version_of(deprecated_name: string, all_names: Iterable<string>): string | undefined;
44
44
  //# sourceMappingURL=event-versions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"event-versions.d.ts","sourceRoot":"","sources":["../../../src/internal/event-versions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAmBH;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,CAgBzE;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,cAAc,EAAE,MAAM,EACtB,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,GACzB,MAAM,GAAG,SAAS,CASpB"}
1
+ {"version":3,"file":"event-versions.d.ts","sourceRoot":"","sources":["../../../src/internal/event-versions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAmBH;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,CAgB3E;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,eAAe,EAAE,MAAM,EACvB,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,GAC1B,MAAM,GAAG,SAAS,CASpB"}
@@ -18,17 +18,18 @@
18
18
  */
19
19
  export { type AuditDeps, audit } from "./audit.js";
20
20
  export type { EventLaneSet } from "./build-classify.js";
21
- export { ALL_LANES, classifyRegistry } from "./build-classify.js";
22
- export { runCloseCycle } from "./close-cycle.js";
21
+ export { ALL_LANES, classify_registry } from "./build-classify.js";
22
+ export { run_close_cycle } from "./close-cycle.js";
23
23
  export { CorrelateCycle } from "./correlate-cycle.js";
24
- export { closeCorrelation, defaultCorrelator } from "./correlator.js";
24
+ export { close_correlation, default_correlator } from "./correlator.js";
25
25
  export type { DrainOps } from "./drain.js";
26
26
  export { DrainController, type Handle, type HandleBatch, } from "./drain-cycle.js";
27
27
  export type { BoundAction, EsOps } from "./event-sourcing.js";
28
28
  export { scan } from "./event-sourcing.js";
29
- export { currentVersionOf, deprecatedEventNames, } from "./event-versions.js";
30
- export { _this_, mergeEventRegister, mergeProjection, registerState, } from "./merge.js";
31
- export { buildHandle, buildHandleBatch } from "./reactions.js";
29
+ export { current_version_of, deprecated_event_names, } from "./event-versions.js";
30
+ export { _this_, merge_event_register, merge_projection, register_state, } from "./merge.js";
31
+ export { build_handle, build_handle_batch } from "./reactions.js";
32
+ export { _registry, pii_fields, pii_gate, pii_merge, pii_split, pii_strip, REDACTED, SHREDDED, } from "./sensitive.js";
32
33
  export { SettleLoop } from "./settle.js";
33
- export { buildDrain, buildEs, traceCycle } from "./tracing.js";
34
+ export { build_drain, build_es, trace_cycle } from "./tracing.js";
34
35
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/internal/index.ts"],"names":[],"mappings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EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACxE,YAAY,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EACL,eAAe,EACf,KAAK,MAAM,EACX,KAAK,WAAW,GACjB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EACL,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,MAAM,EACN,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,GACf,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EACL,SAAS,EACT,UAAU,EACV,QAAQ,EACR,SAAS,EACT,SAAS,EACT,SAAS,EACT,QAAQ,EACR,QAAQ,GACT,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC"}
@@ -4,7 +4,7 @@ import type { State } from "../types/index.js";
4
4
  * Registers a state into a states map and action/event registries,
5
5
  * merging with existing same-name states (partial state support).
6
6
  */
7
- export declare function registerState(state: State<any, any, any>, states: Map<string, State<any, any, any>>, actions: Record<string, any>, events: Record<string, any>): void;
7
+ export declare function register_state(state: State<any, any, any>, states: Map<string, State<any, any, any>>, actions: Record<string, any>, events: Record<string, any>): void;
8
8
  /**
9
9
  * Merges reactions from one event register into another. The target is
10
10
  * assumed to already contain entries for every event name in the source
@@ -12,7 +12,7 @@ export declare function registerState(state: State<any, any, any>, states: Map<s
12
12
  * which seeds the target events). Reaction names collide by `set()`
13
13
  * semantics — last write wins.
14
14
  */
15
- export declare function mergeEventRegister(target: Record<string, {
15
+ export declare function merge_event_register(target: Record<string, {
16
16
  reactions: Map<string, unknown>;
17
17
  }>, source: Record<string, {
18
18
  reactions: Map<string, unknown>;
@@ -21,7 +21,7 @@ export declare function mergeEventRegister(target: Record<string, {
21
21
  * Merges a projection's event schemas and reactions into an event registry,
22
22
  * deduplicating reaction names by appending "_p" on collision.
23
23
  */
24
- export declare function mergeProjection(proj: Projection<any>, events: Record<string, any>): void;
24
+ export declare function merge_projection(proj: Projection<any>, events: Record<string, any>): void;
25
25
  export declare const _this_: ({ stream }: {
26
26
  stream: string;
27
27
  }) => {
@@ -1 +1 @@
1
- {"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../../src/internal/merge.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,KAAK,EAAU,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAuDvD;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAC3B,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,EACzC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC5B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC1B,IAAI,CAON;AAmID;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,CAAC,EAC3D,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,S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AAC,MAAM,EAAE,GAAG,CAAC,GAC1B,IAAI,CAiBN;AAGD,eAAO,MAAM,MAAM,GAAI,YAAY;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE;;;CAGnD,CAAC"}
@@ -2,13 +2,13 @@
2
2
  * @module reactions
3
3
  * @category Internal
4
4
  *
5
- * Reaction dispatch — what runs inside the drain pipeline once `runDrainCycle`
5
+ * Reaction dispatch — what runs inside the drain pipeline once `run_drain_cycle`
6
6
  * has fetched events for a leased stream. Two shapes:
7
7
  *
8
8
  * - per-event `handle`: walks payloads sequentially, builds a scoped `IAct`
9
9
  * that auto-injects `reactingTo` so handlers don't have to thread it
10
10
  * through manually
11
- * - bulk `handleBatch`: hands every event for a static-target projection to
11
+ * - bulk `handle_batch`: hands every event for a static-target projection to
12
12
  * a single batch callback, enabling one-transaction replays
13
13
  *
14
14
  * Both share `_finalize`, which collapses the retry-vs-block decision and
@@ -27,13 +27,14 @@ import type { Handle, HandleBatch } from "./drain-cycle.js";
27
27
  */
28
28
  export type ReactionDeps<TEvents extends Schemas, TActions extends Schemas, TActor extends Actor = Actor> = {
29
29
  readonly logger: Logger;
30
- readonly boundDo: IAct<TEvents, TActions, TActor>["do"];
31
- readonly boundLoad: IAct<TEvents, TActions, TActor>["load"];
32
- readonly boundQuery: IAct<TEvents, TActions, TActor>["query"];
33
- readonly boundQueryArray: IAct<TEvents, TActions, TActor>["query_array"];
30
+ readonly bound_do: IAct<TEvents, TActions, TActor>["do"];
31
+ readonly bound_load: IAct<TEvents, TActions, TActor>["load"];
32
+ readonly bound_query: IAct<TEvents, TActions, TActor>["query"];
33
+ readonly bound_query_array: IAct<TEvents, TActions, TActor>["query_array"];
34
+ readonly bound_forget: IAct<TEvents, TActions, TActor>["forget"];
34
35
  };
35
36
  /**
36
- * Builds the per-event reaction dispatcher passed to `runDrainCycle`.
37
+ * Builds the per-event reaction dispatcher passed to `run_drain_cycle`.
37
38
  *
38
39
  * The scoped `IAct` proxy auto-injects the triggering event as `reactingTo`
39
40
  * when handlers call `do()` without it (#587), keeping the correlation
@@ -42,13 +43,13 @@ export type ReactionDeps<TEvents extends Schemas, TActions extends Schemas, TAct
42
43
  *
43
44
  * @internal
44
45
  */
45
- export declare function buildHandle<TEvents extends Schemas, TActions extends Schemas, TActor extends Actor = Actor>(deps: ReactionDeps<TEvents, TActions, TActor>): Handle<TEvents>;
46
+ export declare function build_handle<TEvents extends Schemas, TActions extends Schemas, TActor extends Actor = Actor>(deps: ReactionDeps<TEvents, TActions, TActor>): Handle<TEvents>;
46
47
  /**
47
- * Builds the bulk reaction dispatcher passed to `runDrainCycle`. All events
48
+ * Builds the bulk reaction dispatcher passed to `run_drain_cycle`. All events
48
49
  * for a static-target projection are handed to a single callback so the
49
50
  * projection can do one transaction per drain (catch-up replays especially).
50
51
  *
51
52
  * @internal
52
53
  */
53
- export declare function buildHandleBatch<TEvents extends Schemas>(logger: Logger): HandleBatch<TEvents>;
54
+ export declare function build_handle_batch<TEvents extends Schemas>(logger: Logger): HandleBatch<TEvents>;
54
55
  //# sourceMappingURL=reactions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"reactions.d.ts","sourceRoot":"","sources":["../../../src/internal/reactions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EACL,KAAK,KAAK,EAGV,KAAK,IAAI,EAET,KAAK,MAAM,EAIX,KAAK,OAAO,EAEb,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAgB,MAAM,kBAAkB,CAAC;AAE1E;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,CACtB,OAAO,SAAS,OAAO,EACvB,QAAQ,SAAS,OAAO,EACxB,MAAM,SAAS,KAAK,GAAG,KAAK,IAC1B;IACF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,CA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QAAQ,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC;IACzD,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;IAC7D,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC;IAC/D,QAAQ,CAAC,iBAAiB,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,aAAa,CAAC,CAAC;IAC3E,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC;CAClE,CAAC;AAoDF;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAC1B,OAAO,SAAS,OAAO,EACvB,QAAQ,SAAS,OAAO,EACxB,MAAM,SAAS,KAAK,GAAG,KAAK,EAC5B,IAAI,EAAE,YAAY,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,CA6DhE;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,SAAS,OAAO,EACxD,MAAM,EAAE,MAAM,GACb,WAAW,CAAC,OAAO,CAAC,CA6BtB"}
@@ -0,0 +1,147 @@
1
+ /**
2
+ * @module sensitive
3
+ * @category Internal
4
+ *
5
+ * Internal mechanics for the sensitive-data foundation (#855 / epic #566).
6
+ * The public surface (`sensitive(zodType)`) lives at `libs/act/src/sensitive.ts`
7
+ * and re-exports `REDACTED` / `SHREDDED` from here; this module holds the
8
+ * registry plus the helpers the orchestrator calls during commit, load, and
9
+ * handler dispatch.
10
+ *
11
+ * - `_registry` — process-global `z.registry<{ sensitive: true }>()`. Public
12
+ * `sensitive()` adds to it; the helpers in this module read it.
13
+ * - `pii_fields(schema)` — walk a Zod schema's top-level shape, return the
14
+ * keys marked via `sensitive(...)`.
15
+ * - `pii_merge(event, fields)` — produce the reducer view (pii merged
16
+ * into data; `[SHREDDED]` if pii column is null).
17
+ * - `pii_gate(event, fields, predicate, actor)` — produce the external
18
+ * view: plaintext when authorized, `[REDACTED]` when not, `[SHREDDED]`
19
+ * when the underlying pii column is null.
20
+ * - `pii_strip(event, fields)` — remove sensitive keys entirely
21
+ * before invoking projection / reaction handlers.
22
+ *
23
+ * @internal
24
+ */
25
+ import { z } from "zod";
26
+ import type { Actor, Committed, Schemas } from "../types/index.js";
27
+ /**
28
+ * Sentinel placed in `event.data[field]` when the caller isn't authorized to
29
+ * see the sensitive field — either `.discloses(predicate)` returned `false`,
30
+ * or no predicate was declared (framework default-deny). Recoverable: a
31
+ * properly-authorized read returns the plaintext.
32
+ *
33
+ * Re-exported from `libs/act/src/sensitive.ts` as part of the public surface.
34
+ */
35
+ export declare const REDACTED: "[REDACTED]";
36
+ /**
37
+ * Sentinel placed in `event.data[field]` when the underlying PII payload has
38
+ * been wiped via `Store.forget_pii(stream)` — the row's pii column is `NULL`
39
+ * and the original plaintext is gone forever. Irrecoverable.
40
+ *
41
+ * Re-exported from `libs/act/src/sensitive.ts` as part of the public surface.
42
+ */
43
+ export declare const SHREDDED: "[SHREDDED]";
44
+ /**
45
+ * Process-global registry holding every Zod schema marked sensitive. Backed
46
+ * by a `WeakMap`, so wrapper-created instances (`.optional()`, `.nullable()`,
47
+ * `.default()`) that chain off a marked schema produce *new* schema instances
48
+ * the registry doesn't track; the field walker handles those via unwrap.
49
+ *
50
+ * Exported so the public `sensitive(zodType)` wrapper can call `_registry.add`.
51
+ * Underscore prefix marks "framework-private, don't touch from user code."
52
+ *
53
+ * @internal
54
+ */
55
+ export declare const _registry: z.core.$ZodRegistry<{
56
+ sensitive: true;
57
+ }, z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
58
+ /**
59
+ * Derive the list of sensitive field names from an event's Zod schema.
60
+ *
61
+ * Walks the top-level shape of a `z.object({...})` and returns the keys whose
62
+ * schema (after unwrapping optional/nullable/default wrappers) was marked via
63
+ * `sensitive(...)`. Returns an empty array for non-object schemas or events
64
+ * with no sensitive fields — the common-case zero-cost path.
65
+ *
66
+ * Only the top-level shape is walked. Sensitive fields nested inside a
67
+ * `z.object` declared inside the event payload would require recursive
68
+ * descent; that's deferred until a real callsite needs it.
69
+ *
70
+ * @internal — consumed by the registry's `sensitive_fields(event_name)` lookup.
71
+ */
72
+ export declare function pii_fields(schema: z.ZodType): readonly string[];
73
+ /**
74
+ * Split an emitted event's `data` into `data` (non-sensitive) + `pii`
75
+ * (sensitive) using the field list precomputed at build time. Used by the
76
+ * State's `_pii_split` decorator just before `Store.commit`.
77
+ *
78
+ * Single forward pass over `Object.keys(validated)` — same shape as the
79
+ * spread-and-delete-free implementation in slice 3, just hoisted out of the
80
+ * orchestrator hot path so it's only invoked when the State actually has a
81
+ * sensitive event.
82
+ *
83
+ * @internal
84
+ */
85
+ export declare function pii_split(emitted: {
86
+ name: unknown;
87
+ data: unknown;
88
+ }, fields: readonly string[]): {
89
+ name: unknown;
90
+ data: unknown;
91
+ pii: Record<string, unknown>;
92
+ };
93
+ /**
94
+ * Build the **reducer view** of a committed event — sensitive fields merged
95
+ * back into `data` so per-state reducers always see plaintext.
96
+ *
97
+ * - Event with no `pii` payload AND no schema-declared sensitive fields →
98
+ * return the event unchanged (zero-cost path).
99
+ * - Event with a `pii` payload → merge into `data` (plaintext for the reducer).
100
+ * - Event whose schema *declares* sensitive fields but `pii` is null/undefined
101
+ * (post-`forget_pii`) → substitute {@link SHREDDED} for each declared field.
102
+ *
103
+ * Used inside `load()` before invoking the reducer chain. Reducer-visible PII
104
+ * is by design — the reducer is the source of truth for derived state. The
105
+ * external view returned to callers is separately gated by {@link pii_gate}.
106
+ *
107
+ * @internal
108
+ */
109
+ export declare function pii_merge<TEvents extends Schemas, TKey extends keyof TEvents & string>(event: Committed<TEvents, TKey>, fields: readonly string[]): Committed<TEvents, TKey>;
110
+ /**
111
+ * Build the **external view** of a committed event — the form returned by
112
+ * `load()`, `query()`, `query_array()`, and the snapshot in `do()`'s reply.
113
+ *
114
+ * - Event with no schema-declared sensitive fields → returned unchanged
115
+ * (zero-cost path).
116
+ * - Event whose `pii` payload is null/undefined AND schema declares sensitive
117
+ * fields → substitute {@link SHREDDED} for each declared field. Irrecoverable,
118
+ * so no predicate check.
119
+ * - Event with a `pii` payload, predicate returns `true` → merge `pii` into
120
+ * `data` (plaintext).
121
+ * - Event with a `pii` payload, predicate returns `false` OR no predicate
122
+ * declared (framework default-deny) → substitute {@link REDACTED} for each
123
+ * declared field.
124
+ *
125
+ * @internal
126
+ */
127
+ export declare function pii_gate<TEvents extends Schemas, TKey extends keyof TEvents & string>(event: Committed<TEvents, TKey>, fields: readonly string[], predicate: ((event: any, actor: Actor) => boolean) | null, actor: Actor | undefined): Committed<TEvents, TKey>;
128
+ /**
129
+ * Build the **handler view** — sensitive keys removed entirely from `data`
130
+ * and the `pii` field dropped from the event. Used before invoking projection
131
+ * handlers and reaction handlers, which never see PII by framework rule.
132
+ *
133
+ * Different from {@link pii_gate} (which substitutes {@link REDACTED} or
134
+ * {@link SHREDDED}) — projection tables and reaction sinks shouldn't even
135
+ * structurally observe the keys, so a handler that mistakenly writes
136
+ * `event.data.email` into a column would get `undefined`, not a sentinel
137
+ * string that looks like real data. The strictness is deliberate.
138
+ *
139
+ * Reactions that genuinely need PII (e.g. a welcome-email reaction reading
140
+ * `email`) opt back in by explicitly calling `app.load(stream, { actor:
141
+ * system_actor })` inside the handler — pulling PII through the gate at the
142
+ * call site makes the security-relevant path visible in code review.
143
+ *
144
+ * @internal
145
+ */
146
+ export declare function pii_strip<TEvents extends Schemas, TKey extends keyof TEvents & string>(event: Committed<TEvents, TKey>, fields: readonly string[]): Committed<TEvents, TKey>;
147
+ //# sourceMappingURL=sensitive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sensitive.d.ts","sourceRoot":"","sources":["../../../src/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AI,CAAC,EAC/B,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,SAAS,EAAE,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC,GAAG,IAAI,EACzD,KAAK,EAAE,KAAK,GAAG,SAAS,GACvB,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,CA8B1B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,SAAS,CACvB,OAAO,SAAS,OAAO,EACvB,IAAI,SAAS,MAAM,OAAO,GAAG,MAAM,EAEnC,KAAK,EAAE,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,EAC/B,MAAM,EAAE,SAAS,MAAM,EAAE,GACxB,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,CAe1B"}
@@ -29,7 +29,7 @@ export type SettleDeps<TEvents extends Schemas> = {
29
29
  last_id: number;
30
30
  }>;
31
31
  readonly drain: (options: DrainOptions) => Promise<Drain<TEvents>>;
32
- readonly onSettled: (drain: Drain<TEvents>) => void;
32
+ readonly on_settled: (drain: Drain<TEvents>) => void;
33
33
  };
34
34
  /**
35
35
  * Drives the debounced correlate→drain catch-up cycle. One instance per
@@ -43,13 +43,13 @@ export declare class SettleLoop<TEvents extends Schemas> {
43
43
  private readonly _deps;
44
44
  /** Debounce window applied when the caller doesn't override via `SettleOptions.debounceMs`. */
45
45
  private readonly _default_debounce_ms;
46
- constructor(deps: SettleDeps<TEvents>, defaultDebounceMs: number);
46
+ constructor(deps: SettleDeps<TEvents>, default_debounce_ms: number);
47
47
  /**
48
48
  * Schedule a settle pass. Multiple calls inside the debounce window
49
49
  * coalesce into one cycle. The cycle runs correlate→drain in a loop
50
50
  * until no progress is made (no new subscriptions, no acks, no blocks)
51
51
  * or `maxPasses` is reached, then emits the `"settled"` lifecycle event
52
- * via {@link SettleDeps.onSettled}.
52
+ * via {@link SettleDeps.on_settled}.
53
53
  */
54
54
  schedule(options?: SettleOptions): void;
55
55
  /** Cancel any pending or active settle cycle. Idempotent. */
@@ -1 +1 @@
1
- {"version":3,"file":"settle.d.ts","sourceRoot":"","sources":["../../../src/internal/settle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EACV,KAAK,EACL,YAAY,EACZ,MAAM,EACN,KAAK,EACL,OAAO,EACP,aAAa,EACd,MAAM,mBAAmB,CAAC;AAE3B;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,CAAC,OAAO,SAAS,OAAO,IAAI;IAChD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,QAAQ,CAAC,UAAU,EAAE,MAAM,MAAM,CAAC;IAClC,QAAQ,CAAC,SAAS,EAAE,CAClB,KAAK,EAAE,KAAK,KACT,OAAO,CAAC;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACtD,QAAQ,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IACnE,QAAQ,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;CACrD,CAAC;AAEF;;;;;GAKG;AACH,qBAAa,UAAU,CAAC,OAAO,SAAS,OAAO;IAC7C,OAAO,CAAC,MAAM,CAAwD;IACtE,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAsB;IAC5C,+FAA+F;IAC/F,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAS;gBAElC,IAAI,EAAE,UAAU,CAAC,OAAO,CAAC,EAAE,iBAAiB,EAAE,MAAM;IAKhE;;;;;;OAMG;IACH,QAAQ,CAAC,OAAO,GAAE,aAAkB,GAAG,IAAI;IA0C3C,6DAA6D;IAC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,IAAI,IAAI;CAMb"}
@@ -18,7 +18,7 @@
18
18
  * - **Plain mode** (production / log aggregators) — every log gets a textual
19
19
  * prefix; event-sourcing uses `caption: body`, drain uses `caption body`.
20
20
  *
21
- * The two factories — {@link buildEs} and {@link buildDrain} — let the
21
+ * The two factories — {@link build_es} and {@link build_drain} — let the
22
22
  * orchestrator choose bare or traced variants once at `.build()` time based
23
23
  * on the configured log level. Outside this module, no other source file
24
24
  * imports tracing primitives.
@@ -34,17 +34,17 @@ import type { EsOps } from "./event-sourcing.js";
34
34
  *
35
35
  * @internal
36
36
  */
37
- export declare function buildEs(logger: Logger, correlator?: Correlator): EsOps;
37
+ export declare function build_es(logger: Logger, correlator?: Correlator): EsOps;
38
38
  /**
39
39
  * Selects bare or traced drain-pipeline ops. Called once by the orchestrator
40
40
  * constructor.
41
41
  *
42
42
  * @internal
43
43
  */
44
- export declare function buildDrain<TEvents extends Schemas>(logger: Logger): DrainOps<TEvents>;
44
+ export declare function build_drain<TEvents extends Schemas>(logger: Logger): DrainOps<TEvents>;
45
45
  /**
46
46
  * Emit one cycle-level drain trace summarizing what happened in a
47
- * single `runDrainCycle` pass. Per-stream rendering shape — outcome +
47
+ * single `run_drain_cycle` pass. Per-stream rendering shape — outcome +
48
48
  * post-state anchored on the right:
49
49
  *
50
50
  * stream<-source [events] ✓ @<acked-at> — full success
@@ -67,7 +67,7 @@ export declare function buildDrain<TEvents extends Schemas>(logger: Logger): Dra
67
67
  *
68
68
  * @internal
69
69
  */
70
- export declare function traceCycle<TEvents extends Schemas>(logger: Logger, leased: ReadonlyArray<{
70
+ export declare function trace_cycle<TEvents extends Schemas>(logger: Logger, leased: ReadonlyArray<{
71
71
  readonly stream: string;
72
72
  readonly at: number;
73
73
  readonly retry: number;
@@ -1 +1 @@
1
- {"version":3,"file":"tracing.d.ts","sourceRoot":"","sources":["../../../src/internal/tracing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAGH,OAAO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