@rotorsoft/act 2.2.3 → 2.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/@types/act.d.ts +3 -3
- package/dist/@types/act.d.ts.map +1 -1
- package/dist/@types/adapters/in-memory-store.d.ts.map +1 -1
- package/dist/@types/types/ports.d.ts +3 -3
- package/dist/adapter.cjs +3 -3
- package/dist/adapter.js +2 -2
- package/dist/{chunk-ZI4NSYCD.cjs → chunk-4GA3CHQW.cjs} +1 -1
- package/dist/{chunk-ZI4NSYCD.cjs.map → chunk-4GA3CHQW.cjs.map} +1 -1
- package/dist/{chunk-53JUJWPI.js → chunk-KTMIRM5Z.js} +2 -2
- package/dist/{chunk-TI6QERGQ.js → chunk-ROC62MEU.js} +1 -1
- package/dist/{chunk-TI6QERGQ.js.map → chunk-ROC62MEU.js.map} +1 -1
- package/dist/{chunk-BJSOC2ZV.js → chunk-SJJVHRME.js} +10 -3
- package/dist/chunk-SJJVHRME.js.map +1 -0
- package/dist/{chunk-62LDEIDM.cjs → chunk-UYNNDDE7.cjs} +62 -55
- package/dist/chunk-UYNNDDE7.cjs.map +1 -0
- package/dist/{chunk-DAVFDMC4.cjs → chunk-XJZ2PKJH.cjs} +11 -11
- package/dist/{chunk-DAVFDMC4.cjs.map → chunk-XJZ2PKJH.cjs.map} +1 -1
- package/dist/index.cjs +429 -428
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -6
- 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-62LDEIDM.cjs.map +0 -1
- package/dist/chunk-BJSOC2ZV.js.map +0 -1
- /package/dist/{chunk-53JUJWPI.js.map → chunk-KTMIRM5Z.js.map} +0 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkXJZ2PKJHcjs = require('./chunk-XJZ2PKJH.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
@@ -12,7 +12,7 @@ var _chunkDAVFDMC4cjs = require('./chunk-DAVFDMC4.cjs');
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunk4GA3CHQWcjs = require('./chunk-4GA3CHQW.cjs');
|
|
16
16
|
|
|
17
17
|
// src/adapters/console-logger.ts
|
|
18
18
|
var LEVEL_VALUES = {
|
|
@@ -38,11 +38,11 @@ var LEVEL_COLORS = {
|
|
|
38
38
|
// gray
|
|
39
39
|
};
|
|
40
40
|
var RESET = "\x1B[0m";
|
|
41
|
-
var noop = /* @__PURE__ */
|
|
41
|
+
var noop = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => {
|
|
42
42
|
}, "noop");
|
|
43
43
|
var ConsoleLogger = class _ConsoleLogger {
|
|
44
44
|
static {
|
|
45
|
-
|
|
45
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, this, "ConsoleLogger");
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
|
|
@@ -144,7 +144,7 @@ var ConsoleLogger = class _ConsoleLogger {
|
|
|
144
144
|
// src/internal/lru-map.ts
|
|
145
145
|
var LruMap = (_class = class {
|
|
146
146
|
static {
|
|
147
|
-
|
|
147
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, this, "LruMap");
|
|
148
148
|
}
|
|
149
149
|
__init() {this._entries = /* @__PURE__ */ new Map()}
|
|
150
150
|
|
|
@@ -183,7 +183,7 @@ var LruMap = (_class = class {
|
|
|
183
183
|
// src/adapters/in-memory-cache.ts
|
|
184
184
|
var InMemoryCache = class {
|
|
185
185
|
static {
|
|
186
|
-
|
|
186
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, this, "InMemoryCache");
|
|
187
187
|
}
|
|
188
188
|
// CacheEntry<any> lets `get<TState>` and `set<TState>` flow without casts:
|
|
189
189
|
// any is bidirectionally compatible with the per-call TState binding, while
|
|
@@ -224,25 +224,25 @@ var _zod = require('zod');
|
|
|
224
224
|
|
|
225
225
|
// src/utils.ts
|
|
226
226
|
|
|
227
|
-
var validate = /* @__PURE__ */
|
|
227
|
+
var validate = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (target, payload, schema) => {
|
|
228
228
|
try {
|
|
229
229
|
return schema ? schema.parse(payload) : payload;
|
|
230
230
|
} catch (error) {
|
|
231
231
|
if (error instanceof _zod.ZodError) {
|
|
232
|
-
throw new (0,
|
|
232
|
+
throw new (0, _chunk4GA3CHQWcjs.ValidationError)(target, payload, _zod.prettifyError.call(void 0, error));
|
|
233
233
|
}
|
|
234
|
-
throw new (0,
|
|
234
|
+
throw new (0, _chunk4GA3CHQWcjs.ValidationError)(target, payload, error);
|
|
235
235
|
}
|
|
236
236
|
}, "validate");
|
|
237
237
|
async function sleep(ms) {
|
|
238
238
|
return new Promise((resolve) => setTimeout(resolve, _nullishCoalesce(ms, () => ( config().sleepMs))));
|
|
239
239
|
}
|
|
240
|
-
|
|
240
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, sleep, "sleep");
|
|
241
241
|
|
|
242
242
|
// src/adapters/in-memory-store.ts
|
|
243
243
|
var InMemoryStream = (_class2 = class {
|
|
244
244
|
static {
|
|
245
|
-
|
|
245
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, this, "InMemoryStream");
|
|
246
246
|
}
|
|
247
247
|
|
|
248
248
|
|
|
@@ -258,7 +258,7 @@ var InMemoryStream = (_class2 = class {
|
|
|
258
258
|
__init8() {this._deferred_at = void 0}
|
|
259
259
|
// Work mark; `undefined` = never correlated, so `claim` skips it.
|
|
260
260
|
__init9() {this._correlated_at = void 0}
|
|
261
|
-
constructor(stream, source, priority = 0, lane =
|
|
261
|
+
constructor(stream, source, priority = 0, lane = _chunk4GA3CHQWcjs.DEFAULT_LANE) {;_class2.prototype.__init2.call(this);_class2.prototype.__init3.call(this);_class2.prototype.__init4.call(this);_class2.prototype.__init5.call(this);_class2.prototype.__init6.call(this);_class2.prototype.__init7.call(this);_class2.prototype.__init8.call(this);_class2.prototype.__init9.call(this);
|
|
262
262
|
this.stream = stream;
|
|
263
263
|
this.source = source;
|
|
264
264
|
this._priority = priority;
|
|
@@ -385,14 +385,14 @@ var InMemoryStream = (_class2 = class {
|
|
|
385
385
|
return true;
|
|
386
386
|
}
|
|
387
387
|
}, _class2);
|
|
388
|
-
var name_test = /* @__PURE__ */
|
|
388
|
+
var name_test = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (pattern, exact) => {
|
|
389
389
|
if (exact) return (name) => name === pattern;
|
|
390
390
|
const re = new RegExp(pattern);
|
|
391
391
|
return (name) => re.test(name);
|
|
392
392
|
}, "name_test");
|
|
393
393
|
var InMemoryStore = (_class3 = class {constructor() { _class3.prototype.__init10.call(this);_class3.prototype.__init11.call(this);_class3.prototype.__init12.call(this);_class3.prototype.__init13.call(this);_class3.prototype.__init14.call(this);_class3.prototype.__init15.call(this);_class3.prototype.__init16.call(this); }
|
|
394
394
|
static {
|
|
395
|
-
|
|
395
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, this, "InMemoryStore");
|
|
396
396
|
}
|
|
397
397
|
__init10() {this._events = []}
|
|
398
398
|
// Never reused. Deletions punch holes, so ids are not array indexes.
|
|
@@ -458,7 +458,7 @@ var InMemoryStore = (_class3 = class {constructor() { _class3.prototype.__init10
|
|
|
458
458
|
if (query.names && !query.names.includes(e.name)) return false;
|
|
459
459
|
if (query.correlation && _optionalChain([e, 'access', _7 => _7.meta, 'optionalAccess', _8 => _8.correlation]) !== query.correlation)
|
|
460
460
|
return false;
|
|
461
|
-
if (e.name ===
|
|
461
|
+
if (e.name === _chunk4GA3CHQWcjs.SNAP_EVENT && !query.with_snaps) return false;
|
|
462
462
|
if (query.created_after && e.created <= query.created_after) return false;
|
|
463
463
|
if (query.created_before && e.created >= query.created_before)
|
|
464
464
|
return false;
|
|
@@ -471,7 +471,7 @@ var InMemoryStore = (_class3 = class {constructor() { _class3.prototype.__init10
|
|
|
471
471
|
return -1;
|
|
472
472
|
for (let j = this._events.length - 1; j >= 0; j--) {
|
|
473
473
|
const e = this._events[j];
|
|
474
|
-
if (e.stream === query.stream && e.name ===
|
|
474
|
+
if (e.stream === query.stream && e.name === _chunk4GA3CHQWcjs.SNAP_EVENT) return j;
|
|
475
475
|
}
|
|
476
476
|
return -1;
|
|
477
477
|
}
|
|
@@ -496,9 +496,9 @@ var InMemoryStore = (_class3 = class {constructor() { _class3.prototype.__init10
|
|
|
496
496
|
}
|
|
497
497
|
async commit(appends, meta) {
|
|
498
498
|
await sleep();
|
|
499
|
-
|
|
499
|
+
_chunkXJZ2PKJHcjs.checkAppends.call(void 0, appends);
|
|
500
500
|
for (const append of appends)
|
|
501
|
-
|
|
501
|
+
_chunkXJZ2PKJHcjs.checkVersion.call(void 0, append, _nullishCoalesce(this._stream_versions.get(append.stream), () => ( -1)));
|
|
502
502
|
const created = /* @__PURE__ */ new Date();
|
|
503
503
|
return appends.flatMap(({ stream, msgs }) => {
|
|
504
504
|
let version = _nullishCoalesce(this._stream_versions.get(stream), () => ( -1));
|
|
@@ -522,11 +522,11 @@ var InMemoryStore = (_class3 = class {constructor() { _class3.prototype.__init10
|
|
|
522
522
|
}
|
|
523
523
|
async claim(lagging, leading, by, millis, lane) {
|
|
524
524
|
await sleep();
|
|
525
|
-
const has_work = /* @__PURE__ */
|
|
525
|
+
const has_work = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (s) => s.correlated_at !== void 0 && s.at < s.correlated_at, "has_work");
|
|
526
526
|
const available = [...this._streams.values()].filter(
|
|
527
527
|
(s) => s.is_available && has_work(s) && (lane === void 0 || s.lane === lane)
|
|
528
528
|
);
|
|
529
|
-
const fair =
|
|
529
|
+
const fair = _chunkXJZ2PKJHcjs.fairSlots.call(void 0, lagging);
|
|
530
530
|
const by_priority = [...available].sort(
|
|
531
531
|
(a, b) => b.priority - a.priority || a.at - b.at
|
|
532
532
|
);
|
|
@@ -585,7 +585,7 @@ var InMemoryStore = (_class3 = class {constructor() { _class3.prototype.__init10
|
|
|
585
585
|
stream,
|
|
586
586
|
source,
|
|
587
587
|
priority = 0,
|
|
588
|
-
lane =
|
|
588
|
+
lane = _chunk4GA3CHQWcjs.DEFAULT_LANE,
|
|
589
589
|
correlated_at: correlated_at2
|
|
590
590
|
} of streams) {
|
|
591
591
|
const existing = this._streams.get(stream);
|
|
@@ -670,11 +670,11 @@ var InMemoryStore = (_class3 = class {constructor() { _class3.prototype.__init10
|
|
|
670
670
|
}
|
|
671
671
|
async query_streams(callback, query) {
|
|
672
672
|
await sleep();
|
|
673
|
-
const limit = _nullishCoalesce(_optionalChain([query, 'optionalAccess', _35 => _35.limit]), () => (
|
|
673
|
+
const limit = _nullishCoalesce(_optionalChain([query, 'optionalAccess', _35 => _35.limit]), () => ( _chunk4GA3CHQWcjs.DEFAULT_QUERY_STREAMS_LIMIT));
|
|
674
674
|
const after = _optionalChain([query, 'optionalAccess', _36 => _36.after]);
|
|
675
675
|
const source_matches = _optionalChain([query, 'optionalAccess', _37 => _37.source_matches]);
|
|
676
676
|
const matches = this._filter_predicate(_nullishCoalesce(query, () => ( {})));
|
|
677
|
-
const reverse_match = /* @__PURE__ */
|
|
677
|
+
const reverse_match = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (source) => {
|
|
678
678
|
const re = new RegExp(source);
|
|
679
679
|
return source_matches.some((name) => re.test(name));
|
|
680
680
|
}, "reverse_match");
|
|
@@ -717,7 +717,7 @@ var InMemoryStore = (_class3 = class {constructor() { _class3.prototype.__init10
|
|
|
717
717
|
const array_targets = Array.isArray(input) ? new Set(input) : null;
|
|
718
718
|
const stream_ok = !Array.isArray(input) && input.stream !== void 0 ? name_test(input.stream, input.stream_exact) : void 0;
|
|
719
719
|
const scope_cache = /* @__PURE__ */ new Map();
|
|
720
|
-
const in_scope = /* @__PURE__ */
|
|
720
|
+
const in_scope = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (stream) => {
|
|
721
721
|
const cached = scope_cache.get(stream);
|
|
722
722
|
if (cached !== void 0) return cached;
|
|
723
723
|
const ok = array_targets ? array_targets.has(stream) : _nullishCoalesce(_optionalChain([stream_ok, 'optionalCall', _49 => _49(stream)]), () => ( true));
|
|
@@ -764,7 +764,7 @@ var InMemoryStore = (_class3 = class {constructor() { _class3.prototype.__init10
|
|
|
764
764
|
for (const { stream, before, max_id } of windowed) {
|
|
765
765
|
let boundary;
|
|
766
766
|
for (const e of this._events) {
|
|
767
|
-
if (e.stream === stream && e.name ===
|
|
767
|
+
if (e.stream === stream && e.name === _chunk4GA3CHQWcjs.SNAP_EVENT && e.created < before && (max_id === void 0 || e.id <= max_id) && (!boundary || e.id > boundary.id))
|
|
768
768
|
boundary = e;
|
|
769
769
|
}
|
|
770
770
|
if (!boundary) continue;
|
|
@@ -793,7 +793,7 @@ var InMemoryStore = (_class3 = class {constructor() { _class3.prototype.__init10
|
|
|
793
793
|
stream,
|
|
794
794
|
version: 0,
|
|
795
795
|
created: /* @__PURE__ */ new Date(),
|
|
796
|
-
...
|
|
796
|
+
..._chunkXJZ2PKJHcjs.seedEvent.call(void 0, snapshot, meta)
|
|
797
797
|
};
|
|
798
798
|
this._events.push(event);
|
|
799
799
|
this._stream_versions.set(stream, 0);
|
|
@@ -820,8 +820,15 @@ var InMemoryStore = (_class3 = class {constructor() { _class3.prototype.__init10
|
|
|
820
820
|
this._streams = /* @__PURE__ */ new Map();
|
|
821
821
|
this._stream_versions = /* @__PURE__ */ new Map();
|
|
822
822
|
this._pii = /* @__PURE__ */ new Map();
|
|
823
|
+
const seen = /* @__PURE__ */ new Set();
|
|
823
824
|
try {
|
|
824
825
|
await driver(async (event) => {
|
|
826
|
+
const at = `${event.version}:${event.stream}`;
|
|
827
|
+
if (seen.has(at))
|
|
828
|
+
throw new Error(
|
|
829
|
+
`restore: stream "${event.stream}" has version ${event.version} twice`
|
|
830
|
+
);
|
|
831
|
+
seen.add(at);
|
|
825
832
|
const id = this._next_id++;
|
|
826
833
|
const { pii, ...rest } = event;
|
|
827
834
|
const committed = { ...rest, id };
|
|
@@ -845,24 +852,24 @@ var InMemoryStore = (_class3 = class {constructor() { _class3.prototype.__init10
|
|
|
845
852
|
|
|
846
853
|
// src/disposers.ts
|
|
847
854
|
var entries = [];
|
|
848
|
-
var prune = /* @__PURE__ */
|
|
855
|
+
var prune = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => {
|
|
849
856
|
for (let i = entries.length - 1; i >= 0; i--) {
|
|
850
857
|
const { ref } = entries[i];
|
|
851
858
|
if (ref && !ref.deref()) entries.splice(i, 1);
|
|
852
859
|
}
|
|
853
860
|
}, "prune");
|
|
854
|
-
var register_disposer = /* @__PURE__ */
|
|
861
|
+
var register_disposer = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (run) => {
|
|
855
862
|
prune();
|
|
856
863
|
entries.push({ run });
|
|
857
864
|
}, "register_disposer");
|
|
858
|
-
var register_weak_disposer = /* @__PURE__ */
|
|
865
|
+
var register_weak_disposer = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (ref, run) => {
|
|
859
866
|
prune();
|
|
860
867
|
entries.push({
|
|
861
868
|
run,
|
|
862
869
|
ref
|
|
863
870
|
});
|
|
864
871
|
}, "register_weak_disposer");
|
|
865
|
-
var run_disposers = /* @__PURE__ */
|
|
872
|
+
var run_disposers = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, async () => {
|
|
866
873
|
const failures = [];
|
|
867
874
|
for (const { run, ref } of [...entries].reverse()) {
|
|
868
875
|
const target = _optionalChain([ref, 'optionalAccess', _55 => _55.deref, 'call', _56 => _56()]);
|
|
@@ -883,7 +890,7 @@ var run_disposers = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, async
|
|
|
883
890
|
var MAX_TIMER_DELAY_MS = 2147483647;
|
|
884
891
|
var DeferTimer = (_class4 = class {
|
|
885
892
|
static {
|
|
886
|
-
|
|
893
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, this, "DeferTimer");
|
|
887
894
|
}
|
|
888
895
|
__init17() {this._due = /* @__PURE__ */ new Map()}
|
|
889
896
|
|
|
@@ -1044,8 +1051,8 @@ function is_time_zone(tz) {
|
|
|
1044
1051
|
return false;
|
|
1045
1052
|
}
|
|
1046
1053
|
}
|
|
1047
|
-
|
|
1048
|
-
var hour = /* @__PURE__ */
|
|
1054
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, is_time_zone, "is_time_zone");
|
|
1055
|
+
var hour = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (field) => _zod.z.number().int().min(0).max(23, {
|
|
1049
1056
|
message: `autocloseWindow.${field} must be an hour in [0, 23]`
|
|
1050
1057
|
}), "hour");
|
|
1051
1058
|
var AutocloseOptionsSchema = _zod.z.object({
|
|
@@ -1079,7 +1086,7 @@ var DeferWhenSchema = _zod.z.object({
|
|
|
1079
1086
|
}).strict().refine((w) => w.after === void 0 !== (w.at === void 0), {
|
|
1080
1087
|
message: "defer: specify exactly one of `after` or `at`"
|
|
1081
1088
|
});
|
|
1082
|
-
var window_schema = /* @__PURE__ */
|
|
1089
|
+
var window_schema = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, (field, min_days, floor) => _zod.z.object({
|
|
1083
1090
|
days: _zod.z.number({ message: `autocloses: ${field}.days must be a number` }).positive(`autocloses: ${field}.days must be > 0`)
|
|
1084
1091
|
}).refine((o) => o.days >= min_days, {
|
|
1085
1092
|
message: `autocloses: ${field} resolves to < ${floor}, which is too short to be a meaningful retention window`
|
|
@@ -1145,7 +1152,7 @@ var SCHEMAS = {
|
|
|
1145
1152
|
function check(kind, options) {
|
|
1146
1153
|
return SCHEMAS[kind].parse(options);
|
|
1147
1154
|
}
|
|
1148
|
-
|
|
1155
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, check, "check");
|
|
1149
1156
|
|
|
1150
1157
|
// src/scoped.ts
|
|
1151
1158
|
var _async_hooks = require('async_hooks');
|
|
@@ -1154,15 +1161,15 @@ var reacting = new (0, _async_hooks.AsyncLocalStorage)();
|
|
|
1154
1161
|
function make_run_scoped(bag) {
|
|
1155
1162
|
return (fn) => scoped.run(bag, fn);
|
|
1156
1163
|
}
|
|
1157
|
-
|
|
1164
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, make_run_scoped, "make_run_scoped");
|
|
1158
1165
|
function current_autoclose_window() {
|
|
1159
1166
|
return _optionalChain([scoped, 'access', _57 => _57.getStore, 'call', _58 => _58(), 'optionalAccess', _59 => _59.autoclose_window]);
|
|
1160
1167
|
}
|
|
1161
|
-
|
|
1168
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, current_autoclose_window, "current_autoclose_window");
|
|
1162
1169
|
function current_ports() {
|
|
1163
1170
|
return scoped.getStore();
|
|
1164
1171
|
}
|
|
1165
|
-
|
|
1172
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, current_ports, "current_ports");
|
|
1166
1173
|
function run_reacting(event, fn) {
|
|
1167
1174
|
const box = { event };
|
|
1168
1175
|
return reacting.run(box, async () => {
|
|
@@ -1173,15 +1180,15 @@ function run_reacting(event, fn) {
|
|
|
1173
1180
|
}
|
|
1174
1181
|
});
|
|
1175
1182
|
}
|
|
1176
|
-
|
|
1183
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, run_reacting, "run_reacting");
|
|
1177
1184
|
function current_reacting() {
|
|
1178
1185
|
return _optionalChain([reacting, 'access', _60 => _60.getStore, 'call', _61 => _61(), 'optionalAccess', _62 => _62.event]);
|
|
1179
1186
|
}
|
|
1180
|
-
|
|
1187
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, current_reacting, "current_reacting");
|
|
1181
1188
|
function make_reaction_scope(app) {
|
|
1182
1189
|
return { app, run: run_reacting };
|
|
1183
1190
|
}
|
|
1184
|
-
|
|
1191
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, make_reaction_scope, "make_reaction_scope");
|
|
1185
1192
|
|
|
1186
1193
|
// src/ports.ts
|
|
1187
1194
|
var adapters = /* @__PURE__ */ new Map();
|
|
@@ -1195,28 +1202,28 @@ function port(injector) {
|
|
|
1195
1202
|
return adapters.get(injector.name);
|
|
1196
1203
|
};
|
|
1197
1204
|
}
|
|
1198
|
-
|
|
1199
|
-
var log = port(/* @__PURE__ */
|
|
1205
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, port, "port");
|
|
1206
|
+
var log = port(/* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, function log2(adapter) {
|
|
1200
1207
|
const cfg = config();
|
|
1201
1208
|
return adapter || new ConsoleLogger({
|
|
1202
1209
|
level: cfg.logLevel,
|
|
1203
1210
|
pretty: cfg.env !== "production"
|
|
1204
1211
|
});
|
|
1205
1212
|
}, "log"));
|
|
1206
|
-
var _store = port(/* @__PURE__ */
|
|
1213
|
+
var _store = port(/* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, function store(adapter) {
|
|
1207
1214
|
if (adapter) check("store", adapter);
|
|
1208
1215
|
return _nullishCoalesce(adapter, () => ( new InMemoryStore()));
|
|
1209
1216
|
}, "store"));
|
|
1210
|
-
var store2 = /* @__PURE__ */
|
|
1217
|
+
var store2 = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, ((adapter) => {
|
|
1211
1218
|
return _nullishCoalesce(_optionalChain([current_ports, 'call', _63 => _63(), 'optionalAccess', _64 => _64.store]), () => ( _store(adapter)));
|
|
1212
1219
|
}), "store");
|
|
1213
|
-
var _cache = port(/* @__PURE__ */
|
|
1220
|
+
var _cache = port(/* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, function cache(adapter) {
|
|
1214
1221
|
return _nullishCoalesce(adapter, () => ( new InMemoryCache()));
|
|
1215
1222
|
}, "cache"));
|
|
1216
|
-
var cache2 = /* @__PURE__ */
|
|
1223
|
+
var cache2 = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, ((adapter) => {
|
|
1217
1224
|
return _nullishCoalesce(_optionalChain([current_ports, 'call', _65 => _65(), 'optionalAccess', _66 => _66.cache]), () => ( _cache(adapter)));
|
|
1218
1225
|
}), "cache");
|
|
1219
|
-
var unscoped_ports = /* @__PURE__ */
|
|
1226
|
+
var unscoped_ports = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => DEFAULT_SCOPE, "unscoped_ports");
|
|
1220
1227
|
var DEFAULT_SCOPE = {
|
|
1221
1228
|
get store() {
|
|
1222
1229
|
return _store();
|
|
@@ -1246,12 +1253,12 @@ async function disposeAndExit(code = "EXIT") {
|
|
|
1246
1253
|
const failed = code === "ERROR" || failures.length > 0;
|
|
1247
1254
|
config().env !== "test" && process.exit(failed ? 1 : 0);
|
|
1248
1255
|
}
|
|
1249
|
-
|
|
1256
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, disposeAndExit, "disposeAndExit");
|
|
1250
1257
|
function dispose(disposer) {
|
|
1251
1258
|
disposer && register_disposer(disposer);
|
|
1252
1259
|
return disposeAndExit;
|
|
1253
1260
|
}
|
|
1254
|
-
|
|
1261
|
+
_chunk4GA3CHQWcjs.__name.call(void 0, dispose, "dispose");
|
|
1255
1262
|
|
|
1256
1263
|
// src/config.ts
|
|
1257
1264
|
var package_schema = _zod.z.object({
|
|
@@ -1267,7 +1274,7 @@ var FALLBACK_PACKAGE = {
|
|
|
1267
1274
|
version: "0.0.0-fallback",
|
|
1268
1275
|
description: "Synthetic fallback \u2014 package.json could not be loaded"
|
|
1269
1276
|
};
|
|
1270
|
-
var get_package = /* @__PURE__ */
|
|
1277
|
+
var get_package = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => {
|
|
1271
1278
|
try {
|
|
1272
1279
|
const raw = JSON.parse(fs.readFileSync("package.json").toString());
|
|
1273
1280
|
const pkg2 = {
|
|
@@ -1286,8 +1293,8 @@ var get_package = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, () => {
|
|
|
1286
1293
|
}, "get_package");
|
|
1287
1294
|
var pkg_load_error;
|
|
1288
1295
|
var BaseSchema = package_schema.extend({
|
|
1289
|
-
env: _zod.z.enum(
|
|
1290
|
-
logLevel: _zod.z.enum(
|
|
1296
|
+
env: _zod.z.enum(_chunk4GA3CHQWcjs.Environments),
|
|
1297
|
+
logLevel: _zod.z.enum(_chunk4GA3CHQWcjs.LogLevels),
|
|
1291
1298
|
logSingleLine: _zod.z.boolean(),
|
|
1292
1299
|
sleepMs: _zod.z.number().int().min(0).max(5e3)
|
|
1293
1300
|
});
|
|
@@ -1298,7 +1305,7 @@ var logSingleLine = (LOG_SINGLE_LINE || "true") === "true";
|
|
|
1298
1305
|
var sleepMs = parseInt(NODE_ENV === "test" ? "0" : _nullishCoalesce(SLEEP_MS, () => ( "100")), 10);
|
|
1299
1306
|
var pkg = get_package();
|
|
1300
1307
|
var _validated;
|
|
1301
|
-
var config = /* @__PURE__ */
|
|
1308
|
+
var config = /* @__PURE__ */ _chunk4GA3CHQWcjs.__name.call(void 0, () => {
|
|
1302
1309
|
if (!_validated) {
|
|
1303
1310
|
_validated = validate(
|
|
1304
1311
|
"config",
|
|
@@ -1347,4 +1354,4 @@ var config = /* @__PURE__ */ _chunkZI4NSYCDcjs.__name.call(void 0, () => {
|
|
|
1347
1354
|
|
|
1348
1355
|
|
|
1349
1356
|
exports.ConsoleLogger = ConsoleLogger; exports.LruMap = LruMap; exports.InMemoryCache = InMemoryCache; exports.package_schema = package_schema; exports.config = config; exports.validate = validate; exports.sleep = sleep; exports.InMemoryStore = InMemoryStore; exports.register_weak_disposer = register_weak_disposer; exports.DeferTimer = DeferTimer; exports.DEFAULT_BACKOFF = DEFAULT_BACKOFF; exports.DEFAULT_MAX_RETRIES = DEFAULT_MAX_RETRIES; exports.DEFAULT_BLOCK_ON_ERROR = DEFAULT_BLOCK_ON_ERROR; exports.DEFAULT_STREAM_LIMIT = DEFAULT_STREAM_LIMIT; exports.DEFAULT_EVENT_LIMIT = DEFAULT_EVENT_LIMIT; exports.DEFAULT_LEASE_MILLIS = DEFAULT_LEASE_MILLIS; exports.MAX_SHUTDOWN_GRACE_MS = MAX_SHUTDOWN_GRACE_MS; exports.check = check; exports.make_run_scoped = make_run_scoped; exports.current_autoclose_window = current_autoclose_window; exports.current_reacting = current_reacting; exports.make_reaction_scope = make_reaction_scope; exports.port = port; exports.log = log; exports.store = store2; exports.cache = cache2; exports.unscoped_ports = unscoped_ports; exports.disposeAndExit = disposeAndExit; exports.dispose = dispose;
|
|
1350
|
-
//# sourceMappingURL=chunk-
|
|
1357
|
+
//# sourceMappingURL=chunk-UYNNDDE7.cjs.map
|