@rotorsoft/act 2.2.2 → 2.2.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/dist/.tsbuildinfo +1 -1
- package/dist/@types/act.d.ts +3 -3
- package/dist/@types/act.d.ts.map +1 -1
- package/dist/@types/internal/config.d.ts +2 -2
- package/dist/@types/internal/config.d.ts.map +1 -1
- package/dist/@types/internal/defer-timer.d.ts +5 -0
- package/dist/@types/internal/defer-timer.d.ts.map +1 -1
- package/dist/@types/types/ports.d.ts +3 -3
- package/dist/@types/types/reaction.d.ts +2 -2
- package/dist/adapter.cjs +3 -3
- package/dist/adapter.js +2 -2
- package/dist/{chunk-LHSNV3VN.js → chunk-2CYRPAJN.js} +93 -11
- package/dist/chunk-2CYRPAJN.js.map +1 -0
- package/dist/{chunk-LA2BPKNS.cjs → chunk-4GA3CHQW.cjs} +1 -1
- package/dist/{chunk-LA2BPKNS.cjs.map → chunk-4GA3CHQW.cjs.map} +1 -1
- package/dist/{chunk-GHMCESJA.js → chunk-KTMIRM5Z.js} +2 -2
- package/dist/{chunk-KAUON2M3.js → chunk-ROC62MEU.js} +1 -1
- package/dist/{chunk-KAUON2M3.js.map → chunk-ROC62MEU.js.map} +1 -1
- package/dist/{chunk-K4FF6ZXO.cjs → chunk-XG3UD63Y.cjs} +146 -64
- package/dist/chunk-XG3UD63Y.cjs.map +1 -0
- package/dist/{chunk-QITJ63HG.cjs → chunk-XJZ2PKJH.cjs} +11 -11
- package/dist/{chunk-QITJ63HG.cjs.map → chunk-XJZ2PKJH.cjs.map} +1 -1
- package/dist/index.cjs +468 -544
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -84
- package/dist/index.js.map +1 -1
- package/dist/test/index.cjs +9 -9
- package/dist/test/index.js +3 -3
- package/dist/types/index.cjs +2 -2
- package/dist/types/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-K4FF6ZXO.cjs.map +0 -1
- package/dist/chunk-LHSNV3VN.js.map +0 -1
- /package/dist/{chunk-GHMCESJA.js.map → chunk-KTMIRM5Z.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6;
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6;
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
var _chunkK4FF6ZXOcjs = require('./chunk-K4FF6ZXO.cjs');
|
|
31
30
|
|
|
31
|
+
var _chunkXG3UD63Ycjs = require('./chunk-XG3UD63Y.cjs');
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
|
|
@@ -36,8 +36,8 @@ var _chunkK4FF6ZXOcjs = require('./chunk-K4FF6ZXO.cjs');
|
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
var _chunkQITJ63HGcjs = require('./chunk-QITJ63HG.cjs');
|
|
40
39
|
|
|
40
|
+
var _chunkXJZ2PKJHcjs = require('./chunk-XJZ2PKJH.cjs');
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
|
|
@@ -66,26 +66,27 @@ var _chunkQITJ63HGcjs = require('./chunk-QITJ63HG.cjs');
|
|
|
66
66
|
|
|
67
67
|
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
|
|
70
|
+
var _chunk4GA3CHQWcjs = require('./chunk-4GA3CHQW.cjs');
|
|
70
71
|
|
|
71
72
|
// src/signals.ts
|
|
72
73
|
process.once("SIGINT", async (arg) => {
|
|
73
|
-
|
|
74
|
-
await
|
|
74
|
+
_chunkXG3UD63Ycjs.log.call(void 0, ).info(arg, "SIGINT");
|
|
75
|
+
await _chunkXG3UD63Ycjs.disposeAndExit.call(void 0, "EXIT");
|
|
75
76
|
});
|
|
76
77
|
process.once("SIGTERM", async (arg) => {
|
|
77
|
-
|
|
78
|
-
await
|
|
78
|
+
_chunkXG3UD63Ycjs.log.call(void 0, ).info(arg, "SIGTERM");
|
|
79
|
+
await _chunkXG3UD63Ycjs.disposeAndExit.call(void 0, "EXIT");
|
|
79
80
|
});
|
|
80
81
|
process.once("uncaughtException", async (arg) => {
|
|
81
82
|
process.exitCode = 1;
|
|
82
|
-
|
|
83
|
-
await
|
|
83
|
+
_chunkXG3UD63Ycjs.log.call(void 0, ).error(arg, "Uncaught Exception");
|
|
84
|
+
await _chunkXG3UD63Ycjs.disposeAndExit.call(void 0, "ERROR");
|
|
84
85
|
});
|
|
85
86
|
process.once("unhandledRejection", async (arg) => {
|
|
86
87
|
process.exitCode = 1;
|
|
87
|
-
|
|
88
|
-
await
|
|
88
|
+
_chunkXG3UD63Ycjs.log.call(void 0, ).error(arg, "Unhandled Rejection");
|
|
89
|
+
await _chunkXG3UD63Ycjs.disposeAndExit.call(void 0, "ERROR");
|
|
89
90
|
});
|
|
90
91
|
|
|
91
92
|
// src/act.ts
|
|
@@ -101,7 +102,7 @@ function parse(name) {
|
|
|
101
102
|
}
|
|
102
103
|
return { base: name, version: 1 };
|
|
103
104
|
}
|
|
104
|
-
|
|
105
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, parse, "parse");
|
|
105
106
|
function deprecated_event_names(names) {
|
|
106
107
|
const groups = /* @__PURE__ */ new Map();
|
|
107
108
|
for (const name of names) {
|
|
@@ -127,7 +128,7 @@ function deprecated_event_names(names) {
|
|
|
127
128
|
}
|
|
128
129
|
return deprecated;
|
|
129
130
|
}
|
|
130
|
-
|
|
131
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, deprecated_event_names, "deprecated_event_names");
|
|
131
132
|
function current_version_of(deprecated_name, all_names) {
|
|
132
133
|
const target = parse(deprecated_name);
|
|
133
134
|
let highest;
|
|
@@ -138,7 +139,7 @@ function current_version_of(deprecated_name, all_names) {
|
|
|
138
139
|
}
|
|
139
140
|
return highest && highest.version > target.version ? highest.name : void 0;
|
|
140
141
|
}
|
|
141
|
-
|
|
142
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, current_version_of, "current_version_of");
|
|
142
143
|
|
|
143
144
|
// src/internal/walk-streams.ts
|
|
144
145
|
var DEFAULT_STREAM_PAGE = 500;
|
|
@@ -160,7 +161,7 @@ async function walk_streams(store2, callback, query) {
|
|
|
160
161
|
after = last;
|
|
161
162
|
}
|
|
162
163
|
}
|
|
163
|
-
|
|
164
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, walk_streams, "walk_streams");
|
|
164
165
|
|
|
165
166
|
// src/internal/audit.ts
|
|
166
167
|
var DEFAULTS = {
|
|
@@ -197,7 +198,7 @@ async function* audit(deps, categories, options = {}) {
|
|
|
197
198
|
if (need_stats) {
|
|
198
199
|
const stats = await deps.store().query_stats(
|
|
199
200
|
{},
|
|
200
|
-
{ count: true, names: true, exclude: [
|
|
201
|
+
{ count: true, names: true, exclude: [_chunk4GA3CHQWcjs.SNAP_EVENT] }
|
|
201
202
|
);
|
|
202
203
|
for (const [stream, s] of stats) {
|
|
203
204
|
for (const p of passes) _optionalChain([p, 'access', _4 => _4.on_stat, 'optionalCall', _5 => _5(stream, s)]);
|
|
@@ -225,7 +226,7 @@ async function* audit(deps, categories, options = {}) {
|
|
|
225
226
|
for (const f of p.drain()) yield f;
|
|
226
227
|
}
|
|
227
228
|
}
|
|
228
|
-
|
|
229
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, audit, "audit");
|
|
229
230
|
async function scan_events_resiliently(deps, query, on_event, on_unreadable) {
|
|
230
231
|
let cursor = _optionalChain([query, 'optionalAccess', _14 => _14.after]);
|
|
231
232
|
let remaining = _optionalChain([query, 'optionalAccess', _15 => _15.limit]);
|
|
@@ -261,8 +262,8 @@ async function scan_events_resiliently(deps, query, on_event, on_unreadable) {
|
|
|
261
262
|
}
|
|
262
263
|
}
|
|
263
264
|
}
|
|
264
|
-
|
|
265
|
-
var make_schema_pass = /* @__PURE__ */
|
|
265
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, scan_events_resiliently, "scan_events_resiliently");
|
|
266
|
+
var make_schema_pass = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (deps) => {
|
|
266
267
|
const findings = [];
|
|
267
268
|
return {
|
|
268
269
|
category: "schema",
|
|
@@ -305,10 +306,10 @@ var make_schema_pass = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (de
|
|
|
305
306
|
});
|
|
306
307
|
}
|
|
307
308
|
},
|
|
308
|
-
drain: /* @__PURE__ */
|
|
309
|
+
drain: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => findings, "drain")
|
|
309
310
|
};
|
|
310
311
|
}, "make_schema_pass");
|
|
311
|
-
var classify_deprecated_by_state = /* @__PURE__ */
|
|
312
|
+
var classify_deprecated_by_state = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (deps) => {
|
|
312
313
|
const names_by_state = /* @__PURE__ */ new Map();
|
|
313
314
|
for (const [name, state2] of deps.event_to_state) {
|
|
314
315
|
let set = names_by_state.get(state2);
|
|
@@ -326,7 +327,7 @@ var classify_deprecated_by_state = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call
|
|
|
326
327
|
}
|
|
327
328
|
return deprecated_to_current;
|
|
328
329
|
}, "classify_deprecated_by_state");
|
|
329
|
-
var make_deprecated_load_pass = /* @__PURE__ */
|
|
330
|
+
var make_deprecated_load_pass = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (deps, options) => {
|
|
330
331
|
const share_min = _nullishCoalesce(_optionalChain([options, 'access', _17 => _17.thresholds, 'optionalAccess', _18 => _18.deprecated_min]), () => ( DEFAULTS.deprecated_min));
|
|
331
332
|
const totals = /* @__PURE__ */ new Map();
|
|
332
333
|
const per_stream = /* @__PURE__ */ new Map();
|
|
@@ -366,7 +367,7 @@ var make_deprecated_load_pass = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(vo
|
|
|
366
367
|
}
|
|
367
368
|
};
|
|
368
369
|
}, "make_deprecated_load_pass");
|
|
369
|
-
var make_close_candidate_pass = /* @__PURE__ */
|
|
370
|
+
var make_close_candidate_pass = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (deps, options) => {
|
|
370
371
|
const idle_days = _nullishCoalesce(_optionalChain([options, 'access', _19 => _19.thresholds, 'optionalAccess', _20 => _20.idle_days]), () => ( DEFAULTS.idle_days));
|
|
371
372
|
const terminal_events = new Set(_nullishCoalesce(_optionalChain([options, 'access', _21 => _21.thresholds, 'optionalAccess', _22 => _22.terminal_events]), () => ( [])));
|
|
372
373
|
const idle_cutoff = Date.now() - idle_days * 24 * 60 * 60 * 1e3;
|
|
@@ -389,10 +390,10 @@ var make_close_candidate_pass = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(vo
|
|
|
389
390
|
restart_supported: restart_is_supported(deps, head_name)
|
|
390
391
|
});
|
|
391
392
|
},
|
|
392
|
-
drain: /* @__PURE__ */
|
|
393
|
+
drain: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => findings, "drain")
|
|
393
394
|
};
|
|
394
395
|
}, "make_close_candidate_pass");
|
|
395
|
-
var make_restart_candidate_pass = /* @__PURE__ */
|
|
396
|
+
var make_restart_candidate_pass = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (deps, options) => {
|
|
396
397
|
const threshold = _nullishCoalesce(_optionalChain([options, 'access', _23 => _23.thresholds, 'optionalAccess', _24 => _24.restart_min]), () => ( DEFAULTS.restart_min));
|
|
397
398
|
const candidates = [];
|
|
398
399
|
const findings = [];
|
|
@@ -415,7 +416,7 @@ var make_restart_candidate_pass = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(
|
|
|
415
416
|
{
|
|
416
417
|
stream,
|
|
417
418
|
stream_exact: true,
|
|
418
|
-
names: [
|
|
419
|
+
names: [_chunk4GA3CHQWcjs.SNAP_EVENT],
|
|
419
420
|
with_snaps: true,
|
|
420
421
|
// From the start: on its own, `with_snaps` resumes at the latest.
|
|
421
422
|
after: -1
|
|
@@ -429,10 +430,10 @@ var make_restart_candidate_pass = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(
|
|
|
429
430
|
});
|
|
430
431
|
}
|
|
431
432
|
},
|
|
432
|
-
drain: /* @__PURE__ */
|
|
433
|
+
drain: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => findings, "drain")
|
|
433
434
|
};
|
|
434
435
|
}, "make_restart_candidate_pass");
|
|
435
|
-
var make_reaction_health_pass = /* @__PURE__ */
|
|
436
|
+
var make_reaction_health_pass = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (_deps, options) => {
|
|
436
437
|
const near_block = _nullishCoalesce(_optionalChain([options, 'access', _25 => _25.thresholds, 'optionalAccess', _26 => _26.near_block]), () => ( DEFAULTS.near_block));
|
|
437
438
|
const stuck_minutes = _nullishCoalesce(_optionalChain([options, 'access', _27 => _27.thresholds, 'optionalAccess', _28 => _28.stuck_minutes]), () => ( DEFAULTS.stuck_minutes));
|
|
438
439
|
const stuck_cutoff = Date.now() - stuck_minutes * 60 * 1e3;
|
|
@@ -473,10 +474,10 @@ var make_reaction_health_pass = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(vo
|
|
|
473
474
|
});
|
|
474
475
|
}
|
|
475
476
|
},
|
|
476
|
-
drain: /* @__PURE__ */
|
|
477
|
+
drain: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => findings, "drain")
|
|
477
478
|
};
|
|
478
479
|
}, "make_reaction_health_pass");
|
|
479
|
-
var make_snapshot_drift_pass = /* @__PURE__ */
|
|
480
|
+
var make_snapshot_drift_pass = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (deps, options) => {
|
|
480
481
|
const drift_min = _nullishCoalesce(_optionalChain([options, 'access', _29 => _29.thresholds, 'optionalAccess', _30 => _30.drift_min]), () => ( DEFAULTS.drift_min));
|
|
481
482
|
const candidates = [];
|
|
482
483
|
const findings = [];
|
|
@@ -528,10 +529,10 @@ var make_snapshot_drift_pass = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(voi
|
|
|
528
529
|
});
|
|
529
530
|
}
|
|
530
531
|
},
|
|
531
|
-
drain: /* @__PURE__ */
|
|
532
|
+
drain: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => findings, "drain")
|
|
532
533
|
};
|
|
533
534
|
}, "make_snapshot_drift_pass");
|
|
534
|
-
var make_routing_health_pass = /* @__PURE__ */
|
|
535
|
+
var make_routing_health_pass = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (deps) => {
|
|
535
536
|
const findings = [];
|
|
536
537
|
const seen_event_names = /* @__PURE__ */ new Set();
|
|
537
538
|
return {
|
|
@@ -563,10 +564,10 @@ var make_routing_health_pass = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(voi
|
|
|
563
564
|
}
|
|
564
565
|
return Promise.resolve();
|
|
565
566
|
},
|
|
566
|
-
drain: /* @__PURE__ */
|
|
567
|
+
drain: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => findings, "drain")
|
|
567
568
|
};
|
|
568
569
|
}, "make_routing_health_pass");
|
|
569
|
-
var make_correlation_gaps_pass = /* @__PURE__ */
|
|
570
|
+
var make_correlation_gaps_pass = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => {
|
|
570
571
|
const seen_ids = /* @__PURE__ */ new Set();
|
|
571
572
|
const checks = [];
|
|
572
573
|
return {
|
|
@@ -575,7 +576,7 @@ var make_correlation_gaps_pass = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(v
|
|
|
575
576
|
seen_ids.add(e.id);
|
|
576
577
|
const causation = _optionalChain([e, 'access', _31 => _31.meta, 'optionalAccess', _32 => _32.causation]);
|
|
577
578
|
const parent_id = _optionalChain([causation, 'optionalAccess', _33 => _33.event, 'optionalAccess', _34 => _34.id]);
|
|
578
|
-
if (parent_id !== void 0 && e.name !==
|
|
579
|
+
if (parent_id !== void 0 && e.name !== _chunk4GA3CHQWcjs.TOMBSTONE_EVENT) {
|
|
579
580
|
checks.push({ stream: e.stream, id: e.id, parent_id });
|
|
580
581
|
}
|
|
581
582
|
},
|
|
@@ -595,7 +596,7 @@ var make_correlation_gaps_pass = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(v
|
|
|
595
596
|
}
|
|
596
597
|
};
|
|
597
598
|
}, "make_correlation_gaps_pass");
|
|
598
|
-
var make_clock_anomalies_pass = /* @__PURE__ */
|
|
599
|
+
var make_clock_anomalies_pass = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => {
|
|
599
600
|
const findings = [];
|
|
600
601
|
const last_per_stream = /* @__PURE__ */ new Map();
|
|
601
602
|
return {
|
|
@@ -621,14 +622,14 @@ var make_clock_anomalies_pass = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(vo
|
|
|
621
622
|
}
|
|
622
623
|
last_per_stream.set(e.stream, created);
|
|
623
624
|
},
|
|
624
|
-
drain: /* @__PURE__ */
|
|
625
|
+
drain: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => findings, "drain")
|
|
625
626
|
};
|
|
626
627
|
}, "make_clock_anomalies_pass");
|
|
627
628
|
function restart_is_supported(deps, head_event_name) {
|
|
628
629
|
const state2 = deps.event_to_state.get(head_event_name);
|
|
629
630
|
return _optionalChain([state2, 'optionalAccess', _35 => _35.snap]) !== void 0;
|
|
630
631
|
}
|
|
631
|
-
|
|
632
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, restart_is_supported, "restart_is_supported");
|
|
632
633
|
function make_unreadable_events_pass() {
|
|
633
634
|
const findings = [];
|
|
634
635
|
return {
|
|
@@ -642,10 +643,10 @@ function make_unreadable_events_pass() {
|
|
|
642
643
|
error
|
|
643
644
|
});
|
|
644
645
|
},
|
|
645
|
-
drain: /* @__PURE__ */
|
|
646
|
+
drain: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => findings, "drain")
|
|
646
647
|
};
|
|
647
648
|
}
|
|
648
|
-
|
|
649
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, make_unreadable_events_pass, "make_unreadable_events_pass");
|
|
649
650
|
var PASS_FACTORIES = {
|
|
650
651
|
schema: make_schema_pass,
|
|
651
652
|
"deprecated-load": make_deprecated_load_pass,
|
|
@@ -662,7 +663,7 @@ var PASS_FACTORIES = {
|
|
|
662
663
|
// src/internal/circuit-breaker.ts
|
|
663
664
|
var CircuitBreaker = (_class = class {
|
|
664
665
|
static {
|
|
665
|
-
|
|
666
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, this, "CircuitBreaker");
|
|
666
667
|
}
|
|
667
668
|
__init() {this._failures = 0}
|
|
668
669
|
|
|
@@ -755,7 +756,7 @@ var CircuitBreaker = (_class = class {
|
|
|
755
756
|
|
|
756
757
|
// src/internal/classify.ts
|
|
757
758
|
var ALL_LANES = /* @__PURE__ */ Symbol("act/all-lanes");
|
|
758
|
-
var describe_source = /* @__PURE__ */
|
|
759
|
+
var describe_source = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (source) => source === void 0 ? "no source (every stream)" : `"${source}"`, "describe_source");
|
|
759
760
|
function classify_registry(registry, states) {
|
|
760
761
|
const statics = /* @__PURE__ */ new Map();
|
|
761
762
|
const target_lanes = /* @__PURE__ */ new Map();
|
|
@@ -806,43 +807,43 @@ function classify_registry(registry, states) {
|
|
|
806
807
|
event_to_lanes
|
|
807
808
|
};
|
|
808
809
|
}
|
|
809
|
-
|
|
810
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, classify_registry, "classify_registry");
|
|
810
811
|
|
|
811
812
|
// src/internal/autoclose-policy.ts
|
|
812
813
|
var DAY_MS = 864e5;
|
|
813
814
|
function days_after(date, days) {
|
|
814
815
|
return new Date(date.getTime() + days * DAY_MS);
|
|
815
816
|
}
|
|
816
|
-
|
|
817
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, days_after, "days_after");
|
|
817
818
|
function days_before_now(days) {
|
|
818
819
|
return new Date(Date.now() - days * DAY_MS);
|
|
819
820
|
}
|
|
820
|
-
|
|
821
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, days_before_now, "days_before_now");
|
|
821
822
|
function compile_after(after) {
|
|
822
823
|
return (_stream, head) => days_after(head.created, after.days) <= /* @__PURE__ */ new Date();
|
|
823
824
|
}
|
|
824
|
-
|
|
825
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, compile_after, "compile_after");
|
|
825
826
|
function compile_is(is) {
|
|
826
827
|
const set = new Set(typeof is === "string" ? [is] : is);
|
|
827
828
|
return (_stream, head) => set.has(head.name);
|
|
828
829
|
}
|
|
829
|
-
|
|
830
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, compile_is, "compile_is");
|
|
830
831
|
function compile_reaches(reaches) {
|
|
831
832
|
return (_stream, _head, count) => count >= reaches;
|
|
832
833
|
}
|
|
833
|
-
|
|
834
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, compile_reaches, "compile_reaches");
|
|
834
835
|
function policy_after_windows(options) {
|
|
835
|
-
const parsed =
|
|
836
|
+
const parsed = _chunkXG3UD63Ycjs.check.call(void 0, "autoclose_policy", options);
|
|
836
837
|
return [parsed.after, _optionalChain([parsed, 'access', _42 => _42.or, 'optionalAccess', _43 => _43.after])].flatMap((w) => w ? [w.days] : []);
|
|
837
838
|
}
|
|
838
|
-
|
|
839
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, policy_after_windows, "policy_after_windows");
|
|
839
840
|
function policy_keep_days(options) {
|
|
840
|
-
const parsed =
|
|
841
|
+
const parsed = _chunkXG3UD63Ycjs.check.call(void 0, "autoclose_policy", options);
|
|
841
842
|
return _optionalChain([parsed, 'access', _44 => _44.keep, 'optionalAccess', _45 => _45.days]);
|
|
842
843
|
}
|
|
843
|
-
|
|
844
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, policy_keep_days, "policy_keep_days");
|
|
844
845
|
function compile_autoclose_policy(options) {
|
|
845
|
-
const parsed =
|
|
846
|
+
const parsed = _chunkXG3UD63Ycjs.check.call(void 0, "autoclose_policy", options);
|
|
846
847
|
const and_preds = [];
|
|
847
848
|
if (parsed.after) and_preds.push(compile_after(parsed.after));
|
|
848
849
|
if (parsed.is) and_preds.push(compile_is(parsed.is));
|
|
@@ -863,7 +864,7 @@ function compile_autoclose_policy(options) {
|
|
|
863
864
|
return false;
|
|
864
865
|
};
|
|
865
866
|
}
|
|
866
|
-
|
|
867
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, compile_autoclose_policy, "compile_autoclose_policy");
|
|
867
868
|
|
|
868
869
|
// src/internal/autoclose-window.ts
|
|
869
870
|
function hour_in_zone(now, timeZone) {
|
|
@@ -874,24 +875,24 @@ function hour_in_zone(now, timeZone) {
|
|
|
874
875
|
}).formatToParts(now);
|
|
875
876
|
return Number(_optionalChain([parts, 'access', _46 => _46.find, 'call', _47 => _47((p) => p.type === "hour"), 'optionalAccess', _48 => _48.value]));
|
|
876
877
|
}
|
|
877
|
-
|
|
878
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, hour_in_zone, "hour_in_zone");
|
|
878
879
|
function hour_in_range(hour, start, end) {
|
|
879
880
|
return start < end ? hour >= start && hour < end : hour >= start || hour < end;
|
|
880
881
|
}
|
|
881
|
-
|
|
882
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, hour_in_range, "hour_in_range");
|
|
882
883
|
function is_dst_gap_open(now, timeZone, start) {
|
|
883
884
|
const hour = hour_in_zone(now, timeZone);
|
|
884
885
|
if (hour <= start) return false;
|
|
885
886
|
const prev = hour_in_zone(new Date(now.getTime() - 36e5), timeZone);
|
|
886
887
|
return prev === start - 1 && hour === start + 1;
|
|
887
888
|
}
|
|
888
|
-
|
|
889
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, is_dst_gap_open, "is_dst_gap_open");
|
|
889
890
|
function in_autoclose_window(window, now) {
|
|
890
891
|
if (!window) return true;
|
|
891
892
|
const hour = hour_in_zone(now, window.timeZone);
|
|
892
893
|
return hour_in_range(hour, window.start, window.end) || is_dst_gap_open(now, window.timeZone, window.start);
|
|
893
894
|
}
|
|
894
|
-
|
|
895
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, in_autoclose_window, "in_autoclose_window");
|
|
895
896
|
function next_window_open(window, now) {
|
|
896
897
|
const start_ms = now.getTime();
|
|
897
898
|
for (let h = 0; h <= 48; h++) {
|
|
@@ -906,30 +907,30 @@ function next_window_open(window, now) {
|
|
|
906
907
|
}
|
|
907
908
|
return new Date(start_ms + 864e5);
|
|
908
909
|
}
|
|
909
|
-
|
|
910
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, next_window_open, "next_window_open");
|
|
910
911
|
|
|
911
912
|
// src/internal/defer-config.ts
|
|
912
913
|
function duration_ms(d) {
|
|
913
914
|
return (_nullishCoalesce(d.days, () => ( 0))) * 864e5 + (_nullishCoalesce(d.hours, () => ( 0))) * 36e5 + (_nullishCoalesce(d.minutes, () => ( 0))) * 6e4;
|
|
914
915
|
}
|
|
915
|
-
|
|
916
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, duration_ms, "duration_ms");
|
|
916
917
|
function resolve_defer_at(when, event) {
|
|
917
|
-
const parsed =
|
|
918
|
+
const parsed = _chunkXG3UD63Ycjs.check.call(void 0, "defer", when);
|
|
918
919
|
if (parsed.after) return event.created.getTime() + duration_ms(parsed.after);
|
|
919
920
|
return parsed.at.getTime();
|
|
920
921
|
}
|
|
921
|
-
|
|
922
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, resolve_defer_at, "resolve_defer_at");
|
|
922
923
|
function make_deferred(handler, schedule) {
|
|
923
924
|
const call = handler;
|
|
924
|
-
const deferred = /* @__PURE__ */
|
|
925
|
+
const deferred = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, async (event, stream, app) => {
|
|
925
926
|
const when = typeof schedule === "function" ? schedule(event) : schedule;
|
|
926
|
-
if (Date.now() < resolve_defer_at(when, event)) throw new (0,
|
|
927
|
+
if (Date.now() < resolve_defer_at(when, event)) throw new (0, _chunk4GA3CHQWcjs.DeferSignal)(when);
|
|
927
928
|
return call(event, stream, app);
|
|
928
929
|
}, "deferred");
|
|
929
930
|
Object.defineProperty(deferred, "name", { value: handler.name });
|
|
930
931
|
return deferred;
|
|
931
932
|
}
|
|
932
|
-
|
|
933
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, make_deferred, "make_deferred");
|
|
933
934
|
|
|
934
935
|
// src/internal/drain-cycle.ts
|
|
935
936
|
var _crypto = require('crypto');
|
|
@@ -958,85 +959,7 @@ function compute_backoff_delay(retry, opts) {
|
|
|
958
959
|
if (opts.jitter) delay = delay * (0.5 + Math.random());
|
|
959
960
|
return Math.max(0, Math.floor(delay));
|
|
960
961
|
}
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
// src/internal/defer-timer.ts
|
|
964
|
-
var MAX_TIMER_DELAY_MS = 2147483647;
|
|
965
|
-
var DeferTimer = (_class2 = class {
|
|
966
|
-
static {
|
|
967
|
-
_chunkLA2BPKNScjs.__name.call(void 0, this, "DeferTimer");
|
|
968
|
-
}
|
|
969
|
-
__init2() {this._due = /* @__PURE__ */ new Map()}
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
/**
|
|
973
|
-
* @param on_wake - invoked once each time the earliest due-time elapses.
|
|
974
|
-
* The consumer re-schedules for whatever is still parked.
|
|
975
|
-
*/
|
|
976
|
-
constructor(on_wake) {;_class2.prototype.__init2.call(this);
|
|
977
|
-
this._on_wake = on_wake;
|
|
978
|
-
}
|
|
979
|
-
/** Number of currently parked streams. */
|
|
980
|
-
get size() {
|
|
981
|
-
return this._due.size;
|
|
982
|
-
}
|
|
983
|
-
/**
|
|
984
|
-
* Park `stream` for a re-visit at `at` (ms since epoch). A plain
|
|
985
|
-
* overwrite: the caller computes the authoritative next-visit for the
|
|
986
|
-
* stream (the drain's `handle` already reconciles a stream's reactions
|
|
987
|
-
* into one result per cycle), so there is no stale value to merge against.
|
|
988
|
-
*/
|
|
989
|
-
set(stream, at) {
|
|
990
|
-
this._due.set(stream, at);
|
|
991
|
-
}
|
|
992
|
-
/** Drop `stream` from the parked set (e.g. on a successful ack or block). */
|
|
993
|
-
delete(stream) {
|
|
994
|
-
this._due.delete(stream);
|
|
995
|
-
}
|
|
996
|
-
/**
|
|
997
|
-
* Drop every entry due at or before `before`. The drain calls it when a
|
|
998
|
-
* pass that started at `before` claimed nothing: whatever was due by then
|
|
999
|
-
* was handled elsewhere (another worker) or has no work left, so waking
|
|
1000
|
-
* for it again would spin.
|
|
1001
|
-
*/
|
|
1002
|
-
prune(before) {
|
|
1003
|
-
for (const [stream, at] of this._due)
|
|
1004
|
-
if (at <= before) this._due.delete(stream);
|
|
1005
|
-
}
|
|
1006
|
-
/**
|
|
1007
|
-
* (Re)schedule the wake timer at the earliest pending due-time. Idempotent
|
|
1008
|
-
* — collapses many parked streams into a single timer. A no-op clears any
|
|
1009
|
-
* pending timer when the map is empty.
|
|
1010
|
-
*
|
|
1011
|
-
* The timer is `unref()`-ed so pending re-visits never keep the process
|
|
1012
|
-
* alive on their own.
|
|
1013
|
-
*/
|
|
1014
|
-
schedule() {
|
|
1015
|
-
if (this._timer) clearTimeout(this._timer);
|
|
1016
|
-
if (this._due.size === 0) {
|
|
1017
|
-
this._timer = void 0;
|
|
1018
|
-
return;
|
|
1019
|
-
}
|
|
1020
|
-
let earliest = Number.POSITIVE_INFINITY;
|
|
1021
|
-
for (const t of this._due.values()) if (t < earliest) earliest = t;
|
|
1022
|
-
const delay = Math.min(
|
|
1023
|
-
Math.max(0, earliest - Date.now()),
|
|
1024
|
-
MAX_TIMER_DELAY_MS
|
|
1025
|
-
);
|
|
1026
|
-
this._timer = setTimeout(() => {
|
|
1027
|
-
this._timer = void 0;
|
|
1028
|
-
this._on_wake();
|
|
1029
|
-
}, delay);
|
|
1030
|
-
this._timer.unref();
|
|
1031
|
-
}
|
|
1032
|
-
/** Cancel any pending wake timer. Idempotent. Leaves the parked set intact. */
|
|
1033
|
-
stop() {
|
|
1034
|
-
if (this._timer) {
|
|
1035
|
-
clearTimeout(this._timer);
|
|
1036
|
-
this._timer = void 0;
|
|
1037
|
-
}
|
|
1038
|
-
}
|
|
1039
|
-
}, _class2);
|
|
962
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, compute_backoff_delay, "compute_backoff_delay");
|
|
1040
963
|
|
|
1041
964
|
// src/internal/drain-ratio.ts
|
|
1042
965
|
var RATIO_MIN = 0.2;
|
|
@@ -1055,15 +978,15 @@ function compute_lag_lead_ratio(handled, lagging, leading) {
|
|
|
1055
978
|
if (total === 0) return RATIO_DEFAULT;
|
|
1056
979
|
return Math.max(RATIO_MIN, Math.min(RATIO_MAX, lagging_avg / total));
|
|
1057
980
|
}
|
|
1058
|
-
|
|
981
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, compute_lag_lead_ratio, "compute_lag_lead_ratio");
|
|
1059
982
|
|
|
1060
983
|
// src/internal/report-once.ts
|
|
1061
984
|
function report_once(seen, key, message) {
|
|
1062
985
|
if (seen.has(key)) return;
|
|
1063
986
|
seen.add(key);
|
|
1064
|
-
|
|
987
|
+
_chunkXG3UD63Ycjs.log.call(void 0, ).error(new Error(message));
|
|
1065
988
|
}
|
|
1066
|
-
|
|
989
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, report_once, "report_once");
|
|
1067
990
|
|
|
1068
991
|
// src/internal/correlation-id.ts
|
|
1069
992
|
|
|
@@ -1073,8 +996,8 @@ var SEG_SPACE = BASE ** SEG_WIDTH;
|
|
|
1073
996
|
function seg(n) {
|
|
1074
997
|
return n.toString(BASE).padStart(SEG_WIDTH, "0");
|
|
1075
998
|
}
|
|
1076
|
-
|
|
1077
|
-
var default_correlator = /* @__PURE__ */
|
|
999
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, seg, "seg");
|
|
1000
|
+
var default_correlator = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, ({ state: state2, action: action2 }) => {
|
|
1078
1001
|
const s = state2.slice(0, SEG_WIDTH).toLowerCase();
|
|
1079
1002
|
const a = action2.slice(0, SEG_WIDTH).toLowerCase();
|
|
1080
1003
|
const ts = seg(Date.now() % SEG_SPACE);
|
|
@@ -1089,17 +1012,17 @@ function close_correlation(correlator, actor) {
|
|
|
1089
1012
|
actor
|
|
1090
1013
|
});
|
|
1091
1014
|
}
|
|
1092
|
-
|
|
1015
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, close_correlation, "close_correlation");
|
|
1093
1016
|
|
|
1094
1017
|
// src/internal/drain-ops.ts
|
|
1095
|
-
var claim = /* @__PURE__ */
|
|
1018
|
+
var claim = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (lagging, leading, by, millis, lane) => _chunkXG3UD63Ycjs.store.call(void 0, ).claim(lagging, leading, by, millis, lane), "claim");
|
|
1096
1019
|
async function fetch(leased, eventLimit) {
|
|
1097
1020
|
return Promise.all(
|
|
1098
1021
|
leased.map(async ({ stream, source, at, lagging }) => {
|
|
1099
1022
|
const events = [];
|
|
1100
|
-
const stream_exact = source !== void 0 &&
|
|
1023
|
+
const stream_exact = source !== void 0 && _chunkXJZ2PKJHcjs.isStreamName.call(void 0, source, stream) ? true : void 0;
|
|
1101
1024
|
try {
|
|
1102
|
-
await
|
|
1025
|
+
await _chunkXG3UD63Ycjs.store.call(void 0, ).query((e) => events.push(e), {
|
|
1103
1026
|
stream: source,
|
|
1104
1027
|
stream_exact,
|
|
1105
1028
|
after: at,
|
|
@@ -1119,10 +1042,10 @@ async function fetch(leased, eventLimit) {
|
|
|
1119
1042
|
})
|
|
1120
1043
|
);
|
|
1121
1044
|
}
|
|
1122
|
-
|
|
1123
|
-
var ack = /* @__PURE__ */
|
|
1124
|
-
var block = /* @__PURE__ */
|
|
1125
|
-
var subscribe = /* @__PURE__ */
|
|
1045
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, fetch, "fetch");
|
|
1046
|
+
var ack = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (leases) => _chunkXG3UD63Ycjs.store.call(void 0, ).ack(leases), "ack");
|
|
1047
|
+
var block = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (leases) => _chunkXG3UD63Ycjs.store.call(void 0, ).block(leases), "block");
|
|
1048
|
+
var subscribe = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (streams, correlated_at, correlator) => _chunkXG3UD63Ycjs.store.call(void 0, ).subscribe(streams, correlated_at, correlator), "subscribe");
|
|
1126
1049
|
|
|
1127
1050
|
// src/internal/event-sourcing.ts
|
|
1128
1051
|
var _actpatch = require('@rotorsoft/act-patch');
|
|
@@ -1132,7 +1055,7 @@ var _zod2 = require('zod');
|
|
|
1132
1055
|
|
|
1133
1056
|
|
|
1134
1057
|
// src/internal/zod.ts
|
|
1135
|
-
var def_of = /* @__PURE__ */
|
|
1058
|
+
var def_of = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (schema) => _optionalChain([schema, 'optionalAccess', _50 => _50._zod, 'optionalAccess', _51 => _51.def]), "def_of");
|
|
1136
1059
|
var SINGLE_INNER = [
|
|
1137
1060
|
"optional",
|
|
1138
1061
|
"nullable",
|
|
@@ -1142,7 +1065,7 @@ var SINGLE_INNER = [
|
|
|
1142
1065
|
"readonly",
|
|
1143
1066
|
"catch"
|
|
1144
1067
|
];
|
|
1145
|
-
var inner_of = /* @__PURE__ */
|
|
1068
|
+
var inner_of = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (def) => SINGLE_INNER.includes(def.type) ? def.innerType : void 0, "inner_of");
|
|
1146
1069
|
function wrapped(schema) {
|
|
1147
1070
|
const def = def_of(schema);
|
|
1148
1071
|
if (!def) return [];
|
|
@@ -1151,15 +1074,15 @@ function wrapped(schema) {
|
|
|
1151
1074
|
const inner = inner_of(def);
|
|
1152
1075
|
return inner ? [inner] : [];
|
|
1153
1076
|
}
|
|
1154
|
-
|
|
1077
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, wrapped, "wrapped");
|
|
1155
1078
|
function parts_of(schema) {
|
|
1156
1079
|
const def = def_of(schema);
|
|
1157
1080
|
return _optionalChain([def, 'optionalAccess', _52 => _52.type]) === "intersection" ? [def.left, def.right] : wrapped(schema);
|
|
1158
1081
|
}
|
|
1159
|
-
|
|
1082
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, parts_of, "parts_of");
|
|
1160
1083
|
function some_layer(schema, test) {
|
|
1161
1084
|
const seen = /* @__PURE__ */ new Set();
|
|
1162
|
-
const visit = /* @__PURE__ */
|
|
1085
|
+
const visit = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (s) => {
|
|
1163
1086
|
if (seen.has(s)) return false;
|
|
1164
1087
|
seen.add(s);
|
|
1165
1088
|
const def = def_of(s);
|
|
@@ -1167,7 +1090,7 @@ function some_layer(schema, test) {
|
|
|
1167
1090
|
}, "visit");
|
|
1168
1091
|
return visit(schema);
|
|
1169
1092
|
}
|
|
1170
|
-
|
|
1093
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, some_layer, "some_layer");
|
|
1171
1094
|
function output_of(schema) {
|
|
1172
1095
|
const seen = /* @__PURE__ */ new Set();
|
|
1173
1096
|
let cur = schema;
|
|
@@ -1181,7 +1104,7 @@ function output_of(schema) {
|
|
|
1181
1104
|
}
|
|
1182
1105
|
return cur;
|
|
1183
1106
|
}
|
|
1184
|
-
|
|
1107
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, output_of, "output_of");
|
|
1185
1108
|
|
|
1186
1109
|
// src/internal/date-reviver.ts
|
|
1187
1110
|
function variant_schema(schema, walk) {
|
|
@@ -1199,13 +1122,13 @@ function variant_schema(schema, walk) {
|
|
|
1199
1122
|
}
|
|
1200
1123
|
return { schema: _zod2.z.looseObject(next), dated };
|
|
1201
1124
|
}
|
|
1202
|
-
|
|
1125
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, variant_schema, "variant_schema");
|
|
1203
1126
|
function date_reviver_schema(schema) {
|
|
1204
1127
|
let recursive = false;
|
|
1205
|
-
const pass = /* @__PURE__ */
|
|
1128
|
+
const pass = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (tie) => {
|
|
1206
1129
|
const done = /* @__PURE__ */ new Map();
|
|
1207
1130
|
const active = /* @__PURE__ */ new Set();
|
|
1208
|
-
const walk = /* @__PURE__ */
|
|
1131
|
+
const walk = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (node) => {
|
|
1209
1132
|
if (done.has(node)) return done.get(node);
|
|
1210
1133
|
if (active.has(node)) {
|
|
1211
1134
|
recursive = true;
|
|
@@ -1222,11 +1145,11 @@ function date_reviver_schema(schema) {
|
|
|
1222
1145
|
const first = pass(false);
|
|
1223
1146
|
return first && recursive ? pass(true) : first;
|
|
1224
1147
|
}
|
|
1225
|
-
|
|
1148
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, date_reviver_schema, "date_reviver_schema");
|
|
1226
1149
|
function build(schema, walk) {
|
|
1227
1150
|
const def = def_of(schema);
|
|
1228
1151
|
if (!def) return void 0;
|
|
1229
|
-
const inner = /* @__PURE__ */
|
|
1152
|
+
const inner = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => walk(def.innerType), "inner");
|
|
1230
1153
|
switch (def.type) {
|
|
1231
1154
|
case "date":
|
|
1232
1155
|
return _zod2.z.coerce.date();
|
|
@@ -1273,42 +1196,42 @@ function build(schema, walk) {
|
|
|
1273
1196
|
return inner_of(def) ? inner() : void 0;
|
|
1274
1197
|
}
|
|
1275
1198
|
}
|
|
1276
|
-
|
|
1199
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, build, "build");
|
|
1277
1200
|
|
|
1278
1201
|
// src/internal/event-sourcing.ts
|
|
1279
|
-
var bare_patch = /* @__PURE__ */
|
|
1280
|
-
var value_at = /* @__PURE__ */
|
|
1202
|
+
var bare_patch = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (_me, state2, partial) => _actpatch.patch.call(void 0, state2, partial), "bare_patch");
|
|
1203
|
+
var value_at = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (value, path) => path.reduce(
|
|
1281
1204
|
(at, key) => _optionalChain([at, 'optionalAccess', _58 => _58[key]]),
|
|
1282
1205
|
value
|
|
1283
1206
|
), "value_at");
|
|
1284
|
-
var check_invariants = /* @__PURE__ */
|
|
1207
|
+
var check_invariants = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (target, state2, schema, pii_aware) => {
|
|
1285
1208
|
let result;
|
|
1286
1209
|
try {
|
|
1287
1210
|
result = schema.safeParse(state2);
|
|
1288
1211
|
} catch (error) {
|
|
1289
|
-
throw new (0,
|
|
1212
|
+
throw new (0, _chunk4GA3CHQWcjs.ValidationError)(target, state2, error);
|
|
1290
1213
|
}
|
|
1291
1214
|
if (result.success) return;
|
|
1292
1215
|
const issues = pii_aware ? result.error.issues.filter((issue) => {
|
|
1293
1216
|
const value = value_at(state2, issue.path);
|
|
1294
|
-
return value !==
|
|
1217
|
+
return value !== _chunk4GA3CHQWcjs.REDACTED && value !== _chunk4GA3CHQWcjs.SHREDDED;
|
|
1295
1218
|
}) : result.error.issues;
|
|
1296
1219
|
if (issues.length)
|
|
1297
|
-
throw new (0,
|
|
1220
|
+
throw new (0, _chunk4GA3CHQWcjs.ValidationError)(
|
|
1298
1221
|
target,
|
|
1299
1222
|
state2,
|
|
1300
1223
|
_zod2.prettifyError.call(void 0, new (0, _zod2.ZodError)(issues))
|
|
1301
1224
|
);
|
|
1302
1225
|
}, "check_invariants");
|
|
1303
1226
|
var DEFAULT_BATCH = 500;
|
|
1304
|
-
var cache_put = /* @__PURE__ */
|
|
1305
|
-
(err) =>
|
|
1227
|
+
var cache_put = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (stream, entry) => _chunkXG3UD63Ycjs.cache.call(void 0, ).set(stream, entry).catch(
|
|
1228
|
+
(err) => _chunkXG3UD63Ycjs.log.call(void 0, ).warn(
|
|
1306
1229
|
err,
|
|
1307
1230
|
"cache set skipped; the next load re-folds from the store"
|
|
1308
1231
|
)
|
|
1309
1232
|
), "cache_put");
|
|
1310
|
-
var cache_drop = /* @__PURE__ */
|
|
1311
|
-
(err) =>
|
|
1233
|
+
var cache_drop = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (stream) => _chunkXG3UD63Ycjs.cache.call(void 0, ).invalidate(stream).catch(
|
|
1234
|
+
(err) => _chunkXG3UD63Ycjs.log.call(void 0, ).warn(
|
|
1312
1235
|
err,
|
|
1313
1236
|
"cache invalidate skipped; a stale checkpoint re-folds from its event_id"
|
|
1314
1237
|
)
|
|
@@ -1316,11 +1239,11 @@ var cache_drop = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (stream)
|
|
|
1316
1239
|
async function snap(snapshot) {
|
|
1317
1240
|
const { id, stream, name, meta, version } = snapshot.event;
|
|
1318
1241
|
try {
|
|
1319
|
-
const [committed] = await
|
|
1242
|
+
const [committed] = await _chunkXG3UD63Ycjs.store.call(void 0, ).commit(
|
|
1320
1243
|
[
|
|
1321
1244
|
{
|
|
1322
1245
|
stream,
|
|
1323
|
-
msgs: [{ name:
|
|
1246
|
+
msgs: [{ name: _chunk4GA3CHQWcjs.SNAP_EVENT, data: snapshot.state }],
|
|
1324
1247
|
// IMPORTANT! - state events are committed right after the snapshot event
|
|
1325
1248
|
expectedVersion: version
|
|
1326
1249
|
}
|
|
@@ -1333,19 +1256,19 @@ async function snap(snapshot) {
|
|
|
1333
1256
|
return committed;
|
|
1334
1257
|
} catch (error) {
|
|
1335
1258
|
const reason = error instanceof Error ? error.message : String(error);
|
|
1336
|
-
|
|
1259
|
+
_chunkXG3UD63Ycjs.log.call(void 0, ).warn(
|
|
1337
1260
|
`Snapshot write failed on stream "${stream}": ${reason} \u2014 cold starts will replay full history until snapshots succeed.`
|
|
1338
1261
|
);
|
|
1339
1262
|
}
|
|
1340
1263
|
}
|
|
1341
|
-
|
|
1264
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, snap, "snap");
|
|
1342
1265
|
async function tombstone(stream, expectedVersion, correlation) {
|
|
1343
1266
|
try {
|
|
1344
|
-
const [committed] = await
|
|
1267
|
+
const [committed] = await _chunkXG3UD63Ycjs.store.call(void 0, ).commit(
|
|
1345
1268
|
[
|
|
1346
1269
|
{
|
|
1347
1270
|
stream,
|
|
1348
|
-
msgs: [{ name:
|
|
1271
|
+
msgs: [{ name: _chunk4GA3CHQWcjs.TOMBSTONE_EVENT, data: {} }],
|
|
1349
1272
|
expectedVersion
|
|
1350
1273
|
}
|
|
1351
1274
|
],
|
|
@@ -1353,18 +1276,18 @@ async function tombstone(stream, expectedVersion, correlation) {
|
|
|
1353
1276
|
);
|
|
1354
1277
|
return committed;
|
|
1355
1278
|
} catch (error) {
|
|
1356
|
-
if (error instanceof
|
|
1279
|
+
if (error instanceof _chunk4GA3CHQWcjs.ConcurrencyError) return void 0;
|
|
1357
1280
|
throw error;
|
|
1358
1281
|
}
|
|
1359
1282
|
}
|
|
1360
|
-
|
|
1283
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, tombstone, "tombstone");
|
|
1361
1284
|
function is_valid(event) {
|
|
1362
1285
|
if (event.version < 0) return false;
|
|
1363
1286
|
if (!(event.created instanceof Date) || Number.isNaN(event.created.getTime()))
|
|
1364
1287
|
return false;
|
|
1365
1288
|
return true;
|
|
1366
1289
|
}
|
|
1367
|
-
|
|
1290
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, is_valid, "is_valid");
|
|
1368
1291
|
async function scan(source, opts = {}, callback) {
|
|
1369
1292
|
const {
|
|
1370
1293
|
drop_snapshots = false,
|
|
@@ -1392,9 +1315,9 @@ async function scan(source, opts = {}, callback) {
|
|
|
1392
1315
|
if (drop_closed_streams) {
|
|
1393
1316
|
await source.query(
|
|
1394
1317
|
(e) => {
|
|
1395
|
-
if (e.name ===
|
|
1318
|
+
if (e.name === _chunk4GA3CHQWcjs.TOMBSTONE_EVENT) closed_streams.add(e.stream);
|
|
1396
1319
|
},
|
|
1397
|
-
{ names: [
|
|
1320
|
+
{ names: [_chunk4GA3CHQWcjs.TOMBSTONE_EVENT] }
|
|
1398
1321
|
);
|
|
1399
1322
|
}
|
|
1400
1323
|
let max_id;
|
|
@@ -1419,11 +1342,11 @@ async function scan(source, opts = {}, callback) {
|
|
|
1419
1342
|
if (on_progress) on_progress({ processed, id: event.id, max_id });
|
|
1420
1343
|
const has_history = started.has(event.stream);
|
|
1421
1344
|
started.add(event.stream);
|
|
1422
|
-
if (drop_snapshots && event.name ===
|
|
1345
|
+
if (drop_snapshots && event.name === _chunk4GA3CHQWcjs.SNAP_EVENT && has_history) {
|
|
1423
1346
|
dropped_snaps++;
|
|
1424
1347
|
return;
|
|
1425
1348
|
}
|
|
1426
|
-
if (closed_streams.has(event.stream) && event.name !==
|
|
1349
|
+
if (closed_streams.has(event.stream) && event.name !== _chunk4GA3CHQWcjs.TOMBSTONE_EVENT) {
|
|
1427
1350
|
dropped_closed++;
|
|
1428
1351
|
return;
|
|
1429
1352
|
}
|
|
@@ -1496,23 +1419,23 @@ async function scan(source, opts = {}, callback) {
|
|
|
1496
1419
|
}
|
|
1497
1420
|
};
|
|
1498
1421
|
}
|
|
1499
|
-
|
|
1422
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, scan, "scan");
|
|
1500
1423
|
async function load(me, target, callback, patch_fn = bare_patch) {
|
|
1501
1424
|
const { stream, actor, asOf } = target;
|
|
1502
1425
|
const time_travel = !!asOf && Object.values(asOf).some((v) => v !== void 0);
|
|
1503
1426
|
const seeded = time_travel && asOf.limit === void 0 && !asOf.created_after;
|
|
1504
|
-
const cached = time_travel ? void 0 : await
|
|
1427
|
+
const cached = time_travel ? void 0 : await _chunkXG3UD63Ycjs.cache.call(void 0, ).get(stream);
|
|
1505
1428
|
const cache_hit = !!cached;
|
|
1506
1429
|
let state2 = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _67 => _67.state]), () => ( (me.init ? me.init() : {})));
|
|
1507
1430
|
let patches = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _68 => _68.patches]), () => ( 0));
|
|
1508
1431
|
let snaps = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _69 => _69.snaps]), () => ( 0));
|
|
1509
1432
|
let replayed = 0;
|
|
1510
1433
|
let event;
|
|
1511
|
-
await
|
|
1434
|
+
await _chunkXG3UD63Ycjs.store.call(void 0, ).query(
|
|
1512
1435
|
(raw) => {
|
|
1513
|
-
if (seeded && raw.name ===
|
|
1436
|
+
if (seeded && raw.name === _chunk4GA3CHQWcjs.SNAP_EVENT && replayed > 0) return;
|
|
1514
1437
|
event = me.view(raw, actor);
|
|
1515
|
-
if (event.name ===
|
|
1438
|
+
if (event.name === _chunk4GA3CHQWcjs.SNAP_EVENT) {
|
|
1516
1439
|
state2 = event.data;
|
|
1517
1440
|
snaps++;
|
|
1518
1441
|
patches = 0;
|
|
@@ -1521,8 +1444,8 @@ async function load(me, target, callback, patch_fn = bare_patch) {
|
|
|
1521
1444
|
state2 = patch_fn(me, state2, me.patch[event.name](event, state2), event);
|
|
1522
1445
|
patches++;
|
|
1523
1446
|
replayed++;
|
|
1524
|
-
} else if (event.name !==
|
|
1525
|
-
|
|
1447
|
+
} else if (event.name !== _chunk4GA3CHQWcjs.TOMBSTONE_EVENT) {
|
|
1448
|
+
_chunkXG3UD63Ycjs.log.call(void 0, ).warn(
|
|
1526
1449
|
`Skipping unknown event "${String(event.name)}" on stream "${stream}" (id=${event.id}) \u2014 no reducer in state "${me.name}"`
|
|
1527
1450
|
);
|
|
1528
1451
|
}
|
|
@@ -1550,7 +1473,7 @@ async function load(me, target, callback, patch_fn = bare_patch) {
|
|
|
1550
1473
|
) : time_travel ? asOf : { with_snaps: true }
|
|
1551
1474
|
}
|
|
1552
1475
|
);
|
|
1553
|
-
const head_is_tombstone = _optionalChain([event, 'optionalAccess', _71 => _71.name]) ===
|
|
1476
|
+
const head_is_tombstone = _optionalChain([event, 'optionalAccess', _71 => _71.name]) === _chunk4GA3CHQWcjs.TOMBSTONE_EVENT;
|
|
1554
1477
|
if (replayed > 0 && !time_travel && event && !me.pii_aware && !head_is_tombstone) {
|
|
1555
1478
|
await cache_put(stream, {
|
|
1556
1479
|
stream,
|
|
@@ -1573,7 +1496,7 @@ async function load(me, target, callback, patch_fn = bare_patch) {
|
|
|
1573
1496
|
replayed
|
|
1574
1497
|
};
|
|
1575
1498
|
}
|
|
1576
|
-
|
|
1499
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, load, "load");
|
|
1577
1500
|
async function load_others(loads, payload, own, actor, patch_fn, refuse) {
|
|
1578
1501
|
const streams = loads.map((l) => l.target(payload, own.state));
|
|
1579
1502
|
streams.forEach((stream, i) => {
|
|
@@ -1594,8 +1517,8 @@ async function load_others(loads, payload, own, actor, patch_fn, refuse) {
|
|
|
1594
1517
|
void 0,
|
|
1595
1518
|
patch_fn
|
|
1596
1519
|
);
|
|
1597
|
-
if (_optionalChain([snapshot, 'access', _76 => _76.event, 'optionalAccess', _77 => _77.name]) ===
|
|
1598
|
-
throw new (0,
|
|
1520
|
+
if (_optionalChain([snapshot, 'access', _76 => _76.event, 'optionalAccess', _77 => _77.name]) === _chunk4GA3CHQWcjs.TOMBSTONE_EVENT)
|
|
1521
|
+
throw new (0, _chunk4GA3CHQWcjs.StreamClosedError)(stream);
|
|
1599
1522
|
return {
|
|
1600
1523
|
state: l.state,
|
|
1601
1524
|
stream,
|
|
@@ -1606,13 +1529,13 @@ async function load_others(loads, payload, own, actor, patch_fn, refuse) {
|
|
|
1606
1529
|
})
|
|
1607
1530
|
);
|
|
1608
1531
|
}
|
|
1609
|
-
|
|
1532
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, load_others, "load_others");
|
|
1610
1533
|
async function action(me, action2, target, payload, options, patch_fn = bare_patch) {
|
|
1611
1534
|
const { stream, expectedVersion, actor } = target;
|
|
1612
1535
|
if (!stream) throw new Error("Missing target stream");
|
|
1613
1536
|
const reactingTo = _optionalChain([options, 'optionalAccess', _78 => _78.reactingTo]);
|
|
1614
1537
|
const correlator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _79 => _79.correlator]), () => ( default_correlator));
|
|
1615
|
-
const validated =
|
|
1538
|
+
const validated = _chunkXG3UD63Ycjs.validate.call(void 0, action2, payload, me.actions[action2]);
|
|
1616
1539
|
const opts = _optionalChain([me, 'access', _80 => _80.options, 'optionalAccess', _81 => _81[action2]]);
|
|
1617
1540
|
const max_retries = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _82 => _82.maxRetries]), () => ( 0));
|
|
1618
1541
|
const loads = _nullishCoalesce(_optionalChain([me, 'access', _83 => _83.loads, 'optionalAccess', _84 => _84[action2]]), () => ( []));
|
|
@@ -1624,8 +1547,8 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1624
1547
|
void 0,
|
|
1625
1548
|
patch_fn
|
|
1626
1549
|
);
|
|
1627
|
-
if (_optionalChain([snapshot, 'access', _85 => _85.event, 'optionalAccess', _86 => _86.name]) ===
|
|
1628
|
-
throw new (0,
|
|
1550
|
+
if (_optionalChain([snapshot, 'access', _85 => _85.event, 'optionalAccess', _86 => _86.name]) === _chunk4GA3CHQWcjs.TOMBSTONE_EVENT)
|
|
1551
|
+
throw new (0, _chunk4GA3CHQWcjs.StreamClosedError)(stream);
|
|
1629
1552
|
const own = {
|
|
1630
1553
|
state: me,
|
|
1631
1554
|
stream,
|
|
@@ -1639,7 +1562,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1639
1562
|
{ stream, state: snapshot.state },
|
|
1640
1563
|
target.actor,
|
|
1641
1564
|
patch_fn,
|
|
1642
|
-
(description) => new (0,
|
|
1565
|
+
(description) => new (0, _chunk4GA3CHQWcjs.PreconditionError)(
|
|
1643
1566
|
action2,
|
|
1644
1567
|
validated,
|
|
1645
1568
|
target,
|
|
@@ -1652,7 +1575,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1652
1575
|
);
|
|
1653
1576
|
for (const { holds, description } of _nullishCoalesce(_optionalChain([me, 'access', _89 => _89.requires, 'optionalAccess', _90 => _90[action2]]), () => ( [])))
|
|
1654
1577
|
if (!holds(validated, snapshot.state, actor, loaded))
|
|
1655
|
-
throw new (0,
|
|
1578
|
+
throw new (0, _chunk4GA3CHQWcjs.PreconditionError)(
|
|
1656
1579
|
action2,
|
|
1657
1580
|
validated,
|
|
1658
1581
|
target,
|
|
@@ -1674,7 +1597,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1674
1597
|
);
|
|
1675
1598
|
to.events.push({
|
|
1676
1599
|
name: event,
|
|
1677
|
-
data:
|
|
1600
|
+
data: _chunkXG3UD63Ycjs.validate.call(void 0, event, data, to.state.events[event])
|
|
1678
1601
|
});
|
|
1679
1602
|
}
|
|
1680
1603
|
if (!own.events.length)
|
|
@@ -1731,7 +1654,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1731
1654
|
});
|
|
1732
1655
|
let committed;
|
|
1733
1656
|
try {
|
|
1734
|
-
committed = await
|
|
1657
|
+
committed = await _chunkXG3UD63Ycjs.store.call(void 0, ).commit(
|
|
1735
1658
|
appends.map((p) => ({
|
|
1736
1659
|
stream: p.stream,
|
|
1737
1660
|
msgs: p.events.map((e) => p.state.message(e)),
|
|
@@ -1740,7 +1663,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1740
1663
|
meta
|
|
1741
1664
|
);
|
|
1742
1665
|
} catch (error) {
|
|
1743
|
-
if (error instanceof
|
|
1666
|
+
if (error instanceof _chunk4GA3CHQWcjs.ConcurrencyError) void cache_drop(error.stream);
|
|
1744
1667
|
throw error;
|
|
1745
1668
|
}
|
|
1746
1669
|
let row = 0;
|
|
@@ -1782,20 +1705,20 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1782
1705
|
}
|
|
1783
1706
|
return snapshots;
|
|
1784
1707
|
} catch (error) {
|
|
1785
|
-
if (!(error instanceof
|
|
1708
|
+
if (!(error instanceof _chunk4GA3CHQWcjs.ConcurrencyError)) throw error;
|
|
1786
1709
|
if (expectedVersion !== void 0 && error.stream === stream) throw error;
|
|
1787
1710
|
if (attempt >= max_retries) throw error;
|
|
1788
1711
|
if (_optionalChain([opts, 'optionalAccess', _99 => _99.backoff])) {
|
|
1789
1712
|
const delay_ms = compute_backoff_delay(attempt, opts.backoff);
|
|
1790
|
-
if (delay_ms > 0) await
|
|
1713
|
+
if (delay_ms > 0) await _chunkXG3UD63Ycjs.sleep.call(void 0, delay_ms);
|
|
1791
1714
|
}
|
|
1792
1715
|
}
|
|
1793
1716
|
}
|
|
1794
1717
|
}
|
|
1795
|
-
|
|
1718
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, action, "action");
|
|
1796
1719
|
|
|
1797
1720
|
// src/internal/tracing.ts
|
|
1798
|
-
var PRETTY =
|
|
1721
|
+
var PRETTY = _chunkXG3UD63Ycjs.config.call(void 0, ).env !== "production";
|
|
1799
1722
|
var C_BLUE = "\x1B[38;5;39m";
|
|
1800
1723
|
var C_ORANGE = "\x1B[38;5;208m";
|
|
1801
1724
|
var C_GREEN = "\x1B[38;5;42m";
|
|
@@ -1804,14 +1727,14 @@ var C_DRAIN = "\x1B[38;5;244m";
|
|
|
1804
1727
|
var C_HIT = "\x1B[38;5;82m";
|
|
1805
1728
|
var C_MISS = "\x1B[38;5;220m";
|
|
1806
1729
|
var C_RESET = "\x1B[0m";
|
|
1807
|
-
var es_caption = /* @__PURE__ */
|
|
1730
|
+
var es_caption = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (caption, color, body) => PRETTY ? `${color}${body}${C_RESET}` : `${caption}: ${body}`, "es_caption");
|
|
1808
1731
|
var C_LANE = "\x1B[38;5;183m";
|
|
1809
1732
|
var C_DIM = "\x1B[38;5;240m";
|
|
1810
1733
|
var C_ERR = "\x1B[38;5;196m";
|
|
1811
1734
|
var C_STREAM = "\x1B[38;5;226m";
|
|
1812
|
-
var dim = /* @__PURE__ */
|
|
1813
|
-
var hue = /* @__PURE__ */
|
|
1814
|
-
var drain_caption = /* @__PURE__ */
|
|
1735
|
+
var dim = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (text) => PRETTY ? `${C_DIM}${text}${C_RESET}` : text, "dim");
|
|
1736
|
+
var hue = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (color, text) => PRETTY ? `${color}${text}${C_RESET}` : text, "hue");
|
|
1737
|
+
var drain_caption = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (caption, lane) => {
|
|
1815
1738
|
const show_lane = lane && lane !== "default";
|
|
1816
1739
|
if (PRETTY) {
|
|
1817
1740
|
const tag = `${C_DRAIN}>> ${caption}${C_RESET}`;
|
|
@@ -1819,17 +1742,17 @@ var drain_caption = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (capti
|
|
|
1819
1742
|
}
|
|
1820
1743
|
return show_lane ? `>> ${caption} ${lane}` : `>> ${caption}`;
|
|
1821
1744
|
}, "drain_caption");
|
|
1822
|
-
var cache_marker = /* @__PURE__ */
|
|
1745
|
+
var cache_marker = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (hit) => {
|
|
1823
1746
|
const word = hit ? "hit" : "miss";
|
|
1824
1747
|
if (!PRETTY) return word;
|
|
1825
1748
|
return `${hit ? C_HIT : C_MISS}${word}${C_RESET}${C_GREEN}`;
|
|
1826
1749
|
}, "cache_marker");
|
|
1827
|
-
var stats_marker = /* @__PURE__ */
|
|
1750
|
+
var stats_marker = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (version, replayed, snaps, patches) => {
|
|
1828
1751
|
const text = `v=${version} replayed=${replayed} snaps=${snaps} patches=${patches}`;
|
|
1829
1752
|
if (!PRETTY) return text;
|
|
1830
1753
|
return `${C_DRAIN}${text}${C_RESET}${C_GREEN}`;
|
|
1831
1754
|
}, "stats_marker");
|
|
1832
|
-
var as_of_marker = /* @__PURE__ */
|
|
1755
|
+
var as_of_marker = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (asOf) => {
|
|
1833
1756
|
if (!asOf) return "";
|
|
1834
1757
|
const parts = [];
|
|
1835
1758
|
if (asOf.before !== void 0) parts.push(`before=${asOf.before}`);
|
|
@@ -1840,14 +1763,14 @@ var as_of_marker = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (asOf)
|
|
|
1840
1763
|
if (asOf.limit !== void 0) parts.push(`limit=${asOf.limit}`);
|
|
1841
1764
|
return parts.length ? ` (as-of ${parts.join(" ")})` : " (as-of)";
|
|
1842
1765
|
}, "as_of_marker");
|
|
1843
|
-
var traced = /* @__PURE__ */
|
|
1766
|
+
var traced = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (inner, exit, entry) => (async (...args) => {
|
|
1844
1767
|
_optionalChain([entry, 'optionalCall', _100 => _100(...args)]);
|
|
1845
1768
|
const result = await inner(...args);
|
|
1846
1769
|
_optionalChain([exit, 'optionalCall', _101 => _101(result, ...args)]);
|
|
1847
1770
|
return result;
|
|
1848
1771
|
}), "traced");
|
|
1849
1772
|
function build_es(logger, correlator = default_correlator, patch_fn = bare_patch) {
|
|
1850
|
-
const bound_action = /* @__PURE__ */
|
|
1773
|
+
const bound_action = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (me, action_name, target, payload, options) => action(
|
|
1851
1774
|
me,
|
|
1852
1775
|
action_name,
|
|
1853
1776
|
target,
|
|
@@ -1855,7 +1778,7 @@ function build_es(logger, correlator = default_correlator, patch_fn = bare_patch
|
|
|
1855
1778
|
{ ...options, correlator: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _102 => _102.correlator]), () => ( correlator)) },
|
|
1856
1779
|
patch_fn
|
|
1857
1780
|
), "bound_action");
|
|
1858
|
-
const bound_load = /* @__PURE__ */
|
|
1781
|
+
const bound_load = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (me, target, callback) => load(me, target, callback, patch_fn), "bound_load");
|
|
1859
1782
|
if (logger.level !== "trace") {
|
|
1860
1783
|
return {
|
|
1861
1784
|
snap,
|
|
@@ -1917,7 +1840,7 @@ function build_es(logger, correlator = default_correlator, patch_fn = bare_patch
|
|
|
1917
1840
|
})
|
|
1918
1841
|
};
|
|
1919
1842
|
}
|
|
1920
|
-
|
|
1843
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, build_es, "build_es");
|
|
1921
1844
|
function build_drain(logger) {
|
|
1922
1845
|
return {
|
|
1923
1846
|
claim,
|
|
@@ -1937,7 +1860,7 @@ function build_drain(logger) {
|
|
|
1937
1860
|
})
|
|
1938
1861
|
};
|
|
1939
1862
|
}
|
|
1940
|
-
|
|
1863
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, build_drain, "build_drain");
|
|
1941
1864
|
function trace_cycle(logger, leased, fetched, handled, acked, blocked) {
|
|
1942
1865
|
if (logger.level !== "trace" || !leased.length) return;
|
|
1943
1866
|
const lane = _optionalChain([leased, 'access', _105 => _105[0], 'optionalAccess', _106 => _106.lane]);
|
|
@@ -1975,17 +1898,17 @@ function trace_cycle(logger, leased, fetched, handled, acked, blocked) {
|
|
|
1975
1898
|
}).join(", ");
|
|
1976
1899
|
logger.trace(`${drain_caption("drained", lane)} ${detail}`);
|
|
1977
1900
|
}
|
|
1978
|
-
|
|
1901
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, trace_cycle, "trace_cycle");
|
|
1979
1902
|
|
|
1980
1903
|
// src/internal/drain-cycle.ts
|
|
1981
1904
|
function budget_exhausted(lease, options, store_failing) {
|
|
1982
1905
|
if (store_failing || !_optionalChain([options, 'optionalAccess', _110 => _110.blockOnError]) || lease.retry <= options.maxRetries)
|
|
1983
1906
|
return void 0;
|
|
1984
1907
|
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.`;
|
|
1985
|
-
|
|
1908
|
+
_chunkXG3UD63Ycjs.log.call(void 0, ).error(error);
|
|
1986
1909
|
return { lease, handled: 0, acked_at: lease.at, error, block: true };
|
|
1987
1910
|
}
|
|
1988
|
-
|
|
1911
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, budget_exhausted, "budget_exhausted");
|
|
1989
1912
|
function fetch_failure_policy(registry) {
|
|
1990
1913
|
let blockOnError = true;
|
|
1991
1914
|
let maxRetries = 0;
|
|
@@ -1996,17 +1919,17 @@ function fetch_failure_policy(registry) {
|
|
|
1996
1919
|
}
|
|
1997
1920
|
return { blockOnError, maxRetries };
|
|
1998
1921
|
}
|
|
1999
|
-
|
|
1922
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, fetch_failure_policy, "fetch_failure_policy");
|
|
2000
1923
|
function finalize(lease, handled, at, error, options, logger, failed_at) {
|
|
2001
1924
|
if (!error) return { lease, handled, acked_at: at };
|
|
2002
1925
|
logger.error(error);
|
|
2003
|
-
const non_retryable = error instanceof
|
|
1926
|
+
const non_retryable = error instanceof _chunk4GA3CHQWcjs.NonRetryableError;
|
|
2004
1927
|
const block2 = options.blockOnError && (non_retryable || lease.retry >= options.maxRetries);
|
|
2005
1928
|
if (block2)
|
|
2006
1929
|
logger.error(
|
|
2007
1930
|
non_retryable ? `Blocking ${lease.stream} on non-retryable error.` : `Blocking ${lease.stream} after ${lease.retry} retries.`
|
|
2008
1931
|
);
|
|
2009
|
-
const next_attempt_at = block2 ? void 0 : Date.now() + compute_backoff_delay(lease.retry, _nullishCoalesce(options.backoff, () => (
|
|
1932
|
+
const next_attempt_at = block2 ? void 0 : Date.now() + compute_backoff_delay(lease.retry, _nullishCoalesce(options.backoff, () => ( _chunkXG3UD63Ycjs.DEFAULT_BACKOFF)));
|
|
2010
1933
|
return {
|
|
2011
1934
|
lease,
|
|
2012
1935
|
handled,
|
|
@@ -2017,7 +1940,7 @@ function finalize(lease, handled, at, error, options, logger, failed_at) {
|
|
|
2017
1940
|
failed_at
|
|
2018
1941
|
};
|
|
2019
1942
|
}
|
|
2020
|
-
|
|
1943
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, finalize, "finalize");
|
|
2021
1944
|
function warn_misrouted(seen, stream, handler, event) {
|
|
2022
1945
|
report_once(
|
|
2023
1946
|
seen,
|
|
@@ -2025,7 +1948,7 @@ function warn_misrouted(seen, stream, handler, event) {
|
|
|
2025
1948
|
`Reaction "${handler}" on "${event}" resolved to target "${stream}", which a projection already serves. A target is served by one batch handler or one state projection, so this reaction can never run \u2014 and delivering to it would hand the projection an aggregate from another stream. Skipping it. The equivalent static \`.to({ target })\` is rejected at build; a dynamic resolver's target is only knowable here.`
|
|
2026
1949
|
);
|
|
2027
1950
|
}
|
|
2028
|
-
|
|
1951
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, warn_misrouted, "warn_misrouted");
|
|
2029
1952
|
async function run_drain_cycle(deps, cycle) {
|
|
2030
1953
|
const { ops, registry, batch_handlers, handle, handle_batch, lane } = deps;
|
|
2031
1954
|
const {
|
|
@@ -2136,13 +2059,13 @@ async function run_drain_cycle(deps, cycle) {
|
|
|
2136
2059
|
const acked = submitted.length ? await ops.ack(submitted) : [];
|
|
2137
2060
|
const expected = submitted.filter((l) => l.due === void 0).length;
|
|
2138
2061
|
if (acked.length < expected)
|
|
2139
|
-
|
|
2062
|
+
_chunkXG3UD63Ycjs.log.call(void 0, ).warn(
|
|
2140
2063
|
`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.`
|
|
2141
2064
|
);
|
|
2142
2065
|
const closeable = handled.filter((h) => h.close !== void 0).map((h) => h.close);
|
|
2143
2066
|
return { leased, fetched, handled, acked, blocked, closeable };
|
|
2144
2067
|
}
|
|
2145
|
-
|
|
2068
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, run_drain_cycle, "run_drain_cycle");
|
|
2146
2069
|
var EMPTY_DRAIN = {
|
|
2147
2070
|
fetched: [],
|
|
2148
2071
|
leased: [],
|
|
@@ -2157,36 +2080,36 @@ function merge_drains(drains) {
|
|
|
2157
2080
|
blocked: drains.flatMap((d) => d.blocked)
|
|
2158
2081
|
};
|
|
2159
2082
|
}
|
|
2160
|
-
|
|
2083
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, merge_drains, "merge_drains");
|
|
2161
2084
|
var RETRY = "";
|
|
2162
|
-
var DrainController = (
|
|
2085
|
+
var DrainController = (_class2 = class {
|
|
2163
2086
|
static {
|
|
2164
|
-
|
|
2087
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, this, "DrainController");
|
|
2165
2088
|
}
|
|
2166
2089
|
// Armed while `_raised` is ahead of `_lowered` (the raise count the last
|
|
2167
2090
|
// empty claim saw), so a claim never lowers over a raise that landed
|
|
2168
2091
|
// during it.
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2092
|
+
__init2() {this._raised = 0}
|
|
2093
|
+
__init3() {this._lowered = 0}
|
|
2094
|
+
__init4() {this._ratio = 0.5}
|
|
2172
2095
|
// Local wake at the earliest parked (backoff or defer) visit, or at the
|
|
2173
2096
|
// lease expiry after a failed pass (the {@link RETRY} key); the schedule
|
|
2174
2097
|
// itself is persisted. On an idle app nothing else would drain it. It
|
|
2175
2098
|
// drains until a pass leases nothing or the controller stops, and an entry
|
|
2176
2099
|
// stays until handled or until a later pass claims nothing.
|
|
2177
|
-
|
|
2100
|
+
__init5() {this._defer = new (0, _chunkXG3UD63Ycjs.DeferTimer)(() => {
|
|
2178
2101
|
this.arm();
|
|
2179
2102
|
void this._deps.run_scoped(async () => {
|
|
2180
2103
|
while ((await this.drain()).leased.length > 0) ;
|
|
2181
2104
|
});
|
|
2182
2105
|
})}
|
|
2183
2106
|
|
|
2184
|
-
|
|
2185
|
-
|
|
2107
|
+
__init6() {this._misrouted = /* @__PURE__ */ new Set()}
|
|
2108
|
+
__init7() {this._stopped = false}
|
|
2186
2109
|
// The pass in flight. Never rejects; graceful shutdown waits on it.
|
|
2187
2110
|
|
|
2188
2111
|
|
|
2189
|
-
constructor(deps) {;
|
|
2112
|
+
constructor(deps) {;_class2.prototype.__init2.call(this);_class2.prototype.__init3.call(this);_class2.prototype.__init4.call(this);_class2.prototype.__init5.call(this);_class2.prototype.__init6.call(this);_class2.prototype.__init7.call(this);
|
|
2190
2113
|
this._deps = deps;
|
|
2191
2114
|
}
|
|
2192
2115
|
arm() {
|
|
@@ -2216,7 +2139,7 @@ var DrainController = (_class3 = class {
|
|
|
2216
2139
|
*/
|
|
2217
2140
|
start(cycleMs) {
|
|
2218
2141
|
const run = this._deps.run_scoped;
|
|
2219
|
-
const tick = /* @__PURE__ */
|
|
2142
|
+
const tick = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, async () => {
|
|
2220
2143
|
if (this.armed) await run(() => this.drain());
|
|
2221
2144
|
if (this._stopped) return;
|
|
2222
2145
|
this._worker = setTimeout(tick, cycleMs);
|
|
@@ -2237,9 +2160,9 @@ var DrainController = (_class3 = class {
|
|
|
2237
2160
|
if (!this.armed || this._stopped || this._inflight)
|
|
2238
2161
|
return EMPTY_DRAIN;
|
|
2239
2162
|
const d = _nullishCoalesce(this._deps.defaults, () => ( {}));
|
|
2240
|
-
const streamLimit = _nullishCoalesce(_nullishCoalesce(d.streamLimit, () => ( options.streamLimit)), () => (
|
|
2241
|
-
const eventLimit = _nullishCoalesce(options.eventLimit, () => (
|
|
2242
|
-
const leaseMillis = _nullishCoalesce(_nullishCoalesce(d.leaseMillis, () => ( options.leaseMillis)), () => (
|
|
2163
|
+
const streamLimit = _nullishCoalesce(_nullishCoalesce(d.streamLimit, () => ( options.streamLimit)), () => ( _chunkXG3UD63Ycjs.DEFAULT_STREAM_LIMIT));
|
|
2164
|
+
const eventLimit = _nullishCoalesce(options.eventLimit, () => ( _chunkXG3UD63Ycjs.DEFAULT_EVENT_LIMIT));
|
|
2165
|
+
const leaseMillis = _nullishCoalesce(_nullishCoalesce(d.leaseMillis, () => ( options.leaseMillis)), () => ( _chunkXG3UD63Ycjs.DEFAULT_LEASE_MILLIS));
|
|
2243
2166
|
if (this._deps.breaker.state(Date.now()) === "open")
|
|
2244
2167
|
return EMPTY_DRAIN;
|
|
2245
2168
|
const pass = this._pass(streamLimit, eventLimit, leaseMillis).finally(
|
|
@@ -2295,12 +2218,12 @@ var DrainController = (_class3 = class {
|
|
|
2295
2218
|
if (!this._stopped) this._defer.schedule();
|
|
2296
2219
|
}
|
|
2297
2220
|
}
|
|
2298
|
-
},
|
|
2221
|
+
}, _class2);
|
|
2299
2222
|
|
|
2300
2223
|
// src/internal/reaction-dispatch.ts
|
|
2301
2224
|
var CloseSignal = class extends Error {
|
|
2302
2225
|
static {
|
|
2303
|
-
|
|
2226
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, this, "CloseSignal");
|
|
2304
2227
|
}
|
|
2305
2228
|
/**
|
|
2306
2229
|
* Stream to close. Omitted → the reaction's own lease stream (a self-close).
|
|
@@ -2368,7 +2291,7 @@ function build_handle(deps) {
|
|
|
2368
2291
|
handled++;
|
|
2369
2292
|
}
|
|
2370
2293
|
} catch (error) {
|
|
2371
|
-
if (error instanceof
|
|
2294
|
+
if (error instanceof _chunk4GA3CHQWcjs.DeferSignal) {
|
|
2372
2295
|
let defer;
|
|
2373
2296
|
try {
|
|
2374
2297
|
defer = resolve_defer_at(error.when, event);
|
|
@@ -2417,7 +2340,7 @@ function build_handle(deps) {
|
|
|
2417
2340
|
return finalize(lease, handled, at, void 0, payloads[0].options, logger);
|
|
2418
2341
|
};
|
|
2419
2342
|
}
|
|
2420
|
-
|
|
2343
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, build_handle, "build_handle");
|
|
2421
2344
|
function build_handle_batch(logger) {
|
|
2422
2345
|
return async (lease, payloads, batchHandler) => {
|
|
2423
2346
|
const stream = lease.stream;
|
|
@@ -2446,7 +2369,7 @@ function build_handle_batch(logger) {
|
|
|
2446
2369
|
}
|
|
2447
2370
|
};
|
|
2448
2371
|
}
|
|
2449
|
-
|
|
2372
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, build_handle_batch, "build_handle_batch");
|
|
2450
2373
|
|
|
2451
2374
|
// src/internal/autoclose-reaction.ts
|
|
2452
2375
|
var AUTOCLOSE_TARGET_PREFIX = "__autoclose__:";
|
|
@@ -2467,22 +2390,22 @@ function synthesize_autoclose_reactions(registry, states, read_window) {
|
|
|
2467
2390
|
// An anchored stream name would read as a pattern, and a store may refuse
|
|
2468
2391
|
// it at subscribe, stopping every reaction. Such a stream has no
|
|
2469
2392
|
// autoclose: `app.close` still closes it.
|
|
2470
|
-
resolver: /* @__PURE__ */
|
|
2393
|
+
resolver: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (e) => _chunkXJZ2PKJHcjs.isStreamName.call(void 0, e.stream) ? {
|
|
2471
2394
|
target: `${AUTOCLOSE_TARGET_PREFIX}${e.stream}`,
|
|
2472
2395
|
source: e.stream
|
|
2473
2396
|
} : void 0, "resolver"),
|
|
2474
2397
|
// Never block on autoclose: a transient query/store error should retry,
|
|
2475
2398
|
// not quarantine the synthetic stream.
|
|
2476
|
-
options: { blockOnError: false, maxRetries:
|
|
2477
|
-
handler: /* @__PURE__ */
|
|
2399
|
+
options: { blockOnError: false, maxRetries: _chunkXG3UD63Ycjs.DEFAULT_MAX_RETRIES },
|
|
2400
|
+
handler: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, async (event) => {
|
|
2478
2401
|
const aggregate = event.stream;
|
|
2479
2402
|
const window = read_window();
|
|
2480
2403
|
if (!in_autoclose_window(window, /* @__PURE__ */ new Date()))
|
|
2481
|
-
throw new (0,
|
|
2482
|
-
const stats = await
|
|
2404
|
+
throw new (0, _chunk4GA3CHQWcjs.DeferSignal)({ at: next_window_open(window, /* @__PURE__ */ new Date()) });
|
|
2405
|
+
const stats = await _chunkXG3UD63Ycjs.store.call(void 0, ).query_stats([aggregate], {
|
|
2483
2406
|
count: true,
|
|
2484
2407
|
tail: keep_days !== void 0 ? true : void 0,
|
|
2485
|
-
exclude: [
|
|
2408
|
+
exclude: [_chunk4GA3CHQWcjs.TOMBSTONE_EVENT, _chunk4GA3CHQWcjs.SNAP_EVENT]
|
|
2486
2409
|
});
|
|
2487
2410
|
const entry = stats.get(aggregate);
|
|
2488
2411
|
if (!entry) return;
|
|
@@ -2520,7 +2443,7 @@ function synthesize_autoclose_reactions(registry, states, read_window) {
|
|
|
2520
2443
|
dues.push(days_after(entry.tail.created, keep_days));
|
|
2521
2444
|
const future = dues.map((d) => d.getTime()).filter((t) => t > Date.now());
|
|
2522
2445
|
if (future.length)
|
|
2523
|
-
throw new (0,
|
|
2446
|
+
throw new (0, _chunk4GA3CHQWcjs.DeferSignal)({ at: new Date(Math.min(...future)) });
|
|
2524
2447
|
}, "handler")
|
|
2525
2448
|
};
|
|
2526
2449
|
const key = `__autoclose_${st.name}`;
|
|
@@ -2532,7 +2455,7 @@ function synthesize_autoclose_reactions(registry, states, read_window) {
|
|
|
2532
2455
|
}
|
|
2533
2456
|
}
|
|
2534
2457
|
}
|
|
2535
|
-
|
|
2458
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, synthesize_autoclose_reactions, "synthesize_autoclose_reactions");
|
|
2536
2459
|
|
|
2537
2460
|
// src/internal/close-cycle.ts
|
|
2538
2461
|
var CLOSE_CATCH_UP_LIMIT = 1e3;
|
|
@@ -2546,24 +2469,24 @@ async function catch_up_correlation(cursor, correlate, until) {
|
|
|
2546
2469
|
}
|
|
2547
2470
|
return cursor.checkpoint;
|
|
2548
2471
|
}
|
|
2549
|
-
|
|
2550
|
-
var CloseLock = (
|
|
2472
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, catch_up_correlation, "catch_up_correlation");
|
|
2473
|
+
var CloseLock = (_class3 = class {constructor() { _class3.prototype.__init8.call(this); }
|
|
2551
2474
|
static {
|
|
2552
|
-
|
|
2475
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, this, "CloseLock");
|
|
2553
2476
|
}
|
|
2554
|
-
|
|
2477
|
+
__init8() {this._tails = /* @__PURE__ */ new Map()}
|
|
2555
2478
|
/** Run `work` after every earlier close of `stream` has settled. */
|
|
2556
2479
|
run(stream, work) {
|
|
2557
2480
|
const prev = _nullishCoalesce(this._tails.get(stream), () => ( Promise.resolve()));
|
|
2558
2481
|
const next = prev.then(work, work);
|
|
2559
2482
|
this._tails.set(stream, next);
|
|
2560
|
-
const cleanup = /* @__PURE__ */
|
|
2483
|
+
const cleanup = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => {
|
|
2561
2484
|
if (this._tails.get(stream) === next) this._tails.delete(stream);
|
|
2562
2485
|
}, "cleanup");
|
|
2563
2486
|
next.then(cleanup, cleanup);
|
|
2564
2487
|
return next;
|
|
2565
2488
|
}
|
|
2566
|
-
},
|
|
2489
|
+
}, _class3);
|
|
2567
2490
|
var SAFETY_PROBE_PAGE_SIZE = 1e3;
|
|
2568
2491
|
async function run_close_cycle(targets, deps) {
|
|
2569
2492
|
const target_map = new Map(targets.map((t) => [t.stream, t]));
|
|
@@ -2585,12 +2508,12 @@ async function run_close_cycle(targets, deps) {
|
|
|
2585
2508
|
deps,
|
|
2586
2509
|
() => run_full_closes(full, target_map, deps, skipped)
|
|
2587
2510
|
);
|
|
2588
|
-
const retired = [...truncated.entries()].filter(([, r]) => r.committed.name ===
|
|
2511
|
+
const retired = [...truncated.entries()].filter(([, r]) => r.committed.name === _chunk4GA3CHQWcjs.TOMBSTONE_EVENT).map(([stream]) => stream);
|
|
2589
2512
|
if (retired.length) _optionalChain([deps, 'access', _137 => _137.forget_subscribed, 'optionalCall', _138 => _138(retired)]);
|
|
2590
2513
|
for (const [stream, entry] of windowed_result) truncated.set(stream, entry);
|
|
2591
2514
|
return { truncated, skipped };
|
|
2592
2515
|
}
|
|
2593
|
-
|
|
2516
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, run_close_cycle, "run_close_cycle");
|
|
2594
2517
|
function with_stream_locks(streams, deps, work) {
|
|
2595
2518
|
const with_lock = _nullishCoalesce(deps.with_stream_lock, () => ( ((_stream, w) => w())));
|
|
2596
2519
|
return [...streams].sort().reduceRight(
|
|
@@ -2598,7 +2521,7 @@ function with_stream_locks(streams, deps, work) {
|
|
|
2598
2521
|
work
|
|
2599
2522
|
)();
|
|
2600
2523
|
}
|
|
2601
|
-
|
|
2524
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, with_stream_locks, "with_stream_locks");
|
|
2602
2525
|
async function run_full_closes(full, target_map, deps, skipped) {
|
|
2603
2526
|
const none = /* @__PURE__ */ new Map();
|
|
2604
2527
|
const streams = full.map((t) => t.stream);
|
|
@@ -2654,7 +2577,7 @@ async function run_full_closes(full, target_map, deps, skipped) {
|
|
|
2654
2577
|
deps.correlation
|
|
2655
2578
|
);
|
|
2656
2579
|
}
|
|
2657
|
-
|
|
2580
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, run_full_closes, "run_full_closes");
|
|
2658
2581
|
async function run_windowed_closes(windowed, deps, skipped) {
|
|
2659
2582
|
const checkpoint = deps.reactive ? await deps.catch_up_correlation(Number.MAX_SAFE_INTEGER) : -1;
|
|
2660
2583
|
const min_at = deps.reactive ? await probe_min_watermarks(
|
|
@@ -2670,7 +2593,7 @@ async function run_windowed_closes(windowed, deps, skipped) {
|
|
|
2670
2593
|
if (!await windowed_prune_pending(t.stream, t.before, max_id))
|
|
2671
2594
|
return void 0;
|
|
2672
2595
|
if (t.archive) await t.archive();
|
|
2673
|
-
const result = await
|
|
2596
|
+
const result = await _chunkXG3UD63Ycjs.store.call(void 0, ).truncate([
|
|
2674
2597
|
{ stream: t.stream, before: t.before, max_id }
|
|
2675
2598
|
]);
|
|
2676
2599
|
return result.get(t.stream);
|
|
@@ -2680,26 +2603,26 @@ async function run_windowed_closes(windowed, deps, skipped) {
|
|
|
2680
2603
|
}
|
|
2681
2604
|
return truncated;
|
|
2682
2605
|
}
|
|
2683
|
-
|
|
2606
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, run_windowed_closes, "run_windowed_closes");
|
|
2684
2607
|
async function windowed_prune_pending(stream, before, max_id) {
|
|
2685
2608
|
let boundary_id;
|
|
2686
2609
|
let min_id;
|
|
2687
|
-
await
|
|
2610
|
+
await _chunkXG3UD63Ycjs.store.call(void 0, ).query(
|
|
2688
2611
|
(event) => {
|
|
2689
2612
|
if (min_id === void 0 || event.id < min_id) min_id = event.id;
|
|
2690
|
-
if (event.name ===
|
|
2613
|
+
if (event.name === _chunk4GA3CHQWcjs.SNAP_EVENT && event.created < before && (max_id === void 0 || event.id <= max_id) && (boundary_id === void 0 || event.id > boundary_id))
|
|
2691
2614
|
boundary_id = event.id;
|
|
2692
2615
|
},
|
|
2693
2616
|
{ stream, stream_exact: true, with_snaps: true, after: -1 }
|
|
2694
2617
|
);
|
|
2695
2618
|
return boundary_id !== void 0 && min_id < boundary_id;
|
|
2696
2619
|
}
|
|
2697
|
-
|
|
2620
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, windowed_prune_pending, "windowed_prune_pending");
|
|
2698
2621
|
async function probe_min_watermarks(streams, page_size, checkpoint) {
|
|
2699
2622
|
const min_at = /* @__PURE__ */ new Map();
|
|
2700
2623
|
const matches = source_matcher();
|
|
2701
2624
|
await walk_streams(
|
|
2702
|
-
|
|
2625
|
+
_chunkXG3UD63Ycjs.store.call(void 0, ),
|
|
2703
2626
|
(position) => {
|
|
2704
2627
|
const pending = position.correlated_at === void 0 || position.at < position.correlated_at;
|
|
2705
2628
|
const cap = pending ? position.at : Math.max(position.at, checkpoint);
|
|
@@ -2714,12 +2637,12 @@ async function probe_min_watermarks(streams, page_size, checkpoint) {
|
|
|
2714
2637
|
);
|
|
2715
2638
|
return min_at;
|
|
2716
2639
|
}
|
|
2717
|
-
|
|
2640
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, probe_min_watermarks, "probe_min_watermarks");
|
|
2718
2641
|
function source_matcher() {
|
|
2719
2642
|
const compiled = /* @__PURE__ */ new Map();
|
|
2720
2643
|
return (source, target, stream) => {
|
|
2721
2644
|
if (!source) return true;
|
|
2722
|
-
if (
|
|
2645
|
+
if (_chunkXJZ2PKJHcjs.isStreamName.call(void 0, source, target)) return source === stream;
|
|
2723
2646
|
let re = compiled.get(source);
|
|
2724
2647
|
if (!re) {
|
|
2725
2648
|
re = new RegExp(source);
|
|
@@ -2728,19 +2651,19 @@ function source_matcher() {
|
|
|
2728
2651
|
return re.test(stream);
|
|
2729
2652
|
};
|
|
2730
2653
|
}
|
|
2731
|
-
|
|
2654
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, source_matcher, "source_matcher");
|
|
2732
2655
|
async function scan_stream_heads(streams) {
|
|
2733
|
-
const stats = await
|
|
2734
|
-
exclude: [
|
|
2656
|
+
const stats = await _chunkXG3UD63Ycjs.store.call(void 0, ).query_stats(streams, {
|
|
2657
|
+
exclude: [_chunk4GA3CHQWcjs.SNAP_EVENT]
|
|
2735
2658
|
});
|
|
2736
|
-
const domain_heads = await
|
|
2737
|
-
exclude: [
|
|
2659
|
+
const domain_heads = await _chunkXG3UD63Ycjs.store.call(void 0, ).query_stats(streams, {
|
|
2660
|
+
exclude: [_chunk4GA3CHQWcjs.SNAP_EVENT, _chunk4GA3CHQWcjs.TOMBSTONE_EVENT]
|
|
2738
2661
|
});
|
|
2739
|
-
const true_heads = await
|
|
2662
|
+
const true_heads = await _chunkXG3UD63Ycjs.store.call(void 0, ).query_stats(streams, {});
|
|
2740
2663
|
const out = /* @__PURE__ */ new Map();
|
|
2741
2664
|
for (const [stream, { head }] of domain_heads) {
|
|
2742
2665
|
const marker_head = _optionalChain([stats, 'access', _140 => _140.get, 'call', _141 => _141(stream), 'optionalAccess', _142 => _142.head]);
|
|
2743
|
-
const interrupted = _optionalChain([marker_head, 'optionalAccess', _143 => _143.name]) ===
|
|
2666
|
+
const interrupted = _optionalChain([marker_head, 'optionalAccess', _143 => _143.name]) === _chunk4GA3CHQWcjs.TOMBSTONE_EVENT;
|
|
2744
2667
|
out.set(stream, {
|
|
2745
2668
|
max_id: head.id,
|
|
2746
2669
|
version: true_heads.get(stream).head.version,
|
|
@@ -2750,7 +2673,7 @@ async function scan_stream_heads(streams) {
|
|
|
2750
2673
|
}
|
|
2751
2674
|
return out;
|
|
2752
2675
|
}
|
|
2753
|
-
|
|
2676
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, scan_stream_heads, "scan_stream_heads");
|
|
2754
2677
|
async function partition_by_safety(stream_info, reactive, skipped, page_size, catch_up_correlation2) {
|
|
2755
2678
|
if (!reactive) return [...stream_info.keys()];
|
|
2756
2679
|
let needed = -1;
|
|
@@ -2764,7 +2687,7 @@ async function partition_by_safety(stream_info, reactive, skipped, page_size, ca
|
|
|
2764
2687
|
const pending_set = /* @__PURE__ */ new Set();
|
|
2765
2688
|
const matches = source_matcher();
|
|
2766
2689
|
await walk_streams(
|
|
2767
|
-
|
|
2690
|
+
_chunkXG3UD63Ycjs.store.call(void 0, ),
|
|
2768
2691
|
(position) => {
|
|
2769
2692
|
const has_work = position.correlated_at !== void 0 && position.at < position.correlated_at;
|
|
2770
2693
|
if (!has_work) return;
|
|
@@ -2784,7 +2707,7 @@ async function partition_by_safety(stream_info, reactive, skipped, page_size, ca
|
|
|
2784
2707
|
}
|
|
2785
2708
|
return safe;
|
|
2786
2709
|
}
|
|
2787
|
-
|
|
2710
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, partition_by_safety, "partition_by_safety");
|
|
2788
2711
|
async function guard_with_tombstones(safe, stream_info, correlation, tombstone2, skipped) {
|
|
2789
2712
|
const guarded = [];
|
|
2790
2713
|
const guard_events = /* @__PURE__ */ new Map();
|
|
@@ -2807,7 +2730,7 @@ async function guard_with_tombstones(safe, stream_info, correlation, tombstone2,
|
|
|
2807
2730
|
);
|
|
2808
2731
|
return { guarded, guard_events };
|
|
2809
2732
|
}
|
|
2810
|
-
|
|
2733
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, guard_with_tombstones, "guard_with_tombstones");
|
|
2811
2734
|
async function load_restart_seeds(guarded, target_map, stream_info, event_to_state, load2, logger) {
|
|
2812
2735
|
const seed_states = /* @__PURE__ */ new Map();
|
|
2813
2736
|
await Promise.all(
|
|
@@ -2826,16 +2749,16 @@ async function load_restart_seeds(guarded, target_map, stream_info, event_to_sta
|
|
|
2826
2749
|
);
|
|
2827
2750
|
return seed_states;
|
|
2828
2751
|
}
|
|
2829
|
-
|
|
2752
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, load_restart_seeds, "load_restart_seeds");
|
|
2830
2753
|
async function run_archive_callbacks(guarded, target_map) {
|
|
2831
2754
|
for (const stream of guarded) {
|
|
2832
2755
|
const archive_fn = _optionalChain([target_map, 'access', _147 => _147.get, 'call', _148 => _148(stream), 'optionalAccess', _149 => _149.archive]);
|
|
2833
2756
|
if (archive_fn) await archive_fn();
|
|
2834
2757
|
}
|
|
2835
2758
|
}
|
|
2836
|
-
|
|
2759
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, run_archive_callbacks, "run_archive_callbacks");
|
|
2837
2760
|
async function heads_still_guarded(guarded, guard_events, skipped) {
|
|
2838
|
-
const heads = await
|
|
2761
|
+
const heads = await _chunkXG3UD63Ycjs.store.call(void 0, ).query_stats(guarded, {});
|
|
2839
2762
|
return guarded.filter((stream) => {
|
|
2840
2763
|
if (_optionalChain([heads, 'access', _150 => _150.get, 'call', _151 => _151(stream), 'optionalAccess', _152 => _152.head, 'access', _153 => _153.id]) === guard_events.get(stream).id)
|
|
2841
2764
|
return true;
|
|
@@ -2843,7 +2766,7 @@ async function heads_still_guarded(guarded, guard_events, skipped) {
|
|
|
2843
2766
|
return false;
|
|
2844
2767
|
});
|
|
2845
2768
|
}
|
|
2846
|
-
|
|
2769
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, heads_still_guarded, "heads_still_guarded");
|
|
2847
2770
|
async function truncate_and_warm_cache(guarded, seed_states, guard_events, correlation) {
|
|
2848
2771
|
const trunc_targets = guarded.map((stream) => {
|
|
2849
2772
|
const snapshot = seed_states.get(stream);
|
|
@@ -2854,18 +2777,18 @@ async function truncate_and_warm_cache(guarded, seed_states, guard_events, corre
|
|
|
2854
2777
|
meta: {
|
|
2855
2778
|
correlation,
|
|
2856
2779
|
causation: {
|
|
2857
|
-
event: { id: guard.id, name:
|
|
2780
|
+
event: { id: guard.id, name: _chunk4GA3CHQWcjs.TOMBSTONE_EVENT, stream: guard.stream }
|
|
2858
2781
|
}
|
|
2859
2782
|
}
|
|
2860
2783
|
};
|
|
2861
2784
|
});
|
|
2862
|
-
const truncated = await
|
|
2785
|
+
const truncated = await _chunkXG3UD63Ycjs.store.call(void 0, ).truncate(trunc_targets);
|
|
2863
2786
|
await Promise.all(
|
|
2864
2787
|
guarded.map(async (stream) => {
|
|
2865
2788
|
const entry = truncated.get(stream);
|
|
2866
2789
|
const state2 = seed_states.get(stream);
|
|
2867
2790
|
if (state2 && entry) {
|
|
2868
|
-
await
|
|
2791
|
+
await _chunkXG3UD63Ycjs.cache.call(void 0, ).set(stream, {
|
|
2869
2792
|
stream,
|
|
2870
2793
|
state: state2,
|
|
2871
2794
|
version: entry.committed.version,
|
|
@@ -2874,19 +2797,19 @@ async function truncate_and_warm_cache(guarded, seed_states, guard_events, corre
|
|
|
2874
2797
|
snaps: 1
|
|
2875
2798
|
});
|
|
2876
2799
|
} else {
|
|
2877
|
-
await
|
|
2800
|
+
await _chunkXG3UD63Ycjs.cache.call(void 0, ).invalidate(stream);
|
|
2878
2801
|
}
|
|
2879
2802
|
})
|
|
2880
2803
|
);
|
|
2881
2804
|
return truncated;
|
|
2882
2805
|
}
|
|
2883
|
-
|
|
2806
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, truncate_and_warm_cache, "truncate_and_warm_cache");
|
|
2884
2807
|
|
|
2885
2808
|
// src/internal/correlate-cycle.ts
|
|
2886
2809
|
|
|
2887
2810
|
var COLD_START_BACK_SCAN = 1e4;
|
|
2888
2811
|
var CORRELATION_LEASE_MS = 5e3;
|
|
2889
|
-
var registry_key = /* @__PURE__ */
|
|
2812
|
+
var registry_key = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (events) => {
|
|
2890
2813
|
const shape = Object.keys(events).filter((name) => events[name].reactions.size > 0).sort().map((name) => [name, [...events[name].reactions.keys()].sort()]);
|
|
2891
2814
|
return _crypto.createHash.call(void 0, "sha256").update(JSON.stringify(shape)).digest("hex").slice(0, 32);
|
|
2892
2815
|
}, "registry_key");
|
|
@@ -2898,7 +2821,7 @@ function report_undeclared_lane(seen, handler, target, lane, declared) {
|
|
|
2898
2821
|
`Reaction "${handler}" resolved onto undeclared lane "${lane}" \u2014 for example target "${target}". Declared lanes: ${[...declared].map((l) => `"${l}"`).join(", ")}. No controller claims it, so the stream would never drain \u2014 running it on "default" instead. The equivalent static \`.to({ lane })\` is rejected at build; a dynamic resolver's lane is only knowable here.`
|
|
2899
2822
|
);
|
|
2900
2823
|
}
|
|
2901
|
-
|
|
2824
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, report_undeclared_lane, "report_undeclared_lane");
|
|
2902
2825
|
function report_bad_priority(seen, handler, target, priority) {
|
|
2903
2826
|
report_once(
|
|
2904
2827
|
seen,
|
|
@@ -2906,7 +2829,7 @@ function report_bad_priority(seen, handler, target, priority) {
|
|
|
2906
2829
|
`Reaction "${handler}" resolved priority ${String(priority)} for target "${target}", which isn't a 32-bit integer. Running it at priority 0 instead. The equivalent static \`.to({ priority })\` is rejected at build; a dynamic resolver's priority is only knowable here.`
|
|
2907
2830
|
);
|
|
2908
2831
|
}
|
|
2909
|
-
|
|
2832
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, report_bad_priority, "report_bad_priority");
|
|
2910
2833
|
function report_lane_conflict(seen, handler, target, kept, dropped) {
|
|
2911
2834
|
report_once(
|
|
2912
2835
|
seen,
|
|
@@ -2914,40 +2837,40 @@ function report_lane_conflict(seen, handler, target, kept, dropped) {
|
|
|
2914
2837
|
`Reaction "${handler}" resolved lane "${dropped}" for a stream already on "${kept}" \u2014 for example "${target}". These are conflicting lane assignments from two dynamic resolutions at equal priority. Keeping "${kept}", the lane it was first discovered on \u2014 re-laning a live stream would move it out from under a worker holding its lease. The reaction resolving "${dropped}" runs inside the "${kept}" lane's budget, and a process restricted to "${dropped}" via onlyLanes never runs it. The equivalent static declaration is rejected at build; align the resolvers, or split the target.`
|
|
2915
2838
|
);
|
|
2916
2839
|
}
|
|
2917
|
-
|
|
2918
|
-
var CorrelateCycle = (
|
|
2840
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, report_lane_conflict, "report_lane_conflict");
|
|
2841
|
+
var CorrelateCycle = (_class4 = class {
|
|
2919
2842
|
static {
|
|
2920
|
-
|
|
2843
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, this, "CorrelateCycle");
|
|
2921
2844
|
}
|
|
2922
|
-
|
|
2845
|
+
__init9() {this._checkpoint = -1}
|
|
2923
2846
|
// Lease holder id; per instance, so a restart never inherits a stale claim.
|
|
2924
|
-
|
|
2847
|
+
__init10() {this._by = _crypto.randomUUID.call(void 0, )}
|
|
2925
2848
|
|
|
2926
2849
|
// Local expiry of the held lease (0 = none); stale only costs a duplicate scan.
|
|
2927
|
-
|
|
2850
|
+
__init11() {this._lease_until = 0}
|
|
2928
2851
|
// Armed while `_raised` (bumped by a commit or notification) is ahead of
|
|
2929
2852
|
// `_lowered` (the raise count the last short page saw). Starts armed.
|
|
2930
|
-
|
|
2931
|
-
|
|
2853
|
+
__init12() {this._raised = 1}
|
|
2854
|
+
__init13() {this._lowered = 0}
|
|
2932
2855
|
// Bumped by a release (shutdown), so a scan or lease reply that was out
|
|
2933
2856
|
// across one writes nothing.
|
|
2934
|
-
|
|
2857
|
+
__init14() {this._epoch = 0}
|
|
2935
2858
|
// Passes in flight: a restore waits for them, and refuses new ones.
|
|
2936
|
-
|
|
2937
|
-
|
|
2859
|
+
__init15() {this._passes = /* @__PURE__ */ new Set()}
|
|
2860
|
+
__init16() {this._restoring = false}
|
|
2938
2861
|
|
|
2939
2862
|
// Bounded by `maxSubscribedStreams`; static records live apart so eviction
|
|
2940
2863
|
// never lets a resolution re-lane them.
|
|
2941
2864
|
|
|
2942
|
-
|
|
2943
|
-
|
|
2865
|
+
__init17() {this._static_subscriptions = /* @__PURE__ */ new Map()}
|
|
2866
|
+
__init18() {this._patterns = new (0, _chunkXG3UD63Ycjs.LruMap)(PATTERN_CACHE_SIZE)}
|
|
2944
2867
|
|
|
2945
2868
|
|
|
2946
2869
|
|
|
2947
2870
|
|
|
2948
2871
|
|
|
2949
2872
|
// Report-once keys; per instance because `internal/` holds no module state.
|
|
2950
|
-
|
|
2873
|
+
__init19() {this._reported = /* @__PURE__ */ new Set()}
|
|
2951
2874
|
constructor({
|
|
2952
2875
|
registry,
|
|
2953
2876
|
static_targets,
|
|
@@ -2956,9 +2879,9 @@ var CorrelateCycle = (_class5 = class {
|
|
|
2956
2879
|
declared_lanes,
|
|
2957
2880
|
shard,
|
|
2958
2881
|
on_init
|
|
2959
|
-
}) {;
|
|
2882
|
+
}) {;_class4.prototype.__init9.call(this);_class4.prototype.__init10.call(this);_class4.prototype.__init11.call(this);_class4.prototype.__init12.call(this);_class4.prototype.__init13.call(this);_class4.prototype.__init14.call(this);_class4.prototype.__init15.call(this);_class4.prototype.__init16.call(this);_class4.prototype.__init17.call(this);_class4.prototype.__init18.call(this);_class4.prototype.__init19.call(this);
|
|
2960
2883
|
this._key = shard ? `${registry_key(registry.events)}:${[...shard].sort().join(",")}` : registry_key(registry.events);
|
|
2961
|
-
this._dynamic_subscriptions = new (0,
|
|
2884
|
+
this._dynamic_subscriptions = new (0, _chunkXG3UD63Ycjs.LruMap)(max_subscribed_streams);
|
|
2962
2885
|
this._registry = registry;
|
|
2963
2886
|
this._declared_lanes = declared_lanes;
|
|
2964
2887
|
this._static_targets = static_targets;
|
|
@@ -3016,7 +2939,7 @@ var CorrelateCycle = (_class5 = class {
|
|
|
3016
2939
|
// Would the target's own `fetch` (filtered by `source`) return this event?
|
|
3017
2940
|
_in_fetch_window(source, stream) {
|
|
3018
2941
|
if (source === void 0 || source === stream) return true;
|
|
3019
|
-
if (
|
|
2942
|
+
if (_chunkXJZ2PKJHcjs.isStreamName.call(void 0, source)) return false;
|
|
3020
2943
|
let pattern = this._patterns.get(source);
|
|
3021
2944
|
if (!pattern) {
|
|
3022
2945
|
pattern = new RegExp(source);
|
|
@@ -3038,7 +2961,7 @@ var CorrelateCycle = (_class5 = class {
|
|
|
3038
2961
|
async _scan(limit, lease) {
|
|
3039
2962
|
await this._init();
|
|
3040
2963
|
const epoch = this._epoch;
|
|
3041
|
-
const idle = /* @__PURE__ */
|
|
2964
|
+
const idle = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => ({
|
|
3042
2965
|
kind: "idle",
|
|
3043
2966
|
last_id: this._checkpoint
|
|
3044
2967
|
}), "idle");
|
|
@@ -3059,7 +2982,7 @@ var CorrelateCycle = (_class5 = class {
|
|
|
3059
2982
|
const correlated = /* @__PURE__ */ new Map();
|
|
3060
2983
|
let last_id = after;
|
|
3061
2984
|
let stopped = false;
|
|
3062
|
-
const found = await
|
|
2985
|
+
const found = await _chunkXG3UD63Ycjs.store.call(void 0, ).query(
|
|
3063
2986
|
(event) => {
|
|
3064
2987
|
if (stopped) return;
|
|
3065
2988
|
const register = this._registry.events[event.name];
|
|
@@ -3079,7 +3002,7 @@ var CorrelateCycle = (_class5 = class {
|
|
|
3079
3002
|
}
|
|
3080
3003
|
if (!resolved) continue;
|
|
3081
3004
|
try {
|
|
3082
|
-
|
|
3005
|
+
_chunkXG3UD63Ycjs.check.call(void 0, "target", resolved);
|
|
3083
3006
|
} catch (e2) {
|
|
3084
3007
|
report_bad_priority(
|
|
3085
3008
|
this._reported,
|
|
@@ -3115,9 +3038,9 @@ var CorrelateCycle = (_class5 = class {
|
|
|
3115
3038
|
correlated_at: void 0
|
|
3116
3039
|
};
|
|
3117
3040
|
const seen_in_scan = correlated.has(resolved.target);
|
|
3118
|
-
const held_lane = _nullishCoalesce((seen_in_scan ? entry.lane : _optionalChain([recorded, 'optionalAccess', _156 => _156.lane])), () => (
|
|
3041
|
+
const held_lane = _nullishCoalesce((seen_in_scan ? entry.lane : _optionalChain([recorded, 'optionalAccess', _156 => _156.lane])), () => ( _chunk4GA3CHQWcjs.DEFAULT_LANE));
|
|
3119
3042
|
const held_priority = seen_in_scan ? entry.priority : _optionalChain([recorded, 'optionalAccess', _157 => _157.priority]);
|
|
3120
|
-
const resolved_lane = _nullishCoalesce(lane, () => (
|
|
3043
|
+
const resolved_lane = _nullishCoalesce(lane, () => ( _chunk4GA3CHQWcjs.DEFAULT_LANE));
|
|
3121
3044
|
if (held_priority === priority && held_lane !== resolved_lane)
|
|
3122
3045
|
report_lane_conflict(
|
|
3123
3046
|
this._reported,
|
|
@@ -3191,7 +3114,7 @@ var CorrelateCycle = (_class5 = class {
|
|
|
3191
3114
|
await Promise.all(
|
|
3192
3115
|
missed.map(async ([stream, entry]) => {
|
|
3193
3116
|
let row;
|
|
3194
|
-
await
|
|
3117
|
+
await _chunkXG3UD63Ycjs.store.call(void 0, ).query_streams(
|
|
3195
3118
|
(position) => {
|
|
3196
3119
|
row = position;
|
|
3197
3120
|
},
|
|
@@ -3203,8 +3126,8 @@ var CorrelateCycle = (_class5 = class {
|
|
|
3203
3126
|
lane: row.lane
|
|
3204
3127
|
});
|
|
3205
3128
|
if (entry.priority > row.priority) return;
|
|
3206
|
-
const held_lane = _nullishCoalesce(row.lane, () => (
|
|
3207
|
-
const resolved_lane = _nullishCoalesce(entry.lane, () => (
|
|
3129
|
+
const held_lane = _nullishCoalesce(row.lane, () => ( _chunk4GA3CHQWcjs.DEFAULT_LANE));
|
|
3130
|
+
const resolved_lane = _nullishCoalesce(entry.lane, () => ( _chunk4GA3CHQWcjs.DEFAULT_LANE));
|
|
3208
3131
|
if (entry.priority === row.priority && held_lane !== resolved_lane)
|
|
3209
3132
|
report_lane_conflict(
|
|
3210
3133
|
this._reported,
|
|
@@ -3230,12 +3153,12 @@ var CorrelateCycle = (_class5 = class {
|
|
|
3230
3153
|
millis: 0
|
|
3231
3154
|
});
|
|
3232
3155
|
} catch (error) {
|
|
3233
|
-
|
|
3156
|
+
_chunkXG3UD63Ycjs.log.call(void 0, ).warn(
|
|
3234
3157
|
`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)))}`
|
|
3235
3158
|
);
|
|
3236
3159
|
}
|
|
3237
3160
|
}
|
|
3238
|
-
},
|
|
3161
|
+
}, _class4);
|
|
3239
3162
|
|
|
3240
3163
|
// src/internal/pii.ts
|
|
3241
3164
|
function pii_split(emitted, fields) {
|
|
@@ -3249,13 +3172,13 @@ function pii_split(emitted, fields) {
|
|
|
3249
3172
|
}
|
|
3250
3173
|
return { name: emitted.name, data, pii };
|
|
3251
3174
|
}
|
|
3252
|
-
|
|
3175
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, pii_split, "pii_split");
|
|
3253
3176
|
function pii_gate(event, fields, predicate, actor) {
|
|
3254
3177
|
const data = event.data;
|
|
3255
3178
|
const { pii, ...rest } = event;
|
|
3256
3179
|
if (pii == null) {
|
|
3257
3180
|
const shredded = { ...data };
|
|
3258
|
-
for (const f of fields) shredded[f] =
|
|
3181
|
+
for (const f of fields) shredded[f] = _chunk4GA3CHQWcjs.SHREDDED;
|
|
3259
3182
|
return { ...rest, data: shredded };
|
|
3260
3183
|
}
|
|
3261
3184
|
const allowed = !!actor && !!predicate && predicate(event, actor);
|
|
@@ -3266,15 +3189,15 @@ function pii_gate(event, fields, predicate, actor) {
|
|
|
3266
3189
|
};
|
|
3267
3190
|
}
|
|
3268
3191
|
const redacted = { ...data };
|
|
3269
|
-
for (const f of fields) redacted[f] =
|
|
3192
|
+
for (const f of fields) redacted[f] = _chunk4GA3CHQWcjs.REDACTED;
|
|
3270
3193
|
return { ...rest, data: redacted };
|
|
3271
3194
|
}
|
|
3272
|
-
|
|
3273
|
-
var IDENTITY_GATE = /* @__PURE__ */
|
|
3195
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, pii_gate, "pii_gate");
|
|
3196
|
+
var IDENTITY_GATE = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (event) => event, "IDENTITY_GATE");
|
|
3274
3197
|
function make_gate(fields, predicate) {
|
|
3275
3198
|
return (event, actor) => pii_gate(event, fields, predicate, actor);
|
|
3276
3199
|
}
|
|
3277
|
-
|
|
3200
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, make_gate, "make_gate");
|
|
3278
3201
|
function pii_strip(event, fields) {
|
|
3279
3202
|
const data = event.data;
|
|
3280
3203
|
const stripped = {};
|
|
@@ -3287,22 +3210,22 @@ function pii_strip(event, fields) {
|
|
|
3287
3210
|
data: stripped
|
|
3288
3211
|
};
|
|
3289
3212
|
}
|
|
3290
|
-
|
|
3213
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, pii_strip, "pii_strip");
|
|
3291
3214
|
|
|
3292
3215
|
// src/internal/projection-fold.ts
|
|
3293
3216
|
var FOLD_RESET = /* @__PURE__ */ Symbol("act.fold.reset");
|
|
3294
3217
|
function make_fold_handler(me, flush, config2, sensitive_fields) {
|
|
3295
3218
|
const load_me = {
|
|
3296
3219
|
...me,
|
|
3297
|
-
view: /* @__PURE__ */
|
|
3220
|
+
view: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (raw, actor) => {
|
|
3298
3221
|
const viewed = me.view(raw, actor);
|
|
3299
3222
|
const fields = sensitive_fields(viewed.name);
|
|
3300
3223
|
return fields.length ? pii_strip(viewed, fields) : viewed;
|
|
3301
3224
|
}, "view")
|
|
3302
3225
|
};
|
|
3303
3226
|
const cache2 = /* @__PURE__ */ new Map();
|
|
3304
|
-
const row = /* @__PURE__ */
|
|
3305
|
-
const flush_dirty = /* @__PURE__ */
|
|
3227
|
+
const row = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, ({ dirty: _, ...row2 }) => row2, "row");
|
|
3228
|
+
const flush_dirty = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, async () => {
|
|
3306
3229
|
const rows = [];
|
|
3307
3230
|
const flushed = [];
|
|
3308
3231
|
for (const f of cache2.values())
|
|
@@ -3314,7 +3237,7 @@ function make_fold_handler(me, flush, config2, sensitive_fields) {
|
|
|
3314
3237
|
await flush(rows);
|
|
3315
3238
|
for (const f of flushed) f.dirty = false;
|
|
3316
3239
|
}, "flush_dirty");
|
|
3317
|
-
const first_sight = /* @__PURE__ */
|
|
3240
|
+
const first_sight = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, async (stream) => {
|
|
3318
3241
|
if (cache2.size >= config2.maxCachedStates) {
|
|
3319
3242
|
const oldest = cache2.keys().next().value;
|
|
3320
3243
|
const evictee = cache2.get(oldest);
|
|
@@ -3334,7 +3257,7 @@ function make_fold_handler(me, flush, config2, sensitive_fields) {
|
|
|
3334
3257
|
cache2.set(stream, seated);
|
|
3335
3258
|
return seated;
|
|
3336
3259
|
}, "first_sight");
|
|
3337
|
-
const handler = /* @__PURE__ */
|
|
3260
|
+
const handler = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, async (events) => {
|
|
3338
3261
|
let folded_since_flush = 0;
|
|
3339
3262
|
for (const event of events) {
|
|
3340
3263
|
const stream = event.stream;
|
|
@@ -3372,32 +3295,32 @@ function make_fold_handler(me, flush, config2, sensitive_fields) {
|
|
|
3372
3295
|
}
|
|
3373
3296
|
await flush_dirty();
|
|
3374
3297
|
}, "handler");
|
|
3375
|
-
Object.defineProperty(handler, FOLD_RESET, { value: /* @__PURE__ */
|
|
3298
|
+
Object.defineProperty(handler, FOLD_RESET, { value: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => cache2.clear(), "value") });
|
|
3376
3299
|
return handler;
|
|
3377
3300
|
}
|
|
3378
|
-
|
|
3301
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, make_fold_handler, "make_fold_handler");
|
|
3379
3302
|
|
|
3380
3303
|
// src/internal/settle.ts
|
|
3381
|
-
var SettleLoop = (
|
|
3304
|
+
var SettleLoop = (_class5 = class {
|
|
3382
3305
|
static {
|
|
3383
|
-
|
|
3306
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, this, "SettleLoop");
|
|
3384
3307
|
}
|
|
3385
|
-
|
|
3308
|
+
__init20() {this._timer = void 0}
|
|
3386
3309
|
// The cycle in flight, set while one runs. Shutdown waits for it
|
|
3387
3310
|
// (`stop()` cancels scheduling only). Never rejects.
|
|
3388
3311
|
|
|
3389
3312
|
// A wake-up arrived while a cycle ran: run one more pass after it.
|
|
3390
|
-
|
|
3313
|
+
__init21() {this._pending = false}
|
|
3391
3314
|
// The last caller's options, used by the next pass.
|
|
3392
|
-
|
|
3315
|
+
__init22() {this._next = void 0}
|
|
3393
3316
|
// When the scheduled pass fires (epoch ms).
|
|
3394
|
-
|
|
3317
|
+
__init23() {this._due = 0}
|
|
3395
3318
|
// Set at shutdown: nothing schedules again.
|
|
3396
|
-
|
|
3319
|
+
__init24() {this._stopped = false}
|
|
3397
3320
|
|
|
3398
3321
|
// Debounce window applied when the caller doesn't override via `SettleOptions.debounceMs`.
|
|
3399
3322
|
|
|
3400
|
-
constructor(deps, default_debounce_ms) {;
|
|
3323
|
+
constructor(deps, default_debounce_ms) {;_class5.prototype.__init20.call(this);_class5.prototype.__init21.call(this);_class5.prototype.__init22.call(this);_class5.prototype.__init23.call(this);_class5.prototype.__init24.call(this);
|
|
3401
3324
|
this._deps = deps;
|
|
3402
3325
|
this._default_debounce_ms = default_debounce_ms;
|
|
3403
3326
|
}
|
|
@@ -3478,14 +3401,14 @@ var SettleLoop = (_class6 = class {
|
|
|
3478
3401
|
this._timer = void 0;
|
|
3479
3402
|
}
|
|
3480
3403
|
}
|
|
3481
|
-
},
|
|
3404
|
+
}, _class5);
|
|
3482
3405
|
|
|
3483
3406
|
// src/act.ts
|
|
3484
|
-
var Act = (
|
|
3407
|
+
var Act = (_class6 = class {
|
|
3485
3408
|
static {
|
|
3486
|
-
|
|
3409
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, this, "Act");
|
|
3487
3410
|
}
|
|
3488
|
-
|
|
3411
|
+
__init25() {this._emitter = new (0, _events2.default)()}
|
|
3489
3412
|
|
|
3490
3413
|
|
|
3491
3414
|
|
|
@@ -3571,14 +3494,14 @@ var Act = (_class7 = class {
|
|
|
3571
3494
|
// Lanes to arm per event; `"all"` when a dynamic resolver hides the lane.
|
|
3572
3495
|
|
|
3573
3496
|
|
|
3574
|
-
|
|
3497
|
+
__init26() {this._logger = _chunkXG3UD63Ycjs.log.call(void 0, )}
|
|
3575
3498
|
// This Act's ports: its own bag, or the singleton adapters.
|
|
3576
3499
|
|
|
3577
3500
|
// Runs a body so internal `store()`/`cache()` calls resolve to `_ports`.
|
|
3578
3501
|
|
|
3579
3502
|
|
|
3580
3503
|
|
|
3581
|
-
|
|
3504
|
+
__init27() {this._close_lock = new CloseLock()}
|
|
3582
3505
|
// Every lane a controller can exist for: `"default"` plus each declared one.
|
|
3583
3506
|
|
|
3584
3507
|
/** Drain lanes declared via `.withLane(...)`. Implicit default not included. */
|
|
@@ -3586,7 +3509,7 @@ var Act = (_class7 = class {
|
|
|
3586
3509
|
return this._lanes;
|
|
3587
3510
|
}
|
|
3588
3511
|
/** Use the {@link act} builder rather than constructing directly. */
|
|
3589
|
-
constructor(registry, states = /* @__PURE__ */ new Map(), batch_handlers = /* @__PURE__ */ new Map(), options = {}, lanes = [], patch_fn = bare_patch) {;
|
|
3512
|
+
constructor(registry, states = /* @__PURE__ */ new Map(), batch_handlers = /* @__PURE__ */ new Map(), options = {}, lanes = [], patch_fn = bare_patch) {;_class6.prototype.__init25.call(this);_class6.prototype.__init26.call(this);_class6.prototype.__init27.call(this);
|
|
3590
3513
|
this.registry = registry;
|
|
3591
3514
|
this._states = states;
|
|
3592
3515
|
this._batch_handlers = batch_handlers;
|
|
@@ -3600,11 +3523,11 @@ var Act = (_class7 = class {
|
|
|
3600
3523
|
throw new Error(
|
|
3601
3524
|
`ActOptions.onlyLanes references undeclared lane(s): ${undeclared.map((l) => `"${l}"`).join(", ")}`
|
|
3602
3525
|
);
|
|
3603
|
-
|
|
3604
|
-
if (options.scoped)
|
|
3605
|
-
this._ports = _nullishCoalesce(options.scoped, () => (
|
|
3526
|
+
_chunkXG3UD63Ycjs.check.call(void 0, "act", options);
|
|
3527
|
+
if (options.scoped) _chunkXG3UD63Ycjs.check.call(void 0, "store", options.scoped.store);
|
|
3528
|
+
this._ports = _nullishCoalesce(options.scoped, () => ( _chunkXG3UD63Ycjs.unscoped_ports.call(void 0, )));
|
|
3606
3529
|
const ports = this._ports;
|
|
3607
|
-
this._scoped =
|
|
3530
|
+
this._scoped = _chunkXG3UD63Ycjs.make_run_scoped.call(void 0, {
|
|
3608
3531
|
// Getters, not a spread: the singletons resolve lazily, so a later
|
|
3609
3532
|
// `store(...)` / `cache(...)` still takes effect.
|
|
3610
3533
|
get store() {
|
|
@@ -3614,14 +3537,14 @@ var Act = (_class7 = class {
|
|
|
3614
3537
|
return ports.cache;
|
|
3615
3538
|
},
|
|
3616
3539
|
// Parsed per build, so a bad window throws on every build.
|
|
3617
|
-
autoclose_window:
|
|
3540
|
+
autoclose_window: _chunkXG3UD63Ycjs.check.call(void 0, "autoclose", options).autocloseWindow
|
|
3618
3541
|
});
|
|
3619
3542
|
this._correlator = _nullishCoalesce(options.correlator, () => ( default_correlator));
|
|
3620
3543
|
this._es = build_es(this._logger, this._correlator, patch_fn);
|
|
3621
3544
|
this._cd = build_drain(this._logger);
|
|
3622
3545
|
const handle = build_handle({
|
|
3623
3546
|
logger: this._logger,
|
|
3624
|
-
reaction_scope:
|
|
3547
|
+
reaction_scope: _chunkXG3UD63Ycjs.make_reaction_scope.call(void 0, {
|
|
3625
3548
|
do: this.do.bind(this),
|
|
3626
3549
|
load: this.load.bind(this),
|
|
3627
3550
|
query: this.query.bind(this),
|
|
@@ -3651,17 +3574,17 @@ var Act = (_class7 = class {
|
|
|
3651
3574
|
this._ports.store,
|
|
3652
3575
|
options.listen !== false
|
|
3653
3576
|
);
|
|
3654
|
-
|
|
3577
|
+
_chunkXG3UD63Ycjs.register_weak_disposer.call(void 0, new WeakRef(this), (self) => self.shutdown());
|
|
3655
3578
|
}
|
|
3656
3579
|
// Shared by drain, settle and autoclose; bad knobs throw at build.
|
|
3657
3580
|
_build_breaker(options) {
|
|
3658
3581
|
return new CircuitBreaker(
|
|
3659
|
-
|
|
3582
|
+
_chunkXG3UD63Ycjs.check.call(void 0, "circuit_breaker", _nullishCoalesce(options.circuitBreaker, () => ( {}))),
|
|
3660
3583
|
{
|
|
3661
|
-
on_error: /* @__PURE__ */
|
|
3584
|
+
on_error: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (error, circuit) => this._emit_error(error, circuit), "on_error"),
|
|
3662
3585
|
// When the cooldown elapses, settle once: its scan or claim is the
|
|
3663
3586
|
// half-open probe that closes or re-opens the breaker.
|
|
3664
|
-
on_retry: /* @__PURE__ */
|
|
3587
|
+
on_retry: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => this._schedule(), "on_retry")
|
|
3665
3588
|
}
|
|
3666
3589
|
);
|
|
3667
3590
|
}
|
|
@@ -3681,16 +3604,16 @@ var Act = (_class7 = class {
|
|
|
3681
3604
|
batch_handlers: this._batch_handlers,
|
|
3682
3605
|
handle,
|
|
3683
3606
|
handle_batch,
|
|
3684
|
-
on_acked: /* @__PURE__ */
|
|
3685
|
-
on_blocked: /* @__PURE__ */
|
|
3607
|
+
on_acked: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (acked) => this.emit("acked", acked), "on_acked"),
|
|
3608
|
+
on_blocked: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (blocked) => this.emit("blocked", blocked), "on_blocked"),
|
|
3686
3609
|
// Reaction-requested close: the same machinery as `app.close`.
|
|
3687
3610
|
// A store failure reaches the breaker; anything else (the archive
|
|
3688
3611
|
// callback is app code) is logged here, never counted.
|
|
3689
|
-
on_close: /* @__PURE__ */
|
|
3612
|
+
on_close: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, async (targets) => {
|
|
3690
3613
|
try {
|
|
3691
3614
|
await this._run_close(targets);
|
|
3692
3615
|
} catch (error) {
|
|
3693
|
-
if (error instanceof
|
|
3616
|
+
if (error instanceof _chunk4GA3CHQWcjs.StoreError) throw error;
|
|
3694
3617
|
this._logger.error(
|
|
3695
3618
|
error,
|
|
3696
3619
|
`Reaction-requested close of ${targets.map((t) => `"${t.stream}"`).join(", ")} failed; the policy retries it (a full close the next day, a prune on the stream's next commit), or close it now with app.close(...) once the cause is fixed.`
|
|
@@ -3724,7 +3647,7 @@ var Act = (_class7 = class {
|
|
|
3724
3647
|
// Audit deps, built after the controllers so the lane set is final.
|
|
3725
3648
|
_build_audit_deps() {
|
|
3726
3649
|
return {
|
|
3727
|
-
store:
|
|
3650
|
+
store: _chunkXG3UD63Ycjs.store,
|
|
3728
3651
|
event_to_state: this._event_to_state,
|
|
3729
3652
|
sensitive_fields: this.registry.sensitive_fields,
|
|
3730
3653
|
// Declared lanes, not this process's controllers: a lane another
|
|
@@ -3738,14 +3661,14 @@ var Act = (_class7 = class {
|
|
|
3738
3661
|
registry: this.registry,
|
|
3739
3662
|
static_targets: classification.static_targets,
|
|
3740
3663
|
cd: this._cd,
|
|
3741
|
-
max_subscribed_streams: _nullishCoalesce(options.maxSubscribedStreams, () => (
|
|
3664
|
+
max_subscribed_streams: _nullishCoalesce(options.maxSubscribedStreams, () => ( _chunk4GA3CHQWcjs.DEFAULT_MAX_SUBSCRIBED_STREAMS)),
|
|
3742
3665
|
// Declared lanes (not active ones): a lane another process claims is
|
|
3743
3666
|
// still a valid destination.
|
|
3744
3667
|
declared_lanes: new Set(this._declared_lanes),
|
|
3745
3668
|
// Built after the controllers, so their keys are the active lanes.
|
|
3746
3669
|
shard: this._drain_controllers.size < this._declared_lanes.length ? [...this._drain_controllers.keys()] : void 0,
|
|
3747
3670
|
// Only reached on a draining app: writer-only ones never correlate.
|
|
3748
|
-
on_init: /* @__PURE__ */
|
|
3671
|
+
on_init: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, async () => {
|
|
3749
3672
|
this._arm_all();
|
|
3750
3673
|
await this._seed_persisted_defers();
|
|
3751
3674
|
}, "on_init")
|
|
@@ -3754,7 +3677,7 @@ var Act = (_class7 = class {
|
|
|
3754
3677
|
// Cold start: an idle deferred stream still fires on time after a restart.
|
|
3755
3678
|
async _seed_persisted_defers() {
|
|
3756
3679
|
const now = Date.now();
|
|
3757
|
-
await walk_streams(
|
|
3680
|
+
await walk_streams(_chunkXG3UD63Ycjs.store.call(void 0, ), (pos) => {
|
|
3758
3681
|
if (pos.deferred_at === void 0 || pos.deferred_at <= now) return;
|
|
3759
3682
|
const controller = this._drain_controllers.get(_nullishCoalesce(pos.lane, () => ( "default")));
|
|
3760
3683
|
_optionalChain([controller, 'optionalAccess', _165 => _165.seed_defer, 'call', _166 => _166(pos.stream, pos.deferred_at)]);
|
|
@@ -3763,14 +3686,14 @@ var Act = (_class7 = class {
|
|
|
3763
3686
|
_build_settle(options) {
|
|
3764
3687
|
return new SettleLoop(
|
|
3765
3688
|
{
|
|
3766
|
-
correlate: /* @__PURE__ */
|
|
3689
|
+
correlate: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (q) => this._correlate_pass(_nullishCoalesce(_nullishCoalesce(q.limit, () => ( this._poll_limit)), () => ( 100)), true), "correlate"),
|
|
3767
3690
|
// `settle()` validated the options, and `_schedule` skips writer-only
|
|
3768
3691
|
// instances, so the loop drains through the internal path.
|
|
3769
|
-
drain: /* @__PURE__ */
|
|
3770
|
-
on_settled: /* @__PURE__ */
|
|
3692
|
+
drain: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (o) => this._scoped(() => this._drain_all(o)), "drain"),
|
|
3693
|
+
on_settled: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (drain) => this.emit("settled", drain), "on_settled"),
|
|
3771
3694
|
breaker: this._breaker
|
|
3772
3695
|
},
|
|
3773
|
-
_nullishCoalesce(options.settleDebounceMs, () => (
|
|
3696
|
+
_nullishCoalesce(options.settleDebounceMs, () => ( _chunk4GA3CHQWcjs.DEFAULT_SETTLE_DEBOUNCE_MS))
|
|
3774
3697
|
);
|
|
3775
3698
|
}
|
|
3776
3699
|
|
|
@@ -3790,7 +3713,7 @@ var Act = (_class7 = class {
|
|
|
3790
3713
|
*/
|
|
3791
3714
|
shutdown(options) {
|
|
3792
3715
|
if (!this._shutdown_promise) {
|
|
3793
|
-
|
|
3716
|
+
_chunkXG3UD63Ycjs.check.call(void 0, "shutdown", _nullishCoalesce(options, () => ( {})));
|
|
3794
3717
|
this._shutdown_promise = (async () => {
|
|
3795
3718
|
this.stop_correlations();
|
|
3796
3719
|
this._settle.stop(true);
|
|
@@ -3808,10 +3731,10 @@ var Act = (_class7 = class {
|
|
|
3808
3731
|
// The largest `leaseMillis` among lanes with a cycle in flight (the
|
|
3809
3732
|
// default for none or 0, and for a running settle), capped.
|
|
3810
3733
|
_derive_grace_ms(running, settling) {
|
|
3811
|
-
let max = settling ?
|
|
3734
|
+
let max = settling ? _chunkXG3UD63Ycjs.DEFAULT_LEASE_MILLIS : 0;
|
|
3812
3735
|
for (const c of running)
|
|
3813
|
-
max = Math.max(max, c.lease_millis ||
|
|
3814
|
-
return Math.min(max,
|
|
3736
|
+
max = Math.max(max, c.lease_millis || _chunkXG3UD63Ycjs.DEFAULT_LEASE_MILLIS);
|
|
3737
|
+
return Math.min(max, _chunkXG3UD63Ycjs.MAX_SHUTDOWN_GRACE_MS);
|
|
3815
3738
|
}
|
|
3816
3739
|
async _await_inflight(grace_ms) {
|
|
3817
3740
|
const running = [...this._drain_controllers.values()].filter(
|
|
@@ -3895,7 +3818,7 @@ var Act = (_class7 = class {
|
|
|
3895
3818
|
* @see {@link ValidationError}, {@link PreconditionError}, {@link ConcurrencyError}
|
|
3896
3819
|
*/
|
|
3897
3820
|
async do(action2, target, payload, options) {
|
|
3898
|
-
const reacting_to = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _168 => _168.reactingTo]), () => (
|
|
3821
|
+
const reacting_to = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _168 => _168.reactingTo]), () => ( _chunkXG3UD63Ycjs.current_reacting.call(void 0, )));
|
|
3899
3822
|
const do_options = reacting_to === _optionalChain([options, 'optionalAccess', _169 => _169.reactingTo]) ? options : { ...options, reactingTo: reacting_to };
|
|
3900
3823
|
return this._scoped(async () => {
|
|
3901
3824
|
const snapshots = await this._es.action(
|
|
@@ -3938,7 +3861,7 @@ var Act = (_class7 = class {
|
|
|
3938
3861
|
actor: void 0,
|
|
3939
3862
|
asOf
|
|
3940
3863
|
} : streamOrTarget;
|
|
3941
|
-
|
|
3864
|
+
_chunkXG3UD63Ycjs.check.call(void 0, "page", _nullishCoalesce(target.asOf, () => ( {})));
|
|
3942
3865
|
return await this._es.load(merged, target, callback);
|
|
3943
3866
|
});
|
|
3944
3867
|
}
|
|
@@ -3967,11 +3890,11 @@ var Act = (_class7 = class {
|
|
|
3967
3890
|
* @see {@link query_array} for loading events into memory
|
|
3968
3891
|
*/
|
|
3969
3892
|
async query(query, callback) {
|
|
3970
|
-
|
|
3893
|
+
_chunkXG3UD63Ycjs.check.call(void 0, "page", query);
|
|
3971
3894
|
return this._scoped(async () => {
|
|
3972
3895
|
let first;
|
|
3973
3896
|
let last;
|
|
3974
|
-
const count = await
|
|
3897
|
+
const count = await _chunkXG3UD63Ycjs.store.call(void 0, ).query((e) => {
|
|
3975
3898
|
const gated = this.registry.query_gate(e.name)(e);
|
|
3976
3899
|
if (!first) first = gated;
|
|
3977
3900
|
last = gated;
|
|
@@ -4017,14 +3940,14 @@ var Act = (_class7 = class {
|
|
|
4017
3940
|
*/
|
|
4018
3941
|
async forget(stream) {
|
|
4019
3942
|
return this._scoped(async () => {
|
|
4020
|
-
const s =
|
|
3943
|
+
const s = _chunkXG3UD63Ycjs.store.call(void 0, );
|
|
4021
3944
|
if (!s.forget_pii) {
|
|
4022
3945
|
throw new Error(
|
|
4023
3946
|
`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).`
|
|
4024
3947
|
);
|
|
4025
3948
|
}
|
|
4026
3949
|
const eventCount = await s.forget_pii(stream);
|
|
4027
|
-
await
|
|
3950
|
+
await _chunkXG3UD63Ycjs.cache.call(void 0, ).invalidate(stream);
|
|
4028
3951
|
if (eventCount > 0) {
|
|
4029
3952
|
this.emit("forgotten", { stream, at: /* @__PURE__ */ new Date(), eventCount });
|
|
4030
3953
|
}
|
|
@@ -4058,7 +3981,7 @@ var Act = (_class7 = class {
|
|
|
4058
3981
|
* @see {@link correlate} for dynamic stream discovery
|
|
4059
3982
|
*/
|
|
4060
3983
|
async drain(options = {}) {
|
|
4061
|
-
|
|
3984
|
+
_chunkXG3UD63Ycjs.check.call(void 0, "drain", options);
|
|
4062
3985
|
if (!this._drain)
|
|
4063
3986
|
return { fetched: [], leased: [], acked: [], blocked: [] };
|
|
4064
3987
|
return this._scoped(() => this._drain_all(options));
|
|
@@ -4135,7 +4058,7 @@ var Act = (_class7 = class {
|
|
|
4135
4058
|
* @see {@link start_correlations} for automatic periodic correlation
|
|
4136
4059
|
*/
|
|
4137
4060
|
async correlate(query = {}) {
|
|
4138
|
-
|
|
4061
|
+
_chunkXG3UD63Ycjs.check.call(void 0, "page", query);
|
|
4139
4062
|
const pass = await this._correlate_pass(_nullishCoalesce(query.limit, () => ( 10)));
|
|
4140
4063
|
return {
|
|
4141
4064
|
subscribed: pass.kind === "scanned" ? pass.subscribed : 0,
|
|
@@ -4181,8 +4104,8 @@ var Act = (_class7 = class {
|
|
|
4181
4104
|
* @see {@link stop_correlations} to stop the poll
|
|
4182
4105
|
*/
|
|
4183
4106
|
start_correlations(query = {}, frequency = 1e4) {
|
|
4184
|
-
|
|
4185
|
-
|
|
4107
|
+
_chunkXG3UD63Ycjs.check.call(void 0, "page", query);
|
|
4108
|
+
_chunkXG3UD63Ycjs.check.call(void 0, "poll", { frequency });
|
|
4186
4109
|
if (this._poll) return false;
|
|
4187
4110
|
this._poll_limit = query.limit || void 0;
|
|
4188
4111
|
this._poll = setInterval(() => {
|
|
@@ -4248,7 +4171,7 @@ var Act = (_class7 = class {
|
|
|
4248
4171
|
*/
|
|
4249
4172
|
async reset(input) {
|
|
4250
4173
|
return this._scoped(async () => {
|
|
4251
|
-
const count = await
|
|
4174
|
+
const count = await _chunkXG3UD63Ycjs.store.call(void 0, ).reset(input);
|
|
4252
4175
|
this._reset_folds();
|
|
4253
4176
|
if (count > 0) {
|
|
4254
4177
|
this._wake();
|
|
@@ -4283,7 +4206,7 @@ var Act = (_class7 = class {
|
|
|
4283
4206
|
*/
|
|
4284
4207
|
async unblock(input) {
|
|
4285
4208
|
return this._scoped(async () => {
|
|
4286
|
-
const count = await
|
|
4209
|
+
const count = await _chunkXG3UD63Ycjs.store.call(void 0, ).unblock(input);
|
|
4287
4210
|
if (count > 0) {
|
|
4288
4211
|
this._wake();
|
|
4289
4212
|
}
|
|
@@ -4298,8 +4221,9 @@ var Act = (_class7 = class {
|
|
|
4298
4221
|
* lifecycle and per-event insert.
|
|
4299
4222
|
*
|
|
4300
4223
|
* Safe in a live process: restoring into this Act's own store waits
|
|
4301
|
-
* for its correlate passes in flight, replaces the log,
|
|
4302
|
-
*
|
|
4224
|
+
* for its correlate passes in flight, replaces the log, clears the cache
|
|
4225
|
+
* and the state projections' fold caches, then restarts correlation and
|
|
4226
|
+
* settles. A correlate pass that starts meanwhile
|
|
4303
4227
|
* reads nothing. Other processes on the same store keep their
|
|
4304
4228
|
* correlation state and must be restarted.
|
|
4305
4229
|
*
|
|
@@ -4325,13 +4249,12 @@ var Act = (_class7 = class {
|
|
|
4325
4249
|
* ```typescript
|
|
4326
4250
|
* const result = await app.restore(new CsvFile({ path: "./backup.csv" }));
|
|
4327
4251
|
* console.log(`Restored ${result.kept} events in ${result.duration_ms}ms`);
|
|
4328
|
-
* await cache().clear(); // operator's responsibility
|
|
4329
4252
|
* ```
|
|
4330
4253
|
*
|
|
4331
4254
|
* @see {@link Store.restore} for the underlying driver-pattern primitive.
|
|
4332
4255
|
*/
|
|
4333
4256
|
async restore(source, opts = {}, sink) {
|
|
4334
|
-
|
|
4257
|
+
_chunkXG3UD63Ycjs.check.call(void 0, "scan", opts);
|
|
4335
4258
|
return this._scoped(async () => {
|
|
4336
4259
|
const started = Date.now();
|
|
4337
4260
|
if (opts.dry_run) {
|
|
@@ -4339,14 +4262,14 @@ var Act = (_class7 = class {
|
|
|
4339
4262
|
return { ...partial, duration_ms: Date.now() - started };
|
|
4340
4263
|
}
|
|
4341
4264
|
const target = _nullishCoalesce(sink, () => ( (() => {
|
|
4342
|
-
const s =
|
|
4265
|
+
const s = _chunkXG3UD63Ycjs.store.call(void 0, );
|
|
4343
4266
|
if (!s.restore) throw new Error("adapter has no restore capability");
|
|
4344
4267
|
return s;
|
|
4345
4268
|
})()));
|
|
4346
4269
|
let kept = 0;
|
|
4347
4270
|
let migrated = 0;
|
|
4348
4271
|
let dropped = { closed_streams: 0, snapshots: 0 };
|
|
4349
|
-
const run = /* @__PURE__ */
|
|
4272
|
+
const run = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => target.restore(async (callback) => {
|
|
4350
4273
|
const partial = await scan(source, opts, callback);
|
|
4351
4274
|
kept = partial.kept;
|
|
4352
4275
|
migrated = partial.migrated;
|
|
@@ -4355,6 +4278,7 @@ var Act = (_class7 = class {
|
|
|
4355
4278
|
if (sink) await run();
|
|
4356
4279
|
else {
|
|
4357
4280
|
await this._correlate.restart(run);
|
|
4281
|
+
await _chunkXG3UD63Ycjs.cache.call(void 0, ).clear();
|
|
4358
4282
|
this._reset_folds();
|
|
4359
4283
|
this._wake();
|
|
4360
4284
|
}
|
|
@@ -4384,10 +4308,10 @@ var Act = (_class7 = class {
|
|
|
4384
4308
|
* ```
|
|
4385
4309
|
*/
|
|
4386
4310
|
async blocked_streams(options) {
|
|
4387
|
-
|
|
4311
|
+
_chunkXG3UD63Ycjs.check.call(void 0, "page", { limit: _optionalChain([options, 'optionalAccess', _178 => _178.limit]) });
|
|
4388
4312
|
return this._scoped(async () => {
|
|
4389
4313
|
const positions = [];
|
|
4390
|
-
await
|
|
4314
|
+
await _chunkXG3UD63Ycjs.store.call(void 0, ).query_streams(
|
|
4391
4315
|
(p) => {
|
|
4392
4316
|
positions.push(p);
|
|
4393
4317
|
},
|
|
@@ -4413,7 +4337,7 @@ var Act = (_class7 = class {
|
|
|
4413
4337
|
* ```
|
|
4414
4338
|
*/
|
|
4415
4339
|
async *audit(categories, options) {
|
|
4416
|
-
|
|
4340
|
+
_chunkXG3UD63Ycjs.check.call(void 0, "audit", _nullishCoalesce(options, () => ( {})));
|
|
4417
4341
|
const it = audit(this._audit_deps, categories, options)[Symbol.asyncIterator]();
|
|
4418
4342
|
while (true) {
|
|
4419
4343
|
const { value, done } = await this._scoped(() => it.next());
|
|
@@ -4441,15 +4365,15 @@ var Act = (_class7 = class {
|
|
|
4441
4365
|
* @see {@link Store.prioritize} for the underlying primitive
|
|
4442
4366
|
*/
|
|
4443
4367
|
async prioritize(filter, priority) {
|
|
4444
|
-
|
|
4445
|
-
return this._scoped(() =>
|
|
4368
|
+
_chunkXG3UD63Ycjs.check.call(void 0, "target", { priority });
|
|
4369
|
+
return this._scoped(() => _chunkXG3UD63Ycjs.store.call(void 0, ).prioritize(filter, priority));
|
|
4446
4370
|
}
|
|
4447
4371
|
// Shared by `close()` and reaction-requested closes.
|
|
4448
4372
|
async _run_close(targets) {
|
|
4449
4373
|
const close_actor = { id: "$close", name: "close" };
|
|
4450
4374
|
const result = await run_close_cycle(targets, {
|
|
4451
4375
|
reactive: this._reactive,
|
|
4452
|
-
catch_up_correlation: /* @__PURE__ */
|
|
4376
|
+
catch_up_correlation: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (until) => catch_up_correlation(
|
|
4453
4377
|
this._correlate,
|
|
4454
4378
|
(limit) => this.correlate({ limit }),
|
|
4455
4379
|
until
|
|
@@ -4459,8 +4383,8 @@ var Act = (_class7 = class {
|
|
|
4459
4383
|
tombstone: this._es.tombstone,
|
|
4460
4384
|
logger: this._logger,
|
|
4461
4385
|
correlation: close_correlation(this._correlator, close_actor),
|
|
4462
|
-
with_stream_lock: /* @__PURE__ */
|
|
4463
|
-
forget_subscribed: /* @__PURE__ */
|
|
4386
|
+
with_stream_lock: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (stream, work) => this._close_lock.run(stream, work), "with_stream_lock"),
|
|
4387
|
+
forget_subscribed: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (streams) => this._correlate.forget_subscribed(streams), "forget_subscribed")
|
|
4464
4388
|
});
|
|
4465
4389
|
this.emit("closed", result);
|
|
4466
4390
|
return result;
|
|
@@ -4522,10 +4446,10 @@ var Act = (_class7 = class {
|
|
|
4522
4446
|
* @see {@link correlate} for manual correlation
|
|
4523
4447
|
*/
|
|
4524
4448
|
settle(options) {
|
|
4525
|
-
|
|
4449
|
+
_chunkXG3UD63Ycjs.check.call(void 0, "settle", _nullishCoalesce(options, () => ( {})));
|
|
4526
4450
|
this._schedule(options);
|
|
4527
4451
|
}
|
|
4528
|
-
},
|
|
4452
|
+
}, _class6);
|
|
4529
4453
|
|
|
4530
4454
|
// src/builders/merge.ts
|
|
4531
4455
|
|
|
@@ -4535,7 +4459,7 @@ function base_type_name(schema) {
|
|
|
4535
4459
|
def = def_of(inner);
|
|
4536
4460
|
return def.type === "array" ? `array of ${base_type_name(def.element)}` : def.type;
|
|
4537
4461
|
}
|
|
4538
|
-
|
|
4462
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, base_type_name, "base_type_name");
|
|
4539
4463
|
function merge_schemas(existing, incoming, state_name) {
|
|
4540
4464
|
if (existing === incoming) return existing;
|
|
4541
4465
|
const existing_object = as_object(existing, "existing", state_name);
|
|
@@ -4555,18 +4479,18 @@ function merge_schemas(existing, incoming, state_name) {
|
|
|
4555
4479
|
}
|
|
4556
4480
|
return existing_object.extend(incoming_shape);
|
|
4557
4481
|
}
|
|
4558
|
-
|
|
4482
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, merge_schemas, "merge_schemas");
|
|
4559
4483
|
function as_object(schema, side, state_name) {
|
|
4560
4484
|
if (schema instanceof _zod2.ZodObject) return schema;
|
|
4561
4485
|
throw new Error(
|
|
4562
4486
|
`Cannot merge state schemas for "${state_name}": the ${side} partial's schema is a ${schema.constructor.name}, not a z.object. Partials of the same state are merged by extending their shapes, so declare every partial's state as a plain z.object({ ... }).`
|
|
4563
4487
|
);
|
|
4564
4488
|
}
|
|
4565
|
-
|
|
4489
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, as_object, "as_object");
|
|
4566
4490
|
function merge_inits(existing, incoming) {
|
|
4567
4491
|
return () => ({ ...existing(), ...incoming() });
|
|
4568
4492
|
}
|
|
4569
|
-
|
|
4493
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, merge_inits, "merge_inits");
|
|
4570
4494
|
function register_state(state2, states, actions, events) {
|
|
4571
4495
|
const existing = states.get(state2.name);
|
|
4572
4496
|
if (existing) {
|
|
@@ -4575,8 +4499,8 @@ function register_state(state2, states, actions, events) {
|
|
|
4575
4499
|
register_new_state(state2, states, actions, events);
|
|
4576
4500
|
}
|
|
4577
4501
|
}
|
|
4578
|
-
|
|
4579
|
-
var shared_name = /* @__PURE__ */
|
|
4502
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, register_state, "register_state");
|
|
4503
|
+
var shared_name = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (name) => new Error(
|
|
4580
4504
|
`Action and event share the name "${name}" \u2014 action and event names must be unique across the application. Rename one of them.`
|
|
4581
4505
|
), "shared_name");
|
|
4582
4506
|
function register_new_state(state2, states, actions, events) {
|
|
@@ -4592,13 +4516,13 @@ function register_new_state(state2, states, actions, events) {
|
|
|
4592
4516
|
events[name] = { schema: state2.events[name], reactions: /* @__PURE__ */ new Map() };
|
|
4593
4517
|
}
|
|
4594
4518
|
}
|
|
4595
|
-
|
|
4519
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, register_new_state, "register_new_state");
|
|
4596
4520
|
function pick_declared(existing, incoming, what, state_name) {
|
|
4597
4521
|
if (existing && incoming && existing !== incoming)
|
|
4598
4522
|
throw new Error(`Duplicate ${what} for state "${state_name}"`);
|
|
4599
4523
|
return _nullishCoalesce(incoming, () => ( existing));
|
|
4600
4524
|
}
|
|
4601
|
-
|
|
4525
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, pick_declared, "pick_declared");
|
|
4602
4526
|
function autoclose_of(existing, state2) {
|
|
4603
4527
|
pick_declared(
|
|
4604
4528
|
existing.autoclose,
|
|
@@ -4614,7 +4538,7 @@ function autoclose_of(existing, state2) {
|
|
|
4614
4538
|
autoclose_keep_days: owner.autoclose_keep_days
|
|
4615
4539
|
};
|
|
4616
4540
|
}
|
|
4617
|
-
|
|
4541
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, autoclose_of, "autoclose_of");
|
|
4618
4542
|
function merge_into_existing(state2, existing, states, actions, events) {
|
|
4619
4543
|
for (const name of Object.keys(state2.actions)) {
|
|
4620
4544
|
if (existing.on[name] === state2.on[name]) continue;
|
|
@@ -4672,7 +4596,7 @@ function merge_into_existing(state2, existing, states, actions, events) {
|
|
|
4672
4596
|
events[name] = { schema: state2.events[name], reactions: /* @__PURE__ */ new Map() };
|
|
4673
4597
|
}
|
|
4674
4598
|
}
|
|
4675
|
-
|
|
4599
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, merge_into_existing, "merge_into_existing");
|
|
4676
4600
|
function merge_patches(existing, incoming, state_name) {
|
|
4677
4601
|
const merged = { ...existing };
|
|
4678
4602
|
for (const name of Object.keys(incoming)) {
|
|
@@ -4695,7 +4619,7 @@ function merge_patches(existing, incoming, state_name) {
|
|
|
4695
4619
|
}
|
|
4696
4620
|
return merged;
|
|
4697
4621
|
}
|
|
4698
|
-
|
|
4622
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, merge_patches, "merge_patches");
|
|
4699
4623
|
function merge_event_register(target, source) {
|
|
4700
4624
|
for (const [event_name, source_reg] of Object.entries(source)) {
|
|
4701
4625
|
const target_reg = target[event_name];
|
|
@@ -4710,7 +4634,7 @@ function merge_event_register(target, source) {
|
|
|
4710
4634
|
}
|
|
4711
4635
|
}
|
|
4712
4636
|
}
|
|
4713
|
-
|
|
4637
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, merge_event_register, "merge_event_register");
|
|
4714
4638
|
function merge_projection(proj, events) {
|
|
4715
4639
|
for (const event_name of Object.keys(proj.events)) {
|
|
4716
4640
|
const proj_register = proj.events[event_name];
|
|
@@ -4730,17 +4654,17 @@ function merge_projection(proj, events) {
|
|
|
4730
4654
|
}
|
|
4731
4655
|
}
|
|
4732
4656
|
}
|
|
4733
|
-
|
|
4734
|
-
var _this_ = /* @__PURE__ */
|
|
4657
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, merge_projection, "merge_projection");
|
|
4658
|
+
var _this_ = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, ({ stream }) => ({
|
|
4735
4659
|
source: stream,
|
|
4736
4660
|
target: stream
|
|
4737
4661
|
}), "_this_");
|
|
4738
4662
|
|
|
4739
4663
|
// src/builders/builder-utils.ts
|
|
4740
4664
|
function register_lane(config2, lanes) {
|
|
4741
|
-
|
|
4742
|
-
if (config2.name ===
|
|
4743
|
-
throw new Error(`Lane "${
|
|
4665
|
+
_chunkXG3UD63Ycjs.check.call(void 0, "lane", config2);
|
|
4666
|
+
if (config2.name === _chunk4GA3CHQWcjs.DEFAULT_LANE)
|
|
4667
|
+
throw new Error(`Lane "${_chunk4GA3CHQWcjs.DEFAULT_LANE}" is reserved`);
|
|
4744
4668
|
const existing = lanes.find((l) => l.name === config2.name);
|
|
4745
4669
|
if (!existing) return void lanes.push(config2);
|
|
4746
4670
|
if (existing.leaseMillis !== config2.leaseMillis || existing.streamLimit !== config2.streamLimit || existing.cycleMs !== config2.cycleMs)
|
|
@@ -4748,7 +4672,7 @@ function register_lane(config2, lanes) {
|
|
|
4748
4672
|
`Lane "${config2.name}" was already declared with a different config`
|
|
4749
4673
|
);
|
|
4750
4674
|
}
|
|
4751
|
-
|
|
4675
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, register_lane, "register_lane");
|
|
4752
4676
|
function add_reaction(events, event, name, kind, make, builder) {
|
|
4753
4677
|
if (!name)
|
|
4754
4678
|
throw new Error(
|
|
@@ -4763,31 +4687,31 @@ function add_reaction(events, event, name, kind, make, builder) {
|
|
|
4763
4687
|
events[event].reactions.set(name, reaction);
|
|
4764
4688
|
return Object.assign(builder, {
|
|
4765
4689
|
to(resolver) {
|
|
4766
|
-
if (typeof resolver === "object")
|
|
4690
|
+
if (typeof resolver === "object") _chunkXG3UD63Ycjs.check.call(void 0, "target", resolver);
|
|
4767
4691
|
reaction.resolver = typeof resolver === "string" ? { target: resolver } : resolver;
|
|
4768
4692
|
return builder;
|
|
4769
4693
|
}
|
|
4770
4694
|
});
|
|
4771
4695
|
}
|
|
4772
|
-
|
|
4696
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, add_reaction, "add_reaction");
|
|
4773
4697
|
function reaction_on(event, events, builder) {
|
|
4774
|
-
const register = /* @__PURE__ */
|
|
4698
|
+
const register = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (handler, options, schedule) => add_reaction(
|
|
4775
4699
|
events,
|
|
4776
4700
|
event,
|
|
4777
4701
|
handler.name,
|
|
4778
4702
|
"Reaction",
|
|
4779
4703
|
() => {
|
|
4780
4704
|
if (schedule && typeof schedule !== "function")
|
|
4781
|
-
|
|
4705
|
+
_chunkXG3UD63Ycjs.check.call(void 0, "defer", schedule);
|
|
4782
4706
|
return {
|
|
4783
4707
|
handler: schedule ? make_deferred(handler, schedule) : handler,
|
|
4784
4708
|
resolver: _this_,
|
|
4785
4709
|
// Validate the whole bag at the declaration site so a bad
|
|
4786
4710
|
// `maxRetries`/`backoff`/`blockOnError` throws ZodError at build,
|
|
4787
4711
|
// not a NaN gate on the first retry.
|
|
4788
|
-
options:
|
|
4789
|
-
blockOnError: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _181 => _181.blockOnError]), () => (
|
|
4790
|
-
maxRetries: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _182 => _182.maxRetries]), () => (
|
|
4712
|
+
options: _chunkXG3UD63Ycjs.check.call(void 0, "reaction", {
|
|
4713
|
+
blockOnError: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _181 => _181.blockOnError]), () => ( _chunkXG3UD63Ycjs.DEFAULT_BLOCK_ON_ERROR)),
|
|
4714
|
+
maxRetries: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _182 => _182.maxRetries]), () => ( _chunkXG3UD63Ycjs.DEFAULT_MAX_RETRIES)),
|
|
4791
4715
|
backoff: _optionalChain([options, 'optionalAccess', _183 => _183.backoff])
|
|
4792
4716
|
})
|
|
4793
4717
|
};
|
|
@@ -4795,20 +4719,20 @@ function reaction_on(event, events, builder) {
|
|
|
4795
4719
|
builder
|
|
4796
4720
|
), "register");
|
|
4797
4721
|
return {
|
|
4798
|
-
do: /* @__PURE__ */
|
|
4799
|
-
defer: /* @__PURE__ */
|
|
4800
|
-
do: /* @__PURE__ */
|
|
4722
|
+
do: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (handler, options) => register(handler, options), "do"),
|
|
4723
|
+
defer: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (schedule) => ({
|
|
4724
|
+
do: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (handler, options) => register(handler, options, schedule), "do")
|
|
4801
4725
|
}), "defer")
|
|
4802
4726
|
};
|
|
4803
4727
|
}
|
|
4804
|
-
|
|
4728
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, reaction_on, "reaction_on");
|
|
4805
4729
|
|
|
4806
4730
|
// src/builders/event-builder.ts
|
|
4807
4731
|
|
|
4808
4732
|
|
|
4809
4733
|
// src/internal/sensitive.ts
|
|
4810
4734
|
var SENSITIVE = /* @__PURE__ */ Symbol.for("act.sensitive");
|
|
4811
|
-
var is_pii = /* @__PURE__ */
|
|
4735
|
+
var is_pii = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (schema) => some_layer(schema, (def) => def[SENSITIVE] === true), "is_pii");
|
|
4812
4736
|
function pii_schemas(schema) {
|
|
4813
4737
|
const fields = {};
|
|
4814
4738
|
const shape = schema.shape;
|
|
@@ -4824,7 +4748,7 @@ function pii_schemas(schema) {
|
|
|
4824
4748
|
fields[key] ??= field;
|
|
4825
4749
|
return fields;
|
|
4826
4750
|
}
|
|
4827
|
-
|
|
4751
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, pii_schemas, "pii_schemas");
|
|
4828
4752
|
|
|
4829
4753
|
// src/builders/event-builder.ts
|
|
4830
4754
|
function event_tags(schema) {
|
|
@@ -4835,7 +4759,7 @@ function event_tags(schema) {
|
|
|
4835
4759
|
if (dates) pii_dates[key] = dates.optional();
|
|
4836
4760
|
}
|
|
4837
4761
|
const data_reviver_schema = date_reviver_schema(schema);
|
|
4838
|
-
const revive = /* @__PURE__ */
|
|
4762
|
+
const revive = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (schema2) => (data) => {
|
|
4839
4763
|
const revived = schema2.safeParse(data);
|
|
4840
4764
|
return revived.success ? revived.data : data;
|
|
4841
4765
|
}, "revive");
|
|
@@ -4846,7 +4770,7 @@ function event_tags(schema) {
|
|
|
4846
4770
|
pii_date_reviver: dated_pii ? revive(_zod2.z.looseObject(pii_dates)) : void 0
|
|
4847
4771
|
};
|
|
4848
4772
|
}
|
|
4849
|
-
|
|
4773
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, event_tags, "event_tags");
|
|
4850
4774
|
function make_event_reader(tags, disclosure, predicate = null) {
|
|
4851
4775
|
const { date_reviver, pii_date_reviver } = tags;
|
|
4852
4776
|
const sensitive2 = Object.keys(tags.sensitive);
|
|
@@ -4866,9 +4790,9 @@ function make_event_reader(tags, disclosure, predicate = null) {
|
|
|
4866
4790
|
);
|
|
4867
4791
|
});
|
|
4868
4792
|
}
|
|
4869
|
-
|
|
4793
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, make_event_reader, "make_event_reader");
|
|
4870
4794
|
function build_events(registry, states, lanes, owners) {
|
|
4871
|
-
const declared = /* @__PURE__ */ new Set([
|
|
4795
|
+
const declared = /* @__PURE__ */ new Set([_chunk4GA3CHQWcjs.DEFAULT_LANE, ...lanes.map((l) => l.name)]);
|
|
4872
4796
|
const lane_errors = [];
|
|
4873
4797
|
const tags = /* @__PURE__ */ new Map();
|
|
4874
4798
|
const sensitive2 = /* @__PURE__ */ new Map();
|
|
@@ -4901,7 +4825,7 @@ function build_events(registry, states, lanes, owners) {
|
|
|
4901
4825
|
handler_readers.set(event_name, handler_reader);
|
|
4902
4826
|
for (const [name, reaction] of def.reactions) {
|
|
4903
4827
|
const inner = reaction.handler;
|
|
4904
|
-
const wrapped2 = /* @__PURE__ */
|
|
4828
|
+
const wrapped2 = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (evt, stream, app) => inner(handler_reader(evt), stream, app), "wrapped");
|
|
4905
4829
|
Object.defineProperty(wrapped2, "name", { value: inner.name });
|
|
4906
4830
|
reaction.handler = wrapped2;
|
|
4907
4831
|
def.reactions.set(name, reaction);
|
|
@@ -4943,7 +4867,7 @@ function build_events(registry, states, lanes, owners) {
|
|
|
4943
4867
|
if (reader) readers.set(event_name, reader);
|
|
4944
4868
|
}
|
|
4945
4869
|
const snap2 = make_event_reader(event_tags(state2.state), "redact", null);
|
|
4946
|
-
if (snap2) readers.set(
|
|
4870
|
+
if (snap2) readers.set(_chunk4GA3CHQWcjs.SNAP_EVENT, snap2);
|
|
4947
4871
|
if (readers.size === 0) continue;
|
|
4948
4872
|
state2.view = (event, actor) => (_nullishCoalesce(readers.get(event.name), () => ( IDENTITY_GATE)))(event, actor);
|
|
4949
4873
|
}
|
|
@@ -4954,12 +4878,12 @@ function build_events(registry, states, lanes, owners) {
|
|
|
4954
4878
|
const advisory = advised.size > 0 ? `Act has ${advised.size} sensitive field(s) whose type isn't a string: ${[...advised].join(", ")}. A caller who may not see one reads "[REDACTED]" or "[SHREDDED]" there instead, which its type doesn't allow. Declare sensitive fields as strings. See docs/docs/guides/sensitive-data.md.` : void 0;
|
|
4955
4879
|
return { sensitive: sensitive2, advisory, query_readers, handler_readers };
|
|
4956
4880
|
}
|
|
4957
|
-
|
|
4881
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, build_events, "build_events");
|
|
4958
4882
|
function reads_as_string(schema) {
|
|
4959
4883
|
const type = _optionalChain([def_of, 'call', _184 => _184(output_of(schema)), 'optionalAccess', _185 => _185.type]);
|
|
4960
4884
|
return type === "string" || type === "transform";
|
|
4961
4885
|
}
|
|
4962
|
-
|
|
4886
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, reads_as_string, "reads_as_string");
|
|
4963
4887
|
|
|
4964
4888
|
// src/builders/act-builder.ts
|
|
4965
4889
|
function register_batch_handler(proj, batch_handlers) {
|
|
@@ -4972,7 +4896,7 @@ function register_batch_handler(proj, batch_handlers) {
|
|
|
4972
4896
|
}
|
|
4973
4897
|
batch_handlers.set(proj.target, proj.batchHandler);
|
|
4974
4898
|
}
|
|
4975
|
-
|
|
4899
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, register_batch_handler, "register_batch_handler");
|
|
4976
4900
|
function act() {
|
|
4977
4901
|
const states = /* @__PURE__ */ new Map();
|
|
4978
4902
|
const _sf = /* @__PURE__ */ new Map();
|
|
@@ -4986,16 +4910,16 @@ function act() {
|
|
|
4986
4910
|
const registry = {
|
|
4987
4911
|
actions: {},
|
|
4988
4912
|
events: {},
|
|
4989
|
-
sensitive_fields: /* @__PURE__ */
|
|
4990
|
-
query_gate: /* @__PURE__ */
|
|
4991
|
-
disclosure_predicate: /* @__PURE__ */
|
|
4992
|
-
deprecated_events: /* @__PURE__ */
|
|
4993
|
-
autoclose_policy: /* @__PURE__ */
|
|
4994
|
-
autoclose_archiver: /* @__PURE__ */
|
|
4913
|
+
sensitive_fields: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (name) => _nullishCoalesce(_sf.get(name), () => ( [])), "sensitive_fields"),
|
|
4914
|
+
query_gate: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (event_name) => _nullishCoalesce(_qg.get(event_name), () => ( IDENTITY_GATE)), "query_gate"),
|
|
4915
|
+
disclosure_predicate: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (state_name) => _nullishCoalesce(_dp.get(state_name), () => ( null)), "disclosure_predicate"),
|
|
4916
|
+
deprecated_events: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (state_name) => _nullishCoalesce(_de.get(state_name), () => ( EMPTY_DEPRECATED)), "deprecated_events"),
|
|
4917
|
+
autoclose_policy: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (state_name) => _nullishCoalesce(_ac.get(state_name), () => ( null)), "autoclose_policy"),
|
|
4918
|
+
autoclose_archiver: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (state_name) => _nullishCoalesce(_aa.get(state_name), () => ( null)), "autoclose_archiver")
|
|
4995
4919
|
};
|
|
4996
4920
|
const pending_projections = [];
|
|
4997
4921
|
const projection_reactions = /* @__PURE__ */ new Set();
|
|
4998
|
-
const record_projection_reactions = /* @__PURE__ */
|
|
4922
|
+
const record_projection_reactions = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (proj) => {
|
|
4999
4923
|
if (!proj.batchHandler && !proj.fold) return;
|
|
5000
4924
|
for (const register of Object.values(
|
|
5001
4925
|
proj.events
|
|
@@ -5005,7 +4929,7 @@ function act() {
|
|
|
5005
4929
|
}, "record_projection_reactions");
|
|
5006
4930
|
const fold_projections = [];
|
|
5007
4931
|
const batch_handlers = /* @__PURE__ */ new Map();
|
|
5008
|
-
const add_projection = /* @__PURE__ */
|
|
4932
|
+
const add_projection = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (proj) => {
|
|
5009
4933
|
record_projection_reactions(proj);
|
|
5010
4934
|
merge_projection(proj, registry.events);
|
|
5011
4935
|
register_batch_handler(proj, batch_handlers);
|
|
@@ -5014,8 +4938,8 @@ function act() {
|
|
|
5014
4938
|
const fold_specs = [];
|
|
5015
4939
|
const lanes = [];
|
|
5016
4940
|
let _built = false;
|
|
5017
|
-
const read_wrap = /* @__PURE__ */
|
|
5018
|
-
const wrapped2 = /* @__PURE__ */
|
|
4941
|
+
const read_wrap = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (original) => {
|
|
4942
|
+
const wrapped2 = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, async (events, stream) => {
|
|
5019
4943
|
const read = events.map((e) => _nullishCoalesce(_optionalChain([_hr, 'access', _186 => _186.get, 'call', _187 => _187(e.name), 'optionalCall', _188 => _188(e)]), () => ( e)));
|
|
5020
4944
|
return original(read, stream);
|
|
5021
4945
|
}, "wrapped");
|
|
@@ -5023,7 +4947,7 @@ function act() {
|
|
|
5023
4947
|
if (reset) Object.defineProperty(wrapped2, FOLD_RESET, { value: reset });
|
|
5024
4948
|
return wrapped2;
|
|
5025
4949
|
}, "read_wrap");
|
|
5026
|
-
const make_batch_handlers = /* @__PURE__ */
|
|
4950
|
+
const make_batch_handlers = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => {
|
|
5027
4951
|
const handlers = new Map(batch_handlers);
|
|
5028
4952
|
for (const spec of fold_specs) {
|
|
5029
4953
|
handlers.set(
|
|
@@ -5041,7 +4965,7 @@ function act() {
|
|
|
5041
4965
|
}
|
|
5042
4966
|
return handlers;
|
|
5043
4967
|
}, "make_batch_handlers");
|
|
5044
|
-
const finalize_deprecations = /* @__PURE__ */
|
|
4968
|
+
const finalize_deprecations = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => {
|
|
5045
4969
|
const deprecation_summary = [];
|
|
5046
4970
|
for (const state2 of states.values()) {
|
|
5047
4971
|
const event_names = Object.keys(state2.events);
|
|
@@ -5070,23 +4994,23 @@ function act() {
|
|
|
5070
4994
|
const list = deprecation_summary.map(
|
|
5071
4995
|
(d) => `"${d.deprecated}" (current: "${d.current}", state: "${d.state_name}")`
|
|
5072
4996
|
).join(", ");
|
|
5073
|
-
|
|
4997
|
+
_chunkXG3UD63Ycjs.log.call(void 0, ).info(
|
|
5074
4998
|
`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.`
|
|
5075
4999
|
);
|
|
5076
5000
|
}
|
|
5077
5001
|
}, "finalize_deprecations");
|
|
5078
|
-
const closed = /* @__PURE__ */
|
|
5002
|
+
const closed = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (method) => {
|
|
5079
5003
|
throw new Error(
|
|
5080
5004
|
`act().${method}() was called after build(); the registry is already classified. Register everything before build() \u2014 build() itself may be called repeatedly (e.g. once per tenant with ActOptions.scoped).`
|
|
5081
5005
|
);
|
|
5082
5006
|
}, "closed");
|
|
5083
5007
|
const builder = {
|
|
5084
|
-
withState: /* @__PURE__ */
|
|
5008
|
+
withState: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (state2) => {
|
|
5085
5009
|
if (_built) closed("withState");
|
|
5086
5010
|
register_state(state2, states, registry.actions, registry.events);
|
|
5087
5011
|
return builder;
|
|
5088
5012
|
}, "withState"),
|
|
5089
|
-
withSlice: /* @__PURE__ */
|
|
5013
|
+
withSlice: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (input) => {
|
|
5090
5014
|
if (_built) closed("withSlice");
|
|
5091
5015
|
for (const s of input.states.values()) {
|
|
5092
5016
|
register_state(s, states, registry.actions, registry.events);
|
|
@@ -5096,22 +5020,22 @@ function act() {
|
|
|
5096
5020
|
for (const lane of input.lanes) register_lane(lane, lanes);
|
|
5097
5021
|
return builder;
|
|
5098
5022
|
}, "withSlice"),
|
|
5099
|
-
withProjection: /* @__PURE__ */
|
|
5023
|
+
withProjection: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (proj) => {
|
|
5100
5024
|
if (_built) closed("withProjection");
|
|
5101
5025
|
add_projection(proj);
|
|
5102
5026
|
return builder;
|
|
5103
5027
|
}, "withProjection"),
|
|
5104
|
-
withActor: /* @__PURE__ */
|
|
5105
|
-
withLane: /* @__PURE__ */
|
|
5028
|
+
withActor: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => builder, "withActor"),
|
|
5029
|
+
withLane: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (config2) => {
|
|
5106
5030
|
if (_built) closed("withLane");
|
|
5107
5031
|
register_lane(config2, lanes);
|
|
5108
5032
|
return builder;
|
|
5109
5033
|
}, "withLane"),
|
|
5110
|
-
on: /* @__PURE__ */
|
|
5034
|
+
on: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (event) => {
|
|
5111
5035
|
if (_built) closed("on");
|
|
5112
5036
|
return reaction_on(event, registry.events, builder);
|
|
5113
5037
|
}, "on"),
|
|
5114
|
-
build: /* @__PURE__ */
|
|
5038
|
+
build: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (options) => {
|
|
5115
5039
|
if (!_built) {
|
|
5116
5040
|
for (const proj of pending_projections) add_projection(proj);
|
|
5117
5041
|
for (const proj of fold_projections) {
|
|
@@ -5151,7 +5075,7 @@ function act() {
|
|
|
5151
5075
|
for (const [name, gate] of built.query_readers) _qg.set(name, gate);
|
|
5152
5076
|
for (const [name, gate] of built.handler_readers) _hr.set(name, gate);
|
|
5153
5077
|
finalize_deprecations();
|
|
5154
|
-
if (built.advisory)
|
|
5078
|
+
if (built.advisory) _chunkXG3UD63Ycjs.log.call(void 0, ).warn(built.advisory);
|
|
5155
5079
|
for (const [name, state2] of states) {
|
|
5156
5080
|
if (!state2.loads) continue;
|
|
5157
5081
|
const resolved = {};
|
|
@@ -5195,7 +5119,7 @@ function act() {
|
|
|
5195
5119
|
synthesize_autoclose_reactions(
|
|
5196
5120
|
registry,
|
|
5197
5121
|
states,
|
|
5198
|
-
|
|
5122
|
+
_chunkXG3UD63Ycjs.current_autoclose_window
|
|
5199
5123
|
);
|
|
5200
5124
|
Object.freeze(registry.actions);
|
|
5201
5125
|
Object.freeze(registry.events);
|
|
@@ -5214,14 +5138,14 @@ function act() {
|
|
|
5214
5138
|
};
|
|
5215
5139
|
return builder;
|
|
5216
5140
|
}
|
|
5217
|
-
|
|
5141
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, act, "act");
|
|
5218
5142
|
|
|
5219
5143
|
// src/builders/projection-builder.ts
|
|
5220
5144
|
function _projection(target) {
|
|
5221
5145
|
const events = {};
|
|
5222
5146
|
const default_resolver = typeof target === "string" ? { target } : void 0;
|
|
5223
5147
|
const base = {
|
|
5224
|
-
on: /* @__PURE__ */
|
|
5148
|
+
on: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (entry) => {
|
|
5225
5149
|
const keys = Object.keys(entry);
|
|
5226
5150
|
if (keys.length !== 1) throw new Error(".on() requires exactly one key");
|
|
5227
5151
|
const event = keys[0];
|
|
@@ -5233,7 +5157,7 @@ function _projection(target) {
|
|
|
5233
5157
|
};
|
|
5234
5158
|
}
|
|
5235
5159
|
return {
|
|
5236
|
-
do: /* @__PURE__ */
|
|
5160
|
+
do: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (handler) => {
|
|
5237
5161
|
const widened = base;
|
|
5238
5162
|
return add_reaction(
|
|
5239
5163
|
events,
|
|
@@ -5244,8 +5168,8 @@ function _projection(target) {
|
|
|
5244
5168
|
handler,
|
|
5245
5169
|
resolver: _nullishCoalesce(default_resolver, () => ( _this_)),
|
|
5246
5170
|
options: {
|
|
5247
|
-
blockOnError:
|
|
5248
|
-
maxRetries:
|
|
5171
|
+
blockOnError: _chunkXG3UD63Ycjs.DEFAULT_BLOCK_ON_ERROR,
|
|
5172
|
+
maxRetries: _chunkXG3UD63Ycjs.DEFAULT_MAX_RETRIES
|
|
5249
5173
|
}
|
|
5250
5174
|
}),
|
|
5251
5175
|
widened
|
|
@@ -5253,7 +5177,7 @@ function _projection(target) {
|
|
|
5253
5177
|
}, "do")
|
|
5254
5178
|
};
|
|
5255
5179
|
}, "on"),
|
|
5256
|
-
build: /* @__PURE__ */
|
|
5180
|
+
build: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => ({
|
|
5257
5181
|
_tag: "Projection",
|
|
5258
5182
|
events,
|
|
5259
5183
|
...target !== void 0 && { target }
|
|
@@ -5262,20 +5186,20 @@ function _projection(target) {
|
|
|
5262
5186
|
};
|
|
5263
5187
|
if (typeof target === "string") {
|
|
5264
5188
|
return Object.assign(base, {
|
|
5265
|
-
batch: /* @__PURE__ */
|
|
5266
|
-
build: /* @__PURE__ */
|
|
5189
|
+
batch: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (handler) => ({
|
|
5190
|
+
build: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => ({
|
|
5267
5191
|
_tag: "Projection",
|
|
5268
5192
|
events,
|
|
5269
5193
|
target,
|
|
5270
5194
|
batchHandler: handler
|
|
5271
5195
|
}), "build")
|
|
5272
5196
|
}), "batch"),
|
|
5273
|
-
of: /* @__PURE__ */
|
|
5197
|
+
of: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (...args) => {
|
|
5274
5198
|
if (Object.keys(events).length > 0)
|
|
5275
5199
|
throw new Error(
|
|
5276
5200
|
`Projection "${target}" mixes .of() with .on() handlers \u2014 a projection either folds a state or declares handlers, never both`
|
|
5277
5201
|
);
|
|
5278
|
-
const is_state = /* @__PURE__ */
|
|
5202
|
+
const is_state = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (a) => !!a && typeof a.init === "function", "is_state");
|
|
5279
5203
|
const partials = args.filter(is_state);
|
|
5280
5204
|
const options = _nullishCoalesce(args.find((a) => !is_state(a)), () => ( {}));
|
|
5281
5205
|
if (partials.length === 0)
|
|
@@ -5286,7 +5210,7 @@ function _projection(target) {
|
|
|
5286
5210
|
throw new Error(
|
|
5287
5211
|
`Projection "${target}" .of() partials must share one state name \u2014 got "${name}" and "${partial.name}"`
|
|
5288
5212
|
);
|
|
5289
|
-
const config2 =
|
|
5213
|
+
const config2 = _chunkXG3UD63Ycjs.check.call(void 0, "fold", options);
|
|
5290
5214
|
const fold_events = {};
|
|
5291
5215
|
for (const partial of partials)
|
|
5292
5216
|
for (const [event_name, schema] of Object.entries(partial.events)) {
|
|
@@ -5304,8 +5228,8 @@ function _projection(target) {
|
|
|
5304
5228
|
handler: noop,
|
|
5305
5229
|
resolver: { target },
|
|
5306
5230
|
options: {
|
|
5307
|
-
blockOnError:
|
|
5308
|
-
maxRetries:
|
|
5231
|
+
blockOnError: _chunkXG3UD63Ycjs.DEFAULT_BLOCK_ON_ERROR,
|
|
5232
|
+
maxRetries: _chunkXG3UD63Ycjs.DEFAULT_MAX_RETRIES
|
|
5309
5233
|
}
|
|
5310
5234
|
}
|
|
5311
5235
|
]
|
|
@@ -5313,8 +5237,8 @@ function _projection(target) {
|
|
|
5313
5237
|
};
|
|
5314
5238
|
}
|
|
5315
5239
|
return {
|
|
5316
|
-
flush: /* @__PURE__ */
|
|
5317
|
-
build: /* @__PURE__ */
|
|
5240
|
+
flush: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (handler) => ({
|
|
5241
|
+
build: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => ({
|
|
5318
5242
|
_tag: "Projection",
|
|
5319
5243
|
events: fold_events,
|
|
5320
5244
|
target,
|
|
@@ -5327,11 +5251,11 @@ function _projection(target) {
|
|
|
5327
5251
|
}
|
|
5328
5252
|
return base;
|
|
5329
5253
|
}
|
|
5330
|
-
|
|
5254
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, _projection, "_projection");
|
|
5331
5255
|
function projection(target) {
|
|
5332
5256
|
return _projection(target);
|
|
5333
5257
|
}
|
|
5334
|
-
|
|
5258
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, projection, "projection");
|
|
5335
5259
|
|
|
5336
5260
|
// src/builders/slice-builder.ts
|
|
5337
5261
|
function slice() {
|
|
@@ -5341,20 +5265,20 @@ function slice() {
|
|
|
5341
5265
|
const projections = [];
|
|
5342
5266
|
const lanes = [];
|
|
5343
5267
|
const builder = {
|
|
5344
|
-
withState: /* @__PURE__ */
|
|
5268
|
+
withState: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (state2) => {
|
|
5345
5269
|
register_state(state2, states, actions, events);
|
|
5346
5270
|
return builder;
|
|
5347
5271
|
}, "withState"),
|
|
5348
|
-
withProjection: /* @__PURE__ */
|
|
5272
|
+
withProjection: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (proj) => {
|
|
5349
5273
|
projections.push(proj);
|
|
5350
5274
|
return builder;
|
|
5351
5275
|
}, "withProjection"),
|
|
5352
|
-
withLane: /* @__PURE__ */
|
|
5276
|
+
withLane: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (config2) => {
|
|
5353
5277
|
register_lane(config2, lanes);
|
|
5354
5278
|
return builder;
|
|
5355
5279
|
}, "withLane"),
|
|
5356
|
-
on: /* @__PURE__ */
|
|
5357
|
-
build: /* @__PURE__ */
|
|
5280
|
+
on: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (event) => reaction_on(event, events, builder), "on"),
|
|
5281
|
+
build: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => ({
|
|
5358
5282
|
_tag: "Slice",
|
|
5359
5283
|
states,
|
|
5360
5284
|
events,
|
|
@@ -5365,7 +5289,7 @@ function slice() {
|
|
|
5365
5289
|
};
|
|
5366
5290
|
return builder;
|
|
5367
5291
|
}
|
|
5368
|
-
|
|
5292
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, slice, "slice");
|
|
5369
5293
|
|
|
5370
5294
|
// src/builders/state-builder.ts
|
|
5371
5295
|
function state(entry) {
|
|
@@ -5397,8 +5321,8 @@ function state(entry) {
|
|
|
5397
5321
|
// `act().build()` flips both on states with `sensitive(...)`
|
|
5398
5322
|
// events to bake in the gate / split and gate the cache write.
|
|
5399
5323
|
pii_aware: false,
|
|
5400
|
-
view: /* @__PURE__ */
|
|
5401
|
-
message: /* @__PURE__ */
|
|
5324
|
+
view: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (event) => event, "view"),
|
|
5325
|
+
message: /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (validated) => validated, "message")
|
|
5402
5326
|
};
|
|
5403
5327
|
const builder = action_builder(internal);
|
|
5404
5328
|
return Object.assign(builder, {
|
|
@@ -5412,7 +5336,7 @@ function state(entry) {
|
|
|
5412
5336
|
}
|
|
5413
5337
|
};
|
|
5414
5338
|
}
|
|
5415
|
-
|
|
5339
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, state, "state");
|
|
5416
5340
|
function action_builder(state2) {
|
|
5417
5341
|
const internal = state2;
|
|
5418
5342
|
const builder = {
|
|
@@ -5425,7 +5349,7 @@ function action_builder(state2) {
|
|
|
5425
5349
|
throw new Error(`Duplicate action "${action2}"`);
|
|
5426
5350
|
internal.actions[action2] = schema;
|
|
5427
5351
|
if (options) {
|
|
5428
|
-
|
|
5352
|
+
_chunkXG3UD63Ycjs.check.call(void 0, "action", options);
|
|
5429
5353
|
internal.options ??= {};
|
|
5430
5354
|
internal.options[action2] = options;
|
|
5431
5355
|
}
|
|
@@ -5449,12 +5373,12 @@ function action_builder(state2) {
|
|
|
5449
5373
|
(internal.loads ??= {})[action2] = loads;
|
|
5450
5374
|
return { loads: load2, requires, emit };
|
|
5451
5375
|
}
|
|
5452
|
-
|
|
5376
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, load2, "load");
|
|
5453
5377
|
function requires(rules) {
|
|
5454
5378
|
(internal.requires ??= {})[action2] = rules;
|
|
5455
5379
|
return { emit };
|
|
5456
5380
|
}
|
|
5457
|
-
|
|
5381
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, requires, "requires");
|
|
5458
5382
|
function emit(handler) {
|
|
5459
5383
|
if (typeof handler === "string") {
|
|
5460
5384
|
const event_name = handler;
|
|
@@ -5470,7 +5394,7 @@ function action_builder(state2) {
|
|
|
5470
5394
|
}
|
|
5471
5395
|
return builder;
|
|
5472
5396
|
}
|
|
5473
|
-
|
|
5397
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, emit, "emit");
|
|
5474
5398
|
return { loads: load2, requires, emit };
|
|
5475
5399
|
},
|
|
5476
5400
|
snap(snap2) {
|
|
@@ -5521,7 +5445,7 @@ function action_builder(state2) {
|
|
|
5521
5445
|
};
|
|
5522
5446
|
return builder;
|
|
5523
5447
|
}
|
|
5524
|
-
|
|
5448
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, action_builder, "action_builder");
|
|
5525
5449
|
|
|
5526
5450
|
// src/csv.ts
|
|
5527
5451
|
var _fs = require('fs');
|
|
@@ -5537,7 +5461,7 @@ var CSV_COLUMNS = [
|
|
|
5537
5461
|
];
|
|
5538
5462
|
var CsvFile = class {
|
|
5539
5463
|
static {
|
|
5540
|
-
|
|
5464
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, this, "CsvFile");
|
|
5541
5465
|
}
|
|
5542
5466
|
|
|
5543
5467
|
|
|
@@ -5632,7 +5556,7 @@ async function* linesFromFile(path) {
|
|
|
5632
5556
|
stream.close();
|
|
5633
5557
|
}
|
|
5634
5558
|
}
|
|
5635
|
-
|
|
5559
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, linesFromFile, "linesFromFile");
|
|
5636
5560
|
async function* linesFromBlob(blob) {
|
|
5637
5561
|
let start = 0;
|
|
5638
5562
|
while (start < blob.length) {
|
|
@@ -5643,7 +5567,7 @@ async function* linesFromBlob(blob) {
|
|
|
5643
5567
|
await Promise.resolve();
|
|
5644
5568
|
}
|
|
5645
5569
|
}
|
|
5646
|
-
|
|
5570
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, linesFromBlob, "linesFromBlob");
|
|
5647
5571
|
function parse_csv_line(line) {
|
|
5648
5572
|
const fields = [];
|
|
5649
5573
|
let i = 0;
|
|
@@ -5677,12 +5601,12 @@ function parse_csv_line(line) {
|
|
|
5677
5601
|
}
|
|
5678
5602
|
return fields;
|
|
5679
5603
|
}
|
|
5680
|
-
|
|
5604
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, parse_csv_line, "parse_csv_line");
|
|
5681
5605
|
function csv_escape(value) {
|
|
5682
5606
|
if (/[",\n\r]/.test(value)) return `"${value.replace(/"/g, '""')}"`;
|
|
5683
5607
|
return value;
|
|
5684
5608
|
}
|
|
5685
|
-
|
|
5609
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, csv_escape, "csv_escape");
|
|
5686
5610
|
function write_line(writer, line) {
|
|
5687
5611
|
return new Promise((resolve, reject) => {
|
|
5688
5612
|
writer.write(`${line}
|
|
@@ -5692,38 +5616,38 @@ function write_line(writer, line) {
|
|
|
5692
5616
|
});
|
|
5693
5617
|
});
|
|
5694
5618
|
}
|
|
5695
|
-
|
|
5619
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, write_line, "write_line");
|
|
5696
5620
|
|
|
5697
5621
|
// src/deprecated.ts
|
|
5698
|
-
var check_appends =
|
|
5699
|
-
var throw_if_stale =
|
|
5700
|
-
var concurrency_error =
|
|
5701
|
-
var seed_event =
|
|
5702
|
-
var fair_slots =
|
|
5703
|
-
var is_literal_source =
|
|
5704
|
-
var notification_of =
|
|
5705
|
-
var DEFAULT_QUERY_STREAMS_LIMIT2 =
|
|
5706
|
-
var ActorSchema2 =
|
|
5707
|
-
var TargetSchema2 =
|
|
5708
|
-
var EventMetaSchema2 =
|
|
5709
|
-
var CausationEventSchema2 =
|
|
5710
|
-
var CommittedMetaSchema2 =
|
|
5711
|
-
var QuerySchema2 =
|
|
5712
|
-
var Environments2 =
|
|
5713
|
-
var LogLevels2 =
|
|
5714
|
-
var ExitCodes2 =
|
|
5715
|
-
var DEFAULT_LANE2 =
|
|
5716
|
-
var DEFAULT_MAX_SUBSCRIBED_STREAMS2 =
|
|
5717
|
-
var DEFAULT_SETTLE_DEBOUNCE_MS2 =
|
|
5718
|
-
var PackageSchema =
|
|
5719
|
-
var default_scope =
|
|
5720
|
-
var extend = /* @__PURE__ */
|
|
5622
|
+
var check_appends = _chunkXJZ2PKJHcjs.checkAppends;
|
|
5623
|
+
var throw_if_stale = _chunkXJZ2PKJHcjs.checkVersion;
|
|
5624
|
+
var concurrency_error = _chunkXJZ2PKJHcjs.concurrencyError;
|
|
5625
|
+
var seed_event = _chunkXJZ2PKJHcjs.seedEvent;
|
|
5626
|
+
var fair_slots = _chunkXJZ2PKJHcjs.fairSlots;
|
|
5627
|
+
var is_literal_source = _chunkXJZ2PKJHcjs.isStreamName;
|
|
5628
|
+
var notification_of = _chunkXJZ2PKJHcjs.parseNotification;
|
|
5629
|
+
var DEFAULT_QUERY_STREAMS_LIMIT2 = _chunk4GA3CHQWcjs.DEFAULT_QUERY_STREAMS_LIMIT;
|
|
5630
|
+
var ActorSchema2 = _chunk4GA3CHQWcjs.ActorSchema;
|
|
5631
|
+
var TargetSchema2 = _chunk4GA3CHQWcjs.TargetSchema;
|
|
5632
|
+
var EventMetaSchema2 = _chunk4GA3CHQWcjs.EventMetaSchema;
|
|
5633
|
+
var CausationEventSchema2 = _chunk4GA3CHQWcjs.CausationEventSchema;
|
|
5634
|
+
var CommittedMetaSchema2 = _chunk4GA3CHQWcjs.CommittedMetaSchema;
|
|
5635
|
+
var QuerySchema2 = _chunk4GA3CHQWcjs.QuerySchema;
|
|
5636
|
+
var Environments2 = _chunk4GA3CHQWcjs.Environments;
|
|
5637
|
+
var LogLevels2 = _chunk4GA3CHQWcjs.LogLevels;
|
|
5638
|
+
var ExitCodes2 = _chunk4GA3CHQWcjs.ExitCodes;
|
|
5639
|
+
var DEFAULT_LANE2 = _chunk4GA3CHQWcjs.DEFAULT_LANE;
|
|
5640
|
+
var DEFAULT_MAX_SUBSCRIBED_STREAMS2 = _chunk4GA3CHQWcjs.DEFAULT_MAX_SUBSCRIBED_STREAMS;
|
|
5641
|
+
var DEFAULT_SETTLE_DEBOUNCE_MS2 = _chunk4GA3CHQWcjs.DEFAULT_SETTLE_DEBOUNCE_MS;
|
|
5642
|
+
var PackageSchema = _chunkXG3UD63Ycjs.package_schema;
|
|
5643
|
+
var default_scope = _chunkXG3UD63Ycjs.unscoped_ports;
|
|
5644
|
+
var extend = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (source, schema, target) => ({ ...target, ..._chunkXG3UD63Ycjs.validate.call(void 0, "config", source, schema) }), "extend");
|
|
5721
5645
|
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])?$/;
|
|
5722
|
-
var dateReviver = /* @__PURE__ */
|
|
5646
|
+
var dateReviver = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (_key, value) => typeof value === "string" && ISO_8601.test(value) ? new Date(value) : value, "dateReviver");
|
|
5723
5647
|
function sensitiveFields(schema) {
|
|
5724
5648
|
return Object.keys(pii_schemas(schema));
|
|
5725
5649
|
}
|
|
5726
|
-
|
|
5650
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, sensitiveFields, "sensitiveFields");
|
|
5727
5651
|
var pii_fields = sensitiveFields;
|
|
5728
5652
|
|
|
5729
5653
|
|
|
@@ -5784,5 +5708,5 @@ var pii_fields = sensitiveFields;
|
|
|
5784
5708
|
|
|
5785
5709
|
|
|
5786
5710
|
|
|
5787
|
-
exports.Act = Act; exports.ActorSchema = ActorSchema2; exports.CausationEventSchema = CausationEventSchema2; exports.CommittedMetaSchema = CommittedMetaSchema2; exports.ConcurrencyError =
|
|
5711
|
+
exports.Act = Act; exports.ActorSchema = ActorSchema2; exports.CausationEventSchema = CausationEventSchema2; exports.CommittedMetaSchema = CommittedMetaSchema2; exports.ConcurrencyError = _chunk4GA3CHQWcjs.ConcurrencyError; exports.ConsoleLogger = _chunkXG3UD63Ycjs.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 = _chunk4GA3CHQWcjs.DeferSignal; exports.Environments = Environments2; exports.Errors = _chunk4GA3CHQWcjs.Errors; exports.EventMetaSchema = EventMetaSchema2; exports.ExitCodes = ExitCodes2; exports.InMemoryCache = _chunkXG3UD63Ycjs.InMemoryCache; exports.InMemoryStore = _chunkXG3UD63Ycjs.InMemoryStore; exports.LogLevels = LogLevels2; exports.NonRetryableError = _chunk4GA3CHQWcjs.NonRetryableError; exports.PackageSchema = PackageSchema; exports.PreconditionError = _chunk4GA3CHQWcjs.PreconditionError; exports.QuerySchema = QuerySchema2; exports.REDACTED = _chunk4GA3CHQWcjs.REDACTED; exports.SHREDDED = _chunk4GA3CHQWcjs.SHREDDED; exports.SNAP_EVENT = _chunk4GA3CHQWcjs.SNAP_EVENT; exports.StoreError = _chunk4GA3CHQWcjs.StoreError; exports.StreamClosedError = _chunk4GA3CHQWcjs.StreamClosedError; exports.TOMBSTONE_EVENT = _chunk4GA3CHQWcjs.TOMBSTONE_EVENT; exports.TargetSchema = TargetSchema2; exports.ValidationError = _chunk4GA3CHQWcjs.ValidationError; exports.ZodEmpty = _chunk4GA3CHQWcjs.ZodEmpty; exports.act = act; exports.cache = _chunkXG3UD63Ycjs.cache; exports.check_appends = check_appends; exports.concurrency_error = concurrency_error; exports.config = _chunkXG3UD63Ycjs.config; exports.dateReviver = dateReviver; exports.default_scope = default_scope; exports.dispose = _chunkXG3UD63Ycjs.dispose; exports.disposeAndExit = _chunkXG3UD63Ycjs.disposeAndExit; exports.extend = extend; exports.fair_slots = fair_slots; exports.is_literal_source = is_literal_source; exports.log = _chunkXG3UD63Ycjs.log; exports.notification_of = notification_of; exports.pii_fields = pii_fields; exports.port = _chunkXG3UD63Ycjs.port; exports.projection = projection; exports.seed_event = seed_event; exports.sensitive = _chunk4GA3CHQWcjs.sensitive; exports.sensitiveFields = sensitiveFields; exports.sleep = _chunkXG3UD63Ycjs.sleep; exports.slice = slice; exports.state = state; exports.store = _chunkXG3UD63Ycjs.store; exports.throw_if_stale = throw_if_stale; exports.validate = _chunkXG3UD63Ycjs.validate;
|
|
5788
5712
|
//# sourceMappingURL=index.cjs.map
|