@rotorsoft/act 2.1.9 → 2.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/@types/act.d.ts.map +1 -1
- package/dist/@types/builders/builder-utils.d.ts.map +1 -1
- package/dist/@types/deprecated.d.ts +0 -3
- package/dist/@types/deprecated.d.ts.map +1 -1
- package/dist/@types/index.d.ts +1 -1
- package/dist/@types/index.d.ts.map +1 -1
- package/dist/@types/internal/autoclose-policy.d.ts +1 -1
- package/dist/@types/internal/autoclose-policy.d.ts.map +1 -1
- package/dist/@types/internal/config.d.ts +128 -95
- package/dist/@types/internal/config.d.ts.map +1 -1
- package/dist/@types/internal/correlate-cycle.d.ts.map +1 -1
- package/dist/@types/internal/defer-config.d.ts +2 -9
- package/dist/@types/internal/defer-config.d.ts.map +1 -1
- package/dist/@types/types/act.d.ts +2 -2
- package/dist/adapter.cjs +3 -3
- package/dist/adapter.js +2 -2
- package/dist/{chunk-C35J3SNT.js → chunk-BQUOIHOR.js} +1 -1
- package/dist/chunk-BQUOIHOR.js.map +1 -0
- package/dist/{chunk-YXP6WASH.cjs → chunk-N74AN6L5.cjs} +132 -139
- package/dist/chunk-N74AN6L5.cjs.map +1 -0
- package/dist/{chunk-TUALNYW2.js → chunk-RV34EYSN.js} +2 -2
- package/dist/{chunk-D7LQNOEV.cjs → chunk-SC6TY4P2.cjs} +4 -4
- package/dist/{chunk-D7LQNOEV.cjs.map → chunk-SC6TY4P2.cjs.map} +1 -1
- package/dist/{chunk-NYDHZSYZ.js → chunk-Y2ISPWQL.js} +113 -120
- package/dist/chunk-Y2ISPWQL.js.map +1 -0
- package/dist/{chunk-QFYPSI6P.cjs → chunk-ZTHGF62O.cjs} +1 -1
- package/dist/chunk-ZTHGF62O.cjs.map +1 -0
- package/dist/index.cjs +204 -274
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +47 -117
- package/dist/index.js.map +1 -1
- package/dist/test/index.cjs +5 -5
- 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-C35J3SNT.js.map +0 -1
- package/dist/chunk-NYDHZSYZ.js.map +0 -1
- package/dist/chunk-QFYPSI6P.cjs.map +0 -1
- package/dist/chunk-YXP6WASH.cjs.map +0 -1
- /package/dist/{chunk-TUALNYW2.js.map → chunk-RV34EYSN.js.map} +0 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkSC6TY4P2cjs = require('./chunk-SC6TY4P2.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
@@ -11,7 +11,7 @@ var _chunkD7LQNOEVcjs = require('./chunk-D7LQNOEV.cjs');
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunkZTHGF62Ocjs = require('./chunk-ZTHGF62O.cjs');
|
|
15
15
|
|
|
16
16
|
// src/adapters/console-logger.ts
|
|
17
17
|
var LEVEL_VALUES = {
|
|
@@ -219,9 +219,9 @@ var validate = (target, payload, schema) => {
|
|
|
219
219
|
return schema ? schema.parse(payload) : payload;
|
|
220
220
|
} catch (error) {
|
|
221
221
|
if (error instanceof _zod.ZodError) {
|
|
222
|
-
throw new (0,
|
|
222
|
+
throw new (0, _chunkZTHGF62Ocjs.ValidationError)(target, payload, _zod.prettifyError.call(void 0, error));
|
|
223
223
|
}
|
|
224
|
-
throw new (0,
|
|
224
|
+
throw new (0, _chunkZTHGF62Ocjs.ValidationError)(target, payload, error);
|
|
225
225
|
}
|
|
226
226
|
};
|
|
227
227
|
async function sleep(ms) {
|
|
@@ -244,7 +244,7 @@ var InMemoryStream = (_class2 = class {
|
|
|
244
244
|
__init8() {this._deferred_at = void 0}
|
|
245
245
|
// Work mark; `undefined` = never correlated, so `claim` skips it.
|
|
246
246
|
__init9() {this._correlated_at = void 0}
|
|
247
|
-
constructor(stream, source, priority = 0, lane =
|
|
247
|
+
constructor(stream, source, priority = 0, lane = _chunkZTHGF62Ocjs.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);
|
|
248
248
|
this.stream = stream;
|
|
249
249
|
this.source = source;
|
|
250
250
|
this._priority = priority;
|
|
@@ -441,7 +441,7 @@ var InMemoryStore = (_class3 = class {constructor() { _class3.prototype.__init10
|
|
|
441
441
|
if (query.names && !query.names.includes(e.name)) return false;
|
|
442
442
|
if (query.correlation && _optionalChain([e, 'access', _7 => _7.meta, 'optionalAccess', _8 => _8.correlation]) !== query.correlation)
|
|
443
443
|
return false;
|
|
444
|
-
if (e.name ===
|
|
444
|
+
if (e.name === _chunkZTHGF62Ocjs.SNAP_EVENT && !query.with_snaps) return false;
|
|
445
445
|
if (query.created_after && e.created <= query.created_after) return false;
|
|
446
446
|
if (query.created_before && e.created >= query.created_before)
|
|
447
447
|
return false;
|
|
@@ -454,7 +454,7 @@ var InMemoryStore = (_class3 = class {constructor() { _class3.prototype.__init10
|
|
|
454
454
|
return -1;
|
|
455
455
|
for (let j = this._events.length - 1; j >= 0; j--) {
|
|
456
456
|
const e = this._events[j];
|
|
457
|
-
if (e.stream === query.stream && e.name ===
|
|
457
|
+
if (e.stream === query.stream && e.name === _chunkZTHGF62Ocjs.SNAP_EVENT) return j;
|
|
458
458
|
}
|
|
459
459
|
return -1;
|
|
460
460
|
}
|
|
@@ -479,9 +479,9 @@ var InMemoryStore = (_class3 = class {constructor() { _class3.prototype.__init10
|
|
|
479
479
|
}
|
|
480
480
|
async commit(appends, meta) {
|
|
481
481
|
await sleep();
|
|
482
|
-
|
|
482
|
+
_chunkSC6TY4P2cjs.checkAppends.call(void 0, appends);
|
|
483
483
|
for (const append of appends)
|
|
484
|
-
|
|
484
|
+
_chunkSC6TY4P2cjs.checkVersion.call(void 0, append, _nullishCoalesce(this._stream_versions.get(append.stream), () => ( -1)));
|
|
485
485
|
const created = /* @__PURE__ */ new Date();
|
|
486
486
|
return appends.flatMap(({ stream, msgs }) => {
|
|
487
487
|
let version = _nullishCoalesce(this._stream_versions.get(stream), () => ( -1));
|
|
@@ -509,7 +509,7 @@ var InMemoryStore = (_class3 = class {constructor() { _class3.prototype.__init10
|
|
|
509
509
|
const available = [...this._streams.values()].filter(
|
|
510
510
|
(s) => s.is_available && has_work(s) && (lane === void 0 || s.lane === lane)
|
|
511
511
|
);
|
|
512
|
-
const fair =
|
|
512
|
+
const fair = _chunkSC6TY4P2cjs.fairSlots.call(void 0, lagging);
|
|
513
513
|
const by_priority = [...available].sort(
|
|
514
514
|
(a, b) => b.priority - a.priority || a.at - b.at
|
|
515
515
|
);
|
|
@@ -568,7 +568,7 @@ var InMemoryStore = (_class3 = class {constructor() { _class3.prototype.__init10
|
|
|
568
568
|
stream,
|
|
569
569
|
source,
|
|
570
570
|
priority = 0,
|
|
571
|
-
lane =
|
|
571
|
+
lane = _chunkZTHGF62Ocjs.DEFAULT_LANE,
|
|
572
572
|
correlated_at: correlated_at2
|
|
573
573
|
} of streams) {
|
|
574
574
|
const existing = this._streams.get(stream);
|
|
@@ -653,7 +653,7 @@ var InMemoryStore = (_class3 = class {constructor() { _class3.prototype.__init10
|
|
|
653
653
|
}
|
|
654
654
|
async query_streams(callback, query) {
|
|
655
655
|
await sleep();
|
|
656
|
-
const limit = _nullishCoalesce(_optionalChain([query, 'optionalAccess', _35 => _35.limit]), () => (
|
|
656
|
+
const limit = _nullishCoalesce(_optionalChain([query, 'optionalAccess', _35 => _35.limit]), () => ( _chunkZTHGF62Ocjs.DEFAULT_QUERY_STREAMS_LIMIT));
|
|
657
657
|
const after = _optionalChain([query, 'optionalAccess', _36 => _36.after]);
|
|
658
658
|
const source_matches = _optionalChain([query, 'optionalAccess', _37 => _37.source_matches]);
|
|
659
659
|
const matches = this._filter_predicate(_nullishCoalesce(query, () => ( {})));
|
|
@@ -747,7 +747,7 @@ var InMemoryStore = (_class3 = class {constructor() { _class3.prototype.__init10
|
|
|
747
747
|
for (const { stream, before, max_id } of windowed) {
|
|
748
748
|
let boundary;
|
|
749
749
|
for (const e of this._events) {
|
|
750
|
-
if (e.stream === stream && e.name ===
|
|
750
|
+
if (e.stream === stream && e.name === _chunkZTHGF62Ocjs.SNAP_EVENT && e.created < before && (max_id === void 0 || e.id <= max_id) && (!boundary || e.id > boundary.id))
|
|
751
751
|
boundary = e;
|
|
752
752
|
}
|
|
753
753
|
if (!boundary) continue;
|
|
@@ -776,7 +776,7 @@ var InMemoryStore = (_class3 = class {constructor() { _class3.prototype.__init10
|
|
|
776
776
|
stream,
|
|
777
777
|
version: 0,
|
|
778
778
|
created: /* @__PURE__ */ new Date(),
|
|
779
|
-
...
|
|
779
|
+
..._chunkSC6TY4P2cjs.seedEvent.call(void 0, snapshot, meta)
|
|
780
780
|
};
|
|
781
781
|
this._events.push(event);
|
|
782
782
|
this._stream_versions.set(stream, 0);
|
|
@@ -875,50 +875,30 @@ var ReactionOptionsSchema = _zod.z.object({
|
|
|
875
875
|
maxRetries: _zod.z.number().int().min(0),
|
|
876
876
|
backoff: BackoffOptionsSchema.optional()
|
|
877
877
|
});
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
878
|
+
var ActionOptionsSchema = _zod.z.object({
|
|
879
|
+
maxRetries: _zod.z.number().int().min(0).optional(),
|
|
880
|
+
backoff: BackoffOptionsSchema.optional()
|
|
881
|
+
});
|
|
881
882
|
var TargetOptionsSchema = _zod.z.object({ priority: _zod.z.int32().optional() });
|
|
882
|
-
function check_target(options) {
|
|
883
|
-
TargetOptionsSchema.parse(options);
|
|
884
|
-
}
|
|
885
|
-
function is_valid_target(options) {
|
|
886
|
-
return TargetOptionsSchema.safeParse(options).success;
|
|
887
|
-
}
|
|
888
883
|
var ScanOptionsSchema = _zod.z.object({
|
|
889
884
|
batch_size: _zod.z.number().int().min(1).optional()
|
|
890
885
|
});
|
|
891
|
-
function check_scan_options(options) {
|
|
892
|
-
ScanOptionsSchema.parse({ batch_size: options.batch_size });
|
|
893
|
-
}
|
|
894
886
|
var AuditOptionsSchema = _zod.z.object({
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
887
|
+
thresholds: _zod.z.object({
|
|
888
|
+
idle_days: _zod.z.number().min(0).optional(),
|
|
889
|
+
restart_min: _zod.z.number().min(0).optional(),
|
|
890
|
+
stuck_minutes: _zod.z.number().min(0).optional(),
|
|
891
|
+
near_block: _zod.z.number().min(0).optional(),
|
|
892
|
+
deprecated_min: _zod.z.number().min(0).optional(),
|
|
893
|
+
drift_min: _zod.z.number().min(0).optional()
|
|
894
|
+
}).optional()
|
|
901
895
|
});
|
|
902
|
-
function check_audit_options(options) {
|
|
903
|
-
AuditOptionsSchema.parse(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _55 => _55.thresholds]), () => ( {})));
|
|
904
|
-
}
|
|
905
|
-
var ActionOptionsSchema = _zod.z.object({
|
|
906
|
-
maxRetries: _zod.z.number().int().min(0).optional(),
|
|
907
|
-
backoff: BackoffOptionsSchema.optional()
|
|
908
|
-
});
|
|
909
|
-
function resolveActionConfig(options) {
|
|
910
|
-
return ActionOptionsSchema.parse(options);
|
|
911
|
-
}
|
|
912
896
|
var LaneConfigSchema = _zod.z.object({
|
|
913
897
|
name: _zod.z.string().min(1),
|
|
914
898
|
leaseMillis: _zod.z.number().min(0).optional(),
|
|
915
899
|
streamLimit: _zod.z.number().int().min(0).optional(),
|
|
916
900
|
cycleMs: _zod.z.number().min(0).optional()
|
|
917
901
|
});
|
|
918
|
-
function resolveLaneConfig(options) {
|
|
919
|
-
LaneConfigSchema.parse(options);
|
|
920
|
-
return options;
|
|
921
|
-
}
|
|
922
902
|
var DEFAULT_STREAM_LIMIT = 10;
|
|
923
903
|
var DEFAULT_EVENT_LIMIT = 10;
|
|
924
904
|
var DEFAULT_LEASE_MILLIS = 1e4;
|
|
@@ -927,54 +907,22 @@ var DrainOptionsSchema = _zod.z.object({
|
|
|
927
907
|
eventLimit: _zod.z.number().int().min(0).optional(),
|
|
928
908
|
leaseMillis: _zod.z.number().min(0).optional()
|
|
929
909
|
});
|
|
930
|
-
function resolveDrainConfig(options) {
|
|
931
|
-
if (options === void 0) return void 0;
|
|
932
|
-
DrainOptionsSchema.parse(options);
|
|
933
|
-
return options;
|
|
934
|
-
}
|
|
935
910
|
var SettleOptionsSchema = DrainOptionsSchema.extend({
|
|
936
911
|
debounceMs: _zod.z.number().min(0).optional(),
|
|
937
|
-
// `
|
|
938
|
-
//
|
|
939
|
-
//
|
|
940
|
-
// `Infinity` is accepted explicitly. It is the documented default
|
|
941
|
-
// (`Act.settle`'s doc-comment and `SettleOptions.maxPasses` both name it),
|
|
942
|
-
// and `settle.ts` destructures `maxPasses = Infinity`, so the one value the
|
|
943
|
-
// docs advertise was the one value `z.number().int()` refused — Zod 4
|
|
944
|
-
// rejects `±Infinity`, and an integer check cannot pass it either. Wrapper
|
|
945
|
-
// code normalizing an optional cap (`maxPasses: opts.maxPasses ?? Infinity`)
|
|
946
|
-
// is the natural way to hit it. Accepting it also honors this module's own
|
|
947
|
-
// rule that a value which works today is never newly rejected.
|
|
912
|
+
// `0` runs no passes; `Infinity` is the documented default (no cap), which
|
|
913
|
+
// an integer check alone would refuse.
|
|
948
914
|
maxPasses: _zod.z.union([_zod.z.number().int().min(0), _zod.z.literal(Number.POSITIVE_INFINITY)]).optional()
|
|
949
|
-
})
|
|
950
|
-
function resolveSettleConfig(options) {
|
|
951
|
-
if (options === void 0) return void 0;
|
|
952
|
-
SettleOptionsSchema.parse(options);
|
|
953
|
-
return options;
|
|
954
|
-
}
|
|
915
|
+
});
|
|
955
916
|
var MAX_SHUTDOWN_GRACE_MS = 3e4;
|
|
956
917
|
var ShutdownOptionsSchema = _zod.z.object({
|
|
957
|
-
// `0` is legal and is exactly today's behavior: stop scheduling and
|
|
958
|
-
// return without waiting.
|
|
959
918
|
graceMs: _zod.z.number().min(0).optional()
|
|
960
|
-
})
|
|
961
|
-
function resolveShutdownConfig(options) {
|
|
962
|
-
if (options === void 0) return void 0;
|
|
963
|
-
ShutdownOptionsSchema.parse(options);
|
|
964
|
-
return options;
|
|
965
|
-
}
|
|
919
|
+
});
|
|
966
920
|
var ActOptionsSchema = _zod.z.object({
|
|
967
921
|
maxSubscribedStreams: _zod.z.number().int().min(1).optional(),
|
|
968
922
|
settleDebounceMs: _zod.z.number().int().min(0).optional(),
|
|
969
923
|
autoSettle: _zod.z.boolean().optional()
|
|
970
|
-
})
|
|
971
|
-
function
|
|
972
|
-
if (options === void 0) return void 0;
|
|
973
|
-
ActOptionsSchema.parse(options);
|
|
974
|
-
return options;
|
|
975
|
-
}
|
|
976
|
-
var DEFAULT_AUTOCLOSE_WINDOW_TZ = "UTC";
|
|
977
|
-
function is_valid_time_zone(tz) {
|
|
924
|
+
});
|
|
925
|
+
function is_time_zone(tz) {
|
|
978
926
|
try {
|
|
979
927
|
new Intl.DateTimeFormat("en-US", { timeZone: tz });
|
|
980
928
|
return true;
|
|
@@ -982,44 +930,103 @@ function is_valid_time_zone(tz) {
|
|
|
982
930
|
return false;
|
|
983
931
|
}
|
|
984
932
|
}
|
|
985
|
-
var
|
|
986
|
-
|
|
987
|
-
end: _zod.z.number().int().min(0).max(23, { message: "autocloseWindow.end must be an hour in [0, 23]" }),
|
|
988
|
-
timeZone: _zod.z.string().refine(is_valid_time_zone, {
|
|
989
|
-
message: "autocloseWindow.timeZone must be a valid IANA time zone"
|
|
990
|
-
}).default(DEFAULT_AUTOCLOSE_WINDOW_TZ)
|
|
991
|
-
}).refine((w) => w.start !== w.end, {
|
|
992
|
-
message: "autocloseWindow.start and end must differ \u2014 an empty window disables autoclose"
|
|
933
|
+
var hour = (field) => _zod.z.number().int().min(0).max(23, {
|
|
934
|
+
message: `autocloseWindow.${field} must be an hour in [0, 23]`
|
|
993
935
|
});
|
|
994
936
|
var AutocloseOptionsSchema = _zod.z.object({
|
|
995
|
-
autocloseWindow:
|
|
937
|
+
autocloseWindow: _zod.z.object({
|
|
938
|
+
start: hour("start"),
|
|
939
|
+
end: hour("end"),
|
|
940
|
+
timeZone: _zod.z.string().refine(is_time_zone, {
|
|
941
|
+
message: "autocloseWindow.timeZone must be a valid IANA time zone"
|
|
942
|
+
}).default("UTC")
|
|
943
|
+
}).refine((w) => w.start !== w.end, {
|
|
944
|
+
message: "autocloseWindow.start and end must differ \u2014 an empty window disables autoclose"
|
|
945
|
+
}).optional()
|
|
996
946
|
});
|
|
997
|
-
function resolveAutocloseConfig(options) {
|
|
998
|
-
return AutocloseOptionsSchema.parse({
|
|
999
|
-
autocloseWindow: _optionalChain([options, 'optionalAccess', _56 => _56.autocloseWindow])
|
|
1000
|
-
});
|
|
1001
|
-
}
|
|
1002
|
-
var DEFAULT_CIRCUIT_FAILURE_THRESHOLD = 5;
|
|
1003
|
-
var DEFAULT_CIRCUIT_COOLDOWN_MS = 3e4;
|
|
1004
947
|
var CircuitBreakerOptionsSchema = _zod.z.object({
|
|
1005
|
-
failureThreshold: _zod.z.number().int().min(1).default(
|
|
1006
|
-
cooldownMs: _zod.z.number().int().min(100).max(36e5).default(
|
|
948
|
+
failureThreshold: _zod.z.number().int().min(1).default(5),
|
|
949
|
+
cooldownMs: _zod.z.number().int().min(100).max(36e5).default(3e4)
|
|
1007
950
|
});
|
|
1008
|
-
var resolveCircuitBreakerConfig = (options) => CircuitBreakerOptionsSchema.parse(_nullishCoalesce(options, () => ( {})));
|
|
1009
|
-
var DEFAULT_FOLD_FLUSH_EVERY = 1e3;
|
|
1010
|
-
var DEFAULT_MAX_CACHED_STATES = 1e4;
|
|
1011
951
|
var FoldOptionsSchema = _zod.z.object({
|
|
1012
|
-
flushEvery: _zod.z.number().int().min(1).default(
|
|
1013
|
-
maxCachedStates: _zod.z.number().int().min(1).default(
|
|
952
|
+
flushEvery: _zod.z.number().int().min(1).default(1e3),
|
|
953
|
+
maxCachedStates: _zod.z.number().int().min(1).default(1e4)
|
|
1014
954
|
});
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
955
|
+
var DeferWhenSchema = _zod.z.object({
|
|
956
|
+
after: _zod.z.object({
|
|
957
|
+
days: _zod.z.number().positive().optional(),
|
|
958
|
+
hours: _zod.z.number().positive().optional(),
|
|
959
|
+
minutes: _zod.z.number().positive().optional()
|
|
960
|
+
}).strict().refine((d) => d.days != null || d.hours != null || d.minutes != null, {
|
|
961
|
+
message: "defer: a duration needs at least one of days, hours, or minutes"
|
|
962
|
+
}).optional(),
|
|
963
|
+
at: _zod.z.date().optional()
|
|
964
|
+
}).strict().refine((w) => w.after === void 0 !== (w.at === void 0), {
|
|
965
|
+
message: "defer: specify exactly one of `after` or `at`"
|
|
966
|
+
});
|
|
967
|
+
var window_schema = (field, min_days, floor) => _zod.z.object({
|
|
968
|
+
days: _zod.z.number({ message: `autocloses: ${field}.days must be a number` }).positive(`autocloses: ${field}.days must be > 0`)
|
|
969
|
+
}).refine((o) => o.days >= min_days, {
|
|
970
|
+
message: `autocloses: ${field} resolves to < ${floor}, which is too short to be a meaningful retention window`
|
|
971
|
+
});
|
|
972
|
+
var AfterSchema = window_schema("after", 1 / 1440, "one minute");
|
|
973
|
+
var IsSchema = _zod.z.union([
|
|
974
|
+
_zod.z.string().min(1, "autocloses: is must be a non-empty event name"),
|
|
975
|
+
_zod.z.array(
|
|
976
|
+
_zod.z.string().min(1, "autocloses: is entries must be non-empty event names")
|
|
977
|
+
).min(1, "autocloses: is must include at least one event name").readonly()
|
|
978
|
+
]);
|
|
979
|
+
var ReachesSchema = _zod.z.number({ message: "autocloses: reaches must be a number" }).int("autocloses: reaches must be an integer").min(1, "autocloses: reaches must be >= 1");
|
|
980
|
+
var OrBlockSchema = _zod.z.object({
|
|
981
|
+
after: AfterSchema.optional(),
|
|
982
|
+
is: IsSchema.optional(),
|
|
983
|
+
reaches: ReachesSchema.optional()
|
|
984
|
+
}).strict().refine(
|
|
985
|
+
(o) => o.after !== void 0 || o.is !== void 0 || o.reaches !== void 0,
|
|
986
|
+
{
|
|
987
|
+
message: "autocloses: `or` block must include at least one of after / is / reaches"
|
|
988
|
+
}
|
|
989
|
+
);
|
|
990
|
+
var AutoclosePolicySchema = _zod.z.object({
|
|
991
|
+
after: AfterSchema.optional(),
|
|
992
|
+
is: IsSchema.optional(),
|
|
993
|
+
reaches: ReachesSchema.optional(),
|
|
994
|
+
or: OrBlockSchema.optional(),
|
|
995
|
+
keep: window_schema("keep", 1, "one day").optional()
|
|
996
|
+
}).strict().refine(
|
|
997
|
+
(o) => o.after !== void 0 || o.is !== void 0 || o.reaches !== void 0 || o.or !== void 0 || o.keep !== void 0,
|
|
998
|
+
{
|
|
999
|
+
message: "autocloses: at least one of after / is / reaches / or / keep must be specified \u2014 empty `{}` is a misconfiguration"
|
|
1000
|
+
}
|
|
1001
|
+
);
|
|
1002
|
+
var StoreSchema = _zod.z.object({
|
|
1003
|
+
commit: _zod.z.custom(
|
|
1004
|
+
(commit) => typeof commit === "function" && commit.length !== 4,
|
|
1005
|
+
{
|
|
1006
|
+
message: "This store's commit takes (stream, msgs, meta, expectedVersion), the shape before @rotorsoft/act 2.0. Upgrade it, and every @rotorsoft/act-* package, together: https://rotorsoft.github.io/act-root/docs/guides/migrating-to-2.x"
|
|
1007
|
+
}
|
|
1008
|
+
)
|
|
1009
|
+
});
|
|
1010
|
+
var SCHEMAS = {
|
|
1011
|
+
act: ActOptionsSchema,
|
|
1012
|
+
action: ActionOptionsSchema,
|
|
1013
|
+
audit: AuditOptionsSchema,
|
|
1014
|
+
autoclose: AutocloseOptionsSchema,
|
|
1015
|
+
autoclose_policy: AutoclosePolicySchema,
|
|
1016
|
+
circuit_breaker: CircuitBreakerOptionsSchema,
|
|
1017
|
+
defer: DeferWhenSchema,
|
|
1018
|
+
drain: DrainOptionsSchema,
|
|
1019
|
+
fold: FoldOptionsSchema,
|
|
1020
|
+
lane: LaneConfigSchema,
|
|
1021
|
+
reaction: ReactionOptionsSchema,
|
|
1022
|
+
scan: ScanOptionsSchema,
|
|
1023
|
+
settle: SettleOptionsSchema,
|
|
1024
|
+
shutdown: ShutdownOptionsSchema,
|
|
1025
|
+
store: StoreSchema,
|
|
1026
|
+
target: TargetOptionsSchema
|
|
1027
|
+
};
|
|
1028
|
+
function check(kind, options) {
|
|
1029
|
+
return SCHEMAS[kind].parse(options);
|
|
1023
1030
|
}
|
|
1024
1031
|
|
|
1025
1032
|
// src/scoped.ts
|
|
@@ -1030,7 +1037,7 @@ function make_run_scoped(bag) {
|
|
|
1030
1037
|
return (fn) => scoped.run(bag, fn);
|
|
1031
1038
|
}
|
|
1032
1039
|
function current_autoclose_window() {
|
|
1033
|
-
return _optionalChain([scoped, 'access',
|
|
1040
|
+
return _optionalChain([scoped, 'access', _55 => _55.getStore, 'call', _56 => _56(), 'optionalAccess', _57 => _57.autoclose_window]);
|
|
1034
1041
|
}
|
|
1035
1042
|
function current_ports() {
|
|
1036
1043
|
return scoped.getStore();
|
|
@@ -1046,7 +1053,7 @@ function run_reacting(event, fn) {
|
|
|
1046
1053
|
});
|
|
1047
1054
|
}
|
|
1048
1055
|
function current_reacting() {
|
|
1049
|
-
return _optionalChain([reacting, 'access',
|
|
1056
|
+
return _optionalChain([reacting, 'access', _58 => _58.getStore, 'call', _59 => _59(), 'optionalAccess', _60 => _60.event]);
|
|
1050
1057
|
}
|
|
1051
1058
|
function make_reaction_scope(app) {
|
|
1052
1059
|
return { app, run: run_reacting };
|
|
@@ -1072,17 +1079,17 @@ var log = port(function log2(adapter) {
|
|
|
1072
1079
|
});
|
|
1073
1080
|
});
|
|
1074
1081
|
var _store = port(function store(adapter) {
|
|
1075
|
-
if (adapter)
|
|
1082
|
+
if (adapter) check("store", adapter);
|
|
1076
1083
|
return _nullishCoalesce(adapter, () => ( new InMemoryStore()));
|
|
1077
1084
|
});
|
|
1078
1085
|
var store2 = ((adapter) => {
|
|
1079
|
-
return _nullishCoalesce(_optionalChain([current_ports, 'call',
|
|
1086
|
+
return _nullishCoalesce(_optionalChain([current_ports, 'call', _61 => _61(), 'optionalAccess', _62 => _62.store]), () => ( _store(adapter)));
|
|
1080
1087
|
});
|
|
1081
1088
|
var _cache = port(function cache(adapter) {
|
|
1082
1089
|
return _nullishCoalesce(adapter, () => ( new InMemoryCache()));
|
|
1083
1090
|
});
|
|
1084
1091
|
var cache2 = ((adapter) => {
|
|
1085
|
-
return _nullishCoalesce(_optionalChain([current_ports, 'call',
|
|
1092
|
+
return _nullishCoalesce(_optionalChain([current_ports, 'call', _63 => _63(), 'optionalAccess', _64 => _64.cache]), () => ( _cache(adapter)));
|
|
1086
1093
|
});
|
|
1087
1094
|
var unscoped_ports = () => DEFAULT_SCOPE;
|
|
1088
1095
|
var DEFAULT_SCOPE = {
|
|
@@ -1135,7 +1142,7 @@ var get_package = () => {
|
|
|
1135
1142
|
version: FALLBACK_PACKAGE.version
|
|
1136
1143
|
};
|
|
1137
1144
|
for (const [key, schema] of Object.entries(package_schema.shape)) {
|
|
1138
|
-
const field = schema.safeParse(_optionalChain([raw, 'optionalAccess',
|
|
1145
|
+
const field = schema.safeParse(_optionalChain([raw, 'optionalAccess', _65 => _65[key]]));
|
|
1139
1146
|
if (field.success && field.data !== void 0) pkg2[key] = field.data;
|
|
1140
1147
|
}
|
|
1141
1148
|
return pkg2;
|
|
@@ -1146,8 +1153,8 @@ var get_package = () => {
|
|
|
1146
1153
|
};
|
|
1147
1154
|
var pkg_load_error;
|
|
1148
1155
|
var BaseSchema = package_schema.extend({
|
|
1149
|
-
env: _zod.z.enum(
|
|
1150
|
-
logLevel: _zod.z.enum(
|
|
1156
|
+
env: _zod.z.enum(_chunkZTHGF62Ocjs.Environments),
|
|
1157
|
+
logLevel: _zod.z.enum(_chunkZTHGF62Ocjs.LogLevels),
|
|
1151
1158
|
logSingleLine: _zod.z.boolean(),
|
|
1152
1159
|
sleepMs: _zod.z.number().int().min(0).max(5e3)
|
|
1153
1160
|
});
|
|
@@ -1205,19 +1212,5 @@ var config = () => {
|
|
|
1205
1212
|
|
|
1206
1213
|
|
|
1207
1214
|
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
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.DEFAULT_BACKOFF = DEFAULT_BACKOFF; exports.DEFAULT_MAX_RETRIES = DEFAULT_MAX_RETRIES; exports.DEFAULT_BLOCK_ON_ERROR = DEFAULT_BLOCK_ON_ERROR; exports.resolveReactionConfig = resolveReactionConfig; exports.check_target = check_target; exports.is_valid_target = is_valid_target; exports.check_scan_options = check_scan_options; exports.check_audit_options = check_audit_options; exports.resolveActionConfig = resolveActionConfig; exports.resolveLaneConfig = resolveLaneConfig; exports.DEFAULT_STREAM_LIMIT = DEFAULT_STREAM_LIMIT; exports.DEFAULT_EVENT_LIMIT = DEFAULT_EVENT_LIMIT; exports.DEFAULT_LEASE_MILLIS = DEFAULT_LEASE_MILLIS; exports.resolveDrainConfig = resolveDrainConfig; exports.resolveSettleConfig = resolveSettleConfig; exports.MAX_SHUTDOWN_GRACE_MS = MAX_SHUTDOWN_GRACE_MS; exports.resolveShutdownConfig = resolveShutdownConfig; exports.resolveActConfig = resolveActConfig; exports.resolveAutocloseConfig = resolveAutocloseConfig; exports.resolveCircuitBreakerConfig = resolveCircuitBreakerConfig; exports.resolveFoldConfig = resolveFoldConfig; exports.check_store = check_store; 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;
|
|
1223
|
-
//# sourceMappingURL=chunk-YXP6WASH.cjs.map
|
|
1215
|
+
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.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;
|
|
1216
|
+
//# sourceMappingURL=chunk-N74AN6L5.cjs.map
|