@rotorsoft/act 1.33.17 → 1.33.18
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 +3 -2
- package/dist/@types/act.d.ts.map +1 -1
- package/dist/@types/internal/correlate-cycle.d.ts.map +1 -1
- package/dist/@types/internal/settle.d.ts.map +1 -1
- package/dist/@types/types/reaction.d.ts +4 -2
- package/dist/@types/types/reaction.d.ts.map +1 -1
- package/dist/{chunk-5KTVG7IM.js → chunk-3OTABSIB.js} +2 -2
- package/dist/{chunk-PMS6BMIU.cjs → chunk-N7K4FQEM.cjs} +1 -1
- package/dist/{chunk-PMS6BMIU.cjs.map → chunk-N7K4FQEM.cjs.map} +1 -1
- package/dist/{chunk-J6QMZEQF.cjs → chunk-OYR5RIFE.cjs} +13 -13
- package/dist/{chunk-J6QMZEQF.cjs.map → chunk-OYR5RIFE.cjs.map} +1 -1
- package/dist/{chunk-CAL4XEVN.js → chunk-SD7SW47Z.js} +1 -1
- package/dist/{chunk-CAL4XEVN.js.map → chunk-SD7SW47Z.js.map} +1 -1
- package/dist/index.cjs +150 -151
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -12
- 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-5KTVG7IM.js.map → chunk-3OTABSIB.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
var
|
|
43
|
+
var _chunkOYR5RIFEcjs = require('./chunk-OYR5RIFE.cjs');
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
|
|
@@ -70,24 +70,24 @@ var _chunkJ6QMZEQFcjs = require('./chunk-J6QMZEQF.cjs');
|
|
|
70
70
|
|
|
71
71
|
|
|
72
72
|
|
|
73
|
-
var
|
|
73
|
+
var _chunkN7K4FQEMcjs = require('./chunk-N7K4FQEM.cjs');
|
|
74
74
|
|
|
75
75
|
// src/signals.ts
|
|
76
76
|
process.once("SIGINT", async (arg) => {
|
|
77
|
-
|
|
78
|
-
await
|
|
77
|
+
_chunkOYR5RIFEcjs.log.call(void 0, ).info(arg, "SIGINT");
|
|
78
|
+
await _chunkOYR5RIFEcjs.disposeAndExit.call(void 0, "EXIT");
|
|
79
79
|
});
|
|
80
80
|
process.once("SIGTERM", async (arg) => {
|
|
81
|
-
|
|
82
|
-
await
|
|
81
|
+
_chunkOYR5RIFEcjs.log.call(void 0, ).info(arg, "SIGTERM");
|
|
82
|
+
await _chunkOYR5RIFEcjs.disposeAndExit.call(void 0, "EXIT");
|
|
83
83
|
});
|
|
84
84
|
process.once("uncaughtException", async (arg) => {
|
|
85
|
-
|
|
86
|
-
await
|
|
85
|
+
_chunkOYR5RIFEcjs.log.call(void 0, ).error(arg, "Uncaught Exception");
|
|
86
|
+
await _chunkOYR5RIFEcjs.disposeAndExit.call(void 0, "ERROR");
|
|
87
87
|
});
|
|
88
88
|
process.once("unhandledRejection", async (arg) => {
|
|
89
|
-
|
|
90
|
-
await
|
|
89
|
+
_chunkOYR5RIFEcjs.log.call(void 0, ).error(arg, "Unhandled Rejection");
|
|
90
|
+
await _chunkOYR5RIFEcjs.disposeAndExit.call(void 0, "ERROR");
|
|
91
91
|
});
|
|
92
92
|
|
|
93
93
|
// src/act.ts
|
|
@@ -195,7 +195,7 @@ async function* audit(deps, categories, options = {}) {
|
|
|
195
195
|
if (need_stats) {
|
|
196
196
|
const stats = await deps.store().query_stats(
|
|
197
197
|
{},
|
|
198
|
-
{ count: true, names: true, exclude: [
|
|
198
|
+
{ count: true, names: true, exclude: [_chunkN7K4FQEMcjs.SNAP_EVENT] }
|
|
199
199
|
);
|
|
200
200
|
for (const [stream, s] of stats) {
|
|
201
201
|
for (const p of passes) _optionalChain([p, 'access', _4 => _4.on_stat, 'optionalCall', _5 => _5(stream, s)]);
|
|
@@ -277,7 +277,7 @@ var make_schema_pass = (deps) => {
|
|
|
277
277
|
return;
|
|
278
278
|
}
|
|
279
279
|
const schema = state2.events[name];
|
|
280
|
-
const sensitive2 =
|
|
280
|
+
const sensitive2 = _chunkN7K4FQEMcjs.pii_fields.call(void 0, schema);
|
|
281
281
|
let parse_schema = schema;
|
|
282
282
|
if (sensitive2.length > 0) {
|
|
283
283
|
const omitter = schema.omit;
|
|
@@ -411,7 +411,7 @@ var make_restart_candidate_pass = (deps, options) => {
|
|
|
411
411
|
{
|
|
412
412
|
stream,
|
|
413
413
|
stream_exact: true,
|
|
414
|
-
names: [
|
|
414
|
+
names: [_chunkN7K4FQEMcjs.SNAP_EVENT],
|
|
415
415
|
with_snaps: true
|
|
416
416
|
}
|
|
417
417
|
);
|
|
@@ -840,7 +840,7 @@ async function run_close_cycle(targets, deps) {
|
|
|
840
840
|
deps,
|
|
841
841
|
() => run_full_closes(full, target_map, deps, skipped)
|
|
842
842
|
);
|
|
843
|
-
const retired = [...truncated.entries()].filter(([, r]) => r.committed.name ===
|
|
843
|
+
const retired = [...truncated.entries()].filter(([, r]) => r.committed.name === _chunkN7K4FQEMcjs.TOMBSTONE_EVENT).map(([stream]) => stream);
|
|
844
844
|
if (retired.length) _optionalChain([deps, 'access', _42 => _42.forget_subscribed, 'optionalCall', _43 => _43(retired)]);
|
|
845
845
|
for (const [stream, entry] of windowed_result) truncated.set(stream, entry);
|
|
846
846
|
return { truncated, skipped };
|
|
@@ -922,7 +922,7 @@ async function run_windowed_closes(windowed, deps, skipped) {
|
|
|
922
922
|
if (!await windowed_prune_pending(t.stream, t.before, max_id))
|
|
923
923
|
return void 0;
|
|
924
924
|
if (t.archive) await t.archive();
|
|
925
|
-
const result = await
|
|
925
|
+
const result = await _chunkOYR5RIFEcjs.store.call(void 0, ).truncate([
|
|
926
926
|
{ stream: t.stream, before: t.before, max_id }
|
|
927
927
|
]);
|
|
928
928
|
return result.get(t.stream);
|
|
@@ -935,10 +935,10 @@ async function run_windowed_closes(windowed, deps, skipped) {
|
|
|
935
935
|
async function windowed_prune_pending(stream, before, max_id) {
|
|
936
936
|
let boundary_id;
|
|
937
937
|
let min_id;
|
|
938
|
-
await
|
|
938
|
+
await _chunkOYR5RIFEcjs.store.call(void 0, ).query(
|
|
939
939
|
(event) => {
|
|
940
940
|
if (min_id === void 0 || event.id < min_id) min_id = event.id;
|
|
941
|
-
if (event.name ===
|
|
941
|
+
if (event.name === _chunkN7K4FQEMcjs.SNAP_EVENT && event.created < before && (max_id === void 0 || event.id <= max_id) && (boundary_id === void 0 || event.id > boundary_id))
|
|
942
942
|
boundary_id = event.id;
|
|
943
943
|
},
|
|
944
944
|
{ stream, stream_exact: true, with_snaps: true, after: -1 }
|
|
@@ -949,7 +949,7 @@ async function probe_min_watermarks(streams, page_size, checkpoint) {
|
|
|
949
949
|
const min_at = /* @__PURE__ */ new Map();
|
|
950
950
|
const matches = source_matcher();
|
|
951
951
|
await walk_streams(
|
|
952
|
-
|
|
952
|
+
_chunkOYR5RIFEcjs.store.call(void 0, ),
|
|
953
953
|
(position) => {
|
|
954
954
|
const pending = position.correlated_at === void 0 || position.at < position.correlated_at;
|
|
955
955
|
const cap = pending ? position.at : Math.max(position.at, checkpoint);
|
|
@@ -977,17 +977,17 @@ function source_matcher() {
|
|
|
977
977
|
};
|
|
978
978
|
}
|
|
979
979
|
async function scan_stream_heads(streams) {
|
|
980
|
-
const stats = await
|
|
981
|
-
exclude: [
|
|
980
|
+
const stats = await _chunkOYR5RIFEcjs.store.call(void 0, ).query_stats(streams, {
|
|
981
|
+
exclude: [_chunkN7K4FQEMcjs.SNAP_EVENT]
|
|
982
982
|
});
|
|
983
|
-
const domain_heads = await
|
|
984
|
-
exclude: [
|
|
983
|
+
const domain_heads = await _chunkOYR5RIFEcjs.store.call(void 0, ).query_stats(streams, {
|
|
984
|
+
exclude: [_chunkN7K4FQEMcjs.SNAP_EVENT, _chunkN7K4FQEMcjs.TOMBSTONE_EVENT]
|
|
985
985
|
});
|
|
986
|
-
const true_heads = await
|
|
986
|
+
const true_heads = await _chunkOYR5RIFEcjs.store.call(void 0, ).query_stats(streams, {});
|
|
987
987
|
const out = /* @__PURE__ */ new Map();
|
|
988
988
|
for (const [stream, { head }] of domain_heads) {
|
|
989
989
|
const marker_head = _optionalChain([stats, 'access', _45 => _45.get, 'call', _46 => _46(stream), 'optionalAccess', _47 => _47.head]);
|
|
990
|
-
const interrupted = _optionalChain([marker_head, 'optionalAccess', _48 => _48.name]) ===
|
|
990
|
+
const interrupted = _optionalChain([marker_head, 'optionalAccess', _48 => _48.name]) === _chunkN7K4FQEMcjs.TOMBSTONE_EVENT;
|
|
991
991
|
out.set(stream, {
|
|
992
992
|
max_id: head.id,
|
|
993
993
|
version: true_heads.get(stream).head.version,
|
|
@@ -1011,7 +1011,7 @@ async function partition_by_safety(stream_info, reactive, skipped, page_size, ca
|
|
|
1011
1011
|
const matches = source_matcher();
|
|
1012
1012
|
const targets = [...stream_info.keys()];
|
|
1013
1013
|
await walk_streams(
|
|
1014
|
-
|
|
1014
|
+
_chunkOYR5RIFEcjs.store.call(void 0, ),
|
|
1015
1015
|
(position) => {
|
|
1016
1016
|
const has_work = position.correlated_at !== void 0 && position.at < position.correlated_at;
|
|
1017
1017
|
if (!has_work) return;
|
|
@@ -1077,7 +1077,7 @@ async function run_archive_callbacks(guarded, target_map) {
|
|
|
1077
1077
|
}
|
|
1078
1078
|
}
|
|
1079
1079
|
async function heads_still_guarded(guarded, guard_events, skipped) {
|
|
1080
|
-
const heads = await
|
|
1080
|
+
const heads = await _chunkOYR5RIFEcjs.store.call(void 0, ).query_stats(guarded, {});
|
|
1081
1081
|
return guarded.filter((stream) => {
|
|
1082
1082
|
if (_optionalChain([heads, 'access', _55 => _55.get, 'call', _56 => _56(stream), 'optionalAccess', _57 => _57.head, 'access', _58 => _58.id]) === guard_events.get(stream).id)
|
|
1083
1083
|
return true;
|
|
@@ -1095,18 +1095,18 @@ async function truncate_and_warm_cache(guarded, seed_states, guard_events, corre
|
|
|
1095
1095
|
meta: {
|
|
1096
1096
|
correlation,
|
|
1097
1097
|
causation: {
|
|
1098
|
-
event: { id: guard.id, name:
|
|
1098
|
+
event: { id: guard.id, name: _chunkN7K4FQEMcjs.TOMBSTONE_EVENT, stream: guard.stream }
|
|
1099
1099
|
}
|
|
1100
1100
|
}
|
|
1101
1101
|
};
|
|
1102
1102
|
});
|
|
1103
|
-
const truncated = await
|
|
1103
|
+
const truncated = await _chunkOYR5RIFEcjs.store.call(void 0, ).truncate(trunc_targets);
|
|
1104
1104
|
await Promise.all(
|
|
1105
1105
|
guarded.map(async (stream) => {
|
|
1106
1106
|
const entry = truncated.get(stream);
|
|
1107
1107
|
const state2 = seed_states.get(stream);
|
|
1108
1108
|
if (state2 && entry) {
|
|
1109
|
-
await
|
|
1109
|
+
await _chunkOYR5RIFEcjs.cache.call(void 0, ).set(stream, {
|
|
1110
1110
|
stream,
|
|
1111
1111
|
state: state2,
|
|
1112
1112
|
version: entry.committed.version,
|
|
@@ -1115,7 +1115,7 @@ async function truncate_and_warm_cache(guarded, seed_states, guard_events, corre
|
|
|
1115
1115
|
snaps: 1
|
|
1116
1116
|
});
|
|
1117
1117
|
} else {
|
|
1118
|
-
await
|
|
1118
|
+
await _chunkOYR5RIFEcjs.cache.call(void 0, ).invalidate(stream);
|
|
1119
1119
|
}
|
|
1120
1120
|
})
|
|
1121
1121
|
);
|
|
@@ -1129,7 +1129,7 @@ var _crypto = require('crypto');
|
|
|
1129
1129
|
function report_once(seen, key, message) {
|
|
1130
1130
|
if (seen.has(key)) return;
|
|
1131
1131
|
seen.add(key);
|
|
1132
|
-
|
|
1132
|
+
_chunkOYR5RIFEcjs.log.call(void 0, ).error(new Error(message));
|
|
1133
1133
|
}
|
|
1134
1134
|
|
|
1135
1135
|
// src/internal/correlate-cycle.ts
|
|
@@ -1180,7 +1180,7 @@ var CorrelateCycle = (_class3 = class {
|
|
|
1180
1180
|
// never drops their +Infinity floor.
|
|
1181
1181
|
|
|
1182
1182
|
__init11() {this._static_subscriptions = /* @__PURE__ */ new Map()}
|
|
1183
|
-
__init12() {this._patterns = new (0,
|
|
1183
|
+
__init12() {this._patterns = new (0, _chunkOYR5RIFEcjs.LruMap)(PATTERN_CACHE_SIZE)}
|
|
1184
1184
|
|
|
1185
1185
|
|
|
1186
1186
|
|
|
@@ -1198,7 +1198,7 @@ var CorrelateCycle = (_class3 = class {
|
|
|
1198
1198
|
on_init
|
|
1199
1199
|
}) {;_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);
|
|
1200
1200
|
this._key = shard ? `${registry_key(registry.events)}:${[...shard].sort().join(",")}` : registry_key(registry.events);
|
|
1201
|
-
this._dynamic_subscriptions = new (0,
|
|
1201
|
+
this._dynamic_subscriptions = new (0, _chunkOYR5RIFEcjs.LruMap)(max_subscribed_streams);
|
|
1202
1202
|
this._registry = registry;
|
|
1203
1203
|
this._declared_lanes = declared_lanes;
|
|
1204
1204
|
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 (_chunkOYR5RIFEcjs.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);
|
|
@@ -1296,11 +1296,11 @@ var CorrelateCycle = (_class3 = class {
|
|
|
1296
1296
|
this._lease_until = correlating ? now + CORRELATION_LEASE_MS : 0;
|
|
1297
1297
|
if (correlating === false) return idle();
|
|
1298
1298
|
}
|
|
1299
|
-
const after =
|
|
1299
|
+
const after = this._checkpoint;
|
|
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 _chunkOYR5RIFEcjs.store.call(void 0, ).query(
|
|
1304
1304
|
(event) => {
|
|
1305
1305
|
if (stopped) return;
|
|
1306
1306
|
const register = this._registry.events[event.name];
|
|
@@ -1344,9 +1344,9 @@ var CorrelateCycle = (_class3 = class {
|
|
|
1344
1344
|
correlated_at: void 0
|
|
1345
1345
|
};
|
|
1346
1346
|
const seen_in_scan = correlated.has(resolved.target);
|
|
1347
|
-
const held_lane = _nullishCoalesce((seen_in_scan ? entry.lane : _optionalChain([recorded, 'optionalAccess', _61 => _61.lane])), () => (
|
|
1347
|
+
const held_lane = _nullishCoalesce((seen_in_scan ? entry.lane : _optionalChain([recorded, 'optionalAccess', _61 => _61.lane])), () => ( _chunkN7K4FQEMcjs.DEFAULT_LANE));
|
|
1348
1348
|
const held_priority = seen_in_scan ? entry.priority : _optionalChain([recorded, 'optionalAccess', _62 => _62.priority]);
|
|
1349
|
-
const resolved_lane = _nullishCoalesce(lane, () => (
|
|
1349
|
+
const resolved_lane = _nullishCoalesce(lane, () => ( _chunkN7K4FQEMcjs.DEFAULT_LANE));
|
|
1350
1350
|
if (held_priority === priority && held_lane !== resolved_lane)
|
|
1351
1351
|
report_lane_conflict(
|
|
1352
1352
|
this._reported,
|
|
@@ -1370,7 +1370,7 @@ var CorrelateCycle = (_class3 = class {
|
|
|
1370
1370
|
},
|
|
1371
1371
|
// Resolvers see `pii: null`: correlate runs actor-less, and one
|
|
1372
1372
|
// undecryptable row would otherwise stop every stream's reactions.
|
|
1373
|
-
{
|
|
1373
|
+
{ after, limit: query.limit, with_pii: false }
|
|
1374
1374
|
);
|
|
1375
1375
|
if (this._declared_lanes.size > 1) await this._recall(correlated);
|
|
1376
1376
|
const read = last_id > after;
|
|
@@ -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 _chunkOYR5RIFEcjs.store.call(void 0, ).query_streams(
|
|
1427
1427
|
(position) => {
|
|
1428
1428
|
row = position;
|
|
1429
1429
|
},
|
|
@@ -1436,8 +1436,8 @@ var CorrelateCycle = (_class3 = class {
|
|
|
1436
1436
|
lane: row.lane
|
|
1437
1437
|
});
|
|
1438
1438
|
if (entry.priority > row.priority) return;
|
|
1439
|
-
const held_lane = _nullishCoalesce(row.lane, () => (
|
|
1440
|
-
const resolved_lane = _nullishCoalesce(entry.lane, () => (
|
|
1439
|
+
const held_lane = _nullishCoalesce(row.lane, () => ( _chunkN7K4FQEMcjs.DEFAULT_LANE));
|
|
1440
|
+
const resolved_lane = _nullishCoalesce(entry.lane, () => ( _chunkN7K4FQEMcjs.DEFAULT_LANE));
|
|
1441
1441
|
if (entry.priority === row.priority && held_lane !== resolved_lane)
|
|
1442
1442
|
report_lane_conflict(
|
|
1443
1443
|
this._reported,
|
|
@@ -1463,7 +1463,7 @@ var CorrelateCycle = (_class3 = class {
|
|
|
1463
1463
|
millis: 0
|
|
1464
1464
|
});
|
|
1465
1465
|
} catch (error) {
|
|
1466
|
-
|
|
1466
|
+
_chunkOYR5RIFEcjs.log.call(void 0, ).warn(
|
|
1467
1467
|
`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)}`
|
|
1468
1468
|
);
|
|
1469
1469
|
}
|
|
@@ -1616,14 +1616,14 @@ function compute_lag_lead_ratio(handled, lagging, leading) {
|
|
|
1616
1616
|
}
|
|
1617
1617
|
|
|
1618
1618
|
// src/internal/drain-ops.ts
|
|
1619
|
-
var claim = (lagging, leading, by, millis, lane) =>
|
|
1619
|
+
var claim = (lagging, leading, by, millis, lane) => _chunkOYR5RIFEcjs.store.call(void 0, ).claim(lagging, leading, by, millis, lane);
|
|
1620
1620
|
async function fetch(leased, eventLimit) {
|
|
1621
1621
|
return Promise.all(
|
|
1622
1622
|
leased.map(async ({ stream, source, at, lagging }) => {
|
|
1623
1623
|
const events = [];
|
|
1624
|
-
const stream_exact = source !== void 0 &&
|
|
1624
|
+
const stream_exact = source !== void 0 && _chunkOYR5RIFEcjs.is_literal_source.call(void 0, source) ? true : void 0;
|
|
1625
1625
|
try {
|
|
1626
|
-
await
|
|
1626
|
+
await _chunkOYR5RIFEcjs.store.call(void 0, ).query((e) => events.push(e), {
|
|
1627
1627
|
stream: source,
|
|
1628
1628
|
stream_exact,
|
|
1629
1629
|
after: at,
|
|
@@ -1643,30 +1643,30 @@ async function fetch(leased, eventLimit) {
|
|
|
1643
1643
|
})
|
|
1644
1644
|
);
|
|
1645
1645
|
}
|
|
1646
|
-
var ack = (leases) =>
|
|
1647
|
-
var block = (leases) =>
|
|
1648
|
-
var subscribe = (streams, correlated_at, correlator) =>
|
|
1646
|
+
var ack = (leases) => _chunkOYR5RIFEcjs.store.call(void 0, ).ack(leases);
|
|
1647
|
+
var block = (leases) => _chunkOYR5RIFEcjs.store.call(void 0, ).block(leases);
|
|
1648
|
+
var subscribe = (streams, correlated_at, correlator) => _chunkOYR5RIFEcjs.store.call(void 0, ).subscribe(streams, correlated_at, correlator);
|
|
1649
1649
|
|
|
1650
1650
|
// src/internal/event-sourcing.ts
|
|
1651
1651
|
var _actpatch = require('@rotorsoft/act-patch');
|
|
1652
1652
|
var bare_patch = (_me, state2, partial) => _actpatch.patch.call(void 0, state2, partial);
|
|
1653
1653
|
var validating_patch = (me, state2, partial, event) => {
|
|
1654
1654
|
const next = _actpatch.patch.call(void 0, state2, partial);
|
|
1655
|
-
return
|
|
1655
|
+
return _chunkOYR5RIFEcjs.validate.call(void 0,
|
|
1656
1656
|
`${me.name}.${String(event.name)}#${event.id}`,
|
|
1657
1657
|
next,
|
|
1658
1658
|
me.state
|
|
1659
1659
|
);
|
|
1660
1660
|
};
|
|
1661
1661
|
var DEFAULT_BATCH = 500;
|
|
1662
|
-
var cache_put = (stream, entry) =>
|
|
1663
|
-
(err) =>
|
|
1662
|
+
var cache_put = (stream, entry) => _chunkOYR5RIFEcjs.cache.call(void 0, ).set(stream, entry).catch(
|
|
1663
|
+
(err) => _chunkOYR5RIFEcjs.log.call(void 0, ).warn(
|
|
1664
1664
|
err,
|
|
1665
1665
|
"cache set skipped; the next load re-folds from the store"
|
|
1666
1666
|
)
|
|
1667
1667
|
);
|
|
1668
|
-
var cache_drop = (stream) =>
|
|
1669
|
-
(err) =>
|
|
1668
|
+
var cache_drop = (stream) => _chunkOYR5RIFEcjs.cache.call(void 0, ).invalidate(stream).catch(
|
|
1669
|
+
(err) => _chunkOYR5RIFEcjs.log.call(void 0, ).warn(
|
|
1670
1670
|
err,
|
|
1671
1671
|
"cache invalidate skipped; a stale checkpoint re-folds from its event_id"
|
|
1672
1672
|
)
|
|
@@ -1674,9 +1674,9 @@ var cache_drop = (stream) => _chunkJ6QMZEQFcjs.cache.call(void 0, ).invalidate(s
|
|
|
1674
1674
|
async function snap(snapshot) {
|
|
1675
1675
|
const { id, stream, name, meta, version } = snapshot.event;
|
|
1676
1676
|
try {
|
|
1677
|
-
const [committed] = await
|
|
1677
|
+
const [committed] = await _chunkOYR5RIFEcjs.store.call(void 0, ).commit(
|
|
1678
1678
|
stream,
|
|
1679
|
-
[{ name:
|
|
1679
|
+
[{ name: _chunkN7K4FQEMcjs.SNAP_EVENT, data: snapshot.state }],
|
|
1680
1680
|
{
|
|
1681
1681
|
correlation: meta.correlation,
|
|
1682
1682
|
causation: { event: { id, name, stream } }
|
|
@@ -1687,22 +1687,22 @@ async function snap(snapshot) {
|
|
|
1687
1687
|
return committed;
|
|
1688
1688
|
} catch (error) {
|
|
1689
1689
|
const reason = error instanceof Error ? error.message : String(error);
|
|
1690
|
-
|
|
1690
|
+
_chunkOYR5RIFEcjs.log.call(void 0, ).warn(
|
|
1691
1691
|
`Snapshot write failed on stream "${stream}": ${reason} \u2014 cold starts will replay full history until snapshots succeed.`
|
|
1692
1692
|
);
|
|
1693
1693
|
}
|
|
1694
1694
|
}
|
|
1695
1695
|
async function tombstone(stream, expectedVersion, correlation) {
|
|
1696
1696
|
try {
|
|
1697
|
-
const [committed] = await
|
|
1697
|
+
const [committed] = await _chunkOYR5RIFEcjs.store.call(void 0, ).commit(
|
|
1698
1698
|
stream,
|
|
1699
|
-
[{ name:
|
|
1699
|
+
[{ name: _chunkN7K4FQEMcjs.TOMBSTONE_EVENT, data: {} }],
|
|
1700
1700
|
{ correlation, causation: {} },
|
|
1701
1701
|
expectedVersion
|
|
1702
1702
|
);
|
|
1703
1703
|
return committed;
|
|
1704
1704
|
} catch (error) {
|
|
1705
|
-
if (error instanceof
|
|
1705
|
+
if (error instanceof _chunkN7K4FQEMcjs.ConcurrencyError) return void 0;
|
|
1706
1706
|
throw error;
|
|
1707
1707
|
}
|
|
1708
1708
|
}
|
|
@@ -1732,9 +1732,9 @@ async function scan(source, opts = {}, callback) {
|
|
|
1732
1732
|
if (drop_closed_streams) {
|
|
1733
1733
|
await source.query(
|
|
1734
1734
|
(e) => {
|
|
1735
|
-
if (e.name ===
|
|
1735
|
+
if (e.name === _chunkN7K4FQEMcjs.TOMBSTONE_EVENT) closed_streams.add(e.stream);
|
|
1736
1736
|
},
|
|
1737
|
-
{ names: [
|
|
1737
|
+
{ names: [_chunkN7K4FQEMcjs.TOMBSTONE_EVENT] }
|
|
1738
1738
|
);
|
|
1739
1739
|
}
|
|
1740
1740
|
let max_id;
|
|
@@ -1756,11 +1756,11 @@ async function scan(source, opts = {}, callback) {
|
|
|
1756
1756
|
if (!is_valid(event))
|
|
1757
1757
|
throw new Error(`Invalid event at index ${processed}`);
|
|
1758
1758
|
if (on_progress) on_progress({ processed, id: event.id, max_id });
|
|
1759
|
-
if (drop_snapshots && event.name ===
|
|
1759
|
+
if (drop_snapshots && event.name === _chunkN7K4FQEMcjs.SNAP_EVENT) {
|
|
1760
1760
|
dropped_snaps++;
|
|
1761
1761
|
return;
|
|
1762
1762
|
}
|
|
1763
|
-
if (closed_streams.has(event.stream) && event.name !==
|
|
1763
|
+
if (closed_streams.has(event.stream) && event.name !== _chunkN7K4FQEMcjs.TOMBSTONE_EVENT) {
|
|
1764
1764
|
dropped_closed++;
|
|
1765
1765
|
return;
|
|
1766
1766
|
}
|
|
@@ -1827,17 +1827,17 @@ async function scan(source, opts = {}, callback) {
|
|
|
1827
1827
|
async function load(me, target, callback, patch_fn = bare_patch) {
|
|
1828
1828
|
const { stream, actor, asOf } = target;
|
|
1829
1829
|
const time_travel = !!asOf && Object.values(asOf).some((v) => v !== void 0);
|
|
1830
|
-
const cached = time_travel ? void 0 : await
|
|
1830
|
+
const cached = time_travel ? void 0 : await _chunkOYR5RIFEcjs.cache.call(void 0, ).get(stream);
|
|
1831
1831
|
const cache_hit = !!cached;
|
|
1832
1832
|
let state2 = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _72 => _72.state]), () => ( (me.init ? me.init() : {})));
|
|
1833
1833
|
let patches = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _73 => _73.patches]), () => ( 0));
|
|
1834
1834
|
let snaps = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _74 => _74.snaps]), () => ( 0));
|
|
1835
1835
|
let replayed = 0;
|
|
1836
1836
|
let event;
|
|
1837
|
-
await
|
|
1837
|
+
await _chunkOYR5RIFEcjs.store.call(void 0, ).query(
|
|
1838
1838
|
(raw) => {
|
|
1839
1839
|
event = me.view(raw, actor);
|
|
1840
|
-
if (event.name ===
|
|
1840
|
+
if (event.name === _chunkN7K4FQEMcjs.SNAP_EVENT) {
|
|
1841
1841
|
state2 = event.data;
|
|
1842
1842
|
snaps++;
|
|
1843
1843
|
patches = 0;
|
|
@@ -1846,8 +1846,8 @@ async function load(me, target, callback, patch_fn = bare_patch) {
|
|
|
1846
1846
|
state2 = patch_fn(me, state2, me.patch[event.name](event, state2), event);
|
|
1847
1847
|
patches++;
|
|
1848
1848
|
replayed++;
|
|
1849
|
-
} else if (event.name !==
|
|
1850
|
-
|
|
1849
|
+
} else if (event.name !== _chunkN7K4FQEMcjs.TOMBSTONE_EVENT) {
|
|
1850
|
+
_chunkOYR5RIFEcjs.log.call(void 0, ).warn(
|
|
1851
1851
|
`Skipping unknown event "${String(event.name)}" on stream "${stream}" (id=${event.id}) \u2014 no reducer in state "${me.name}"`
|
|
1852
1852
|
);
|
|
1853
1853
|
}
|
|
@@ -1871,7 +1871,7 @@ async function load(me, target, callback, patch_fn = bare_patch) {
|
|
|
1871
1871
|
...cached ? { after: cached.event_id, with_snaps: true } : { ...time_travel ? {} : { with_snaps: true }, ...asOf }
|
|
1872
1872
|
}
|
|
1873
1873
|
);
|
|
1874
|
-
const head_is_tombstone = _optionalChain([event, 'optionalAccess', _76 => _76.name]) ===
|
|
1874
|
+
const head_is_tombstone = _optionalChain([event, 'optionalAccess', _76 => _76.name]) === _chunkN7K4FQEMcjs.TOMBSTONE_EVENT;
|
|
1875
1875
|
if (replayed > 0 && !time_travel && event && !me.pii_aware && !head_is_tombstone) {
|
|
1876
1876
|
await cache_put(stream, {
|
|
1877
1877
|
stream,
|
|
@@ -1899,7 +1899,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1899
1899
|
if (!stream) throw new Error("Missing target stream");
|
|
1900
1900
|
const reactingTo = _optionalChain([options, 'optionalAccess', _81 => _81.reactingTo]);
|
|
1901
1901
|
const correlator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _82 => _82.correlator]), () => ( default_correlator));
|
|
1902
|
-
const validated =
|
|
1902
|
+
const validated = _chunkOYR5RIFEcjs.validate.call(void 0, action2, payload, me.actions[action2]);
|
|
1903
1903
|
const opts = _optionalChain([me, 'access', _83 => _83.options, 'optionalAccess', _84 => _84[action2]]);
|
|
1904
1904
|
const max_retries = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _85 => _85.maxRetries]), () => ( 0));
|
|
1905
1905
|
for (let attempt = 0; ; attempt++) {
|
|
@@ -1910,14 +1910,14 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1910
1910
|
void 0,
|
|
1911
1911
|
patch_fn
|
|
1912
1912
|
);
|
|
1913
|
-
if (_optionalChain([snapshot, 'access', _86 => _86.event, 'optionalAccess', _87 => _87.name]) ===
|
|
1914
|
-
throw new (0,
|
|
1913
|
+
if (_optionalChain([snapshot, 'access', _86 => _86.event, 'optionalAccess', _87 => _87.name]) === _chunkN7K4FQEMcjs.TOMBSTONE_EVENT)
|
|
1914
|
+
throw new (0, _chunkN7K4FQEMcjs.StreamClosedError)(stream);
|
|
1915
1915
|
const expected = _nullishCoalesce(expectedVersion, () => ( (snapshot.version >= 0 ? snapshot.version : void 0)));
|
|
1916
1916
|
if (me.given) {
|
|
1917
1917
|
const invariants = me.given[action2] || [];
|
|
1918
1918
|
invariants.forEach(({ valid: valid2, description }) => {
|
|
1919
1919
|
if (!valid2(snapshot.state, actor))
|
|
1920
|
-
throw new (0,
|
|
1920
|
+
throw new (0, _chunkN7K4FQEMcjs.InvariantError)(
|
|
1921
1921
|
action2,
|
|
1922
1922
|
validated,
|
|
1923
1923
|
target,
|
|
@@ -1934,7 +1934,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1934
1934
|
const tuples = Array.isArray(result[0]) ? result : [result];
|
|
1935
1935
|
const valid = tuples.map(([name, data]) => ({
|
|
1936
1936
|
name,
|
|
1937
|
-
data:
|
|
1937
|
+
data: _chunkOYR5RIFEcjs.validate.call(void 0, name, data, me.events[name])
|
|
1938
1938
|
}));
|
|
1939
1939
|
const emitted = valid.map((e) => me.message(e));
|
|
1940
1940
|
const meta = {
|
|
@@ -1959,7 +1959,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1959
1959
|
};
|
|
1960
1960
|
let committed;
|
|
1961
1961
|
try {
|
|
1962
|
-
committed = await
|
|
1962
|
+
committed = await _chunkOYR5RIFEcjs.store.call(void 0, ).commit(
|
|
1963
1963
|
stream,
|
|
1964
1964
|
emitted,
|
|
1965
1965
|
meta,
|
|
@@ -1968,7 +1968,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1968
1968
|
reactingTo ? expectedVersion : expected
|
|
1969
1969
|
);
|
|
1970
1970
|
} catch (error) {
|
|
1971
|
-
if (error instanceof
|
|
1971
|
+
if (error instanceof _chunkN7K4FQEMcjs.ConcurrencyError) void cache_drop(stream);
|
|
1972
1972
|
throw error;
|
|
1973
1973
|
}
|
|
1974
1974
|
let { state: state2, patches } = snapshot;
|
|
@@ -2007,19 +2007,19 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
2007
2007
|
}
|
|
2008
2008
|
return snapshots;
|
|
2009
2009
|
} catch (error) {
|
|
2010
|
-
if (!(error instanceof
|
|
2010
|
+
if (!(error instanceof _chunkN7K4FQEMcjs.ConcurrencyError)) throw error;
|
|
2011
2011
|
if (expectedVersion !== void 0) throw error;
|
|
2012
2012
|
if (attempt >= max_retries) throw error;
|
|
2013
2013
|
if (_optionalChain([opts, 'optionalAccess', _94 => _94.backoff])) {
|
|
2014
2014
|
const delay_ms = compute_backoff_delay(attempt, opts.backoff);
|
|
2015
|
-
if (delay_ms > 0) await
|
|
2015
|
+
if (delay_ms > 0) await _chunkOYR5RIFEcjs.sleep.call(void 0, delay_ms);
|
|
2016
2016
|
}
|
|
2017
2017
|
}
|
|
2018
2018
|
}
|
|
2019
2019
|
}
|
|
2020
2020
|
|
|
2021
2021
|
// src/internal/tracing.ts
|
|
2022
|
-
var PRETTY =
|
|
2022
|
+
var PRETTY = _chunkOYR5RIFEcjs.config.call(void 0, ).env !== "production";
|
|
2023
2023
|
var C_BLUE = "\x1B[38;5;39m";
|
|
2024
2024
|
var C_ORANGE = "\x1B[38;5;208m";
|
|
2025
2025
|
var C_GREEN = "\x1B[38;5;42m";
|
|
@@ -2205,7 +2205,7 @@ function budget_exhausted(lease, options, store_failing) {
|
|
|
2205
2205
|
if (store_failing || !_optionalChain([options, 'optionalAccess', _104 => _104.blockOnError]) || lease.retry <= options.maxRetries)
|
|
2206
2206
|
return void 0;
|
|
2207
2207
|
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.`;
|
|
2208
|
-
|
|
2208
|
+
_chunkOYR5RIFEcjs.log.call(void 0, ).error(error);
|
|
2209
2209
|
return { lease, handled: 0, acked_at: lease.at, error, block: true };
|
|
2210
2210
|
}
|
|
2211
2211
|
function fetch_failure_policy(registry) {
|
|
@@ -2221,13 +2221,13 @@ function fetch_failure_policy(registry) {
|
|
|
2221
2221
|
function finalize(lease, handled, at, error, options, logger, failed_at) {
|
|
2222
2222
|
if (!error) return { lease, handled, acked_at: at };
|
|
2223
2223
|
logger.error(error);
|
|
2224
|
-
const non_retryable = error instanceof
|
|
2224
|
+
const non_retryable = error instanceof _chunkN7K4FQEMcjs.NonRetryableError;
|
|
2225
2225
|
const block2 = options.blockOnError && (non_retryable || lease.retry >= options.maxRetries);
|
|
2226
2226
|
if (block2)
|
|
2227
2227
|
logger.error(
|
|
2228
2228
|
non_retryable ? `Blocking ${lease.stream} on non-retryable error.` : `Blocking ${lease.stream} after ${lease.retry} retries.`
|
|
2229
2229
|
);
|
|
2230
|
-
const next_attempt_at = block2 ? void 0 : Date.now() + compute_backoff_delay(lease.retry, _nullishCoalesce(options.backoff, () => (
|
|
2230
|
+
const next_attempt_at = block2 ? void 0 : Date.now() + compute_backoff_delay(lease.retry, _nullishCoalesce(options.backoff, () => ( _chunkOYR5RIFEcjs.DEFAULT_BACKOFF)));
|
|
2231
2231
|
return {
|
|
2232
2232
|
lease,
|
|
2233
2233
|
handled,
|
|
@@ -2356,7 +2356,7 @@ async function run_drain_cycle(deps, cycle) {
|
|
|
2356
2356
|
const acked = await ops.ack(submitted);
|
|
2357
2357
|
const expected = submitted.filter((l) => l.due === void 0).length;
|
|
2358
2358
|
if (acked.length < expected)
|
|
2359
|
-
|
|
2359
|
+
_chunkOYR5RIFEcjs.log.call(void 0, ).warn(
|
|
2360
2360
|
`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.`
|
|
2361
2361
|
);
|
|
2362
2362
|
const closeable = handled.filter((h) => h.close !== void 0).map((h) => h.close);
|
|
@@ -2456,9 +2456,9 @@ var DrainController = (_class5 = class {
|
|
|
2456
2456
|
if (!this.armed || this._stopped || this._inflight)
|
|
2457
2457
|
return EMPTY_DRAIN;
|
|
2458
2458
|
const d = _nullishCoalesce(this._deps.defaults, () => ( {}));
|
|
2459
|
-
const streamLimit = _nullishCoalesce(_nullishCoalesce(d.streamLimit, () => ( options.streamLimit)), () => (
|
|
2460
|
-
const eventLimit = _nullishCoalesce(options.eventLimit, () => (
|
|
2461
|
-
const leaseMillis = _nullishCoalesce(_nullishCoalesce(d.leaseMillis, () => ( options.leaseMillis)), () => (
|
|
2459
|
+
const streamLimit = _nullishCoalesce(_nullishCoalesce(d.streamLimit, () => ( options.streamLimit)), () => ( _chunkOYR5RIFEcjs.DEFAULT_STREAM_LIMIT));
|
|
2460
|
+
const eventLimit = _nullishCoalesce(options.eventLimit, () => ( _chunkOYR5RIFEcjs.DEFAULT_EVENT_LIMIT));
|
|
2461
|
+
const leaseMillis = _nullishCoalesce(_nullishCoalesce(d.leaseMillis, () => ( options.leaseMillis)), () => ( _chunkOYR5RIFEcjs.DEFAULT_LEASE_MILLIS));
|
|
2462
2462
|
if (this._deps.breaker.state(Date.now()) === "open")
|
|
2463
2463
|
return EMPTY_DRAIN;
|
|
2464
2464
|
const pass = this._pass(streamLimit, eventLimit, leaseMillis).finally(
|
|
@@ -2533,7 +2533,7 @@ function pii_gate(event, fields, predicate, actor) {
|
|
|
2533
2533
|
const { pii, ...rest } = event;
|
|
2534
2534
|
if (pii == null) {
|
|
2535
2535
|
const shredded = { ...data };
|
|
2536
|
-
for (const f of fields) shredded[f] =
|
|
2536
|
+
for (const f of fields) shredded[f] = _chunkN7K4FQEMcjs.SHREDDED;
|
|
2537
2537
|
return { ...rest, data: shredded };
|
|
2538
2538
|
}
|
|
2539
2539
|
const allowed = !!actor && !!predicate && predicate(event, actor);
|
|
@@ -2544,7 +2544,7 @@ function pii_gate(event, fields, predicate, actor) {
|
|
|
2544
2544
|
};
|
|
2545
2545
|
}
|
|
2546
2546
|
const redacted = { ...data };
|
|
2547
|
-
for (const f of fields) redacted[f] =
|
|
2547
|
+
for (const f of fields) redacted[f] = _chunkN7K4FQEMcjs.REDACTED;
|
|
2548
2548
|
return { ...rest, data: redacted };
|
|
2549
2549
|
}
|
|
2550
2550
|
var IDENTITY_GATE = (event) => event;
|
|
@@ -2681,7 +2681,7 @@ function make_deferred(handler, schedule) {
|
|
|
2681
2681
|
const call = handler;
|
|
2682
2682
|
const deferred = async (event, stream, app) => {
|
|
2683
2683
|
const when = typeof schedule === "function" ? schedule(event) : schedule;
|
|
2684
|
-
if (Date.now() < resolve_defer_at(when, event)) throw new (0,
|
|
2684
|
+
if (Date.now() < resolve_defer_at(when, event)) throw new (0, _chunkN7K4FQEMcjs.DeferSignal)(when);
|
|
2685
2685
|
return call(event, stream, app);
|
|
2686
2686
|
};
|
|
2687
2687
|
Object.defineProperty(deferred, "name", { value: handler.name });
|
|
@@ -2750,7 +2750,7 @@ function build_handle(deps) {
|
|
|
2750
2750
|
handled++;
|
|
2751
2751
|
}
|
|
2752
2752
|
} catch (error) {
|
|
2753
|
-
if (error instanceof
|
|
2753
|
+
if (error instanceof _chunkN7K4FQEMcjs.DeferSignal) {
|
|
2754
2754
|
let defer;
|
|
2755
2755
|
try {
|
|
2756
2756
|
defer = resolve_defer_at(error.when, event);
|
|
@@ -2879,8 +2879,7 @@ var SettleLoop = (_class6 = class {
|
|
|
2879
2879
|
this._timer = void 0;
|
|
2880
2880
|
const {
|
|
2881
2881
|
debounceMs: _,
|
|
2882
|
-
|
|
2883
|
-
correlate: { after: _after, ...correlate_query } = {},
|
|
2882
|
+
correlate: correlate_query = {},
|
|
2884
2883
|
maxPasses = Infinity,
|
|
2885
2884
|
...drain_options
|
|
2886
2885
|
} = _nullishCoalesce(this._next, () => ( {}));
|
|
@@ -2893,7 +2892,7 @@ var SettleLoop = (_class6 = class {
|
|
|
2893
2892
|
if (scanned) this._deps.breaker.passed();
|
|
2894
2893
|
const drain = await this._deps.drain(drain_options);
|
|
2895
2894
|
passes.push(drain);
|
|
2896
|
-
const made_progress = drain.leased.length > 0 || scanned &&
|
|
2895
|
+
const made_progress = drain.leased.length > 0 || scanned && pass.read;
|
|
2897
2896
|
if (!made_progress) break;
|
|
2898
2897
|
}
|
|
2899
2898
|
if (passes.length) this._deps.on_settled(merge_drains(passes));
|
|
@@ -3018,7 +3017,7 @@ var Act = (_class7 = class {
|
|
|
3018
3017
|
/** Lanes to arm per event; `"all"` when a dynamic resolver hides the lane. */
|
|
3019
3018
|
|
|
3020
3019
|
|
|
3021
|
-
__init27() {this._logger =
|
|
3020
|
+
__init27() {this._logger = _chunkOYR5RIFEcjs.log.call(void 0, )}
|
|
3022
3021
|
/** This Act's ports: its own bag, or the singleton adapters. */
|
|
3023
3022
|
|
|
3024
3023
|
/** Runs a body so internal `store()`/`cache()` calls resolve to `_ports`. */
|
|
@@ -3040,9 +3039,9 @@ var Act = (_class7 = class {
|
|
|
3040
3039
|
this._lanes = lanes;
|
|
3041
3040
|
this._declared_lanes = ["default", ...lanes.map((l) => l.name)];
|
|
3042
3041
|
validate_only_lanes(options, lanes);
|
|
3043
|
-
this._ports = _nullishCoalesce(options.scoped, () => (
|
|
3042
|
+
this._ports = _nullishCoalesce(options.scoped, () => ( _chunkOYR5RIFEcjs.default_scope.call(void 0, )));
|
|
3044
3043
|
const ports = this._ports;
|
|
3045
|
-
this._scoped =
|
|
3044
|
+
this._scoped = _chunkOYR5RIFEcjs.make_run_scoped.call(void 0, {
|
|
3046
3045
|
// Getters, not a spread: the singletons resolve lazily, so a later
|
|
3047
3046
|
// `store(...)` / `cache(...)` still takes effect.
|
|
3048
3047
|
get store() {
|
|
@@ -3052,14 +3051,14 @@ var Act = (_class7 = class {
|
|
|
3052
3051
|
return ports.cache;
|
|
3053
3052
|
},
|
|
3054
3053
|
// Parsed per build, so a bad window throws on every build.
|
|
3055
|
-
autoclose_window:
|
|
3054
|
+
autoclose_window: _chunkOYR5RIFEcjs.resolveAutocloseConfig.call(void 0, options).autocloseWindow
|
|
3056
3055
|
});
|
|
3057
3056
|
this._correlator = _nullishCoalesce(options.correlator, () => ( default_correlator));
|
|
3058
3057
|
this._es = build_es(this._logger, this._correlator, patch_fn);
|
|
3059
3058
|
this._cd = build_drain(this._logger);
|
|
3060
3059
|
const handle = build_handle({
|
|
3061
3060
|
logger: this._logger,
|
|
3062
|
-
reaction_scope:
|
|
3061
|
+
reaction_scope: _chunkOYR5RIFEcjs.make_reaction_scope.call(void 0, {
|
|
3063
3062
|
do: this.do.bind(this),
|
|
3064
3063
|
load: this.load.bind(this),
|
|
3065
3064
|
query: this.query.bind(this),
|
|
@@ -3089,12 +3088,12 @@ var Act = (_class7 = class {
|
|
|
3089
3088
|
this._ports.store,
|
|
3090
3089
|
options.listen !== false
|
|
3091
3090
|
);
|
|
3092
|
-
|
|
3091
|
+
_chunkOYR5RIFEcjs.register_weak_disposer.call(void 0, new WeakRef(this), (self) => self.shutdown());
|
|
3093
3092
|
}
|
|
3094
3093
|
/** Shared by drain, settle and autoclose; bad knobs throw at build. */
|
|
3095
3094
|
_build_breaker(options) {
|
|
3096
3095
|
return new CircuitBreaker(
|
|
3097
|
-
|
|
3096
|
+
_chunkOYR5RIFEcjs.resolveCircuitBreakerConfig.call(void 0, options.circuitBreaker),
|
|
3098
3097
|
{
|
|
3099
3098
|
on_error: (error, circuit) => this._emit_error(error, circuit),
|
|
3100
3099
|
// When the cooldown elapses, settle once: its scan or claim is the
|
|
@@ -3128,7 +3127,7 @@ var Act = (_class7 = class {
|
|
|
3128
3127
|
try {
|
|
3129
3128
|
await this._run_close(targets);
|
|
3130
3129
|
} catch (error) {
|
|
3131
|
-
if (error instanceof
|
|
3130
|
+
if (error instanceof _chunkN7K4FQEMcjs.StoreError) throw error;
|
|
3132
3131
|
this._logger.error(
|
|
3133
3132
|
error,
|
|
3134
3133
|
`Reaction-requested close of ${targets.map((t) => `"${t.stream}"`).join(", ")} failed and was not retried; close it with app.close(...) once the cause is fixed.`
|
|
@@ -3163,7 +3162,7 @@ var Act = (_class7 = class {
|
|
|
3163
3162
|
/** Audit deps, built after the controllers so the lane set is final. */
|
|
3164
3163
|
_build_audit_deps() {
|
|
3165
3164
|
return {
|
|
3166
|
-
store:
|
|
3165
|
+
store: _chunkOYR5RIFEcjs.store,
|
|
3167
3166
|
event_to_state: this._event_to_state,
|
|
3168
3167
|
// Declared lanes, not this process's controllers: a lane another
|
|
3169
3168
|
// worker drains is not `unknown-lane`.
|
|
@@ -3176,7 +3175,7 @@ var Act = (_class7 = class {
|
|
|
3176
3175
|
registry: this.registry,
|
|
3177
3176
|
static_targets: classification.static_targets,
|
|
3178
3177
|
cd: this._cd,
|
|
3179
|
-
max_subscribed_streams: _nullishCoalesce(options.maxSubscribedStreams, () => (
|
|
3178
|
+
max_subscribed_streams: _nullishCoalesce(options.maxSubscribedStreams, () => ( _chunkN7K4FQEMcjs.DEFAULT_MAX_SUBSCRIBED_STREAMS)),
|
|
3180
3179
|
// Declared lanes (not active ones): a lane another process claims is
|
|
3181
3180
|
// still a valid destination.
|
|
3182
3181
|
declared_lanes: new Set(this._declared_lanes),
|
|
@@ -3192,7 +3191,7 @@ var Act = (_class7 = class {
|
|
|
3192
3191
|
/** Cold start: an idle deferred stream still fires on time after a restart. */
|
|
3193
3192
|
async _seed_persisted_defers() {
|
|
3194
3193
|
const now = Date.now();
|
|
3195
|
-
await walk_streams(
|
|
3194
|
+
await walk_streams(_chunkOYR5RIFEcjs.store.call(void 0, ), (pos) => {
|
|
3196
3195
|
if (pos.deferred_at === void 0 || pos.deferred_at <= now) return;
|
|
3197
3196
|
const controller = this._drain_controllers.get(_nullishCoalesce(pos.lane, () => ( "default")));
|
|
3198
3197
|
_optionalChain([controller, 'optionalAccess', _124 => _124.seed_defer, 'call', _125 => _125(pos.stream, pos.deferred_at)]);
|
|
@@ -3211,7 +3210,7 @@ var Act = (_class7 = class {
|
|
|
3211
3210
|
on_settled: (drain) => this.emit("settled", drain),
|
|
3212
3211
|
breaker: this._breaker
|
|
3213
3212
|
},
|
|
3214
|
-
_nullishCoalesce(options.settleDebounceMs, () => (
|
|
3213
|
+
_nullishCoalesce(options.settleDebounceMs, () => ( _chunkN7K4FQEMcjs.DEFAULT_SETTLE_DEBOUNCE_MS))
|
|
3215
3214
|
);
|
|
3216
3215
|
}
|
|
3217
3216
|
|
|
@@ -3231,7 +3230,7 @@ var Act = (_class7 = class {
|
|
|
3231
3230
|
*/
|
|
3232
3231
|
shutdown(options) {
|
|
3233
3232
|
if (!this._shutdown_promise) {
|
|
3234
|
-
|
|
3233
|
+
_chunkOYR5RIFEcjs.resolveShutdownConfig.call(void 0, options);
|
|
3235
3234
|
this._shutdown_promise = (async () => {
|
|
3236
3235
|
this.stop_correlations();
|
|
3237
3236
|
this._settle.stop(true);
|
|
@@ -3251,10 +3250,10 @@ var Act = (_class7 = class {
|
|
|
3251
3250
|
* default for none or 0, and for a running settle), capped.
|
|
3252
3251
|
*/
|
|
3253
3252
|
_derive_grace_ms(running, settling) {
|
|
3254
|
-
let max = settling ?
|
|
3253
|
+
let max = settling ? _chunkOYR5RIFEcjs.DEFAULT_LEASE_MILLIS : 0;
|
|
3255
3254
|
for (const c of running)
|
|
3256
|
-
max = Math.max(max, c.lease_millis ||
|
|
3257
|
-
return Math.min(max,
|
|
3255
|
+
max = Math.max(max, c.lease_millis || _chunkOYR5RIFEcjs.DEFAULT_LEASE_MILLIS);
|
|
3256
|
+
return Math.min(max, _chunkOYR5RIFEcjs.MAX_SHUTDOWN_GRACE_MS);
|
|
3258
3257
|
}
|
|
3259
3258
|
async _await_inflight(grace_ms) {
|
|
3260
3259
|
const running = [...this._drain_controllers.values()].filter(
|
|
@@ -3335,7 +3334,7 @@ var Act = (_class7 = class {
|
|
|
3335
3334
|
* @see {@link ValidationError}, {@link InvariantError}, {@link ConcurrencyError}
|
|
3336
3335
|
*/
|
|
3337
3336
|
async do(action2, target, payload, options) {
|
|
3338
|
-
const reacting_to = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _127 => _127.reactingTo]), () => (
|
|
3337
|
+
const reacting_to = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _127 => _127.reactingTo]), () => ( _chunkOYR5RIFEcjs.current_reacting.call(void 0, )));
|
|
3339
3338
|
const do_options = reacting_to === _optionalChain([options, 'optionalAccess', _128 => _128.reactingTo]) ? options : { ...options, reactingTo: reacting_to };
|
|
3340
3339
|
return this._scoped(async () => {
|
|
3341
3340
|
const snapshots = await this._es.action(
|
|
@@ -3396,7 +3395,7 @@ var Act = (_class7 = class {
|
|
|
3396
3395
|
return this._scoped(async () => {
|
|
3397
3396
|
let first;
|
|
3398
3397
|
let last;
|
|
3399
|
-
const count = await
|
|
3398
|
+
const count = await _chunkOYR5RIFEcjs.store.call(void 0, ).query((e) => {
|
|
3400
3399
|
const gated = this.registry.query_gate(e.name)(e);
|
|
3401
3400
|
if (!first) first = gated;
|
|
3402
3401
|
last = gated;
|
|
@@ -3426,7 +3425,7 @@ var Act = (_class7 = class {
|
|
|
3426
3425
|
async query_array(query) {
|
|
3427
3426
|
return this._scoped(async () => {
|
|
3428
3427
|
const events = [];
|
|
3429
|
-
await
|
|
3428
|
+
await _chunkOYR5RIFEcjs.store.call(void 0, ).query((e) => {
|
|
3430
3429
|
events.push(this.registry.query_gate(e.name)(e));
|
|
3431
3430
|
}, query);
|
|
3432
3431
|
return events;
|
|
@@ -3446,14 +3445,14 @@ var Act = (_class7 = class {
|
|
|
3446
3445
|
*/
|
|
3447
3446
|
async forget(stream) {
|
|
3448
3447
|
return this._scoped(async () => {
|
|
3449
|
-
const s =
|
|
3448
|
+
const s = _chunkOYR5RIFEcjs.store.call(void 0, );
|
|
3450
3449
|
if (!s.forget_pii) {
|
|
3451
3450
|
throw new Error(
|
|
3452
3451
|
`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).`
|
|
3453
3452
|
);
|
|
3454
3453
|
}
|
|
3455
3454
|
const eventCount = await s.forget_pii(stream);
|
|
3456
|
-
await
|
|
3455
|
+
await _chunkOYR5RIFEcjs.cache.call(void 0, ).invalidate(stream);
|
|
3457
3456
|
if (eventCount > 0) {
|
|
3458
3457
|
this.emit("forgotten", { stream, at: /* @__PURE__ */ new Date(), eventCount });
|
|
3459
3458
|
}
|
|
@@ -3487,7 +3486,7 @@ var Act = (_class7 = class {
|
|
|
3487
3486
|
* @see {@link correlate} for dynamic stream discovery
|
|
3488
3487
|
*/
|
|
3489
3488
|
async drain(options = {}) {
|
|
3490
|
-
|
|
3489
|
+
_chunkOYR5RIFEcjs.resolveDrainConfig.call(void 0, options);
|
|
3491
3490
|
if (!this._drain)
|
|
3492
3491
|
return { fetched: [], leased: [], acked: [], blocked: [] };
|
|
3493
3492
|
return this._scoped(() => this._drain_all(options));
|
|
@@ -3552,8 +3551,9 @@ var Act = (_class7 = class {
|
|
|
3552
3551
|
* target streams their reactions resolve to (static or computed from
|
|
3553
3552
|
* the event), and marks their work so the next drain can claim it.
|
|
3554
3553
|
*
|
|
3555
|
-
* @param query -
|
|
3556
|
-
*
|
|
3554
|
+
* @param query - Only `limit` is used: the most events the pass reads
|
|
3555
|
+
* (default 10). The scan always starts at the correlation checkpoint,
|
|
3556
|
+
* which every reaction shares, so filters and `after` are ignored.
|
|
3557
3557
|
* @returns The number of newly subscribed streams and the last scanned event id
|
|
3558
3558
|
*
|
|
3559
3559
|
* @example Manual correlation
|
|
@@ -3563,7 +3563,7 @@ var Act = (_class7 = class {
|
|
|
3563
3563
|
*
|
|
3564
3564
|
* @see {@link start_correlations} for automatic periodic correlation
|
|
3565
3565
|
*/
|
|
3566
|
-
async correlate(query = {
|
|
3566
|
+
async correlate(query = { limit: 10 }) {
|
|
3567
3567
|
const pass = await this._correlate_pass(query);
|
|
3568
3568
|
return {
|
|
3569
3569
|
subscribed: pass.kind === "scanned" ? pass.subscribed : 0,
|
|
@@ -3575,8 +3575,7 @@ var Act = (_class7 = class {
|
|
|
3575
3575
|
if (!this._drain) return { kind: "idle", last_id: -1 };
|
|
3576
3576
|
return this._scoped(async () => {
|
|
3577
3577
|
const pass = await this._correlate.correlate(query, lease);
|
|
3578
|
-
if (pass.kind === "scanned" &&
|
|
3579
|
-
this._arm_all();
|
|
3578
|
+
if (pass.kind === "scanned" && pass.marked > 0) this._arm_all();
|
|
3580
3579
|
return pass;
|
|
3581
3580
|
});
|
|
3582
3581
|
}
|
|
@@ -3667,7 +3666,7 @@ var Act = (_class7 = class {
|
|
|
3667
3666
|
*/
|
|
3668
3667
|
async reset(input) {
|
|
3669
3668
|
return this._scoped(async () => {
|
|
3670
|
-
const count = await
|
|
3669
|
+
const count = await _chunkOYR5RIFEcjs.store.call(void 0, ).reset(input);
|
|
3671
3670
|
for (const handler of this._batch_handlers.values())
|
|
3672
3671
|
_optionalChain([handler, 'access', _135 => _135[FOLD_RESET], 'optionalCall', _136 => _136()]);
|
|
3673
3672
|
if (count > 0) {
|
|
@@ -3703,7 +3702,7 @@ var Act = (_class7 = class {
|
|
|
3703
3702
|
*/
|
|
3704
3703
|
async unblock(input) {
|
|
3705
3704
|
return this._scoped(async () => {
|
|
3706
|
-
const count = await
|
|
3705
|
+
const count = await _chunkOYR5RIFEcjs.store.call(void 0, ).unblock(input);
|
|
3707
3706
|
if (count > 0) {
|
|
3708
3707
|
this._wake();
|
|
3709
3708
|
}
|
|
@@ -3758,7 +3757,7 @@ var Act = (_class7 = class {
|
|
|
3758
3757
|
return { ...partial, duration_ms: Date.now() - started };
|
|
3759
3758
|
}
|
|
3760
3759
|
const target = _nullishCoalesce(sink, () => ( (() => {
|
|
3761
|
-
const s =
|
|
3760
|
+
const s = _chunkOYR5RIFEcjs.store.call(void 0, );
|
|
3762
3761
|
if (!s.restore) throw new Error("adapter has no restore capability");
|
|
3763
3762
|
return s;
|
|
3764
3763
|
})()));
|
|
@@ -3804,7 +3803,7 @@ var Act = (_class7 = class {
|
|
|
3804
3803
|
async blocked_streams(options) {
|
|
3805
3804
|
return this._scoped(async () => {
|
|
3806
3805
|
const positions = [];
|
|
3807
|
-
await
|
|
3806
|
+
await _chunkOYR5RIFEcjs.store.call(void 0, ).query_streams(
|
|
3808
3807
|
(p) => {
|
|
3809
3808
|
positions.push(p);
|
|
3810
3809
|
},
|
|
@@ -3856,7 +3855,7 @@ var Act = (_class7 = class {
|
|
|
3856
3855
|
* @see {@link Store.prioritize} for the underlying primitive
|
|
3857
3856
|
*/
|
|
3858
3857
|
async prioritize(filter, priority) {
|
|
3859
|
-
return this._scoped(() =>
|
|
3858
|
+
return this._scoped(() => _chunkOYR5RIFEcjs.store.call(void 0, ).prioritize(filter, priority));
|
|
3860
3859
|
}
|
|
3861
3860
|
/** Shared by `close()` and reaction-requested closes. */
|
|
3862
3861
|
async _run_close(targets) {
|
|
@@ -3936,7 +3935,7 @@ var Act = (_class7 = class {
|
|
|
3936
3935
|
* @see {@link correlate} for manual correlation
|
|
3937
3936
|
*/
|
|
3938
3937
|
settle(options) {
|
|
3939
|
-
|
|
3938
|
+
_chunkOYR5RIFEcjs.resolveSettleConfig.call(void 0, _nullishCoalesce(options, () => ( {})));
|
|
3940
3939
|
this._schedule(options);
|
|
3941
3940
|
}
|
|
3942
3941
|
}, _class7);
|
|
@@ -4092,16 +4091,16 @@ function synthesize_autoclose_reactions(registry, states, read_window) {
|
|
|
4092
4091
|
}),
|
|
4093
4092
|
// Never block on autoclose: a transient query/store error should retry,
|
|
4094
4093
|
// not quarantine the synthetic stream.
|
|
4095
|
-
options: { blockOnError: false, maxRetries:
|
|
4094
|
+
options: { blockOnError: false, maxRetries: _chunkOYR5RIFEcjs.DEFAULT_MAX_RETRIES },
|
|
4096
4095
|
handler: async (event) => {
|
|
4097
4096
|
const aggregate = event.stream;
|
|
4098
4097
|
const window = read_window();
|
|
4099
4098
|
if (!in_autoclose_window(window, /* @__PURE__ */ new Date()))
|
|
4100
|
-
throw new (0,
|
|
4101
|
-
const stats = await
|
|
4099
|
+
throw new (0, _chunkN7K4FQEMcjs.DeferSignal)({ at: next_window_open(window, /* @__PURE__ */ new Date()) });
|
|
4100
|
+
const stats = await _chunkOYR5RIFEcjs.store.call(void 0, ).query_stats([aggregate], {
|
|
4102
4101
|
count: true,
|
|
4103
4102
|
tail: keep_days !== void 0 ? true : void 0,
|
|
4104
|
-
exclude: [
|
|
4103
|
+
exclude: [_chunkN7K4FQEMcjs.TOMBSTONE_EVENT, _chunkN7K4FQEMcjs.SNAP_EVENT]
|
|
4105
4104
|
});
|
|
4106
4105
|
const entry = stats.get(aggregate);
|
|
4107
4106
|
if (!entry) return;
|
|
@@ -4132,7 +4131,7 @@ function synthesize_autoclose_reactions(registry, states, read_window) {
|
|
|
4132
4131
|
dues.push(days_after(entry.tail.created, keep_days));
|
|
4133
4132
|
const future = dues.map((d) => d.getTime()).filter((t) => t > Date.now());
|
|
4134
4133
|
if (future.length)
|
|
4135
|
-
throw new (0,
|
|
4134
|
+
throw new (0, _chunkN7K4FQEMcjs.DeferSignal)({ at: new Date(Math.min(...future)) });
|
|
4136
4135
|
}
|
|
4137
4136
|
};
|
|
4138
4137
|
const key = `__autoclose_${st.name}`;
|
|
@@ -4336,9 +4335,9 @@ var _this_ = ({ stream }) => ({
|
|
|
4336
4335
|
|
|
4337
4336
|
// src/builders/builder-utils.ts
|
|
4338
4337
|
function register_lane(config2, lanes) {
|
|
4339
|
-
|
|
4340
|
-
if (config2.name ===
|
|
4341
|
-
throw new Error(`Lane "${
|
|
4338
|
+
_chunkOYR5RIFEcjs.resolveLaneConfig.call(void 0, config2);
|
|
4339
|
+
if (config2.name === _chunkN7K4FQEMcjs.DEFAULT_LANE)
|
|
4340
|
+
throw new Error(`Lane "${_chunkN7K4FQEMcjs.DEFAULT_LANE}" is reserved`);
|
|
4342
4341
|
const existing = lanes.find((l) => l.name === config2.name);
|
|
4343
4342
|
if (!existing) return void lanes.push(config2);
|
|
4344
4343
|
if (existing.leaseMillis !== config2.leaseMillis || existing.streamLimit !== config2.streamLimit || existing.cycleMs !== config2.cycleMs)
|
|
@@ -4380,9 +4379,9 @@ function reaction_on(event, events, builder) {
|
|
|
4380
4379
|
// Validate the whole bag at the declaration site so a bad
|
|
4381
4380
|
// `maxRetries`/`backoff`/`blockOnError` throws ZodError at build,
|
|
4382
4381
|
// not a NaN gate on the first retry.
|
|
4383
|
-
options:
|
|
4384
|
-
blockOnError: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _151 => _151.blockOnError]), () => (
|
|
4385
|
-
maxRetries: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _152 => _152.maxRetries]), () => (
|
|
4382
|
+
options: _chunkOYR5RIFEcjs.resolveReactionConfig.call(void 0, {
|
|
4383
|
+
blockOnError: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _151 => _151.blockOnError]), () => ( _chunkOYR5RIFEcjs.DEFAULT_BLOCK_ON_ERROR)),
|
|
4384
|
+
maxRetries: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _152 => _152.maxRetries]), () => ( _chunkOYR5RIFEcjs.DEFAULT_MAX_RETRIES)),
|
|
4386
4385
|
backoff: _optionalChain([options, 'optionalAccess', _153 => _153.backoff])
|
|
4387
4386
|
})
|
|
4388
4387
|
};
|
|
@@ -4467,7 +4466,7 @@ function date_reviver_schema(schema) {
|
|
|
4467
4466
|
|
|
4468
4467
|
// src/builders/event-builder.ts
|
|
4469
4468
|
function event_tags(schema) {
|
|
4470
|
-
const pii =
|
|
4469
|
+
const pii = _chunkN7K4FQEMcjs.pii_schemas.call(void 0, schema);
|
|
4471
4470
|
const pii_dates = {};
|
|
4472
4471
|
for (const [key, field] of Object.entries(pii)) {
|
|
4473
4472
|
const dates = date_reviver_schema(field);
|
|
@@ -4504,7 +4503,7 @@ function make_event_reader(tags, disclosure, predicate = null) {
|
|
|
4504
4503
|
});
|
|
4505
4504
|
}
|
|
4506
4505
|
function build_events(registry, states, lanes, owners) {
|
|
4507
|
-
const declared = /* @__PURE__ */ new Set([
|
|
4506
|
+
const declared = /* @__PURE__ */ new Set([_chunkN7K4FQEMcjs.DEFAULT_LANE, ...lanes.map((l) => l.name)]);
|
|
4508
4507
|
const lane_errors = [];
|
|
4509
4508
|
const tags = /* @__PURE__ */ new Map();
|
|
4510
4509
|
const sensitive2 = /* @__PURE__ */ new Map();
|
|
@@ -4568,7 +4567,7 @@ function build_events(registry, states, lanes, owners) {
|
|
|
4568
4567
|
if (reader) readers.set(event_name, reader);
|
|
4569
4568
|
}
|
|
4570
4569
|
const snap2 = make_event_reader(event_tags(state2.state), "redact", null);
|
|
4571
|
-
if (snap2) readers.set(
|
|
4570
|
+
if (snap2) readers.set(_chunkN7K4FQEMcjs.SNAP_EVENT, snap2);
|
|
4572
4571
|
if (readers.size === 0) continue;
|
|
4573
4572
|
state2.view = (event, actor) => (_nullishCoalesce(readers.get(event.name), () => ( IDENTITY_GATE)))(event, actor);
|
|
4574
4573
|
}
|
|
@@ -4684,7 +4683,7 @@ function act() {
|
|
|
4684
4683
|
const list = deprecation_summary.map(
|
|
4685
4684
|
(d) => `"${d.deprecated}" (current: "${d.current}", state: "${d.state_name}")`
|
|
4686
4685
|
).join(", ");
|
|
4687
|
-
|
|
4686
|
+
_chunkOYR5RIFEcjs.log.call(void 0, ).info(
|
|
4688
4687
|
`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.`
|
|
4689
4688
|
);
|
|
4690
4689
|
}
|
|
@@ -4726,7 +4725,7 @@ function act() {
|
|
|
4726
4725
|
return reaction_on(event, registry.events, builder);
|
|
4727
4726
|
},
|
|
4728
4727
|
build: (options) => {
|
|
4729
|
-
|
|
4728
|
+
_chunkOYR5RIFEcjs.resolveActConfig.call(void 0, options);
|
|
4730
4729
|
const patch_fn = _optionalChain([options, 'optionalAccess', _165 => _165.validateFoldedState]) === true ? validating_patch : bare_patch;
|
|
4731
4730
|
if (!_built) {
|
|
4732
4731
|
for (const proj of pending_projections) add_projection(proj);
|
|
@@ -4778,7 +4777,7 @@ function act() {
|
|
|
4778
4777
|
synthesize_autoclose_reactions(
|
|
4779
4778
|
registry,
|
|
4780
4779
|
states,
|
|
4781
|
-
|
|
4780
|
+
_chunkOYR5RIFEcjs.current_autoclose_window
|
|
4782
4781
|
);
|
|
4783
4782
|
Object.freeze(registry.actions);
|
|
4784
4783
|
Object.freeze(registry.events);
|
|
@@ -4827,8 +4826,8 @@ function _projection(target) {
|
|
|
4827
4826
|
handler,
|
|
4828
4827
|
resolver: _nullishCoalesce(default_resolver, () => ( _this_)),
|
|
4829
4828
|
options: {
|
|
4830
|
-
blockOnError:
|
|
4831
|
-
maxRetries:
|
|
4829
|
+
blockOnError: _chunkOYR5RIFEcjs.DEFAULT_BLOCK_ON_ERROR,
|
|
4830
|
+
maxRetries: _chunkOYR5RIFEcjs.DEFAULT_MAX_RETRIES
|
|
4832
4831
|
}
|
|
4833
4832
|
}),
|
|
4834
4833
|
widened
|
|
@@ -4869,7 +4868,7 @@ function _projection(target) {
|
|
|
4869
4868
|
throw new Error(
|
|
4870
4869
|
`Projection "${target}" .of() partials must share one state name \u2014 got "${name}" and "${partial.name}"`
|
|
4871
4870
|
);
|
|
4872
|
-
const config2 =
|
|
4871
|
+
const config2 = _chunkOYR5RIFEcjs.resolveFoldConfig.call(void 0, options);
|
|
4873
4872
|
const fold_events = {};
|
|
4874
4873
|
for (const partial of partials)
|
|
4875
4874
|
for (const [event_name, schema] of Object.entries(partial.events)) {
|
|
@@ -4887,8 +4886,8 @@ function _projection(target) {
|
|
|
4887
4886
|
handler: noop,
|
|
4888
4887
|
resolver: { target },
|
|
4889
4888
|
options: {
|
|
4890
|
-
blockOnError:
|
|
4891
|
-
maxRetries:
|
|
4889
|
+
blockOnError: _chunkOYR5RIFEcjs.DEFAULT_BLOCK_ON_ERROR,
|
|
4890
|
+
maxRetries: _chunkOYR5RIFEcjs.DEFAULT_MAX_RETRIES
|
|
4892
4891
|
}
|
|
4893
4892
|
}
|
|
4894
4893
|
]
|
|
@@ -5004,7 +5003,7 @@ function action_builder(state2) {
|
|
|
5004
5003
|
throw new Error(`Duplicate action "${action2}"`);
|
|
5005
5004
|
internal.actions[action2] = schema;
|
|
5006
5005
|
if (options) {
|
|
5007
|
-
|
|
5006
|
+
_chunkOYR5RIFEcjs.resolveActionConfig.call(void 0, options);
|
|
5008
5007
|
internal.options ??= {};
|
|
5009
5008
|
internal.options[action2] = options;
|
|
5010
5009
|
}
|
|
@@ -5293,5 +5292,5 @@ function write_line(writer, line) {
|
|
|
5293
5292
|
|
|
5294
5293
|
|
|
5295
5294
|
|
|
5296
|
-
exports.Act = Act; exports.ActorSchema =
|
|
5295
|
+
exports.Act = Act; exports.ActorSchema = _chunkN7K4FQEMcjs.ActorSchema; exports.CausationEventSchema = _chunkN7K4FQEMcjs.CausationEventSchema; exports.CommittedMetaSchema = _chunkN7K4FQEMcjs.CommittedMetaSchema; exports.ConcurrencyError = _chunkN7K4FQEMcjs.ConcurrencyError; exports.ConsoleLogger = _chunkOYR5RIFEcjs.ConsoleLogger; exports.CsvFile = CsvFile; exports.DEFAULT_LANE = _chunkN7K4FQEMcjs.DEFAULT_LANE; exports.DEFAULT_MAX_SUBSCRIBED_STREAMS = _chunkN7K4FQEMcjs.DEFAULT_MAX_SUBSCRIBED_STREAMS; exports.DEFAULT_SETTLE_DEBOUNCE_MS = _chunkN7K4FQEMcjs.DEFAULT_SETTLE_DEBOUNCE_MS; exports.DeferSignal = _chunkN7K4FQEMcjs.DeferSignal; exports.Environments = _chunkN7K4FQEMcjs.Environments; exports.Errors = _chunkN7K4FQEMcjs.Errors; exports.EventMetaSchema = _chunkN7K4FQEMcjs.EventMetaSchema; exports.ExitCodes = _chunkN7K4FQEMcjs.ExitCodes; exports.InMemoryCache = _chunkOYR5RIFEcjs.InMemoryCache; exports.InMemoryStore = _chunkOYR5RIFEcjs.InMemoryStore; exports.InvariantError = _chunkN7K4FQEMcjs.InvariantError; exports.LogLevels = _chunkN7K4FQEMcjs.LogLevels; exports.NonRetryableError = _chunkN7K4FQEMcjs.NonRetryableError; exports.PackageSchema = _chunkOYR5RIFEcjs.PackageSchema; exports.QuerySchema = _chunkN7K4FQEMcjs.QuerySchema; exports.REDACTED = _chunkN7K4FQEMcjs.REDACTED; exports.SHREDDED = _chunkN7K4FQEMcjs.SHREDDED; exports.SNAP_EVENT = _chunkN7K4FQEMcjs.SNAP_EVENT; exports.StoreError = _chunkN7K4FQEMcjs.StoreError; exports.StreamClosedError = _chunkN7K4FQEMcjs.StreamClosedError; exports.TOMBSTONE_EVENT = _chunkN7K4FQEMcjs.TOMBSTONE_EVENT; exports.TargetSchema = _chunkN7K4FQEMcjs.TargetSchema; exports.ValidationError = _chunkN7K4FQEMcjs.ValidationError; exports.ZodEmpty = _chunkN7K4FQEMcjs.ZodEmpty; exports.act = act; exports.cache = _chunkOYR5RIFEcjs.cache; exports.config = _chunkOYR5RIFEcjs.config; exports.dateReviver = _chunkOYR5RIFEcjs.dateReviver; exports.default_scope = _chunkOYR5RIFEcjs.default_scope; exports.dispose = _chunkOYR5RIFEcjs.dispose; exports.disposeAndExit = _chunkOYR5RIFEcjs.disposeAndExit; exports.extend = _chunkOYR5RIFEcjs.extend; exports.is_literal_source = _chunkOYR5RIFEcjs.is_literal_source; exports.log = _chunkOYR5RIFEcjs.log; exports.pii_fields = _chunkN7K4FQEMcjs.pii_fields; exports.port = _chunkOYR5RIFEcjs.port; exports.projection = projection; exports.resolveAutocloseConfig = _chunkOYR5RIFEcjs.resolveAutocloseConfig2; exports.sensitive = _chunkN7K4FQEMcjs.sensitive; exports.sleep = _chunkOYR5RIFEcjs.sleep; exports.slice = slice; exports.state = state; exports.store = _chunkOYR5RIFEcjs.store; exports.validate = _chunkOYR5RIFEcjs.validate;
|
|
5297
5296
|
//# sourceMappingURL=index.cjs.map
|