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