@rotorsoft/act 0.32.4 → 0.32.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/@types/act.d.ts +65 -47
- package/dist/@types/act.d.ts.map +1 -1
- package/dist/@types/adapters/{ConsoleLogger.d.ts → console-logger.d.ts} +2 -2
- package/dist/@types/adapters/console-logger.d.ts.map +1 -0
- package/dist/@types/adapters/{InMemoryCache.d.ts → in-memory-cache.d.ts} +2 -3
- package/dist/@types/adapters/in-memory-cache.d.ts.map +1 -0
- package/dist/@types/adapters/{InMemoryStore.d.ts → in-memory-store.d.ts} +5 -1
- package/dist/@types/adapters/in-memory-store.d.ts.map +1 -0
- package/dist/@types/adapters/index.d.ts +3 -3
- package/dist/@types/adapters/index.d.ts.map +1 -1
- package/dist/@types/{act-builder.d.ts → builders/act-builder.d.ts} +5 -5
- package/dist/@types/builders/act-builder.d.ts.map +1 -0
- package/dist/@types/builders/index.d.ts +13 -0
- package/dist/@types/builders/index.d.ts.map +1 -0
- package/dist/@types/{projection-builder.d.ts → builders/projection-builder.d.ts} +3 -3
- package/dist/@types/builders/projection-builder.d.ts.map +1 -0
- package/dist/@types/{slice-builder.d.ts → builders/slice-builder.d.ts} +2 -2
- package/dist/@types/builders/slice-builder.d.ts.map +1 -0
- package/dist/@types/{state-builder.d.ts → builders/state-builder.d.ts} +1 -1
- package/dist/@types/builders/state-builder.d.ts.map +1 -0
- package/dist/@types/config.d.ts.map +1 -1
- package/dist/@types/index.d.ts +1 -4
- package/dist/@types/index.d.ts.map +1 -1
- package/dist/@types/internal/close-cycle.d.ts +38 -0
- package/dist/@types/internal/close-cycle.d.ts.map +1 -0
- package/dist/@types/internal/drain-cycle.d.ts +61 -0
- package/dist/@types/internal/drain-cycle.d.ts.map +1 -0
- package/dist/@types/internal/drain-ratio.d.ts +26 -0
- package/dist/@types/internal/drain-ratio.d.ts.map +1 -0
- package/dist/@types/internal/event-sourcing.d.ts +14 -0
- package/dist/@types/internal/event-sourcing.d.ts.map +1 -1
- package/dist/@types/internal/index.d.ts +5 -1
- package/dist/@types/internal/index.d.ts.map +1 -1
- package/dist/@types/internal/lru-map.d.ts +50 -0
- package/dist/@types/internal/lru-map.d.ts.map +1 -0
- package/dist/@types/internal/merge.d.ts +13 -1
- package/dist/@types/internal/merge.d.ts.map +1 -1
- package/dist/@types/internal/tracing.d.ts.map +1 -1
- package/dist/@types/ports.d.ts +1 -1
- package/dist/@types/ports.d.ts.map +1 -1
- package/dist/@types/types/errors.d.ts.map +1 -1
- package/dist/@types/types/reaction.d.ts +7 -1
- package/dist/@types/types/reaction.d.ts.map +1 -1
- package/dist/@types/utils.d.ts +27 -296
- package/dist/@types/utils.d.ts.map +1 -1
- package/dist/{chunk-JBKZJXQZ.js → chunk-IDEYGKT4.js} +2 -2
- package/dist/{chunk-JBKZJXQZ.js.map → chunk-IDEYGKT4.js.map} +1 -1
- package/dist/index.cjs +628 -422
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +627 -422
- package/dist/index.js.map +1 -1
- package/dist/types/index.cjs +1 -1
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.js +1 -1
- package/package.json +1 -1
- package/dist/@types/act-builder.d.ts.map +0 -1
- package/dist/@types/adapters/ConsoleLogger.d.ts.map +0 -1
- package/dist/@types/adapters/InMemoryCache.d.ts.map +0 -1
- package/dist/@types/adapters/InMemoryStore.d.ts.map +0 -1
- package/dist/@types/projection-builder.d.ts.map +0 -1
- package/dist/@types/slice-builder.d.ts.map +0 -1
- package/dist/@types/state-builder.d.ts.map +0 -1
package/dist/@types/act.d.ts
CHANGED
|
@@ -25,6 +25,33 @@ import type { Actor, AsOf, BatchHandler, BlockedLease, CloseResult, CloseTarget,
|
|
|
25
25
|
* @template TStateMap Map of state names to state schemas
|
|
26
26
|
* @template TActor Actor type extending base Actor
|
|
27
27
|
*/
|
|
28
|
+
/**
|
|
29
|
+
* Default LRU cap for the subscribed-streams cache. Apps that mint many
|
|
30
|
+
* dynamic targets (one per aggregate) should override via
|
|
31
|
+
* {@link ActOptions.maxSubscribedStreams} based on expected concurrency.
|
|
32
|
+
*/
|
|
33
|
+
export declare const DEFAULT_MAX_SUBSCRIBED_STREAMS = 1000;
|
|
34
|
+
/**
|
|
35
|
+
* Lifecycle events emitted by {@link Act}, mapped to their payload type.
|
|
36
|
+
* Drives the typing of `emit` / `on` / `off` — the event-name argument
|
|
37
|
+
* narrows its payload at the call site.
|
|
38
|
+
*/
|
|
39
|
+
export type ActLifecycleEvents<TSchemaReg extends SchemaRegister<TActions>, TEvents extends Schemas, TActions extends Schemas> = {
|
|
40
|
+
committed: Snapshot<TSchemaReg, TEvents>[];
|
|
41
|
+
acked: Lease[];
|
|
42
|
+
blocked: BlockedLease[];
|
|
43
|
+
settled: Drain<TEvents>;
|
|
44
|
+
closed: CloseResult;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Options for {@link Act} construction (passed via {@link ActBuilder.build}).
|
|
48
|
+
*
|
|
49
|
+
* @property maxSubscribedStreams - Cap for the LRU set tracking already-
|
|
50
|
+
* subscribed reaction streams. Default: {@link DEFAULT_MAX_SUBSCRIBED_STREAMS}.
|
|
51
|
+
*/
|
|
52
|
+
export type ActOptions = {
|
|
53
|
+
readonly maxSubscribedStreams?: number;
|
|
54
|
+
};
|
|
28
55
|
export declare class Act<TSchemaReg extends SchemaRegister<TActions>, TEvents extends Schemas, TActions extends Schemas, TStateMap extends Record<string, Schema> = Record<string, never>, TActor extends Actor = Actor> implements IAct<TEvents, TActions, TActor> {
|
|
29
56
|
readonly registry: Registry<TSchemaReg, TEvents, TActions>;
|
|
30
57
|
private readonly _states;
|
|
@@ -35,7 +62,18 @@ export declare class Act<TSchemaReg extends SchemaRegister<TActions>, TEvents ex
|
|
|
35
62
|
private _settle_timer;
|
|
36
63
|
private _settling;
|
|
37
64
|
private _correlation_checkpoint;
|
|
38
|
-
|
|
65
|
+
/**
|
|
66
|
+
* Streams already subscribed via store.subscribe() — both the static
|
|
67
|
+
* targets registered at init and dynamic targets discovered by
|
|
68
|
+
* correlate(). correlate() consults this set to avoid re-subscribing
|
|
69
|
+
* known streams.
|
|
70
|
+
*
|
|
71
|
+
* Bounded LRU so apps that mint millions of dynamic targets (one per
|
|
72
|
+
* aggregate) don't grow this unbounded. Eviction costs at most one
|
|
73
|
+
* redundant store.subscribe() call per evicted-but-still-active stream
|
|
74
|
+
* (subscribe is idempotent). Cap configurable via {@link ActOptions}.
|
|
75
|
+
*/
|
|
76
|
+
private readonly _subscribed_streams;
|
|
39
77
|
private _has_dynamic_resolvers;
|
|
40
78
|
private _correlation_initialized;
|
|
41
79
|
/** Event names with at least one registered reaction (computed at build time) */
|
|
@@ -43,41 +81,19 @@ export declare class Act<TSchemaReg extends SchemaRegister<TActions>, TEvents ex
|
|
|
43
81
|
/** Set in do() when a committed event has reactions — cleared by drain() */
|
|
44
82
|
private _needs_drain;
|
|
45
83
|
/**
|
|
46
|
-
* Emit a lifecycle event
|
|
47
|
-
*
|
|
48
|
-
* @param event The event name ("committed", "acked", or "blocked")
|
|
49
|
-
* @param args The event payload
|
|
50
|
-
* @returns true if the event had listeners, false otherwise
|
|
84
|
+
* Emit a lifecycle event. The payload type is inferred from the event name
|
|
85
|
+
* via {@link ActLifecycleEvents}.
|
|
51
86
|
*/
|
|
52
|
-
emit(event:
|
|
53
|
-
emit(event: "acked", args: Lease[]): boolean;
|
|
54
|
-
emit(event: "blocked", args: BlockedLease[]): boolean;
|
|
55
|
-
emit(event: "settled", args: Drain<TEvents>): boolean;
|
|
56
|
-
emit(event: "closed", args: CloseResult): boolean;
|
|
87
|
+
emit<E extends keyof ActLifecycleEvents<TSchemaReg, TEvents, TActions>>(event: E, args: ActLifecycleEvents<TSchemaReg, TEvents, TActions>[E]): boolean;
|
|
57
88
|
/**
|
|
58
|
-
* Register a listener for a lifecycle event
|
|
59
|
-
*
|
|
60
|
-
* @param event The event name
|
|
61
|
-
* @param listener The callback function
|
|
62
|
-
* @returns this (for chaining)
|
|
89
|
+
* Register a listener for a lifecycle event. The listener receives the
|
|
90
|
+
* event-specific payload.
|
|
63
91
|
*/
|
|
64
|
-
on(event:
|
|
65
|
-
on(event: "acked", listener: (args: Lease[]) => void): this;
|
|
66
|
-
on(event: "blocked", listener: (args: BlockedLease[]) => void): this;
|
|
67
|
-
on(event: "settled", listener: (args: Drain<TEvents>) => void): this;
|
|
68
|
-
on(event: "closed", listener: (args: CloseResult) => void): this;
|
|
92
|
+
on<E extends keyof ActLifecycleEvents<TSchemaReg, TEvents, TActions>>(event: E, listener: (args: ActLifecycleEvents<TSchemaReg, TEvents, TActions>[E]) => void): this;
|
|
69
93
|
/**
|
|
70
|
-
* Remove a
|
|
71
|
-
*
|
|
72
|
-
* @param event The event name
|
|
73
|
-
* @param listener The callback function
|
|
74
|
-
* @returns this (for chaining)
|
|
94
|
+
* Remove a previously registered lifecycle listener.
|
|
75
95
|
*/
|
|
76
|
-
off(event:
|
|
77
|
-
off(event: "acked", listener: (args: Lease[]) => void): this;
|
|
78
|
-
off(event: "blocked", listener: (args: BlockedLease[]) => void): this;
|
|
79
|
-
off(event: "settled", listener: (args: Drain<TEvents>) => void): this;
|
|
80
|
-
off(event: "closed", listener: (args: CloseResult) => void): this;
|
|
96
|
+
off<E extends keyof ActLifecycleEvents<TSchemaReg, TEvents, TActions>>(event: E, listener: (args: ActLifecycleEvents<TSchemaReg, TEvents, TActions>[E]) => void): this;
|
|
81
97
|
/**
|
|
82
98
|
* Create a new Act orchestrator.
|
|
83
99
|
*
|
|
@@ -107,7 +123,10 @@ export declare class Act<TSchemaReg extends SchemaRegister<TActions>, TEvents ex
|
|
|
107
123
|
private readonly _bound_load;
|
|
108
124
|
private readonly _bound_query;
|
|
109
125
|
private readonly _bound_query_array;
|
|
110
|
-
|
|
126
|
+
/** Pre-bound dispatchers handed to runDrainCycle each cycle. */
|
|
127
|
+
private readonly _bound_handle;
|
|
128
|
+
private readonly _bound_handle_batch;
|
|
129
|
+
constructor(registry: Registry<TSchemaReg, TEvents, TActions>, _states?: Map<string, State<any, any, any>>, batchHandlers?: Map<string, BatchHandler<any>>, options?: ActOptions);
|
|
111
130
|
/**
|
|
112
131
|
* Executes an action on a state instance, committing resulting events.
|
|
113
132
|
*
|
|
@@ -317,20 +336,23 @@ export declare class Act<TSchemaReg extends SchemaRegister<TActions>, TEvents ex
|
|
|
317
336
|
*/
|
|
318
337
|
query_array(query: Query): Promise<Committed<TEvents, keyof TEvents>[]>;
|
|
319
338
|
/**
|
|
320
|
-
*
|
|
321
|
-
*
|
|
322
|
-
*
|
|
323
|
-
*
|
|
339
|
+
* Shared finalization for the two reaction-runner shapes (per-event
|
|
340
|
+
* `handle` and bulk `handleBatch`). Centralizes the error log, retry-vs-
|
|
341
|
+
* block decision, and the "error reported only when nothing was handled"
|
|
342
|
+
* rule that's true in both shapes (in batch mode, `handled` is always 0
|
|
343
|
+
* on failure, so the rule degenerates to "always reported").
|
|
344
|
+
*/
|
|
345
|
+
private _finalize;
|
|
346
|
+
/**
|
|
347
|
+
* Handles leased reactions one event at a time.
|
|
324
348
|
*
|
|
325
|
-
*
|
|
326
|
-
*
|
|
327
|
-
*
|
|
328
|
-
*
|
|
349
|
+
* Called by the main `drain` loop after fetching new events. Each handler
|
|
350
|
+
* receives a scoped `IAct` proxy that auto-injects the triggering event
|
|
351
|
+
* as `reactingTo` when `do()` is called without it, maintaining
|
|
352
|
+
* correlation chains by default (#587). Handlers can still pass an
|
|
353
|
+
* explicit `reactingTo` to override.
|
|
329
354
|
*
|
|
330
355
|
* @internal
|
|
331
|
-
* @param lease The lease to handle
|
|
332
|
-
* @param payloads The reactions to handle
|
|
333
|
-
* @returns The lease with results
|
|
334
356
|
*/
|
|
335
357
|
private handle;
|
|
336
358
|
/**
|
|
@@ -341,10 +363,6 @@ export declare class Act<TSchemaReg extends SchemaRegister<TActions>, TEvents ex
|
|
|
341
363
|
* in a single call, enabling bulk DB operations.
|
|
342
364
|
*
|
|
343
365
|
* @internal
|
|
344
|
-
* @param lease The lease to handle
|
|
345
|
-
* @param payloads The reactions to handle
|
|
346
|
-
* @param batchHandler The batch handler for this projection
|
|
347
|
-
* @returns The lease with results
|
|
348
366
|
*/
|
|
349
367
|
private handleBatch;
|
|
350
368
|
/**
|
package/dist/@types/act.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"act.d.ts","sourceRoot":"","sources":["../../src/act.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"act.d.ts","sourceRoot":"","sources":["../../src/act.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EACV,KAAK,EACL,IAAI,EACJ,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,WAAW,EACX,SAAS,EACT,KAAK,EACL,YAAY,EACZ,IAAI,EACJ,KAAK,EAEL,KAAK,EAGL,QAAQ,EACR,MAAM,EACN,cAAc,EACd,OAAO,EACP,aAAa,EACb,QAAQ,EACR,KAAK,EACL,MAAM,EACP,MAAM,kBAAkB,CAAC;AAE1B;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH;;;;GAIG;AACH,eAAO,MAAM,8BAA8B,OAAO,CAAC;AAEnD;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,CAC5B,UAAU,SAAS,cAAc,CAAC,QAAQ,CAAC,EAC3C,OAAO,SAAS,OAAO,EACvB,QAAQ,SAAS,OAAO,IACtB;IACF,SAAS,EAAE,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,EAAE,CAAC;IAC3C,KAAK,EAAE,KAAK,EAAE,CAAC;IACf,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IACxB,MAAM,EAAE,WAAW,CAAC;CACrB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC;CACxC,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AAE,MAAM,KAAK,IAAI,GACtC,OAAO;IAgBV;;;;;;;;;;;;;;;;OAgBG;IACH,iBAAiB;IAOjB;;;;OAIG;IACH,aAAa;IAOb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACG,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAQ/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACG,KAAK,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC;IAmBzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACH,MAAM,CAAC,OAAO,GAAE,aAAkB,GAAG,IAAI;CAyC1C"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @module adapters/
|
|
2
|
+
* @module adapters/console-logger
|
|
3
3
|
*
|
|
4
4
|
* High-performance console logger inspired by pino's design:
|
|
5
5
|
* - Numeric level comparison for O(1) gating
|
|
@@ -36,4 +36,4 @@ export declare class ConsoleLogger implements Logger {
|
|
|
36
36
|
private _jsonWrite;
|
|
37
37
|
private _prettyWrite;
|
|
38
38
|
}
|
|
39
|
-
//# sourceMappingURL=
|
|
39
|
+
//# sourceMappingURL=console-logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"console-logger.d.ts","sourceRoot":"","sources":["../../../src/adapters/console-logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAwBhD;;;;;;;GAOG;AACH,qBAAa,aAAc,YAAW,MAAM;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;IAElC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;gBAG9B,OAAO,GAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAC/B;IAwBF,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAE9B,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM;IAQhD,OAAO,CAAC,UAAU;IAwClB,OAAO,CAAC,YAAY;CAmCrB"}
|
|
@@ -2,7 +2,7 @@ import type { Cache, CacheEntry, Schema } from "../types/index.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* In-memory LRU cache for stream snapshots.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* Backed by {@link LruMap} for O(1) get/set with LRU eviction.
|
|
6
6
|
* Configurable `maxSize` bounds memory usage.
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
@@ -15,7 +15,6 @@ import type { Cache, CacheEntry, Schema } from "../types/index.js";
|
|
|
15
15
|
*/
|
|
16
16
|
export declare class InMemoryCache implements Cache {
|
|
17
17
|
private readonly _entries;
|
|
18
|
-
private readonly _maxSize;
|
|
19
18
|
constructor(options?: {
|
|
20
19
|
maxSize?: number;
|
|
21
20
|
});
|
|
@@ -26,4 +25,4 @@ export declare class InMemoryCache implements Cache {
|
|
|
26
25
|
dispose(): Promise<void>;
|
|
27
26
|
get size(): number;
|
|
28
27
|
}
|
|
29
|
-
//# sourceMappingURL=
|
|
28
|
+
//# sourceMappingURL=in-memory-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"in-memory-cache.d.ts","sourceRoot":"","sources":["../../../src/adapters/in-memory-cache.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEnE;;;;;;;;;;;;;GAaG;AAEH,qBAAa,aAAc,YAAW,KAAK;IAIzC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAkC;gBAE/C,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE;IAIpC,GAAG,CAAC,MAAM,SAAS,MAAM,EAC7B,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IAIpC,GAAG,CAAC,MAAM,SAAS,MAAM,EAC7B,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,GACxB,OAAO,CAAC,IAAI,CAAC;IAIV,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAItB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAI9B,IAAI,IAAI,IAAI,MAAM,CAEjB;CACF"}
|
|
@@ -66,6 +66,10 @@ import type { BlockedLease, Committed, EventMeta, Lease, Message, Query, QuerySt
|
|
|
66
66
|
export declare class InMemoryStore implements Store {
|
|
67
67
|
private _events;
|
|
68
68
|
private _streams;
|
|
69
|
+
private _streamVersions;
|
|
70
|
+
private _maxEventIdByStream;
|
|
71
|
+
private _maxNonSnapEventId;
|
|
72
|
+
private _resetIndexes;
|
|
69
73
|
/**
|
|
70
74
|
* Dispose of the store and clear all events.
|
|
71
75
|
* @returns Promise that resolves when disposal is complete.
|
|
@@ -174,4 +178,4 @@ export declare class InMemoryStore implements Store {
|
|
|
174
178
|
committed: Committed<Schemas, keyof Schemas>;
|
|
175
179
|
}>>;
|
|
176
180
|
}
|
|
177
|
-
//# sourceMappingURL=
|
|
181
|
+
//# sourceMappingURL=in-memory-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"in-memory-store.d.ts","sourceRoot":"","sources":["../../../src/adapters/in-memory-store.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,YAAY,EACZ,SAAS,EACT,SAAS,EACT,KAAK,EACL,OAAO,EACP,KAAK,EACL,YAAY,EACZ,kBAAkB,EAClB,MAAM,EACN,OAAO,EACP,KAAK,EACL,cAAc,EACf,MAAM,mBAAmB,CAAC;AAkI3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AACH,qBAAa,aAAc,YAAW,KAAK;IAEzC,OAAO,CAAC,OAAO,CAA2C;IAE1D,OAAO,CAAC,QAAQ,CAA0C;IAE1D,OAAO,CAAC,eAAe,CAAkC;IAGzD,OAAO,CAAC,mBAAmB,CAAkC;IAE7D,OAAO,CAAC,kBAAkB,CAAM;IAEhC,OAAO,CAAC,aAAa;IAOrB;;;OAGG;IACG,OAAO;IAKb;;;OAGG;IACG,IAAI;IAIV;;;OAGG;IACG,IAAI;IAMV,OAAO,CAAC,QAAQ;IAahB;;;;;OAKG;IACG,KAAK,CAAC,CAAC,SAAS,OAAO,EAC3B,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,KAAK,IAAI,EAChD,KAAK,CAAC,EAAE,KAAK;IAiCf;;;;;;;;OAQG;IACG,MAAM,CAAC,CAAC,SAAS,OAAO,EAC5B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,EAC3B,IAAI,EAAE,SAAS,EACf,eAAe,CAAC,EAAE,MAAM;IA2C1B;;;;;;;;OAQG;IACG,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IA0DxE;;;;OAIG;IACG,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;;;;IAgBnE;;;OAGG;IACG,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE;;;;;;;;IAOzB;;;;OAIG;IACG,KAAK,CAAC,MAAM,EAAE,YAAY,EAAE;;;;;;;;;IAOlC;;;;;OAKG;IACG,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE;IAa7B;;;;OAIG;IACG,aAAa,CACjB,QAAQ,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,EAC5C,KAAK,CAAC,EAAE,YAAY,GACnB,OAAO,CAAC,kBAAkB,CAAC;IAuD9B;;;;OAIG;IACG,QAAQ,CACZ,OAAO,EAAE,KAAK,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,IAAI,CAAC,EAAE,SAAS,CAAC;KAClB,CAAC;iBAmBW,MAAM;mBAAa,SAAS,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC;;CA6BpE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { ConsoleLogger } from "./
|
|
2
|
-
export { InMemoryCache } from "./
|
|
3
|
-
export { InMemoryStore } from "./
|
|
1
|
+
export { ConsoleLogger } from "./console-logger.js";
|
|
2
|
+
export { InMemoryCache } from "./in-memory-cache.js";
|
|
3
|
+
export { InMemoryStore } from "./in-memory-store.js";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Fluent builder for composing event-sourced applications.
|
|
6
6
|
*/
|
|
7
|
-
import { Act } from "
|
|
7
|
+
import { Act, type ActOptions } from "../act.js";
|
|
8
|
+
import type { Actor, Committed, EventRegister, IAct, ReactionOptions, ReactionResolver, Schema, SchemaRegister, Schemas, Snapshot, State } from "../types/index.js";
|
|
8
9
|
import type { Projection } from "./projection-builder.js";
|
|
9
10
|
import type { Slice } from "./slice-builder.js";
|
|
10
|
-
import type { Actor, BatchHandler, Committed, EventRegister, IAct, ReactionOptions, ReactionResolver, Registry, Schema, SchemaRegister, Schemas, Snapshot, State } from "./types/index.js";
|
|
11
11
|
/**
|
|
12
12
|
* Fluent builder interface for composing event-sourced applications.
|
|
13
13
|
*
|
|
@@ -105,12 +105,12 @@ export type ActBuilder<TSchemaReg extends SchemaRegister<TActions>, TEvents exte
|
|
|
105
105
|
/**
|
|
106
106
|
* Builds and returns the Act orchestrator instance.
|
|
107
107
|
*
|
|
108
|
-
* @param
|
|
108
|
+
* @param options - Optional runtime overrides (see {@link ActOptions}).
|
|
109
109
|
* @returns The Act orchestrator instance
|
|
110
110
|
*
|
|
111
111
|
* @see {@link Act} for available orchestrator methods
|
|
112
112
|
*/
|
|
113
|
-
build: (
|
|
113
|
+
build: (options?: ActOptions) => Act<TSchemaReg, TEvents, TActions, TStateMap, TActor>;
|
|
114
114
|
/**
|
|
115
115
|
* The registered event schemas and their reaction maps.
|
|
116
116
|
*/
|
|
@@ -156,5 +156,5 @@ export type ActBuilder<TSchemaReg extends SchemaRegister<TActions>, TEvents exte
|
|
|
156
156
|
* @see {@link state} for defining states
|
|
157
157
|
* @see {@link slice} for defining slices
|
|
158
158
|
*/
|
|
159
|
-
export declare function act<TSchemaReg extends SchemaRegister<TActions> = {}, TEvents extends Schemas = {}, TActions extends Schemas = {}, TStateMap extends Record<string, Schema> = {}, TActor extends Actor = Actor>(
|
|
159
|
+
export declare function act<TSchemaReg extends SchemaRegister<TActions> = {}, TEvents extends Schemas = {}, TActions extends Schemas = {}, TStateMap extends Record<string, Schema> = {}, TActor extends Actor = Actor>(): ActBuilder<TSchemaReg, TEvents, TActions, TStateMap, TActor>;
|
|
160
160
|
//# sourceMappingURL=act-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"act-builder.d.ts","sourceRoot":"","sources":["../../../src/builders/act-builder.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,GAAG,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAOjD,OAAO,KAAK,EACV,KAAK,EAEL,SAAS,EACT,aAAa,EACb,IAAI,EAEJ,eAAe,EACf,gBAAgB,EAEhB,MAAM,EACN,cAAc,EACd,OAAO,EACP,QAAQ,EACR,KAAK,EACN,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAoBhD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,UAAU,CACpB,UAAU,SAAS,cAAc,CAAC,QAAQ,CAAC,EAC3C,OAAO,SAAS,OAAO,EACvB,QAAQ,SAAS,OAAO,EAExB,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,EAAE,EAC7C,MAAM,SAAS,KAAK,GAAG,KAAK,IAC1B;IACF;;;;;;;OAOG;IACH,SAAS,EAAE,CACT,SA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KAAK,KACzB,UAAU,CAAC,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,CA4FhE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module builders
|
|
3
|
+
* @category Builders
|
|
4
|
+
*
|
|
5
|
+
* Public-facing fluent builders for composing event-sourced applications:
|
|
6
|
+
* `state` (aggregates), `slice` (vertical-slice modules), `projection`
|
|
7
|
+
* (read-model updaters), and `act` (the orchestrator builder).
|
|
8
|
+
*/
|
|
9
|
+
export * from "./act-builder.js";
|
|
10
|
+
export * from "./projection-builder.js";
|
|
11
|
+
export * from "./slice-builder.js";
|
|
12
|
+
export * from "./state-builder.js";
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/builders/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC"}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* actions, and are pure side-effect handlers routed to a named stream.
|
|
10
10
|
*/
|
|
11
11
|
import type { ZodType } from "zod";
|
|
12
|
-
import type { BatchHandler, Committed, EventRegister, ReactionResolver, Schema, Schemas } from "
|
|
12
|
+
import type { BatchHandler, Committed, EventRegister, ReactionResolver, Schema, Schemas } from "../types/index.js";
|
|
13
13
|
/**
|
|
14
14
|
* A self-contained projection grouping read-model update handlers.
|
|
15
15
|
* Projections are composed into an Act orchestrator via `act().withProjection(projection)`.
|
|
@@ -90,12 +90,12 @@ export type ProjectionBuilder<TEvents extends Schemas, TTarget extends string |
|
|
|
90
90
|
*
|
|
91
91
|
* @param target - Static target stream for all handlers
|
|
92
92
|
*/
|
|
93
|
-
export declare function projection<TEvents extends Schemas = {}>(target: string
|
|
93
|
+
export declare function projection<TEvents extends Schemas = {}>(target: string): ProjectionBuilder<TEvents, string>;
|
|
94
94
|
/**
|
|
95
95
|
* Creates a new projection builder without a default target.
|
|
96
96
|
*
|
|
97
97
|
* Use per-handler `.to()` to route events to different streams.
|
|
98
98
|
*/
|
|
99
|
-
export declare function projection<TEvents extends Schemas = {}>(target?: undefined
|
|
99
|
+
export declare function projection<TEvents extends Schemas = {}>(target?: undefined): ProjectionBuilder<TEvents, undefined>;
|
|
100
100
|
export {};
|
|
101
101
|
//# sourceMappingURL=projection-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projection-builder.d.ts","sourceRoot":"","sources":["../../../src/builders/projection-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAEnC,OAAO,KAAK,EACV,YAAY,EACZ,SAAS,EACT,aAAa,EAEb,gBAAgB,EAChB,MAAM,EACN,OAAO,EACR,MAAM,mBAAmB,CAAC;AAE3B;;;;;GAKG;AACH,MAAM,MAAM,UAAU,CAAC,OAAO,SAAS,OAAO,IAAI;IAChD,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IACxC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;CAC/C,CAAC;AAEF,2EAA2E;AAC3E,KAAK,UAAU,CAAC,IAAI,SAAS,MAAM,GAAG,MAAM,EAAE,KAAK,SAAS,MAAM,GAAG,MAAM,IAAI;KAC5E,CAAC,IAAI,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC;CAC5B,CAAC;AAEF,iEAAiE;AACjE,KAAK,QAAQ,CACX,OAAO,SAAS,OAAO,EACvB,IAAI,SAAS,MAAM,EACnB,KAAK,S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AAM,UAAU,CAAC,OAAO,CAAC,CAAC;KAClC,CAAC;CACH,GAED,EAAE,CAAC,CAAC;AAkJR;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,OAAO,SAAS,OAAO,GAAG,EAAE,EACrD,MAAM,EAAE,MAAM,GACb,iBAAiB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AACtC;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,OAAO,SAAS,OAAO,GAAG,EAAE,EACrD,MAAM,CAAC,EAAE,SAAS,GACjB,iBAAiB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { Actor, Committed, EventRegister, IAct, ReactionOptions, ReactionResolver, Schema, SchemaRegister, Schemas, Snapshot, State } from "../types/index.js";
|
|
1
2
|
import type { Projection } from "./projection-builder.js";
|
|
2
|
-
import type { Actor, Committed, EventRegister, IAct, ReactionOptions, ReactionResolver, Schema, SchemaRegister, Schemas, Snapshot, State } from "./types/index.js";
|
|
3
3
|
/**
|
|
4
4
|
* A self-contained functional slice grouping partial states with their
|
|
5
5
|
* scoped reactions. Slices are composed into an Act orchestrator via
|
|
@@ -105,5 +105,5 @@ export type SliceBuilder<TSchemaReg extends SchemaRegister<TActions>, TEvents ex
|
|
|
105
105
|
* @see {@link SliceBuilder} for builder methods
|
|
106
106
|
* @see {@link Slice} for the output type
|
|
107
107
|
*/
|
|
108
|
-
export declare function slice<TSchemaReg extends SchemaRegister<TActions> = {}, TEvents extends Schemas = {}, TActions extends Schemas = {}, TStateMap extends Record<string, Schema> = {}, TActor extends Actor = Actor>(
|
|
108
|
+
export declare function slice<TSchemaReg extends SchemaRegister<TActions> = {}, TEvents extends Schemas = {}, TActions extends Schemas = {}, TStateMap extends Record<string, Schema> = {}, TActor extends Actor = Actor>(): SliceBuilder<TSchemaReg, TEvents, TActions, TStateMap, TActor>;
|
|
109
109
|
//# sourceMappingURL=slice-builder.d.ts.map
|
|
@@ -0,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,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,GAAG;YACpE,EAAE,EAAE,CACF,QAAQ,EAAE,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,MAAM,KAC/C,YAAY,CAAC,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;SACrE,CAAC;KACH,CAAC;IACF;;OAEG;IACH,KAAK,EAAE,MAAM,KAAK,CAAC,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IACrE;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;CACzC,CAAC;AAIF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,KAAK,CAEnB,UAAU,SAAS,cAAc,CAAC,QAAQ,CAAC,GAAG,EAAE,EAChD,OAAO,SAAS,OAAO,GAAG,EAAE,EAC5B,QAAQ,SAAS,OAAO,GAAG,EAAE,EAC7B,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,EAAE,EAC7C,MAAM,SAAS,KAAK,GAAG,KAAK,KACzB,YAAY,CAAC,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,CAoElE"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Fluent interface for defining a strongly-typed state machine using Zod schemas.
|
|
6
6
|
*/
|
|
7
7
|
import { ZodType } from "zod";
|
|
8
|
-
import { ActionHandler, Invariant, PatchHandlers, Schema, Schemas, Snapshot, State, ZodTypes } from "
|
|
8
|
+
import { ActionHandler, Invariant, PatchHandlers, Schema, Schemas, Snapshot, State, ZodTypes } from "../types/index.js";
|
|
9
9
|
/**
|
|
10
10
|
* Builder interface for defining a state with event sourcing.
|
|
11
11
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":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E,CACJ,IAAI,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,KACnD,aAAa,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;IACrD;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAK,EAAE,MAAM,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;CACtD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoHG;AACH,wBAAgB,KAAK,CAAC,KAAK,SAAS,MAAM,EAAE,MAAM,SAAS,MAAM,EAC/D,KAAK,EAAE,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,GAC/B,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,CA6C7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAUxB;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;iBAWxB,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AA0CpD;;;;GAIG;AACH,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;iBAKd,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAsBhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,eAAO,MAAM,MAAM,QAAO,MAwBzB,CAAC"}
|
package/dist/@types/index.d.ts
CHANGED
|
@@ -4,14 +4,11 @@ import "./signals.js";
|
|
|
4
4
|
* @module act
|
|
5
5
|
* Main entry point for the Act framework. Re-exports all core APIs.
|
|
6
6
|
*/
|
|
7
|
-
export * from "./act-builder.js";
|
|
8
7
|
export * from "./act.js";
|
|
9
8
|
export * from "./adapters/index.js";
|
|
9
|
+
export * from "./builders/index.js";
|
|
10
10
|
export * from "./config.js";
|
|
11
11
|
export * from "./ports.js";
|
|
12
|
-
export * from "./projection-builder.js";
|
|
13
|
-
export * from "./slice-builder.js";
|
|
14
|
-
export * from "./state-builder.js";
|
|
15
12
|
export * from "./types/index.js";
|
|
16
13
|
export * from "./utils.js";
|
|
17
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAEtB;;;;GAIG;AACH,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAEtB;;;;GAIG;AACH,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module close-cycle
|
|
3
|
+
* @category Internal
|
|
4
|
+
*
|
|
5
|
+
* Pure orchestration of the close-the-books flow: scan stream heads,
|
|
6
|
+
* partition by reaction safety, guard with tombstones, optionally seed
|
|
7
|
+
* restart state, run user archive callbacks, atomically truncate, and
|
|
8
|
+
* update the cache.
|
|
9
|
+
*
|
|
10
|
+
* The Act orchestrator owns lifecycle (correlate gate, emit("closed")) and
|
|
11
|
+
* the registry-derived inputs (reactive-event count, event→state map). All
|
|
12
|
+
* sequential phase work between those state touches lives here.
|
|
13
|
+
*
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
import type { CloseResult, CloseTarget, Logger, State } from "../types/index.js";
|
|
17
|
+
import type { EsOps } from "./event-sourcing.js";
|
|
18
|
+
/**
|
|
19
|
+
* Dependencies the close cycle needs from the Act orchestrator. Decoupled
|
|
20
|
+
* from `Act` itself so the cycle can be exercised from tests in isolation.
|
|
21
|
+
*
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
export type CloseCycleDeps = {
|
|
25
|
+
readonly reactiveEventsSize: number;
|
|
26
|
+
readonly eventToState: ReadonlyMap<string, State<any, any, any>>;
|
|
27
|
+
readonly load: EsOps["load"];
|
|
28
|
+
readonly tombstone: EsOps["tombstone"];
|
|
29
|
+
readonly logger: Logger;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Run the full close cycle for the given targets. Caller owns the
|
|
33
|
+
* lifecycle event emission.
|
|
34
|
+
*
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
37
|
+
export declare function runCloseCycle(targets: CloseTarget[], deps: CloseCycleDeps): Promise<CloseResult>;
|
|
38
|
+
//# sourceMappingURL=close-cycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"close-cycle.d.ts","sourceRoot":"","sources":["../../../src/internal/close-cycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,MAAM,EAEN,KAAK,EACN,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;IACjE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,CAAC;AAcF;;;;;GAKG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,WAAW,EAAE,EACtB,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,WAAW,CAAC,CAmDtB"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module drain-cycle
|
|
3
|
+
* @category Internal
|
|
4
|
+
*
|
|
5
|
+
* Pure drain-pipeline orchestration: one round-trip of claim → fetch →
|
|
6
|
+
* group → dispatch → ack/block. The Act orchestrator owns the `_needs_drain`
|
|
7
|
+
* / `_drain_locked` flags and the adaptive lag-to-lead ratio; everything
|
|
8
|
+
* sequential between those state updates lives here.
|
|
9
|
+
*
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
import type { BatchHandler, BlockedLease, Fetch, Lease, ReactionPayload, Registry, SchemaRegister, Schemas } from "../types/index.js";
|
|
13
|
+
import type { DrainOps } from "./drain.js";
|
|
14
|
+
/**
|
|
15
|
+
* Outcome of processing a single leased stream — produced by Act's `handle`
|
|
16
|
+
* / `handleBatch` dispatchers, consumed by `runDrainCycle` to drive ack/block.
|
|
17
|
+
*
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export type HandleResult = Readonly<{
|
|
21
|
+
lease: Lease;
|
|
22
|
+
handled: number;
|
|
23
|
+
at: number;
|
|
24
|
+
error?: string;
|
|
25
|
+
block?: boolean;
|
|
26
|
+
}>;
|
|
27
|
+
/**
|
|
28
|
+
* Per-event reaction dispatcher signature (matches `Act.handle`).
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
export type Handle<TEvents extends Schemas> = (lease: Lease, payloads: ReactionPayload<TEvents>[]) => Promise<HandleResult>;
|
|
32
|
+
/**
|
|
33
|
+
* Bulk reaction dispatcher signature (matches `Act.handleBatch`).
|
|
34
|
+
* @internal
|
|
35
|
+
*/
|
|
36
|
+
export type HandleBatch<TEvents extends Schemas> = (lease: Lease, payloads: ReactionPayload<TEvents>[], batchHandler: BatchHandler<TEvents>) => Promise<HandleResult>;
|
|
37
|
+
/**
|
|
38
|
+
* One drain cycle's results. Returned by {@link runDrainCycle}; consumed by
|
|
39
|
+
* `Act.drain()` to update lifecycle state, the lag/lead ratio, and emit the
|
|
40
|
+
* `acked` / `blocked` lifecycle events.
|
|
41
|
+
*
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
44
|
+
export type DrainCycle<TEvents extends Schemas> = {
|
|
45
|
+
readonly leased: Lease[];
|
|
46
|
+
readonly fetched: Fetch<TEvents>;
|
|
47
|
+
readonly handled: HandleResult[];
|
|
48
|
+
readonly acked: Lease[];
|
|
49
|
+
readonly blocked: BlockedLease[];
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Run one drain cycle: claim streams, fetch their events, dispatch
|
|
53
|
+
* matching reactions, ack the successes, block the retries-exhausted.
|
|
54
|
+
*
|
|
55
|
+
* Returns `undefined` when nothing was claimed — caller can short-circuit
|
|
56
|
+
* the rest of the drain pass.
|
|
57
|
+
*
|
|
58
|
+
* @internal
|
|
59
|
+
*/
|
|
60
|
+
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): Promise<DrainCycle<TEvents> | undefined>;
|
|
61
|
+
//# sourceMappingURL=drain-cycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drain-cycle.d.ts","sourceRoot":"","sources":["../../../src/internal/drain-cycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,KAAK,EACL,eAAe,EACf,QAAQ,EACR,cAAc,EACd,OAAO,EACR,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC;IAClC,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,MAAM,MAAM,CAAC,OAAO,SAAS,OAAO,IAAI,CAC5C,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,eAAe,CAAC,OAAO,CAAC,EAAE,KACjC,OAAO,CAAC,YAAY,CAAC,CAAC;AAE3B;;;GAGG;AACH,MAAM,MAAM,WAAW,CAAC,OAAO,SAAS,OAAO,IAAI,CACjD,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,eAAe,CAAC,OAAO,CAAC,EAAE,EACpC,YAAY,EAAE,YAAY,CAAC,OAAO,CAAC,KAChC,OAAO,CAAC,YAAY,CAAC,CAAC;AAE3B;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,CAAC,OAAO,SAAS,OAAO,IAAI;IAChD,QAAQ,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE,YAAY,EAAE,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,YAAY,EAAE,CAAC;CAClC,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CACjC,OAAO,SAAS,OAAO,EACvB,QAAQ,SAAS,OAAO,EACxB,UAAU,SAAS,cAAc,CAAC,QAAQ,CAAC,EAE3C,GAAG,EAAE,QAAQ,CAAC,OAAO,CAAC,EACtB,QAAQ,EAAE,QAAQ,CAAC,UAAU,EAAE,OAAO,EAAE,QAAQ,CAAC,EACjD,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,EACjD,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,EACvB,WAAW,EAAE,WAAW,CAAC,OAAO,CAAC,EACjC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC,CAqE1C"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module drain-ratio
|
|
3
|
+
* @category Internal
|
|
4
|
+
*
|
|
5
|
+
* Adaptive lag-to-lead ratio for the dual-frontier drain strategy.
|
|
6
|
+
*
|
|
7
|
+
* The orchestrator splits its per-cycle stream budget between two frontiers:
|
|
8
|
+
*
|
|
9
|
+
* - **lagging** — newly subscribed or behind streams catching up.
|
|
10
|
+
* - **leading** — actively-processing streams at the head of the log.
|
|
11
|
+
*
|
|
12
|
+
* After each cycle, this helper looks at how many events were actually
|
|
13
|
+
* handled in each frontier and shifts the next cycle's split toward
|
|
14
|
+
* whichever frontier had the higher per-stream throughput. The result is
|
|
15
|
+
* clamped to `[0.2, 0.8]` so neither frontier can be starved.
|
|
16
|
+
*
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
import type { HandleResult } from "./drain-cycle.js";
|
|
20
|
+
/**
|
|
21
|
+
* Compute the next lag-to-lead ratio from the cycle's handled events and
|
|
22
|
+
* the frontier sizes used to claim them. Returns `RATIO_DEFAULT` when no
|
|
23
|
+
* progress was made (nothing to base a decision on).
|
|
24
|
+
*/
|
|
25
|
+
export declare function computeLagLeadRatio(handled: ReadonlyArray<HandleResult>, lagging: number, leading: number): number;
|
|
26
|
+
//# sourceMappingURL=drain-ratio.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -17,6 +17,7 @@ export interface EsOps {
|
|
|
17
17
|
snap: typeof snap;
|
|
18
18
|
load: typeof load;
|
|
19
19
|
action: typeof action;
|
|
20
|
+
tombstone: typeof tombstone;
|
|
20
21
|
}
|
|
21
22
|
/**
|
|
22
23
|
* Event sourcing utilities for snapshotting, loading, and committing actions/events.
|
|
@@ -36,6 +37,19 @@ export interface EsOps {
|
|
|
36
37
|
* await snap(snapshot);
|
|
37
38
|
*/
|
|
38
39
|
export declare function snap<TState extends Schema, TEvents extends Schemas>(snapshot: Snapshot<TState, TEvents>): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Commits a tombstone event with optimistic concurrency, returning the
|
|
42
|
+
* committed record on success or `undefined` if the stream moved past
|
|
43
|
+
* `expectedVersion` (concurrent write detected). Other store errors
|
|
44
|
+
* propagate.
|
|
45
|
+
*
|
|
46
|
+
* Used by `close()` to guard a stream while archive/truncate runs:
|
|
47
|
+
* subsequent `action()` calls see the tombstone at head and reject with
|
|
48
|
+
* {@link StreamClosedError} until the close completes.
|
|
49
|
+
*
|
|
50
|
+
* @internal
|
|
51
|
+
*/
|
|
52
|
+
export declare function tombstone(stream: string, expectedVersion: number, correlation: string): Promise<Committed<Schemas, keyof Schemas> | undefined>;
|
|
39
53
|
/**
|
|
40
54
|
* Loads a snapshot of the state from the store by replaying events and applying patches.
|
|
41
55
|
*
|