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