@rotorsoft/act 2.1.8 → 2.1.10
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/builder-utils.d.ts.map +1 -1
- package/dist/@types/deprecated.d.ts +0 -3
- package/dist/@types/deprecated.d.ts.map +1 -1
- package/dist/@types/index.d.ts +1 -1
- package/dist/@types/index.d.ts.map +1 -1
- package/dist/@types/internal/autoclose-policy.d.ts +1 -1
- package/dist/@types/internal/autoclose-policy.d.ts.map +1 -1
- package/dist/@types/internal/config.d.ts +128 -91
- package/dist/@types/internal/config.d.ts.map +1 -1
- package/dist/@types/internal/correlate-cycle.d.ts.map +1 -1
- package/dist/@types/internal/defer-config.d.ts +2 -9
- package/dist/@types/internal/defer-config.d.ts.map +1 -1
- package/dist/@types/types/act.d.ts +2 -2
- package/dist/@types/types/audit.d.ts +4 -1
- package/dist/@types/types/audit.d.ts.map +1 -1
- package/dist/adapter.cjs +3 -3
- package/dist/adapter.js +2 -2
- package/dist/{chunk-C35J3SNT.js → chunk-BQUOIHOR.js} +1 -1
- package/dist/chunk-BQUOIHOR.js.map +1 -0
- package/dist/{chunk-C4JJ7LTB.cjs → chunk-N74AN6L5.cjs} +133 -128
- package/dist/chunk-N74AN6L5.cjs.map +1 -0
- package/dist/{chunk-TUALNYW2.js → chunk-RV34EYSN.js} +2 -2
- package/dist/{chunk-D7LQNOEV.cjs → chunk-SC6TY4P2.cjs} +4 -4
- package/dist/{chunk-D7LQNOEV.cjs.map → chunk-SC6TY4P2.cjs.map} +1 -1
- package/dist/{chunk-GUMG5AVZ.js → chunk-Y2ISPWQL.js} +114 -109
- package/dist/chunk-Y2ISPWQL.js.map +1 -0
- package/dist/{chunk-QFYPSI6P.cjs → chunk-ZTHGF62O.cjs} +1 -1
- package/dist/chunk-ZTHGF62O.cjs.map +1 -0
- package/dist/index.cjs +204 -272
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +47 -115
- package/dist/index.js.map +1 -1
- package/dist/test/index.cjs +5 -5
- package/dist/test/index.js +3 -3
- package/dist/types/index.cjs +2 -2
- package/dist/types/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-C35J3SNT.js.map +0 -1
- package/dist/chunk-C4JJ7LTB.cjs.map +0 -1
- package/dist/chunk-GUMG5AVZ.js.map +0 -1
- package/dist/chunk-QFYPSI6P.cjs.map +0 -1
- /package/dist/{chunk-TUALNYW2.js.map → chunk-RV34EYSN.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -11,36 +11,23 @@ import {
|
|
|
11
11
|
LruMap,
|
|
12
12
|
MAX_SHUTDOWN_GRACE_MS,
|
|
13
13
|
cache,
|
|
14
|
-
|
|
15
|
-
check_store,
|
|
14
|
+
check,
|
|
16
15
|
config,
|
|
17
16
|
current_autoclose_window,
|
|
18
17
|
current_reacting,
|
|
19
18
|
dispose,
|
|
20
19
|
disposeAndExit,
|
|
21
|
-
is_valid_target,
|
|
22
20
|
log,
|
|
23
21
|
make_reaction_scope,
|
|
24
22
|
make_run_scoped,
|
|
25
23
|
package_schema,
|
|
26
24
|
port,
|
|
27
25
|
register_weak_disposer,
|
|
28
|
-
resolveActConfig,
|
|
29
|
-
resolveActionConfig,
|
|
30
|
-
resolveAutocloseConfig,
|
|
31
|
-
resolveCircuitBreakerConfig,
|
|
32
|
-
resolveDrainConfig,
|
|
33
|
-
resolveFoldConfig,
|
|
34
|
-
resolveLaneConfig,
|
|
35
|
-
resolveReactionConfig,
|
|
36
|
-
resolveSettleConfig,
|
|
37
|
-
resolveShutdownConfig,
|
|
38
|
-
resolveTargetConfig,
|
|
39
26
|
sleep,
|
|
40
27
|
store,
|
|
41
28
|
unscoped_ports,
|
|
42
29
|
validate
|
|
43
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-Y2ISPWQL.js";
|
|
44
31
|
import {
|
|
45
32
|
checkAppends,
|
|
46
33
|
checkVersion,
|
|
@@ -49,7 +36,7 @@ import {
|
|
|
49
36
|
isStreamName,
|
|
50
37
|
parseNotification,
|
|
51
38
|
seedEvent
|
|
52
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-RV34EYSN.js";
|
|
53
40
|
import {
|
|
54
41
|
ActorSchema,
|
|
55
42
|
CausationEventSchema,
|
|
@@ -84,7 +71,7 @@ import {
|
|
|
84
71
|
pii_schemas,
|
|
85
72
|
sensitive,
|
|
86
73
|
sensitiveFields
|
|
87
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-BQUOIHOR.js";
|
|
88
75
|
|
|
89
76
|
// src/signals.ts
|
|
90
77
|
process.once("SIGINT", async (arg) => {
|
|
@@ -813,52 +800,13 @@ function classify_registry(registry, states) {
|
|
|
813
800
|
}
|
|
814
801
|
|
|
815
802
|
// src/internal/autoclose-policy.ts
|
|
816
|
-
import { z } from "zod";
|
|
817
803
|
var DAY_MS = 864e5;
|
|
818
|
-
var MIN_AFTER_DAYS = 1 / 1440;
|
|
819
|
-
var MIN_KEEP_DAYS = 1;
|
|
820
804
|
function days_after(date, days) {
|
|
821
805
|
return new Date(date.getTime() + days * DAY_MS);
|
|
822
806
|
}
|
|
823
807
|
function days_before_now(days) {
|
|
824
808
|
return new Date(Date.now() - days * DAY_MS);
|
|
825
809
|
}
|
|
826
|
-
var window_schema = (field, min_days, floor) => z.object({
|
|
827
|
-
days: z.number({ message: `autocloses: ${field}.days must be a number` }).positive(`autocloses: ${field}.days must be > 0`)
|
|
828
|
-
}).refine((o) => o.days >= min_days, {
|
|
829
|
-
message: `autocloses: ${field} resolves to < ${floor}, which is too short to be a meaningful retention window`
|
|
830
|
-
});
|
|
831
|
-
var AfterSchema = window_schema("after", MIN_AFTER_DAYS, "one minute");
|
|
832
|
-
var KeepSchema = window_schema("keep", MIN_KEEP_DAYS, "one day");
|
|
833
|
-
var IsSchema = z.union([
|
|
834
|
-
z.string().min(1, "autocloses: is must be a non-empty event name"),
|
|
835
|
-
z.array(
|
|
836
|
-
z.string().min(1, "autocloses: is entries must be non-empty event names")
|
|
837
|
-
).min(1, "autocloses: is must include at least one event name").readonly()
|
|
838
|
-
]);
|
|
839
|
-
var ReachesSchema = z.number({ message: "autocloses: reaches must be a number" }).int("autocloses: reaches must be an integer").min(1, "autocloses: reaches must be >= 1");
|
|
840
|
-
var OrBlockSchema = z.object({
|
|
841
|
-
after: AfterSchema.optional(),
|
|
842
|
-
is: IsSchema.optional(),
|
|
843
|
-
reaches: ReachesSchema.optional()
|
|
844
|
-
}).strict().refine(
|
|
845
|
-
(o) => o.after !== void 0 || o.is !== void 0 || o.reaches !== void 0,
|
|
846
|
-
{
|
|
847
|
-
message: "autocloses: `or` block must include at least one of after / is / reaches"
|
|
848
|
-
}
|
|
849
|
-
);
|
|
850
|
-
var AutoclosePolicySchema = z.object({
|
|
851
|
-
after: AfterSchema.optional(),
|
|
852
|
-
is: IsSchema.optional(),
|
|
853
|
-
reaches: ReachesSchema.optional(),
|
|
854
|
-
or: OrBlockSchema.optional(),
|
|
855
|
-
keep: KeepSchema.optional()
|
|
856
|
-
}).strict().refine(
|
|
857
|
-
(o) => o.after !== void 0 || o.is !== void 0 || o.reaches !== void 0 || o.or !== void 0 || o.keep !== void 0,
|
|
858
|
-
{
|
|
859
|
-
message: "autocloses: at least one of after / is / reaches / or / keep must be specified \u2014 empty `{}` is a misconfiguration"
|
|
860
|
-
}
|
|
861
|
-
);
|
|
862
810
|
function compile_after(after) {
|
|
863
811
|
return (_stream, head) => days_after(head.created, after.days) <= /* @__PURE__ */ new Date();
|
|
864
812
|
}
|
|
@@ -870,15 +818,15 @@ function compile_reaches(reaches) {
|
|
|
870
818
|
return (_stream, _head, count) => count >= reaches;
|
|
871
819
|
}
|
|
872
820
|
function policy_after_windows(options) {
|
|
873
|
-
const parsed =
|
|
821
|
+
const parsed = check("autoclose_policy", options);
|
|
874
822
|
return [parsed.after, parsed.or?.after].flatMap((w) => w ? [w.days] : []);
|
|
875
823
|
}
|
|
876
824
|
function policy_keep_days(options) {
|
|
877
|
-
const parsed =
|
|
825
|
+
const parsed = check("autoclose_policy", options);
|
|
878
826
|
return parsed.keep?.days;
|
|
879
827
|
}
|
|
880
828
|
function compile_autoclose_policy(options) {
|
|
881
|
-
const parsed =
|
|
829
|
+
const parsed = check("autoclose_policy", options);
|
|
882
830
|
const and_preds = [];
|
|
883
831
|
if (parsed.after) and_preds.push(compile_after(parsed.after));
|
|
884
832
|
if (parsed.is) and_preds.push(compile_is(parsed.is));
|
|
@@ -939,31 +887,14 @@ function next_window_open(window, now) {
|
|
|
939
887
|
}
|
|
940
888
|
|
|
941
889
|
// src/internal/defer-config.ts
|
|
942
|
-
import { z as z2 } from "zod";
|
|
943
|
-
var DeferDurationSchema = z2.object({
|
|
944
|
-
days: z2.number().positive().optional(),
|
|
945
|
-
hours: z2.number().positive().optional(),
|
|
946
|
-
minutes: z2.number().positive().optional()
|
|
947
|
-
}).strict().refine((d) => d.days != null || d.hours != null || d.minutes != null, {
|
|
948
|
-
message: "defer: a duration needs at least one of days, hours, or minutes"
|
|
949
|
-
});
|
|
950
|
-
var DeferWhenSchema = z2.object({
|
|
951
|
-
after: DeferDurationSchema.optional(),
|
|
952
|
-
at: z2.date().optional()
|
|
953
|
-
}).strict().refine((w) => w.after === void 0 !== (w.at === void 0), {
|
|
954
|
-
message: "defer: specify exactly one of `after` or `at`"
|
|
955
|
-
});
|
|
956
890
|
function duration_ms(d) {
|
|
957
891
|
return (d.days ?? 0) * 864e5 + (d.hours ?? 0) * 36e5 + (d.minutes ?? 0) * 6e4;
|
|
958
892
|
}
|
|
959
893
|
function resolve_defer_at(when, event) {
|
|
960
|
-
const parsed =
|
|
894
|
+
const parsed = check("defer", when);
|
|
961
895
|
if (parsed.after) return event.created.getTime() + duration_ms(parsed.after);
|
|
962
896
|
return parsed.at.getTime();
|
|
963
897
|
}
|
|
964
|
-
function assert_defer_when(when) {
|
|
965
|
-
DeferWhenSchema.parse(when);
|
|
966
|
-
}
|
|
967
898
|
function make_deferred(handler, schedule) {
|
|
968
899
|
const call = handler;
|
|
969
900
|
const deferred = async (event, stream, app) => {
|
|
@@ -1164,7 +1095,7 @@ import { patch } from "@rotorsoft/act-patch";
|
|
|
1164
1095
|
import { prettifyError, ZodError } from "zod";
|
|
1165
1096
|
|
|
1166
1097
|
// src/internal/date-reviver.ts
|
|
1167
|
-
import { z
|
|
1098
|
+
import { z } from "zod";
|
|
1168
1099
|
function variant_schema(schema, walk) {
|
|
1169
1100
|
const shape = def_of(schema)?.shape;
|
|
1170
1101
|
if (!shape) {
|
|
@@ -1178,7 +1109,7 @@ function variant_schema(schema, walk) {
|
|
|
1178
1109
|
if (dates) dated = true;
|
|
1179
1110
|
next[key] = (dates ?? field).optional();
|
|
1180
1111
|
}
|
|
1181
|
-
return { schema:
|
|
1112
|
+
return { schema: z.looseObject(next), dated };
|
|
1182
1113
|
}
|
|
1183
1114
|
function date_reviver_schema(schema) {
|
|
1184
1115
|
let recursive = false;
|
|
@@ -1189,7 +1120,7 @@ function date_reviver_schema(schema) {
|
|
|
1189
1120
|
if (done.has(node)) return done.get(node);
|
|
1190
1121
|
if (active.has(node)) {
|
|
1191
1122
|
recursive = true;
|
|
1192
|
-
return tie ?
|
|
1123
|
+
return tie ? z.lazy(() => done.get(node)) : void 0;
|
|
1193
1124
|
}
|
|
1194
1125
|
active.add(node);
|
|
1195
1126
|
const result = build(node, walk);
|
|
@@ -1208,7 +1139,7 @@ function build(schema, walk) {
|
|
|
1208
1139
|
const inner = () => walk(def.innerType);
|
|
1209
1140
|
switch (def.type) {
|
|
1210
1141
|
case "date":
|
|
1211
|
-
return
|
|
1142
|
+
return z.coerce.date();
|
|
1212
1143
|
case "object": {
|
|
1213
1144
|
const shape = def.shape;
|
|
1214
1145
|
if (!shape) return void 0;
|
|
@@ -1217,25 +1148,25 @@ function build(schema, walk) {
|
|
|
1217
1148
|
const dates = walk(field);
|
|
1218
1149
|
if (dates) dated[key] = dates.optional();
|
|
1219
1150
|
}
|
|
1220
|
-
return Object.keys(dated).length ?
|
|
1151
|
+
return Object.keys(dated).length ? z.looseObject(dated) : void 0;
|
|
1221
1152
|
}
|
|
1222
1153
|
case "array": {
|
|
1223
1154
|
const element = walk(def.element);
|
|
1224
|
-
return element &&
|
|
1155
|
+
return element && z.array(element);
|
|
1225
1156
|
}
|
|
1226
1157
|
case "tuple": {
|
|
1227
1158
|
const items = def.items.map((i) => walk(i));
|
|
1228
|
-
return items.some(Boolean) ?
|
|
1159
|
+
return items.some(Boolean) ? z.tuple(items.map((i) => i ?? z.unknown())) : void 0;
|
|
1229
1160
|
}
|
|
1230
1161
|
case "record": {
|
|
1231
1162
|
const value = walk(def.valueType);
|
|
1232
|
-
return value &&
|
|
1163
|
+
return value && z.record(z.string(), value);
|
|
1233
1164
|
}
|
|
1234
1165
|
case "union": {
|
|
1235
1166
|
const variants = def.options.map(
|
|
1236
1167
|
(o) => variant_schema(o, walk)
|
|
1237
1168
|
);
|
|
1238
|
-
return variants.some((v) => v.dated) ?
|
|
1169
|
+
return variants.some((v) => v.dated) ? z.union(variants.map((v) => v.schema)) : void 0;
|
|
1239
1170
|
}
|
|
1240
1171
|
case "nullable":
|
|
1241
1172
|
return inner()?.nullable();
|
|
@@ -3007,7 +2938,9 @@ var CorrelateCycle = class {
|
|
|
3007
2938
|
return;
|
|
3008
2939
|
}
|
|
3009
2940
|
if (!resolved) continue;
|
|
3010
|
-
|
|
2941
|
+
try {
|
|
2942
|
+
check("target", resolved);
|
|
2943
|
+
} catch {
|
|
3011
2944
|
report_bad_priority(
|
|
3012
2945
|
this._reported,
|
|
3013
2946
|
reaction.handler.name,
|
|
@@ -3400,13 +3333,6 @@ var SettleLoop = class {
|
|
|
3400
3333
|
};
|
|
3401
3334
|
|
|
3402
3335
|
// src/act.ts
|
|
3403
|
-
function validate_only_lanes(only, declared) {
|
|
3404
|
-
const unknown = (only ?? []).filter((l) => !declared.includes(l));
|
|
3405
|
-
if (unknown.length > 0)
|
|
3406
|
-
throw new Error(
|
|
3407
|
-
`ActOptions.onlyLanes references undeclared lane(s): ${unknown.map((l) => `"${l}"`).join(", ")}`
|
|
3408
|
-
);
|
|
3409
|
-
}
|
|
3410
3336
|
var Act = class {
|
|
3411
3337
|
_emitter = new EventEmitter();
|
|
3412
3338
|
_breaker;
|
|
@@ -3514,9 +3440,16 @@ var Act = class {
|
|
|
3514
3440
|
this._states = states;
|
|
3515
3441
|
this._batch_handlers = batch_handlers;
|
|
3516
3442
|
this._lanes = lanes;
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3443
|
+
const declared = ["default", ...lanes.map((l) => l.name)];
|
|
3444
|
+
this._declared_lanes = declared;
|
|
3445
|
+
const undeclared = (options.onlyLanes ?? []).filter(
|
|
3446
|
+
(l) => !declared.includes(l)
|
|
3447
|
+
);
|
|
3448
|
+
if (undeclared.length > 0)
|
|
3449
|
+
throw new Error(
|
|
3450
|
+
`ActOptions.onlyLanes references undeclared lane(s): ${undeclared.map((l) => `"${l}"`).join(", ")}`
|
|
3451
|
+
);
|
|
3452
|
+
if (options.scoped) check("store", options.scoped.store);
|
|
3520
3453
|
this._ports = options.scoped ?? unscoped_ports();
|
|
3521
3454
|
const ports = this._ports;
|
|
3522
3455
|
this._scoped = make_run_scoped({
|
|
@@ -3529,7 +3462,7 @@ var Act = class {
|
|
|
3529
3462
|
return ports.cache;
|
|
3530
3463
|
},
|
|
3531
3464
|
// Parsed per build, so a bad window throws on every build.
|
|
3532
|
-
autoclose_window:
|
|
3465
|
+
autoclose_window: check("autoclose", options).autocloseWindow
|
|
3533
3466
|
});
|
|
3534
3467
|
this._correlator = options.correlator ?? default_correlator;
|
|
3535
3468
|
this._es = build_es(this._logger, this._correlator, patch_fn);
|
|
@@ -3571,7 +3504,7 @@ var Act = class {
|
|
|
3571
3504
|
// Shared by drain, settle and autoclose; bad knobs throw at build.
|
|
3572
3505
|
_build_breaker(options) {
|
|
3573
3506
|
return new CircuitBreaker(
|
|
3574
|
-
|
|
3507
|
+
check("circuit_breaker", options.circuitBreaker ?? {}),
|
|
3575
3508
|
{
|
|
3576
3509
|
on_error: (error, circuit) => this._emit_error(error, circuit),
|
|
3577
3510
|
// When the cooldown elapses, settle once: its scan or claim is the
|
|
@@ -3704,7 +3637,7 @@ var Act = class {
|
|
|
3704
3637
|
*/
|
|
3705
3638
|
shutdown(options) {
|
|
3706
3639
|
if (!this._shutdown_promise) {
|
|
3707
|
-
|
|
3640
|
+
check("shutdown", options ?? {});
|
|
3708
3641
|
this._shutdown_promise = (async () => {
|
|
3709
3642
|
this.stop_correlations();
|
|
3710
3643
|
this._settle.stop(true);
|
|
@@ -3970,7 +3903,7 @@ var Act = class {
|
|
|
3970
3903
|
* @see {@link correlate} for dynamic stream discovery
|
|
3971
3904
|
*/
|
|
3972
3905
|
async drain(options = {}) {
|
|
3973
|
-
|
|
3906
|
+
check("drain", options);
|
|
3974
3907
|
if (!this._drain)
|
|
3975
3908
|
return { fetched: [], leased: [], acked: [], blocked: [] };
|
|
3976
3909
|
return this._scoped(() => this._drain_all(options));
|
|
@@ -4234,7 +4167,7 @@ var Act = class {
|
|
|
4234
4167
|
* @see {@link Store.restore} for the underlying driver-pattern primitive.
|
|
4235
4168
|
*/
|
|
4236
4169
|
async restore(source, opts = {}, sink) {
|
|
4237
|
-
|
|
4170
|
+
check("scan", opts);
|
|
4238
4171
|
return this._scoped(async () => {
|
|
4239
4172
|
const started = Date.now();
|
|
4240
4173
|
if (opts.dry_run) {
|
|
@@ -4314,6 +4247,7 @@ var Act = class {
|
|
|
4314
4247
|
* ```
|
|
4315
4248
|
*/
|
|
4316
4249
|
async *audit(categories, options) {
|
|
4250
|
+
check("audit", options ?? {});
|
|
4317
4251
|
const it = audit(this._audit_deps, categories, options)[Symbol.asyncIterator]();
|
|
4318
4252
|
while (true) {
|
|
4319
4253
|
const { value, done } = await this._scoped(() => it.next());
|
|
@@ -4341,7 +4275,7 @@ var Act = class {
|
|
|
4341
4275
|
* @see {@link Store.prioritize} for the underlying primitive
|
|
4342
4276
|
*/
|
|
4343
4277
|
async prioritize(filter, priority) {
|
|
4344
|
-
|
|
4278
|
+
check("target", { priority });
|
|
4345
4279
|
return this._scoped(() => store().prioritize(filter, priority));
|
|
4346
4280
|
}
|
|
4347
4281
|
// Shared by `close()` and reaction-requested closes.
|
|
@@ -4422,7 +4356,7 @@ var Act = class {
|
|
|
4422
4356
|
* @see {@link correlate} for manual correlation
|
|
4423
4357
|
*/
|
|
4424
4358
|
settle(options) {
|
|
4425
|
-
|
|
4359
|
+
check("settle", options ?? {});
|
|
4426
4360
|
this._schedule(options);
|
|
4427
4361
|
}
|
|
4428
4362
|
};
|
|
@@ -4619,7 +4553,7 @@ var _this_ = ({ stream }) => ({
|
|
|
4619
4553
|
|
|
4620
4554
|
// src/builders/builder-utils.ts
|
|
4621
4555
|
function register_lane(config2, lanes) {
|
|
4622
|
-
|
|
4556
|
+
check("lane", config2);
|
|
4623
4557
|
if (config2.name === DEFAULT_LANE)
|
|
4624
4558
|
throw new Error(`Lane "${DEFAULT_LANE}" is reserved`);
|
|
4625
4559
|
const existing = lanes.find((l) => l.name === config2.name);
|
|
@@ -4643,7 +4577,7 @@ function add_reaction(events, event, name, kind, make, builder) {
|
|
|
4643
4577
|
events[event].reactions.set(name, reaction);
|
|
4644
4578
|
return Object.assign(builder, {
|
|
4645
4579
|
to(resolver) {
|
|
4646
|
-
if (typeof resolver === "object")
|
|
4580
|
+
if (typeof resolver === "object") check("target", resolver);
|
|
4647
4581
|
reaction.resolver = typeof resolver === "string" ? { target: resolver } : resolver;
|
|
4648
4582
|
return builder;
|
|
4649
4583
|
}
|
|
@@ -4657,14 +4591,14 @@ function reaction_on(event, events, builder) {
|
|
|
4657
4591
|
"Reaction",
|
|
4658
4592
|
() => {
|
|
4659
4593
|
if (schedule && typeof schedule !== "function")
|
|
4660
|
-
|
|
4594
|
+
check("defer", schedule);
|
|
4661
4595
|
return {
|
|
4662
4596
|
handler: schedule ? make_deferred(handler, schedule) : handler,
|
|
4663
4597
|
resolver: _this_,
|
|
4664
4598
|
// Validate the whole bag at the declaration site so a bad
|
|
4665
4599
|
// `maxRetries`/`backoff`/`blockOnError` throws ZodError at build,
|
|
4666
4600
|
// not a NaN gate on the first retry.
|
|
4667
|
-
options:
|
|
4601
|
+
options: check("reaction", {
|
|
4668
4602
|
blockOnError: options?.blockOnError ?? DEFAULT_BLOCK_ON_ERROR,
|
|
4669
4603
|
maxRetries: options?.maxRetries ?? DEFAULT_MAX_RETRIES,
|
|
4670
4604
|
backoff: options?.backoff
|
|
@@ -4682,7 +4616,7 @@ function reaction_on(event, events, builder) {
|
|
|
4682
4616
|
}
|
|
4683
4617
|
|
|
4684
4618
|
// src/builders/event-builder.ts
|
|
4685
|
-
import { z as
|
|
4619
|
+
import { z as z2 } from "zod";
|
|
4686
4620
|
function event_tags(schema) {
|
|
4687
4621
|
const pii = pii_schemas(schema);
|
|
4688
4622
|
const pii_dates = {};
|
|
@@ -4699,7 +4633,7 @@ function event_tags(schema) {
|
|
|
4699
4633
|
return {
|
|
4700
4634
|
sensitive: pii,
|
|
4701
4635
|
date_reviver: data_reviver_schema && revive(data_reviver_schema),
|
|
4702
|
-
pii_date_reviver: dated_pii ? revive(
|
|
4636
|
+
pii_date_reviver: dated_pii ? revive(z2.looseObject(pii_dates)) : void 0
|
|
4703
4637
|
};
|
|
4704
4638
|
}
|
|
4705
4639
|
function make_event_reader(tags, disclosure, predicate = null) {
|
|
@@ -4959,7 +4893,7 @@ function act() {
|
|
|
4959
4893
|
return reaction_on(event, registry.events, builder);
|
|
4960
4894
|
},
|
|
4961
4895
|
build: (options) => {
|
|
4962
|
-
|
|
4896
|
+
check("act", options ?? {});
|
|
4963
4897
|
if (!_built) {
|
|
4964
4898
|
for (const proj of pending_projections) add_projection(proj);
|
|
4965
4899
|
for (const proj of fold_projections) {
|
|
@@ -5133,7 +5067,7 @@ function _projection(target) {
|
|
|
5133
5067
|
throw new Error(
|
|
5134
5068
|
`Projection "${target}" .of() partials must share one state name \u2014 got "${name}" and "${partial.name}"`
|
|
5135
5069
|
);
|
|
5136
|
-
const config2 =
|
|
5070
|
+
const config2 = check("fold", options);
|
|
5137
5071
|
const fold_events = {};
|
|
5138
5072
|
for (const partial of partials)
|
|
5139
5073
|
for (const [event_name, schema] of Object.entries(partial.events)) {
|
|
@@ -5268,7 +5202,7 @@ function action_builder(state2) {
|
|
|
5268
5202
|
throw new Error(`Duplicate action "${action2}"`);
|
|
5269
5203
|
internal.actions[action2] = schema;
|
|
5270
5204
|
if (options) {
|
|
5271
|
-
|
|
5205
|
+
check("action", options);
|
|
5272
5206
|
internal.options ??= {};
|
|
5273
5207
|
internal.options[action2] = options;
|
|
5274
5208
|
}
|
|
@@ -5548,7 +5482,6 @@ var DEFAULT_MAX_SUBSCRIBED_STREAMS2 = DEFAULT_MAX_SUBSCRIBED_STREAMS;
|
|
|
5548
5482
|
var DEFAULT_SETTLE_DEBOUNCE_MS2 = DEFAULT_SETTLE_DEBOUNCE_MS;
|
|
5549
5483
|
var PackageSchema = package_schema;
|
|
5550
5484
|
var default_scope = unscoped_ports;
|
|
5551
|
-
var resolveAutocloseConfig2 = resolveAutocloseConfig;
|
|
5552
5485
|
var extend = (source, schema, target) => ({ ...target, ...validate("config", source, schema) });
|
|
5553
5486
|
var ISO_8601 = /^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])T([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])(\.\d+)?(Z|[+-][0-2][0-9]:[0-5][0-9])?$/;
|
|
5554
5487
|
var dateReviver = (_key, value) => typeof value === "string" && ISO_8601.test(value) ? new Date(value) : value;
|
|
@@ -5602,7 +5535,6 @@ export {
|
|
|
5602
5535
|
pii_fields,
|
|
5603
5536
|
port,
|
|
5604
5537
|
projection,
|
|
5605
|
-
resolveAutocloseConfig2 as resolveAutocloseConfig,
|
|
5606
5538
|
seed_event,
|
|
5607
5539
|
sensitive,
|
|
5608
5540
|
sensitiveFields,
|