@rotorsoft/act 1.35.1 → 1.35.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/@types/act.d.ts.map +1 -1
- package/dist/@types/builders/act-builder.d.ts.map +1 -1
- package/dist/@types/builders/projection-builder.d.ts +25 -3
- package/dist/@types/builders/projection-builder.d.ts.map +1 -1
- package/dist/@types/internal/autoclose-policy.d.ts +23 -23
- package/dist/@types/internal/autoclose-policy.d.ts.map +1 -1
- package/dist/@types/internal/classify.d.ts +4 -4
- package/dist/@types/internal/classify.d.ts.map +1 -1
- package/dist/@types/internal/event-sourcing.d.ts.map +1 -1
- package/dist/@types/internal/projection-fold.d.ts +2 -2
- package/dist/@types/internal/projection-fold.d.ts.map +1 -1
- package/dist/@types/internal/tracing.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 +198 -212
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +23 -37
- 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
|
);
|
|
@@ -746,7 +746,7 @@ var CircuitBreaker = (_class = class {
|
|
|
746
746
|
}, _class);
|
|
747
747
|
|
|
748
748
|
// src/internal/classify.ts
|
|
749
|
-
var ALL_LANES = /* @__PURE__ */ Symbol("act
|
|
749
|
+
var ALL_LANES = /* @__PURE__ */ Symbol("act/all-lanes");
|
|
750
750
|
function classify_registry(registry, states) {
|
|
751
751
|
const statics = /* @__PURE__ */ new Map();
|
|
752
752
|
const target_lanes = /* @__PURE__ */ new Map();
|
|
@@ -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";
|
|
@@ -2109,7 +2097,7 @@ function build_es(logger, correlator = default_correlator, patch_fn = bare_patch
|
|
|
2109
2097
|
action_name,
|
|
2110
2098
|
target,
|
|
2111
2099
|
payload,
|
|
2112
|
-
{
|
|
2100
|
+
{ ...options, correlator: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _102 => _102.correlator]), () => ( correlator)) },
|
|
2113
2101
|
patch_fn
|
|
2114
2102
|
);
|
|
2115
2103
|
const bound_load = (me, target, callback) => load(me, target, callback, patch_fn);
|
|
@@ -2149,17 +2137,15 @@ function build_es(logger, correlator = default_correlator, patch_fn = bare_patch
|
|
|
2149
2137
|
action: traced(
|
|
2150
2138
|
bound_action,
|
|
2151
2139
|
(snapshots, _me, _action, target) => {
|
|
2152
|
-
|
|
2153
|
-
if (committed.length) {
|
|
2140
|
+
if (snapshots[0].patch)
|
|
2154
2141
|
logger.trace(
|
|
2155
|
-
|
|
2142
|
+
snapshots.map((s) => s.event.data),
|
|
2156
2143
|
es_caption(
|
|
2157
2144
|
"committed",
|
|
2158
2145
|
C_ORANGE,
|
|
2159
|
-
`${target.stream}.${
|
|
2146
|
+
`${target.stream}.${snapshots.map((s) => s.event.name).join(", ")}`
|
|
2160
2147
|
)
|
|
2161
2148
|
);
|
|
2162
|
-
}
|
|
2163
2149
|
},
|
|
2164
2150
|
(_me, action2, target, payload) => {
|
|
2165
2151
|
logger.trace(
|
|
@@ -2185,7 +2171,7 @@ function build_drain(logger) {
|
|
|
2185
2171
|
subscribe: logger.level !== "trace" ? subscribe : traced(subscribe, (result, streams) => {
|
|
2186
2172
|
if (!result.subscribed) return;
|
|
2187
2173
|
const lanes = new Set(streams.map((s) => _nullishCoalesce(s.lane, () => ( "default"))));
|
|
2188
|
-
const uniform_lane = lanes.size === 1 ? _optionalChain([streams, 'access',
|
|
2174
|
+
const uniform_lane = lanes.size === 1 ? _optionalChain([streams, 'access', _103 => _103[0], 'optionalAccess', _104 => _104.lane]) : void 0;
|
|
2189
2175
|
const data = streams.map(
|
|
2190
2176
|
({ stream, lane }) => uniform_lane || !lane || lane === "default" ? hue(C_STREAM, stream) : `${hue(C_STREAM, stream)}${dim(`[${lane}]`)}`
|
|
2191
2177
|
).join(" ");
|
|
@@ -2197,7 +2183,7 @@ function build_drain(logger) {
|
|
|
2197
2183
|
}
|
|
2198
2184
|
function trace_cycle(logger, leased, fetched, handled, acked, blocked) {
|
|
2199
2185
|
if (logger.level !== "trace" || !leased.length) return;
|
|
2200
|
-
const lane = _optionalChain([leased, 'access',
|
|
2186
|
+
const lane = _optionalChain([leased, 'access', _105 => _105[0], 'optionalAccess', _106 => _106.lane]);
|
|
2201
2187
|
const fetch_by_stream = new Map(fetched.map((f) => [f.stream, f]));
|
|
2202
2188
|
const acked_by_stream = new Map(acked.map((a) => [a.stream, a.at]));
|
|
2203
2189
|
const blocked_by_stream = new Map(blocked.map((b) => [b.stream, b.error]));
|
|
@@ -2206,8 +2192,8 @@ function trace_cycle(logger, leased, fetched, handled, acked, blocked) {
|
|
|
2206
2192
|
);
|
|
2207
2193
|
const detail = leased.map(({ stream, at, retry }) => {
|
|
2208
2194
|
const f = fetch_by_stream.get(stream);
|
|
2209
|
-
const key = _optionalChain([f, 'optionalAccess',
|
|
2210
|
-
const events = _optionalChain([f, 'optionalAccess',
|
|
2195
|
+
const key = _optionalChain([f, 'optionalAccess', _107 => _107.source]) ? `${hue(C_STREAM, stream)}${dim(`<-${f.source}`)}` : hue(C_STREAM, stream);
|
|
2196
|
+
const events = _optionalChain([f, 'optionalAccess', _108 => _108.events, 'access', _109 => _109.length]) ? ` ${dim(
|
|
2211
2197
|
`[${f.events.map(({ id, name }) => `#${id} ${String(name)}`).join(", ")}]`
|
|
2212
2198
|
)}` : "";
|
|
2213
2199
|
const acked_at = acked_by_stream.get(stream);
|
|
@@ -2235,10 +2221,10 @@ function trace_cycle(logger, leased, fetched, handled, acked, blocked) {
|
|
|
2235
2221
|
|
|
2236
2222
|
// src/internal/drain-cycle.ts
|
|
2237
2223
|
function budget_exhausted(lease, options, store_failing) {
|
|
2238
|
-
if (store_failing || !_optionalChain([options, 'optionalAccess',
|
|
2224
|
+
if (store_failing || !_optionalChain([options, 'optionalAccess', _110 => _110.blockOnError]) || lease.retry <= options.maxRetries)
|
|
2239
2225
|
return void 0;
|
|
2240
2226
|
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
|
-
|
|
2227
|
+
_chunkF2YAA4SEcjs.log.call(void 0, ).error(error);
|
|
2242
2228
|
return { lease, handled: 0, acked_at: lease.at, error, block: true };
|
|
2243
2229
|
}
|
|
2244
2230
|
function fetch_failure_policy(registry) {
|
|
@@ -2254,13 +2240,13 @@ function fetch_failure_policy(registry) {
|
|
|
2254
2240
|
function finalize(lease, handled, at, error, options, logger, failed_at) {
|
|
2255
2241
|
if (!error) return { lease, handled, acked_at: at };
|
|
2256
2242
|
logger.error(error);
|
|
2257
|
-
const non_retryable = error instanceof
|
|
2243
|
+
const non_retryable = error instanceof _chunk4KDMNSPJcjs.NonRetryableError;
|
|
2258
2244
|
const block2 = options.blockOnError && (non_retryable || lease.retry >= options.maxRetries);
|
|
2259
2245
|
if (block2)
|
|
2260
2246
|
logger.error(
|
|
2261
2247
|
non_retryable ? `Blocking ${lease.stream} on non-retryable error.` : `Blocking ${lease.stream} after ${lease.retry} retries.`
|
|
2262
2248
|
);
|
|
2263
|
-
const next_attempt_at = block2 ? void 0 : Date.now() + compute_backoff_delay(lease.retry, _nullishCoalesce(options.backoff, () => (
|
|
2249
|
+
const next_attempt_at = block2 ? void 0 : Date.now() + compute_backoff_delay(lease.retry, _nullishCoalesce(options.backoff, () => ( _chunkF2YAA4SEcjs.DEFAULT_BACKOFF)));
|
|
2264
2250
|
return {
|
|
2265
2251
|
lease,
|
|
2266
2252
|
handled,
|
|
@@ -2299,7 +2285,7 @@ async function run_drain_cycle(deps, cycle) {
|
|
|
2299
2285
|
const fetched = await ops.fetch(leased, eventLimit);
|
|
2300
2286
|
const fetch_map = /* @__PURE__ */ new Map();
|
|
2301
2287
|
const fetch_window_at = fetched.reduce(
|
|
2302
|
-
(max, { at, events }) => Math.max(max, _optionalChain([events, 'access',
|
|
2288
|
+
(max, { at, events }) => Math.max(max, _optionalChain([events, 'access', _111 => _111.at, 'call', _112 => _112(-1), 'optionalAccess', _113 => _113.id]) || at),
|
|
2303
2289
|
0
|
|
2304
2290
|
);
|
|
2305
2291
|
for (const f of fetched) {
|
|
@@ -2363,11 +2349,11 @@ async function run_drain_cycle(deps, cycle) {
|
|
|
2363
2349
|
deps.logger
|
|
2364
2350
|
)
|
|
2365
2351
|
);
|
|
2366
|
-
const at = _optionalChain([entry, 'access',
|
|
2352
|
+
const at = _optionalChain([entry, 'access', _114 => _114.fetch, 'access', _115 => _115.events, 'access', _116 => _116.at, 'call', _117 => _117(-1), 'optionalAccess', _118 => _118.id]) || fetch_window_at;
|
|
2367
2353
|
const { payloads } = entry;
|
|
2368
2354
|
const exhausted = budget_exhausted(
|
|
2369
2355
|
lease,
|
|
2370
|
-
_optionalChain([payloads, 'access',
|
|
2356
|
+
_optionalChain([payloads, 'access', _119 => _119[0], 'optionalAccess', _120 => _120.options]),
|
|
2371
2357
|
store_failing
|
|
2372
2358
|
);
|
|
2373
2359
|
if (exhausted) return Promise.resolve(exhausted);
|
|
@@ -2388,7 +2374,7 @@ async function run_drain_cycle(deps, cycle) {
|
|
|
2388
2374
|
const acked = submitted.length ? await ops.ack(submitted) : [];
|
|
2389
2375
|
const expected = submitted.filter((l) => l.due === void 0).length;
|
|
2390
2376
|
if (acked.length < expected)
|
|
2391
|
-
|
|
2377
|
+
_chunkF2YAA4SEcjs.log.call(void 0, ).warn(
|
|
2392
2378
|
`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
2379
|
);
|
|
2394
2380
|
const closeable = handled.filter((h) => h.close !== void 0).map((h) => h.close);
|
|
@@ -2456,7 +2442,7 @@ var DrainController = (_class5 = class {
|
|
|
2456
2442
|
}
|
|
2457
2443
|
/** This lane's configured lease, or `undefined`; the shutdown grace basis. */
|
|
2458
2444
|
get lease_millis() {
|
|
2459
|
-
return _optionalChain([this, 'access',
|
|
2445
|
+
return _optionalChain([this, 'access', _121 => _121._deps, 'access', _122 => _122.defaults, 'optionalAccess', _123 => _123.leaseMillis]);
|
|
2460
2446
|
}
|
|
2461
2447
|
get lane() {
|
|
2462
2448
|
return this._deps.lane;
|
|
@@ -2488,9 +2474,9 @@ var DrainController = (_class5 = class {
|
|
|
2488
2474
|
if (!this.armed || this._stopped || this._inflight)
|
|
2489
2475
|
return EMPTY_DRAIN;
|
|
2490
2476
|
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)), () => (
|
|
2477
|
+
const streamLimit = _nullishCoalesce(_nullishCoalesce(d.streamLimit, () => ( options.streamLimit)), () => ( _chunkF2YAA4SEcjs.DEFAULT_STREAM_LIMIT));
|
|
2478
|
+
const eventLimit = _nullishCoalesce(options.eventLimit, () => ( _chunkF2YAA4SEcjs.DEFAULT_EVENT_LIMIT));
|
|
2479
|
+
const leaseMillis = _nullishCoalesce(_nullishCoalesce(d.leaseMillis, () => ( options.leaseMillis)), () => ( _chunkF2YAA4SEcjs.DEFAULT_LEASE_MILLIS));
|
|
2494
2480
|
if (this._deps.breaker.state(Date.now()) === "open")
|
|
2495
2481
|
return EMPTY_DRAIN;
|
|
2496
2482
|
const pass = this._pass(streamLimit, eventLimit, leaseMillis).finally(
|
|
@@ -2565,7 +2551,7 @@ function pii_gate(event, fields, predicate, actor) {
|
|
|
2565
2551
|
const { pii, ...rest } = event;
|
|
2566
2552
|
if (pii == null) {
|
|
2567
2553
|
const shredded = { ...data };
|
|
2568
|
-
for (const f of fields) shredded[f] =
|
|
2554
|
+
for (const f of fields) shredded[f] = _chunk4KDMNSPJcjs.SHREDDED;
|
|
2569
2555
|
return { ...rest, data: shredded };
|
|
2570
2556
|
}
|
|
2571
2557
|
const allowed = !!actor && !!predicate && predicate(event, actor);
|
|
@@ -2576,7 +2562,7 @@ function pii_gate(event, fields, predicate, actor) {
|
|
|
2576
2562
|
};
|
|
2577
2563
|
}
|
|
2578
2564
|
const redacted = { ...data };
|
|
2579
|
-
for (const f of fields) redacted[f] =
|
|
2565
|
+
for (const f of fields) redacted[f] = _chunk4KDMNSPJcjs.REDACTED;
|
|
2580
2566
|
return { ...rest, data: redacted };
|
|
2581
2567
|
}
|
|
2582
2568
|
var IDENTITY_GATE = (event) => event;
|
|
@@ -2598,7 +2584,7 @@ function pii_strip(event, fields) {
|
|
|
2598
2584
|
|
|
2599
2585
|
// src/internal/projection-fold.ts
|
|
2600
2586
|
var FOLD_RESET = /* @__PURE__ */ Symbol("act.fold.reset");
|
|
2601
|
-
function make_fold_handler(me, flush, config2,
|
|
2587
|
+
function make_fold_handler(me, flush, config2, sensitive_fields) {
|
|
2602
2588
|
const load_me = {
|
|
2603
2589
|
...me,
|
|
2604
2590
|
view: (raw, actor) => {
|
|
@@ -2628,7 +2614,7 @@ function make_fold_handler(me, flush, config2, patch_fn, sensitive_fields) {
|
|
|
2628
2614
|
if (evictee.dirty) await flush([row(evictee)]);
|
|
2629
2615
|
cache2.delete(oldest);
|
|
2630
2616
|
}
|
|
2631
|
-
const snapshot = await load(load_me, { stream }
|
|
2617
|
+
const snapshot = await load(load_me, { stream });
|
|
2632
2618
|
const seated = {
|
|
2633
2619
|
stream,
|
|
2634
2620
|
state: snapshot.state,
|
|
@@ -2659,7 +2645,7 @@ function make_fold_handler(me, flush, config2, patch_fn, sensitive_fields) {
|
|
|
2659
2645
|
}
|
|
2660
2646
|
if (event.id > fold.event_id) {
|
|
2661
2647
|
const reducer = me.patch[event.name];
|
|
2662
|
-
fold.state =
|
|
2648
|
+
fold.state = bare_patch(
|
|
2663
2649
|
me,
|
|
2664
2650
|
fold.state,
|
|
2665
2651
|
reducer(event, fold.state),
|
|
@@ -2713,7 +2699,7 @@ function make_deferred(handler, schedule) {
|
|
|
2713
2699
|
const call = handler;
|
|
2714
2700
|
const deferred = async (event, stream, app) => {
|
|
2715
2701
|
const when = typeof schedule === "function" ? schedule(event) : schedule;
|
|
2716
|
-
if (Date.now() < resolve_defer_at(when, event)) throw new (0,
|
|
2702
|
+
if (Date.now() < resolve_defer_at(when, event)) throw new (0, _chunk4KDMNSPJcjs.DeferSignal)(when);
|
|
2717
2703
|
return call(event, stream, app);
|
|
2718
2704
|
};
|
|
2719
2705
|
Object.defineProperty(deferred, "name", { value: handler.name });
|
|
@@ -2749,10 +2735,10 @@ var CloseSignal = class extends Error {
|
|
|
2749
2735
|
constructor(opts) {
|
|
2750
2736
|
super("reaction requested close");
|
|
2751
2737
|
this.name = "CloseSignal";
|
|
2752
|
-
this.stream = _optionalChain([opts, 'optionalAccess',
|
|
2753
|
-
this.archive = _optionalChain([opts, 'optionalAccess',
|
|
2754
|
-
this.at = _optionalChain([opts, 'optionalAccess',
|
|
2755
|
-
this.before = _optionalChain([opts, 'optionalAccess',
|
|
2738
|
+
this.stream = _optionalChain([opts, 'optionalAccess', _124 => _124.stream]);
|
|
2739
|
+
this.archive = _optionalChain([opts, 'optionalAccess', _125 => _125.archive]);
|
|
2740
|
+
this.at = _optionalChain([opts, 'optionalAccess', _126 => _126.at]);
|
|
2741
|
+
this.before = _optionalChain([opts, 'optionalAccess', _127 => _127.before]);
|
|
2756
2742
|
}
|
|
2757
2743
|
};
|
|
2758
2744
|
function build_handle(deps) {
|
|
@@ -2782,7 +2768,7 @@ function build_handle(deps) {
|
|
|
2782
2768
|
handled++;
|
|
2783
2769
|
}
|
|
2784
2770
|
} catch (error) {
|
|
2785
|
-
if (error instanceof
|
|
2771
|
+
if (error instanceof _chunk4KDMNSPJcjs.DeferSignal) {
|
|
2786
2772
|
let defer;
|
|
2787
2773
|
try {
|
|
2788
2774
|
defer = resolve_defer_at(error.when, event);
|
|
@@ -2899,7 +2885,7 @@ var SettleLoop = (_class6 = class {
|
|
|
2899
2885
|
this._pending = true;
|
|
2900
2886
|
return;
|
|
2901
2887
|
}
|
|
2902
|
-
const delay = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
2888
|
+
const delay = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _128 => _128.debounceMs]), () => ( this._default_debounce_ms));
|
|
2903
2889
|
const due = Date.now() + delay;
|
|
2904
2890
|
if (this._timer) {
|
|
2905
2891
|
if (due >= this._due) return;
|
|
@@ -3046,7 +3032,7 @@ var Act = (_class7 = class {
|
|
|
3046
3032
|
/** Lanes to arm per event; `"all"` when a dynamic resolver hides the lane. */
|
|
3047
3033
|
|
|
3048
3034
|
|
|
3049
|
-
__init27() {this._logger =
|
|
3035
|
+
__init27() {this._logger = _chunkF2YAA4SEcjs.log.call(void 0, )}
|
|
3050
3036
|
/** This Act's ports: its own bag, or the singleton adapters. */
|
|
3051
3037
|
|
|
3052
3038
|
/** Runs a body so internal `store()`/`cache()` calls resolve to `_ports`. */
|
|
@@ -3068,9 +3054,9 @@ var Act = (_class7 = class {
|
|
|
3068
3054
|
this._lanes = lanes;
|
|
3069
3055
|
this._declared_lanes = ["default", ...lanes.map((l) => l.name)];
|
|
3070
3056
|
validate_only_lanes(options.onlyLanes, this._declared_lanes);
|
|
3071
|
-
this._ports = _nullishCoalesce(options.scoped, () => (
|
|
3057
|
+
this._ports = _nullishCoalesce(options.scoped, () => ( _chunkF2YAA4SEcjs.default_scope.call(void 0, )));
|
|
3072
3058
|
const ports = this._ports;
|
|
3073
|
-
this._scoped =
|
|
3059
|
+
this._scoped = _chunkF2YAA4SEcjs.make_run_scoped.call(void 0, {
|
|
3074
3060
|
// Getters, not a spread: the singletons resolve lazily, so a later
|
|
3075
3061
|
// `store(...)` / `cache(...)` still takes effect.
|
|
3076
3062
|
get store() {
|
|
@@ -3080,14 +3066,14 @@ var Act = (_class7 = class {
|
|
|
3080
3066
|
return ports.cache;
|
|
3081
3067
|
},
|
|
3082
3068
|
// Parsed per build, so a bad window throws on every build.
|
|
3083
|
-
autoclose_window:
|
|
3069
|
+
autoclose_window: _chunkF2YAA4SEcjs.resolveAutocloseConfig.call(void 0, options).autocloseWindow
|
|
3084
3070
|
});
|
|
3085
3071
|
this._correlator = _nullishCoalesce(options.correlator, () => ( default_correlator));
|
|
3086
3072
|
this._es = build_es(this._logger, this._correlator, patch_fn);
|
|
3087
3073
|
this._cd = build_drain(this._logger);
|
|
3088
3074
|
const handle = build_handle({
|
|
3089
3075
|
logger: this._logger,
|
|
3090
|
-
reaction_scope:
|
|
3076
|
+
reaction_scope: _chunkF2YAA4SEcjs.make_reaction_scope.call(void 0, {
|
|
3091
3077
|
do: this.do.bind(this),
|
|
3092
3078
|
load: this.load.bind(this),
|
|
3093
3079
|
query: this.query.bind(this),
|
|
@@ -3117,12 +3103,12 @@ var Act = (_class7 = class {
|
|
|
3117
3103
|
this._ports.store,
|
|
3118
3104
|
options.listen !== false
|
|
3119
3105
|
);
|
|
3120
|
-
|
|
3106
|
+
_chunkF2YAA4SEcjs.register_weak_disposer.call(void 0, new WeakRef(this), (self) => self.shutdown());
|
|
3121
3107
|
}
|
|
3122
3108
|
/** Shared by drain, settle and autoclose; bad knobs throw at build. */
|
|
3123
3109
|
_build_breaker(options) {
|
|
3124
3110
|
return new CircuitBreaker(
|
|
3125
|
-
|
|
3111
|
+
_chunkF2YAA4SEcjs.resolveCircuitBreakerConfig.call(void 0, options.circuitBreaker),
|
|
3126
3112
|
{
|
|
3127
3113
|
on_error: (error, circuit) => this._emit_error(error, circuit),
|
|
3128
3114
|
// When the cooldown elapses, settle once: its scan or claim is the
|
|
@@ -3134,7 +3120,7 @@ var Act = (_class7 = class {
|
|
|
3134
3120
|
/** Apps that declare no lanes pass no lane filter to `claim`. */
|
|
3135
3121
|
_build_drain_controllers(options, lanes, handle, handle_batch) {
|
|
3136
3122
|
const all_lanes = this._declared_lanes;
|
|
3137
|
-
const only_set = _optionalChain([options, 'access',
|
|
3123
|
+
const only_set = _optionalChain([options, 'access', _129 => _129.onlyLanes, 'optionalAccess', _130 => _130.length]) ? new Set(options.onlyLanes) : void 0;
|
|
3138
3124
|
const active_lanes = only_set ? all_lanes.filter((n) => only_set.has(n)) : all_lanes;
|
|
3139
3125
|
const single_default_lane = lanes.length === 0;
|
|
3140
3126
|
const controllers = /* @__PURE__ */ new Map();
|
|
@@ -3156,7 +3142,7 @@ var Act = (_class7 = class {
|
|
|
3156
3142
|
try {
|
|
3157
3143
|
await this._run_close(targets);
|
|
3158
3144
|
} catch (error) {
|
|
3159
|
-
if (error instanceof
|
|
3145
|
+
if (error instanceof _chunk4KDMNSPJcjs.StoreError) throw error;
|
|
3160
3146
|
this._logger.error(
|
|
3161
3147
|
error,
|
|
3162
3148
|
`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.`
|
|
@@ -3171,7 +3157,7 @@ var Act = (_class7 = class {
|
|
|
3171
3157
|
leaseMillis: cfg.leaseMillis
|
|
3172
3158
|
}
|
|
3173
3159
|
});
|
|
3174
|
-
if (_optionalChain([cfg, 'optionalAccess',
|
|
3160
|
+
if (_optionalChain([cfg, 'optionalAccess', _131 => _131.cycleMs]) !== void 0 && this._drain)
|
|
3175
3161
|
controller.start(cfg.cycleMs);
|
|
3176
3162
|
controllers.set(name, controller);
|
|
3177
3163
|
}
|
|
@@ -3190,7 +3176,7 @@ var Act = (_class7 = class {
|
|
|
3190
3176
|
/** Audit deps, built after the controllers so the lane set is final. */
|
|
3191
3177
|
_build_audit_deps() {
|
|
3192
3178
|
return {
|
|
3193
|
-
store:
|
|
3179
|
+
store: _chunkF2YAA4SEcjs.store,
|
|
3194
3180
|
event_to_state: this._event_to_state,
|
|
3195
3181
|
// Declared lanes, not this process's controllers: a lane another
|
|
3196
3182
|
// worker drains is not `unknown-lane`.
|
|
@@ -3203,7 +3189,7 @@ var Act = (_class7 = class {
|
|
|
3203
3189
|
registry: this.registry,
|
|
3204
3190
|
static_targets: classification.static_targets,
|
|
3205
3191
|
cd: this._cd,
|
|
3206
|
-
max_subscribed_streams: _nullishCoalesce(options.maxSubscribedStreams, () => (
|
|
3192
|
+
max_subscribed_streams: _nullishCoalesce(options.maxSubscribedStreams, () => ( _chunk4KDMNSPJcjs.DEFAULT_MAX_SUBSCRIBED_STREAMS)),
|
|
3207
3193
|
// Declared lanes (not active ones): a lane another process claims is
|
|
3208
3194
|
// still a valid destination.
|
|
3209
3195
|
declared_lanes: new Set(this._declared_lanes),
|
|
@@ -3219,10 +3205,10 @@ var Act = (_class7 = class {
|
|
|
3219
3205
|
/** Cold start: an idle deferred stream still fires on time after a restart. */
|
|
3220
3206
|
async _seed_persisted_defers() {
|
|
3221
3207
|
const now = Date.now();
|
|
3222
|
-
await walk_streams(
|
|
3208
|
+
await walk_streams(_chunkF2YAA4SEcjs.store.call(void 0, ), (pos) => {
|
|
3223
3209
|
if (pos.deferred_at === void 0 || pos.deferred_at <= now) return;
|
|
3224
3210
|
const controller = this._drain_controllers.get(_nullishCoalesce(pos.lane, () => ( "default")));
|
|
3225
|
-
_optionalChain([controller, 'optionalAccess',
|
|
3211
|
+
_optionalChain([controller, 'optionalAccess', _132 => _132.seed_defer, 'call', _133 => _133(pos.stream, pos.deferred_at)]);
|
|
3226
3212
|
});
|
|
3227
3213
|
}
|
|
3228
3214
|
_build_settle(options) {
|
|
@@ -3235,7 +3221,7 @@ var Act = (_class7 = class {
|
|
|
3235
3221
|
on_settled: (drain) => this.emit("settled", drain),
|
|
3236
3222
|
breaker: this._breaker
|
|
3237
3223
|
},
|
|
3238
|
-
_nullishCoalesce(options.settleDebounceMs, () => (
|
|
3224
|
+
_nullishCoalesce(options.settleDebounceMs, () => ( _chunk4KDMNSPJcjs.DEFAULT_SETTLE_DEBOUNCE_MS))
|
|
3239
3225
|
);
|
|
3240
3226
|
}
|
|
3241
3227
|
|
|
@@ -3255,7 +3241,7 @@ var Act = (_class7 = class {
|
|
|
3255
3241
|
*/
|
|
3256
3242
|
shutdown(options) {
|
|
3257
3243
|
if (!this._shutdown_promise) {
|
|
3258
|
-
|
|
3244
|
+
_chunkF2YAA4SEcjs.resolveShutdownConfig.call(void 0, options);
|
|
3259
3245
|
this._shutdown_promise = (async () => {
|
|
3260
3246
|
this.stop_correlations();
|
|
3261
3247
|
this._settle.stop(true);
|
|
@@ -3263,7 +3249,7 @@ var Act = (_class7 = class {
|
|
|
3263
3249
|
for (const c of this._drain_controllers.values()) c.stop();
|
|
3264
3250
|
const disposer = await this._notify_disposer;
|
|
3265
3251
|
if (disposer) await disposer();
|
|
3266
|
-
await this._await_inflight(_optionalChain([options, 'optionalAccess',
|
|
3252
|
+
await this._await_inflight(_optionalChain([options, 'optionalAccess', _134 => _134.graceMs]));
|
|
3267
3253
|
await this._scoped(() => this._correlate.release_correlation());
|
|
3268
3254
|
this._emitter.removeAllListeners();
|
|
3269
3255
|
})();
|
|
@@ -3275,10 +3261,10 @@ var Act = (_class7 = class {
|
|
|
3275
3261
|
* default for none or 0, and for a running settle), capped.
|
|
3276
3262
|
*/
|
|
3277
3263
|
_derive_grace_ms(running, settling) {
|
|
3278
|
-
let max = settling ?
|
|
3264
|
+
let max = settling ? _chunkF2YAA4SEcjs.DEFAULT_LEASE_MILLIS : 0;
|
|
3279
3265
|
for (const c of running)
|
|
3280
|
-
max = Math.max(max, c.lease_millis ||
|
|
3281
|
-
return Math.min(max,
|
|
3266
|
+
max = Math.max(max, c.lease_millis || _chunkF2YAA4SEcjs.DEFAULT_LEASE_MILLIS);
|
|
3267
|
+
return Math.min(max, _chunkF2YAA4SEcjs.MAX_SHUTDOWN_GRACE_MS);
|
|
3282
3268
|
}
|
|
3283
3269
|
async _await_inflight(grace_ms) {
|
|
3284
3270
|
const running = [...this._drain_controllers.values()].filter(
|
|
@@ -3361,8 +3347,8 @@ var Act = (_class7 = class {
|
|
|
3361
3347
|
* @see {@link ValidationError}, {@link PreconditionError}, {@link ConcurrencyError}
|
|
3362
3348
|
*/
|
|
3363
3349
|
async do(action2, target, payload, options) {
|
|
3364
|
-
const reacting_to = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
3365
|
-
const do_options = reacting_to === _optionalChain([options, 'optionalAccess',
|
|
3350
|
+
const reacting_to = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _135 => _135.reactingTo]), () => ( _chunkF2YAA4SEcjs.current_reacting.call(void 0, )));
|
|
3351
|
+
const do_options = reacting_to === _optionalChain([options, 'optionalAccess', _136 => _136.reactingTo]) ? options : { ...options, reactingTo: reacting_to };
|
|
3366
3352
|
return this._scoped(async () => {
|
|
3367
3353
|
const snapshots = await this._es.action(
|
|
3368
3354
|
this.registry.actions[action2],
|
|
@@ -3371,6 +3357,7 @@ var Act = (_class7 = class {
|
|
|
3371
3357
|
payload,
|
|
3372
3358
|
do_options
|
|
3373
3359
|
);
|
|
3360
|
+
if (!snapshots[0].patch) return snapshots;
|
|
3374
3361
|
this._wake(snapshots.map((s) => s.event.name));
|
|
3375
3362
|
this.emit("committed", snapshots);
|
|
3376
3363
|
return snapshots;
|
|
@@ -3422,11 +3409,11 @@ var Act = (_class7 = class {
|
|
|
3422
3409
|
return this._scoped(async () => {
|
|
3423
3410
|
let first;
|
|
3424
3411
|
let last;
|
|
3425
|
-
const count = await
|
|
3412
|
+
const count = await _chunkF2YAA4SEcjs.store.call(void 0, ).query((e) => {
|
|
3426
3413
|
const gated = this.registry.query_gate(e.name)(e);
|
|
3427
3414
|
if (!first) first = gated;
|
|
3428
3415
|
last = gated;
|
|
3429
|
-
_optionalChain([callback, 'optionalCall',
|
|
3416
|
+
_optionalChain([callback, 'optionalCall', _137 => _137(gated)]);
|
|
3430
3417
|
}, query);
|
|
3431
3418
|
return { first, last, count };
|
|
3432
3419
|
});
|
|
@@ -3452,7 +3439,7 @@ var Act = (_class7 = class {
|
|
|
3452
3439
|
async query_array(query) {
|
|
3453
3440
|
return this._scoped(async () => {
|
|
3454
3441
|
const events = [];
|
|
3455
|
-
await
|
|
3442
|
+
await _chunkF2YAA4SEcjs.store.call(void 0, ).query((e) => {
|
|
3456
3443
|
events.push(this.registry.query_gate(e.name)(e));
|
|
3457
3444
|
}, query);
|
|
3458
3445
|
return events;
|
|
@@ -3472,14 +3459,14 @@ var Act = (_class7 = class {
|
|
|
3472
3459
|
*/
|
|
3473
3460
|
async forget(stream) {
|
|
3474
3461
|
return this._scoped(async () => {
|
|
3475
|
-
const s =
|
|
3462
|
+
const s = _chunkF2YAA4SEcjs.store.call(void 0, );
|
|
3476
3463
|
if (!s.forget_pii) {
|
|
3477
3464
|
throw new Error(
|
|
3478
3465
|
`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
3466
|
);
|
|
3480
3467
|
}
|
|
3481
3468
|
const eventCount = await s.forget_pii(stream);
|
|
3482
|
-
await
|
|
3469
|
+
await _chunkF2YAA4SEcjs.cache.call(void 0, ).invalidate(stream);
|
|
3483
3470
|
if (eventCount > 0) {
|
|
3484
3471
|
this.emit("forgotten", { stream, at: /* @__PURE__ */ new Date(), eventCount });
|
|
3485
3472
|
}
|
|
@@ -3513,7 +3500,7 @@ var Act = (_class7 = class {
|
|
|
3513
3500
|
* @see {@link correlate} for dynamic stream discovery
|
|
3514
3501
|
*/
|
|
3515
3502
|
async drain(options = {}) {
|
|
3516
|
-
|
|
3503
|
+
_chunkF2YAA4SEcjs.resolveDrainConfig.call(void 0, options);
|
|
3517
3504
|
if (!this._drain)
|
|
3518
3505
|
return { fetched: [], leased: [], acked: [], blocked: [] };
|
|
3519
3506
|
return this._scoped(() => this._drain_all(options));
|
|
@@ -3553,7 +3540,7 @@ var Act = (_class7 = class {
|
|
|
3553
3540
|
}
|
|
3554
3541
|
if (to_arm.size === 0) return false;
|
|
3555
3542
|
this._correlate.arm();
|
|
3556
|
-
for (const lane of to_arm) _optionalChain([this, 'access',
|
|
3543
|
+
for (const lane of to_arm) _optionalChain([this, 'access', _138 => _138._drain_controllers, 'access', _139 => _139.get, 'call', _140 => _140(lane), 'optionalAccess', _141 => _141.arm, 'call', _142 => _142()]);
|
|
3557
3544
|
return true;
|
|
3558
3545
|
}
|
|
3559
3546
|
/** In parallel, so a slow lane never holds up a fast one. */
|
|
@@ -3695,9 +3682,9 @@ var Act = (_class7 = class {
|
|
|
3695
3682
|
*/
|
|
3696
3683
|
async reset(input) {
|
|
3697
3684
|
return this._scoped(async () => {
|
|
3698
|
-
const count = await
|
|
3685
|
+
const count = await _chunkF2YAA4SEcjs.store.call(void 0, ).reset(input);
|
|
3699
3686
|
for (const handler of this._batch_handlers.values())
|
|
3700
|
-
_optionalChain([handler, 'access',
|
|
3687
|
+
_optionalChain([handler, 'access', _143 => _143[FOLD_RESET], 'optionalCall', _144 => _144()]);
|
|
3701
3688
|
if (count > 0) {
|
|
3702
3689
|
this._wake();
|
|
3703
3690
|
}
|
|
@@ -3731,7 +3718,7 @@ var Act = (_class7 = class {
|
|
|
3731
3718
|
*/
|
|
3732
3719
|
async unblock(input) {
|
|
3733
3720
|
return this._scoped(async () => {
|
|
3734
|
-
const count = await
|
|
3721
|
+
const count = await _chunkF2YAA4SEcjs.store.call(void 0, ).unblock(input);
|
|
3735
3722
|
if (count > 0) {
|
|
3736
3723
|
this._wake();
|
|
3737
3724
|
}
|
|
@@ -3786,7 +3773,7 @@ var Act = (_class7 = class {
|
|
|
3786
3773
|
return { ...partial, duration_ms: Date.now() - started };
|
|
3787
3774
|
}
|
|
3788
3775
|
const target = _nullishCoalesce(sink, () => ( (() => {
|
|
3789
|
-
const s =
|
|
3776
|
+
const s = _chunkF2YAA4SEcjs.store.call(void 0, );
|
|
3790
3777
|
if (!s.restore) throw new Error("adapter has no restore capability");
|
|
3791
3778
|
return s;
|
|
3792
3779
|
})()));
|
|
@@ -3832,11 +3819,11 @@ var Act = (_class7 = class {
|
|
|
3832
3819
|
async blocked_streams(options) {
|
|
3833
3820
|
return this._scoped(async () => {
|
|
3834
3821
|
const positions = [];
|
|
3835
|
-
await
|
|
3822
|
+
await _chunkF2YAA4SEcjs.store.call(void 0, ).query_streams(
|
|
3836
3823
|
(p) => {
|
|
3837
3824
|
positions.push(p);
|
|
3838
3825
|
},
|
|
3839
|
-
{ blocked: true, after: _optionalChain([options, 'optionalAccess',
|
|
3826
|
+
{ blocked: true, after: _optionalChain([options, 'optionalAccess', _145 => _145.after]), limit: _optionalChain([options, 'optionalAccess', _146 => _146.limit]) }
|
|
3840
3827
|
);
|
|
3841
3828
|
return positions;
|
|
3842
3829
|
});
|
|
@@ -3884,7 +3871,7 @@ var Act = (_class7 = class {
|
|
|
3884
3871
|
* @see {@link Store.prioritize} for the underlying primitive
|
|
3885
3872
|
*/
|
|
3886
3873
|
async prioritize(filter, priority) {
|
|
3887
|
-
return this._scoped(() =>
|
|
3874
|
+
return this._scoped(() => _chunkF2YAA4SEcjs.store.call(void 0, ).prioritize(filter, priority));
|
|
3888
3875
|
}
|
|
3889
3876
|
/** Shared by `close()` and reaction-requested closes. */
|
|
3890
3877
|
async _run_close(targets) {
|
|
@@ -3964,7 +3951,7 @@ var Act = (_class7 = class {
|
|
|
3964
3951
|
* @see {@link correlate} for manual correlation
|
|
3965
3952
|
*/
|
|
3966
3953
|
settle(options) {
|
|
3967
|
-
|
|
3954
|
+
_chunkF2YAA4SEcjs.resolveSettleConfig.call(void 0, _nullishCoalesce(options, () => ( {})));
|
|
3968
3955
|
this._schedule(options);
|
|
3969
3956
|
}
|
|
3970
3957
|
}, _class7);
|
|
@@ -4030,12 +4017,12 @@ function policy_min_after_days(options) {
|
|
|
4030
4017
|
const parsed = AutoclosePolicySchema.parse(options);
|
|
4031
4018
|
const windows = [];
|
|
4032
4019
|
if (parsed.after) windows.push(parsed.after.days);
|
|
4033
|
-
if (_optionalChain([parsed, 'access',
|
|
4020
|
+
if (_optionalChain([parsed, 'access', _147 => _147.or, 'optionalAccess', _148 => _148.after])) windows.push(parsed.or.after.days);
|
|
4034
4021
|
return windows.length ? Math.min(...windows) : void 0;
|
|
4035
4022
|
}
|
|
4036
4023
|
function policy_keep_days(options) {
|
|
4037
4024
|
const parsed = AutoclosePolicySchema.parse(options);
|
|
4038
|
-
return _optionalChain([parsed, 'access',
|
|
4025
|
+
return _optionalChain([parsed, 'access', _149 => _149.keep, 'optionalAccess', _150 => _150.days]);
|
|
4039
4026
|
}
|
|
4040
4027
|
function compile_autoclose_policy(options) {
|
|
4041
4028
|
const parsed = AutoclosePolicySchema.parse(options);
|
|
@@ -4067,7 +4054,7 @@ function hour_in_zone(now, timeZone) {
|
|
|
4067
4054
|
hour: "2-digit",
|
|
4068
4055
|
hourCycle: "h23"
|
|
4069
4056
|
}).formatToParts(now);
|
|
4070
|
-
return Number(_optionalChain([parts, 'access',
|
|
4057
|
+
return Number(_optionalChain([parts, 'access', _151 => _151.find, 'call', _152 => _152((p) => p.type === "hour"), 'optionalAccess', _153 => _153.value]));
|
|
4071
4058
|
}
|
|
4072
4059
|
function hour_in_range(hour, start, end) {
|
|
4073
4060
|
return start < end ? hour >= start && hour < end : hour >= start || hour < end;
|
|
@@ -4120,16 +4107,16 @@ function synthesize_autoclose_reactions(registry, states, read_window) {
|
|
|
4120
4107
|
}),
|
|
4121
4108
|
// Never block on autoclose: a transient query/store error should retry,
|
|
4122
4109
|
// not quarantine the synthetic stream.
|
|
4123
|
-
options: { blockOnError: false, maxRetries:
|
|
4110
|
+
options: { blockOnError: false, maxRetries: _chunkF2YAA4SEcjs.DEFAULT_MAX_RETRIES },
|
|
4124
4111
|
handler: async (event) => {
|
|
4125
4112
|
const aggregate = event.stream;
|
|
4126
4113
|
const window = read_window();
|
|
4127
4114
|
if (!in_autoclose_window(window, /* @__PURE__ */ new Date()))
|
|
4128
|
-
throw new (0,
|
|
4129
|
-
const stats = await
|
|
4115
|
+
throw new (0, _chunk4KDMNSPJcjs.DeferSignal)({ at: next_window_open(window, /* @__PURE__ */ new Date()) });
|
|
4116
|
+
const stats = await _chunkF2YAA4SEcjs.store.call(void 0, ).query_stats([aggregate], {
|
|
4130
4117
|
count: true,
|
|
4131
4118
|
tail: keep_days !== void 0 ? true : void 0,
|
|
4132
|
-
exclude: [
|
|
4119
|
+
exclude: [_chunk4KDMNSPJcjs.TOMBSTONE_EVENT, _chunk4KDMNSPJcjs.SNAP_EVENT]
|
|
4133
4120
|
});
|
|
4134
4121
|
const entry = stats.get(aggregate);
|
|
4135
4122
|
if (!entry) return;
|
|
@@ -4160,12 +4147,12 @@ function synthesize_autoclose_reactions(registry, states, read_window) {
|
|
|
4160
4147
|
dues.push(days_after(entry.tail.created, keep_days));
|
|
4161
4148
|
const future = dues.map((d) => d.getTime()).filter((t) => t > Date.now());
|
|
4162
4149
|
if (future.length)
|
|
4163
|
-
throw new (0,
|
|
4150
|
+
throw new (0, _chunk4KDMNSPJcjs.DeferSignal)({ at: new Date(Math.min(...future)) });
|
|
4164
4151
|
}
|
|
4165
4152
|
};
|
|
4166
4153
|
const key = `__autoclose_${st.name}`;
|
|
4167
4154
|
for (const event_name of Object.keys(st.events)) {
|
|
4168
|
-
_optionalChain([registry, 'access',
|
|
4155
|
+
_optionalChain([registry, 'access', _154 => _154.events, 'access', _155 => _155[event_name], 'optionalAccess', _156 => _156.reactions, 'access', _157 => _157.set, 'call', _158 => _158(
|
|
4169
4156
|
key,
|
|
4170
4157
|
reaction
|
|
4171
4158
|
)]);
|
|
@@ -4365,9 +4352,9 @@ var _this_ = ({ stream }) => ({
|
|
|
4365
4352
|
|
|
4366
4353
|
// src/builders/builder-utils.ts
|
|
4367
4354
|
function register_lane(config2, lanes) {
|
|
4368
|
-
|
|
4369
|
-
if (config2.name ===
|
|
4370
|
-
throw new Error(`Lane "${
|
|
4355
|
+
_chunkF2YAA4SEcjs.resolveLaneConfig.call(void 0, config2);
|
|
4356
|
+
if (config2.name === _chunk4KDMNSPJcjs.DEFAULT_LANE)
|
|
4357
|
+
throw new Error(`Lane "${_chunk4KDMNSPJcjs.DEFAULT_LANE}" is reserved`);
|
|
4371
4358
|
const existing = lanes.find((l) => l.name === config2.name);
|
|
4372
4359
|
if (!existing) return void lanes.push(config2);
|
|
4373
4360
|
if (existing.leaseMillis !== config2.leaseMillis || existing.streamLimit !== config2.streamLimit || existing.cycleMs !== config2.cycleMs)
|
|
@@ -4409,10 +4396,10 @@ function reaction_on(event, events, builder) {
|
|
|
4409
4396
|
// Validate the whole bag at the declaration site so a bad
|
|
4410
4397
|
// `maxRetries`/`backoff`/`blockOnError` throws ZodError at build,
|
|
4411
4398
|
// not a NaN gate on the first retry.
|
|
4412
|
-
options:
|
|
4413
|
-
blockOnError: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
4414
|
-
maxRetries: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
4415
|
-
backoff: _optionalChain([options, 'optionalAccess',
|
|
4399
|
+
options: _chunkF2YAA4SEcjs.resolveReactionConfig.call(void 0, {
|
|
4400
|
+
blockOnError: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _159 => _159.blockOnError]), () => ( _chunkF2YAA4SEcjs.DEFAULT_BLOCK_ON_ERROR)),
|
|
4401
|
+
maxRetries: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _160 => _160.maxRetries]), () => ( _chunkF2YAA4SEcjs.DEFAULT_MAX_RETRIES)),
|
|
4402
|
+
backoff: _optionalChain([options, 'optionalAccess', _161 => _161.backoff])
|
|
4416
4403
|
})
|
|
4417
4404
|
};
|
|
4418
4405
|
},
|
|
@@ -4431,9 +4418,9 @@ function reaction_on(event, events, builder) {
|
|
|
4431
4418
|
|
|
4432
4419
|
// src/internal/date-reviver.ts
|
|
4433
4420
|
|
|
4434
|
-
var def_of = (schema) => _nullishCoalesce(_optionalChain([schema, 'access',
|
|
4421
|
+
var def_of = (schema) => _nullishCoalesce(_optionalChain([schema, 'access', _162 => _162._zod, 'optionalAccess', _163 => _163.def]), () => ( schema.def));
|
|
4435
4422
|
function variant_schema(schema) {
|
|
4436
|
-
const shape = _optionalChain([def_of, 'call',
|
|
4423
|
+
const shape = _optionalChain([def_of, 'call', _164 => _164(schema), 'optionalAccess', _165 => _165.shape]);
|
|
4437
4424
|
if (!shape) {
|
|
4438
4425
|
const dates = date_reviver_schema(schema);
|
|
4439
4426
|
return { schema: _nullishCoalesce(dates, () => ( schema)), dated: !!dates };
|
|
@@ -4481,7 +4468,7 @@ function date_reviver_schema(schema) {
|
|
|
4481
4468
|
return variants.some((v) => v.dated) ? _zod2.z.union(variants.map((v) => v.schema)) : void 0;
|
|
4482
4469
|
}
|
|
4483
4470
|
case "nullable":
|
|
4484
|
-
return _optionalChain([inner, 'call',
|
|
4471
|
+
return _optionalChain([inner, 'call', _166 => _166(), 'optionalAccess', _167 => _167.nullable, 'call', _168 => _168()]);
|
|
4485
4472
|
case "optional":
|
|
4486
4473
|
case "nonoptional":
|
|
4487
4474
|
case "readonly":
|
|
@@ -4496,7 +4483,7 @@ function date_reviver_schema(schema) {
|
|
|
4496
4483
|
|
|
4497
4484
|
// src/builders/event-builder.ts
|
|
4498
4485
|
function event_tags(schema) {
|
|
4499
|
-
const pii =
|
|
4486
|
+
const pii = _chunk4KDMNSPJcjs.pii_schemas.call(void 0, schema);
|
|
4500
4487
|
const pii_dates = {};
|
|
4501
4488
|
for (const [key, field] of Object.entries(pii)) {
|
|
4502
4489
|
const dates = date_reviver_schema(field);
|
|
@@ -4533,7 +4520,7 @@ function make_event_reader(tags, disclosure, predicate = null) {
|
|
|
4533
4520
|
});
|
|
4534
4521
|
}
|
|
4535
4522
|
function build_events(registry, states, lanes, owners) {
|
|
4536
|
-
const declared = /* @__PURE__ */ new Set([
|
|
4523
|
+
const declared = /* @__PURE__ */ new Set([_chunk4KDMNSPJcjs.DEFAULT_LANE, ...lanes.map((l) => l.name)]);
|
|
4537
4524
|
const lane_errors = [];
|
|
4538
4525
|
const tags = /* @__PURE__ */ new Map();
|
|
4539
4526
|
const sensitive2 = /* @__PURE__ */ new Map();
|
|
@@ -4597,7 +4584,7 @@ function build_events(registry, states, lanes, owners) {
|
|
|
4597
4584
|
if (reader) readers.set(event_name, reader);
|
|
4598
4585
|
}
|
|
4599
4586
|
const snap2 = make_event_reader(event_tags(state2.state), "redact", null);
|
|
4600
|
-
if (snap2) readers.set(
|
|
4587
|
+
if (snap2) readers.set(_chunk4KDMNSPJcjs.SNAP_EVENT, snap2);
|
|
4601
4588
|
if (readers.size === 0) continue;
|
|
4602
4589
|
state2.view = (event, actor) => (_nullishCoalesce(readers.get(event.name), () => ( IDENTITY_GATE)))(event, actor);
|
|
4603
4590
|
}
|
|
@@ -4658,7 +4645,7 @@ function act() {
|
|
|
4658
4645
|
let _built = false;
|
|
4659
4646
|
const read_wrap = (original) => {
|
|
4660
4647
|
const wrapped = async (events, stream) => {
|
|
4661
|
-
const read = events.map((e) => _nullishCoalesce(_optionalChain([_hr, 'access',
|
|
4648
|
+
const read = events.map((e) => _nullishCoalesce(_optionalChain([_hr, 'access', _169 => _169.get, 'call', _170 => _170(e.name), 'optionalCall', _171 => _171(e)]), () => ( e)));
|
|
4662
4649
|
return original(read, stream);
|
|
4663
4650
|
};
|
|
4664
4651
|
const reset = original[FOLD_RESET];
|
|
@@ -4675,7 +4662,6 @@ function act() {
|
|
|
4675
4662
|
spec.merged,
|
|
4676
4663
|
spec.flush,
|
|
4677
4664
|
spec.config,
|
|
4678
|
-
bare_patch,
|
|
4679
4665
|
// Head loads strip sensitive keys like the warm path.
|
|
4680
4666
|
registry.sensitive_fields
|
|
4681
4667
|
)
|
|
@@ -4700,7 +4686,7 @@ function act() {
|
|
|
4700
4686
|
});
|
|
4701
4687
|
}
|
|
4702
4688
|
for (const [action_name, handler] of Object.entries(state2.on)) {
|
|
4703
|
-
const static_target = _optionalChain([handler, 'optionalAccess',
|
|
4689
|
+
const static_target = _optionalChain([handler, 'optionalAccess', _172 => _172._static_emit]);
|
|
4704
4690
|
if (static_target && deprecated.has(static_target)) {
|
|
4705
4691
|
const current = current_version_of(static_target, event_names);
|
|
4706
4692
|
throw new Error(
|
|
@@ -4713,7 +4699,7 @@ function act() {
|
|
|
4713
4699
|
const list = deprecation_summary.map(
|
|
4714
4700
|
(d) => `"${d.deprecated}" (current: "${d.current}", state: "${d.state_name}")`
|
|
4715
4701
|
).join(", ");
|
|
4716
|
-
|
|
4702
|
+
_chunkF2YAA4SEcjs.log.call(void 0, ).info(
|
|
4717
4703
|
`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
4704
|
);
|
|
4719
4705
|
}
|
|
@@ -4755,7 +4741,7 @@ function act() {
|
|
|
4755
4741
|
return reaction_on(event, registry.events, builder);
|
|
4756
4742
|
},
|
|
4757
4743
|
build: (options) => {
|
|
4758
|
-
|
|
4744
|
+
_chunkF2YAA4SEcjs.resolveActConfig.call(void 0, options);
|
|
4759
4745
|
if (!_built) {
|
|
4760
4746
|
for (const proj of pending_projections) add_projection(proj);
|
|
4761
4747
|
for (const proj of fold_projections) {
|
|
@@ -4773,7 +4759,7 @@ function act() {
|
|
|
4773
4759
|
`State projection "${proj.target}" of "${fold.name}" is missing events ${missing.join(", ")} \u2014 pass every partial of the state to .of()`
|
|
4774
4760
|
);
|
|
4775
4761
|
const claimed = fold_specs.find((s) => s.target === proj.target);
|
|
4776
|
-
if (_optionalChain([claimed, 'optionalAccess',
|
|
4762
|
+
if (_optionalChain([claimed, 'optionalAccess', _173 => _173.projection]) === proj) continue;
|
|
4777
4763
|
if (batch_handlers.has(proj.target) || claimed)
|
|
4778
4764
|
throw new Error(
|
|
4779
4765
|
`Duplicate projection target "${proj.target}" \u2014 a target is served by one batch handler or one state projection, never both`
|
|
@@ -4806,7 +4792,7 @@ function act() {
|
|
|
4806
4792
|
synthesize_autoclose_reactions(
|
|
4807
4793
|
registry,
|
|
4808
4794
|
states,
|
|
4809
|
-
|
|
4795
|
+
_chunkF2YAA4SEcjs.current_autoclose_window
|
|
4810
4796
|
);
|
|
4811
4797
|
Object.freeze(registry.actions);
|
|
4812
4798
|
Object.freeze(registry.events);
|
|
@@ -4854,8 +4840,8 @@ function _projection(target) {
|
|
|
4854
4840
|
handler,
|
|
4855
4841
|
resolver: _nullishCoalesce(default_resolver, () => ( _this_)),
|
|
4856
4842
|
options: {
|
|
4857
|
-
blockOnError:
|
|
4858
|
-
maxRetries:
|
|
4843
|
+
blockOnError: _chunkF2YAA4SEcjs.DEFAULT_BLOCK_ON_ERROR,
|
|
4844
|
+
maxRetries: _chunkF2YAA4SEcjs.DEFAULT_MAX_RETRIES
|
|
4859
4845
|
}
|
|
4860
4846
|
}),
|
|
4861
4847
|
widened
|
|
@@ -4896,7 +4882,7 @@ function _projection(target) {
|
|
|
4896
4882
|
throw new Error(
|
|
4897
4883
|
`Projection "${target}" .of() partials must share one state name \u2014 got "${name}" and "${partial.name}"`
|
|
4898
4884
|
);
|
|
4899
|
-
const config2 =
|
|
4885
|
+
const config2 = _chunkF2YAA4SEcjs.resolveFoldConfig.call(void 0, options);
|
|
4900
4886
|
const fold_events = {};
|
|
4901
4887
|
for (const partial of partials)
|
|
4902
4888
|
for (const [event_name, schema] of Object.entries(partial.events)) {
|
|
@@ -4914,8 +4900,8 @@ function _projection(target) {
|
|
|
4914
4900
|
handler: noop,
|
|
4915
4901
|
resolver: { target },
|
|
4916
4902
|
options: {
|
|
4917
|
-
blockOnError:
|
|
4918
|
-
maxRetries:
|
|
4903
|
+
blockOnError: _chunkF2YAA4SEcjs.DEFAULT_BLOCK_ON_ERROR,
|
|
4904
|
+
maxRetries: _chunkF2YAA4SEcjs.DEFAULT_MAX_RETRIES
|
|
4919
4905
|
}
|
|
4920
4906
|
}
|
|
4921
4907
|
]
|
|
@@ -5031,7 +5017,7 @@ function action_builder(state2) {
|
|
|
5031
5017
|
throw new Error(`Duplicate action "${action2}"`);
|
|
5032
5018
|
internal.actions[action2] = schema;
|
|
5033
5019
|
if (options) {
|
|
5034
|
-
|
|
5020
|
+
_chunkF2YAA4SEcjs.resolveActionConfig.call(void 0, options);
|
|
5035
5021
|
internal.options ??= {};
|
|
5036
5022
|
internal.options[action2] = options;
|
|
5037
5023
|
}
|
|
@@ -5324,5 +5310,5 @@ function write_line(writer, line) {
|
|
|
5324
5310
|
|
|
5325
5311
|
|
|
5326
5312
|
|
|
5327
|
-
exports.Act = Act; exports.ActorSchema =
|
|
5313
|
+
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
5314
|
//# sourceMappingURL=index.cjs.map
|