@rotorsoft/act 1.35.3 → 1.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/@types/act.d.ts +19 -39
- package/dist/@types/act.d.ts.map +1 -1
- package/dist/@types/adapters/in-memory-store.d.ts +0 -4
- package/dist/@types/adapters/in-memory-store.d.ts.map +1 -1
- package/dist/@types/builders/act-builder.d.ts.map +1 -1
- package/dist/@types/internal/autoclose-reaction.d.ts +2 -2
- package/dist/@types/internal/circuit-breaker.d.ts +0 -7
- package/dist/@types/internal/circuit-breaker.d.ts.map +1 -1
- package/dist/@types/internal/correlate-cycle.d.ts +0 -18
- package/dist/@types/internal/correlate-cycle.d.ts.map +1 -1
- package/dist/@types/internal/drain-cycle.d.ts +0 -14
- package/dist/@types/internal/drain-cycle.d.ts.map +1 -1
- package/dist/@types/internal/event-sourcing.d.ts +1 -1
- package/dist/@types/internal/settle.d.ts +0 -9
- package/dist/@types/internal/settle.d.ts.map +1 -1
- package/dist/@types/types/action.d.ts +2 -2
- package/dist/@types/types/errors.d.ts +11 -26
- package/dist/@types/types/errors.d.ts.map +1 -1
- package/dist/{chunk-H2QN755D.js → chunk-A3XDAB7T.js} +1 -1
- package/dist/chunk-A3XDAB7T.js.map +1 -0
- package/dist/{chunk-SVVVS6GA.js → chunk-BRJZQ4IY.js} +8 -8
- package/dist/chunk-BRJZQ4IY.js.map +1 -0
- package/dist/{chunk-F2YAA4SE.cjs → chunk-C67XTW3W.cjs} +19 -19
- package/dist/{chunk-F2YAA4SE.cjs.map → chunk-C67XTW3W.cjs.map} +1 -1
- package/dist/{chunk-4KDMNSPJ.cjs → chunk-NXURHBSB.cjs} +1 -1
- package/dist/chunk-NXURHBSB.cjs.map +1 -0
- package/dist/index.cjs +264 -243
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +122 -101
- package/dist/index.js.map +1 -1
- package/dist/test/index.cjs +4 -4
- package/dist/test/index.js +2 -2
- package/dist/types/index.cjs +2 -2
- package/dist/types/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-4KDMNSPJ.cjs.map +0 -1
- package/dist/chunk-H2QN755D.js.map +0 -1
- package/dist/chunk-SVVVS6GA.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
var
|
|
43
|
+
var _chunkC67XTW3Wcjs = require('./chunk-C67XTW3W.cjs');
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
|
|
@@ -71,24 +71,24 @@ var _chunkF2YAA4SEcjs = require('./chunk-F2YAA4SE.cjs');
|
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
|
|
74
|
-
var
|
|
74
|
+
var _chunkNXURHBSBcjs = require('./chunk-NXURHBSB.cjs');
|
|
75
75
|
|
|
76
76
|
// src/signals.ts
|
|
77
77
|
process.once("SIGINT", async (arg) => {
|
|
78
|
-
|
|
79
|
-
await
|
|
78
|
+
_chunkC67XTW3Wcjs.log.call(void 0, ).info(arg, "SIGINT");
|
|
79
|
+
await _chunkC67XTW3Wcjs.disposeAndExit.call(void 0, "EXIT");
|
|
80
80
|
});
|
|
81
81
|
process.once("SIGTERM", async (arg) => {
|
|
82
|
-
|
|
83
|
-
await
|
|
82
|
+
_chunkC67XTW3Wcjs.log.call(void 0, ).info(arg, "SIGTERM");
|
|
83
|
+
await _chunkC67XTW3Wcjs.disposeAndExit.call(void 0, "EXIT");
|
|
84
84
|
});
|
|
85
85
|
process.once("uncaughtException", async (arg) => {
|
|
86
|
-
|
|
87
|
-
await
|
|
86
|
+
_chunkC67XTW3Wcjs.log.call(void 0, ).error(arg, "Uncaught Exception");
|
|
87
|
+
await _chunkC67XTW3Wcjs.disposeAndExit.call(void 0, "ERROR");
|
|
88
88
|
});
|
|
89
89
|
process.once("unhandledRejection", async (arg) => {
|
|
90
|
-
|
|
91
|
-
await
|
|
90
|
+
_chunkC67XTW3Wcjs.log.call(void 0, ).error(arg, "Unhandled Rejection");
|
|
91
|
+
await _chunkC67XTW3Wcjs.disposeAndExit.call(void 0, "ERROR");
|
|
92
92
|
});
|
|
93
93
|
|
|
94
94
|
// src/act.ts
|
|
@@ -196,7 +196,7 @@ async function* audit(deps, categories, options = {}) {
|
|
|
196
196
|
if (need_stats) {
|
|
197
197
|
const stats = await deps.store().query_stats(
|
|
198
198
|
{},
|
|
199
|
-
{ count: true, names: true, exclude: [
|
|
199
|
+
{ count: true, names: true, exclude: [_chunkNXURHBSBcjs.SNAP_EVENT] }
|
|
200
200
|
);
|
|
201
201
|
for (const [stream, s] of stats) {
|
|
202
202
|
for (const p of passes) _optionalChain([p, 'access', _4 => _4.on_stat, 'optionalCall', _5 => _5(stream, s)]);
|
|
@@ -278,7 +278,7 @@ var make_schema_pass = (deps) => {
|
|
|
278
278
|
return;
|
|
279
279
|
}
|
|
280
280
|
const schema = state2.events[name];
|
|
281
|
-
const sensitive2 =
|
|
281
|
+
const sensitive2 = _chunkNXURHBSBcjs.pii_fields.call(void 0, schema);
|
|
282
282
|
let parse_schema = schema;
|
|
283
283
|
if (sensitive2.length > 0) {
|
|
284
284
|
const omitter = schema.omit;
|
|
@@ -412,7 +412,7 @@ var make_restart_candidate_pass = (deps, options) => {
|
|
|
412
412
|
{
|
|
413
413
|
stream,
|
|
414
414
|
stream_exact: true,
|
|
415
|
-
names: [
|
|
415
|
+
names: [_chunkNXURHBSBcjs.SNAP_EVENT],
|
|
416
416
|
with_snaps: true
|
|
417
417
|
}
|
|
418
418
|
);
|
|
@@ -709,12 +709,10 @@ var CircuitBreaker = (_class = class {
|
|
|
709
709
|
stop() {
|
|
710
710
|
this._clear_wake();
|
|
711
711
|
}
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
* keeps the process alive.
|
|
717
|
-
*/
|
|
712
|
+
// Schedule the `on_retry` wake `cooldownMs` out so the breaker re-trials
|
|
713
|
+
// the store on its own. No-op when no `on_retry` hook is wired (e.g. unit
|
|
714
|
+
// tests of the pure state machine). The timer is `unref`'d so it never
|
|
715
|
+
// keeps the process alive.
|
|
718
716
|
_schedule_wake() {
|
|
719
717
|
if (!this._hooks.on_retry) return;
|
|
720
718
|
this._clear_wake();
|
|
@@ -730,7 +728,7 @@ var CircuitBreaker = (_class = class {
|
|
|
730
728
|
this._wake = void 0;
|
|
731
729
|
}
|
|
732
730
|
}
|
|
733
|
-
|
|
731
|
+
// Pure state transition for a failure — no side effects.
|
|
734
732
|
_advance(now) {
|
|
735
733
|
if (this._opened_at !== void 0) {
|
|
736
734
|
this._opened_at = now;
|
|
@@ -841,7 +839,7 @@ async function run_close_cycle(targets, deps) {
|
|
|
841
839
|
deps,
|
|
842
840
|
() => run_full_closes(full, target_map, deps, skipped)
|
|
843
841
|
);
|
|
844
|
-
const retired = [...truncated.entries()].filter(([, r]) => r.committed.name ===
|
|
842
|
+
const retired = [...truncated.entries()].filter(([, r]) => r.committed.name === _chunkNXURHBSBcjs.TOMBSTONE_EVENT).map(([stream]) => stream);
|
|
845
843
|
if (retired.length) _optionalChain([deps, 'access', _42 => _42.forget_subscribed, 'optionalCall', _43 => _43(retired)]);
|
|
846
844
|
for (const [stream, entry] of windowed_result) truncated.set(stream, entry);
|
|
847
845
|
return { truncated, skipped };
|
|
@@ -923,7 +921,7 @@ async function run_windowed_closes(windowed, deps, skipped) {
|
|
|
923
921
|
if (!await windowed_prune_pending(t.stream, t.before, max_id))
|
|
924
922
|
return void 0;
|
|
925
923
|
if (t.archive) await t.archive();
|
|
926
|
-
const result = await
|
|
924
|
+
const result = await _chunkC67XTW3Wcjs.store.call(void 0, ).truncate([
|
|
927
925
|
{ stream: t.stream, before: t.before, max_id }
|
|
928
926
|
]);
|
|
929
927
|
return result.get(t.stream);
|
|
@@ -936,10 +934,10 @@ async function run_windowed_closes(windowed, deps, skipped) {
|
|
|
936
934
|
async function windowed_prune_pending(stream, before, max_id) {
|
|
937
935
|
let boundary_id;
|
|
938
936
|
let min_id;
|
|
939
|
-
await
|
|
937
|
+
await _chunkC67XTW3Wcjs.store.call(void 0, ).query(
|
|
940
938
|
(event) => {
|
|
941
939
|
if (min_id === void 0 || event.id < min_id) min_id = event.id;
|
|
942
|
-
if (event.name ===
|
|
940
|
+
if (event.name === _chunkNXURHBSBcjs.SNAP_EVENT && event.created < before && (max_id === void 0 || event.id <= max_id) && (boundary_id === void 0 || event.id > boundary_id))
|
|
943
941
|
boundary_id = event.id;
|
|
944
942
|
},
|
|
945
943
|
{ stream, stream_exact: true, with_snaps: true, after: -1 }
|
|
@@ -950,7 +948,7 @@ async function probe_min_watermarks(streams, page_size, checkpoint) {
|
|
|
950
948
|
const min_at = /* @__PURE__ */ new Map();
|
|
951
949
|
const matches = source_matcher();
|
|
952
950
|
await walk_streams(
|
|
953
|
-
|
|
951
|
+
_chunkC67XTW3Wcjs.store.call(void 0, ),
|
|
954
952
|
(position) => {
|
|
955
953
|
const pending = position.correlated_at === void 0 || position.at < position.correlated_at;
|
|
956
954
|
const cap = pending ? position.at : Math.max(position.at, checkpoint);
|
|
@@ -978,17 +976,17 @@ function source_matcher() {
|
|
|
978
976
|
};
|
|
979
977
|
}
|
|
980
978
|
async function scan_stream_heads(streams) {
|
|
981
|
-
const stats = await
|
|
982
|
-
exclude: [
|
|
979
|
+
const stats = await _chunkC67XTW3Wcjs.store.call(void 0, ).query_stats(streams, {
|
|
980
|
+
exclude: [_chunkNXURHBSBcjs.SNAP_EVENT]
|
|
983
981
|
});
|
|
984
|
-
const domain_heads = await
|
|
985
|
-
exclude: [
|
|
982
|
+
const domain_heads = await _chunkC67XTW3Wcjs.store.call(void 0, ).query_stats(streams, {
|
|
983
|
+
exclude: [_chunkNXURHBSBcjs.SNAP_EVENT, _chunkNXURHBSBcjs.TOMBSTONE_EVENT]
|
|
986
984
|
});
|
|
987
|
-
const true_heads = await
|
|
985
|
+
const true_heads = await _chunkC67XTW3Wcjs.store.call(void 0, ).query_stats(streams, {});
|
|
988
986
|
const out = /* @__PURE__ */ new Map();
|
|
989
987
|
for (const [stream, { head }] of domain_heads) {
|
|
990
988
|
const marker_head = _optionalChain([stats, 'access', _45 => _45.get, 'call', _46 => _46(stream), 'optionalAccess', _47 => _47.head]);
|
|
991
|
-
const interrupted = _optionalChain([marker_head, 'optionalAccess', _48 => _48.name]) ===
|
|
989
|
+
const interrupted = _optionalChain([marker_head, 'optionalAccess', _48 => _48.name]) === _chunkNXURHBSBcjs.TOMBSTONE_EVENT;
|
|
992
990
|
out.set(stream, {
|
|
993
991
|
max_id: head.id,
|
|
994
992
|
version: true_heads.get(stream).head.version,
|
|
@@ -1012,7 +1010,7 @@ async function partition_by_safety(stream_info, reactive, skipped, page_size, ca
|
|
|
1012
1010
|
const matches = source_matcher();
|
|
1013
1011
|
const targets = [...stream_info.keys()];
|
|
1014
1012
|
await walk_streams(
|
|
1015
|
-
|
|
1013
|
+
_chunkC67XTW3Wcjs.store.call(void 0, ),
|
|
1016
1014
|
(position) => {
|
|
1017
1015
|
const has_work = position.correlated_at !== void 0 && position.at < position.correlated_at;
|
|
1018
1016
|
if (!has_work) return;
|
|
@@ -1078,7 +1076,7 @@ async function run_archive_callbacks(guarded, target_map) {
|
|
|
1078
1076
|
}
|
|
1079
1077
|
}
|
|
1080
1078
|
async function heads_still_guarded(guarded, guard_events, skipped) {
|
|
1081
|
-
const heads = await
|
|
1079
|
+
const heads = await _chunkC67XTW3Wcjs.store.call(void 0, ).query_stats(guarded, {});
|
|
1082
1080
|
return guarded.filter((stream) => {
|
|
1083
1081
|
if (_optionalChain([heads, 'access', _55 => _55.get, 'call', _56 => _56(stream), 'optionalAccess', _57 => _57.head, 'access', _58 => _58.id]) === guard_events.get(stream).id)
|
|
1084
1082
|
return true;
|
|
@@ -1096,18 +1094,18 @@ async function truncate_and_warm_cache(guarded, seed_states, guard_events, corre
|
|
|
1096
1094
|
meta: {
|
|
1097
1095
|
correlation,
|
|
1098
1096
|
causation: {
|
|
1099
|
-
event: { id: guard.id, name:
|
|
1097
|
+
event: { id: guard.id, name: _chunkNXURHBSBcjs.TOMBSTONE_EVENT, stream: guard.stream }
|
|
1100
1098
|
}
|
|
1101
1099
|
}
|
|
1102
1100
|
};
|
|
1103
1101
|
});
|
|
1104
|
-
const truncated = await
|
|
1102
|
+
const truncated = await _chunkC67XTW3Wcjs.store.call(void 0, ).truncate(trunc_targets);
|
|
1105
1103
|
await Promise.all(
|
|
1106
1104
|
guarded.map(async (stream) => {
|
|
1107
1105
|
const entry = truncated.get(stream);
|
|
1108
1106
|
const state2 = seed_states.get(stream);
|
|
1109
1107
|
if (state2 && entry) {
|
|
1110
|
-
await
|
|
1108
|
+
await _chunkC67XTW3Wcjs.cache.call(void 0, ).set(stream, {
|
|
1111
1109
|
stream,
|
|
1112
1110
|
state: state2,
|
|
1113
1111
|
version: entry.committed.version,
|
|
@@ -1116,7 +1114,7 @@ async function truncate_and_warm_cache(guarded, seed_states, guard_events, corre
|
|
|
1116
1114
|
snaps: 1
|
|
1117
1115
|
});
|
|
1118
1116
|
} else {
|
|
1119
|
-
await
|
|
1117
|
+
await _chunkC67XTW3Wcjs.cache.call(void 0, ).invalidate(stream);
|
|
1120
1118
|
}
|
|
1121
1119
|
})
|
|
1122
1120
|
);
|
|
@@ -1130,7 +1128,7 @@ var _crypto = require('crypto');
|
|
|
1130
1128
|
function report_once(seen, key, message) {
|
|
1131
1129
|
if (seen.has(key)) return;
|
|
1132
1130
|
seen.add(key);
|
|
1133
|
-
|
|
1131
|
+
_chunkC67XTW3Wcjs.log.call(void 0, ).error(new Error(message));
|
|
1134
1132
|
}
|
|
1135
1133
|
|
|
1136
1134
|
// src/internal/correlate-cycle.ts
|
|
@@ -1157,23 +1155,19 @@ function report_lane_conflict(seen, handler, target, kept, dropped) {
|
|
|
1157
1155
|
}
|
|
1158
1156
|
var CorrelateCycle = (_class3 = class {
|
|
1159
1157
|
__init3() {this._checkpoint = -1}
|
|
1160
|
-
|
|
1158
|
+
// Lease holder id; per instance, so a restart never inherits a stale claim.
|
|
1161
1159
|
__init4() {this._by = _crypto.randomUUID.call(void 0, )}
|
|
1162
1160
|
|
|
1163
|
-
|
|
1161
|
+
// Local expiry of the held lease (0 = none); stale only costs a duplicate scan.
|
|
1164
1162
|
__init5() {this._lease_until = 0}
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
* `_lowered` (the raise count the last short page saw). Starts armed.
|
|
1168
|
-
*/
|
|
1163
|
+
// Armed while `_raised` (bumped by a commit or notification) is ahead of
|
|
1164
|
+
// `_lowered` (the raise count the last short page saw). Starts armed.
|
|
1169
1165
|
__init6() {this._raised = 1}
|
|
1170
1166
|
__init7() {this._lowered = 0}
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
* across one writes nothing.
|
|
1174
|
-
*/
|
|
1167
|
+
// Bumped by a release (shutdown), so a scan or lease reply that was out
|
|
1168
|
+
// across one writes nothing.
|
|
1175
1169
|
__init8() {this._epoch = 0}
|
|
1176
|
-
|
|
1170
|
+
// Passes in flight: a restore waits for them, and refuses new ones.
|
|
1177
1171
|
__init9() {this._passes = /* @__PURE__ */ new Set()}
|
|
1178
1172
|
__init10() {this._restoring = false}
|
|
1179
1173
|
|
|
@@ -1181,13 +1175,13 @@ var CorrelateCycle = (_class3 = class {
|
|
|
1181
1175
|
// never lets a resolution re-lane them.
|
|
1182
1176
|
|
|
1183
1177
|
__init11() {this._static_subscriptions = /* @__PURE__ */ new Map()}
|
|
1184
|
-
__init12() {this._patterns = new (0,
|
|
1178
|
+
__init12() {this._patterns = new (0, _chunkC67XTW3Wcjs.LruMap)(PATTERN_CACHE_SIZE)}
|
|
1185
1179
|
|
|
1186
1180
|
|
|
1187
1181
|
|
|
1188
1182
|
|
|
1189
1183
|
|
|
1190
|
-
|
|
1184
|
+
// Report-once keys; per instance because `internal/` holds no module state.
|
|
1191
1185
|
__init13() {this._reported = /* @__PURE__ */ new Set()}
|
|
1192
1186
|
constructor({
|
|
1193
1187
|
registry,
|
|
@@ -1199,7 +1193,7 @@ var CorrelateCycle = (_class3 = class {
|
|
|
1199
1193
|
on_init
|
|
1200
1194
|
}) {;_class3.prototype.__init3.call(this);_class3.prototype.__init4.call(this);_class3.prototype.__init5.call(this);_class3.prototype.__init6.call(this);_class3.prototype.__init7.call(this);_class3.prototype.__init8.call(this);_class3.prototype.__init9.call(this);_class3.prototype.__init10.call(this);_class3.prototype.__init11.call(this);_class3.prototype.__init12.call(this);_class3.prototype.__init13.call(this);
|
|
1201
1195
|
this._key = shard ? `${registry_key(registry.events)}:${[...shard].sort().join(",")}` : registry_key(registry.events);
|
|
1202
|
-
this._dynamic_subscriptions = new (0,
|
|
1196
|
+
this._dynamic_subscriptions = new (0, _chunkC67XTW3Wcjs.LruMap)(max_subscribed_streams);
|
|
1203
1197
|
this._registry = registry;
|
|
1204
1198
|
this._declared_lanes = declared_lanes;
|
|
1205
1199
|
this._static_targets = static_targets;
|
|
@@ -1254,10 +1248,10 @@ var CorrelateCycle = (_class3 = class {
|
|
|
1254
1248
|
forget_subscribed(streams) {
|
|
1255
1249
|
for (const stream of streams) this._dynamic_subscriptions.delete(stream);
|
|
1256
1250
|
}
|
|
1257
|
-
|
|
1251
|
+
// Would the target's own `fetch` (filtered by `source`) return this event?
|
|
1258
1252
|
_in_fetch_window(source, stream) {
|
|
1259
1253
|
if (source === void 0 || source === stream) return true;
|
|
1260
|
-
if (
|
|
1254
|
+
if (_chunkC67XTW3Wcjs.is_literal_source.call(void 0, source)) return false;
|
|
1261
1255
|
let pattern = this._patterns.get(source);
|
|
1262
1256
|
if (!pattern) {
|
|
1263
1257
|
pattern = new RegExp(source);
|
|
@@ -1300,7 +1294,7 @@ var CorrelateCycle = (_class3 = class {
|
|
|
1300
1294
|
const correlated = /* @__PURE__ */ new Map();
|
|
1301
1295
|
let last_id = after;
|
|
1302
1296
|
let stopped = false;
|
|
1303
|
-
const found = await
|
|
1297
|
+
const found = await _chunkC67XTW3Wcjs.store.call(void 0, ).query(
|
|
1304
1298
|
(event) => {
|
|
1305
1299
|
if (stopped) return;
|
|
1306
1300
|
const register = this._registry.events[event.name];
|
|
@@ -1345,9 +1339,9 @@ var CorrelateCycle = (_class3 = class {
|
|
|
1345
1339
|
correlated_at: void 0
|
|
1346
1340
|
};
|
|
1347
1341
|
const seen_in_scan = correlated.has(resolved.target);
|
|
1348
|
-
const held_lane = _nullishCoalesce((seen_in_scan ? entry.lane : _optionalChain([recorded, 'optionalAccess', _61 => _61.lane])), () => (
|
|
1342
|
+
const held_lane = _nullishCoalesce((seen_in_scan ? entry.lane : _optionalChain([recorded, 'optionalAccess', _61 => _61.lane])), () => ( _chunkNXURHBSBcjs.DEFAULT_LANE));
|
|
1349
1343
|
const held_priority = seen_in_scan ? entry.priority : _optionalChain([recorded, 'optionalAccess', _62 => _62.priority]);
|
|
1350
|
-
const resolved_lane = _nullishCoalesce(lane, () => (
|
|
1344
|
+
const resolved_lane = _nullishCoalesce(lane, () => ( _chunkNXURHBSBcjs.DEFAULT_LANE));
|
|
1351
1345
|
if (held_priority === priority && held_lane !== resolved_lane)
|
|
1352
1346
|
report_lane_conflict(
|
|
1353
1347
|
this._reported,
|
|
@@ -1413,17 +1407,15 @@ var CorrelateCycle = (_class3 = class {
|
|
|
1413
1407
|
if (!stopped && found !== limit) this._lowered = raised;
|
|
1414
1408
|
return { kind: "scanned", last_id, subscribed: 0, marked: 0, read };
|
|
1415
1409
|
}
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
* Only called with more than one lane declared.
|
|
1420
|
-
*/
|
|
1410
|
+
// Read the row of each target this scan had no record of (new or evicted),
|
|
1411
|
+
// so a resolution that doesn't beat its priority keeps the row's lane.
|
|
1412
|
+
// Only called with more than one lane declared.
|
|
1421
1413
|
async _recall(correlated) {
|
|
1422
1414
|
const missed = [...correlated].filter(([, entry]) => entry.missed);
|
|
1423
1415
|
await Promise.all(
|
|
1424
1416
|
missed.map(async ([stream, entry]) => {
|
|
1425
1417
|
let row;
|
|
1426
|
-
await
|
|
1418
|
+
await _chunkC67XTW3Wcjs.store.call(void 0, ).query_streams(
|
|
1427
1419
|
(position) => {
|
|
1428
1420
|
row = position;
|
|
1429
1421
|
},
|
|
@@ -1435,8 +1427,8 @@ var CorrelateCycle = (_class3 = class {
|
|
|
1435
1427
|
lane: row.lane
|
|
1436
1428
|
});
|
|
1437
1429
|
if (entry.priority > row.priority) return;
|
|
1438
|
-
const held_lane = _nullishCoalesce(row.lane, () => (
|
|
1439
|
-
const resolved_lane = _nullishCoalesce(entry.lane, () => (
|
|
1430
|
+
const held_lane = _nullishCoalesce(row.lane, () => ( _chunkNXURHBSBcjs.DEFAULT_LANE));
|
|
1431
|
+
const resolved_lane = _nullishCoalesce(entry.lane, () => ( _chunkNXURHBSBcjs.DEFAULT_LANE));
|
|
1440
1432
|
if (entry.priority === row.priority && held_lane !== resolved_lane)
|
|
1441
1433
|
report_lane_conflict(
|
|
1442
1434
|
this._reported,
|
|
@@ -1462,7 +1454,7 @@ var CorrelateCycle = (_class3 = class {
|
|
|
1462
1454
|
millis: 0
|
|
1463
1455
|
});
|
|
1464
1456
|
} catch (error) {
|
|
1465
|
-
|
|
1457
|
+
_chunkC67XTW3Wcjs.log.call(void 0, ).warn(
|
|
1466
1458
|
`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(error)}`
|
|
1467
1459
|
);
|
|
1468
1460
|
}
|
|
@@ -1615,14 +1607,14 @@ function compute_lag_lead_ratio(handled, lagging, leading) {
|
|
|
1615
1607
|
}
|
|
1616
1608
|
|
|
1617
1609
|
// src/internal/drain-ops.ts
|
|
1618
|
-
var claim = (lagging, leading, by, millis, lane) =>
|
|
1610
|
+
var claim = (lagging, leading, by, millis, lane) => _chunkC67XTW3Wcjs.store.call(void 0, ).claim(lagging, leading, by, millis, lane);
|
|
1619
1611
|
async function fetch(leased, eventLimit) {
|
|
1620
1612
|
return Promise.all(
|
|
1621
1613
|
leased.map(async ({ stream, source, at, lagging }) => {
|
|
1622
1614
|
const events = [];
|
|
1623
|
-
const stream_exact = source !== void 0 &&
|
|
1615
|
+
const stream_exact = source !== void 0 && _chunkC67XTW3Wcjs.is_literal_source.call(void 0, source) ? true : void 0;
|
|
1624
1616
|
try {
|
|
1625
|
-
await
|
|
1617
|
+
await _chunkC67XTW3Wcjs.store.call(void 0, ).query((e) => events.push(e), {
|
|
1626
1618
|
stream: source,
|
|
1627
1619
|
stream_exact,
|
|
1628
1620
|
after: at,
|
|
@@ -1642,9 +1634,9 @@ async function fetch(leased, eventLimit) {
|
|
|
1642
1634
|
})
|
|
1643
1635
|
);
|
|
1644
1636
|
}
|
|
1645
|
-
var ack = (leases) =>
|
|
1646
|
-
var block = (leases) =>
|
|
1647
|
-
var subscribe = (streams, correlated_at, correlator) =>
|
|
1637
|
+
var ack = (leases) => _chunkC67XTW3Wcjs.store.call(void 0, ).ack(leases);
|
|
1638
|
+
var block = (leases) => _chunkC67XTW3Wcjs.store.call(void 0, ).block(leases);
|
|
1639
|
+
var subscribe = (streams, correlated_at, correlator) => _chunkC67XTW3Wcjs.store.call(void 0, ).subscribe(streams, correlated_at, correlator);
|
|
1648
1640
|
|
|
1649
1641
|
// src/internal/event-sourcing.ts
|
|
1650
1642
|
var _actpatch = require('@rotorsoft/act-patch');
|
|
@@ -1659,29 +1651,29 @@ var check_invariants = (target, state2, schema, pii_aware) => {
|
|
|
1659
1651
|
try {
|
|
1660
1652
|
result = schema.safeParse(state2);
|
|
1661
1653
|
} catch (error) {
|
|
1662
|
-
throw new (0,
|
|
1654
|
+
throw new (0, _chunkNXURHBSBcjs.ValidationError)(target, state2, error);
|
|
1663
1655
|
}
|
|
1664
1656
|
if (result.success) return;
|
|
1665
1657
|
const issues = pii_aware ? result.error.issues.filter((issue) => {
|
|
1666
1658
|
const value = value_at(state2, issue.path);
|
|
1667
|
-
return value !==
|
|
1659
|
+
return value !== _chunkNXURHBSBcjs.REDACTED && value !== _chunkNXURHBSBcjs.SHREDDED;
|
|
1668
1660
|
}) : result.error.issues;
|
|
1669
1661
|
if (issues.length)
|
|
1670
|
-
throw new (0,
|
|
1662
|
+
throw new (0, _chunkNXURHBSBcjs.ValidationError)(
|
|
1671
1663
|
target,
|
|
1672
1664
|
state2,
|
|
1673
1665
|
_zod2.prettifyError.call(void 0, new (0, _zod2.ZodError)(issues))
|
|
1674
1666
|
);
|
|
1675
1667
|
};
|
|
1676
1668
|
var DEFAULT_BATCH = 500;
|
|
1677
|
-
var cache_put = (stream, entry) =>
|
|
1678
|
-
(err) =>
|
|
1669
|
+
var cache_put = (stream, entry) => _chunkC67XTW3Wcjs.cache.call(void 0, ).set(stream, entry).catch(
|
|
1670
|
+
(err) => _chunkC67XTW3Wcjs.log.call(void 0, ).warn(
|
|
1679
1671
|
err,
|
|
1680
1672
|
"cache set skipped; the next load re-folds from the store"
|
|
1681
1673
|
)
|
|
1682
1674
|
);
|
|
1683
|
-
var cache_drop = (stream) =>
|
|
1684
|
-
(err) =>
|
|
1675
|
+
var cache_drop = (stream) => _chunkC67XTW3Wcjs.cache.call(void 0, ).invalidate(stream).catch(
|
|
1676
|
+
(err) => _chunkC67XTW3Wcjs.log.call(void 0, ).warn(
|
|
1685
1677
|
err,
|
|
1686
1678
|
"cache invalidate skipped; a stale checkpoint re-folds from its event_id"
|
|
1687
1679
|
)
|
|
@@ -1689,9 +1681,9 @@ var cache_drop = (stream) => _chunkF2YAA4SEcjs.cache.call(void 0, ).invalidate(s
|
|
|
1689
1681
|
async function snap(snapshot) {
|
|
1690
1682
|
const { id, stream, name, meta, version } = snapshot.event;
|
|
1691
1683
|
try {
|
|
1692
|
-
const [committed] = await
|
|
1684
|
+
const [committed] = await _chunkC67XTW3Wcjs.store.call(void 0, ).commit(
|
|
1693
1685
|
stream,
|
|
1694
|
-
[{ name:
|
|
1686
|
+
[{ name: _chunkNXURHBSBcjs.SNAP_EVENT, data: snapshot.state }],
|
|
1695
1687
|
{
|
|
1696
1688
|
correlation: meta.correlation,
|
|
1697
1689
|
causation: { event: { id, name, stream } }
|
|
@@ -1702,22 +1694,22 @@ async function snap(snapshot) {
|
|
|
1702
1694
|
return committed;
|
|
1703
1695
|
} catch (error) {
|
|
1704
1696
|
const reason = error instanceof Error ? error.message : String(error);
|
|
1705
|
-
|
|
1697
|
+
_chunkC67XTW3Wcjs.log.call(void 0, ).warn(
|
|
1706
1698
|
`Snapshot write failed on stream "${stream}": ${reason} \u2014 cold starts will replay full history until snapshots succeed.`
|
|
1707
1699
|
);
|
|
1708
1700
|
}
|
|
1709
1701
|
}
|
|
1710
1702
|
async function tombstone(stream, expectedVersion, correlation) {
|
|
1711
1703
|
try {
|
|
1712
|
-
const [committed] = await
|
|
1704
|
+
const [committed] = await _chunkC67XTW3Wcjs.store.call(void 0, ).commit(
|
|
1713
1705
|
stream,
|
|
1714
|
-
[{ name:
|
|
1706
|
+
[{ name: _chunkNXURHBSBcjs.TOMBSTONE_EVENT, data: {} }],
|
|
1715
1707
|
{ correlation, causation: {} },
|
|
1716
1708
|
expectedVersion
|
|
1717
1709
|
);
|
|
1718
1710
|
return committed;
|
|
1719
1711
|
} catch (error) {
|
|
1720
|
-
if (error instanceof
|
|
1712
|
+
if (error instanceof _chunkNXURHBSBcjs.ConcurrencyError) return void 0;
|
|
1721
1713
|
throw error;
|
|
1722
1714
|
}
|
|
1723
1715
|
}
|
|
@@ -1747,9 +1739,9 @@ async function scan(source, opts = {}, callback) {
|
|
|
1747
1739
|
if (drop_closed_streams) {
|
|
1748
1740
|
await source.query(
|
|
1749
1741
|
(e) => {
|
|
1750
|
-
if (e.name ===
|
|
1742
|
+
if (e.name === _chunkNXURHBSBcjs.TOMBSTONE_EVENT) closed_streams.add(e.stream);
|
|
1751
1743
|
},
|
|
1752
|
-
{ names: [
|
|
1744
|
+
{ names: [_chunkNXURHBSBcjs.TOMBSTONE_EVENT] }
|
|
1753
1745
|
);
|
|
1754
1746
|
}
|
|
1755
1747
|
let max_id;
|
|
@@ -1771,11 +1763,11 @@ async function scan(source, opts = {}, callback) {
|
|
|
1771
1763
|
if (!is_valid(event))
|
|
1772
1764
|
throw new Error(`Invalid event at index ${processed}`);
|
|
1773
1765
|
if (on_progress) on_progress({ processed, id: event.id, max_id });
|
|
1774
|
-
if (drop_snapshots && event.name ===
|
|
1766
|
+
if (drop_snapshots && event.name === _chunkNXURHBSBcjs.SNAP_EVENT) {
|
|
1775
1767
|
dropped_snaps++;
|
|
1776
1768
|
return;
|
|
1777
1769
|
}
|
|
1778
|
-
if (closed_streams.has(event.stream) && event.name !==
|
|
1770
|
+
if (closed_streams.has(event.stream) && event.name !== _chunkNXURHBSBcjs.TOMBSTONE_EVENT) {
|
|
1779
1771
|
dropped_closed++;
|
|
1780
1772
|
return;
|
|
1781
1773
|
}
|
|
@@ -1842,17 +1834,17 @@ async function scan(source, opts = {}, callback) {
|
|
|
1842
1834
|
async function load(me, target, callback, patch_fn = bare_patch) {
|
|
1843
1835
|
const { stream, actor, asOf } = target;
|
|
1844
1836
|
const time_travel = !!asOf && Object.values(asOf).some((v) => v !== void 0);
|
|
1845
|
-
const cached = time_travel ? void 0 : await
|
|
1837
|
+
const cached = time_travel ? void 0 : await _chunkC67XTW3Wcjs.cache.call(void 0, ).get(stream);
|
|
1846
1838
|
const cache_hit = !!cached;
|
|
1847
1839
|
let state2 = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _73 => _73.state]), () => ( (me.init ? me.init() : {})));
|
|
1848
1840
|
let patches = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _74 => _74.patches]), () => ( 0));
|
|
1849
1841
|
let snaps = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _75 => _75.snaps]), () => ( 0));
|
|
1850
1842
|
let replayed = 0;
|
|
1851
1843
|
let event;
|
|
1852
|
-
await
|
|
1844
|
+
await _chunkC67XTW3Wcjs.store.call(void 0, ).query(
|
|
1853
1845
|
(raw) => {
|
|
1854
1846
|
event = me.view(raw, actor);
|
|
1855
|
-
if (event.name ===
|
|
1847
|
+
if (event.name === _chunkNXURHBSBcjs.SNAP_EVENT) {
|
|
1856
1848
|
state2 = event.data;
|
|
1857
1849
|
snaps++;
|
|
1858
1850
|
patches = 0;
|
|
@@ -1861,8 +1853,8 @@ async function load(me, target, callback, patch_fn = bare_patch) {
|
|
|
1861
1853
|
state2 = patch_fn(me, state2, me.patch[event.name](event, state2), event);
|
|
1862
1854
|
patches++;
|
|
1863
1855
|
replayed++;
|
|
1864
|
-
} else if (event.name !==
|
|
1865
|
-
|
|
1856
|
+
} else if (event.name !== _chunkNXURHBSBcjs.TOMBSTONE_EVENT) {
|
|
1857
|
+
_chunkC67XTW3Wcjs.log.call(void 0, ).warn(
|
|
1866
1858
|
`Skipping unknown event "${String(event.name)}" on stream "${stream}" (id=${event.id}) \u2014 no reducer in state "${me.name}"`
|
|
1867
1859
|
);
|
|
1868
1860
|
}
|
|
@@ -1886,7 +1878,7 @@ async function load(me, target, callback, patch_fn = bare_patch) {
|
|
|
1886
1878
|
...cached ? { after: cached.event_id, with_snaps: true } : { ...time_travel ? {} : { with_snaps: true }, ...asOf }
|
|
1887
1879
|
}
|
|
1888
1880
|
);
|
|
1889
|
-
const head_is_tombstone = _optionalChain([event, 'optionalAccess', _77 => _77.name]) ===
|
|
1881
|
+
const head_is_tombstone = _optionalChain([event, 'optionalAccess', _77 => _77.name]) === _chunkNXURHBSBcjs.TOMBSTONE_EVENT;
|
|
1890
1882
|
if (replayed > 0 && !time_travel && event && !me.pii_aware && !head_is_tombstone) {
|
|
1891
1883
|
await cache_put(stream, {
|
|
1892
1884
|
stream,
|
|
@@ -1914,7 +1906,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1914
1906
|
if (!stream) throw new Error("Missing target stream");
|
|
1915
1907
|
const reactingTo = _optionalChain([options, 'optionalAccess', _82 => _82.reactingTo]);
|
|
1916
1908
|
const correlator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _83 => _83.correlator]), () => ( default_correlator));
|
|
1917
|
-
const validated =
|
|
1909
|
+
const validated = _chunkC67XTW3Wcjs.validate.call(void 0, action2, payload, me.actions[action2]);
|
|
1918
1910
|
const opts = _optionalChain([me, 'access', _84 => _84.options, 'optionalAccess', _85 => _85[action2]]);
|
|
1919
1911
|
const max_retries = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _86 => _86.maxRetries]), () => ( 0));
|
|
1920
1912
|
for (let attempt = 0; ; attempt++) {
|
|
@@ -1925,12 +1917,12 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1925
1917
|
void 0,
|
|
1926
1918
|
patch_fn
|
|
1927
1919
|
);
|
|
1928
|
-
if (_optionalChain([snapshot, 'access', _87 => _87.event, 'optionalAccess', _88 => _88.name]) ===
|
|
1929
|
-
throw new (0,
|
|
1920
|
+
if (_optionalChain([snapshot, 'access', _87 => _87.event, 'optionalAccess', _88 => _88.name]) === _chunkNXURHBSBcjs.TOMBSTONE_EVENT)
|
|
1921
|
+
throw new (0, _chunkNXURHBSBcjs.StreamClosedError)(stream);
|
|
1930
1922
|
const expected = _nullishCoalesce(expectedVersion, () => ( snapshot.version));
|
|
1931
1923
|
for (const { valid, description } of _nullishCoalesce(_optionalChain([me, 'access', _89 => _89.given, 'optionalAccess', _90 => _90[action2]]), () => ( [])))
|
|
1932
1924
|
if (!valid(snapshot.state, actor))
|
|
1933
|
-
throw new (0,
|
|
1925
|
+
throw new (0, _chunkNXURHBSBcjs.InvariantError)(
|
|
1934
1926
|
action2,
|
|
1935
1927
|
validated,
|
|
1936
1928
|
target,
|
|
@@ -1939,7 +1931,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1939
1931
|
);
|
|
1940
1932
|
for (const { holds, description } of _nullishCoalesce(_optionalChain([me, 'access', _91 => _91.requires, 'optionalAccess', _92 => _92[action2]]), () => ( [])))
|
|
1941
1933
|
if (!holds(validated, snapshot.state, actor))
|
|
1942
|
-
throw new (0,
|
|
1934
|
+
throw new (0, _chunkNXURHBSBcjs.PreconditionError)(
|
|
1943
1935
|
action2,
|
|
1944
1936
|
validated,
|
|
1945
1937
|
target,
|
|
@@ -1952,7 +1944,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1952
1944
|
const tuples = Array.isArray(result[0]) ? result : [result];
|
|
1953
1945
|
const events = tuples.map(([name, data]) => ({
|
|
1954
1946
|
name,
|
|
1955
|
-
data:
|
|
1947
|
+
data: _chunkC67XTW3Wcjs.validate.call(void 0, name, data, me.events[name])
|
|
1956
1948
|
}));
|
|
1957
1949
|
const emitted = events.map((e) => me.message(e));
|
|
1958
1950
|
const meta = {
|
|
@@ -1999,9 +1991,9 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1999
1991
|
);
|
|
2000
1992
|
let committed;
|
|
2001
1993
|
try {
|
|
2002
|
-
committed = await
|
|
1994
|
+
committed = await _chunkC67XTW3Wcjs.store.call(void 0, ).commit(stream, emitted, meta, expected);
|
|
2003
1995
|
} catch (error) {
|
|
2004
|
-
if (error instanceof
|
|
1996
|
+
if (error instanceof _chunkNXURHBSBcjs.ConcurrencyError) void cache_drop(stream);
|
|
2005
1997
|
throw error;
|
|
2006
1998
|
}
|
|
2007
1999
|
const snapshots = committed.map((row, i) => ({
|
|
@@ -2028,19 +2020,19 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
2028
2020
|
});
|
|
2029
2021
|
return snapshots;
|
|
2030
2022
|
} catch (error) {
|
|
2031
|
-
if (!(error instanceof
|
|
2023
|
+
if (!(error instanceof _chunkNXURHBSBcjs.ConcurrencyError)) throw error;
|
|
2032
2024
|
if (expectedVersion !== void 0) throw error;
|
|
2033
2025
|
if (attempt >= max_retries) throw error;
|
|
2034
2026
|
if (_optionalChain([opts, 'optionalAccess', _99 => _99.backoff])) {
|
|
2035
2027
|
const delay_ms = compute_backoff_delay(attempt, opts.backoff);
|
|
2036
|
-
if (delay_ms > 0) await
|
|
2028
|
+
if (delay_ms > 0) await _chunkC67XTW3Wcjs.sleep.call(void 0, delay_ms);
|
|
2037
2029
|
}
|
|
2038
2030
|
}
|
|
2039
2031
|
}
|
|
2040
2032
|
}
|
|
2041
2033
|
|
|
2042
2034
|
// src/internal/tracing.ts
|
|
2043
|
-
var PRETTY =
|
|
2035
|
+
var PRETTY = _chunkC67XTW3Wcjs.config.call(void 0, ).env !== "production";
|
|
2044
2036
|
var C_BLUE = "\x1B[38;5;39m";
|
|
2045
2037
|
var C_ORANGE = "\x1B[38;5;208m";
|
|
2046
2038
|
var C_GREEN = "\x1B[38;5;42m";
|
|
@@ -2224,7 +2216,7 @@ function budget_exhausted(lease, options, store_failing) {
|
|
|
2224
2216
|
if (store_failing || !_optionalChain([options, 'optionalAccess', _110 => _110.blockOnError]) || lease.retry <= options.maxRetries)
|
|
2225
2217
|
return void 0;
|
|
2226
2218
|
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.`;
|
|
2227
|
-
|
|
2219
|
+
_chunkC67XTW3Wcjs.log.call(void 0, ).error(error);
|
|
2228
2220
|
return { lease, handled: 0, acked_at: lease.at, error, block: true };
|
|
2229
2221
|
}
|
|
2230
2222
|
function fetch_failure_policy(registry) {
|
|
@@ -2240,13 +2232,13 @@ function fetch_failure_policy(registry) {
|
|
|
2240
2232
|
function finalize(lease, handled, at, error, options, logger, failed_at) {
|
|
2241
2233
|
if (!error) return { lease, handled, acked_at: at };
|
|
2242
2234
|
logger.error(error);
|
|
2243
|
-
const non_retryable = error instanceof
|
|
2235
|
+
const non_retryable = error instanceof _chunkNXURHBSBcjs.NonRetryableError;
|
|
2244
2236
|
const block2 = options.blockOnError && (non_retryable || lease.retry >= options.maxRetries);
|
|
2245
2237
|
if (block2)
|
|
2246
2238
|
logger.error(
|
|
2247
2239
|
non_retryable ? `Blocking ${lease.stream} on non-retryable error.` : `Blocking ${lease.stream} after ${lease.retry} retries.`
|
|
2248
2240
|
);
|
|
2249
|
-
const next_attempt_at = block2 ? void 0 : Date.now() + compute_backoff_delay(lease.retry, _nullishCoalesce(options.backoff, () => (
|
|
2241
|
+
const next_attempt_at = block2 ? void 0 : Date.now() + compute_backoff_delay(lease.retry, _nullishCoalesce(options.backoff, () => ( _chunkC67XTW3Wcjs.DEFAULT_BACKOFF)));
|
|
2250
2242
|
return {
|
|
2251
2243
|
lease,
|
|
2252
2244
|
handled,
|
|
@@ -2374,7 +2366,7 @@ async function run_drain_cycle(deps, cycle) {
|
|
|
2374
2366
|
const acked = submitted.length ? await ops.ack(submitted) : [];
|
|
2375
2367
|
const expected = submitted.filter((l) => l.due === void 0).length;
|
|
2376
2368
|
if (acked.length < expected)
|
|
2377
|
-
|
|
2369
|
+
_chunkC67XTW3Wcjs.log.call(void 0, ).warn(
|
|
2378
2370
|
`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.`
|
|
2379
2371
|
);
|
|
2380
2372
|
const closeable = handled.filter((h) => h.close !== void 0).map((h) => h.close);
|
|
@@ -2396,21 +2388,17 @@ function merge_drains(drains) {
|
|
|
2396
2388
|
}
|
|
2397
2389
|
var RETRY = "";
|
|
2398
2390
|
var DrainController = (_class5 = class {
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
* during it.
|
|
2403
|
-
*/
|
|
2391
|
+
// Armed while `_raised` is ahead of `_lowered` (the raise count the last
|
|
2392
|
+
// empty claim saw), so a claim never lowers over a raise that landed
|
|
2393
|
+
// during it.
|
|
2404
2394
|
__init15() {this._raised = 0}
|
|
2405
2395
|
__init16() {this._lowered = 0}
|
|
2406
2396
|
__init17() {this._ratio = 0.5}
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
* stays until handled or until a later pass claims nothing.
|
|
2413
|
-
*/
|
|
2397
|
+
// Local wake at the earliest parked (backoff or defer) visit, or at the
|
|
2398
|
+
// lease expiry after a failed pass (the {@link RETRY} key); the schedule
|
|
2399
|
+
// itself is persisted. On an idle app nothing else would drain it. It
|
|
2400
|
+
// drains until a pass leases nothing or the controller stops, and an entry
|
|
2401
|
+
// stays until handled or until a later pass claims nothing.
|
|
2414
2402
|
__init18() {this._defer = new DeferTimer(() => {
|
|
2415
2403
|
this.arm();
|
|
2416
2404
|
void this._deps.run_scoped(async () => {
|
|
@@ -2420,7 +2408,7 @@ var DrainController = (_class5 = class {
|
|
|
2420
2408
|
|
|
2421
2409
|
__init19() {this._misrouted = /* @__PURE__ */ new Set()}
|
|
2422
2410
|
__init20() {this._stopped = false}
|
|
2423
|
-
|
|
2411
|
+
// The pass in flight. Never rejects; graceful shutdown waits on it.
|
|
2424
2412
|
|
|
2425
2413
|
|
|
2426
2414
|
constructor(deps) {;_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);
|
|
@@ -2474,9 +2462,9 @@ var DrainController = (_class5 = class {
|
|
|
2474
2462
|
if (!this.armed || this._stopped || this._inflight)
|
|
2475
2463
|
return EMPTY_DRAIN;
|
|
2476
2464
|
const d = _nullishCoalesce(this._deps.defaults, () => ( {}));
|
|
2477
|
-
const streamLimit = _nullishCoalesce(_nullishCoalesce(d.streamLimit, () => ( options.streamLimit)), () => (
|
|
2478
|
-
const eventLimit = _nullishCoalesce(options.eventLimit, () => (
|
|
2479
|
-
const leaseMillis = _nullishCoalesce(_nullishCoalesce(d.leaseMillis, () => ( options.leaseMillis)), () => (
|
|
2465
|
+
const streamLimit = _nullishCoalesce(_nullishCoalesce(d.streamLimit, () => ( options.streamLimit)), () => ( _chunkC67XTW3Wcjs.DEFAULT_STREAM_LIMIT));
|
|
2466
|
+
const eventLimit = _nullishCoalesce(options.eventLimit, () => ( _chunkC67XTW3Wcjs.DEFAULT_EVENT_LIMIT));
|
|
2467
|
+
const leaseMillis = _nullishCoalesce(_nullishCoalesce(d.leaseMillis, () => ( options.leaseMillis)), () => ( _chunkC67XTW3Wcjs.DEFAULT_LEASE_MILLIS));
|
|
2480
2468
|
if (this._deps.breaker.state(Date.now()) === "open")
|
|
2481
2469
|
return EMPTY_DRAIN;
|
|
2482
2470
|
const pass = this._pass(streamLimit, eventLimit, leaseMillis).finally(
|
|
@@ -2487,7 +2475,7 @@ var DrainController = (_class5 = class {
|
|
|
2487
2475
|
this._inflight = pass;
|
|
2488
2476
|
return pass;
|
|
2489
2477
|
}
|
|
2490
|
-
|
|
2478
|
+
// One claim → fetch → handle → ack pass. Never throws.
|
|
2491
2479
|
async _pass(streamLimit, eventLimit, leaseMillis) {
|
|
2492
2480
|
try {
|
|
2493
2481
|
const lagging = Math.ceil(streamLimit * this._ratio);
|
|
@@ -2551,7 +2539,7 @@ function pii_gate(event, fields, predicate, actor) {
|
|
|
2551
2539
|
const { pii, ...rest } = event;
|
|
2552
2540
|
if (pii == null) {
|
|
2553
2541
|
const shredded = { ...data };
|
|
2554
|
-
for (const f of fields) shredded[f] =
|
|
2542
|
+
for (const f of fields) shredded[f] = _chunkNXURHBSBcjs.SHREDDED;
|
|
2555
2543
|
return { ...rest, data: shredded };
|
|
2556
2544
|
}
|
|
2557
2545
|
const allowed = !!actor && !!predicate && predicate(event, actor);
|
|
@@ -2562,7 +2550,7 @@ function pii_gate(event, fields, predicate, actor) {
|
|
|
2562
2550
|
};
|
|
2563
2551
|
}
|
|
2564
2552
|
const redacted = { ...data };
|
|
2565
|
-
for (const f of fields) redacted[f] =
|
|
2553
|
+
for (const f of fields) redacted[f] = _chunkNXURHBSBcjs.REDACTED;
|
|
2566
2554
|
return { ...rest, data: redacted };
|
|
2567
2555
|
}
|
|
2568
2556
|
var IDENTITY_GATE = (event) => event;
|
|
@@ -2699,7 +2687,7 @@ function make_deferred(handler, schedule) {
|
|
|
2699
2687
|
const call = handler;
|
|
2700
2688
|
const deferred = async (event, stream, app) => {
|
|
2701
2689
|
const when = typeof schedule === "function" ? schedule(event) : schedule;
|
|
2702
|
-
if (Date.now() < resolve_defer_at(when, event)) throw new (0,
|
|
2690
|
+
if (Date.now() < resolve_defer_at(when, event)) throw new (0, _chunkNXURHBSBcjs.DeferSignal)(when);
|
|
2703
2691
|
return call(event, stream, app);
|
|
2704
2692
|
};
|
|
2705
2693
|
Object.defineProperty(deferred, "name", { value: handler.name });
|
|
@@ -2768,7 +2756,7 @@ function build_handle(deps) {
|
|
|
2768
2756
|
handled++;
|
|
2769
2757
|
}
|
|
2770
2758
|
} catch (error) {
|
|
2771
|
-
if (error instanceof
|
|
2759
|
+
if (error instanceof _chunkNXURHBSBcjs.DeferSignal) {
|
|
2772
2760
|
let defer;
|
|
2773
2761
|
try {
|
|
2774
2762
|
defer = resolve_defer_at(error.when, event);
|
|
@@ -2848,21 +2836,19 @@ function build_handle_batch(logger) {
|
|
|
2848
2836
|
// src/internal/settle.ts
|
|
2849
2837
|
var SettleLoop = (_class6 = class {
|
|
2850
2838
|
__init21() {this._timer = void 0}
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
* (`stop()` cancels scheduling only). Never rejects.
|
|
2854
|
-
*/
|
|
2839
|
+
// The cycle in flight, set while one runs. Shutdown waits for it
|
|
2840
|
+
// (`stop()` cancels scheduling only). Never rejects.
|
|
2855
2841
|
|
|
2856
|
-
|
|
2842
|
+
// A wake-up arrived while a cycle ran: run one more pass after it.
|
|
2857
2843
|
__init22() {this._pending = false}
|
|
2858
|
-
|
|
2844
|
+
// The last caller's options, used by the next pass.
|
|
2859
2845
|
__init23() {this._next = void 0}
|
|
2860
|
-
|
|
2846
|
+
// When the scheduled pass fires (epoch ms).
|
|
2861
2847
|
__init24() {this._due = 0}
|
|
2862
|
-
|
|
2848
|
+
// Set at shutdown: nothing schedules again.
|
|
2863
2849
|
__init25() {this._stopped = false}
|
|
2864
2850
|
|
|
2865
|
-
|
|
2851
|
+
// Debounce window applied when the caller doesn't override via `SettleOptions.debounceMs`.
|
|
2866
2852
|
|
|
2867
2853
|
constructor(deps, default_debounce_ms) {;_class6.prototype.__init21.call(this);_class6.prototype.__init22.call(this);_class6.prototype.__init23.call(this);_class6.prototype.__init24.call(this);_class6.prototype.__init25.call(this);
|
|
2868
2854
|
this._deps = deps;
|
|
@@ -2960,18 +2946,16 @@ var Act = (_class7 = class {
|
|
|
2960
2946
|
|
|
2961
2947
|
|
|
2962
2948
|
|
|
2963
|
-
|
|
2949
|
+
// Whether any event has a reaction; nothing arms without one.
|
|
2964
2950
|
|
|
2965
2951
|
|
|
2966
2952
|
|
|
2967
2953
|
|
|
2968
2954
|
|
|
2969
|
-
|
|
2955
|
+
// The poll's correlate `limit`, used by every settle pass while it runs.
|
|
2970
2956
|
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
* injected after `build()` is never notified.
|
|
2974
|
-
*/
|
|
2957
|
+
// Wired at construction against the store current then, so a store
|
|
2958
|
+
// injected after `build()` is never notified.
|
|
2975
2959
|
|
|
2976
2960
|
/** Public registry — kept as-is per the no-prefix-on-public convention. */
|
|
2977
2961
|
|
|
@@ -2989,58 +2973,70 @@ var Act = (_class7 = class {
|
|
|
2989
2973
|
* returns "had listeners" to preserve the `EventEmitter.emit` contract.
|
|
2990
2974
|
*/
|
|
2991
2975
|
emit(event, args) {
|
|
2992
|
-
|
|
2976
|
+
return this._notify(event, args);
|
|
2977
|
+
}
|
|
2978
|
+
// Run each listener of `key` on its own, logging any that throws.
|
|
2979
|
+
_notify(key, args) {
|
|
2980
|
+
const listeners = this._emitter.rawListeners(key);
|
|
2993
2981
|
for (const listener of listeners) {
|
|
2994
2982
|
try {
|
|
2995
2983
|
listener(args);
|
|
2996
2984
|
} catch (error) {
|
|
2997
|
-
this._logger.error(error, `${
|
|
2985
|
+
this._logger.error(error, `${key} listener threw`);
|
|
2998
2986
|
}
|
|
2999
2987
|
}
|
|
3000
2988
|
return listeners.length > 0;
|
|
3001
2989
|
}
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
2990
|
+
// The emitter key of one state's `committed` listeners.
|
|
2991
|
+
_committed_key(state2) {
|
|
2992
|
+
const name = typeof state2 === "string" ? state2 : state2.name;
|
|
2993
|
+
if (!this._states.has(name))
|
|
2994
|
+
throw new Error(`committed: "${name}" is not a state of this app`);
|
|
2995
|
+
return `committed:${name}`;
|
|
2996
|
+
}
|
|
2997
|
+
// The one place a store failure is logged and emitted (the breaker's
|
|
2998
|
+
// `on_error`). The emit is guarded: an unhandled `"error"` emission
|
|
2999
|
+
// would crash the process.
|
|
3007
3000
|
_emit_error(error, circuit) {
|
|
3008
3001
|
this._logger.error(error);
|
|
3009
3002
|
if (this._emitter.listenerCount("error") > 0)
|
|
3010
3003
|
this.emit("error", { error, circuit });
|
|
3011
3004
|
}
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3005
|
+
on(event, state_or_listener, listener) {
|
|
3006
|
+
if (listener)
|
|
3007
|
+
this._emitter.on(
|
|
3008
|
+
this._committed_key(state_or_listener),
|
|
3009
|
+
listener
|
|
3010
|
+
);
|
|
3011
|
+
else this._emitter.on(event, state_or_listener);
|
|
3018
3012
|
return this;
|
|
3019
3013
|
}
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3014
|
+
off(event, state_or_listener, listener) {
|
|
3015
|
+
if (listener)
|
|
3016
|
+
this._emitter.off(
|
|
3017
|
+
this._committed_key(state_or_listener),
|
|
3018
|
+
listener
|
|
3019
|
+
);
|
|
3020
|
+
else this._emitter.off(event, state_or_listener);
|
|
3025
3021
|
return this;
|
|
3026
3022
|
}
|
|
3027
3023
|
|
|
3028
3024
|
|
|
3029
3025
|
|
|
3030
|
-
|
|
3026
|
+
// Unambiguous: merge rejects an event name declared by two states.
|
|
3031
3027
|
|
|
3032
|
-
|
|
3028
|
+
// Lanes to arm per event; `"all"` when a dynamic resolver hides the lane.
|
|
3033
3029
|
|
|
3034
3030
|
|
|
3035
|
-
__init27() {this._logger =
|
|
3036
|
-
|
|
3031
|
+
__init27() {this._logger = _chunkC67XTW3Wcjs.log.call(void 0, )}
|
|
3032
|
+
// This Act's ports: its own bag, or the singleton adapters.
|
|
3037
3033
|
|
|
3038
|
-
|
|
3034
|
+
// Runs a body so internal `store()`/`cache()` calls resolve to `_ports`.
|
|
3039
3035
|
|
|
3040
3036
|
|
|
3041
3037
|
|
|
3042
3038
|
__init28() {this._close_lock = new CloseLock()}
|
|
3043
|
-
|
|
3039
|
+
// Every lane a controller can exist for: `"default"` plus each declared one.
|
|
3044
3040
|
|
|
3045
3041
|
/** Drain lanes declared via `.withLane(...)`. Implicit default not included. */
|
|
3046
3042
|
get lanes() {
|
|
@@ -3054,9 +3050,9 @@ var Act = (_class7 = class {
|
|
|
3054
3050
|
this._lanes = lanes;
|
|
3055
3051
|
this._declared_lanes = ["default", ...lanes.map((l) => l.name)];
|
|
3056
3052
|
validate_only_lanes(options.onlyLanes, this._declared_lanes);
|
|
3057
|
-
this._ports = _nullishCoalesce(options.scoped, () => (
|
|
3053
|
+
this._ports = _nullishCoalesce(options.scoped, () => ( _chunkC67XTW3Wcjs.default_scope.call(void 0, )));
|
|
3058
3054
|
const ports = this._ports;
|
|
3059
|
-
this._scoped =
|
|
3055
|
+
this._scoped = _chunkC67XTW3Wcjs.make_run_scoped.call(void 0, {
|
|
3060
3056
|
// Getters, not a spread: the singletons resolve lazily, so a later
|
|
3061
3057
|
// `store(...)` / `cache(...)` still takes effect.
|
|
3062
3058
|
get store() {
|
|
@@ -3066,14 +3062,14 @@ var Act = (_class7 = class {
|
|
|
3066
3062
|
return ports.cache;
|
|
3067
3063
|
},
|
|
3068
3064
|
// Parsed per build, so a bad window throws on every build.
|
|
3069
|
-
autoclose_window:
|
|
3065
|
+
autoclose_window: _chunkC67XTW3Wcjs.resolveAutocloseConfig.call(void 0, options).autocloseWindow
|
|
3070
3066
|
});
|
|
3071
3067
|
this._correlator = _nullishCoalesce(options.correlator, () => ( default_correlator));
|
|
3072
3068
|
this._es = build_es(this._logger, this._correlator, patch_fn);
|
|
3073
3069
|
this._cd = build_drain(this._logger);
|
|
3074
3070
|
const handle = build_handle({
|
|
3075
3071
|
logger: this._logger,
|
|
3076
|
-
reaction_scope:
|
|
3072
|
+
reaction_scope: _chunkC67XTW3Wcjs.make_reaction_scope.call(void 0, {
|
|
3077
3073
|
do: this.do.bind(this),
|
|
3078
3074
|
load: this.load.bind(this),
|
|
3079
3075
|
query: this.query.bind(this),
|
|
@@ -3103,12 +3099,12 @@ var Act = (_class7 = class {
|
|
|
3103
3099
|
this._ports.store,
|
|
3104
3100
|
options.listen !== false
|
|
3105
3101
|
);
|
|
3106
|
-
|
|
3102
|
+
_chunkC67XTW3Wcjs.register_weak_disposer.call(void 0, new WeakRef(this), (self) => self.shutdown());
|
|
3107
3103
|
}
|
|
3108
|
-
|
|
3104
|
+
// Shared by drain, settle and autoclose; bad knobs throw at build.
|
|
3109
3105
|
_build_breaker(options) {
|
|
3110
3106
|
return new CircuitBreaker(
|
|
3111
|
-
|
|
3107
|
+
_chunkC67XTW3Wcjs.resolveCircuitBreakerConfig.call(void 0, options.circuitBreaker),
|
|
3112
3108
|
{
|
|
3113
3109
|
on_error: (error, circuit) => this._emit_error(error, circuit),
|
|
3114
3110
|
// When the cooldown elapses, settle once: its scan or claim is the
|
|
@@ -3117,7 +3113,7 @@ var Act = (_class7 = class {
|
|
|
3117
3113
|
}
|
|
3118
3114
|
);
|
|
3119
3115
|
}
|
|
3120
|
-
|
|
3116
|
+
// Apps that declare no lanes pass no lane filter to `claim`.
|
|
3121
3117
|
_build_drain_controllers(options, lanes, handle, handle_batch) {
|
|
3122
3118
|
const all_lanes = this._declared_lanes;
|
|
3123
3119
|
const only_set = _optionalChain([options, 'access', _129 => _129.onlyLanes, 'optionalAccess', _130 => _130.length]) ? new Set(options.onlyLanes) : void 0;
|
|
@@ -3142,7 +3138,7 @@ var Act = (_class7 = class {
|
|
|
3142
3138
|
try {
|
|
3143
3139
|
await this._run_close(targets);
|
|
3144
3140
|
} catch (error) {
|
|
3145
|
-
if (error instanceof
|
|
3141
|
+
if (error instanceof _chunkNXURHBSBcjs.StoreError) throw error;
|
|
3146
3142
|
this._logger.error(
|
|
3147
3143
|
error,
|
|
3148
3144
|
`Reaction-requested close of ${targets.map((t) => `"${t.stream}"`).join(", ")} failed and was not retried; close it with app.close(...) once the cause is fixed.`
|
|
@@ -3163,7 +3159,7 @@ var Act = (_class7 = class {
|
|
|
3163
3159
|
}
|
|
3164
3160
|
return controllers;
|
|
3165
3161
|
}
|
|
3166
|
-
|
|
3162
|
+
// One process can't see the cluster, so it reports its own lane gaps.
|
|
3167
3163
|
_advise_orphaned_lanes() {
|
|
3168
3164
|
const active = new Set(this._drain_controllers.keys());
|
|
3169
3165
|
const orphaned = this._declared_lanes.filter((name) => !active.has(name));
|
|
@@ -3173,10 +3169,10 @@ var Act = (_class7 = class {
|
|
|
3173
3169
|
`Act declared ${orphaned.length} orphaned lane(s) on this instance: ${list}. onlyLanes excludes them, so no DrainController claims their streams here \u2014 their reactions accumulate un-drained unless a peer worker deploys with these lanes in its onlyLanes. Ensure the cluster invariant holds: the union of every worker's onlyLanes must cover every declared lane. See docs/docs/guides/production-checklist.md \xA7 Sizing lanes.`
|
|
3174
3170
|
);
|
|
3175
3171
|
}
|
|
3176
|
-
|
|
3172
|
+
// Audit deps, built after the controllers so the lane set is final.
|
|
3177
3173
|
_build_audit_deps() {
|
|
3178
3174
|
return {
|
|
3179
|
-
store:
|
|
3175
|
+
store: _chunkC67XTW3Wcjs.store,
|
|
3180
3176
|
event_to_state: this._event_to_state,
|
|
3181
3177
|
// Declared lanes, not this process's controllers: a lane another
|
|
3182
3178
|
// worker drains is not `unknown-lane`.
|
|
@@ -3189,7 +3185,7 @@ var Act = (_class7 = class {
|
|
|
3189
3185
|
registry: this.registry,
|
|
3190
3186
|
static_targets: classification.static_targets,
|
|
3191
3187
|
cd: this._cd,
|
|
3192
|
-
max_subscribed_streams: _nullishCoalesce(options.maxSubscribedStreams, () => (
|
|
3188
|
+
max_subscribed_streams: _nullishCoalesce(options.maxSubscribedStreams, () => ( _chunkNXURHBSBcjs.DEFAULT_MAX_SUBSCRIBED_STREAMS)),
|
|
3193
3189
|
// Declared lanes (not active ones): a lane another process claims is
|
|
3194
3190
|
// still a valid destination.
|
|
3195
3191
|
declared_lanes: new Set(this._declared_lanes),
|
|
@@ -3202,10 +3198,10 @@ var Act = (_class7 = class {
|
|
|
3202
3198
|
}
|
|
3203
3199
|
});
|
|
3204
3200
|
}
|
|
3205
|
-
|
|
3201
|
+
// Cold start: an idle deferred stream still fires on time after a restart.
|
|
3206
3202
|
async _seed_persisted_defers() {
|
|
3207
3203
|
const now = Date.now();
|
|
3208
|
-
await walk_streams(
|
|
3204
|
+
await walk_streams(_chunkC67XTW3Wcjs.store.call(void 0, ), (pos) => {
|
|
3209
3205
|
if (pos.deferred_at === void 0 || pos.deferred_at <= now) return;
|
|
3210
3206
|
const controller = this._drain_controllers.get(_nullishCoalesce(pos.lane, () => ( "default")));
|
|
3211
3207
|
_optionalChain([controller, 'optionalAccess', _132 => _132.seed_defer, 'call', _133 => _133(pos.stream, pos.deferred_at)]);
|
|
@@ -3221,7 +3217,7 @@ var Act = (_class7 = class {
|
|
|
3221
3217
|
on_settled: (drain) => this.emit("settled", drain),
|
|
3222
3218
|
breaker: this._breaker
|
|
3223
3219
|
},
|
|
3224
|
-
_nullishCoalesce(options.settleDebounceMs, () => (
|
|
3220
|
+
_nullishCoalesce(options.settleDebounceMs, () => ( _chunkNXURHBSBcjs.DEFAULT_SETTLE_DEBOUNCE_MS))
|
|
3225
3221
|
);
|
|
3226
3222
|
}
|
|
3227
3223
|
|
|
@@ -3241,7 +3237,7 @@ var Act = (_class7 = class {
|
|
|
3241
3237
|
*/
|
|
3242
3238
|
shutdown(options) {
|
|
3243
3239
|
if (!this._shutdown_promise) {
|
|
3244
|
-
|
|
3240
|
+
_chunkC67XTW3Wcjs.resolveShutdownConfig.call(void 0, options);
|
|
3245
3241
|
this._shutdown_promise = (async () => {
|
|
3246
3242
|
this.stop_correlations();
|
|
3247
3243
|
this._settle.stop(true);
|
|
@@ -3256,15 +3252,13 @@ var Act = (_class7 = class {
|
|
|
3256
3252
|
}
|
|
3257
3253
|
return this._shutdown_promise;
|
|
3258
3254
|
}
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
* default for none or 0, and for a running settle), capped.
|
|
3262
|
-
*/
|
|
3255
|
+
// The largest `leaseMillis` among lanes with a cycle in flight (the
|
|
3256
|
+
// default for none or 0, and for a running settle), capped.
|
|
3263
3257
|
_derive_grace_ms(running, settling) {
|
|
3264
|
-
let max = settling ?
|
|
3258
|
+
let max = settling ? _chunkC67XTW3Wcjs.DEFAULT_LEASE_MILLIS : 0;
|
|
3265
3259
|
for (const c of running)
|
|
3266
|
-
max = Math.max(max, c.lease_millis ||
|
|
3267
|
-
return Math.min(max,
|
|
3260
|
+
max = Math.max(max, c.lease_millis || _chunkC67XTW3Wcjs.DEFAULT_LEASE_MILLIS);
|
|
3261
|
+
return Math.min(max, _chunkC67XTW3Wcjs.MAX_SHUTDOWN_GRACE_MS);
|
|
3268
3262
|
}
|
|
3269
3263
|
async _await_inflight(grace_ms) {
|
|
3270
3264
|
const running = [...this._drain_controllers.values()].filter(
|
|
@@ -3288,7 +3282,7 @@ var Act = (_class7 = class {
|
|
|
3288
3282
|
clearTimeout(timer);
|
|
3289
3283
|
}
|
|
3290
3284
|
}
|
|
3291
|
-
|
|
3285
|
+
// Failures are logged, never thrown: `notify` is a hint.
|
|
3292
3286
|
async _wire_notify(s, listen) {
|
|
3293
3287
|
if (!this._reactive) return void 0;
|
|
3294
3288
|
if (!s.notify) return void 0;
|
|
@@ -3347,7 +3341,7 @@ var Act = (_class7 = class {
|
|
|
3347
3341
|
* @see {@link ValidationError}, {@link PreconditionError}, {@link ConcurrencyError}
|
|
3348
3342
|
*/
|
|
3349
3343
|
async do(action2, target, payload, options) {
|
|
3350
|
-
const reacting_to = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _135 => _135.reactingTo]), () => (
|
|
3344
|
+
const reacting_to = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _135 => _135.reactingTo]), () => ( _chunkC67XTW3Wcjs.current_reacting.call(void 0, )));
|
|
3351
3345
|
const do_options = reacting_to === _optionalChain([options, 'optionalAccess', _136 => _136.reactingTo]) ? options : { ...options, reactingTo: reacting_to };
|
|
3352
3346
|
return this._scoped(async () => {
|
|
3353
3347
|
const snapshots = await this._es.action(
|
|
@@ -3360,6 +3354,10 @@ var Act = (_class7 = class {
|
|
|
3360
3354
|
if (!snapshots[0].patch) return snapshots;
|
|
3361
3355
|
this._wake(snapshots.map((s) => s.event.name));
|
|
3362
3356
|
this.emit("committed", snapshots);
|
|
3357
|
+
this._notify(
|
|
3358
|
+
`committed:${this.registry.actions[action2].name}`,
|
|
3359
|
+
snapshots
|
|
3360
|
+
);
|
|
3363
3361
|
return snapshots;
|
|
3364
3362
|
});
|
|
3365
3363
|
}
|
|
@@ -3409,7 +3407,7 @@ var Act = (_class7 = class {
|
|
|
3409
3407
|
return this._scoped(async () => {
|
|
3410
3408
|
let first;
|
|
3411
3409
|
let last;
|
|
3412
|
-
const count = await
|
|
3410
|
+
const count = await _chunkC67XTW3Wcjs.store.call(void 0, ).query((e) => {
|
|
3413
3411
|
const gated = this.registry.query_gate(e.name)(e);
|
|
3414
3412
|
if (!first) first = gated;
|
|
3415
3413
|
last = gated;
|
|
@@ -3439,7 +3437,7 @@ var Act = (_class7 = class {
|
|
|
3439
3437
|
async query_array(query) {
|
|
3440
3438
|
return this._scoped(async () => {
|
|
3441
3439
|
const events = [];
|
|
3442
|
-
await
|
|
3440
|
+
await _chunkC67XTW3Wcjs.store.call(void 0, ).query((e) => {
|
|
3443
3441
|
events.push(this.registry.query_gate(e.name)(e));
|
|
3444
3442
|
}, query);
|
|
3445
3443
|
return events;
|
|
@@ -3459,14 +3457,14 @@ var Act = (_class7 = class {
|
|
|
3459
3457
|
*/
|
|
3460
3458
|
async forget(stream) {
|
|
3461
3459
|
return this._scoped(async () => {
|
|
3462
|
-
const s =
|
|
3460
|
+
const s = _chunkC67XTW3Wcjs.store.call(void 0, );
|
|
3463
3461
|
if (!s.forget_pii) {
|
|
3464
3462
|
throw new Error(
|
|
3465
3463
|
`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).`
|
|
3466
3464
|
);
|
|
3467
3465
|
}
|
|
3468
3466
|
const eventCount = await s.forget_pii(stream);
|
|
3469
|
-
await
|
|
3467
|
+
await _chunkC67XTW3Wcjs.cache.call(void 0, ).invalidate(stream);
|
|
3470
3468
|
if (eventCount > 0) {
|
|
3471
3469
|
this.emit("forgotten", { stream, at: /* @__PURE__ */ new Date(), eventCount });
|
|
3472
3470
|
}
|
|
@@ -3500,33 +3498,31 @@ var Act = (_class7 = class {
|
|
|
3500
3498
|
* @see {@link correlate} for dynamic stream discovery
|
|
3501
3499
|
*/
|
|
3502
3500
|
async drain(options = {}) {
|
|
3503
|
-
|
|
3501
|
+
_chunkC67XTW3Wcjs.resolveDrainConfig.call(void 0, options);
|
|
3504
3502
|
if (!this._drain)
|
|
3505
3503
|
return { fetched: [], leased: [], acked: [], blocked: [] };
|
|
3506
3504
|
return this._scoped(() => this._drain_all(options));
|
|
3507
3505
|
}
|
|
3508
|
-
|
|
3506
|
+
// Arms correlate and every lane; false on an app with no reactions.
|
|
3509
3507
|
_arm_all() {
|
|
3510
3508
|
if (!this._reactive) return false;
|
|
3511
3509
|
this._correlate.arm();
|
|
3512
3510
|
for (const c of this._drain_controllers.values()) c.arm();
|
|
3513
3511
|
return true;
|
|
3514
3512
|
}
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
* walks the pipeline itself (`autoSettle: false`).
|
|
3520
|
-
*/
|
|
3513
|
+
// Wakes what a change freed (a commit, a reset, an unblock, a restore,
|
|
3514
|
+
// a notification from another process): arms the lanes these events
|
|
3515
|
+
// react on, or every lane without names, and settles them unless the app
|
|
3516
|
+
// walks the pipeline itself (`autoSettle: false`).
|
|
3521
3517
|
_wake(names) {
|
|
3522
3518
|
const armed = names ? this._arm_for_event_names(names) : this._arm_all();
|
|
3523
3519
|
if (armed && this._auto_settle) this._schedule();
|
|
3524
3520
|
}
|
|
3525
|
-
|
|
3521
|
+
// Schedules a settle pass; writer-only instances (`drain: false`) skip it.
|
|
3526
3522
|
_schedule(options) {
|
|
3527
3523
|
if (this._drain) this._settle.schedule(options);
|
|
3528
3524
|
}
|
|
3529
|
-
|
|
3525
|
+
// Arms only the lanes these events react on; true when any was armed.
|
|
3530
3526
|
_arm_for_event_names(names) {
|
|
3531
3527
|
const to_arm = /* @__PURE__ */ new Set();
|
|
3532
3528
|
for (const name of names) {
|
|
@@ -3543,7 +3539,7 @@ var Act = (_class7 = class {
|
|
|
3543
3539
|
for (const lane of to_arm) _optionalChain([this, 'access', _138 => _138._drain_controllers, 'access', _139 => _139.get, 'call', _140 => _140(lane), 'optionalAccess', _141 => _141.arm, 'call', _142 => _142()]);
|
|
3544
3540
|
return true;
|
|
3545
3541
|
}
|
|
3546
|
-
|
|
3542
|
+
// In parallel, so a slow lane never holds up a fast one.
|
|
3547
3543
|
async _drain_all(options) {
|
|
3548
3544
|
const merged = merge_drains(
|
|
3549
3545
|
await Promise.all(
|
|
@@ -3585,7 +3581,7 @@ var Act = (_class7 = class {
|
|
|
3585
3581
|
last_id: pass.last_id
|
|
3586
3582
|
};
|
|
3587
3583
|
}
|
|
3588
|
-
|
|
3584
|
+
// One correlate pass; arms every lane when it found work.
|
|
3589
3585
|
async _correlate_pass(limit, lease = false) {
|
|
3590
3586
|
if (!this._drain) return { kind: "idle", last_id: -1 };
|
|
3591
3587
|
return this._scoped(async () => {
|
|
@@ -3682,7 +3678,7 @@ var Act = (_class7 = class {
|
|
|
3682
3678
|
*/
|
|
3683
3679
|
async reset(input) {
|
|
3684
3680
|
return this._scoped(async () => {
|
|
3685
|
-
const count = await
|
|
3681
|
+
const count = await _chunkC67XTW3Wcjs.store.call(void 0, ).reset(input);
|
|
3686
3682
|
for (const handler of this._batch_handlers.values())
|
|
3687
3683
|
_optionalChain([handler, 'access', _143 => _143[FOLD_RESET], 'optionalCall', _144 => _144()]);
|
|
3688
3684
|
if (count > 0) {
|
|
@@ -3718,7 +3714,7 @@ var Act = (_class7 = class {
|
|
|
3718
3714
|
*/
|
|
3719
3715
|
async unblock(input) {
|
|
3720
3716
|
return this._scoped(async () => {
|
|
3721
|
-
const count = await
|
|
3717
|
+
const count = await _chunkC67XTW3Wcjs.store.call(void 0, ).unblock(input);
|
|
3722
3718
|
if (count > 0) {
|
|
3723
3719
|
this._wake();
|
|
3724
3720
|
}
|
|
@@ -3773,7 +3769,7 @@ var Act = (_class7 = class {
|
|
|
3773
3769
|
return { ...partial, duration_ms: Date.now() - started };
|
|
3774
3770
|
}
|
|
3775
3771
|
const target = _nullishCoalesce(sink, () => ( (() => {
|
|
3776
|
-
const s =
|
|
3772
|
+
const s = _chunkC67XTW3Wcjs.store.call(void 0, );
|
|
3777
3773
|
if (!s.restore) throw new Error("adapter has no restore capability");
|
|
3778
3774
|
return s;
|
|
3779
3775
|
})()));
|
|
@@ -3819,7 +3815,7 @@ var Act = (_class7 = class {
|
|
|
3819
3815
|
async blocked_streams(options) {
|
|
3820
3816
|
return this._scoped(async () => {
|
|
3821
3817
|
const positions = [];
|
|
3822
|
-
await
|
|
3818
|
+
await _chunkC67XTW3Wcjs.store.call(void 0, ).query_streams(
|
|
3823
3819
|
(p) => {
|
|
3824
3820
|
positions.push(p);
|
|
3825
3821
|
},
|
|
@@ -3871,9 +3867,9 @@ var Act = (_class7 = class {
|
|
|
3871
3867
|
* @see {@link Store.prioritize} for the underlying primitive
|
|
3872
3868
|
*/
|
|
3873
3869
|
async prioritize(filter, priority) {
|
|
3874
|
-
return this._scoped(() =>
|
|
3870
|
+
return this._scoped(() => _chunkC67XTW3Wcjs.store.call(void 0, ).prioritize(filter, priority));
|
|
3875
3871
|
}
|
|
3876
|
-
|
|
3872
|
+
// Shared by `close()` and reaction-requested closes.
|
|
3877
3873
|
async _run_close(targets) {
|
|
3878
3874
|
const close_actor = { id: "$close", name: "close" };
|
|
3879
3875
|
const result = await run_close_cycle(targets, {
|
|
@@ -3951,7 +3947,7 @@ var Act = (_class7 = class {
|
|
|
3951
3947
|
* @see {@link correlate} for manual correlation
|
|
3952
3948
|
*/
|
|
3953
3949
|
settle(options) {
|
|
3954
|
-
|
|
3950
|
+
_chunkC67XTW3Wcjs.resolveSettleConfig.call(void 0, _nullishCoalesce(options, () => ( {})));
|
|
3955
3951
|
this._schedule(options);
|
|
3956
3952
|
}
|
|
3957
3953
|
}, _class7);
|
|
@@ -4107,16 +4103,16 @@ function synthesize_autoclose_reactions(registry, states, read_window) {
|
|
|
4107
4103
|
}),
|
|
4108
4104
|
// Never block on autoclose: a transient query/store error should retry,
|
|
4109
4105
|
// not quarantine the synthetic stream.
|
|
4110
|
-
options: { blockOnError: false, maxRetries:
|
|
4106
|
+
options: { blockOnError: false, maxRetries: _chunkC67XTW3Wcjs.DEFAULT_MAX_RETRIES },
|
|
4111
4107
|
handler: async (event) => {
|
|
4112
4108
|
const aggregate = event.stream;
|
|
4113
4109
|
const window = read_window();
|
|
4114
4110
|
if (!in_autoclose_window(window, /* @__PURE__ */ new Date()))
|
|
4115
|
-
throw new (0,
|
|
4116
|
-
const stats = await
|
|
4111
|
+
throw new (0, _chunkNXURHBSBcjs.DeferSignal)({ at: next_window_open(window, /* @__PURE__ */ new Date()) });
|
|
4112
|
+
const stats = await _chunkC67XTW3Wcjs.store.call(void 0, ).query_stats([aggregate], {
|
|
4117
4113
|
count: true,
|
|
4118
4114
|
tail: keep_days !== void 0 ? true : void 0,
|
|
4119
|
-
exclude: [
|
|
4115
|
+
exclude: [_chunkNXURHBSBcjs.TOMBSTONE_EVENT, _chunkNXURHBSBcjs.SNAP_EVENT]
|
|
4120
4116
|
});
|
|
4121
4117
|
const entry = stats.get(aggregate);
|
|
4122
4118
|
if (!entry) return;
|
|
@@ -4147,7 +4143,7 @@ function synthesize_autoclose_reactions(registry, states, read_window) {
|
|
|
4147
4143
|
dues.push(days_after(entry.tail.created, keep_days));
|
|
4148
4144
|
const future = dues.map((d) => d.getTime()).filter((t) => t > Date.now());
|
|
4149
4145
|
if (future.length)
|
|
4150
|
-
throw new (0,
|
|
4146
|
+
throw new (0, _chunkNXURHBSBcjs.DeferSignal)({ at: new Date(Math.min(...future)) });
|
|
4151
4147
|
}
|
|
4152
4148
|
};
|
|
4153
4149
|
const key = `__autoclose_${st.name}`;
|
|
@@ -4352,9 +4348,9 @@ var _this_ = ({ stream }) => ({
|
|
|
4352
4348
|
|
|
4353
4349
|
// src/builders/builder-utils.ts
|
|
4354
4350
|
function register_lane(config2, lanes) {
|
|
4355
|
-
|
|
4356
|
-
if (config2.name ===
|
|
4357
|
-
throw new Error(`Lane "${
|
|
4351
|
+
_chunkC67XTW3Wcjs.resolveLaneConfig.call(void 0, config2);
|
|
4352
|
+
if (config2.name === _chunkNXURHBSBcjs.DEFAULT_LANE)
|
|
4353
|
+
throw new Error(`Lane "${_chunkNXURHBSBcjs.DEFAULT_LANE}" is reserved`);
|
|
4358
4354
|
const existing = lanes.find((l) => l.name === config2.name);
|
|
4359
4355
|
if (!existing) return void lanes.push(config2);
|
|
4360
4356
|
if (existing.leaseMillis !== config2.leaseMillis || existing.streamLimit !== config2.streamLimit || existing.cycleMs !== config2.cycleMs)
|
|
@@ -4396,9 +4392,9 @@ function reaction_on(event, events, builder) {
|
|
|
4396
4392
|
// Validate the whole bag at the declaration site so a bad
|
|
4397
4393
|
// `maxRetries`/`backoff`/`blockOnError` throws ZodError at build,
|
|
4398
4394
|
// not a NaN gate on the first retry.
|
|
4399
|
-
options:
|
|
4400
|
-
blockOnError: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _159 => _159.blockOnError]), () => (
|
|
4401
|
-
maxRetries: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _160 => _160.maxRetries]), () => (
|
|
4395
|
+
options: _chunkC67XTW3Wcjs.resolveReactionConfig.call(void 0, {
|
|
4396
|
+
blockOnError: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _159 => _159.blockOnError]), () => ( _chunkC67XTW3Wcjs.DEFAULT_BLOCK_ON_ERROR)),
|
|
4397
|
+
maxRetries: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _160 => _160.maxRetries]), () => ( _chunkC67XTW3Wcjs.DEFAULT_MAX_RETRIES)),
|
|
4402
4398
|
backoff: _optionalChain([options, 'optionalAccess', _161 => _161.backoff])
|
|
4403
4399
|
})
|
|
4404
4400
|
};
|
|
@@ -4483,7 +4479,7 @@ function date_reviver_schema(schema) {
|
|
|
4483
4479
|
|
|
4484
4480
|
// src/builders/event-builder.ts
|
|
4485
4481
|
function event_tags(schema) {
|
|
4486
|
-
const pii =
|
|
4482
|
+
const pii = _chunkNXURHBSBcjs.pii_schemas.call(void 0, schema);
|
|
4487
4483
|
const pii_dates = {};
|
|
4488
4484
|
for (const [key, field] of Object.entries(pii)) {
|
|
4489
4485
|
const dates = date_reviver_schema(field);
|
|
@@ -4520,7 +4516,7 @@ function make_event_reader(tags, disclosure, predicate = null) {
|
|
|
4520
4516
|
});
|
|
4521
4517
|
}
|
|
4522
4518
|
function build_events(registry, states, lanes, owners) {
|
|
4523
|
-
const declared = /* @__PURE__ */ new Set([
|
|
4519
|
+
const declared = /* @__PURE__ */ new Set([_chunkNXURHBSBcjs.DEFAULT_LANE, ...lanes.map((l) => l.name)]);
|
|
4524
4520
|
const lane_errors = [];
|
|
4525
4521
|
const tags = /* @__PURE__ */ new Map();
|
|
4526
4522
|
const sensitive2 = /* @__PURE__ */ new Map();
|
|
@@ -4584,7 +4580,7 @@ function build_events(registry, states, lanes, owners) {
|
|
|
4584
4580
|
if (reader) readers.set(event_name, reader);
|
|
4585
4581
|
}
|
|
4586
4582
|
const snap2 = make_event_reader(event_tags(state2.state), "redact", null);
|
|
4587
|
-
if (snap2) readers.set(
|
|
4583
|
+
if (snap2) readers.set(_chunkNXURHBSBcjs.SNAP_EVENT, snap2);
|
|
4588
4584
|
if (readers.size === 0) continue;
|
|
4589
4585
|
state2.view = (event, actor) => (_nullishCoalesce(readers.get(event.name), () => ( IDENTITY_GATE)))(event, actor);
|
|
4590
4586
|
}
|
|
@@ -4643,6 +4639,24 @@ function act() {
|
|
|
4643
4639
|
const fold_specs = [];
|
|
4644
4640
|
const lanes = [];
|
|
4645
4641
|
let _built = false;
|
|
4642
|
+
const advise_pii_types = () => {
|
|
4643
|
+
const fields = /* @__PURE__ */ new Set();
|
|
4644
|
+
for (const state2 of states.values()) {
|
|
4645
|
+
const shape = _nullishCoalesce(state2.state.shape, () => ( {}));
|
|
4646
|
+
for (const [event, schema] of Object.entries(state2.events))
|
|
4647
|
+
for (const [field, field_schema] of Object.entries(
|
|
4648
|
+
_chunkNXURHBSBcjs.pii_schemas.call(void 0, schema)
|
|
4649
|
+
)) {
|
|
4650
|
+
if (!reads_as_string(field_schema)) fields.add(`${event}.${field}`);
|
|
4651
|
+
if (shape[field] && !reads_as_string(shape[field]))
|
|
4652
|
+
fields.add(`${state2.name}.${field}`);
|
|
4653
|
+
}
|
|
4654
|
+
}
|
|
4655
|
+
if (fields.size > 0)
|
|
4656
|
+
_chunkC67XTW3Wcjs.log.call(void 0, ).warn(
|
|
4657
|
+
`Act has ${fields.size} sensitive field(s) whose type isn't a string: ${[...fields].join(", ")}. A caller who may not see one reads "[REDACTED]" or "[SHREDDED]" there instead, which its type doesn't allow. Declare sensitive fields as strings. See docs/docs/guides/sensitive-data.md.`
|
|
4658
|
+
);
|
|
4659
|
+
};
|
|
4646
4660
|
const read_wrap = (original) => {
|
|
4647
4661
|
const wrapped = async (events, stream) => {
|
|
4648
4662
|
const read = events.map((e) => _nullishCoalesce(_optionalChain([_hr, 'access', _169 => _169.get, 'call', _170 => _170(e.name), 'optionalCall', _171 => _171(e)]), () => ( e)));
|
|
@@ -4699,7 +4713,7 @@ function act() {
|
|
|
4699
4713
|
const list = deprecation_summary.map(
|
|
4700
4714
|
(d) => `"${d.deprecated}" (current: "${d.current}", state: "${d.state_name}")`
|
|
4701
4715
|
).join(", ");
|
|
4702
|
-
|
|
4716
|
+
_chunkC67XTW3Wcjs.log.call(void 0, ).info(
|
|
4703
4717
|
`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.`
|
|
4704
4718
|
);
|
|
4705
4719
|
}
|
|
@@ -4741,7 +4755,7 @@ function act() {
|
|
|
4741
4755
|
return reaction_on(event, registry.events, builder);
|
|
4742
4756
|
},
|
|
4743
4757
|
build: (options) => {
|
|
4744
|
-
|
|
4758
|
+
_chunkC67XTW3Wcjs.resolveActConfig.call(void 0, options);
|
|
4745
4759
|
if (!_built) {
|
|
4746
4760
|
for (const proj of pending_projections) add_projection(proj);
|
|
4747
4761
|
for (const proj of fold_projections) {
|
|
@@ -4781,6 +4795,7 @@ function act() {
|
|
|
4781
4795
|
for (const [name, gate] of built.query_readers) _qg.set(name, gate);
|
|
4782
4796
|
for (const [name, gate] of built.handler_readers) _hr.set(name, gate);
|
|
4783
4797
|
finalize_deprecations();
|
|
4798
|
+
advise_pii_types();
|
|
4784
4799
|
for (const state2 of states.values()) {
|
|
4785
4800
|
if (state2.disclose) _dp.set(state2.name, state2.disclose);
|
|
4786
4801
|
if (state2.autoclose) _ac.set(state2.name, state2.autoclose);
|
|
@@ -4792,7 +4807,7 @@ function act() {
|
|
|
4792
4807
|
synthesize_autoclose_reactions(
|
|
4793
4808
|
registry,
|
|
4794
4809
|
states,
|
|
4795
|
-
|
|
4810
|
+
_chunkC67XTW3Wcjs.current_autoclose_window
|
|
4796
4811
|
);
|
|
4797
4812
|
Object.freeze(registry.actions);
|
|
4798
4813
|
Object.freeze(registry.events);
|
|
@@ -4811,6 +4826,12 @@ function act() {
|
|
|
4811
4826
|
};
|
|
4812
4827
|
return builder;
|
|
4813
4828
|
}
|
|
4829
|
+
function reads_as_string(schema) {
|
|
4830
|
+
const def = schema._zod.def;
|
|
4831
|
+
if (def.type === "string" || def.type === "transform") return true;
|
|
4832
|
+
if (def.out) return reads_as_string(def.out);
|
|
4833
|
+
return def.innerType ? reads_as_string(def.innerType) : false;
|
|
4834
|
+
}
|
|
4814
4835
|
|
|
4815
4836
|
// src/builders/projection-builder.ts
|
|
4816
4837
|
function _projection(target) {
|
|
@@ -4840,8 +4861,8 @@ function _projection(target) {
|
|
|
4840
4861
|
handler,
|
|
4841
4862
|
resolver: _nullishCoalesce(default_resolver, () => ( _this_)),
|
|
4842
4863
|
options: {
|
|
4843
|
-
blockOnError:
|
|
4844
|
-
maxRetries:
|
|
4864
|
+
blockOnError: _chunkC67XTW3Wcjs.DEFAULT_BLOCK_ON_ERROR,
|
|
4865
|
+
maxRetries: _chunkC67XTW3Wcjs.DEFAULT_MAX_RETRIES
|
|
4845
4866
|
}
|
|
4846
4867
|
}),
|
|
4847
4868
|
widened
|
|
@@ -4882,7 +4903,7 @@ function _projection(target) {
|
|
|
4882
4903
|
throw new Error(
|
|
4883
4904
|
`Projection "${target}" .of() partials must share one state name \u2014 got "${name}" and "${partial.name}"`
|
|
4884
4905
|
);
|
|
4885
|
-
const config2 =
|
|
4906
|
+
const config2 = _chunkC67XTW3Wcjs.resolveFoldConfig.call(void 0, options);
|
|
4886
4907
|
const fold_events = {};
|
|
4887
4908
|
for (const partial of partials)
|
|
4888
4909
|
for (const [event_name, schema] of Object.entries(partial.events)) {
|
|
@@ -4900,8 +4921,8 @@ function _projection(target) {
|
|
|
4900
4921
|
handler: noop,
|
|
4901
4922
|
resolver: { target },
|
|
4902
4923
|
options: {
|
|
4903
|
-
blockOnError:
|
|
4904
|
-
maxRetries:
|
|
4924
|
+
blockOnError: _chunkC67XTW3Wcjs.DEFAULT_BLOCK_ON_ERROR,
|
|
4925
|
+
maxRetries: _chunkC67XTW3Wcjs.DEFAULT_MAX_RETRIES
|
|
4905
4926
|
}
|
|
4906
4927
|
}
|
|
4907
4928
|
]
|
|
@@ -5017,7 +5038,7 @@ function action_builder(state2) {
|
|
|
5017
5038
|
throw new Error(`Duplicate action "${action2}"`);
|
|
5018
5039
|
internal.actions[action2] = schema;
|
|
5019
5040
|
if (options) {
|
|
5020
|
-
|
|
5041
|
+
_chunkC67XTW3Wcjs.resolveActionConfig.call(void 0, options);
|
|
5021
5042
|
internal.options ??= {};
|
|
5022
5043
|
internal.options[action2] = options;
|
|
5023
5044
|
}
|
|
@@ -5310,5 +5331,5 @@ function write_line(writer, line) {
|
|
|
5310
5331
|
|
|
5311
5332
|
|
|
5312
5333
|
|
|
5313
|
-
exports.Act = Act; exports.ActorSchema =
|
|
5334
|
+
exports.Act = Act; exports.ActorSchema = _chunkNXURHBSBcjs.ActorSchema; exports.CausationEventSchema = _chunkNXURHBSBcjs.CausationEventSchema; exports.CommittedMetaSchema = _chunkNXURHBSBcjs.CommittedMetaSchema; exports.ConcurrencyError = _chunkNXURHBSBcjs.ConcurrencyError; exports.ConsoleLogger = _chunkC67XTW3Wcjs.ConsoleLogger; exports.CsvFile = CsvFile; exports.DEFAULT_LANE = _chunkNXURHBSBcjs.DEFAULT_LANE; exports.DEFAULT_MAX_SUBSCRIBED_STREAMS = _chunkNXURHBSBcjs.DEFAULT_MAX_SUBSCRIBED_STREAMS; exports.DEFAULT_SETTLE_DEBOUNCE_MS = _chunkNXURHBSBcjs.DEFAULT_SETTLE_DEBOUNCE_MS; exports.DeferSignal = _chunkNXURHBSBcjs.DeferSignal; exports.Environments = _chunkNXURHBSBcjs.Environments; exports.Errors = _chunkNXURHBSBcjs.Errors; exports.EventMetaSchema = _chunkNXURHBSBcjs.EventMetaSchema; exports.ExitCodes = _chunkNXURHBSBcjs.ExitCodes; exports.InMemoryCache = _chunkC67XTW3Wcjs.InMemoryCache; exports.InMemoryStore = _chunkC67XTW3Wcjs.InMemoryStore; exports.InvariantError = _chunkNXURHBSBcjs.InvariantError; exports.LogLevels = _chunkNXURHBSBcjs.LogLevels; exports.NonRetryableError = _chunkNXURHBSBcjs.NonRetryableError; exports.PackageSchema = _chunkC67XTW3Wcjs.PackageSchema; exports.PreconditionError = _chunkNXURHBSBcjs.PreconditionError; exports.QuerySchema = _chunkNXURHBSBcjs.QuerySchema; exports.REDACTED = _chunkNXURHBSBcjs.REDACTED; exports.SHREDDED = _chunkNXURHBSBcjs.SHREDDED; exports.SNAP_EVENT = _chunkNXURHBSBcjs.SNAP_EVENT; exports.StoreError = _chunkNXURHBSBcjs.StoreError; exports.StreamClosedError = _chunkNXURHBSBcjs.StreamClosedError; exports.TOMBSTONE_EVENT = _chunkNXURHBSBcjs.TOMBSTONE_EVENT; exports.TargetSchema = _chunkNXURHBSBcjs.TargetSchema; exports.ValidationError = _chunkNXURHBSBcjs.ValidationError; exports.ZodEmpty = _chunkNXURHBSBcjs.ZodEmpty; exports.act = act; exports.cache = _chunkC67XTW3Wcjs.cache; exports.config = _chunkC67XTW3Wcjs.config; exports.dateReviver = _chunkC67XTW3Wcjs.dateReviver; exports.default_scope = _chunkC67XTW3Wcjs.default_scope; exports.dispose = _chunkC67XTW3Wcjs.dispose; exports.disposeAndExit = _chunkC67XTW3Wcjs.disposeAndExit; exports.extend = _chunkC67XTW3Wcjs.extend; exports.is_literal_source = _chunkC67XTW3Wcjs.is_literal_source; exports.log = _chunkC67XTW3Wcjs.log; exports.pii_fields = _chunkNXURHBSBcjs.pii_fields; exports.port = _chunkC67XTW3Wcjs.port; exports.projection = projection; exports.resolveAutocloseConfig = _chunkC67XTW3Wcjs.resolveAutocloseConfig2; exports.sensitive = _chunkNXURHBSBcjs.sensitive; exports.sleep = _chunkC67XTW3Wcjs.sleep; exports.slice = slice; exports.state = state; exports.store = _chunkC67XTW3Wcjs.store; exports.validate = _chunkC67XTW3Wcjs.validate;
|
|
5314
5335
|
//# sourceMappingURL=index.cjs.map
|