@rotorsoft/act 1.34.0 → 1.34.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- 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/adapters/in-memory-cache.d.ts.map +1 -1
- package/dist/@types/builders/act-builder.d.ts.map +1 -1
- package/dist/@types/builders/merge.d.ts.map +1 -1
- package/dist/@types/builders/projection-builder.d.ts.map +1 -1
- package/dist/@types/builders/slice-builder.d.ts.map +1 -1
- package/dist/@types/ports.d.ts +1 -2
- package/dist/@types/ports.d.ts.map +1 -1
- package/dist/@types/test/sandbox.d.ts.map +1 -1
- package/dist/@types/types/builders.d.ts +61 -138
- package/dist/@types/types/builders.d.ts.map +1 -1
- package/dist/{chunk-BTLM7SW4.cjs → chunk-GBAMBUDN.cjs} +1 -1
- package/dist/chunk-GBAMBUDN.cjs.map +1 -0
- package/dist/{chunk-5F2TQ4PT.js → chunk-IEM2NS6J.js} +1 -1
- package/dist/chunk-IEM2NS6J.js.map +1 -0
- package/dist/index.cjs +102 -101
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -6
- package/dist/index.js.map +1 -1
- package/dist/test/index.cjs +3 -3
- package/dist/test/index.cjs.map +1 -1
- package/dist/test/index.js +1 -1
- package/dist/test/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-5F2TQ4PT.js.map +0 -1
- package/dist/chunk-BTLM7SW4.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
var
|
|
43
|
+
var _chunkGBAMBUDNcjs = require('./chunk-GBAMBUDN.cjs');
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
|
|
@@ -74,20 +74,20 @@ var _chunkRF5MV72Kcjs = require('./chunk-RF5MV72K.cjs');
|
|
|
74
74
|
|
|
75
75
|
// src/signals.ts
|
|
76
76
|
process.once("SIGINT", async (arg) => {
|
|
77
|
-
|
|
78
|
-
await
|
|
77
|
+
_chunkGBAMBUDNcjs.log.call(void 0, ).info(arg, "SIGINT");
|
|
78
|
+
await _chunkGBAMBUDNcjs.disposeAndExit.call(void 0, "EXIT");
|
|
79
79
|
});
|
|
80
80
|
process.once("SIGTERM", async (arg) => {
|
|
81
|
-
|
|
82
|
-
await
|
|
81
|
+
_chunkGBAMBUDNcjs.log.call(void 0, ).info(arg, "SIGTERM");
|
|
82
|
+
await _chunkGBAMBUDNcjs.disposeAndExit.call(void 0, "EXIT");
|
|
83
83
|
});
|
|
84
84
|
process.once("uncaughtException", async (arg) => {
|
|
85
|
-
|
|
86
|
-
await
|
|
85
|
+
_chunkGBAMBUDNcjs.log.call(void 0, ).error(arg, "Uncaught Exception");
|
|
86
|
+
await _chunkGBAMBUDNcjs.disposeAndExit.call(void 0, "ERROR");
|
|
87
87
|
});
|
|
88
88
|
process.once("unhandledRejection", async (arg) => {
|
|
89
|
-
|
|
90
|
-
await
|
|
89
|
+
_chunkGBAMBUDNcjs.log.call(void 0, ).error(arg, "Unhandled Rejection");
|
|
90
|
+
await _chunkGBAMBUDNcjs.disposeAndExit.call(void 0, "ERROR");
|
|
91
91
|
});
|
|
92
92
|
|
|
93
93
|
// src/act.ts
|
|
@@ -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 _chunkGBAMBUDNcjs.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,7 +935,7 @@ 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 _chunkGBAMBUDNcjs.store.call(void 0, ).query(
|
|
939
939
|
(event) => {
|
|
940
940
|
if (min_id === void 0 || event.id < min_id) min_id = event.id;
|
|
941
941
|
if (event.name === _chunkRF5MV72Kcjs.SNAP_EVENT && event.created < before && (max_id === void 0 || event.id <= max_id) && (boundary_id === void 0 || event.id > boundary_id))
|
|
@@ -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
|
+
_chunkGBAMBUDNcjs.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,13 +977,13 @@ function source_matcher() {
|
|
|
977
977
|
};
|
|
978
978
|
}
|
|
979
979
|
async function scan_stream_heads(streams) {
|
|
980
|
-
const stats = await
|
|
980
|
+
const stats = await _chunkGBAMBUDNcjs.store.call(void 0, ).query_stats(streams, {
|
|
981
981
|
exclude: [_chunkRF5MV72Kcjs.SNAP_EVENT]
|
|
982
982
|
});
|
|
983
|
-
const domain_heads = await
|
|
983
|
+
const domain_heads = await _chunkGBAMBUDNcjs.store.call(void 0, ).query_stats(streams, {
|
|
984
984
|
exclude: [_chunkRF5MV72Kcjs.SNAP_EVENT, _chunkRF5MV72Kcjs.TOMBSTONE_EVENT]
|
|
985
985
|
});
|
|
986
|
-
const true_heads = await
|
|
986
|
+
const true_heads = await _chunkGBAMBUDNcjs.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]);
|
|
@@ -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
|
+
_chunkGBAMBUDNcjs.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 _chunkGBAMBUDNcjs.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;
|
|
@@ -1100,13 +1100,13 @@ async function truncate_and_warm_cache(guarded, seed_states, guard_events, corre
|
|
|
1100
1100
|
}
|
|
1101
1101
|
};
|
|
1102
1102
|
});
|
|
1103
|
-
const truncated = await
|
|
1103
|
+
const truncated = await _chunkGBAMBUDNcjs.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 _chunkGBAMBUDNcjs.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 _chunkGBAMBUDNcjs.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
|
+
_chunkGBAMBUDNcjs.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 lets a resolution re-lane them.
|
|
1181
1181
|
|
|
1182
1182
|
__init11() {this._static_subscriptions = /* @__PURE__ */ new Map()}
|
|
1183
|
-
__init12() {this._patterns = new (0,
|
|
1183
|
+
__init12() {this._patterns = new (0, _chunkGBAMBUDNcjs.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, _chunkGBAMBUDNcjs.LruMap)(max_subscribed_streams);
|
|
1202
1202
|
this._registry = registry;
|
|
1203
1203
|
this._declared_lanes = declared_lanes;
|
|
1204
1204
|
this._static_targets = static_targets;
|
|
@@ -1256,7 +1256,7 @@ var CorrelateCycle = (_class3 = class {
|
|
|
1256
1256
|
/** Would the target's own `fetch` (filtered by `source`) return this event? */
|
|
1257
1257
|
_in_fetch_window(source, stream) {
|
|
1258
1258
|
if (source === void 0 || source === stream) return true;
|
|
1259
|
-
if (
|
|
1259
|
+
if (_chunkGBAMBUDNcjs.is_literal_source.call(void 0, source)) return false;
|
|
1260
1260
|
let pattern = this._patterns.get(source);
|
|
1261
1261
|
if (!pattern) {
|
|
1262
1262
|
pattern = new RegExp(source);
|
|
@@ -1299,7 +1299,7 @@ var CorrelateCycle = (_class3 = class {
|
|
|
1299
1299
|
const correlated = /* @__PURE__ */ new Map();
|
|
1300
1300
|
let last_id = after;
|
|
1301
1301
|
let stopped = false;
|
|
1302
|
-
const found = await
|
|
1302
|
+
const found = await _chunkGBAMBUDNcjs.store.call(void 0, ).query(
|
|
1303
1303
|
(event) => {
|
|
1304
1304
|
if (stopped) return;
|
|
1305
1305
|
const register = this._registry.events[event.name];
|
|
@@ -1422,7 +1422,7 @@ var CorrelateCycle = (_class3 = class {
|
|
|
1422
1422
|
await Promise.all(
|
|
1423
1423
|
missed.map(async ([stream, entry]) => {
|
|
1424
1424
|
let row;
|
|
1425
|
-
await
|
|
1425
|
+
await _chunkGBAMBUDNcjs.store.call(void 0, ).query_streams(
|
|
1426
1426
|
(position) => {
|
|
1427
1427
|
row = position;
|
|
1428
1428
|
},
|
|
@@ -1461,7 +1461,7 @@ var CorrelateCycle = (_class3 = class {
|
|
|
1461
1461
|
millis: 0
|
|
1462
1462
|
});
|
|
1463
1463
|
} catch (error) {
|
|
1464
|
-
|
|
1464
|
+
_chunkGBAMBUDNcjs.log.call(void 0, ).warn(
|
|
1465
1465
|
`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)}`
|
|
1466
1466
|
);
|
|
1467
1467
|
}
|
|
@@ -1614,14 +1614,14 @@ function compute_lag_lead_ratio(handled, lagging, leading) {
|
|
|
1614
1614
|
}
|
|
1615
1615
|
|
|
1616
1616
|
// src/internal/drain-ops.ts
|
|
1617
|
-
var claim = (lagging, leading, by, millis, lane) =>
|
|
1617
|
+
var claim = (lagging, leading, by, millis, lane) => _chunkGBAMBUDNcjs.store.call(void 0, ).claim(lagging, leading, by, millis, lane);
|
|
1618
1618
|
async function fetch(leased, eventLimit) {
|
|
1619
1619
|
return Promise.all(
|
|
1620
1620
|
leased.map(async ({ stream, source, at, lagging }) => {
|
|
1621
1621
|
const events = [];
|
|
1622
|
-
const stream_exact = source !== void 0 &&
|
|
1622
|
+
const stream_exact = source !== void 0 && _chunkGBAMBUDNcjs.is_literal_source.call(void 0, source) ? true : void 0;
|
|
1623
1623
|
try {
|
|
1624
|
-
await
|
|
1624
|
+
await _chunkGBAMBUDNcjs.store.call(void 0, ).query((e) => events.push(e), {
|
|
1625
1625
|
stream: source,
|
|
1626
1626
|
stream_exact,
|
|
1627
1627
|
after: at,
|
|
@@ -1641,30 +1641,30 @@ async function fetch(leased, eventLimit) {
|
|
|
1641
1641
|
})
|
|
1642
1642
|
);
|
|
1643
1643
|
}
|
|
1644
|
-
var ack = (leases) =>
|
|
1645
|
-
var block = (leases) =>
|
|
1646
|
-
var subscribe = (streams, correlated_at, correlator) =>
|
|
1644
|
+
var ack = (leases) => _chunkGBAMBUDNcjs.store.call(void 0, ).ack(leases);
|
|
1645
|
+
var block = (leases) => _chunkGBAMBUDNcjs.store.call(void 0, ).block(leases);
|
|
1646
|
+
var subscribe = (streams, correlated_at, correlator) => _chunkGBAMBUDNcjs.store.call(void 0, ).subscribe(streams, correlated_at, correlator);
|
|
1647
1647
|
|
|
1648
1648
|
// src/internal/event-sourcing.ts
|
|
1649
1649
|
var _actpatch = require('@rotorsoft/act-patch');
|
|
1650
1650
|
var bare_patch = (_me, state2, partial) => _actpatch.patch.call(void 0, state2, partial);
|
|
1651
1651
|
var validating_patch = (me, state2, partial, event) => {
|
|
1652
1652
|
const next = _actpatch.patch.call(void 0, state2, partial);
|
|
1653
|
-
return
|
|
1653
|
+
return _chunkGBAMBUDNcjs.validate.call(void 0,
|
|
1654
1654
|
`${me.name}.${String(event.name)}#${event.id}`,
|
|
1655
1655
|
next,
|
|
1656
1656
|
me.state
|
|
1657
1657
|
);
|
|
1658
1658
|
};
|
|
1659
1659
|
var DEFAULT_BATCH = 500;
|
|
1660
|
-
var cache_put = (stream, entry) =>
|
|
1661
|
-
(err) =>
|
|
1660
|
+
var cache_put = (stream, entry) => _chunkGBAMBUDNcjs.cache.call(void 0, ).set(stream, entry).catch(
|
|
1661
|
+
(err) => _chunkGBAMBUDNcjs.log.call(void 0, ).warn(
|
|
1662
1662
|
err,
|
|
1663
1663
|
"cache set skipped; the next load re-folds from the store"
|
|
1664
1664
|
)
|
|
1665
1665
|
);
|
|
1666
|
-
var cache_drop = (stream) =>
|
|
1667
|
-
(err) =>
|
|
1666
|
+
var cache_drop = (stream) => _chunkGBAMBUDNcjs.cache.call(void 0, ).invalidate(stream).catch(
|
|
1667
|
+
(err) => _chunkGBAMBUDNcjs.log.call(void 0, ).warn(
|
|
1668
1668
|
err,
|
|
1669
1669
|
"cache invalidate skipped; a stale checkpoint re-folds from its event_id"
|
|
1670
1670
|
)
|
|
@@ -1672,7 +1672,7 @@ var cache_drop = (stream) => _chunkBTLM7SW4cjs.cache.call(void 0, ).invalidate(s
|
|
|
1672
1672
|
async function snap(snapshot) {
|
|
1673
1673
|
const { id, stream, name, meta, version } = snapshot.event;
|
|
1674
1674
|
try {
|
|
1675
|
-
const [committed] = await
|
|
1675
|
+
const [committed] = await _chunkGBAMBUDNcjs.store.call(void 0, ).commit(
|
|
1676
1676
|
stream,
|
|
1677
1677
|
[{ name: _chunkRF5MV72Kcjs.SNAP_EVENT, data: snapshot.state }],
|
|
1678
1678
|
{
|
|
@@ -1685,14 +1685,14 @@ async function snap(snapshot) {
|
|
|
1685
1685
|
return committed;
|
|
1686
1686
|
} catch (error) {
|
|
1687
1687
|
const reason = error instanceof Error ? error.message : String(error);
|
|
1688
|
-
|
|
1688
|
+
_chunkGBAMBUDNcjs.log.call(void 0, ).warn(
|
|
1689
1689
|
`Snapshot write failed on stream "${stream}": ${reason} \u2014 cold starts will replay full history until snapshots succeed.`
|
|
1690
1690
|
);
|
|
1691
1691
|
}
|
|
1692
1692
|
}
|
|
1693
1693
|
async function tombstone(stream, expectedVersion, correlation) {
|
|
1694
1694
|
try {
|
|
1695
|
-
const [committed] = await
|
|
1695
|
+
const [committed] = await _chunkGBAMBUDNcjs.store.call(void 0, ).commit(
|
|
1696
1696
|
stream,
|
|
1697
1697
|
[{ name: _chunkRF5MV72Kcjs.TOMBSTONE_EVENT, data: {} }],
|
|
1698
1698
|
{ correlation, causation: {} },
|
|
@@ -1825,14 +1825,14 @@ async function scan(source, opts = {}, callback) {
|
|
|
1825
1825
|
async function load(me, target, callback, patch_fn = bare_patch) {
|
|
1826
1826
|
const { stream, actor, asOf } = target;
|
|
1827
1827
|
const time_travel = !!asOf && Object.values(asOf).some((v) => v !== void 0);
|
|
1828
|
-
const cached = time_travel ? void 0 : await
|
|
1828
|
+
const cached = time_travel ? void 0 : await _chunkGBAMBUDNcjs.cache.call(void 0, ).get(stream);
|
|
1829
1829
|
const cache_hit = !!cached;
|
|
1830
1830
|
let state2 = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _72 => _72.state]), () => ( (me.init ? me.init() : {})));
|
|
1831
1831
|
let patches = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _73 => _73.patches]), () => ( 0));
|
|
1832
1832
|
let snaps = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _74 => _74.snaps]), () => ( 0));
|
|
1833
1833
|
let replayed = 0;
|
|
1834
1834
|
let event;
|
|
1835
|
-
await
|
|
1835
|
+
await _chunkGBAMBUDNcjs.store.call(void 0, ).query(
|
|
1836
1836
|
(raw) => {
|
|
1837
1837
|
event = me.view(raw, actor);
|
|
1838
1838
|
if (event.name === _chunkRF5MV72Kcjs.SNAP_EVENT) {
|
|
@@ -1845,7 +1845,7 @@ async function load(me, target, callback, patch_fn = bare_patch) {
|
|
|
1845
1845
|
patches++;
|
|
1846
1846
|
replayed++;
|
|
1847
1847
|
} else if (event.name !== _chunkRF5MV72Kcjs.TOMBSTONE_EVENT) {
|
|
1848
|
-
|
|
1848
|
+
_chunkGBAMBUDNcjs.log.call(void 0, ).warn(
|
|
1849
1849
|
`Skipping unknown event "${String(event.name)}" on stream "${stream}" (id=${event.id}) \u2014 no reducer in state "${me.name}"`
|
|
1850
1850
|
);
|
|
1851
1851
|
}
|
|
@@ -1897,7 +1897,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1897
1897
|
if (!stream) throw new Error("Missing target stream");
|
|
1898
1898
|
const reactingTo = _optionalChain([options, 'optionalAccess', _81 => _81.reactingTo]);
|
|
1899
1899
|
const correlator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _82 => _82.correlator]), () => ( default_correlator));
|
|
1900
|
-
const validated =
|
|
1900
|
+
const validated = _chunkGBAMBUDNcjs.validate.call(void 0, action2, payload, me.actions[action2]);
|
|
1901
1901
|
const opts = _optionalChain([me, 'access', _83 => _83.options, 'optionalAccess', _84 => _84[action2]]);
|
|
1902
1902
|
const max_retries = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _85 => _85.maxRetries]), () => ( 0));
|
|
1903
1903
|
for (let attempt = 0; ; attempt++) {
|
|
@@ -1945,7 +1945,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1945
1945
|
const tuples = Array.isArray(result[0]) ? result : [result];
|
|
1946
1946
|
const valid = tuples.map(([name, data]) => ({
|
|
1947
1947
|
name,
|
|
1948
|
-
data:
|
|
1948
|
+
data: _chunkGBAMBUDNcjs.validate.call(void 0, name, data, me.events[name])
|
|
1949
1949
|
}));
|
|
1950
1950
|
const emitted = valid.map((e) => me.message(e));
|
|
1951
1951
|
const meta = {
|
|
@@ -1970,7 +1970,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1970
1970
|
};
|
|
1971
1971
|
let committed;
|
|
1972
1972
|
try {
|
|
1973
|
-
committed = await
|
|
1973
|
+
committed = await _chunkGBAMBUDNcjs.store.call(void 0, ).commit(
|
|
1974
1974
|
stream,
|
|
1975
1975
|
emitted,
|
|
1976
1976
|
meta,
|
|
@@ -2023,14 +2023,14 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
2023
2023
|
if (attempt >= max_retries) throw error;
|
|
2024
2024
|
if (_optionalChain([opts, 'optionalAccess', _94 => _94.backoff])) {
|
|
2025
2025
|
const delay_ms = compute_backoff_delay(attempt, opts.backoff);
|
|
2026
|
-
if (delay_ms > 0) await
|
|
2026
|
+
if (delay_ms > 0) await _chunkGBAMBUDNcjs.sleep.call(void 0, delay_ms);
|
|
2027
2027
|
}
|
|
2028
2028
|
}
|
|
2029
2029
|
}
|
|
2030
2030
|
}
|
|
2031
2031
|
|
|
2032
2032
|
// src/internal/tracing.ts
|
|
2033
|
-
var PRETTY =
|
|
2033
|
+
var PRETTY = _chunkGBAMBUDNcjs.config.call(void 0, ).env !== "production";
|
|
2034
2034
|
var C_BLUE = "\x1B[38;5;39m";
|
|
2035
2035
|
var C_ORANGE = "\x1B[38;5;208m";
|
|
2036
2036
|
var C_GREEN = "\x1B[38;5;42m";
|
|
@@ -2216,7 +2216,7 @@ function budget_exhausted(lease, options, store_failing) {
|
|
|
2216
2216
|
if (store_failing || !_optionalChain([options, 'optionalAccess', _104 => _104.blockOnError]) || lease.retry <= options.maxRetries)
|
|
2217
2217
|
return void 0;
|
|
2218
2218
|
const error = `Blocking ${lease.stream} after ${lease.retry} claims with no acknowledged progress \u2014 the retry budget (${options.maxRetries}) was spent without the handler ever reporting an error. That means every attempt lost its lease before it could ack: move the reaction to a lane whose leaseMillis covers the handler, then unblock the stream.`;
|
|
2219
|
-
|
|
2219
|
+
_chunkGBAMBUDNcjs.log.call(void 0, ).error(error);
|
|
2220
2220
|
return { lease, handled: 0, acked_at: lease.at, error, block: true };
|
|
2221
2221
|
}
|
|
2222
2222
|
function fetch_failure_policy(registry) {
|
|
@@ -2238,7 +2238,7 @@ function finalize(lease, handled, at, error, options, logger, failed_at) {
|
|
|
2238
2238
|
logger.error(
|
|
2239
2239
|
non_retryable ? `Blocking ${lease.stream} on non-retryable error.` : `Blocking ${lease.stream} after ${lease.retry} retries.`
|
|
2240
2240
|
);
|
|
2241
|
-
const next_attempt_at = block2 ? void 0 : Date.now() + compute_backoff_delay(lease.retry, _nullishCoalesce(options.backoff, () => (
|
|
2241
|
+
const next_attempt_at = block2 ? void 0 : Date.now() + compute_backoff_delay(lease.retry, _nullishCoalesce(options.backoff, () => ( _chunkGBAMBUDNcjs.DEFAULT_BACKOFF)));
|
|
2242
2242
|
return {
|
|
2243
2243
|
lease,
|
|
2244
2244
|
handled,
|
|
@@ -2366,7 +2366,7 @@ async function run_drain_cycle(deps, cycle) {
|
|
|
2366
2366
|
const acked = submitted.length ? await ops.ack(submitted) : [];
|
|
2367
2367
|
const expected = submitted.filter((l) => l.due === void 0).length;
|
|
2368
2368
|
if (acked.length < expected)
|
|
2369
|
-
|
|
2369
|
+
_chunkGBAMBUDNcjs.log.call(void 0, ).warn(
|
|
2370
2370
|
`drain: ${expected - acked.length} of ${expected} acks were dropped \u2014 the lease was taken by another worker mid-handler. That work will be redelivered (at-least-once), but persistent drops mean leaseMillis is too short for this handler.`
|
|
2371
2371
|
);
|
|
2372
2372
|
const closeable = handled.filter((h) => h.close !== void 0).map((h) => h.close);
|
|
@@ -2466,9 +2466,9 @@ var DrainController = (_class5 = class {
|
|
|
2466
2466
|
if (!this.armed || this._stopped || this._inflight)
|
|
2467
2467
|
return EMPTY_DRAIN;
|
|
2468
2468
|
const d = _nullishCoalesce(this._deps.defaults, () => ( {}));
|
|
2469
|
-
const streamLimit = _nullishCoalesce(_nullishCoalesce(d.streamLimit, () => ( options.streamLimit)), () => (
|
|
2470
|
-
const eventLimit = _nullishCoalesce(options.eventLimit, () => (
|
|
2471
|
-
const leaseMillis = _nullishCoalesce(_nullishCoalesce(d.leaseMillis, () => ( options.leaseMillis)), () => (
|
|
2469
|
+
const streamLimit = _nullishCoalesce(_nullishCoalesce(d.streamLimit, () => ( options.streamLimit)), () => ( _chunkGBAMBUDNcjs.DEFAULT_STREAM_LIMIT));
|
|
2470
|
+
const eventLimit = _nullishCoalesce(options.eventLimit, () => ( _chunkGBAMBUDNcjs.DEFAULT_EVENT_LIMIT));
|
|
2471
|
+
const leaseMillis = _nullishCoalesce(_nullishCoalesce(d.leaseMillis, () => ( options.leaseMillis)), () => ( _chunkGBAMBUDNcjs.DEFAULT_LEASE_MILLIS));
|
|
2472
2472
|
if (this._deps.breaker.state(Date.now()) === "open")
|
|
2473
2473
|
return EMPTY_DRAIN;
|
|
2474
2474
|
const pass = this._pass(streamLimit, eventLimit, leaseMillis).finally(
|
|
@@ -3026,7 +3026,7 @@ var Act = (_class7 = class {
|
|
|
3026
3026
|
/** Lanes to arm per event; `"all"` when a dynamic resolver hides the lane. */
|
|
3027
3027
|
|
|
3028
3028
|
|
|
3029
|
-
__init27() {this._logger =
|
|
3029
|
+
__init27() {this._logger = _chunkGBAMBUDNcjs.log.call(void 0, )}
|
|
3030
3030
|
/** This Act's ports: its own bag, or the singleton adapters. */
|
|
3031
3031
|
|
|
3032
3032
|
/** Runs a body so internal `store()`/`cache()` calls resolve to `_ports`. */
|
|
@@ -3048,9 +3048,9 @@ var Act = (_class7 = class {
|
|
|
3048
3048
|
this._lanes = lanes;
|
|
3049
3049
|
this._declared_lanes = ["default", ...lanes.map((l) => l.name)];
|
|
3050
3050
|
validate_only_lanes(options, lanes);
|
|
3051
|
-
this._ports = _nullishCoalesce(options.scoped, () => (
|
|
3051
|
+
this._ports = _nullishCoalesce(options.scoped, () => ( _chunkGBAMBUDNcjs.default_scope.call(void 0, )));
|
|
3052
3052
|
const ports = this._ports;
|
|
3053
|
-
this._scoped =
|
|
3053
|
+
this._scoped = _chunkGBAMBUDNcjs.make_run_scoped.call(void 0, {
|
|
3054
3054
|
// Getters, not a spread: the singletons resolve lazily, so a later
|
|
3055
3055
|
// `store(...)` / `cache(...)` still takes effect.
|
|
3056
3056
|
get store() {
|
|
@@ -3060,14 +3060,14 @@ var Act = (_class7 = class {
|
|
|
3060
3060
|
return ports.cache;
|
|
3061
3061
|
},
|
|
3062
3062
|
// Parsed per build, so a bad window throws on every build.
|
|
3063
|
-
autoclose_window:
|
|
3063
|
+
autoclose_window: _chunkGBAMBUDNcjs.resolveAutocloseConfig.call(void 0, options).autocloseWindow
|
|
3064
3064
|
});
|
|
3065
3065
|
this._correlator = _nullishCoalesce(options.correlator, () => ( default_correlator));
|
|
3066
3066
|
this._es = build_es(this._logger, this._correlator, patch_fn);
|
|
3067
3067
|
this._cd = build_drain(this._logger);
|
|
3068
3068
|
const handle = build_handle({
|
|
3069
3069
|
logger: this._logger,
|
|
3070
|
-
reaction_scope:
|
|
3070
|
+
reaction_scope: _chunkGBAMBUDNcjs.make_reaction_scope.call(void 0, {
|
|
3071
3071
|
do: this.do.bind(this),
|
|
3072
3072
|
load: this.load.bind(this),
|
|
3073
3073
|
query: this.query.bind(this),
|
|
@@ -3097,12 +3097,12 @@ var Act = (_class7 = class {
|
|
|
3097
3097
|
this._ports.store,
|
|
3098
3098
|
options.listen !== false
|
|
3099
3099
|
);
|
|
3100
|
-
|
|
3100
|
+
_chunkGBAMBUDNcjs.register_weak_disposer.call(void 0, new WeakRef(this), (self) => self.shutdown());
|
|
3101
3101
|
}
|
|
3102
3102
|
/** Shared by drain, settle and autoclose; bad knobs throw at build. */
|
|
3103
3103
|
_build_breaker(options) {
|
|
3104
3104
|
return new CircuitBreaker(
|
|
3105
|
-
|
|
3105
|
+
_chunkGBAMBUDNcjs.resolveCircuitBreakerConfig.call(void 0, options.circuitBreaker),
|
|
3106
3106
|
{
|
|
3107
3107
|
on_error: (error, circuit) => this._emit_error(error, circuit),
|
|
3108
3108
|
// When the cooldown elapses, settle once: its scan or claim is the
|
|
@@ -3171,7 +3171,7 @@ var Act = (_class7 = class {
|
|
|
3171
3171
|
/** Audit deps, built after the controllers so the lane set is final. */
|
|
3172
3172
|
_build_audit_deps() {
|
|
3173
3173
|
return {
|
|
3174
|
-
store:
|
|
3174
|
+
store: _chunkGBAMBUDNcjs.store,
|
|
3175
3175
|
event_to_state: this._event_to_state,
|
|
3176
3176
|
// Declared lanes, not this process's controllers: a lane another
|
|
3177
3177
|
// worker drains is not `unknown-lane`.
|
|
@@ -3200,7 +3200,7 @@ var Act = (_class7 = class {
|
|
|
3200
3200
|
/** Cold start: an idle deferred stream still fires on time after a restart. */
|
|
3201
3201
|
async _seed_persisted_defers() {
|
|
3202
3202
|
const now = Date.now();
|
|
3203
|
-
await walk_streams(
|
|
3203
|
+
await walk_streams(_chunkGBAMBUDNcjs.store.call(void 0, ), (pos) => {
|
|
3204
3204
|
if (pos.deferred_at === void 0 || pos.deferred_at <= now) return;
|
|
3205
3205
|
const controller = this._drain_controllers.get(_nullishCoalesce(pos.lane, () => ( "default")));
|
|
3206
3206
|
_optionalChain([controller, 'optionalAccess', _124 => _124.seed_defer, 'call', _125 => _125(pos.stream, pos.deferred_at)]);
|
|
@@ -3239,7 +3239,7 @@ var Act = (_class7 = class {
|
|
|
3239
3239
|
*/
|
|
3240
3240
|
shutdown(options) {
|
|
3241
3241
|
if (!this._shutdown_promise) {
|
|
3242
|
-
|
|
3242
|
+
_chunkGBAMBUDNcjs.resolveShutdownConfig.call(void 0, options);
|
|
3243
3243
|
this._shutdown_promise = (async () => {
|
|
3244
3244
|
this.stop_correlations();
|
|
3245
3245
|
this._settle.stop(true);
|
|
@@ -3259,10 +3259,10 @@ var Act = (_class7 = class {
|
|
|
3259
3259
|
* default for none or 0, and for a running settle), capped.
|
|
3260
3260
|
*/
|
|
3261
3261
|
_derive_grace_ms(running, settling) {
|
|
3262
|
-
let max = settling ?
|
|
3262
|
+
let max = settling ? _chunkGBAMBUDNcjs.DEFAULT_LEASE_MILLIS : 0;
|
|
3263
3263
|
for (const c of running)
|
|
3264
|
-
max = Math.max(max, c.lease_millis ||
|
|
3265
|
-
return Math.min(max,
|
|
3264
|
+
max = Math.max(max, c.lease_millis || _chunkGBAMBUDNcjs.DEFAULT_LEASE_MILLIS);
|
|
3265
|
+
return Math.min(max, _chunkGBAMBUDNcjs.MAX_SHUTDOWN_GRACE_MS);
|
|
3266
3266
|
}
|
|
3267
3267
|
async _await_inflight(grace_ms) {
|
|
3268
3268
|
const running = [...this._drain_controllers.values()].filter(
|
|
@@ -3343,7 +3343,7 @@ var Act = (_class7 = class {
|
|
|
3343
3343
|
* @see {@link ValidationError}, {@link InvariantError}, {@link ConcurrencyError}
|
|
3344
3344
|
*/
|
|
3345
3345
|
async do(action2, target, payload, options) {
|
|
3346
|
-
const reacting_to = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _127 => _127.reactingTo]), () => (
|
|
3346
|
+
const reacting_to = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _127 => _127.reactingTo]), () => ( _chunkGBAMBUDNcjs.current_reacting.call(void 0, )));
|
|
3347
3347
|
const do_options = reacting_to === _optionalChain([options, 'optionalAccess', _128 => _128.reactingTo]) ? options : { ...options, reactingTo: reacting_to };
|
|
3348
3348
|
return this._scoped(async () => {
|
|
3349
3349
|
const snapshots = await this._es.action(
|
|
@@ -3404,7 +3404,7 @@ var Act = (_class7 = class {
|
|
|
3404
3404
|
return this._scoped(async () => {
|
|
3405
3405
|
let first;
|
|
3406
3406
|
let last;
|
|
3407
|
-
const count = await
|
|
3407
|
+
const count = await _chunkGBAMBUDNcjs.store.call(void 0, ).query((e) => {
|
|
3408
3408
|
const gated = this.registry.query_gate(e.name)(e);
|
|
3409
3409
|
if (!first) first = gated;
|
|
3410
3410
|
last = gated;
|
|
@@ -3434,7 +3434,7 @@ var Act = (_class7 = class {
|
|
|
3434
3434
|
async query_array(query) {
|
|
3435
3435
|
return this._scoped(async () => {
|
|
3436
3436
|
const events = [];
|
|
3437
|
-
await
|
|
3437
|
+
await _chunkGBAMBUDNcjs.store.call(void 0, ).query((e) => {
|
|
3438
3438
|
events.push(this.registry.query_gate(e.name)(e));
|
|
3439
3439
|
}, query);
|
|
3440
3440
|
return events;
|
|
@@ -3454,14 +3454,14 @@ var Act = (_class7 = class {
|
|
|
3454
3454
|
*/
|
|
3455
3455
|
async forget(stream) {
|
|
3456
3456
|
return this._scoped(async () => {
|
|
3457
|
-
const s =
|
|
3457
|
+
const s = _chunkGBAMBUDNcjs.store.call(void 0, );
|
|
3458
3458
|
if (!s.forget_pii) {
|
|
3459
3459
|
throw new Error(
|
|
3460
3460
|
`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).`
|
|
3461
3461
|
);
|
|
3462
3462
|
}
|
|
3463
3463
|
const eventCount = await s.forget_pii(stream);
|
|
3464
|
-
await
|
|
3464
|
+
await _chunkGBAMBUDNcjs.cache.call(void 0, ).invalidate(stream);
|
|
3465
3465
|
if (eventCount > 0) {
|
|
3466
3466
|
this.emit("forgotten", { stream, at: /* @__PURE__ */ new Date(), eventCount });
|
|
3467
3467
|
}
|
|
@@ -3495,7 +3495,7 @@ var Act = (_class7 = class {
|
|
|
3495
3495
|
* @see {@link correlate} for dynamic stream discovery
|
|
3496
3496
|
*/
|
|
3497
3497
|
async drain(options = {}) {
|
|
3498
|
-
|
|
3498
|
+
_chunkGBAMBUDNcjs.resolveDrainConfig.call(void 0, options);
|
|
3499
3499
|
if (!this._drain)
|
|
3500
3500
|
return { fetched: [], leased: [], acked: [], blocked: [] };
|
|
3501
3501
|
return this._scoped(() => this._drain_all(options));
|
|
@@ -3561,8 +3561,9 @@ var Act = (_class7 = class {
|
|
|
3561
3561
|
* the event), and marks their work so the next drain can claim it.
|
|
3562
3562
|
*
|
|
3563
3563
|
* @param query - Only `limit` is used: the most events the pass reads
|
|
3564
|
-
* (
|
|
3565
|
-
* which every reaction shares, so
|
|
3564
|
+
* (10 when the query has none; `0` reads everything). The scan always
|
|
3565
|
+
* starts at the correlation checkpoint, which every reaction shares, so
|
|
3566
|
+
* filters and `after` are ignored.
|
|
3566
3567
|
* @returns The number of newly subscribed streams and the last scanned event id
|
|
3567
3568
|
*
|
|
3568
3569
|
* @example Manual correlation
|
|
@@ -3572,8 +3573,8 @@ var Act = (_class7 = class {
|
|
|
3572
3573
|
*
|
|
3573
3574
|
* @see {@link start_correlations} for automatic periodic correlation
|
|
3574
3575
|
*/
|
|
3575
|
-
async correlate(query = {
|
|
3576
|
-
const pass = await this._correlate_pass(query);
|
|
3576
|
+
async correlate(query = {}) {
|
|
3577
|
+
const pass = await this._correlate_pass({ limit: _nullishCoalesce(query.limit, () => ( 10)) });
|
|
3577
3578
|
return {
|
|
3578
3579
|
subscribed: pass.kind === "scanned" ? pass.subscribed : 0,
|
|
3579
3580
|
last_id: pass.last_id
|
|
@@ -3675,7 +3676,7 @@ var Act = (_class7 = class {
|
|
|
3675
3676
|
*/
|
|
3676
3677
|
async reset(input) {
|
|
3677
3678
|
return this._scoped(async () => {
|
|
3678
|
-
const count = await
|
|
3679
|
+
const count = await _chunkGBAMBUDNcjs.store.call(void 0, ).reset(input);
|
|
3679
3680
|
for (const handler of this._batch_handlers.values())
|
|
3680
3681
|
_optionalChain([handler, 'access', _135 => _135[FOLD_RESET], 'optionalCall', _136 => _136()]);
|
|
3681
3682
|
if (count > 0) {
|
|
@@ -3711,7 +3712,7 @@ var Act = (_class7 = class {
|
|
|
3711
3712
|
*/
|
|
3712
3713
|
async unblock(input) {
|
|
3713
3714
|
return this._scoped(async () => {
|
|
3714
|
-
const count = await
|
|
3715
|
+
const count = await _chunkGBAMBUDNcjs.store.call(void 0, ).unblock(input);
|
|
3715
3716
|
if (count > 0) {
|
|
3716
3717
|
this._wake();
|
|
3717
3718
|
}
|
|
@@ -3766,7 +3767,7 @@ var Act = (_class7 = class {
|
|
|
3766
3767
|
return { ...partial, duration_ms: Date.now() - started };
|
|
3767
3768
|
}
|
|
3768
3769
|
const target = _nullishCoalesce(sink, () => ( (() => {
|
|
3769
|
-
const s =
|
|
3770
|
+
const s = _chunkGBAMBUDNcjs.store.call(void 0, );
|
|
3770
3771
|
if (!s.restore) throw new Error("adapter has no restore capability");
|
|
3771
3772
|
return s;
|
|
3772
3773
|
})()));
|
|
@@ -3812,7 +3813,7 @@ var Act = (_class7 = class {
|
|
|
3812
3813
|
async blocked_streams(options) {
|
|
3813
3814
|
return this._scoped(async () => {
|
|
3814
3815
|
const positions = [];
|
|
3815
|
-
await
|
|
3816
|
+
await _chunkGBAMBUDNcjs.store.call(void 0, ).query_streams(
|
|
3816
3817
|
(p) => {
|
|
3817
3818
|
positions.push(p);
|
|
3818
3819
|
},
|
|
@@ -3864,7 +3865,7 @@ var Act = (_class7 = class {
|
|
|
3864
3865
|
* @see {@link Store.prioritize} for the underlying primitive
|
|
3865
3866
|
*/
|
|
3866
3867
|
async prioritize(filter, priority) {
|
|
3867
|
-
return this._scoped(() =>
|
|
3868
|
+
return this._scoped(() => _chunkGBAMBUDNcjs.store.call(void 0, ).prioritize(filter, priority));
|
|
3868
3869
|
}
|
|
3869
3870
|
/** Shared by `close()` and reaction-requested closes. */
|
|
3870
3871
|
async _run_close(targets) {
|
|
@@ -3944,7 +3945,7 @@ var Act = (_class7 = class {
|
|
|
3944
3945
|
* @see {@link correlate} for manual correlation
|
|
3945
3946
|
*/
|
|
3946
3947
|
settle(options) {
|
|
3947
|
-
|
|
3948
|
+
_chunkGBAMBUDNcjs.resolveSettleConfig.call(void 0, _nullishCoalesce(options, () => ( {})));
|
|
3948
3949
|
this._schedule(options);
|
|
3949
3950
|
}
|
|
3950
3951
|
}, _class7);
|
|
@@ -4100,13 +4101,13 @@ function synthesize_autoclose_reactions(registry, states, read_window) {
|
|
|
4100
4101
|
}),
|
|
4101
4102
|
// Never block on autoclose: a transient query/store error should retry,
|
|
4102
4103
|
// not quarantine the synthetic stream.
|
|
4103
|
-
options: { blockOnError: false, maxRetries:
|
|
4104
|
+
options: { blockOnError: false, maxRetries: _chunkGBAMBUDNcjs.DEFAULT_MAX_RETRIES },
|
|
4104
4105
|
handler: async (event) => {
|
|
4105
4106
|
const aggregate = event.stream;
|
|
4106
4107
|
const window = read_window();
|
|
4107
4108
|
if (!in_autoclose_window(window, /* @__PURE__ */ new Date()))
|
|
4108
4109
|
throw new (0, _chunkRF5MV72Kcjs.DeferSignal)({ at: next_window_open(window, /* @__PURE__ */ new Date()) });
|
|
4109
|
-
const stats = await
|
|
4110
|
+
const stats = await _chunkGBAMBUDNcjs.store.call(void 0, ).query_stats([aggregate], {
|
|
4110
4111
|
count: true,
|
|
4111
4112
|
tail: keep_days !== void 0 ? true : void 0,
|
|
4112
4113
|
exclude: [_chunkRF5MV72Kcjs.TOMBSTONE_EVENT, _chunkRF5MV72Kcjs.SNAP_EVENT]
|
|
@@ -4230,7 +4231,7 @@ function autoclose_of(existing, state2) {
|
|
|
4230
4231
|
}
|
|
4231
4232
|
function merge_into_existing(state2, existing, states, actions, events) {
|
|
4232
4233
|
for (const name of Object.keys(state2.actions)) {
|
|
4233
|
-
if (existing.
|
|
4234
|
+
if (existing.on[name] === state2.on[name]) continue;
|
|
4234
4235
|
if (actions[name]) throw new Error(`Duplicate action "${name}"`);
|
|
4235
4236
|
}
|
|
4236
4237
|
for (const name of Object.keys(state2.events)) {
|
|
@@ -4345,7 +4346,7 @@ var _this_ = ({ stream }) => ({
|
|
|
4345
4346
|
|
|
4346
4347
|
// src/builders/builder-utils.ts
|
|
4347
4348
|
function register_lane(config2, lanes) {
|
|
4348
|
-
|
|
4349
|
+
_chunkGBAMBUDNcjs.resolveLaneConfig.call(void 0, config2);
|
|
4349
4350
|
if (config2.name === _chunkRF5MV72Kcjs.DEFAULT_LANE)
|
|
4350
4351
|
throw new Error(`Lane "${_chunkRF5MV72Kcjs.DEFAULT_LANE}" is reserved`);
|
|
4351
4352
|
const existing = lanes.find((l) => l.name === config2.name);
|
|
@@ -4389,9 +4390,9 @@ function reaction_on(event, events, builder) {
|
|
|
4389
4390
|
// Validate the whole bag at the declaration site so a bad
|
|
4390
4391
|
// `maxRetries`/`backoff`/`blockOnError` throws ZodError at build,
|
|
4391
4392
|
// not a NaN gate on the first retry.
|
|
4392
|
-
options:
|
|
4393
|
-
blockOnError: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _151 => _151.blockOnError]), () => (
|
|
4394
|
-
maxRetries: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _152 => _152.maxRetries]), () => (
|
|
4393
|
+
options: _chunkGBAMBUDNcjs.resolveReactionConfig.call(void 0, {
|
|
4394
|
+
blockOnError: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _151 => _151.blockOnError]), () => ( _chunkGBAMBUDNcjs.DEFAULT_BLOCK_ON_ERROR)),
|
|
4395
|
+
maxRetries: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _152 => _152.maxRetries]), () => ( _chunkGBAMBUDNcjs.DEFAULT_MAX_RETRIES)),
|
|
4395
4396
|
backoff: _optionalChain([options, 'optionalAccess', _153 => _153.backoff])
|
|
4396
4397
|
})
|
|
4397
4398
|
};
|
|
@@ -4693,7 +4694,7 @@ function act() {
|
|
|
4693
4694
|
const list = deprecation_summary.map(
|
|
4694
4695
|
(d) => `"${d.deprecated}" (current: "${d.current}", state: "${d.state_name}")`
|
|
4695
4696
|
).join(", ");
|
|
4696
|
-
|
|
4697
|
+
_chunkGBAMBUDNcjs.log.call(void 0, ).info(
|
|
4697
4698
|
`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.`
|
|
4698
4699
|
);
|
|
4699
4700
|
}
|
|
@@ -4735,7 +4736,7 @@ function act() {
|
|
|
4735
4736
|
return reaction_on(event, registry.events, builder);
|
|
4736
4737
|
},
|
|
4737
4738
|
build: (options) => {
|
|
4738
|
-
|
|
4739
|
+
_chunkGBAMBUDNcjs.resolveActConfig.call(void 0, options);
|
|
4739
4740
|
const patch_fn = _optionalChain([options, 'optionalAccess', _165 => _165.validateFoldedState]) === true ? validating_patch : bare_patch;
|
|
4740
4741
|
if (!_built) {
|
|
4741
4742
|
for (const proj of pending_projections) add_projection(proj);
|
|
@@ -4787,7 +4788,7 @@ function act() {
|
|
|
4787
4788
|
synthesize_autoclose_reactions(
|
|
4788
4789
|
registry,
|
|
4789
4790
|
states,
|
|
4790
|
-
|
|
4791
|
+
_chunkGBAMBUDNcjs.current_autoclose_window
|
|
4791
4792
|
);
|
|
4792
4793
|
Object.freeze(registry.actions);
|
|
4793
4794
|
Object.freeze(registry.events);
|
|
@@ -4836,8 +4837,8 @@ function _projection(target) {
|
|
|
4836
4837
|
handler,
|
|
4837
4838
|
resolver: _nullishCoalesce(default_resolver, () => ( _this_)),
|
|
4838
4839
|
options: {
|
|
4839
|
-
blockOnError:
|
|
4840
|
-
maxRetries:
|
|
4840
|
+
blockOnError: _chunkGBAMBUDNcjs.DEFAULT_BLOCK_ON_ERROR,
|
|
4841
|
+
maxRetries: _chunkGBAMBUDNcjs.DEFAULT_MAX_RETRIES
|
|
4841
4842
|
}
|
|
4842
4843
|
}),
|
|
4843
4844
|
widened
|
|
@@ -4878,7 +4879,7 @@ function _projection(target) {
|
|
|
4878
4879
|
throw new Error(
|
|
4879
4880
|
`Projection "${target}" .of() partials must share one state name \u2014 got "${name}" and "${partial.name}"`
|
|
4880
4881
|
);
|
|
4881
|
-
const config2 =
|
|
4882
|
+
const config2 = _chunkGBAMBUDNcjs.resolveFoldConfig.call(void 0, options);
|
|
4882
4883
|
const fold_events = {};
|
|
4883
4884
|
for (const partial of partials)
|
|
4884
4885
|
for (const [event_name, schema] of Object.entries(partial.events)) {
|
|
@@ -4896,8 +4897,8 @@ function _projection(target) {
|
|
|
4896
4897
|
handler: noop,
|
|
4897
4898
|
resolver: { target },
|
|
4898
4899
|
options: {
|
|
4899
|
-
blockOnError:
|
|
4900
|
-
maxRetries:
|
|
4900
|
+
blockOnError: _chunkGBAMBUDNcjs.DEFAULT_BLOCK_ON_ERROR,
|
|
4901
|
+
maxRetries: _chunkGBAMBUDNcjs.DEFAULT_MAX_RETRIES
|
|
4901
4902
|
}
|
|
4902
4903
|
}
|
|
4903
4904
|
]
|
|
@@ -5013,7 +5014,7 @@ function action_builder(state2) {
|
|
|
5013
5014
|
throw new Error(`Duplicate action "${action2}"`);
|
|
5014
5015
|
internal.actions[action2] = schema;
|
|
5015
5016
|
if (options) {
|
|
5016
|
-
|
|
5017
|
+
_chunkGBAMBUDNcjs.resolveActionConfig.call(void 0, options);
|
|
5017
5018
|
internal.options ??= {};
|
|
5018
5019
|
internal.options[action2] = options;
|
|
5019
5020
|
}
|
|
@@ -5307,5 +5308,5 @@ function write_line(writer, line) {
|
|
|
5307
5308
|
|
|
5308
5309
|
|
|
5309
5310
|
|
|
5310
|
-
exports.Act = Act; exports.ActorSchema = _chunkRF5MV72Kcjs.ActorSchema; exports.CausationEventSchema = _chunkRF5MV72Kcjs.CausationEventSchema; exports.CommittedMetaSchema = _chunkRF5MV72Kcjs.CommittedMetaSchema; exports.ConcurrencyError = _chunkRF5MV72Kcjs.ConcurrencyError; exports.ConsoleLogger =
|
|
5311
|
+
exports.Act = Act; exports.ActorSchema = _chunkRF5MV72Kcjs.ActorSchema; exports.CausationEventSchema = _chunkRF5MV72Kcjs.CausationEventSchema; exports.CommittedMetaSchema = _chunkRF5MV72Kcjs.CommittedMetaSchema; exports.ConcurrencyError = _chunkRF5MV72Kcjs.ConcurrencyError; exports.ConsoleLogger = _chunkGBAMBUDNcjs.ConsoleLogger; exports.CsvFile = CsvFile; exports.DEFAULT_LANE = _chunkRF5MV72Kcjs.DEFAULT_LANE; exports.DEFAULT_MAX_SUBSCRIBED_STREAMS = _chunkRF5MV72Kcjs.DEFAULT_MAX_SUBSCRIBED_STREAMS; exports.DEFAULT_SETTLE_DEBOUNCE_MS = _chunkRF5MV72Kcjs.DEFAULT_SETTLE_DEBOUNCE_MS; exports.DeferSignal = _chunkRF5MV72Kcjs.DeferSignal; exports.Environments = _chunkRF5MV72Kcjs.Environments; exports.Errors = _chunkRF5MV72Kcjs.Errors; exports.EventMetaSchema = _chunkRF5MV72Kcjs.EventMetaSchema; exports.ExitCodes = _chunkRF5MV72Kcjs.ExitCodes; exports.InMemoryCache = _chunkGBAMBUDNcjs.InMemoryCache; exports.InMemoryStore = _chunkGBAMBUDNcjs.InMemoryStore; exports.InvariantError = _chunkRF5MV72Kcjs.InvariantError; exports.LogLevels = _chunkRF5MV72Kcjs.LogLevels; exports.NonRetryableError = _chunkRF5MV72Kcjs.NonRetryableError; exports.PackageSchema = _chunkGBAMBUDNcjs.PackageSchema; exports.QuerySchema = _chunkRF5MV72Kcjs.QuerySchema; exports.REDACTED = _chunkRF5MV72Kcjs.REDACTED; exports.SHREDDED = _chunkRF5MV72Kcjs.SHREDDED; exports.SNAP_EVENT = _chunkRF5MV72Kcjs.SNAP_EVENT; exports.StoreError = _chunkRF5MV72Kcjs.StoreError; exports.StreamClosedError = _chunkRF5MV72Kcjs.StreamClosedError; exports.TOMBSTONE_EVENT = _chunkRF5MV72Kcjs.TOMBSTONE_EVENT; exports.TargetSchema = _chunkRF5MV72Kcjs.TargetSchema; exports.ValidationError = _chunkRF5MV72Kcjs.ValidationError; exports.ZodEmpty = _chunkRF5MV72Kcjs.ZodEmpty; exports.act = act; exports.cache = _chunkGBAMBUDNcjs.cache; exports.config = _chunkGBAMBUDNcjs.config; exports.dateReviver = _chunkGBAMBUDNcjs.dateReviver; exports.default_scope = _chunkGBAMBUDNcjs.default_scope; exports.dispose = _chunkGBAMBUDNcjs.dispose; exports.disposeAndExit = _chunkGBAMBUDNcjs.disposeAndExit; exports.extend = _chunkGBAMBUDNcjs.extend; exports.is_literal_source = _chunkGBAMBUDNcjs.is_literal_source; exports.log = _chunkGBAMBUDNcjs.log; exports.pii_fields = _chunkRF5MV72Kcjs.pii_fields; exports.port = _chunkGBAMBUDNcjs.port; exports.projection = projection; exports.resolveAutocloseConfig = _chunkGBAMBUDNcjs.resolveAutocloseConfig2; exports.sensitive = _chunkRF5MV72Kcjs.sensitive; exports.sleep = _chunkGBAMBUDNcjs.sleep; exports.slice = slice; exports.state = state; exports.store = _chunkGBAMBUDNcjs.store; exports.validate = _chunkGBAMBUDNcjs.validate;
|
|
5311
5312
|
//# sourceMappingURL=index.cjs.map
|