@rotorsoft/act 2.0.3 → 2.0.5
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.map +1 -1
- package/dist/@types/utils.d.ts +0 -14
- package/dist/@types/utils.d.ts.map +1 -1
- package/dist/{chunk-YAHM7P64.js → chunk-3JULRYQO.js} +1 -1
- package/dist/chunk-3JULRYQO.js.map +1 -0
- package/dist/{chunk-KGJQXN3S.cjs → chunk-XW4EAUS6.cjs} +1 -1
- package/dist/chunk-XW4EAUS6.cjs.map +1 -0
- package/dist/index.cjs +103 -104
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -6
- package/dist/index.js.map +1 -1
- package/dist/test/index.cjs +3 -3
- package/dist/test/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-KGJQXN3S.cjs.map +0 -1
- package/dist/chunk-YAHM7P64.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
|
|
51
|
-
var
|
|
51
|
+
var _chunkXW4EAUS6cjs = require('./chunk-XW4EAUS6.cjs');
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
|
|
@@ -85,20 +85,20 @@ var _chunkVD4BLAY4cjs = require('./chunk-VD4BLAY4.cjs');
|
|
|
85
85
|
|
|
86
86
|
// src/signals.ts
|
|
87
87
|
process.once("SIGINT", async (arg) => {
|
|
88
|
-
|
|
89
|
-
await
|
|
88
|
+
_chunkXW4EAUS6cjs.log.call(void 0, ).info(arg, "SIGINT");
|
|
89
|
+
await _chunkXW4EAUS6cjs.disposeAndExit.call(void 0, "EXIT");
|
|
90
90
|
});
|
|
91
91
|
process.once("SIGTERM", async (arg) => {
|
|
92
|
-
|
|
93
|
-
await
|
|
92
|
+
_chunkXW4EAUS6cjs.log.call(void 0, ).info(arg, "SIGTERM");
|
|
93
|
+
await _chunkXW4EAUS6cjs.disposeAndExit.call(void 0, "EXIT");
|
|
94
94
|
});
|
|
95
95
|
process.once("uncaughtException", async (arg) => {
|
|
96
|
-
|
|
97
|
-
await
|
|
96
|
+
_chunkXW4EAUS6cjs.log.call(void 0, ).error(arg, "Uncaught Exception");
|
|
97
|
+
await _chunkXW4EAUS6cjs.disposeAndExit.call(void 0, "ERROR");
|
|
98
98
|
});
|
|
99
99
|
process.once("unhandledRejection", async (arg) => {
|
|
100
|
-
|
|
101
|
-
await
|
|
100
|
+
_chunkXW4EAUS6cjs.log.call(void 0, ).error(arg, "Unhandled Rejection");
|
|
101
|
+
await _chunkXW4EAUS6cjs.disposeAndExit.call(void 0, "ERROR");
|
|
102
102
|
});
|
|
103
103
|
|
|
104
104
|
// src/act.ts
|
|
@@ -1097,7 +1097,7 @@ function compute_lag_lead_ratio(handled, lagging, leading) {
|
|
|
1097
1097
|
function report_once(seen, key, message) {
|
|
1098
1098
|
if (seen.has(key)) return;
|
|
1099
1099
|
seen.add(key);
|
|
1100
|
-
|
|
1100
|
+
_chunkXW4EAUS6cjs.log.call(void 0, ).error(new Error(message));
|
|
1101
1101
|
}
|
|
1102
1102
|
|
|
1103
1103
|
// src/internal/correlation-id.ts
|
|
@@ -1125,14 +1125,14 @@ function close_correlation(correlator, actor) {
|
|
|
1125
1125
|
}
|
|
1126
1126
|
|
|
1127
1127
|
// src/internal/drain-ops.ts
|
|
1128
|
-
var claim = (lagging, leading, by, millis, lane) =>
|
|
1128
|
+
var claim = (lagging, leading, by, millis, lane) => _chunkXW4EAUS6cjs.store.call(void 0, ).claim(lagging, leading, by, millis, lane);
|
|
1129
1129
|
async function fetch(leased, eventLimit) {
|
|
1130
1130
|
return Promise.all(
|
|
1131
1131
|
leased.map(async ({ stream, source, at, lagging }) => {
|
|
1132
1132
|
const events = [];
|
|
1133
|
-
const stream_exact = source !== void 0 &&
|
|
1133
|
+
const stream_exact = source !== void 0 && _chunkXW4EAUS6cjs.is_literal_source.call(void 0, source, stream) ? true : void 0;
|
|
1134
1134
|
try {
|
|
1135
|
-
await
|
|
1135
|
+
await _chunkXW4EAUS6cjs.store.call(void 0, ).query((e) => events.push(e), {
|
|
1136
1136
|
stream: source,
|
|
1137
1137
|
stream_exact,
|
|
1138
1138
|
after: at,
|
|
@@ -1152,9 +1152,9 @@ async function fetch(leased, eventLimit) {
|
|
|
1152
1152
|
})
|
|
1153
1153
|
);
|
|
1154
1154
|
}
|
|
1155
|
-
var ack = (leases) =>
|
|
1156
|
-
var block = (leases) =>
|
|
1157
|
-
var subscribe = (streams, correlated_at, correlator) =>
|
|
1155
|
+
var ack = (leases) => _chunkXW4EAUS6cjs.store.call(void 0, ).ack(leases);
|
|
1156
|
+
var block = (leases) => _chunkXW4EAUS6cjs.store.call(void 0, ).block(leases);
|
|
1157
|
+
var subscribe = (streams, correlated_at, correlator) => _chunkXW4EAUS6cjs.store.call(void 0, ).subscribe(streams, correlated_at, correlator);
|
|
1158
1158
|
|
|
1159
1159
|
// src/internal/event-sourcing.ts
|
|
1160
1160
|
var _actpatch = require('@rotorsoft/act-patch');
|
|
@@ -1184,14 +1184,14 @@ var check_invariants = (target, state2, schema, pii_aware) => {
|
|
|
1184
1184
|
);
|
|
1185
1185
|
};
|
|
1186
1186
|
var DEFAULT_BATCH = 500;
|
|
1187
|
-
var cache_put = (stream, entry) =>
|
|
1188
|
-
(err) =>
|
|
1187
|
+
var cache_put = (stream, entry) => _chunkXW4EAUS6cjs.cache.call(void 0, ).set(stream, entry).catch(
|
|
1188
|
+
(err) => _chunkXW4EAUS6cjs.log.call(void 0, ).warn(
|
|
1189
1189
|
err,
|
|
1190
1190
|
"cache set skipped; the next load re-folds from the store"
|
|
1191
1191
|
)
|
|
1192
1192
|
);
|
|
1193
|
-
var cache_drop = (stream) =>
|
|
1194
|
-
(err) =>
|
|
1193
|
+
var cache_drop = (stream) => _chunkXW4EAUS6cjs.cache.call(void 0, ).invalidate(stream).catch(
|
|
1194
|
+
(err) => _chunkXW4EAUS6cjs.log.call(void 0, ).warn(
|
|
1195
1195
|
err,
|
|
1196
1196
|
"cache invalidate skipped; a stale checkpoint re-folds from its event_id"
|
|
1197
1197
|
)
|
|
@@ -1199,7 +1199,7 @@ var cache_drop = (stream) => _chunkKGJQXN3Scjs.cache.call(void 0, ).invalidate(s
|
|
|
1199
1199
|
async function snap(snapshot) {
|
|
1200
1200
|
const { id, stream, name, meta, version } = snapshot.event;
|
|
1201
1201
|
try {
|
|
1202
|
-
const [committed] = await
|
|
1202
|
+
const [committed] = await _chunkXW4EAUS6cjs.store.call(void 0, ).commit(
|
|
1203
1203
|
[
|
|
1204
1204
|
{
|
|
1205
1205
|
stream,
|
|
@@ -1216,14 +1216,14 @@ async function snap(snapshot) {
|
|
|
1216
1216
|
return committed;
|
|
1217
1217
|
} catch (error) {
|
|
1218
1218
|
const reason = error instanceof Error ? error.message : String(error);
|
|
1219
|
-
|
|
1219
|
+
_chunkXW4EAUS6cjs.log.call(void 0, ).warn(
|
|
1220
1220
|
`Snapshot write failed on stream "${stream}": ${reason} \u2014 cold starts will replay full history until snapshots succeed.`
|
|
1221
1221
|
);
|
|
1222
1222
|
}
|
|
1223
1223
|
}
|
|
1224
1224
|
async function tombstone(stream, expectedVersion, correlation) {
|
|
1225
1225
|
try {
|
|
1226
|
-
const [committed] = await
|
|
1226
|
+
const [committed] = await _chunkXW4EAUS6cjs.store.call(void 0, ).commit(
|
|
1227
1227
|
[
|
|
1228
1228
|
{
|
|
1229
1229
|
stream,
|
|
@@ -1361,14 +1361,14 @@ async function load(me, target, callback, patch_fn = bare_patch) {
|
|
|
1361
1361
|
const { stream, actor, asOf } = target;
|
|
1362
1362
|
const time_travel = !!asOf && Object.values(asOf).some((v) => v !== void 0);
|
|
1363
1363
|
const seeded = time_travel && asOf.limit === void 0 && !asOf.created_after;
|
|
1364
|
-
const cached = time_travel ? void 0 : await
|
|
1364
|
+
const cached = time_travel ? void 0 : await _chunkXW4EAUS6cjs.cache.call(void 0, ).get(stream);
|
|
1365
1365
|
const cache_hit = !!cached;
|
|
1366
1366
|
let state2 = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _56 => _56.state]), () => ( (me.init ? me.init() : {})));
|
|
1367
1367
|
let patches = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _57 => _57.patches]), () => ( 0));
|
|
1368
1368
|
let snaps = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _58 => _58.snaps]), () => ( 0));
|
|
1369
1369
|
let replayed = 0;
|
|
1370
1370
|
let event;
|
|
1371
|
-
await
|
|
1371
|
+
await _chunkXW4EAUS6cjs.store.call(void 0, ).query(
|
|
1372
1372
|
(raw) => {
|
|
1373
1373
|
if (seeded && raw.name === _chunkVD4BLAY4cjs.SNAP_EVENT && replayed > 0) return;
|
|
1374
1374
|
event = me.view(raw, actor);
|
|
@@ -1382,7 +1382,7 @@ async function load(me, target, callback, patch_fn = bare_patch) {
|
|
|
1382
1382
|
patches++;
|
|
1383
1383
|
replayed++;
|
|
1384
1384
|
} else if (event.name !== _chunkVD4BLAY4cjs.TOMBSTONE_EVENT) {
|
|
1385
|
-
|
|
1385
|
+
_chunkXW4EAUS6cjs.log.call(void 0, ).warn(
|
|
1386
1386
|
`Skipping unknown event "${String(event.name)}" on stream "${stream}" (id=${event.id}) \u2014 no reducer in state "${me.name}"`
|
|
1387
1387
|
);
|
|
1388
1388
|
}
|
|
@@ -1470,7 +1470,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1470
1470
|
if (!stream) throw new Error("Missing target stream");
|
|
1471
1471
|
const reactingTo = _optionalChain([options, 'optionalAccess', _67 => _67.reactingTo]);
|
|
1472
1472
|
const correlator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _68 => _68.correlator]), () => ( default_correlator));
|
|
1473
|
-
const validated =
|
|
1473
|
+
const validated = _chunkXW4EAUS6cjs.validate.call(void 0, action2, payload, me.actions[action2]);
|
|
1474
1474
|
const opts = _optionalChain([me, 'access', _69 => _69.options, 'optionalAccess', _70 => _70[action2]]);
|
|
1475
1475
|
const max_retries = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _71 => _71.maxRetries]), () => ( 0));
|
|
1476
1476
|
const loads = _nullishCoalesce(_optionalChain([me, 'access', _72 => _72.loads, 'optionalAccess', _73 => _73[action2]]), () => ( []));
|
|
@@ -1532,7 +1532,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1532
1532
|
);
|
|
1533
1533
|
to.events.push({
|
|
1534
1534
|
name: event,
|
|
1535
|
-
data:
|
|
1535
|
+
data: _chunkXW4EAUS6cjs.validate.call(void 0, event, data, to.state.events[event])
|
|
1536
1536
|
});
|
|
1537
1537
|
}
|
|
1538
1538
|
if (!own.events.length)
|
|
@@ -1589,7 +1589,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1589
1589
|
});
|
|
1590
1590
|
let committed;
|
|
1591
1591
|
try {
|
|
1592
|
-
committed = await
|
|
1592
|
+
committed = await _chunkXW4EAUS6cjs.store.call(void 0, ).commit(
|
|
1593
1593
|
appends.map((p) => ({
|
|
1594
1594
|
stream: p.stream,
|
|
1595
1595
|
msgs: p.events.map((e) => p.state.message(e)),
|
|
@@ -1645,14 +1645,14 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1645
1645
|
if (attempt >= max_retries) throw error;
|
|
1646
1646
|
if (_optionalChain([opts, 'optionalAccess', _88 => _88.backoff])) {
|
|
1647
1647
|
const delay_ms = compute_backoff_delay(attempt, opts.backoff);
|
|
1648
|
-
if (delay_ms > 0) await
|
|
1648
|
+
if (delay_ms > 0) await _chunkXW4EAUS6cjs.sleep.call(void 0, delay_ms);
|
|
1649
1649
|
}
|
|
1650
1650
|
}
|
|
1651
1651
|
}
|
|
1652
1652
|
}
|
|
1653
1653
|
|
|
1654
1654
|
// src/internal/tracing.ts
|
|
1655
|
-
var PRETTY =
|
|
1655
|
+
var PRETTY = _chunkXW4EAUS6cjs.config.call(void 0, ).env !== "production";
|
|
1656
1656
|
var C_BLUE = "\x1B[38;5;39m";
|
|
1657
1657
|
var C_ORANGE = "\x1B[38;5;208m";
|
|
1658
1658
|
var C_GREEN = "\x1B[38;5;42m";
|
|
@@ -1836,7 +1836,7 @@ function budget_exhausted(lease, options, store_failing) {
|
|
|
1836
1836
|
if (store_failing || !_optionalChain([options, 'optionalAccess', _99 => _99.blockOnError]) || lease.retry <= options.maxRetries)
|
|
1837
1837
|
return void 0;
|
|
1838
1838
|
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.`;
|
|
1839
|
-
|
|
1839
|
+
_chunkXW4EAUS6cjs.log.call(void 0, ).error(error);
|
|
1840
1840
|
return { lease, handled: 0, acked_at: lease.at, error, block: true };
|
|
1841
1841
|
}
|
|
1842
1842
|
function fetch_failure_policy(registry) {
|
|
@@ -1858,7 +1858,7 @@ function finalize(lease, handled, at, error, options, logger, failed_at) {
|
|
|
1858
1858
|
logger.error(
|
|
1859
1859
|
non_retryable ? `Blocking ${lease.stream} on non-retryable error.` : `Blocking ${lease.stream} after ${lease.retry} retries.`
|
|
1860
1860
|
);
|
|
1861
|
-
const next_attempt_at = block2 ? void 0 : Date.now() + compute_backoff_delay(lease.retry, _nullishCoalesce(options.backoff, () => (
|
|
1861
|
+
const next_attempt_at = block2 ? void 0 : Date.now() + compute_backoff_delay(lease.retry, _nullishCoalesce(options.backoff, () => ( _chunkXW4EAUS6cjs.DEFAULT_BACKOFF)));
|
|
1862
1862
|
return {
|
|
1863
1863
|
lease,
|
|
1864
1864
|
handled,
|
|
@@ -1986,7 +1986,7 @@ async function run_drain_cycle(deps, cycle) {
|
|
|
1986
1986
|
const acked = submitted.length ? await ops.ack(submitted) : [];
|
|
1987
1987
|
const expected = submitted.filter((l) => l.due === void 0).length;
|
|
1988
1988
|
if (acked.length < expected)
|
|
1989
|
-
|
|
1989
|
+
_chunkXW4EAUS6cjs.log.call(void 0, ).warn(
|
|
1990
1990
|
`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.`
|
|
1991
1991
|
);
|
|
1992
1992
|
const closeable = handled.filter((h) => h.close !== void 0).map((h) => h.close);
|
|
@@ -2082,9 +2082,9 @@ var DrainController = (_class3 = class {
|
|
|
2082
2082
|
if (!this.armed || this._stopped || this._inflight)
|
|
2083
2083
|
return EMPTY_DRAIN;
|
|
2084
2084
|
const d = _nullishCoalesce(this._deps.defaults, () => ( {}));
|
|
2085
|
-
const streamLimit = _nullishCoalesce(_nullishCoalesce(d.streamLimit, () => ( options.streamLimit)), () => (
|
|
2086
|
-
const eventLimit = _nullishCoalesce(options.eventLimit, () => (
|
|
2087
|
-
const leaseMillis = _nullishCoalesce(_nullishCoalesce(d.leaseMillis, () => ( options.leaseMillis)), () => (
|
|
2085
|
+
const streamLimit = _nullishCoalesce(_nullishCoalesce(d.streamLimit, () => ( options.streamLimit)), () => ( _chunkXW4EAUS6cjs.DEFAULT_STREAM_LIMIT));
|
|
2086
|
+
const eventLimit = _nullishCoalesce(options.eventLimit, () => ( _chunkXW4EAUS6cjs.DEFAULT_EVENT_LIMIT));
|
|
2087
|
+
const leaseMillis = _nullishCoalesce(_nullishCoalesce(d.leaseMillis, () => ( options.leaseMillis)), () => ( _chunkXW4EAUS6cjs.DEFAULT_LEASE_MILLIS));
|
|
2088
2088
|
if (this._deps.breaker.state(Date.now()) === "open")
|
|
2089
2089
|
return EMPTY_DRAIN;
|
|
2090
2090
|
const pass = this._pass(streamLimit, eventLimit, leaseMillis).finally(
|
|
@@ -2307,19 +2307,19 @@ function synthesize_autoclose_reactions(registry, states, read_window) {
|
|
|
2307
2307
|
// An anchored stream name would read as a pattern, and a store may refuse
|
|
2308
2308
|
// it at subscribe, stopping every reaction. Such a stream has no
|
|
2309
2309
|
// autoclose: `app.close` still closes it.
|
|
2310
|
-
resolver: (e) =>
|
|
2310
|
+
resolver: (e) => _chunkXW4EAUS6cjs.is_literal_source.call(void 0, e.stream) ? {
|
|
2311
2311
|
target: `${AUTOCLOSE_TARGET_PREFIX}${e.stream}`,
|
|
2312
2312
|
source: e.stream
|
|
2313
2313
|
} : void 0,
|
|
2314
2314
|
// Never block on autoclose: a transient query/store error should retry,
|
|
2315
2315
|
// not quarantine the synthetic stream.
|
|
2316
|
-
options: { blockOnError: false, maxRetries:
|
|
2316
|
+
options: { blockOnError: false, maxRetries: _chunkXW4EAUS6cjs.DEFAULT_MAX_RETRIES },
|
|
2317
2317
|
handler: async (event) => {
|
|
2318
2318
|
const aggregate = event.stream;
|
|
2319
2319
|
const window = read_window();
|
|
2320
2320
|
if (!in_autoclose_window(window, /* @__PURE__ */ new Date()))
|
|
2321
2321
|
throw new (0, _chunkVD4BLAY4cjs.DeferSignal)({ at: next_window_open(window, /* @__PURE__ */ new Date()) });
|
|
2322
|
-
const stats = await
|
|
2322
|
+
const stats = await _chunkXW4EAUS6cjs.store.call(void 0, ).query_stats([aggregate], {
|
|
2323
2323
|
count: true,
|
|
2324
2324
|
tail: keep_days !== void 0 ? true : void 0,
|
|
2325
2325
|
exclude: [_chunkVD4BLAY4cjs.TOMBSTONE_EVENT, _chunkVD4BLAY4cjs.SNAP_EVENT]
|
|
@@ -2500,7 +2500,7 @@ async function run_windowed_closes(windowed, deps, skipped) {
|
|
|
2500
2500
|
if (!await windowed_prune_pending(t.stream, t.before, max_id))
|
|
2501
2501
|
return void 0;
|
|
2502
2502
|
if (t.archive) await t.archive();
|
|
2503
|
-
const result = await
|
|
2503
|
+
const result = await _chunkXW4EAUS6cjs.store.call(void 0, ).truncate([
|
|
2504
2504
|
{ stream: t.stream, before: t.before, max_id }
|
|
2505
2505
|
]);
|
|
2506
2506
|
return result.get(t.stream);
|
|
@@ -2513,7 +2513,7 @@ async function run_windowed_closes(windowed, deps, skipped) {
|
|
|
2513
2513
|
async function windowed_prune_pending(stream, before, max_id) {
|
|
2514
2514
|
let boundary_id;
|
|
2515
2515
|
let min_id;
|
|
2516
|
-
await
|
|
2516
|
+
await _chunkXW4EAUS6cjs.store.call(void 0, ).query(
|
|
2517
2517
|
(event) => {
|
|
2518
2518
|
if (min_id === void 0 || event.id < min_id) min_id = event.id;
|
|
2519
2519
|
if (event.name === _chunkVD4BLAY4cjs.SNAP_EVENT && event.created < before && (max_id === void 0 || event.id <= max_id) && (boundary_id === void 0 || event.id > boundary_id))
|
|
@@ -2527,7 +2527,7 @@ async function probe_min_watermarks(streams, page_size, checkpoint) {
|
|
|
2527
2527
|
const min_at = /* @__PURE__ */ new Map();
|
|
2528
2528
|
const matches = source_matcher();
|
|
2529
2529
|
await walk_streams(
|
|
2530
|
-
|
|
2530
|
+
_chunkXW4EAUS6cjs.store.call(void 0, ),
|
|
2531
2531
|
(position) => {
|
|
2532
2532
|
const pending = position.correlated_at === void 0 || position.at < position.correlated_at;
|
|
2533
2533
|
const cap = pending ? position.at : Math.max(position.at, checkpoint);
|
|
@@ -2546,7 +2546,7 @@ function source_matcher() {
|
|
|
2546
2546
|
const compiled = /* @__PURE__ */ new Map();
|
|
2547
2547
|
return (source, target, stream) => {
|
|
2548
2548
|
if (!source) return true;
|
|
2549
|
-
if (
|
|
2549
|
+
if (_chunkXW4EAUS6cjs.is_literal_source.call(void 0, source, target)) return source === stream;
|
|
2550
2550
|
let re = compiled.get(source);
|
|
2551
2551
|
if (!re) {
|
|
2552
2552
|
re = new RegExp(source);
|
|
@@ -2556,13 +2556,13 @@ function source_matcher() {
|
|
|
2556
2556
|
};
|
|
2557
2557
|
}
|
|
2558
2558
|
async function scan_stream_heads(streams) {
|
|
2559
|
-
const stats = await
|
|
2559
|
+
const stats = await _chunkXW4EAUS6cjs.store.call(void 0, ).query_stats(streams, {
|
|
2560
2560
|
exclude: [_chunkVD4BLAY4cjs.SNAP_EVENT]
|
|
2561
2561
|
});
|
|
2562
|
-
const domain_heads = await
|
|
2562
|
+
const domain_heads = await _chunkXW4EAUS6cjs.store.call(void 0, ).query_stats(streams, {
|
|
2563
2563
|
exclude: [_chunkVD4BLAY4cjs.SNAP_EVENT, _chunkVD4BLAY4cjs.TOMBSTONE_EVENT]
|
|
2564
2564
|
});
|
|
2565
|
-
const true_heads = await
|
|
2565
|
+
const true_heads = await _chunkXW4EAUS6cjs.store.call(void 0, ).query_stats(streams, {});
|
|
2566
2566
|
const out = /* @__PURE__ */ new Map();
|
|
2567
2567
|
for (const [stream, { head }] of domain_heads) {
|
|
2568
2568
|
const marker_head = _optionalChain([stats, 'access', _129 => _129.get, 'call', _130 => _130(stream), 'optionalAccess', _131 => _131.head]);
|
|
@@ -2589,7 +2589,7 @@ async function partition_by_safety(stream_info, reactive, skipped, page_size, ca
|
|
|
2589
2589
|
const pending_set = /* @__PURE__ */ new Set();
|
|
2590
2590
|
const matches = source_matcher();
|
|
2591
2591
|
await walk_streams(
|
|
2592
|
-
|
|
2592
|
+
_chunkXW4EAUS6cjs.store.call(void 0, ),
|
|
2593
2593
|
(position) => {
|
|
2594
2594
|
const has_work = position.correlated_at !== void 0 && position.at < position.correlated_at;
|
|
2595
2595
|
if (!has_work) return;
|
|
@@ -2656,7 +2656,7 @@ async function run_archive_callbacks(guarded, target_map) {
|
|
|
2656
2656
|
}
|
|
2657
2657
|
}
|
|
2658
2658
|
async function heads_still_guarded(guarded, guard_events, skipped) {
|
|
2659
|
-
const heads = await
|
|
2659
|
+
const heads = await _chunkXW4EAUS6cjs.store.call(void 0, ).query_stats(guarded, {});
|
|
2660
2660
|
return guarded.filter((stream) => {
|
|
2661
2661
|
if (_optionalChain([heads, 'access', _139 => _139.get, 'call', _140 => _140(stream), 'optionalAccess', _141 => _141.head, 'access', _142 => _142.id]) === guard_events.get(stream).id)
|
|
2662
2662
|
return true;
|
|
@@ -2679,13 +2679,13 @@ async function truncate_and_warm_cache(guarded, seed_states, guard_events, corre
|
|
|
2679
2679
|
}
|
|
2680
2680
|
};
|
|
2681
2681
|
});
|
|
2682
|
-
const truncated = await
|
|
2682
|
+
const truncated = await _chunkXW4EAUS6cjs.store.call(void 0, ).truncate(trunc_targets);
|
|
2683
2683
|
await Promise.all(
|
|
2684
2684
|
guarded.map(async (stream) => {
|
|
2685
2685
|
const entry = truncated.get(stream);
|
|
2686
2686
|
const state2 = seed_states.get(stream);
|
|
2687
2687
|
if (state2 && entry) {
|
|
2688
|
-
await
|
|
2688
|
+
await _chunkXW4EAUS6cjs.cache.call(void 0, ).set(stream, {
|
|
2689
2689
|
stream,
|
|
2690
2690
|
state: state2,
|
|
2691
2691
|
version: entry.committed.version,
|
|
@@ -2694,7 +2694,7 @@ async function truncate_and_warm_cache(guarded, seed_states, guard_events, corre
|
|
|
2694
2694
|
snaps: 1
|
|
2695
2695
|
});
|
|
2696
2696
|
} else {
|
|
2697
|
-
await
|
|
2697
|
+
await _chunkXW4EAUS6cjs.cache.call(void 0, ).invalidate(stream);
|
|
2698
2698
|
}
|
|
2699
2699
|
})
|
|
2700
2700
|
);
|
|
@@ -2746,7 +2746,7 @@ var CorrelateCycle = (_class5 = class {
|
|
|
2746
2746
|
// never lets a resolution re-lane them.
|
|
2747
2747
|
|
|
2748
2748
|
__init18() {this._static_subscriptions = /* @__PURE__ */ new Map()}
|
|
2749
|
-
__init19() {this._patterns = new (0,
|
|
2749
|
+
__init19() {this._patterns = new (0, _chunkXW4EAUS6cjs.LruMap)(PATTERN_CACHE_SIZE)}
|
|
2750
2750
|
|
|
2751
2751
|
|
|
2752
2752
|
|
|
@@ -2764,7 +2764,7 @@ var CorrelateCycle = (_class5 = class {
|
|
|
2764
2764
|
on_init
|
|
2765
2765
|
}) {;_class5.prototype.__init10.call(this);_class5.prototype.__init11.call(this);_class5.prototype.__init12.call(this);_class5.prototype.__init13.call(this);_class5.prototype.__init14.call(this);_class5.prototype.__init15.call(this);_class5.prototype.__init16.call(this);_class5.prototype.__init17.call(this);_class5.prototype.__init18.call(this);_class5.prototype.__init19.call(this);_class5.prototype.__init20.call(this);
|
|
2766
2766
|
this._key = shard ? `${registry_key(registry.events)}:${[...shard].sort().join(",")}` : registry_key(registry.events);
|
|
2767
|
-
this._dynamic_subscriptions = new (0,
|
|
2767
|
+
this._dynamic_subscriptions = new (0, _chunkXW4EAUS6cjs.LruMap)(max_subscribed_streams);
|
|
2768
2768
|
this._registry = registry;
|
|
2769
2769
|
this._declared_lanes = declared_lanes;
|
|
2770
2770
|
this._static_targets = static_targets;
|
|
@@ -2822,7 +2822,7 @@ var CorrelateCycle = (_class5 = class {
|
|
|
2822
2822
|
// Would the target's own `fetch` (filtered by `source`) return this event?
|
|
2823
2823
|
_in_fetch_window(source, stream) {
|
|
2824
2824
|
if (source === void 0 || source === stream) return true;
|
|
2825
|
-
if (
|
|
2825
|
+
if (_chunkXW4EAUS6cjs.is_literal_source.call(void 0, source)) return false;
|
|
2826
2826
|
let pattern = this._patterns.get(source);
|
|
2827
2827
|
if (!pattern) {
|
|
2828
2828
|
pattern = new RegExp(source);
|
|
@@ -2865,7 +2865,7 @@ var CorrelateCycle = (_class5 = class {
|
|
|
2865
2865
|
const correlated = /* @__PURE__ */ new Map();
|
|
2866
2866
|
let last_id = after;
|
|
2867
2867
|
let stopped = false;
|
|
2868
|
-
const found = await
|
|
2868
|
+
const found = await _chunkXW4EAUS6cjs.store.call(void 0, ).query(
|
|
2869
2869
|
(event) => {
|
|
2870
2870
|
if (stopped) return;
|
|
2871
2871
|
const register = this._registry.events[event.name];
|
|
@@ -2986,7 +2986,7 @@ var CorrelateCycle = (_class5 = class {
|
|
|
2986
2986
|
await Promise.all(
|
|
2987
2987
|
missed.map(async ([stream, entry]) => {
|
|
2988
2988
|
let row;
|
|
2989
|
-
await
|
|
2989
|
+
await _chunkXW4EAUS6cjs.store.call(void 0, ).query_streams(
|
|
2990
2990
|
(position) => {
|
|
2991
2991
|
row = position;
|
|
2992
2992
|
},
|
|
@@ -3025,7 +3025,7 @@ var CorrelateCycle = (_class5 = class {
|
|
|
3025
3025
|
millis: 0
|
|
3026
3026
|
});
|
|
3027
3027
|
} catch (error) {
|
|
3028
|
-
|
|
3028
|
+
_chunkXW4EAUS6cjs.log.call(void 0, ).warn(
|
|
3029
3029
|
`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(_nullishCoalesce(error.cause, () => ( error)))}`
|
|
3030
3030
|
);
|
|
3031
3031
|
}
|
|
@@ -3362,7 +3362,7 @@ var Act = (_class7 = class {
|
|
|
3362
3362
|
// Lanes to arm per event; `"all"` when a dynamic resolver hides the lane.
|
|
3363
3363
|
|
|
3364
3364
|
|
|
3365
|
-
__init27() {this._logger =
|
|
3365
|
+
__init27() {this._logger = _chunkXW4EAUS6cjs.log.call(void 0, )}
|
|
3366
3366
|
// This Act's ports: its own bag, or the singleton adapters.
|
|
3367
3367
|
|
|
3368
3368
|
// Runs a body so internal `store()`/`cache()` calls resolve to `_ports`.
|
|
@@ -3384,10 +3384,10 @@ var Act = (_class7 = class {
|
|
|
3384
3384
|
this._lanes = lanes;
|
|
3385
3385
|
this._declared_lanes = ["default", ...lanes.map((l) => l.name)];
|
|
3386
3386
|
validate_only_lanes(options.onlyLanes, this._declared_lanes);
|
|
3387
|
-
if (options.scoped)
|
|
3388
|
-
this._ports = _nullishCoalesce(options.scoped, () => (
|
|
3387
|
+
if (options.scoped) _chunkXW4EAUS6cjs.check_store.call(void 0, options.scoped.store);
|
|
3388
|
+
this._ports = _nullishCoalesce(options.scoped, () => ( _chunkXW4EAUS6cjs.default_scope.call(void 0, )));
|
|
3389
3389
|
const ports = this._ports;
|
|
3390
|
-
this._scoped =
|
|
3390
|
+
this._scoped = _chunkXW4EAUS6cjs.make_run_scoped.call(void 0, {
|
|
3391
3391
|
// Getters, not a spread: the singletons resolve lazily, so a later
|
|
3392
3392
|
// `store(...)` / `cache(...)` still takes effect.
|
|
3393
3393
|
get store() {
|
|
@@ -3397,14 +3397,14 @@ var Act = (_class7 = class {
|
|
|
3397
3397
|
return ports.cache;
|
|
3398
3398
|
},
|
|
3399
3399
|
// Parsed per build, so a bad window throws on every build.
|
|
3400
|
-
autoclose_window:
|
|
3400
|
+
autoclose_window: _chunkXW4EAUS6cjs.resolveAutocloseConfig.call(void 0, options).autocloseWindow
|
|
3401
3401
|
});
|
|
3402
3402
|
this._correlator = _nullishCoalesce(options.correlator, () => ( default_correlator));
|
|
3403
3403
|
this._es = build_es(this._logger, this._correlator, patch_fn);
|
|
3404
3404
|
this._cd = build_drain(this._logger);
|
|
3405
3405
|
const handle = build_handle({
|
|
3406
3406
|
logger: this._logger,
|
|
3407
|
-
reaction_scope:
|
|
3407
|
+
reaction_scope: _chunkXW4EAUS6cjs.make_reaction_scope.call(void 0, {
|
|
3408
3408
|
do: this.do.bind(this),
|
|
3409
3409
|
load: this.load.bind(this),
|
|
3410
3410
|
query: this.query.bind(this),
|
|
@@ -3434,12 +3434,12 @@ var Act = (_class7 = class {
|
|
|
3434
3434
|
this._ports.store,
|
|
3435
3435
|
options.listen !== false
|
|
3436
3436
|
);
|
|
3437
|
-
|
|
3437
|
+
_chunkXW4EAUS6cjs.register_weak_disposer.call(void 0, new WeakRef(this), (self) => self.shutdown());
|
|
3438
3438
|
}
|
|
3439
3439
|
// Shared by drain, settle and autoclose; bad knobs throw at build.
|
|
3440
3440
|
_build_breaker(options) {
|
|
3441
3441
|
return new CircuitBreaker(
|
|
3442
|
-
|
|
3442
|
+
_chunkXW4EAUS6cjs.resolveCircuitBreakerConfig.call(void 0, options.circuitBreaker),
|
|
3443
3443
|
{
|
|
3444
3444
|
on_error: (error, circuit) => this._emit_error(error, circuit),
|
|
3445
3445
|
// When the cooldown elapses, settle once: its scan or claim is the
|
|
@@ -3507,7 +3507,7 @@ var Act = (_class7 = class {
|
|
|
3507
3507
|
// Audit deps, built after the controllers so the lane set is final.
|
|
3508
3508
|
_build_audit_deps() {
|
|
3509
3509
|
return {
|
|
3510
|
-
store:
|
|
3510
|
+
store: _chunkXW4EAUS6cjs.store,
|
|
3511
3511
|
event_to_state: this._event_to_state,
|
|
3512
3512
|
// Declared lanes, not this process's controllers: a lane another
|
|
3513
3513
|
// worker drains is not `unknown-lane`.
|
|
@@ -3536,7 +3536,7 @@ var Act = (_class7 = class {
|
|
|
3536
3536
|
// Cold start: an idle deferred stream still fires on time after a restart.
|
|
3537
3537
|
async _seed_persisted_defers() {
|
|
3538
3538
|
const now = Date.now();
|
|
3539
|
-
await walk_streams(
|
|
3539
|
+
await walk_streams(_chunkXW4EAUS6cjs.store.call(void 0, ), (pos) => {
|
|
3540
3540
|
if (pos.deferred_at === void 0 || pos.deferred_at <= now) return;
|
|
3541
3541
|
const controller = this._drain_controllers.get(_nullishCoalesce(pos.lane, () => ( "default")));
|
|
3542
3542
|
_optionalChain([controller, 'optionalAccess', _154 => _154.seed_defer, 'call', _155 => _155(pos.stream, pos.deferred_at)]);
|
|
@@ -3572,7 +3572,7 @@ var Act = (_class7 = class {
|
|
|
3572
3572
|
*/
|
|
3573
3573
|
shutdown(options) {
|
|
3574
3574
|
if (!this._shutdown_promise) {
|
|
3575
|
-
|
|
3575
|
+
_chunkXW4EAUS6cjs.resolveShutdownConfig.call(void 0, options);
|
|
3576
3576
|
this._shutdown_promise = (async () => {
|
|
3577
3577
|
this.stop_correlations();
|
|
3578
3578
|
this._settle.stop(true);
|
|
@@ -3590,10 +3590,10 @@ var Act = (_class7 = class {
|
|
|
3590
3590
|
// The largest `leaseMillis` among lanes with a cycle in flight (the
|
|
3591
3591
|
// default for none or 0, and for a running settle), capped.
|
|
3592
3592
|
_derive_grace_ms(running, settling) {
|
|
3593
|
-
let max = settling ?
|
|
3593
|
+
let max = settling ? _chunkXW4EAUS6cjs.DEFAULT_LEASE_MILLIS : 0;
|
|
3594
3594
|
for (const c of running)
|
|
3595
|
-
max = Math.max(max, c.lease_millis ||
|
|
3596
|
-
return Math.min(max,
|
|
3595
|
+
max = Math.max(max, c.lease_millis || _chunkXW4EAUS6cjs.DEFAULT_LEASE_MILLIS);
|
|
3596
|
+
return Math.min(max, _chunkXW4EAUS6cjs.MAX_SHUTDOWN_GRACE_MS);
|
|
3597
3597
|
}
|
|
3598
3598
|
async _await_inflight(grace_ms) {
|
|
3599
3599
|
const running = [...this._drain_controllers.values()].filter(
|
|
@@ -3677,7 +3677,7 @@ var Act = (_class7 = class {
|
|
|
3677
3677
|
* @see {@link ValidationError}, {@link PreconditionError}, {@link ConcurrencyError}
|
|
3678
3678
|
*/
|
|
3679
3679
|
async do(action2, target, payload, options) {
|
|
3680
|
-
const reacting_to = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _157 => _157.reactingTo]), () => (
|
|
3680
|
+
const reacting_to = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _157 => _157.reactingTo]), () => ( _chunkXW4EAUS6cjs.current_reacting.call(void 0, )));
|
|
3681
3681
|
const do_options = reacting_to === _optionalChain([options, 'optionalAccess', _158 => _158.reactingTo]) ? options : { ...options, reactingTo: reacting_to };
|
|
3682
3682
|
return this._scoped(async () => {
|
|
3683
3683
|
const snapshots = await this._es.action(
|
|
@@ -3688,7 +3688,6 @@ var Act = (_class7 = class {
|
|
|
3688
3688
|
do_options
|
|
3689
3689
|
);
|
|
3690
3690
|
if (!snapshots[0].patch) return snapshots;
|
|
3691
|
-
const me = this.registry.actions[action2];
|
|
3692
3691
|
this._wake(snapshots.map((s) => s.event.name));
|
|
3693
3692
|
const by_stream = /* @__PURE__ */ new Map();
|
|
3694
3693
|
for (const s of snapshots) {
|
|
@@ -3696,10 +3695,10 @@ var Act = (_class7 = class {
|
|
|
3696
3695
|
if (of_stream) of_stream.push(s);
|
|
3697
3696
|
else by_stream.set(s.event.stream, [s]);
|
|
3698
3697
|
}
|
|
3699
|
-
for (const
|
|
3700
|
-
const owner =
|
|
3701
|
-
|
|
3702
|
-
)
|
|
3698
|
+
for (const of_stream of by_stream.values()) {
|
|
3699
|
+
const owner = this._event_to_state.get(
|
|
3700
|
+
of_stream[0].event.name
|
|
3701
|
+
);
|
|
3703
3702
|
this.emit("committed", of_stream);
|
|
3704
3703
|
this._notify(`committed:${owner.name}`, of_stream);
|
|
3705
3704
|
}
|
|
@@ -3752,7 +3751,7 @@ var Act = (_class7 = class {
|
|
|
3752
3751
|
return this._scoped(async () => {
|
|
3753
3752
|
let first;
|
|
3754
3753
|
let last;
|
|
3755
|
-
const count = await
|
|
3754
|
+
const count = await _chunkXW4EAUS6cjs.store.call(void 0, ).query((e) => {
|
|
3756
3755
|
const gated = this.registry.query_gate(e.name)(e);
|
|
3757
3756
|
if (!first) first = gated;
|
|
3758
3757
|
last = gated;
|
|
@@ -3782,7 +3781,7 @@ var Act = (_class7 = class {
|
|
|
3782
3781
|
async query_array(query) {
|
|
3783
3782
|
return this._scoped(async () => {
|
|
3784
3783
|
const events = [];
|
|
3785
|
-
await
|
|
3784
|
+
await _chunkXW4EAUS6cjs.store.call(void 0, ).query((e) => {
|
|
3786
3785
|
events.push(this.registry.query_gate(e.name)(e));
|
|
3787
3786
|
}, query);
|
|
3788
3787
|
return events;
|
|
@@ -3802,14 +3801,14 @@ var Act = (_class7 = class {
|
|
|
3802
3801
|
*/
|
|
3803
3802
|
async forget(stream) {
|
|
3804
3803
|
return this._scoped(async () => {
|
|
3805
|
-
const s =
|
|
3804
|
+
const s = _chunkXW4EAUS6cjs.store.call(void 0, );
|
|
3806
3805
|
if (!s.forget_pii) {
|
|
3807
3806
|
throw new Error(
|
|
3808
3807
|
`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).`
|
|
3809
3808
|
);
|
|
3810
3809
|
}
|
|
3811
3810
|
const eventCount = await s.forget_pii(stream);
|
|
3812
|
-
await
|
|
3811
|
+
await _chunkXW4EAUS6cjs.cache.call(void 0, ).invalidate(stream);
|
|
3813
3812
|
if (eventCount > 0) {
|
|
3814
3813
|
this.emit("forgotten", { stream, at: /* @__PURE__ */ new Date(), eventCount });
|
|
3815
3814
|
}
|
|
@@ -3843,7 +3842,7 @@ var Act = (_class7 = class {
|
|
|
3843
3842
|
* @see {@link correlate} for dynamic stream discovery
|
|
3844
3843
|
*/
|
|
3845
3844
|
async drain(options = {}) {
|
|
3846
|
-
|
|
3845
|
+
_chunkXW4EAUS6cjs.resolveDrainConfig.call(void 0, options);
|
|
3847
3846
|
if (!this._drain)
|
|
3848
3847
|
return { fetched: [], leased: [], acked: [], blocked: [] };
|
|
3849
3848
|
return this._scoped(() => this._drain_all(options));
|
|
@@ -4023,7 +4022,7 @@ var Act = (_class7 = class {
|
|
|
4023
4022
|
*/
|
|
4024
4023
|
async reset(input) {
|
|
4025
4024
|
return this._scoped(async () => {
|
|
4026
|
-
const count = await
|
|
4025
|
+
const count = await _chunkXW4EAUS6cjs.store.call(void 0, ).reset(input);
|
|
4027
4026
|
for (const handler of this._batch_handlers.values())
|
|
4028
4027
|
_optionalChain([handler, 'access', _165 => _165[FOLD_RESET], 'optionalCall', _166 => _166()]);
|
|
4029
4028
|
if (count > 0) {
|
|
@@ -4059,7 +4058,7 @@ var Act = (_class7 = class {
|
|
|
4059
4058
|
*/
|
|
4060
4059
|
async unblock(input) {
|
|
4061
4060
|
return this._scoped(async () => {
|
|
4062
|
-
const count = await
|
|
4061
|
+
const count = await _chunkXW4EAUS6cjs.store.call(void 0, ).unblock(input);
|
|
4063
4062
|
if (count > 0) {
|
|
4064
4063
|
this._wake();
|
|
4065
4064
|
}
|
|
@@ -4114,7 +4113,7 @@ var Act = (_class7 = class {
|
|
|
4114
4113
|
return { ...partial, duration_ms: Date.now() - started };
|
|
4115
4114
|
}
|
|
4116
4115
|
const target = _nullishCoalesce(sink, () => ( (() => {
|
|
4117
|
-
const s =
|
|
4116
|
+
const s = _chunkXW4EAUS6cjs.store.call(void 0, );
|
|
4118
4117
|
if (!s.restore) throw new Error("adapter has no restore capability");
|
|
4119
4118
|
return s;
|
|
4120
4119
|
})()));
|
|
@@ -4160,7 +4159,7 @@ var Act = (_class7 = class {
|
|
|
4160
4159
|
async blocked_streams(options) {
|
|
4161
4160
|
return this._scoped(async () => {
|
|
4162
4161
|
const positions = [];
|
|
4163
|
-
await
|
|
4162
|
+
await _chunkXW4EAUS6cjs.store.call(void 0, ).query_streams(
|
|
4164
4163
|
(p) => {
|
|
4165
4164
|
positions.push(p);
|
|
4166
4165
|
},
|
|
@@ -4212,7 +4211,7 @@ var Act = (_class7 = class {
|
|
|
4212
4211
|
* @see {@link Store.prioritize} for the underlying primitive
|
|
4213
4212
|
*/
|
|
4214
4213
|
async prioritize(filter, priority) {
|
|
4215
|
-
return this._scoped(() =>
|
|
4214
|
+
return this._scoped(() => _chunkXW4EAUS6cjs.store.call(void 0, ).prioritize(filter, priority));
|
|
4216
4215
|
}
|
|
4217
4216
|
// Shared by `close()` and reaction-requested closes.
|
|
4218
4217
|
async _run_close(targets) {
|
|
@@ -4292,7 +4291,7 @@ var Act = (_class7 = class {
|
|
|
4292
4291
|
* @see {@link correlate} for manual correlation
|
|
4293
4292
|
*/
|
|
4294
4293
|
settle(options) {
|
|
4295
|
-
|
|
4294
|
+
_chunkXW4EAUS6cjs.resolveSettleConfig.call(void 0, _nullishCoalesce(options, () => ( {})));
|
|
4296
4295
|
this._schedule(options);
|
|
4297
4296
|
}
|
|
4298
4297
|
}, _class7);
|
|
@@ -4489,7 +4488,7 @@ var _this_ = ({ stream }) => ({
|
|
|
4489
4488
|
|
|
4490
4489
|
// src/builders/builder-utils.ts
|
|
4491
4490
|
function register_lane(config2, lanes) {
|
|
4492
|
-
|
|
4491
|
+
_chunkXW4EAUS6cjs.resolveLaneConfig.call(void 0, config2);
|
|
4493
4492
|
if (config2.name === _chunkVD4BLAY4cjs.DEFAULT_LANE)
|
|
4494
4493
|
throw new Error(`Lane "${_chunkVD4BLAY4cjs.DEFAULT_LANE}" is reserved`);
|
|
4495
4494
|
const existing = lanes.find((l) => l.name === config2.name);
|
|
@@ -4533,9 +4532,9 @@ function reaction_on(event, events, builder) {
|
|
|
4533
4532
|
// Validate the whole bag at the declaration site so a bad
|
|
4534
4533
|
// `maxRetries`/`backoff`/`blockOnError` throws ZodError at build,
|
|
4535
4534
|
// not a NaN gate on the first retry.
|
|
4536
|
-
options:
|
|
4537
|
-
blockOnError: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _169 => _169.blockOnError]), () => (
|
|
4538
|
-
maxRetries: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _170 => _170.maxRetries]), () => (
|
|
4535
|
+
options: _chunkXW4EAUS6cjs.resolveReactionConfig.call(void 0, {
|
|
4536
|
+
blockOnError: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _169 => _169.blockOnError]), () => ( _chunkXW4EAUS6cjs.DEFAULT_BLOCK_ON_ERROR)),
|
|
4537
|
+
maxRetries: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _170 => _170.maxRetries]), () => ( _chunkXW4EAUS6cjs.DEFAULT_MAX_RETRIES)),
|
|
4539
4538
|
backoff: _optionalChain([options, 'optionalAccess', _171 => _171.backoff])
|
|
4540
4539
|
})
|
|
4541
4540
|
};
|
|
@@ -4878,7 +4877,7 @@ function act() {
|
|
|
4878
4877
|
const list = deprecation_summary.map(
|
|
4879
4878
|
(d) => `"${d.deprecated}" (current: "${d.current}", state: "${d.state_name}")`
|
|
4880
4879
|
).join(", ");
|
|
4881
|
-
|
|
4880
|
+
_chunkXW4EAUS6cjs.log.call(void 0, ).info(
|
|
4882
4881
|
`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.`
|
|
4883
4882
|
);
|
|
4884
4883
|
}
|
|
@@ -4920,7 +4919,7 @@ function act() {
|
|
|
4920
4919
|
return reaction_on(event, registry.events, builder);
|
|
4921
4920
|
},
|
|
4922
4921
|
build: (options) => {
|
|
4923
|
-
|
|
4922
|
+
_chunkXW4EAUS6cjs.resolveActConfig.call(void 0, options);
|
|
4924
4923
|
if (!_built) {
|
|
4925
4924
|
for (const proj of pending_projections) add_projection(proj);
|
|
4926
4925
|
for (const proj of fold_projections) {
|
|
@@ -4960,7 +4959,7 @@ function act() {
|
|
|
4960
4959
|
for (const [name, gate] of built.query_readers) _qg.set(name, gate);
|
|
4961
4960
|
for (const [name, gate] of built.handler_readers) _hr.set(name, gate);
|
|
4962
4961
|
finalize_deprecations();
|
|
4963
|
-
if (built.advisory)
|
|
4962
|
+
if (built.advisory) _chunkXW4EAUS6cjs.log.call(void 0, ).warn(built.advisory);
|
|
4964
4963
|
for (const [name, state2] of states) {
|
|
4965
4964
|
if (!state2.loads) continue;
|
|
4966
4965
|
const resolved = {};
|
|
@@ -5004,7 +5003,7 @@ function act() {
|
|
|
5004
5003
|
synthesize_autoclose_reactions(
|
|
5005
5004
|
registry,
|
|
5006
5005
|
states,
|
|
5007
|
-
|
|
5006
|
+
_chunkXW4EAUS6cjs.current_autoclose_window
|
|
5008
5007
|
);
|
|
5009
5008
|
Object.freeze(registry.actions);
|
|
5010
5009
|
Object.freeze(registry.events);
|
|
@@ -5052,8 +5051,8 @@ function _projection(target) {
|
|
|
5052
5051
|
handler,
|
|
5053
5052
|
resolver: _nullishCoalesce(default_resolver, () => ( _this_)),
|
|
5054
5053
|
options: {
|
|
5055
|
-
blockOnError:
|
|
5056
|
-
maxRetries:
|
|
5054
|
+
blockOnError: _chunkXW4EAUS6cjs.DEFAULT_BLOCK_ON_ERROR,
|
|
5055
|
+
maxRetries: _chunkXW4EAUS6cjs.DEFAULT_MAX_RETRIES
|
|
5057
5056
|
}
|
|
5058
5057
|
}),
|
|
5059
5058
|
widened
|
|
@@ -5094,7 +5093,7 @@ function _projection(target) {
|
|
|
5094
5093
|
throw new Error(
|
|
5095
5094
|
`Projection "${target}" .of() partials must share one state name \u2014 got "${name}" and "${partial.name}"`
|
|
5096
5095
|
);
|
|
5097
|
-
const config2 =
|
|
5096
|
+
const config2 = _chunkXW4EAUS6cjs.resolveFoldConfig.call(void 0, options);
|
|
5098
5097
|
const fold_events = {};
|
|
5099
5098
|
for (const partial of partials)
|
|
5100
5099
|
for (const [event_name, schema] of Object.entries(partial.events)) {
|
|
@@ -5112,8 +5111,8 @@ function _projection(target) {
|
|
|
5112
5111
|
handler: noop,
|
|
5113
5112
|
resolver: { target },
|
|
5114
5113
|
options: {
|
|
5115
|
-
blockOnError:
|
|
5116
|
-
maxRetries:
|
|
5114
|
+
blockOnError: _chunkXW4EAUS6cjs.DEFAULT_BLOCK_ON_ERROR,
|
|
5115
|
+
maxRetries: _chunkXW4EAUS6cjs.DEFAULT_MAX_RETRIES
|
|
5117
5116
|
}
|
|
5118
5117
|
}
|
|
5119
5118
|
]
|
|
@@ -5229,7 +5228,7 @@ function action_builder(state2) {
|
|
|
5229
5228
|
throw new Error(`Duplicate action "${action2}"`);
|
|
5230
5229
|
internal.actions[action2] = schema;
|
|
5231
5230
|
if (options) {
|
|
5232
|
-
|
|
5231
|
+
_chunkXW4EAUS6cjs.resolveActionConfig.call(void 0, options);
|
|
5233
5232
|
internal.options ??= {};
|
|
5234
5233
|
internal.options[action2] = options;
|
|
5235
5234
|
}
|
|
@@ -5546,5 +5545,5 @@ function write_line(writer, line) {
|
|
|
5546
5545
|
|
|
5547
5546
|
|
|
5548
5547
|
|
|
5549
|
-
exports.Act = Act; exports.ActorSchema = _chunkVD4BLAY4cjs.ActorSchema; exports.CausationEventSchema = _chunkVD4BLAY4cjs.CausationEventSchema; exports.CommittedMetaSchema = _chunkVD4BLAY4cjs.CommittedMetaSchema; exports.ConcurrencyError = _chunkVD4BLAY4cjs.ConcurrencyError; exports.ConsoleLogger =
|
|
5548
|
+
exports.Act = Act; exports.ActorSchema = _chunkVD4BLAY4cjs.ActorSchema; exports.CausationEventSchema = _chunkVD4BLAY4cjs.CausationEventSchema; exports.CommittedMetaSchema = _chunkVD4BLAY4cjs.CommittedMetaSchema; exports.ConcurrencyError = _chunkVD4BLAY4cjs.ConcurrencyError; exports.ConsoleLogger = _chunkXW4EAUS6cjs.ConsoleLogger; exports.CsvFile = CsvFile; exports.DEFAULT_LANE = _chunkVD4BLAY4cjs.DEFAULT_LANE; exports.DEFAULT_MAX_SUBSCRIBED_STREAMS = _chunkVD4BLAY4cjs.DEFAULT_MAX_SUBSCRIBED_STREAMS; exports.DEFAULT_QUERY_STREAMS_LIMIT = _chunkXW4EAUS6cjs.DEFAULT_QUERY_STREAMS_LIMIT; exports.DEFAULT_SETTLE_DEBOUNCE_MS = _chunkVD4BLAY4cjs.DEFAULT_SETTLE_DEBOUNCE_MS; exports.DeferSignal = _chunkVD4BLAY4cjs.DeferSignal; exports.Environments = _chunkVD4BLAY4cjs.Environments; exports.Errors = _chunkVD4BLAY4cjs.Errors; exports.EventMetaSchema = _chunkVD4BLAY4cjs.EventMetaSchema; exports.ExitCodes = _chunkVD4BLAY4cjs.ExitCodes; exports.InMemoryCache = _chunkXW4EAUS6cjs.InMemoryCache; exports.InMemoryStore = _chunkXW4EAUS6cjs.InMemoryStore; exports.LogLevels = _chunkVD4BLAY4cjs.LogLevels; exports.NonRetryableError = _chunkVD4BLAY4cjs.NonRetryableError; exports.PackageSchema = _chunkXW4EAUS6cjs.PackageSchema; exports.PreconditionError = _chunkVD4BLAY4cjs.PreconditionError; exports.QuerySchema = _chunkVD4BLAY4cjs.QuerySchema; exports.REDACTED = _chunkVD4BLAY4cjs.REDACTED; exports.SHREDDED = _chunkVD4BLAY4cjs.SHREDDED; exports.SNAP_EVENT = _chunkVD4BLAY4cjs.SNAP_EVENT; exports.StoreError = _chunkVD4BLAY4cjs.StoreError; exports.StreamClosedError = _chunkVD4BLAY4cjs.StreamClosedError; exports.TOMBSTONE_EVENT = _chunkVD4BLAY4cjs.TOMBSTONE_EVENT; exports.TargetSchema = _chunkVD4BLAY4cjs.TargetSchema; exports.ValidationError = _chunkVD4BLAY4cjs.ValidationError; exports.ZodEmpty = _chunkVD4BLAY4cjs.ZodEmpty; exports.act = act; exports.cache = _chunkXW4EAUS6cjs.cache; exports.check_appends = _chunkXW4EAUS6cjs.check_appends; exports.concurrency_error = _chunkXW4EAUS6cjs.concurrency_error; exports.config = _chunkXW4EAUS6cjs.config; exports.dateReviver = _chunkXW4EAUS6cjs.dateReviver; exports.default_scope = _chunkXW4EAUS6cjs.default_scope; exports.dispose = _chunkXW4EAUS6cjs.dispose; exports.disposeAndExit = _chunkXW4EAUS6cjs.disposeAndExit; exports.extend = _chunkXW4EAUS6cjs.extend; exports.fair_slots = _chunkXW4EAUS6cjs.fair_slots; exports.is_literal_source = _chunkXW4EAUS6cjs.is_literal_source; exports.log = _chunkXW4EAUS6cjs.log; exports.notification_of = _chunkXW4EAUS6cjs.notification_of; exports.pii_fields = _chunkVD4BLAY4cjs.pii_fields; exports.port = _chunkXW4EAUS6cjs.port; exports.projection = projection; exports.resolveAutocloseConfig = _chunkXW4EAUS6cjs.resolveAutocloseConfig2; exports.seed_event = _chunkXW4EAUS6cjs.seed_event; exports.sensitive = _chunkVD4BLAY4cjs.sensitive; exports.sleep = _chunkXW4EAUS6cjs.sleep; exports.slice = slice; exports.state = state; exports.store = _chunkXW4EAUS6cjs.store; exports.throw_if_stale = _chunkXW4EAUS6cjs.throw_if_stale; exports.validate = _chunkXW4EAUS6cjs.validate;
|
|
5550
5549
|
//# sourceMappingURL=index.cjs.map
|