@rotorsoft/act 2.1.14 → 2.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/@types/act.d.ts.map +1 -1
- package/dist/@types/types/act.d.ts +4 -3
- package/dist/@types/types/act.d.ts.map +1 -1
- package/dist/adapter.cjs +3 -3
- package/dist/adapter.js +2 -2
- package/dist/{chunk-WDIBO6AW.cjs → chunk-3WHD4VPP.cjs} +54 -54
- package/dist/{chunk-WDIBO6AW.cjs.map → chunk-3WHD4VPP.cjs.map} +1 -1
- package/dist/{chunk-SCH4GLWM.js → chunk-CWWTVYIN.js} +3 -3
- package/dist/{chunk-EIGZVFT7.js → chunk-GHMCESJA.js} +2 -2
- package/dist/{chunk-GDPBPAML.js → chunk-KAUON2M3.js} +1 -1
- package/dist/chunk-KAUON2M3.js.map +1 -0
- package/dist/{chunk-UEGKXCSQ.cjs → chunk-LA2BPKNS.cjs} +1 -1
- package/dist/chunk-LA2BPKNS.cjs.map +1 -0
- package/dist/{chunk-DCWPJFXR.cjs → chunk-QITJ63HG.cjs} +11 -11
- package/dist/{chunk-DCWPJFXR.cjs.map → chunk-QITJ63HG.cjs.map} +1 -1
- package/dist/index.cjs +423 -422
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -3
- 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 +2 -2
- package/dist/chunk-GDPBPAML.js.map +0 -1
- package/dist/chunk-UEGKXCSQ.cjs.map +0 -1
- /package/dist/{chunk-SCH4GLWM.js.map → chunk-CWWTVYIN.js.map} +0 -0
- /package/dist/{chunk-EIGZVFT7.js.map → chunk-GHMCESJA.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
var
|
|
30
|
+
var _chunk3WHD4VPPcjs = require('./chunk-3WHD4VPP.cjs');
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
|
|
@@ -36,7 +36,7 @@ var _chunkWDIBO6AWcjs = require('./chunk-WDIBO6AW.cjs');
|
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
var
|
|
39
|
+
var _chunkQITJ63HGcjs = require('./chunk-QITJ63HG.cjs');
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
|
|
@@ -66,26 +66,26 @@ var _chunkDCWPJFXRcjs = require('./chunk-DCWPJFXR.cjs');
|
|
|
66
66
|
|
|
67
67
|
|
|
68
68
|
|
|
69
|
-
var
|
|
69
|
+
var _chunkLA2BPKNScjs = require('./chunk-LA2BPKNS.cjs');
|
|
70
70
|
|
|
71
71
|
// src/signals.ts
|
|
72
72
|
process.once("SIGINT", async (arg) => {
|
|
73
|
-
|
|
74
|
-
await
|
|
73
|
+
_chunk3WHD4VPPcjs.log.call(void 0, ).info(arg, "SIGINT");
|
|
74
|
+
await _chunk3WHD4VPPcjs.disposeAndExit.call(void 0, "EXIT");
|
|
75
75
|
});
|
|
76
76
|
process.once("SIGTERM", async (arg) => {
|
|
77
|
-
|
|
78
|
-
await
|
|
77
|
+
_chunk3WHD4VPPcjs.log.call(void 0, ).info(arg, "SIGTERM");
|
|
78
|
+
await _chunk3WHD4VPPcjs.disposeAndExit.call(void 0, "EXIT");
|
|
79
79
|
});
|
|
80
80
|
process.once("uncaughtException", async (arg) => {
|
|
81
81
|
process.exitCode = 1;
|
|
82
|
-
|
|
83
|
-
await
|
|
82
|
+
_chunk3WHD4VPPcjs.log.call(void 0, ).error(arg, "Uncaught Exception");
|
|
83
|
+
await _chunk3WHD4VPPcjs.disposeAndExit.call(void 0, "ERROR");
|
|
84
84
|
});
|
|
85
85
|
process.once("unhandledRejection", async (arg) => {
|
|
86
86
|
process.exitCode = 1;
|
|
87
|
-
|
|
88
|
-
await
|
|
87
|
+
_chunk3WHD4VPPcjs.log.call(void 0, ).error(arg, "Unhandled Rejection");
|
|
88
|
+
await _chunk3WHD4VPPcjs.disposeAndExit.call(void 0, "ERROR");
|
|
89
89
|
});
|
|
90
90
|
|
|
91
91
|
// src/act.ts
|
|
@@ -101,7 +101,7 @@ function parse(name) {
|
|
|
101
101
|
}
|
|
102
102
|
return { base: name, version: 1 };
|
|
103
103
|
}
|
|
104
|
-
|
|
104
|
+
_chunkLA2BPKNScjs.__name.call(void 0, parse, "parse");
|
|
105
105
|
function deprecated_event_names(names) {
|
|
106
106
|
const groups = /* @__PURE__ */ new Map();
|
|
107
107
|
for (const name of names) {
|
|
@@ -127,7 +127,7 @@ function deprecated_event_names(names) {
|
|
|
127
127
|
}
|
|
128
128
|
return deprecated;
|
|
129
129
|
}
|
|
130
|
-
|
|
130
|
+
_chunkLA2BPKNScjs.__name.call(void 0, deprecated_event_names, "deprecated_event_names");
|
|
131
131
|
function current_version_of(deprecated_name, all_names) {
|
|
132
132
|
const target = parse(deprecated_name);
|
|
133
133
|
let highest;
|
|
@@ -138,7 +138,7 @@ function current_version_of(deprecated_name, all_names) {
|
|
|
138
138
|
}
|
|
139
139
|
return highest && highest.version > target.version ? highest.name : void 0;
|
|
140
140
|
}
|
|
141
|
-
|
|
141
|
+
_chunkLA2BPKNScjs.__name.call(void 0, current_version_of, "current_version_of");
|
|
142
142
|
|
|
143
143
|
// src/internal/walk-streams.ts
|
|
144
144
|
var DEFAULT_STREAM_PAGE = 500;
|
|
@@ -160,7 +160,7 @@ async function walk_streams(store2, callback, query) {
|
|
|
160
160
|
after = last;
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
|
-
|
|
163
|
+
_chunkLA2BPKNScjs.__name.call(void 0, walk_streams, "walk_streams");
|
|
164
164
|
|
|
165
165
|
// src/internal/audit.ts
|
|
166
166
|
var DEFAULTS = {
|
|
@@ -197,7 +197,7 @@ async function* audit(deps, categories, options = {}) {
|
|
|
197
197
|
if (need_stats) {
|
|
198
198
|
const stats = await deps.store().query_stats(
|
|
199
199
|
{},
|
|
200
|
-
{ count: true, names: true, exclude: [
|
|
200
|
+
{ count: true, names: true, exclude: [_chunkLA2BPKNScjs.SNAP_EVENT] }
|
|
201
201
|
);
|
|
202
202
|
for (const [stream, s] of stats) {
|
|
203
203
|
for (const p of passes) _optionalChain([p, 'access', _4 => _4.on_stat, 'optionalCall', _5 => _5(stream, s)]);
|
|
@@ -225,7 +225,7 @@ async function* audit(deps, categories, options = {}) {
|
|
|
225
225
|
for (const f of p.drain()) yield f;
|
|
226
226
|
}
|
|
227
227
|
}
|
|
228
|
-
|
|
228
|
+
_chunkLA2BPKNScjs.__name.call(void 0, audit, "audit");
|
|
229
229
|
async function scan_events_resiliently(deps, query, on_event, on_unreadable) {
|
|
230
230
|
let cursor = _optionalChain([query, 'optionalAccess', _14 => _14.after]);
|
|
231
231
|
let remaining = _optionalChain([query, 'optionalAccess', _15 => _15.limit]);
|
|
@@ -261,8 +261,8 @@ async function scan_events_resiliently(deps, query, on_event, on_unreadable) {
|
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
|
-
|
|
265
|
-
var make_schema_pass = /* @__PURE__ */
|
|
264
|
+
_chunkLA2BPKNScjs.__name.call(void 0, scan_events_resiliently, "scan_events_resiliently");
|
|
265
|
+
var make_schema_pass = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (deps) => {
|
|
266
266
|
const findings = [];
|
|
267
267
|
return {
|
|
268
268
|
category: "schema",
|
|
@@ -305,10 +305,10 @@ var make_schema_pass = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (de
|
|
|
305
305
|
});
|
|
306
306
|
}
|
|
307
307
|
},
|
|
308
|
-
drain: /* @__PURE__ */
|
|
308
|
+
drain: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, () => findings, "drain")
|
|
309
309
|
};
|
|
310
310
|
}, "make_schema_pass");
|
|
311
|
-
var classify_deprecated_by_state = /* @__PURE__ */
|
|
311
|
+
var classify_deprecated_by_state = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (deps) => {
|
|
312
312
|
const names_by_state = /* @__PURE__ */ new Map();
|
|
313
313
|
for (const [name, state2] of deps.event_to_state) {
|
|
314
314
|
let set = names_by_state.get(state2);
|
|
@@ -326,7 +326,7 @@ var classify_deprecated_by_state = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call
|
|
|
326
326
|
}
|
|
327
327
|
return deprecated_to_current;
|
|
328
328
|
}, "classify_deprecated_by_state");
|
|
329
|
-
var make_deprecated_load_pass = /* @__PURE__ */
|
|
329
|
+
var make_deprecated_load_pass = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (deps, options) => {
|
|
330
330
|
const share_min = _nullishCoalesce(_optionalChain([options, 'access', _17 => _17.thresholds, 'optionalAccess', _18 => _18.deprecated_min]), () => ( DEFAULTS.deprecated_min));
|
|
331
331
|
const totals = /* @__PURE__ */ new Map();
|
|
332
332
|
const per_stream = /* @__PURE__ */ new Map();
|
|
@@ -366,7 +366,7 @@ var make_deprecated_load_pass = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(vo
|
|
|
366
366
|
}
|
|
367
367
|
};
|
|
368
368
|
}, "make_deprecated_load_pass");
|
|
369
|
-
var make_close_candidate_pass = /* @__PURE__ */
|
|
369
|
+
var make_close_candidate_pass = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (deps, options) => {
|
|
370
370
|
const idle_days = _nullishCoalesce(_optionalChain([options, 'access', _19 => _19.thresholds, 'optionalAccess', _20 => _20.idle_days]), () => ( DEFAULTS.idle_days));
|
|
371
371
|
const terminal_events = new Set(_nullishCoalesce(_optionalChain([options, 'access', _21 => _21.thresholds, 'optionalAccess', _22 => _22.terminal_events]), () => ( [])));
|
|
372
372
|
const idle_cutoff = Date.now() - idle_days * 24 * 60 * 60 * 1e3;
|
|
@@ -389,10 +389,10 @@ var make_close_candidate_pass = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(vo
|
|
|
389
389
|
restart_supported: restart_is_supported(deps, head_name)
|
|
390
390
|
});
|
|
391
391
|
},
|
|
392
|
-
drain: /* @__PURE__ */
|
|
392
|
+
drain: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, () => findings, "drain")
|
|
393
393
|
};
|
|
394
394
|
}, "make_close_candidate_pass");
|
|
395
|
-
var make_restart_candidate_pass = /* @__PURE__ */
|
|
395
|
+
var make_restart_candidate_pass = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (deps, options) => {
|
|
396
396
|
const threshold = _nullishCoalesce(_optionalChain([options, 'access', _23 => _23.thresholds, 'optionalAccess', _24 => _24.restart_min]), () => ( DEFAULTS.restart_min));
|
|
397
397
|
const candidates = [];
|
|
398
398
|
const findings = [];
|
|
@@ -415,7 +415,7 @@ var make_restart_candidate_pass = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(
|
|
|
415
415
|
{
|
|
416
416
|
stream,
|
|
417
417
|
stream_exact: true,
|
|
418
|
-
names: [
|
|
418
|
+
names: [_chunkLA2BPKNScjs.SNAP_EVENT],
|
|
419
419
|
with_snaps: true,
|
|
420
420
|
// From the start: on its own, `with_snaps` resumes at the latest.
|
|
421
421
|
after: -1
|
|
@@ -429,10 +429,10 @@ var make_restart_candidate_pass = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(
|
|
|
429
429
|
});
|
|
430
430
|
}
|
|
431
431
|
},
|
|
432
|
-
drain: /* @__PURE__ */
|
|
432
|
+
drain: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, () => findings, "drain")
|
|
433
433
|
};
|
|
434
434
|
}, "make_restart_candidate_pass");
|
|
435
|
-
var make_reaction_health_pass = /* @__PURE__ */
|
|
435
|
+
var make_reaction_health_pass = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (_deps, options) => {
|
|
436
436
|
const near_block = _nullishCoalesce(_optionalChain([options, 'access', _25 => _25.thresholds, 'optionalAccess', _26 => _26.near_block]), () => ( DEFAULTS.near_block));
|
|
437
437
|
const stuck_minutes = _nullishCoalesce(_optionalChain([options, 'access', _27 => _27.thresholds, 'optionalAccess', _28 => _28.stuck_minutes]), () => ( DEFAULTS.stuck_minutes));
|
|
438
438
|
const stuck_cutoff = Date.now() - stuck_minutes * 60 * 1e3;
|
|
@@ -473,10 +473,10 @@ var make_reaction_health_pass = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(vo
|
|
|
473
473
|
});
|
|
474
474
|
}
|
|
475
475
|
},
|
|
476
|
-
drain: /* @__PURE__ */
|
|
476
|
+
drain: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, () => findings, "drain")
|
|
477
477
|
};
|
|
478
478
|
}, "make_reaction_health_pass");
|
|
479
|
-
var make_snapshot_drift_pass = /* @__PURE__ */
|
|
479
|
+
var make_snapshot_drift_pass = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (deps, options) => {
|
|
480
480
|
const drift_min = _nullishCoalesce(_optionalChain([options, 'access', _29 => _29.thresholds, 'optionalAccess', _30 => _30.drift_min]), () => ( DEFAULTS.drift_min));
|
|
481
481
|
const candidates = [];
|
|
482
482
|
const findings = [];
|
|
@@ -528,10 +528,10 @@ var make_snapshot_drift_pass = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(voi
|
|
|
528
528
|
});
|
|
529
529
|
}
|
|
530
530
|
},
|
|
531
|
-
drain: /* @__PURE__ */
|
|
531
|
+
drain: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, () => findings, "drain")
|
|
532
532
|
};
|
|
533
533
|
}, "make_snapshot_drift_pass");
|
|
534
|
-
var make_routing_health_pass = /* @__PURE__ */
|
|
534
|
+
var make_routing_health_pass = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (deps) => {
|
|
535
535
|
const findings = [];
|
|
536
536
|
const seen_event_names = /* @__PURE__ */ new Set();
|
|
537
537
|
return {
|
|
@@ -563,10 +563,10 @@ var make_routing_health_pass = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(voi
|
|
|
563
563
|
}
|
|
564
564
|
return Promise.resolve();
|
|
565
565
|
},
|
|
566
|
-
drain: /* @__PURE__ */
|
|
566
|
+
drain: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, () => findings, "drain")
|
|
567
567
|
};
|
|
568
568
|
}, "make_routing_health_pass");
|
|
569
|
-
var make_correlation_gaps_pass = /* @__PURE__ */
|
|
569
|
+
var make_correlation_gaps_pass = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, () => {
|
|
570
570
|
const seen_ids = /* @__PURE__ */ new Set();
|
|
571
571
|
const checks = [];
|
|
572
572
|
return {
|
|
@@ -575,7 +575,7 @@ var make_correlation_gaps_pass = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(v
|
|
|
575
575
|
seen_ids.add(e.id);
|
|
576
576
|
const causation = _optionalChain([e, 'access', _31 => _31.meta, 'optionalAccess', _32 => _32.causation]);
|
|
577
577
|
const parent_id = _optionalChain([causation, 'optionalAccess', _33 => _33.event, 'optionalAccess', _34 => _34.id]);
|
|
578
|
-
if (parent_id !== void 0 && e.name !==
|
|
578
|
+
if (parent_id !== void 0 && e.name !== _chunkLA2BPKNScjs.TOMBSTONE_EVENT) {
|
|
579
579
|
checks.push({ stream: e.stream, id: e.id, parent_id });
|
|
580
580
|
}
|
|
581
581
|
},
|
|
@@ -595,7 +595,7 @@ var make_correlation_gaps_pass = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(v
|
|
|
595
595
|
}
|
|
596
596
|
};
|
|
597
597
|
}, "make_correlation_gaps_pass");
|
|
598
|
-
var make_clock_anomalies_pass = /* @__PURE__ */
|
|
598
|
+
var make_clock_anomalies_pass = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, () => {
|
|
599
599
|
const findings = [];
|
|
600
600
|
const last_per_stream = /* @__PURE__ */ new Map();
|
|
601
601
|
return {
|
|
@@ -621,14 +621,14 @@ var make_clock_anomalies_pass = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(vo
|
|
|
621
621
|
}
|
|
622
622
|
last_per_stream.set(e.stream, created);
|
|
623
623
|
},
|
|
624
|
-
drain: /* @__PURE__ */
|
|
624
|
+
drain: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, () => findings, "drain")
|
|
625
625
|
};
|
|
626
626
|
}, "make_clock_anomalies_pass");
|
|
627
627
|
function restart_is_supported(deps, head_event_name) {
|
|
628
628
|
const state2 = deps.event_to_state.get(head_event_name);
|
|
629
629
|
return _optionalChain([state2, 'optionalAccess', _35 => _35.snap]) !== void 0;
|
|
630
630
|
}
|
|
631
|
-
|
|
631
|
+
_chunkLA2BPKNScjs.__name.call(void 0, restart_is_supported, "restart_is_supported");
|
|
632
632
|
function make_unreadable_events_pass() {
|
|
633
633
|
const findings = [];
|
|
634
634
|
return {
|
|
@@ -642,10 +642,10 @@ function make_unreadable_events_pass() {
|
|
|
642
642
|
error
|
|
643
643
|
});
|
|
644
644
|
},
|
|
645
|
-
drain: /* @__PURE__ */
|
|
645
|
+
drain: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, () => findings, "drain")
|
|
646
646
|
};
|
|
647
647
|
}
|
|
648
|
-
|
|
648
|
+
_chunkLA2BPKNScjs.__name.call(void 0, make_unreadable_events_pass, "make_unreadable_events_pass");
|
|
649
649
|
var PASS_FACTORIES = {
|
|
650
650
|
schema: make_schema_pass,
|
|
651
651
|
"deprecated-load": make_deprecated_load_pass,
|
|
@@ -662,7 +662,7 @@ var PASS_FACTORIES = {
|
|
|
662
662
|
// src/internal/circuit-breaker.ts
|
|
663
663
|
var CircuitBreaker = (_class = class {
|
|
664
664
|
static {
|
|
665
|
-
|
|
665
|
+
_chunkLA2BPKNScjs.__name.call(void 0, this, "CircuitBreaker");
|
|
666
666
|
}
|
|
667
667
|
__init() {this._failures = 0}
|
|
668
668
|
|
|
@@ -755,7 +755,7 @@ var CircuitBreaker = (_class = class {
|
|
|
755
755
|
|
|
756
756
|
// src/internal/classify.ts
|
|
757
757
|
var ALL_LANES = /* @__PURE__ */ Symbol("act/all-lanes");
|
|
758
|
-
var describe_source = /* @__PURE__ */
|
|
758
|
+
var describe_source = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (source) => source === void 0 ? "no source (every stream)" : `"${source}"`, "describe_source");
|
|
759
759
|
function classify_registry(registry, states) {
|
|
760
760
|
const statics = /* @__PURE__ */ new Map();
|
|
761
761
|
const target_lanes = /* @__PURE__ */ new Map();
|
|
@@ -806,43 +806,43 @@ function classify_registry(registry, states) {
|
|
|
806
806
|
event_to_lanes
|
|
807
807
|
};
|
|
808
808
|
}
|
|
809
|
-
|
|
809
|
+
_chunkLA2BPKNScjs.__name.call(void 0, classify_registry, "classify_registry");
|
|
810
810
|
|
|
811
811
|
// src/internal/autoclose-policy.ts
|
|
812
812
|
var DAY_MS = 864e5;
|
|
813
813
|
function days_after(date, days) {
|
|
814
814
|
return new Date(date.getTime() + days * DAY_MS);
|
|
815
815
|
}
|
|
816
|
-
|
|
816
|
+
_chunkLA2BPKNScjs.__name.call(void 0, days_after, "days_after");
|
|
817
817
|
function days_before_now(days) {
|
|
818
818
|
return new Date(Date.now() - days * DAY_MS);
|
|
819
819
|
}
|
|
820
|
-
|
|
820
|
+
_chunkLA2BPKNScjs.__name.call(void 0, days_before_now, "days_before_now");
|
|
821
821
|
function compile_after(after) {
|
|
822
822
|
return (_stream, head) => days_after(head.created, after.days) <= /* @__PURE__ */ new Date();
|
|
823
823
|
}
|
|
824
|
-
|
|
824
|
+
_chunkLA2BPKNScjs.__name.call(void 0, compile_after, "compile_after");
|
|
825
825
|
function compile_is(is) {
|
|
826
826
|
const set = new Set(typeof is === "string" ? [is] : is);
|
|
827
827
|
return (_stream, head) => set.has(head.name);
|
|
828
828
|
}
|
|
829
|
-
|
|
829
|
+
_chunkLA2BPKNScjs.__name.call(void 0, compile_is, "compile_is");
|
|
830
830
|
function compile_reaches(reaches) {
|
|
831
831
|
return (_stream, _head, count) => count >= reaches;
|
|
832
832
|
}
|
|
833
|
-
|
|
833
|
+
_chunkLA2BPKNScjs.__name.call(void 0, compile_reaches, "compile_reaches");
|
|
834
834
|
function policy_after_windows(options) {
|
|
835
|
-
const parsed =
|
|
835
|
+
const parsed = _chunk3WHD4VPPcjs.check.call(void 0, "autoclose_policy", options);
|
|
836
836
|
return [parsed.after, _optionalChain([parsed, 'access', _42 => _42.or, 'optionalAccess', _43 => _43.after])].flatMap((w) => w ? [w.days] : []);
|
|
837
837
|
}
|
|
838
|
-
|
|
838
|
+
_chunkLA2BPKNScjs.__name.call(void 0, policy_after_windows, "policy_after_windows");
|
|
839
839
|
function policy_keep_days(options) {
|
|
840
|
-
const parsed =
|
|
840
|
+
const parsed = _chunk3WHD4VPPcjs.check.call(void 0, "autoclose_policy", options);
|
|
841
841
|
return _optionalChain([parsed, 'access', _44 => _44.keep, 'optionalAccess', _45 => _45.days]);
|
|
842
842
|
}
|
|
843
|
-
|
|
843
|
+
_chunkLA2BPKNScjs.__name.call(void 0, policy_keep_days, "policy_keep_days");
|
|
844
844
|
function compile_autoclose_policy(options) {
|
|
845
|
-
const parsed =
|
|
845
|
+
const parsed = _chunk3WHD4VPPcjs.check.call(void 0, "autoclose_policy", options);
|
|
846
846
|
const and_preds = [];
|
|
847
847
|
if (parsed.after) and_preds.push(compile_after(parsed.after));
|
|
848
848
|
if (parsed.is) and_preds.push(compile_is(parsed.is));
|
|
@@ -863,7 +863,7 @@ function compile_autoclose_policy(options) {
|
|
|
863
863
|
return false;
|
|
864
864
|
};
|
|
865
865
|
}
|
|
866
|
-
|
|
866
|
+
_chunkLA2BPKNScjs.__name.call(void 0, compile_autoclose_policy, "compile_autoclose_policy");
|
|
867
867
|
|
|
868
868
|
// src/internal/autoclose-window.ts
|
|
869
869
|
function hour_in_zone(now, timeZone) {
|
|
@@ -874,24 +874,24 @@ function hour_in_zone(now, timeZone) {
|
|
|
874
874
|
}).formatToParts(now);
|
|
875
875
|
return Number(_optionalChain([parts, 'access', _46 => _46.find, 'call', _47 => _47((p) => p.type === "hour"), 'optionalAccess', _48 => _48.value]));
|
|
876
876
|
}
|
|
877
|
-
|
|
877
|
+
_chunkLA2BPKNScjs.__name.call(void 0, hour_in_zone, "hour_in_zone");
|
|
878
878
|
function hour_in_range(hour, start, end) {
|
|
879
879
|
return start < end ? hour >= start && hour < end : hour >= start || hour < end;
|
|
880
880
|
}
|
|
881
|
-
|
|
881
|
+
_chunkLA2BPKNScjs.__name.call(void 0, hour_in_range, "hour_in_range");
|
|
882
882
|
function is_dst_gap_open(now, timeZone, start) {
|
|
883
883
|
const hour = hour_in_zone(now, timeZone);
|
|
884
884
|
if (hour <= start) return false;
|
|
885
885
|
const prev = hour_in_zone(new Date(now.getTime() - 36e5), timeZone);
|
|
886
886
|
return prev === start - 1 && hour === start + 1;
|
|
887
887
|
}
|
|
888
|
-
|
|
888
|
+
_chunkLA2BPKNScjs.__name.call(void 0, is_dst_gap_open, "is_dst_gap_open");
|
|
889
889
|
function in_autoclose_window(window, now) {
|
|
890
890
|
if (!window) return true;
|
|
891
891
|
const hour = hour_in_zone(now, window.timeZone);
|
|
892
892
|
return hour_in_range(hour, window.start, window.end) || is_dst_gap_open(now, window.timeZone, window.start);
|
|
893
893
|
}
|
|
894
|
-
|
|
894
|
+
_chunkLA2BPKNScjs.__name.call(void 0, in_autoclose_window, "in_autoclose_window");
|
|
895
895
|
function next_window_open(window, now) {
|
|
896
896
|
const start_ms = now.getTime();
|
|
897
897
|
for (let h = 0; h <= 48; h++) {
|
|
@@ -906,30 +906,30 @@ function next_window_open(window, now) {
|
|
|
906
906
|
}
|
|
907
907
|
return new Date(start_ms + 864e5);
|
|
908
908
|
}
|
|
909
|
-
|
|
909
|
+
_chunkLA2BPKNScjs.__name.call(void 0, next_window_open, "next_window_open");
|
|
910
910
|
|
|
911
911
|
// src/internal/defer-config.ts
|
|
912
912
|
function duration_ms(d) {
|
|
913
913
|
return (_nullishCoalesce(d.days, () => ( 0))) * 864e5 + (_nullishCoalesce(d.hours, () => ( 0))) * 36e5 + (_nullishCoalesce(d.minutes, () => ( 0))) * 6e4;
|
|
914
914
|
}
|
|
915
|
-
|
|
915
|
+
_chunkLA2BPKNScjs.__name.call(void 0, duration_ms, "duration_ms");
|
|
916
916
|
function resolve_defer_at(when, event) {
|
|
917
|
-
const parsed =
|
|
917
|
+
const parsed = _chunk3WHD4VPPcjs.check.call(void 0, "defer", when);
|
|
918
918
|
if (parsed.after) return event.created.getTime() + duration_ms(parsed.after);
|
|
919
919
|
return parsed.at.getTime();
|
|
920
920
|
}
|
|
921
|
-
|
|
921
|
+
_chunkLA2BPKNScjs.__name.call(void 0, resolve_defer_at, "resolve_defer_at");
|
|
922
922
|
function make_deferred(handler, schedule) {
|
|
923
923
|
const call = handler;
|
|
924
|
-
const deferred = /* @__PURE__ */
|
|
924
|
+
const deferred = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, async (event, stream, app) => {
|
|
925
925
|
const when = typeof schedule === "function" ? schedule(event) : schedule;
|
|
926
|
-
if (Date.now() < resolve_defer_at(when, event)) throw new (0,
|
|
926
|
+
if (Date.now() < resolve_defer_at(when, event)) throw new (0, _chunkLA2BPKNScjs.DeferSignal)(when);
|
|
927
927
|
return call(event, stream, app);
|
|
928
928
|
}, "deferred");
|
|
929
929
|
Object.defineProperty(deferred, "name", { value: handler.name });
|
|
930
930
|
return deferred;
|
|
931
931
|
}
|
|
932
|
-
|
|
932
|
+
_chunkLA2BPKNScjs.__name.call(void 0, make_deferred, "make_deferred");
|
|
933
933
|
|
|
934
934
|
// src/internal/drain-cycle.ts
|
|
935
935
|
var _crypto = require('crypto');
|
|
@@ -958,13 +958,13 @@ function compute_backoff_delay(retry, opts) {
|
|
|
958
958
|
if (opts.jitter) delay = delay * (0.5 + Math.random());
|
|
959
959
|
return Math.max(0, Math.floor(delay));
|
|
960
960
|
}
|
|
961
|
-
|
|
961
|
+
_chunkLA2BPKNScjs.__name.call(void 0, compute_backoff_delay, "compute_backoff_delay");
|
|
962
962
|
|
|
963
963
|
// src/internal/defer-timer.ts
|
|
964
964
|
var MAX_TIMER_DELAY_MS = 2147483647;
|
|
965
965
|
var DeferTimer = (_class2 = class {
|
|
966
966
|
static {
|
|
967
|
-
|
|
967
|
+
_chunkLA2BPKNScjs.__name.call(void 0, this, "DeferTimer");
|
|
968
968
|
}
|
|
969
969
|
__init2() {this._due = /* @__PURE__ */ new Map()}
|
|
970
970
|
|
|
@@ -1055,15 +1055,15 @@ function compute_lag_lead_ratio(handled, lagging, leading) {
|
|
|
1055
1055
|
if (total === 0) return RATIO_DEFAULT;
|
|
1056
1056
|
return Math.max(RATIO_MIN, Math.min(RATIO_MAX, lagging_avg / total));
|
|
1057
1057
|
}
|
|
1058
|
-
|
|
1058
|
+
_chunkLA2BPKNScjs.__name.call(void 0, compute_lag_lead_ratio, "compute_lag_lead_ratio");
|
|
1059
1059
|
|
|
1060
1060
|
// src/internal/report-once.ts
|
|
1061
1061
|
function report_once(seen, key, message) {
|
|
1062
1062
|
if (seen.has(key)) return;
|
|
1063
1063
|
seen.add(key);
|
|
1064
|
-
|
|
1064
|
+
_chunk3WHD4VPPcjs.log.call(void 0, ).error(new Error(message));
|
|
1065
1065
|
}
|
|
1066
|
-
|
|
1066
|
+
_chunkLA2BPKNScjs.__name.call(void 0, report_once, "report_once");
|
|
1067
1067
|
|
|
1068
1068
|
// src/internal/correlation-id.ts
|
|
1069
1069
|
|
|
@@ -1073,8 +1073,8 @@ var SEG_SPACE = BASE ** SEG_WIDTH;
|
|
|
1073
1073
|
function seg(n) {
|
|
1074
1074
|
return n.toString(BASE).padStart(SEG_WIDTH, "0");
|
|
1075
1075
|
}
|
|
1076
|
-
|
|
1077
|
-
var default_correlator = /* @__PURE__ */
|
|
1076
|
+
_chunkLA2BPKNScjs.__name.call(void 0, seg, "seg");
|
|
1077
|
+
var default_correlator = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, ({ state: state2, action: action2 }) => {
|
|
1078
1078
|
const s = state2.slice(0, SEG_WIDTH).toLowerCase();
|
|
1079
1079
|
const a = action2.slice(0, SEG_WIDTH).toLowerCase();
|
|
1080
1080
|
const ts = seg(Date.now() % SEG_SPACE);
|
|
@@ -1089,17 +1089,17 @@ function close_correlation(correlator, actor) {
|
|
|
1089
1089
|
actor
|
|
1090
1090
|
});
|
|
1091
1091
|
}
|
|
1092
|
-
|
|
1092
|
+
_chunkLA2BPKNScjs.__name.call(void 0, close_correlation, "close_correlation");
|
|
1093
1093
|
|
|
1094
1094
|
// src/internal/drain-ops.ts
|
|
1095
|
-
var claim = /* @__PURE__ */
|
|
1095
|
+
var claim = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (lagging, leading, by, millis, lane) => _chunk3WHD4VPPcjs.store.call(void 0, ).claim(lagging, leading, by, millis, lane), "claim");
|
|
1096
1096
|
async function fetch(leased, eventLimit) {
|
|
1097
1097
|
return Promise.all(
|
|
1098
1098
|
leased.map(async ({ stream, source, at, lagging }) => {
|
|
1099
1099
|
const events = [];
|
|
1100
|
-
const stream_exact = source !== void 0 &&
|
|
1100
|
+
const stream_exact = source !== void 0 && _chunkQITJ63HGcjs.isStreamName.call(void 0, source, stream) ? true : void 0;
|
|
1101
1101
|
try {
|
|
1102
|
-
await
|
|
1102
|
+
await _chunk3WHD4VPPcjs.store.call(void 0, ).query((e) => events.push(e), {
|
|
1103
1103
|
stream: source,
|
|
1104
1104
|
stream_exact,
|
|
1105
1105
|
after: at,
|
|
@@ -1119,10 +1119,10 @@ async function fetch(leased, eventLimit) {
|
|
|
1119
1119
|
})
|
|
1120
1120
|
);
|
|
1121
1121
|
}
|
|
1122
|
-
|
|
1123
|
-
var ack = /* @__PURE__ */
|
|
1124
|
-
var block = /* @__PURE__ */
|
|
1125
|
-
var subscribe = /* @__PURE__ */
|
|
1122
|
+
_chunkLA2BPKNScjs.__name.call(void 0, fetch, "fetch");
|
|
1123
|
+
var ack = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (leases) => _chunk3WHD4VPPcjs.store.call(void 0, ).ack(leases), "ack");
|
|
1124
|
+
var block = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (leases) => _chunk3WHD4VPPcjs.store.call(void 0, ).block(leases), "block");
|
|
1125
|
+
var subscribe = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (streams, correlated_at, correlator) => _chunk3WHD4VPPcjs.store.call(void 0, ).subscribe(streams, correlated_at, correlator), "subscribe");
|
|
1126
1126
|
|
|
1127
1127
|
// src/internal/event-sourcing.ts
|
|
1128
1128
|
var _actpatch = require('@rotorsoft/act-patch');
|
|
@@ -1132,7 +1132,7 @@ var _zod2 = require('zod');
|
|
|
1132
1132
|
|
|
1133
1133
|
|
|
1134
1134
|
// src/internal/zod.ts
|
|
1135
|
-
var def_of = /* @__PURE__ */
|
|
1135
|
+
var def_of = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (schema) => _optionalChain([schema, 'optionalAccess', _50 => _50._zod, 'optionalAccess', _51 => _51.def]), "def_of");
|
|
1136
1136
|
var SINGLE_INNER = [
|
|
1137
1137
|
"optional",
|
|
1138
1138
|
"nullable",
|
|
@@ -1142,7 +1142,7 @@ var SINGLE_INNER = [
|
|
|
1142
1142
|
"readonly",
|
|
1143
1143
|
"catch"
|
|
1144
1144
|
];
|
|
1145
|
-
var inner_of = /* @__PURE__ */
|
|
1145
|
+
var inner_of = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (def) => SINGLE_INNER.includes(def.type) ? def.innerType : void 0, "inner_of");
|
|
1146
1146
|
function wrapped(schema) {
|
|
1147
1147
|
const def = def_of(schema);
|
|
1148
1148
|
if (!def) return [];
|
|
@@ -1151,10 +1151,10 @@ function wrapped(schema) {
|
|
|
1151
1151
|
const inner = inner_of(def);
|
|
1152
1152
|
return inner ? [inner] : [];
|
|
1153
1153
|
}
|
|
1154
|
-
|
|
1154
|
+
_chunkLA2BPKNScjs.__name.call(void 0, wrapped, "wrapped");
|
|
1155
1155
|
function some_layer(schema, test) {
|
|
1156
1156
|
const seen = /* @__PURE__ */ new Set();
|
|
1157
|
-
const visit = /* @__PURE__ */
|
|
1157
|
+
const visit = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (s) => {
|
|
1158
1158
|
if (seen.has(s)) return false;
|
|
1159
1159
|
seen.add(s);
|
|
1160
1160
|
const def = def_of(s);
|
|
@@ -1162,7 +1162,7 @@ function some_layer(schema, test) {
|
|
|
1162
1162
|
}, "visit");
|
|
1163
1163
|
return visit(schema);
|
|
1164
1164
|
}
|
|
1165
|
-
|
|
1165
|
+
_chunkLA2BPKNScjs.__name.call(void 0, some_layer, "some_layer");
|
|
1166
1166
|
function output_of(schema) {
|
|
1167
1167
|
const seen = /* @__PURE__ */ new Set();
|
|
1168
1168
|
let cur = schema;
|
|
@@ -1176,7 +1176,7 @@ function output_of(schema) {
|
|
|
1176
1176
|
}
|
|
1177
1177
|
return cur;
|
|
1178
1178
|
}
|
|
1179
|
-
|
|
1179
|
+
_chunkLA2BPKNScjs.__name.call(void 0, output_of, "output_of");
|
|
1180
1180
|
|
|
1181
1181
|
// src/internal/date-reviver.ts
|
|
1182
1182
|
function variant_schema(schema, walk) {
|
|
@@ -1194,13 +1194,13 @@ function variant_schema(schema, walk) {
|
|
|
1194
1194
|
}
|
|
1195
1195
|
return { schema: _zod2.z.looseObject(next), dated };
|
|
1196
1196
|
}
|
|
1197
|
-
|
|
1197
|
+
_chunkLA2BPKNScjs.__name.call(void 0, variant_schema, "variant_schema");
|
|
1198
1198
|
function date_reviver_schema(schema) {
|
|
1199
1199
|
let recursive = false;
|
|
1200
|
-
const pass = /* @__PURE__ */
|
|
1200
|
+
const pass = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (tie) => {
|
|
1201
1201
|
const done = /* @__PURE__ */ new Map();
|
|
1202
1202
|
const active = /* @__PURE__ */ new Set();
|
|
1203
|
-
const walk = /* @__PURE__ */
|
|
1203
|
+
const walk = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (node) => {
|
|
1204
1204
|
if (done.has(node)) return done.get(node);
|
|
1205
1205
|
if (active.has(node)) {
|
|
1206
1206
|
recursive = true;
|
|
@@ -1217,11 +1217,11 @@ function date_reviver_schema(schema) {
|
|
|
1217
1217
|
const first = pass(false);
|
|
1218
1218
|
return first && recursive ? pass(true) : first;
|
|
1219
1219
|
}
|
|
1220
|
-
|
|
1220
|
+
_chunkLA2BPKNScjs.__name.call(void 0, date_reviver_schema, "date_reviver_schema");
|
|
1221
1221
|
function build(schema, walk) {
|
|
1222
1222
|
const def = def_of(schema);
|
|
1223
1223
|
if (!def) return void 0;
|
|
1224
|
-
const inner = /* @__PURE__ */
|
|
1224
|
+
const inner = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, () => walk(def.innerType), "inner");
|
|
1225
1225
|
switch (def.type) {
|
|
1226
1226
|
case "date":
|
|
1227
1227
|
return _zod2.z.coerce.date();
|
|
@@ -1268,42 +1268,42 @@ function build(schema, walk) {
|
|
|
1268
1268
|
return inner_of(def) ? inner() : void 0;
|
|
1269
1269
|
}
|
|
1270
1270
|
}
|
|
1271
|
-
|
|
1271
|
+
_chunkLA2BPKNScjs.__name.call(void 0, build, "build");
|
|
1272
1272
|
|
|
1273
1273
|
// src/internal/event-sourcing.ts
|
|
1274
|
-
var bare_patch = /* @__PURE__ */
|
|
1275
|
-
var value_at = /* @__PURE__ */
|
|
1274
|
+
var bare_patch = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (_me, state2, partial) => _actpatch.patch.call(void 0, state2, partial), "bare_patch");
|
|
1275
|
+
var value_at = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (value, path) => path.reduce(
|
|
1276
1276
|
(at, key) => _optionalChain([at, 'optionalAccess', _57 => _57[key]]),
|
|
1277
1277
|
value
|
|
1278
1278
|
), "value_at");
|
|
1279
|
-
var check_invariants = /* @__PURE__ */
|
|
1279
|
+
var check_invariants = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (target, state2, schema, pii_aware) => {
|
|
1280
1280
|
let result;
|
|
1281
1281
|
try {
|
|
1282
1282
|
result = schema.safeParse(state2);
|
|
1283
1283
|
} catch (error) {
|
|
1284
|
-
throw new (0,
|
|
1284
|
+
throw new (0, _chunkLA2BPKNScjs.ValidationError)(target, state2, error);
|
|
1285
1285
|
}
|
|
1286
1286
|
if (result.success) return;
|
|
1287
1287
|
const issues = pii_aware ? result.error.issues.filter((issue) => {
|
|
1288
1288
|
const value = value_at(state2, issue.path);
|
|
1289
|
-
return value !==
|
|
1289
|
+
return value !== _chunkLA2BPKNScjs.REDACTED && value !== _chunkLA2BPKNScjs.SHREDDED;
|
|
1290
1290
|
}) : result.error.issues;
|
|
1291
1291
|
if (issues.length)
|
|
1292
|
-
throw new (0,
|
|
1292
|
+
throw new (0, _chunkLA2BPKNScjs.ValidationError)(
|
|
1293
1293
|
target,
|
|
1294
1294
|
state2,
|
|
1295
1295
|
_zod2.prettifyError.call(void 0, new (0, _zod2.ZodError)(issues))
|
|
1296
1296
|
);
|
|
1297
1297
|
}, "check_invariants");
|
|
1298
1298
|
var DEFAULT_BATCH = 500;
|
|
1299
|
-
var cache_put = /* @__PURE__ */
|
|
1300
|
-
(err) =>
|
|
1299
|
+
var cache_put = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (stream, entry) => _chunk3WHD4VPPcjs.cache.call(void 0, ).set(stream, entry).catch(
|
|
1300
|
+
(err) => _chunk3WHD4VPPcjs.log.call(void 0, ).warn(
|
|
1301
1301
|
err,
|
|
1302
1302
|
"cache set skipped; the next load re-folds from the store"
|
|
1303
1303
|
)
|
|
1304
1304
|
), "cache_put");
|
|
1305
|
-
var cache_drop = /* @__PURE__ */
|
|
1306
|
-
(err) =>
|
|
1305
|
+
var cache_drop = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (stream) => _chunk3WHD4VPPcjs.cache.call(void 0, ).invalidate(stream).catch(
|
|
1306
|
+
(err) => _chunk3WHD4VPPcjs.log.call(void 0, ).warn(
|
|
1307
1307
|
err,
|
|
1308
1308
|
"cache invalidate skipped; a stale checkpoint re-folds from its event_id"
|
|
1309
1309
|
)
|
|
@@ -1311,11 +1311,11 @@ var cache_drop = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (stream)
|
|
|
1311
1311
|
async function snap(snapshot) {
|
|
1312
1312
|
const { id, stream, name, meta, version } = snapshot.event;
|
|
1313
1313
|
try {
|
|
1314
|
-
const [committed] = await
|
|
1314
|
+
const [committed] = await _chunk3WHD4VPPcjs.store.call(void 0, ).commit(
|
|
1315
1315
|
[
|
|
1316
1316
|
{
|
|
1317
1317
|
stream,
|
|
1318
|
-
msgs: [{ name:
|
|
1318
|
+
msgs: [{ name: _chunkLA2BPKNScjs.SNAP_EVENT, data: snapshot.state }],
|
|
1319
1319
|
// IMPORTANT! - state events are committed right after the snapshot event
|
|
1320
1320
|
expectedVersion: version
|
|
1321
1321
|
}
|
|
@@ -1328,19 +1328,19 @@ async function snap(snapshot) {
|
|
|
1328
1328
|
return committed;
|
|
1329
1329
|
} catch (error) {
|
|
1330
1330
|
const reason = error instanceof Error ? error.message : String(error);
|
|
1331
|
-
|
|
1331
|
+
_chunk3WHD4VPPcjs.log.call(void 0, ).warn(
|
|
1332
1332
|
`Snapshot write failed on stream "${stream}": ${reason} \u2014 cold starts will replay full history until snapshots succeed.`
|
|
1333
1333
|
);
|
|
1334
1334
|
}
|
|
1335
1335
|
}
|
|
1336
|
-
|
|
1336
|
+
_chunkLA2BPKNScjs.__name.call(void 0, snap, "snap");
|
|
1337
1337
|
async function tombstone(stream, expectedVersion, correlation) {
|
|
1338
1338
|
try {
|
|
1339
|
-
const [committed] = await
|
|
1339
|
+
const [committed] = await _chunk3WHD4VPPcjs.store.call(void 0, ).commit(
|
|
1340
1340
|
[
|
|
1341
1341
|
{
|
|
1342
1342
|
stream,
|
|
1343
|
-
msgs: [{ name:
|
|
1343
|
+
msgs: [{ name: _chunkLA2BPKNScjs.TOMBSTONE_EVENT, data: {} }],
|
|
1344
1344
|
expectedVersion
|
|
1345
1345
|
}
|
|
1346
1346
|
],
|
|
@@ -1348,18 +1348,18 @@ async function tombstone(stream, expectedVersion, correlation) {
|
|
|
1348
1348
|
);
|
|
1349
1349
|
return committed;
|
|
1350
1350
|
} catch (error) {
|
|
1351
|
-
if (error instanceof
|
|
1351
|
+
if (error instanceof _chunkLA2BPKNScjs.ConcurrencyError) return void 0;
|
|
1352
1352
|
throw error;
|
|
1353
1353
|
}
|
|
1354
1354
|
}
|
|
1355
|
-
|
|
1355
|
+
_chunkLA2BPKNScjs.__name.call(void 0, tombstone, "tombstone");
|
|
1356
1356
|
function is_valid(event) {
|
|
1357
1357
|
if (event.version < 0) return false;
|
|
1358
1358
|
if (!(event.created instanceof Date) || Number.isNaN(event.created.getTime()))
|
|
1359
1359
|
return false;
|
|
1360
1360
|
return true;
|
|
1361
1361
|
}
|
|
1362
|
-
|
|
1362
|
+
_chunkLA2BPKNScjs.__name.call(void 0, is_valid, "is_valid");
|
|
1363
1363
|
async function scan(source, opts = {}, callback) {
|
|
1364
1364
|
const {
|
|
1365
1365
|
drop_snapshots = false,
|
|
@@ -1387,9 +1387,9 @@ async function scan(source, opts = {}, callback) {
|
|
|
1387
1387
|
if (drop_closed_streams) {
|
|
1388
1388
|
await source.query(
|
|
1389
1389
|
(e) => {
|
|
1390
|
-
if (e.name ===
|
|
1390
|
+
if (e.name === _chunkLA2BPKNScjs.TOMBSTONE_EVENT) closed_streams.add(e.stream);
|
|
1391
1391
|
},
|
|
1392
|
-
{ names: [
|
|
1392
|
+
{ names: [_chunkLA2BPKNScjs.TOMBSTONE_EVENT] }
|
|
1393
1393
|
);
|
|
1394
1394
|
}
|
|
1395
1395
|
let max_id;
|
|
@@ -1414,11 +1414,11 @@ async function scan(source, opts = {}, callback) {
|
|
|
1414
1414
|
if (on_progress) on_progress({ processed, id: event.id, max_id });
|
|
1415
1415
|
const has_history = started.has(event.stream);
|
|
1416
1416
|
started.add(event.stream);
|
|
1417
|
-
if (drop_snapshots && event.name ===
|
|
1417
|
+
if (drop_snapshots && event.name === _chunkLA2BPKNScjs.SNAP_EVENT && has_history) {
|
|
1418
1418
|
dropped_snaps++;
|
|
1419
1419
|
return;
|
|
1420
1420
|
}
|
|
1421
|
-
if (closed_streams.has(event.stream) && event.name !==
|
|
1421
|
+
if (closed_streams.has(event.stream) && event.name !== _chunkLA2BPKNScjs.TOMBSTONE_EVENT) {
|
|
1422
1422
|
dropped_closed++;
|
|
1423
1423
|
return;
|
|
1424
1424
|
}
|
|
@@ -1491,23 +1491,23 @@ async function scan(source, opts = {}, callback) {
|
|
|
1491
1491
|
}
|
|
1492
1492
|
};
|
|
1493
1493
|
}
|
|
1494
|
-
|
|
1494
|
+
_chunkLA2BPKNScjs.__name.call(void 0, scan, "scan");
|
|
1495
1495
|
async function load(me, target, callback, patch_fn = bare_patch) {
|
|
1496
1496
|
const { stream, actor, asOf } = target;
|
|
1497
1497
|
const time_travel = !!asOf && Object.values(asOf).some((v) => v !== void 0);
|
|
1498
1498
|
const seeded = time_travel && asOf.limit === void 0 && !asOf.created_after;
|
|
1499
|
-
const cached = time_travel ? void 0 : await
|
|
1499
|
+
const cached = time_travel ? void 0 : await _chunk3WHD4VPPcjs.cache.call(void 0, ).get(stream);
|
|
1500
1500
|
const cache_hit = !!cached;
|
|
1501
1501
|
let state2 = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _66 => _66.state]), () => ( (me.init ? me.init() : {})));
|
|
1502
1502
|
let patches = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _67 => _67.patches]), () => ( 0));
|
|
1503
1503
|
let snaps = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _68 => _68.snaps]), () => ( 0));
|
|
1504
1504
|
let replayed = 0;
|
|
1505
1505
|
let event;
|
|
1506
|
-
await
|
|
1506
|
+
await _chunk3WHD4VPPcjs.store.call(void 0, ).query(
|
|
1507
1507
|
(raw) => {
|
|
1508
|
-
if (seeded && raw.name ===
|
|
1508
|
+
if (seeded && raw.name === _chunkLA2BPKNScjs.SNAP_EVENT && replayed > 0) return;
|
|
1509
1509
|
event = me.view(raw, actor);
|
|
1510
|
-
if (event.name ===
|
|
1510
|
+
if (event.name === _chunkLA2BPKNScjs.SNAP_EVENT) {
|
|
1511
1511
|
state2 = event.data;
|
|
1512
1512
|
snaps++;
|
|
1513
1513
|
patches = 0;
|
|
@@ -1516,8 +1516,8 @@ async function load(me, target, callback, patch_fn = bare_patch) {
|
|
|
1516
1516
|
state2 = patch_fn(me, state2, me.patch[event.name](event, state2), event);
|
|
1517
1517
|
patches++;
|
|
1518
1518
|
replayed++;
|
|
1519
|
-
} else if (event.name !==
|
|
1520
|
-
|
|
1519
|
+
} else if (event.name !== _chunkLA2BPKNScjs.TOMBSTONE_EVENT) {
|
|
1520
|
+
_chunk3WHD4VPPcjs.log.call(void 0, ).warn(
|
|
1521
1521
|
`Skipping unknown event "${String(event.name)}" on stream "${stream}" (id=${event.id}) \u2014 no reducer in state "${me.name}"`
|
|
1522
1522
|
);
|
|
1523
1523
|
}
|
|
@@ -1545,7 +1545,7 @@ async function load(me, target, callback, patch_fn = bare_patch) {
|
|
|
1545
1545
|
) : time_travel ? asOf : { with_snaps: true }
|
|
1546
1546
|
}
|
|
1547
1547
|
);
|
|
1548
|
-
const head_is_tombstone = _optionalChain([event, 'optionalAccess', _70 => _70.name]) ===
|
|
1548
|
+
const head_is_tombstone = _optionalChain([event, 'optionalAccess', _70 => _70.name]) === _chunkLA2BPKNScjs.TOMBSTONE_EVENT;
|
|
1549
1549
|
if (replayed > 0 && !time_travel && event && !me.pii_aware && !head_is_tombstone) {
|
|
1550
1550
|
await cache_put(stream, {
|
|
1551
1551
|
stream,
|
|
@@ -1568,7 +1568,7 @@ async function load(me, target, callback, patch_fn = bare_patch) {
|
|
|
1568
1568
|
replayed
|
|
1569
1569
|
};
|
|
1570
1570
|
}
|
|
1571
|
-
|
|
1571
|
+
_chunkLA2BPKNScjs.__name.call(void 0, load, "load");
|
|
1572
1572
|
async function load_others(loads, payload, own, actor, patch_fn, refuse) {
|
|
1573
1573
|
const streams = loads.map((l) => l.target(payload, own.state));
|
|
1574
1574
|
streams.forEach((stream, i) => {
|
|
@@ -1589,8 +1589,8 @@ async function load_others(loads, payload, own, actor, patch_fn, refuse) {
|
|
|
1589
1589
|
void 0,
|
|
1590
1590
|
patch_fn
|
|
1591
1591
|
);
|
|
1592
|
-
if (_optionalChain([snapshot, 'access', _75 => _75.event, 'optionalAccess', _76 => _76.name]) ===
|
|
1593
|
-
throw new (0,
|
|
1592
|
+
if (_optionalChain([snapshot, 'access', _75 => _75.event, 'optionalAccess', _76 => _76.name]) === _chunkLA2BPKNScjs.TOMBSTONE_EVENT)
|
|
1593
|
+
throw new (0, _chunkLA2BPKNScjs.StreamClosedError)(stream);
|
|
1594
1594
|
return {
|
|
1595
1595
|
state: l.state,
|
|
1596
1596
|
stream,
|
|
@@ -1601,13 +1601,13 @@ async function load_others(loads, payload, own, actor, patch_fn, refuse) {
|
|
|
1601
1601
|
})
|
|
1602
1602
|
);
|
|
1603
1603
|
}
|
|
1604
|
-
|
|
1604
|
+
_chunkLA2BPKNScjs.__name.call(void 0, load_others, "load_others");
|
|
1605
1605
|
async function action(me, action2, target, payload, options, patch_fn = bare_patch) {
|
|
1606
1606
|
const { stream, expectedVersion, actor } = target;
|
|
1607
1607
|
if (!stream) throw new Error("Missing target stream");
|
|
1608
1608
|
const reactingTo = _optionalChain([options, 'optionalAccess', _77 => _77.reactingTo]);
|
|
1609
1609
|
const correlator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _78 => _78.correlator]), () => ( default_correlator));
|
|
1610
|
-
const validated =
|
|
1610
|
+
const validated = _chunk3WHD4VPPcjs.validate.call(void 0, action2, payload, me.actions[action2]);
|
|
1611
1611
|
const opts = _optionalChain([me, 'access', _79 => _79.options, 'optionalAccess', _80 => _80[action2]]);
|
|
1612
1612
|
const max_retries = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _81 => _81.maxRetries]), () => ( 0));
|
|
1613
1613
|
const loads = _nullishCoalesce(_optionalChain([me, 'access', _82 => _82.loads, 'optionalAccess', _83 => _83[action2]]), () => ( []));
|
|
@@ -1619,8 +1619,8 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1619
1619
|
void 0,
|
|
1620
1620
|
patch_fn
|
|
1621
1621
|
);
|
|
1622
|
-
if (_optionalChain([snapshot, 'access', _84 => _84.event, 'optionalAccess', _85 => _85.name]) ===
|
|
1623
|
-
throw new (0,
|
|
1622
|
+
if (_optionalChain([snapshot, 'access', _84 => _84.event, 'optionalAccess', _85 => _85.name]) === _chunkLA2BPKNScjs.TOMBSTONE_EVENT)
|
|
1623
|
+
throw new (0, _chunkLA2BPKNScjs.StreamClosedError)(stream);
|
|
1624
1624
|
const own = {
|
|
1625
1625
|
state: me,
|
|
1626
1626
|
stream,
|
|
@@ -1634,7 +1634,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1634
1634
|
{ stream, state: snapshot.state },
|
|
1635
1635
|
target.actor,
|
|
1636
1636
|
patch_fn,
|
|
1637
|
-
(description) => new (0,
|
|
1637
|
+
(description) => new (0, _chunkLA2BPKNScjs.PreconditionError)(
|
|
1638
1638
|
action2,
|
|
1639
1639
|
validated,
|
|
1640
1640
|
target,
|
|
@@ -1647,7 +1647,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1647
1647
|
);
|
|
1648
1648
|
for (const { holds, description } of _nullishCoalesce(_optionalChain([me, 'access', _88 => _88.requires, 'optionalAccess', _89 => _89[action2]]), () => ( [])))
|
|
1649
1649
|
if (!holds(validated, snapshot.state, actor, loaded))
|
|
1650
|
-
throw new (0,
|
|
1650
|
+
throw new (0, _chunkLA2BPKNScjs.PreconditionError)(
|
|
1651
1651
|
action2,
|
|
1652
1652
|
validated,
|
|
1653
1653
|
target,
|
|
@@ -1669,7 +1669,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1669
1669
|
);
|
|
1670
1670
|
to.events.push({
|
|
1671
1671
|
name: event,
|
|
1672
|
-
data:
|
|
1672
|
+
data: _chunk3WHD4VPPcjs.validate.call(void 0, event, data, to.state.events[event])
|
|
1673
1673
|
});
|
|
1674
1674
|
}
|
|
1675
1675
|
if (!own.events.length)
|
|
@@ -1726,7 +1726,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1726
1726
|
});
|
|
1727
1727
|
let committed;
|
|
1728
1728
|
try {
|
|
1729
|
-
committed = await
|
|
1729
|
+
committed = await _chunk3WHD4VPPcjs.store.call(void 0, ).commit(
|
|
1730
1730
|
appends.map((p) => ({
|
|
1731
1731
|
stream: p.stream,
|
|
1732
1732
|
msgs: p.events.map((e) => p.state.message(e)),
|
|
@@ -1735,7 +1735,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1735
1735
|
meta
|
|
1736
1736
|
);
|
|
1737
1737
|
} catch (error) {
|
|
1738
|
-
if (error instanceof
|
|
1738
|
+
if (error instanceof _chunkLA2BPKNScjs.ConcurrencyError) void cache_drop(error.stream);
|
|
1739
1739
|
throw error;
|
|
1740
1740
|
}
|
|
1741
1741
|
let row = 0;
|
|
@@ -1777,20 +1777,20 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1777
1777
|
}
|
|
1778
1778
|
return snapshots;
|
|
1779
1779
|
} catch (error) {
|
|
1780
|
-
if (!(error instanceof
|
|
1780
|
+
if (!(error instanceof _chunkLA2BPKNScjs.ConcurrencyError)) throw error;
|
|
1781
1781
|
if (expectedVersion !== void 0 && error.stream === stream) throw error;
|
|
1782
1782
|
if (attempt >= max_retries) throw error;
|
|
1783
1783
|
if (_optionalChain([opts, 'optionalAccess', _98 => _98.backoff])) {
|
|
1784
1784
|
const delay_ms = compute_backoff_delay(attempt, opts.backoff);
|
|
1785
|
-
if (delay_ms > 0) await
|
|
1785
|
+
if (delay_ms > 0) await _chunk3WHD4VPPcjs.sleep.call(void 0, delay_ms);
|
|
1786
1786
|
}
|
|
1787
1787
|
}
|
|
1788
1788
|
}
|
|
1789
1789
|
}
|
|
1790
|
-
|
|
1790
|
+
_chunkLA2BPKNScjs.__name.call(void 0, action, "action");
|
|
1791
1791
|
|
|
1792
1792
|
// src/internal/tracing.ts
|
|
1793
|
-
var PRETTY =
|
|
1793
|
+
var PRETTY = _chunk3WHD4VPPcjs.config.call(void 0, ).env !== "production";
|
|
1794
1794
|
var C_BLUE = "\x1B[38;5;39m";
|
|
1795
1795
|
var C_ORANGE = "\x1B[38;5;208m";
|
|
1796
1796
|
var C_GREEN = "\x1B[38;5;42m";
|
|
@@ -1799,14 +1799,14 @@ var C_DRAIN = "\x1B[38;5;244m";
|
|
|
1799
1799
|
var C_HIT = "\x1B[38;5;82m";
|
|
1800
1800
|
var C_MISS = "\x1B[38;5;220m";
|
|
1801
1801
|
var C_RESET = "\x1B[0m";
|
|
1802
|
-
var es_caption = /* @__PURE__ */
|
|
1802
|
+
var es_caption = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (caption, color, body) => PRETTY ? `${color}${body}${C_RESET}` : `${caption}: ${body}`, "es_caption");
|
|
1803
1803
|
var C_LANE = "\x1B[38;5;183m";
|
|
1804
1804
|
var C_DIM = "\x1B[38;5;240m";
|
|
1805
1805
|
var C_ERR = "\x1B[38;5;196m";
|
|
1806
1806
|
var C_STREAM = "\x1B[38;5;226m";
|
|
1807
|
-
var dim = /* @__PURE__ */
|
|
1808
|
-
var hue = /* @__PURE__ */
|
|
1809
|
-
var drain_caption = /* @__PURE__ */
|
|
1807
|
+
var dim = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (text) => PRETTY ? `${C_DIM}${text}${C_RESET}` : text, "dim");
|
|
1808
|
+
var hue = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (color, text) => PRETTY ? `${color}${text}${C_RESET}` : text, "hue");
|
|
1809
|
+
var drain_caption = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (caption, lane) => {
|
|
1810
1810
|
const show_lane = lane && lane !== "default";
|
|
1811
1811
|
if (PRETTY) {
|
|
1812
1812
|
const tag = `${C_DRAIN}>> ${caption}${C_RESET}`;
|
|
@@ -1814,17 +1814,17 @@ var drain_caption = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (capti
|
|
|
1814
1814
|
}
|
|
1815
1815
|
return show_lane ? `>> ${caption} ${lane}` : `>> ${caption}`;
|
|
1816
1816
|
}, "drain_caption");
|
|
1817
|
-
var cache_marker = /* @__PURE__ */
|
|
1817
|
+
var cache_marker = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (hit) => {
|
|
1818
1818
|
const word = hit ? "hit" : "miss";
|
|
1819
1819
|
if (!PRETTY) return word;
|
|
1820
1820
|
return `${hit ? C_HIT : C_MISS}${word}${C_RESET}${C_GREEN}`;
|
|
1821
1821
|
}, "cache_marker");
|
|
1822
|
-
var stats_marker = /* @__PURE__ */
|
|
1822
|
+
var stats_marker = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (version, replayed, snaps, patches) => {
|
|
1823
1823
|
const text = `v=${version} replayed=${replayed} snaps=${snaps} patches=${patches}`;
|
|
1824
1824
|
if (!PRETTY) return text;
|
|
1825
1825
|
return `${C_DRAIN}${text}${C_RESET}${C_GREEN}`;
|
|
1826
1826
|
}, "stats_marker");
|
|
1827
|
-
var as_of_marker = /* @__PURE__ */
|
|
1827
|
+
var as_of_marker = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (asOf) => {
|
|
1828
1828
|
if (!asOf) return "";
|
|
1829
1829
|
const parts = [];
|
|
1830
1830
|
if (asOf.before !== void 0) parts.push(`before=${asOf.before}`);
|
|
@@ -1835,14 +1835,14 @@ var as_of_marker = /* @__PURE__ */ _chunkUEGKXCSQcjs.__name.call(void 0, (asOf)
|
|
|
1835
1835
|
if (asOf.limit !== void 0) parts.push(`limit=${asOf.limit}`);
|
|
1836
1836
|
return parts.length ? ` (as-of ${parts.join(" ")})` : " (as-of)";
|
|
1837
1837
|
}, "as_of_marker");
|
|
1838
|
-
var traced = /* @__PURE__ */
|
|
1838
|
+
var traced = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (inner, exit, entry) => (async (...args) => {
|
|
1839
1839
|
_optionalChain([entry, 'optionalCall', _99 => _99(...args)]);
|
|
1840
1840
|
const result = await inner(...args);
|
|
1841
1841
|
_optionalChain([exit, 'optionalCall', _100 => _100(result, ...args)]);
|
|
1842
1842
|
return result;
|
|
1843
1843
|
}), "traced");
|
|
1844
1844
|
function build_es(logger, correlator = default_correlator, patch_fn = bare_patch) {
|
|
1845
|
-
const bound_action = /* @__PURE__ */
|
|
1845
|
+
const bound_action = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (me, action_name, target, payload, options) => action(
|
|
1846
1846
|
me,
|
|
1847
1847
|
action_name,
|
|
1848
1848
|
target,
|
|
@@ -1850,7 +1850,7 @@ function build_es(logger, correlator = default_correlator, patch_fn = bare_patch
|
|
|
1850
1850
|
{ ...options, correlator: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _101 => _101.correlator]), () => ( correlator)) },
|
|
1851
1851
|
patch_fn
|
|
1852
1852
|
), "bound_action");
|
|
1853
|
-
const bound_load = /* @__PURE__ */
|
|
1853
|
+
const bound_load = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (me, target, callback) => load(me, target, callback, patch_fn), "bound_load");
|
|
1854
1854
|
if (logger.level !== "trace") {
|
|
1855
1855
|
return {
|
|
1856
1856
|
snap,
|
|
@@ -1912,7 +1912,7 @@ function build_es(logger, correlator = default_correlator, patch_fn = bare_patch
|
|
|
1912
1912
|
})
|
|
1913
1913
|
};
|
|
1914
1914
|
}
|
|
1915
|
-
|
|
1915
|
+
_chunkLA2BPKNScjs.__name.call(void 0, build_es, "build_es");
|
|
1916
1916
|
function build_drain(logger) {
|
|
1917
1917
|
return {
|
|
1918
1918
|
claim,
|
|
@@ -1932,7 +1932,7 @@ function build_drain(logger) {
|
|
|
1932
1932
|
})
|
|
1933
1933
|
};
|
|
1934
1934
|
}
|
|
1935
|
-
|
|
1935
|
+
_chunkLA2BPKNScjs.__name.call(void 0, build_drain, "build_drain");
|
|
1936
1936
|
function trace_cycle(logger, leased, fetched, handled, acked, blocked) {
|
|
1937
1937
|
if (logger.level !== "trace" || !leased.length) return;
|
|
1938
1938
|
const lane = _optionalChain([leased, 'access', _104 => _104[0], 'optionalAccess', _105 => _105.lane]);
|
|
@@ -1970,17 +1970,17 @@ function trace_cycle(logger, leased, fetched, handled, acked, blocked) {
|
|
|
1970
1970
|
}).join(", ");
|
|
1971
1971
|
logger.trace(`${drain_caption("drained", lane)} ${detail}`);
|
|
1972
1972
|
}
|
|
1973
|
-
|
|
1973
|
+
_chunkLA2BPKNScjs.__name.call(void 0, trace_cycle, "trace_cycle");
|
|
1974
1974
|
|
|
1975
1975
|
// src/internal/drain-cycle.ts
|
|
1976
1976
|
function budget_exhausted(lease, options, store_failing) {
|
|
1977
1977
|
if (store_failing || !_optionalChain([options, 'optionalAccess', _109 => _109.blockOnError]) || lease.retry <= options.maxRetries)
|
|
1978
1978
|
return void 0;
|
|
1979
1979
|
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.`;
|
|
1980
|
-
|
|
1980
|
+
_chunk3WHD4VPPcjs.log.call(void 0, ).error(error);
|
|
1981
1981
|
return { lease, handled: 0, acked_at: lease.at, error, block: true };
|
|
1982
1982
|
}
|
|
1983
|
-
|
|
1983
|
+
_chunkLA2BPKNScjs.__name.call(void 0, budget_exhausted, "budget_exhausted");
|
|
1984
1984
|
function fetch_failure_policy(registry) {
|
|
1985
1985
|
let blockOnError = true;
|
|
1986
1986
|
let maxRetries = 0;
|
|
@@ -1991,17 +1991,17 @@ function fetch_failure_policy(registry) {
|
|
|
1991
1991
|
}
|
|
1992
1992
|
return { blockOnError, maxRetries };
|
|
1993
1993
|
}
|
|
1994
|
-
|
|
1994
|
+
_chunkLA2BPKNScjs.__name.call(void 0, fetch_failure_policy, "fetch_failure_policy");
|
|
1995
1995
|
function finalize(lease, handled, at, error, options, logger, failed_at) {
|
|
1996
1996
|
if (!error) return { lease, handled, acked_at: at };
|
|
1997
1997
|
logger.error(error);
|
|
1998
|
-
const non_retryable = error instanceof
|
|
1998
|
+
const non_retryable = error instanceof _chunkLA2BPKNScjs.NonRetryableError;
|
|
1999
1999
|
const block2 = options.blockOnError && (non_retryable || lease.retry >= options.maxRetries);
|
|
2000
2000
|
if (block2)
|
|
2001
2001
|
logger.error(
|
|
2002
2002
|
non_retryable ? `Blocking ${lease.stream} on non-retryable error.` : `Blocking ${lease.stream} after ${lease.retry} retries.`
|
|
2003
2003
|
);
|
|
2004
|
-
const next_attempt_at = block2 ? void 0 : Date.now() + compute_backoff_delay(lease.retry, _nullishCoalesce(options.backoff, () => (
|
|
2004
|
+
const next_attempt_at = block2 ? void 0 : Date.now() + compute_backoff_delay(lease.retry, _nullishCoalesce(options.backoff, () => ( _chunk3WHD4VPPcjs.DEFAULT_BACKOFF)));
|
|
2005
2005
|
return {
|
|
2006
2006
|
lease,
|
|
2007
2007
|
handled,
|
|
@@ -2012,7 +2012,7 @@ function finalize(lease, handled, at, error, options, logger, failed_at) {
|
|
|
2012
2012
|
failed_at
|
|
2013
2013
|
};
|
|
2014
2014
|
}
|
|
2015
|
-
|
|
2015
|
+
_chunkLA2BPKNScjs.__name.call(void 0, finalize, "finalize");
|
|
2016
2016
|
function warn_misrouted(seen, stream, handler, event) {
|
|
2017
2017
|
report_once(
|
|
2018
2018
|
seen,
|
|
@@ -2020,7 +2020,7 @@ function warn_misrouted(seen, stream, handler, event) {
|
|
|
2020
2020
|
`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.`
|
|
2021
2021
|
);
|
|
2022
2022
|
}
|
|
2023
|
-
|
|
2023
|
+
_chunkLA2BPKNScjs.__name.call(void 0, warn_misrouted, "warn_misrouted");
|
|
2024
2024
|
async function run_drain_cycle(deps, cycle) {
|
|
2025
2025
|
const { ops, registry, batch_handlers, handle, handle_batch, lane } = deps;
|
|
2026
2026
|
const {
|
|
@@ -2131,13 +2131,13 @@ async function run_drain_cycle(deps, cycle) {
|
|
|
2131
2131
|
const acked = submitted.length ? await ops.ack(submitted) : [];
|
|
2132
2132
|
const expected = submitted.filter((l) => l.due === void 0).length;
|
|
2133
2133
|
if (acked.length < expected)
|
|
2134
|
-
|
|
2134
|
+
_chunk3WHD4VPPcjs.log.call(void 0, ).warn(
|
|
2135
2135
|
`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.`
|
|
2136
2136
|
);
|
|
2137
2137
|
const closeable = handled.filter((h) => h.close !== void 0).map((h) => h.close);
|
|
2138
2138
|
return { leased, fetched, handled, acked, blocked, closeable };
|
|
2139
2139
|
}
|
|
2140
|
-
|
|
2140
|
+
_chunkLA2BPKNScjs.__name.call(void 0, run_drain_cycle, "run_drain_cycle");
|
|
2141
2141
|
var EMPTY_DRAIN = {
|
|
2142
2142
|
fetched: [],
|
|
2143
2143
|
leased: [],
|
|
@@ -2152,11 +2152,11 @@ function merge_drains(drains) {
|
|
|
2152
2152
|
blocked: drains.flatMap((d) => d.blocked)
|
|
2153
2153
|
};
|
|
2154
2154
|
}
|
|
2155
|
-
|
|
2155
|
+
_chunkLA2BPKNScjs.__name.call(void 0, merge_drains, "merge_drains");
|
|
2156
2156
|
var RETRY = "";
|
|
2157
2157
|
var DrainController = (_class3 = class {
|
|
2158
2158
|
static {
|
|
2159
|
-
|
|
2159
|
+
_chunkLA2BPKNScjs.__name.call(void 0, this, "DrainController");
|
|
2160
2160
|
}
|
|
2161
2161
|
// Armed while `_raised` is ahead of `_lowered` (the raise count the last
|
|
2162
2162
|
// empty claim saw), so a claim never lowers over a raise that landed
|
|
@@ -2211,7 +2211,7 @@ var DrainController = (_class3 = class {
|
|
|
2211
2211
|
*/
|
|
2212
2212
|
start(cycleMs) {
|
|
2213
2213
|
const run = this._deps.run_scoped;
|
|
2214
|
-
const tick = /* @__PURE__ */
|
|
2214
|
+
const tick = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, async () => {
|
|
2215
2215
|
if (this.armed) await run(() => this.drain());
|
|
2216
2216
|
if (this._stopped) return;
|
|
2217
2217
|
this._worker = setTimeout(tick, cycleMs);
|
|
@@ -2232,9 +2232,9 @@ var DrainController = (_class3 = class {
|
|
|
2232
2232
|
if (!this.armed || this._stopped || this._inflight)
|
|
2233
2233
|
return EMPTY_DRAIN;
|
|
2234
2234
|
const d = _nullishCoalesce(this._deps.defaults, () => ( {}));
|
|
2235
|
-
const streamLimit = _nullishCoalesce(_nullishCoalesce(d.streamLimit, () => ( options.streamLimit)), () => (
|
|
2236
|
-
const eventLimit = _nullishCoalesce(options.eventLimit, () => (
|
|
2237
|
-
const leaseMillis = _nullishCoalesce(_nullishCoalesce(d.leaseMillis, () => ( options.leaseMillis)), () => (
|
|
2235
|
+
const streamLimit = _nullishCoalesce(_nullishCoalesce(d.streamLimit, () => ( options.streamLimit)), () => ( _chunk3WHD4VPPcjs.DEFAULT_STREAM_LIMIT));
|
|
2236
|
+
const eventLimit = _nullishCoalesce(options.eventLimit, () => ( _chunk3WHD4VPPcjs.DEFAULT_EVENT_LIMIT));
|
|
2237
|
+
const leaseMillis = _nullishCoalesce(_nullishCoalesce(d.leaseMillis, () => ( options.leaseMillis)), () => ( _chunk3WHD4VPPcjs.DEFAULT_LEASE_MILLIS));
|
|
2238
2238
|
if (this._deps.breaker.state(Date.now()) === "open")
|
|
2239
2239
|
return EMPTY_DRAIN;
|
|
2240
2240
|
const pass = this._pass(streamLimit, eventLimit, leaseMillis).finally(
|
|
@@ -2295,7 +2295,7 @@ var DrainController = (_class3 = class {
|
|
|
2295
2295
|
// src/internal/reaction-dispatch.ts
|
|
2296
2296
|
var CloseSignal = class extends Error {
|
|
2297
2297
|
static {
|
|
2298
|
-
|
|
2298
|
+
_chunkLA2BPKNScjs.__name.call(void 0, this, "CloseSignal");
|
|
2299
2299
|
}
|
|
2300
2300
|
/**
|
|
2301
2301
|
* Stream to close. Omitted → the reaction's own lease stream (a self-close).
|
|
@@ -2363,7 +2363,7 @@ function build_handle(deps) {
|
|
|
2363
2363
|
handled++;
|
|
2364
2364
|
}
|
|
2365
2365
|
} catch (error) {
|
|
2366
|
-
if (error instanceof
|
|
2366
|
+
if (error instanceof _chunkLA2BPKNScjs.DeferSignal) {
|
|
2367
2367
|
let defer;
|
|
2368
2368
|
try {
|
|
2369
2369
|
defer = resolve_defer_at(error.when, event);
|
|
@@ -2412,7 +2412,7 @@ function build_handle(deps) {
|
|
|
2412
2412
|
return finalize(lease, handled, at, void 0, payloads[0].options, logger);
|
|
2413
2413
|
};
|
|
2414
2414
|
}
|
|
2415
|
-
|
|
2415
|
+
_chunkLA2BPKNScjs.__name.call(void 0, build_handle, "build_handle");
|
|
2416
2416
|
function build_handle_batch(logger) {
|
|
2417
2417
|
return async (lease, payloads, batchHandler) => {
|
|
2418
2418
|
const stream = lease.stream;
|
|
@@ -2441,7 +2441,7 @@ function build_handle_batch(logger) {
|
|
|
2441
2441
|
}
|
|
2442
2442
|
};
|
|
2443
2443
|
}
|
|
2444
|
-
|
|
2444
|
+
_chunkLA2BPKNScjs.__name.call(void 0, build_handle_batch, "build_handle_batch");
|
|
2445
2445
|
|
|
2446
2446
|
// src/internal/autoclose-reaction.ts
|
|
2447
2447
|
var AUTOCLOSE_TARGET_PREFIX = "__autoclose__:";
|
|
@@ -2462,22 +2462,22 @@ function synthesize_autoclose_reactions(registry, states, read_window) {
|
|
|
2462
2462
|
// An anchored stream name would read as a pattern, and a store may refuse
|
|
2463
2463
|
// it at subscribe, stopping every reaction. Such a stream has no
|
|
2464
2464
|
// autoclose: `app.close` still closes it.
|
|
2465
|
-
resolver: /* @__PURE__ */
|
|
2465
|
+
resolver: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (e) => _chunkQITJ63HGcjs.isStreamName.call(void 0, e.stream) ? {
|
|
2466
2466
|
target: `${AUTOCLOSE_TARGET_PREFIX}${e.stream}`,
|
|
2467
2467
|
source: e.stream
|
|
2468
2468
|
} : void 0, "resolver"),
|
|
2469
2469
|
// Never block on autoclose: a transient query/store error should retry,
|
|
2470
2470
|
// not quarantine the synthetic stream.
|
|
2471
|
-
options: { blockOnError: false, maxRetries:
|
|
2472
|
-
handler: /* @__PURE__ */
|
|
2471
|
+
options: { blockOnError: false, maxRetries: _chunk3WHD4VPPcjs.DEFAULT_MAX_RETRIES },
|
|
2472
|
+
handler: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, async (event) => {
|
|
2473
2473
|
const aggregate = event.stream;
|
|
2474
2474
|
const window = read_window();
|
|
2475
2475
|
if (!in_autoclose_window(window, /* @__PURE__ */ new Date()))
|
|
2476
|
-
throw new (0,
|
|
2477
|
-
const stats = await
|
|
2476
|
+
throw new (0, _chunkLA2BPKNScjs.DeferSignal)({ at: next_window_open(window, /* @__PURE__ */ new Date()) });
|
|
2477
|
+
const stats = await _chunk3WHD4VPPcjs.store.call(void 0, ).query_stats([aggregate], {
|
|
2478
2478
|
count: true,
|
|
2479
2479
|
tail: keep_days !== void 0 ? true : void 0,
|
|
2480
|
-
exclude: [
|
|
2480
|
+
exclude: [_chunkLA2BPKNScjs.TOMBSTONE_EVENT, _chunkLA2BPKNScjs.SNAP_EVENT]
|
|
2481
2481
|
});
|
|
2482
2482
|
const entry = stats.get(aggregate);
|
|
2483
2483
|
if (!entry) return;
|
|
@@ -2515,7 +2515,7 @@ function synthesize_autoclose_reactions(registry, states, read_window) {
|
|
|
2515
2515
|
dues.push(days_after(entry.tail.created, keep_days));
|
|
2516
2516
|
const future = dues.map((d) => d.getTime()).filter((t) => t > Date.now());
|
|
2517
2517
|
if (future.length)
|
|
2518
|
-
throw new (0,
|
|
2518
|
+
throw new (0, _chunkLA2BPKNScjs.DeferSignal)({ at: new Date(Math.min(...future)) });
|
|
2519
2519
|
}, "handler")
|
|
2520
2520
|
};
|
|
2521
2521
|
const key = `__autoclose_${st.name}`;
|
|
@@ -2527,7 +2527,7 @@ function synthesize_autoclose_reactions(registry, states, read_window) {
|
|
|
2527
2527
|
}
|
|
2528
2528
|
}
|
|
2529
2529
|
}
|
|
2530
|
-
|
|
2530
|
+
_chunkLA2BPKNScjs.__name.call(void 0, synthesize_autoclose_reactions, "synthesize_autoclose_reactions");
|
|
2531
2531
|
|
|
2532
2532
|
// src/internal/close-cycle.ts
|
|
2533
2533
|
var CLOSE_CATCH_UP_LIMIT = 1e3;
|
|
@@ -2541,10 +2541,10 @@ async function catch_up_correlation(cursor, correlate, until) {
|
|
|
2541
2541
|
}
|
|
2542
2542
|
return cursor.checkpoint;
|
|
2543
2543
|
}
|
|
2544
|
-
|
|
2544
|
+
_chunkLA2BPKNScjs.__name.call(void 0, catch_up_correlation, "catch_up_correlation");
|
|
2545
2545
|
var CloseLock = (_class4 = class {constructor() { _class4.prototype.__init9.call(this); }
|
|
2546
2546
|
static {
|
|
2547
|
-
|
|
2547
|
+
_chunkLA2BPKNScjs.__name.call(void 0, this, "CloseLock");
|
|
2548
2548
|
}
|
|
2549
2549
|
__init9() {this._tails = /* @__PURE__ */ new Map()}
|
|
2550
2550
|
/** Run `work` after every earlier close of `stream` has settled. */
|
|
@@ -2552,7 +2552,7 @@ var CloseLock = (_class4 = class {constructor() { _class4.prototype.__init9.call
|
|
|
2552
2552
|
const prev = _nullishCoalesce(this._tails.get(stream), () => ( Promise.resolve()));
|
|
2553
2553
|
const next = prev.then(work, work);
|
|
2554
2554
|
this._tails.set(stream, next);
|
|
2555
|
-
const cleanup = /* @__PURE__ */
|
|
2555
|
+
const cleanup = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, () => {
|
|
2556
2556
|
if (this._tails.get(stream) === next) this._tails.delete(stream);
|
|
2557
2557
|
}, "cleanup");
|
|
2558
2558
|
next.then(cleanup, cleanup);
|
|
@@ -2580,12 +2580,12 @@ async function run_close_cycle(targets, deps) {
|
|
|
2580
2580
|
deps,
|
|
2581
2581
|
() => run_full_closes(full, target_map, deps, skipped)
|
|
2582
2582
|
);
|
|
2583
|
-
const retired = [...truncated.entries()].filter(([, r]) => r.committed.name ===
|
|
2583
|
+
const retired = [...truncated.entries()].filter(([, r]) => r.committed.name === _chunkLA2BPKNScjs.TOMBSTONE_EVENT).map(([stream]) => stream);
|
|
2584
2584
|
if (retired.length) _optionalChain([deps, 'access', _136 => _136.forget_subscribed, 'optionalCall', _137 => _137(retired)]);
|
|
2585
2585
|
for (const [stream, entry] of windowed_result) truncated.set(stream, entry);
|
|
2586
2586
|
return { truncated, skipped };
|
|
2587
2587
|
}
|
|
2588
|
-
|
|
2588
|
+
_chunkLA2BPKNScjs.__name.call(void 0, run_close_cycle, "run_close_cycle");
|
|
2589
2589
|
function with_stream_locks(streams, deps, work) {
|
|
2590
2590
|
const with_lock = _nullishCoalesce(deps.with_stream_lock, () => ( ((_stream, w) => w())));
|
|
2591
2591
|
return [...streams].sort().reduceRight(
|
|
@@ -2593,7 +2593,7 @@ function with_stream_locks(streams, deps, work) {
|
|
|
2593
2593
|
work
|
|
2594
2594
|
)();
|
|
2595
2595
|
}
|
|
2596
|
-
|
|
2596
|
+
_chunkLA2BPKNScjs.__name.call(void 0, with_stream_locks, "with_stream_locks");
|
|
2597
2597
|
async function run_full_closes(full, target_map, deps, skipped) {
|
|
2598
2598
|
const none = /* @__PURE__ */ new Map();
|
|
2599
2599
|
const streams = full.map((t) => t.stream);
|
|
@@ -2649,7 +2649,7 @@ async function run_full_closes(full, target_map, deps, skipped) {
|
|
|
2649
2649
|
deps.correlation
|
|
2650
2650
|
);
|
|
2651
2651
|
}
|
|
2652
|
-
|
|
2652
|
+
_chunkLA2BPKNScjs.__name.call(void 0, run_full_closes, "run_full_closes");
|
|
2653
2653
|
async function run_windowed_closes(windowed, deps, skipped) {
|
|
2654
2654
|
const checkpoint = deps.reactive ? await deps.catch_up_correlation(Number.MAX_SAFE_INTEGER) : -1;
|
|
2655
2655
|
const min_at = deps.reactive ? await probe_min_watermarks(
|
|
@@ -2665,7 +2665,7 @@ async function run_windowed_closes(windowed, deps, skipped) {
|
|
|
2665
2665
|
if (!await windowed_prune_pending(t.stream, t.before, max_id))
|
|
2666
2666
|
return void 0;
|
|
2667
2667
|
if (t.archive) await t.archive();
|
|
2668
|
-
const result = await
|
|
2668
|
+
const result = await _chunk3WHD4VPPcjs.store.call(void 0, ).truncate([
|
|
2669
2669
|
{ stream: t.stream, before: t.before, max_id }
|
|
2670
2670
|
]);
|
|
2671
2671
|
return result.get(t.stream);
|
|
@@ -2675,26 +2675,26 @@ async function run_windowed_closes(windowed, deps, skipped) {
|
|
|
2675
2675
|
}
|
|
2676
2676
|
return truncated;
|
|
2677
2677
|
}
|
|
2678
|
-
|
|
2678
|
+
_chunkLA2BPKNScjs.__name.call(void 0, run_windowed_closes, "run_windowed_closes");
|
|
2679
2679
|
async function windowed_prune_pending(stream, before, max_id) {
|
|
2680
2680
|
let boundary_id;
|
|
2681
2681
|
let min_id;
|
|
2682
|
-
await
|
|
2682
|
+
await _chunk3WHD4VPPcjs.store.call(void 0, ).query(
|
|
2683
2683
|
(event) => {
|
|
2684
2684
|
if (min_id === void 0 || event.id < min_id) min_id = event.id;
|
|
2685
|
-
if (event.name ===
|
|
2685
|
+
if (event.name === _chunkLA2BPKNScjs.SNAP_EVENT && event.created < before && (max_id === void 0 || event.id <= max_id) && (boundary_id === void 0 || event.id > boundary_id))
|
|
2686
2686
|
boundary_id = event.id;
|
|
2687
2687
|
},
|
|
2688
2688
|
{ stream, stream_exact: true, with_snaps: true, after: -1 }
|
|
2689
2689
|
);
|
|
2690
2690
|
return boundary_id !== void 0 && min_id < boundary_id;
|
|
2691
2691
|
}
|
|
2692
|
-
|
|
2692
|
+
_chunkLA2BPKNScjs.__name.call(void 0, windowed_prune_pending, "windowed_prune_pending");
|
|
2693
2693
|
async function probe_min_watermarks(streams, page_size, checkpoint) {
|
|
2694
2694
|
const min_at = /* @__PURE__ */ new Map();
|
|
2695
2695
|
const matches = source_matcher();
|
|
2696
2696
|
await walk_streams(
|
|
2697
|
-
|
|
2697
|
+
_chunk3WHD4VPPcjs.store.call(void 0, ),
|
|
2698
2698
|
(position) => {
|
|
2699
2699
|
const pending = position.correlated_at === void 0 || position.at < position.correlated_at;
|
|
2700
2700
|
const cap = pending ? position.at : Math.max(position.at, checkpoint);
|
|
@@ -2709,12 +2709,12 @@ async function probe_min_watermarks(streams, page_size, checkpoint) {
|
|
|
2709
2709
|
);
|
|
2710
2710
|
return min_at;
|
|
2711
2711
|
}
|
|
2712
|
-
|
|
2712
|
+
_chunkLA2BPKNScjs.__name.call(void 0, probe_min_watermarks, "probe_min_watermarks");
|
|
2713
2713
|
function source_matcher() {
|
|
2714
2714
|
const compiled = /* @__PURE__ */ new Map();
|
|
2715
2715
|
return (source, target, stream) => {
|
|
2716
2716
|
if (!source) return true;
|
|
2717
|
-
if (
|
|
2717
|
+
if (_chunkQITJ63HGcjs.isStreamName.call(void 0, source, target)) return source === stream;
|
|
2718
2718
|
let re = compiled.get(source);
|
|
2719
2719
|
if (!re) {
|
|
2720
2720
|
re = new RegExp(source);
|
|
@@ -2723,19 +2723,19 @@ function source_matcher() {
|
|
|
2723
2723
|
return re.test(stream);
|
|
2724
2724
|
};
|
|
2725
2725
|
}
|
|
2726
|
-
|
|
2726
|
+
_chunkLA2BPKNScjs.__name.call(void 0, source_matcher, "source_matcher");
|
|
2727
2727
|
async function scan_stream_heads(streams) {
|
|
2728
|
-
const stats = await
|
|
2729
|
-
exclude: [
|
|
2728
|
+
const stats = await _chunk3WHD4VPPcjs.store.call(void 0, ).query_stats(streams, {
|
|
2729
|
+
exclude: [_chunkLA2BPKNScjs.SNAP_EVENT]
|
|
2730
2730
|
});
|
|
2731
|
-
const domain_heads = await
|
|
2732
|
-
exclude: [
|
|
2731
|
+
const domain_heads = await _chunk3WHD4VPPcjs.store.call(void 0, ).query_stats(streams, {
|
|
2732
|
+
exclude: [_chunkLA2BPKNScjs.SNAP_EVENT, _chunkLA2BPKNScjs.TOMBSTONE_EVENT]
|
|
2733
2733
|
});
|
|
2734
|
-
const true_heads = await
|
|
2734
|
+
const true_heads = await _chunk3WHD4VPPcjs.store.call(void 0, ).query_stats(streams, {});
|
|
2735
2735
|
const out = /* @__PURE__ */ new Map();
|
|
2736
2736
|
for (const [stream, { head }] of domain_heads) {
|
|
2737
2737
|
const marker_head = _optionalChain([stats, 'access', _139 => _139.get, 'call', _140 => _140(stream), 'optionalAccess', _141 => _141.head]);
|
|
2738
|
-
const interrupted = _optionalChain([marker_head, 'optionalAccess', _142 => _142.name]) ===
|
|
2738
|
+
const interrupted = _optionalChain([marker_head, 'optionalAccess', _142 => _142.name]) === _chunkLA2BPKNScjs.TOMBSTONE_EVENT;
|
|
2739
2739
|
out.set(stream, {
|
|
2740
2740
|
max_id: head.id,
|
|
2741
2741
|
version: true_heads.get(stream).head.version,
|
|
@@ -2745,7 +2745,7 @@ async function scan_stream_heads(streams) {
|
|
|
2745
2745
|
}
|
|
2746
2746
|
return out;
|
|
2747
2747
|
}
|
|
2748
|
-
|
|
2748
|
+
_chunkLA2BPKNScjs.__name.call(void 0, scan_stream_heads, "scan_stream_heads");
|
|
2749
2749
|
async function partition_by_safety(stream_info, reactive, skipped, page_size, catch_up_correlation2) {
|
|
2750
2750
|
if (!reactive) return [...stream_info.keys()];
|
|
2751
2751
|
let needed = -1;
|
|
@@ -2759,7 +2759,7 @@ async function partition_by_safety(stream_info, reactive, skipped, page_size, ca
|
|
|
2759
2759
|
const pending_set = /* @__PURE__ */ new Set();
|
|
2760
2760
|
const matches = source_matcher();
|
|
2761
2761
|
await walk_streams(
|
|
2762
|
-
|
|
2762
|
+
_chunk3WHD4VPPcjs.store.call(void 0, ),
|
|
2763
2763
|
(position) => {
|
|
2764
2764
|
const has_work = position.correlated_at !== void 0 && position.at < position.correlated_at;
|
|
2765
2765
|
if (!has_work) return;
|
|
@@ -2779,7 +2779,7 @@ async function partition_by_safety(stream_info, reactive, skipped, page_size, ca
|
|
|
2779
2779
|
}
|
|
2780
2780
|
return safe;
|
|
2781
2781
|
}
|
|
2782
|
-
|
|
2782
|
+
_chunkLA2BPKNScjs.__name.call(void 0, partition_by_safety, "partition_by_safety");
|
|
2783
2783
|
async function guard_with_tombstones(safe, stream_info, correlation, tombstone2, skipped) {
|
|
2784
2784
|
const guarded = [];
|
|
2785
2785
|
const guard_events = /* @__PURE__ */ new Map();
|
|
@@ -2802,7 +2802,7 @@ async function guard_with_tombstones(safe, stream_info, correlation, tombstone2,
|
|
|
2802
2802
|
);
|
|
2803
2803
|
return { guarded, guard_events };
|
|
2804
2804
|
}
|
|
2805
|
-
|
|
2805
|
+
_chunkLA2BPKNScjs.__name.call(void 0, guard_with_tombstones, "guard_with_tombstones");
|
|
2806
2806
|
async function load_restart_seeds(guarded, target_map, stream_info, event_to_state, load2, logger) {
|
|
2807
2807
|
const seed_states = /* @__PURE__ */ new Map();
|
|
2808
2808
|
await Promise.all(
|
|
@@ -2821,16 +2821,16 @@ async function load_restart_seeds(guarded, target_map, stream_info, event_to_sta
|
|
|
2821
2821
|
);
|
|
2822
2822
|
return seed_states;
|
|
2823
2823
|
}
|
|
2824
|
-
|
|
2824
|
+
_chunkLA2BPKNScjs.__name.call(void 0, load_restart_seeds, "load_restart_seeds");
|
|
2825
2825
|
async function run_archive_callbacks(guarded, target_map) {
|
|
2826
2826
|
for (const stream of guarded) {
|
|
2827
2827
|
const archive_fn = _optionalChain([target_map, 'access', _146 => _146.get, 'call', _147 => _147(stream), 'optionalAccess', _148 => _148.archive]);
|
|
2828
2828
|
if (archive_fn) await archive_fn();
|
|
2829
2829
|
}
|
|
2830
2830
|
}
|
|
2831
|
-
|
|
2831
|
+
_chunkLA2BPKNScjs.__name.call(void 0, run_archive_callbacks, "run_archive_callbacks");
|
|
2832
2832
|
async function heads_still_guarded(guarded, guard_events, skipped) {
|
|
2833
|
-
const heads = await
|
|
2833
|
+
const heads = await _chunk3WHD4VPPcjs.store.call(void 0, ).query_stats(guarded, {});
|
|
2834
2834
|
return guarded.filter((stream) => {
|
|
2835
2835
|
if (_optionalChain([heads, 'access', _149 => _149.get, 'call', _150 => _150(stream), 'optionalAccess', _151 => _151.head, 'access', _152 => _152.id]) === guard_events.get(stream).id)
|
|
2836
2836
|
return true;
|
|
@@ -2838,7 +2838,7 @@ async function heads_still_guarded(guarded, guard_events, skipped) {
|
|
|
2838
2838
|
return false;
|
|
2839
2839
|
});
|
|
2840
2840
|
}
|
|
2841
|
-
|
|
2841
|
+
_chunkLA2BPKNScjs.__name.call(void 0, heads_still_guarded, "heads_still_guarded");
|
|
2842
2842
|
async function truncate_and_warm_cache(guarded, seed_states, guard_events, correlation) {
|
|
2843
2843
|
const trunc_targets = guarded.map((stream) => {
|
|
2844
2844
|
const snapshot = seed_states.get(stream);
|
|
@@ -2849,18 +2849,18 @@ async function truncate_and_warm_cache(guarded, seed_states, guard_events, corre
|
|
|
2849
2849
|
meta: {
|
|
2850
2850
|
correlation,
|
|
2851
2851
|
causation: {
|
|
2852
|
-
event: { id: guard.id, name:
|
|
2852
|
+
event: { id: guard.id, name: _chunkLA2BPKNScjs.TOMBSTONE_EVENT, stream: guard.stream }
|
|
2853
2853
|
}
|
|
2854
2854
|
}
|
|
2855
2855
|
};
|
|
2856
2856
|
});
|
|
2857
|
-
const truncated = await
|
|
2857
|
+
const truncated = await _chunk3WHD4VPPcjs.store.call(void 0, ).truncate(trunc_targets);
|
|
2858
2858
|
await Promise.all(
|
|
2859
2859
|
guarded.map(async (stream) => {
|
|
2860
2860
|
const entry = truncated.get(stream);
|
|
2861
2861
|
const state2 = seed_states.get(stream);
|
|
2862
2862
|
if (state2 && entry) {
|
|
2863
|
-
await
|
|
2863
|
+
await _chunk3WHD4VPPcjs.cache.call(void 0, ).set(stream, {
|
|
2864
2864
|
stream,
|
|
2865
2865
|
state: state2,
|
|
2866
2866
|
version: entry.committed.version,
|
|
@@ -2869,19 +2869,19 @@ async function truncate_and_warm_cache(guarded, seed_states, guard_events, corre
|
|
|
2869
2869
|
snaps: 1
|
|
2870
2870
|
});
|
|
2871
2871
|
} else {
|
|
2872
|
-
await
|
|
2872
|
+
await _chunk3WHD4VPPcjs.cache.call(void 0, ).invalidate(stream);
|
|
2873
2873
|
}
|
|
2874
2874
|
})
|
|
2875
2875
|
);
|
|
2876
2876
|
return truncated;
|
|
2877
2877
|
}
|
|
2878
|
-
|
|
2878
|
+
_chunkLA2BPKNScjs.__name.call(void 0, truncate_and_warm_cache, "truncate_and_warm_cache");
|
|
2879
2879
|
|
|
2880
2880
|
// src/internal/correlate-cycle.ts
|
|
2881
2881
|
|
|
2882
2882
|
var COLD_START_BACK_SCAN = 1e4;
|
|
2883
2883
|
var CORRELATION_LEASE_MS = 5e3;
|
|
2884
|
-
var registry_key = /* @__PURE__ */
|
|
2884
|
+
var registry_key = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (events) => {
|
|
2885
2885
|
const shape = Object.keys(events).filter((name) => events[name].reactions.size > 0).sort().map((name) => [name, [...events[name].reactions.keys()].sort()]);
|
|
2886
2886
|
return _crypto.createHash.call(void 0, "sha256").update(JSON.stringify(shape)).digest("hex").slice(0, 32);
|
|
2887
2887
|
}, "registry_key");
|
|
@@ -2893,7 +2893,7 @@ function report_undeclared_lane(seen, handler, target, lane, declared) {
|
|
|
2893
2893
|
`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.`
|
|
2894
2894
|
);
|
|
2895
2895
|
}
|
|
2896
|
-
|
|
2896
|
+
_chunkLA2BPKNScjs.__name.call(void 0, report_undeclared_lane, "report_undeclared_lane");
|
|
2897
2897
|
function report_bad_priority(seen, handler, target, priority) {
|
|
2898
2898
|
report_once(
|
|
2899
2899
|
seen,
|
|
@@ -2901,7 +2901,7 @@ function report_bad_priority(seen, handler, target, priority) {
|
|
|
2901
2901
|
`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.`
|
|
2902
2902
|
);
|
|
2903
2903
|
}
|
|
2904
|
-
|
|
2904
|
+
_chunkLA2BPKNScjs.__name.call(void 0, report_bad_priority, "report_bad_priority");
|
|
2905
2905
|
function report_lane_conflict(seen, handler, target, kept, dropped) {
|
|
2906
2906
|
report_once(
|
|
2907
2907
|
seen,
|
|
@@ -2909,10 +2909,10 @@ function report_lane_conflict(seen, handler, target, kept, dropped) {
|
|
|
2909
2909
|
`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.`
|
|
2910
2910
|
);
|
|
2911
2911
|
}
|
|
2912
|
-
|
|
2912
|
+
_chunkLA2BPKNScjs.__name.call(void 0, report_lane_conflict, "report_lane_conflict");
|
|
2913
2913
|
var CorrelateCycle = (_class5 = class {
|
|
2914
2914
|
static {
|
|
2915
|
-
|
|
2915
|
+
_chunkLA2BPKNScjs.__name.call(void 0, this, "CorrelateCycle");
|
|
2916
2916
|
}
|
|
2917
2917
|
__init10() {this._checkpoint = -1}
|
|
2918
2918
|
// Lease holder id; per instance, so a restart never inherits a stale claim.
|
|
@@ -2935,7 +2935,7 @@ var CorrelateCycle = (_class5 = class {
|
|
|
2935
2935
|
// never lets a resolution re-lane them.
|
|
2936
2936
|
|
|
2937
2937
|
__init18() {this._static_subscriptions = /* @__PURE__ */ new Map()}
|
|
2938
|
-
__init19() {this._patterns = new (0,
|
|
2938
|
+
__init19() {this._patterns = new (0, _chunk3WHD4VPPcjs.LruMap)(PATTERN_CACHE_SIZE)}
|
|
2939
2939
|
|
|
2940
2940
|
|
|
2941
2941
|
|
|
@@ -2953,7 +2953,7 @@ var CorrelateCycle = (_class5 = class {
|
|
|
2953
2953
|
on_init
|
|
2954
2954
|
}) {;_class5.prototype.__init10.call(this);_class5.prototype.__init11.call(this);_class5.prototype.__init12.call(this);_class5.prototype.__init13.call(this);_class5.prototype.__init14.call(this);_class5.prototype.__init15.call(this);_class5.prototype.__init16.call(this);_class5.prototype.__init17.call(this);_class5.prototype.__init18.call(this);_class5.prototype.__init19.call(this);_class5.prototype.__init20.call(this);
|
|
2955
2955
|
this._key = shard ? `${registry_key(registry.events)}:${[...shard].sort().join(",")}` : registry_key(registry.events);
|
|
2956
|
-
this._dynamic_subscriptions = new (0,
|
|
2956
|
+
this._dynamic_subscriptions = new (0, _chunk3WHD4VPPcjs.LruMap)(max_subscribed_streams);
|
|
2957
2957
|
this._registry = registry;
|
|
2958
2958
|
this._declared_lanes = declared_lanes;
|
|
2959
2959
|
this._static_targets = static_targets;
|
|
@@ -3011,7 +3011,7 @@ var CorrelateCycle = (_class5 = class {
|
|
|
3011
3011
|
// Would the target's own `fetch` (filtered by `source`) return this event?
|
|
3012
3012
|
_in_fetch_window(source, stream) {
|
|
3013
3013
|
if (source === void 0 || source === stream) return true;
|
|
3014
|
-
if (
|
|
3014
|
+
if (_chunkQITJ63HGcjs.isStreamName.call(void 0, source)) return false;
|
|
3015
3015
|
let pattern = this._patterns.get(source);
|
|
3016
3016
|
if (!pattern) {
|
|
3017
3017
|
pattern = new RegExp(source);
|
|
@@ -3033,7 +3033,7 @@ var CorrelateCycle = (_class5 = class {
|
|
|
3033
3033
|
async _scan(limit, lease) {
|
|
3034
3034
|
await this._init();
|
|
3035
3035
|
const epoch = this._epoch;
|
|
3036
|
-
const idle = /* @__PURE__ */
|
|
3036
|
+
const idle = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, () => ({
|
|
3037
3037
|
kind: "idle",
|
|
3038
3038
|
last_id: this._checkpoint
|
|
3039
3039
|
}), "idle");
|
|
@@ -3054,7 +3054,7 @@ var CorrelateCycle = (_class5 = class {
|
|
|
3054
3054
|
const correlated = /* @__PURE__ */ new Map();
|
|
3055
3055
|
let last_id = after;
|
|
3056
3056
|
let stopped = false;
|
|
3057
|
-
const found = await
|
|
3057
|
+
const found = await _chunk3WHD4VPPcjs.store.call(void 0, ).query(
|
|
3058
3058
|
(event) => {
|
|
3059
3059
|
if (stopped) return;
|
|
3060
3060
|
const register = this._registry.events[event.name];
|
|
@@ -3074,7 +3074,7 @@ var CorrelateCycle = (_class5 = class {
|
|
|
3074
3074
|
}
|
|
3075
3075
|
if (!resolved) continue;
|
|
3076
3076
|
try {
|
|
3077
|
-
|
|
3077
|
+
_chunk3WHD4VPPcjs.check.call(void 0, "target", resolved);
|
|
3078
3078
|
} catch (e2) {
|
|
3079
3079
|
report_bad_priority(
|
|
3080
3080
|
this._reported,
|
|
@@ -3110,9 +3110,9 @@ var CorrelateCycle = (_class5 = class {
|
|
|
3110
3110
|
correlated_at: void 0
|
|
3111
3111
|
};
|
|
3112
3112
|
const seen_in_scan = correlated.has(resolved.target);
|
|
3113
|
-
const held_lane = _nullishCoalesce((seen_in_scan ? entry.lane : _optionalChain([recorded, 'optionalAccess', _155 => _155.lane])), () => (
|
|
3113
|
+
const held_lane = _nullishCoalesce((seen_in_scan ? entry.lane : _optionalChain([recorded, 'optionalAccess', _155 => _155.lane])), () => ( _chunkLA2BPKNScjs.DEFAULT_LANE));
|
|
3114
3114
|
const held_priority = seen_in_scan ? entry.priority : _optionalChain([recorded, 'optionalAccess', _156 => _156.priority]);
|
|
3115
|
-
const resolved_lane = _nullishCoalesce(lane, () => (
|
|
3115
|
+
const resolved_lane = _nullishCoalesce(lane, () => ( _chunkLA2BPKNScjs.DEFAULT_LANE));
|
|
3116
3116
|
if (held_priority === priority && held_lane !== resolved_lane)
|
|
3117
3117
|
report_lane_conflict(
|
|
3118
3118
|
this._reported,
|
|
@@ -3186,7 +3186,7 @@ var CorrelateCycle = (_class5 = class {
|
|
|
3186
3186
|
await Promise.all(
|
|
3187
3187
|
missed.map(async ([stream, entry]) => {
|
|
3188
3188
|
let row;
|
|
3189
|
-
await
|
|
3189
|
+
await _chunk3WHD4VPPcjs.store.call(void 0, ).query_streams(
|
|
3190
3190
|
(position) => {
|
|
3191
3191
|
row = position;
|
|
3192
3192
|
},
|
|
@@ -3198,8 +3198,8 @@ var CorrelateCycle = (_class5 = class {
|
|
|
3198
3198
|
lane: row.lane
|
|
3199
3199
|
});
|
|
3200
3200
|
if (entry.priority > row.priority) return;
|
|
3201
|
-
const held_lane = _nullishCoalesce(row.lane, () => (
|
|
3202
|
-
const resolved_lane = _nullishCoalesce(entry.lane, () => (
|
|
3201
|
+
const held_lane = _nullishCoalesce(row.lane, () => ( _chunkLA2BPKNScjs.DEFAULT_LANE));
|
|
3202
|
+
const resolved_lane = _nullishCoalesce(entry.lane, () => ( _chunkLA2BPKNScjs.DEFAULT_LANE));
|
|
3203
3203
|
if (entry.priority === row.priority && held_lane !== resolved_lane)
|
|
3204
3204
|
report_lane_conflict(
|
|
3205
3205
|
this._reported,
|
|
@@ -3225,7 +3225,7 @@ var CorrelateCycle = (_class5 = class {
|
|
|
3225
3225
|
millis: 0
|
|
3226
3226
|
});
|
|
3227
3227
|
} catch (error) {
|
|
3228
|
-
|
|
3228
|
+
_chunk3WHD4VPPcjs.log.call(void 0, ).warn(
|
|
3229
3229
|
`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)))}`
|
|
3230
3230
|
);
|
|
3231
3231
|
}
|
|
@@ -3244,13 +3244,13 @@ function pii_split(emitted, fields) {
|
|
|
3244
3244
|
}
|
|
3245
3245
|
return { name: emitted.name, data, pii };
|
|
3246
3246
|
}
|
|
3247
|
-
|
|
3247
|
+
_chunkLA2BPKNScjs.__name.call(void 0, pii_split, "pii_split");
|
|
3248
3248
|
function pii_gate(event, fields, predicate, actor) {
|
|
3249
3249
|
const data = event.data;
|
|
3250
3250
|
const { pii, ...rest } = event;
|
|
3251
3251
|
if (pii == null) {
|
|
3252
3252
|
const shredded = { ...data };
|
|
3253
|
-
for (const f of fields) shredded[f] =
|
|
3253
|
+
for (const f of fields) shredded[f] = _chunkLA2BPKNScjs.SHREDDED;
|
|
3254
3254
|
return { ...rest, data: shredded };
|
|
3255
3255
|
}
|
|
3256
3256
|
const allowed = !!actor && !!predicate && predicate(event, actor);
|
|
@@ -3261,15 +3261,15 @@ function pii_gate(event, fields, predicate, actor) {
|
|
|
3261
3261
|
};
|
|
3262
3262
|
}
|
|
3263
3263
|
const redacted = { ...data };
|
|
3264
|
-
for (const f of fields) redacted[f] =
|
|
3264
|
+
for (const f of fields) redacted[f] = _chunkLA2BPKNScjs.REDACTED;
|
|
3265
3265
|
return { ...rest, data: redacted };
|
|
3266
3266
|
}
|
|
3267
|
-
|
|
3268
|
-
var IDENTITY_GATE = /* @__PURE__ */
|
|
3267
|
+
_chunkLA2BPKNScjs.__name.call(void 0, pii_gate, "pii_gate");
|
|
3268
|
+
var IDENTITY_GATE = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (event) => event, "IDENTITY_GATE");
|
|
3269
3269
|
function make_gate(fields, predicate) {
|
|
3270
3270
|
return (event, actor) => pii_gate(event, fields, predicate, actor);
|
|
3271
3271
|
}
|
|
3272
|
-
|
|
3272
|
+
_chunkLA2BPKNScjs.__name.call(void 0, make_gate, "make_gate");
|
|
3273
3273
|
function pii_strip(event, fields) {
|
|
3274
3274
|
const data = event.data;
|
|
3275
3275
|
const stripped = {};
|
|
@@ -3282,22 +3282,22 @@ function pii_strip(event, fields) {
|
|
|
3282
3282
|
data: stripped
|
|
3283
3283
|
};
|
|
3284
3284
|
}
|
|
3285
|
-
|
|
3285
|
+
_chunkLA2BPKNScjs.__name.call(void 0, pii_strip, "pii_strip");
|
|
3286
3286
|
|
|
3287
3287
|
// src/internal/projection-fold.ts
|
|
3288
3288
|
var FOLD_RESET = /* @__PURE__ */ Symbol("act.fold.reset");
|
|
3289
3289
|
function make_fold_handler(me, flush, config2, sensitive_fields) {
|
|
3290
3290
|
const load_me = {
|
|
3291
3291
|
...me,
|
|
3292
|
-
view: /* @__PURE__ */
|
|
3292
|
+
view: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (raw, actor) => {
|
|
3293
3293
|
const viewed = me.view(raw, actor);
|
|
3294
3294
|
const fields = sensitive_fields(viewed.name);
|
|
3295
3295
|
return fields.length ? pii_strip(viewed, fields) : viewed;
|
|
3296
3296
|
}, "view")
|
|
3297
3297
|
};
|
|
3298
3298
|
const cache2 = /* @__PURE__ */ new Map();
|
|
3299
|
-
const row = /* @__PURE__ */
|
|
3300
|
-
const flush_dirty = /* @__PURE__ */
|
|
3299
|
+
const row = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, ({ dirty: _, ...row2 }) => row2, "row");
|
|
3300
|
+
const flush_dirty = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, async () => {
|
|
3301
3301
|
const rows = [];
|
|
3302
3302
|
const flushed = [];
|
|
3303
3303
|
for (const f of cache2.values())
|
|
@@ -3309,7 +3309,7 @@ function make_fold_handler(me, flush, config2, sensitive_fields) {
|
|
|
3309
3309
|
await flush(rows);
|
|
3310
3310
|
for (const f of flushed) f.dirty = false;
|
|
3311
3311
|
}, "flush_dirty");
|
|
3312
|
-
const first_sight = /* @__PURE__ */
|
|
3312
|
+
const first_sight = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, async (stream) => {
|
|
3313
3313
|
if (cache2.size >= config2.maxCachedStates) {
|
|
3314
3314
|
const oldest = cache2.keys().next().value;
|
|
3315
3315
|
const evictee = cache2.get(oldest);
|
|
@@ -3329,7 +3329,7 @@ function make_fold_handler(me, flush, config2, sensitive_fields) {
|
|
|
3329
3329
|
cache2.set(stream, seated);
|
|
3330
3330
|
return seated;
|
|
3331
3331
|
}, "first_sight");
|
|
3332
|
-
const handler = /* @__PURE__ */
|
|
3332
|
+
const handler = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, async (events) => {
|
|
3333
3333
|
let folded_since_flush = 0;
|
|
3334
3334
|
for (const event of events) {
|
|
3335
3335
|
const stream = event.stream;
|
|
@@ -3367,15 +3367,15 @@ function make_fold_handler(me, flush, config2, sensitive_fields) {
|
|
|
3367
3367
|
}
|
|
3368
3368
|
await flush_dirty();
|
|
3369
3369
|
}, "handler");
|
|
3370
|
-
Object.defineProperty(handler, FOLD_RESET, { value: /* @__PURE__ */
|
|
3370
|
+
Object.defineProperty(handler, FOLD_RESET, { value: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, () => cache2.clear(), "value") });
|
|
3371
3371
|
return handler;
|
|
3372
3372
|
}
|
|
3373
|
-
|
|
3373
|
+
_chunkLA2BPKNScjs.__name.call(void 0, make_fold_handler, "make_fold_handler");
|
|
3374
3374
|
|
|
3375
3375
|
// src/internal/settle.ts
|
|
3376
3376
|
var SettleLoop = (_class6 = class {
|
|
3377
3377
|
static {
|
|
3378
|
-
|
|
3378
|
+
_chunkLA2BPKNScjs.__name.call(void 0, this, "SettleLoop");
|
|
3379
3379
|
}
|
|
3380
3380
|
__init21() {this._timer = void 0}
|
|
3381
3381
|
// The cycle in flight, set while one runs. Shutdown waits for it
|
|
@@ -3478,7 +3478,7 @@ var SettleLoop = (_class6 = class {
|
|
|
3478
3478
|
// src/act.ts
|
|
3479
3479
|
var Act = (_class7 = class {
|
|
3480
3480
|
static {
|
|
3481
|
-
|
|
3481
|
+
_chunkLA2BPKNScjs.__name.call(void 0, this, "Act");
|
|
3482
3482
|
}
|
|
3483
3483
|
__init26() {this._emitter = new (0, _events2.default)()}
|
|
3484
3484
|
|
|
@@ -3566,7 +3566,7 @@ var Act = (_class7 = class {
|
|
|
3566
3566
|
// Lanes to arm per event; `"all"` when a dynamic resolver hides the lane.
|
|
3567
3567
|
|
|
3568
3568
|
|
|
3569
|
-
__init27() {this._logger =
|
|
3569
|
+
__init27() {this._logger = _chunk3WHD4VPPcjs.log.call(void 0, )}
|
|
3570
3570
|
// This Act's ports: its own bag, or the singleton adapters.
|
|
3571
3571
|
|
|
3572
3572
|
// Runs a body so internal `store()`/`cache()` calls resolve to `_ports`.
|
|
@@ -3595,11 +3595,11 @@ var Act = (_class7 = class {
|
|
|
3595
3595
|
throw new Error(
|
|
3596
3596
|
`ActOptions.onlyLanes references undeclared lane(s): ${undeclared.map((l) => `"${l}"`).join(", ")}`
|
|
3597
3597
|
);
|
|
3598
|
-
|
|
3599
|
-
if (options.scoped)
|
|
3600
|
-
this._ports = _nullishCoalesce(options.scoped, () => (
|
|
3598
|
+
_chunk3WHD4VPPcjs.check.call(void 0, "act", options);
|
|
3599
|
+
if (options.scoped) _chunk3WHD4VPPcjs.check.call(void 0, "store", options.scoped.store);
|
|
3600
|
+
this._ports = _nullishCoalesce(options.scoped, () => ( _chunk3WHD4VPPcjs.unscoped_ports.call(void 0, )));
|
|
3601
3601
|
const ports = this._ports;
|
|
3602
|
-
this._scoped =
|
|
3602
|
+
this._scoped = _chunk3WHD4VPPcjs.make_run_scoped.call(void 0, {
|
|
3603
3603
|
// Getters, not a spread: the singletons resolve lazily, so a later
|
|
3604
3604
|
// `store(...)` / `cache(...)` still takes effect.
|
|
3605
3605
|
get store() {
|
|
@@ -3609,14 +3609,14 @@ var Act = (_class7 = class {
|
|
|
3609
3609
|
return ports.cache;
|
|
3610
3610
|
},
|
|
3611
3611
|
// Parsed per build, so a bad window throws on every build.
|
|
3612
|
-
autoclose_window:
|
|
3612
|
+
autoclose_window: _chunk3WHD4VPPcjs.check.call(void 0, "autoclose", options).autocloseWindow
|
|
3613
3613
|
});
|
|
3614
3614
|
this._correlator = _nullishCoalesce(options.correlator, () => ( default_correlator));
|
|
3615
3615
|
this._es = build_es(this._logger, this._correlator, patch_fn);
|
|
3616
3616
|
this._cd = build_drain(this._logger);
|
|
3617
3617
|
const handle = build_handle({
|
|
3618
3618
|
logger: this._logger,
|
|
3619
|
-
reaction_scope:
|
|
3619
|
+
reaction_scope: _chunk3WHD4VPPcjs.make_reaction_scope.call(void 0, {
|
|
3620
3620
|
do: this.do.bind(this),
|
|
3621
3621
|
load: this.load.bind(this),
|
|
3622
3622
|
query: this.query.bind(this),
|
|
@@ -3646,17 +3646,17 @@ var Act = (_class7 = class {
|
|
|
3646
3646
|
this._ports.store,
|
|
3647
3647
|
options.listen !== false
|
|
3648
3648
|
);
|
|
3649
|
-
|
|
3649
|
+
_chunk3WHD4VPPcjs.register_weak_disposer.call(void 0, new WeakRef(this), (self) => self.shutdown());
|
|
3650
3650
|
}
|
|
3651
3651
|
// Shared by drain, settle and autoclose; bad knobs throw at build.
|
|
3652
3652
|
_build_breaker(options) {
|
|
3653
3653
|
return new CircuitBreaker(
|
|
3654
|
-
|
|
3654
|
+
_chunk3WHD4VPPcjs.check.call(void 0, "circuit_breaker", _nullishCoalesce(options.circuitBreaker, () => ( {}))),
|
|
3655
3655
|
{
|
|
3656
|
-
on_error: /* @__PURE__ */
|
|
3656
|
+
on_error: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (error, circuit) => this._emit_error(error, circuit), "on_error"),
|
|
3657
3657
|
// When the cooldown elapses, settle once: its scan or claim is the
|
|
3658
3658
|
// half-open probe that closes or re-opens the breaker.
|
|
3659
|
-
on_retry: /* @__PURE__ */
|
|
3659
|
+
on_retry: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, () => this._schedule(), "on_retry")
|
|
3660
3660
|
}
|
|
3661
3661
|
);
|
|
3662
3662
|
}
|
|
@@ -3676,16 +3676,16 @@ var Act = (_class7 = class {
|
|
|
3676
3676
|
batch_handlers: this._batch_handlers,
|
|
3677
3677
|
handle,
|
|
3678
3678
|
handle_batch,
|
|
3679
|
-
on_acked: /* @__PURE__ */
|
|
3680
|
-
on_blocked: /* @__PURE__ */
|
|
3679
|
+
on_acked: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (acked) => this.emit("acked", acked), "on_acked"),
|
|
3680
|
+
on_blocked: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (blocked) => this.emit("blocked", blocked), "on_blocked"),
|
|
3681
3681
|
// Reaction-requested close: the same machinery as `app.close`.
|
|
3682
3682
|
// A store failure reaches the breaker; anything else (the archive
|
|
3683
3683
|
// callback is app code) is logged here, never counted.
|
|
3684
|
-
on_close: /* @__PURE__ */
|
|
3684
|
+
on_close: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, async (targets) => {
|
|
3685
3685
|
try {
|
|
3686
3686
|
await this._run_close(targets);
|
|
3687
3687
|
} catch (error) {
|
|
3688
|
-
if (error instanceof
|
|
3688
|
+
if (error instanceof _chunkLA2BPKNScjs.StoreError) throw error;
|
|
3689
3689
|
this._logger.error(
|
|
3690
3690
|
error,
|
|
3691
3691
|
`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.`
|
|
@@ -3719,7 +3719,7 @@ var Act = (_class7 = class {
|
|
|
3719
3719
|
// Audit deps, built after the controllers so the lane set is final.
|
|
3720
3720
|
_build_audit_deps() {
|
|
3721
3721
|
return {
|
|
3722
|
-
store:
|
|
3722
|
+
store: _chunk3WHD4VPPcjs.store,
|
|
3723
3723
|
event_to_state: this._event_to_state,
|
|
3724
3724
|
sensitive_fields: this.registry.sensitive_fields,
|
|
3725
3725
|
// Declared lanes, not this process's controllers: a lane another
|
|
@@ -3733,14 +3733,14 @@ var Act = (_class7 = class {
|
|
|
3733
3733
|
registry: this.registry,
|
|
3734
3734
|
static_targets: classification.static_targets,
|
|
3735
3735
|
cd: this._cd,
|
|
3736
|
-
max_subscribed_streams: _nullishCoalesce(options.maxSubscribedStreams, () => (
|
|
3736
|
+
max_subscribed_streams: _nullishCoalesce(options.maxSubscribedStreams, () => ( _chunkLA2BPKNScjs.DEFAULT_MAX_SUBSCRIBED_STREAMS)),
|
|
3737
3737
|
// Declared lanes (not active ones): a lane another process claims is
|
|
3738
3738
|
// still a valid destination.
|
|
3739
3739
|
declared_lanes: new Set(this._declared_lanes),
|
|
3740
3740
|
// Built after the controllers, so their keys are the active lanes.
|
|
3741
3741
|
shard: this._drain_controllers.size < this._declared_lanes.length ? [...this._drain_controllers.keys()] : void 0,
|
|
3742
3742
|
// Only reached on a draining app: writer-only ones never correlate.
|
|
3743
|
-
on_init: /* @__PURE__ */
|
|
3743
|
+
on_init: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, async () => {
|
|
3744
3744
|
this._arm_all();
|
|
3745
3745
|
await this._seed_persisted_defers();
|
|
3746
3746
|
}, "on_init")
|
|
@@ -3749,7 +3749,7 @@ var Act = (_class7 = class {
|
|
|
3749
3749
|
// Cold start: an idle deferred stream still fires on time after a restart.
|
|
3750
3750
|
async _seed_persisted_defers() {
|
|
3751
3751
|
const now = Date.now();
|
|
3752
|
-
await walk_streams(
|
|
3752
|
+
await walk_streams(_chunk3WHD4VPPcjs.store.call(void 0, ), (pos) => {
|
|
3753
3753
|
if (pos.deferred_at === void 0 || pos.deferred_at <= now) return;
|
|
3754
3754
|
const controller = this._drain_controllers.get(_nullishCoalesce(pos.lane, () => ( "default")));
|
|
3755
3755
|
_optionalChain([controller, 'optionalAccess', _164 => _164.seed_defer, 'call', _165 => _165(pos.stream, pos.deferred_at)]);
|
|
@@ -3758,14 +3758,14 @@ var Act = (_class7 = class {
|
|
|
3758
3758
|
_build_settle(options) {
|
|
3759
3759
|
return new SettleLoop(
|
|
3760
3760
|
{
|
|
3761
|
-
correlate: /* @__PURE__ */
|
|
3761
|
+
correlate: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (q) => this._correlate_pass(_nullishCoalesce(_nullishCoalesce(q.limit, () => ( this._poll_limit)), () => ( 100)), true), "correlate"),
|
|
3762
3762
|
// `settle()` validated the options, and `_schedule` skips writer-only
|
|
3763
3763
|
// instances, so the loop drains through the internal path.
|
|
3764
|
-
drain: /* @__PURE__ */
|
|
3765
|
-
on_settled: /* @__PURE__ */
|
|
3764
|
+
drain: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (o) => this._scoped(() => this._drain_all(o)), "drain"),
|
|
3765
|
+
on_settled: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (drain) => this.emit("settled", drain), "on_settled"),
|
|
3766
3766
|
breaker: this._breaker
|
|
3767
3767
|
},
|
|
3768
|
-
_nullishCoalesce(options.settleDebounceMs, () => (
|
|
3768
|
+
_nullishCoalesce(options.settleDebounceMs, () => ( _chunkLA2BPKNScjs.DEFAULT_SETTLE_DEBOUNCE_MS))
|
|
3769
3769
|
);
|
|
3770
3770
|
}
|
|
3771
3771
|
|
|
@@ -3785,7 +3785,7 @@ var Act = (_class7 = class {
|
|
|
3785
3785
|
*/
|
|
3786
3786
|
shutdown(options) {
|
|
3787
3787
|
if (!this._shutdown_promise) {
|
|
3788
|
-
|
|
3788
|
+
_chunk3WHD4VPPcjs.check.call(void 0, "shutdown", _nullishCoalesce(options, () => ( {})));
|
|
3789
3789
|
this._shutdown_promise = (async () => {
|
|
3790
3790
|
this.stop_correlations();
|
|
3791
3791
|
this._settle.stop(true);
|
|
@@ -3803,10 +3803,10 @@ var Act = (_class7 = class {
|
|
|
3803
3803
|
// The largest `leaseMillis` among lanes with a cycle in flight (the
|
|
3804
3804
|
// default for none or 0, and for a running settle), capped.
|
|
3805
3805
|
_derive_grace_ms(running, settling) {
|
|
3806
|
-
let max = settling ?
|
|
3806
|
+
let max = settling ? _chunk3WHD4VPPcjs.DEFAULT_LEASE_MILLIS : 0;
|
|
3807
3807
|
for (const c of running)
|
|
3808
|
-
max = Math.max(max, c.lease_millis ||
|
|
3809
|
-
return Math.min(max,
|
|
3808
|
+
max = Math.max(max, c.lease_millis || _chunk3WHD4VPPcjs.DEFAULT_LEASE_MILLIS);
|
|
3809
|
+
return Math.min(max, _chunk3WHD4VPPcjs.MAX_SHUTDOWN_GRACE_MS);
|
|
3810
3810
|
}
|
|
3811
3811
|
async _await_inflight(grace_ms) {
|
|
3812
3812
|
const running = [...this._drain_controllers.values()].filter(
|
|
@@ -3890,7 +3890,7 @@ var Act = (_class7 = class {
|
|
|
3890
3890
|
* @see {@link ValidationError}, {@link PreconditionError}, {@link ConcurrencyError}
|
|
3891
3891
|
*/
|
|
3892
3892
|
async do(action2, target, payload, options) {
|
|
3893
|
-
const reacting_to = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _167 => _167.reactingTo]), () => (
|
|
3893
|
+
const reacting_to = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _167 => _167.reactingTo]), () => ( _chunk3WHD4VPPcjs.current_reacting.call(void 0, )));
|
|
3894
3894
|
const do_options = reacting_to === _optionalChain([options, 'optionalAccess', _168 => _168.reactingTo]) ? options : { ...options, reactingTo: reacting_to };
|
|
3895
3895
|
return this._scoped(async () => {
|
|
3896
3896
|
const snapshots = await this._es.action(
|
|
@@ -3961,10 +3961,11 @@ var Act = (_class7 = class {
|
|
|
3961
3961
|
* @see {@link query_array} for loading events into memory
|
|
3962
3962
|
*/
|
|
3963
3963
|
async query(query, callback) {
|
|
3964
|
+
_chunk3WHD4VPPcjs.check.call(void 0, "page", query);
|
|
3964
3965
|
return this._scoped(async () => {
|
|
3965
3966
|
let first;
|
|
3966
3967
|
let last;
|
|
3967
|
-
const count = await
|
|
3968
|
+
const count = await _chunk3WHD4VPPcjs.store.call(void 0, ).query((e) => {
|
|
3968
3969
|
const gated = this.registry.query_gate(e.name)(e);
|
|
3969
3970
|
if (!first) first = gated;
|
|
3970
3971
|
last = gated;
|
|
@@ -4010,14 +4011,14 @@ var Act = (_class7 = class {
|
|
|
4010
4011
|
*/
|
|
4011
4012
|
async forget(stream) {
|
|
4012
4013
|
return this._scoped(async () => {
|
|
4013
|
-
const s =
|
|
4014
|
+
const s = _chunk3WHD4VPPcjs.store.call(void 0, );
|
|
4014
4015
|
if (!s.forget_pii) {
|
|
4015
4016
|
throw new Error(
|
|
4016
4017
|
`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).`
|
|
4017
4018
|
);
|
|
4018
4019
|
}
|
|
4019
4020
|
const eventCount = await s.forget_pii(stream);
|
|
4020
|
-
await
|
|
4021
|
+
await _chunk3WHD4VPPcjs.cache.call(void 0, ).invalidate(stream);
|
|
4021
4022
|
if (eventCount > 0) {
|
|
4022
4023
|
this.emit("forgotten", { stream, at: /* @__PURE__ */ new Date(), eventCount });
|
|
4023
4024
|
}
|
|
@@ -4051,7 +4052,7 @@ var Act = (_class7 = class {
|
|
|
4051
4052
|
* @see {@link correlate} for dynamic stream discovery
|
|
4052
4053
|
*/
|
|
4053
4054
|
async drain(options = {}) {
|
|
4054
|
-
|
|
4055
|
+
_chunk3WHD4VPPcjs.check.call(void 0, "drain", options);
|
|
4055
4056
|
if (!this._drain)
|
|
4056
4057
|
return { fetched: [], leased: [], acked: [], blocked: [] };
|
|
4057
4058
|
return this._scoped(() => this._drain_all(options));
|
|
@@ -4128,7 +4129,7 @@ var Act = (_class7 = class {
|
|
|
4128
4129
|
* @see {@link start_correlations} for automatic periodic correlation
|
|
4129
4130
|
*/
|
|
4130
4131
|
async correlate(query = {}) {
|
|
4131
|
-
|
|
4132
|
+
_chunk3WHD4VPPcjs.check.call(void 0, "page", query);
|
|
4132
4133
|
const pass = await this._correlate_pass(_nullishCoalesce(query.limit, () => ( 10)));
|
|
4133
4134
|
return {
|
|
4134
4135
|
subscribed: pass.kind === "scanned" ? pass.subscribed : 0,
|
|
@@ -4174,8 +4175,8 @@ var Act = (_class7 = class {
|
|
|
4174
4175
|
* @see {@link stop_correlations} to stop the poll
|
|
4175
4176
|
*/
|
|
4176
4177
|
start_correlations(query = {}, frequency = 1e4) {
|
|
4177
|
-
|
|
4178
|
-
|
|
4178
|
+
_chunk3WHD4VPPcjs.check.call(void 0, "page", query);
|
|
4179
|
+
_chunk3WHD4VPPcjs.check.call(void 0, "poll", { frequency });
|
|
4179
4180
|
if (this._poll) return false;
|
|
4180
4181
|
this._poll_limit = query.limit || void 0;
|
|
4181
4182
|
this._poll = setInterval(() => {
|
|
@@ -4241,7 +4242,7 @@ var Act = (_class7 = class {
|
|
|
4241
4242
|
*/
|
|
4242
4243
|
async reset(input) {
|
|
4243
4244
|
return this._scoped(async () => {
|
|
4244
|
-
const count = await
|
|
4245
|
+
const count = await _chunk3WHD4VPPcjs.store.call(void 0, ).reset(input);
|
|
4245
4246
|
this._reset_folds();
|
|
4246
4247
|
if (count > 0) {
|
|
4247
4248
|
this._wake();
|
|
@@ -4276,7 +4277,7 @@ var Act = (_class7 = class {
|
|
|
4276
4277
|
*/
|
|
4277
4278
|
async unblock(input) {
|
|
4278
4279
|
return this._scoped(async () => {
|
|
4279
|
-
const count = await
|
|
4280
|
+
const count = await _chunk3WHD4VPPcjs.store.call(void 0, ).unblock(input);
|
|
4280
4281
|
if (count > 0) {
|
|
4281
4282
|
this._wake();
|
|
4282
4283
|
}
|
|
@@ -4324,7 +4325,7 @@ var Act = (_class7 = class {
|
|
|
4324
4325
|
* @see {@link Store.restore} for the underlying driver-pattern primitive.
|
|
4325
4326
|
*/
|
|
4326
4327
|
async restore(source, opts = {}, sink) {
|
|
4327
|
-
|
|
4328
|
+
_chunk3WHD4VPPcjs.check.call(void 0, "scan", opts);
|
|
4328
4329
|
return this._scoped(async () => {
|
|
4329
4330
|
const started = Date.now();
|
|
4330
4331
|
if (opts.dry_run) {
|
|
@@ -4332,14 +4333,14 @@ var Act = (_class7 = class {
|
|
|
4332
4333
|
return { ...partial, duration_ms: Date.now() - started };
|
|
4333
4334
|
}
|
|
4334
4335
|
const target = _nullishCoalesce(sink, () => ( (() => {
|
|
4335
|
-
const s =
|
|
4336
|
+
const s = _chunk3WHD4VPPcjs.store.call(void 0, );
|
|
4336
4337
|
if (!s.restore) throw new Error("adapter has no restore capability");
|
|
4337
4338
|
return s;
|
|
4338
4339
|
})()));
|
|
4339
4340
|
let kept = 0;
|
|
4340
4341
|
let migrated = 0;
|
|
4341
4342
|
let dropped = { closed_streams: 0, snapshots: 0 };
|
|
4342
|
-
const run = /* @__PURE__ */
|
|
4343
|
+
const run = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, () => target.restore(async (callback) => {
|
|
4343
4344
|
const partial = await scan(source, opts, callback);
|
|
4344
4345
|
kept = partial.kept;
|
|
4345
4346
|
migrated = partial.migrated;
|
|
@@ -4377,10 +4378,10 @@ var Act = (_class7 = class {
|
|
|
4377
4378
|
* ```
|
|
4378
4379
|
*/
|
|
4379
4380
|
async blocked_streams(options) {
|
|
4380
|
-
|
|
4381
|
+
_chunk3WHD4VPPcjs.check.call(void 0, "page", _nullishCoalesce(options, () => ( {})));
|
|
4381
4382
|
return this._scoped(async () => {
|
|
4382
4383
|
const positions = [];
|
|
4383
|
-
await
|
|
4384
|
+
await _chunk3WHD4VPPcjs.store.call(void 0, ).query_streams(
|
|
4384
4385
|
(p) => {
|
|
4385
4386
|
positions.push(p);
|
|
4386
4387
|
},
|
|
@@ -4406,7 +4407,7 @@ var Act = (_class7 = class {
|
|
|
4406
4407
|
* ```
|
|
4407
4408
|
*/
|
|
4408
4409
|
async *audit(categories, options) {
|
|
4409
|
-
|
|
4410
|
+
_chunk3WHD4VPPcjs.check.call(void 0, "audit", _nullishCoalesce(options, () => ( {})));
|
|
4410
4411
|
const it = audit(this._audit_deps, categories, options)[Symbol.asyncIterator]();
|
|
4411
4412
|
while (true) {
|
|
4412
4413
|
const { value, done } = await this._scoped(() => it.next());
|
|
@@ -4434,15 +4435,15 @@ var Act = (_class7 = class {
|
|
|
4434
4435
|
* @see {@link Store.prioritize} for the underlying primitive
|
|
4435
4436
|
*/
|
|
4436
4437
|
async prioritize(filter, priority) {
|
|
4437
|
-
|
|
4438
|
-
return this._scoped(() =>
|
|
4438
|
+
_chunk3WHD4VPPcjs.check.call(void 0, "target", { priority });
|
|
4439
|
+
return this._scoped(() => _chunk3WHD4VPPcjs.store.call(void 0, ).prioritize(filter, priority));
|
|
4439
4440
|
}
|
|
4440
4441
|
// Shared by `close()` and reaction-requested closes.
|
|
4441
4442
|
async _run_close(targets) {
|
|
4442
4443
|
const close_actor = { id: "$close", name: "close" };
|
|
4443
4444
|
const result = await run_close_cycle(targets, {
|
|
4444
4445
|
reactive: this._reactive,
|
|
4445
|
-
catch_up_correlation: /* @__PURE__ */
|
|
4446
|
+
catch_up_correlation: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (until) => catch_up_correlation(
|
|
4446
4447
|
this._correlate,
|
|
4447
4448
|
(limit) => this.correlate({ limit }),
|
|
4448
4449
|
until
|
|
@@ -4452,8 +4453,8 @@ var Act = (_class7 = class {
|
|
|
4452
4453
|
tombstone: this._es.tombstone,
|
|
4453
4454
|
logger: this._logger,
|
|
4454
4455
|
correlation: close_correlation(this._correlator, close_actor),
|
|
4455
|
-
with_stream_lock: /* @__PURE__ */
|
|
4456
|
-
forget_subscribed: /* @__PURE__ */
|
|
4456
|
+
with_stream_lock: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (stream, work) => this._close_lock.run(stream, work), "with_stream_lock"),
|
|
4457
|
+
forget_subscribed: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (streams) => this._correlate.forget_subscribed(streams), "forget_subscribed")
|
|
4457
4458
|
});
|
|
4458
4459
|
this.emit("closed", result);
|
|
4459
4460
|
return result;
|
|
@@ -4515,7 +4516,7 @@ var Act = (_class7 = class {
|
|
|
4515
4516
|
* @see {@link correlate} for manual correlation
|
|
4516
4517
|
*/
|
|
4517
4518
|
settle(options) {
|
|
4518
|
-
|
|
4519
|
+
_chunk3WHD4VPPcjs.check.call(void 0, "settle", _nullishCoalesce(options, () => ( {})));
|
|
4519
4520
|
this._schedule(options);
|
|
4520
4521
|
}
|
|
4521
4522
|
}, _class7);
|
|
@@ -4528,7 +4529,7 @@ function base_type_name(schema) {
|
|
|
4528
4529
|
def = def_of(inner);
|
|
4529
4530
|
return def.type === "array" ? `array of ${base_type_name(def.element)}` : def.type;
|
|
4530
4531
|
}
|
|
4531
|
-
|
|
4532
|
+
_chunkLA2BPKNScjs.__name.call(void 0, base_type_name, "base_type_name");
|
|
4532
4533
|
function merge_schemas(existing, incoming, state_name) {
|
|
4533
4534
|
if (existing === incoming) return existing;
|
|
4534
4535
|
const existing_object = as_object(existing, "existing", state_name);
|
|
@@ -4548,18 +4549,18 @@ function merge_schemas(existing, incoming, state_name) {
|
|
|
4548
4549
|
}
|
|
4549
4550
|
return existing_object.extend(incoming_shape);
|
|
4550
4551
|
}
|
|
4551
|
-
|
|
4552
|
+
_chunkLA2BPKNScjs.__name.call(void 0, merge_schemas, "merge_schemas");
|
|
4552
4553
|
function as_object(schema, side, state_name) {
|
|
4553
4554
|
if (schema instanceof _zod2.ZodObject) return schema;
|
|
4554
4555
|
throw new Error(
|
|
4555
4556
|
`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({ ... }).`
|
|
4556
4557
|
);
|
|
4557
4558
|
}
|
|
4558
|
-
|
|
4559
|
+
_chunkLA2BPKNScjs.__name.call(void 0, as_object, "as_object");
|
|
4559
4560
|
function merge_inits(existing, incoming) {
|
|
4560
4561
|
return () => ({ ...existing(), ...incoming() });
|
|
4561
4562
|
}
|
|
4562
|
-
|
|
4563
|
+
_chunkLA2BPKNScjs.__name.call(void 0, merge_inits, "merge_inits");
|
|
4563
4564
|
function register_state(state2, states, actions, events) {
|
|
4564
4565
|
const existing = states.get(state2.name);
|
|
4565
4566
|
if (existing) {
|
|
@@ -4568,8 +4569,8 @@ function register_state(state2, states, actions, events) {
|
|
|
4568
4569
|
register_new_state(state2, states, actions, events);
|
|
4569
4570
|
}
|
|
4570
4571
|
}
|
|
4571
|
-
|
|
4572
|
-
var shared_name = /* @__PURE__ */
|
|
4572
|
+
_chunkLA2BPKNScjs.__name.call(void 0, register_state, "register_state");
|
|
4573
|
+
var shared_name = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (name) => new Error(
|
|
4573
4574
|
`Action and event share the name "${name}" \u2014 action and event names must be unique across the application. Rename one of them.`
|
|
4574
4575
|
), "shared_name");
|
|
4575
4576
|
function register_new_state(state2, states, actions, events) {
|
|
@@ -4585,13 +4586,13 @@ function register_new_state(state2, states, actions, events) {
|
|
|
4585
4586
|
events[name] = { schema: state2.events[name], reactions: /* @__PURE__ */ new Map() };
|
|
4586
4587
|
}
|
|
4587
4588
|
}
|
|
4588
|
-
|
|
4589
|
+
_chunkLA2BPKNScjs.__name.call(void 0, register_new_state, "register_new_state");
|
|
4589
4590
|
function pick_declared(existing, incoming, what, state_name) {
|
|
4590
4591
|
if (existing && incoming && existing !== incoming)
|
|
4591
4592
|
throw new Error(`Duplicate ${what} for state "${state_name}"`);
|
|
4592
4593
|
return _nullishCoalesce(incoming, () => ( existing));
|
|
4593
4594
|
}
|
|
4594
|
-
|
|
4595
|
+
_chunkLA2BPKNScjs.__name.call(void 0, pick_declared, "pick_declared");
|
|
4595
4596
|
function autoclose_of(existing, state2) {
|
|
4596
4597
|
pick_declared(
|
|
4597
4598
|
existing.autoclose,
|
|
@@ -4607,7 +4608,7 @@ function autoclose_of(existing, state2) {
|
|
|
4607
4608
|
autoclose_keep_days: owner.autoclose_keep_days
|
|
4608
4609
|
};
|
|
4609
4610
|
}
|
|
4610
|
-
|
|
4611
|
+
_chunkLA2BPKNScjs.__name.call(void 0, autoclose_of, "autoclose_of");
|
|
4611
4612
|
function merge_into_existing(state2, existing, states, actions, events) {
|
|
4612
4613
|
for (const name of Object.keys(state2.actions)) {
|
|
4613
4614
|
if (existing.on[name] === state2.on[name]) continue;
|
|
@@ -4665,7 +4666,7 @@ function merge_into_existing(state2, existing, states, actions, events) {
|
|
|
4665
4666
|
events[name] = { schema: state2.events[name], reactions: /* @__PURE__ */ new Map() };
|
|
4666
4667
|
}
|
|
4667
4668
|
}
|
|
4668
|
-
|
|
4669
|
+
_chunkLA2BPKNScjs.__name.call(void 0, merge_into_existing, "merge_into_existing");
|
|
4669
4670
|
function merge_patches(existing, incoming, state_name) {
|
|
4670
4671
|
const merged = { ...existing };
|
|
4671
4672
|
for (const name of Object.keys(incoming)) {
|
|
@@ -4688,7 +4689,7 @@ function merge_patches(existing, incoming, state_name) {
|
|
|
4688
4689
|
}
|
|
4689
4690
|
return merged;
|
|
4690
4691
|
}
|
|
4691
|
-
|
|
4692
|
+
_chunkLA2BPKNScjs.__name.call(void 0, merge_patches, "merge_patches");
|
|
4692
4693
|
function merge_event_register(target, source) {
|
|
4693
4694
|
for (const [event_name, source_reg] of Object.entries(source)) {
|
|
4694
4695
|
const target_reg = target[event_name];
|
|
@@ -4703,7 +4704,7 @@ function merge_event_register(target, source) {
|
|
|
4703
4704
|
}
|
|
4704
4705
|
}
|
|
4705
4706
|
}
|
|
4706
|
-
|
|
4707
|
+
_chunkLA2BPKNScjs.__name.call(void 0, merge_event_register, "merge_event_register");
|
|
4707
4708
|
function merge_projection(proj, events) {
|
|
4708
4709
|
for (const event_name of Object.keys(proj.events)) {
|
|
4709
4710
|
const proj_register = proj.events[event_name];
|
|
@@ -4723,17 +4724,17 @@ function merge_projection(proj, events) {
|
|
|
4723
4724
|
}
|
|
4724
4725
|
}
|
|
4725
4726
|
}
|
|
4726
|
-
|
|
4727
|
-
var _this_ = /* @__PURE__ */
|
|
4727
|
+
_chunkLA2BPKNScjs.__name.call(void 0, merge_projection, "merge_projection");
|
|
4728
|
+
var _this_ = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, ({ stream }) => ({
|
|
4728
4729
|
source: stream,
|
|
4729
4730
|
target: stream
|
|
4730
4731
|
}), "_this_");
|
|
4731
4732
|
|
|
4732
4733
|
// src/builders/builder-utils.ts
|
|
4733
4734
|
function register_lane(config2, lanes) {
|
|
4734
|
-
|
|
4735
|
-
if (config2.name ===
|
|
4736
|
-
throw new Error(`Lane "${
|
|
4735
|
+
_chunk3WHD4VPPcjs.check.call(void 0, "lane", config2);
|
|
4736
|
+
if (config2.name === _chunkLA2BPKNScjs.DEFAULT_LANE)
|
|
4737
|
+
throw new Error(`Lane "${_chunkLA2BPKNScjs.DEFAULT_LANE}" is reserved`);
|
|
4737
4738
|
const existing = lanes.find((l) => l.name === config2.name);
|
|
4738
4739
|
if (!existing) return void lanes.push(config2);
|
|
4739
4740
|
if (existing.leaseMillis !== config2.leaseMillis || existing.streamLimit !== config2.streamLimit || existing.cycleMs !== config2.cycleMs)
|
|
@@ -4741,7 +4742,7 @@ function register_lane(config2, lanes) {
|
|
|
4741
4742
|
`Lane "${config2.name}" was already declared with a different config`
|
|
4742
4743
|
);
|
|
4743
4744
|
}
|
|
4744
|
-
|
|
4745
|
+
_chunkLA2BPKNScjs.__name.call(void 0, register_lane, "register_lane");
|
|
4745
4746
|
function add_reaction(events, event, name, kind, make, builder) {
|
|
4746
4747
|
if (!name)
|
|
4747
4748
|
throw new Error(
|
|
@@ -4756,31 +4757,31 @@ function add_reaction(events, event, name, kind, make, builder) {
|
|
|
4756
4757
|
events[event].reactions.set(name, reaction);
|
|
4757
4758
|
return Object.assign(builder, {
|
|
4758
4759
|
to(resolver) {
|
|
4759
|
-
if (typeof resolver === "object")
|
|
4760
|
+
if (typeof resolver === "object") _chunk3WHD4VPPcjs.check.call(void 0, "target", resolver);
|
|
4760
4761
|
reaction.resolver = typeof resolver === "string" ? { target: resolver } : resolver;
|
|
4761
4762
|
return builder;
|
|
4762
4763
|
}
|
|
4763
4764
|
});
|
|
4764
4765
|
}
|
|
4765
|
-
|
|
4766
|
+
_chunkLA2BPKNScjs.__name.call(void 0, add_reaction, "add_reaction");
|
|
4766
4767
|
function reaction_on(event, events, builder) {
|
|
4767
|
-
const register = /* @__PURE__ */
|
|
4768
|
+
const register = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (handler, options, schedule) => add_reaction(
|
|
4768
4769
|
events,
|
|
4769
4770
|
event,
|
|
4770
4771
|
handler.name,
|
|
4771
4772
|
"Reaction",
|
|
4772
4773
|
() => {
|
|
4773
4774
|
if (schedule && typeof schedule !== "function")
|
|
4774
|
-
|
|
4775
|
+
_chunk3WHD4VPPcjs.check.call(void 0, "defer", schedule);
|
|
4775
4776
|
return {
|
|
4776
4777
|
handler: schedule ? make_deferred(handler, schedule) : handler,
|
|
4777
4778
|
resolver: _this_,
|
|
4778
4779
|
// Validate the whole bag at the declaration site so a bad
|
|
4779
4780
|
// `maxRetries`/`backoff`/`blockOnError` throws ZodError at build,
|
|
4780
4781
|
// not a NaN gate on the first retry.
|
|
4781
|
-
options:
|
|
4782
|
-
blockOnError: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _179 => _179.blockOnError]), () => (
|
|
4783
|
-
maxRetries: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _180 => _180.maxRetries]), () => (
|
|
4782
|
+
options: _chunk3WHD4VPPcjs.check.call(void 0, "reaction", {
|
|
4783
|
+
blockOnError: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _179 => _179.blockOnError]), () => ( _chunk3WHD4VPPcjs.DEFAULT_BLOCK_ON_ERROR)),
|
|
4784
|
+
maxRetries: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _180 => _180.maxRetries]), () => ( _chunk3WHD4VPPcjs.DEFAULT_MAX_RETRIES)),
|
|
4784
4785
|
backoff: _optionalChain([options, 'optionalAccess', _181 => _181.backoff])
|
|
4785
4786
|
})
|
|
4786
4787
|
};
|
|
@@ -4788,20 +4789,20 @@ function reaction_on(event, events, builder) {
|
|
|
4788
4789
|
builder
|
|
4789
4790
|
), "register");
|
|
4790
4791
|
return {
|
|
4791
|
-
do: /* @__PURE__ */
|
|
4792
|
-
defer: /* @__PURE__ */
|
|
4793
|
-
do: /* @__PURE__ */
|
|
4792
|
+
do: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (handler, options) => register(handler, options), "do"),
|
|
4793
|
+
defer: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (schedule) => ({
|
|
4794
|
+
do: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (handler, options) => register(handler, options, schedule), "do")
|
|
4794
4795
|
}), "defer")
|
|
4795
4796
|
};
|
|
4796
4797
|
}
|
|
4797
|
-
|
|
4798
|
+
_chunkLA2BPKNScjs.__name.call(void 0, reaction_on, "reaction_on");
|
|
4798
4799
|
|
|
4799
4800
|
// src/builders/event-builder.ts
|
|
4800
4801
|
|
|
4801
4802
|
|
|
4802
4803
|
// src/internal/sensitive.ts
|
|
4803
4804
|
var SENSITIVE = /* @__PURE__ */ Symbol.for("act.sensitive");
|
|
4804
|
-
var is_pii = /* @__PURE__ */
|
|
4805
|
+
var is_pii = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (schema) => some_layer(schema, (def) => def[SENSITIVE] === true), "is_pii");
|
|
4805
4806
|
function pii_schemas(schema) {
|
|
4806
4807
|
const shape = schema.shape;
|
|
4807
4808
|
if (shape && typeof shape === "object") {
|
|
@@ -4822,7 +4823,7 @@ function pii_schemas(schema) {
|
|
|
4822
4823
|
}
|
|
4823
4824
|
return {};
|
|
4824
4825
|
}
|
|
4825
|
-
|
|
4826
|
+
_chunkLA2BPKNScjs.__name.call(void 0, pii_schemas, "pii_schemas");
|
|
4826
4827
|
|
|
4827
4828
|
// src/builders/event-builder.ts
|
|
4828
4829
|
function event_tags(schema) {
|
|
@@ -4833,7 +4834,7 @@ function event_tags(schema) {
|
|
|
4833
4834
|
if (dates) pii_dates[key] = dates.optional();
|
|
4834
4835
|
}
|
|
4835
4836
|
const data_reviver_schema = date_reviver_schema(schema);
|
|
4836
|
-
const revive = /* @__PURE__ */
|
|
4837
|
+
const revive = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (schema2) => (data) => {
|
|
4837
4838
|
const revived = schema2.safeParse(data);
|
|
4838
4839
|
return revived.success ? revived.data : data;
|
|
4839
4840
|
}, "revive");
|
|
@@ -4844,7 +4845,7 @@ function event_tags(schema) {
|
|
|
4844
4845
|
pii_date_reviver: dated_pii ? revive(_zod2.z.looseObject(pii_dates)) : void 0
|
|
4845
4846
|
};
|
|
4846
4847
|
}
|
|
4847
|
-
|
|
4848
|
+
_chunkLA2BPKNScjs.__name.call(void 0, event_tags, "event_tags");
|
|
4848
4849
|
function make_event_reader(tags, disclosure, predicate = null) {
|
|
4849
4850
|
const { date_reviver, pii_date_reviver } = tags;
|
|
4850
4851
|
const sensitive2 = Object.keys(tags.sensitive);
|
|
@@ -4864,9 +4865,9 @@ function make_event_reader(tags, disclosure, predicate = null) {
|
|
|
4864
4865
|
);
|
|
4865
4866
|
});
|
|
4866
4867
|
}
|
|
4867
|
-
|
|
4868
|
+
_chunkLA2BPKNScjs.__name.call(void 0, make_event_reader, "make_event_reader");
|
|
4868
4869
|
function build_events(registry, states, lanes, owners) {
|
|
4869
|
-
const declared = /* @__PURE__ */ new Set([
|
|
4870
|
+
const declared = /* @__PURE__ */ new Set([_chunkLA2BPKNScjs.DEFAULT_LANE, ...lanes.map((l) => l.name)]);
|
|
4870
4871
|
const lane_errors = [];
|
|
4871
4872
|
const tags = /* @__PURE__ */ new Map();
|
|
4872
4873
|
const sensitive2 = /* @__PURE__ */ new Map();
|
|
@@ -4899,7 +4900,7 @@ function build_events(registry, states, lanes, owners) {
|
|
|
4899
4900
|
handler_readers.set(event_name, handler_reader);
|
|
4900
4901
|
for (const [name, reaction] of def.reactions) {
|
|
4901
4902
|
const inner = reaction.handler;
|
|
4902
|
-
const wrapped2 = /* @__PURE__ */
|
|
4903
|
+
const wrapped2 = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (evt, stream, app) => inner(handler_reader(evt), stream, app), "wrapped");
|
|
4903
4904
|
Object.defineProperty(wrapped2, "name", { value: inner.name });
|
|
4904
4905
|
reaction.handler = wrapped2;
|
|
4905
4906
|
def.reactions.set(name, reaction);
|
|
@@ -4941,7 +4942,7 @@ function build_events(registry, states, lanes, owners) {
|
|
|
4941
4942
|
if (reader) readers.set(event_name, reader);
|
|
4942
4943
|
}
|
|
4943
4944
|
const snap2 = make_event_reader(event_tags(state2.state), "redact", null);
|
|
4944
|
-
if (snap2) readers.set(
|
|
4945
|
+
if (snap2) readers.set(_chunkLA2BPKNScjs.SNAP_EVENT, snap2);
|
|
4945
4946
|
if (readers.size === 0) continue;
|
|
4946
4947
|
state2.view = (event, actor) => (_nullishCoalesce(readers.get(event.name), () => ( IDENTITY_GATE)))(event, actor);
|
|
4947
4948
|
}
|
|
@@ -4952,12 +4953,12 @@ function build_events(registry, states, lanes, owners) {
|
|
|
4952
4953
|
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;
|
|
4953
4954
|
return { sensitive: sensitive2, advisory, query_readers, handler_readers };
|
|
4954
4955
|
}
|
|
4955
|
-
|
|
4956
|
+
_chunkLA2BPKNScjs.__name.call(void 0, build_events, "build_events");
|
|
4956
4957
|
function reads_as_string(schema) {
|
|
4957
4958
|
const type = _optionalChain([def_of, 'call', _182 => _182(output_of(schema)), 'optionalAccess', _183 => _183.type]);
|
|
4958
4959
|
return type === "string" || type === "transform";
|
|
4959
4960
|
}
|
|
4960
|
-
|
|
4961
|
+
_chunkLA2BPKNScjs.__name.call(void 0, reads_as_string, "reads_as_string");
|
|
4961
4962
|
|
|
4962
4963
|
// src/builders/act-builder.ts
|
|
4963
4964
|
function register_batch_handler(proj, batch_handlers) {
|
|
@@ -4970,7 +4971,7 @@ function register_batch_handler(proj, batch_handlers) {
|
|
|
4970
4971
|
}
|
|
4971
4972
|
batch_handlers.set(proj.target, proj.batchHandler);
|
|
4972
4973
|
}
|
|
4973
|
-
|
|
4974
|
+
_chunkLA2BPKNScjs.__name.call(void 0, register_batch_handler, "register_batch_handler");
|
|
4974
4975
|
function act() {
|
|
4975
4976
|
const states = /* @__PURE__ */ new Map();
|
|
4976
4977
|
const _sf = /* @__PURE__ */ new Map();
|
|
@@ -4984,16 +4985,16 @@ function act() {
|
|
|
4984
4985
|
const registry = {
|
|
4985
4986
|
actions: {},
|
|
4986
4987
|
events: {},
|
|
4987
|
-
sensitive_fields: /* @__PURE__ */
|
|
4988
|
-
query_gate: /* @__PURE__ */
|
|
4989
|
-
disclosure_predicate: /* @__PURE__ */
|
|
4990
|
-
deprecated_events: /* @__PURE__ */
|
|
4991
|
-
autoclose_policy: /* @__PURE__ */
|
|
4992
|
-
autoclose_archiver: /* @__PURE__ */
|
|
4988
|
+
sensitive_fields: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (name) => _nullishCoalesce(_sf.get(name), () => ( [])), "sensitive_fields"),
|
|
4989
|
+
query_gate: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (event_name) => _nullishCoalesce(_qg.get(event_name), () => ( IDENTITY_GATE)), "query_gate"),
|
|
4990
|
+
disclosure_predicate: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (state_name) => _nullishCoalesce(_dp.get(state_name), () => ( null)), "disclosure_predicate"),
|
|
4991
|
+
deprecated_events: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (state_name) => _nullishCoalesce(_de.get(state_name), () => ( EMPTY_DEPRECATED)), "deprecated_events"),
|
|
4992
|
+
autoclose_policy: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (state_name) => _nullishCoalesce(_ac.get(state_name), () => ( null)), "autoclose_policy"),
|
|
4993
|
+
autoclose_archiver: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (state_name) => _nullishCoalesce(_aa.get(state_name), () => ( null)), "autoclose_archiver")
|
|
4993
4994
|
};
|
|
4994
4995
|
const pending_projections = [];
|
|
4995
4996
|
const projection_reactions = /* @__PURE__ */ new Set();
|
|
4996
|
-
const record_projection_reactions = /* @__PURE__ */
|
|
4997
|
+
const record_projection_reactions = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (proj) => {
|
|
4997
4998
|
if (!proj.batchHandler && !proj.fold) return;
|
|
4998
4999
|
for (const register of Object.values(
|
|
4999
5000
|
proj.events
|
|
@@ -5003,7 +5004,7 @@ function act() {
|
|
|
5003
5004
|
}, "record_projection_reactions");
|
|
5004
5005
|
const fold_projections = [];
|
|
5005
5006
|
const batch_handlers = /* @__PURE__ */ new Map();
|
|
5006
|
-
const add_projection = /* @__PURE__ */
|
|
5007
|
+
const add_projection = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (proj) => {
|
|
5007
5008
|
record_projection_reactions(proj);
|
|
5008
5009
|
merge_projection(proj, registry.events);
|
|
5009
5010
|
register_batch_handler(proj, batch_handlers);
|
|
@@ -5012,8 +5013,8 @@ function act() {
|
|
|
5012
5013
|
const fold_specs = [];
|
|
5013
5014
|
const lanes = [];
|
|
5014
5015
|
let _built = false;
|
|
5015
|
-
const read_wrap = /* @__PURE__ */
|
|
5016
|
-
const wrapped2 = /* @__PURE__ */
|
|
5016
|
+
const read_wrap = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (original) => {
|
|
5017
|
+
const wrapped2 = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, async (events, stream) => {
|
|
5017
5018
|
const read = events.map((e) => _nullishCoalesce(_optionalChain([_hr, 'access', _184 => _184.get, 'call', _185 => _185(e.name), 'optionalCall', _186 => _186(e)]), () => ( e)));
|
|
5018
5019
|
return original(read, stream);
|
|
5019
5020
|
}, "wrapped");
|
|
@@ -5021,7 +5022,7 @@ function act() {
|
|
|
5021
5022
|
if (reset) Object.defineProperty(wrapped2, FOLD_RESET, { value: reset });
|
|
5022
5023
|
return wrapped2;
|
|
5023
5024
|
}, "read_wrap");
|
|
5024
|
-
const make_batch_handlers = /* @__PURE__ */
|
|
5025
|
+
const make_batch_handlers = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, () => {
|
|
5025
5026
|
const handlers = new Map(batch_handlers);
|
|
5026
5027
|
for (const spec of fold_specs) {
|
|
5027
5028
|
handlers.set(
|
|
@@ -5039,7 +5040,7 @@ function act() {
|
|
|
5039
5040
|
}
|
|
5040
5041
|
return handlers;
|
|
5041
5042
|
}, "make_batch_handlers");
|
|
5042
|
-
const finalize_deprecations = /* @__PURE__ */
|
|
5043
|
+
const finalize_deprecations = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, () => {
|
|
5043
5044
|
const deprecation_summary = [];
|
|
5044
5045
|
for (const state2 of states.values()) {
|
|
5045
5046
|
const event_names = Object.keys(state2.events);
|
|
@@ -5068,23 +5069,23 @@ function act() {
|
|
|
5068
5069
|
const list = deprecation_summary.map(
|
|
5069
5070
|
(d) => `"${d.deprecated}" (current: "${d.current}", state: "${d.state_name}")`
|
|
5070
5071
|
).join(", ");
|
|
5071
|
-
|
|
5072
|
+
_chunk3WHD4VPPcjs.log.call(void 0, ).info(
|
|
5072
5073
|
`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.`
|
|
5073
5074
|
);
|
|
5074
5075
|
}
|
|
5075
5076
|
}, "finalize_deprecations");
|
|
5076
|
-
const closed = /* @__PURE__ */
|
|
5077
|
+
const closed = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (method) => {
|
|
5077
5078
|
throw new Error(
|
|
5078
5079
|
`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).`
|
|
5079
5080
|
);
|
|
5080
5081
|
}, "closed");
|
|
5081
5082
|
const builder = {
|
|
5082
|
-
withState: /* @__PURE__ */
|
|
5083
|
+
withState: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (state2) => {
|
|
5083
5084
|
if (_built) closed("withState");
|
|
5084
5085
|
register_state(state2, states, registry.actions, registry.events);
|
|
5085
5086
|
return builder;
|
|
5086
5087
|
}, "withState"),
|
|
5087
|
-
withSlice: /* @__PURE__ */
|
|
5088
|
+
withSlice: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (input) => {
|
|
5088
5089
|
if (_built) closed("withSlice");
|
|
5089
5090
|
for (const s of input.states.values()) {
|
|
5090
5091
|
register_state(s, states, registry.actions, registry.events);
|
|
@@ -5094,22 +5095,22 @@ function act() {
|
|
|
5094
5095
|
for (const lane of input.lanes) register_lane(lane, lanes);
|
|
5095
5096
|
return builder;
|
|
5096
5097
|
}, "withSlice"),
|
|
5097
|
-
withProjection: /* @__PURE__ */
|
|
5098
|
+
withProjection: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (proj) => {
|
|
5098
5099
|
if (_built) closed("withProjection");
|
|
5099
5100
|
add_projection(proj);
|
|
5100
5101
|
return builder;
|
|
5101
5102
|
}, "withProjection"),
|
|
5102
|
-
withActor: /* @__PURE__ */
|
|
5103
|
-
withLane: /* @__PURE__ */
|
|
5103
|
+
withActor: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, () => builder, "withActor"),
|
|
5104
|
+
withLane: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (config2) => {
|
|
5104
5105
|
if (_built) closed("withLane");
|
|
5105
5106
|
register_lane(config2, lanes);
|
|
5106
5107
|
return builder;
|
|
5107
5108
|
}, "withLane"),
|
|
5108
|
-
on: /* @__PURE__ */
|
|
5109
|
+
on: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (event) => {
|
|
5109
5110
|
if (_built) closed("on");
|
|
5110
5111
|
return reaction_on(event, registry.events, builder);
|
|
5111
5112
|
}, "on"),
|
|
5112
|
-
build: /* @__PURE__ */
|
|
5113
|
+
build: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (options) => {
|
|
5113
5114
|
if (!_built) {
|
|
5114
5115
|
for (const proj of pending_projections) add_projection(proj);
|
|
5115
5116
|
for (const proj of fold_projections) {
|
|
@@ -5149,7 +5150,7 @@ function act() {
|
|
|
5149
5150
|
for (const [name, gate] of built.query_readers) _qg.set(name, gate);
|
|
5150
5151
|
for (const [name, gate] of built.handler_readers) _hr.set(name, gate);
|
|
5151
5152
|
finalize_deprecations();
|
|
5152
|
-
if (built.advisory)
|
|
5153
|
+
if (built.advisory) _chunk3WHD4VPPcjs.log.call(void 0, ).warn(built.advisory);
|
|
5153
5154
|
for (const [name, state2] of states) {
|
|
5154
5155
|
if (!state2.loads) continue;
|
|
5155
5156
|
const resolved = {};
|
|
@@ -5193,7 +5194,7 @@ function act() {
|
|
|
5193
5194
|
synthesize_autoclose_reactions(
|
|
5194
5195
|
registry,
|
|
5195
5196
|
states,
|
|
5196
|
-
|
|
5197
|
+
_chunk3WHD4VPPcjs.current_autoclose_window
|
|
5197
5198
|
);
|
|
5198
5199
|
Object.freeze(registry.actions);
|
|
5199
5200
|
Object.freeze(registry.events);
|
|
@@ -5212,14 +5213,14 @@ function act() {
|
|
|
5212
5213
|
};
|
|
5213
5214
|
return builder;
|
|
5214
5215
|
}
|
|
5215
|
-
|
|
5216
|
+
_chunkLA2BPKNScjs.__name.call(void 0, act, "act");
|
|
5216
5217
|
|
|
5217
5218
|
// src/builders/projection-builder.ts
|
|
5218
5219
|
function _projection(target) {
|
|
5219
5220
|
const events = {};
|
|
5220
5221
|
const default_resolver = typeof target === "string" ? { target } : void 0;
|
|
5221
5222
|
const base = {
|
|
5222
|
-
on: /* @__PURE__ */
|
|
5223
|
+
on: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (entry) => {
|
|
5223
5224
|
const keys = Object.keys(entry);
|
|
5224
5225
|
if (keys.length !== 1) throw new Error(".on() requires exactly one key");
|
|
5225
5226
|
const event = keys[0];
|
|
@@ -5231,7 +5232,7 @@ function _projection(target) {
|
|
|
5231
5232
|
};
|
|
5232
5233
|
}
|
|
5233
5234
|
return {
|
|
5234
|
-
do: /* @__PURE__ */
|
|
5235
|
+
do: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (handler) => {
|
|
5235
5236
|
const widened = base;
|
|
5236
5237
|
return add_reaction(
|
|
5237
5238
|
events,
|
|
@@ -5242,8 +5243,8 @@ function _projection(target) {
|
|
|
5242
5243
|
handler,
|
|
5243
5244
|
resolver: _nullishCoalesce(default_resolver, () => ( _this_)),
|
|
5244
5245
|
options: {
|
|
5245
|
-
blockOnError:
|
|
5246
|
-
maxRetries:
|
|
5246
|
+
blockOnError: _chunk3WHD4VPPcjs.DEFAULT_BLOCK_ON_ERROR,
|
|
5247
|
+
maxRetries: _chunk3WHD4VPPcjs.DEFAULT_MAX_RETRIES
|
|
5247
5248
|
}
|
|
5248
5249
|
}),
|
|
5249
5250
|
widened
|
|
@@ -5251,7 +5252,7 @@ function _projection(target) {
|
|
|
5251
5252
|
}, "do")
|
|
5252
5253
|
};
|
|
5253
5254
|
}, "on"),
|
|
5254
|
-
build: /* @__PURE__ */
|
|
5255
|
+
build: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, () => ({
|
|
5255
5256
|
_tag: "Projection",
|
|
5256
5257
|
events,
|
|
5257
5258
|
...target !== void 0 && { target }
|
|
@@ -5260,20 +5261,20 @@ function _projection(target) {
|
|
|
5260
5261
|
};
|
|
5261
5262
|
if (typeof target === "string") {
|
|
5262
5263
|
return Object.assign(base, {
|
|
5263
|
-
batch: /* @__PURE__ */
|
|
5264
|
-
build: /* @__PURE__ */
|
|
5264
|
+
batch: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (handler) => ({
|
|
5265
|
+
build: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, () => ({
|
|
5265
5266
|
_tag: "Projection",
|
|
5266
5267
|
events,
|
|
5267
5268
|
target,
|
|
5268
5269
|
batchHandler: handler
|
|
5269
5270
|
}), "build")
|
|
5270
5271
|
}), "batch"),
|
|
5271
|
-
of: /* @__PURE__ */
|
|
5272
|
+
of: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (...args) => {
|
|
5272
5273
|
if (Object.keys(events).length > 0)
|
|
5273
5274
|
throw new Error(
|
|
5274
5275
|
`Projection "${target}" mixes .of() with .on() handlers \u2014 a projection either folds a state or declares handlers, never both`
|
|
5275
5276
|
);
|
|
5276
|
-
const is_state = /* @__PURE__ */
|
|
5277
|
+
const is_state = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (a) => !!a && typeof a.init === "function", "is_state");
|
|
5277
5278
|
const partials = args.filter(is_state);
|
|
5278
5279
|
const options = _nullishCoalesce(args.find((a) => !is_state(a)), () => ( {}));
|
|
5279
5280
|
if (partials.length === 0)
|
|
@@ -5284,7 +5285,7 @@ function _projection(target) {
|
|
|
5284
5285
|
throw new Error(
|
|
5285
5286
|
`Projection "${target}" .of() partials must share one state name \u2014 got "${name}" and "${partial.name}"`
|
|
5286
5287
|
);
|
|
5287
|
-
const config2 =
|
|
5288
|
+
const config2 = _chunk3WHD4VPPcjs.check.call(void 0, "fold", options);
|
|
5288
5289
|
const fold_events = {};
|
|
5289
5290
|
for (const partial of partials)
|
|
5290
5291
|
for (const [event_name, schema] of Object.entries(partial.events)) {
|
|
@@ -5302,8 +5303,8 @@ function _projection(target) {
|
|
|
5302
5303
|
handler: noop,
|
|
5303
5304
|
resolver: { target },
|
|
5304
5305
|
options: {
|
|
5305
|
-
blockOnError:
|
|
5306
|
-
maxRetries:
|
|
5306
|
+
blockOnError: _chunk3WHD4VPPcjs.DEFAULT_BLOCK_ON_ERROR,
|
|
5307
|
+
maxRetries: _chunk3WHD4VPPcjs.DEFAULT_MAX_RETRIES
|
|
5307
5308
|
}
|
|
5308
5309
|
}
|
|
5309
5310
|
]
|
|
@@ -5311,8 +5312,8 @@ function _projection(target) {
|
|
|
5311
5312
|
};
|
|
5312
5313
|
}
|
|
5313
5314
|
return {
|
|
5314
|
-
flush: /* @__PURE__ */
|
|
5315
|
-
build: /* @__PURE__ */
|
|
5315
|
+
flush: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (handler) => ({
|
|
5316
|
+
build: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, () => ({
|
|
5316
5317
|
_tag: "Projection",
|
|
5317
5318
|
events: fold_events,
|
|
5318
5319
|
target,
|
|
@@ -5325,11 +5326,11 @@ function _projection(target) {
|
|
|
5325
5326
|
}
|
|
5326
5327
|
return base;
|
|
5327
5328
|
}
|
|
5328
|
-
|
|
5329
|
+
_chunkLA2BPKNScjs.__name.call(void 0, _projection, "_projection");
|
|
5329
5330
|
function projection(target) {
|
|
5330
5331
|
return _projection(target);
|
|
5331
5332
|
}
|
|
5332
|
-
|
|
5333
|
+
_chunkLA2BPKNScjs.__name.call(void 0, projection, "projection");
|
|
5333
5334
|
|
|
5334
5335
|
// src/builders/slice-builder.ts
|
|
5335
5336
|
function slice() {
|
|
@@ -5339,20 +5340,20 @@ function slice() {
|
|
|
5339
5340
|
const projections = [];
|
|
5340
5341
|
const lanes = [];
|
|
5341
5342
|
const builder = {
|
|
5342
|
-
withState: /* @__PURE__ */
|
|
5343
|
+
withState: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (state2) => {
|
|
5343
5344
|
register_state(state2, states, actions, events);
|
|
5344
5345
|
return builder;
|
|
5345
5346
|
}, "withState"),
|
|
5346
|
-
withProjection: /* @__PURE__ */
|
|
5347
|
+
withProjection: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (proj) => {
|
|
5347
5348
|
projections.push(proj);
|
|
5348
5349
|
return builder;
|
|
5349
5350
|
}, "withProjection"),
|
|
5350
|
-
withLane: /* @__PURE__ */
|
|
5351
|
+
withLane: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (config2) => {
|
|
5351
5352
|
register_lane(config2, lanes);
|
|
5352
5353
|
return builder;
|
|
5353
5354
|
}, "withLane"),
|
|
5354
|
-
on: /* @__PURE__ */
|
|
5355
|
-
build: /* @__PURE__ */
|
|
5355
|
+
on: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (event) => reaction_on(event, events, builder), "on"),
|
|
5356
|
+
build: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, () => ({
|
|
5356
5357
|
_tag: "Slice",
|
|
5357
5358
|
states,
|
|
5358
5359
|
events,
|
|
@@ -5363,7 +5364,7 @@ function slice() {
|
|
|
5363
5364
|
};
|
|
5364
5365
|
return builder;
|
|
5365
5366
|
}
|
|
5366
|
-
|
|
5367
|
+
_chunkLA2BPKNScjs.__name.call(void 0, slice, "slice");
|
|
5367
5368
|
|
|
5368
5369
|
// src/builders/state-builder.ts
|
|
5369
5370
|
function state(entry) {
|
|
@@ -5395,8 +5396,8 @@ function state(entry) {
|
|
|
5395
5396
|
// `act().build()` flips both on states with `sensitive(...)`
|
|
5396
5397
|
// events to bake in the gate / split and gate the cache write.
|
|
5397
5398
|
pii_aware: false,
|
|
5398
|
-
view: /* @__PURE__ */
|
|
5399
|
-
message: /* @__PURE__ */
|
|
5399
|
+
view: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (event) => event, "view"),
|
|
5400
|
+
message: /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (validated) => validated, "message")
|
|
5400
5401
|
};
|
|
5401
5402
|
const builder = action_builder(internal);
|
|
5402
5403
|
return Object.assign(builder, {
|
|
@@ -5410,7 +5411,7 @@ function state(entry) {
|
|
|
5410
5411
|
}
|
|
5411
5412
|
};
|
|
5412
5413
|
}
|
|
5413
|
-
|
|
5414
|
+
_chunkLA2BPKNScjs.__name.call(void 0, state, "state");
|
|
5414
5415
|
function action_builder(state2) {
|
|
5415
5416
|
const internal = state2;
|
|
5416
5417
|
const builder = {
|
|
@@ -5423,7 +5424,7 @@ function action_builder(state2) {
|
|
|
5423
5424
|
throw new Error(`Duplicate action "${action2}"`);
|
|
5424
5425
|
internal.actions[action2] = schema;
|
|
5425
5426
|
if (options) {
|
|
5426
|
-
|
|
5427
|
+
_chunk3WHD4VPPcjs.check.call(void 0, "action", options);
|
|
5427
5428
|
internal.options ??= {};
|
|
5428
5429
|
internal.options[action2] = options;
|
|
5429
5430
|
}
|
|
@@ -5447,12 +5448,12 @@ function action_builder(state2) {
|
|
|
5447
5448
|
(internal.loads ??= {})[action2] = loads;
|
|
5448
5449
|
return { loads: load2, requires, emit };
|
|
5449
5450
|
}
|
|
5450
|
-
|
|
5451
|
+
_chunkLA2BPKNScjs.__name.call(void 0, load2, "load");
|
|
5451
5452
|
function requires(rules) {
|
|
5452
5453
|
(internal.requires ??= {})[action2] = rules;
|
|
5453
5454
|
return { emit };
|
|
5454
5455
|
}
|
|
5455
|
-
|
|
5456
|
+
_chunkLA2BPKNScjs.__name.call(void 0, requires, "requires");
|
|
5456
5457
|
function emit(handler) {
|
|
5457
5458
|
if (typeof handler === "string") {
|
|
5458
5459
|
const event_name = handler;
|
|
@@ -5468,7 +5469,7 @@ function action_builder(state2) {
|
|
|
5468
5469
|
}
|
|
5469
5470
|
return builder;
|
|
5470
5471
|
}
|
|
5471
|
-
|
|
5472
|
+
_chunkLA2BPKNScjs.__name.call(void 0, emit, "emit");
|
|
5472
5473
|
return { loads: load2, requires, emit };
|
|
5473
5474
|
},
|
|
5474
5475
|
snap(snap2) {
|
|
@@ -5519,7 +5520,7 @@ function action_builder(state2) {
|
|
|
5519
5520
|
};
|
|
5520
5521
|
return builder;
|
|
5521
5522
|
}
|
|
5522
|
-
|
|
5523
|
+
_chunkLA2BPKNScjs.__name.call(void 0, action_builder, "action_builder");
|
|
5523
5524
|
|
|
5524
5525
|
// src/csv.ts
|
|
5525
5526
|
var _fs = require('fs');
|
|
@@ -5535,7 +5536,7 @@ var CSV_COLUMNS = [
|
|
|
5535
5536
|
];
|
|
5536
5537
|
var CsvFile = class {
|
|
5537
5538
|
static {
|
|
5538
|
-
|
|
5539
|
+
_chunkLA2BPKNScjs.__name.call(void 0, this, "CsvFile");
|
|
5539
5540
|
}
|
|
5540
5541
|
|
|
5541
5542
|
|
|
@@ -5630,7 +5631,7 @@ async function* linesFromFile(path) {
|
|
|
5630
5631
|
stream.close();
|
|
5631
5632
|
}
|
|
5632
5633
|
}
|
|
5633
|
-
|
|
5634
|
+
_chunkLA2BPKNScjs.__name.call(void 0, linesFromFile, "linesFromFile");
|
|
5634
5635
|
async function* linesFromBlob(blob) {
|
|
5635
5636
|
let start = 0;
|
|
5636
5637
|
while (start < blob.length) {
|
|
@@ -5641,7 +5642,7 @@ async function* linesFromBlob(blob) {
|
|
|
5641
5642
|
await Promise.resolve();
|
|
5642
5643
|
}
|
|
5643
5644
|
}
|
|
5644
|
-
|
|
5645
|
+
_chunkLA2BPKNScjs.__name.call(void 0, linesFromBlob, "linesFromBlob");
|
|
5645
5646
|
function parse_csv_line(line) {
|
|
5646
5647
|
const fields = [];
|
|
5647
5648
|
let i = 0;
|
|
@@ -5675,12 +5676,12 @@ function parse_csv_line(line) {
|
|
|
5675
5676
|
}
|
|
5676
5677
|
return fields;
|
|
5677
5678
|
}
|
|
5678
|
-
|
|
5679
|
+
_chunkLA2BPKNScjs.__name.call(void 0, parse_csv_line, "parse_csv_line");
|
|
5679
5680
|
function csv_escape(value) {
|
|
5680
5681
|
if (/[",\n\r]/.test(value)) return `"${value.replace(/"/g, '""')}"`;
|
|
5681
5682
|
return value;
|
|
5682
5683
|
}
|
|
5683
|
-
|
|
5684
|
+
_chunkLA2BPKNScjs.__name.call(void 0, csv_escape, "csv_escape");
|
|
5684
5685
|
function write_line(writer, line) {
|
|
5685
5686
|
return new Promise((resolve, reject) => {
|
|
5686
5687
|
writer.write(`${line}
|
|
@@ -5690,38 +5691,38 @@ function write_line(writer, line) {
|
|
|
5690
5691
|
});
|
|
5691
5692
|
});
|
|
5692
5693
|
}
|
|
5693
|
-
|
|
5694
|
+
_chunkLA2BPKNScjs.__name.call(void 0, write_line, "write_line");
|
|
5694
5695
|
|
|
5695
5696
|
// src/deprecated.ts
|
|
5696
|
-
var check_appends =
|
|
5697
|
-
var throw_if_stale =
|
|
5698
|
-
var concurrency_error =
|
|
5699
|
-
var seed_event =
|
|
5700
|
-
var fair_slots =
|
|
5701
|
-
var is_literal_source =
|
|
5702
|
-
var notification_of =
|
|
5703
|
-
var DEFAULT_QUERY_STREAMS_LIMIT2 =
|
|
5704
|
-
var ActorSchema2 =
|
|
5705
|
-
var TargetSchema2 =
|
|
5706
|
-
var EventMetaSchema2 =
|
|
5707
|
-
var CausationEventSchema2 =
|
|
5708
|
-
var CommittedMetaSchema2 =
|
|
5709
|
-
var QuerySchema2 =
|
|
5710
|
-
var Environments2 =
|
|
5711
|
-
var LogLevels2 =
|
|
5712
|
-
var ExitCodes2 =
|
|
5713
|
-
var DEFAULT_LANE2 =
|
|
5714
|
-
var DEFAULT_MAX_SUBSCRIBED_STREAMS2 =
|
|
5715
|
-
var DEFAULT_SETTLE_DEBOUNCE_MS2 =
|
|
5716
|
-
var PackageSchema =
|
|
5717
|
-
var default_scope =
|
|
5718
|
-
var extend = /* @__PURE__ */
|
|
5697
|
+
var check_appends = _chunkQITJ63HGcjs.checkAppends;
|
|
5698
|
+
var throw_if_stale = _chunkQITJ63HGcjs.checkVersion;
|
|
5699
|
+
var concurrency_error = _chunkQITJ63HGcjs.concurrencyError;
|
|
5700
|
+
var seed_event = _chunkQITJ63HGcjs.seedEvent;
|
|
5701
|
+
var fair_slots = _chunkQITJ63HGcjs.fairSlots;
|
|
5702
|
+
var is_literal_source = _chunkQITJ63HGcjs.isStreamName;
|
|
5703
|
+
var notification_of = _chunkQITJ63HGcjs.parseNotification;
|
|
5704
|
+
var DEFAULT_QUERY_STREAMS_LIMIT2 = _chunkLA2BPKNScjs.DEFAULT_QUERY_STREAMS_LIMIT;
|
|
5705
|
+
var ActorSchema2 = _chunkLA2BPKNScjs.ActorSchema;
|
|
5706
|
+
var TargetSchema2 = _chunkLA2BPKNScjs.TargetSchema;
|
|
5707
|
+
var EventMetaSchema2 = _chunkLA2BPKNScjs.EventMetaSchema;
|
|
5708
|
+
var CausationEventSchema2 = _chunkLA2BPKNScjs.CausationEventSchema;
|
|
5709
|
+
var CommittedMetaSchema2 = _chunkLA2BPKNScjs.CommittedMetaSchema;
|
|
5710
|
+
var QuerySchema2 = _chunkLA2BPKNScjs.QuerySchema;
|
|
5711
|
+
var Environments2 = _chunkLA2BPKNScjs.Environments;
|
|
5712
|
+
var LogLevels2 = _chunkLA2BPKNScjs.LogLevels;
|
|
5713
|
+
var ExitCodes2 = _chunkLA2BPKNScjs.ExitCodes;
|
|
5714
|
+
var DEFAULT_LANE2 = _chunkLA2BPKNScjs.DEFAULT_LANE;
|
|
5715
|
+
var DEFAULT_MAX_SUBSCRIBED_STREAMS2 = _chunkLA2BPKNScjs.DEFAULT_MAX_SUBSCRIBED_STREAMS;
|
|
5716
|
+
var DEFAULT_SETTLE_DEBOUNCE_MS2 = _chunkLA2BPKNScjs.DEFAULT_SETTLE_DEBOUNCE_MS;
|
|
5717
|
+
var PackageSchema = _chunk3WHD4VPPcjs.package_schema;
|
|
5718
|
+
var default_scope = _chunk3WHD4VPPcjs.unscoped_ports;
|
|
5719
|
+
var extend = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (source, schema, target) => ({ ...target, ..._chunk3WHD4VPPcjs.validate.call(void 0, "config", source, schema) }), "extend");
|
|
5719
5720
|
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])?$/;
|
|
5720
|
-
var dateReviver = /* @__PURE__ */
|
|
5721
|
+
var dateReviver = /* @__PURE__ */ _chunkLA2BPKNScjs.__name.call(void 0, (_key, value) => typeof value === "string" && ISO_8601.test(value) ? new Date(value) : value, "dateReviver");
|
|
5721
5722
|
function sensitiveFields(schema) {
|
|
5722
5723
|
return Object.keys(pii_schemas(schema));
|
|
5723
5724
|
}
|
|
5724
|
-
|
|
5725
|
+
_chunkLA2BPKNScjs.__name.call(void 0, sensitiveFields, "sensitiveFields");
|
|
5725
5726
|
var pii_fields = sensitiveFields;
|
|
5726
5727
|
|
|
5727
5728
|
|
|
@@ -5782,5 +5783,5 @@ var pii_fields = sensitiveFields;
|
|
|
5782
5783
|
|
|
5783
5784
|
|
|
5784
5785
|
|
|
5785
|
-
exports.Act = Act; exports.ActorSchema = ActorSchema2; exports.CausationEventSchema = CausationEventSchema2; exports.CommittedMetaSchema = CommittedMetaSchema2; exports.ConcurrencyError =
|
|
5786
|
+
exports.Act = Act; exports.ActorSchema = ActorSchema2; exports.CausationEventSchema = CausationEventSchema2; exports.CommittedMetaSchema = CommittedMetaSchema2; exports.ConcurrencyError = _chunkLA2BPKNScjs.ConcurrencyError; exports.ConsoleLogger = _chunk3WHD4VPPcjs.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 = _chunkLA2BPKNScjs.DeferSignal; exports.Environments = Environments2; exports.Errors = _chunkLA2BPKNScjs.Errors; exports.EventMetaSchema = EventMetaSchema2; exports.ExitCodes = ExitCodes2; exports.InMemoryCache = _chunk3WHD4VPPcjs.InMemoryCache; exports.InMemoryStore = _chunk3WHD4VPPcjs.InMemoryStore; exports.LogLevels = LogLevels2; exports.NonRetryableError = _chunkLA2BPKNScjs.NonRetryableError; exports.PackageSchema = PackageSchema; exports.PreconditionError = _chunkLA2BPKNScjs.PreconditionError; exports.QuerySchema = QuerySchema2; exports.REDACTED = _chunkLA2BPKNScjs.REDACTED; exports.SHREDDED = _chunkLA2BPKNScjs.SHREDDED; exports.SNAP_EVENT = _chunkLA2BPKNScjs.SNAP_EVENT; exports.StoreError = _chunkLA2BPKNScjs.StoreError; exports.StreamClosedError = _chunkLA2BPKNScjs.StreamClosedError; exports.TOMBSTONE_EVENT = _chunkLA2BPKNScjs.TOMBSTONE_EVENT; exports.TargetSchema = TargetSchema2; exports.ValidationError = _chunkLA2BPKNScjs.ValidationError; exports.ZodEmpty = _chunkLA2BPKNScjs.ZodEmpty; exports.act = act; exports.cache = _chunk3WHD4VPPcjs.cache; exports.check_appends = check_appends; exports.concurrency_error = concurrency_error; exports.config = _chunk3WHD4VPPcjs.config; exports.dateReviver = dateReviver; exports.default_scope = default_scope; exports.dispose = _chunk3WHD4VPPcjs.dispose; exports.disposeAndExit = _chunk3WHD4VPPcjs.disposeAndExit; exports.extend = extend; exports.fair_slots = fair_slots; exports.is_literal_source = is_literal_source; exports.log = _chunk3WHD4VPPcjs.log; exports.notification_of = notification_of; exports.pii_fields = pii_fields; exports.port = _chunk3WHD4VPPcjs.port; exports.projection = projection; exports.seed_event = seed_event; exports.sensitive = _chunkLA2BPKNScjs.sensitive; exports.sensitiveFields = sensitiveFields; exports.sleep = _chunk3WHD4VPPcjs.sleep; exports.slice = slice; exports.state = state; exports.store = _chunk3WHD4VPPcjs.store; exports.throw_if_stale = throw_if_stale; exports.validate = _chunk3WHD4VPPcjs.validate;
|
|
5786
5787
|
//# sourceMappingURL=index.cjs.map
|