@rotorsoft/act 1.32.29 → 1.33.0
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/README.md +0 -1
- package/dist/.tsbuildinfo +1 -1
- package/dist/@types/act.d.ts +41 -233
- package/dist/@types/act.d.ts.map +1 -1
- package/dist/@types/adapters/in-memory-store.d.ts.map +1 -1
- package/dist/@types/builders/act-builder.d.ts +2 -115
- package/dist/@types/builders/act-builder.d.ts.map +1 -1
- package/dist/@types/builders/builder-utils.d.ts +1 -1
- package/dist/@types/builders/builder-utils.d.ts.map +1 -1
- package/dist/@types/builders/event-builder.d.ts +5 -5
- package/dist/@types/builders/event-builder.d.ts.map +1 -1
- package/dist/@types/builders/merge.d.ts +1 -1
- package/dist/@types/builders/merge.d.ts.map +1 -1
- package/dist/@types/builders/projection-builder.d.ts +2 -144
- package/dist/@types/builders/projection-builder.d.ts.map +1 -1
- package/dist/@types/builders/slice-builder.d.ts +2 -71
- package/dist/@types/builders/slice-builder.d.ts.map +1 -1
- package/dist/@types/builders/state-builder.d.ts +2 -376
- package/dist/@types/builders/state-builder.d.ts.map +1 -1
- package/dist/@types/config.d.ts +6 -43
- package/dist/@types/config.d.ts.map +1 -1
- package/dist/@types/csv.d.ts +1 -15
- package/dist/@types/csv.d.ts.map +1 -1
- package/dist/@types/index.d.ts +0 -1
- package/dist/@types/index.d.ts.map +1 -1
- package/dist/@types/internal/autoclose-policy.d.ts +9 -108
- package/dist/@types/internal/autoclose-policy.d.ts.map +1 -1
- package/dist/@types/internal/autoclose-reaction.d.ts +1 -9
- package/dist/@types/internal/autoclose-reaction.d.ts.map +1 -1
- package/dist/@types/internal/autoclose-window.d.ts +2 -15
- package/dist/@types/internal/autoclose-window.d.ts.map +1 -1
- package/dist/@types/internal/backoff.d.ts +1 -6
- package/dist/@types/internal/backoff.d.ts.map +1 -1
- package/dist/@types/internal/circuit-breaker.d.ts +1 -4
- package/dist/@types/internal/circuit-breaker.d.ts.map +1 -1
- package/dist/@types/{builders/build-classify.d.ts → internal/classify.d.ts} +2 -15
- package/dist/@types/internal/classify.d.ts.map +1 -0
- package/dist/@types/internal/close-cycle.d.ts +0 -13
- package/dist/@types/internal/close-cycle.d.ts.map +1 -1
- package/dist/@types/internal/config.d.ts +9 -81
- package/dist/@types/internal/config.d.ts.map +1 -1
- package/dist/@types/internal/correlate-cycle.d.ts +1 -1
- package/dist/@types/internal/correlate-cycle.d.ts.map +1 -1
- package/dist/@types/internal/{correlator.d.ts → correlation-id.d.ts} +1 -8
- package/dist/@types/internal/correlation-id.d.ts.map +1 -0
- package/dist/@types/internal/date-reviver.d.ts +0 -5
- package/dist/@types/internal/date-reviver.d.ts.map +1 -1
- package/dist/@types/internal/defer-config.d.ts +0 -13
- package/dist/@types/internal/defer-config.d.ts.map +1 -1
- package/dist/@types/internal/defer-timer.d.ts +1 -5
- package/dist/@types/internal/defer-timer.d.ts.map +1 -1
- package/dist/@types/internal/drain-cycle.d.ts +1 -1
- package/dist/@types/internal/drain-cycle.d.ts.map +1 -1
- package/dist/@types/internal/{drain.d.ts → drain-ops.d.ts} +1 -7
- package/dist/@types/internal/drain-ops.d.ts.map +1 -0
- package/dist/@types/internal/drain-ratio.d.ts +0 -5
- package/dist/@types/internal/drain-ratio.d.ts.map +1 -1
- package/dist/@types/internal/event-sourcing.d.ts +1 -8
- package/dist/@types/internal/event-sourcing.d.ts.map +1 -1
- package/dist/@types/internal/event-versions.d.ts +0 -9
- package/dist/@types/internal/event-versions.d.ts.map +1 -1
- package/dist/@types/internal/lru-map.d.ts +0 -9
- package/dist/@types/internal/lru-map.d.ts.map +1 -1
- package/dist/@types/internal/pii.d.ts +78 -0
- package/dist/@types/internal/pii.d.ts.map +1 -0
- package/dist/@types/internal/projection-fold.d.ts +1 -5
- package/dist/@types/internal/projection-fold.d.ts.map +1 -1
- package/dist/@types/internal/{close-signal.d.ts → reaction-dispatch.d.ts} +46 -6
- package/dist/@types/internal/reaction-dispatch.d.ts.map +1 -0
- package/dist/@types/internal/report-once.d.ts +1 -8
- package/dist/@types/internal/report-once.d.ts.map +1 -1
- package/dist/@types/internal/settle.d.ts +21 -21
- package/dist/@types/internal/settle.d.ts.map +1 -1
- package/dist/@types/internal/tracing.d.ts +3 -14
- package/dist/@types/internal/tracing.d.ts.map +1 -1
- package/dist/@types/internal/walk-streams.d.ts +0 -2
- package/dist/@types/internal/walk-streams.d.ts.map +1 -1
- package/dist/@types/ports.d.ts +3 -43
- package/dist/@types/ports.d.ts.map +1 -1
- package/dist/@types/scoped.d.ts +1 -6
- package/dist/@types/scoped.d.ts.map +1 -1
- package/dist/@types/sensitive.d.ts +56 -0
- package/dist/@types/sensitive.d.ts.map +1 -0
- package/dist/@types/test/index.d.ts +1 -0
- package/dist/@types/test/index.d.ts.map +1 -1
- package/dist/@types/test/sandbox.d.ts +2 -26
- package/dist/@types/test/sandbox.d.ts.map +1 -1
- package/dist/@types/types/act.d.ts +216 -0
- package/dist/@types/types/act.d.ts.map +1 -0
- package/dist/@types/types/action.d.ts +67 -0
- package/dist/@types/types/action.d.ts.map +1 -1
- package/dist/@types/types/builders.d.ts +722 -0
- package/dist/@types/types/builders.d.ts.map +1 -0
- package/dist/@types/types/errors.d.ts +31 -1
- package/dist/@types/types/errors.d.ts.map +1 -1
- package/dist/@types/types/index.d.ts +38 -0
- package/dist/@types/types/index.d.ts.map +1 -1
- package/dist/@types/types/ports.d.ts +16 -10
- package/dist/@types/types/ports.d.ts.map +1 -1
- package/dist/@types/types/reaction.d.ts +11 -1
- package/dist/@types/types/reaction.d.ts.map +1 -1
- package/dist/@types/types/sandbox.d.ts +31 -0
- package/dist/@types/types/sandbox.d.ts.map +1 -0
- package/dist/@types/types/schemas.d.ts +12 -17
- package/dist/@types/types/schemas.d.ts.map +1 -1
- package/dist/{chunk-F7K7SIG6.js → chunk-2PMUONGF.js} +38 -57
- package/dist/chunk-2PMUONGF.js.map +1 -0
- package/dist/chunk-HF433MAF.cjs +264 -0
- package/dist/chunk-HF433MAF.cjs.map +1 -0
- package/dist/{chunk-5FXT63KF.js → chunk-JABYJGT7.js} +184 -24
- package/dist/chunk-JABYJGT7.js.map +1 -0
- package/dist/chunk-VE3MTY4A.cjs +1233 -0
- package/dist/chunk-VE3MTY4A.cjs.map +1 -0
- package/dist/index.cjs +1615 -3003
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +751 -813
- package/dist/index.js.map +1 -1
- package/dist/test/index.cjs +16 -1105
- package/dist/test/index.cjs.map +1 -1
- package/dist/test/index.js +2 -2
- package/dist/test/index.js.map +1 -1
- package/dist/types/index.cjs +58 -276
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.js +15 -1
- package/package.json +1 -1
- package/dist/@types/builders/build-classify.d.ts.map +0 -1
- package/dist/@types/builders/builder-base.d.ts +0 -70
- package/dist/@types/builders/builder-base.d.ts.map +0 -1
- package/dist/@types/builders/reaction-builder.d.ts +0 -55
- package/dist/@types/builders/reaction-builder.d.ts.map +0 -1
- package/dist/@types/internal/close-signal.d.ts.map +0 -1
- package/dist/@types/internal/correlator.d.ts.map +0 -1
- package/dist/@types/internal/defer-signal.d.ts +0 -35
- package/dist/@types/internal/defer-signal.d.ts.map +0 -1
- package/dist/@types/internal/drain.d.ts.map +0 -1
- package/dist/@types/internal/index.d.ts +0 -43
- package/dist/@types/internal/index.d.ts.map +0 -1
- package/dist/@types/internal/sensitive.d.ts +0 -177
- package/dist/@types/internal/sensitive.d.ts.map +0 -1
- package/dist/chunk-5FXT63KF.js.map +0 -1
- package/dist/chunk-F7K7SIG6.js.map +0 -1
package/dist/@types/config.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { type ActOptions, type AutocloseConfig, type Config } from "./types/index.js";
|
|
2
3
|
/**
|
|
3
4
|
* Zod schema for validating package.json metadata.
|
|
4
5
|
* @internal
|
|
@@ -14,48 +15,6 @@ export declare const PackageSchema: z.ZodObject<{
|
|
|
14
15
|
license: z.ZodOptional<z.ZodString>;
|
|
15
16
|
dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
16
17
|
}, z.core.$strip>;
|
|
17
|
-
/**
|
|
18
|
-
* Type representing the validated package.json metadata.
|
|
19
|
-
*
|
|
20
|
-
* @internal
|
|
21
|
-
*/
|
|
22
|
-
export type Package = z.infer<typeof PackageSchema>;
|
|
23
|
-
/**
|
|
24
|
-
* Zod schema for the full Act Framework configuration object.
|
|
25
|
-
* Includes package metadata, environment, logging, and timing options.
|
|
26
|
-
* @internal
|
|
27
|
-
*/
|
|
28
|
-
declare const BaseSchema: z.ZodObject<{
|
|
29
|
-
name: z.ZodString;
|
|
30
|
-
version: z.ZodString;
|
|
31
|
-
description: z.ZodOptional<z.ZodString>;
|
|
32
|
-
author: z.ZodOptional<z.ZodUnion<[z.ZodOptional<z.ZodObject<{
|
|
33
|
-
name: z.ZodString;
|
|
34
|
-
email: z.ZodOptional<z.ZodString>;
|
|
35
|
-
}, z.core.$strip>>, z.ZodString]>>;
|
|
36
|
-
license: z.ZodOptional<z.ZodString>;
|
|
37
|
-
dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
38
|
-
env: z.ZodEnum<{
|
|
39
|
-
development: "development";
|
|
40
|
-
production: "production";
|
|
41
|
-
staging: "staging";
|
|
42
|
-
test: "test";
|
|
43
|
-
}>;
|
|
44
|
-
logLevel: z.ZodEnum<{
|
|
45
|
-
debug: "debug";
|
|
46
|
-
error: "error";
|
|
47
|
-
fatal: "fatal";
|
|
48
|
-
info: "info";
|
|
49
|
-
trace: "trace";
|
|
50
|
-
warn: "warn";
|
|
51
|
-
}>;
|
|
52
|
-
logSingleLine: z.ZodBoolean;
|
|
53
|
-
sleepMs: z.ZodNumber;
|
|
54
|
-
}, z.core.$strip>;
|
|
55
|
-
/**
|
|
56
|
-
* Type representing the validated Act Framework configuration object.
|
|
57
|
-
*/
|
|
58
|
-
export type Config = z.infer<typeof BaseSchema>;
|
|
59
18
|
/**
|
|
60
19
|
* Gets the current Act Framework configuration.
|
|
61
20
|
*
|
|
@@ -88,5 +47,9 @@ export type Config = z.infer<typeof BaseSchema>;
|
|
|
88
47
|
* @see {@link Config} for configuration type
|
|
89
48
|
*/
|
|
90
49
|
export declare const config: () => Config;
|
|
91
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Validates and defaults the autoclose knobs of `ActOptions`, the way
|
|
52
|
+
* `act().build()` does. Throws `ZodError` on an out-of-range value.
|
|
53
|
+
*/
|
|
54
|
+
export declare function resolveAutocloseConfig(options: ActOptions | undefined): AutocloseConfig;
|
|
92
55
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -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;AAGxB,OAAO,EACL,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,MAAM,EAMZ,MAAM,kBAAkB,CAAC;AAG1B;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;iBAWK,CAAC;AAsFhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,MAAM,QAAO,MAwBzB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,UAAU,GAAG,SAAS,GAC9B,eAAe,CAEjB"}
|
package/dist/@types/csv.d.ts
CHANGED
|
@@ -15,21 +15,7 @@
|
|
|
15
15
|
* implemented — `CsvFile` is a transfer-only primitive, not a
|
|
16
16
|
* store you'd run an Act app against.
|
|
17
17
|
*/
|
|
18
|
-
import type { Committed, EventSink, EventSource, Query, Schemas } from "./types/action.js";
|
|
19
|
-
/**
|
|
20
|
-
* Construct a {@link CsvFile} from either a filesystem path (for
|
|
21
|
-
* reading and/or writing through the OS) or an in-memory blob (a
|
|
22
|
-
* pre-loaded CSV string, used by the inspector when a CSV arrives
|
|
23
|
-
* over the wire via tRPC).
|
|
24
|
-
*
|
|
25
|
-
* Both modes share the same on-disk format, so the same blob shape
|
|
26
|
-
* can be round-tripped through the transfer pipeline.
|
|
27
|
-
*/
|
|
28
|
-
export type CsvFileOptions = {
|
|
29
|
-
path: string;
|
|
30
|
-
} | {
|
|
31
|
-
blob: string;
|
|
32
|
-
};
|
|
18
|
+
import type { Committed, CsvFileOptions, EventSink, EventSource, Query, Schemas } from "./types/action.js";
|
|
33
19
|
export declare class CsvFile implements EventSource, EventSink {
|
|
34
20
|
private readonly path;
|
|
35
21
|
private readonly blob;
|
package/dist/@types/csv.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"csv.d.ts","sourceRoot":"","sources":["../../src/csv.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,KAAK,EACV,SAAS,EACT,SAAS,EACT,WAAW,EACX,KAAK,EACL,OAAO,EACR,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"csv.d.ts","sourceRoot":"","sources":["../../src/csv.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,KAAK,EACV,SAAS,EACT,cAAc,EACd,SAAS,EACT,WAAW,EACX,KAAK,EACL,OAAO,EACR,MAAM,mBAAmB,CAAC;AAgB3B,qBAAa,OAAQ,YAAW,WAAW,EAAE,SAAS;IACpD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAgB;IACrC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAgB;IAErC,YAAY,OAAO,EAAE,cAAc,EAQlC;IAEK,KAAK,CAAC,CAAC,SAAS,OAAO,EAC3B,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,KAAK,IAAI,EAChD,OAAO,CAAC,EAAE,KAAK,GACd,OAAO,CAAC,MAAM,CAAC,CAsCjB;IAEK,OAAO,CACX,MAAM,EAAE,CACN,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,KACpE,OAAO,CAAC,IAAI,CAAC,GACjB,OAAO,CAAC,IAAI,CAAC,CA6Bf;IAEK,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAK7B;CACF"}
|
package/dist/@types/index.d.ts
CHANGED
|
@@ -9,7 +9,6 @@ export * from "./adapters/index.js";
|
|
|
9
9
|
export * from "./builders/index.js";
|
|
10
10
|
export * from "./config.js";
|
|
11
11
|
export * from "./csv.js";
|
|
12
|
-
export { DeferSignal } from "./internal/index.js";
|
|
13
12
|
export * from "./ports.js";
|
|
14
13
|
export * from "./types/index.js";
|
|
15
14
|
export * from "./utils.js";
|
|
@@ -1 +1 @@
|
|
|
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,UAAU,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,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC"}
|
|
@@ -1,108 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* - `after` — time / compliance ("autocloses **after** N days")
|
|
10
|
-
* - `is` — domain lifecycle ("autocloses ... **is** Resolved")
|
|
11
|
-
* - `reaches` — resource ("autocloses ... **reaches** 10k events")
|
|
12
|
-
*
|
|
13
|
-
* Top-level fields combine with **AND** semantics. This captures the
|
|
14
|
-
* common cooldown-after-terminal pattern that runs through almost
|
|
15
|
-
* every business app — *"close 90 days after `Resolved`"*, *"close 14
|
|
16
|
-
* days after `Delivered`"*, *"close 30 days after a GDPR deletion
|
|
17
|
-
* request"*. All conditions must hold for the cycle to truncate.
|
|
18
|
-
*
|
|
19
|
-
* A separate `or: {...}` block opens an alternative path: when
|
|
20
|
-
* present, the policy fires if **either** the top-level AND group
|
|
21
|
-
* matches **or** any field inside `or` matches. Use it for safety
|
|
22
|
-
* nets — *"close (Resolved AND aged 90 days) OR if event count
|
|
23
|
-
* reaches 10k"*. The two-axis split mirrors the two ways close
|
|
24
|
-
* policies appear in practice: primary close logic (AND-shaped) and
|
|
25
|
-
* defensive backstops (OR-shaped).
|
|
26
|
-
*
|
|
27
|
-
* The state builder's `.autocloses(...)` overload distinguishes
|
|
28
|
-
* function (predicate) from object (policy) and routes the latter
|
|
29
|
-
* through {@link compile_autoclose_policy}, which validates via
|
|
30
|
-
* {@link AutoclosePolicySchema} and returns the compiled predicate.
|
|
31
|
-
* Operators with custom needs (per-stream metadata, multi-branch
|
|
32
|
-
* AND/OR like "(`Resolved` + 90d) OR (`Cancelled` + 30d)") keep the
|
|
33
|
-
* function form; the declarative form covers the 90% case.
|
|
34
|
-
*
|
|
35
|
-
* Validation runs at the builder call (`act().build()` time), so
|
|
36
|
-
* misconfiguration — empty bag, sub-1 `reaches`, sub-minute `after`,
|
|
37
|
-
* empty `is`, empty `or`, nested `or` inside `or`, unknown keys —
|
|
38
|
-
* throws at build, not on the first cycle tick.
|
|
39
|
-
*
|
|
40
|
-
* @internal
|
|
2
|
+
* Compiles the declarative `.autocloses({...})` policy into a predicate.
|
|
3
|
+
* Top-level `after` / `is` / `reaches` combine with AND; an `or: {...}`
|
|
4
|
+
* block adds an alternative path. Validated with
|
|
5
|
+
* {@link AutoclosePolicySchema} when the app builds, so a bad policy throws
|
|
6
|
+
* then, not on the first cycle. Semantics and examples:
|
|
7
|
+
* docs/docs/guides/close-policies.md.
|
|
41
8
|
*/
|
|
42
|
-
import {
|
|
43
|
-
|
|
44
|
-
/** The `Date` that lies `days` after `date`. @internal */
|
|
9
|
+
import type { AutoclosePolicy, AutoclosePredicate, Schemas } from "../types/action.js";
|
|
10
|
+
/** The `Date` that lies `days` after `date`. */
|
|
45
11
|
export declare function days_after(date: Date, days: number): Date;
|
|
46
|
-
/** The `Date` that lies `days` in the past.
|
|
12
|
+
/** The `Date` that lies `days` in the past. */
|
|
47
13
|
export declare function days_before_now(days: number): Date;
|
|
48
|
-
/**
|
|
49
|
-
* Zod schema for the declarative {@link AutoclosePolicy} bag.
|
|
50
|
-
* Internal `const` per the config-validation-schema standard (CLAUDE.md
|
|
51
|
-
* "Config-validation schemas") — the public surface is the inferred
|
|
52
|
-
* {@link AutoclosePolicy} type and the `.autocloses({...})` overload,
|
|
53
|
-
* never this schema. `.strict()` rejects unknown keys so typos surface
|
|
54
|
-
* at build instead of being silently ignored.
|
|
55
|
-
*
|
|
56
|
-
* @internal
|
|
57
|
-
*/
|
|
58
|
-
declare const AutoclosePolicySchema: z.ZodObject<{
|
|
59
|
-
after: z.ZodOptional<z.ZodObject<{
|
|
60
|
-
days: z.ZodNumber;
|
|
61
|
-
}, z.core.$strip>>;
|
|
62
|
-
is: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodReadonly<z.ZodArray<z.ZodString>>]>>;
|
|
63
|
-
reaches: z.ZodOptional<z.ZodNumber>;
|
|
64
|
-
or: z.ZodOptional<z.ZodObject<{
|
|
65
|
-
after: z.ZodOptional<z.ZodObject<{
|
|
66
|
-
days: z.ZodNumber;
|
|
67
|
-
}, z.core.$strip>>;
|
|
68
|
-
is: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodReadonly<z.ZodArray<z.ZodString>>]>>;
|
|
69
|
-
reaches: z.ZodOptional<z.ZodNumber>;
|
|
70
|
-
}, z.core.$strict>>;
|
|
71
|
-
keep: z.ZodOptional<z.ZodObject<{
|
|
72
|
-
days: z.ZodNumber;
|
|
73
|
-
}, z.core.$strip>>;
|
|
74
|
-
}, z.core.$strict>;
|
|
75
|
-
/**
|
|
76
|
-
* Declarative close-policy options consumed by `.autocloses({...})`.
|
|
77
|
-
* Top-level fields are AND-combined; the optional `or` block opens an
|
|
78
|
-
* alternative OR-path. Omitted fields contribute nothing — they do
|
|
79
|
-
* not mean "match everything."
|
|
80
|
-
*
|
|
81
|
-
* @property after - Close when `head.created` is at least the resolved
|
|
82
|
-
* window in the past. Days are the close surface's only unit;
|
|
83
|
-
* fractional `days` cover sub-day cooldowns (`{ days: 1/24 }` is one
|
|
84
|
-
* hour) without introducing another denomination.
|
|
85
|
-
* @property is - Close when `head.name` matches. String for the
|
|
86
|
-
* single-terminal-event case (the most common); `readonly string[]`
|
|
87
|
-
* for multi-terminal states (`Order: Shipped | Delivered |
|
|
88
|
-
* Cancelled`).
|
|
89
|
-
* @property reaches - Close when the stream's event count is `>= N`
|
|
90
|
-
* (inclusive — fires the moment the threshold is reached).
|
|
91
|
-
* @property or - Alternative OR-path. When present, the policy fires
|
|
92
|
-
* if EITHER the top-level AND group matches OR any field inside
|
|
93
|
-
* `or` matches. Used for safety-net backstops layered onto a
|
|
94
|
-
* primary cooldown policy (e.g. *"(Resolved AND 90 days) OR reaches
|
|
95
|
-
* 10k"*). Nested `or` inside `or` rejects at build time.
|
|
96
|
-
* @property keep - Rolling-window retention, **independent** of
|
|
97
|
-
* the terminate fields: while the stream stays open, prune events
|
|
98
|
-
* older than `now − keep` behind the closest safe snapshot via a
|
|
99
|
-
* windowed close. Does not participate in the AND group or the `or`
|
|
100
|
-
* block — a policy may terminate, prune, or both. Requires
|
|
101
|
-
* `.snap(...)` earlier in the builder chain (type-gated) and a
|
|
102
|
-
* window of at least one day — the close cycle is low-cadence
|
|
103
|
-
* housekeeping, never sub-day realtime.
|
|
104
|
-
*/
|
|
105
|
-
export type AutoclosePolicy = z.infer<typeof AutoclosePolicySchema>;
|
|
106
14
|
/**
|
|
107
15
|
* Compile a declarative {@link AutoclosePolicy} into an
|
|
108
16
|
* {@link AutoclosePredicate}. The state-builder's
|
|
@@ -128,8 +36,6 @@ export type AutoclosePolicy = z.infer<typeof AutoclosePolicySchema>;
|
|
|
128
36
|
* Throws `ZodError` at call time when the options are invalid (empty
|
|
129
37
|
* bag, non-positive `reaches`, sub-minute `after`, empty `is`, empty
|
|
130
38
|
* `or`, nested `or`, unknown keys).
|
|
131
|
-
*
|
|
132
|
-
* @internal
|
|
133
39
|
*/
|
|
134
40
|
/**
|
|
135
41
|
* The smallest `after` window (in days) anywhere in a policy — across
|
|
@@ -143,8 +49,6 @@ export type AutoclosePolicy = z.infer<typeof AutoclosePolicySchema>;
|
|
|
143
49
|
* just waits for the next event to re-trigger rather than parking on a
|
|
144
50
|
* due-time. Conservative — the min across branches never defers past
|
|
145
51
|
* the soonest a branch could fire.
|
|
146
|
-
*
|
|
147
|
-
* @internal
|
|
148
52
|
*/
|
|
149
53
|
export declare function policy_min_after_days(options: AutoclosePolicy): number | undefined;
|
|
150
54
|
/**
|
|
@@ -154,10 +58,7 @@ export declare function policy_min_after_days(options: AutoclosePolicy): number
|
|
|
154
58
|
* window (via a windowed close) and derives its prune due-time as
|
|
155
59
|
* `tail.created` plus this many days — the earliest the oldest
|
|
156
60
|
* surviving domain event can age out of the window.
|
|
157
|
-
*
|
|
158
|
-
* @internal
|
|
159
61
|
*/
|
|
160
62
|
export declare function policy_keep_days(options: AutoclosePolicy): number | undefined;
|
|
161
63
|
export declare function compile_autoclose_policy(options: AutoclosePolicy): AutoclosePredicate<Schemas>;
|
|
162
|
-
export {};
|
|
163
64
|
//# sourceMappingURL=autoclose-policy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autoclose-policy.d.ts","sourceRoot":"","sources":["../../../src/internal/autoclose-policy.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"autoclose-policy.d.ts","sourceRoot":"","sources":["../../../src/internal/autoclose-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAClB,OAAO,EACR,MAAM,oBAAoB,CAAC;AA2B5B,gDAAgD;AAChD,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAEzD;AAED,+CAA+C;AAC/C,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAElD;AAmHD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,eAAe,GACvB,MAAM,GAAG,SAAS,CAMpB;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,GAAG,SAAS,CAG7E;AAED,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,eAAe,GACvB,kBAAkB,CAAC,OAAO,CAAC,CAiC7B"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @module autoclose-reaction
|
|
3
|
-
* @category Internal
|
|
4
|
-
*
|
|
5
2
|
* Synthesis of the online close-the-books reaction. `.autocloses(policy)`
|
|
6
3
|
* is not a sweep: it is a reaction on every event the declaring state owns
|
|
7
4
|
* that evaluates the policy against the LIVE head (so a reopened stream
|
|
@@ -14,11 +11,8 @@
|
|
|
14
11
|
* discovered by `classify_registry` and its target stream subscribed. The
|
|
15
12
|
* registry is complete once the builder finishes; the orchestrator never
|
|
16
13
|
* mutates it.
|
|
17
|
-
*
|
|
18
|
-
* @internal
|
|
19
14
|
*/
|
|
20
|
-
import type { Registry, SchemaRegister, Schemas, State } from "../types/index.js";
|
|
21
|
-
import { type AutocloseConfig } from "./config.js";
|
|
15
|
+
import type { AutocloseConfig, Registry, SchemaRegister, Schemas, State } from "../types/index.js";
|
|
22
16
|
/**
|
|
23
17
|
* Inject one synthesized autoclose reaction per `.autocloses(...)` state
|
|
24
18
|
* into the registry's event registers. The handler resolves ports at call
|
|
@@ -26,8 +20,6 @@ import { type AutocloseConfig } from "./config.js";
|
|
|
26
20
|
* The reactions are synthesized once into the shared registry, so nothing
|
|
27
21
|
* per-Act is captured here — the off-hours window is read from the running
|
|
28
22
|
* Act at resolution time via the injected `read_window`.
|
|
29
|
-
*
|
|
30
|
-
* @internal
|
|
31
23
|
*/
|
|
32
24
|
export declare function synthesize_autoclose_reactions<TSchemaReg extends SchemaRegister<TActions>, TEvents extends Schemas, TActions extends Schemas>(registry: Registry<TSchemaReg, TEvents, TActions>, states: ReadonlyMap<string, State<any, any, any>>,
|
|
33
25
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autoclose-reaction.d.ts","sourceRoot":"","sources":["../../../src/internal/autoclose-reaction.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"autoclose-reaction.d.ts","sourceRoot":"","sources":["../../../src/internal/autoclose-reaction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,KAAK,EACV,eAAe,EAEf,QAAQ,EACR,cAAc,EACd,OAAO,EACP,KAAK,EACN,MAAM,mBAAmB,CAAC;AAgB3B;;;;;;;GAOG;AACH,wBAAgB,8BAA8B,CAC5C,UAAU,SAAS,cAAc,CAAC,QAAQ,CAAC,EAC3C,OAAO,SAAS,OAAO,EACvB,QAAQ,SAAS,OAAO,EAExB,QAAQ,EAAE,QAAQ,CAAC,UAAU,EAAE,OAAO,EAAE,QAAQ,CAAC,EACjD,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AACjD;;;;;;GAMG;AACH,WAAW,EAAE,MAAM,eAAe,CAAC,iBAAiB,CAAC,GACpD,IAAI,CAkHN"}
|
|
@@ -1,21 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @module autoclose-window
|
|
3
|
-
* @category Internal
|
|
4
|
-
*
|
|
5
2
|
* Off-hours window math for autoclose — hour-in-zone, DST-gap handling, and
|
|
6
|
-
* "next time the window opens".
|
|
7
|
-
* resolver) lives in `./config.js`, the single home for builder-facing config
|
|
8
|
-
* bags; this module is the runtime window logic those knobs drive.
|
|
9
|
-
*
|
|
10
|
-
* @internal
|
|
3
|
+
* "next time the window opens".
|
|
11
4
|
*/
|
|
12
|
-
import type { AutocloseConfig } from "
|
|
5
|
+
import type { AutocloseConfig } from "../types/index.js";
|
|
13
6
|
/**
|
|
14
7
|
* The current hour `[0, 23]` in the given IANA time zone, DST-correct
|
|
15
8
|
* via `Intl`. Split out so the window check can be unit-tested without
|
|
16
9
|
* spinning a controller.
|
|
17
|
-
*
|
|
18
|
-
* @internal
|
|
19
10
|
*/
|
|
20
11
|
export declare function hour_in_zone(now: Date, timeZone: string): number;
|
|
21
12
|
/**
|
|
@@ -28,8 +19,6 @@ export declare function hour_in_zone(now: Date, timeZone: string): number;
|
|
|
28
19
|
* would otherwise be closed for the whole day (the `start` hour never
|
|
29
20
|
* occurs). The gap's replacement instant is admitted so autoclose still
|
|
30
21
|
* runs — see {@link is_dst_gap_open}.
|
|
31
|
-
*
|
|
32
|
-
* @internal
|
|
33
22
|
*/
|
|
34
23
|
export declare function in_autoclose_window(window: AutocloseConfig["autocloseWindow"], now: Date): boolean;
|
|
35
24
|
/**
|
|
@@ -59,8 +48,6 @@ export declare function in_autoclose_window(window: AutocloseConfig["autocloseWi
|
|
|
59
48
|
* that boundary instant — deferring ~1 h to the replacement instant
|
|
60
49
|
* rather than a full day. The boundary is returned as-is (no minute
|
|
61
50
|
* offset): the gap opening is a single transition instant, not a range.
|
|
62
|
-
*
|
|
63
|
-
* @internal
|
|
64
51
|
*/
|
|
65
52
|
export declare function next_window_open(window: NonNullable<AutocloseConfig["autocloseWindow"]>, now: Date): Date;
|
|
66
53
|
//# sourceMappingURL=autoclose-window.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autoclose-window.d.ts","sourceRoot":"","sources":["../../../src/internal/autoclose-window.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"autoclose-window.d.ts","sourceRoot":"","sources":["../../../src/internal/autoclose-window.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAOhE;AAkCD;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,eAAe,CAAC,iBAAiB,CAAC,EAC1C,GAAG,EAAE,IAAI,GACR,OAAO,CAOT;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,WAAW,CAAC,eAAe,CAAC,iBAAiB,CAAC,CAAC,EACvD,GAAG,EAAE,IAAI,GACR,IAAI,CAoBN"}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @module backoff
|
|
3
|
-
* @category Internal
|
|
4
|
-
*
|
|
5
2
|
* Per-reaction retry backoff delay computation. Pure function — keeps
|
|
6
|
-
* `DrainController` and `
|
|
7
|
-
*
|
|
8
|
-
* @internal
|
|
3
|
+
* `DrainController` and `finalize` (in `drain-cycle.ts`) testable in isolation.
|
|
9
4
|
*/
|
|
10
5
|
import type { BackoffOptions } from "../types/action.js";
|
|
11
6
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backoff.d.ts","sourceRoot":"","sources":["../../../src/internal/backoff.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"backoff.d.ts","sourceRoot":"","sources":["../../../src/internal/backoff.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,cAAc,GAAG,SAAS,GAC/B,MAAM,CAyBR"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @module internal/circuit-breaker
|
|
3
|
-
*
|
|
4
2
|
* Orchestrator-level circuit breaker for store operations. The drain loop
|
|
5
3
|
* polls `claim()` continuously; when the backing store goes down every poll
|
|
6
4
|
* throws a {@link StoreError}, and without a breaker the orchestrator would
|
|
@@ -17,9 +15,8 @@
|
|
|
17
15
|
* Time is passed in (`now`) rather than read from the clock so the state
|
|
18
16
|
* machine is deterministic under test.
|
|
19
17
|
*/
|
|
18
|
+
import type { CircuitState } from "../types/index.js";
|
|
20
19
|
import type { CircuitBreakerConfig } from "./config.js";
|
|
21
|
-
/** Circuit breaker state. */
|
|
22
|
-
export type CircuitState = "closed" | "open" | "half-open";
|
|
23
20
|
/**
|
|
24
21
|
* Side-effect hooks the orchestrator wires into the breaker so consumers
|
|
25
22
|
* (drain / settle / autoclose) don't each thread their own callbacks.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"circuit-breaker.d.ts","sourceRoot":"","sources":["../../../src/internal/circuit-breaker.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"circuit-breaker.d.ts","sourceRoot":"","sources":["../../../src/internal/circuit-breaker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExD;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,+EAA+E;IAC/E,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,KAAK,IAAI,CAAC;IACpE;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CAChC,CAAC;AAEF,qBAAa,cAAc;IACzB,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,UAAU,CAAqB;IACvC,OAAO,CAAC,KAAK,CAA4C;IACzD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsB;IAE7C,YAAY,MAAM,EAAE,oBAAoB,EAAE,KAAK,GAAE,mBAAwB,EAIxE;IAED;;;;;OAKG;IACH,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,uEAAuE;IACvE,IAAI,WAAW,IAAI,MAAM,CAExB;IAED,gDAAgD;IAChD,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAG/B;IAED,wEAAwE;IACxE,MAAM,IAAI,IAAI,CAIb;IAED;;;;;;;;;OASG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,YAAY,CAKjD;IAED,oEAAoE;IACpE,IAAI,IAAI,IAAI,CAEX;IAED;;;;;OAKG;IACH,OAAO,CAAC,cAAc;IAUtB,OAAO,CAAC,WAAW;IAOnB,6DAA6D;IAC7D,OAAO,CAAC,QAAQ;CAcjB"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @module build-classify
|
|
3
|
-
* @category Internal
|
|
4
|
-
*
|
|
5
2
|
* Build-time classification of the registry + state map. The Act constructor
|
|
6
3
|
* needs three pre-computed inputs to wire its runtime subsystems:
|
|
7
4
|
*
|
|
@@ -15,24 +12,18 @@
|
|
|
15
12
|
*
|
|
16
13
|
* Pure function — single pass over events + states, fully testable without
|
|
17
14
|
* instantiating Act.
|
|
18
|
-
*
|
|
19
|
-
* @internal
|
|
20
15
|
*/
|
|
21
|
-
import type { StaticTarget } from "../internal/index.js";
|
|
22
16
|
import type { Registry, Schema, SchemaRegister, Schemas, State } from "../types/index.js";
|
|
17
|
+
import type { StaticTarget } from "./correlate-cycle.js";
|
|
23
18
|
/**
|
|
24
19
|
* Classification result. Returned by {@link classify_registry}; consumed
|
|
25
20
|
* piecewise by Act's constructor.
|
|
26
|
-
*
|
|
27
|
-
* @internal
|
|
28
21
|
*/
|
|
29
22
|
/**
|
|
30
23
|
* Sentinel for "any reaction on this event has a dynamic resolver, so
|
|
31
24
|
* the lane is opaque until correlate runs the function — arm every
|
|
32
25
|
* controller." A Symbol rather than a string literal so it can't
|
|
33
26
|
* collide with a user-declared lane named `"all"`.
|
|
34
|
-
*
|
|
35
|
-
* @internal
|
|
36
27
|
*/
|
|
37
28
|
export declare const ALL_LANES: unique symbol;
|
|
38
29
|
/**
|
|
@@ -41,8 +32,6 @@ export declare const ALL_LANES: unique symbol;
|
|
|
41
32
|
* declared lanes — `do()` arms only those controllers on commit. For
|
|
42
33
|
* events with at least one dynamic resolver, the value is
|
|
43
34
|
* {@link ALL_LANES}; `do()` falls back to arming every controller.
|
|
44
|
-
*
|
|
45
|
-
* @internal
|
|
46
35
|
*/
|
|
47
36
|
export type EventLaneSet = ReadonlySet<string> | typeof ALL_LANES;
|
|
48
37
|
export type Classification = {
|
|
@@ -55,8 +44,6 @@ export type Classification = {
|
|
|
55
44
|
* reactive event names, the per-event lane fan-in, and the event-to-state
|
|
56
45
|
* map. Static targets are deduplicated by (target, source) — two reactions
|
|
57
46
|
* routing to the same projection produce one subscription.
|
|
58
|
-
*
|
|
59
|
-
* @internal
|
|
60
47
|
*/
|
|
61
48
|
export declare function classify_registry<TSchemaReg extends SchemaRegister<TActions>, TEvents extends Schemas, TActions extends Schemas>(registry: Registry<TSchemaReg, TEvents, TActions>, states: ReadonlyMap<string, State<Schema, any, any>>): Classification;
|
|
62
|
-
//# sourceMappingURL=
|
|
49
|
+
//# sourceMappingURL=classify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classify.d.ts","sourceRoot":"","sources":["../../../src/internal/classify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EACV,QAAQ,EACR,MAAM,EACN,cAAc,EACd,OAAO,EACP,KAAK,EACN,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD;;;GAGG;AACH;;;;;GAKG;AACH,eAAO,MAAM,SAAS,EAAE,OAAO,MAAqC,CAAC;AAErE;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG,WAAW,CAAC,MAAM,CAAC,GAAG,OAAO,SAAS,CAAC;AAElE,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,cAAc,EAAE,YAAY,EAAE,CAAC;IACxC,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;IACnE,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;CAC5D,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,SAAS,cAAc,CAAC,QAAQ,CAAC,EAC3C,OAAO,SAAS,OAAO,EACvB,QAAQ,SAAS,OAAO,EAExB,QAAQ,EAAE,QAAQ,CAAC,UAAU,EAAE,OAAO,EAAE,QAAQ,CAAC,EACjD,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,GACnD,cAAc,CA4EhB"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @module close-cycle
|
|
3
|
-
* @category Internal
|
|
4
|
-
*
|
|
5
2
|
* Pure orchestration of the close-the-books flow: scan stream heads,
|
|
6
3
|
* partition by reaction safety, guard with tombstones, optionally seed
|
|
7
4
|
* restart state, run user archive callbacks, atomically truncate, and
|
|
@@ -10,16 +7,12 @@
|
|
|
10
7
|
* Also home to the pieces a closer needs around the cycle: the per-stream
|
|
11
8
|
* {@link CloseLock} and the bounded {@link catch_up_correlation}. The Act
|
|
12
9
|
* orchestrator only wires its ports in and emits `"closed"`.
|
|
13
|
-
*
|
|
14
|
-
* @internal
|
|
15
10
|
*/
|
|
16
11
|
import type { CloseResult, CloseTarget, Logger, State } from "../types/index.js";
|
|
17
12
|
import type { EsOps } from "./event-sourcing.js";
|
|
18
13
|
/**
|
|
19
14
|
* Dependencies the close cycle needs from the Act orchestrator. Decoupled
|
|
20
15
|
* from `Act` itself so the cycle can be exercised from tests in isolation.
|
|
21
|
-
*
|
|
22
|
-
* @internal
|
|
23
16
|
*/
|
|
24
17
|
export type CloseCycleDeps = {
|
|
25
18
|
/** Whether any event has a reaction; without one nothing can be pending. */
|
|
@@ -75,8 +68,6 @@ export type CloseCycleDeps = {
|
|
|
75
68
|
*
|
|
76
69
|
* Stops as soon as a pass makes no progress (the log has no more to give),
|
|
77
70
|
* and after {@link CLOSE_CATCH_UP_PASSES} windows.
|
|
78
|
-
*
|
|
79
|
-
* @internal
|
|
80
71
|
*/
|
|
81
72
|
export declare function catch_up_correlation(cursor: {
|
|
82
73
|
readonly checkpoint: number;
|
|
@@ -86,8 +77,6 @@ export declare function catch_up_correlation(cursor: {
|
|
|
86
77
|
* Per-stream serialization for close critical sections: two closers of the
|
|
87
78
|
* same stream never prune or archive concurrently, while different streams
|
|
88
79
|
* proceed in parallel. One instance per Act.
|
|
89
|
-
*
|
|
90
|
-
* @internal
|
|
91
80
|
*/
|
|
92
81
|
export declare class CloseLock {
|
|
93
82
|
private readonly _tails;
|
|
@@ -102,8 +91,6 @@ export declare class CloseLock {
|
|
|
102
91
|
* pure prefix delete behind an existing snapshot (see
|
|
103
92
|
* {@link run_windowed_closes}); the rest run the guarded
|
|
104
93
|
* tombstone/restart pipeline below.
|
|
105
|
-
*
|
|
106
|
-
* @internal
|
|
107
94
|
*/
|
|
108
95
|
export declare function run_close_cycle(targets: CloseTarget[], deps: CloseCycleDeps): Promise<CloseResult>;
|
|
109
96
|
//# sourceMappingURL=close-cycle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"close-cycle.d.ts","sourceRoot":"","sources":["../../../src/internal/close-cycle.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"close-cycle.d.ts","sourceRoot":"","sources":["../../../src/internal/close-cycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,MAAM,EAEN,KAAK,EACN,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAGjD;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,4EAA4E;IAC5E,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;IACnE,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;IACxB;;;;;OAKG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC;;;;;;;;;OASG;IACH,QAAQ,CAAC,oBAAoB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAClE;;;;;OAKG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,EAC5B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,KACnB,OAAO,CAAC,CAAC,CAAC,CAAC;IAChB;;;;;;OAMG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CAC1D,CAAC;AAUF;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE;IAAE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAAC,GAAG,IAAI,IAAI,CAAA;CAAE,EACpD,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,EAC9C,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,MAAM,CAAC,CAajB;AAED;;;;GAIG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAuC;IAE9D,oEAAoE;IACpE,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAYzD;CACF;AA8BD;;;;;;;;GAQG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,WAAW,EAAE,EACtB,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,WAAW,CAAC,CA+BtB"}
|
|
@@ -1,46 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* hand-written `if (x < min) throw` ladder — so misconfiguration surfaces as
|
|
10
|
-
* a `ZodError` at the entry point, not as `NaN` arithmetic on the first cycle
|
|
11
|
-
* tick.
|
|
12
|
-
*
|
|
13
|
-
* Layout: one section per bag, each with its `DEFAULT_*` constants, an
|
|
14
|
-
* internal `<Type>OptionsSchema`, an inferred `<Type>Config`, and a
|
|
15
|
-
* `resolve<Type>Config(options): <Type>Config`. The schema is never
|
|
16
|
-
* re-exported — the public surface is the inferred type + resolver.
|
|
17
|
-
*
|
|
18
|
-
* Index of bags owned here:
|
|
19
|
-
* - **Backoff** — retry pacing (`BackoffOptions`), nested in reaction/action.
|
|
20
|
-
* - **Reaction** — `.do(handler, options)` (`blockOnError` / `maxRetries` / `backoff`).
|
|
21
|
-
* - **Action** — `.on(entry, options)` (`maxRetries` / `backoff`).
|
|
22
|
-
* - **Lane** — `.withLane({...})` (`leaseMillis` / `streamLimit` / `cycleMs`).
|
|
23
|
-
* - **Drain / Settle** — `drain(...)` / `settle(...)` runtime knobs.
|
|
24
|
-
* - **Autoclose** — the `.autocloses` / `ActOptions` autoclose knobs (+ window).
|
|
25
|
-
* - **CircuitBreaker** — the store-op breaker on `ActOptions`.
|
|
26
|
-
* - **Fold** — `projection(...).of(...)` batch-fold knobs.
|
|
27
|
-
*
|
|
28
|
-
* Sibling env/package config (`config()`, `NODE_ENV`, log level) lives in the
|
|
29
|
-
* public `../config.ts` — a different concern (process environment, not
|
|
30
|
-
* builder input). The `@rotorsoft/act-http` transport bags (`SseOptions`,
|
|
31
|
-
* `OpenAPIOptions`) live in that package; core cannot own another package's
|
|
32
|
-
* surface.
|
|
33
|
-
*
|
|
34
|
-
* Validation philosophy: reject only what is genuinely broken — `NaN`,
|
|
35
|
-
* `±Infinity` (Zod 4's `z.number()` rejects both by default), and negatives
|
|
36
|
-
* where nonsensical. A value that works today is never newly rejected. The
|
|
37
|
-
* real strictness lands on `maxRetries` and `backoff`, the knobs whose bad
|
|
38
|
-
* values silently corrupt the poison-quarantine and retry-loop-exit gates.
|
|
39
|
-
*
|
|
40
|
-
* @internal
|
|
2
|
+
* The single home for every builder-facing config bag in act-core: one
|
|
3
|
+
* section per bag, each with its `DEFAULT_*` constants, an internal
|
|
4
|
+
* `<Type>OptionsSchema`, the inferred `<Type>Config` and a
|
|
5
|
+
* `resolve<Type>Config`, so misconfiguration throws a `ZodError` at the
|
|
6
|
+
* entry point. Validation rejects only what is broken (`NaN`, `±Infinity`,
|
|
7
|
+
* nonsensical negatives) and never newly rejects a value that works. The
|
|
8
|
+
* rules are in CLAUDE.md § Config-validation schemas.
|
|
41
9
|
*/
|
|
42
10
|
import { z } from "zod";
|
|
43
|
-
import type { ActOptions } from "../act.js";
|
|
11
|
+
import type { ActOptions, AutocloseConfig, CircuitBreakerOptions } from "../types/act.js";
|
|
44
12
|
import type { ActionOptions, BackoffOptions, DrainOptions, FoldOptions, LaneConfig, ReactionOptions, SettleOptions, ShutdownOptions } from "../types/index.js";
|
|
45
13
|
/**
|
|
46
14
|
* Retry pacing for a reaction that declares no backoff, and for projections
|
|
@@ -97,18 +65,6 @@ export declare const DEFAULT_STREAM_LIMIT = 10;
|
|
|
97
65
|
export declare const DEFAULT_EVENT_LIMIT = 10;
|
|
98
66
|
/** How long a drain holds a stream's lease (ms). */
|
|
99
67
|
export declare const DEFAULT_LEASE_MILLIS = 10000;
|
|
100
|
-
/**
|
|
101
|
-
* Default debounce window (ms) for `settle()` when neither the per-call
|
|
102
|
-
* `SettleOptions.debounceMs` nor `ActOptions.settleDebounceMs` is set.
|
|
103
|
-
* Coalesces commits in the same tick and small bursts.
|
|
104
|
-
*/
|
|
105
|
-
export declare const DEFAULT_SETTLE_DEBOUNCE_MS = 10;
|
|
106
|
-
/**
|
|
107
|
-
* Default LRU cap for the subscribed-streams cache. Apps that mint many
|
|
108
|
-
* dynamic targets (one per aggregate) should override it with
|
|
109
|
-
* `ActOptions.maxSubscribedStreams`.
|
|
110
|
-
*/
|
|
111
|
-
export declare const DEFAULT_MAX_SUBSCRIBED_STREAMS = 1000;
|
|
112
68
|
/** Validate drain options, or pass `undefined` through. Throws `ZodError`. */
|
|
113
69
|
export declare function resolveDrainConfig(options: DrainOptions | undefined): DrainOptions | undefined;
|
|
114
70
|
/** Validate settle options, or pass `undefined` through. Throws `ZodError`. */
|
|
@@ -126,38 +82,10 @@ export declare const MAX_SHUTDOWN_GRACE_MS = 30000;
|
|
|
126
82
|
export declare function resolveShutdownConfig(options: ShutdownOptions | undefined): ShutdownOptions | undefined;
|
|
127
83
|
/** Validate the scalar `ActOptions` knobs at build. Throws `ZodError`. */
|
|
128
84
|
export declare function resolveActConfig(options: ActOptions | undefined): ActOptions | undefined;
|
|
129
|
-
/**
|
|
130
|
-
* @deprecated The cadence knob is derived from `autocloseWindow` now;
|
|
131
|
-
* nothing consumes it. Kept for compat; removed in the next major.
|
|
132
|
-
*/
|
|
133
|
-
export declare const DEFAULT_AUTOCLOSE_CYCLE_MINUTES = 720;
|
|
134
|
-
/** @deprecated Unused since the autoclose sweep was removed. */
|
|
135
|
-
export declare const DEFAULT_CLOSE_BATCH_SIZE = 64;
|
|
136
|
-
/** @deprecated Unused since the autoclose sweep was removed. */
|
|
137
|
-
export declare const DEFAULT_CLOSE_YIELD_MS = 0;
|
|
138
|
-
declare const AutocloseOptionsSchema: z.ZodObject<{
|
|
139
|
-
autocloseCycleMinutes: z.ZodDefault<z.ZodNumber>;
|
|
140
|
-
closeBatchSize: z.ZodDefault<z.ZodNumber>;
|
|
141
|
-
closeYieldMs: z.ZodDefault<z.ZodNumber>;
|
|
142
|
-
closeOnError: z.ZodDefault<z.ZodBoolean>;
|
|
143
|
-
autocloseWindow: z.ZodOptional<z.ZodObject<{
|
|
144
|
-
start: z.ZodNumber;
|
|
145
|
-
end: z.ZodNumber;
|
|
146
|
-
timeZone: z.ZodDefault<z.ZodString>;
|
|
147
|
-
}, z.core.$strip>>;
|
|
148
|
-
}, z.core.$strip>;
|
|
149
|
-
/** Resolved autoclose configuration after validation + default expansion. */
|
|
150
|
-
export type AutocloseConfig = z.infer<typeof AutocloseOptionsSchema>;
|
|
151
85
|
/** Validate + default the autoclose knobs on `ActOptions`. Throws `ZodError`. */
|
|
152
86
|
export declare function resolveAutocloseConfig(options: ActOptions | undefined): AutocloseConfig;
|
|
153
|
-
declare const CircuitBreakerOptionsSchema: z.ZodObject<{
|
|
154
|
-
failureThreshold: z.ZodDefault<z.ZodNumber>;
|
|
155
|
-
cooldownMs: z.ZodDefault<z.ZodNumber>;
|
|
156
|
-
}, z.core.$strip>;
|
|
157
|
-
/** Public, all-optional circuit-breaker options bag for `act().build()`. */
|
|
158
|
-
export type CircuitBreakerOptions = z.input<typeof CircuitBreakerOptionsSchema>;
|
|
159
87
|
/** Resolved circuit-breaker configuration. */
|
|
160
|
-
export type CircuitBreakerConfig =
|
|
88
|
+
export type CircuitBreakerConfig = Required<CircuitBreakerOptions>;
|
|
161
89
|
/** Parse + apply defaults. Throws `ZodError` on out-of-range values. */
|
|
162
90
|
export declare const resolveCircuitBreakerConfig: (options?: CircuitBreakerOptions) => CircuitBreakerConfig;
|
|
163
91
|
declare const FoldOptionsSchema: z.ZodObject<{
|