@rotorsoft/act 1.23.6 → 1.23.7
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.map +1 -1
- package/dist/@types/builders/act-builder.d.ts.map +1 -1
- package/dist/@types/builders/state-builder.d.ts.map +1 -1
- package/dist/@types/internal/autoclose-reaction.d.ts +1 -1
- package/dist/@types/internal/autoclose-reaction.d.ts.map +1 -1
- package/dist/@types/internal/autoclose-window.d.ts +66 -0
- package/dist/@types/internal/autoclose-window.d.ts.map +1 -0
- package/dist/@types/internal/backoff.d.ts.map +1 -1
- package/dist/@types/internal/builder-utils.d.ts.map +1 -1
- package/dist/@types/internal/circuit-breaker.d.ts +1 -19
- package/dist/@types/internal/circuit-breaker.d.ts.map +1 -1
- package/dist/@types/internal/config.d.ts +139 -0
- package/dist/@types/internal/config.d.ts.map +1 -0
- package/dist/@types/internal/index.d.ts +4 -3
- package/dist/@types/internal/index.d.ts.map +1 -1
- package/dist/@types/internal/projection-fold.d.ts +2 -11
- package/dist/@types/internal/projection-fold.d.ts.map +1 -1
- package/dist/@types/types/action.d.ts +7 -2
- package/dist/@types/types/action.d.ts.map +1 -1
- package/dist/index.cjs +179 -107
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +179 -107
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/@types/internal/autoclose-config.d.ts +0 -142
- package/dist/@types/internal/autoclose-config.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module autoclose-config
|
|
3
|
-
* @category Internal
|
|
4
|
-
*
|
|
5
|
-
* Defaults, Zod schema, and resolver for the autoclose knobs on
|
|
6
|
-
* {@link ActOptions} (#837 / epic #802). Split out of `act.ts` so the
|
|
7
|
-
* orchestrator file stays focused on the `Act` class and the
|
|
8
|
-
* autoclose surface lives with the cycle + controller that consume
|
|
9
|
-
* it. The validation pattern matches the rest of the framework —
|
|
10
|
-
* Zod schema with `.min().max().default(...)` per field — so the
|
|
11
|
-
* upcoming policy-factory subs (#838 retention, #839 terminal,
|
|
12
|
-
* #840 cardinality) can `.extend(...)` it for their own
|
|
13
|
-
* per-policy options without reinventing range checks.
|
|
14
|
-
*
|
|
15
|
-
* @internal
|
|
16
|
-
*/
|
|
17
|
-
import { z } from "zod";
|
|
18
|
-
import type { ActOptions } from "../act.js";
|
|
19
|
-
/**
|
|
20
|
-
* Default {@link ActOptions.autocloseCycleMinutes}: 720 (12 h).
|
|
21
|
-
*
|
|
22
|
-
* @deprecated The knob it defaults is deprecated (#1175) — the
|
|
23
|
-
* off-window re-check is derived from `autocloseWindow` via
|
|
24
|
-
* {@link next_window_open}, so nothing consumes the cadence. Kept so
|
|
25
|
-
* existing imports and the compat validation keep working; removed in
|
|
26
|
-
* the next major.
|
|
27
|
-
*/
|
|
28
|
-
export declare const DEFAULT_AUTOCLOSE_CYCLE_MINUTES = 720;
|
|
29
|
-
/**
|
|
30
|
-
* Default {@link ActOptions.closeBatchSize}: 64.
|
|
31
|
-
*
|
|
32
|
-
* @deprecated Dead since #1090 removed the autoclose sweep — nothing
|
|
33
|
-
* pages the store in batches. Kept for compat; removed in the next
|
|
34
|
-
* major.
|
|
35
|
-
*/
|
|
36
|
-
export declare const DEFAULT_CLOSE_BATCH_SIZE = 64;
|
|
37
|
-
/**
|
|
38
|
-
* Default {@link ActOptions.closeYieldMs}: 0.
|
|
39
|
-
*
|
|
40
|
-
* @deprecated Dead since #1090 removed the autoclose sweep — there is
|
|
41
|
-
* no truncate loop to yield between. Kept for compat; removed in the
|
|
42
|
-
* next major.
|
|
43
|
-
*/
|
|
44
|
-
export declare const DEFAULT_CLOSE_YIELD_MS = 0;
|
|
45
|
-
/**
|
|
46
|
-
* Default time zone for {@link ActOptions.autocloseWindow} when the
|
|
47
|
-
* operator declares a window without one. UTC keeps the contract
|
|
48
|
-
* timezone-explicit; operators who think in local off-hours pass an
|
|
49
|
-
* IANA name.
|
|
50
|
-
*/
|
|
51
|
-
export declare const DEFAULT_AUTOCLOSE_WINDOW_TZ = "UTC";
|
|
52
|
-
/**
|
|
53
|
-
* Zod schema for the autoclose knobs on {@link ActOptions}. Same
|
|
54
|
-
* declarative-validation pattern the framework uses elsewhere
|
|
55
|
-
* (`libs/act/src/config.ts`, every event/action schema, every
|
|
56
|
-
* reaction-option shape). Defaults, ranges, and integer constraints
|
|
57
|
-
* live in one place — no parallel `DEFAULT_*` + `*_MIN` / `*_MAX`
|
|
58
|
-
* declarations to keep in sync. Out-of-range values throw `ZodError`
|
|
59
|
-
* at `act().build()` so misconfiguration surfaces at startup, not
|
|
60
|
-
* on the first cycle tick.
|
|
61
|
-
*
|
|
62
|
-
* @internal
|
|
63
|
-
*/
|
|
64
|
-
declare const AutocloseOptionsSchema: z.ZodObject<{
|
|
65
|
-
autocloseCycleMinutes: z.ZodDefault<z.ZodNumber>;
|
|
66
|
-
closeBatchSize: z.ZodDefault<z.ZodNumber>;
|
|
67
|
-
closeYieldMs: z.ZodDefault<z.ZodNumber>;
|
|
68
|
-
closeOnError: z.ZodDefault<z.ZodBoolean>;
|
|
69
|
-
autocloseWindow: z.ZodOptional<z.ZodObject<{
|
|
70
|
-
start: z.ZodNumber;
|
|
71
|
-
end: z.ZodNumber;
|
|
72
|
-
timeZone: z.ZodDefault<z.ZodString>;
|
|
73
|
-
}, z.core.$strip>>;
|
|
74
|
-
}, z.core.$strip>;
|
|
75
|
-
/**
|
|
76
|
-
* Resolved autoclose configuration after validation and default
|
|
77
|
-
* expansion. Reachable through the public root (`@rotorsoft/act`) so
|
|
78
|
-
* fields follow the public-camelCase convention and mirror the
|
|
79
|
-
* `ActOptions` knob names directly — no per-resolver renaming layer.
|
|
80
|
-
*/
|
|
81
|
-
export type AutocloseConfig = z.infer<typeof AutocloseOptionsSchema>;
|
|
82
|
-
/**
|
|
83
|
-
* Validate and apply defaults for the autoclose knobs on
|
|
84
|
-
* {@link ActOptions}. Called from `act().build()`. Out-of-range
|
|
85
|
-
* values throw `ZodError` at startup, not on the first cycle tick.
|
|
86
|
-
*/
|
|
87
|
-
export declare function resolveAutocloseConfig(options: ActOptions | undefined): AutocloseConfig;
|
|
88
|
-
/**
|
|
89
|
-
* The current hour `[0, 23]` in the given IANA time zone, DST-correct
|
|
90
|
-
* via `Intl`. Split out so the window check can be unit-tested without
|
|
91
|
-
* spinning a controller.
|
|
92
|
-
*
|
|
93
|
-
* @internal
|
|
94
|
-
*/
|
|
95
|
-
export declare function hour_in_zone(now: Date, timeZone: string): number;
|
|
96
|
-
/**
|
|
97
|
-
* Whether `now` falls inside the configured off-hours window. The
|
|
98
|
-
* window is half-open on hour boundaries — `[start, end)` — and wraps
|
|
99
|
-
* past midnight when `start > end`. With no window configured every
|
|
100
|
-
* tick runs, so callers treat `undefined` as "always in window."
|
|
101
|
-
*
|
|
102
|
-
* On a DST spring-forward day whose `start` hour is skipped, the window
|
|
103
|
-
* would otherwise be closed for the whole day (the `start` hour never
|
|
104
|
-
* occurs). The gap's replacement instant is admitted so autoclose still
|
|
105
|
-
* runs — see {@link is_dst_gap_open}.
|
|
106
|
-
*
|
|
107
|
-
* @internal
|
|
108
|
-
*/
|
|
109
|
-
export declare function in_autoclose_window(window: AutocloseConfig["autocloseWindow"], now: Date): boolean;
|
|
110
|
-
/**
|
|
111
|
-
* The next instant the off-hours window opens at or after `now`. The
|
|
112
|
-
* synthesized autoclose reaction defers to this when a tick lands
|
|
113
|
-
* outside the window — parking until the window actually opens instead
|
|
114
|
-
* of blind-polling on a configured cadence (the pre-#1175 behavior,
|
|
115
|
-
* where a poll interval longer than the window could oscillate around
|
|
116
|
-
* it and miss it repeatedly).
|
|
117
|
-
*
|
|
118
|
-
* Walks forward hour by hour and asks `Intl` for the local hour at each
|
|
119
|
-
* step, so DST transitions resolve exactly the way the runtime's zone
|
|
120
|
-
* database says they do — a 23- or 25-hour day never desynchronizes the
|
|
121
|
-
* walk. The window validates as non-empty at build, and every zone hits
|
|
122
|
-
* each `[0, 23]` hour label within any 48-hour span, so the walk always
|
|
123
|
-
* terminates; the bound is a defensive backstop, with "one day out" as
|
|
124
|
-
* the fallback no real zone can reach.
|
|
125
|
-
*
|
|
126
|
-
* Minute/second offsets within the opening hour are preserved from
|
|
127
|
-
* `now` shifted by whole hours — the contract is hour-granular, matching
|
|
128
|
-
* the window's own `[start, end)` hour semantics.
|
|
129
|
-
*
|
|
130
|
-
* On a DST spring-forward day whose `start` hour is skipped, the `start`
|
|
131
|
-
* hour never occurs, so the minute-preserving walk would never match and
|
|
132
|
-
* the window would defer ~24 h. The walk also checks each hour-aligned
|
|
133
|
-
* boundary for the gap opening (see {@link is_dst_gap_open}) and returns
|
|
134
|
-
* that boundary instant — deferring ~1 h to the replacement instant
|
|
135
|
-
* rather than a full day. The boundary is returned as-is (no minute
|
|
136
|
-
* offset): the gap opening is a single transition instant, not a range.
|
|
137
|
-
*
|
|
138
|
-
* @internal
|
|
139
|
-
*/
|
|
140
|
-
export declare function next_window_open(window: NonNullable<AutocloseConfig["autocloseWindow"]>, now: Date): Date;
|
|
141
|
-
export {};
|
|
142
|
-
//# sourceMappingURL=autoclose-config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"autoclose-config.d.ts","sourceRoot":"","sources":["../../../src/internal/autoclose-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C;;;;;;;;GAQG;AACH,eAAO,MAAM,+BAA+B,MAAM,CAAC;AAEnD;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAE3C;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,QAAQ,CAAC;AAkDjD;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,sBAAsB;;;;;;;;;;iBAgB1B,CAAC;AAEH;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAErE;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,UAAU,GAAG,SAAS,GAC9B,eAAe,CAQjB;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAOhE;AAsCD;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,eAAe,CAAC,iBAAiB,CAAC,EAC1C,GAAG,EAAE,IAAI,GACR,OAAO,CAOT;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,WAAW,CAAC,eAAe,CAAC,iBAAiB,CAAC,CAAC,EACvD,GAAG,EAAE,IAAI,GACR,IAAI,CAeN"}
|