@rotorsoft/act 1.35.1 → 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 +155 -167
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -26
- 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,9 +1642,9 @@ 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');
|
|
@@ -1659,29 +1659,29 @@ var check_invariants = (target, state2, schema, pii_aware) => {
|
|
|
1659
1659
|
try {
|
|
1660
1660
|
result = schema.safeParse(state2);
|
|
1661
1661
|
} catch (error) {
|
|
1662
|
-
throw new (0,
|
|
1662
|
+
throw new (0, _chunk4KDMNSPJcjs.ValidationError)(target, state2, error);
|
|
1663
1663
|
}
|
|
1664
1664
|
if (result.success) return;
|
|
1665
1665
|
const issues = pii_aware ? result.error.issues.filter((issue) => {
|
|
1666
1666
|
const value = value_at(state2, issue.path);
|
|
1667
|
-
return value !==
|
|
1667
|
+
return value !== _chunk4KDMNSPJcjs.REDACTED && value !== _chunk4KDMNSPJcjs.SHREDDED;
|
|
1668
1668
|
}) : result.error.issues;
|
|
1669
1669
|
if (issues.length)
|
|
1670
|
-
throw new (0,
|
|
1670
|
+
throw new (0, _chunk4KDMNSPJcjs.ValidationError)(
|
|
1671
1671
|
target,
|
|
1672
1672
|
state2,
|
|
1673
1673
|
_zod2.prettifyError.call(void 0, new (0, _zod2.ZodError)(issues))
|
|
1674
1674
|
);
|
|
1675
1675
|
};
|
|
1676
1676
|
var DEFAULT_BATCH = 500;
|
|
1677
|
-
var cache_put = (stream, entry) =>
|
|
1678
|
-
(err) =>
|
|
1677
|
+
var cache_put = (stream, entry) => _chunkF2YAA4SEcjs.cache.call(void 0, ).set(stream, entry).catch(
|
|
1678
|
+
(err) => _chunkF2YAA4SEcjs.log.call(void 0, ).warn(
|
|
1679
1679
|
err,
|
|
1680
1680
|
"cache set skipped; the next load re-folds from the store"
|
|
1681
1681
|
)
|
|
1682
1682
|
);
|
|
1683
|
-
var cache_drop = (stream) =>
|
|
1684
|
-
(err) =>
|
|
1683
|
+
var cache_drop = (stream) => _chunkF2YAA4SEcjs.cache.call(void 0, ).invalidate(stream).catch(
|
|
1684
|
+
(err) => _chunkF2YAA4SEcjs.log.call(void 0, ).warn(
|
|
1685
1685
|
err,
|
|
1686
1686
|
"cache invalidate skipped; a stale checkpoint re-folds from its event_id"
|
|
1687
1687
|
)
|
|
@@ -1689,9 +1689,9 @@ var cache_drop = (stream) => _chunkBNTVE7RQcjs.cache.call(void 0, ).invalidate(s
|
|
|
1689
1689
|
async function snap(snapshot) {
|
|
1690
1690
|
const { id, stream, name, meta, version } = snapshot.event;
|
|
1691
1691
|
try {
|
|
1692
|
-
const [committed] = await
|
|
1692
|
+
const [committed] = await _chunkF2YAA4SEcjs.store.call(void 0, ).commit(
|
|
1693
1693
|
stream,
|
|
1694
|
-
[{ name:
|
|
1694
|
+
[{ name: _chunk4KDMNSPJcjs.SNAP_EVENT, data: snapshot.state }],
|
|
1695
1695
|
{
|
|
1696
1696
|
correlation: meta.correlation,
|
|
1697
1697
|
causation: { event: { id, name, stream } }
|
|
@@ -1702,22 +1702,22 @@ async function snap(snapshot) {
|
|
|
1702
1702
|
return committed;
|
|
1703
1703
|
} catch (error) {
|
|
1704
1704
|
const reason = error instanceof Error ? error.message : String(error);
|
|
1705
|
-
|
|
1705
|
+
_chunkF2YAA4SEcjs.log.call(void 0, ).warn(
|
|
1706
1706
|
`Snapshot write failed on stream "${stream}": ${reason} \u2014 cold starts will replay full history until snapshots succeed.`
|
|
1707
1707
|
);
|
|
1708
1708
|
}
|
|
1709
1709
|
}
|
|
1710
1710
|
async function tombstone(stream, expectedVersion, correlation) {
|
|
1711
1711
|
try {
|
|
1712
|
-
const [committed] = await
|
|
1712
|
+
const [committed] = await _chunkF2YAA4SEcjs.store.call(void 0, ).commit(
|
|
1713
1713
|
stream,
|
|
1714
|
-
[{ name:
|
|
1714
|
+
[{ name: _chunk4KDMNSPJcjs.TOMBSTONE_EVENT, data: {} }],
|
|
1715
1715
|
{ correlation, causation: {} },
|
|
1716
1716
|
expectedVersion
|
|
1717
1717
|
);
|
|
1718
1718
|
return committed;
|
|
1719
1719
|
} catch (error) {
|
|
1720
|
-
if (error instanceof
|
|
1720
|
+
if (error instanceof _chunk4KDMNSPJcjs.ConcurrencyError) return void 0;
|
|
1721
1721
|
throw error;
|
|
1722
1722
|
}
|
|
1723
1723
|
}
|
|
@@ -1747,9 +1747,9 @@ async function scan(source, opts = {}, callback) {
|
|
|
1747
1747
|
if (drop_closed_streams) {
|
|
1748
1748
|
await source.query(
|
|
1749
1749
|
(e) => {
|
|
1750
|
-
if (e.name ===
|
|
1750
|
+
if (e.name === _chunk4KDMNSPJcjs.TOMBSTONE_EVENT) closed_streams.add(e.stream);
|
|
1751
1751
|
},
|
|
1752
|
-
{ names: [
|
|
1752
|
+
{ names: [_chunk4KDMNSPJcjs.TOMBSTONE_EVENT] }
|
|
1753
1753
|
);
|
|
1754
1754
|
}
|
|
1755
1755
|
let max_id;
|
|
@@ -1771,11 +1771,11 @@ async function scan(source, opts = {}, callback) {
|
|
|
1771
1771
|
if (!is_valid(event))
|
|
1772
1772
|
throw new Error(`Invalid event at index ${processed}`);
|
|
1773
1773
|
if (on_progress) on_progress({ processed, id: event.id, max_id });
|
|
1774
|
-
if (drop_snapshots && event.name ===
|
|
1774
|
+
if (drop_snapshots && event.name === _chunk4KDMNSPJcjs.SNAP_EVENT) {
|
|
1775
1775
|
dropped_snaps++;
|
|
1776
1776
|
return;
|
|
1777
1777
|
}
|
|
1778
|
-
if (closed_streams.has(event.stream) && event.name !==
|
|
1778
|
+
if (closed_streams.has(event.stream) && event.name !== _chunk4KDMNSPJcjs.TOMBSTONE_EVENT) {
|
|
1779
1779
|
dropped_closed++;
|
|
1780
1780
|
return;
|
|
1781
1781
|
}
|
|
@@ -1842,17 +1842,17 @@ async function scan(source, opts = {}, callback) {
|
|
|
1842
1842
|
async function load(me, target, callback, patch_fn = bare_patch) {
|
|
1843
1843
|
const { stream, actor, asOf } = target;
|
|
1844
1844
|
const time_travel = !!asOf && Object.values(asOf).some((v) => v !== void 0);
|
|
1845
|
-
const cached = time_travel ? void 0 : await
|
|
1845
|
+
const cached = time_travel ? void 0 : await _chunkF2YAA4SEcjs.cache.call(void 0, ).get(stream);
|
|
1846
1846
|
const cache_hit = !!cached;
|
|
1847
1847
|
let state2 = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _73 => _73.state]), () => ( (me.init ? me.init() : {})));
|
|
1848
1848
|
let patches = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _74 => _74.patches]), () => ( 0));
|
|
1849
1849
|
let snaps = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _75 => _75.snaps]), () => ( 0));
|
|
1850
1850
|
let replayed = 0;
|
|
1851
1851
|
let event;
|
|
1852
|
-
await
|
|
1852
|
+
await _chunkF2YAA4SEcjs.store.call(void 0, ).query(
|
|
1853
1853
|
(raw) => {
|
|
1854
1854
|
event = me.view(raw, actor);
|
|
1855
|
-
if (event.name ===
|
|
1855
|
+
if (event.name === _chunk4KDMNSPJcjs.SNAP_EVENT) {
|
|
1856
1856
|
state2 = event.data;
|
|
1857
1857
|
snaps++;
|
|
1858
1858
|
patches = 0;
|
|
@@ -1861,8 +1861,8 @@ async function load(me, target, callback, patch_fn = bare_patch) {
|
|
|
1861
1861
|
state2 = patch_fn(me, state2, me.patch[event.name](event, state2), event);
|
|
1862
1862
|
patches++;
|
|
1863
1863
|
replayed++;
|
|
1864
|
-
} else if (event.name !==
|
|
1865
|
-
|
|
1864
|
+
} else if (event.name !== _chunk4KDMNSPJcjs.TOMBSTONE_EVENT) {
|
|
1865
|
+
_chunkF2YAA4SEcjs.log.call(void 0, ).warn(
|
|
1866
1866
|
`Skipping unknown event "${String(event.name)}" on stream "${stream}" (id=${event.id}) \u2014 no reducer in state "${me.name}"`
|
|
1867
1867
|
);
|
|
1868
1868
|
}
|
|
@@ -1886,7 +1886,7 @@ async function load(me, target, callback, patch_fn = bare_patch) {
|
|
|
1886
1886
|
...cached ? { after: cached.event_id, with_snaps: true } : { ...time_travel ? {} : { with_snaps: true }, ...asOf }
|
|
1887
1887
|
}
|
|
1888
1888
|
);
|
|
1889
|
-
const head_is_tombstone = _optionalChain([event, 'optionalAccess', _77 => _77.name]) ===
|
|
1889
|
+
const head_is_tombstone = _optionalChain([event, 'optionalAccess', _77 => _77.name]) === _chunk4KDMNSPJcjs.TOMBSTONE_EVENT;
|
|
1890
1890
|
if (replayed > 0 && !time_travel && event && !me.pii_aware && !head_is_tombstone) {
|
|
1891
1891
|
await cache_put(stream, {
|
|
1892
1892
|
stream,
|
|
@@ -1914,7 +1914,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1914
1914
|
if (!stream) throw new Error("Missing target stream");
|
|
1915
1915
|
const reactingTo = _optionalChain([options, 'optionalAccess', _82 => _82.reactingTo]);
|
|
1916
1916
|
const correlator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _83 => _83.correlator]), () => ( default_correlator));
|
|
1917
|
-
const validated =
|
|
1917
|
+
const validated = _chunkF2YAA4SEcjs.validate.call(void 0, action2, payload, me.actions[action2]);
|
|
1918
1918
|
const opts = _optionalChain([me, 'access', _84 => _84.options, 'optionalAccess', _85 => _85[action2]]);
|
|
1919
1919
|
const max_retries = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _86 => _86.maxRetries]), () => ( 0));
|
|
1920
1920
|
for (let attempt = 0; ; attempt++) {
|
|
@@ -1925,12 +1925,12 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1925
1925
|
void 0,
|
|
1926
1926
|
patch_fn
|
|
1927
1927
|
);
|
|
1928
|
-
if (_optionalChain([snapshot, 'access', _87 => _87.event, 'optionalAccess', _88 => _88.name]) ===
|
|
1929
|
-
throw new (0,
|
|
1930
|
-
const expected = _nullishCoalesce(expectedVersion, () => (
|
|
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
1931
|
for (const { valid, description } of _nullishCoalesce(_optionalChain([me, 'access', _89 => _89.given, 'optionalAccess', _90 => _90[action2]]), () => ( [])))
|
|
1932
1932
|
if (!valid(snapshot.state, actor))
|
|
1933
|
-
throw new (0,
|
|
1933
|
+
throw new (0, _chunk4KDMNSPJcjs.InvariantError)(
|
|
1934
1934
|
action2,
|
|
1935
1935
|
validated,
|
|
1936
1936
|
target,
|
|
@@ -1939,7 +1939,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1939
1939
|
);
|
|
1940
1940
|
for (const { holds, description } of _nullishCoalesce(_optionalChain([me, 'access', _91 => _91.requires, 'optionalAccess', _92 => _92[action2]]), () => ( [])))
|
|
1941
1941
|
if (!holds(validated, snapshot.state, actor))
|
|
1942
|
-
throw new (0,
|
|
1942
|
+
throw new (0, _chunk4KDMNSPJcjs.PreconditionError)(
|
|
1943
1943
|
action2,
|
|
1944
1944
|
validated,
|
|
1945
1945
|
target,
|
|
@@ -1952,7 +1952,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1952
1952
|
const tuples = Array.isArray(result[0]) ? result : [result];
|
|
1953
1953
|
const events = tuples.map(([name, data]) => ({
|
|
1954
1954
|
name,
|
|
1955
|
-
data:
|
|
1955
|
+
data: _chunkF2YAA4SEcjs.validate.call(void 0, name, data, me.events[name])
|
|
1956
1956
|
}));
|
|
1957
1957
|
const emitted = events.map((e) => me.message(e));
|
|
1958
1958
|
const meta = {
|
|
@@ -1999,16 +1999,9 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1999
1999
|
);
|
|
2000
2000
|
let committed;
|
|
2001
2001
|
try {
|
|
2002
|
-
committed = await
|
|
2003
|
-
stream,
|
|
2004
|
-
emitted,
|
|
2005
|
-
meta,
|
|
2006
|
-
// Reactions skip the inferred version guard (leases already
|
|
2007
|
-
// serialize them); an explicit expectedVersion is still honored.
|
|
2008
|
-
reactingTo ? expectedVersion : expected
|
|
2009
|
-
);
|
|
2002
|
+
committed = await _chunkF2YAA4SEcjs.store.call(void 0, ).commit(stream, emitted, meta, expected);
|
|
2010
2003
|
} catch (error) {
|
|
2011
|
-
if (error instanceof
|
|
2004
|
+
if (error instanceof _chunk4KDMNSPJcjs.ConcurrencyError) void cache_drop(stream);
|
|
2012
2005
|
throw error;
|
|
2013
2006
|
}
|
|
2014
2007
|
const snapshots = committed.map((row, i) => ({
|
|
@@ -2023,36 +2016,31 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
2023
2016
|
replayed: snapshot.replayed
|
|
2024
2017
|
}));
|
|
2025
2018
|
const last = snapshots.at(-1);
|
|
2026
|
-
const
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
patches: snap_event ? 0 : last.patches,
|
|
2037
|
-
snaps: snap_event ? last.snaps + 1 : last.snaps
|
|
2038
|
-
});
|
|
2039
|
-
else void cache_drop(stream);
|
|
2040
|
-
}
|
|
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
|
+
});
|
|
2041
2029
|
return snapshots;
|
|
2042
2030
|
} catch (error) {
|
|
2043
|
-
if (!(error instanceof
|
|
2031
|
+
if (!(error instanceof _chunk4KDMNSPJcjs.ConcurrencyError)) throw error;
|
|
2044
2032
|
if (expectedVersion !== void 0) throw error;
|
|
2045
2033
|
if (attempt >= max_retries) throw error;
|
|
2046
2034
|
if (_optionalChain([opts, 'optionalAccess', _99 => _99.backoff])) {
|
|
2047
2035
|
const delay_ms = compute_backoff_delay(attempt, opts.backoff);
|
|
2048
|
-
if (delay_ms > 0) await
|
|
2036
|
+
if (delay_ms > 0) await _chunkF2YAA4SEcjs.sleep.call(void 0, delay_ms);
|
|
2049
2037
|
}
|
|
2050
2038
|
}
|
|
2051
2039
|
}
|
|
2052
2040
|
}
|
|
2053
2041
|
|
|
2054
2042
|
// src/internal/tracing.ts
|
|
2055
|
-
var PRETTY =
|
|
2043
|
+
var PRETTY = _chunkF2YAA4SEcjs.config.call(void 0, ).env !== "production";
|
|
2056
2044
|
var C_BLUE = "\x1B[38;5;39m";
|
|
2057
2045
|
var C_ORANGE = "\x1B[38;5;208m";
|
|
2058
2046
|
var C_GREEN = "\x1B[38;5;42m";
|
|
@@ -2238,7 +2226,7 @@ function budget_exhausted(lease, options, store_failing) {
|
|
|
2238
2226
|
if (store_failing || !_optionalChain([options, 'optionalAccess', _109 => _109.blockOnError]) || lease.retry <= options.maxRetries)
|
|
2239
2227
|
return void 0;
|
|
2240
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.`;
|
|
2241
|
-
|
|
2229
|
+
_chunkF2YAA4SEcjs.log.call(void 0, ).error(error);
|
|
2242
2230
|
return { lease, handled: 0, acked_at: lease.at, error, block: true };
|
|
2243
2231
|
}
|
|
2244
2232
|
function fetch_failure_policy(registry) {
|
|
@@ -2254,13 +2242,13 @@ function fetch_failure_policy(registry) {
|
|
|
2254
2242
|
function finalize(lease, handled, at, error, options, logger, failed_at) {
|
|
2255
2243
|
if (!error) return { lease, handled, acked_at: at };
|
|
2256
2244
|
logger.error(error);
|
|
2257
|
-
const non_retryable = error instanceof
|
|
2245
|
+
const non_retryable = error instanceof _chunk4KDMNSPJcjs.NonRetryableError;
|
|
2258
2246
|
const block2 = options.blockOnError && (non_retryable || lease.retry >= options.maxRetries);
|
|
2259
2247
|
if (block2)
|
|
2260
2248
|
logger.error(
|
|
2261
2249
|
non_retryable ? `Blocking ${lease.stream} on non-retryable error.` : `Blocking ${lease.stream} after ${lease.retry} retries.`
|
|
2262
2250
|
);
|
|
2263
|
-
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)));
|
|
2264
2252
|
return {
|
|
2265
2253
|
lease,
|
|
2266
2254
|
handled,
|
|
@@ -2388,7 +2376,7 @@ async function run_drain_cycle(deps, cycle) {
|
|
|
2388
2376
|
const acked = submitted.length ? await ops.ack(submitted) : [];
|
|
2389
2377
|
const expected = submitted.filter((l) => l.due === void 0).length;
|
|
2390
2378
|
if (acked.length < expected)
|
|
2391
|
-
|
|
2379
|
+
_chunkF2YAA4SEcjs.log.call(void 0, ).warn(
|
|
2392
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.`
|
|
2393
2381
|
);
|
|
2394
2382
|
const closeable = handled.filter((h) => h.close !== void 0).map((h) => h.close);
|
|
@@ -2488,9 +2476,9 @@ var DrainController = (_class5 = class {
|
|
|
2488
2476
|
if (!this.armed || this._stopped || this._inflight)
|
|
2489
2477
|
return EMPTY_DRAIN;
|
|
2490
2478
|
const d = _nullishCoalesce(this._deps.defaults, () => ( {}));
|
|
2491
|
-
const streamLimit = _nullishCoalesce(_nullishCoalesce(d.streamLimit, () => ( options.streamLimit)), () => (
|
|
2492
|
-
const eventLimit = _nullishCoalesce(options.eventLimit, () => (
|
|
2493
|
-
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));
|
|
2494
2482
|
if (this._deps.breaker.state(Date.now()) === "open")
|
|
2495
2483
|
return EMPTY_DRAIN;
|
|
2496
2484
|
const pass = this._pass(streamLimit, eventLimit, leaseMillis).finally(
|
|
@@ -2565,7 +2553,7 @@ function pii_gate(event, fields, predicate, actor) {
|
|
|
2565
2553
|
const { pii, ...rest } = event;
|
|
2566
2554
|
if (pii == null) {
|
|
2567
2555
|
const shredded = { ...data };
|
|
2568
|
-
for (const f of fields) shredded[f] =
|
|
2556
|
+
for (const f of fields) shredded[f] = _chunk4KDMNSPJcjs.SHREDDED;
|
|
2569
2557
|
return { ...rest, data: shredded };
|
|
2570
2558
|
}
|
|
2571
2559
|
const allowed = !!actor && !!predicate && predicate(event, actor);
|
|
@@ -2576,7 +2564,7 @@ function pii_gate(event, fields, predicate, actor) {
|
|
|
2576
2564
|
};
|
|
2577
2565
|
}
|
|
2578
2566
|
const redacted = { ...data };
|
|
2579
|
-
for (const f of fields) redacted[f] =
|
|
2567
|
+
for (const f of fields) redacted[f] = _chunk4KDMNSPJcjs.REDACTED;
|
|
2580
2568
|
return { ...rest, data: redacted };
|
|
2581
2569
|
}
|
|
2582
2570
|
var IDENTITY_GATE = (event) => event;
|
|
@@ -2713,7 +2701,7 @@ function make_deferred(handler, schedule) {
|
|
|
2713
2701
|
const call = handler;
|
|
2714
2702
|
const deferred = async (event, stream, app) => {
|
|
2715
2703
|
const when = typeof schedule === "function" ? schedule(event) : schedule;
|
|
2716
|
-
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);
|
|
2717
2705
|
return call(event, stream, app);
|
|
2718
2706
|
};
|
|
2719
2707
|
Object.defineProperty(deferred, "name", { value: handler.name });
|
|
@@ -2782,7 +2770,7 @@ function build_handle(deps) {
|
|
|
2782
2770
|
handled++;
|
|
2783
2771
|
}
|
|
2784
2772
|
} catch (error) {
|
|
2785
|
-
if (error instanceof
|
|
2773
|
+
if (error instanceof _chunk4KDMNSPJcjs.DeferSignal) {
|
|
2786
2774
|
let defer;
|
|
2787
2775
|
try {
|
|
2788
2776
|
defer = resolve_defer_at(error.when, event);
|
|
@@ -3046,7 +3034,7 @@ var Act = (_class7 = class {
|
|
|
3046
3034
|
/** Lanes to arm per event; `"all"` when a dynamic resolver hides the lane. */
|
|
3047
3035
|
|
|
3048
3036
|
|
|
3049
|
-
__init27() {this._logger =
|
|
3037
|
+
__init27() {this._logger = _chunkF2YAA4SEcjs.log.call(void 0, )}
|
|
3050
3038
|
/** This Act's ports: its own bag, or the singleton adapters. */
|
|
3051
3039
|
|
|
3052
3040
|
/** Runs a body so internal `store()`/`cache()` calls resolve to `_ports`. */
|
|
@@ -3068,9 +3056,9 @@ var Act = (_class7 = class {
|
|
|
3068
3056
|
this._lanes = lanes;
|
|
3069
3057
|
this._declared_lanes = ["default", ...lanes.map((l) => l.name)];
|
|
3070
3058
|
validate_only_lanes(options.onlyLanes, this._declared_lanes);
|
|
3071
|
-
this._ports = _nullishCoalesce(options.scoped, () => (
|
|
3059
|
+
this._ports = _nullishCoalesce(options.scoped, () => ( _chunkF2YAA4SEcjs.default_scope.call(void 0, )));
|
|
3072
3060
|
const ports = this._ports;
|
|
3073
|
-
this._scoped =
|
|
3061
|
+
this._scoped = _chunkF2YAA4SEcjs.make_run_scoped.call(void 0, {
|
|
3074
3062
|
// Getters, not a spread: the singletons resolve lazily, so a later
|
|
3075
3063
|
// `store(...)` / `cache(...)` still takes effect.
|
|
3076
3064
|
get store() {
|
|
@@ -3080,14 +3068,14 @@ var Act = (_class7 = class {
|
|
|
3080
3068
|
return ports.cache;
|
|
3081
3069
|
},
|
|
3082
3070
|
// Parsed per build, so a bad window throws on every build.
|
|
3083
|
-
autoclose_window:
|
|
3071
|
+
autoclose_window: _chunkF2YAA4SEcjs.resolveAutocloseConfig.call(void 0, options).autocloseWindow
|
|
3084
3072
|
});
|
|
3085
3073
|
this._correlator = _nullishCoalesce(options.correlator, () => ( default_correlator));
|
|
3086
3074
|
this._es = build_es(this._logger, this._correlator, patch_fn);
|
|
3087
3075
|
this._cd = build_drain(this._logger);
|
|
3088
3076
|
const handle = build_handle({
|
|
3089
3077
|
logger: this._logger,
|
|
3090
|
-
reaction_scope:
|
|
3078
|
+
reaction_scope: _chunkF2YAA4SEcjs.make_reaction_scope.call(void 0, {
|
|
3091
3079
|
do: this.do.bind(this),
|
|
3092
3080
|
load: this.load.bind(this),
|
|
3093
3081
|
query: this.query.bind(this),
|
|
@@ -3117,12 +3105,12 @@ var Act = (_class7 = class {
|
|
|
3117
3105
|
this._ports.store,
|
|
3118
3106
|
options.listen !== false
|
|
3119
3107
|
);
|
|
3120
|
-
|
|
3108
|
+
_chunkF2YAA4SEcjs.register_weak_disposer.call(void 0, new WeakRef(this), (self) => self.shutdown());
|
|
3121
3109
|
}
|
|
3122
3110
|
/** Shared by drain, settle and autoclose; bad knobs throw at build. */
|
|
3123
3111
|
_build_breaker(options) {
|
|
3124
3112
|
return new CircuitBreaker(
|
|
3125
|
-
|
|
3113
|
+
_chunkF2YAA4SEcjs.resolveCircuitBreakerConfig.call(void 0, options.circuitBreaker),
|
|
3126
3114
|
{
|
|
3127
3115
|
on_error: (error, circuit) => this._emit_error(error, circuit),
|
|
3128
3116
|
// When the cooldown elapses, settle once: its scan or claim is the
|
|
@@ -3156,7 +3144,7 @@ var Act = (_class7 = class {
|
|
|
3156
3144
|
try {
|
|
3157
3145
|
await this._run_close(targets);
|
|
3158
3146
|
} catch (error) {
|
|
3159
|
-
if (error instanceof
|
|
3147
|
+
if (error instanceof _chunk4KDMNSPJcjs.StoreError) throw error;
|
|
3160
3148
|
this._logger.error(
|
|
3161
3149
|
error,
|
|
3162
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.`
|
|
@@ -3190,7 +3178,7 @@ var Act = (_class7 = class {
|
|
|
3190
3178
|
/** Audit deps, built after the controllers so the lane set is final. */
|
|
3191
3179
|
_build_audit_deps() {
|
|
3192
3180
|
return {
|
|
3193
|
-
store:
|
|
3181
|
+
store: _chunkF2YAA4SEcjs.store,
|
|
3194
3182
|
event_to_state: this._event_to_state,
|
|
3195
3183
|
// Declared lanes, not this process's controllers: a lane another
|
|
3196
3184
|
// worker drains is not `unknown-lane`.
|
|
@@ -3203,7 +3191,7 @@ var Act = (_class7 = class {
|
|
|
3203
3191
|
registry: this.registry,
|
|
3204
3192
|
static_targets: classification.static_targets,
|
|
3205
3193
|
cd: this._cd,
|
|
3206
|
-
max_subscribed_streams: _nullishCoalesce(options.maxSubscribedStreams, () => (
|
|
3194
|
+
max_subscribed_streams: _nullishCoalesce(options.maxSubscribedStreams, () => ( _chunk4KDMNSPJcjs.DEFAULT_MAX_SUBSCRIBED_STREAMS)),
|
|
3207
3195
|
// Declared lanes (not active ones): a lane another process claims is
|
|
3208
3196
|
// still a valid destination.
|
|
3209
3197
|
declared_lanes: new Set(this._declared_lanes),
|
|
@@ -3219,7 +3207,7 @@ var Act = (_class7 = class {
|
|
|
3219
3207
|
/** Cold start: an idle deferred stream still fires on time after a restart. */
|
|
3220
3208
|
async _seed_persisted_defers() {
|
|
3221
3209
|
const now = Date.now();
|
|
3222
|
-
await walk_streams(
|
|
3210
|
+
await walk_streams(_chunkF2YAA4SEcjs.store.call(void 0, ), (pos) => {
|
|
3223
3211
|
if (pos.deferred_at === void 0 || pos.deferred_at <= now) return;
|
|
3224
3212
|
const controller = this._drain_controllers.get(_nullishCoalesce(pos.lane, () => ( "default")));
|
|
3225
3213
|
_optionalChain([controller, 'optionalAccess', _131 => _131.seed_defer, 'call', _132 => _132(pos.stream, pos.deferred_at)]);
|
|
@@ -3235,7 +3223,7 @@ var Act = (_class7 = class {
|
|
|
3235
3223
|
on_settled: (drain) => this.emit("settled", drain),
|
|
3236
3224
|
breaker: this._breaker
|
|
3237
3225
|
},
|
|
3238
|
-
_nullishCoalesce(options.settleDebounceMs, () => (
|
|
3226
|
+
_nullishCoalesce(options.settleDebounceMs, () => ( _chunk4KDMNSPJcjs.DEFAULT_SETTLE_DEBOUNCE_MS))
|
|
3239
3227
|
);
|
|
3240
3228
|
}
|
|
3241
3229
|
|
|
@@ -3255,7 +3243,7 @@ var Act = (_class7 = class {
|
|
|
3255
3243
|
*/
|
|
3256
3244
|
shutdown(options) {
|
|
3257
3245
|
if (!this._shutdown_promise) {
|
|
3258
|
-
|
|
3246
|
+
_chunkF2YAA4SEcjs.resolveShutdownConfig.call(void 0, options);
|
|
3259
3247
|
this._shutdown_promise = (async () => {
|
|
3260
3248
|
this.stop_correlations();
|
|
3261
3249
|
this._settle.stop(true);
|
|
@@ -3275,10 +3263,10 @@ var Act = (_class7 = class {
|
|
|
3275
3263
|
* default for none or 0, and for a running settle), capped.
|
|
3276
3264
|
*/
|
|
3277
3265
|
_derive_grace_ms(running, settling) {
|
|
3278
|
-
let max = settling ?
|
|
3266
|
+
let max = settling ? _chunkF2YAA4SEcjs.DEFAULT_LEASE_MILLIS : 0;
|
|
3279
3267
|
for (const c of running)
|
|
3280
|
-
max = Math.max(max, c.lease_millis ||
|
|
3281
|
-
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);
|
|
3282
3270
|
}
|
|
3283
3271
|
async _await_inflight(grace_ms) {
|
|
3284
3272
|
const running = [...this._drain_controllers.values()].filter(
|
|
@@ -3361,7 +3349,7 @@ var Act = (_class7 = class {
|
|
|
3361
3349
|
* @see {@link ValidationError}, {@link PreconditionError}, {@link ConcurrencyError}
|
|
3362
3350
|
*/
|
|
3363
3351
|
async do(action2, target, payload, options) {
|
|
3364
|
-
const reacting_to = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _134 => _134.reactingTo]), () => (
|
|
3352
|
+
const reacting_to = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _134 => _134.reactingTo]), () => ( _chunkF2YAA4SEcjs.current_reacting.call(void 0, )));
|
|
3365
3353
|
const do_options = reacting_to === _optionalChain([options, 'optionalAccess', _135 => _135.reactingTo]) ? options : { ...options, reactingTo: reacting_to };
|
|
3366
3354
|
return this._scoped(async () => {
|
|
3367
3355
|
const snapshots = await this._es.action(
|
|
@@ -3422,7 +3410,7 @@ var Act = (_class7 = class {
|
|
|
3422
3410
|
return this._scoped(async () => {
|
|
3423
3411
|
let first;
|
|
3424
3412
|
let last;
|
|
3425
|
-
const count = await
|
|
3413
|
+
const count = await _chunkF2YAA4SEcjs.store.call(void 0, ).query((e) => {
|
|
3426
3414
|
const gated = this.registry.query_gate(e.name)(e);
|
|
3427
3415
|
if (!first) first = gated;
|
|
3428
3416
|
last = gated;
|
|
@@ -3452,7 +3440,7 @@ var Act = (_class7 = class {
|
|
|
3452
3440
|
async query_array(query) {
|
|
3453
3441
|
return this._scoped(async () => {
|
|
3454
3442
|
const events = [];
|
|
3455
|
-
await
|
|
3443
|
+
await _chunkF2YAA4SEcjs.store.call(void 0, ).query((e) => {
|
|
3456
3444
|
events.push(this.registry.query_gate(e.name)(e));
|
|
3457
3445
|
}, query);
|
|
3458
3446
|
return events;
|
|
@@ -3472,14 +3460,14 @@ var Act = (_class7 = class {
|
|
|
3472
3460
|
*/
|
|
3473
3461
|
async forget(stream) {
|
|
3474
3462
|
return this._scoped(async () => {
|
|
3475
|
-
const s =
|
|
3463
|
+
const s = _chunkF2YAA4SEcjs.store.call(void 0, );
|
|
3476
3464
|
if (!s.forget_pii) {
|
|
3477
3465
|
throw new Error(
|
|
3478
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).`
|
|
3479
3467
|
);
|
|
3480
3468
|
}
|
|
3481
3469
|
const eventCount = await s.forget_pii(stream);
|
|
3482
|
-
await
|
|
3470
|
+
await _chunkF2YAA4SEcjs.cache.call(void 0, ).invalidate(stream);
|
|
3483
3471
|
if (eventCount > 0) {
|
|
3484
3472
|
this.emit("forgotten", { stream, at: /* @__PURE__ */ new Date(), eventCount });
|
|
3485
3473
|
}
|
|
@@ -3513,7 +3501,7 @@ var Act = (_class7 = class {
|
|
|
3513
3501
|
* @see {@link correlate} for dynamic stream discovery
|
|
3514
3502
|
*/
|
|
3515
3503
|
async drain(options = {}) {
|
|
3516
|
-
|
|
3504
|
+
_chunkF2YAA4SEcjs.resolveDrainConfig.call(void 0, options);
|
|
3517
3505
|
if (!this._drain)
|
|
3518
3506
|
return { fetched: [], leased: [], acked: [], blocked: [] };
|
|
3519
3507
|
return this._scoped(() => this._drain_all(options));
|
|
@@ -3695,7 +3683,7 @@ var Act = (_class7 = class {
|
|
|
3695
3683
|
*/
|
|
3696
3684
|
async reset(input) {
|
|
3697
3685
|
return this._scoped(async () => {
|
|
3698
|
-
const count = await
|
|
3686
|
+
const count = await _chunkF2YAA4SEcjs.store.call(void 0, ).reset(input);
|
|
3699
3687
|
for (const handler of this._batch_handlers.values())
|
|
3700
3688
|
_optionalChain([handler, 'access', _142 => _142[FOLD_RESET], 'optionalCall', _143 => _143()]);
|
|
3701
3689
|
if (count > 0) {
|
|
@@ -3731,7 +3719,7 @@ var Act = (_class7 = class {
|
|
|
3731
3719
|
*/
|
|
3732
3720
|
async unblock(input) {
|
|
3733
3721
|
return this._scoped(async () => {
|
|
3734
|
-
const count = await
|
|
3722
|
+
const count = await _chunkF2YAA4SEcjs.store.call(void 0, ).unblock(input);
|
|
3735
3723
|
if (count > 0) {
|
|
3736
3724
|
this._wake();
|
|
3737
3725
|
}
|
|
@@ -3786,7 +3774,7 @@ var Act = (_class7 = class {
|
|
|
3786
3774
|
return { ...partial, duration_ms: Date.now() - started };
|
|
3787
3775
|
}
|
|
3788
3776
|
const target = _nullishCoalesce(sink, () => ( (() => {
|
|
3789
|
-
const s =
|
|
3777
|
+
const s = _chunkF2YAA4SEcjs.store.call(void 0, );
|
|
3790
3778
|
if (!s.restore) throw new Error("adapter has no restore capability");
|
|
3791
3779
|
return s;
|
|
3792
3780
|
})()));
|
|
@@ -3832,7 +3820,7 @@ var Act = (_class7 = class {
|
|
|
3832
3820
|
async blocked_streams(options) {
|
|
3833
3821
|
return this._scoped(async () => {
|
|
3834
3822
|
const positions = [];
|
|
3835
|
-
await
|
|
3823
|
+
await _chunkF2YAA4SEcjs.store.call(void 0, ).query_streams(
|
|
3836
3824
|
(p) => {
|
|
3837
3825
|
positions.push(p);
|
|
3838
3826
|
},
|
|
@@ -3884,7 +3872,7 @@ var Act = (_class7 = class {
|
|
|
3884
3872
|
* @see {@link Store.prioritize} for the underlying primitive
|
|
3885
3873
|
*/
|
|
3886
3874
|
async prioritize(filter, priority) {
|
|
3887
|
-
return this._scoped(() =>
|
|
3875
|
+
return this._scoped(() => _chunkF2YAA4SEcjs.store.call(void 0, ).prioritize(filter, priority));
|
|
3888
3876
|
}
|
|
3889
3877
|
/** Shared by `close()` and reaction-requested closes. */
|
|
3890
3878
|
async _run_close(targets) {
|
|
@@ -3964,7 +3952,7 @@ var Act = (_class7 = class {
|
|
|
3964
3952
|
* @see {@link correlate} for manual correlation
|
|
3965
3953
|
*/
|
|
3966
3954
|
settle(options) {
|
|
3967
|
-
|
|
3955
|
+
_chunkF2YAA4SEcjs.resolveSettleConfig.call(void 0, _nullishCoalesce(options, () => ( {})));
|
|
3968
3956
|
this._schedule(options);
|
|
3969
3957
|
}
|
|
3970
3958
|
}, _class7);
|
|
@@ -4120,16 +4108,16 @@ function synthesize_autoclose_reactions(registry, states, read_window) {
|
|
|
4120
4108
|
}),
|
|
4121
4109
|
// Never block on autoclose: a transient query/store error should retry,
|
|
4122
4110
|
// not quarantine the synthetic stream.
|
|
4123
|
-
options: { blockOnError: false, maxRetries:
|
|
4111
|
+
options: { blockOnError: false, maxRetries: _chunkF2YAA4SEcjs.DEFAULT_MAX_RETRIES },
|
|
4124
4112
|
handler: async (event) => {
|
|
4125
4113
|
const aggregate = event.stream;
|
|
4126
4114
|
const window = read_window();
|
|
4127
4115
|
if (!in_autoclose_window(window, /* @__PURE__ */ new Date()))
|
|
4128
|
-
throw new (0,
|
|
4129
|
-
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], {
|
|
4130
4118
|
count: true,
|
|
4131
4119
|
tail: keep_days !== void 0 ? true : void 0,
|
|
4132
|
-
exclude: [
|
|
4120
|
+
exclude: [_chunk4KDMNSPJcjs.TOMBSTONE_EVENT, _chunk4KDMNSPJcjs.SNAP_EVENT]
|
|
4133
4121
|
});
|
|
4134
4122
|
const entry = stats.get(aggregate);
|
|
4135
4123
|
if (!entry) return;
|
|
@@ -4160,7 +4148,7 @@ function synthesize_autoclose_reactions(registry, states, read_window) {
|
|
|
4160
4148
|
dues.push(days_after(entry.tail.created, keep_days));
|
|
4161
4149
|
const future = dues.map((d) => d.getTime()).filter((t) => t > Date.now());
|
|
4162
4150
|
if (future.length)
|
|
4163
|
-
throw new (0,
|
|
4151
|
+
throw new (0, _chunk4KDMNSPJcjs.DeferSignal)({ at: new Date(Math.min(...future)) });
|
|
4164
4152
|
}
|
|
4165
4153
|
};
|
|
4166
4154
|
const key = `__autoclose_${st.name}`;
|
|
@@ -4365,9 +4353,9 @@ var _this_ = ({ stream }) => ({
|
|
|
4365
4353
|
|
|
4366
4354
|
// src/builders/builder-utils.ts
|
|
4367
4355
|
function register_lane(config2, lanes) {
|
|
4368
|
-
|
|
4369
|
-
if (config2.name ===
|
|
4370
|
-
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`);
|
|
4371
4359
|
const existing = lanes.find((l) => l.name === config2.name);
|
|
4372
4360
|
if (!existing) return void lanes.push(config2);
|
|
4373
4361
|
if (existing.leaseMillis !== config2.leaseMillis || existing.streamLimit !== config2.streamLimit || existing.cycleMs !== config2.cycleMs)
|
|
@@ -4409,9 +4397,9 @@ function reaction_on(event, events, builder) {
|
|
|
4409
4397
|
// Validate the whole bag at the declaration site so a bad
|
|
4410
4398
|
// `maxRetries`/`backoff`/`blockOnError` throws ZodError at build,
|
|
4411
4399
|
// not a NaN gate on the first retry.
|
|
4412
|
-
options:
|
|
4413
|
-
blockOnError: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _158 => _158.blockOnError]), () => (
|
|
4414
|
-
maxRetries: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _159 => _159.maxRetries]), () => (
|
|
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)),
|
|
4415
4403
|
backoff: _optionalChain([options, 'optionalAccess', _160 => _160.backoff])
|
|
4416
4404
|
})
|
|
4417
4405
|
};
|
|
@@ -4496,7 +4484,7 @@ function date_reviver_schema(schema) {
|
|
|
4496
4484
|
|
|
4497
4485
|
// src/builders/event-builder.ts
|
|
4498
4486
|
function event_tags(schema) {
|
|
4499
|
-
const pii =
|
|
4487
|
+
const pii = _chunk4KDMNSPJcjs.pii_schemas.call(void 0, schema);
|
|
4500
4488
|
const pii_dates = {};
|
|
4501
4489
|
for (const [key, field] of Object.entries(pii)) {
|
|
4502
4490
|
const dates = date_reviver_schema(field);
|
|
@@ -4533,7 +4521,7 @@ function make_event_reader(tags, disclosure, predicate = null) {
|
|
|
4533
4521
|
});
|
|
4534
4522
|
}
|
|
4535
4523
|
function build_events(registry, states, lanes, owners) {
|
|
4536
|
-
const declared = /* @__PURE__ */ new Set([
|
|
4524
|
+
const declared = /* @__PURE__ */ new Set([_chunk4KDMNSPJcjs.DEFAULT_LANE, ...lanes.map((l) => l.name)]);
|
|
4537
4525
|
const lane_errors = [];
|
|
4538
4526
|
const tags = /* @__PURE__ */ new Map();
|
|
4539
4527
|
const sensitive2 = /* @__PURE__ */ new Map();
|
|
@@ -4597,7 +4585,7 @@ function build_events(registry, states, lanes, owners) {
|
|
|
4597
4585
|
if (reader) readers.set(event_name, reader);
|
|
4598
4586
|
}
|
|
4599
4587
|
const snap2 = make_event_reader(event_tags(state2.state), "redact", null);
|
|
4600
|
-
if (snap2) readers.set(
|
|
4588
|
+
if (snap2) readers.set(_chunk4KDMNSPJcjs.SNAP_EVENT, snap2);
|
|
4601
4589
|
if (readers.size === 0) continue;
|
|
4602
4590
|
state2.view = (event, actor) => (_nullishCoalesce(readers.get(event.name), () => ( IDENTITY_GATE)))(event, actor);
|
|
4603
4591
|
}
|
|
@@ -4713,7 +4701,7 @@ function act() {
|
|
|
4713
4701
|
const list = deprecation_summary.map(
|
|
4714
4702
|
(d) => `"${d.deprecated}" (current: "${d.current}", state: "${d.state_name}")`
|
|
4715
4703
|
).join(", ");
|
|
4716
|
-
|
|
4704
|
+
_chunkF2YAA4SEcjs.log.call(void 0, ).info(
|
|
4717
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.`
|
|
4718
4706
|
);
|
|
4719
4707
|
}
|
|
@@ -4755,7 +4743,7 @@ function act() {
|
|
|
4755
4743
|
return reaction_on(event, registry.events, builder);
|
|
4756
4744
|
},
|
|
4757
4745
|
build: (options) => {
|
|
4758
|
-
|
|
4746
|
+
_chunkF2YAA4SEcjs.resolveActConfig.call(void 0, options);
|
|
4759
4747
|
if (!_built) {
|
|
4760
4748
|
for (const proj of pending_projections) add_projection(proj);
|
|
4761
4749
|
for (const proj of fold_projections) {
|
|
@@ -4806,7 +4794,7 @@ function act() {
|
|
|
4806
4794
|
synthesize_autoclose_reactions(
|
|
4807
4795
|
registry,
|
|
4808
4796
|
states,
|
|
4809
|
-
|
|
4797
|
+
_chunkF2YAA4SEcjs.current_autoclose_window
|
|
4810
4798
|
);
|
|
4811
4799
|
Object.freeze(registry.actions);
|
|
4812
4800
|
Object.freeze(registry.events);
|
|
@@ -4854,8 +4842,8 @@ function _projection(target) {
|
|
|
4854
4842
|
handler,
|
|
4855
4843
|
resolver: _nullishCoalesce(default_resolver, () => ( _this_)),
|
|
4856
4844
|
options: {
|
|
4857
|
-
blockOnError:
|
|
4858
|
-
maxRetries:
|
|
4845
|
+
blockOnError: _chunkF2YAA4SEcjs.DEFAULT_BLOCK_ON_ERROR,
|
|
4846
|
+
maxRetries: _chunkF2YAA4SEcjs.DEFAULT_MAX_RETRIES
|
|
4859
4847
|
}
|
|
4860
4848
|
}),
|
|
4861
4849
|
widened
|
|
@@ -4896,7 +4884,7 @@ function _projection(target) {
|
|
|
4896
4884
|
throw new Error(
|
|
4897
4885
|
`Projection "${target}" .of() partials must share one state name \u2014 got "${name}" and "${partial.name}"`
|
|
4898
4886
|
);
|
|
4899
|
-
const config2 =
|
|
4887
|
+
const config2 = _chunkF2YAA4SEcjs.resolveFoldConfig.call(void 0, options);
|
|
4900
4888
|
const fold_events = {};
|
|
4901
4889
|
for (const partial of partials)
|
|
4902
4890
|
for (const [event_name, schema] of Object.entries(partial.events)) {
|
|
@@ -4914,8 +4902,8 @@ function _projection(target) {
|
|
|
4914
4902
|
handler: noop,
|
|
4915
4903
|
resolver: { target },
|
|
4916
4904
|
options: {
|
|
4917
|
-
blockOnError:
|
|
4918
|
-
maxRetries:
|
|
4905
|
+
blockOnError: _chunkF2YAA4SEcjs.DEFAULT_BLOCK_ON_ERROR,
|
|
4906
|
+
maxRetries: _chunkF2YAA4SEcjs.DEFAULT_MAX_RETRIES
|
|
4919
4907
|
}
|
|
4920
4908
|
}
|
|
4921
4909
|
]
|
|
@@ -5031,7 +5019,7 @@ function action_builder(state2) {
|
|
|
5031
5019
|
throw new Error(`Duplicate action "${action2}"`);
|
|
5032
5020
|
internal.actions[action2] = schema;
|
|
5033
5021
|
if (options) {
|
|
5034
|
-
|
|
5022
|
+
_chunkF2YAA4SEcjs.resolveActionConfig.call(void 0, options);
|
|
5035
5023
|
internal.options ??= {};
|
|
5036
5024
|
internal.options[action2] = options;
|
|
5037
5025
|
}
|
|
@@ -5324,5 +5312,5 @@ function write_line(writer, line) {
|
|
|
5324
5312
|
|
|
5325
5313
|
|
|
5326
5314
|
|
|
5327
|
-
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;
|
|
5328
5316
|
//# sourceMappingURL=index.cjs.map
|