@rotorsoft/act 2.1.8 → 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 -91
- 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/@types/types/audit.d.ts +4 -1
- package/dist/@types/types/audit.d.ts.map +1 -1
- 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-C4JJ7LTB.cjs → chunk-N74AN6L5.cjs} +133 -128
- 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-GUMG5AVZ.js → chunk-Y2ISPWQL.js} +114 -109
- 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 -272
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +47 -115
- 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-C4JJ7LTB.cjs.map +0 -1
- package/dist/chunk-GUMG5AVZ.js.map +0 -1
- package/dist/chunk-QFYPSI6P.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,39 +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 resolveTargetConfig(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
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
886
|
+
var AuditOptionsSchema = _zod.z.object({
|
|
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()
|
|
897
895
|
});
|
|
898
|
-
function resolveActionConfig(options) {
|
|
899
|
-
return ActionOptionsSchema.parse(options);
|
|
900
|
-
}
|
|
901
896
|
var LaneConfigSchema = _zod.z.object({
|
|
902
897
|
name: _zod.z.string().min(1),
|
|
903
898
|
leaseMillis: _zod.z.number().min(0).optional(),
|
|
904
899
|
streamLimit: _zod.z.number().int().min(0).optional(),
|
|
905
900
|
cycleMs: _zod.z.number().min(0).optional()
|
|
906
901
|
});
|
|
907
|
-
function resolveLaneConfig(options) {
|
|
908
|
-
LaneConfigSchema.parse(options);
|
|
909
|
-
return options;
|
|
910
|
-
}
|
|
911
902
|
var DEFAULT_STREAM_LIMIT = 10;
|
|
912
903
|
var DEFAULT_EVENT_LIMIT = 10;
|
|
913
904
|
var DEFAULT_LEASE_MILLIS = 1e4;
|
|
@@ -916,54 +907,22 @@ var DrainOptionsSchema = _zod.z.object({
|
|
|
916
907
|
eventLimit: _zod.z.number().int().min(0).optional(),
|
|
917
908
|
leaseMillis: _zod.z.number().min(0).optional()
|
|
918
909
|
});
|
|
919
|
-
function resolveDrainConfig(options) {
|
|
920
|
-
if (options === void 0) return void 0;
|
|
921
|
-
DrainOptionsSchema.parse(options);
|
|
922
|
-
return options;
|
|
923
|
-
}
|
|
924
910
|
var SettleOptionsSchema = DrainOptionsSchema.extend({
|
|
925
911
|
debounceMs: _zod.z.number().min(0).optional(),
|
|
926
|
-
// `
|
|
927
|
-
//
|
|
928
|
-
//
|
|
929
|
-
// `Infinity` is accepted explicitly. It is the documented default
|
|
930
|
-
// (`Act.settle`'s doc-comment and `SettleOptions.maxPasses` both name it),
|
|
931
|
-
// and `settle.ts` destructures `maxPasses = Infinity`, so the one value the
|
|
932
|
-
// docs advertise was the one value `z.number().int()` refused — Zod 4
|
|
933
|
-
// rejects `±Infinity`, and an integer check cannot pass it either. Wrapper
|
|
934
|
-
// code normalizing an optional cap (`maxPasses: opts.maxPasses ?? Infinity`)
|
|
935
|
-
// is the natural way to hit it. Accepting it also honors this module's own
|
|
936
|
-
// 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.
|
|
937
914
|
maxPasses: _zod.z.union([_zod.z.number().int().min(0), _zod.z.literal(Number.POSITIVE_INFINITY)]).optional()
|
|
938
|
-
})
|
|
939
|
-
function resolveSettleConfig(options) {
|
|
940
|
-
if (options === void 0) return void 0;
|
|
941
|
-
SettleOptionsSchema.parse(options);
|
|
942
|
-
return options;
|
|
943
|
-
}
|
|
915
|
+
});
|
|
944
916
|
var MAX_SHUTDOWN_GRACE_MS = 3e4;
|
|
945
917
|
var ShutdownOptionsSchema = _zod.z.object({
|
|
946
|
-
// `0` is legal and is exactly today's behavior: stop scheduling and
|
|
947
|
-
// return without waiting.
|
|
948
918
|
graceMs: _zod.z.number().min(0).optional()
|
|
949
|
-
})
|
|
950
|
-
function resolveShutdownConfig(options) {
|
|
951
|
-
if (options === void 0) return void 0;
|
|
952
|
-
ShutdownOptionsSchema.parse(options);
|
|
953
|
-
return options;
|
|
954
|
-
}
|
|
919
|
+
});
|
|
955
920
|
var ActOptionsSchema = _zod.z.object({
|
|
956
921
|
maxSubscribedStreams: _zod.z.number().int().min(1).optional(),
|
|
957
922
|
settleDebounceMs: _zod.z.number().int().min(0).optional(),
|
|
958
923
|
autoSettle: _zod.z.boolean().optional()
|
|
959
|
-
})
|
|
960
|
-
function
|
|
961
|
-
if (options === void 0) return void 0;
|
|
962
|
-
ActOptionsSchema.parse(options);
|
|
963
|
-
return options;
|
|
964
|
-
}
|
|
965
|
-
var DEFAULT_AUTOCLOSE_WINDOW_TZ = "UTC";
|
|
966
|
-
function is_valid_time_zone(tz) {
|
|
924
|
+
});
|
|
925
|
+
function is_time_zone(tz) {
|
|
967
926
|
try {
|
|
968
927
|
new Intl.DateTimeFormat("en-US", { timeZone: tz });
|
|
969
928
|
return true;
|
|
@@ -971,44 +930,103 @@ function is_valid_time_zone(tz) {
|
|
|
971
930
|
return false;
|
|
972
931
|
}
|
|
973
932
|
}
|
|
974
|
-
var
|
|
975
|
-
|
|
976
|
-
end: _zod.z.number().int().min(0).max(23, { message: "autocloseWindow.end must be an hour in [0, 23]" }),
|
|
977
|
-
timeZone: _zod.z.string().refine(is_valid_time_zone, {
|
|
978
|
-
message: "autocloseWindow.timeZone must be a valid IANA time zone"
|
|
979
|
-
}).default(DEFAULT_AUTOCLOSE_WINDOW_TZ)
|
|
980
|
-
}).refine((w) => w.start !== w.end, {
|
|
981
|
-
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]`
|
|
982
935
|
});
|
|
983
936
|
var AutocloseOptionsSchema = _zod.z.object({
|
|
984
|
-
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()
|
|
985
946
|
});
|
|
986
|
-
function resolveAutocloseConfig(options) {
|
|
987
|
-
return AutocloseOptionsSchema.parse({
|
|
988
|
-
autocloseWindow: _optionalChain([options, 'optionalAccess', _55 => _55.autocloseWindow])
|
|
989
|
-
});
|
|
990
|
-
}
|
|
991
|
-
var DEFAULT_CIRCUIT_FAILURE_THRESHOLD = 5;
|
|
992
|
-
var DEFAULT_CIRCUIT_COOLDOWN_MS = 3e4;
|
|
993
947
|
var CircuitBreakerOptionsSchema = _zod.z.object({
|
|
994
|
-
failureThreshold: _zod.z.number().int().min(1).default(
|
|
995
|
-
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)
|
|
996
950
|
});
|
|
997
|
-
var resolveCircuitBreakerConfig = (options) => CircuitBreakerOptionsSchema.parse(_nullishCoalesce(options, () => ( {})));
|
|
998
|
-
var DEFAULT_FOLD_FLUSH_EVERY = 1e3;
|
|
999
|
-
var DEFAULT_MAX_CACHED_STATES = 1e4;
|
|
1000
951
|
var FoldOptionsSchema = _zod.z.object({
|
|
1001
|
-
flushEvery: _zod.z.number().int().min(1).default(
|
|
1002
|
-
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)
|
|
1003
954
|
});
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
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);
|
|
1012
1030
|
}
|
|
1013
1031
|
|
|
1014
1032
|
// src/scoped.ts
|
|
@@ -1019,7 +1037,7 @@ function make_run_scoped(bag) {
|
|
|
1019
1037
|
return (fn) => scoped.run(bag, fn);
|
|
1020
1038
|
}
|
|
1021
1039
|
function current_autoclose_window() {
|
|
1022
|
-
return _optionalChain([scoped, 'access',
|
|
1040
|
+
return _optionalChain([scoped, 'access', _55 => _55.getStore, 'call', _56 => _56(), 'optionalAccess', _57 => _57.autoclose_window]);
|
|
1023
1041
|
}
|
|
1024
1042
|
function current_ports() {
|
|
1025
1043
|
return scoped.getStore();
|
|
@@ -1035,7 +1053,7 @@ function run_reacting(event, fn) {
|
|
|
1035
1053
|
});
|
|
1036
1054
|
}
|
|
1037
1055
|
function current_reacting() {
|
|
1038
|
-
return _optionalChain([reacting, 'access',
|
|
1056
|
+
return _optionalChain([reacting, 'access', _58 => _58.getStore, 'call', _59 => _59(), 'optionalAccess', _60 => _60.event]);
|
|
1039
1057
|
}
|
|
1040
1058
|
function make_reaction_scope(app) {
|
|
1041
1059
|
return { app, run: run_reacting };
|
|
@@ -1061,17 +1079,17 @@ var log = port(function log2(adapter) {
|
|
|
1061
1079
|
});
|
|
1062
1080
|
});
|
|
1063
1081
|
var _store = port(function store(adapter) {
|
|
1064
|
-
if (adapter)
|
|
1082
|
+
if (adapter) check("store", adapter);
|
|
1065
1083
|
return _nullishCoalesce(adapter, () => ( new InMemoryStore()));
|
|
1066
1084
|
});
|
|
1067
1085
|
var store2 = ((adapter) => {
|
|
1068
|
-
return _nullishCoalesce(_optionalChain([current_ports, 'call',
|
|
1086
|
+
return _nullishCoalesce(_optionalChain([current_ports, 'call', _61 => _61(), 'optionalAccess', _62 => _62.store]), () => ( _store(adapter)));
|
|
1069
1087
|
});
|
|
1070
1088
|
var _cache = port(function cache(adapter) {
|
|
1071
1089
|
return _nullishCoalesce(adapter, () => ( new InMemoryCache()));
|
|
1072
1090
|
});
|
|
1073
1091
|
var cache2 = ((adapter) => {
|
|
1074
|
-
return _nullishCoalesce(_optionalChain([current_ports, 'call',
|
|
1092
|
+
return _nullishCoalesce(_optionalChain([current_ports, 'call', _63 => _63(), 'optionalAccess', _64 => _64.cache]), () => ( _cache(adapter)));
|
|
1075
1093
|
});
|
|
1076
1094
|
var unscoped_ports = () => DEFAULT_SCOPE;
|
|
1077
1095
|
var DEFAULT_SCOPE = {
|
|
@@ -1124,7 +1142,7 @@ var get_package = () => {
|
|
|
1124
1142
|
version: FALLBACK_PACKAGE.version
|
|
1125
1143
|
};
|
|
1126
1144
|
for (const [key, schema] of Object.entries(package_schema.shape)) {
|
|
1127
|
-
const field = schema.safeParse(_optionalChain([raw, 'optionalAccess',
|
|
1145
|
+
const field = schema.safeParse(_optionalChain([raw, 'optionalAccess', _65 => _65[key]]));
|
|
1128
1146
|
if (field.success && field.data !== void 0) pkg2[key] = field.data;
|
|
1129
1147
|
}
|
|
1130
1148
|
return pkg2;
|
|
@@ -1135,8 +1153,8 @@ var get_package = () => {
|
|
|
1135
1153
|
};
|
|
1136
1154
|
var pkg_load_error;
|
|
1137
1155
|
var BaseSchema = package_schema.extend({
|
|
1138
|
-
env: _zod.z.enum(
|
|
1139
|
-
logLevel: _zod.z.enum(
|
|
1156
|
+
env: _zod.z.enum(_chunkZTHGF62Ocjs.Environments),
|
|
1157
|
+
logLevel: _zod.z.enum(_chunkZTHGF62Ocjs.LogLevels),
|
|
1140
1158
|
logSingleLine: _zod.z.boolean(),
|
|
1141
1159
|
sleepMs: _zod.z.number().int().min(0).max(5e3)
|
|
1142
1160
|
});
|
|
@@ -1194,18 +1212,5 @@ var config = () => {
|
|
|
1194
1212
|
|
|
1195
1213
|
|
|
1196
1214
|
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
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.resolveTargetConfig = resolveTargetConfig; exports.is_valid_target = is_valid_target; exports.check_scan_options = check_scan_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;
|
|
1211
|
-
//# sourceMappingURL=chunk-C4JJ7LTB.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
|