@rotorsoft/act 2.1.7 → 2.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/@types/act.d.ts.map +1 -1
- package/dist/@types/csv.d.ts.map +1 -1
- package/dist/@types/internal/config.d.ts +6 -2
- package/dist/@types/internal/config.d.ts.map +1 -1
- package/dist/@types/types/audit.d.ts +4 -1
- package/dist/@types/types/audit.d.ts.map +1 -1
- package/dist/{chunk-GUMG5AVZ.js → chunk-NYDHZSYZ.js} +15 -3
- package/dist/chunk-NYDHZSYZ.js.map +1 -0
- package/dist/{chunk-C4JJ7LTB.cjs → chunk-YXP6WASH.cjs} +21 -9
- package/dist/chunk-YXP6WASH.cjs.map +1 -0
- package/dist/index.cjs +106 -106
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -8
- 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-C4JJ7LTB.cjs.map +0 -1
- package/dist/chunk-GUMG5AVZ.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -40,7 +40,8 @@
|
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
|
|
44
|
+
var _chunkYXP6WASHcjs = require('./chunk-YXP6WASH.cjs');
|
|
44
45
|
|
|
45
46
|
|
|
46
47
|
|
|
@@ -88,20 +89,20 @@ var _chunkQFYPSI6Pcjs = require('./chunk-QFYPSI6P.cjs');
|
|
|
88
89
|
|
|
89
90
|
// src/signals.ts
|
|
90
91
|
process.once("SIGINT", async (arg) => {
|
|
91
|
-
|
|
92
|
-
await
|
|
92
|
+
_chunkYXP6WASHcjs.log.call(void 0, ).info(arg, "SIGINT");
|
|
93
|
+
await _chunkYXP6WASHcjs.disposeAndExit.call(void 0, "EXIT");
|
|
93
94
|
});
|
|
94
95
|
process.once("SIGTERM", async (arg) => {
|
|
95
|
-
|
|
96
|
-
await
|
|
96
|
+
_chunkYXP6WASHcjs.log.call(void 0, ).info(arg, "SIGTERM");
|
|
97
|
+
await _chunkYXP6WASHcjs.disposeAndExit.call(void 0, "EXIT");
|
|
97
98
|
});
|
|
98
99
|
process.once("uncaughtException", async (arg) => {
|
|
99
|
-
|
|
100
|
-
await
|
|
100
|
+
_chunkYXP6WASHcjs.log.call(void 0, ).error(arg, "Uncaught Exception");
|
|
101
|
+
await _chunkYXP6WASHcjs.disposeAndExit.call(void 0, "ERROR");
|
|
101
102
|
});
|
|
102
103
|
process.once("unhandledRejection", async (arg) => {
|
|
103
|
-
|
|
104
|
-
await
|
|
104
|
+
_chunkYXP6WASHcjs.log.call(void 0, ).error(arg, "Unhandled Rejection");
|
|
105
|
+
await _chunkYXP6WASHcjs.disposeAndExit.call(void 0, "ERROR");
|
|
105
106
|
});
|
|
106
107
|
|
|
107
108
|
// src/act.ts
|
|
@@ -1100,7 +1101,7 @@ function compute_lag_lead_ratio(handled, lagging, leading) {
|
|
|
1100
1101
|
function report_once(seen, key, message) {
|
|
1101
1102
|
if (seen.has(key)) return;
|
|
1102
1103
|
seen.add(key);
|
|
1103
|
-
|
|
1104
|
+
_chunkYXP6WASHcjs.log.call(void 0, ).error(new Error(message));
|
|
1104
1105
|
}
|
|
1105
1106
|
|
|
1106
1107
|
// src/internal/correlation-id.ts
|
|
@@ -1128,14 +1129,14 @@ function close_correlation(correlator, actor) {
|
|
|
1128
1129
|
}
|
|
1129
1130
|
|
|
1130
1131
|
// src/internal/drain-ops.ts
|
|
1131
|
-
var claim = (lagging, leading, by, millis, lane) =>
|
|
1132
|
+
var claim = (lagging, leading, by, millis, lane) => _chunkYXP6WASHcjs.store.call(void 0, ).claim(lagging, leading, by, millis, lane);
|
|
1132
1133
|
async function fetch(leased, eventLimit) {
|
|
1133
1134
|
return Promise.all(
|
|
1134
1135
|
leased.map(async ({ stream, source, at, lagging }) => {
|
|
1135
1136
|
const events = [];
|
|
1136
1137
|
const stream_exact = source !== void 0 && _chunkD7LQNOEVcjs.isStreamName.call(void 0, source, stream) ? true : void 0;
|
|
1137
1138
|
try {
|
|
1138
|
-
await
|
|
1139
|
+
await _chunkYXP6WASHcjs.store.call(void 0, ).query((e) => events.push(e), {
|
|
1139
1140
|
stream: source,
|
|
1140
1141
|
stream_exact,
|
|
1141
1142
|
after: at,
|
|
@@ -1155,9 +1156,9 @@ async function fetch(leased, eventLimit) {
|
|
|
1155
1156
|
})
|
|
1156
1157
|
);
|
|
1157
1158
|
}
|
|
1158
|
-
var ack = (leases) =>
|
|
1159
|
-
var block = (leases) =>
|
|
1160
|
-
var subscribe = (streams, correlated_at, correlator) =>
|
|
1159
|
+
var ack = (leases) => _chunkYXP6WASHcjs.store.call(void 0, ).ack(leases);
|
|
1160
|
+
var block = (leases) => _chunkYXP6WASHcjs.store.call(void 0, ).block(leases);
|
|
1161
|
+
var subscribe = (streams, correlated_at, correlator) => _chunkYXP6WASHcjs.store.call(void 0, ).subscribe(streams, correlated_at, correlator);
|
|
1161
1162
|
|
|
1162
1163
|
// src/internal/event-sourcing.ts
|
|
1163
1164
|
var _actpatch = require('@rotorsoft/act-patch');
|
|
@@ -1279,14 +1280,14 @@ var check_invariants = (target, state2, schema, pii_aware) => {
|
|
|
1279
1280
|
);
|
|
1280
1281
|
};
|
|
1281
1282
|
var DEFAULT_BATCH = 500;
|
|
1282
|
-
var cache_put = (stream, entry) =>
|
|
1283
|
-
(err) =>
|
|
1283
|
+
var cache_put = (stream, entry) => _chunkYXP6WASHcjs.cache.call(void 0, ).set(stream, entry).catch(
|
|
1284
|
+
(err) => _chunkYXP6WASHcjs.log.call(void 0, ).warn(
|
|
1284
1285
|
err,
|
|
1285
1286
|
"cache set skipped; the next load re-folds from the store"
|
|
1286
1287
|
)
|
|
1287
1288
|
);
|
|
1288
|
-
var cache_drop = (stream) =>
|
|
1289
|
-
(err) =>
|
|
1289
|
+
var cache_drop = (stream) => _chunkYXP6WASHcjs.cache.call(void 0, ).invalidate(stream).catch(
|
|
1290
|
+
(err) => _chunkYXP6WASHcjs.log.call(void 0, ).warn(
|
|
1290
1291
|
err,
|
|
1291
1292
|
"cache invalidate skipped; a stale checkpoint re-folds from its event_id"
|
|
1292
1293
|
)
|
|
@@ -1294,7 +1295,7 @@ var cache_drop = (stream) => _chunkC4JJ7LTBcjs.cache.call(void 0, ).invalidate(s
|
|
|
1294
1295
|
async function snap(snapshot) {
|
|
1295
1296
|
const { id, stream, name, meta, version } = snapshot.event;
|
|
1296
1297
|
try {
|
|
1297
|
-
const [committed] = await
|
|
1298
|
+
const [committed] = await _chunkYXP6WASHcjs.store.call(void 0, ).commit(
|
|
1298
1299
|
[
|
|
1299
1300
|
{
|
|
1300
1301
|
stream,
|
|
@@ -1311,14 +1312,14 @@ async function snap(snapshot) {
|
|
|
1311
1312
|
return committed;
|
|
1312
1313
|
} catch (error) {
|
|
1313
1314
|
const reason = error instanceof Error ? error.message : String(error);
|
|
1314
|
-
|
|
1315
|
+
_chunkYXP6WASHcjs.log.call(void 0, ).warn(
|
|
1315
1316
|
`Snapshot write failed on stream "${stream}": ${reason} \u2014 cold starts will replay full history until snapshots succeed.`
|
|
1316
1317
|
);
|
|
1317
1318
|
}
|
|
1318
1319
|
}
|
|
1319
1320
|
async function tombstone(stream, expectedVersion, correlation) {
|
|
1320
1321
|
try {
|
|
1321
|
-
const [committed] = await
|
|
1322
|
+
const [committed] = await _chunkYXP6WASHcjs.store.call(void 0, ).commit(
|
|
1322
1323
|
[
|
|
1323
1324
|
{
|
|
1324
1325
|
stream,
|
|
@@ -1475,14 +1476,14 @@ async function load(me, target, callback, patch_fn = bare_patch) {
|
|
|
1475
1476
|
const { stream, actor, asOf } = target;
|
|
1476
1477
|
const time_travel = !!asOf && Object.values(asOf).some((v) => v !== void 0);
|
|
1477
1478
|
const seeded = time_travel && asOf.limit === void 0 && !asOf.created_after;
|
|
1478
|
-
const cached = time_travel ? void 0 : await
|
|
1479
|
+
const cached = time_travel ? void 0 : await _chunkYXP6WASHcjs.cache.call(void 0, ).get(stream);
|
|
1479
1480
|
const cache_hit = !!cached;
|
|
1480
1481
|
let state2 = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _63 => _63.state]), () => ( (me.init ? me.init() : {})));
|
|
1481
1482
|
let patches = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _64 => _64.patches]), () => ( 0));
|
|
1482
1483
|
let snaps = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _65 => _65.snaps]), () => ( 0));
|
|
1483
1484
|
let replayed = 0;
|
|
1484
1485
|
let event;
|
|
1485
|
-
await
|
|
1486
|
+
await _chunkYXP6WASHcjs.store.call(void 0, ).query(
|
|
1486
1487
|
(raw) => {
|
|
1487
1488
|
if (seeded && raw.name === _chunkQFYPSI6Pcjs.SNAP_EVENT && replayed > 0) return;
|
|
1488
1489
|
event = me.view(raw, actor);
|
|
@@ -1496,7 +1497,7 @@ async function load(me, target, callback, patch_fn = bare_patch) {
|
|
|
1496
1497
|
patches++;
|
|
1497
1498
|
replayed++;
|
|
1498
1499
|
} else if (event.name !== _chunkQFYPSI6Pcjs.TOMBSTONE_EVENT) {
|
|
1499
|
-
|
|
1500
|
+
_chunkYXP6WASHcjs.log.call(void 0, ).warn(
|
|
1500
1501
|
`Skipping unknown event "${String(event.name)}" on stream "${stream}" (id=${event.id}) \u2014 no reducer in state "${me.name}"`
|
|
1501
1502
|
);
|
|
1502
1503
|
}
|
|
@@ -1584,7 +1585,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1584
1585
|
if (!stream) throw new Error("Missing target stream");
|
|
1585
1586
|
const reactingTo = _optionalChain([options, 'optionalAccess', _74 => _74.reactingTo]);
|
|
1586
1587
|
const correlator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _75 => _75.correlator]), () => ( default_correlator));
|
|
1587
|
-
const validated =
|
|
1588
|
+
const validated = _chunkYXP6WASHcjs.validate.call(void 0, action2, payload, me.actions[action2]);
|
|
1588
1589
|
const opts = _optionalChain([me, 'access', _76 => _76.options, 'optionalAccess', _77 => _77[action2]]);
|
|
1589
1590
|
const max_retries = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _78 => _78.maxRetries]), () => ( 0));
|
|
1590
1591
|
const loads = _nullishCoalesce(_optionalChain([me, 'access', _79 => _79.loads, 'optionalAccess', _80 => _80[action2]]), () => ( []));
|
|
@@ -1646,7 +1647,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1646
1647
|
);
|
|
1647
1648
|
to.events.push({
|
|
1648
1649
|
name: event,
|
|
1649
|
-
data:
|
|
1650
|
+
data: _chunkYXP6WASHcjs.validate.call(void 0, event, data, to.state.events[event])
|
|
1650
1651
|
});
|
|
1651
1652
|
}
|
|
1652
1653
|
if (!own.events.length)
|
|
@@ -1703,7 +1704,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1703
1704
|
});
|
|
1704
1705
|
let committed;
|
|
1705
1706
|
try {
|
|
1706
|
-
committed = await
|
|
1707
|
+
committed = await _chunkYXP6WASHcjs.store.call(void 0, ).commit(
|
|
1707
1708
|
appends.map((p) => ({
|
|
1708
1709
|
stream: p.stream,
|
|
1709
1710
|
msgs: p.events.map((e) => p.state.message(e)),
|
|
@@ -1759,14 +1760,14 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1759
1760
|
if (attempt >= max_retries) throw error;
|
|
1760
1761
|
if (_optionalChain([opts, 'optionalAccess', _95 => _95.backoff])) {
|
|
1761
1762
|
const delay_ms = compute_backoff_delay(attempt, opts.backoff);
|
|
1762
|
-
if (delay_ms > 0) await
|
|
1763
|
+
if (delay_ms > 0) await _chunkYXP6WASHcjs.sleep.call(void 0, delay_ms);
|
|
1763
1764
|
}
|
|
1764
1765
|
}
|
|
1765
1766
|
}
|
|
1766
1767
|
}
|
|
1767
1768
|
|
|
1768
1769
|
// src/internal/tracing.ts
|
|
1769
|
-
var PRETTY =
|
|
1770
|
+
var PRETTY = _chunkYXP6WASHcjs.config.call(void 0, ).env !== "production";
|
|
1770
1771
|
var C_BLUE = "\x1B[38;5;39m";
|
|
1771
1772
|
var C_ORANGE = "\x1B[38;5;208m";
|
|
1772
1773
|
var C_GREEN = "\x1B[38;5;42m";
|
|
@@ -1950,7 +1951,7 @@ function budget_exhausted(lease, options, store_failing) {
|
|
|
1950
1951
|
if (store_failing || !_optionalChain([options, 'optionalAccess', _106 => _106.blockOnError]) || lease.retry <= options.maxRetries)
|
|
1951
1952
|
return void 0;
|
|
1952
1953
|
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.`;
|
|
1953
|
-
|
|
1954
|
+
_chunkYXP6WASHcjs.log.call(void 0, ).error(error);
|
|
1954
1955
|
return { lease, handled: 0, acked_at: lease.at, error, block: true };
|
|
1955
1956
|
}
|
|
1956
1957
|
function fetch_failure_policy(registry) {
|
|
@@ -1972,7 +1973,7 @@ function finalize(lease, handled, at, error, options, logger, failed_at) {
|
|
|
1972
1973
|
logger.error(
|
|
1973
1974
|
non_retryable ? `Blocking ${lease.stream} on non-retryable error.` : `Blocking ${lease.stream} after ${lease.retry} retries.`
|
|
1974
1975
|
);
|
|
1975
|
-
const next_attempt_at = block2 ? void 0 : Date.now() + compute_backoff_delay(lease.retry, _nullishCoalesce(options.backoff, () => (
|
|
1976
|
+
const next_attempt_at = block2 ? void 0 : Date.now() + compute_backoff_delay(lease.retry, _nullishCoalesce(options.backoff, () => ( _chunkYXP6WASHcjs.DEFAULT_BACKOFF)));
|
|
1976
1977
|
return {
|
|
1977
1978
|
lease,
|
|
1978
1979
|
handled,
|
|
@@ -2100,7 +2101,7 @@ async function run_drain_cycle(deps, cycle) {
|
|
|
2100
2101
|
const acked = submitted.length ? await ops.ack(submitted) : [];
|
|
2101
2102
|
const expected = submitted.filter((l) => l.due === void 0).length;
|
|
2102
2103
|
if (acked.length < expected)
|
|
2103
|
-
|
|
2104
|
+
_chunkYXP6WASHcjs.log.call(void 0, ).warn(
|
|
2104
2105
|
`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.`
|
|
2105
2106
|
);
|
|
2106
2107
|
const closeable = handled.filter((h) => h.close !== void 0).map((h) => h.close);
|
|
@@ -2196,9 +2197,9 @@ var DrainController = (_class3 = class {
|
|
|
2196
2197
|
if (!this.armed || this._stopped || this._inflight)
|
|
2197
2198
|
return EMPTY_DRAIN;
|
|
2198
2199
|
const d = _nullishCoalesce(this._deps.defaults, () => ( {}));
|
|
2199
|
-
const streamLimit = _nullishCoalesce(_nullishCoalesce(d.streamLimit, () => ( options.streamLimit)), () => (
|
|
2200
|
-
const eventLimit = _nullishCoalesce(options.eventLimit, () => (
|
|
2201
|
-
const leaseMillis = _nullishCoalesce(_nullishCoalesce(d.leaseMillis, () => ( options.leaseMillis)), () => (
|
|
2200
|
+
const streamLimit = _nullishCoalesce(_nullishCoalesce(d.streamLimit, () => ( options.streamLimit)), () => ( _chunkYXP6WASHcjs.DEFAULT_STREAM_LIMIT));
|
|
2201
|
+
const eventLimit = _nullishCoalesce(options.eventLimit, () => ( _chunkYXP6WASHcjs.DEFAULT_EVENT_LIMIT));
|
|
2202
|
+
const leaseMillis = _nullishCoalesce(_nullishCoalesce(d.leaseMillis, () => ( options.leaseMillis)), () => ( _chunkYXP6WASHcjs.DEFAULT_LEASE_MILLIS));
|
|
2202
2203
|
if (this._deps.breaker.state(Date.now()) === "open")
|
|
2203
2204
|
return EMPTY_DRAIN;
|
|
2204
2205
|
const pass = this._pass(streamLimit, eventLimit, leaseMillis).finally(
|
|
@@ -2427,13 +2428,13 @@ function synthesize_autoclose_reactions(registry, states, read_window) {
|
|
|
2427
2428
|
} : void 0,
|
|
2428
2429
|
// Never block on autoclose: a transient query/store error should retry,
|
|
2429
2430
|
// not quarantine the synthetic stream.
|
|
2430
|
-
options: { blockOnError: false, maxRetries:
|
|
2431
|
+
options: { blockOnError: false, maxRetries: _chunkYXP6WASHcjs.DEFAULT_MAX_RETRIES },
|
|
2431
2432
|
handler: async (event) => {
|
|
2432
2433
|
const aggregate = event.stream;
|
|
2433
2434
|
const window = read_window();
|
|
2434
2435
|
if (!in_autoclose_window(window, /* @__PURE__ */ new Date()))
|
|
2435
2436
|
throw new (0, _chunkQFYPSI6Pcjs.DeferSignal)({ at: next_window_open(window, /* @__PURE__ */ new Date()) });
|
|
2436
|
-
const stats = await
|
|
2437
|
+
const stats = await _chunkYXP6WASHcjs.store.call(void 0, ).query_stats([aggregate], {
|
|
2437
2438
|
count: true,
|
|
2438
2439
|
tail: keep_days !== void 0 ? true : void 0,
|
|
2439
2440
|
exclude: [_chunkQFYPSI6Pcjs.TOMBSTONE_EVENT, _chunkQFYPSI6Pcjs.SNAP_EVENT]
|
|
@@ -2616,7 +2617,7 @@ async function run_windowed_closes(windowed, deps, skipped) {
|
|
|
2616
2617
|
if (!await windowed_prune_pending(t.stream, t.before, max_id))
|
|
2617
2618
|
return void 0;
|
|
2618
2619
|
if (t.archive) await t.archive();
|
|
2619
|
-
const result = await
|
|
2620
|
+
const result = await _chunkYXP6WASHcjs.store.call(void 0, ).truncate([
|
|
2620
2621
|
{ stream: t.stream, before: t.before, max_id }
|
|
2621
2622
|
]);
|
|
2622
2623
|
return result.get(t.stream);
|
|
@@ -2629,7 +2630,7 @@ async function run_windowed_closes(windowed, deps, skipped) {
|
|
|
2629
2630
|
async function windowed_prune_pending(stream, before, max_id) {
|
|
2630
2631
|
let boundary_id;
|
|
2631
2632
|
let min_id;
|
|
2632
|
-
await
|
|
2633
|
+
await _chunkYXP6WASHcjs.store.call(void 0, ).query(
|
|
2633
2634
|
(event) => {
|
|
2634
2635
|
if (min_id === void 0 || event.id < min_id) min_id = event.id;
|
|
2635
2636
|
if (event.name === _chunkQFYPSI6Pcjs.SNAP_EVENT && event.created < before && (max_id === void 0 || event.id <= max_id) && (boundary_id === void 0 || event.id > boundary_id))
|
|
@@ -2643,7 +2644,7 @@ async function probe_min_watermarks(streams, page_size, checkpoint) {
|
|
|
2643
2644
|
const min_at = /* @__PURE__ */ new Map();
|
|
2644
2645
|
const matches = source_matcher();
|
|
2645
2646
|
await walk_streams(
|
|
2646
|
-
|
|
2647
|
+
_chunkYXP6WASHcjs.store.call(void 0, ),
|
|
2647
2648
|
(position) => {
|
|
2648
2649
|
const pending = position.correlated_at === void 0 || position.at < position.correlated_at;
|
|
2649
2650
|
const cap = pending ? position.at : Math.max(position.at, checkpoint);
|
|
@@ -2672,13 +2673,13 @@ function source_matcher() {
|
|
|
2672
2673
|
};
|
|
2673
2674
|
}
|
|
2674
2675
|
async function scan_stream_heads(streams) {
|
|
2675
|
-
const stats = await
|
|
2676
|
+
const stats = await _chunkYXP6WASHcjs.store.call(void 0, ).query_stats(streams, {
|
|
2676
2677
|
exclude: [_chunkQFYPSI6Pcjs.SNAP_EVENT]
|
|
2677
2678
|
});
|
|
2678
|
-
const domain_heads = await
|
|
2679
|
+
const domain_heads = await _chunkYXP6WASHcjs.store.call(void 0, ).query_stats(streams, {
|
|
2679
2680
|
exclude: [_chunkQFYPSI6Pcjs.SNAP_EVENT, _chunkQFYPSI6Pcjs.TOMBSTONE_EVENT]
|
|
2680
2681
|
});
|
|
2681
|
-
const true_heads = await
|
|
2682
|
+
const true_heads = await _chunkYXP6WASHcjs.store.call(void 0, ).query_stats(streams, {});
|
|
2682
2683
|
const out = /* @__PURE__ */ new Map();
|
|
2683
2684
|
for (const [stream, { head }] of domain_heads) {
|
|
2684
2685
|
const marker_head = _optionalChain([stats, 'access', _136 => _136.get, 'call', _137 => _137(stream), 'optionalAccess', _138 => _138.head]);
|
|
@@ -2705,7 +2706,7 @@ async function partition_by_safety(stream_info, reactive, skipped, page_size, ca
|
|
|
2705
2706
|
const pending_set = /* @__PURE__ */ new Set();
|
|
2706
2707
|
const matches = source_matcher();
|
|
2707
2708
|
await walk_streams(
|
|
2708
|
-
|
|
2709
|
+
_chunkYXP6WASHcjs.store.call(void 0, ),
|
|
2709
2710
|
(position) => {
|
|
2710
2711
|
const has_work = position.correlated_at !== void 0 && position.at < position.correlated_at;
|
|
2711
2712
|
if (!has_work) return;
|
|
@@ -2772,7 +2773,7 @@ async function run_archive_callbacks(guarded, target_map) {
|
|
|
2772
2773
|
}
|
|
2773
2774
|
}
|
|
2774
2775
|
async function heads_still_guarded(guarded, guard_events, skipped) {
|
|
2775
|
-
const heads = await
|
|
2776
|
+
const heads = await _chunkYXP6WASHcjs.store.call(void 0, ).query_stats(guarded, {});
|
|
2776
2777
|
return guarded.filter((stream) => {
|
|
2777
2778
|
if (_optionalChain([heads, 'access', _146 => _146.get, 'call', _147 => _147(stream), 'optionalAccess', _148 => _148.head, 'access', _149 => _149.id]) === guard_events.get(stream).id)
|
|
2778
2779
|
return true;
|
|
@@ -2795,13 +2796,13 @@ async function truncate_and_warm_cache(guarded, seed_states, guard_events, corre
|
|
|
2795
2796
|
}
|
|
2796
2797
|
};
|
|
2797
2798
|
});
|
|
2798
|
-
const truncated = await
|
|
2799
|
+
const truncated = await _chunkYXP6WASHcjs.store.call(void 0, ).truncate(trunc_targets);
|
|
2799
2800
|
await Promise.all(
|
|
2800
2801
|
guarded.map(async (stream) => {
|
|
2801
2802
|
const entry = truncated.get(stream);
|
|
2802
2803
|
const state2 = seed_states.get(stream);
|
|
2803
2804
|
if (state2 && entry) {
|
|
2804
|
-
await
|
|
2805
|
+
await _chunkYXP6WASHcjs.cache.call(void 0, ).set(stream, {
|
|
2805
2806
|
stream,
|
|
2806
2807
|
state: state2,
|
|
2807
2808
|
version: entry.committed.version,
|
|
@@ -2810,7 +2811,7 @@ async function truncate_and_warm_cache(guarded, seed_states, guard_events, corre
|
|
|
2810
2811
|
snaps: 1
|
|
2811
2812
|
});
|
|
2812
2813
|
} else {
|
|
2813
|
-
await
|
|
2814
|
+
await _chunkYXP6WASHcjs.cache.call(void 0, ).invalidate(stream);
|
|
2814
2815
|
}
|
|
2815
2816
|
})
|
|
2816
2817
|
);
|
|
@@ -2869,7 +2870,7 @@ var CorrelateCycle = (_class5 = class {
|
|
|
2869
2870
|
// never lets a resolution re-lane them.
|
|
2870
2871
|
|
|
2871
2872
|
__init18() {this._static_subscriptions = /* @__PURE__ */ new Map()}
|
|
2872
|
-
__init19() {this._patterns = new (0,
|
|
2873
|
+
__init19() {this._patterns = new (0, _chunkYXP6WASHcjs.LruMap)(PATTERN_CACHE_SIZE)}
|
|
2873
2874
|
|
|
2874
2875
|
|
|
2875
2876
|
|
|
@@ -2887,7 +2888,7 @@ var CorrelateCycle = (_class5 = class {
|
|
|
2887
2888
|
on_init
|
|
2888
2889
|
}) {;_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);
|
|
2889
2890
|
this._key = shard ? `${registry_key(registry.events)}:${[...shard].sort().join(",")}` : registry_key(registry.events);
|
|
2890
|
-
this._dynamic_subscriptions = new (0,
|
|
2891
|
+
this._dynamic_subscriptions = new (0, _chunkYXP6WASHcjs.LruMap)(max_subscribed_streams);
|
|
2891
2892
|
this._registry = registry;
|
|
2892
2893
|
this._declared_lanes = declared_lanes;
|
|
2893
2894
|
this._static_targets = static_targets;
|
|
@@ -2988,7 +2989,7 @@ var CorrelateCycle = (_class5 = class {
|
|
|
2988
2989
|
const correlated = /* @__PURE__ */ new Map();
|
|
2989
2990
|
let last_id = after;
|
|
2990
2991
|
let stopped = false;
|
|
2991
|
-
const found = await
|
|
2992
|
+
const found = await _chunkYXP6WASHcjs.store.call(void 0, ).query(
|
|
2992
2993
|
(event) => {
|
|
2993
2994
|
if (stopped) return;
|
|
2994
2995
|
const register = this._registry.events[event.name];
|
|
@@ -3007,7 +3008,7 @@ var CorrelateCycle = (_class5 = class {
|
|
|
3007
3008
|
return;
|
|
3008
3009
|
}
|
|
3009
3010
|
if (!resolved) continue;
|
|
3010
|
-
if (!
|
|
3011
|
+
if (!_chunkYXP6WASHcjs.is_valid_target.call(void 0, resolved)) {
|
|
3011
3012
|
report_bad_priority(
|
|
3012
3013
|
this._reported,
|
|
3013
3014
|
reaction.handler.name,
|
|
@@ -3118,7 +3119,7 @@ var CorrelateCycle = (_class5 = class {
|
|
|
3118
3119
|
await Promise.all(
|
|
3119
3120
|
missed.map(async ([stream, entry]) => {
|
|
3120
3121
|
let row;
|
|
3121
|
-
await
|
|
3122
|
+
await _chunkYXP6WASHcjs.store.call(void 0, ).query_streams(
|
|
3122
3123
|
(position) => {
|
|
3123
3124
|
row = position;
|
|
3124
3125
|
},
|
|
@@ -3157,7 +3158,7 @@ var CorrelateCycle = (_class5 = class {
|
|
|
3157
3158
|
millis: 0
|
|
3158
3159
|
});
|
|
3159
3160
|
} catch (error) {
|
|
3160
|
-
|
|
3161
|
+
_chunkYXP6WASHcjs.log.call(void 0, ).warn(
|
|
3161
3162
|
`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)))}`
|
|
3162
3163
|
);
|
|
3163
3164
|
}
|
|
@@ -3494,7 +3495,7 @@ var Act = (_class7 = class {
|
|
|
3494
3495
|
// Lanes to arm per event; `"all"` when a dynamic resolver hides the lane.
|
|
3495
3496
|
|
|
3496
3497
|
|
|
3497
|
-
__init27() {this._logger =
|
|
3498
|
+
__init27() {this._logger = _chunkYXP6WASHcjs.log.call(void 0, )}
|
|
3498
3499
|
// This Act's ports: its own bag, or the singleton adapters.
|
|
3499
3500
|
|
|
3500
3501
|
// Runs a body so internal `store()`/`cache()` calls resolve to `_ports`.
|
|
@@ -3516,10 +3517,10 @@ var Act = (_class7 = class {
|
|
|
3516
3517
|
this._lanes = lanes;
|
|
3517
3518
|
this._declared_lanes = ["default", ...lanes.map((l) => l.name)];
|
|
3518
3519
|
validate_only_lanes(options.onlyLanes, this._declared_lanes);
|
|
3519
|
-
if (options.scoped)
|
|
3520
|
-
this._ports = _nullishCoalesce(options.scoped, () => (
|
|
3520
|
+
if (options.scoped) _chunkYXP6WASHcjs.check_store.call(void 0, options.scoped.store);
|
|
3521
|
+
this._ports = _nullishCoalesce(options.scoped, () => ( _chunkYXP6WASHcjs.unscoped_ports.call(void 0, )));
|
|
3521
3522
|
const ports = this._ports;
|
|
3522
|
-
this._scoped =
|
|
3523
|
+
this._scoped = _chunkYXP6WASHcjs.make_run_scoped.call(void 0, {
|
|
3523
3524
|
// Getters, not a spread: the singletons resolve lazily, so a later
|
|
3524
3525
|
// `store(...)` / `cache(...)` still takes effect.
|
|
3525
3526
|
get store() {
|
|
@@ -3529,14 +3530,14 @@ var Act = (_class7 = class {
|
|
|
3529
3530
|
return ports.cache;
|
|
3530
3531
|
},
|
|
3531
3532
|
// Parsed per build, so a bad window throws on every build.
|
|
3532
|
-
autoclose_window:
|
|
3533
|
+
autoclose_window: _chunkYXP6WASHcjs.resolveAutocloseConfig.call(void 0, options).autocloseWindow
|
|
3533
3534
|
});
|
|
3534
3535
|
this._correlator = _nullishCoalesce(options.correlator, () => ( default_correlator));
|
|
3535
3536
|
this._es = build_es(this._logger, this._correlator, patch_fn);
|
|
3536
3537
|
this._cd = build_drain(this._logger);
|
|
3537
3538
|
const handle = build_handle({
|
|
3538
3539
|
logger: this._logger,
|
|
3539
|
-
reaction_scope:
|
|
3540
|
+
reaction_scope: _chunkYXP6WASHcjs.make_reaction_scope.call(void 0, {
|
|
3540
3541
|
do: this.do.bind(this),
|
|
3541
3542
|
load: this.load.bind(this),
|
|
3542
3543
|
query: this.query.bind(this),
|
|
@@ -3566,12 +3567,12 @@ var Act = (_class7 = class {
|
|
|
3566
3567
|
this._ports.store,
|
|
3567
3568
|
options.listen !== false
|
|
3568
3569
|
);
|
|
3569
|
-
|
|
3570
|
+
_chunkYXP6WASHcjs.register_weak_disposer.call(void 0, new WeakRef(this), (self) => self.shutdown());
|
|
3570
3571
|
}
|
|
3571
3572
|
// Shared by drain, settle and autoclose; bad knobs throw at build.
|
|
3572
3573
|
_build_breaker(options) {
|
|
3573
3574
|
return new CircuitBreaker(
|
|
3574
|
-
|
|
3575
|
+
_chunkYXP6WASHcjs.resolveCircuitBreakerConfig.call(void 0, options.circuitBreaker),
|
|
3575
3576
|
{
|
|
3576
3577
|
on_error: (error, circuit) => this._emit_error(error, circuit),
|
|
3577
3578
|
// When the cooldown elapses, settle once: its scan or claim is the
|
|
@@ -3639,7 +3640,7 @@ var Act = (_class7 = class {
|
|
|
3639
3640
|
// Audit deps, built after the controllers so the lane set is final.
|
|
3640
3641
|
_build_audit_deps() {
|
|
3641
3642
|
return {
|
|
3642
|
-
store:
|
|
3643
|
+
store: _chunkYXP6WASHcjs.store,
|
|
3643
3644
|
event_to_state: this._event_to_state,
|
|
3644
3645
|
// Declared lanes, not this process's controllers: a lane another
|
|
3645
3646
|
// worker drains is not `unknown-lane`.
|
|
@@ -3668,7 +3669,7 @@ var Act = (_class7 = class {
|
|
|
3668
3669
|
// Cold start: an idle deferred stream still fires on time after a restart.
|
|
3669
3670
|
async _seed_persisted_defers() {
|
|
3670
3671
|
const now = Date.now();
|
|
3671
|
-
await walk_streams(
|
|
3672
|
+
await walk_streams(_chunkYXP6WASHcjs.store.call(void 0, ), (pos) => {
|
|
3672
3673
|
if (pos.deferred_at === void 0 || pos.deferred_at <= now) return;
|
|
3673
3674
|
const controller = this._drain_controllers.get(_nullishCoalesce(pos.lane, () => ( "default")));
|
|
3674
3675
|
_optionalChain([controller, 'optionalAccess', _161 => _161.seed_defer, 'call', _162 => _162(pos.stream, pos.deferred_at)]);
|
|
@@ -3704,7 +3705,7 @@ var Act = (_class7 = class {
|
|
|
3704
3705
|
*/
|
|
3705
3706
|
shutdown(options) {
|
|
3706
3707
|
if (!this._shutdown_promise) {
|
|
3707
|
-
|
|
3708
|
+
_chunkYXP6WASHcjs.resolveShutdownConfig.call(void 0, options);
|
|
3708
3709
|
this._shutdown_promise = (async () => {
|
|
3709
3710
|
this.stop_correlations();
|
|
3710
3711
|
this._settle.stop(true);
|
|
@@ -3722,10 +3723,10 @@ var Act = (_class7 = class {
|
|
|
3722
3723
|
// The largest `leaseMillis` among lanes with a cycle in flight (the
|
|
3723
3724
|
// default for none or 0, and for a running settle), capped.
|
|
3724
3725
|
_derive_grace_ms(running, settling) {
|
|
3725
|
-
let max = settling ?
|
|
3726
|
+
let max = settling ? _chunkYXP6WASHcjs.DEFAULT_LEASE_MILLIS : 0;
|
|
3726
3727
|
for (const c of running)
|
|
3727
|
-
max = Math.max(max, c.lease_millis ||
|
|
3728
|
-
return Math.min(max,
|
|
3728
|
+
max = Math.max(max, c.lease_millis || _chunkYXP6WASHcjs.DEFAULT_LEASE_MILLIS);
|
|
3729
|
+
return Math.min(max, _chunkYXP6WASHcjs.MAX_SHUTDOWN_GRACE_MS);
|
|
3729
3730
|
}
|
|
3730
3731
|
async _await_inflight(grace_ms) {
|
|
3731
3732
|
const running = [...this._drain_controllers.values()].filter(
|
|
@@ -3809,7 +3810,7 @@ var Act = (_class7 = class {
|
|
|
3809
3810
|
* @see {@link ValidationError}, {@link PreconditionError}, {@link ConcurrencyError}
|
|
3810
3811
|
*/
|
|
3811
3812
|
async do(action2, target, payload, options) {
|
|
3812
|
-
const reacting_to = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _164 => _164.reactingTo]), () => (
|
|
3813
|
+
const reacting_to = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _164 => _164.reactingTo]), () => ( _chunkYXP6WASHcjs.current_reacting.call(void 0, )));
|
|
3813
3814
|
const do_options = reacting_to === _optionalChain([options, 'optionalAccess', _165 => _165.reactingTo]) ? options : { ...options, reactingTo: reacting_to };
|
|
3814
3815
|
return this._scoped(async () => {
|
|
3815
3816
|
const snapshots = await this._es.action(
|
|
@@ -3883,7 +3884,7 @@ var Act = (_class7 = class {
|
|
|
3883
3884
|
return this._scoped(async () => {
|
|
3884
3885
|
let first;
|
|
3885
3886
|
let last;
|
|
3886
|
-
const count = await
|
|
3887
|
+
const count = await _chunkYXP6WASHcjs.store.call(void 0, ).query((e) => {
|
|
3887
3888
|
const gated = this.registry.query_gate(e.name)(e);
|
|
3888
3889
|
if (!first) first = gated;
|
|
3889
3890
|
last = gated;
|
|
@@ -3929,14 +3930,14 @@ var Act = (_class7 = class {
|
|
|
3929
3930
|
*/
|
|
3930
3931
|
async forget(stream) {
|
|
3931
3932
|
return this._scoped(async () => {
|
|
3932
|
-
const s =
|
|
3933
|
+
const s = _chunkYXP6WASHcjs.store.call(void 0, );
|
|
3933
3934
|
if (!s.forget_pii) {
|
|
3934
3935
|
throw new Error(
|
|
3935
3936
|
`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).`
|
|
3936
3937
|
);
|
|
3937
3938
|
}
|
|
3938
3939
|
const eventCount = await s.forget_pii(stream);
|
|
3939
|
-
await
|
|
3940
|
+
await _chunkYXP6WASHcjs.cache.call(void 0, ).invalidate(stream);
|
|
3940
3941
|
if (eventCount > 0) {
|
|
3941
3942
|
this.emit("forgotten", { stream, at: /* @__PURE__ */ new Date(), eventCount });
|
|
3942
3943
|
}
|
|
@@ -3970,7 +3971,7 @@ var Act = (_class7 = class {
|
|
|
3970
3971
|
* @see {@link correlate} for dynamic stream discovery
|
|
3971
3972
|
*/
|
|
3972
3973
|
async drain(options = {}) {
|
|
3973
|
-
|
|
3974
|
+
_chunkYXP6WASHcjs.resolveDrainConfig.call(void 0, options);
|
|
3974
3975
|
if (!this._drain)
|
|
3975
3976
|
return { fetched: [], leased: [], acked: [], blocked: [] };
|
|
3976
3977
|
return this._scoped(() => this._drain_all(options));
|
|
@@ -4150,7 +4151,7 @@ var Act = (_class7 = class {
|
|
|
4150
4151
|
*/
|
|
4151
4152
|
async reset(input) {
|
|
4152
4153
|
return this._scoped(async () => {
|
|
4153
|
-
const count = await
|
|
4154
|
+
const count = await _chunkYXP6WASHcjs.store.call(void 0, ).reset(input);
|
|
4154
4155
|
for (const handler of this._batch_handlers.values())
|
|
4155
4156
|
_optionalChain([handler, 'access', _172 => _172[FOLD_RESET], 'optionalCall', _173 => _173()]);
|
|
4156
4157
|
if (count > 0) {
|
|
@@ -4186,7 +4187,7 @@ var Act = (_class7 = class {
|
|
|
4186
4187
|
*/
|
|
4187
4188
|
async unblock(input) {
|
|
4188
4189
|
return this._scoped(async () => {
|
|
4189
|
-
const count = await
|
|
4190
|
+
const count = await _chunkYXP6WASHcjs.store.call(void 0, ).unblock(input);
|
|
4190
4191
|
if (count > 0) {
|
|
4191
4192
|
this._wake();
|
|
4192
4193
|
}
|
|
@@ -4234,7 +4235,7 @@ var Act = (_class7 = class {
|
|
|
4234
4235
|
* @see {@link Store.restore} for the underlying driver-pattern primitive.
|
|
4235
4236
|
*/
|
|
4236
4237
|
async restore(source, opts = {}, sink) {
|
|
4237
|
-
|
|
4238
|
+
_chunkYXP6WASHcjs.check_scan_options.call(void 0, opts);
|
|
4238
4239
|
return this._scoped(async () => {
|
|
4239
4240
|
const started = Date.now();
|
|
4240
4241
|
if (opts.dry_run) {
|
|
@@ -4242,7 +4243,7 @@ var Act = (_class7 = class {
|
|
|
4242
4243
|
return { ...partial, duration_ms: Date.now() - started };
|
|
4243
4244
|
}
|
|
4244
4245
|
const target = _nullishCoalesce(sink, () => ( (() => {
|
|
4245
|
-
const s =
|
|
4246
|
+
const s = _chunkYXP6WASHcjs.store.call(void 0, );
|
|
4246
4247
|
if (!s.restore) throw new Error("adapter has no restore capability");
|
|
4247
4248
|
return s;
|
|
4248
4249
|
})()));
|
|
@@ -4288,7 +4289,7 @@ var Act = (_class7 = class {
|
|
|
4288
4289
|
async blocked_streams(options) {
|
|
4289
4290
|
return this._scoped(async () => {
|
|
4290
4291
|
const positions = [];
|
|
4291
|
-
await
|
|
4292
|
+
await _chunkYXP6WASHcjs.store.call(void 0, ).query_streams(
|
|
4292
4293
|
(p) => {
|
|
4293
4294
|
positions.push(p);
|
|
4294
4295
|
},
|
|
@@ -4314,6 +4315,7 @@ var Act = (_class7 = class {
|
|
|
4314
4315
|
* ```
|
|
4315
4316
|
*/
|
|
4316
4317
|
async *audit(categories, options) {
|
|
4318
|
+
_chunkYXP6WASHcjs.check_audit_options.call(void 0, options);
|
|
4317
4319
|
const it = audit(this._audit_deps, categories, options)[Symbol.asyncIterator]();
|
|
4318
4320
|
while (true) {
|
|
4319
4321
|
const { value, done } = await this._scoped(() => it.next());
|
|
@@ -4341,8 +4343,8 @@ var Act = (_class7 = class {
|
|
|
4341
4343
|
* @see {@link Store.prioritize} for the underlying primitive
|
|
4342
4344
|
*/
|
|
4343
4345
|
async prioritize(filter, priority) {
|
|
4344
|
-
|
|
4345
|
-
return this._scoped(() =>
|
|
4346
|
+
_chunkYXP6WASHcjs.check_target.call(void 0, { priority });
|
|
4347
|
+
return this._scoped(() => _chunkYXP6WASHcjs.store.call(void 0, ).prioritize(filter, priority));
|
|
4346
4348
|
}
|
|
4347
4349
|
// Shared by `close()` and reaction-requested closes.
|
|
4348
4350
|
async _run_close(targets) {
|
|
@@ -4422,7 +4424,7 @@ var Act = (_class7 = class {
|
|
|
4422
4424
|
* @see {@link correlate} for manual correlation
|
|
4423
4425
|
*/
|
|
4424
4426
|
settle(options) {
|
|
4425
|
-
|
|
4427
|
+
_chunkYXP6WASHcjs.resolveSettleConfig.call(void 0, _nullishCoalesce(options, () => ( {})));
|
|
4426
4428
|
this._schedule(options);
|
|
4427
4429
|
}
|
|
4428
4430
|
}, _class7);
|
|
@@ -4619,7 +4621,7 @@ var _this_ = ({ stream }) => ({
|
|
|
4619
4621
|
|
|
4620
4622
|
// src/builders/builder-utils.ts
|
|
4621
4623
|
function register_lane(config2, lanes) {
|
|
4622
|
-
|
|
4624
|
+
_chunkYXP6WASHcjs.resolveLaneConfig.call(void 0, config2);
|
|
4623
4625
|
if (config2.name === _chunkQFYPSI6Pcjs.DEFAULT_LANE)
|
|
4624
4626
|
throw new Error(`Lane "${_chunkQFYPSI6Pcjs.DEFAULT_LANE}" is reserved`);
|
|
4625
4627
|
const existing = lanes.find((l) => l.name === config2.name);
|
|
@@ -4643,7 +4645,7 @@ function add_reaction(events, event, name, kind, make, builder) {
|
|
|
4643
4645
|
events[event].reactions.set(name, reaction);
|
|
4644
4646
|
return Object.assign(builder, {
|
|
4645
4647
|
to(resolver) {
|
|
4646
|
-
if (typeof resolver === "object")
|
|
4648
|
+
if (typeof resolver === "object") _chunkYXP6WASHcjs.check_target.call(void 0, resolver);
|
|
4647
4649
|
reaction.resolver = typeof resolver === "string" ? { target: resolver } : resolver;
|
|
4648
4650
|
return builder;
|
|
4649
4651
|
}
|
|
@@ -4664,9 +4666,9 @@ function reaction_on(event, events, builder) {
|
|
|
4664
4666
|
// Validate the whole bag at the declaration site so a bad
|
|
4665
4667
|
// `maxRetries`/`backoff`/`blockOnError` throws ZodError at build,
|
|
4666
4668
|
// not a NaN gate on the first retry.
|
|
4667
|
-
options:
|
|
4668
|
-
blockOnError: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _176 => _176.blockOnError]), () => (
|
|
4669
|
-
maxRetries: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _177 => _177.maxRetries]), () => (
|
|
4669
|
+
options: _chunkYXP6WASHcjs.resolveReactionConfig.call(void 0, {
|
|
4670
|
+
blockOnError: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _176 => _176.blockOnError]), () => ( _chunkYXP6WASHcjs.DEFAULT_BLOCK_ON_ERROR)),
|
|
4671
|
+
maxRetries: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _177 => _177.maxRetries]), () => ( _chunkYXP6WASHcjs.DEFAULT_MAX_RETRIES)),
|
|
4670
4672
|
backoff: _optionalChain([options, 'optionalAccess', _178 => _178.backoff])
|
|
4671
4673
|
})
|
|
4672
4674
|
};
|
|
@@ -4917,7 +4919,7 @@ function act() {
|
|
|
4917
4919
|
const list = deprecation_summary.map(
|
|
4918
4920
|
(d) => `"${d.deprecated}" (current: "${d.current}", state: "${d.state_name}")`
|
|
4919
4921
|
).join(", ");
|
|
4920
|
-
|
|
4922
|
+
_chunkYXP6WASHcjs.log.call(void 0, ).info(
|
|
4921
4923
|
`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.`
|
|
4922
4924
|
);
|
|
4923
4925
|
}
|
|
@@ -4959,7 +4961,7 @@ function act() {
|
|
|
4959
4961
|
return reaction_on(event, registry.events, builder);
|
|
4960
4962
|
},
|
|
4961
4963
|
build: (options) => {
|
|
4962
|
-
|
|
4964
|
+
_chunkYXP6WASHcjs.resolveActConfig.call(void 0, options);
|
|
4963
4965
|
if (!_built) {
|
|
4964
4966
|
for (const proj of pending_projections) add_projection(proj);
|
|
4965
4967
|
for (const proj of fold_projections) {
|
|
@@ -4999,7 +5001,7 @@ function act() {
|
|
|
4999
5001
|
for (const [name, gate] of built.query_readers) _qg.set(name, gate);
|
|
5000
5002
|
for (const [name, gate] of built.handler_readers) _hr.set(name, gate);
|
|
5001
5003
|
finalize_deprecations();
|
|
5002
|
-
if (built.advisory)
|
|
5004
|
+
if (built.advisory) _chunkYXP6WASHcjs.log.call(void 0, ).warn(built.advisory);
|
|
5003
5005
|
for (const [name, state2] of states) {
|
|
5004
5006
|
if (!state2.loads) continue;
|
|
5005
5007
|
const resolved = {};
|
|
@@ -5043,7 +5045,7 @@ function act() {
|
|
|
5043
5045
|
synthesize_autoclose_reactions(
|
|
5044
5046
|
registry,
|
|
5045
5047
|
states,
|
|
5046
|
-
|
|
5048
|
+
_chunkYXP6WASHcjs.current_autoclose_window
|
|
5047
5049
|
);
|
|
5048
5050
|
Object.freeze(registry.actions);
|
|
5049
5051
|
Object.freeze(registry.events);
|
|
@@ -5091,8 +5093,8 @@ function _projection(target) {
|
|
|
5091
5093
|
handler,
|
|
5092
5094
|
resolver: _nullishCoalesce(default_resolver, () => ( _this_)),
|
|
5093
5095
|
options: {
|
|
5094
|
-
blockOnError:
|
|
5095
|
-
maxRetries:
|
|
5096
|
+
blockOnError: _chunkYXP6WASHcjs.DEFAULT_BLOCK_ON_ERROR,
|
|
5097
|
+
maxRetries: _chunkYXP6WASHcjs.DEFAULT_MAX_RETRIES
|
|
5096
5098
|
}
|
|
5097
5099
|
}),
|
|
5098
5100
|
widened
|
|
@@ -5133,7 +5135,7 @@ function _projection(target) {
|
|
|
5133
5135
|
throw new Error(
|
|
5134
5136
|
`Projection "${target}" .of() partials must share one state name \u2014 got "${name}" and "${partial.name}"`
|
|
5135
5137
|
);
|
|
5136
|
-
const config2 =
|
|
5138
|
+
const config2 = _chunkYXP6WASHcjs.resolveFoldConfig.call(void 0, options);
|
|
5137
5139
|
const fold_events = {};
|
|
5138
5140
|
for (const partial of partials)
|
|
5139
5141
|
for (const [event_name, schema] of Object.entries(partial.events)) {
|
|
@@ -5151,8 +5153,8 @@ function _projection(target) {
|
|
|
5151
5153
|
handler: noop,
|
|
5152
5154
|
resolver: { target },
|
|
5153
5155
|
options: {
|
|
5154
|
-
blockOnError:
|
|
5155
|
-
maxRetries:
|
|
5156
|
+
blockOnError: _chunkYXP6WASHcjs.DEFAULT_BLOCK_ON_ERROR,
|
|
5157
|
+
maxRetries: _chunkYXP6WASHcjs.DEFAULT_MAX_RETRIES
|
|
5156
5158
|
}
|
|
5157
5159
|
}
|
|
5158
5160
|
]
|
|
@@ -5268,7 +5270,7 @@ function action_builder(state2) {
|
|
|
5268
5270
|
throw new Error(`Duplicate action "${action2}"`);
|
|
5269
5271
|
internal.actions[action2] = schema;
|
|
5270
5272
|
if (options) {
|
|
5271
|
-
|
|
5273
|
+
_chunkYXP6WASHcjs.resolveActionConfig.call(void 0, options);
|
|
5272
5274
|
internal.options ??= {};
|
|
5273
5275
|
internal.options[action2] = options;
|
|
5274
5276
|
}
|
|
@@ -5407,10 +5409,8 @@ var CsvFile = class {
|
|
|
5407
5409
|
const event = {
|
|
5408
5410
|
id: Number.parseInt(fields[0], 10),
|
|
5409
5411
|
name: fields[1],
|
|
5410
|
-
//
|
|
5411
|
-
//
|
|
5412
|
-
// through a CSV restore. The `created` column below has
|
|
5413
|
-
// always been parsed explicitly; the JSON columns were missed.
|
|
5412
|
+
// Plain JSON, as every store returns it: a date in `data` stays its
|
|
5413
|
+
// ISO string here, and a load revives it from the event's schema.
|
|
5414
5414
|
data: JSON.parse(fields[2]),
|
|
5415
5415
|
stream: fields[3],
|
|
5416
5416
|
version: Number.parseInt(fields[4], 10),
|
|
@@ -5548,10 +5548,10 @@ var ExitCodes2 = _chunkQFYPSI6Pcjs.ExitCodes;
|
|
|
5548
5548
|
var DEFAULT_LANE2 = _chunkQFYPSI6Pcjs.DEFAULT_LANE;
|
|
5549
5549
|
var DEFAULT_MAX_SUBSCRIBED_STREAMS2 = _chunkQFYPSI6Pcjs.DEFAULT_MAX_SUBSCRIBED_STREAMS;
|
|
5550
5550
|
var DEFAULT_SETTLE_DEBOUNCE_MS2 = _chunkQFYPSI6Pcjs.DEFAULT_SETTLE_DEBOUNCE_MS;
|
|
5551
|
-
var PackageSchema =
|
|
5552
|
-
var default_scope =
|
|
5553
|
-
var resolveAutocloseConfig2 =
|
|
5554
|
-
var extend = (source, schema, target) => ({ ...target, ...
|
|
5551
|
+
var PackageSchema = _chunkYXP6WASHcjs.package_schema;
|
|
5552
|
+
var default_scope = _chunkYXP6WASHcjs.unscoped_ports;
|
|
5553
|
+
var resolveAutocloseConfig2 = _chunkYXP6WASHcjs.resolveAutocloseConfig;
|
|
5554
|
+
var extend = (source, schema, target) => ({ ...target, ..._chunkYXP6WASHcjs.validate.call(void 0, "config", source, schema) });
|
|
5555
5555
|
var ISO_8601 = /^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])T([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])(\.\d+)?(Z|[+-][0-2][0-9]:[0-5][0-9])?$/;
|
|
5556
5556
|
var dateReviver = (_key, value) => typeof value === "string" && ISO_8601.test(value) ? new Date(value) : value;
|
|
5557
5557
|
|
|
@@ -5614,5 +5614,5 @@ var dateReviver = (_key, value) => typeof value === "string" && ISO_8601.test(va
|
|
|
5614
5614
|
|
|
5615
5615
|
|
|
5616
5616
|
|
|
5617
|
-
exports.Act = Act; exports.ActorSchema = ActorSchema2; exports.CausationEventSchema = CausationEventSchema2; exports.CommittedMetaSchema = CommittedMetaSchema2; exports.ConcurrencyError = _chunkQFYPSI6Pcjs.ConcurrencyError; exports.ConsoleLogger =
|
|
5617
|
+
exports.Act = Act; exports.ActorSchema = ActorSchema2; exports.CausationEventSchema = CausationEventSchema2; exports.CommittedMetaSchema = CommittedMetaSchema2; exports.ConcurrencyError = _chunkQFYPSI6Pcjs.ConcurrencyError; exports.ConsoleLogger = _chunkYXP6WASHcjs.ConsoleLogger; exports.CsvFile = CsvFile; exports.DEFAULT_LANE = DEFAULT_LANE2; exports.DEFAULT_MAX_SUBSCRIBED_STREAMS = DEFAULT_MAX_SUBSCRIBED_STREAMS2; exports.DEFAULT_QUERY_STREAMS_LIMIT = DEFAULT_QUERY_STREAMS_LIMIT2; exports.DEFAULT_SETTLE_DEBOUNCE_MS = DEFAULT_SETTLE_DEBOUNCE_MS2; exports.DeferSignal = _chunkQFYPSI6Pcjs.DeferSignal; exports.Environments = Environments2; exports.Errors = _chunkQFYPSI6Pcjs.Errors; exports.EventMetaSchema = EventMetaSchema2; exports.ExitCodes = ExitCodes2; exports.InMemoryCache = _chunkYXP6WASHcjs.InMemoryCache; exports.InMemoryStore = _chunkYXP6WASHcjs.InMemoryStore; exports.LogLevels = LogLevels2; exports.NonRetryableError = _chunkQFYPSI6Pcjs.NonRetryableError; exports.PackageSchema = PackageSchema; exports.PreconditionError = _chunkQFYPSI6Pcjs.PreconditionError; exports.QuerySchema = QuerySchema2; exports.REDACTED = _chunkQFYPSI6Pcjs.REDACTED; exports.SHREDDED = _chunkQFYPSI6Pcjs.SHREDDED; exports.SNAP_EVENT = _chunkQFYPSI6Pcjs.SNAP_EVENT; exports.StoreError = _chunkQFYPSI6Pcjs.StoreError; exports.StreamClosedError = _chunkQFYPSI6Pcjs.StreamClosedError; exports.TOMBSTONE_EVENT = _chunkQFYPSI6Pcjs.TOMBSTONE_EVENT; exports.TargetSchema = TargetSchema2; exports.ValidationError = _chunkQFYPSI6Pcjs.ValidationError; exports.ZodEmpty = _chunkQFYPSI6Pcjs.ZodEmpty; exports.act = act; exports.cache = _chunkYXP6WASHcjs.cache; exports.check_appends = check_appends; exports.concurrency_error = concurrency_error; exports.config = _chunkYXP6WASHcjs.config; exports.dateReviver = dateReviver; exports.default_scope = default_scope; exports.dispose = _chunkYXP6WASHcjs.dispose; exports.disposeAndExit = _chunkYXP6WASHcjs.disposeAndExit; exports.extend = extend; exports.fair_slots = fair_slots; exports.is_literal_source = is_literal_source; exports.log = _chunkYXP6WASHcjs.log; exports.notification_of = notification_of; exports.pii_fields = _chunkQFYPSI6Pcjs.pii_fields; exports.port = _chunkYXP6WASHcjs.port; exports.projection = projection; exports.resolveAutocloseConfig = resolveAutocloseConfig2; exports.seed_event = seed_event; exports.sensitive = _chunkQFYPSI6Pcjs.sensitive; exports.sensitiveFields = _chunkQFYPSI6Pcjs.sensitiveFields; exports.sleep = _chunkYXP6WASHcjs.sleep; exports.slice = slice; exports.state = state; exports.store = _chunkYXP6WASHcjs.store; exports.throw_if_stale = throw_if_stale; exports.validate = _chunkYXP6WASHcjs.validate;
|
|
5618
5618
|
//# sourceMappingURL=index.cjs.map
|