@rotorsoft/act 2.2.6 → 2.3.1
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/internal/correlate-cycle.d.ts.map +1 -1
- package/dist/@types/types/ports.d.ts +4 -4
- package/dist/@types/types/reaction.d.ts +2 -1
- package/dist/@types/types/reaction.d.ts.map +1 -1
- package/dist/adapter.cjs +3 -3
- package/dist/adapter.js +2 -2
- package/dist/{chunk-4GA3CHQW.cjs → chunk-253TSECA.cjs} +1 -1
- package/dist/{chunk-4GA3CHQW.cjs.map → chunk-253TSECA.cjs.map} +1 -1
- package/dist/{chunk-KTMIRM5Z.js → chunk-5DXXAR7D.js} +2 -2
- package/dist/{chunk-UYNNDDE7.cjs → chunk-EXXHQ7CS.cjs} +55 -55
- package/dist/{chunk-UYNNDDE7.cjs.map → chunk-EXXHQ7CS.cjs.map} +1 -1
- package/dist/{chunk-ROC62MEU.js → chunk-HU7KBNJ7.js} +1 -1
- package/dist/{chunk-ROC62MEU.js.map → chunk-HU7KBNJ7.js.map} +1 -1
- package/dist/{chunk-SJJVHRME.js → chunk-VJ726W5R.js} +3 -3
- package/dist/{chunk-XJZ2PKJH.cjs → chunk-XSLQYVIG.cjs} +11 -11
- package/dist/{chunk-XJZ2PKJH.cjs.map → chunk-XSLQYVIG.cjs.map} +1 -1
- package/dist/index.cjs +428 -426
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -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 +1 -1
- /package/dist/{chunk-KTMIRM5Z.js.map → chunk-5DXXAR7D.js.map} +0 -0
- /package/dist/{chunk-SJJVHRME.js.map → chunk-VJ726W5R.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
var
|
|
31
|
+
var _chunkEXXHQ7CScjs = require('./chunk-EXXHQ7CS.cjs');
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
|
|
@@ -37,7 +37,7 @@ var _chunkUYNNDDE7cjs = require('./chunk-UYNNDDE7.cjs');
|
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
var
|
|
40
|
+
var _chunkXSLQYVIGcjs = require('./chunk-XSLQYVIG.cjs');
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
|
|
@@ -67,26 +67,26 @@ var _chunkXJZ2PKJHcjs = require('./chunk-XJZ2PKJH.cjs');
|
|
|
67
67
|
|
|
68
68
|
|
|
69
69
|
|
|
70
|
-
var
|
|
70
|
+
var _chunk253TSECAcjs = require('./chunk-253TSECA.cjs');
|
|
71
71
|
|
|
72
72
|
// src/signals.ts
|
|
73
73
|
process.once("SIGINT", async (arg) => {
|
|
74
|
-
|
|
75
|
-
await
|
|
74
|
+
_chunkEXXHQ7CScjs.log.call(void 0, ).info(arg, "SIGINT");
|
|
75
|
+
await _chunkEXXHQ7CScjs.disposeAndExit.call(void 0, "EXIT");
|
|
76
76
|
});
|
|
77
77
|
process.once("SIGTERM", async (arg) => {
|
|
78
|
-
|
|
79
|
-
await
|
|
78
|
+
_chunkEXXHQ7CScjs.log.call(void 0, ).info(arg, "SIGTERM");
|
|
79
|
+
await _chunkEXXHQ7CScjs.disposeAndExit.call(void 0, "EXIT");
|
|
80
80
|
});
|
|
81
81
|
process.once("uncaughtException", async (arg) => {
|
|
82
82
|
process.exitCode = 1;
|
|
83
|
-
|
|
84
|
-
await
|
|
83
|
+
_chunkEXXHQ7CScjs.log.call(void 0, ).error(arg, "Uncaught Exception");
|
|
84
|
+
await _chunkEXXHQ7CScjs.disposeAndExit.call(void 0, "ERROR");
|
|
85
85
|
});
|
|
86
86
|
process.once("unhandledRejection", async (arg) => {
|
|
87
87
|
process.exitCode = 1;
|
|
88
|
-
|
|
89
|
-
await
|
|
88
|
+
_chunkEXXHQ7CScjs.log.call(void 0, ).error(arg, "Unhandled Rejection");
|
|
89
|
+
await _chunkEXXHQ7CScjs.disposeAndExit.call(void 0, "ERROR");
|
|
90
90
|
});
|
|
91
91
|
|
|
92
92
|
// src/act.ts
|
|
@@ -102,7 +102,7 @@ function parse(name) {
|
|
|
102
102
|
}
|
|
103
103
|
return { base: name, version: 1 };
|
|
104
104
|
}
|
|
105
|
-
|
|
105
|
+
_chunk253TSECAcjs.__name.call(void 0, parse, "parse");
|
|
106
106
|
function deprecated_event_names(names) {
|
|
107
107
|
const groups = /* @__PURE__ */ new Map();
|
|
108
108
|
for (const name of names) {
|
|
@@ -128,7 +128,7 @@ function deprecated_event_names(names) {
|
|
|
128
128
|
}
|
|
129
129
|
return deprecated;
|
|
130
130
|
}
|
|
131
|
-
|
|
131
|
+
_chunk253TSECAcjs.__name.call(void 0, deprecated_event_names, "deprecated_event_names");
|
|
132
132
|
function current_version_of(deprecated_name, all_names) {
|
|
133
133
|
const target = parse(deprecated_name);
|
|
134
134
|
let highest;
|
|
@@ -139,7 +139,7 @@ function current_version_of(deprecated_name, all_names) {
|
|
|
139
139
|
}
|
|
140
140
|
return highest && highest.version > target.version ? highest.name : void 0;
|
|
141
141
|
}
|
|
142
|
-
|
|
142
|
+
_chunk253TSECAcjs.__name.call(void 0, current_version_of, "current_version_of");
|
|
143
143
|
|
|
144
144
|
// src/internal/walk-streams.ts
|
|
145
145
|
var DEFAULT_STREAM_PAGE = 500;
|
|
@@ -161,7 +161,7 @@ async function walk_streams(store2, callback, query) {
|
|
|
161
161
|
after = last;
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
-
|
|
164
|
+
_chunk253TSECAcjs.__name.call(void 0, walk_streams, "walk_streams");
|
|
165
165
|
|
|
166
166
|
// src/internal/audit.ts
|
|
167
167
|
var DEFAULTS = {
|
|
@@ -198,7 +198,7 @@ async function* audit(deps, categories, options = {}) {
|
|
|
198
198
|
if (need_stats) {
|
|
199
199
|
const stats = await deps.store().query_stats(
|
|
200
200
|
{},
|
|
201
|
-
{ count: true, names: true, exclude: [
|
|
201
|
+
{ count: true, names: true, exclude: [_chunk253TSECAcjs.SNAP_EVENT] }
|
|
202
202
|
);
|
|
203
203
|
for (const [stream, s] of stats) {
|
|
204
204
|
for (const p of passes) _optionalChain([p, 'access', _4 => _4.on_stat, 'optionalCall', _5 => _5(stream, s)]);
|
|
@@ -226,7 +226,7 @@ async function* audit(deps, categories, options = {}) {
|
|
|
226
226
|
for (const f of p.drain()) yield f;
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
|
-
|
|
229
|
+
_chunk253TSECAcjs.__name.call(void 0, audit, "audit");
|
|
230
230
|
async function scan_events_resiliently(deps, query, on_event, on_unreadable) {
|
|
231
231
|
let cursor = _optionalChain([query, 'optionalAccess', _14 => _14.after]);
|
|
232
232
|
let remaining = _optionalChain([query, 'optionalAccess', _15 => _15.limit]);
|
|
@@ -262,8 +262,8 @@ async function scan_events_resiliently(deps, query, on_event, on_unreadable) {
|
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
264
|
}
|
|
265
|
-
|
|
266
|
-
var make_schema_pass = /* @__PURE__ */
|
|
265
|
+
_chunk253TSECAcjs.__name.call(void 0, scan_events_resiliently, "scan_events_resiliently");
|
|
266
|
+
var make_schema_pass = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (deps) => {
|
|
267
267
|
const findings = [];
|
|
268
268
|
return {
|
|
269
269
|
category: "schema",
|
|
@@ -306,10 +306,10 @@ var make_schema_pass = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (de
|
|
|
306
306
|
});
|
|
307
307
|
}
|
|
308
308
|
},
|
|
309
|
-
drain: /* @__PURE__ */
|
|
309
|
+
drain: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, () => findings, "drain")
|
|
310
310
|
};
|
|
311
311
|
}, "make_schema_pass");
|
|
312
|
-
var classify_deprecated_by_state = /* @__PURE__ */
|
|
312
|
+
var classify_deprecated_by_state = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (deps) => {
|
|
313
313
|
const names_by_state = /* @__PURE__ */ new Map();
|
|
314
314
|
for (const [name, state2] of deps.event_to_state) {
|
|
315
315
|
let set = names_by_state.get(state2);
|
|
@@ -327,7 +327,7 @@ var classify_deprecated_by_state = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call
|
|
|
327
327
|
}
|
|
328
328
|
return deprecated_to_current;
|
|
329
329
|
}, "classify_deprecated_by_state");
|
|
330
|
-
var make_deprecated_load_pass = /* @__PURE__ */
|
|
330
|
+
var make_deprecated_load_pass = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (deps, options) => {
|
|
331
331
|
const share_min = _nullishCoalesce(_optionalChain([options, 'access', _17 => _17.thresholds, 'optionalAccess', _18 => _18.deprecated_min]), () => ( DEFAULTS.deprecated_min));
|
|
332
332
|
const totals = /* @__PURE__ */ new Map();
|
|
333
333
|
const per_stream = /* @__PURE__ */ new Map();
|
|
@@ -367,7 +367,7 @@ var make_deprecated_load_pass = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(vo
|
|
|
367
367
|
}
|
|
368
368
|
};
|
|
369
369
|
}, "make_deprecated_load_pass");
|
|
370
|
-
var make_close_candidate_pass = /* @__PURE__ */
|
|
370
|
+
var make_close_candidate_pass = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (deps, options) => {
|
|
371
371
|
const idle_days = _nullishCoalesce(_optionalChain([options, 'access', _19 => _19.thresholds, 'optionalAccess', _20 => _20.idle_days]), () => ( DEFAULTS.idle_days));
|
|
372
372
|
const terminal_events = new Set(_nullishCoalesce(_optionalChain([options, 'access', _21 => _21.thresholds, 'optionalAccess', _22 => _22.terminal_events]), () => ( [])));
|
|
373
373
|
const idle_cutoff = Date.now() - idle_days * 24 * 60 * 60 * 1e3;
|
|
@@ -390,10 +390,10 @@ var make_close_candidate_pass = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(vo
|
|
|
390
390
|
restart_supported: restart_is_supported(deps, head_name)
|
|
391
391
|
});
|
|
392
392
|
},
|
|
393
|
-
drain: /* @__PURE__ */
|
|
393
|
+
drain: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, () => findings, "drain")
|
|
394
394
|
};
|
|
395
395
|
}, "make_close_candidate_pass");
|
|
396
|
-
var make_restart_candidate_pass = /* @__PURE__ */
|
|
396
|
+
var make_restart_candidate_pass = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (deps, options) => {
|
|
397
397
|
const threshold = _nullishCoalesce(_optionalChain([options, 'access', _23 => _23.thresholds, 'optionalAccess', _24 => _24.restart_min]), () => ( DEFAULTS.restart_min));
|
|
398
398
|
const candidates = [];
|
|
399
399
|
const findings = [];
|
|
@@ -416,7 +416,7 @@ var make_restart_candidate_pass = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(
|
|
|
416
416
|
{
|
|
417
417
|
stream,
|
|
418
418
|
stream_exact: true,
|
|
419
|
-
names: [
|
|
419
|
+
names: [_chunk253TSECAcjs.SNAP_EVENT],
|
|
420
420
|
with_snaps: true,
|
|
421
421
|
// From the start: on its own, `with_snaps` resumes at the latest.
|
|
422
422
|
after: -1
|
|
@@ -430,10 +430,10 @@ var make_restart_candidate_pass = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(
|
|
|
430
430
|
});
|
|
431
431
|
}
|
|
432
432
|
},
|
|
433
|
-
drain: /* @__PURE__ */
|
|
433
|
+
drain: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, () => findings, "drain")
|
|
434
434
|
};
|
|
435
435
|
}, "make_restart_candidate_pass");
|
|
436
|
-
var make_reaction_health_pass = /* @__PURE__ */
|
|
436
|
+
var make_reaction_health_pass = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (_deps, options) => {
|
|
437
437
|
const near_block = _nullishCoalesce(_optionalChain([options, 'access', _25 => _25.thresholds, 'optionalAccess', _26 => _26.near_block]), () => ( DEFAULTS.near_block));
|
|
438
438
|
const stuck_minutes = _nullishCoalesce(_optionalChain([options, 'access', _27 => _27.thresholds, 'optionalAccess', _28 => _28.stuck_minutes]), () => ( DEFAULTS.stuck_minutes));
|
|
439
439
|
const stuck_cutoff = Date.now() - stuck_minutes * 60 * 1e3;
|
|
@@ -474,10 +474,10 @@ var make_reaction_health_pass = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(vo
|
|
|
474
474
|
});
|
|
475
475
|
}
|
|
476
476
|
},
|
|
477
|
-
drain: /* @__PURE__ */
|
|
477
|
+
drain: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, () => findings, "drain")
|
|
478
478
|
};
|
|
479
479
|
}, "make_reaction_health_pass");
|
|
480
|
-
var make_snapshot_drift_pass = /* @__PURE__ */
|
|
480
|
+
var make_snapshot_drift_pass = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (deps, options) => {
|
|
481
481
|
const drift_min = _nullishCoalesce(_optionalChain([options, 'access', _29 => _29.thresholds, 'optionalAccess', _30 => _30.drift_min]), () => ( DEFAULTS.drift_min));
|
|
482
482
|
const candidates = [];
|
|
483
483
|
const findings = [];
|
|
@@ -529,10 +529,10 @@ var make_snapshot_drift_pass = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(voi
|
|
|
529
529
|
});
|
|
530
530
|
}
|
|
531
531
|
},
|
|
532
|
-
drain: /* @__PURE__ */
|
|
532
|
+
drain: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, () => findings, "drain")
|
|
533
533
|
};
|
|
534
534
|
}, "make_snapshot_drift_pass");
|
|
535
|
-
var make_routing_health_pass = /* @__PURE__ */
|
|
535
|
+
var make_routing_health_pass = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (deps) => {
|
|
536
536
|
const findings = [];
|
|
537
537
|
const seen_event_names = /* @__PURE__ */ new Set();
|
|
538
538
|
return {
|
|
@@ -564,10 +564,10 @@ var make_routing_health_pass = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(voi
|
|
|
564
564
|
}
|
|
565
565
|
return Promise.resolve();
|
|
566
566
|
},
|
|
567
|
-
drain: /* @__PURE__ */
|
|
567
|
+
drain: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, () => findings, "drain")
|
|
568
568
|
};
|
|
569
569
|
}, "make_routing_health_pass");
|
|
570
|
-
var make_correlation_gaps_pass = /* @__PURE__ */
|
|
570
|
+
var make_correlation_gaps_pass = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, () => {
|
|
571
571
|
const seen_ids = /* @__PURE__ */ new Set();
|
|
572
572
|
const checks = [];
|
|
573
573
|
return {
|
|
@@ -576,7 +576,7 @@ var make_correlation_gaps_pass = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(v
|
|
|
576
576
|
seen_ids.add(e.id);
|
|
577
577
|
const causation = _optionalChain([e, 'access', _31 => _31.meta, 'optionalAccess', _32 => _32.causation]);
|
|
578
578
|
const parent_id = _optionalChain([causation, 'optionalAccess', _33 => _33.event, 'optionalAccess', _34 => _34.id]);
|
|
579
|
-
if (parent_id !== void 0 && e.name !==
|
|
579
|
+
if (parent_id !== void 0 && e.name !== _chunk253TSECAcjs.TOMBSTONE_EVENT) {
|
|
580
580
|
checks.push({ stream: e.stream, id: e.id, parent_id });
|
|
581
581
|
}
|
|
582
582
|
},
|
|
@@ -596,7 +596,7 @@ var make_correlation_gaps_pass = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(v
|
|
|
596
596
|
}
|
|
597
597
|
};
|
|
598
598
|
}, "make_correlation_gaps_pass");
|
|
599
|
-
var make_clock_anomalies_pass = /* @__PURE__ */
|
|
599
|
+
var make_clock_anomalies_pass = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, () => {
|
|
600
600
|
const findings = [];
|
|
601
601
|
const last_per_stream = /* @__PURE__ */ new Map();
|
|
602
602
|
return {
|
|
@@ -622,14 +622,14 @@ var make_clock_anomalies_pass = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(vo
|
|
|
622
622
|
}
|
|
623
623
|
last_per_stream.set(e.stream, created);
|
|
624
624
|
},
|
|
625
|
-
drain: /* @__PURE__ */
|
|
625
|
+
drain: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, () => findings, "drain")
|
|
626
626
|
};
|
|
627
627
|
}, "make_clock_anomalies_pass");
|
|
628
628
|
function restart_is_supported(deps, head_event_name) {
|
|
629
629
|
const state2 = deps.event_to_state.get(head_event_name);
|
|
630
630
|
return _optionalChain([state2, 'optionalAccess', _35 => _35.snap]) !== void 0;
|
|
631
631
|
}
|
|
632
|
-
|
|
632
|
+
_chunk253TSECAcjs.__name.call(void 0, restart_is_supported, "restart_is_supported");
|
|
633
633
|
function make_unreadable_events_pass() {
|
|
634
634
|
const findings = [];
|
|
635
635
|
return {
|
|
@@ -643,10 +643,10 @@ function make_unreadable_events_pass() {
|
|
|
643
643
|
error
|
|
644
644
|
});
|
|
645
645
|
},
|
|
646
|
-
drain: /* @__PURE__ */
|
|
646
|
+
drain: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, () => findings, "drain")
|
|
647
647
|
};
|
|
648
648
|
}
|
|
649
|
-
|
|
649
|
+
_chunk253TSECAcjs.__name.call(void 0, make_unreadable_events_pass, "make_unreadable_events_pass");
|
|
650
650
|
var PASS_FACTORIES = {
|
|
651
651
|
schema: make_schema_pass,
|
|
652
652
|
"deprecated-load": make_deprecated_load_pass,
|
|
@@ -663,7 +663,7 @@ var PASS_FACTORIES = {
|
|
|
663
663
|
// src/internal/circuit-breaker.ts
|
|
664
664
|
var CircuitBreaker = (_class = class {
|
|
665
665
|
static {
|
|
666
|
-
|
|
666
|
+
_chunk253TSECAcjs.__name.call(void 0, this, "CircuitBreaker");
|
|
667
667
|
}
|
|
668
668
|
__init() {this._failures = 0}
|
|
669
669
|
|
|
@@ -756,7 +756,7 @@ var CircuitBreaker = (_class = class {
|
|
|
756
756
|
|
|
757
757
|
// src/internal/classify.ts
|
|
758
758
|
var ALL_LANES = /* @__PURE__ */ Symbol("act/all-lanes");
|
|
759
|
-
var describe_source = /* @__PURE__ */
|
|
759
|
+
var describe_source = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (source) => source === void 0 ? "no source (every stream)" : `"${source}"`, "describe_source");
|
|
760
760
|
function classify_registry(registry, states) {
|
|
761
761
|
const statics = /* @__PURE__ */ new Map();
|
|
762
762
|
const target_lanes = /* @__PURE__ */ new Map();
|
|
@@ -807,43 +807,43 @@ function classify_registry(registry, states) {
|
|
|
807
807
|
event_to_lanes
|
|
808
808
|
};
|
|
809
809
|
}
|
|
810
|
-
|
|
810
|
+
_chunk253TSECAcjs.__name.call(void 0, classify_registry, "classify_registry");
|
|
811
811
|
|
|
812
812
|
// src/internal/autoclose-policy.ts
|
|
813
813
|
var DAY_MS = 864e5;
|
|
814
814
|
function days_after(date, days) {
|
|
815
815
|
return new Date(date.getTime() + days * DAY_MS);
|
|
816
816
|
}
|
|
817
|
-
|
|
817
|
+
_chunk253TSECAcjs.__name.call(void 0, days_after, "days_after");
|
|
818
818
|
function days_before_now(days) {
|
|
819
819
|
return new Date(Date.now() - days * DAY_MS);
|
|
820
820
|
}
|
|
821
|
-
|
|
821
|
+
_chunk253TSECAcjs.__name.call(void 0, days_before_now, "days_before_now");
|
|
822
822
|
function compile_after(after) {
|
|
823
823
|
return (_stream, head) => days_after(head.created, after.days) <= /* @__PURE__ */ new Date();
|
|
824
824
|
}
|
|
825
|
-
|
|
825
|
+
_chunk253TSECAcjs.__name.call(void 0, compile_after, "compile_after");
|
|
826
826
|
function compile_is(is) {
|
|
827
827
|
const set = new Set(typeof is === "string" ? [is] : is);
|
|
828
828
|
return (_stream, head) => set.has(head.name);
|
|
829
829
|
}
|
|
830
|
-
|
|
830
|
+
_chunk253TSECAcjs.__name.call(void 0, compile_is, "compile_is");
|
|
831
831
|
function compile_reaches(reaches) {
|
|
832
832
|
return (_stream, _head, count) => count >= reaches;
|
|
833
833
|
}
|
|
834
|
-
|
|
834
|
+
_chunk253TSECAcjs.__name.call(void 0, compile_reaches, "compile_reaches");
|
|
835
835
|
function policy_after_windows(options) {
|
|
836
|
-
const parsed =
|
|
836
|
+
const parsed = _chunkEXXHQ7CScjs.check.call(void 0, "autoclose_policy", options);
|
|
837
837
|
return [parsed.after, _optionalChain([parsed, 'access', _42 => _42.or, 'optionalAccess', _43 => _43.after])].flatMap((w) => w ? [w.days] : []);
|
|
838
838
|
}
|
|
839
|
-
|
|
839
|
+
_chunk253TSECAcjs.__name.call(void 0, policy_after_windows, "policy_after_windows");
|
|
840
840
|
function policy_keep_days(options) {
|
|
841
|
-
const parsed =
|
|
841
|
+
const parsed = _chunkEXXHQ7CScjs.check.call(void 0, "autoclose_policy", options);
|
|
842
842
|
return _optionalChain([parsed, 'access', _44 => _44.keep, 'optionalAccess', _45 => _45.days]);
|
|
843
843
|
}
|
|
844
|
-
|
|
844
|
+
_chunk253TSECAcjs.__name.call(void 0, policy_keep_days, "policy_keep_days");
|
|
845
845
|
function compile_autoclose_policy(options) {
|
|
846
|
-
const parsed =
|
|
846
|
+
const parsed = _chunkEXXHQ7CScjs.check.call(void 0, "autoclose_policy", options);
|
|
847
847
|
const and_preds = [];
|
|
848
848
|
if (parsed.after) and_preds.push(compile_after(parsed.after));
|
|
849
849
|
if (parsed.is) and_preds.push(compile_is(parsed.is));
|
|
@@ -864,7 +864,7 @@ function compile_autoclose_policy(options) {
|
|
|
864
864
|
return false;
|
|
865
865
|
};
|
|
866
866
|
}
|
|
867
|
-
|
|
867
|
+
_chunk253TSECAcjs.__name.call(void 0, compile_autoclose_policy, "compile_autoclose_policy");
|
|
868
868
|
|
|
869
869
|
// src/internal/autoclose-window.ts
|
|
870
870
|
function hour_in_zone(now, timeZone) {
|
|
@@ -875,24 +875,24 @@ function hour_in_zone(now, timeZone) {
|
|
|
875
875
|
}).formatToParts(now);
|
|
876
876
|
return Number(_optionalChain([parts, 'access', _46 => _46.find, 'call', _47 => _47((p) => p.type === "hour"), 'optionalAccess', _48 => _48.value]));
|
|
877
877
|
}
|
|
878
|
-
|
|
878
|
+
_chunk253TSECAcjs.__name.call(void 0, hour_in_zone, "hour_in_zone");
|
|
879
879
|
function hour_in_range(hour, start, end) {
|
|
880
880
|
return start < end ? hour >= start && hour < end : hour >= start || hour < end;
|
|
881
881
|
}
|
|
882
|
-
|
|
882
|
+
_chunk253TSECAcjs.__name.call(void 0, hour_in_range, "hour_in_range");
|
|
883
883
|
function is_dst_gap_open(now, timeZone, start) {
|
|
884
884
|
const hour = hour_in_zone(now, timeZone);
|
|
885
885
|
if (hour <= start) return false;
|
|
886
886
|
const prev = hour_in_zone(new Date(now.getTime() - 36e5), timeZone);
|
|
887
887
|
return prev === start - 1 && hour === start + 1;
|
|
888
888
|
}
|
|
889
|
-
|
|
889
|
+
_chunk253TSECAcjs.__name.call(void 0, is_dst_gap_open, "is_dst_gap_open");
|
|
890
890
|
function in_autoclose_window(window, now) {
|
|
891
891
|
if (!window) return true;
|
|
892
892
|
const hour = hour_in_zone(now, window.timeZone);
|
|
893
893
|
return hour_in_range(hour, window.start, window.end) || is_dst_gap_open(now, window.timeZone, window.start);
|
|
894
894
|
}
|
|
895
|
-
|
|
895
|
+
_chunk253TSECAcjs.__name.call(void 0, in_autoclose_window, "in_autoclose_window");
|
|
896
896
|
function next_window_open(window, now) {
|
|
897
897
|
const start_ms = now.getTime();
|
|
898
898
|
for (let h = 0; h <= 48; h++) {
|
|
@@ -907,30 +907,30 @@ function next_window_open(window, now) {
|
|
|
907
907
|
}
|
|
908
908
|
return new Date(start_ms + 864e5);
|
|
909
909
|
}
|
|
910
|
-
|
|
910
|
+
_chunk253TSECAcjs.__name.call(void 0, next_window_open, "next_window_open");
|
|
911
911
|
|
|
912
912
|
// src/internal/defer-config.ts
|
|
913
913
|
function duration_ms(d) {
|
|
914
914
|
return (_nullishCoalesce(d.days, () => ( 0))) * 864e5 + (_nullishCoalesce(d.hours, () => ( 0))) * 36e5 + (_nullishCoalesce(d.minutes, () => ( 0))) * 6e4;
|
|
915
915
|
}
|
|
916
|
-
|
|
916
|
+
_chunk253TSECAcjs.__name.call(void 0, duration_ms, "duration_ms");
|
|
917
917
|
function resolve_defer_at(when, event) {
|
|
918
|
-
const parsed =
|
|
918
|
+
const parsed = _chunkEXXHQ7CScjs.check.call(void 0, "defer", when);
|
|
919
919
|
if (parsed.after) return event.created.getTime() + duration_ms(parsed.after);
|
|
920
920
|
return parsed.at.getTime();
|
|
921
921
|
}
|
|
922
|
-
|
|
922
|
+
_chunk253TSECAcjs.__name.call(void 0, resolve_defer_at, "resolve_defer_at");
|
|
923
923
|
function make_deferred(handler, schedule) {
|
|
924
924
|
const call = handler;
|
|
925
|
-
const deferred = /* @__PURE__ */
|
|
925
|
+
const deferred = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, async (event, stream, app) => {
|
|
926
926
|
const when = typeof schedule === "function" ? schedule(event) : schedule;
|
|
927
|
-
if (Date.now() < resolve_defer_at(when, event)) throw new (0,
|
|
927
|
+
if (Date.now() < resolve_defer_at(when, event)) throw new (0, _chunk253TSECAcjs.DeferSignal)(when);
|
|
928
928
|
return call(event, stream, app);
|
|
929
929
|
}, "deferred");
|
|
930
930
|
Object.defineProperty(deferred, "name", { value: handler.name });
|
|
931
931
|
return deferred;
|
|
932
932
|
}
|
|
933
|
-
|
|
933
|
+
_chunk253TSECAcjs.__name.call(void 0, make_deferred, "make_deferred");
|
|
934
934
|
|
|
935
935
|
// src/internal/drain-cycle.ts
|
|
936
936
|
var _crypto = require('crypto');
|
|
@@ -959,7 +959,7 @@ function compute_backoff_delay(retry, opts) {
|
|
|
959
959
|
if (opts.jitter) delay = delay * (0.5 + Math.random());
|
|
960
960
|
return Math.max(0, Math.floor(delay));
|
|
961
961
|
}
|
|
962
|
-
|
|
962
|
+
_chunk253TSECAcjs.__name.call(void 0, compute_backoff_delay, "compute_backoff_delay");
|
|
963
963
|
|
|
964
964
|
// src/internal/drain-ratio.ts
|
|
965
965
|
var RATIO_MIN = 0.2;
|
|
@@ -978,15 +978,15 @@ function compute_lag_lead_ratio(handled, lagging, leading) {
|
|
|
978
978
|
if (total === 0) return RATIO_DEFAULT;
|
|
979
979
|
return Math.max(RATIO_MIN, Math.min(RATIO_MAX, lagging_avg / total));
|
|
980
980
|
}
|
|
981
|
-
|
|
981
|
+
_chunk253TSECAcjs.__name.call(void 0, compute_lag_lead_ratio, "compute_lag_lead_ratio");
|
|
982
982
|
|
|
983
983
|
// src/internal/report-once.ts
|
|
984
984
|
function report_once(seen, key, message) {
|
|
985
985
|
if (seen.has(key)) return;
|
|
986
986
|
seen.add(key);
|
|
987
|
-
|
|
987
|
+
_chunkEXXHQ7CScjs.log.call(void 0, ).error(new Error(message));
|
|
988
988
|
}
|
|
989
|
-
|
|
989
|
+
_chunk253TSECAcjs.__name.call(void 0, report_once, "report_once");
|
|
990
990
|
|
|
991
991
|
// src/internal/correlation-id.ts
|
|
992
992
|
|
|
@@ -996,8 +996,8 @@ var SEG_SPACE = BASE ** SEG_WIDTH;
|
|
|
996
996
|
function seg(n) {
|
|
997
997
|
return n.toString(BASE).padStart(SEG_WIDTH, "0");
|
|
998
998
|
}
|
|
999
|
-
|
|
1000
|
-
var default_correlator = /* @__PURE__ */
|
|
999
|
+
_chunk253TSECAcjs.__name.call(void 0, seg, "seg");
|
|
1000
|
+
var default_correlator = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, ({ state: state2, action: action2 }) => {
|
|
1001
1001
|
const s = state2.slice(0, SEG_WIDTH).toLowerCase();
|
|
1002
1002
|
const a = action2.slice(0, SEG_WIDTH).toLowerCase();
|
|
1003
1003
|
const ts = seg(Date.now() % SEG_SPACE);
|
|
@@ -1012,17 +1012,17 @@ function close_correlation(correlator, actor) {
|
|
|
1012
1012
|
actor
|
|
1013
1013
|
});
|
|
1014
1014
|
}
|
|
1015
|
-
|
|
1015
|
+
_chunk253TSECAcjs.__name.call(void 0, close_correlation, "close_correlation");
|
|
1016
1016
|
|
|
1017
1017
|
// src/internal/drain-ops.ts
|
|
1018
|
-
var claim = /* @__PURE__ */
|
|
1018
|
+
var claim = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (lagging, leading, by, millis, lane) => _chunkEXXHQ7CScjs.store.call(void 0, ).claim(lagging, leading, by, millis, lane), "claim");
|
|
1019
1019
|
async function fetch(leased, eventLimit) {
|
|
1020
1020
|
return Promise.all(
|
|
1021
1021
|
leased.map(async ({ stream, source, at, lagging }) => {
|
|
1022
1022
|
const events = [];
|
|
1023
|
-
const stream_exact = source !== void 0 &&
|
|
1023
|
+
const stream_exact = source !== void 0 && _chunkXSLQYVIGcjs.isStreamName.call(void 0, source, stream) ? true : void 0;
|
|
1024
1024
|
try {
|
|
1025
|
-
await
|
|
1025
|
+
await _chunkEXXHQ7CScjs.store.call(void 0, ).query((e) => events.push(e), {
|
|
1026
1026
|
stream: source,
|
|
1027
1027
|
stream_exact,
|
|
1028
1028
|
after: at,
|
|
@@ -1042,10 +1042,10 @@ async function fetch(leased, eventLimit) {
|
|
|
1042
1042
|
})
|
|
1043
1043
|
);
|
|
1044
1044
|
}
|
|
1045
|
-
|
|
1046
|
-
var ack = /* @__PURE__ */
|
|
1047
|
-
var block = /* @__PURE__ */
|
|
1048
|
-
var subscribe = /* @__PURE__ */
|
|
1045
|
+
_chunk253TSECAcjs.__name.call(void 0, fetch, "fetch");
|
|
1046
|
+
var ack = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (leases) => _chunkEXXHQ7CScjs.store.call(void 0, ).ack(leases), "ack");
|
|
1047
|
+
var block = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (leases) => _chunkEXXHQ7CScjs.store.call(void 0, ).block(leases), "block");
|
|
1048
|
+
var subscribe = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (streams, correlated_at, correlator) => _chunkEXXHQ7CScjs.store.call(void 0, ).subscribe(streams, correlated_at, correlator), "subscribe");
|
|
1049
1049
|
|
|
1050
1050
|
// src/internal/event-sourcing.ts
|
|
1051
1051
|
var _actpatch = require('@rotorsoft/act-patch');
|
|
@@ -1055,7 +1055,7 @@ var _zod2 = require('zod');
|
|
|
1055
1055
|
|
|
1056
1056
|
|
|
1057
1057
|
// src/internal/zod.ts
|
|
1058
|
-
var def_of = /* @__PURE__ */
|
|
1058
|
+
var def_of = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (schema) => _optionalChain([schema, 'optionalAccess', _50 => _50._zod, 'optionalAccess', _51 => _51.def]), "def_of");
|
|
1059
1059
|
var SINGLE_INNER = [
|
|
1060
1060
|
"optional",
|
|
1061
1061
|
"nullable",
|
|
@@ -1065,7 +1065,7 @@ var SINGLE_INNER = [
|
|
|
1065
1065
|
"readonly",
|
|
1066
1066
|
"catch"
|
|
1067
1067
|
];
|
|
1068
|
-
var inner_of = /* @__PURE__ */
|
|
1068
|
+
var inner_of = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (def) => SINGLE_INNER.includes(def.type) ? def.innerType : void 0, "inner_of");
|
|
1069
1069
|
function wrapped(schema) {
|
|
1070
1070
|
const def = def_of(schema);
|
|
1071
1071
|
if (!def) return [];
|
|
@@ -1074,15 +1074,15 @@ function wrapped(schema) {
|
|
|
1074
1074
|
const inner = inner_of(def);
|
|
1075
1075
|
return inner ? [inner] : [];
|
|
1076
1076
|
}
|
|
1077
|
-
|
|
1077
|
+
_chunk253TSECAcjs.__name.call(void 0, wrapped, "wrapped");
|
|
1078
1078
|
function parts_of(schema) {
|
|
1079
1079
|
const def = def_of(schema);
|
|
1080
1080
|
return _optionalChain([def, 'optionalAccess', _52 => _52.type]) === "intersection" ? [def.left, def.right] : wrapped(schema);
|
|
1081
1081
|
}
|
|
1082
|
-
|
|
1082
|
+
_chunk253TSECAcjs.__name.call(void 0, parts_of, "parts_of");
|
|
1083
1083
|
function some_layer(schema, test) {
|
|
1084
1084
|
const seen = /* @__PURE__ */ new Set();
|
|
1085
|
-
const visit = /* @__PURE__ */
|
|
1085
|
+
const visit = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (s) => {
|
|
1086
1086
|
if (seen.has(s)) return false;
|
|
1087
1087
|
seen.add(s);
|
|
1088
1088
|
const def = def_of(s);
|
|
@@ -1090,7 +1090,7 @@ function some_layer(schema, test) {
|
|
|
1090
1090
|
}, "visit");
|
|
1091
1091
|
return visit(schema);
|
|
1092
1092
|
}
|
|
1093
|
-
|
|
1093
|
+
_chunk253TSECAcjs.__name.call(void 0, some_layer, "some_layer");
|
|
1094
1094
|
function output_of(schema) {
|
|
1095
1095
|
const seen = /* @__PURE__ */ new Set();
|
|
1096
1096
|
let cur = schema;
|
|
@@ -1104,7 +1104,7 @@ function output_of(schema) {
|
|
|
1104
1104
|
}
|
|
1105
1105
|
return cur;
|
|
1106
1106
|
}
|
|
1107
|
-
|
|
1107
|
+
_chunk253TSECAcjs.__name.call(void 0, output_of, "output_of");
|
|
1108
1108
|
|
|
1109
1109
|
// src/internal/date-reviver.ts
|
|
1110
1110
|
function variant_schema(schema, walk) {
|
|
@@ -1122,13 +1122,13 @@ function variant_schema(schema, walk) {
|
|
|
1122
1122
|
}
|
|
1123
1123
|
return { schema: _zod2.z.looseObject(next), dated };
|
|
1124
1124
|
}
|
|
1125
|
-
|
|
1125
|
+
_chunk253TSECAcjs.__name.call(void 0, variant_schema, "variant_schema");
|
|
1126
1126
|
function date_reviver_schema(schema) {
|
|
1127
1127
|
let recursive = false;
|
|
1128
|
-
const pass = /* @__PURE__ */
|
|
1128
|
+
const pass = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (tie) => {
|
|
1129
1129
|
const done = /* @__PURE__ */ new Map();
|
|
1130
1130
|
const active = /* @__PURE__ */ new Set();
|
|
1131
|
-
const walk = /* @__PURE__ */
|
|
1131
|
+
const walk = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (node) => {
|
|
1132
1132
|
if (done.has(node)) return done.get(node);
|
|
1133
1133
|
if (active.has(node)) {
|
|
1134
1134
|
recursive = true;
|
|
@@ -1145,11 +1145,11 @@ function date_reviver_schema(schema) {
|
|
|
1145
1145
|
const first = pass(false);
|
|
1146
1146
|
return first && recursive ? pass(true) : first;
|
|
1147
1147
|
}
|
|
1148
|
-
|
|
1148
|
+
_chunk253TSECAcjs.__name.call(void 0, date_reviver_schema, "date_reviver_schema");
|
|
1149
1149
|
function build(schema, walk) {
|
|
1150
1150
|
const def = def_of(schema);
|
|
1151
1151
|
if (!def) return void 0;
|
|
1152
|
-
const inner = /* @__PURE__ */
|
|
1152
|
+
const inner = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, () => walk(def.innerType), "inner");
|
|
1153
1153
|
switch (def.type) {
|
|
1154
1154
|
case "date":
|
|
1155
1155
|
return _zod2.z.coerce.date();
|
|
@@ -1196,42 +1196,42 @@ function build(schema, walk) {
|
|
|
1196
1196
|
return inner_of(def) ? inner() : void 0;
|
|
1197
1197
|
}
|
|
1198
1198
|
}
|
|
1199
|
-
|
|
1199
|
+
_chunk253TSECAcjs.__name.call(void 0, build, "build");
|
|
1200
1200
|
|
|
1201
1201
|
// src/internal/event-sourcing.ts
|
|
1202
|
-
var bare_patch = /* @__PURE__ */
|
|
1203
|
-
var value_at = /* @__PURE__ */
|
|
1202
|
+
var bare_patch = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (_me, state2, partial) => _actpatch.patch.call(void 0, state2, partial), "bare_patch");
|
|
1203
|
+
var value_at = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (value, path) => path.reduce(
|
|
1204
1204
|
(at, key) => _optionalChain([at, 'optionalAccess', _58 => _58[key]]),
|
|
1205
1205
|
value
|
|
1206
1206
|
), "value_at");
|
|
1207
|
-
var check_invariants = /* @__PURE__ */
|
|
1207
|
+
var check_invariants = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (target, state2, schema, pii_aware) => {
|
|
1208
1208
|
let result;
|
|
1209
1209
|
try {
|
|
1210
1210
|
result = schema.safeParse(state2);
|
|
1211
1211
|
} catch (error) {
|
|
1212
|
-
throw new (0,
|
|
1212
|
+
throw new (0, _chunk253TSECAcjs.ValidationError)(target, state2, error);
|
|
1213
1213
|
}
|
|
1214
1214
|
if (result.success) return;
|
|
1215
1215
|
const issues = pii_aware ? result.error.issues.filter((issue) => {
|
|
1216
1216
|
const value = value_at(state2, issue.path);
|
|
1217
|
-
return value !==
|
|
1217
|
+
return value !== _chunk253TSECAcjs.REDACTED && value !== _chunk253TSECAcjs.SHREDDED;
|
|
1218
1218
|
}) : result.error.issues;
|
|
1219
1219
|
if (issues.length)
|
|
1220
|
-
throw new (0,
|
|
1220
|
+
throw new (0, _chunk253TSECAcjs.ValidationError)(
|
|
1221
1221
|
target,
|
|
1222
1222
|
state2,
|
|
1223
1223
|
_zod2.prettifyError.call(void 0, new (0, _zod2.ZodError)(issues))
|
|
1224
1224
|
);
|
|
1225
1225
|
}, "check_invariants");
|
|
1226
1226
|
var DEFAULT_BATCH = 500;
|
|
1227
|
-
var cache_put = /* @__PURE__ */
|
|
1228
|
-
(err) =>
|
|
1227
|
+
var cache_put = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (stream, entry) => _chunkEXXHQ7CScjs.cache.call(void 0, ).set(stream, entry).catch(
|
|
1228
|
+
(err) => _chunkEXXHQ7CScjs.log.call(void 0, ).warn(
|
|
1229
1229
|
err,
|
|
1230
1230
|
"cache set skipped; the next load re-folds from the store"
|
|
1231
1231
|
)
|
|
1232
1232
|
), "cache_put");
|
|
1233
|
-
var cache_drop = /* @__PURE__ */
|
|
1234
|
-
(err) =>
|
|
1233
|
+
var cache_drop = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (stream) => _chunkEXXHQ7CScjs.cache.call(void 0, ).invalidate(stream).catch(
|
|
1234
|
+
(err) => _chunkEXXHQ7CScjs.log.call(void 0, ).warn(
|
|
1235
1235
|
err,
|
|
1236
1236
|
"cache invalidate skipped; a stale checkpoint re-folds from its event_id"
|
|
1237
1237
|
)
|
|
@@ -1239,11 +1239,11 @@ var cache_drop = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (stream)
|
|
|
1239
1239
|
async function snap(snapshot) {
|
|
1240
1240
|
const { id, stream, name, meta, version } = snapshot.event;
|
|
1241
1241
|
try {
|
|
1242
|
-
const [committed] = await
|
|
1242
|
+
const [committed] = await _chunkEXXHQ7CScjs.store.call(void 0, ).commit(
|
|
1243
1243
|
[
|
|
1244
1244
|
{
|
|
1245
1245
|
stream,
|
|
1246
|
-
msgs: [{ name:
|
|
1246
|
+
msgs: [{ name: _chunk253TSECAcjs.SNAP_EVENT, data: snapshot.state }],
|
|
1247
1247
|
// IMPORTANT! - state events are committed right after the snapshot event
|
|
1248
1248
|
expectedVersion: version
|
|
1249
1249
|
}
|
|
@@ -1256,19 +1256,19 @@ async function snap(snapshot) {
|
|
|
1256
1256
|
return committed;
|
|
1257
1257
|
} catch (error) {
|
|
1258
1258
|
const reason = error instanceof Error ? error.message : String(error);
|
|
1259
|
-
|
|
1259
|
+
_chunkEXXHQ7CScjs.log.call(void 0, ).warn(
|
|
1260
1260
|
`Snapshot write failed on stream "${stream}": ${reason} \u2014 cold starts will replay full history until snapshots succeed.`
|
|
1261
1261
|
);
|
|
1262
1262
|
}
|
|
1263
1263
|
}
|
|
1264
|
-
|
|
1264
|
+
_chunk253TSECAcjs.__name.call(void 0, snap, "snap");
|
|
1265
1265
|
async function tombstone(stream, expectedVersion, correlation) {
|
|
1266
1266
|
try {
|
|
1267
|
-
const [committed] = await
|
|
1267
|
+
const [committed] = await _chunkEXXHQ7CScjs.store.call(void 0, ).commit(
|
|
1268
1268
|
[
|
|
1269
1269
|
{
|
|
1270
1270
|
stream,
|
|
1271
|
-
msgs: [{ name:
|
|
1271
|
+
msgs: [{ name: _chunk253TSECAcjs.TOMBSTONE_EVENT, data: {} }],
|
|
1272
1272
|
expectedVersion
|
|
1273
1273
|
}
|
|
1274
1274
|
],
|
|
@@ -1276,18 +1276,18 @@ async function tombstone(stream, expectedVersion, correlation) {
|
|
|
1276
1276
|
);
|
|
1277
1277
|
return committed;
|
|
1278
1278
|
} catch (error) {
|
|
1279
|
-
if (error instanceof
|
|
1279
|
+
if (error instanceof _chunk253TSECAcjs.ConcurrencyError) return void 0;
|
|
1280
1280
|
throw error;
|
|
1281
1281
|
}
|
|
1282
1282
|
}
|
|
1283
|
-
|
|
1283
|
+
_chunk253TSECAcjs.__name.call(void 0, tombstone, "tombstone");
|
|
1284
1284
|
function is_valid(event) {
|
|
1285
1285
|
if (event.version < 0) return false;
|
|
1286
1286
|
if (!(event.created instanceof Date) || Number.isNaN(event.created.getTime()))
|
|
1287
1287
|
return false;
|
|
1288
1288
|
return true;
|
|
1289
1289
|
}
|
|
1290
|
-
|
|
1290
|
+
_chunk253TSECAcjs.__name.call(void 0, is_valid, "is_valid");
|
|
1291
1291
|
async function scan(source, opts = {}, callback) {
|
|
1292
1292
|
const {
|
|
1293
1293
|
drop_snapshots = false,
|
|
@@ -1315,9 +1315,9 @@ async function scan(source, opts = {}, callback) {
|
|
|
1315
1315
|
if (drop_closed_streams) {
|
|
1316
1316
|
await source.query(
|
|
1317
1317
|
(e) => {
|
|
1318
|
-
if (e.name ===
|
|
1318
|
+
if (e.name === _chunk253TSECAcjs.TOMBSTONE_EVENT) closed_streams.add(e.stream);
|
|
1319
1319
|
},
|
|
1320
|
-
{ names: [
|
|
1320
|
+
{ names: [_chunk253TSECAcjs.TOMBSTONE_EVENT] }
|
|
1321
1321
|
);
|
|
1322
1322
|
}
|
|
1323
1323
|
let max_id;
|
|
@@ -1342,11 +1342,11 @@ async function scan(source, opts = {}, callback) {
|
|
|
1342
1342
|
if (on_progress) on_progress({ processed, id: event.id, max_id });
|
|
1343
1343
|
const has_history = started.has(event.stream);
|
|
1344
1344
|
started.add(event.stream);
|
|
1345
|
-
if (drop_snapshots && event.name ===
|
|
1345
|
+
if (drop_snapshots && event.name === _chunk253TSECAcjs.SNAP_EVENT && has_history) {
|
|
1346
1346
|
dropped_snaps++;
|
|
1347
1347
|
return;
|
|
1348
1348
|
}
|
|
1349
|
-
if (closed_streams.has(event.stream) && event.name !==
|
|
1349
|
+
if (closed_streams.has(event.stream) && event.name !== _chunk253TSECAcjs.TOMBSTONE_EVENT) {
|
|
1350
1350
|
dropped_closed++;
|
|
1351
1351
|
return;
|
|
1352
1352
|
}
|
|
@@ -1419,23 +1419,23 @@ async function scan(source, opts = {}, callback) {
|
|
|
1419
1419
|
}
|
|
1420
1420
|
};
|
|
1421
1421
|
}
|
|
1422
|
-
|
|
1422
|
+
_chunk253TSECAcjs.__name.call(void 0, scan, "scan");
|
|
1423
1423
|
async function load(me, target, callback, patch_fn = bare_patch) {
|
|
1424
1424
|
const { stream, actor, asOf } = target;
|
|
1425
1425
|
const time_travel = !!asOf && Object.values(asOf).some((v) => v !== void 0);
|
|
1426
1426
|
const seeded = time_travel && asOf.limit === void 0 && !asOf.created_after;
|
|
1427
|
-
const cached = time_travel ? void 0 : await
|
|
1427
|
+
const cached = time_travel ? void 0 : await _chunkEXXHQ7CScjs.cache.call(void 0, ).get(stream);
|
|
1428
1428
|
const cache_hit = !!cached;
|
|
1429
1429
|
let state2 = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _67 => _67.state]), () => ( (me.init ? me.init() : {})));
|
|
1430
1430
|
let patches = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _68 => _68.patches]), () => ( 0));
|
|
1431
1431
|
let snaps = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _69 => _69.snaps]), () => ( 0));
|
|
1432
1432
|
let replayed = 0;
|
|
1433
1433
|
let event;
|
|
1434
|
-
await
|
|
1434
|
+
await _chunkEXXHQ7CScjs.store.call(void 0, ).query(
|
|
1435
1435
|
(raw) => {
|
|
1436
|
-
if (seeded && raw.name ===
|
|
1436
|
+
if (seeded && raw.name === _chunk253TSECAcjs.SNAP_EVENT && replayed > 0) return;
|
|
1437
1437
|
event = me.view(raw, actor);
|
|
1438
|
-
if (event.name ===
|
|
1438
|
+
if (event.name === _chunk253TSECAcjs.SNAP_EVENT) {
|
|
1439
1439
|
state2 = event.data;
|
|
1440
1440
|
snaps++;
|
|
1441
1441
|
patches = 0;
|
|
@@ -1444,8 +1444,8 @@ async function load(me, target, callback, patch_fn = bare_patch) {
|
|
|
1444
1444
|
state2 = patch_fn(me, state2, me.patch[event.name](event, state2), event);
|
|
1445
1445
|
patches++;
|
|
1446
1446
|
replayed++;
|
|
1447
|
-
} else if (event.name !==
|
|
1448
|
-
|
|
1447
|
+
} else if (event.name !== _chunk253TSECAcjs.TOMBSTONE_EVENT) {
|
|
1448
|
+
_chunkEXXHQ7CScjs.log.call(void 0, ).warn(
|
|
1449
1449
|
`Skipping unknown event "${String(event.name)}" on stream "${stream}" (id=${event.id}) \u2014 no reducer in state "${me.name}"`
|
|
1450
1450
|
);
|
|
1451
1451
|
}
|
|
@@ -1473,7 +1473,7 @@ async function load(me, target, callback, patch_fn = bare_patch) {
|
|
|
1473
1473
|
) : time_travel ? asOf : { with_snaps: true }
|
|
1474
1474
|
}
|
|
1475
1475
|
);
|
|
1476
|
-
const head_is_tombstone = _optionalChain([event, 'optionalAccess', _71 => _71.name]) ===
|
|
1476
|
+
const head_is_tombstone = _optionalChain([event, 'optionalAccess', _71 => _71.name]) === _chunk253TSECAcjs.TOMBSTONE_EVENT;
|
|
1477
1477
|
if (replayed > 0 && !time_travel && event && !me.pii_aware && !head_is_tombstone) {
|
|
1478
1478
|
await cache_put(stream, {
|
|
1479
1479
|
stream,
|
|
@@ -1496,7 +1496,7 @@ async function load(me, target, callback, patch_fn = bare_patch) {
|
|
|
1496
1496
|
replayed
|
|
1497
1497
|
};
|
|
1498
1498
|
}
|
|
1499
|
-
|
|
1499
|
+
_chunk253TSECAcjs.__name.call(void 0, load, "load");
|
|
1500
1500
|
async function load_others(loads, payload, own, actor, patch_fn, refuse) {
|
|
1501
1501
|
const streams = loads.map((l) => l.target(payload, own.state));
|
|
1502
1502
|
streams.forEach((stream, i) => {
|
|
@@ -1517,8 +1517,8 @@ async function load_others(loads, payload, own, actor, patch_fn, refuse) {
|
|
|
1517
1517
|
void 0,
|
|
1518
1518
|
patch_fn
|
|
1519
1519
|
);
|
|
1520
|
-
if (_optionalChain([snapshot, 'access', _76 => _76.event, 'optionalAccess', _77 => _77.name]) ===
|
|
1521
|
-
throw new (0,
|
|
1520
|
+
if (_optionalChain([snapshot, 'access', _76 => _76.event, 'optionalAccess', _77 => _77.name]) === _chunk253TSECAcjs.TOMBSTONE_EVENT)
|
|
1521
|
+
throw new (0, _chunk253TSECAcjs.StreamClosedError)(stream);
|
|
1522
1522
|
return {
|
|
1523
1523
|
state: l.state,
|
|
1524
1524
|
stream,
|
|
@@ -1529,13 +1529,13 @@ async function load_others(loads, payload, own, actor, patch_fn, refuse) {
|
|
|
1529
1529
|
})
|
|
1530
1530
|
);
|
|
1531
1531
|
}
|
|
1532
|
-
|
|
1532
|
+
_chunk253TSECAcjs.__name.call(void 0, load_others, "load_others");
|
|
1533
1533
|
async function action(me, action2, target, payload, options, patch_fn = bare_patch) {
|
|
1534
1534
|
const { stream, expectedVersion, actor } = target;
|
|
1535
1535
|
if (!stream) throw new Error("Missing target stream");
|
|
1536
1536
|
const reactingTo = _optionalChain([options, 'optionalAccess', _78 => _78.reactingTo]);
|
|
1537
1537
|
const correlator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _79 => _79.correlator]), () => ( default_correlator));
|
|
1538
|
-
const validated =
|
|
1538
|
+
const validated = _chunkEXXHQ7CScjs.validate.call(void 0, action2, payload, me.actions[action2]);
|
|
1539
1539
|
const opts = _optionalChain([me, 'access', _80 => _80.options, 'optionalAccess', _81 => _81[action2]]);
|
|
1540
1540
|
const max_retries = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _82 => _82.maxRetries]), () => ( 0));
|
|
1541
1541
|
const loads = _nullishCoalesce(_optionalChain([me, 'access', _83 => _83.loads, 'optionalAccess', _84 => _84[action2]]), () => ( []));
|
|
@@ -1547,8 +1547,8 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1547
1547
|
void 0,
|
|
1548
1548
|
patch_fn
|
|
1549
1549
|
);
|
|
1550
|
-
if (_optionalChain([snapshot, 'access', _85 => _85.event, 'optionalAccess', _86 => _86.name]) ===
|
|
1551
|
-
throw new (0,
|
|
1550
|
+
if (_optionalChain([snapshot, 'access', _85 => _85.event, 'optionalAccess', _86 => _86.name]) === _chunk253TSECAcjs.TOMBSTONE_EVENT)
|
|
1551
|
+
throw new (0, _chunk253TSECAcjs.StreamClosedError)(stream);
|
|
1552
1552
|
const own = {
|
|
1553
1553
|
state: me,
|
|
1554
1554
|
stream,
|
|
@@ -1562,7 +1562,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1562
1562
|
{ stream, state: snapshot.state },
|
|
1563
1563
|
target.actor,
|
|
1564
1564
|
patch_fn,
|
|
1565
|
-
(description) => new (0,
|
|
1565
|
+
(description) => new (0, _chunk253TSECAcjs.PreconditionError)(
|
|
1566
1566
|
action2,
|
|
1567
1567
|
validated,
|
|
1568
1568
|
target,
|
|
@@ -1575,7 +1575,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1575
1575
|
);
|
|
1576
1576
|
for (const { holds, description } of _nullishCoalesce(_optionalChain([me, 'access', _89 => _89.requires, 'optionalAccess', _90 => _90[action2]]), () => ( [])))
|
|
1577
1577
|
if (!holds(validated, snapshot.state, actor, loaded))
|
|
1578
|
-
throw new (0,
|
|
1578
|
+
throw new (0, _chunk253TSECAcjs.PreconditionError)(
|
|
1579
1579
|
action2,
|
|
1580
1580
|
validated,
|
|
1581
1581
|
target,
|
|
@@ -1597,7 +1597,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1597
1597
|
);
|
|
1598
1598
|
to.events.push({
|
|
1599
1599
|
name: event,
|
|
1600
|
-
data:
|
|
1600
|
+
data: _chunkEXXHQ7CScjs.validate.call(void 0, event, data, to.state.events[event])
|
|
1601
1601
|
});
|
|
1602
1602
|
}
|
|
1603
1603
|
if (!own.events.length)
|
|
@@ -1654,7 +1654,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1654
1654
|
});
|
|
1655
1655
|
let committed;
|
|
1656
1656
|
try {
|
|
1657
|
-
committed = await
|
|
1657
|
+
committed = await _chunkEXXHQ7CScjs.store.call(void 0, ).commit(
|
|
1658
1658
|
appends.map((p) => ({
|
|
1659
1659
|
stream: p.stream,
|
|
1660
1660
|
msgs: p.events.map((e) => p.state.message(e)),
|
|
@@ -1663,7 +1663,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1663
1663
|
meta
|
|
1664
1664
|
);
|
|
1665
1665
|
} catch (error) {
|
|
1666
|
-
if (error instanceof
|
|
1666
|
+
if (error instanceof _chunk253TSECAcjs.ConcurrencyError) void cache_drop(error.stream);
|
|
1667
1667
|
throw error;
|
|
1668
1668
|
}
|
|
1669
1669
|
let row = 0;
|
|
@@ -1705,20 +1705,20 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
|
|
|
1705
1705
|
}
|
|
1706
1706
|
return snapshots;
|
|
1707
1707
|
} catch (error) {
|
|
1708
|
-
if (!(error instanceof
|
|
1708
|
+
if (!(error instanceof _chunk253TSECAcjs.ConcurrencyError)) throw error;
|
|
1709
1709
|
if (expectedVersion !== void 0 && error.stream === stream) throw error;
|
|
1710
1710
|
if (attempt >= max_retries) throw error;
|
|
1711
1711
|
if (_optionalChain([opts, 'optionalAccess', _99 => _99.backoff])) {
|
|
1712
1712
|
const delay_ms = compute_backoff_delay(attempt, opts.backoff);
|
|
1713
|
-
if (delay_ms > 0) await
|
|
1713
|
+
if (delay_ms > 0) await _chunkEXXHQ7CScjs.sleep.call(void 0, delay_ms);
|
|
1714
1714
|
}
|
|
1715
1715
|
}
|
|
1716
1716
|
}
|
|
1717
1717
|
}
|
|
1718
|
-
|
|
1718
|
+
_chunk253TSECAcjs.__name.call(void 0, action, "action");
|
|
1719
1719
|
|
|
1720
1720
|
// src/internal/tracing.ts
|
|
1721
|
-
var PRETTY =
|
|
1721
|
+
var PRETTY = _chunkEXXHQ7CScjs.config.call(void 0, ).env !== "production";
|
|
1722
1722
|
var C_BLUE = "\x1B[38;5;39m";
|
|
1723
1723
|
var C_ORANGE = "\x1B[38;5;208m";
|
|
1724
1724
|
var C_GREEN = "\x1B[38;5;42m";
|
|
@@ -1727,14 +1727,14 @@ var C_DRAIN = "\x1B[38;5;244m";
|
|
|
1727
1727
|
var C_HIT = "\x1B[38;5;82m";
|
|
1728
1728
|
var C_MISS = "\x1B[38;5;220m";
|
|
1729
1729
|
var C_RESET = "\x1B[0m";
|
|
1730
|
-
var es_caption = /* @__PURE__ */
|
|
1730
|
+
var es_caption = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (caption, color, body) => PRETTY ? `${color}${body}${C_RESET}` : `${caption}: ${body}`, "es_caption");
|
|
1731
1731
|
var C_LANE = "\x1B[38;5;183m";
|
|
1732
1732
|
var C_DIM = "\x1B[38;5;240m";
|
|
1733
1733
|
var C_ERR = "\x1B[38;5;196m";
|
|
1734
1734
|
var C_STREAM = "\x1B[38;5;226m";
|
|
1735
|
-
var dim = /* @__PURE__ */
|
|
1736
|
-
var hue = /* @__PURE__ */
|
|
1737
|
-
var drain_caption = /* @__PURE__ */
|
|
1735
|
+
var dim = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (text) => PRETTY ? `${C_DIM}${text}${C_RESET}` : text, "dim");
|
|
1736
|
+
var hue = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (color, text) => PRETTY ? `${color}${text}${C_RESET}` : text, "hue");
|
|
1737
|
+
var drain_caption = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (caption, lane) => {
|
|
1738
1738
|
const show_lane = lane && lane !== "default";
|
|
1739
1739
|
if (PRETTY) {
|
|
1740
1740
|
const tag = `${C_DRAIN}>> ${caption}${C_RESET}`;
|
|
@@ -1742,17 +1742,17 @@ var drain_caption = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (capti
|
|
|
1742
1742
|
}
|
|
1743
1743
|
return show_lane ? `>> ${caption} ${lane}` : `>> ${caption}`;
|
|
1744
1744
|
}, "drain_caption");
|
|
1745
|
-
var cache_marker = /* @__PURE__ */
|
|
1745
|
+
var cache_marker = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (hit) => {
|
|
1746
1746
|
const word = hit ? "hit" : "miss";
|
|
1747
1747
|
if (!PRETTY) return word;
|
|
1748
1748
|
return `${hit ? C_HIT : C_MISS}${word}${C_RESET}${C_GREEN}`;
|
|
1749
1749
|
}, "cache_marker");
|
|
1750
|
-
var stats_marker = /* @__PURE__ */
|
|
1750
|
+
var stats_marker = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (version, replayed, snaps, patches) => {
|
|
1751
1751
|
const text = `v=${version} replayed=${replayed} snaps=${snaps} patches=${patches}`;
|
|
1752
1752
|
if (!PRETTY) return text;
|
|
1753
1753
|
return `${C_DRAIN}${text}${C_RESET}${C_GREEN}`;
|
|
1754
1754
|
}, "stats_marker");
|
|
1755
|
-
var as_of_marker = /* @__PURE__ */
|
|
1755
|
+
var as_of_marker = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (asOf) => {
|
|
1756
1756
|
if (!asOf) return "";
|
|
1757
1757
|
const parts = [];
|
|
1758
1758
|
if (asOf.before !== void 0) parts.push(`before=${asOf.before}`);
|
|
@@ -1763,14 +1763,14 @@ var as_of_marker = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (asOf)
|
|
|
1763
1763
|
if (asOf.limit !== void 0) parts.push(`limit=${asOf.limit}`);
|
|
1764
1764
|
return parts.length ? ` (as-of ${parts.join(" ")})` : " (as-of)";
|
|
1765
1765
|
}, "as_of_marker");
|
|
1766
|
-
var traced = /* @__PURE__ */
|
|
1766
|
+
var traced = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (inner, exit, entry) => (async (...args) => {
|
|
1767
1767
|
_optionalChain([entry, 'optionalCall', _100 => _100(...args)]);
|
|
1768
1768
|
const result = await inner(...args);
|
|
1769
1769
|
_optionalChain([exit, 'optionalCall', _101 => _101(result, ...args)]);
|
|
1770
1770
|
return result;
|
|
1771
1771
|
}), "traced");
|
|
1772
1772
|
function build_es(logger, correlator = default_correlator, patch_fn = bare_patch) {
|
|
1773
|
-
const bound_action = /* @__PURE__ */
|
|
1773
|
+
const bound_action = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (me, action_name, target, payload, options) => action(
|
|
1774
1774
|
me,
|
|
1775
1775
|
action_name,
|
|
1776
1776
|
target,
|
|
@@ -1778,7 +1778,7 @@ function build_es(logger, correlator = default_correlator, patch_fn = bare_patch
|
|
|
1778
1778
|
{ ...options, correlator: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _102 => _102.correlator]), () => ( correlator)) },
|
|
1779
1779
|
patch_fn
|
|
1780
1780
|
), "bound_action");
|
|
1781
|
-
const bound_load = /* @__PURE__ */
|
|
1781
|
+
const bound_load = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (me, target, callback) => load(me, target, callback, patch_fn), "bound_load");
|
|
1782
1782
|
if (logger.level !== "trace") {
|
|
1783
1783
|
return {
|
|
1784
1784
|
snap,
|
|
@@ -1840,7 +1840,7 @@ function build_es(logger, correlator = default_correlator, patch_fn = bare_patch
|
|
|
1840
1840
|
})
|
|
1841
1841
|
};
|
|
1842
1842
|
}
|
|
1843
|
-
|
|
1843
|
+
_chunk253TSECAcjs.__name.call(void 0, build_es, "build_es");
|
|
1844
1844
|
function build_drain(logger) {
|
|
1845
1845
|
return {
|
|
1846
1846
|
claim,
|
|
@@ -1860,7 +1860,7 @@ function build_drain(logger) {
|
|
|
1860
1860
|
})
|
|
1861
1861
|
};
|
|
1862
1862
|
}
|
|
1863
|
-
|
|
1863
|
+
_chunk253TSECAcjs.__name.call(void 0, build_drain, "build_drain");
|
|
1864
1864
|
function trace_cycle(logger, leased, fetched, handled, acked, blocked) {
|
|
1865
1865
|
if (logger.level !== "trace" || !leased.length) return;
|
|
1866
1866
|
const lane = _optionalChain([leased, 'access', _105 => _105[0], 'optionalAccess', _106 => _106.lane]);
|
|
@@ -1898,17 +1898,17 @@ function trace_cycle(logger, leased, fetched, handled, acked, blocked) {
|
|
|
1898
1898
|
}).join(", ");
|
|
1899
1899
|
logger.trace(`${drain_caption("drained", lane)} ${detail}`);
|
|
1900
1900
|
}
|
|
1901
|
-
|
|
1901
|
+
_chunk253TSECAcjs.__name.call(void 0, trace_cycle, "trace_cycle");
|
|
1902
1902
|
|
|
1903
1903
|
// src/internal/drain-cycle.ts
|
|
1904
1904
|
function budget_exhausted(lease, options, store_failing) {
|
|
1905
1905
|
if (store_failing || !_optionalChain([options, 'optionalAccess', _110 => _110.blockOnError]) || lease.retry <= options.maxRetries)
|
|
1906
1906
|
return void 0;
|
|
1907
1907
|
const error = `Blocking ${lease.stream} after ${lease.retry} claims with no acknowledged progress \u2014 the retry budget (${options.maxRetries}) was spent without the handler ever reporting an error. That means every attempt lost its lease before it could ack: move the reaction to a lane whose leaseMillis covers the handler, then unblock the stream.`;
|
|
1908
|
-
|
|
1908
|
+
_chunkEXXHQ7CScjs.log.call(void 0, ).error(error);
|
|
1909
1909
|
return { lease, handled: 0, acked_at: lease.at, error, block: true };
|
|
1910
1910
|
}
|
|
1911
|
-
|
|
1911
|
+
_chunk253TSECAcjs.__name.call(void 0, budget_exhausted, "budget_exhausted");
|
|
1912
1912
|
function fetch_failure_policy(registry) {
|
|
1913
1913
|
let blockOnError = true;
|
|
1914
1914
|
let maxRetries = 0;
|
|
@@ -1919,17 +1919,17 @@ function fetch_failure_policy(registry) {
|
|
|
1919
1919
|
}
|
|
1920
1920
|
return { blockOnError, maxRetries };
|
|
1921
1921
|
}
|
|
1922
|
-
|
|
1922
|
+
_chunk253TSECAcjs.__name.call(void 0, fetch_failure_policy, "fetch_failure_policy");
|
|
1923
1923
|
function finalize(lease, handled, at, error, options, logger, failed_at) {
|
|
1924
1924
|
if (!error) return { lease, handled, acked_at: at };
|
|
1925
1925
|
logger.error(error);
|
|
1926
|
-
const non_retryable = error instanceof
|
|
1926
|
+
const non_retryable = error instanceof _chunk253TSECAcjs.NonRetryableError;
|
|
1927
1927
|
const block2 = options.blockOnError && (non_retryable || lease.retry >= options.maxRetries);
|
|
1928
1928
|
if (block2)
|
|
1929
1929
|
logger.error(
|
|
1930
1930
|
non_retryable ? `Blocking ${lease.stream} on non-retryable error.` : `Blocking ${lease.stream} after ${lease.retry} retries.`
|
|
1931
1931
|
);
|
|
1932
|
-
const next_attempt_at = block2 ? void 0 : Date.now() + compute_backoff_delay(lease.retry, _nullishCoalesce(options.backoff, () => (
|
|
1932
|
+
const next_attempt_at = block2 ? void 0 : Date.now() + compute_backoff_delay(lease.retry, _nullishCoalesce(options.backoff, () => ( _chunkEXXHQ7CScjs.DEFAULT_BACKOFF)));
|
|
1933
1933
|
return {
|
|
1934
1934
|
lease,
|
|
1935
1935
|
handled,
|
|
@@ -1940,7 +1940,7 @@ function finalize(lease, handled, at, error, options, logger, failed_at) {
|
|
|
1940
1940
|
failed_at
|
|
1941
1941
|
};
|
|
1942
1942
|
}
|
|
1943
|
-
|
|
1943
|
+
_chunk253TSECAcjs.__name.call(void 0, finalize, "finalize");
|
|
1944
1944
|
function warn_misrouted(seen, stream, handler, event) {
|
|
1945
1945
|
report_once(
|
|
1946
1946
|
seen,
|
|
@@ -1948,7 +1948,7 @@ function warn_misrouted(seen, stream, handler, event) {
|
|
|
1948
1948
|
`Reaction "${handler}" on "${event}" resolved to target "${stream}", which a projection already serves. A target is served by one batch handler or one state projection, so this reaction can never run \u2014 and delivering to it would hand the projection an aggregate from another stream. Skipping it. The equivalent static \`.to({ target })\` is rejected at build; a dynamic resolver's target is only knowable here.`
|
|
1949
1949
|
);
|
|
1950
1950
|
}
|
|
1951
|
-
|
|
1951
|
+
_chunk253TSECAcjs.__name.call(void 0, warn_misrouted, "warn_misrouted");
|
|
1952
1952
|
async function run_drain_cycle(deps, cycle) {
|
|
1953
1953
|
const { ops, registry, batch_handlers, handle, handle_batch, lane } = deps;
|
|
1954
1954
|
const {
|
|
@@ -2059,13 +2059,13 @@ async function run_drain_cycle(deps, cycle) {
|
|
|
2059
2059
|
const acked = submitted.length ? await ops.ack(submitted) : [];
|
|
2060
2060
|
const expected = submitted.filter((l) => l.due === void 0).length;
|
|
2061
2061
|
if (acked.length < expected)
|
|
2062
|
-
|
|
2062
|
+
_chunkEXXHQ7CScjs.log.call(void 0, ).warn(
|
|
2063
2063
|
`drain: ${expected - acked.length} of ${expected} acks were dropped \u2014 the lease was taken by another worker mid-handler. That work will be redelivered (at-least-once), but persistent drops mean leaseMillis is too short for this handler.`
|
|
2064
2064
|
);
|
|
2065
2065
|
const closeable = handled.filter((h) => h.close !== void 0).map((h) => h.close);
|
|
2066
2066
|
return { leased, fetched, handled, acked, blocked, closeable };
|
|
2067
2067
|
}
|
|
2068
|
-
|
|
2068
|
+
_chunk253TSECAcjs.__name.call(void 0, run_drain_cycle, "run_drain_cycle");
|
|
2069
2069
|
var EMPTY_DRAIN = {
|
|
2070
2070
|
fetched: [],
|
|
2071
2071
|
leased: [],
|
|
@@ -2080,11 +2080,11 @@ function merge_drains(drains) {
|
|
|
2080
2080
|
blocked: drains.flatMap((d) => d.blocked)
|
|
2081
2081
|
};
|
|
2082
2082
|
}
|
|
2083
|
-
|
|
2083
|
+
_chunk253TSECAcjs.__name.call(void 0, merge_drains, "merge_drains");
|
|
2084
2084
|
var RETRY = "";
|
|
2085
2085
|
var DrainController = (_class2 = class {
|
|
2086
2086
|
static {
|
|
2087
|
-
|
|
2087
|
+
_chunk253TSECAcjs.__name.call(void 0, this, "DrainController");
|
|
2088
2088
|
}
|
|
2089
2089
|
// Armed while `_raised` is ahead of `_lowered` (the raise count the last
|
|
2090
2090
|
// empty claim saw), so a claim never lowers over a raise that landed
|
|
@@ -2097,7 +2097,7 @@ var DrainController = (_class2 = class {
|
|
|
2097
2097
|
// itself is persisted. On an idle app nothing else would drain it. It
|
|
2098
2098
|
// drains until a pass leases nothing or the controller stops, and an entry
|
|
2099
2099
|
// stays until handled or until a later pass claims nothing.
|
|
2100
|
-
__init5() {this._defer = new (0,
|
|
2100
|
+
__init5() {this._defer = new (0, _chunkEXXHQ7CScjs.DeferTimer)(() => {
|
|
2101
2101
|
this.arm();
|
|
2102
2102
|
void this._deps.run_scoped(async () => {
|
|
2103
2103
|
while ((await this.drain()).leased.length > 0) ;
|
|
@@ -2139,7 +2139,7 @@ var DrainController = (_class2 = class {
|
|
|
2139
2139
|
*/
|
|
2140
2140
|
start(cycleMs) {
|
|
2141
2141
|
const run = this._deps.run_scoped;
|
|
2142
|
-
const tick = /* @__PURE__ */
|
|
2142
|
+
const tick = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, async () => {
|
|
2143
2143
|
if (this.armed) await run(() => this.drain());
|
|
2144
2144
|
if (this._stopped) return;
|
|
2145
2145
|
this._worker = setTimeout(tick, cycleMs);
|
|
@@ -2160,9 +2160,9 @@ var DrainController = (_class2 = class {
|
|
|
2160
2160
|
if (!this.armed || this._stopped || this._inflight)
|
|
2161
2161
|
return EMPTY_DRAIN;
|
|
2162
2162
|
const d = _nullishCoalesce(this._deps.defaults, () => ( {}));
|
|
2163
|
-
const streamLimit = _nullishCoalesce(_nullishCoalesce(d.streamLimit, () => ( options.streamLimit)), () => (
|
|
2164
|
-
const eventLimit = _nullishCoalesce(options.eventLimit, () => (
|
|
2165
|
-
const leaseMillis = _nullishCoalesce(_nullishCoalesce(d.leaseMillis, () => ( options.leaseMillis)), () => (
|
|
2163
|
+
const streamLimit = _nullishCoalesce(_nullishCoalesce(d.streamLimit, () => ( options.streamLimit)), () => ( _chunkEXXHQ7CScjs.DEFAULT_STREAM_LIMIT));
|
|
2164
|
+
const eventLimit = _nullishCoalesce(options.eventLimit, () => ( _chunkEXXHQ7CScjs.DEFAULT_EVENT_LIMIT));
|
|
2165
|
+
const leaseMillis = _nullishCoalesce(_nullishCoalesce(d.leaseMillis, () => ( options.leaseMillis)), () => ( _chunkEXXHQ7CScjs.DEFAULT_LEASE_MILLIS));
|
|
2166
2166
|
if (this._deps.breaker.state(Date.now()) === "open")
|
|
2167
2167
|
return EMPTY_DRAIN;
|
|
2168
2168
|
const pass = this._pass(streamLimit, eventLimit, leaseMillis).finally(
|
|
@@ -2223,7 +2223,7 @@ var DrainController = (_class2 = class {
|
|
|
2223
2223
|
// src/internal/reaction-dispatch.ts
|
|
2224
2224
|
var CloseSignal = class extends Error {
|
|
2225
2225
|
static {
|
|
2226
|
-
|
|
2226
|
+
_chunk253TSECAcjs.__name.call(void 0, this, "CloseSignal");
|
|
2227
2227
|
}
|
|
2228
2228
|
/**
|
|
2229
2229
|
* Stream to close. Omitted → the reaction's own lease stream (a self-close).
|
|
@@ -2291,7 +2291,7 @@ function build_handle(deps) {
|
|
|
2291
2291
|
handled++;
|
|
2292
2292
|
}
|
|
2293
2293
|
} catch (error) {
|
|
2294
|
-
if (error instanceof
|
|
2294
|
+
if (error instanceof _chunk253TSECAcjs.DeferSignal) {
|
|
2295
2295
|
let defer;
|
|
2296
2296
|
try {
|
|
2297
2297
|
defer = resolve_defer_at(error.when, event);
|
|
@@ -2340,7 +2340,7 @@ function build_handle(deps) {
|
|
|
2340
2340
|
return finalize(lease, handled, at, void 0, payloads[0].options, logger);
|
|
2341
2341
|
};
|
|
2342
2342
|
}
|
|
2343
|
-
|
|
2343
|
+
_chunk253TSECAcjs.__name.call(void 0, build_handle, "build_handle");
|
|
2344
2344
|
function build_handle_batch(logger) {
|
|
2345
2345
|
return async (lease, payloads, batchHandler) => {
|
|
2346
2346
|
const stream = lease.stream;
|
|
@@ -2369,7 +2369,7 @@ function build_handle_batch(logger) {
|
|
|
2369
2369
|
}
|
|
2370
2370
|
};
|
|
2371
2371
|
}
|
|
2372
|
-
|
|
2372
|
+
_chunk253TSECAcjs.__name.call(void 0, build_handle_batch, "build_handle_batch");
|
|
2373
2373
|
|
|
2374
2374
|
// src/internal/autoclose-reaction.ts
|
|
2375
2375
|
var AUTOCLOSE_TARGET_PREFIX = "__autoclose__:";
|
|
@@ -2390,22 +2390,22 @@ function synthesize_autoclose_reactions(registry, states, read_window) {
|
|
|
2390
2390
|
// An anchored stream name would read as a pattern, and a store may refuse
|
|
2391
2391
|
// it at subscribe, stopping every reaction. Such a stream has no
|
|
2392
2392
|
// autoclose: `app.close` still closes it.
|
|
2393
|
-
resolver: /* @__PURE__ */
|
|
2393
|
+
resolver: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (e) => _chunkXSLQYVIGcjs.isStreamName.call(void 0, e.stream) ? {
|
|
2394
2394
|
target: `${AUTOCLOSE_TARGET_PREFIX}${e.stream}`,
|
|
2395
2395
|
source: e.stream
|
|
2396
2396
|
} : void 0, "resolver"),
|
|
2397
2397
|
// Never block on autoclose: a transient query/store error should retry,
|
|
2398
2398
|
// not quarantine the synthetic stream.
|
|
2399
|
-
options: { blockOnError: false, maxRetries:
|
|
2400
|
-
handler: /* @__PURE__ */
|
|
2399
|
+
options: { blockOnError: false, maxRetries: _chunkEXXHQ7CScjs.DEFAULT_MAX_RETRIES },
|
|
2400
|
+
handler: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, async (event) => {
|
|
2401
2401
|
const aggregate = event.stream;
|
|
2402
2402
|
const window = read_window();
|
|
2403
2403
|
if (!in_autoclose_window(window, /* @__PURE__ */ new Date()))
|
|
2404
|
-
throw new (0,
|
|
2405
|
-
const stats = await
|
|
2404
|
+
throw new (0, _chunk253TSECAcjs.DeferSignal)({ at: next_window_open(window, /* @__PURE__ */ new Date()) });
|
|
2405
|
+
const stats = await _chunkEXXHQ7CScjs.store.call(void 0, ).query_stats([aggregate], {
|
|
2406
2406
|
count: true,
|
|
2407
2407
|
tail: keep_days !== void 0 ? true : void 0,
|
|
2408
|
-
exclude: [
|
|
2408
|
+
exclude: [_chunk253TSECAcjs.TOMBSTONE_EVENT, _chunk253TSECAcjs.SNAP_EVENT]
|
|
2409
2409
|
});
|
|
2410
2410
|
const entry = stats.get(aggregate);
|
|
2411
2411
|
if (!entry) return;
|
|
@@ -2443,7 +2443,7 @@ function synthesize_autoclose_reactions(registry, states, read_window) {
|
|
|
2443
2443
|
dues.push(days_after(entry.tail.created, keep_days));
|
|
2444
2444
|
const future = dues.map((d) => d.getTime()).filter((t) => t > Date.now());
|
|
2445
2445
|
if (future.length)
|
|
2446
|
-
throw new (0,
|
|
2446
|
+
throw new (0, _chunk253TSECAcjs.DeferSignal)({ at: new Date(Math.min(...future)) });
|
|
2447
2447
|
}, "handler")
|
|
2448
2448
|
};
|
|
2449
2449
|
const key = `__autoclose_${st.name}`;
|
|
@@ -2455,7 +2455,7 @@ function synthesize_autoclose_reactions(registry, states, read_window) {
|
|
|
2455
2455
|
}
|
|
2456
2456
|
}
|
|
2457
2457
|
}
|
|
2458
|
-
|
|
2458
|
+
_chunk253TSECAcjs.__name.call(void 0, synthesize_autoclose_reactions, "synthesize_autoclose_reactions");
|
|
2459
2459
|
|
|
2460
2460
|
// src/internal/close-cycle.ts
|
|
2461
2461
|
var CLOSE_CATCH_UP_LIMIT = 1e3;
|
|
@@ -2469,10 +2469,10 @@ async function catch_up_correlation(cursor, correlate, until) {
|
|
|
2469
2469
|
}
|
|
2470
2470
|
return cursor.checkpoint;
|
|
2471
2471
|
}
|
|
2472
|
-
|
|
2472
|
+
_chunk253TSECAcjs.__name.call(void 0, catch_up_correlation, "catch_up_correlation");
|
|
2473
2473
|
var CloseLock = (_class3 = class {constructor() { _class3.prototype.__init8.call(this); }
|
|
2474
2474
|
static {
|
|
2475
|
-
|
|
2475
|
+
_chunk253TSECAcjs.__name.call(void 0, this, "CloseLock");
|
|
2476
2476
|
}
|
|
2477
2477
|
__init8() {this._tails = /* @__PURE__ */ new Map()}
|
|
2478
2478
|
/** Run `work` after every earlier close of `stream` has settled. */
|
|
@@ -2480,7 +2480,7 @@ var CloseLock = (_class3 = class {constructor() { _class3.prototype.__init8.call
|
|
|
2480
2480
|
const prev = _nullishCoalesce(this._tails.get(stream), () => ( Promise.resolve()));
|
|
2481
2481
|
const next = prev.then(work, work);
|
|
2482
2482
|
this._tails.set(stream, next);
|
|
2483
|
-
const cleanup = /* @__PURE__ */
|
|
2483
|
+
const cleanup = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, () => {
|
|
2484
2484
|
if (this._tails.get(stream) === next) this._tails.delete(stream);
|
|
2485
2485
|
}, "cleanup");
|
|
2486
2486
|
next.then(cleanup, cleanup);
|
|
@@ -2508,12 +2508,12 @@ async function run_close_cycle(targets, deps) {
|
|
|
2508
2508
|
deps,
|
|
2509
2509
|
() => run_full_closes(full, target_map, deps, skipped)
|
|
2510
2510
|
);
|
|
2511
|
-
const retired = [...truncated.entries()].filter(([, r]) => r.committed.name ===
|
|
2511
|
+
const retired = [...truncated.entries()].filter(([, r]) => r.committed.name === _chunk253TSECAcjs.TOMBSTONE_EVENT).map(([stream]) => stream);
|
|
2512
2512
|
if (retired.length) _optionalChain([deps, 'access', _137 => _137.forget_subscribed, 'optionalCall', _138 => _138(retired)]);
|
|
2513
2513
|
for (const [stream, entry] of windowed_result) truncated.set(stream, entry);
|
|
2514
2514
|
return { truncated, skipped };
|
|
2515
2515
|
}
|
|
2516
|
-
|
|
2516
|
+
_chunk253TSECAcjs.__name.call(void 0, run_close_cycle, "run_close_cycle");
|
|
2517
2517
|
function with_stream_locks(streams, deps, work) {
|
|
2518
2518
|
const with_lock = _nullishCoalesce(deps.with_stream_lock, () => ( ((_stream, w) => w())));
|
|
2519
2519
|
return [...streams].sort().reduceRight(
|
|
@@ -2521,7 +2521,7 @@ function with_stream_locks(streams, deps, work) {
|
|
|
2521
2521
|
work
|
|
2522
2522
|
)();
|
|
2523
2523
|
}
|
|
2524
|
-
|
|
2524
|
+
_chunk253TSECAcjs.__name.call(void 0, with_stream_locks, "with_stream_locks");
|
|
2525
2525
|
async function run_full_closes(full, target_map, deps, skipped) {
|
|
2526
2526
|
const none = /* @__PURE__ */ new Map();
|
|
2527
2527
|
const streams = full.map((t) => t.stream);
|
|
@@ -2577,7 +2577,7 @@ async function run_full_closes(full, target_map, deps, skipped) {
|
|
|
2577
2577
|
deps.correlation
|
|
2578
2578
|
);
|
|
2579
2579
|
}
|
|
2580
|
-
|
|
2580
|
+
_chunk253TSECAcjs.__name.call(void 0, run_full_closes, "run_full_closes");
|
|
2581
2581
|
async function run_windowed_closes(windowed, deps, skipped) {
|
|
2582
2582
|
const checkpoint = deps.reactive ? await deps.catch_up_correlation(Number.MAX_SAFE_INTEGER) : -1;
|
|
2583
2583
|
const min_at = deps.reactive ? await probe_min_watermarks(
|
|
@@ -2593,7 +2593,7 @@ async function run_windowed_closes(windowed, deps, skipped) {
|
|
|
2593
2593
|
if (!await windowed_prune_pending(t.stream, t.before, max_id))
|
|
2594
2594
|
return void 0;
|
|
2595
2595
|
if (t.archive) await t.archive();
|
|
2596
|
-
const result = await
|
|
2596
|
+
const result = await _chunkEXXHQ7CScjs.store.call(void 0, ).truncate([
|
|
2597
2597
|
{ stream: t.stream, before: t.before, max_id }
|
|
2598
2598
|
]);
|
|
2599
2599
|
return result.get(t.stream);
|
|
@@ -2603,26 +2603,26 @@ async function run_windowed_closes(windowed, deps, skipped) {
|
|
|
2603
2603
|
}
|
|
2604
2604
|
return truncated;
|
|
2605
2605
|
}
|
|
2606
|
-
|
|
2606
|
+
_chunk253TSECAcjs.__name.call(void 0, run_windowed_closes, "run_windowed_closes");
|
|
2607
2607
|
async function windowed_prune_pending(stream, before, max_id) {
|
|
2608
2608
|
let boundary_id;
|
|
2609
2609
|
let min_id;
|
|
2610
|
-
await
|
|
2610
|
+
await _chunkEXXHQ7CScjs.store.call(void 0, ).query(
|
|
2611
2611
|
(event) => {
|
|
2612
2612
|
if (min_id === void 0 || event.id < min_id) min_id = event.id;
|
|
2613
|
-
if (event.name ===
|
|
2613
|
+
if (event.name === _chunk253TSECAcjs.SNAP_EVENT && event.created < before && (max_id === void 0 || event.id <= max_id) && (boundary_id === void 0 || event.id > boundary_id))
|
|
2614
2614
|
boundary_id = event.id;
|
|
2615
2615
|
},
|
|
2616
2616
|
{ stream, stream_exact: true, with_snaps: true, after: -1 }
|
|
2617
2617
|
);
|
|
2618
2618
|
return boundary_id !== void 0 && min_id < boundary_id;
|
|
2619
2619
|
}
|
|
2620
|
-
|
|
2620
|
+
_chunk253TSECAcjs.__name.call(void 0, windowed_prune_pending, "windowed_prune_pending");
|
|
2621
2621
|
async function probe_min_watermarks(streams, page_size, checkpoint) {
|
|
2622
2622
|
const min_at = /* @__PURE__ */ new Map();
|
|
2623
2623
|
const matches = source_matcher();
|
|
2624
2624
|
await walk_streams(
|
|
2625
|
-
|
|
2625
|
+
_chunkEXXHQ7CScjs.store.call(void 0, ),
|
|
2626
2626
|
(position) => {
|
|
2627
2627
|
const pending = position.correlated_at === void 0 || position.at < position.correlated_at;
|
|
2628
2628
|
const cap = pending ? position.at : Math.max(position.at, checkpoint);
|
|
@@ -2637,12 +2637,12 @@ async function probe_min_watermarks(streams, page_size, checkpoint) {
|
|
|
2637
2637
|
);
|
|
2638
2638
|
return min_at;
|
|
2639
2639
|
}
|
|
2640
|
-
|
|
2640
|
+
_chunk253TSECAcjs.__name.call(void 0, probe_min_watermarks, "probe_min_watermarks");
|
|
2641
2641
|
function source_matcher() {
|
|
2642
2642
|
const compiled = /* @__PURE__ */ new Map();
|
|
2643
2643
|
return (source, target, stream) => {
|
|
2644
2644
|
if (!source) return true;
|
|
2645
|
-
if (
|
|
2645
|
+
if (_chunkXSLQYVIGcjs.isStreamName.call(void 0, source, target)) return source === stream;
|
|
2646
2646
|
let re = compiled.get(source);
|
|
2647
2647
|
if (!re) {
|
|
2648
2648
|
re = new RegExp(source);
|
|
@@ -2651,19 +2651,19 @@ function source_matcher() {
|
|
|
2651
2651
|
return re.test(stream);
|
|
2652
2652
|
};
|
|
2653
2653
|
}
|
|
2654
|
-
|
|
2654
|
+
_chunk253TSECAcjs.__name.call(void 0, source_matcher, "source_matcher");
|
|
2655
2655
|
async function scan_stream_heads(streams) {
|
|
2656
|
-
const stats = await
|
|
2657
|
-
exclude: [
|
|
2656
|
+
const stats = await _chunkEXXHQ7CScjs.store.call(void 0, ).query_stats(streams, {
|
|
2657
|
+
exclude: [_chunk253TSECAcjs.SNAP_EVENT]
|
|
2658
2658
|
});
|
|
2659
|
-
const domain_heads = await
|
|
2660
|
-
exclude: [
|
|
2659
|
+
const domain_heads = await _chunkEXXHQ7CScjs.store.call(void 0, ).query_stats(streams, {
|
|
2660
|
+
exclude: [_chunk253TSECAcjs.SNAP_EVENT, _chunk253TSECAcjs.TOMBSTONE_EVENT]
|
|
2661
2661
|
});
|
|
2662
|
-
const true_heads = await
|
|
2662
|
+
const true_heads = await _chunkEXXHQ7CScjs.store.call(void 0, ).query_stats(streams, {});
|
|
2663
2663
|
const out = /* @__PURE__ */ new Map();
|
|
2664
2664
|
for (const [stream, { head }] of domain_heads) {
|
|
2665
2665
|
const marker_head = _optionalChain([stats, 'access', _140 => _140.get, 'call', _141 => _141(stream), 'optionalAccess', _142 => _142.head]);
|
|
2666
|
-
const interrupted = _optionalChain([marker_head, 'optionalAccess', _143 => _143.name]) ===
|
|
2666
|
+
const interrupted = _optionalChain([marker_head, 'optionalAccess', _143 => _143.name]) === _chunk253TSECAcjs.TOMBSTONE_EVENT;
|
|
2667
2667
|
out.set(stream, {
|
|
2668
2668
|
max_id: head.id,
|
|
2669
2669
|
version: true_heads.get(stream).head.version,
|
|
@@ -2673,7 +2673,7 @@ async function scan_stream_heads(streams) {
|
|
|
2673
2673
|
}
|
|
2674
2674
|
return out;
|
|
2675
2675
|
}
|
|
2676
|
-
|
|
2676
|
+
_chunk253TSECAcjs.__name.call(void 0, scan_stream_heads, "scan_stream_heads");
|
|
2677
2677
|
async function partition_by_safety(stream_info, reactive, skipped, page_size, catch_up_correlation2) {
|
|
2678
2678
|
if (!reactive) return [...stream_info.keys()];
|
|
2679
2679
|
let needed = -1;
|
|
@@ -2687,7 +2687,7 @@ async function partition_by_safety(stream_info, reactive, skipped, page_size, ca
|
|
|
2687
2687
|
const pending_set = /* @__PURE__ */ new Set();
|
|
2688
2688
|
const matches = source_matcher();
|
|
2689
2689
|
await walk_streams(
|
|
2690
|
-
|
|
2690
|
+
_chunkEXXHQ7CScjs.store.call(void 0, ),
|
|
2691
2691
|
(position) => {
|
|
2692
2692
|
const has_work = position.correlated_at !== void 0 && position.at < position.correlated_at;
|
|
2693
2693
|
if (!has_work) return;
|
|
@@ -2707,7 +2707,7 @@ async function partition_by_safety(stream_info, reactive, skipped, page_size, ca
|
|
|
2707
2707
|
}
|
|
2708
2708
|
return safe;
|
|
2709
2709
|
}
|
|
2710
|
-
|
|
2710
|
+
_chunk253TSECAcjs.__name.call(void 0, partition_by_safety, "partition_by_safety");
|
|
2711
2711
|
async function guard_with_tombstones(safe, stream_info, correlation, tombstone2, skipped) {
|
|
2712
2712
|
const guarded = [];
|
|
2713
2713
|
const guard_events = /* @__PURE__ */ new Map();
|
|
@@ -2730,7 +2730,7 @@ async function guard_with_tombstones(safe, stream_info, correlation, tombstone2,
|
|
|
2730
2730
|
);
|
|
2731
2731
|
return { guarded, guard_events };
|
|
2732
2732
|
}
|
|
2733
|
-
|
|
2733
|
+
_chunk253TSECAcjs.__name.call(void 0, guard_with_tombstones, "guard_with_tombstones");
|
|
2734
2734
|
async function load_restart_seeds(guarded, target_map, stream_info, event_to_state, load2, logger) {
|
|
2735
2735
|
const seed_states = /* @__PURE__ */ new Map();
|
|
2736
2736
|
await Promise.all(
|
|
@@ -2749,16 +2749,16 @@ async function load_restart_seeds(guarded, target_map, stream_info, event_to_sta
|
|
|
2749
2749
|
);
|
|
2750
2750
|
return seed_states;
|
|
2751
2751
|
}
|
|
2752
|
-
|
|
2752
|
+
_chunk253TSECAcjs.__name.call(void 0, load_restart_seeds, "load_restart_seeds");
|
|
2753
2753
|
async function run_archive_callbacks(guarded, target_map) {
|
|
2754
2754
|
for (const stream of guarded) {
|
|
2755
2755
|
const archive_fn = _optionalChain([target_map, 'access', _147 => _147.get, 'call', _148 => _148(stream), 'optionalAccess', _149 => _149.archive]);
|
|
2756
2756
|
if (archive_fn) await archive_fn();
|
|
2757
2757
|
}
|
|
2758
2758
|
}
|
|
2759
|
-
|
|
2759
|
+
_chunk253TSECAcjs.__name.call(void 0, run_archive_callbacks, "run_archive_callbacks");
|
|
2760
2760
|
async function heads_still_guarded(guarded, guard_events, skipped) {
|
|
2761
|
-
const heads = await
|
|
2761
|
+
const heads = await _chunkEXXHQ7CScjs.store.call(void 0, ).query_stats(guarded, {});
|
|
2762
2762
|
return guarded.filter((stream) => {
|
|
2763
2763
|
if (_optionalChain([heads, 'access', _150 => _150.get, 'call', _151 => _151(stream), 'optionalAccess', _152 => _152.head, 'access', _153 => _153.id]) === guard_events.get(stream).id)
|
|
2764
2764
|
return true;
|
|
@@ -2766,7 +2766,7 @@ async function heads_still_guarded(guarded, guard_events, skipped) {
|
|
|
2766
2766
|
return false;
|
|
2767
2767
|
});
|
|
2768
2768
|
}
|
|
2769
|
-
|
|
2769
|
+
_chunk253TSECAcjs.__name.call(void 0, heads_still_guarded, "heads_still_guarded");
|
|
2770
2770
|
async function truncate_and_warm_cache(guarded, seed_states, guard_events, correlation) {
|
|
2771
2771
|
const trunc_targets = guarded.map((stream) => {
|
|
2772
2772
|
const snapshot = seed_states.get(stream);
|
|
@@ -2777,18 +2777,18 @@ async function truncate_and_warm_cache(guarded, seed_states, guard_events, corre
|
|
|
2777
2777
|
meta: {
|
|
2778
2778
|
correlation,
|
|
2779
2779
|
causation: {
|
|
2780
|
-
event: { id: guard.id, name:
|
|
2780
|
+
event: { id: guard.id, name: _chunk253TSECAcjs.TOMBSTONE_EVENT, stream: guard.stream }
|
|
2781
2781
|
}
|
|
2782
2782
|
}
|
|
2783
2783
|
};
|
|
2784
2784
|
});
|
|
2785
|
-
const truncated = await
|
|
2785
|
+
const truncated = await _chunkEXXHQ7CScjs.store.call(void 0, ).truncate(trunc_targets);
|
|
2786
2786
|
await Promise.all(
|
|
2787
2787
|
guarded.map(async (stream) => {
|
|
2788
2788
|
const entry = truncated.get(stream);
|
|
2789
2789
|
const state2 = seed_states.get(stream);
|
|
2790
2790
|
if (state2 && entry) {
|
|
2791
|
-
await
|
|
2791
|
+
await _chunkEXXHQ7CScjs.cache.call(void 0, ).set(stream, {
|
|
2792
2792
|
stream,
|
|
2793
2793
|
state: state2,
|
|
2794
2794
|
version: entry.committed.version,
|
|
@@ -2797,19 +2797,19 @@ async function truncate_and_warm_cache(guarded, seed_states, guard_events, corre
|
|
|
2797
2797
|
snaps: 1
|
|
2798
2798
|
});
|
|
2799
2799
|
} else {
|
|
2800
|
-
await
|
|
2800
|
+
await _chunkEXXHQ7CScjs.cache.call(void 0, ).invalidate(stream);
|
|
2801
2801
|
}
|
|
2802
2802
|
})
|
|
2803
2803
|
);
|
|
2804
2804
|
return truncated;
|
|
2805
2805
|
}
|
|
2806
|
-
|
|
2806
|
+
_chunk253TSECAcjs.__name.call(void 0, truncate_and_warm_cache, "truncate_and_warm_cache");
|
|
2807
2807
|
|
|
2808
2808
|
// src/internal/correlate-cycle.ts
|
|
2809
2809
|
|
|
2810
2810
|
var COLD_START_BACK_SCAN = 1e4;
|
|
2811
2811
|
var CORRELATION_LEASE_MS = 5e3;
|
|
2812
|
-
var registry_key = /* @__PURE__ */
|
|
2812
|
+
var registry_key = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (events) => {
|
|
2813
2813
|
const shape = Object.keys(events).filter((name) => events[name].reactions.size > 0).sort().map((name) => [name, [...events[name].reactions.keys()].sort()]);
|
|
2814
2814
|
return _crypto.createHash.call(void 0, "sha256").update(JSON.stringify(shape)).digest("hex").slice(0, 32);
|
|
2815
2815
|
}, "registry_key");
|
|
@@ -2821,7 +2821,7 @@ function report_undeclared_lane(seen, handler, target, lane, declared) {
|
|
|
2821
2821
|
`Reaction "${handler}" resolved onto undeclared lane "${lane}" \u2014 for example target "${target}". Declared lanes: ${[...declared].map((l) => `"${l}"`).join(", ")}. No controller claims it, so the stream would never drain \u2014 running it on "default" instead. The equivalent static \`.to({ lane })\` is rejected at build; a dynamic resolver's lane is only knowable here.`
|
|
2822
2822
|
);
|
|
2823
2823
|
}
|
|
2824
|
-
|
|
2824
|
+
_chunk253TSECAcjs.__name.call(void 0, report_undeclared_lane, "report_undeclared_lane");
|
|
2825
2825
|
function report_bad_priority(seen, handler, target, priority) {
|
|
2826
2826
|
report_once(
|
|
2827
2827
|
seen,
|
|
@@ -2829,7 +2829,7 @@ function report_bad_priority(seen, handler, target, priority) {
|
|
|
2829
2829
|
`Reaction "${handler}" resolved priority ${String(priority)} for target "${target}", which isn't a 32-bit integer. Running it at priority 0 instead. The equivalent static \`.to({ priority })\` is rejected at build; a dynamic resolver's priority is only knowable here.`
|
|
2830
2830
|
);
|
|
2831
2831
|
}
|
|
2832
|
-
|
|
2832
|
+
_chunk253TSECAcjs.__name.call(void 0, report_bad_priority, "report_bad_priority");
|
|
2833
2833
|
function report_lane_conflict(seen, handler, target, kept, dropped) {
|
|
2834
2834
|
report_once(
|
|
2835
2835
|
seen,
|
|
@@ -2837,10 +2837,10 @@ function report_lane_conflict(seen, handler, target, kept, dropped) {
|
|
|
2837
2837
|
`Reaction "${handler}" resolved lane "${dropped}" for a stream already on "${kept}" \u2014 for example "${target}". These are conflicting lane assignments from two dynamic resolutions at equal priority. Keeping "${kept}", the lane it was first discovered on \u2014 re-laning a live stream would move it out from under a worker holding its lease. The reaction resolving "${dropped}" runs inside the "${kept}" lane's budget, and a process restricted to "${dropped}" via onlyLanes never runs it. The equivalent static declaration is rejected at build; align the resolvers, or split the target.`
|
|
2838
2838
|
);
|
|
2839
2839
|
}
|
|
2840
|
-
|
|
2840
|
+
_chunk253TSECAcjs.__name.call(void 0, report_lane_conflict, "report_lane_conflict");
|
|
2841
2841
|
var CorrelateCycle = (_class4 = class {
|
|
2842
2842
|
static {
|
|
2843
|
-
|
|
2843
|
+
_chunk253TSECAcjs.__name.call(void 0, this, "CorrelateCycle");
|
|
2844
2844
|
}
|
|
2845
2845
|
__init9() {this._checkpoint = -1}
|
|
2846
2846
|
// Lease holder id; per instance, so a restart never inherits a stale claim.
|
|
@@ -2863,7 +2863,7 @@ var CorrelateCycle = (_class4 = class {
|
|
|
2863
2863
|
// never lets a resolution re-lane them.
|
|
2864
2864
|
|
|
2865
2865
|
__init17() {this._static_subscriptions = /* @__PURE__ */ new Map()}
|
|
2866
|
-
__init18() {this._patterns = new (0,
|
|
2866
|
+
__init18() {this._patterns = new (0, _chunkEXXHQ7CScjs.LruMap)(PATTERN_CACHE_SIZE)}
|
|
2867
2867
|
|
|
2868
2868
|
|
|
2869
2869
|
|
|
@@ -2881,7 +2881,7 @@ var CorrelateCycle = (_class4 = class {
|
|
|
2881
2881
|
on_init
|
|
2882
2882
|
}) {;_class4.prototype.__init9.call(this);_class4.prototype.__init10.call(this);_class4.prototype.__init11.call(this);_class4.prototype.__init12.call(this);_class4.prototype.__init13.call(this);_class4.prototype.__init14.call(this);_class4.prototype.__init15.call(this);_class4.prototype.__init16.call(this);_class4.prototype.__init17.call(this);_class4.prototype.__init18.call(this);_class4.prototype.__init19.call(this);
|
|
2883
2883
|
this._key = shard ? `${registry_key(registry.events)}:${[...shard].sort().join(",")}` : registry_key(registry.events);
|
|
2884
|
-
this._dynamic_subscriptions = new (0,
|
|
2884
|
+
this._dynamic_subscriptions = new (0, _chunkEXXHQ7CScjs.LruMap)(max_subscribed_streams);
|
|
2885
2885
|
this._registry = registry;
|
|
2886
2886
|
this._declared_lanes = declared_lanes;
|
|
2887
2887
|
this._static_targets = static_targets;
|
|
@@ -2939,7 +2939,7 @@ var CorrelateCycle = (_class4 = class {
|
|
|
2939
2939
|
// Would the target's own `fetch` (filtered by `source`) return this event?
|
|
2940
2940
|
_in_fetch_window(source, stream) {
|
|
2941
2941
|
if (source === void 0 || source === stream) return true;
|
|
2942
|
-
if (
|
|
2942
|
+
if (_chunkXSLQYVIGcjs.isStreamName.call(void 0, source)) return false;
|
|
2943
2943
|
let pattern = this._patterns.get(source);
|
|
2944
2944
|
if (!pattern) {
|
|
2945
2945
|
pattern = new RegExp(source);
|
|
@@ -2961,7 +2961,7 @@ var CorrelateCycle = (_class4 = class {
|
|
|
2961
2961
|
async _scan(limit, lease) {
|
|
2962
2962
|
await this._init();
|
|
2963
2963
|
const epoch = this._epoch;
|
|
2964
|
-
const idle = /* @__PURE__ */
|
|
2964
|
+
const idle = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, () => ({
|
|
2965
2965
|
kind: "idle",
|
|
2966
2966
|
last_id: this._checkpoint
|
|
2967
2967
|
}), "idle");
|
|
@@ -2982,7 +2982,7 @@ var CorrelateCycle = (_class4 = class {
|
|
|
2982
2982
|
const correlated = /* @__PURE__ */ new Map();
|
|
2983
2983
|
let last_id = after;
|
|
2984
2984
|
let stopped = false;
|
|
2985
|
-
const found = await
|
|
2985
|
+
const found = await _chunkEXXHQ7CScjs.store.call(void 0, ).query(
|
|
2986
2986
|
(event) => {
|
|
2987
2987
|
if (stopped) return;
|
|
2988
2988
|
const register = this._registry.events[event.name];
|
|
@@ -3001,8 +3001,10 @@ var CorrelateCycle = (_class4 = class {
|
|
|
3001
3001
|
return;
|
|
3002
3002
|
}
|
|
3003
3003
|
if (!resolved) continue;
|
|
3004
|
+
if (typeof reaction.resolver === "function" && resolved.source === void 0)
|
|
3005
|
+
resolved = { ...resolved, source: event.stream };
|
|
3004
3006
|
try {
|
|
3005
|
-
|
|
3007
|
+
_chunkEXXHQ7CScjs.check.call(void 0, "target", resolved);
|
|
3006
3008
|
} catch (e2) {
|
|
3007
3009
|
report_bad_priority(
|
|
3008
3010
|
this._reported,
|
|
@@ -3038,9 +3040,9 @@ var CorrelateCycle = (_class4 = class {
|
|
|
3038
3040
|
correlated_at: void 0
|
|
3039
3041
|
};
|
|
3040
3042
|
const seen_in_scan = correlated.has(resolved.target);
|
|
3041
|
-
const held_lane = _nullishCoalesce((seen_in_scan ? entry.lane : _optionalChain([recorded, 'optionalAccess', _156 => _156.lane])), () => (
|
|
3043
|
+
const held_lane = _nullishCoalesce((seen_in_scan ? entry.lane : _optionalChain([recorded, 'optionalAccess', _156 => _156.lane])), () => ( _chunk253TSECAcjs.DEFAULT_LANE));
|
|
3042
3044
|
const held_priority = seen_in_scan ? entry.priority : _optionalChain([recorded, 'optionalAccess', _157 => _157.priority]);
|
|
3043
|
-
const resolved_lane = _nullishCoalesce(lane, () => (
|
|
3045
|
+
const resolved_lane = _nullishCoalesce(lane, () => ( _chunk253TSECAcjs.DEFAULT_LANE));
|
|
3044
3046
|
if (held_priority === priority && held_lane !== resolved_lane)
|
|
3045
3047
|
report_lane_conflict(
|
|
3046
3048
|
this._reported,
|
|
@@ -3114,7 +3116,7 @@ var CorrelateCycle = (_class4 = class {
|
|
|
3114
3116
|
await Promise.all(
|
|
3115
3117
|
missed.map(async ([stream, entry]) => {
|
|
3116
3118
|
let row;
|
|
3117
|
-
await
|
|
3119
|
+
await _chunkEXXHQ7CScjs.store.call(void 0, ).query_streams(
|
|
3118
3120
|
(position) => {
|
|
3119
3121
|
row = position;
|
|
3120
3122
|
},
|
|
@@ -3126,8 +3128,8 @@ var CorrelateCycle = (_class4 = class {
|
|
|
3126
3128
|
lane: row.lane
|
|
3127
3129
|
});
|
|
3128
3130
|
if (entry.priority > row.priority) return;
|
|
3129
|
-
const held_lane = _nullishCoalesce(row.lane, () => (
|
|
3130
|
-
const resolved_lane = _nullishCoalesce(entry.lane, () => (
|
|
3131
|
+
const held_lane = _nullishCoalesce(row.lane, () => ( _chunk253TSECAcjs.DEFAULT_LANE));
|
|
3132
|
+
const resolved_lane = _nullishCoalesce(entry.lane, () => ( _chunk253TSECAcjs.DEFAULT_LANE));
|
|
3131
3133
|
if (entry.priority === row.priority && held_lane !== resolved_lane)
|
|
3132
3134
|
report_lane_conflict(
|
|
3133
3135
|
this._reported,
|
|
@@ -3153,7 +3155,7 @@ var CorrelateCycle = (_class4 = class {
|
|
|
3153
3155
|
millis: 0
|
|
3154
3156
|
});
|
|
3155
3157
|
} catch (error) {
|
|
3156
|
-
|
|
3158
|
+
_chunkEXXHQ7CScjs.log.call(void 0, ).warn(
|
|
3157
3159
|
`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)))}`
|
|
3158
3160
|
);
|
|
3159
3161
|
}
|
|
@@ -3172,13 +3174,13 @@ function pii_split(emitted, fields) {
|
|
|
3172
3174
|
}
|
|
3173
3175
|
return { name: emitted.name, data, pii };
|
|
3174
3176
|
}
|
|
3175
|
-
|
|
3177
|
+
_chunk253TSECAcjs.__name.call(void 0, pii_split, "pii_split");
|
|
3176
3178
|
function pii_gate(event, fields, predicate, actor) {
|
|
3177
3179
|
const data = event.data;
|
|
3178
3180
|
const { pii, ...rest } = event;
|
|
3179
3181
|
if (pii == null) {
|
|
3180
3182
|
const shredded = { ...data };
|
|
3181
|
-
for (const f of fields) shredded[f] =
|
|
3183
|
+
for (const f of fields) shredded[f] = _chunk253TSECAcjs.SHREDDED;
|
|
3182
3184
|
return { ...rest, data: shredded };
|
|
3183
3185
|
}
|
|
3184
3186
|
const allowed = !!actor && !!predicate && predicate(event, actor);
|
|
@@ -3189,15 +3191,15 @@ function pii_gate(event, fields, predicate, actor) {
|
|
|
3189
3191
|
};
|
|
3190
3192
|
}
|
|
3191
3193
|
const redacted = { ...data };
|
|
3192
|
-
for (const f of fields) redacted[f] =
|
|
3194
|
+
for (const f of fields) redacted[f] = _chunk253TSECAcjs.REDACTED;
|
|
3193
3195
|
return { ...rest, data: redacted };
|
|
3194
3196
|
}
|
|
3195
|
-
|
|
3196
|
-
var IDENTITY_GATE = /* @__PURE__ */
|
|
3197
|
+
_chunk253TSECAcjs.__name.call(void 0, pii_gate, "pii_gate");
|
|
3198
|
+
var IDENTITY_GATE = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (event) => event, "IDENTITY_GATE");
|
|
3197
3199
|
function make_gate(fields, predicate) {
|
|
3198
3200
|
return (event, actor) => pii_gate(event, fields, predicate, actor);
|
|
3199
3201
|
}
|
|
3200
|
-
|
|
3202
|
+
_chunk253TSECAcjs.__name.call(void 0, make_gate, "make_gate");
|
|
3201
3203
|
function pii_strip(event, fields) {
|
|
3202
3204
|
const data = event.data;
|
|
3203
3205
|
const stripped = {};
|
|
@@ -3210,22 +3212,22 @@ function pii_strip(event, fields) {
|
|
|
3210
3212
|
data: stripped
|
|
3211
3213
|
};
|
|
3212
3214
|
}
|
|
3213
|
-
|
|
3215
|
+
_chunk253TSECAcjs.__name.call(void 0, pii_strip, "pii_strip");
|
|
3214
3216
|
|
|
3215
3217
|
// src/internal/projection-fold.ts
|
|
3216
3218
|
var FOLD_RESET = /* @__PURE__ */ Symbol("act.fold.reset");
|
|
3217
3219
|
function make_fold_handler(me, flush, config2, sensitive_fields) {
|
|
3218
3220
|
const load_me = {
|
|
3219
3221
|
...me,
|
|
3220
|
-
view: /* @__PURE__ */
|
|
3222
|
+
view: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (raw, actor) => {
|
|
3221
3223
|
const viewed = me.view(raw, actor);
|
|
3222
3224
|
const fields = sensitive_fields(viewed.name);
|
|
3223
3225
|
return fields.length ? pii_strip(viewed, fields) : viewed;
|
|
3224
3226
|
}, "view")
|
|
3225
3227
|
};
|
|
3226
3228
|
const cache2 = /* @__PURE__ */ new Map();
|
|
3227
|
-
const row = /* @__PURE__ */
|
|
3228
|
-
const flush_dirty = /* @__PURE__ */
|
|
3229
|
+
const row = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, ({ dirty: _, ...row2 }) => row2, "row");
|
|
3230
|
+
const flush_dirty = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, async () => {
|
|
3229
3231
|
const rows = [];
|
|
3230
3232
|
const flushed = [];
|
|
3231
3233
|
for (const f of cache2.values())
|
|
@@ -3237,7 +3239,7 @@ function make_fold_handler(me, flush, config2, sensitive_fields) {
|
|
|
3237
3239
|
await flush(rows);
|
|
3238
3240
|
for (const f of flushed) f.dirty = false;
|
|
3239
3241
|
}, "flush_dirty");
|
|
3240
|
-
const first_sight = /* @__PURE__ */
|
|
3242
|
+
const first_sight = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, async (stream) => {
|
|
3241
3243
|
if (cache2.size >= config2.maxCachedStates) {
|
|
3242
3244
|
const oldest = cache2.keys().next().value;
|
|
3243
3245
|
const evictee = cache2.get(oldest);
|
|
@@ -3257,7 +3259,7 @@ function make_fold_handler(me, flush, config2, sensitive_fields) {
|
|
|
3257
3259
|
cache2.set(stream, seated);
|
|
3258
3260
|
return seated;
|
|
3259
3261
|
}, "first_sight");
|
|
3260
|
-
const handler = /* @__PURE__ */
|
|
3262
|
+
const handler = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, async (events) => {
|
|
3261
3263
|
let folded_since_flush = 0;
|
|
3262
3264
|
for (const event of events) {
|
|
3263
3265
|
const stream = event.stream;
|
|
@@ -3295,15 +3297,15 @@ function make_fold_handler(me, flush, config2, sensitive_fields) {
|
|
|
3295
3297
|
}
|
|
3296
3298
|
await flush_dirty();
|
|
3297
3299
|
}, "handler");
|
|
3298
|
-
Object.defineProperty(handler, FOLD_RESET, { value: /* @__PURE__ */
|
|
3300
|
+
Object.defineProperty(handler, FOLD_RESET, { value: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, () => cache2.clear(), "value") });
|
|
3299
3301
|
return handler;
|
|
3300
3302
|
}
|
|
3301
|
-
|
|
3303
|
+
_chunk253TSECAcjs.__name.call(void 0, make_fold_handler, "make_fold_handler");
|
|
3302
3304
|
|
|
3303
3305
|
// src/internal/settle.ts
|
|
3304
3306
|
var SettleLoop = (_class5 = class {
|
|
3305
3307
|
static {
|
|
3306
|
-
|
|
3308
|
+
_chunk253TSECAcjs.__name.call(void 0, this, "SettleLoop");
|
|
3307
3309
|
}
|
|
3308
3310
|
__init20() {this._timer = void 0}
|
|
3309
3311
|
// The cycle in flight, set while one runs. Shutdown waits for it
|
|
@@ -3406,7 +3408,7 @@ var SettleLoop = (_class5 = class {
|
|
|
3406
3408
|
// src/act.ts
|
|
3407
3409
|
var Act = (_class6 = class {
|
|
3408
3410
|
static {
|
|
3409
|
-
|
|
3411
|
+
_chunk253TSECAcjs.__name.call(void 0, this, "Act");
|
|
3410
3412
|
}
|
|
3411
3413
|
__init25() {this._emitter = new (0, _events2.default)()}
|
|
3412
3414
|
|
|
@@ -3494,7 +3496,7 @@ var Act = (_class6 = class {
|
|
|
3494
3496
|
// Lanes to arm per event; `"all"` when a dynamic resolver hides the lane.
|
|
3495
3497
|
|
|
3496
3498
|
|
|
3497
|
-
__init26() {this._logger =
|
|
3499
|
+
__init26() {this._logger = _chunkEXXHQ7CScjs.log.call(void 0, )}
|
|
3498
3500
|
// This Act's ports: its own bag, or the singleton adapters.
|
|
3499
3501
|
|
|
3500
3502
|
// Runs a body so internal `store()`/`cache()` calls resolve to `_ports`.
|
|
@@ -3523,11 +3525,11 @@ var Act = (_class6 = class {
|
|
|
3523
3525
|
throw new Error(
|
|
3524
3526
|
`ActOptions.onlyLanes references undeclared lane(s): ${undeclared.map((l) => `"${l}"`).join(", ")}`
|
|
3525
3527
|
);
|
|
3526
|
-
|
|
3527
|
-
if (options.scoped)
|
|
3528
|
-
this._ports = _nullishCoalesce(options.scoped, () => (
|
|
3528
|
+
_chunkEXXHQ7CScjs.check.call(void 0, "act", options);
|
|
3529
|
+
if (options.scoped) _chunkEXXHQ7CScjs.check.call(void 0, "store", options.scoped.store);
|
|
3530
|
+
this._ports = _nullishCoalesce(options.scoped, () => ( _chunkEXXHQ7CScjs.unscoped_ports.call(void 0, )));
|
|
3529
3531
|
const ports = this._ports;
|
|
3530
|
-
this._scoped =
|
|
3532
|
+
this._scoped = _chunkEXXHQ7CScjs.make_run_scoped.call(void 0, {
|
|
3531
3533
|
// Getters, not a spread: the singletons resolve lazily, so a later
|
|
3532
3534
|
// `store(...)` / `cache(...)` still takes effect.
|
|
3533
3535
|
get store() {
|
|
@@ -3537,14 +3539,14 @@ var Act = (_class6 = class {
|
|
|
3537
3539
|
return ports.cache;
|
|
3538
3540
|
},
|
|
3539
3541
|
// Parsed per build, so a bad window throws on every build.
|
|
3540
|
-
autoclose_window:
|
|
3542
|
+
autoclose_window: _chunkEXXHQ7CScjs.check.call(void 0, "autoclose", options).autocloseWindow
|
|
3541
3543
|
});
|
|
3542
3544
|
this._correlator = _nullishCoalesce(options.correlator, () => ( default_correlator));
|
|
3543
3545
|
this._es = build_es(this._logger, this._correlator, patch_fn);
|
|
3544
3546
|
this._cd = build_drain(this._logger);
|
|
3545
3547
|
const handle = build_handle({
|
|
3546
3548
|
logger: this._logger,
|
|
3547
|
-
reaction_scope:
|
|
3549
|
+
reaction_scope: _chunkEXXHQ7CScjs.make_reaction_scope.call(void 0, {
|
|
3548
3550
|
do: this.do.bind(this),
|
|
3549
3551
|
load: this.load.bind(this),
|
|
3550
3552
|
query: this.query.bind(this),
|
|
@@ -3574,17 +3576,17 @@ var Act = (_class6 = class {
|
|
|
3574
3576
|
this._ports.store,
|
|
3575
3577
|
options.listen !== false
|
|
3576
3578
|
);
|
|
3577
|
-
|
|
3579
|
+
_chunkEXXHQ7CScjs.register_weak_disposer.call(void 0, new WeakRef(this), (self) => self.shutdown());
|
|
3578
3580
|
}
|
|
3579
3581
|
// Shared by drain, settle and autoclose; bad knobs throw at build.
|
|
3580
3582
|
_build_breaker(options) {
|
|
3581
3583
|
return new CircuitBreaker(
|
|
3582
|
-
|
|
3584
|
+
_chunkEXXHQ7CScjs.check.call(void 0, "circuit_breaker", _nullishCoalesce(options.circuitBreaker, () => ( {}))),
|
|
3583
3585
|
{
|
|
3584
|
-
on_error: /* @__PURE__ */
|
|
3586
|
+
on_error: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (error, circuit) => this._emit_error(error, circuit), "on_error"),
|
|
3585
3587
|
// When the cooldown elapses, settle once: its scan or claim is the
|
|
3586
3588
|
// half-open probe that closes or re-opens the breaker.
|
|
3587
|
-
on_retry: /* @__PURE__ */
|
|
3589
|
+
on_retry: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, () => this._schedule(), "on_retry")
|
|
3588
3590
|
}
|
|
3589
3591
|
);
|
|
3590
3592
|
}
|
|
@@ -3604,16 +3606,16 @@ var Act = (_class6 = class {
|
|
|
3604
3606
|
batch_handlers: this._batch_handlers,
|
|
3605
3607
|
handle,
|
|
3606
3608
|
handle_batch,
|
|
3607
|
-
on_acked: /* @__PURE__ */
|
|
3608
|
-
on_blocked: /* @__PURE__ */
|
|
3609
|
+
on_acked: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (acked) => this.emit("acked", acked), "on_acked"),
|
|
3610
|
+
on_blocked: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (blocked) => this.emit("blocked", blocked), "on_blocked"),
|
|
3609
3611
|
// Reaction-requested close: the same machinery as `app.close`.
|
|
3610
3612
|
// A store failure reaches the breaker; anything else (the archive
|
|
3611
3613
|
// callback is app code) is logged here, never counted.
|
|
3612
|
-
on_close: /* @__PURE__ */
|
|
3614
|
+
on_close: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, async (targets) => {
|
|
3613
3615
|
try {
|
|
3614
3616
|
await this._run_close(targets);
|
|
3615
3617
|
} catch (error) {
|
|
3616
|
-
if (error instanceof
|
|
3618
|
+
if (error instanceof _chunk253TSECAcjs.StoreError) throw error;
|
|
3617
3619
|
this._logger.error(
|
|
3618
3620
|
error,
|
|
3619
3621
|
`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.`
|
|
@@ -3647,7 +3649,7 @@ var Act = (_class6 = class {
|
|
|
3647
3649
|
// Audit deps, built after the controllers so the lane set is final.
|
|
3648
3650
|
_build_audit_deps() {
|
|
3649
3651
|
return {
|
|
3650
|
-
store:
|
|
3652
|
+
store: _chunkEXXHQ7CScjs.store,
|
|
3651
3653
|
event_to_state: this._event_to_state,
|
|
3652
3654
|
sensitive_fields: this.registry.sensitive_fields,
|
|
3653
3655
|
// Declared lanes, not this process's controllers: a lane another
|
|
@@ -3661,14 +3663,14 @@ var Act = (_class6 = class {
|
|
|
3661
3663
|
registry: this.registry,
|
|
3662
3664
|
static_targets: classification.static_targets,
|
|
3663
3665
|
cd: this._cd,
|
|
3664
|
-
max_subscribed_streams: _nullishCoalesce(options.maxSubscribedStreams, () => (
|
|
3666
|
+
max_subscribed_streams: _nullishCoalesce(options.maxSubscribedStreams, () => ( _chunk253TSECAcjs.DEFAULT_MAX_SUBSCRIBED_STREAMS)),
|
|
3665
3667
|
// Declared lanes (not active ones): a lane another process claims is
|
|
3666
3668
|
// still a valid destination.
|
|
3667
3669
|
declared_lanes: new Set(this._declared_lanes),
|
|
3668
3670
|
// Built after the controllers, so their keys are the active lanes.
|
|
3669
3671
|
shard: this._drain_controllers.size < this._declared_lanes.length ? [...this._drain_controllers.keys()] : void 0,
|
|
3670
3672
|
// Only reached on a draining app: writer-only ones never correlate.
|
|
3671
|
-
on_init: /* @__PURE__ */
|
|
3673
|
+
on_init: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, async () => {
|
|
3672
3674
|
this._arm_all();
|
|
3673
3675
|
await this._seed_persisted_defers();
|
|
3674
3676
|
}, "on_init")
|
|
@@ -3677,7 +3679,7 @@ var Act = (_class6 = class {
|
|
|
3677
3679
|
// Cold start: an idle deferred stream still fires on time after a restart.
|
|
3678
3680
|
async _seed_persisted_defers() {
|
|
3679
3681
|
const now = Date.now();
|
|
3680
|
-
await walk_streams(
|
|
3682
|
+
await walk_streams(_chunkEXXHQ7CScjs.store.call(void 0, ), (pos) => {
|
|
3681
3683
|
if (pos.deferred_at === void 0 || pos.deferred_at <= now) return;
|
|
3682
3684
|
const controller = this._drain_controllers.get(_nullishCoalesce(pos.lane, () => ( "default")));
|
|
3683
3685
|
_optionalChain([controller, 'optionalAccess', _165 => _165.seed_defer, 'call', _166 => _166(pos.stream, pos.deferred_at)]);
|
|
@@ -3686,14 +3688,14 @@ var Act = (_class6 = class {
|
|
|
3686
3688
|
_build_settle(options) {
|
|
3687
3689
|
return new SettleLoop(
|
|
3688
3690
|
{
|
|
3689
|
-
correlate: /* @__PURE__ */
|
|
3691
|
+
correlate: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (q) => this._correlate_pass(_nullishCoalesce(_nullishCoalesce(q.limit, () => ( this._poll_limit)), () => ( 100)), true), "correlate"),
|
|
3690
3692
|
// `settle()` validated the options, and `_schedule` skips writer-only
|
|
3691
3693
|
// instances, so the loop drains through the internal path.
|
|
3692
|
-
drain: /* @__PURE__ */
|
|
3693
|
-
on_settled: /* @__PURE__ */
|
|
3694
|
+
drain: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (o) => this._scoped(() => this._drain_all(o)), "drain"),
|
|
3695
|
+
on_settled: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (drain) => this.emit("settled", drain), "on_settled"),
|
|
3694
3696
|
breaker: this._breaker
|
|
3695
3697
|
},
|
|
3696
|
-
_nullishCoalesce(options.settleDebounceMs, () => (
|
|
3698
|
+
_nullishCoalesce(options.settleDebounceMs, () => ( _chunk253TSECAcjs.DEFAULT_SETTLE_DEBOUNCE_MS))
|
|
3697
3699
|
);
|
|
3698
3700
|
}
|
|
3699
3701
|
|
|
@@ -3713,7 +3715,7 @@ var Act = (_class6 = class {
|
|
|
3713
3715
|
*/
|
|
3714
3716
|
shutdown(options) {
|
|
3715
3717
|
if (!this._shutdown_promise) {
|
|
3716
|
-
|
|
3718
|
+
_chunkEXXHQ7CScjs.check.call(void 0, "shutdown", _nullishCoalesce(options, () => ( {})));
|
|
3717
3719
|
this._shutdown_promise = (async () => {
|
|
3718
3720
|
this.stop_correlations();
|
|
3719
3721
|
this._settle.stop(true);
|
|
@@ -3731,10 +3733,10 @@ var Act = (_class6 = class {
|
|
|
3731
3733
|
// The largest `leaseMillis` among lanes with a cycle in flight (the
|
|
3732
3734
|
// default for none or 0, and for a running settle), capped.
|
|
3733
3735
|
_derive_grace_ms(running, settling) {
|
|
3734
|
-
let max = settling ?
|
|
3736
|
+
let max = settling ? _chunkEXXHQ7CScjs.DEFAULT_LEASE_MILLIS : 0;
|
|
3735
3737
|
for (const c of running)
|
|
3736
|
-
max = Math.max(max, c.lease_millis ||
|
|
3737
|
-
return Math.min(max,
|
|
3738
|
+
max = Math.max(max, c.lease_millis || _chunkEXXHQ7CScjs.DEFAULT_LEASE_MILLIS);
|
|
3739
|
+
return Math.min(max, _chunkEXXHQ7CScjs.MAX_SHUTDOWN_GRACE_MS);
|
|
3738
3740
|
}
|
|
3739
3741
|
async _await_inflight(grace_ms) {
|
|
3740
3742
|
const running = [...this._drain_controllers.values()].filter(
|
|
@@ -3818,7 +3820,7 @@ var Act = (_class6 = class {
|
|
|
3818
3820
|
* @see {@link ValidationError}, {@link PreconditionError}, {@link ConcurrencyError}
|
|
3819
3821
|
*/
|
|
3820
3822
|
async do(action2, target, payload, options) {
|
|
3821
|
-
const reacting_to = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _168 => _168.reactingTo]), () => (
|
|
3823
|
+
const reacting_to = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _168 => _168.reactingTo]), () => ( _chunkEXXHQ7CScjs.current_reacting.call(void 0, )));
|
|
3822
3824
|
const do_options = reacting_to === _optionalChain([options, 'optionalAccess', _169 => _169.reactingTo]) ? options : { ...options, reactingTo: reacting_to };
|
|
3823
3825
|
return this._scoped(async () => {
|
|
3824
3826
|
const snapshots = await this._es.action(
|
|
@@ -3861,7 +3863,7 @@ var Act = (_class6 = class {
|
|
|
3861
3863
|
actor: void 0,
|
|
3862
3864
|
asOf
|
|
3863
3865
|
} : streamOrTarget;
|
|
3864
|
-
|
|
3866
|
+
_chunkEXXHQ7CScjs.check.call(void 0, "page", _nullishCoalesce(target.asOf, () => ( {})));
|
|
3865
3867
|
return await this._es.load(merged, target, callback);
|
|
3866
3868
|
});
|
|
3867
3869
|
}
|
|
@@ -3890,11 +3892,11 @@ var Act = (_class6 = class {
|
|
|
3890
3892
|
* @see {@link query_array} for loading events into memory
|
|
3891
3893
|
*/
|
|
3892
3894
|
async query(query, callback) {
|
|
3893
|
-
|
|
3895
|
+
_chunkEXXHQ7CScjs.check.call(void 0, "page", query);
|
|
3894
3896
|
return this._scoped(async () => {
|
|
3895
3897
|
let first;
|
|
3896
3898
|
let last;
|
|
3897
|
-
const count = await
|
|
3899
|
+
const count = await _chunkEXXHQ7CScjs.store.call(void 0, ).query((e) => {
|
|
3898
3900
|
const gated = this.registry.query_gate(e.name)(e);
|
|
3899
3901
|
if (!first) first = gated;
|
|
3900
3902
|
last = gated;
|
|
@@ -3940,14 +3942,14 @@ var Act = (_class6 = class {
|
|
|
3940
3942
|
*/
|
|
3941
3943
|
async forget(stream) {
|
|
3942
3944
|
return this._scoped(async () => {
|
|
3943
|
-
const s =
|
|
3945
|
+
const s = _chunkEXXHQ7CScjs.store.call(void 0, );
|
|
3944
3946
|
if (!s.forget_pii) {
|
|
3945
3947
|
throw new Error(
|
|
3946
3948
|
`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).`
|
|
3947
3949
|
);
|
|
3948
3950
|
}
|
|
3949
3951
|
const eventCount = await s.forget_pii(stream);
|
|
3950
|
-
await
|
|
3952
|
+
await _chunkEXXHQ7CScjs.cache.call(void 0, ).invalidate(stream);
|
|
3951
3953
|
if (eventCount > 0) {
|
|
3952
3954
|
this.emit("forgotten", { stream, at: /* @__PURE__ */ new Date(), eventCount });
|
|
3953
3955
|
}
|
|
@@ -3981,7 +3983,7 @@ var Act = (_class6 = class {
|
|
|
3981
3983
|
* @see {@link correlate} for dynamic stream discovery
|
|
3982
3984
|
*/
|
|
3983
3985
|
async drain(options = {}) {
|
|
3984
|
-
|
|
3986
|
+
_chunkEXXHQ7CScjs.check.call(void 0, "drain", options);
|
|
3985
3987
|
if (!this._drain)
|
|
3986
3988
|
return { fetched: [], leased: [], acked: [], blocked: [] };
|
|
3987
3989
|
return this._scoped(() => this._drain_all(options));
|
|
@@ -4058,7 +4060,7 @@ var Act = (_class6 = class {
|
|
|
4058
4060
|
* @see {@link start_correlations} for automatic periodic correlation
|
|
4059
4061
|
*/
|
|
4060
4062
|
async correlate(query = {}) {
|
|
4061
|
-
|
|
4063
|
+
_chunkEXXHQ7CScjs.check.call(void 0, "page", query);
|
|
4062
4064
|
const pass = await this._correlate_pass(_nullishCoalesce(query.limit, () => ( 10)));
|
|
4063
4065
|
return {
|
|
4064
4066
|
subscribed: pass.kind === "scanned" ? pass.subscribed : 0,
|
|
@@ -4104,8 +4106,8 @@ var Act = (_class6 = class {
|
|
|
4104
4106
|
* @see {@link stop_correlations} to stop the poll
|
|
4105
4107
|
*/
|
|
4106
4108
|
start_correlations(query = {}, frequency = 1e4) {
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
+
_chunkEXXHQ7CScjs.check.call(void 0, "page", query);
|
|
4110
|
+
_chunkEXXHQ7CScjs.check.call(void 0, "poll", { frequency });
|
|
4109
4111
|
if (this._poll) return false;
|
|
4110
4112
|
this._poll_limit = query.limit || void 0;
|
|
4111
4113
|
this._poll = setInterval(() => {
|
|
@@ -4171,7 +4173,7 @@ var Act = (_class6 = class {
|
|
|
4171
4173
|
*/
|
|
4172
4174
|
async reset(input) {
|
|
4173
4175
|
return this._scoped(async () => {
|
|
4174
|
-
const count = await
|
|
4176
|
+
const count = await _chunkEXXHQ7CScjs.store.call(void 0, ).reset(input);
|
|
4175
4177
|
this._reset_folds();
|
|
4176
4178
|
if (count > 0) {
|
|
4177
4179
|
this._wake();
|
|
@@ -4206,7 +4208,7 @@ var Act = (_class6 = class {
|
|
|
4206
4208
|
*/
|
|
4207
4209
|
async unblock(input) {
|
|
4208
4210
|
return this._scoped(async () => {
|
|
4209
|
-
const count = await
|
|
4211
|
+
const count = await _chunkEXXHQ7CScjs.store.call(void 0, ).unblock(input);
|
|
4210
4212
|
if (count > 0) {
|
|
4211
4213
|
this._wake();
|
|
4212
4214
|
}
|
|
@@ -4254,7 +4256,7 @@ var Act = (_class6 = class {
|
|
|
4254
4256
|
* @see {@link Store.restore} for the underlying driver-pattern primitive.
|
|
4255
4257
|
*/
|
|
4256
4258
|
async restore(source, opts = {}, sink) {
|
|
4257
|
-
|
|
4259
|
+
_chunkEXXHQ7CScjs.check.call(void 0, "scan", opts);
|
|
4258
4260
|
return this._scoped(async () => {
|
|
4259
4261
|
const started = Date.now();
|
|
4260
4262
|
if (opts.dry_run) {
|
|
@@ -4262,14 +4264,14 @@ var Act = (_class6 = class {
|
|
|
4262
4264
|
return { ...partial, duration_ms: Date.now() - started };
|
|
4263
4265
|
}
|
|
4264
4266
|
const target = _nullishCoalesce(sink, () => ( (() => {
|
|
4265
|
-
const s =
|
|
4267
|
+
const s = _chunkEXXHQ7CScjs.store.call(void 0, );
|
|
4266
4268
|
if (!s.restore) throw new Error("adapter has no restore capability");
|
|
4267
4269
|
return s;
|
|
4268
4270
|
})()));
|
|
4269
4271
|
let kept = 0;
|
|
4270
4272
|
let migrated = 0;
|
|
4271
4273
|
let dropped = { closed_streams: 0, snapshots: 0 };
|
|
4272
|
-
const run = /* @__PURE__ */
|
|
4274
|
+
const run = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, () => target.restore(async (callback) => {
|
|
4273
4275
|
const partial = await scan(source, opts, callback);
|
|
4274
4276
|
kept = partial.kept;
|
|
4275
4277
|
migrated = partial.migrated;
|
|
@@ -4278,7 +4280,7 @@ var Act = (_class6 = class {
|
|
|
4278
4280
|
if (sink) await run();
|
|
4279
4281
|
else {
|
|
4280
4282
|
await this._correlate.restart(run);
|
|
4281
|
-
await
|
|
4283
|
+
await _chunkEXXHQ7CScjs.cache.call(void 0, ).clear();
|
|
4282
4284
|
this._reset_folds();
|
|
4283
4285
|
this._wake();
|
|
4284
4286
|
}
|
|
@@ -4308,10 +4310,10 @@ var Act = (_class6 = class {
|
|
|
4308
4310
|
* ```
|
|
4309
4311
|
*/
|
|
4310
4312
|
async blocked_streams(options) {
|
|
4311
|
-
|
|
4313
|
+
_chunkEXXHQ7CScjs.check.call(void 0, "page", { limit: _optionalChain([options, 'optionalAccess', _178 => _178.limit]) });
|
|
4312
4314
|
return this._scoped(async () => {
|
|
4313
4315
|
const positions = [];
|
|
4314
|
-
await
|
|
4316
|
+
await _chunkEXXHQ7CScjs.store.call(void 0, ).query_streams(
|
|
4315
4317
|
(p) => {
|
|
4316
4318
|
positions.push(p);
|
|
4317
4319
|
},
|
|
@@ -4337,7 +4339,7 @@ var Act = (_class6 = class {
|
|
|
4337
4339
|
* ```
|
|
4338
4340
|
*/
|
|
4339
4341
|
async *audit(categories, options) {
|
|
4340
|
-
|
|
4342
|
+
_chunkEXXHQ7CScjs.check.call(void 0, "audit", _nullishCoalesce(options, () => ( {})));
|
|
4341
4343
|
const it = audit(this._audit_deps, categories, options)[Symbol.asyncIterator]();
|
|
4342
4344
|
while (true) {
|
|
4343
4345
|
const { value, done } = await this._scoped(() => it.next());
|
|
@@ -4365,15 +4367,15 @@ var Act = (_class6 = class {
|
|
|
4365
4367
|
* @see {@link Store.prioritize} for the underlying primitive
|
|
4366
4368
|
*/
|
|
4367
4369
|
async prioritize(filter, priority) {
|
|
4368
|
-
|
|
4369
|
-
return this._scoped(() =>
|
|
4370
|
+
_chunkEXXHQ7CScjs.check.call(void 0, "target", { priority });
|
|
4371
|
+
return this._scoped(() => _chunkEXXHQ7CScjs.store.call(void 0, ).prioritize(filter, priority));
|
|
4370
4372
|
}
|
|
4371
4373
|
// Shared by `close()` and reaction-requested closes.
|
|
4372
4374
|
async _run_close(targets) {
|
|
4373
4375
|
const close_actor = { id: "$close", name: "close" };
|
|
4374
4376
|
const result = await run_close_cycle(targets, {
|
|
4375
4377
|
reactive: this._reactive,
|
|
4376
|
-
catch_up_correlation: /* @__PURE__ */
|
|
4378
|
+
catch_up_correlation: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (until) => catch_up_correlation(
|
|
4377
4379
|
this._correlate,
|
|
4378
4380
|
(limit) => this.correlate({ limit }),
|
|
4379
4381
|
until
|
|
@@ -4383,8 +4385,8 @@ var Act = (_class6 = class {
|
|
|
4383
4385
|
tombstone: this._es.tombstone,
|
|
4384
4386
|
logger: this._logger,
|
|
4385
4387
|
correlation: close_correlation(this._correlator, close_actor),
|
|
4386
|
-
with_stream_lock: /* @__PURE__ */
|
|
4387
|
-
forget_subscribed: /* @__PURE__ */
|
|
4388
|
+
with_stream_lock: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (stream, work) => this._close_lock.run(stream, work), "with_stream_lock"),
|
|
4389
|
+
forget_subscribed: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (streams) => this._correlate.forget_subscribed(streams), "forget_subscribed")
|
|
4388
4390
|
});
|
|
4389
4391
|
this.emit("closed", result);
|
|
4390
4392
|
return result;
|
|
@@ -4446,7 +4448,7 @@ var Act = (_class6 = class {
|
|
|
4446
4448
|
* @see {@link correlate} for manual correlation
|
|
4447
4449
|
*/
|
|
4448
4450
|
settle(options) {
|
|
4449
|
-
|
|
4451
|
+
_chunkEXXHQ7CScjs.check.call(void 0, "settle", _nullishCoalesce(options, () => ( {})));
|
|
4450
4452
|
this._schedule(options);
|
|
4451
4453
|
}
|
|
4452
4454
|
}, _class6);
|
|
@@ -4459,7 +4461,7 @@ function base_type_name(schema) {
|
|
|
4459
4461
|
def = def_of(inner);
|
|
4460
4462
|
return def.type === "array" ? `array of ${base_type_name(def.element)}` : def.type;
|
|
4461
4463
|
}
|
|
4462
|
-
|
|
4464
|
+
_chunk253TSECAcjs.__name.call(void 0, base_type_name, "base_type_name");
|
|
4463
4465
|
function merge_schemas(existing, incoming, state_name) {
|
|
4464
4466
|
if (existing === incoming) return existing;
|
|
4465
4467
|
const existing_object = as_object(existing, "existing", state_name);
|
|
@@ -4479,18 +4481,18 @@ function merge_schemas(existing, incoming, state_name) {
|
|
|
4479
4481
|
}
|
|
4480
4482
|
return existing_object.extend(incoming_shape);
|
|
4481
4483
|
}
|
|
4482
|
-
|
|
4484
|
+
_chunk253TSECAcjs.__name.call(void 0, merge_schemas, "merge_schemas");
|
|
4483
4485
|
function as_object(schema, side, state_name) {
|
|
4484
4486
|
if (schema instanceof _zod2.ZodObject) return schema;
|
|
4485
4487
|
throw new Error(
|
|
4486
4488
|
`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({ ... }).`
|
|
4487
4489
|
);
|
|
4488
4490
|
}
|
|
4489
|
-
|
|
4491
|
+
_chunk253TSECAcjs.__name.call(void 0, as_object, "as_object");
|
|
4490
4492
|
function merge_inits(existing, incoming) {
|
|
4491
4493
|
return () => ({ ...existing(), ...incoming() });
|
|
4492
4494
|
}
|
|
4493
|
-
|
|
4495
|
+
_chunk253TSECAcjs.__name.call(void 0, merge_inits, "merge_inits");
|
|
4494
4496
|
function register_state(state2, states, actions, events) {
|
|
4495
4497
|
const existing = states.get(state2.name);
|
|
4496
4498
|
if (existing) {
|
|
@@ -4499,8 +4501,8 @@ function register_state(state2, states, actions, events) {
|
|
|
4499
4501
|
register_new_state(state2, states, actions, events);
|
|
4500
4502
|
}
|
|
4501
4503
|
}
|
|
4502
|
-
|
|
4503
|
-
var shared_name = /* @__PURE__ */
|
|
4504
|
+
_chunk253TSECAcjs.__name.call(void 0, register_state, "register_state");
|
|
4505
|
+
var shared_name = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (name) => new Error(
|
|
4504
4506
|
`Action and event share the name "${name}" \u2014 action and event names must be unique across the application. Rename one of them.`
|
|
4505
4507
|
), "shared_name");
|
|
4506
4508
|
function register_new_state(state2, states, actions, events) {
|
|
@@ -4516,13 +4518,13 @@ function register_new_state(state2, states, actions, events) {
|
|
|
4516
4518
|
events[name] = { schema: state2.events[name], reactions: /* @__PURE__ */ new Map() };
|
|
4517
4519
|
}
|
|
4518
4520
|
}
|
|
4519
|
-
|
|
4521
|
+
_chunk253TSECAcjs.__name.call(void 0, register_new_state, "register_new_state");
|
|
4520
4522
|
function pick_declared(existing, incoming, what, state_name) {
|
|
4521
4523
|
if (existing && incoming && existing !== incoming)
|
|
4522
4524
|
throw new Error(`Duplicate ${what} for state "${state_name}"`);
|
|
4523
4525
|
return _nullishCoalesce(incoming, () => ( existing));
|
|
4524
4526
|
}
|
|
4525
|
-
|
|
4527
|
+
_chunk253TSECAcjs.__name.call(void 0, pick_declared, "pick_declared");
|
|
4526
4528
|
function autoclose_of(existing, state2) {
|
|
4527
4529
|
pick_declared(
|
|
4528
4530
|
existing.autoclose,
|
|
@@ -4538,7 +4540,7 @@ function autoclose_of(existing, state2) {
|
|
|
4538
4540
|
autoclose_keep_days: owner.autoclose_keep_days
|
|
4539
4541
|
};
|
|
4540
4542
|
}
|
|
4541
|
-
|
|
4543
|
+
_chunk253TSECAcjs.__name.call(void 0, autoclose_of, "autoclose_of");
|
|
4542
4544
|
function merge_into_existing(state2, existing, states, actions, events) {
|
|
4543
4545
|
for (const name of Object.keys(state2.actions)) {
|
|
4544
4546
|
if (existing.on[name] === state2.on[name]) continue;
|
|
@@ -4596,7 +4598,7 @@ function merge_into_existing(state2, existing, states, actions, events) {
|
|
|
4596
4598
|
events[name] = { schema: state2.events[name], reactions: /* @__PURE__ */ new Map() };
|
|
4597
4599
|
}
|
|
4598
4600
|
}
|
|
4599
|
-
|
|
4601
|
+
_chunk253TSECAcjs.__name.call(void 0, merge_into_existing, "merge_into_existing");
|
|
4600
4602
|
function merge_patches(existing, incoming, state_name) {
|
|
4601
4603
|
const merged = { ...existing };
|
|
4602
4604
|
for (const name of Object.keys(incoming)) {
|
|
@@ -4619,7 +4621,7 @@ function merge_patches(existing, incoming, state_name) {
|
|
|
4619
4621
|
}
|
|
4620
4622
|
return merged;
|
|
4621
4623
|
}
|
|
4622
|
-
|
|
4624
|
+
_chunk253TSECAcjs.__name.call(void 0, merge_patches, "merge_patches");
|
|
4623
4625
|
function merge_event_register(target, source) {
|
|
4624
4626
|
for (const [event_name, source_reg] of Object.entries(source)) {
|
|
4625
4627
|
const target_reg = target[event_name];
|
|
@@ -4634,7 +4636,7 @@ function merge_event_register(target, source) {
|
|
|
4634
4636
|
}
|
|
4635
4637
|
}
|
|
4636
4638
|
}
|
|
4637
|
-
|
|
4639
|
+
_chunk253TSECAcjs.__name.call(void 0, merge_event_register, "merge_event_register");
|
|
4638
4640
|
function merge_projection(proj, events) {
|
|
4639
4641
|
for (const event_name of Object.keys(proj.events)) {
|
|
4640
4642
|
const proj_register = proj.events[event_name];
|
|
@@ -4654,17 +4656,17 @@ function merge_projection(proj, events) {
|
|
|
4654
4656
|
}
|
|
4655
4657
|
}
|
|
4656
4658
|
}
|
|
4657
|
-
|
|
4658
|
-
var _this_ = /* @__PURE__ */
|
|
4659
|
+
_chunk253TSECAcjs.__name.call(void 0, merge_projection, "merge_projection");
|
|
4660
|
+
var _this_ = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, ({ stream }) => ({
|
|
4659
4661
|
source: stream,
|
|
4660
4662
|
target: stream
|
|
4661
4663
|
}), "_this_");
|
|
4662
4664
|
|
|
4663
4665
|
// src/builders/builder-utils.ts
|
|
4664
4666
|
function register_lane(config2, lanes) {
|
|
4665
|
-
|
|
4666
|
-
if (config2.name ===
|
|
4667
|
-
throw new Error(`Lane "${
|
|
4667
|
+
_chunkEXXHQ7CScjs.check.call(void 0, "lane", config2);
|
|
4668
|
+
if (config2.name === _chunk253TSECAcjs.DEFAULT_LANE)
|
|
4669
|
+
throw new Error(`Lane "${_chunk253TSECAcjs.DEFAULT_LANE}" is reserved`);
|
|
4668
4670
|
const existing = lanes.find((l) => l.name === config2.name);
|
|
4669
4671
|
if (!existing) return void lanes.push(config2);
|
|
4670
4672
|
if (existing.leaseMillis !== config2.leaseMillis || existing.streamLimit !== config2.streamLimit || existing.cycleMs !== config2.cycleMs)
|
|
@@ -4672,7 +4674,7 @@ function register_lane(config2, lanes) {
|
|
|
4672
4674
|
`Lane "${config2.name}" was already declared with a different config`
|
|
4673
4675
|
);
|
|
4674
4676
|
}
|
|
4675
|
-
|
|
4677
|
+
_chunk253TSECAcjs.__name.call(void 0, register_lane, "register_lane");
|
|
4676
4678
|
function add_reaction(events, event, name, kind, make, builder) {
|
|
4677
4679
|
if (!name)
|
|
4678
4680
|
throw new Error(
|
|
@@ -4687,31 +4689,31 @@ function add_reaction(events, event, name, kind, make, builder) {
|
|
|
4687
4689
|
events[event].reactions.set(name, reaction);
|
|
4688
4690
|
return Object.assign(builder, {
|
|
4689
4691
|
to(resolver) {
|
|
4690
|
-
if (typeof resolver === "object")
|
|
4692
|
+
if (typeof resolver === "object") _chunkEXXHQ7CScjs.check.call(void 0, "target", resolver);
|
|
4691
4693
|
reaction.resolver = typeof resolver === "string" ? { target: resolver } : resolver;
|
|
4692
4694
|
return builder;
|
|
4693
4695
|
}
|
|
4694
4696
|
});
|
|
4695
4697
|
}
|
|
4696
|
-
|
|
4698
|
+
_chunk253TSECAcjs.__name.call(void 0, add_reaction, "add_reaction");
|
|
4697
4699
|
function reaction_on(event, events, builder) {
|
|
4698
|
-
const register = /* @__PURE__ */
|
|
4700
|
+
const register = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (handler, options, schedule) => add_reaction(
|
|
4699
4701
|
events,
|
|
4700
4702
|
event,
|
|
4701
4703
|
handler.name,
|
|
4702
4704
|
"Reaction",
|
|
4703
4705
|
() => {
|
|
4704
4706
|
if (schedule && typeof schedule !== "function")
|
|
4705
|
-
|
|
4707
|
+
_chunkEXXHQ7CScjs.check.call(void 0, "defer", schedule);
|
|
4706
4708
|
return {
|
|
4707
4709
|
handler: schedule ? make_deferred(handler, schedule) : handler,
|
|
4708
4710
|
resolver: _this_,
|
|
4709
4711
|
// Validate the whole bag at the declaration site so a bad
|
|
4710
4712
|
// `maxRetries`/`backoff`/`blockOnError` throws ZodError at build,
|
|
4711
4713
|
// not a NaN gate on the first retry.
|
|
4712
|
-
options:
|
|
4713
|
-
blockOnError: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _181 => _181.blockOnError]), () => (
|
|
4714
|
-
maxRetries: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _182 => _182.maxRetries]), () => (
|
|
4714
|
+
options: _chunkEXXHQ7CScjs.check.call(void 0, "reaction", {
|
|
4715
|
+
blockOnError: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _181 => _181.blockOnError]), () => ( _chunkEXXHQ7CScjs.DEFAULT_BLOCK_ON_ERROR)),
|
|
4716
|
+
maxRetries: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _182 => _182.maxRetries]), () => ( _chunkEXXHQ7CScjs.DEFAULT_MAX_RETRIES)),
|
|
4715
4717
|
backoff: _optionalChain([options, 'optionalAccess', _183 => _183.backoff])
|
|
4716
4718
|
})
|
|
4717
4719
|
};
|
|
@@ -4719,20 +4721,20 @@ function reaction_on(event, events, builder) {
|
|
|
4719
4721
|
builder
|
|
4720
4722
|
), "register");
|
|
4721
4723
|
return {
|
|
4722
|
-
do: /* @__PURE__ */
|
|
4723
|
-
defer: /* @__PURE__ */
|
|
4724
|
-
do: /* @__PURE__ */
|
|
4724
|
+
do: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (handler, options) => register(handler, options), "do"),
|
|
4725
|
+
defer: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (schedule) => ({
|
|
4726
|
+
do: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (handler, options) => register(handler, options, schedule), "do")
|
|
4725
4727
|
}), "defer")
|
|
4726
4728
|
};
|
|
4727
4729
|
}
|
|
4728
|
-
|
|
4730
|
+
_chunk253TSECAcjs.__name.call(void 0, reaction_on, "reaction_on");
|
|
4729
4731
|
|
|
4730
4732
|
// src/builders/event-builder.ts
|
|
4731
4733
|
|
|
4732
4734
|
|
|
4733
4735
|
// src/internal/sensitive.ts
|
|
4734
4736
|
var SENSITIVE = /* @__PURE__ */ Symbol.for("act.sensitive");
|
|
4735
|
-
var is_pii = /* @__PURE__ */
|
|
4737
|
+
var is_pii = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (schema) => some_layer(schema, (def) => def[SENSITIVE] === true), "is_pii");
|
|
4736
4738
|
function pii_schemas(schema) {
|
|
4737
4739
|
const fields = {};
|
|
4738
4740
|
const shape = schema.shape;
|
|
@@ -4748,7 +4750,7 @@ function pii_schemas(schema) {
|
|
|
4748
4750
|
fields[key] ??= field;
|
|
4749
4751
|
return fields;
|
|
4750
4752
|
}
|
|
4751
|
-
|
|
4753
|
+
_chunk253TSECAcjs.__name.call(void 0, pii_schemas, "pii_schemas");
|
|
4752
4754
|
|
|
4753
4755
|
// src/builders/event-builder.ts
|
|
4754
4756
|
function event_tags(schema) {
|
|
@@ -4759,7 +4761,7 @@ function event_tags(schema) {
|
|
|
4759
4761
|
if (dates) pii_dates[key] = dates.optional();
|
|
4760
4762
|
}
|
|
4761
4763
|
const data_reviver_schema = date_reviver_schema(schema);
|
|
4762
|
-
const revive = /* @__PURE__ */
|
|
4764
|
+
const revive = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (schema2) => (data) => {
|
|
4763
4765
|
const revived = schema2.safeParse(data);
|
|
4764
4766
|
return revived.success ? revived.data : data;
|
|
4765
4767
|
}, "revive");
|
|
@@ -4770,7 +4772,7 @@ function event_tags(schema) {
|
|
|
4770
4772
|
pii_date_reviver: dated_pii ? revive(_zod2.z.looseObject(pii_dates)) : void 0
|
|
4771
4773
|
};
|
|
4772
4774
|
}
|
|
4773
|
-
|
|
4775
|
+
_chunk253TSECAcjs.__name.call(void 0, event_tags, "event_tags");
|
|
4774
4776
|
function make_event_reader(tags, disclosure, predicate = null) {
|
|
4775
4777
|
const { date_reviver, pii_date_reviver } = tags;
|
|
4776
4778
|
const sensitive2 = Object.keys(tags.sensitive);
|
|
@@ -4790,9 +4792,9 @@ function make_event_reader(tags, disclosure, predicate = null) {
|
|
|
4790
4792
|
);
|
|
4791
4793
|
});
|
|
4792
4794
|
}
|
|
4793
|
-
|
|
4795
|
+
_chunk253TSECAcjs.__name.call(void 0, make_event_reader, "make_event_reader");
|
|
4794
4796
|
function build_events(registry, states, lanes, owners) {
|
|
4795
|
-
const declared = /* @__PURE__ */ new Set([
|
|
4797
|
+
const declared = /* @__PURE__ */ new Set([_chunk253TSECAcjs.DEFAULT_LANE, ...lanes.map((l) => l.name)]);
|
|
4796
4798
|
const lane_errors = [];
|
|
4797
4799
|
const tags = /* @__PURE__ */ new Map();
|
|
4798
4800
|
const sensitive2 = /* @__PURE__ */ new Map();
|
|
@@ -4825,7 +4827,7 @@ function build_events(registry, states, lanes, owners) {
|
|
|
4825
4827
|
handler_readers.set(event_name, handler_reader);
|
|
4826
4828
|
for (const [name, reaction] of def.reactions) {
|
|
4827
4829
|
const inner = reaction.handler;
|
|
4828
|
-
const wrapped2 = /* @__PURE__ */
|
|
4830
|
+
const wrapped2 = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (evt, stream, app) => inner(handler_reader(evt), stream, app), "wrapped");
|
|
4829
4831
|
Object.defineProperty(wrapped2, "name", { value: inner.name });
|
|
4830
4832
|
reaction.handler = wrapped2;
|
|
4831
4833
|
def.reactions.set(name, reaction);
|
|
@@ -4867,7 +4869,7 @@ function build_events(registry, states, lanes, owners) {
|
|
|
4867
4869
|
if (reader) readers.set(event_name, reader);
|
|
4868
4870
|
}
|
|
4869
4871
|
const snap2 = make_event_reader(event_tags(state2.state), "redact", null);
|
|
4870
|
-
if (snap2) readers.set(
|
|
4872
|
+
if (snap2) readers.set(_chunk253TSECAcjs.SNAP_EVENT, snap2);
|
|
4871
4873
|
if (readers.size === 0) continue;
|
|
4872
4874
|
state2.view = (event, actor) => (_nullishCoalesce(readers.get(event.name), () => ( IDENTITY_GATE)))(event, actor);
|
|
4873
4875
|
}
|
|
@@ -4878,12 +4880,12 @@ function build_events(registry, states, lanes, owners) {
|
|
|
4878
4880
|
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;
|
|
4879
4881
|
return { sensitive: sensitive2, advisory, query_readers, handler_readers };
|
|
4880
4882
|
}
|
|
4881
|
-
|
|
4883
|
+
_chunk253TSECAcjs.__name.call(void 0, build_events, "build_events");
|
|
4882
4884
|
function reads_as_string(schema) {
|
|
4883
4885
|
const type = _optionalChain([def_of, 'call', _184 => _184(output_of(schema)), 'optionalAccess', _185 => _185.type]);
|
|
4884
4886
|
return type === "string" || type === "transform";
|
|
4885
4887
|
}
|
|
4886
|
-
|
|
4888
|
+
_chunk253TSECAcjs.__name.call(void 0, reads_as_string, "reads_as_string");
|
|
4887
4889
|
|
|
4888
4890
|
// src/builders/act-builder.ts
|
|
4889
4891
|
function register_batch_handler(proj, batch_handlers) {
|
|
@@ -4896,7 +4898,7 @@ function register_batch_handler(proj, batch_handlers) {
|
|
|
4896
4898
|
}
|
|
4897
4899
|
batch_handlers.set(proj.target, proj.batchHandler);
|
|
4898
4900
|
}
|
|
4899
|
-
|
|
4901
|
+
_chunk253TSECAcjs.__name.call(void 0, register_batch_handler, "register_batch_handler");
|
|
4900
4902
|
function act() {
|
|
4901
4903
|
const states = /* @__PURE__ */ new Map();
|
|
4902
4904
|
const _sf = /* @__PURE__ */ new Map();
|
|
@@ -4910,16 +4912,16 @@ function act() {
|
|
|
4910
4912
|
const registry = {
|
|
4911
4913
|
actions: {},
|
|
4912
4914
|
events: {},
|
|
4913
|
-
sensitive_fields: /* @__PURE__ */
|
|
4914
|
-
query_gate: /* @__PURE__ */
|
|
4915
|
-
disclosure_predicate: /* @__PURE__ */
|
|
4916
|
-
deprecated_events: /* @__PURE__ */
|
|
4917
|
-
autoclose_policy: /* @__PURE__ */
|
|
4918
|
-
autoclose_archiver: /* @__PURE__ */
|
|
4915
|
+
sensitive_fields: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (name) => _nullishCoalesce(_sf.get(name), () => ( [])), "sensitive_fields"),
|
|
4916
|
+
query_gate: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (event_name) => _nullishCoalesce(_qg.get(event_name), () => ( IDENTITY_GATE)), "query_gate"),
|
|
4917
|
+
disclosure_predicate: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (state_name) => _nullishCoalesce(_dp.get(state_name), () => ( null)), "disclosure_predicate"),
|
|
4918
|
+
deprecated_events: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (state_name) => _nullishCoalesce(_de.get(state_name), () => ( EMPTY_DEPRECATED)), "deprecated_events"),
|
|
4919
|
+
autoclose_policy: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (state_name) => _nullishCoalesce(_ac.get(state_name), () => ( null)), "autoclose_policy"),
|
|
4920
|
+
autoclose_archiver: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (state_name) => _nullishCoalesce(_aa.get(state_name), () => ( null)), "autoclose_archiver")
|
|
4919
4921
|
};
|
|
4920
4922
|
const pending_projections = [];
|
|
4921
4923
|
const projection_reactions = /* @__PURE__ */ new Set();
|
|
4922
|
-
const record_projection_reactions = /* @__PURE__ */
|
|
4924
|
+
const record_projection_reactions = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (proj) => {
|
|
4923
4925
|
if (!proj.batchHandler && !proj.fold) return;
|
|
4924
4926
|
for (const register of Object.values(
|
|
4925
4927
|
proj.events
|
|
@@ -4929,7 +4931,7 @@ function act() {
|
|
|
4929
4931
|
}, "record_projection_reactions");
|
|
4930
4932
|
const fold_projections = [];
|
|
4931
4933
|
const batch_handlers = /* @__PURE__ */ new Map();
|
|
4932
|
-
const add_projection = /* @__PURE__ */
|
|
4934
|
+
const add_projection = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (proj) => {
|
|
4933
4935
|
record_projection_reactions(proj);
|
|
4934
4936
|
merge_projection(proj, registry.events);
|
|
4935
4937
|
register_batch_handler(proj, batch_handlers);
|
|
@@ -4938,8 +4940,8 @@ function act() {
|
|
|
4938
4940
|
const fold_specs = [];
|
|
4939
4941
|
const lanes = [];
|
|
4940
4942
|
let _built = false;
|
|
4941
|
-
const read_wrap = /* @__PURE__ */
|
|
4942
|
-
const wrapped2 = /* @__PURE__ */
|
|
4943
|
+
const read_wrap = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (original) => {
|
|
4944
|
+
const wrapped2 = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, async (events, stream) => {
|
|
4943
4945
|
const read = events.map((e) => _nullishCoalesce(_optionalChain([_hr, 'access', _186 => _186.get, 'call', _187 => _187(e.name), 'optionalCall', _188 => _188(e)]), () => ( e)));
|
|
4944
4946
|
return original(read, stream);
|
|
4945
4947
|
}, "wrapped");
|
|
@@ -4947,7 +4949,7 @@ function act() {
|
|
|
4947
4949
|
if (reset) Object.defineProperty(wrapped2, FOLD_RESET, { value: reset });
|
|
4948
4950
|
return wrapped2;
|
|
4949
4951
|
}, "read_wrap");
|
|
4950
|
-
const make_batch_handlers = /* @__PURE__ */
|
|
4952
|
+
const make_batch_handlers = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, () => {
|
|
4951
4953
|
const handlers = new Map(batch_handlers);
|
|
4952
4954
|
for (const spec of fold_specs) {
|
|
4953
4955
|
handlers.set(
|
|
@@ -4965,7 +4967,7 @@ function act() {
|
|
|
4965
4967
|
}
|
|
4966
4968
|
return handlers;
|
|
4967
4969
|
}, "make_batch_handlers");
|
|
4968
|
-
const finalize_deprecations = /* @__PURE__ */
|
|
4970
|
+
const finalize_deprecations = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, () => {
|
|
4969
4971
|
const deprecation_summary = [];
|
|
4970
4972
|
for (const state2 of states.values()) {
|
|
4971
4973
|
const event_names = Object.keys(state2.events);
|
|
@@ -4994,23 +4996,23 @@ function act() {
|
|
|
4994
4996
|
const list = deprecation_summary.map(
|
|
4995
4997
|
(d) => `"${d.deprecated}" (current: "${d.current}", state: "${d.state_name}")`
|
|
4996
4998
|
).join(", ");
|
|
4997
|
-
|
|
4999
|
+
_chunkEXXHQ7CScjs.log.call(void 0, ).info(
|
|
4998
5000
|
`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.`
|
|
4999
5001
|
);
|
|
5000
5002
|
}
|
|
5001
5003
|
}, "finalize_deprecations");
|
|
5002
|
-
const closed = /* @__PURE__ */
|
|
5004
|
+
const closed = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (method) => {
|
|
5003
5005
|
throw new Error(
|
|
5004
5006
|
`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).`
|
|
5005
5007
|
);
|
|
5006
5008
|
}, "closed");
|
|
5007
5009
|
const builder = {
|
|
5008
|
-
withState: /* @__PURE__ */
|
|
5010
|
+
withState: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (state2) => {
|
|
5009
5011
|
if (_built) closed("withState");
|
|
5010
5012
|
register_state(state2, states, registry.actions, registry.events);
|
|
5011
5013
|
return builder;
|
|
5012
5014
|
}, "withState"),
|
|
5013
|
-
withSlice: /* @__PURE__ */
|
|
5015
|
+
withSlice: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (input) => {
|
|
5014
5016
|
if (_built) closed("withSlice");
|
|
5015
5017
|
for (const s of input.states.values()) {
|
|
5016
5018
|
register_state(s, states, registry.actions, registry.events);
|
|
@@ -5020,22 +5022,22 @@ function act() {
|
|
|
5020
5022
|
for (const lane of input.lanes) register_lane(lane, lanes);
|
|
5021
5023
|
return builder;
|
|
5022
5024
|
}, "withSlice"),
|
|
5023
|
-
withProjection: /* @__PURE__ */
|
|
5025
|
+
withProjection: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (proj) => {
|
|
5024
5026
|
if (_built) closed("withProjection");
|
|
5025
5027
|
add_projection(proj);
|
|
5026
5028
|
return builder;
|
|
5027
5029
|
}, "withProjection"),
|
|
5028
|
-
withActor: /* @__PURE__ */
|
|
5029
|
-
withLane: /* @__PURE__ */
|
|
5030
|
+
withActor: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, () => builder, "withActor"),
|
|
5031
|
+
withLane: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (config2) => {
|
|
5030
5032
|
if (_built) closed("withLane");
|
|
5031
5033
|
register_lane(config2, lanes);
|
|
5032
5034
|
return builder;
|
|
5033
5035
|
}, "withLane"),
|
|
5034
|
-
on: /* @__PURE__ */
|
|
5036
|
+
on: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (event) => {
|
|
5035
5037
|
if (_built) closed("on");
|
|
5036
5038
|
return reaction_on(event, registry.events, builder);
|
|
5037
5039
|
}, "on"),
|
|
5038
|
-
build: /* @__PURE__ */
|
|
5040
|
+
build: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (options) => {
|
|
5039
5041
|
if (!_built) {
|
|
5040
5042
|
for (const proj of pending_projections) add_projection(proj);
|
|
5041
5043
|
for (const proj of fold_projections) {
|
|
@@ -5075,7 +5077,7 @@ function act() {
|
|
|
5075
5077
|
for (const [name, gate] of built.query_readers) _qg.set(name, gate);
|
|
5076
5078
|
for (const [name, gate] of built.handler_readers) _hr.set(name, gate);
|
|
5077
5079
|
finalize_deprecations();
|
|
5078
|
-
if (built.advisory)
|
|
5080
|
+
if (built.advisory) _chunkEXXHQ7CScjs.log.call(void 0, ).warn(built.advisory);
|
|
5079
5081
|
for (const [name, state2] of states) {
|
|
5080
5082
|
if (!state2.loads) continue;
|
|
5081
5083
|
const resolved = {};
|
|
@@ -5119,7 +5121,7 @@ function act() {
|
|
|
5119
5121
|
synthesize_autoclose_reactions(
|
|
5120
5122
|
registry,
|
|
5121
5123
|
states,
|
|
5122
|
-
|
|
5124
|
+
_chunkEXXHQ7CScjs.current_autoclose_window
|
|
5123
5125
|
);
|
|
5124
5126
|
Object.freeze(registry.actions);
|
|
5125
5127
|
Object.freeze(registry.events);
|
|
@@ -5138,14 +5140,14 @@ function act() {
|
|
|
5138
5140
|
};
|
|
5139
5141
|
return builder;
|
|
5140
5142
|
}
|
|
5141
|
-
|
|
5143
|
+
_chunk253TSECAcjs.__name.call(void 0, act, "act");
|
|
5142
5144
|
|
|
5143
5145
|
// src/builders/projection-builder.ts
|
|
5144
5146
|
function _projection(target) {
|
|
5145
5147
|
const events = {};
|
|
5146
5148
|
const default_resolver = typeof target === "string" ? { target } : void 0;
|
|
5147
5149
|
const base = {
|
|
5148
|
-
on: /* @__PURE__ */
|
|
5150
|
+
on: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (entry) => {
|
|
5149
5151
|
const keys = Object.keys(entry);
|
|
5150
5152
|
if (keys.length !== 1) throw new Error(".on() requires exactly one key");
|
|
5151
5153
|
const event = keys[0];
|
|
@@ -5157,7 +5159,7 @@ function _projection(target) {
|
|
|
5157
5159
|
};
|
|
5158
5160
|
}
|
|
5159
5161
|
return {
|
|
5160
|
-
do: /* @__PURE__ */
|
|
5162
|
+
do: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (handler) => {
|
|
5161
5163
|
const widened = base;
|
|
5162
5164
|
return add_reaction(
|
|
5163
5165
|
events,
|
|
@@ -5168,8 +5170,8 @@ function _projection(target) {
|
|
|
5168
5170
|
handler,
|
|
5169
5171
|
resolver: _nullishCoalesce(default_resolver, () => ( _this_)),
|
|
5170
5172
|
options: {
|
|
5171
|
-
blockOnError:
|
|
5172
|
-
maxRetries:
|
|
5173
|
+
blockOnError: _chunkEXXHQ7CScjs.DEFAULT_BLOCK_ON_ERROR,
|
|
5174
|
+
maxRetries: _chunkEXXHQ7CScjs.DEFAULT_MAX_RETRIES
|
|
5173
5175
|
}
|
|
5174
5176
|
}),
|
|
5175
5177
|
widened
|
|
@@ -5177,7 +5179,7 @@ function _projection(target) {
|
|
|
5177
5179
|
}, "do")
|
|
5178
5180
|
};
|
|
5179
5181
|
}, "on"),
|
|
5180
|
-
build: /* @__PURE__ */
|
|
5182
|
+
build: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, () => ({
|
|
5181
5183
|
_tag: "Projection",
|
|
5182
5184
|
events,
|
|
5183
5185
|
...target !== void 0 && { target }
|
|
@@ -5186,20 +5188,20 @@ function _projection(target) {
|
|
|
5186
5188
|
};
|
|
5187
5189
|
if (typeof target === "string") {
|
|
5188
5190
|
return Object.assign(base, {
|
|
5189
|
-
batch: /* @__PURE__ */
|
|
5190
|
-
build: /* @__PURE__ */
|
|
5191
|
+
batch: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (handler) => ({
|
|
5192
|
+
build: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, () => ({
|
|
5191
5193
|
_tag: "Projection",
|
|
5192
5194
|
events,
|
|
5193
5195
|
target,
|
|
5194
5196
|
batchHandler: handler
|
|
5195
5197
|
}), "build")
|
|
5196
5198
|
}), "batch"),
|
|
5197
|
-
of: /* @__PURE__ */
|
|
5199
|
+
of: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (...args) => {
|
|
5198
5200
|
if (Object.keys(events).length > 0)
|
|
5199
5201
|
throw new Error(
|
|
5200
5202
|
`Projection "${target}" mixes .of() with .on() handlers \u2014 a projection either folds a state or declares handlers, never both`
|
|
5201
5203
|
);
|
|
5202
|
-
const is_state = /* @__PURE__ */
|
|
5204
|
+
const is_state = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (a) => !!a && typeof a.init === "function", "is_state");
|
|
5203
5205
|
const partials = args.filter(is_state);
|
|
5204
5206
|
const options = _nullishCoalesce(args.find((a) => !is_state(a)), () => ( {}));
|
|
5205
5207
|
if (partials.length === 0)
|
|
@@ -5210,7 +5212,7 @@ function _projection(target) {
|
|
|
5210
5212
|
throw new Error(
|
|
5211
5213
|
`Projection "${target}" .of() partials must share one state name \u2014 got "${name}" and "${partial.name}"`
|
|
5212
5214
|
);
|
|
5213
|
-
const config2 =
|
|
5215
|
+
const config2 = _chunkEXXHQ7CScjs.check.call(void 0, "fold", options);
|
|
5214
5216
|
const fold_events = {};
|
|
5215
5217
|
for (const partial of partials)
|
|
5216
5218
|
for (const [event_name, schema] of Object.entries(partial.events)) {
|
|
@@ -5228,8 +5230,8 @@ function _projection(target) {
|
|
|
5228
5230
|
handler: noop,
|
|
5229
5231
|
resolver: { target },
|
|
5230
5232
|
options: {
|
|
5231
|
-
blockOnError:
|
|
5232
|
-
maxRetries:
|
|
5233
|
+
blockOnError: _chunkEXXHQ7CScjs.DEFAULT_BLOCK_ON_ERROR,
|
|
5234
|
+
maxRetries: _chunkEXXHQ7CScjs.DEFAULT_MAX_RETRIES
|
|
5233
5235
|
}
|
|
5234
5236
|
}
|
|
5235
5237
|
]
|
|
@@ -5237,8 +5239,8 @@ function _projection(target) {
|
|
|
5237
5239
|
};
|
|
5238
5240
|
}
|
|
5239
5241
|
return {
|
|
5240
|
-
flush: /* @__PURE__ */
|
|
5241
|
-
build: /* @__PURE__ */
|
|
5242
|
+
flush: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (handler) => ({
|
|
5243
|
+
build: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, () => ({
|
|
5242
5244
|
_tag: "Projection",
|
|
5243
5245
|
events: fold_events,
|
|
5244
5246
|
target,
|
|
@@ -5251,11 +5253,11 @@ function _projection(target) {
|
|
|
5251
5253
|
}
|
|
5252
5254
|
return base;
|
|
5253
5255
|
}
|
|
5254
|
-
|
|
5256
|
+
_chunk253TSECAcjs.__name.call(void 0, _projection, "_projection");
|
|
5255
5257
|
function projection(target) {
|
|
5256
5258
|
return _projection(target);
|
|
5257
5259
|
}
|
|
5258
|
-
|
|
5260
|
+
_chunk253TSECAcjs.__name.call(void 0, projection, "projection");
|
|
5259
5261
|
|
|
5260
5262
|
// src/builders/slice-builder.ts
|
|
5261
5263
|
function slice() {
|
|
@@ -5265,20 +5267,20 @@ function slice() {
|
|
|
5265
5267
|
const projections = [];
|
|
5266
5268
|
const lanes = [];
|
|
5267
5269
|
const builder = {
|
|
5268
|
-
withState: /* @__PURE__ */
|
|
5270
|
+
withState: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (state2) => {
|
|
5269
5271
|
register_state(state2, states, actions, events);
|
|
5270
5272
|
return builder;
|
|
5271
5273
|
}, "withState"),
|
|
5272
|
-
withProjection: /* @__PURE__ */
|
|
5274
|
+
withProjection: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (proj) => {
|
|
5273
5275
|
projections.push(proj);
|
|
5274
5276
|
return builder;
|
|
5275
5277
|
}, "withProjection"),
|
|
5276
|
-
withLane: /* @__PURE__ */
|
|
5278
|
+
withLane: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (config2) => {
|
|
5277
5279
|
register_lane(config2, lanes);
|
|
5278
5280
|
return builder;
|
|
5279
5281
|
}, "withLane"),
|
|
5280
|
-
on: /* @__PURE__ */
|
|
5281
|
-
build: /* @__PURE__ */
|
|
5282
|
+
on: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (event) => reaction_on(event, events, builder), "on"),
|
|
5283
|
+
build: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, () => ({
|
|
5282
5284
|
_tag: "Slice",
|
|
5283
5285
|
states,
|
|
5284
5286
|
events,
|
|
@@ -5289,7 +5291,7 @@ function slice() {
|
|
|
5289
5291
|
};
|
|
5290
5292
|
return builder;
|
|
5291
5293
|
}
|
|
5292
|
-
|
|
5294
|
+
_chunk253TSECAcjs.__name.call(void 0, slice, "slice");
|
|
5293
5295
|
|
|
5294
5296
|
// src/builders/state-builder.ts
|
|
5295
5297
|
function state(entry) {
|
|
@@ -5321,8 +5323,8 @@ function state(entry) {
|
|
|
5321
5323
|
// `act().build()` flips both on states with `sensitive(...)`
|
|
5322
5324
|
// events to bake in the gate / split and gate the cache write.
|
|
5323
5325
|
pii_aware: false,
|
|
5324
|
-
view: /* @__PURE__ */
|
|
5325
|
-
message: /* @__PURE__ */
|
|
5326
|
+
view: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (event) => event, "view"),
|
|
5327
|
+
message: /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (validated) => validated, "message")
|
|
5326
5328
|
};
|
|
5327
5329
|
const builder = action_builder(internal);
|
|
5328
5330
|
return Object.assign(builder, {
|
|
@@ -5336,7 +5338,7 @@ function state(entry) {
|
|
|
5336
5338
|
}
|
|
5337
5339
|
};
|
|
5338
5340
|
}
|
|
5339
|
-
|
|
5341
|
+
_chunk253TSECAcjs.__name.call(void 0, state, "state");
|
|
5340
5342
|
function action_builder(state2) {
|
|
5341
5343
|
const internal = state2;
|
|
5342
5344
|
const builder = {
|
|
@@ -5349,7 +5351,7 @@ function action_builder(state2) {
|
|
|
5349
5351
|
throw new Error(`Duplicate action "${action2}"`);
|
|
5350
5352
|
internal.actions[action2] = schema;
|
|
5351
5353
|
if (options) {
|
|
5352
|
-
|
|
5354
|
+
_chunkEXXHQ7CScjs.check.call(void 0, "action", options);
|
|
5353
5355
|
internal.options ??= {};
|
|
5354
5356
|
internal.options[action2] = options;
|
|
5355
5357
|
}
|
|
@@ -5373,12 +5375,12 @@ function action_builder(state2) {
|
|
|
5373
5375
|
(internal.loads ??= {})[action2] = loads;
|
|
5374
5376
|
return { loads: load2, requires, emit };
|
|
5375
5377
|
}
|
|
5376
|
-
|
|
5378
|
+
_chunk253TSECAcjs.__name.call(void 0, load2, "load");
|
|
5377
5379
|
function requires(rules) {
|
|
5378
5380
|
(internal.requires ??= {})[action2] = rules;
|
|
5379
5381
|
return { emit };
|
|
5380
5382
|
}
|
|
5381
|
-
|
|
5383
|
+
_chunk253TSECAcjs.__name.call(void 0, requires, "requires");
|
|
5382
5384
|
function emit(handler) {
|
|
5383
5385
|
if (typeof handler === "string") {
|
|
5384
5386
|
const event_name = handler;
|
|
@@ -5394,7 +5396,7 @@ function action_builder(state2) {
|
|
|
5394
5396
|
}
|
|
5395
5397
|
return builder;
|
|
5396
5398
|
}
|
|
5397
|
-
|
|
5399
|
+
_chunk253TSECAcjs.__name.call(void 0, emit, "emit");
|
|
5398
5400
|
return { loads: load2, requires, emit };
|
|
5399
5401
|
},
|
|
5400
5402
|
snap(snap2) {
|
|
@@ -5445,7 +5447,7 @@ function action_builder(state2) {
|
|
|
5445
5447
|
};
|
|
5446
5448
|
return builder;
|
|
5447
5449
|
}
|
|
5448
|
-
|
|
5450
|
+
_chunk253TSECAcjs.__name.call(void 0, action_builder, "action_builder");
|
|
5449
5451
|
|
|
5450
5452
|
// src/csv.ts
|
|
5451
5453
|
var _fs = require('fs');
|
|
@@ -5461,7 +5463,7 @@ var CSV_COLUMNS = [
|
|
|
5461
5463
|
];
|
|
5462
5464
|
var CsvFile = class {
|
|
5463
5465
|
static {
|
|
5464
|
-
|
|
5466
|
+
_chunk253TSECAcjs.__name.call(void 0, this, "CsvFile");
|
|
5465
5467
|
}
|
|
5466
5468
|
|
|
5467
5469
|
|
|
@@ -5556,7 +5558,7 @@ async function* linesFromFile(path) {
|
|
|
5556
5558
|
stream.close();
|
|
5557
5559
|
}
|
|
5558
5560
|
}
|
|
5559
|
-
|
|
5561
|
+
_chunk253TSECAcjs.__name.call(void 0, linesFromFile, "linesFromFile");
|
|
5560
5562
|
async function* linesFromBlob(blob) {
|
|
5561
5563
|
let start = 0;
|
|
5562
5564
|
while (start < blob.length) {
|
|
@@ -5567,7 +5569,7 @@ async function* linesFromBlob(blob) {
|
|
|
5567
5569
|
await Promise.resolve();
|
|
5568
5570
|
}
|
|
5569
5571
|
}
|
|
5570
|
-
|
|
5572
|
+
_chunk253TSECAcjs.__name.call(void 0, linesFromBlob, "linesFromBlob");
|
|
5571
5573
|
function parse_csv_line(line) {
|
|
5572
5574
|
const fields = [];
|
|
5573
5575
|
let i = 0;
|
|
@@ -5601,12 +5603,12 @@ function parse_csv_line(line) {
|
|
|
5601
5603
|
}
|
|
5602
5604
|
return fields;
|
|
5603
5605
|
}
|
|
5604
|
-
|
|
5606
|
+
_chunk253TSECAcjs.__name.call(void 0, parse_csv_line, "parse_csv_line");
|
|
5605
5607
|
function csv_escape(value) {
|
|
5606
5608
|
if (/[",\n\r]/.test(value)) return `"${value.replace(/"/g, '""')}"`;
|
|
5607
5609
|
return value;
|
|
5608
5610
|
}
|
|
5609
|
-
|
|
5611
|
+
_chunk253TSECAcjs.__name.call(void 0, csv_escape, "csv_escape");
|
|
5610
5612
|
function write_line(writer, line) {
|
|
5611
5613
|
return new Promise((resolve, reject) => {
|
|
5612
5614
|
writer.write(`${line}
|
|
@@ -5616,38 +5618,38 @@ function write_line(writer, line) {
|
|
|
5616
5618
|
});
|
|
5617
5619
|
});
|
|
5618
5620
|
}
|
|
5619
|
-
|
|
5621
|
+
_chunk253TSECAcjs.__name.call(void 0, write_line, "write_line");
|
|
5620
5622
|
|
|
5621
5623
|
// src/deprecated.ts
|
|
5622
|
-
var check_appends =
|
|
5623
|
-
var throw_if_stale =
|
|
5624
|
-
var concurrency_error =
|
|
5625
|
-
var seed_event =
|
|
5626
|
-
var fair_slots =
|
|
5627
|
-
var is_literal_source =
|
|
5628
|
-
var notification_of =
|
|
5629
|
-
var DEFAULT_QUERY_STREAMS_LIMIT2 =
|
|
5630
|
-
var ActorSchema2 =
|
|
5631
|
-
var TargetSchema2 =
|
|
5632
|
-
var EventMetaSchema2 =
|
|
5633
|
-
var CausationEventSchema2 =
|
|
5634
|
-
var CommittedMetaSchema2 =
|
|
5635
|
-
var QuerySchema2 =
|
|
5636
|
-
var Environments2 =
|
|
5637
|
-
var LogLevels2 =
|
|
5638
|
-
var ExitCodes2 =
|
|
5639
|
-
var DEFAULT_LANE2 =
|
|
5640
|
-
var DEFAULT_MAX_SUBSCRIBED_STREAMS2 =
|
|
5641
|
-
var DEFAULT_SETTLE_DEBOUNCE_MS2 =
|
|
5642
|
-
var PackageSchema =
|
|
5643
|
-
var default_scope =
|
|
5644
|
-
var extend = /* @__PURE__ */
|
|
5624
|
+
var check_appends = _chunkXSLQYVIGcjs.checkAppends;
|
|
5625
|
+
var throw_if_stale = _chunkXSLQYVIGcjs.checkVersion;
|
|
5626
|
+
var concurrency_error = _chunkXSLQYVIGcjs.concurrencyError;
|
|
5627
|
+
var seed_event = _chunkXSLQYVIGcjs.seedEvent;
|
|
5628
|
+
var fair_slots = _chunkXSLQYVIGcjs.fairSlots;
|
|
5629
|
+
var is_literal_source = _chunkXSLQYVIGcjs.isStreamName;
|
|
5630
|
+
var notification_of = _chunkXSLQYVIGcjs.parseNotification;
|
|
5631
|
+
var DEFAULT_QUERY_STREAMS_LIMIT2 = _chunk253TSECAcjs.DEFAULT_QUERY_STREAMS_LIMIT;
|
|
5632
|
+
var ActorSchema2 = _chunk253TSECAcjs.ActorSchema;
|
|
5633
|
+
var TargetSchema2 = _chunk253TSECAcjs.TargetSchema;
|
|
5634
|
+
var EventMetaSchema2 = _chunk253TSECAcjs.EventMetaSchema;
|
|
5635
|
+
var CausationEventSchema2 = _chunk253TSECAcjs.CausationEventSchema;
|
|
5636
|
+
var CommittedMetaSchema2 = _chunk253TSECAcjs.CommittedMetaSchema;
|
|
5637
|
+
var QuerySchema2 = _chunk253TSECAcjs.QuerySchema;
|
|
5638
|
+
var Environments2 = _chunk253TSECAcjs.Environments;
|
|
5639
|
+
var LogLevels2 = _chunk253TSECAcjs.LogLevels;
|
|
5640
|
+
var ExitCodes2 = _chunk253TSECAcjs.ExitCodes;
|
|
5641
|
+
var DEFAULT_LANE2 = _chunk253TSECAcjs.DEFAULT_LANE;
|
|
5642
|
+
var DEFAULT_MAX_SUBSCRIBED_STREAMS2 = _chunk253TSECAcjs.DEFAULT_MAX_SUBSCRIBED_STREAMS;
|
|
5643
|
+
var DEFAULT_SETTLE_DEBOUNCE_MS2 = _chunk253TSECAcjs.DEFAULT_SETTLE_DEBOUNCE_MS;
|
|
5644
|
+
var PackageSchema = _chunkEXXHQ7CScjs.package_schema;
|
|
5645
|
+
var default_scope = _chunkEXXHQ7CScjs.unscoped_ports;
|
|
5646
|
+
var extend = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (source, schema, target) => ({ ...target, ..._chunkEXXHQ7CScjs.validate.call(void 0, "config", source, schema) }), "extend");
|
|
5645
5647
|
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])?$/;
|
|
5646
|
-
var dateReviver = /* @__PURE__ */
|
|
5648
|
+
var dateReviver = /* @__PURE__ */ _chunk253TSECAcjs.__name.call(void 0, (_key, value) => typeof value === "string" && ISO_8601.test(value) ? new Date(value) : value, "dateReviver");
|
|
5647
5649
|
function sensitiveFields(schema) {
|
|
5648
5650
|
return Object.keys(pii_schemas(schema));
|
|
5649
5651
|
}
|
|
5650
|
-
|
|
5652
|
+
_chunk253TSECAcjs.__name.call(void 0, sensitiveFields, "sensitiveFields");
|
|
5651
5653
|
var pii_fields = sensitiveFields;
|
|
5652
5654
|
|
|
5653
5655
|
|
|
@@ -5708,5 +5710,5 @@ var pii_fields = sensitiveFields;
|
|
|
5708
5710
|
|
|
5709
5711
|
|
|
5710
5712
|
|
|
5711
|
-
exports.Act = Act; exports.ActorSchema = ActorSchema2; exports.CausationEventSchema = CausationEventSchema2; exports.CommittedMetaSchema = CommittedMetaSchema2; exports.ConcurrencyError =
|
|
5713
|
+
exports.Act = Act; exports.ActorSchema = ActorSchema2; exports.CausationEventSchema = CausationEventSchema2; exports.CommittedMetaSchema = CommittedMetaSchema2; exports.ConcurrencyError = _chunk253TSECAcjs.ConcurrencyError; exports.ConsoleLogger = _chunkEXXHQ7CScjs.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 = _chunk253TSECAcjs.DeferSignal; exports.Environments = Environments2; exports.Errors = _chunk253TSECAcjs.Errors; exports.EventMetaSchema = EventMetaSchema2; exports.ExitCodes = ExitCodes2; exports.InMemoryCache = _chunkEXXHQ7CScjs.InMemoryCache; exports.InMemoryStore = _chunkEXXHQ7CScjs.InMemoryStore; exports.LogLevels = LogLevels2; exports.NonRetryableError = _chunk253TSECAcjs.NonRetryableError; exports.PackageSchema = PackageSchema; exports.PreconditionError = _chunk253TSECAcjs.PreconditionError; exports.QuerySchema = QuerySchema2; exports.REDACTED = _chunk253TSECAcjs.REDACTED; exports.SHREDDED = _chunk253TSECAcjs.SHREDDED; exports.SNAP_EVENT = _chunk253TSECAcjs.SNAP_EVENT; exports.StoreError = _chunk253TSECAcjs.StoreError; exports.StreamClosedError = _chunk253TSECAcjs.StreamClosedError; exports.TOMBSTONE_EVENT = _chunk253TSECAcjs.TOMBSTONE_EVENT; exports.TargetSchema = TargetSchema2; exports.ValidationError = _chunk253TSECAcjs.ValidationError; exports.ZodEmpty = _chunk253TSECAcjs.ZodEmpty; exports.act = act; exports.cache = _chunkEXXHQ7CScjs.cache; exports.check_appends = check_appends; exports.concurrency_error = concurrency_error; exports.config = _chunkEXXHQ7CScjs.config; exports.dateReviver = dateReviver; exports.default_scope = default_scope; exports.dispose = _chunkEXXHQ7CScjs.dispose; exports.disposeAndExit = _chunkEXXHQ7CScjs.disposeAndExit; exports.extend = extend; exports.fair_slots = fair_slots; exports.is_literal_source = is_literal_source; exports.log = _chunkEXXHQ7CScjs.log; exports.notification_of = notification_of; exports.pii_fields = pii_fields; exports.port = _chunkEXXHQ7CScjs.port; exports.projection = projection; exports.seed_event = seed_event; exports.sensitive = _chunk253TSECAcjs.sensitive; exports.sensitiveFields = sensitiveFields; exports.sleep = _chunkEXXHQ7CScjs.sleep; exports.slice = slice; exports.state = state; exports.store = _chunkEXXHQ7CScjs.store; exports.throw_if_stale = throw_if_stale; exports.validate = _chunkEXXHQ7CScjs.validate;
|
|
5712
5714
|
//# sourceMappingURL=index.cjs.map
|