@rotorsoft/act 1.35.0 → 1.35.2
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/internal/event-sourcing.d.ts.map +1 -1
- package/dist/@types/types/ports.d.ts +3 -2
- package/dist/@types/types/ports.d.ts.map +1 -1
- package/dist/{chunk-L66OOP2F.cjs → chunk-4KDMNSPJ.cjs} +1 -1
- package/dist/chunk-4KDMNSPJ.cjs.map +1 -0
- package/dist/{chunk-BNTVE7RQ.cjs → chunk-F2YAA4SE.cjs} +13 -13
- package/dist/{chunk-BNTVE7RQ.cjs.map → chunk-F2YAA4SE.cjs.map} +1 -1
- package/dist/{chunk-DH2HW5XJ.js → chunk-H2QN755D.js} +1 -1
- package/dist/chunk-H2QN755D.js.map +1 -0
- package/dist/{chunk-MHPUVTMX.js → chunk-SVVVS6GA.js} +2 -2
- package/dist/index.cjs +232 -221
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +43 -32
- 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-DH2HW5XJ.js.map +0 -1
- package/dist/chunk-L66OOP2F.cjs.map +0 -1
- /package/dist/{chunk-MHPUVTMX.js.map → chunk-SVVVS6GA.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
var
|
|
43
|
+
var _chunkF2YAA4SEcjs = require('./chunk-F2YAA4SE.cjs');
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
|
|
@@ -71,24 +71,24 @@ var _chunkBNTVE7RQcjs = require('./chunk-BNTVE7RQ.cjs');
|
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
|
|
74
|
-
var
|
|
74
|
+
var _chunk4KDMNSPJcjs = require('./chunk-4KDMNSPJ.cjs');
|
|
75
75
|
|
|
76
76
|
// src/signals.ts
|
|
77
77
|
process.once("SIGINT", async (arg) => {
|
|
78
|
-
|
|
79
|
-
await
|
|
78
|
+
_chunkF2YAA4SEcjs.log.call(void 0, ).info(arg, "SIGINT");
|
|
79
|
+
await _chunkF2YAA4SEcjs.disposeAndExit.call(void 0, "EXIT");
|
|
80
80
|
});
|
|
81
81
|
process.once("SIGTERM", async (arg) => {
|
|
82
|
-
|
|
83
|
-
await
|
|
82
|
+
_chunkF2YAA4SEcjs.log.call(void 0, ).info(arg, "SIGTERM");
|
|
83
|
+
await _chunkF2YAA4SEcjs.disposeAndExit.call(void 0, "EXIT");
|
|
84
84
|
});
|
|
85
85
|
process.once("uncaughtException", async (arg) => {
|
|
86
|
-
|
|
87
|
-
await
|
|
86
|
+
_chunkF2YAA4SEcjs.log.call(void 0, ).error(arg, "Uncaught Exception");
|
|
87
|
+
await _chunkF2YAA4SEcjs.disposeAndExit.call(void 0, "ERROR");
|
|
88
88
|
});
|
|
89
89
|
process.once("unhandledRejection", async (arg) => {
|
|
90
|
-
|
|
91
|
-
await
|
|
90
|
+
_chunkF2YAA4SEcjs.log.call(void 0, ).error(arg, "Unhandled Rejection");
|
|
91
|
+
await _chunkF2YAA4SEcjs.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: [_chunk4KDMNSPJcjs.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 = _chunk4KDMNSPJcjs.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: [_chunk4KDMNSPJcjs.SNAP_EVENT],
|
|
416
416
|
with_snaps: true
|
|
417
417
|
}
|
|
418
418
|
);
|
|
@@ -841,7 +841,7 @@ async function run_close_cycle(targets, deps) {
|
|
|
841
841
|
deps,
|
|
842
842
|
() => run_full_closes(full, target_map, deps, skipped)
|
|
843
843
|
);
|
|
844
|
-
const retired = [...truncated.entries()].filter(([, r]) => r.committed.name ===
|
|
844
|
+
const retired = [...truncated.entries()].filter(([, r]) => r.committed.name === _chunk4KDMNSPJcjs.TOMBSTONE_EVENT).map(([stream]) => stream);
|
|
845
845
|
if (retired.length) _optionalChain([deps, 'access', _42 => _42.forget_subscribed, 'optionalCall', _43 => _43(retired)]);
|
|
846
846
|
for (const [stream, entry] of windowed_result) truncated.set(stream, entry);
|
|
847
847
|
return { truncated, skipped };
|
|
@@ -923,7 +923,7 @@ async function run_windowed_closes(windowed, deps, skipped) {
|
|
|
923
923
|
if (!await windowed_prune_pending(t.stream, t.before, max_id))
|
|
924
924
|
return void 0;
|
|
925
925
|
if (t.archive) await t.archive();
|
|
926
|
-
const result = await
|
|
926
|
+
const result = await _chunkF2YAA4SEcjs.store.call(void 0, ).truncate([
|
|
927
927
|
{ stream: t.stream, before: t.before, max_id }
|
|
928
928
|
]);
|
|
929
929
|
return result.get(t.stream);
|
|
@@ -936,10 +936,10 @@ async function run_windowed_closes(windowed, deps, skipped) {
|
|
|
936
936
|
async function windowed_prune_pending(stream, before, max_id) {
|
|
937
937
|
let boundary_id;
|
|
938
938
|
let min_id;
|
|
939
|
-
await
|
|
939
|
+
await _chunkF2YAA4SEcjs.store.call(void 0, ).query(
|
|
940
940
|
(event) => {
|
|
941
941
|
if (min_id === void 0 || event.id < min_id) min_id = event.id;
|
|
942
|
-
if (event.name ===
|
|
942
|
+
if (event.name === _chunk4KDMNSPJcjs.SNAP_EVENT && event.created < before && (max_id === void 0 || event.id <= max_id) && (boundary_id === void 0 || event.id > boundary_id))
|
|
943
943
|
boundary_id = event.id;
|
|
944
944
|
},
|
|
945
945
|
{ stream, stream_exact: true, with_snaps: true, after: -1 }
|
|
@@ -950,7 +950,7 @@ async function probe_min_watermarks(streams, page_size, checkpoint) {
|
|
|
950
950
|
const min_at = /* @__PURE__ */ new Map();
|
|
951
951
|
const matches = source_matcher();
|
|
952
952
|
await walk_streams(
|
|
953
|
-
|
|
953
|
+
_chunkF2YAA4SEcjs.store.call(void 0, ),
|
|
954
954
|
(position) => {
|
|
955
955
|
const pending = position.correlated_at === void 0 || position.at < position.correlated_at;
|
|
956
956
|
const cap = pending ? position.at : Math.max(position.at, checkpoint);
|
|
@@ -978,17 +978,17 @@ function source_matcher() {
|
|
|
978
978
|
};
|
|
979
979
|
}
|
|
980
980
|
async function scan_stream_heads(streams) {
|
|
981
|
-
const stats = await
|
|
982
|
-
exclude: [
|
|
981
|
+
const stats = await _chunkF2YAA4SEcjs.store.call(void 0, ).query_stats(streams, {
|
|
982
|
+
exclude: [_chunk4KDMNSPJcjs.SNAP_EVENT]
|
|
983
983
|
});
|
|
984
|
-
const domain_heads = await
|
|
985
|
-
exclude: [
|
|
984
|
+
const domain_heads = await _chunkF2YAA4SEcjs.store.call(void 0, ).query_stats(streams, {
|
|
985
|
+
exclude: [_chunk4KDMNSPJcjs.SNAP_EVENT, _chunk4KDMNSPJcjs.TOMBSTONE_EVENT]
|
|
986
986
|
});
|
|
987
|
-
const true_heads = await
|
|
987
|
+
const true_heads = await _chunkF2YAA4SEcjs.store.call(void 0, ).query_stats(streams, {});
|
|
988
988
|
const out = /* @__PURE__ */ new Map();
|
|
989
989
|
for (const [stream, { head }] of domain_heads) {
|
|
990
990
|
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]) ===
|
|
991
|
+
const interrupted = _optionalChain([marker_head, 'optionalAccess', _48 => _48.name]) === _chunk4KDMNSPJcjs.TOMBSTONE_EVENT;
|
|
992
992
|
out.set(stream, {
|
|
993
993
|
max_id: head.id,
|
|
994
994
|
version: true_heads.get(stream).head.version,
|
|
@@ -1012,7 +1012,7 @@ async function partition_by_safety(stream_info, reactive, skipped, page_size, ca
|
|
|
1012
1012
|
const matches = source_matcher();
|
|
1013
1013
|
const targets = [...stream_info.keys()];
|
|
1014
1014
|
await walk_streams(
|
|
1015
|
-
|
|
1015
|
+
_chunkF2YAA4SEcjs.store.call(void 0, ),
|
|
1016
1016
|
(position) => {
|
|
1017
1017
|
const has_work = position.correlated_at !== void 0 && position.at < position.correlated_at;
|
|
1018
1018
|
if (!has_work) return;
|
|
@@ -1078,7 +1078,7 @@ async function run_archive_callbacks(guarded, target_map) {
|
|
|
1078
1078
|
}
|
|
1079
1079
|
}
|
|
1080
1080
|
async function heads_still_guarded(guarded, guard_events, skipped) {
|
|
1081
|
-
const heads = await
|
|
1081
|
+
const heads = await _chunkF2YAA4SEcjs.store.call(void 0, ).query_stats(guarded, {});
|
|
1082
1082
|
return guarded.filter((stream) => {
|
|
1083
1083
|
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
1084
|
return true;
|
|
@@ -1096,18 +1096,18 @@ async function truncate_and_warm_cache(guarded, seed_states, guard_events, corre
|
|
|
1096
1096
|
meta: {
|
|
1097
1097
|
correlation,
|
|
1098
1098
|
causation: {
|
|
1099
|
-
event: { id: guard.id, name:
|
|
1099
|
+
event: { id: guard.id, name: _chunk4KDMNSPJcjs.TOMBSTONE_EVENT, stream: guard.stream }
|
|
1100
1100
|
}
|
|
1101
1101
|
}
|
|
1102
1102
|
};
|
|
1103
1103
|
});
|
|
1104
|
-
const truncated = await
|
|
1104
|
+
const truncated = await _chunkF2YAA4SEcjs.store.call(void 0, ).truncate(trunc_targets);
|
|
1105
1105
|
await Promise.all(
|
|
1106
1106
|
guarded.map(async (stream) => {
|
|
1107
1107
|
const entry = truncated.get(stream);
|
|
1108
1108
|
const state2 = seed_states.get(stream);
|
|
1109
1109
|
if (state2 && entry) {
|
|
1110
|
-
await
|
|
1110
|
+
await _chunkF2YAA4SEcjs.cache.call(void 0, ).set(stream, {
|
|
1111
1111
|
stream,
|
|
1112
1112
|
state: state2,
|
|
1113
1113
|
version: entry.committed.version,
|
|
@@ -1116,7 +1116,7 @@ async function truncate_and_warm_cache(guarded, seed_states, guard_events, corre
|
|
|
1116
1116
|
snaps: 1
|
|
1117
1117
|
});
|
|
1118
1118
|
} else {
|
|
1119
|
-
await
|
|
1119
|
+
await _chunkF2YAA4SEcjs.cache.call(void 0, ).invalidate(stream);
|
|
1120
1120
|
}
|
|
1121
1121
|
})
|
|
1122
1122
|
);
|
|
@@ -1130,7 +1130,7 @@ var _crypto = require('crypto');
|
|
|
1130
1130
|
function report_once(seen, key, message) {
|
|
1131
1131
|
if (seen.has(key)) return;
|
|
1132
1132
|
seen.add(key);
|
|
1133
|
-
|
|
1133
|
+
_chunkF2YAA4SEcjs.log.call(void 0, ).error(new Error(message));
|
|
1134
1134
|
}
|
|
1135
1135
|
|
|
1136
1136
|
// src/internal/correlate-cycle.ts
|
|
@@ -1181,7 +1181,7 @@ var CorrelateCycle = (_class3 = class {
|
|
|
1181
1181
|
// never lets a resolution re-lane them.
|
|
1182
1182
|
|
|
1183
1183
|
__init11() {this._static_subscriptions = /* @__PURE__ */ new Map()}
|
|
1184
|
-
__init12() {this._patterns = new (0,
|
|
1184
|
+
__init12() {this._patterns = new (0, _chunkF2YAA4SEcjs.LruMap)(PATTERN_CACHE_SIZE)}
|
|
1185
1185
|
|
|
1186
1186
|
|
|
1187
1187
|
|
|
@@ -1199,7 +1199,7 @@ var CorrelateCycle = (_class3 = class {
|
|
|
1199
1199
|
on_init
|
|
1200
1200
|
}) {;_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
1201
|
this._key = shard ? `${registry_key(registry.events)}:${[...shard].sort().join(",")}` : registry_key(registry.events);
|
|
1202
|
-
this._dynamic_subscriptions = new (0,
|
|
1202
|
+
this._dynamic_subscriptions = new (0, _chunkF2YAA4SEcjs.LruMap)(max_subscribed_streams);
|
|
1203
1203
|
this._registry = registry;
|
|
1204
1204
|
this._declared_lanes = declared_lanes;
|
|
1205
1205
|
this._static_targets = static_targets;
|
|
@@ -1257,7 +1257,7 @@ var CorrelateCycle = (_class3 = class {
|
|
|
1257
1257
|
/** Would the target's own `fetch` (filtered by `source`) return this event? */
|
|
1258
1258
|
_in_fetch_window(source, stream) {
|
|
1259
1259
|
if (source === void 0 || source === stream) return true;
|
|
1260
|
-
if (
|
|
1260
|
+
if (_chunkF2YAA4SEcjs.is_literal_source.call(void 0, source)) return false;
|
|
1261
1261
|
let pattern = this._patterns.get(source);
|
|
1262
1262
|
if (!pattern) {
|
|
1263
1263
|
pattern = new RegExp(source);
|
|
@@ -1300,7 +1300,7 @@ var CorrelateCycle = (_class3 = class {
|
|
|
1300
1300
|
const correlated = /* @__PURE__ */ new Map();
|
|
1301
1301
|
let last_id = after;
|
|
1302
1302
|
let stopped = false;
|
|
1303
|
-
const found = await
|
|
1303
|
+
const found = await _chunkF2YAA4SEcjs.store.call(void 0, ).query(
|
|
1304
1304
|
(event) => {
|
|
1305
1305
|
if (stopped) return;
|
|
1306
1306
|
const register = this._registry.events[event.name];
|
|
@@ -1345,9 +1345,9 @@ var CorrelateCycle = (_class3 = class {
|
|
|
1345
1345
|
correlated_at: void 0
|
|
1346
1346
|
};
|
|
1347
1347
|
const seen_in_scan = correlated.has(resolved.target);
|
|
1348
|
-
const held_lane = _nullishCoalesce((seen_in_scan ? entry.lane : _optionalChain([recorded, 'optionalAccess', _61 => _61.lane])), () => (
|
|
1348
|
+
const held_lane = _nullishCoalesce((seen_in_scan ? entry.lane : _optionalChain([recorded, 'optionalAccess', _61 => _61.lane])), () => ( _chunk4KDMNSPJcjs.DEFAULT_LANE));
|
|
1349
1349
|
const held_priority = seen_in_scan ? entry.priority : _optionalChain([recorded, 'optionalAccess', _62 => _62.priority]);
|
|
1350
|
-
const resolved_lane = _nullishCoalesce(lane, () => (
|
|
1350
|
+
const resolved_lane = _nullishCoalesce(lane, () => ( _chunk4KDMNSPJcjs.DEFAULT_LANE));
|
|
1351
1351
|
if (held_priority === priority && held_lane !== resolved_lane)
|
|
1352
1352
|
report_lane_conflict(
|
|
1353
1353
|
this._reported,
|
|
@@ -1423,7 +1423,7 @@ var CorrelateCycle = (_class3 = class {
|
|
|
1423
1423
|
await Promise.all(
|
|
1424
1424
|
missed.map(async ([stream, entry]) => {
|
|
1425
1425
|
let row;
|
|
1426
|
-
await
|
|
1426
|
+
await _chunkF2YAA4SEcjs.store.call(void 0, ).query_streams(
|
|
1427
1427
|
(position) => {
|
|
1428
1428
|
row = position;
|
|
1429
1429
|
},
|
|
@@ -1435,8 +1435,8 @@ var CorrelateCycle = (_class3 = class {
|
|
|
1435
1435
|
lane: row.lane
|
|
1436
1436
|
});
|
|
1437
1437
|
if (entry.priority > row.priority) return;
|
|
1438
|
-
const held_lane = _nullishCoalesce(row.lane, () => (
|
|
1439
|
-
const resolved_lane = _nullishCoalesce(entry.lane, () => (
|
|
1438
|
+
const held_lane = _nullishCoalesce(row.lane, () => ( _chunk4KDMNSPJcjs.DEFAULT_LANE));
|
|
1439
|
+
const resolved_lane = _nullishCoalesce(entry.lane, () => ( _chunk4KDMNSPJcjs.DEFAULT_LANE));
|
|
1440
1440
|
if (entry.priority === row.priority && held_lane !== resolved_lane)
|
|
1441
1441
|
report_lane_conflict(
|
|
1442
1442
|
this._reported,
|
|
@@ -1462,7 +1462,7 @@ var CorrelateCycle = (_class3 = class {
|
|
|
1462
1462
|
millis: 0
|
|
1463
1463
|
});
|
|
1464
1464
|
} catch (error) {
|
|
1465
|
-
|
|
1465
|
+
_chunkF2YAA4SEcjs.log.call(void 0, ).warn(
|
|
1466
1466
|
`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
1467
|
);
|
|
1468
1468
|
}
|
|
@@ -1615,14 +1615,14 @@ function compute_lag_lead_ratio(handled, lagging, leading) {
|
|
|
1615
1615
|
}
|
|
1616
1616
|
|
|
1617
1617
|
// src/internal/drain-ops.ts
|
|
1618
|
-
var claim = (lagging, leading, by, millis, lane) =>
|
|
1618
|
+
var claim = (lagging, leading, by, millis, lane) => _chunkF2YAA4SEcjs.store.call(void 0, ).claim(lagging, leading, by, millis, lane);
|
|
1619
1619
|
async function fetch(leased, eventLimit) {
|
|
1620
1620
|
return Promise.all(
|
|
1621
1621
|
leased.map(async ({ stream, source, at, lagging }) => {
|
|
1622
1622
|
const events = [];
|
|
1623
|
-
const stream_exact = source !== void 0 &&
|
|
1623
|
+
const stream_exact = source !== void 0 && _chunkF2YAA4SEcjs.is_literal_source.call(void 0, source) ? true : void 0;
|
|
1624
1624
|
try {
|
|
1625
|
-
await
|
|
1625
|
+
await _chunkF2YAA4SEcjs.store.call(void 0, ).query((e) => events.push(e), {
|
|
1626
1626
|
stream: source,
|
|
1627
1627
|
stream_exact,
|
|
1628
1628
|
after: at,
|
|
@@ -1642,28 +1642,46 @@ async function fetch(leased, eventLimit) {
|
|
|
1642
1642
|
})
|
|
1643
1643
|
);
|
|
1644
1644
|
}
|
|
1645
|
-
var ack = (leases) =>
|
|
1646
|
-
var block = (leases) =>
|
|
1647
|
-
var subscribe = (streams, correlated_at, correlator) =>
|
|
1645
|
+
var ack = (leases) => _chunkF2YAA4SEcjs.store.call(void 0, ).ack(leases);
|
|
1646
|
+
var block = (leases) => _chunkF2YAA4SEcjs.store.call(void 0, ).block(leases);
|
|
1647
|
+
var subscribe = (streams, correlated_at, correlator) => _chunkF2YAA4SEcjs.store.call(void 0, ).subscribe(streams, correlated_at, correlator);
|
|
1648
1648
|
|
|
1649
1649
|
// src/internal/event-sourcing.ts
|
|
1650
1650
|
var _actpatch = require('@rotorsoft/act-patch');
|
|
1651
1651
|
var _zod2 = require('zod');
|
|
1652
1652
|
var bare_patch = (_me, state2, partial) => _actpatch.patch.call(void 0, state2, partial);
|
|
1653
|
-
var
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1653
|
+
var value_at = (value, path) => path.reduce(
|
|
1654
|
+
(at, key) => _optionalChain([at, 'optionalAccess', _67 => _67[key]]),
|
|
1655
|
+
value
|
|
1656
|
+
);
|
|
1657
|
+
var check_invariants = (target, state2, schema, pii_aware) => {
|
|
1658
|
+
let result;
|
|
1659
|
+
try {
|
|
1660
|
+
result = schema.safeParse(state2);
|
|
1661
|
+
} catch (error) {
|
|
1662
|
+
throw new (0, _chunk4KDMNSPJcjs.ValidationError)(target, state2, error);
|
|
1663
|
+
}
|
|
1664
|
+
if (result.success) return;
|
|
1665
|
+
const issues = pii_aware ? result.error.issues.filter((issue) => {
|
|
1666
|
+
const value = value_at(state2, issue.path);
|
|
1667
|
+
return value !== _chunk4KDMNSPJcjs.REDACTED && value !== _chunk4KDMNSPJcjs.SHREDDED;
|
|
1668
|
+
}) : result.error.issues;
|
|
1669
|
+
if (issues.length)
|
|
1670
|
+
throw new (0, _chunk4KDMNSPJcjs.ValidationError)(
|
|
1671
|
+
target,
|
|
1672
|
+
state2,
|
|
1673
|
+
_zod2.prettifyError.call(void 0, new (0, _zod2.ZodError)(issues))
|
|
1674
|
+
);
|
|
1657
1675
|
};
|
|
1658
1676
|
var DEFAULT_BATCH = 500;
|
|
1659
|
-
var cache_put = (stream, entry) =>
|
|
1660
|
-
(err) =>
|
|
1677
|
+
var cache_put = (stream, entry) => _chunkF2YAA4SEcjs.cache.call(void 0, ).set(stream, entry).catch(
|
|
1678
|
+
(err) => _chunkF2YAA4SEcjs.log.call(void 0, ).warn(
|
|
1661
1679
|
err,
|
|
1662
1680
|
"cache set skipped; the next load re-folds from the store"
|
|
1663
1681
|
)
|
|
1664
1682
|
);
|
|
1665
|
-
var cache_drop = (stream) =>
|
|
1666
|
-
(err) =>
|
|
1683
|
+
var cache_drop = (stream) => _chunkF2YAA4SEcjs.cache.call(void 0, ).invalidate(stream).catch(
|
|
1684
|
+
(err) => _chunkF2YAA4SEcjs.log.call(void 0, ).warn(
|
|
1667
1685
|
err,
|
|
1668
1686
|
"cache invalidate skipped; a stale checkpoint re-folds from its event_id"
|
|
1669
1687
|
)
|
|
@@ -1671,9 +1689,9 @@ var cache_drop = (stream) => _chunkBNTVE7RQcjs.cache.call(void 0, ).invalidate(s
|
|
|
1671
1689
|
async function snap(snapshot) {
|
|
1672
1690
|
const { id, stream, name, meta, version } = snapshot.event;
|
|
1673
1691
|
try {
|
|
1674
|
-
const [committed] = await
|
|
1692
|
+
const [committed] = await _chunkF2YAA4SEcjs.store.call(void 0, ).commit(
|
|
1675
1693
|
stream,
|
|
1676
|
-
[{ name:
|
|
1694
|
+
[{ name: _chunk4KDMNSPJcjs.SNAP_EVENT, data: snapshot.state }],
|
|
1677
1695
|
{
|
|
1678
1696
|
correlation: meta.correlation,
|
|
1679
1697
|
causation: { event: { id, name, stream } }
|
|
@@ -1684,22 +1702,22 @@ async function snap(snapshot) {
|
|
|
1684
1702
|
return committed;
|
|
1685
1703
|
} catch (error) {
|
|
1686
1704
|
const reason = error instanceof Error ? error.message : String(error);
|
|
1687
|
-
|
|
1705
|
+
_chunkF2YAA4SEcjs.log.call(void 0, ).warn(
|
|
1688
1706
|
`Snapshot write failed on stream "${stream}": ${reason} \u2014 cold starts will replay full history until snapshots succeed.`
|
|
1689
1707
|
);
|
|
1690
1708
|
}
|
|
1691
1709
|
}
|
|
1692
1710
|
async function tombstone(stream, expectedVersion, correlation) {
|
|
1693
1711
|
try {
|
|
1694
|
-
const [committed] = await
|
|
1712
|
+
const [committed] = await _chunkF2YAA4SEcjs.store.call(void 0, ).commit(
|
|
1695
1713
|
stream,
|
|
1696
|
-
[{ name:
|
|
1714
|
+
[{ name: _chunk4KDMNSPJcjs.TOMBSTONE_EVENT, data: {} }],
|
|
1697
1715
|
{ correlation, causation: {} },
|
|
1698
1716
|
expectedVersion
|
|
1699
1717
|
);
|
|
1700
1718
|
return committed;
|
|
1701
1719
|
} catch (error) {
|
|
1702
|
-
if (error instanceof
|
|
1720
|
+
if (error instanceof _chunk4KDMNSPJcjs.ConcurrencyError) return void 0;
|
|
1703
1721
|
throw error;
|
|
1704
1722
|
}
|
|
1705
1723
|
}
|
|
@@ -1729,9 +1747,9 @@ async function scan(source, opts = {}, callback) {
|
|
|
1729
1747
|
if (drop_closed_streams) {
|
|
1730
1748
|
await source.query(
|
|
1731
1749
|
(e) => {
|
|
1732
|
-
if (e.name ===
|
|
1750
|
+
if (e.name === _chunk4KDMNSPJcjs.TOMBSTONE_EVENT) closed_streams.add(e.stream);
|
|
1733
1751
|
},
|
|
1734
|
-
{ names: [
|
|
1752
|
+
{ names: [_chunk4KDMNSPJcjs.TOMBSTONE_EVENT] }
|
|
1735
1753
|
);
|
|
1736
1754
|
}
|
|
1737
1755
|
let max_id;
|
|
@@ -1753,16 +1771,16 @@ async function scan(source, opts = {}, callback) {
|
|
|
1753
1771
|
if (!is_valid(event))
|
|
1754
1772
|
throw new Error(`Invalid event at index ${processed}`);
|
|
1755
1773
|
if (on_progress) on_progress({ processed, id: event.id, max_id });
|
|
1756
|
-
if (drop_snapshots && event.name ===
|
|
1774
|
+
if (drop_snapshots && event.name === _chunk4KDMNSPJcjs.SNAP_EVENT) {
|
|
1757
1775
|
dropped_snaps++;
|
|
1758
1776
|
return;
|
|
1759
1777
|
}
|
|
1760
|
-
if (closed_streams.has(event.stream) && event.name !==
|
|
1778
|
+
if (closed_streams.has(event.stream) && event.name !== _chunk4KDMNSPJcjs.TOMBSTONE_EVENT) {
|
|
1761
1779
|
dropped_closed++;
|
|
1762
1780
|
return;
|
|
1763
1781
|
}
|
|
1764
1782
|
let migrated = event;
|
|
1765
|
-
const migration = _optionalChain([event_migrations, 'optionalAccess',
|
|
1783
|
+
const migration = _optionalChain([event_migrations, 'optionalAccess', _68 => _68[event.name]]);
|
|
1766
1784
|
if (migration) {
|
|
1767
1785
|
const old_data = migration.from_schema.parse(event.data);
|
|
1768
1786
|
const new_data = migration.migrate(old_data);
|
|
@@ -1784,7 +1802,7 @@ async function scan(source, opts = {}, callback) {
|
|
|
1784
1802
|
return;
|
|
1785
1803
|
}
|
|
1786
1804
|
let remapped = migrated;
|
|
1787
|
-
const caused_by = _optionalChain([migrated, 'access',
|
|
1805
|
+
const caused_by = _optionalChain([migrated, 'access', _69 => _69.meta, 'access', _70 => _70.causation, 'access', _71 => _71.event, 'optionalAccess', _72 => _72.id]);
|
|
1788
1806
|
if (caused_by !== void 0) {
|
|
1789
1807
|
const new_caused_by = id_map.get(caused_by);
|
|
1790
1808
|
if (new_caused_by !== void 0 && new_caused_by !== caused_by) {
|
|
@@ -1824,17 +1842,17 @@ async function scan(source, opts = {}, callback) {
|
|
|
1824
1842
|
async function load(me, target, callback, patch_fn = bare_patch) {
|
|
1825
1843
|
const { stream, actor, asOf } = target;
|
|
1826
1844
|
const time_travel = !!asOf && Object.values(asOf).some((v) => v !== void 0);
|
|
1827
|
-
const cached = time_travel ? void 0 : await
|
|
1845
|
+
const cached = time_travel ? void 0 : await _chunkF2YAA4SEcjs.cache.call(void 0, ).get(stream);
|
|
1828
1846
|
const cache_hit = !!cached;
|
|
1829
|
-
let state2 = _nullishCoalesce(_optionalChain([cached, 'optionalAccess',
|
|
1830
|
-
let patches = _nullishCoalesce(_optionalChain([cached, 'optionalAccess',
|
|
1831
|
-
let snaps = _nullishCoalesce(_optionalChain([cached, 'optionalAccess',
|
|
1847
|
+
let state2 = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _73 => _73.state]), () => ( (me.init ? me.init() : {})));
|
|
1848
|
+
let patches = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _74 => _74.patches]), () => ( 0));
|
|
1849
|
+
let snaps = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _75 => _75.snaps]), () => ( 0));
|
|
1832
1850
|
let replayed = 0;
|
|
1833
1851
|
let event;
|
|
1834
|
-
await
|
|
1852
|
+
await _chunkF2YAA4SEcjs.store.call(void 0, ).query(
|
|
1835
1853
|
(raw) => {
|
|
1836
1854
|
event = me.view(raw, actor);
|
|
1837
|
-
if (event.name ===
|
|
1855
|
+
if (event.name === _chunk4KDMNSPJcjs.SNAP_EVENT) {
|
|
1838
1856
|
state2 = event.data;
|
|
1839
1857
|
snaps++;
|
|
1840
1858
|
patches = 0;
|
|
@@ -1843,12 +1861,12 @@ async function load(me, target, callback, patch_fn = bare_patch) {
|
|
|
1843
1861
|
state2 = patch_fn(me, state2, me.patch[event.name](event, state2), event);
|
|
1844
1862
|
patches++;
|
|
1845
1863
|
replayed++;
|
|
1846
|
-
} else if (event.name !==
|
|
1847
|
-
|
|
1864
|
+
} else if (event.name !== _chunk4KDMNSPJcjs.TOMBSTONE_EVENT) {
|
|
1865
|
+
_chunkF2YAA4SEcjs.log.call(void 0, ).warn(
|
|
1848
1866
|
`Skipping unknown event "${String(event.name)}" on stream "${stream}" (id=${event.id}) \u2014 no reducer in state "${me.name}"`
|
|
1849
1867
|
);
|
|
1850
1868
|
}
|
|
1851
|
-
_optionalChain([callback, 'optionalCall',
|
|
1869
|
+
_optionalChain([callback, 'optionalCall', _76 => _76({
|
|
1852
1870
|
event,
|
|
1853
1871
|
state: state2,
|
|
1854
1872
|
version: event.version,
|
|
@@ -1868,7 +1886,7 @@ async function load(me, target, callback, patch_fn = bare_patch) {
|
|
|
1868
1886
|
...cached ? { after: cached.event_id, with_snaps: true } : { ...time_travel ? {} : { with_snaps: true }, ...asOf }
|
|
1869
1887
|
}
|
|
1870
1888
|
);
|
|
1871
|
-
const head_is_tombstone = _optionalChain([event, 'optionalAccess',
|
|
1889
|
+
const head_is_tombstone = _optionalChain([event, 'optionalAccess', _77 => _77.name]) === _chunk4KDMNSPJcjs.TOMBSTONE_EVENT;
|
|
1872
1890
|
if (replayed > 0 && !time_travel && event && !me.pii_aware && !head_is_tombstone) {
|
|
1873
1891
|
await cache_put(stream, {
|
|
1874
1892
|
stream,
|
|
@@ -1882,9 +1900,9 @@ async function load(me, target, callback, patch_fn = bare_patch) {
|
|
|
1882
1900
|
return {
|
|
1883
1901
|
event,
|
|
1884
1902
|
state: state2,
|
|
1885
|
-
version: _nullishCoalesce(_nullishCoalesce(_optionalChain([event, 'optionalAccess',
|
|
1903
|
+
version: _nullishCoalesce(_nullishCoalesce(_optionalChain([event, 'optionalAccess', _78 => _78.version]), () => ( _optionalChain([cached, 'optionalAccess', _79 => _79.version]))), () => ( -1)),
|
|
1886
1904
|
// Captured with `state`, so consumers never race a separate cache lookup.
|
|
1887
|
-
id: _nullishCoalesce(_nullishCoalesce(_optionalChain([event, 'optionalAccess',
|
|
1905
|
+
id: _nullishCoalesce(_nullishCoalesce(_optionalChain([event, 'optionalAccess', _80 => _80.id]), () => ( _optionalChain([cached, 'optionalAccess', _81 => _81.event_id]))), () => ( -1)),
|
|
1888
1906
|
patches,
|
|
1889
1907
|
snaps,
|
|
1890
1908
|
cache_hit,
|
|
@@ -1894,11 +1912,11 @@ async function load(me, target, callback, patch_fn = bare_patch) {
|
|
|
1894
1912
|
async function action(me, action2, target, payload, options, patch_fn = bare_patch) {
|
|
1895
1913
|
const { stream, expectedVersion, actor } = target;
|
|
1896
1914
|
if (!stream) throw new Error("Missing target stream");
|
|
1897
|
-
const reactingTo = _optionalChain([options, 'optionalAccess',
|
|
1898
|
-
const correlator = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1899
|
-
const validated =
|
|
1900
|
-
const opts = _optionalChain([me, 'access',
|
|
1901
|
-
const max_retries = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
1915
|
+
const reactingTo = _optionalChain([options, 'optionalAccess', _82 => _82.reactingTo]);
|
|
1916
|
+
const correlator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _83 => _83.correlator]), () => ( default_correlator));
|
|
1917
|
+
const validated = _chunkF2YAA4SEcjs.validate.call(void 0, action2, payload, me.actions[action2]);
|
|
1918
|
+
const opts = _optionalChain([me, 'access', _84 => _84.options, 'optionalAccess', _85 => _85[action2]]);
|
|
1919
|
+
const max_retries = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _86 => _86.maxRetries]), () => ( 0));
|
|
1902
1920
|
for (let attempt = 0; ; attempt++) {
|
|
1903
1921
|
try {
|
|
1904
1922
|
const snapshot = await load(
|
|
@@ -1907,21 +1925,21 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1907
1925
|
void 0,
|
|
1908
1926
|
patch_fn
|
|
1909
1927
|
);
|
|
1910
|
-
if (_optionalChain([snapshot, 'access',
|
|
1911
|
-
throw new (0,
|
|
1912
|
-
const expected = _nullishCoalesce(expectedVersion, () => (
|
|
1913
|
-
for (const { valid, description } of _nullishCoalesce(_optionalChain([me, 'access',
|
|
1928
|
+
if (_optionalChain([snapshot, 'access', _87 => _87.event, 'optionalAccess', _88 => _88.name]) === _chunk4KDMNSPJcjs.TOMBSTONE_EVENT)
|
|
1929
|
+
throw new (0, _chunk4KDMNSPJcjs.StreamClosedError)(stream);
|
|
1930
|
+
const expected = _nullishCoalesce(expectedVersion, () => ( snapshot.version));
|
|
1931
|
+
for (const { valid, description } of _nullishCoalesce(_optionalChain([me, 'access', _89 => _89.given, 'optionalAccess', _90 => _90[action2]]), () => ( [])))
|
|
1914
1932
|
if (!valid(snapshot.state, actor))
|
|
1915
|
-
throw new (0,
|
|
1933
|
+
throw new (0, _chunk4KDMNSPJcjs.InvariantError)(
|
|
1916
1934
|
action2,
|
|
1917
1935
|
validated,
|
|
1918
1936
|
target,
|
|
1919
1937
|
snapshot,
|
|
1920
1938
|
description
|
|
1921
1939
|
);
|
|
1922
|
-
for (const { holds, description } of _nullishCoalesce(_optionalChain([me, 'access',
|
|
1940
|
+
for (const { holds, description } of _nullishCoalesce(_optionalChain([me, 'access', _91 => _91.requires, 'optionalAccess', _92 => _92[action2]]), () => ( [])))
|
|
1923
1941
|
if (!holds(validated, snapshot.state, actor))
|
|
1924
|
-
throw new (0,
|
|
1942
|
+
throw new (0, _chunk4KDMNSPJcjs.PreconditionError)(
|
|
1925
1943
|
action2,
|
|
1926
1944
|
validated,
|
|
1927
1945
|
target,
|
|
@@ -1934,11 +1952,11 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1934
1952
|
const tuples = Array.isArray(result[0]) ? result : [result];
|
|
1935
1953
|
const events = tuples.map(([name, data]) => ({
|
|
1936
1954
|
name,
|
|
1937
|
-
data:
|
|
1955
|
+
data: _chunkF2YAA4SEcjs.validate.call(void 0, name, data, me.events[name])
|
|
1938
1956
|
}));
|
|
1939
1957
|
const emitted = events.map((e) => me.message(e));
|
|
1940
1958
|
const meta = {
|
|
1941
|
-
correlation: _optionalChain([reactingTo, 'optionalAccess',
|
|
1959
|
+
correlation: _optionalChain([reactingTo, 'optionalAccess', _93 => _93.meta, 'access', _94 => _94.correlation]) || correlator({
|
|
1942
1960
|
action: action2,
|
|
1943
1961
|
state: me.name,
|
|
1944
1962
|
stream,
|
|
@@ -1973,19 +1991,17 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1973
1991
|
patches++;
|
|
1974
1992
|
return { state: state2, patch: patch2, patches };
|
|
1975
1993
|
});
|
|
1976
|
-
check_invariants(
|
|
1994
|
+
check_invariants(
|
|
1995
|
+
`${me.name}.${action2}`,
|
|
1996
|
+
state2,
|
|
1997
|
+
me.state,
|
|
1998
|
+
me.pii_aware
|
|
1999
|
+
);
|
|
1977
2000
|
let committed;
|
|
1978
2001
|
try {
|
|
1979
|
-
committed = await
|
|
1980
|
-
stream,
|
|
1981
|
-
emitted,
|
|
1982
|
-
meta,
|
|
1983
|
-
// Reactions skip the inferred version guard (leases already
|
|
1984
|
-
// serialize them); an explicit expectedVersion is still honored.
|
|
1985
|
-
reactingTo ? expectedVersion : expected
|
|
1986
|
-
);
|
|
2002
|
+
committed = await _chunkF2YAA4SEcjs.store.call(void 0, ).commit(stream, emitted, meta, expected);
|
|
1987
2003
|
} catch (error) {
|
|
1988
|
-
if (error instanceof
|
|
2004
|
+
if (error instanceof _chunk4KDMNSPJcjs.ConcurrencyError) void cache_drop(stream);
|
|
1989
2005
|
throw error;
|
|
1990
2006
|
}
|
|
1991
2007
|
const snapshots = committed.map((row, i) => ({
|
|
@@ -2000,36 +2016,31 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
2000
2016
|
replayed: snapshot.replayed
|
|
2001
2017
|
}));
|
|
2002
2018
|
const last = snapshots.at(-1);
|
|
2003
|
-
const
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
patches: snap_event ? 0 : last.patches,
|
|
2014
|
-
snaps: snap_event ? last.snaps + 1 : last.snaps
|
|
2015
|
-
});
|
|
2016
|
-
else void cache_drop(stream);
|
|
2017
|
-
}
|
|
2019
|
+
const snap_event = _optionalChain([me, 'access', _95 => _95.snap, 'optionalCall', _96 => _96(last)]) ? await snap(last) : void 0;
|
|
2020
|
+
if (!me.pii_aware)
|
|
2021
|
+
void cache_put(stream, {
|
|
2022
|
+
stream,
|
|
2023
|
+
state: last.state,
|
|
2024
|
+
version: _nullishCoalesce(_optionalChain([snap_event, 'optionalAccess', _97 => _97.version]), () => ( last.event.version)),
|
|
2025
|
+
event_id: _nullishCoalesce(_optionalChain([snap_event, 'optionalAccess', _98 => _98.id]), () => ( last.event.id)),
|
|
2026
|
+
patches: snap_event ? 0 : last.patches,
|
|
2027
|
+
snaps: snap_event ? last.snaps + 1 : last.snaps
|
|
2028
|
+
});
|
|
2018
2029
|
return snapshots;
|
|
2019
2030
|
} catch (error) {
|
|
2020
|
-
if (!(error instanceof
|
|
2031
|
+
if (!(error instanceof _chunk4KDMNSPJcjs.ConcurrencyError)) throw error;
|
|
2021
2032
|
if (expectedVersion !== void 0) throw error;
|
|
2022
2033
|
if (attempt >= max_retries) throw error;
|
|
2023
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
2034
|
+
if (_optionalChain([opts, 'optionalAccess', _99 => _99.backoff])) {
|
|
2024
2035
|
const delay_ms = compute_backoff_delay(attempt, opts.backoff);
|
|
2025
|
-
if (delay_ms > 0) await
|
|
2036
|
+
if (delay_ms > 0) await _chunkF2YAA4SEcjs.sleep.call(void 0, delay_ms);
|
|
2026
2037
|
}
|
|
2027
2038
|
}
|
|
2028
2039
|
}
|
|
2029
2040
|
}
|
|
2030
2041
|
|
|
2031
2042
|
// src/internal/tracing.ts
|
|
2032
|
-
var PRETTY =
|
|
2043
|
+
var PRETTY = _chunkF2YAA4SEcjs.config.call(void 0, ).env !== "production";
|
|
2033
2044
|
var C_BLUE = "\x1B[38;5;39m";
|
|
2034
2045
|
var C_ORANGE = "\x1B[38;5;208m";
|
|
2035
2046
|
var C_GREEN = "\x1B[38;5;42m";
|
|
@@ -2075,9 +2086,9 @@ var as_of_marker = (asOf) => {
|
|
|
2075
2086
|
return parts.length ? ` (as-of ${parts.join(" ")})` : " (as-of)";
|
|
2076
2087
|
};
|
|
2077
2088
|
var traced = (inner, exit, entry) => (async (...args) => {
|
|
2078
|
-
_optionalChain([entry, 'optionalCall',
|
|
2089
|
+
_optionalChain([entry, 'optionalCall', _100 => _100(...args)]);
|
|
2079
2090
|
const result = await inner(...args);
|
|
2080
|
-
_optionalChain([exit, 'optionalCall',
|
|
2091
|
+
_optionalChain([exit, 'optionalCall', _101 => _101(result, ...args)]);
|
|
2081
2092
|
return result;
|
|
2082
2093
|
});
|
|
2083
2094
|
function build_es(logger, correlator = default_correlator, patch_fn = bare_patch) {
|
|
@@ -2162,7 +2173,7 @@ function build_drain(logger) {
|
|
|
2162
2173
|
subscribe: logger.level !== "trace" ? subscribe : traced(subscribe, (result, streams) => {
|
|
2163
2174
|
if (!result.subscribed) return;
|
|
2164
2175
|
const lanes = new Set(streams.map((s) => _nullishCoalesce(s.lane, () => ( "default"))));
|
|
2165
|
-
const uniform_lane = lanes.size === 1 ? _optionalChain([streams, 'access',
|
|
2176
|
+
const uniform_lane = lanes.size === 1 ? _optionalChain([streams, 'access', _102 => _102[0], 'optionalAccess', _103 => _103.lane]) : void 0;
|
|
2166
2177
|
const data = streams.map(
|
|
2167
2178
|
({ stream, lane }) => uniform_lane || !lane || lane === "default" ? hue(C_STREAM, stream) : `${hue(C_STREAM, stream)}${dim(`[${lane}]`)}`
|
|
2168
2179
|
).join(" ");
|
|
@@ -2174,7 +2185,7 @@ function build_drain(logger) {
|
|
|
2174
2185
|
}
|
|
2175
2186
|
function trace_cycle(logger, leased, fetched, handled, acked, blocked) {
|
|
2176
2187
|
if (logger.level !== "trace" || !leased.length) return;
|
|
2177
|
-
const lane = _optionalChain([leased, 'access',
|
|
2188
|
+
const lane = _optionalChain([leased, 'access', _104 => _104[0], 'optionalAccess', _105 => _105.lane]);
|
|
2178
2189
|
const fetch_by_stream = new Map(fetched.map((f) => [f.stream, f]));
|
|
2179
2190
|
const acked_by_stream = new Map(acked.map((a) => [a.stream, a.at]));
|
|
2180
2191
|
const blocked_by_stream = new Map(blocked.map((b) => [b.stream, b.error]));
|
|
@@ -2183,8 +2194,8 @@ function trace_cycle(logger, leased, fetched, handled, acked, blocked) {
|
|
|
2183
2194
|
);
|
|
2184
2195
|
const detail = leased.map(({ stream, at, retry }) => {
|
|
2185
2196
|
const f = fetch_by_stream.get(stream);
|
|
2186
|
-
const key = _optionalChain([f, 'optionalAccess',
|
|
2187
|
-
const events = _optionalChain([f, 'optionalAccess',
|
|
2197
|
+
const key = _optionalChain([f, 'optionalAccess', _106 => _106.source]) ? `${hue(C_STREAM, stream)}${dim(`<-${f.source}`)}` : hue(C_STREAM, stream);
|
|
2198
|
+
const events = _optionalChain([f, 'optionalAccess', _107 => _107.events, 'access', _108 => _108.length]) ? ` ${dim(
|
|
2188
2199
|
`[${f.events.map(({ id, name }) => `#${id} ${String(name)}`).join(", ")}]`
|
|
2189
2200
|
)}` : "";
|
|
2190
2201
|
const acked_at = acked_by_stream.get(stream);
|
|
@@ -2212,10 +2223,10 @@ function trace_cycle(logger, leased, fetched, handled, acked, blocked) {
|
|
|
2212
2223
|
|
|
2213
2224
|
// src/internal/drain-cycle.ts
|
|
2214
2225
|
function budget_exhausted(lease, options, store_failing) {
|
|
2215
|
-
if (store_failing || !_optionalChain([options, 'optionalAccess',
|
|
2226
|
+
if (store_failing || !_optionalChain([options, 'optionalAccess', _109 => _109.blockOnError]) || lease.retry <= options.maxRetries)
|
|
2216
2227
|
return void 0;
|
|
2217
2228
|
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.`;
|
|
2218
|
-
|
|
2229
|
+
_chunkF2YAA4SEcjs.log.call(void 0, ).error(error);
|
|
2219
2230
|
return { lease, handled: 0, acked_at: lease.at, error, block: true };
|
|
2220
2231
|
}
|
|
2221
2232
|
function fetch_failure_policy(registry) {
|
|
@@ -2231,13 +2242,13 @@ function fetch_failure_policy(registry) {
|
|
|
2231
2242
|
function finalize(lease, handled, at, error, options, logger, failed_at) {
|
|
2232
2243
|
if (!error) return { lease, handled, acked_at: at };
|
|
2233
2244
|
logger.error(error);
|
|
2234
|
-
const non_retryable = error instanceof
|
|
2245
|
+
const non_retryable = error instanceof _chunk4KDMNSPJcjs.NonRetryableError;
|
|
2235
2246
|
const block2 = options.blockOnError && (non_retryable || lease.retry >= options.maxRetries);
|
|
2236
2247
|
if (block2)
|
|
2237
2248
|
logger.error(
|
|
2238
2249
|
non_retryable ? `Blocking ${lease.stream} on non-retryable error.` : `Blocking ${lease.stream} after ${lease.retry} retries.`
|
|
2239
2250
|
);
|
|
2240
|
-
const next_attempt_at = block2 ? void 0 : Date.now() + compute_backoff_delay(lease.retry, _nullishCoalesce(options.backoff, () => (
|
|
2251
|
+
const next_attempt_at = block2 ? void 0 : Date.now() + compute_backoff_delay(lease.retry, _nullishCoalesce(options.backoff, () => ( _chunkF2YAA4SEcjs.DEFAULT_BACKOFF)));
|
|
2241
2252
|
return {
|
|
2242
2253
|
lease,
|
|
2243
2254
|
handled,
|
|
@@ -2276,7 +2287,7 @@ async function run_drain_cycle(deps, cycle) {
|
|
|
2276
2287
|
const fetched = await ops.fetch(leased, eventLimit);
|
|
2277
2288
|
const fetch_map = /* @__PURE__ */ new Map();
|
|
2278
2289
|
const fetch_window_at = fetched.reduce(
|
|
2279
|
-
(max, { at, events }) => Math.max(max, _optionalChain([events, 'access',
|
|
2290
|
+
(max, { at, events }) => Math.max(max, _optionalChain([events, 'access', _110 => _110.at, 'call', _111 => _111(-1), 'optionalAccess', _112 => _112.id]) || at),
|
|
2280
2291
|
0
|
|
2281
2292
|
);
|
|
2282
2293
|
for (const f of fetched) {
|
|
@@ -2340,11 +2351,11 @@ async function run_drain_cycle(deps, cycle) {
|
|
|
2340
2351
|
deps.logger
|
|
2341
2352
|
)
|
|
2342
2353
|
);
|
|
2343
|
-
const at = _optionalChain([entry, 'access',
|
|
2354
|
+
const at = _optionalChain([entry, 'access', _113 => _113.fetch, 'access', _114 => _114.events, 'access', _115 => _115.at, 'call', _116 => _116(-1), 'optionalAccess', _117 => _117.id]) || fetch_window_at;
|
|
2344
2355
|
const { payloads } = entry;
|
|
2345
2356
|
const exhausted = budget_exhausted(
|
|
2346
2357
|
lease,
|
|
2347
|
-
_optionalChain([payloads, 'access',
|
|
2358
|
+
_optionalChain([payloads, 'access', _118 => _118[0], 'optionalAccess', _119 => _119.options]),
|
|
2348
2359
|
store_failing
|
|
2349
2360
|
);
|
|
2350
2361
|
if (exhausted) return Promise.resolve(exhausted);
|
|
@@ -2365,7 +2376,7 @@ async function run_drain_cycle(deps, cycle) {
|
|
|
2365
2376
|
const acked = submitted.length ? await ops.ack(submitted) : [];
|
|
2366
2377
|
const expected = submitted.filter((l) => l.due === void 0).length;
|
|
2367
2378
|
if (acked.length < expected)
|
|
2368
|
-
|
|
2379
|
+
_chunkF2YAA4SEcjs.log.call(void 0, ).warn(
|
|
2369
2380
|
`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.`
|
|
2370
2381
|
);
|
|
2371
2382
|
const closeable = handled.filter((h) => h.close !== void 0).map((h) => h.close);
|
|
@@ -2433,7 +2444,7 @@ var DrainController = (_class5 = class {
|
|
|
2433
2444
|
}
|
|
2434
2445
|
/** This lane's configured lease, or `undefined`; the shutdown grace basis. */
|
|
2435
2446
|
get lease_millis() {
|
|
2436
|
-
return _optionalChain([this, 'access',
|
|
2447
|
+
return _optionalChain([this, 'access', _120 => _120._deps, 'access', _121 => _121.defaults, 'optionalAccess', _122 => _122.leaseMillis]);
|
|
2437
2448
|
}
|
|
2438
2449
|
get lane() {
|
|
2439
2450
|
return this._deps.lane;
|
|
@@ -2465,9 +2476,9 @@ var DrainController = (_class5 = class {
|
|
|
2465
2476
|
if (!this.armed || this._stopped || this._inflight)
|
|
2466
2477
|
return EMPTY_DRAIN;
|
|
2467
2478
|
const d = _nullishCoalesce(this._deps.defaults, () => ( {}));
|
|
2468
|
-
const streamLimit = _nullishCoalesce(_nullishCoalesce(d.streamLimit, () => ( options.streamLimit)), () => (
|
|
2469
|
-
const eventLimit = _nullishCoalesce(options.eventLimit, () => (
|
|
2470
|
-
const leaseMillis = _nullishCoalesce(_nullishCoalesce(d.leaseMillis, () => ( options.leaseMillis)), () => (
|
|
2479
|
+
const streamLimit = _nullishCoalesce(_nullishCoalesce(d.streamLimit, () => ( options.streamLimit)), () => ( _chunkF2YAA4SEcjs.DEFAULT_STREAM_LIMIT));
|
|
2480
|
+
const eventLimit = _nullishCoalesce(options.eventLimit, () => ( _chunkF2YAA4SEcjs.DEFAULT_EVENT_LIMIT));
|
|
2481
|
+
const leaseMillis = _nullishCoalesce(_nullishCoalesce(d.leaseMillis, () => ( options.leaseMillis)), () => ( _chunkF2YAA4SEcjs.DEFAULT_LEASE_MILLIS));
|
|
2471
2482
|
if (this._deps.breaker.state(Date.now()) === "open")
|
|
2472
2483
|
return EMPTY_DRAIN;
|
|
2473
2484
|
const pass = this._pass(streamLimit, eventLimit, leaseMillis).finally(
|
|
@@ -2542,7 +2553,7 @@ function pii_gate(event, fields, predicate, actor) {
|
|
|
2542
2553
|
const { pii, ...rest } = event;
|
|
2543
2554
|
if (pii == null) {
|
|
2544
2555
|
const shredded = { ...data };
|
|
2545
|
-
for (const f of fields) shredded[f] =
|
|
2556
|
+
for (const f of fields) shredded[f] = _chunk4KDMNSPJcjs.SHREDDED;
|
|
2546
2557
|
return { ...rest, data: shredded };
|
|
2547
2558
|
}
|
|
2548
2559
|
const allowed = !!actor && !!predicate && predicate(event, actor);
|
|
@@ -2553,7 +2564,7 @@ function pii_gate(event, fields, predicate, actor) {
|
|
|
2553
2564
|
};
|
|
2554
2565
|
}
|
|
2555
2566
|
const redacted = { ...data };
|
|
2556
|
-
for (const f of fields) redacted[f] =
|
|
2567
|
+
for (const f of fields) redacted[f] = _chunk4KDMNSPJcjs.REDACTED;
|
|
2557
2568
|
return { ...rest, data: redacted };
|
|
2558
2569
|
}
|
|
2559
2570
|
var IDENTITY_GATE = (event) => event;
|
|
@@ -2690,7 +2701,7 @@ function make_deferred(handler, schedule) {
|
|
|
2690
2701
|
const call = handler;
|
|
2691
2702
|
const deferred = async (event, stream, app) => {
|
|
2692
2703
|
const when = typeof schedule === "function" ? schedule(event) : schedule;
|
|
2693
|
-
if (Date.now() < resolve_defer_at(when, event)) throw new (0,
|
|
2704
|
+
if (Date.now() < resolve_defer_at(when, event)) throw new (0, _chunk4KDMNSPJcjs.DeferSignal)(when);
|
|
2694
2705
|
return call(event, stream, app);
|
|
2695
2706
|
};
|
|
2696
2707
|
Object.defineProperty(deferred, "name", { value: handler.name });
|
|
@@ -2726,10 +2737,10 @@ var CloseSignal = class extends Error {
|
|
|
2726
2737
|
constructor(opts) {
|
|
2727
2738
|
super("reaction requested close");
|
|
2728
2739
|
this.name = "CloseSignal";
|
|
2729
|
-
this.stream = _optionalChain([opts, 'optionalAccess',
|
|
2730
|
-
this.archive = _optionalChain([opts, 'optionalAccess',
|
|
2731
|
-
this.at = _optionalChain([opts, 'optionalAccess',
|
|
2732
|
-
this.before = _optionalChain([opts, 'optionalAccess',
|
|
2740
|
+
this.stream = _optionalChain([opts, 'optionalAccess', _123 => _123.stream]);
|
|
2741
|
+
this.archive = _optionalChain([opts, 'optionalAccess', _124 => _124.archive]);
|
|
2742
|
+
this.at = _optionalChain([opts, 'optionalAccess', _125 => _125.at]);
|
|
2743
|
+
this.before = _optionalChain([opts, 'optionalAccess', _126 => _126.before]);
|
|
2733
2744
|
}
|
|
2734
2745
|
};
|
|
2735
2746
|
function build_handle(deps) {
|
|
@@ -2759,7 +2770,7 @@ function build_handle(deps) {
|
|
|
2759
2770
|
handled++;
|
|
2760
2771
|
}
|
|
2761
2772
|
} catch (error) {
|
|
2762
|
-
if (error instanceof
|
|
2773
|
+
if (error instanceof _chunk4KDMNSPJcjs.DeferSignal) {
|
|
2763
2774
|
let defer;
|
|
2764
2775
|
try {
|
|
2765
2776
|
defer = resolve_defer_at(error.when, event);
|
|
@@ -2876,7 +2887,7 @@ var SettleLoop = (_class6 = class {
|
|
|
2876
2887
|
this._pending = true;
|
|
2877
2888
|
return;
|
|
2878
2889
|
}
|
|
2879
|
-
const delay = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
2890
|
+
const delay = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _127 => _127.debounceMs]), () => ( this._default_debounce_ms));
|
|
2880
2891
|
const due = Date.now() + delay;
|
|
2881
2892
|
if (this._timer) {
|
|
2882
2893
|
if (due >= this._due) return;
|
|
@@ -3023,7 +3034,7 @@ var Act = (_class7 = class {
|
|
|
3023
3034
|
/** Lanes to arm per event; `"all"` when a dynamic resolver hides the lane. */
|
|
3024
3035
|
|
|
3025
3036
|
|
|
3026
|
-
__init27() {this._logger =
|
|
3037
|
+
__init27() {this._logger = _chunkF2YAA4SEcjs.log.call(void 0, )}
|
|
3027
3038
|
/** This Act's ports: its own bag, or the singleton adapters. */
|
|
3028
3039
|
|
|
3029
3040
|
/** Runs a body so internal `store()`/`cache()` calls resolve to `_ports`. */
|
|
@@ -3045,9 +3056,9 @@ var Act = (_class7 = class {
|
|
|
3045
3056
|
this._lanes = lanes;
|
|
3046
3057
|
this._declared_lanes = ["default", ...lanes.map((l) => l.name)];
|
|
3047
3058
|
validate_only_lanes(options.onlyLanes, this._declared_lanes);
|
|
3048
|
-
this._ports = _nullishCoalesce(options.scoped, () => (
|
|
3059
|
+
this._ports = _nullishCoalesce(options.scoped, () => ( _chunkF2YAA4SEcjs.default_scope.call(void 0, )));
|
|
3049
3060
|
const ports = this._ports;
|
|
3050
|
-
this._scoped =
|
|
3061
|
+
this._scoped = _chunkF2YAA4SEcjs.make_run_scoped.call(void 0, {
|
|
3051
3062
|
// Getters, not a spread: the singletons resolve lazily, so a later
|
|
3052
3063
|
// `store(...)` / `cache(...)` still takes effect.
|
|
3053
3064
|
get store() {
|
|
@@ -3057,14 +3068,14 @@ var Act = (_class7 = class {
|
|
|
3057
3068
|
return ports.cache;
|
|
3058
3069
|
},
|
|
3059
3070
|
// Parsed per build, so a bad window throws on every build.
|
|
3060
|
-
autoclose_window:
|
|
3071
|
+
autoclose_window: _chunkF2YAA4SEcjs.resolveAutocloseConfig.call(void 0, options).autocloseWindow
|
|
3061
3072
|
});
|
|
3062
3073
|
this._correlator = _nullishCoalesce(options.correlator, () => ( default_correlator));
|
|
3063
3074
|
this._es = build_es(this._logger, this._correlator, patch_fn);
|
|
3064
3075
|
this._cd = build_drain(this._logger);
|
|
3065
3076
|
const handle = build_handle({
|
|
3066
3077
|
logger: this._logger,
|
|
3067
|
-
reaction_scope:
|
|
3078
|
+
reaction_scope: _chunkF2YAA4SEcjs.make_reaction_scope.call(void 0, {
|
|
3068
3079
|
do: this.do.bind(this),
|
|
3069
3080
|
load: this.load.bind(this),
|
|
3070
3081
|
query: this.query.bind(this),
|
|
@@ -3094,12 +3105,12 @@ var Act = (_class7 = class {
|
|
|
3094
3105
|
this._ports.store,
|
|
3095
3106
|
options.listen !== false
|
|
3096
3107
|
);
|
|
3097
|
-
|
|
3108
|
+
_chunkF2YAA4SEcjs.register_weak_disposer.call(void 0, new WeakRef(this), (self) => self.shutdown());
|
|
3098
3109
|
}
|
|
3099
3110
|
/** Shared by drain, settle and autoclose; bad knobs throw at build. */
|
|
3100
3111
|
_build_breaker(options) {
|
|
3101
3112
|
return new CircuitBreaker(
|
|
3102
|
-
|
|
3113
|
+
_chunkF2YAA4SEcjs.resolveCircuitBreakerConfig.call(void 0, options.circuitBreaker),
|
|
3103
3114
|
{
|
|
3104
3115
|
on_error: (error, circuit) => this._emit_error(error, circuit),
|
|
3105
3116
|
// When the cooldown elapses, settle once: its scan or claim is the
|
|
@@ -3111,7 +3122,7 @@ var Act = (_class7 = class {
|
|
|
3111
3122
|
/** Apps that declare no lanes pass no lane filter to `claim`. */
|
|
3112
3123
|
_build_drain_controllers(options, lanes, handle, handle_batch) {
|
|
3113
3124
|
const all_lanes = this._declared_lanes;
|
|
3114
|
-
const only_set = _optionalChain([options, 'access',
|
|
3125
|
+
const only_set = _optionalChain([options, 'access', _128 => _128.onlyLanes, 'optionalAccess', _129 => _129.length]) ? new Set(options.onlyLanes) : void 0;
|
|
3115
3126
|
const active_lanes = only_set ? all_lanes.filter((n) => only_set.has(n)) : all_lanes;
|
|
3116
3127
|
const single_default_lane = lanes.length === 0;
|
|
3117
3128
|
const controllers = /* @__PURE__ */ new Map();
|
|
@@ -3133,7 +3144,7 @@ var Act = (_class7 = class {
|
|
|
3133
3144
|
try {
|
|
3134
3145
|
await this._run_close(targets);
|
|
3135
3146
|
} catch (error) {
|
|
3136
|
-
if (error instanceof
|
|
3147
|
+
if (error instanceof _chunk4KDMNSPJcjs.StoreError) throw error;
|
|
3137
3148
|
this._logger.error(
|
|
3138
3149
|
error,
|
|
3139
3150
|
`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.`
|
|
@@ -3148,7 +3159,7 @@ var Act = (_class7 = class {
|
|
|
3148
3159
|
leaseMillis: cfg.leaseMillis
|
|
3149
3160
|
}
|
|
3150
3161
|
});
|
|
3151
|
-
if (_optionalChain([cfg, 'optionalAccess',
|
|
3162
|
+
if (_optionalChain([cfg, 'optionalAccess', _130 => _130.cycleMs]) !== void 0 && this._drain)
|
|
3152
3163
|
controller.start(cfg.cycleMs);
|
|
3153
3164
|
controllers.set(name, controller);
|
|
3154
3165
|
}
|
|
@@ -3167,7 +3178,7 @@ var Act = (_class7 = class {
|
|
|
3167
3178
|
/** Audit deps, built after the controllers so the lane set is final. */
|
|
3168
3179
|
_build_audit_deps() {
|
|
3169
3180
|
return {
|
|
3170
|
-
store:
|
|
3181
|
+
store: _chunkF2YAA4SEcjs.store,
|
|
3171
3182
|
event_to_state: this._event_to_state,
|
|
3172
3183
|
// Declared lanes, not this process's controllers: a lane another
|
|
3173
3184
|
// worker drains is not `unknown-lane`.
|
|
@@ -3180,7 +3191,7 @@ var Act = (_class7 = class {
|
|
|
3180
3191
|
registry: this.registry,
|
|
3181
3192
|
static_targets: classification.static_targets,
|
|
3182
3193
|
cd: this._cd,
|
|
3183
|
-
max_subscribed_streams: _nullishCoalesce(options.maxSubscribedStreams, () => (
|
|
3194
|
+
max_subscribed_streams: _nullishCoalesce(options.maxSubscribedStreams, () => ( _chunk4KDMNSPJcjs.DEFAULT_MAX_SUBSCRIBED_STREAMS)),
|
|
3184
3195
|
// Declared lanes (not active ones): a lane another process claims is
|
|
3185
3196
|
// still a valid destination.
|
|
3186
3197
|
declared_lanes: new Set(this._declared_lanes),
|
|
@@ -3196,10 +3207,10 @@ var Act = (_class7 = class {
|
|
|
3196
3207
|
/** Cold start: an idle deferred stream still fires on time after a restart. */
|
|
3197
3208
|
async _seed_persisted_defers() {
|
|
3198
3209
|
const now = Date.now();
|
|
3199
|
-
await walk_streams(
|
|
3210
|
+
await walk_streams(_chunkF2YAA4SEcjs.store.call(void 0, ), (pos) => {
|
|
3200
3211
|
if (pos.deferred_at === void 0 || pos.deferred_at <= now) return;
|
|
3201
3212
|
const controller = this._drain_controllers.get(_nullishCoalesce(pos.lane, () => ( "default")));
|
|
3202
|
-
_optionalChain([controller, 'optionalAccess',
|
|
3213
|
+
_optionalChain([controller, 'optionalAccess', _131 => _131.seed_defer, 'call', _132 => _132(pos.stream, pos.deferred_at)]);
|
|
3203
3214
|
});
|
|
3204
3215
|
}
|
|
3205
3216
|
_build_settle(options) {
|
|
@@ -3212,7 +3223,7 @@ var Act = (_class7 = class {
|
|
|
3212
3223
|
on_settled: (drain) => this.emit("settled", drain),
|
|
3213
3224
|
breaker: this._breaker
|
|
3214
3225
|
},
|
|
3215
|
-
_nullishCoalesce(options.settleDebounceMs, () => (
|
|
3226
|
+
_nullishCoalesce(options.settleDebounceMs, () => ( _chunk4KDMNSPJcjs.DEFAULT_SETTLE_DEBOUNCE_MS))
|
|
3216
3227
|
);
|
|
3217
3228
|
}
|
|
3218
3229
|
|
|
@@ -3232,7 +3243,7 @@ var Act = (_class7 = class {
|
|
|
3232
3243
|
*/
|
|
3233
3244
|
shutdown(options) {
|
|
3234
3245
|
if (!this._shutdown_promise) {
|
|
3235
|
-
|
|
3246
|
+
_chunkF2YAA4SEcjs.resolveShutdownConfig.call(void 0, options);
|
|
3236
3247
|
this._shutdown_promise = (async () => {
|
|
3237
3248
|
this.stop_correlations();
|
|
3238
3249
|
this._settle.stop(true);
|
|
@@ -3240,7 +3251,7 @@ var Act = (_class7 = class {
|
|
|
3240
3251
|
for (const c of this._drain_controllers.values()) c.stop();
|
|
3241
3252
|
const disposer = await this._notify_disposer;
|
|
3242
3253
|
if (disposer) await disposer();
|
|
3243
|
-
await this._await_inflight(_optionalChain([options, 'optionalAccess',
|
|
3254
|
+
await this._await_inflight(_optionalChain([options, 'optionalAccess', _133 => _133.graceMs]));
|
|
3244
3255
|
await this._scoped(() => this._correlate.release_correlation());
|
|
3245
3256
|
this._emitter.removeAllListeners();
|
|
3246
3257
|
})();
|
|
@@ -3252,10 +3263,10 @@ var Act = (_class7 = class {
|
|
|
3252
3263
|
* default for none or 0, and for a running settle), capped.
|
|
3253
3264
|
*/
|
|
3254
3265
|
_derive_grace_ms(running, settling) {
|
|
3255
|
-
let max = settling ?
|
|
3266
|
+
let max = settling ? _chunkF2YAA4SEcjs.DEFAULT_LEASE_MILLIS : 0;
|
|
3256
3267
|
for (const c of running)
|
|
3257
|
-
max = Math.max(max, c.lease_millis ||
|
|
3258
|
-
return Math.min(max,
|
|
3268
|
+
max = Math.max(max, c.lease_millis || _chunkF2YAA4SEcjs.DEFAULT_LEASE_MILLIS);
|
|
3269
|
+
return Math.min(max, _chunkF2YAA4SEcjs.MAX_SHUTDOWN_GRACE_MS);
|
|
3259
3270
|
}
|
|
3260
3271
|
async _await_inflight(grace_ms) {
|
|
3261
3272
|
const running = [...this._drain_controllers.values()].filter(
|
|
@@ -3338,8 +3349,8 @@ var Act = (_class7 = class {
|
|
|
3338
3349
|
* @see {@link ValidationError}, {@link PreconditionError}, {@link ConcurrencyError}
|
|
3339
3350
|
*/
|
|
3340
3351
|
async do(action2, target, payload, options) {
|
|
3341
|
-
const reacting_to = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
3342
|
-
const do_options = reacting_to === _optionalChain([options, 'optionalAccess',
|
|
3352
|
+
const reacting_to = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _134 => _134.reactingTo]), () => ( _chunkF2YAA4SEcjs.current_reacting.call(void 0, )));
|
|
3353
|
+
const do_options = reacting_to === _optionalChain([options, 'optionalAccess', _135 => _135.reactingTo]) ? options : { ...options, reactingTo: reacting_to };
|
|
3343
3354
|
return this._scoped(async () => {
|
|
3344
3355
|
const snapshots = await this._es.action(
|
|
3345
3356
|
this.registry.actions[action2],
|
|
@@ -3399,11 +3410,11 @@ var Act = (_class7 = class {
|
|
|
3399
3410
|
return this._scoped(async () => {
|
|
3400
3411
|
let first;
|
|
3401
3412
|
let last;
|
|
3402
|
-
const count = await
|
|
3413
|
+
const count = await _chunkF2YAA4SEcjs.store.call(void 0, ).query((e) => {
|
|
3403
3414
|
const gated = this.registry.query_gate(e.name)(e);
|
|
3404
3415
|
if (!first) first = gated;
|
|
3405
3416
|
last = gated;
|
|
3406
|
-
_optionalChain([callback, 'optionalCall',
|
|
3417
|
+
_optionalChain([callback, 'optionalCall', _136 => _136(gated)]);
|
|
3407
3418
|
}, query);
|
|
3408
3419
|
return { first, last, count };
|
|
3409
3420
|
});
|
|
@@ -3429,7 +3440,7 @@ var Act = (_class7 = class {
|
|
|
3429
3440
|
async query_array(query) {
|
|
3430
3441
|
return this._scoped(async () => {
|
|
3431
3442
|
const events = [];
|
|
3432
|
-
await
|
|
3443
|
+
await _chunkF2YAA4SEcjs.store.call(void 0, ).query((e) => {
|
|
3433
3444
|
events.push(this.registry.query_gate(e.name)(e));
|
|
3434
3445
|
}, query);
|
|
3435
3446
|
return events;
|
|
@@ -3449,14 +3460,14 @@ var Act = (_class7 = class {
|
|
|
3449
3460
|
*/
|
|
3450
3461
|
async forget(stream) {
|
|
3451
3462
|
return this._scoped(async () => {
|
|
3452
|
-
const s =
|
|
3463
|
+
const s = _chunkF2YAA4SEcjs.store.call(void 0, );
|
|
3453
3464
|
if (!s.forget_pii) {
|
|
3454
3465
|
throw new Error(
|
|
3455
3466
|
`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).`
|
|
3456
3467
|
);
|
|
3457
3468
|
}
|
|
3458
3469
|
const eventCount = await s.forget_pii(stream);
|
|
3459
|
-
await
|
|
3470
|
+
await _chunkF2YAA4SEcjs.cache.call(void 0, ).invalidate(stream);
|
|
3460
3471
|
if (eventCount > 0) {
|
|
3461
3472
|
this.emit("forgotten", { stream, at: /* @__PURE__ */ new Date(), eventCount });
|
|
3462
3473
|
}
|
|
@@ -3490,7 +3501,7 @@ var Act = (_class7 = class {
|
|
|
3490
3501
|
* @see {@link correlate} for dynamic stream discovery
|
|
3491
3502
|
*/
|
|
3492
3503
|
async drain(options = {}) {
|
|
3493
|
-
|
|
3504
|
+
_chunkF2YAA4SEcjs.resolveDrainConfig.call(void 0, options);
|
|
3494
3505
|
if (!this._drain)
|
|
3495
3506
|
return { fetched: [], leased: [], acked: [], blocked: [] };
|
|
3496
3507
|
return this._scoped(() => this._drain_all(options));
|
|
@@ -3530,7 +3541,7 @@ var Act = (_class7 = class {
|
|
|
3530
3541
|
}
|
|
3531
3542
|
if (to_arm.size === 0) return false;
|
|
3532
3543
|
this._correlate.arm();
|
|
3533
|
-
for (const lane of to_arm) _optionalChain([this, 'access',
|
|
3544
|
+
for (const lane of to_arm) _optionalChain([this, 'access', _137 => _137._drain_controllers, 'access', _138 => _138.get, 'call', _139 => _139(lane), 'optionalAccess', _140 => _140.arm, 'call', _141 => _141()]);
|
|
3534
3545
|
return true;
|
|
3535
3546
|
}
|
|
3536
3547
|
/** In parallel, so a slow lane never holds up a fast one. */
|
|
@@ -3672,9 +3683,9 @@ var Act = (_class7 = class {
|
|
|
3672
3683
|
*/
|
|
3673
3684
|
async reset(input) {
|
|
3674
3685
|
return this._scoped(async () => {
|
|
3675
|
-
const count = await
|
|
3686
|
+
const count = await _chunkF2YAA4SEcjs.store.call(void 0, ).reset(input);
|
|
3676
3687
|
for (const handler of this._batch_handlers.values())
|
|
3677
|
-
_optionalChain([handler, 'access',
|
|
3688
|
+
_optionalChain([handler, 'access', _142 => _142[FOLD_RESET], 'optionalCall', _143 => _143()]);
|
|
3678
3689
|
if (count > 0) {
|
|
3679
3690
|
this._wake();
|
|
3680
3691
|
}
|
|
@@ -3708,7 +3719,7 @@ var Act = (_class7 = class {
|
|
|
3708
3719
|
*/
|
|
3709
3720
|
async unblock(input) {
|
|
3710
3721
|
return this._scoped(async () => {
|
|
3711
|
-
const count = await
|
|
3722
|
+
const count = await _chunkF2YAA4SEcjs.store.call(void 0, ).unblock(input);
|
|
3712
3723
|
if (count > 0) {
|
|
3713
3724
|
this._wake();
|
|
3714
3725
|
}
|
|
@@ -3763,7 +3774,7 @@ var Act = (_class7 = class {
|
|
|
3763
3774
|
return { ...partial, duration_ms: Date.now() - started };
|
|
3764
3775
|
}
|
|
3765
3776
|
const target = _nullishCoalesce(sink, () => ( (() => {
|
|
3766
|
-
const s =
|
|
3777
|
+
const s = _chunkF2YAA4SEcjs.store.call(void 0, );
|
|
3767
3778
|
if (!s.restore) throw new Error("adapter has no restore capability");
|
|
3768
3779
|
return s;
|
|
3769
3780
|
})()));
|
|
@@ -3809,11 +3820,11 @@ var Act = (_class7 = class {
|
|
|
3809
3820
|
async blocked_streams(options) {
|
|
3810
3821
|
return this._scoped(async () => {
|
|
3811
3822
|
const positions = [];
|
|
3812
|
-
await
|
|
3823
|
+
await _chunkF2YAA4SEcjs.store.call(void 0, ).query_streams(
|
|
3813
3824
|
(p) => {
|
|
3814
3825
|
positions.push(p);
|
|
3815
3826
|
},
|
|
3816
|
-
{ blocked: true, after: _optionalChain([options, 'optionalAccess',
|
|
3827
|
+
{ blocked: true, after: _optionalChain([options, 'optionalAccess', _144 => _144.after]), limit: _optionalChain([options, 'optionalAccess', _145 => _145.limit]) }
|
|
3817
3828
|
);
|
|
3818
3829
|
return positions;
|
|
3819
3830
|
});
|
|
@@ -3861,7 +3872,7 @@ var Act = (_class7 = class {
|
|
|
3861
3872
|
* @see {@link Store.prioritize} for the underlying primitive
|
|
3862
3873
|
*/
|
|
3863
3874
|
async prioritize(filter, priority) {
|
|
3864
|
-
return this._scoped(() =>
|
|
3875
|
+
return this._scoped(() => _chunkF2YAA4SEcjs.store.call(void 0, ).prioritize(filter, priority));
|
|
3865
3876
|
}
|
|
3866
3877
|
/** Shared by `close()` and reaction-requested closes. */
|
|
3867
3878
|
async _run_close(targets) {
|
|
@@ -3941,7 +3952,7 @@ var Act = (_class7 = class {
|
|
|
3941
3952
|
* @see {@link correlate} for manual correlation
|
|
3942
3953
|
*/
|
|
3943
3954
|
settle(options) {
|
|
3944
|
-
|
|
3955
|
+
_chunkF2YAA4SEcjs.resolveSettleConfig.call(void 0, _nullishCoalesce(options, () => ( {})));
|
|
3945
3956
|
this._schedule(options);
|
|
3946
3957
|
}
|
|
3947
3958
|
}, _class7);
|
|
@@ -4007,12 +4018,12 @@ function policy_min_after_days(options) {
|
|
|
4007
4018
|
const parsed = AutoclosePolicySchema.parse(options);
|
|
4008
4019
|
const windows = [];
|
|
4009
4020
|
if (parsed.after) windows.push(parsed.after.days);
|
|
4010
|
-
if (_optionalChain([parsed, 'access',
|
|
4021
|
+
if (_optionalChain([parsed, 'access', _146 => _146.or, 'optionalAccess', _147 => _147.after])) windows.push(parsed.or.after.days);
|
|
4011
4022
|
return windows.length ? Math.min(...windows) : void 0;
|
|
4012
4023
|
}
|
|
4013
4024
|
function policy_keep_days(options) {
|
|
4014
4025
|
const parsed = AutoclosePolicySchema.parse(options);
|
|
4015
|
-
return _optionalChain([parsed, 'access',
|
|
4026
|
+
return _optionalChain([parsed, 'access', _148 => _148.keep, 'optionalAccess', _149 => _149.days]);
|
|
4016
4027
|
}
|
|
4017
4028
|
function compile_autoclose_policy(options) {
|
|
4018
4029
|
const parsed = AutoclosePolicySchema.parse(options);
|
|
@@ -4044,7 +4055,7 @@ function hour_in_zone(now, timeZone) {
|
|
|
4044
4055
|
hour: "2-digit",
|
|
4045
4056
|
hourCycle: "h23"
|
|
4046
4057
|
}).formatToParts(now);
|
|
4047
|
-
return Number(_optionalChain([parts, 'access',
|
|
4058
|
+
return Number(_optionalChain([parts, 'access', _150 => _150.find, 'call', _151 => _151((p) => p.type === "hour"), 'optionalAccess', _152 => _152.value]));
|
|
4048
4059
|
}
|
|
4049
4060
|
function hour_in_range(hour, start, end) {
|
|
4050
4061
|
return start < end ? hour >= start && hour < end : hour >= start || hour < end;
|
|
@@ -4097,16 +4108,16 @@ function synthesize_autoclose_reactions(registry, states, read_window) {
|
|
|
4097
4108
|
}),
|
|
4098
4109
|
// Never block on autoclose: a transient query/store error should retry,
|
|
4099
4110
|
// not quarantine the synthetic stream.
|
|
4100
|
-
options: { blockOnError: false, maxRetries:
|
|
4111
|
+
options: { blockOnError: false, maxRetries: _chunkF2YAA4SEcjs.DEFAULT_MAX_RETRIES },
|
|
4101
4112
|
handler: async (event) => {
|
|
4102
4113
|
const aggregate = event.stream;
|
|
4103
4114
|
const window = read_window();
|
|
4104
4115
|
if (!in_autoclose_window(window, /* @__PURE__ */ new Date()))
|
|
4105
|
-
throw new (0,
|
|
4106
|
-
const stats = await
|
|
4116
|
+
throw new (0, _chunk4KDMNSPJcjs.DeferSignal)({ at: next_window_open(window, /* @__PURE__ */ new Date()) });
|
|
4117
|
+
const stats = await _chunkF2YAA4SEcjs.store.call(void 0, ).query_stats([aggregate], {
|
|
4107
4118
|
count: true,
|
|
4108
4119
|
tail: keep_days !== void 0 ? true : void 0,
|
|
4109
|
-
exclude: [
|
|
4120
|
+
exclude: [_chunk4KDMNSPJcjs.TOMBSTONE_EVENT, _chunk4KDMNSPJcjs.SNAP_EVENT]
|
|
4110
4121
|
});
|
|
4111
4122
|
const entry = stats.get(aggregate);
|
|
4112
4123
|
if (!entry) return;
|
|
@@ -4137,12 +4148,12 @@ function synthesize_autoclose_reactions(registry, states, read_window) {
|
|
|
4137
4148
|
dues.push(days_after(entry.tail.created, keep_days));
|
|
4138
4149
|
const future = dues.map((d) => d.getTime()).filter((t) => t > Date.now());
|
|
4139
4150
|
if (future.length)
|
|
4140
|
-
throw new (0,
|
|
4151
|
+
throw new (0, _chunk4KDMNSPJcjs.DeferSignal)({ at: new Date(Math.min(...future)) });
|
|
4141
4152
|
}
|
|
4142
4153
|
};
|
|
4143
4154
|
const key = `__autoclose_${st.name}`;
|
|
4144
4155
|
for (const event_name of Object.keys(st.events)) {
|
|
4145
|
-
_optionalChain([registry, 'access',
|
|
4156
|
+
_optionalChain([registry, 'access', _153 => _153.events, 'access', _154 => _154[event_name], 'optionalAccess', _155 => _155.reactions, 'access', _156 => _156.set, 'call', _157 => _157(
|
|
4146
4157
|
key,
|
|
4147
4158
|
reaction
|
|
4148
4159
|
)]);
|
|
@@ -4342,9 +4353,9 @@ var _this_ = ({ stream }) => ({
|
|
|
4342
4353
|
|
|
4343
4354
|
// src/builders/builder-utils.ts
|
|
4344
4355
|
function register_lane(config2, lanes) {
|
|
4345
|
-
|
|
4346
|
-
if (config2.name ===
|
|
4347
|
-
throw new Error(`Lane "${
|
|
4356
|
+
_chunkF2YAA4SEcjs.resolveLaneConfig.call(void 0, config2);
|
|
4357
|
+
if (config2.name === _chunk4KDMNSPJcjs.DEFAULT_LANE)
|
|
4358
|
+
throw new Error(`Lane "${_chunk4KDMNSPJcjs.DEFAULT_LANE}" is reserved`);
|
|
4348
4359
|
const existing = lanes.find((l) => l.name === config2.name);
|
|
4349
4360
|
if (!existing) return void lanes.push(config2);
|
|
4350
4361
|
if (existing.leaseMillis !== config2.leaseMillis || existing.streamLimit !== config2.streamLimit || existing.cycleMs !== config2.cycleMs)
|
|
@@ -4386,10 +4397,10 @@ function reaction_on(event, events, builder) {
|
|
|
4386
4397
|
// Validate the whole bag at the declaration site so a bad
|
|
4387
4398
|
// `maxRetries`/`backoff`/`blockOnError` throws ZodError at build,
|
|
4388
4399
|
// not a NaN gate on the first retry.
|
|
4389
|
-
options:
|
|
4390
|
-
blockOnError: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
4391
|
-
maxRetries: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
4392
|
-
backoff: _optionalChain([options, 'optionalAccess',
|
|
4400
|
+
options: _chunkF2YAA4SEcjs.resolveReactionConfig.call(void 0, {
|
|
4401
|
+
blockOnError: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _158 => _158.blockOnError]), () => ( _chunkF2YAA4SEcjs.DEFAULT_BLOCK_ON_ERROR)),
|
|
4402
|
+
maxRetries: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _159 => _159.maxRetries]), () => ( _chunkF2YAA4SEcjs.DEFAULT_MAX_RETRIES)),
|
|
4403
|
+
backoff: _optionalChain([options, 'optionalAccess', _160 => _160.backoff])
|
|
4393
4404
|
})
|
|
4394
4405
|
};
|
|
4395
4406
|
},
|
|
@@ -4408,9 +4419,9 @@ function reaction_on(event, events, builder) {
|
|
|
4408
4419
|
|
|
4409
4420
|
// src/internal/date-reviver.ts
|
|
4410
4421
|
|
|
4411
|
-
var def_of = (schema) => _nullishCoalesce(_optionalChain([schema, 'access',
|
|
4422
|
+
var def_of = (schema) => _nullishCoalesce(_optionalChain([schema, 'access', _161 => _161._zod, 'optionalAccess', _162 => _162.def]), () => ( schema.def));
|
|
4412
4423
|
function variant_schema(schema) {
|
|
4413
|
-
const shape = _optionalChain([def_of, 'call',
|
|
4424
|
+
const shape = _optionalChain([def_of, 'call', _163 => _163(schema), 'optionalAccess', _164 => _164.shape]);
|
|
4414
4425
|
if (!shape) {
|
|
4415
4426
|
const dates = date_reviver_schema(schema);
|
|
4416
4427
|
return { schema: _nullishCoalesce(dates, () => ( schema)), dated: !!dates };
|
|
@@ -4458,7 +4469,7 @@ function date_reviver_schema(schema) {
|
|
|
4458
4469
|
return variants.some((v) => v.dated) ? _zod2.z.union(variants.map((v) => v.schema)) : void 0;
|
|
4459
4470
|
}
|
|
4460
4471
|
case "nullable":
|
|
4461
|
-
return _optionalChain([inner, 'call',
|
|
4472
|
+
return _optionalChain([inner, 'call', _165 => _165(), 'optionalAccess', _166 => _166.nullable, 'call', _167 => _167()]);
|
|
4462
4473
|
case "optional":
|
|
4463
4474
|
case "nonoptional":
|
|
4464
4475
|
case "readonly":
|
|
@@ -4473,7 +4484,7 @@ function date_reviver_schema(schema) {
|
|
|
4473
4484
|
|
|
4474
4485
|
// src/builders/event-builder.ts
|
|
4475
4486
|
function event_tags(schema) {
|
|
4476
|
-
const pii =
|
|
4487
|
+
const pii = _chunk4KDMNSPJcjs.pii_schemas.call(void 0, schema);
|
|
4477
4488
|
const pii_dates = {};
|
|
4478
4489
|
for (const [key, field] of Object.entries(pii)) {
|
|
4479
4490
|
const dates = date_reviver_schema(field);
|
|
@@ -4510,7 +4521,7 @@ function make_event_reader(tags, disclosure, predicate = null) {
|
|
|
4510
4521
|
});
|
|
4511
4522
|
}
|
|
4512
4523
|
function build_events(registry, states, lanes, owners) {
|
|
4513
|
-
const declared = /* @__PURE__ */ new Set([
|
|
4524
|
+
const declared = /* @__PURE__ */ new Set([_chunk4KDMNSPJcjs.DEFAULT_LANE, ...lanes.map((l) => l.name)]);
|
|
4514
4525
|
const lane_errors = [];
|
|
4515
4526
|
const tags = /* @__PURE__ */ new Map();
|
|
4516
4527
|
const sensitive2 = /* @__PURE__ */ new Map();
|
|
@@ -4574,7 +4585,7 @@ function build_events(registry, states, lanes, owners) {
|
|
|
4574
4585
|
if (reader) readers.set(event_name, reader);
|
|
4575
4586
|
}
|
|
4576
4587
|
const snap2 = make_event_reader(event_tags(state2.state), "redact", null);
|
|
4577
|
-
if (snap2) readers.set(
|
|
4588
|
+
if (snap2) readers.set(_chunk4KDMNSPJcjs.SNAP_EVENT, snap2);
|
|
4578
4589
|
if (readers.size === 0) continue;
|
|
4579
4590
|
state2.view = (event, actor) => (_nullishCoalesce(readers.get(event.name), () => ( IDENTITY_GATE)))(event, actor);
|
|
4580
4591
|
}
|
|
@@ -4635,7 +4646,7 @@ function act() {
|
|
|
4635
4646
|
let _built = false;
|
|
4636
4647
|
const read_wrap = (original) => {
|
|
4637
4648
|
const wrapped = async (events, stream) => {
|
|
4638
|
-
const read = events.map((e) => _nullishCoalesce(_optionalChain([_hr, 'access',
|
|
4649
|
+
const read = events.map((e) => _nullishCoalesce(_optionalChain([_hr, 'access', _168 => _168.get, 'call', _169 => _169(e.name), 'optionalCall', _170 => _170(e)]), () => ( e)));
|
|
4639
4650
|
return original(read, stream);
|
|
4640
4651
|
};
|
|
4641
4652
|
const reset = original[FOLD_RESET];
|
|
@@ -4677,7 +4688,7 @@ function act() {
|
|
|
4677
4688
|
});
|
|
4678
4689
|
}
|
|
4679
4690
|
for (const [action_name, handler] of Object.entries(state2.on)) {
|
|
4680
|
-
const static_target = _optionalChain([handler, 'optionalAccess',
|
|
4691
|
+
const static_target = _optionalChain([handler, 'optionalAccess', _171 => _171._static_emit]);
|
|
4681
4692
|
if (static_target && deprecated.has(static_target)) {
|
|
4682
4693
|
const current = current_version_of(static_target, event_names);
|
|
4683
4694
|
throw new Error(
|
|
@@ -4690,7 +4701,7 @@ function act() {
|
|
|
4690
4701
|
const list = deprecation_summary.map(
|
|
4691
4702
|
(d) => `"${d.deprecated}" (current: "${d.current}", state: "${d.state_name}")`
|
|
4692
4703
|
).join(", ");
|
|
4693
|
-
|
|
4704
|
+
_chunkF2YAA4SEcjs.log.call(void 0, ).info(
|
|
4694
4705
|
`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.`
|
|
4695
4706
|
);
|
|
4696
4707
|
}
|
|
@@ -4732,7 +4743,7 @@ function act() {
|
|
|
4732
4743
|
return reaction_on(event, registry.events, builder);
|
|
4733
4744
|
},
|
|
4734
4745
|
build: (options) => {
|
|
4735
|
-
|
|
4746
|
+
_chunkF2YAA4SEcjs.resolveActConfig.call(void 0, options);
|
|
4736
4747
|
if (!_built) {
|
|
4737
4748
|
for (const proj of pending_projections) add_projection(proj);
|
|
4738
4749
|
for (const proj of fold_projections) {
|
|
@@ -4750,7 +4761,7 @@ function act() {
|
|
|
4750
4761
|
`State projection "${proj.target}" of "${fold.name}" is missing events ${missing.join(", ")} \u2014 pass every partial of the state to .of()`
|
|
4751
4762
|
);
|
|
4752
4763
|
const claimed = fold_specs.find((s) => s.target === proj.target);
|
|
4753
|
-
if (_optionalChain([claimed, 'optionalAccess',
|
|
4764
|
+
if (_optionalChain([claimed, 'optionalAccess', _172 => _172.projection]) === proj) continue;
|
|
4754
4765
|
if (batch_handlers.has(proj.target) || claimed)
|
|
4755
4766
|
throw new Error(
|
|
4756
4767
|
`Duplicate projection target "${proj.target}" \u2014 a target is served by one batch handler or one state projection, never both`
|
|
@@ -4783,7 +4794,7 @@ function act() {
|
|
|
4783
4794
|
synthesize_autoclose_reactions(
|
|
4784
4795
|
registry,
|
|
4785
4796
|
states,
|
|
4786
|
-
|
|
4797
|
+
_chunkF2YAA4SEcjs.current_autoclose_window
|
|
4787
4798
|
);
|
|
4788
4799
|
Object.freeze(registry.actions);
|
|
4789
4800
|
Object.freeze(registry.events);
|
|
@@ -4831,8 +4842,8 @@ function _projection(target) {
|
|
|
4831
4842
|
handler,
|
|
4832
4843
|
resolver: _nullishCoalesce(default_resolver, () => ( _this_)),
|
|
4833
4844
|
options: {
|
|
4834
|
-
blockOnError:
|
|
4835
|
-
maxRetries:
|
|
4845
|
+
blockOnError: _chunkF2YAA4SEcjs.DEFAULT_BLOCK_ON_ERROR,
|
|
4846
|
+
maxRetries: _chunkF2YAA4SEcjs.DEFAULT_MAX_RETRIES
|
|
4836
4847
|
}
|
|
4837
4848
|
}),
|
|
4838
4849
|
widened
|
|
@@ -4873,7 +4884,7 @@ function _projection(target) {
|
|
|
4873
4884
|
throw new Error(
|
|
4874
4885
|
`Projection "${target}" .of() partials must share one state name \u2014 got "${name}" and "${partial.name}"`
|
|
4875
4886
|
);
|
|
4876
|
-
const config2 =
|
|
4887
|
+
const config2 = _chunkF2YAA4SEcjs.resolveFoldConfig.call(void 0, options);
|
|
4877
4888
|
const fold_events = {};
|
|
4878
4889
|
for (const partial of partials)
|
|
4879
4890
|
for (const [event_name, schema] of Object.entries(partial.events)) {
|
|
@@ -4891,8 +4902,8 @@ function _projection(target) {
|
|
|
4891
4902
|
handler: noop,
|
|
4892
4903
|
resolver: { target },
|
|
4893
4904
|
options: {
|
|
4894
|
-
blockOnError:
|
|
4895
|
-
maxRetries:
|
|
4905
|
+
blockOnError: _chunkF2YAA4SEcjs.DEFAULT_BLOCK_ON_ERROR,
|
|
4906
|
+
maxRetries: _chunkF2YAA4SEcjs.DEFAULT_MAX_RETRIES
|
|
4896
4907
|
}
|
|
4897
4908
|
}
|
|
4898
4909
|
]
|
|
@@ -5008,7 +5019,7 @@ function action_builder(state2) {
|
|
|
5008
5019
|
throw new Error(`Duplicate action "${action2}"`);
|
|
5009
5020
|
internal.actions[action2] = schema;
|
|
5010
5021
|
if (options) {
|
|
5011
|
-
|
|
5022
|
+
_chunkF2YAA4SEcjs.resolveActionConfig.call(void 0, options);
|
|
5012
5023
|
internal.options ??= {};
|
|
5013
5024
|
internal.options[action2] = options;
|
|
5014
5025
|
}
|
|
@@ -5301,5 +5312,5 @@ function write_line(writer, line) {
|
|
|
5301
5312
|
|
|
5302
5313
|
|
|
5303
5314
|
|
|
5304
|
-
exports.Act = Act; exports.ActorSchema =
|
|
5315
|
+
exports.Act = Act; exports.ActorSchema = _chunk4KDMNSPJcjs.ActorSchema; exports.CausationEventSchema = _chunk4KDMNSPJcjs.CausationEventSchema; exports.CommittedMetaSchema = _chunk4KDMNSPJcjs.CommittedMetaSchema; exports.ConcurrencyError = _chunk4KDMNSPJcjs.ConcurrencyError; exports.ConsoleLogger = _chunkF2YAA4SEcjs.ConsoleLogger; exports.CsvFile = CsvFile; exports.DEFAULT_LANE = _chunk4KDMNSPJcjs.DEFAULT_LANE; exports.DEFAULT_MAX_SUBSCRIBED_STREAMS = _chunk4KDMNSPJcjs.DEFAULT_MAX_SUBSCRIBED_STREAMS; exports.DEFAULT_SETTLE_DEBOUNCE_MS = _chunk4KDMNSPJcjs.DEFAULT_SETTLE_DEBOUNCE_MS; exports.DeferSignal = _chunk4KDMNSPJcjs.DeferSignal; exports.Environments = _chunk4KDMNSPJcjs.Environments; exports.Errors = _chunk4KDMNSPJcjs.Errors; exports.EventMetaSchema = _chunk4KDMNSPJcjs.EventMetaSchema; exports.ExitCodes = _chunk4KDMNSPJcjs.ExitCodes; exports.InMemoryCache = _chunkF2YAA4SEcjs.InMemoryCache; exports.InMemoryStore = _chunkF2YAA4SEcjs.InMemoryStore; exports.InvariantError = _chunk4KDMNSPJcjs.InvariantError; exports.LogLevels = _chunk4KDMNSPJcjs.LogLevels; exports.NonRetryableError = _chunk4KDMNSPJcjs.NonRetryableError; exports.PackageSchema = _chunkF2YAA4SEcjs.PackageSchema; exports.PreconditionError = _chunk4KDMNSPJcjs.PreconditionError; exports.QuerySchema = _chunk4KDMNSPJcjs.QuerySchema; exports.REDACTED = _chunk4KDMNSPJcjs.REDACTED; exports.SHREDDED = _chunk4KDMNSPJcjs.SHREDDED; exports.SNAP_EVENT = _chunk4KDMNSPJcjs.SNAP_EVENT; exports.StoreError = _chunk4KDMNSPJcjs.StoreError; exports.StreamClosedError = _chunk4KDMNSPJcjs.StreamClosedError; exports.TOMBSTONE_EVENT = _chunk4KDMNSPJcjs.TOMBSTONE_EVENT; exports.TargetSchema = _chunk4KDMNSPJcjs.TargetSchema; exports.ValidationError = _chunk4KDMNSPJcjs.ValidationError; exports.ZodEmpty = _chunk4KDMNSPJcjs.ZodEmpty; exports.act = act; exports.cache = _chunkF2YAA4SEcjs.cache; exports.config = _chunkF2YAA4SEcjs.config; exports.dateReviver = _chunkF2YAA4SEcjs.dateReviver; exports.default_scope = _chunkF2YAA4SEcjs.default_scope; exports.dispose = _chunkF2YAA4SEcjs.dispose; exports.disposeAndExit = _chunkF2YAA4SEcjs.disposeAndExit; exports.extend = _chunkF2YAA4SEcjs.extend; exports.is_literal_source = _chunkF2YAA4SEcjs.is_literal_source; exports.log = _chunkF2YAA4SEcjs.log; exports.pii_fields = _chunk4KDMNSPJcjs.pii_fields; exports.port = _chunkF2YAA4SEcjs.port; exports.projection = projection; exports.resolveAutocloseConfig = _chunkF2YAA4SEcjs.resolveAutocloseConfig2; exports.sensitive = _chunk4KDMNSPJcjs.sensitive; exports.sleep = _chunkF2YAA4SEcjs.sleep; exports.slice = slice; exports.state = state; exports.store = _chunkF2YAA4SEcjs.store; exports.validate = _chunkF2YAA4SEcjs.validate;
|
|
5305
5316
|
//# sourceMappingURL=index.cjs.map
|