@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.cjs
CHANGED
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
|
|
30
|
+
var _chunkN74AN6L5cjs = require('./chunk-N74AN6L5.cjs');
|
|
30
31
|
|
|
31
32
|
|
|
32
33
|
|
|
@@ -35,12 +36,12 @@
|
|
|
35
36
|
|
|
36
37
|
|
|
37
38
|
|
|
39
|
+
var _chunkSC6TY4P2cjs = require('./chunk-SC6TY4P2.cjs');
|
|
38
40
|
|
|
39
41
|
|
|
40
42
|
|
|
41
43
|
|
|
42
44
|
|
|
43
|
-
var _chunkC4JJ7LTBcjs = require('./chunk-C4JJ7LTB.cjs');
|
|
44
45
|
|
|
45
46
|
|
|
46
47
|
|
|
@@ -49,7 +50,6 @@ var _chunkC4JJ7LTBcjs = require('./chunk-C4JJ7LTB.cjs');
|
|
|
49
50
|
|
|
50
51
|
|
|
51
52
|
|
|
52
|
-
var _chunkD7LQNOEVcjs = require('./chunk-D7LQNOEV.cjs');
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
|
|
@@ -71,37 +71,24 @@ var _chunkD7LQNOEVcjs = require('./chunk-D7LQNOEV.cjs');
|
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
var _chunkQFYPSI6Pcjs = require('./chunk-QFYPSI6P.cjs');
|
|
74
|
+
var _chunkZTHGF62Ocjs = require('./chunk-ZTHGF62O.cjs');
|
|
88
75
|
|
|
89
76
|
// src/signals.ts
|
|
90
77
|
process.once("SIGINT", async (arg) => {
|
|
91
|
-
|
|
92
|
-
await
|
|
78
|
+
_chunkN74AN6L5cjs.log.call(void 0, ).info(arg, "SIGINT");
|
|
79
|
+
await _chunkN74AN6L5cjs.disposeAndExit.call(void 0, "EXIT");
|
|
93
80
|
});
|
|
94
81
|
process.once("SIGTERM", async (arg) => {
|
|
95
|
-
|
|
96
|
-
await
|
|
82
|
+
_chunkN74AN6L5cjs.log.call(void 0, ).info(arg, "SIGTERM");
|
|
83
|
+
await _chunkN74AN6L5cjs.disposeAndExit.call(void 0, "EXIT");
|
|
97
84
|
});
|
|
98
85
|
process.once("uncaughtException", async (arg) => {
|
|
99
|
-
|
|
100
|
-
await
|
|
86
|
+
_chunkN74AN6L5cjs.log.call(void 0, ).error(arg, "Uncaught Exception");
|
|
87
|
+
await _chunkN74AN6L5cjs.disposeAndExit.call(void 0, "ERROR");
|
|
101
88
|
});
|
|
102
89
|
process.once("unhandledRejection", async (arg) => {
|
|
103
|
-
|
|
104
|
-
await
|
|
90
|
+
_chunkN74AN6L5cjs.log.call(void 0, ).error(arg, "Unhandled Rejection");
|
|
91
|
+
await _chunkN74AN6L5cjs.disposeAndExit.call(void 0, "ERROR");
|
|
105
92
|
});
|
|
106
93
|
|
|
107
94
|
// src/act.ts
|
|
@@ -209,7 +196,7 @@ async function* audit(deps, categories, options = {}) {
|
|
|
209
196
|
if (need_stats) {
|
|
210
197
|
const stats = await deps.store().query_stats(
|
|
211
198
|
{},
|
|
212
|
-
{ count: true, names: true, exclude: [
|
|
199
|
+
{ count: true, names: true, exclude: [_chunkZTHGF62Ocjs.SNAP_EVENT] }
|
|
213
200
|
);
|
|
214
201
|
for (const [stream, s] of stats) {
|
|
215
202
|
for (const p of passes) _optionalChain([p, 'access', _4 => _4.on_stat, 'optionalCall', _5 => _5(stream, s)]);
|
|
@@ -291,7 +278,7 @@ var make_schema_pass = (deps) => {
|
|
|
291
278
|
return;
|
|
292
279
|
}
|
|
293
280
|
const schema = state2.events[name];
|
|
294
|
-
const sensitive2 =
|
|
281
|
+
const sensitive2 = _chunkZTHGF62Ocjs.sensitiveFields.call(void 0, schema);
|
|
295
282
|
let parse_schema = schema;
|
|
296
283
|
if (sensitive2.length > 0) {
|
|
297
284
|
const omitter = schema.omit;
|
|
@@ -425,7 +412,7 @@ var make_restart_candidate_pass = (deps, options) => {
|
|
|
425
412
|
{
|
|
426
413
|
stream,
|
|
427
414
|
stream_exact: true,
|
|
428
|
-
names: [
|
|
415
|
+
names: [_chunkZTHGF62Ocjs.SNAP_EVENT],
|
|
429
416
|
with_snaps: true,
|
|
430
417
|
// From the start: on its own, `with_snaps` resumes at the latest.
|
|
431
418
|
after: -1
|
|
@@ -585,7 +572,7 @@ var make_correlation_gaps_pass = () => {
|
|
|
585
572
|
seen_ids.add(e.id);
|
|
586
573
|
const causation = _optionalChain([e, 'access', _31 => _31.meta, 'optionalAccess', _32 => _32.causation]);
|
|
587
574
|
const parent_id = _optionalChain([causation, 'optionalAccess', _33 => _33.event, 'optionalAccess', _34 => _34.id]);
|
|
588
|
-
if (parent_id !== void 0 && e.name !==
|
|
575
|
+
if (parent_id !== void 0 && e.name !== _chunkZTHGF62Ocjs.TOMBSTONE_EVENT) {
|
|
589
576
|
checks.push({ stream: e.stream, id: e.id, parent_id });
|
|
590
577
|
}
|
|
591
578
|
},
|
|
@@ -813,52 +800,13 @@ function classify_registry(registry, states) {
|
|
|
813
800
|
}
|
|
814
801
|
|
|
815
802
|
// src/internal/autoclose-policy.ts
|
|
816
|
-
var _zod = require('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) => _zod.z.object({
|
|
827
|
-
days: _zod.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 = _zod.z.union([
|
|
834
|
-
_zod.z.string().min(1, "autocloses: is must be a non-empty event name"),
|
|
835
|
-
_zod.z.array(
|
|
836
|
-
_zod.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 = _zod.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 = _zod.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 = _zod.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 = _chunkN74AN6L5cjs.check.call(void 0, "autoclose_policy", options);
|
|
874
822
|
return [parsed.after, _optionalChain([parsed, 'access', _42 => _42.or, 'optionalAccess', _43 => _43.after])].flatMap((w) => w ? [w.days] : []);
|
|
875
823
|
}
|
|
876
824
|
function policy_keep_days(options) {
|
|
877
|
-
const parsed =
|
|
825
|
+
const parsed = _chunkN74AN6L5cjs.check.call(void 0, "autoclose_policy", options);
|
|
878
826
|
return _optionalChain([parsed, 'access', _44 => _44.keep, 'optionalAccess', _45 => _45.days]);
|
|
879
827
|
}
|
|
880
828
|
function compile_autoclose_policy(options) {
|
|
881
|
-
const parsed =
|
|
829
|
+
const parsed = _chunkN74AN6L5cjs.check.call(void 0, "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,36 +887,19 @@ function next_window_open(window, now) {
|
|
|
939
887
|
}
|
|
940
888
|
|
|
941
889
|
// src/internal/defer-config.ts
|
|
942
|
-
|
|
943
|
-
var DeferDurationSchema = _zod.z.object({
|
|
944
|
-
days: _zod.z.number().positive().optional(),
|
|
945
|
-
hours: _zod.z.number().positive().optional(),
|
|
946
|
-
minutes: _zod.z.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 = _zod.z.object({
|
|
951
|
-
after: DeferDurationSchema.optional(),
|
|
952
|
-
at: _zod.z.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 (_nullishCoalesce(d.days, () => ( 0))) * 864e5 + (_nullishCoalesce(d.hours, () => ( 0))) * 36e5 + (_nullishCoalesce(d.minutes, () => ( 0))) * 6e4;
|
|
958
892
|
}
|
|
959
893
|
function resolve_defer_at(when, event) {
|
|
960
|
-
const parsed =
|
|
894
|
+
const parsed = _chunkN74AN6L5cjs.check.call(void 0, "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) => {
|
|
970
901
|
const when = typeof schedule === "function" ? schedule(event) : schedule;
|
|
971
|
-
if (Date.now() < resolve_defer_at(when, event)) throw new (0,
|
|
902
|
+
if (Date.now() < resolve_defer_at(when, event)) throw new (0, _chunkZTHGF62Ocjs.DeferSignal)(when);
|
|
972
903
|
return call(event, stream, app);
|
|
973
904
|
};
|
|
974
905
|
Object.defineProperty(deferred, "name", { value: handler.name });
|
|
@@ -1100,7 +1031,7 @@ function compute_lag_lead_ratio(handled, lagging, leading) {
|
|
|
1100
1031
|
function report_once(seen, key, message) {
|
|
1101
1032
|
if (seen.has(key)) return;
|
|
1102
1033
|
seen.add(key);
|
|
1103
|
-
|
|
1034
|
+
_chunkN74AN6L5cjs.log.call(void 0, ).error(new Error(message));
|
|
1104
1035
|
}
|
|
1105
1036
|
|
|
1106
1037
|
// src/internal/correlation-id.ts
|
|
@@ -1128,14 +1059,14 @@ function close_correlation(correlator, actor) {
|
|
|
1128
1059
|
}
|
|
1129
1060
|
|
|
1130
1061
|
// src/internal/drain-ops.ts
|
|
1131
|
-
var claim = (lagging, leading, by, millis, lane) =>
|
|
1062
|
+
var claim = (lagging, leading, by, millis, lane) => _chunkN74AN6L5cjs.store.call(void 0, ).claim(lagging, leading, by, millis, lane);
|
|
1132
1063
|
async function fetch(leased, eventLimit) {
|
|
1133
1064
|
return Promise.all(
|
|
1134
1065
|
leased.map(async ({ stream, source, at, lagging }) => {
|
|
1135
1066
|
const events = [];
|
|
1136
|
-
const stream_exact = source !== void 0 &&
|
|
1067
|
+
const stream_exact = source !== void 0 && _chunkSC6TY4P2cjs.isStreamName.call(void 0, source, stream) ? true : void 0;
|
|
1137
1068
|
try {
|
|
1138
|
-
await
|
|
1069
|
+
await _chunkN74AN6L5cjs.store.call(void 0, ).query((e) => events.push(e), {
|
|
1139
1070
|
stream: source,
|
|
1140
1071
|
stream_exact,
|
|
1141
1072
|
after: at,
|
|
@@ -1155,18 +1086,18 @@ async function fetch(leased, eventLimit) {
|
|
|
1155
1086
|
})
|
|
1156
1087
|
);
|
|
1157
1088
|
}
|
|
1158
|
-
var ack = (leases) =>
|
|
1159
|
-
var block = (leases) =>
|
|
1160
|
-
var subscribe = (streams, correlated_at, correlator) =>
|
|
1089
|
+
var ack = (leases) => _chunkN74AN6L5cjs.store.call(void 0, ).ack(leases);
|
|
1090
|
+
var block = (leases) => _chunkN74AN6L5cjs.store.call(void 0, ).block(leases);
|
|
1091
|
+
var subscribe = (streams, correlated_at, correlator) => _chunkN74AN6L5cjs.store.call(void 0, ).subscribe(streams, correlated_at, correlator);
|
|
1161
1092
|
|
|
1162
1093
|
// src/internal/event-sourcing.ts
|
|
1163
1094
|
var _actpatch = require('@rotorsoft/act-patch');
|
|
1164
|
-
|
|
1095
|
+
var _zod = require('zod');
|
|
1165
1096
|
|
|
1166
1097
|
// src/internal/date-reviver.ts
|
|
1167
1098
|
|
|
1168
1099
|
function variant_schema(schema, walk) {
|
|
1169
|
-
const shape = _optionalChain([
|
|
1100
|
+
const shape = _optionalChain([_chunkZTHGF62Ocjs.def_of.call(void 0, schema), 'optionalAccess', _50 => _50.shape]);
|
|
1170
1101
|
if (!shape) {
|
|
1171
1102
|
const dates = walk(schema);
|
|
1172
1103
|
return { schema: _nullishCoalesce(dates, () => ( schema)), dated: !!dates };
|
|
@@ -1203,7 +1134,7 @@ function date_reviver_schema(schema) {
|
|
|
1203
1134
|
return first && recursive ? pass(true) : first;
|
|
1204
1135
|
}
|
|
1205
1136
|
function build(schema, walk) {
|
|
1206
|
-
const def =
|
|
1137
|
+
const def = _chunkZTHGF62Ocjs.def_of.call(void 0, schema);
|
|
1207
1138
|
if (!def) return void 0;
|
|
1208
1139
|
const inner = () => walk(def.innerType);
|
|
1209
1140
|
switch (def.type) {
|
|
@@ -1249,7 +1180,7 @@ function build(schema, walk) {
|
|
|
1249
1180
|
return left && right ? left.pipe(right) : _nullishCoalesce(left, () => ( right));
|
|
1250
1181
|
}
|
|
1251
1182
|
default:
|
|
1252
|
-
return
|
|
1183
|
+
return _chunkZTHGF62Ocjs.inner_of.call(void 0, def) ? inner() : void 0;
|
|
1253
1184
|
}
|
|
1254
1185
|
}
|
|
1255
1186
|
|
|
@@ -1264,29 +1195,29 @@ var check_invariants = (target, state2, schema, pii_aware) => {
|
|
|
1264
1195
|
try {
|
|
1265
1196
|
result = schema.safeParse(state2);
|
|
1266
1197
|
} catch (error) {
|
|
1267
|
-
throw new (0,
|
|
1198
|
+
throw new (0, _chunkZTHGF62Ocjs.ValidationError)(target, state2, error);
|
|
1268
1199
|
}
|
|
1269
1200
|
if (result.success) return;
|
|
1270
1201
|
const issues = pii_aware ? result.error.issues.filter((issue) => {
|
|
1271
1202
|
const value = value_at(state2, issue.path);
|
|
1272
|
-
return value !==
|
|
1203
|
+
return value !== _chunkZTHGF62Ocjs.REDACTED && value !== _chunkZTHGF62Ocjs.SHREDDED;
|
|
1273
1204
|
}) : result.error.issues;
|
|
1274
1205
|
if (issues.length)
|
|
1275
|
-
throw new (0,
|
|
1206
|
+
throw new (0, _chunkZTHGF62Ocjs.ValidationError)(
|
|
1276
1207
|
target,
|
|
1277
1208
|
state2,
|
|
1278
1209
|
_zod.prettifyError.call(void 0, new (0, _zod.ZodError)(issues))
|
|
1279
1210
|
);
|
|
1280
1211
|
};
|
|
1281
1212
|
var DEFAULT_BATCH = 500;
|
|
1282
|
-
var cache_put = (stream, entry) =>
|
|
1283
|
-
(err) =>
|
|
1213
|
+
var cache_put = (stream, entry) => _chunkN74AN6L5cjs.cache.call(void 0, ).set(stream, entry).catch(
|
|
1214
|
+
(err) => _chunkN74AN6L5cjs.log.call(void 0, ).warn(
|
|
1284
1215
|
err,
|
|
1285
1216
|
"cache set skipped; the next load re-folds from the store"
|
|
1286
1217
|
)
|
|
1287
1218
|
);
|
|
1288
|
-
var cache_drop = (stream) =>
|
|
1289
|
-
(err) =>
|
|
1219
|
+
var cache_drop = (stream) => _chunkN74AN6L5cjs.cache.call(void 0, ).invalidate(stream).catch(
|
|
1220
|
+
(err) => _chunkN74AN6L5cjs.log.call(void 0, ).warn(
|
|
1290
1221
|
err,
|
|
1291
1222
|
"cache invalidate skipped; a stale checkpoint re-folds from its event_id"
|
|
1292
1223
|
)
|
|
@@ -1294,11 +1225,11 @@ var cache_drop = (stream) => _chunkC4JJ7LTBcjs.cache.call(void 0, ).invalidate(s
|
|
|
1294
1225
|
async function snap(snapshot) {
|
|
1295
1226
|
const { id, stream, name, meta, version } = snapshot.event;
|
|
1296
1227
|
try {
|
|
1297
|
-
const [committed] = await
|
|
1228
|
+
const [committed] = await _chunkN74AN6L5cjs.store.call(void 0, ).commit(
|
|
1298
1229
|
[
|
|
1299
1230
|
{
|
|
1300
1231
|
stream,
|
|
1301
|
-
msgs: [{ name:
|
|
1232
|
+
msgs: [{ name: _chunkZTHGF62Ocjs.SNAP_EVENT, data: snapshot.state }],
|
|
1302
1233
|
// IMPORTANT! - state events are committed right after the snapshot event
|
|
1303
1234
|
expectedVersion: version
|
|
1304
1235
|
}
|
|
@@ -1311,18 +1242,18 @@ async function snap(snapshot) {
|
|
|
1311
1242
|
return committed;
|
|
1312
1243
|
} catch (error) {
|
|
1313
1244
|
const reason = error instanceof Error ? error.message : String(error);
|
|
1314
|
-
|
|
1245
|
+
_chunkN74AN6L5cjs.log.call(void 0, ).warn(
|
|
1315
1246
|
`Snapshot write failed on stream "${stream}": ${reason} \u2014 cold starts will replay full history until snapshots succeed.`
|
|
1316
1247
|
);
|
|
1317
1248
|
}
|
|
1318
1249
|
}
|
|
1319
1250
|
async function tombstone(stream, expectedVersion, correlation) {
|
|
1320
1251
|
try {
|
|
1321
|
-
const [committed] = await
|
|
1252
|
+
const [committed] = await _chunkN74AN6L5cjs.store.call(void 0, ).commit(
|
|
1322
1253
|
[
|
|
1323
1254
|
{
|
|
1324
1255
|
stream,
|
|
1325
|
-
msgs: [{ name:
|
|
1256
|
+
msgs: [{ name: _chunkZTHGF62Ocjs.TOMBSTONE_EVENT, data: {} }],
|
|
1326
1257
|
expectedVersion
|
|
1327
1258
|
}
|
|
1328
1259
|
],
|
|
@@ -1330,7 +1261,7 @@ async function tombstone(stream, expectedVersion, correlation) {
|
|
|
1330
1261
|
);
|
|
1331
1262
|
return committed;
|
|
1332
1263
|
} catch (error) {
|
|
1333
|
-
if (error instanceof
|
|
1264
|
+
if (error instanceof _chunkZTHGF62Ocjs.ConcurrencyError) return void 0;
|
|
1334
1265
|
throw error;
|
|
1335
1266
|
}
|
|
1336
1267
|
}
|
|
@@ -1367,9 +1298,9 @@ async function scan(source, opts = {}, callback) {
|
|
|
1367
1298
|
if (drop_closed_streams) {
|
|
1368
1299
|
await source.query(
|
|
1369
1300
|
(e) => {
|
|
1370
|
-
if (e.name ===
|
|
1301
|
+
if (e.name === _chunkZTHGF62Ocjs.TOMBSTONE_EVENT) closed_streams.add(e.stream);
|
|
1371
1302
|
},
|
|
1372
|
-
{ names: [
|
|
1303
|
+
{ names: [_chunkZTHGF62Ocjs.TOMBSTONE_EVENT] }
|
|
1373
1304
|
);
|
|
1374
1305
|
}
|
|
1375
1306
|
let max_id;
|
|
@@ -1394,11 +1325,11 @@ async function scan(source, opts = {}, callback) {
|
|
|
1394
1325
|
if (on_progress) on_progress({ processed, id: event.id, max_id });
|
|
1395
1326
|
const has_history = started.has(event.stream);
|
|
1396
1327
|
started.add(event.stream);
|
|
1397
|
-
if (drop_snapshots && event.name ===
|
|
1328
|
+
if (drop_snapshots && event.name === _chunkZTHGF62Ocjs.SNAP_EVENT && has_history) {
|
|
1398
1329
|
dropped_snaps++;
|
|
1399
1330
|
return;
|
|
1400
1331
|
}
|
|
1401
|
-
if (closed_streams.has(event.stream) && event.name !==
|
|
1332
|
+
if (closed_streams.has(event.stream) && event.name !== _chunkZTHGF62Ocjs.TOMBSTONE_EVENT) {
|
|
1402
1333
|
dropped_closed++;
|
|
1403
1334
|
return;
|
|
1404
1335
|
}
|
|
@@ -1475,18 +1406,18 @@ async function load(me, target, callback, patch_fn = bare_patch) {
|
|
|
1475
1406
|
const { stream, actor, asOf } = target;
|
|
1476
1407
|
const time_travel = !!asOf && Object.values(asOf).some((v) => v !== void 0);
|
|
1477
1408
|
const seeded = time_travel && asOf.limit === void 0 && !asOf.created_after;
|
|
1478
|
-
const cached = time_travel ? void 0 : await
|
|
1409
|
+
const cached = time_travel ? void 0 : await _chunkN74AN6L5cjs.cache.call(void 0, ).get(stream);
|
|
1479
1410
|
const cache_hit = !!cached;
|
|
1480
1411
|
let state2 = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _63 => _63.state]), () => ( (me.init ? me.init() : {})));
|
|
1481
1412
|
let patches = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _64 => _64.patches]), () => ( 0));
|
|
1482
1413
|
let snaps = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _65 => _65.snaps]), () => ( 0));
|
|
1483
1414
|
let replayed = 0;
|
|
1484
1415
|
let event;
|
|
1485
|
-
await
|
|
1416
|
+
await _chunkN74AN6L5cjs.store.call(void 0, ).query(
|
|
1486
1417
|
(raw) => {
|
|
1487
|
-
if (seeded && raw.name ===
|
|
1418
|
+
if (seeded && raw.name === _chunkZTHGF62Ocjs.SNAP_EVENT && replayed > 0) return;
|
|
1488
1419
|
event = me.view(raw, actor);
|
|
1489
|
-
if (event.name ===
|
|
1420
|
+
if (event.name === _chunkZTHGF62Ocjs.SNAP_EVENT) {
|
|
1490
1421
|
state2 = event.data;
|
|
1491
1422
|
snaps++;
|
|
1492
1423
|
patches = 0;
|
|
@@ -1495,8 +1426,8 @@ async function load(me, target, callback, patch_fn = bare_patch) {
|
|
|
1495
1426
|
state2 = patch_fn(me, state2, me.patch[event.name](event, state2), event);
|
|
1496
1427
|
patches++;
|
|
1497
1428
|
replayed++;
|
|
1498
|
-
} else if (event.name !==
|
|
1499
|
-
|
|
1429
|
+
} else if (event.name !== _chunkZTHGF62Ocjs.TOMBSTONE_EVENT) {
|
|
1430
|
+
_chunkN74AN6L5cjs.log.call(void 0, ).warn(
|
|
1500
1431
|
`Skipping unknown event "${String(event.name)}" on stream "${stream}" (id=${event.id}) \u2014 no reducer in state "${me.name}"`
|
|
1501
1432
|
);
|
|
1502
1433
|
}
|
|
@@ -1524,7 +1455,7 @@ async function load(me, target, callback, patch_fn = bare_patch) {
|
|
|
1524
1455
|
) : time_travel ? asOf : { with_snaps: true }
|
|
1525
1456
|
}
|
|
1526
1457
|
);
|
|
1527
|
-
const head_is_tombstone = _optionalChain([event, 'optionalAccess', _67 => _67.name]) ===
|
|
1458
|
+
const head_is_tombstone = _optionalChain([event, 'optionalAccess', _67 => _67.name]) === _chunkZTHGF62Ocjs.TOMBSTONE_EVENT;
|
|
1528
1459
|
if (replayed > 0 && !time_travel && event && !me.pii_aware && !head_is_tombstone) {
|
|
1529
1460
|
await cache_put(stream, {
|
|
1530
1461
|
stream,
|
|
@@ -1567,8 +1498,8 @@ async function load_others(loads, payload, own, actor, patch_fn, refuse) {
|
|
|
1567
1498
|
void 0,
|
|
1568
1499
|
patch_fn
|
|
1569
1500
|
);
|
|
1570
|
-
if (_optionalChain([snapshot, 'access', _72 => _72.event, 'optionalAccess', _73 => _73.name]) ===
|
|
1571
|
-
throw new (0,
|
|
1501
|
+
if (_optionalChain([snapshot, 'access', _72 => _72.event, 'optionalAccess', _73 => _73.name]) === _chunkZTHGF62Ocjs.TOMBSTONE_EVENT)
|
|
1502
|
+
throw new (0, _chunkZTHGF62Ocjs.StreamClosedError)(stream);
|
|
1572
1503
|
return {
|
|
1573
1504
|
state: l.state,
|
|
1574
1505
|
stream,
|
|
@@ -1584,7 +1515,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1584
1515
|
if (!stream) throw new Error("Missing target stream");
|
|
1585
1516
|
const reactingTo = _optionalChain([options, 'optionalAccess', _74 => _74.reactingTo]);
|
|
1586
1517
|
const correlator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _75 => _75.correlator]), () => ( default_correlator));
|
|
1587
|
-
const validated =
|
|
1518
|
+
const validated = _chunkN74AN6L5cjs.validate.call(void 0, action2, payload, me.actions[action2]);
|
|
1588
1519
|
const opts = _optionalChain([me, 'access', _76 => _76.options, 'optionalAccess', _77 => _77[action2]]);
|
|
1589
1520
|
const max_retries = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _78 => _78.maxRetries]), () => ( 0));
|
|
1590
1521
|
const loads = _nullishCoalesce(_optionalChain([me, 'access', _79 => _79.loads, 'optionalAccess', _80 => _80[action2]]), () => ( []));
|
|
@@ -1596,8 +1527,8 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1596
1527
|
void 0,
|
|
1597
1528
|
patch_fn
|
|
1598
1529
|
);
|
|
1599
|
-
if (_optionalChain([snapshot, 'access', _81 => _81.event, 'optionalAccess', _82 => _82.name]) ===
|
|
1600
|
-
throw new (0,
|
|
1530
|
+
if (_optionalChain([snapshot, 'access', _81 => _81.event, 'optionalAccess', _82 => _82.name]) === _chunkZTHGF62Ocjs.TOMBSTONE_EVENT)
|
|
1531
|
+
throw new (0, _chunkZTHGF62Ocjs.StreamClosedError)(stream);
|
|
1601
1532
|
const own = {
|
|
1602
1533
|
state: me,
|
|
1603
1534
|
stream,
|
|
@@ -1611,7 +1542,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1611
1542
|
{ stream, state: snapshot.state },
|
|
1612
1543
|
target.actor,
|
|
1613
1544
|
patch_fn,
|
|
1614
|
-
(description) => new (0,
|
|
1545
|
+
(description) => new (0, _chunkZTHGF62Ocjs.PreconditionError)(
|
|
1615
1546
|
action2,
|
|
1616
1547
|
validated,
|
|
1617
1548
|
target,
|
|
@@ -1624,7 +1555,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1624
1555
|
);
|
|
1625
1556
|
for (const { holds, description } of _nullishCoalesce(_optionalChain([me, 'access', _85 => _85.requires, 'optionalAccess', _86 => _86[action2]]), () => ( [])))
|
|
1626
1557
|
if (!holds(validated, snapshot.state, actor, loaded))
|
|
1627
|
-
throw new (0,
|
|
1558
|
+
throw new (0, _chunkZTHGF62Ocjs.PreconditionError)(
|
|
1628
1559
|
action2,
|
|
1629
1560
|
validated,
|
|
1630
1561
|
target,
|
|
@@ -1646,7 +1577,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1646
1577
|
);
|
|
1647
1578
|
to.events.push({
|
|
1648
1579
|
name: event,
|
|
1649
|
-
data:
|
|
1580
|
+
data: _chunkN74AN6L5cjs.validate.call(void 0, event, data, to.state.events[event])
|
|
1650
1581
|
});
|
|
1651
1582
|
}
|
|
1652
1583
|
if (!own.events.length)
|
|
@@ -1703,7 +1634,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1703
1634
|
});
|
|
1704
1635
|
let committed;
|
|
1705
1636
|
try {
|
|
1706
|
-
committed = await
|
|
1637
|
+
committed = await _chunkN74AN6L5cjs.store.call(void 0, ).commit(
|
|
1707
1638
|
appends.map((p) => ({
|
|
1708
1639
|
stream: p.stream,
|
|
1709
1640
|
msgs: p.events.map((e) => p.state.message(e)),
|
|
@@ -1712,7 +1643,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1712
1643
|
meta
|
|
1713
1644
|
);
|
|
1714
1645
|
} catch (error) {
|
|
1715
|
-
if (error instanceof
|
|
1646
|
+
if (error instanceof _chunkZTHGF62Ocjs.ConcurrencyError) void cache_drop(error.stream);
|
|
1716
1647
|
throw error;
|
|
1717
1648
|
}
|
|
1718
1649
|
let row = 0;
|
|
@@ -1754,19 +1685,19 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1754
1685
|
}
|
|
1755
1686
|
return snapshots;
|
|
1756
1687
|
} catch (error) {
|
|
1757
|
-
if (!(error instanceof
|
|
1688
|
+
if (!(error instanceof _chunkZTHGF62Ocjs.ConcurrencyError)) throw error;
|
|
1758
1689
|
if (expectedVersion !== void 0 && error.stream === stream) throw error;
|
|
1759
1690
|
if (attempt >= max_retries) throw error;
|
|
1760
1691
|
if (_optionalChain([opts, 'optionalAccess', _95 => _95.backoff])) {
|
|
1761
1692
|
const delay_ms = compute_backoff_delay(attempt, opts.backoff);
|
|
1762
|
-
if (delay_ms > 0) await
|
|
1693
|
+
if (delay_ms > 0) await _chunkN74AN6L5cjs.sleep.call(void 0, delay_ms);
|
|
1763
1694
|
}
|
|
1764
1695
|
}
|
|
1765
1696
|
}
|
|
1766
1697
|
}
|
|
1767
1698
|
|
|
1768
1699
|
// src/internal/tracing.ts
|
|
1769
|
-
var PRETTY =
|
|
1700
|
+
var PRETTY = _chunkN74AN6L5cjs.config.call(void 0, ).env !== "production";
|
|
1770
1701
|
var C_BLUE = "\x1B[38;5;39m";
|
|
1771
1702
|
var C_ORANGE = "\x1B[38;5;208m";
|
|
1772
1703
|
var C_GREEN = "\x1B[38;5;42m";
|
|
@@ -1950,7 +1881,7 @@ function budget_exhausted(lease, options, store_failing) {
|
|
|
1950
1881
|
if (store_failing || !_optionalChain([options, 'optionalAccess', _106 => _106.blockOnError]) || lease.retry <= options.maxRetries)
|
|
1951
1882
|
return void 0;
|
|
1952
1883
|
const error = `Blocking ${lease.stream} after ${lease.retry} claims with no acknowledged progress \u2014 the retry budget (${options.maxRetries}) was spent without the handler ever reporting an error. That means every attempt lost its lease before it could ack: move the reaction to a lane whose leaseMillis covers the handler, then unblock the stream.`;
|
|
1953
|
-
|
|
1884
|
+
_chunkN74AN6L5cjs.log.call(void 0, ).error(error);
|
|
1954
1885
|
return { lease, handled: 0, acked_at: lease.at, error, block: true };
|
|
1955
1886
|
}
|
|
1956
1887
|
function fetch_failure_policy(registry) {
|
|
@@ -1966,13 +1897,13 @@ function fetch_failure_policy(registry) {
|
|
|
1966
1897
|
function finalize(lease, handled, at, error, options, logger, failed_at) {
|
|
1967
1898
|
if (!error) return { lease, handled, acked_at: at };
|
|
1968
1899
|
logger.error(error);
|
|
1969
|
-
const non_retryable = error instanceof
|
|
1900
|
+
const non_retryable = error instanceof _chunkZTHGF62Ocjs.NonRetryableError;
|
|
1970
1901
|
const block2 = options.blockOnError && (non_retryable || lease.retry >= options.maxRetries);
|
|
1971
1902
|
if (block2)
|
|
1972
1903
|
logger.error(
|
|
1973
1904
|
non_retryable ? `Blocking ${lease.stream} on non-retryable error.` : `Blocking ${lease.stream} after ${lease.retry} retries.`
|
|
1974
1905
|
);
|
|
1975
|
-
const next_attempt_at = block2 ? void 0 : Date.now() + compute_backoff_delay(lease.retry, _nullishCoalesce(options.backoff, () => (
|
|
1906
|
+
const next_attempt_at = block2 ? void 0 : Date.now() + compute_backoff_delay(lease.retry, _nullishCoalesce(options.backoff, () => ( _chunkN74AN6L5cjs.DEFAULT_BACKOFF)));
|
|
1976
1907
|
return {
|
|
1977
1908
|
lease,
|
|
1978
1909
|
handled,
|
|
@@ -2100,7 +2031,7 @@ async function run_drain_cycle(deps, cycle) {
|
|
|
2100
2031
|
const acked = submitted.length ? await ops.ack(submitted) : [];
|
|
2101
2032
|
const expected = submitted.filter((l) => l.due === void 0).length;
|
|
2102
2033
|
if (acked.length < expected)
|
|
2103
|
-
|
|
2034
|
+
_chunkN74AN6L5cjs.log.call(void 0, ).warn(
|
|
2104
2035
|
`drain: ${expected - acked.length} of ${expected} acks were dropped \u2014 the lease was taken by another worker mid-handler. That work will be redelivered (at-least-once), but persistent drops mean leaseMillis is too short for this handler.`
|
|
2105
2036
|
);
|
|
2106
2037
|
const closeable = handled.filter((h) => h.close !== void 0).map((h) => h.close);
|
|
@@ -2196,9 +2127,9 @@ var DrainController = (_class3 = class {
|
|
|
2196
2127
|
if (!this.armed || this._stopped || this._inflight)
|
|
2197
2128
|
return EMPTY_DRAIN;
|
|
2198
2129
|
const d = _nullishCoalesce(this._deps.defaults, () => ( {}));
|
|
2199
|
-
const streamLimit = _nullishCoalesce(_nullishCoalesce(d.streamLimit, () => ( options.streamLimit)), () => (
|
|
2200
|
-
const eventLimit = _nullishCoalesce(options.eventLimit, () => (
|
|
2201
|
-
const leaseMillis = _nullishCoalesce(_nullishCoalesce(d.leaseMillis, () => ( options.leaseMillis)), () => (
|
|
2130
|
+
const streamLimit = _nullishCoalesce(_nullishCoalesce(d.streamLimit, () => ( options.streamLimit)), () => ( _chunkN74AN6L5cjs.DEFAULT_STREAM_LIMIT));
|
|
2131
|
+
const eventLimit = _nullishCoalesce(options.eventLimit, () => ( _chunkN74AN6L5cjs.DEFAULT_EVENT_LIMIT));
|
|
2132
|
+
const leaseMillis = _nullishCoalesce(_nullishCoalesce(d.leaseMillis, () => ( options.leaseMillis)), () => ( _chunkN74AN6L5cjs.DEFAULT_LEASE_MILLIS));
|
|
2202
2133
|
if (this._deps.breaker.state(Date.now()) === "open")
|
|
2203
2134
|
return EMPTY_DRAIN;
|
|
2204
2135
|
const pass = this._pass(streamLimit, eventLimit, leaseMillis).finally(
|
|
@@ -2324,7 +2255,7 @@ function build_handle(deps) {
|
|
|
2324
2255
|
handled++;
|
|
2325
2256
|
}
|
|
2326
2257
|
} catch (error) {
|
|
2327
|
-
if (error instanceof
|
|
2258
|
+
if (error instanceof _chunkZTHGF62Ocjs.DeferSignal) {
|
|
2328
2259
|
let defer;
|
|
2329
2260
|
try {
|
|
2330
2261
|
defer = resolve_defer_at(error.when, event);
|
|
@@ -2421,22 +2352,22 @@ function synthesize_autoclose_reactions(registry, states, read_window) {
|
|
|
2421
2352
|
// An anchored stream name would read as a pattern, and a store may refuse
|
|
2422
2353
|
// it at subscribe, stopping every reaction. Such a stream has no
|
|
2423
2354
|
// autoclose: `app.close` still closes it.
|
|
2424
|
-
resolver: (e) =>
|
|
2355
|
+
resolver: (e) => _chunkSC6TY4P2cjs.isStreamName.call(void 0, e.stream) ? {
|
|
2425
2356
|
target: `${AUTOCLOSE_TARGET_PREFIX}${e.stream}`,
|
|
2426
2357
|
source: e.stream
|
|
2427
2358
|
} : void 0,
|
|
2428
2359
|
// Never block on autoclose: a transient query/store error should retry,
|
|
2429
2360
|
// not quarantine the synthetic stream.
|
|
2430
|
-
options: { blockOnError: false, maxRetries:
|
|
2361
|
+
options: { blockOnError: false, maxRetries: _chunkN74AN6L5cjs.DEFAULT_MAX_RETRIES },
|
|
2431
2362
|
handler: async (event) => {
|
|
2432
2363
|
const aggregate = event.stream;
|
|
2433
2364
|
const window = read_window();
|
|
2434
2365
|
if (!in_autoclose_window(window, /* @__PURE__ */ new Date()))
|
|
2435
|
-
throw new (0,
|
|
2436
|
-
const stats = await
|
|
2366
|
+
throw new (0, _chunkZTHGF62Ocjs.DeferSignal)({ at: next_window_open(window, /* @__PURE__ */ new Date()) });
|
|
2367
|
+
const stats = await _chunkN74AN6L5cjs.store.call(void 0, ).query_stats([aggregate], {
|
|
2437
2368
|
count: true,
|
|
2438
2369
|
tail: keep_days !== void 0 ? true : void 0,
|
|
2439
|
-
exclude: [
|
|
2370
|
+
exclude: [_chunkZTHGF62Ocjs.TOMBSTONE_EVENT, _chunkZTHGF62Ocjs.SNAP_EVENT]
|
|
2440
2371
|
});
|
|
2441
2372
|
const entry = stats.get(aggregate);
|
|
2442
2373
|
if (!entry) return;
|
|
@@ -2474,7 +2405,7 @@ function synthesize_autoclose_reactions(registry, states, read_window) {
|
|
|
2474
2405
|
dues.push(days_after(entry.tail.created, keep_days));
|
|
2475
2406
|
const future = dues.map((d) => d.getTime()).filter((t) => t > Date.now());
|
|
2476
2407
|
if (future.length)
|
|
2477
|
-
throw new (0,
|
|
2408
|
+
throw new (0, _chunkZTHGF62Ocjs.DeferSignal)({ at: new Date(Math.min(...future)) });
|
|
2478
2409
|
}
|
|
2479
2410
|
};
|
|
2480
2411
|
const key = `__autoclose_${st.name}`;
|
|
@@ -2534,7 +2465,7 @@ async function run_close_cycle(targets, deps) {
|
|
|
2534
2465
|
deps,
|
|
2535
2466
|
() => run_full_closes(full, target_map, deps, skipped)
|
|
2536
2467
|
);
|
|
2537
|
-
const retired = [...truncated.entries()].filter(([, r]) => r.committed.name ===
|
|
2468
|
+
const retired = [...truncated.entries()].filter(([, r]) => r.committed.name === _chunkZTHGF62Ocjs.TOMBSTONE_EVENT).map(([stream]) => stream);
|
|
2538
2469
|
if (retired.length) _optionalChain([deps, 'access', _133 => _133.forget_subscribed, 'optionalCall', _134 => _134(retired)]);
|
|
2539
2470
|
for (const [stream, entry] of windowed_result) truncated.set(stream, entry);
|
|
2540
2471
|
return { truncated, skipped };
|
|
@@ -2616,7 +2547,7 @@ async function run_windowed_closes(windowed, deps, skipped) {
|
|
|
2616
2547
|
if (!await windowed_prune_pending(t.stream, t.before, max_id))
|
|
2617
2548
|
return void 0;
|
|
2618
2549
|
if (t.archive) await t.archive();
|
|
2619
|
-
const result = await
|
|
2550
|
+
const result = await _chunkN74AN6L5cjs.store.call(void 0, ).truncate([
|
|
2620
2551
|
{ stream: t.stream, before: t.before, max_id }
|
|
2621
2552
|
]);
|
|
2622
2553
|
return result.get(t.stream);
|
|
@@ -2629,10 +2560,10 @@ async function run_windowed_closes(windowed, deps, skipped) {
|
|
|
2629
2560
|
async function windowed_prune_pending(stream, before, max_id) {
|
|
2630
2561
|
let boundary_id;
|
|
2631
2562
|
let min_id;
|
|
2632
|
-
await
|
|
2563
|
+
await _chunkN74AN6L5cjs.store.call(void 0, ).query(
|
|
2633
2564
|
(event) => {
|
|
2634
2565
|
if (min_id === void 0 || event.id < min_id) min_id = event.id;
|
|
2635
|
-
if (event.name ===
|
|
2566
|
+
if (event.name === _chunkZTHGF62Ocjs.SNAP_EVENT && event.created < before && (max_id === void 0 || event.id <= max_id) && (boundary_id === void 0 || event.id > boundary_id))
|
|
2636
2567
|
boundary_id = event.id;
|
|
2637
2568
|
},
|
|
2638
2569
|
{ stream, stream_exact: true, with_snaps: true, after: -1 }
|
|
@@ -2643,7 +2574,7 @@ async function probe_min_watermarks(streams, page_size, checkpoint) {
|
|
|
2643
2574
|
const min_at = /* @__PURE__ */ new Map();
|
|
2644
2575
|
const matches = source_matcher();
|
|
2645
2576
|
await walk_streams(
|
|
2646
|
-
|
|
2577
|
+
_chunkN74AN6L5cjs.store.call(void 0, ),
|
|
2647
2578
|
(position) => {
|
|
2648
2579
|
const pending = position.correlated_at === void 0 || position.at < position.correlated_at;
|
|
2649
2580
|
const cap = pending ? position.at : Math.max(position.at, checkpoint);
|
|
@@ -2662,7 +2593,7 @@ function source_matcher() {
|
|
|
2662
2593
|
const compiled = /* @__PURE__ */ new Map();
|
|
2663
2594
|
return (source, target, stream) => {
|
|
2664
2595
|
if (!source) return true;
|
|
2665
|
-
if (
|
|
2596
|
+
if (_chunkSC6TY4P2cjs.isStreamName.call(void 0, source, target)) return source === stream;
|
|
2666
2597
|
let re = compiled.get(source);
|
|
2667
2598
|
if (!re) {
|
|
2668
2599
|
re = new RegExp(source);
|
|
@@ -2672,17 +2603,17 @@ function source_matcher() {
|
|
|
2672
2603
|
};
|
|
2673
2604
|
}
|
|
2674
2605
|
async function scan_stream_heads(streams) {
|
|
2675
|
-
const stats = await
|
|
2676
|
-
exclude: [
|
|
2606
|
+
const stats = await _chunkN74AN6L5cjs.store.call(void 0, ).query_stats(streams, {
|
|
2607
|
+
exclude: [_chunkZTHGF62Ocjs.SNAP_EVENT]
|
|
2677
2608
|
});
|
|
2678
|
-
const domain_heads = await
|
|
2679
|
-
exclude: [
|
|
2609
|
+
const domain_heads = await _chunkN74AN6L5cjs.store.call(void 0, ).query_stats(streams, {
|
|
2610
|
+
exclude: [_chunkZTHGF62Ocjs.SNAP_EVENT, _chunkZTHGF62Ocjs.TOMBSTONE_EVENT]
|
|
2680
2611
|
});
|
|
2681
|
-
const true_heads = await
|
|
2612
|
+
const true_heads = await _chunkN74AN6L5cjs.store.call(void 0, ).query_stats(streams, {});
|
|
2682
2613
|
const out = /* @__PURE__ */ new Map();
|
|
2683
2614
|
for (const [stream, { head }] of domain_heads) {
|
|
2684
2615
|
const marker_head = _optionalChain([stats, 'access', _136 => _136.get, 'call', _137 => _137(stream), 'optionalAccess', _138 => _138.head]);
|
|
2685
|
-
const interrupted = _optionalChain([marker_head, 'optionalAccess', _139 => _139.name]) ===
|
|
2616
|
+
const interrupted = _optionalChain([marker_head, 'optionalAccess', _139 => _139.name]) === _chunkZTHGF62Ocjs.TOMBSTONE_EVENT;
|
|
2686
2617
|
out.set(stream, {
|
|
2687
2618
|
max_id: head.id,
|
|
2688
2619
|
version: true_heads.get(stream).head.version,
|
|
@@ -2705,7 +2636,7 @@ async function partition_by_safety(stream_info, reactive, skipped, page_size, ca
|
|
|
2705
2636
|
const pending_set = /* @__PURE__ */ new Set();
|
|
2706
2637
|
const matches = source_matcher();
|
|
2707
2638
|
await walk_streams(
|
|
2708
|
-
|
|
2639
|
+
_chunkN74AN6L5cjs.store.call(void 0, ),
|
|
2709
2640
|
(position) => {
|
|
2710
2641
|
const has_work = position.correlated_at !== void 0 && position.at < position.correlated_at;
|
|
2711
2642
|
if (!has_work) return;
|
|
@@ -2772,7 +2703,7 @@ async function run_archive_callbacks(guarded, target_map) {
|
|
|
2772
2703
|
}
|
|
2773
2704
|
}
|
|
2774
2705
|
async function heads_still_guarded(guarded, guard_events, skipped) {
|
|
2775
|
-
const heads = await
|
|
2706
|
+
const heads = await _chunkN74AN6L5cjs.store.call(void 0, ).query_stats(guarded, {});
|
|
2776
2707
|
return guarded.filter((stream) => {
|
|
2777
2708
|
if (_optionalChain([heads, 'access', _146 => _146.get, 'call', _147 => _147(stream), 'optionalAccess', _148 => _148.head, 'access', _149 => _149.id]) === guard_events.get(stream).id)
|
|
2778
2709
|
return true;
|
|
@@ -2790,18 +2721,18 @@ async function truncate_and_warm_cache(guarded, seed_states, guard_events, corre
|
|
|
2790
2721
|
meta: {
|
|
2791
2722
|
correlation,
|
|
2792
2723
|
causation: {
|
|
2793
|
-
event: { id: guard.id, name:
|
|
2724
|
+
event: { id: guard.id, name: _chunkZTHGF62Ocjs.TOMBSTONE_EVENT, stream: guard.stream }
|
|
2794
2725
|
}
|
|
2795
2726
|
}
|
|
2796
2727
|
};
|
|
2797
2728
|
});
|
|
2798
|
-
const truncated = await
|
|
2729
|
+
const truncated = await _chunkN74AN6L5cjs.store.call(void 0, ).truncate(trunc_targets);
|
|
2799
2730
|
await Promise.all(
|
|
2800
2731
|
guarded.map(async (stream) => {
|
|
2801
2732
|
const entry = truncated.get(stream);
|
|
2802
2733
|
const state2 = seed_states.get(stream);
|
|
2803
2734
|
if (state2 && entry) {
|
|
2804
|
-
await
|
|
2735
|
+
await _chunkN74AN6L5cjs.cache.call(void 0, ).set(stream, {
|
|
2805
2736
|
stream,
|
|
2806
2737
|
state: state2,
|
|
2807
2738
|
version: entry.committed.version,
|
|
@@ -2810,7 +2741,7 @@ async function truncate_and_warm_cache(guarded, seed_states, guard_events, corre
|
|
|
2810
2741
|
snaps: 1
|
|
2811
2742
|
});
|
|
2812
2743
|
} else {
|
|
2813
|
-
await
|
|
2744
|
+
await _chunkN74AN6L5cjs.cache.call(void 0, ).invalidate(stream);
|
|
2814
2745
|
}
|
|
2815
2746
|
})
|
|
2816
2747
|
);
|
|
@@ -2869,7 +2800,7 @@ var CorrelateCycle = (_class5 = class {
|
|
|
2869
2800
|
// never lets a resolution re-lane them.
|
|
2870
2801
|
|
|
2871
2802
|
__init18() {this._static_subscriptions = /* @__PURE__ */ new Map()}
|
|
2872
|
-
__init19() {this._patterns = new (0,
|
|
2803
|
+
__init19() {this._patterns = new (0, _chunkN74AN6L5cjs.LruMap)(PATTERN_CACHE_SIZE)}
|
|
2873
2804
|
|
|
2874
2805
|
|
|
2875
2806
|
|
|
@@ -2887,7 +2818,7 @@ var CorrelateCycle = (_class5 = class {
|
|
|
2887
2818
|
on_init
|
|
2888
2819
|
}) {;_class5.prototype.__init10.call(this);_class5.prototype.__init11.call(this);_class5.prototype.__init12.call(this);_class5.prototype.__init13.call(this);_class5.prototype.__init14.call(this);_class5.prototype.__init15.call(this);_class5.prototype.__init16.call(this);_class5.prototype.__init17.call(this);_class5.prototype.__init18.call(this);_class5.prototype.__init19.call(this);_class5.prototype.__init20.call(this);
|
|
2889
2820
|
this._key = shard ? `${registry_key(registry.events)}:${[...shard].sort().join(",")}` : registry_key(registry.events);
|
|
2890
|
-
this._dynamic_subscriptions = new (0,
|
|
2821
|
+
this._dynamic_subscriptions = new (0, _chunkN74AN6L5cjs.LruMap)(max_subscribed_streams);
|
|
2891
2822
|
this._registry = registry;
|
|
2892
2823
|
this._declared_lanes = declared_lanes;
|
|
2893
2824
|
this._static_targets = static_targets;
|
|
@@ -2945,7 +2876,7 @@ var CorrelateCycle = (_class5 = class {
|
|
|
2945
2876
|
// Would the target's own `fetch` (filtered by `source`) return this event?
|
|
2946
2877
|
_in_fetch_window(source, stream) {
|
|
2947
2878
|
if (source === void 0 || source === stream) return true;
|
|
2948
|
-
if (
|
|
2879
|
+
if (_chunkSC6TY4P2cjs.isStreamName.call(void 0, source)) return false;
|
|
2949
2880
|
let pattern = this._patterns.get(source);
|
|
2950
2881
|
if (!pattern) {
|
|
2951
2882
|
pattern = new RegExp(source);
|
|
@@ -2988,7 +2919,7 @@ var CorrelateCycle = (_class5 = class {
|
|
|
2988
2919
|
const correlated = /* @__PURE__ */ new Map();
|
|
2989
2920
|
let last_id = after;
|
|
2990
2921
|
let stopped = false;
|
|
2991
|
-
const found = await
|
|
2922
|
+
const found = await _chunkN74AN6L5cjs.store.call(void 0, ).query(
|
|
2992
2923
|
(event) => {
|
|
2993
2924
|
if (stopped) return;
|
|
2994
2925
|
const register = this._registry.events[event.name];
|
|
@@ -3007,7 +2938,9 @@ var CorrelateCycle = (_class5 = class {
|
|
|
3007
2938
|
return;
|
|
3008
2939
|
}
|
|
3009
2940
|
if (!resolved) continue;
|
|
3010
|
-
|
|
2941
|
+
try {
|
|
2942
|
+
_chunkN74AN6L5cjs.check.call(void 0, "target", resolved);
|
|
2943
|
+
} catch (e2) {
|
|
3011
2944
|
report_bad_priority(
|
|
3012
2945
|
this._reported,
|
|
3013
2946
|
reaction.handler.name,
|
|
@@ -3042,9 +2975,9 @@ var CorrelateCycle = (_class5 = class {
|
|
|
3042
2975
|
correlated_at: void 0
|
|
3043
2976
|
};
|
|
3044
2977
|
const seen_in_scan = correlated.has(resolved.target);
|
|
3045
|
-
const held_lane = _nullishCoalesce((seen_in_scan ? entry.lane : _optionalChain([recorded, 'optionalAccess', _152 => _152.lane])), () => (
|
|
2978
|
+
const held_lane = _nullishCoalesce((seen_in_scan ? entry.lane : _optionalChain([recorded, 'optionalAccess', _152 => _152.lane])), () => ( _chunkZTHGF62Ocjs.DEFAULT_LANE));
|
|
3046
2979
|
const held_priority = seen_in_scan ? entry.priority : _optionalChain([recorded, 'optionalAccess', _153 => _153.priority]);
|
|
3047
|
-
const resolved_lane = _nullishCoalesce(lane, () => (
|
|
2980
|
+
const resolved_lane = _nullishCoalesce(lane, () => ( _chunkZTHGF62Ocjs.DEFAULT_LANE));
|
|
3048
2981
|
if (held_priority === priority && held_lane !== resolved_lane)
|
|
3049
2982
|
report_lane_conflict(
|
|
3050
2983
|
this._reported,
|
|
@@ -3118,7 +3051,7 @@ var CorrelateCycle = (_class5 = class {
|
|
|
3118
3051
|
await Promise.all(
|
|
3119
3052
|
missed.map(async ([stream, entry]) => {
|
|
3120
3053
|
let row;
|
|
3121
|
-
await
|
|
3054
|
+
await _chunkN74AN6L5cjs.store.call(void 0, ).query_streams(
|
|
3122
3055
|
(position) => {
|
|
3123
3056
|
row = position;
|
|
3124
3057
|
},
|
|
@@ -3130,8 +3063,8 @@ var CorrelateCycle = (_class5 = class {
|
|
|
3130
3063
|
lane: row.lane
|
|
3131
3064
|
});
|
|
3132
3065
|
if (entry.priority > row.priority) return;
|
|
3133
|
-
const held_lane = _nullishCoalesce(row.lane, () => (
|
|
3134
|
-
const resolved_lane = _nullishCoalesce(entry.lane, () => (
|
|
3066
|
+
const held_lane = _nullishCoalesce(row.lane, () => ( _chunkZTHGF62Ocjs.DEFAULT_LANE));
|
|
3067
|
+
const resolved_lane = _nullishCoalesce(entry.lane, () => ( _chunkZTHGF62Ocjs.DEFAULT_LANE));
|
|
3135
3068
|
if (entry.priority === row.priority && held_lane !== resolved_lane)
|
|
3136
3069
|
report_lane_conflict(
|
|
3137
3070
|
this._reported,
|
|
@@ -3157,7 +3090,7 @@ var CorrelateCycle = (_class5 = class {
|
|
|
3157
3090
|
millis: 0
|
|
3158
3091
|
});
|
|
3159
3092
|
} catch (error) {
|
|
3160
|
-
|
|
3093
|
+
_chunkN74AN6L5cjs.log.call(void 0, ).warn(
|
|
3161
3094
|
`Could not hand back the correlation lease during shutdown; it expires on its own within ${CORRELATION_LEASE_MS}ms and correlation resumes normally after that. On a single-writer store this usually means another connection holds the database. Cause: ${String(_nullishCoalesce(error.cause, () => ( error)))}`
|
|
3162
3095
|
);
|
|
3163
3096
|
}
|
|
@@ -3181,7 +3114,7 @@ function pii_gate(event, fields, predicate, actor) {
|
|
|
3181
3114
|
const { pii, ...rest } = event;
|
|
3182
3115
|
if (pii == null) {
|
|
3183
3116
|
const shredded = { ...data };
|
|
3184
|
-
for (const f of fields) shredded[f] =
|
|
3117
|
+
for (const f of fields) shredded[f] = _chunkZTHGF62Ocjs.SHREDDED;
|
|
3185
3118
|
return { ...rest, data: shredded };
|
|
3186
3119
|
}
|
|
3187
3120
|
const allowed = !!actor && !!predicate && predicate(event, actor);
|
|
@@ -3192,7 +3125,7 @@ function pii_gate(event, fields, predicate, actor) {
|
|
|
3192
3125
|
};
|
|
3193
3126
|
}
|
|
3194
3127
|
const redacted = { ...data };
|
|
3195
|
-
for (const f of fields) redacted[f] =
|
|
3128
|
+
for (const f of fields) redacted[f] = _chunkZTHGF62Ocjs.REDACTED;
|
|
3196
3129
|
return { ...rest, data: redacted };
|
|
3197
3130
|
}
|
|
3198
3131
|
var IDENTITY_GATE = (event) => event;
|
|
@@ -3400,13 +3333,6 @@ var SettleLoop = (_class6 = class {
|
|
|
3400
3333
|
}, _class6);
|
|
3401
3334
|
|
|
3402
3335
|
// src/act.ts
|
|
3403
|
-
function validate_only_lanes(only, declared) {
|
|
3404
|
-
const unknown = (_nullishCoalesce(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 = (_class7 = class {
|
|
3411
3337
|
__init26() {this._emitter = new (0, _events2.default)()}
|
|
3412
3338
|
|
|
@@ -3494,7 +3420,7 @@ var Act = (_class7 = class {
|
|
|
3494
3420
|
// Lanes to arm per event; `"all"` when a dynamic resolver hides the lane.
|
|
3495
3421
|
|
|
3496
3422
|
|
|
3497
|
-
__init27() {this._logger =
|
|
3423
|
+
__init27() {this._logger = _chunkN74AN6L5cjs.log.call(void 0, )}
|
|
3498
3424
|
// This Act's ports: its own bag, or the singleton adapters.
|
|
3499
3425
|
|
|
3500
3426
|
// Runs a body so internal `store()`/`cache()` calls resolve to `_ports`.
|
|
@@ -3514,12 +3440,19 @@ var Act = (_class7 = class {
|
|
|
3514
3440
|
this._states = states;
|
|
3515
3441
|
this._batch_handlers = batch_handlers;
|
|
3516
3442
|
this._lanes = lanes;
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3443
|
+
const declared = ["default", ...lanes.map((l) => l.name)];
|
|
3444
|
+
this._declared_lanes = declared;
|
|
3445
|
+
const undeclared = (_nullishCoalesce(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) _chunkN74AN6L5cjs.check.call(void 0, "store", options.scoped.store);
|
|
3453
|
+
this._ports = _nullishCoalesce(options.scoped, () => ( _chunkN74AN6L5cjs.unscoped_ports.call(void 0, )));
|
|
3521
3454
|
const ports = this._ports;
|
|
3522
|
-
this._scoped =
|
|
3455
|
+
this._scoped = _chunkN74AN6L5cjs.make_run_scoped.call(void 0, {
|
|
3523
3456
|
// Getters, not a spread: the singletons resolve lazily, so a later
|
|
3524
3457
|
// `store(...)` / `cache(...)` still takes effect.
|
|
3525
3458
|
get store() {
|
|
@@ -3529,14 +3462,14 @@ var Act = (_class7 = 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: _chunkN74AN6L5cjs.check.call(void 0, "autoclose", options).autocloseWindow
|
|
3533
3466
|
});
|
|
3534
3467
|
this._correlator = _nullishCoalesce(options.correlator, () => ( default_correlator));
|
|
3535
3468
|
this._es = build_es(this._logger, this._correlator, patch_fn);
|
|
3536
3469
|
this._cd = build_drain(this._logger);
|
|
3537
3470
|
const handle = build_handle({
|
|
3538
3471
|
logger: this._logger,
|
|
3539
|
-
reaction_scope:
|
|
3472
|
+
reaction_scope: _chunkN74AN6L5cjs.make_reaction_scope.call(void 0, {
|
|
3540
3473
|
do: this.do.bind(this),
|
|
3541
3474
|
load: this.load.bind(this),
|
|
3542
3475
|
query: this.query.bind(this),
|
|
@@ -3566,12 +3499,12 @@ var Act = (_class7 = class {
|
|
|
3566
3499
|
this._ports.store,
|
|
3567
3500
|
options.listen !== false
|
|
3568
3501
|
);
|
|
3569
|
-
|
|
3502
|
+
_chunkN74AN6L5cjs.register_weak_disposer.call(void 0, new WeakRef(this), (self) => self.shutdown());
|
|
3570
3503
|
}
|
|
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
|
+
_chunkN74AN6L5cjs.check.call(void 0, "circuit_breaker", _nullishCoalesce(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
|
|
@@ -3605,7 +3538,7 @@ var Act = (_class7 = class {
|
|
|
3605
3538
|
try {
|
|
3606
3539
|
await this._run_close(targets);
|
|
3607
3540
|
} catch (error) {
|
|
3608
|
-
if (error instanceof
|
|
3541
|
+
if (error instanceof _chunkZTHGF62Ocjs.StoreError) throw error;
|
|
3609
3542
|
this._logger.error(
|
|
3610
3543
|
error,
|
|
3611
3544
|
`Reaction-requested close of ${targets.map((t) => `"${t.stream}"`).join(", ")} failed; the policy retries it (a full close the next day, a prune on the stream's next commit), or close it now with app.close(...) once the cause is fixed.`
|
|
@@ -3639,7 +3572,7 @@ var Act = (_class7 = class {
|
|
|
3639
3572
|
// Audit deps, built after the controllers so the lane set is final.
|
|
3640
3573
|
_build_audit_deps() {
|
|
3641
3574
|
return {
|
|
3642
|
-
store:
|
|
3575
|
+
store: _chunkN74AN6L5cjs.store,
|
|
3643
3576
|
event_to_state: this._event_to_state,
|
|
3644
3577
|
// Declared lanes, not this process's controllers: a lane another
|
|
3645
3578
|
// worker drains is not `unknown-lane`.
|
|
@@ -3652,7 +3585,7 @@ var Act = (_class7 = class {
|
|
|
3652
3585
|
registry: this.registry,
|
|
3653
3586
|
static_targets: classification.static_targets,
|
|
3654
3587
|
cd: this._cd,
|
|
3655
|
-
max_subscribed_streams: _nullishCoalesce(options.maxSubscribedStreams, () => (
|
|
3588
|
+
max_subscribed_streams: _nullishCoalesce(options.maxSubscribedStreams, () => ( _chunkZTHGF62Ocjs.DEFAULT_MAX_SUBSCRIBED_STREAMS)),
|
|
3656
3589
|
// Declared lanes (not active ones): a lane another process claims is
|
|
3657
3590
|
// still a valid destination.
|
|
3658
3591
|
declared_lanes: new Set(this._declared_lanes),
|
|
@@ -3668,7 +3601,7 @@ var Act = (_class7 = class {
|
|
|
3668
3601
|
// Cold start: an idle deferred stream still fires on time after a restart.
|
|
3669
3602
|
async _seed_persisted_defers() {
|
|
3670
3603
|
const now = Date.now();
|
|
3671
|
-
await walk_streams(
|
|
3604
|
+
await walk_streams(_chunkN74AN6L5cjs.store.call(void 0, ), (pos) => {
|
|
3672
3605
|
if (pos.deferred_at === void 0 || pos.deferred_at <= now) return;
|
|
3673
3606
|
const controller = this._drain_controllers.get(_nullishCoalesce(pos.lane, () => ( "default")));
|
|
3674
3607
|
_optionalChain([controller, 'optionalAccess', _161 => _161.seed_defer, 'call', _162 => _162(pos.stream, pos.deferred_at)]);
|
|
@@ -3684,7 +3617,7 @@ var Act = (_class7 = class {
|
|
|
3684
3617
|
on_settled: (drain) => this.emit("settled", drain),
|
|
3685
3618
|
breaker: this._breaker
|
|
3686
3619
|
},
|
|
3687
|
-
_nullishCoalesce(options.settleDebounceMs, () => (
|
|
3620
|
+
_nullishCoalesce(options.settleDebounceMs, () => ( _chunkZTHGF62Ocjs.DEFAULT_SETTLE_DEBOUNCE_MS))
|
|
3688
3621
|
);
|
|
3689
3622
|
}
|
|
3690
3623
|
|
|
@@ -3704,7 +3637,7 @@ var Act = (_class7 = class {
|
|
|
3704
3637
|
*/
|
|
3705
3638
|
shutdown(options) {
|
|
3706
3639
|
if (!this._shutdown_promise) {
|
|
3707
|
-
|
|
3640
|
+
_chunkN74AN6L5cjs.check.call(void 0, "shutdown", _nullishCoalesce(options, () => ( {})));
|
|
3708
3641
|
this._shutdown_promise = (async () => {
|
|
3709
3642
|
this.stop_correlations();
|
|
3710
3643
|
this._settle.stop(true);
|
|
@@ -3722,10 +3655,10 @@ var Act = (_class7 = class {
|
|
|
3722
3655
|
// The largest `leaseMillis` among lanes with a cycle in flight (the
|
|
3723
3656
|
// default for none or 0, and for a running settle), capped.
|
|
3724
3657
|
_derive_grace_ms(running, settling) {
|
|
3725
|
-
let max = settling ?
|
|
3658
|
+
let max = settling ? _chunkN74AN6L5cjs.DEFAULT_LEASE_MILLIS : 0;
|
|
3726
3659
|
for (const c of running)
|
|
3727
|
-
max = Math.max(max, c.lease_millis ||
|
|
3728
|
-
return Math.min(max,
|
|
3660
|
+
max = Math.max(max, c.lease_millis || _chunkN74AN6L5cjs.DEFAULT_LEASE_MILLIS);
|
|
3661
|
+
return Math.min(max, _chunkN74AN6L5cjs.MAX_SHUTDOWN_GRACE_MS);
|
|
3729
3662
|
}
|
|
3730
3663
|
async _await_inflight(grace_ms) {
|
|
3731
3664
|
const running = [...this._drain_controllers.values()].filter(
|
|
@@ -3809,7 +3742,7 @@ var Act = (_class7 = class {
|
|
|
3809
3742
|
* @see {@link ValidationError}, {@link PreconditionError}, {@link ConcurrencyError}
|
|
3810
3743
|
*/
|
|
3811
3744
|
async do(action2, target, payload, options) {
|
|
3812
|
-
const reacting_to = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _164 => _164.reactingTo]), () => (
|
|
3745
|
+
const reacting_to = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _164 => _164.reactingTo]), () => ( _chunkN74AN6L5cjs.current_reacting.call(void 0, )));
|
|
3813
3746
|
const do_options = reacting_to === _optionalChain([options, 'optionalAccess', _165 => _165.reactingTo]) ? options : { ...options, reactingTo: reacting_to };
|
|
3814
3747
|
return this._scoped(async () => {
|
|
3815
3748
|
const snapshots = await this._es.action(
|
|
@@ -3883,7 +3816,7 @@ var Act = (_class7 = class {
|
|
|
3883
3816
|
return this._scoped(async () => {
|
|
3884
3817
|
let first;
|
|
3885
3818
|
let last;
|
|
3886
|
-
const count = await
|
|
3819
|
+
const count = await _chunkN74AN6L5cjs.store.call(void 0, ).query((e) => {
|
|
3887
3820
|
const gated = this.registry.query_gate(e.name)(e);
|
|
3888
3821
|
if (!first) first = gated;
|
|
3889
3822
|
last = gated;
|
|
@@ -3929,14 +3862,14 @@ var Act = (_class7 = class {
|
|
|
3929
3862
|
*/
|
|
3930
3863
|
async forget(stream) {
|
|
3931
3864
|
return this._scoped(async () => {
|
|
3932
|
-
const s =
|
|
3865
|
+
const s = _chunkN74AN6L5cjs.store.call(void 0, );
|
|
3933
3866
|
if (!s.forget_pii) {
|
|
3934
3867
|
throw new Error(
|
|
3935
3868
|
`Store does not implement forget_pii \u2014 adapter cannot comply with sensitive-data erasure. Use an adapter that declares pii_isolation: true (e.g. @rotorsoft/act on the in-memory store).`
|
|
3936
3869
|
);
|
|
3937
3870
|
}
|
|
3938
3871
|
const eventCount = await s.forget_pii(stream);
|
|
3939
|
-
await
|
|
3872
|
+
await _chunkN74AN6L5cjs.cache.call(void 0, ).invalidate(stream);
|
|
3940
3873
|
if (eventCount > 0) {
|
|
3941
3874
|
this.emit("forgotten", { stream, at: /* @__PURE__ */ new Date(), eventCount });
|
|
3942
3875
|
}
|
|
@@ -3970,7 +3903,7 @@ var Act = (_class7 = class {
|
|
|
3970
3903
|
* @see {@link correlate} for dynamic stream discovery
|
|
3971
3904
|
*/
|
|
3972
3905
|
async drain(options = {}) {
|
|
3973
|
-
|
|
3906
|
+
_chunkN74AN6L5cjs.check.call(void 0, "drain", options);
|
|
3974
3907
|
if (!this._drain)
|
|
3975
3908
|
return { fetched: [], leased: [], acked: [], blocked: [] };
|
|
3976
3909
|
return this._scoped(() => this._drain_all(options));
|
|
@@ -4150,7 +4083,7 @@ var Act = (_class7 = class {
|
|
|
4150
4083
|
*/
|
|
4151
4084
|
async reset(input) {
|
|
4152
4085
|
return this._scoped(async () => {
|
|
4153
|
-
const count = await
|
|
4086
|
+
const count = await _chunkN74AN6L5cjs.store.call(void 0, ).reset(input);
|
|
4154
4087
|
for (const handler of this._batch_handlers.values())
|
|
4155
4088
|
_optionalChain([handler, 'access', _172 => _172[FOLD_RESET], 'optionalCall', _173 => _173()]);
|
|
4156
4089
|
if (count > 0) {
|
|
@@ -4186,7 +4119,7 @@ var Act = (_class7 = class {
|
|
|
4186
4119
|
*/
|
|
4187
4120
|
async unblock(input) {
|
|
4188
4121
|
return this._scoped(async () => {
|
|
4189
|
-
const count = await
|
|
4122
|
+
const count = await _chunkN74AN6L5cjs.store.call(void 0, ).unblock(input);
|
|
4190
4123
|
if (count > 0) {
|
|
4191
4124
|
this._wake();
|
|
4192
4125
|
}
|
|
@@ -4234,7 +4167,7 @@ var Act = (_class7 = class {
|
|
|
4234
4167
|
* @see {@link Store.restore} for the underlying driver-pattern primitive.
|
|
4235
4168
|
*/
|
|
4236
4169
|
async restore(source, opts = {}, sink) {
|
|
4237
|
-
|
|
4170
|
+
_chunkN74AN6L5cjs.check.call(void 0, "scan", opts);
|
|
4238
4171
|
return this._scoped(async () => {
|
|
4239
4172
|
const started = Date.now();
|
|
4240
4173
|
if (opts.dry_run) {
|
|
@@ -4242,7 +4175,7 @@ var Act = (_class7 = class {
|
|
|
4242
4175
|
return { ...partial, duration_ms: Date.now() - started };
|
|
4243
4176
|
}
|
|
4244
4177
|
const target = _nullishCoalesce(sink, () => ( (() => {
|
|
4245
|
-
const s =
|
|
4178
|
+
const s = _chunkN74AN6L5cjs.store.call(void 0, );
|
|
4246
4179
|
if (!s.restore) throw new Error("adapter has no restore capability");
|
|
4247
4180
|
return s;
|
|
4248
4181
|
})()));
|
|
@@ -4288,7 +4221,7 @@ var Act = (_class7 = class {
|
|
|
4288
4221
|
async blocked_streams(options) {
|
|
4289
4222
|
return this._scoped(async () => {
|
|
4290
4223
|
const positions = [];
|
|
4291
|
-
await
|
|
4224
|
+
await _chunkN74AN6L5cjs.store.call(void 0, ).query_streams(
|
|
4292
4225
|
(p) => {
|
|
4293
4226
|
positions.push(p);
|
|
4294
4227
|
},
|
|
@@ -4314,6 +4247,7 @@ var Act = (_class7 = class {
|
|
|
4314
4247
|
* ```
|
|
4315
4248
|
*/
|
|
4316
4249
|
async *audit(categories, options) {
|
|
4250
|
+
_chunkN74AN6L5cjs.check.call(void 0, "audit", _nullishCoalesce(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,8 +4275,8 @@ var Act = (_class7 = class {
|
|
|
4341
4275
|
* @see {@link Store.prioritize} for the underlying primitive
|
|
4342
4276
|
*/
|
|
4343
4277
|
async prioritize(filter, priority) {
|
|
4344
|
-
|
|
4345
|
-
return this._scoped(() =>
|
|
4278
|
+
_chunkN74AN6L5cjs.check.call(void 0, "target", { priority });
|
|
4279
|
+
return this._scoped(() => _chunkN74AN6L5cjs.store.call(void 0, ).prioritize(filter, priority));
|
|
4346
4280
|
}
|
|
4347
4281
|
// Shared by `close()` and reaction-requested closes.
|
|
4348
4282
|
async _run_close(targets) {
|
|
@@ -4422,7 +4356,7 @@ var Act = (_class7 = class {
|
|
|
4422
4356
|
* @see {@link correlate} for manual correlation
|
|
4423
4357
|
*/
|
|
4424
4358
|
settle(options) {
|
|
4425
|
-
|
|
4359
|
+
_chunkN74AN6L5cjs.check.call(void 0, "settle", _nullishCoalesce(options, () => ( {})));
|
|
4426
4360
|
this._schedule(options);
|
|
4427
4361
|
}
|
|
4428
4362
|
}, _class7);
|
|
@@ -4430,9 +4364,9 @@ var Act = (_class7 = class {
|
|
|
4430
4364
|
// src/builders/merge.ts
|
|
4431
4365
|
|
|
4432
4366
|
function base_type_name(schema) {
|
|
4433
|
-
let def =
|
|
4434
|
-
for (let inner =
|
|
4435
|
-
def =
|
|
4367
|
+
let def = _chunkZTHGF62Ocjs.def_of.call(void 0, schema);
|
|
4368
|
+
for (let inner = _chunkZTHGF62Ocjs.inner_of.call(void 0, def); inner; inner = _chunkZTHGF62Ocjs.inner_of.call(void 0, def))
|
|
4369
|
+
def = _chunkZTHGF62Ocjs.def_of.call(void 0, inner);
|
|
4436
4370
|
return def.type === "array" ? `array of ${base_type_name(def.element)}` : def.type;
|
|
4437
4371
|
}
|
|
4438
4372
|
function merge_schemas(existing, incoming, state_name) {
|
|
@@ -4619,9 +4553,9 @@ var _this_ = ({ stream }) => ({
|
|
|
4619
4553
|
|
|
4620
4554
|
// src/builders/builder-utils.ts
|
|
4621
4555
|
function register_lane(config2, lanes) {
|
|
4622
|
-
|
|
4623
|
-
if (config2.name ===
|
|
4624
|
-
throw new Error(`Lane "${
|
|
4556
|
+
_chunkN74AN6L5cjs.check.call(void 0, "lane", config2);
|
|
4557
|
+
if (config2.name === _chunkZTHGF62Ocjs.DEFAULT_LANE)
|
|
4558
|
+
throw new Error(`Lane "${_chunkZTHGF62Ocjs.DEFAULT_LANE}" is reserved`);
|
|
4625
4559
|
const existing = lanes.find((l) => l.name === config2.name);
|
|
4626
4560
|
if (!existing) return void lanes.push(config2);
|
|
4627
4561
|
if (existing.leaseMillis !== config2.leaseMillis || existing.streamLimit !== config2.streamLimit || existing.cycleMs !== config2.cycleMs)
|
|
@@ -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") _chunkN74AN6L5cjs.check.call(void 0, "target", resolver);
|
|
4647
4581
|
reaction.resolver = typeof resolver === "string" ? { target: resolver } : resolver;
|
|
4648
4582
|
return builder;
|
|
4649
4583
|
}
|
|
@@ -4657,16 +4591,16 @@ function reaction_on(event, events, builder) {
|
|
|
4657
4591
|
"Reaction",
|
|
4658
4592
|
() => {
|
|
4659
4593
|
if (schedule && typeof schedule !== "function")
|
|
4660
|
-
|
|
4594
|
+
_chunkN74AN6L5cjs.check.call(void 0, "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:
|
|
4668
|
-
blockOnError: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _176 => _176.blockOnError]), () => (
|
|
4669
|
-
maxRetries: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _177 => _177.maxRetries]), () => (
|
|
4601
|
+
options: _chunkN74AN6L5cjs.check.call(void 0, "reaction", {
|
|
4602
|
+
blockOnError: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _176 => _176.blockOnError]), () => ( _chunkN74AN6L5cjs.DEFAULT_BLOCK_ON_ERROR)),
|
|
4603
|
+
maxRetries: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _177 => _177.maxRetries]), () => ( _chunkN74AN6L5cjs.DEFAULT_MAX_RETRIES)),
|
|
4670
4604
|
backoff: _optionalChain([options, 'optionalAccess', _178 => _178.backoff])
|
|
4671
4605
|
})
|
|
4672
4606
|
};
|
|
@@ -4684,7 +4618,7 @@ function reaction_on(event, events, builder) {
|
|
|
4684
4618
|
// src/builders/event-builder.ts
|
|
4685
4619
|
|
|
4686
4620
|
function event_tags(schema) {
|
|
4687
|
-
const pii =
|
|
4621
|
+
const pii = _chunkZTHGF62Ocjs.pii_schemas.call(void 0, schema);
|
|
4688
4622
|
const pii_dates = {};
|
|
4689
4623
|
for (const [key, field] of Object.entries(pii)) {
|
|
4690
4624
|
const dates = date_reviver_schema(field);
|
|
@@ -4722,7 +4656,7 @@ function make_event_reader(tags, disclosure, predicate = null) {
|
|
|
4722
4656
|
});
|
|
4723
4657
|
}
|
|
4724
4658
|
function build_events(registry, states, lanes, owners) {
|
|
4725
|
-
const declared = /* @__PURE__ */ new Set([
|
|
4659
|
+
const declared = /* @__PURE__ */ new Set([_chunkZTHGF62Ocjs.DEFAULT_LANE, ...lanes.map((l) => l.name)]);
|
|
4726
4660
|
const lane_errors = [];
|
|
4727
4661
|
const tags = /* @__PURE__ */ new Map();
|
|
4728
4662
|
const sensitive2 = /* @__PURE__ */ new Map();
|
|
@@ -4797,7 +4731,7 @@ function build_events(registry, states, lanes, owners) {
|
|
|
4797
4731
|
if (reader) readers.set(event_name, reader);
|
|
4798
4732
|
}
|
|
4799
4733
|
const snap2 = make_event_reader(event_tags(state2.state), "redact", null);
|
|
4800
|
-
if (snap2) readers.set(
|
|
4734
|
+
if (snap2) readers.set(_chunkZTHGF62Ocjs.SNAP_EVENT, snap2);
|
|
4801
4735
|
if (readers.size === 0) continue;
|
|
4802
4736
|
state2.view = (event, actor) => (_nullishCoalesce(readers.get(event.name), () => ( IDENTITY_GATE)))(event, actor);
|
|
4803
4737
|
}
|
|
@@ -4805,7 +4739,7 @@ function build_events(registry, states, lanes, owners) {
|
|
|
4805
4739
|
return { sensitive: sensitive2, advisory, query_readers, handler_readers };
|
|
4806
4740
|
}
|
|
4807
4741
|
function reads_as_string(schema) {
|
|
4808
|
-
const type = _optionalChain([
|
|
4742
|
+
const type = _optionalChain([_chunkZTHGF62Ocjs.def_of.call(void 0, _chunkZTHGF62Ocjs.output_of.call(void 0, schema)), 'optionalAccess', _179 => _179.type]);
|
|
4809
4743
|
return type === "string" || type === "transform";
|
|
4810
4744
|
}
|
|
4811
4745
|
|
|
@@ -4917,7 +4851,7 @@ function act() {
|
|
|
4917
4851
|
const list = deprecation_summary.map(
|
|
4918
4852
|
(d) => `"${d.deprecated}" (current: "${d.current}", state: "${d.state_name}")`
|
|
4919
4853
|
).join(", ");
|
|
4920
|
-
|
|
4854
|
+
_chunkN74AN6L5cjs.log.call(void 0, ).info(
|
|
4921
4855
|
`Act registered ${deprecation_summary.length} deprecated event(s): ${list}. These are legacy versions kept for the read path. Consider truncating closed streams via app.close() when feasible to reduce historical event load. See docs/docs/architecture/event-schema-evolution.md.`
|
|
4922
4856
|
);
|
|
4923
4857
|
}
|
|
@@ -4959,7 +4893,7 @@ function act() {
|
|
|
4959
4893
|
return reaction_on(event, registry.events, builder);
|
|
4960
4894
|
},
|
|
4961
4895
|
build: (options) => {
|
|
4962
|
-
|
|
4896
|
+
_chunkN74AN6L5cjs.check.call(void 0, "act", _nullishCoalesce(options, () => ( {})));
|
|
4963
4897
|
if (!_built) {
|
|
4964
4898
|
for (const proj of pending_projections) add_projection(proj);
|
|
4965
4899
|
for (const proj of fold_projections) {
|
|
@@ -4999,7 +4933,7 @@ function act() {
|
|
|
4999
4933
|
for (const [name, gate] of built.query_readers) _qg.set(name, gate);
|
|
5000
4934
|
for (const [name, gate] of built.handler_readers) _hr.set(name, gate);
|
|
5001
4935
|
finalize_deprecations();
|
|
5002
|
-
if (built.advisory)
|
|
4936
|
+
if (built.advisory) _chunkN74AN6L5cjs.log.call(void 0, ).warn(built.advisory);
|
|
5003
4937
|
for (const [name, state2] of states) {
|
|
5004
4938
|
if (!state2.loads) continue;
|
|
5005
4939
|
const resolved = {};
|
|
@@ -5043,7 +4977,7 @@ function act() {
|
|
|
5043
4977
|
synthesize_autoclose_reactions(
|
|
5044
4978
|
registry,
|
|
5045
4979
|
states,
|
|
5046
|
-
|
|
4980
|
+
_chunkN74AN6L5cjs.current_autoclose_window
|
|
5047
4981
|
);
|
|
5048
4982
|
Object.freeze(registry.actions);
|
|
5049
4983
|
Object.freeze(registry.events);
|
|
@@ -5091,8 +5025,8 @@ function _projection(target) {
|
|
|
5091
5025
|
handler,
|
|
5092
5026
|
resolver: _nullishCoalesce(default_resolver, () => ( _this_)),
|
|
5093
5027
|
options: {
|
|
5094
|
-
blockOnError:
|
|
5095
|
-
maxRetries:
|
|
5028
|
+
blockOnError: _chunkN74AN6L5cjs.DEFAULT_BLOCK_ON_ERROR,
|
|
5029
|
+
maxRetries: _chunkN74AN6L5cjs.DEFAULT_MAX_RETRIES
|
|
5096
5030
|
}
|
|
5097
5031
|
}),
|
|
5098
5032
|
widened
|
|
@@ -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 = _chunkN74AN6L5cjs.check.call(void 0, "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)) {
|
|
@@ -5151,8 +5085,8 @@ function _projection(target) {
|
|
|
5151
5085
|
handler: noop,
|
|
5152
5086
|
resolver: { target },
|
|
5153
5087
|
options: {
|
|
5154
|
-
blockOnError:
|
|
5155
|
-
maxRetries:
|
|
5088
|
+
blockOnError: _chunkN74AN6L5cjs.DEFAULT_BLOCK_ON_ERROR,
|
|
5089
|
+
maxRetries: _chunkN74AN6L5cjs.DEFAULT_MAX_RETRIES
|
|
5156
5090
|
}
|
|
5157
5091
|
}
|
|
5158
5092
|
]
|
|
@@ -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
|
+
_chunkN74AN6L5cjs.check.call(void 0, "action", options);
|
|
5272
5206
|
internal.options ??= {};
|
|
5273
5207
|
internal.options[action2] = options;
|
|
5274
5208
|
}
|
|
@@ -5526,30 +5460,29 @@ function write_line(writer, line) {
|
|
|
5526
5460
|
}
|
|
5527
5461
|
|
|
5528
5462
|
// src/deprecated.ts
|
|
5529
|
-
var check_appends =
|
|
5530
|
-
var throw_if_stale =
|
|
5531
|
-
var concurrency_error =
|
|
5532
|
-
var seed_event =
|
|
5533
|
-
var fair_slots =
|
|
5534
|
-
var is_literal_source =
|
|
5535
|
-
var notification_of =
|
|
5536
|
-
var DEFAULT_QUERY_STREAMS_LIMIT2 =
|
|
5537
|
-
var ActorSchema2 =
|
|
5538
|
-
var TargetSchema2 =
|
|
5539
|
-
var EventMetaSchema2 =
|
|
5540
|
-
var CausationEventSchema2 =
|
|
5541
|
-
var CommittedMetaSchema2 =
|
|
5542
|
-
var QuerySchema2 =
|
|
5543
|
-
var Environments2 =
|
|
5544
|
-
var LogLevels2 =
|
|
5545
|
-
var ExitCodes2 =
|
|
5546
|
-
var DEFAULT_LANE2 =
|
|
5547
|
-
var DEFAULT_MAX_SUBSCRIBED_STREAMS2 =
|
|
5548
|
-
var DEFAULT_SETTLE_DEBOUNCE_MS2 =
|
|
5549
|
-
var PackageSchema =
|
|
5550
|
-
var default_scope =
|
|
5551
|
-
var
|
|
5552
|
-
var extend = (source, schema, target) => ({ ...target, ..._chunkC4JJ7LTBcjs.validate.call(void 0, "config", source, schema) });
|
|
5463
|
+
var check_appends = _chunkSC6TY4P2cjs.checkAppends;
|
|
5464
|
+
var throw_if_stale = _chunkSC6TY4P2cjs.checkVersion;
|
|
5465
|
+
var concurrency_error = _chunkSC6TY4P2cjs.concurrencyError;
|
|
5466
|
+
var seed_event = _chunkSC6TY4P2cjs.seedEvent;
|
|
5467
|
+
var fair_slots = _chunkSC6TY4P2cjs.fairSlots;
|
|
5468
|
+
var is_literal_source = _chunkSC6TY4P2cjs.isStreamName;
|
|
5469
|
+
var notification_of = _chunkSC6TY4P2cjs.parseNotification;
|
|
5470
|
+
var DEFAULT_QUERY_STREAMS_LIMIT2 = _chunkZTHGF62Ocjs.DEFAULT_QUERY_STREAMS_LIMIT;
|
|
5471
|
+
var ActorSchema2 = _chunkZTHGF62Ocjs.ActorSchema;
|
|
5472
|
+
var TargetSchema2 = _chunkZTHGF62Ocjs.TargetSchema;
|
|
5473
|
+
var EventMetaSchema2 = _chunkZTHGF62Ocjs.EventMetaSchema;
|
|
5474
|
+
var CausationEventSchema2 = _chunkZTHGF62Ocjs.CausationEventSchema;
|
|
5475
|
+
var CommittedMetaSchema2 = _chunkZTHGF62Ocjs.CommittedMetaSchema;
|
|
5476
|
+
var QuerySchema2 = _chunkZTHGF62Ocjs.QuerySchema;
|
|
5477
|
+
var Environments2 = _chunkZTHGF62Ocjs.Environments;
|
|
5478
|
+
var LogLevels2 = _chunkZTHGF62Ocjs.LogLevels;
|
|
5479
|
+
var ExitCodes2 = _chunkZTHGF62Ocjs.ExitCodes;
|
|
5480
|
+
var DEFAULT_LANE2 = _chunkZTHGF62Ocjs.DEFAULT_LANE;
|
|
5481
|
+
var DEFAULT_MAX_SUBSCRIBED_STREAMS2 = _chunkZTHGF62Ocjs.DEFAULT_MAX_SUBSCRIBED_STREAMS;
|
|
5482
|
+
var DEFAULT_SETTLE_DEBOUNCE_MS2 = _chunkZTHGF62Ocjs.DEFAULT_SETTLE_DEBOUNCE_MS;
|
|
5483
|
+
var PackageSchema = _chunkN74AN6L5cjs.package_schema;
|
|
5484
|
+
var default_scope = _chunkN74AN6L5cjs.unscoped_ports;
|
|
5485
|
+
var extend = (source, schema, target) => ({ ...target, ..._chunkN74AN6L5cjs.validate.call(void 0, "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;
|
|
5555
5488
|
|
|
@@ -5611,6 +5544,5 @@ var dateReviver = (_key, value) => typeof value === "string" && ISO_8601.test(va
|
|
|
5611
5544
|
|
|
5612
5545
|
|
|
5613
5546
|
|
|
5614
|
-
|
|
5615
|
-
exports.Act = Act; exports.ActorSchema = ActorSchema2; exports.CausationEventSchema = CausationEventSchema2; exports.CommittedMetaSchema = CommittedMetaSchema2; exports.ConcurrencyError = _chunkQFYPSI6Pcjs.ConcurrencyError; exports.ConsoleLogger = _chunkC4JJ7LTBcjs.ConsoleLogger; exports.CsvFile = CsvFile; exports.DEFAULT_LANE = DEFAULT_LANE2; exports.DEFAULT_MAX_SUBSCRIBED_STREAMS = DEFAULT_MAX_SUBSCRIBED_STREAMS2; exports.DEFAULT_QUERY_STREAMS_LIMIT = DEFAULT_QUERY_STREAMS_LIMIT2; exports.DEFAULT_SETTLE_DEBOUNCE_MS = DEFAULT_SETTLE_DEBOUNCE_MS2; exports.DeferSignal = _chunkQFYPSI6Pcjs.DeferSignal; exports.Environments = Environments2; exports.Errors = _chunkQFYPSI6Pcjs.Errors; exports.EventMetaSchema = EventMetaSchema2; exports.ExitCodes = ExitCodes2; exports.InMemoryCache = _chunkC4JJ7LTBcjs.InMemoryCache; exports.InMemoryStore = _chunkC4JJ7LTBcjs.InMemoryStore; exports.LogLevels = LogLevels2; exports.NonRetryableError = _chunkQFYPSI6Pcjs.NonRetryableError; exports.PackageSchema = PackageSchema; exports.PreconditionError = _chunkQFYPSI6Pcjs.PreconditionError; exports.QuerySchema = QuerySchema2; exports.REDACTED = _chunkQFYPSI6Pcjs.REDACTED; exports.SHREDDED = _chunkQFYPSI6Pcjs.SHREDDED; exports.SNAP_EVENT = _chunkQFYPSI6Pcjs.SNAP_EVENT; exports.StoreError = _chunkQFYPSI6Pcjs.StoreError; exports.StreamClosedError = _chunkQFYPSI6Pcjs.StreamClosedError; exports.TOMBSTONE_EVENT = _chunkQFYPSI6Pcjs.TOMBSTONE_EVENT; exports.TargetSchema = TargetSchema2; exports.ValidationError = _chunkQFYPSI6Pcjs.ValidationError; exports.ZodEmpty = _chunkQFYPSI6Pcjs.ZodEmpty; exports.act = act; exports.cache = _chunkC4JJ7LTBcjs.cache; exports.check_appends = check_appends; exports.concurrency_error = concurrency_error; exports.config = _chunkC4JJ7LTBcjs.config; exports.dateReviver = dateReviver; exports.default_scope = default_scope; exports.dispose = _chunkC4JJ7LTBcjs.dispose; exports.disposeAndExit = _chunkC4JJ7LTBcjs.disposeAndExit; exports.extend = extend; exports.fair_slots = fair_slots; exports.is_literal_source = is_literal_source; exports.log = _chunkC4JJ7LTBcjs.log; exports.notification_of = notification_of; exports.pii_fields = _chunkQFYPSI6Pcjs.pii_fields; exports.port = _chunkC4JJ7LTBcjs.port; exports.projection = projection; exports.resolveAutocloseConfig = resolveAutocloseConfig2; exports.seed_event = seed_event; exports.sensitive = _chunkQFYPSI6Pcjs.sensitive; exports.sensitiveFields = _chunkQFYPSI6Pcjs.sensitiveFields; exports.sleep = _chunkC4JJ7LTBcjs.sleep; exports.slice = slice; exports.state = state; exports.store = _chunkC4JJ7LTBcjs.store; exports.throw_if_stale = throw_if_stale; exports.validate = _chunkC4JJ7LTBcjs.validate;
|
|
5547
|
+
exports.Act = Act; exports.ActorSchema = ActorSchema2; exports.CausationEventSchema = CausationEventSchema2; exports.CommittedMetaSchema = CommittedMetaSchema2; exports.ConcurrencyError = _chunkZTHGF62Ocjs.ConcurrencyError; exports.ConsoleLogger = _chunkN74AN6L5cjs.ConsoleLogger; exports.CsvFile = CsvFile; exports.DEFAULT_LANE = DEFAULT_LANE2; exports.DEFAULT_MAX_SUBSCRIBED_STREAMS = DEFAULT_MAX_SUBSCRIBED_STREAMS2; exports.DEFAULT_QUERY_STREAMS_LIMIT = DEFAULT_QUERY_STREAMS_LIMIT2; exports.DEFAULT_SETTLE_DEBOUNCE_MS = DEFAULT_SETTLE_DEBOUNCE_MS2; exports.DeferSignal = _chunkZTHGF62Ocjs.DeferSignal; exports.Environments = Environments2; exports.Errors = _chunkZTHGF62Ocjs.Errors; exports.EventMetaSchema = EventMetaSchema2; exports.ExitCodes = ExitCodes2; exports.InMemoryCache = _chunkN74AN6L5cjs.InMemoryCache; exports.InMemoryStore = _chunkN74AN6L5cjs.InMemoryStore; exports.LogLevels = LogLevels2; exports.NonRetryableError = _chunkZTHGF62Ocjs.NonRetryableError; exports.PackageSchema = PackageSchema; exports.PreconditionError = _chunkZTHGF62Ocjs.PreconditionError; exports.QuerySchema = QuerySchema2; exports.REDACTED = _chunkZTHGF62Ocjs.REDACTED; exports.SHREDDED = _chunkZTHGF62Ocjs.SHREDDED; exports.SNAP_EVENT = _chunkZTHGF62Ocjs.SNAP_EVENT; exports.StoreError = _chunkZTHGF62Ocjs.StoreError; exports.StreamClosedError = _chunkZTHGF62Ocjs.StreamClosedError; exports.TOMBSTONE_EVENT = _chunkZTHGF62Ocjs.TOMBSTONE_EVENT; exports.TargetSchema = TargetSchema2; exports.ValidationError = _chunkZTHGF62Ocjs.ValidationError; exports.ZodEmpty = _chunkZTHGF62Ocjs.ZodEmpty; exports.act = act; exports.cache = _chunkN74AN6L5cjs.cache; exports.check_appends = check_appends; exports.concurrency_error = concurrency_error; exports.config = _chunkN74AN6L5cjs.config; exports.dateReviver = dateReviver; exports.default_scope = default_scope; exports.dispose = _chunkN74AN6L5cjs.dispose; exports.disposeAndExit = _chunkN74AN6L5cjs.disposeAndExit; exports.extend = extend; exports.fair_slots = fair_slots; exports.is_literal_source = is_literal_source; exports.log = _chunkN74AN6L5cjs.log; exports.notification_of = notification_of; exports.pii_fields = _chunkZTHGF62Ocjs.pii_fields; exports.port = _chunkN74AN6L5cjs.port; exports.projection = projection; exports.seed_event = seed_event; exports.sensitive = _chunkZTHGF62Ocjs.sensitive; exports.sensitiveFields = _chunkZTHGF62Ocjs.sensitiveFields; exports.sleep = _chunkN74AN6L5cjs.sleep; exports.slice = slice; exports.state = state; exports.store = _chunkN74AN6L5cjs.store; exports.throw_if_stale = throw_if_stale; exports.validate = _chunkN74AN6L5cjs.validate;
|
|
5616
5548
|
//# sourceMappingURL=index.cjs.map
|