@rotorsoft/act 2.0.5 → 2.1.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/README.md +1 -1
- package/dist/.tsbuildinfo +1 -1
- package/dist/@types/act.d.ts +2 -1
- package/dist/@types/act.d.ts.map +1 -1
- package/dist/@types/adapter.d.ts +85 -0
- package/dist/@types/adapter.d.ts.map +1 -0
- package/dist/@types/adapters/in-memory-store.d.ts.map +1 -1
- package/dist/@types/builders/builder-utils.d.ts.map +1 -1
- package/dist/@types/config.d.ts +3 -9
- package/dist/@types/config.d.ts.map +1 -1
- package/dist/@types/deprecated.d.ts +57 -0
- package/dist/@types/deprecated.d.ts.map +1 -0
- package/dist/@types/index.d.ts +12 -9
- package/dist/@types/index.d.ts.map +1 -1
- package/dist/@types/internal/autoclose-reaction.d.ts.map +1 -1
- package/dist/@types/internal/close-cycle.d.ts.map +1 -1
- package/dist/@types/internal/config.d.ts +8 -0
- 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/drain-ops.d.ts.map +1 -1
- package/dist/@types/internal/event-sourcing.d.ts.map +1 -1
- package/dist/@types/ports.d.ts +1 -3
- package/dist/@types/ports.d.ts.map +1 -1
- package/dist/@types/scoped.d.ts +1 -1
- package/dist/@types/sensitive.d.ts +6 -2
- package/dist/@types/sensitive.d.ts.map +1 -1
- package/dist/@types/types/action.d.ts +2 -2
- package/dist/@types/types/index.d.ts +1 -1
- package/dist/@types/types/index.d.ts.map +1 -1
- package/dist/@types/types/ports.d.ts +7 -3
- package/dist/@types/types/ports.d.ts.map +1 -1
- package/dist/@types/types/reaction.d.ts +2 -1
- package/dist/@types/types/reaction.d.ts.map +1 -1
- package/dist/@types/types/schemas.d.ts +1 -1
- package/dist/@types/types/schemas.d.ts.map +1 -1
- package/dist/@types/utils.d.ts +0 -105
- package/dist/@types/utils.d.ts.map +1 -1
- package/dist/adapter.cjs +20 -0
- package/dist/adapter.cjs.map +1 -0
- package/dist/adapter.js +20 -0
- package/dist/adapter.js.map +1 -0
- package/dist/{chunk-VD4BLAY4.cjs → chunk-7VYSJIXD.cjs} +7 -3
- package/dist/chunk-7VYSJIXD.cjs.map +1 -0
- package/dist/{chunk-XW4EAUS6.cjs → chunk-LN3OP4OL.cjs} +202 -252
- package/dist/chunk-LN3OP4OL.cjs.map +1 -0
- package/dist/chunk-PZQXTGWF.cjs +62 -0
- package/dist/chunk-PZQXTGWF.cjs.map +1 -0
- package/dist/{chunk-3JULRYQO.js → chunk-QPVUARKL.js} +177 -227
- package/dist/chunk-QPVUARKL.js.map +1 -0
- package/dist/chunk-UXDNSZAD.js +62 -0
- package/dist/chunk-UXDNSZAD.js.map +1 -0
- package/dist/{chunk-ESFICIG2.js → chunk-W3PHEA5Q.js} +6 -2
- package/dist/chunk-W3PHEA5Q.js.map +1 -0
- package/dist/index.cjs +292 -237
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +105 -50
- package/dist/index.js.map +1 -1
- package/dist/test/index.cjs +5 -4
- package/dist/test/index.cjs.map +1 -1
- package/dist/test/index.js +3 -2
- package/dist/test/index.js.map +1 -1
- package/dist/types/index.cjs +6 -2
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.js +7 -3
- package/package.json +6 -1
- package/dist/chunk-3JULRYQO.js.map +0 -1
- package/dist/chunk-ESFICIG2.js.map +0 -1
- package/dist/chunk-VD4BLAY4.cjs.map +0 -1
- package/dist/chunk-XW4EAUS6.cjs.map +0 -1
|
@@ -3,10 +3,15 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
var _chunkPZQXTGWFcjs = require('./chunk-PZQXTGWF.cjs');
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
var _chunk7VYSJIXDcjs = require('./chunk-7VYSJIXD.cjs');
|
|
10
15
|
|
|
11
16
|
// src/adapters/console-logger.ts
|
|
12
17
|
var LEVEL_VALUES = {
|
|
@@ -207,148 +212,6 @@ var InMemoryCache = class {
|
|
|
207
212
|
var _fs = require('fs'); var fs = _interopRequireWildcard(_fs);
|
|
208
213
|
var _zod = require('zod');
|
|
209
214
|
|
|
210
|
-
// src/internal/config.ts
|
|
211
|
-
|
|
212
|
-
var BackoffOptionsSchema = _zod.z.object({
|
|
213
|
-
strategy: _zod.z.enum(["fixed", "linear", "exponential"]),
|
|
214
|
-
baseMs: _zod.z.number().min(0),
|
|
215
|
-
maxMs: _zod.z.number().gt(0).optional(),
|
|
216
|
-
jitter: _zod.z.boolean().optional()
|
|
217
|
-
});
|
|
218
|
-
var DEFAULT_BACKOFF = {
|
|
219
|
-
strategy: "fixed",
|
|
220
|
-
baseMs: 1e4
|
|
221
|
-
};
|
|
222
|
-
var DEFAULT_MAX_RETRIES = 3;
|
|
223
|
-
var DEFAULT_BLOCK_ON_ERROR = true;
|
|
224
|
-
var ReactionOptionsSchema = _zod.z.object({
|
|
225
|
-
blockOnError: _zod.z.boolean(),
|
|
226
|
-
maxRetries: _zod.z.number().int().min(0),
|
|
227
|
-
backoff: BackoffOptionsSchema.optional()
|
|
228
|
-
});
|
|
229
|
-
function resolveReactionConfig(options) {
|
|
230
|
-
return ReactionOptionsSchema.parse(options);
|
|
231
|
-
}
|
|
232
|
-
var ActionOptionsSchema = _zod.z.object({
|
|
233
|
-
maxRetries: _zod.z.number().int().min(0).optional(),
|
|
234
|
-
backoff: BackoffOptionsSchema.optional()
|
|
235
|
-
});
|
|
236
|
-
function resolveActionConfig(options) {
|
|
237
|
-
return ActionOptionsSchema.parse(options);
|
|
238
|
-
}
|
|
239
|
-
var LaneConfigSchema = _zod.z.object({
|
|
240
|
-
name: _zod.z.string().min(1),
|
|
241
|
-
leaseMillis: _zod.z.number().min(0).optional(),
|
|
242
|
-
streamLimit: _zod.z.number().int().min(0).optional(),
|
|
243
|
-
cycleMs: _zod.z.number().min(0).optional()
|
|
244
|
-
});
|
|
245
|
-
function resolveLaneConfig(options) {
|
|
246
|
-
LaneConfigSchema.parse(options);
|
|
247
|
-
return options;
|
|
248
|
-
}
|
|
249
|
-
var DEFAULT_STREAM_LIMIT = 10;
|
|
250
|
-
var DEFAULT_EVENT_LIMIT = 10;
|
|
251
|
-
var DEFAULT_LEASE_MILLIS = 1e4;
|
|
252
|
-
var DrainOptionsSchema = _zod.z.object({
|
|
253
|
-
streamLimit: _zod.z.number().int().min(0).optional(),
|
|
254
|
-
eventLimit: _zod.z.number().int().min(0).optional(),
|
|
255
|
-
leaseMillis: _zod.z.number().min(0).optional()
|
|
256
|
-
});
|
|
257
|
-
function resolveDrainConfig(options) {
|
|
258
|
-
if (options === void 0) return void 0;
|
|
259
|
-
DrainOptionsSchema.parse(options);
|
|
260
|
-
return options;
|
|
261
|
-
}
|
|
262
|
-
var SettleOptionsSchema = DrainOptionsSchema.extend({
|
|
263
|
-
debounceMs: _zod.z.number().min(0).optional(),
|
|
264
|
-
// `maxPasses` defaults to Infinity (no cap) when omitted; a present value is
|
|
265
|
-
// a non-negative integer — `0` is legal and means "run no passes".
|
|
266
|
-
//
|
|
267
|
-
// `Infinity` is accepted explicitly. It is the documented default
|
|
268
|
-
// (`Act.settle`'s doc-comment and `SettleOptions.maxPasses` both name it),
|
|
269
|
-
// and `settle.ts` destructures `maxPasses = Infinity`, so the one value the
|
|
270
|
-
// docs advertise was the one value `z.number().int()` refused — Zod 4
|
|
271
|
-
// rejects `±Infinity`, and an integer check cannot pass it either. Wrapper
|
|
272
|
-
// code normalizing an optional cap (`maxPasses: opts.maxPasses ?? Infinity`)
|
|
273
|
-
// is the natural way to hit it. Accepting it also honors this module's own
|
|
274
|
-
// rule that a value which works today is never newly rejected.
|
|
275
|
-
maxPasses: _zod.z.union([_zod.z.number().int().min(0), _zod.z.literal(Number.POSITIVE_INFINITY)]).optional()
|
|
276
|
-
}).loose();
|
|
277
|
-
function resolveSettleConfig(options) {
|
|
278
|
-
if (options === void 0) return void 0;
|
|
279
|
-
SettleOptionsSchema.parse(options);
|
|
280
|
-
return options;
|
|
281
|
-
}
|
|
282
|
-
var MAX_SHUTDOWN_GRACE_MS = 3e4;
|
|
283
|
-
var ShutdownOptionsSchema = _zod.z.object({
|
|
284
|
-
// `0` is legal and is exactly today's behavior: stop scheduling and
|
|
285
|
-
// return without waiting.
|
|
286
|
-
graceMs: _zod.z.number().min(0).optional()
|
|
287
|
-
}).loose();
|
|
288
|
-
function resolveShutdownConfig(options) {
|
|
289
|
-
if (options === void 0) return void 0;
|
|
290
|
-
ShutdownOptionsSchema.parse(options);
|
|
291
|
-
return options;
|
|
292
|
-
}
|
|
293
|
-
var ActOptionsSchema = _zod.z.object({
|
|
294
|
-
maxSubscribedStreams: _zod.z.number().int().min(1).optional(),
|
|
295
|
-
settleDebounceMs: _zod.z.number().int().min(0).optional(),
|
|
296
|
-
autoSettle: _zod.z.boolean().optional()
|
|
297
|
-
}).loose();
|
|
298
|
-
function resolveActConfig(options) {
|
|
299
|
-
if (options === void 0) return void 0;
|
|
300
|
-
ActOptionsSchema.parse(options);
|
|
301
|
-
return options;
|
|
302
|
-
}
|
|
303
|
-
var DEFAULT_AUTOCLOSE_WINDOW_TZ = "UTC";
|
|
304
|
-
function is_valid_time_zone(tz) {
|
|
305
|
-
try {
|
|
306
|
-
new Intl.DateTimeFormat("en-US", { timeZone: tz });
|
|
307
|
-
return true;
|
|
308
|
-
} catch (e4) {
|
|
309
|
-
return false;
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
var AutocloseWindowSchema = _zod.z.object({
|
|
313
|
-
start: _zod.z.number().int().min(0).max(23, { message: "autocloseWindow.start must be an hour in [0, 23]" }),
|
|
314
|
-
end: _zod.z.number().int().min(0).max(23, { message: "autocloseWindow.end must be an hour in [0, 23]" }),
|
|
315
|
-
timeZone: _zod.z.string().refine(is_valid_time_zone, {
|
|
316
|
-
message: "autocloseWindow.timeZone must be a valid IANA time zone"
|
|
317
|
-
}).default(DEFAULT_AUTOCLOSE_WINDOW_TZ)
|
|
318
|
-
}).refine((w) => w.start !== w.end, {
|
|
319
|
-
message: "autocloseWindow.start and end must differ \u2014 an empty window disables autoclose"
|
|
320
|
-
});
|
|
321
|
-
var AutocloseOptionsSchema = _zod.z.object({
|
|
322
|
-
autocloseWindow: AutocloseWindowSchema.optional()
|
|
323
|
-
});
|
|
324
|
-
function resolveAutocloseConfig(options) {
|
|
325
|
-
return AutocloseOptionsSchema.parse({
|
|
326
|
-
autocloseWindow: _optionalChain([options, 'optionalAccess', _2 => _2.autocloseWindow])
|
|
327
|
-
});
|
|
328
|
-
}
|
|
329
|
-
var DEFAULT_CIRCUIT_FAILURE_THRESHOLD = 5;
|
|
330
|
-
var DEFAULT_CIRCUIT_COOLDOWN_MS = 3e4;
|
|
331
|
-
var CircuitBreakerOptionsSchema = _zod.z.object({
|
|
332
|
-
failureThreshold: _zod.z.number().int().min(1).default(DEFAULT_CIRCUIT_FAILURE_THRESHOLD),
|
|
333
|
-
cooldownMs: _zod.z.number().int().min(100).max(36e5).default(DEFAULT_CIRCUIT_COOLDOWN_MS)
|
|
334
|
-
});
|
|
335
|
-
var resolveCircuitBreakerConfig = (options) => CircuitBreakerOptionsSchema.parse(_nullishCoalesce(options, () => ( {})));
|
|
336
|
-
var DEFAULT_FOLD_FLUSH_EVERY = 1e3;
|
|
337
|
-
var DEFAULT_MAX_CACHED_STATES = 1e4;
|
|
338
|
-
var FoldOptionsSchema = _zod.z.object({
|
|
339
|
-
flushEvery: _zod.z.number().int().min(1).default(DEFAULT_FOLD_FLUSH_EVERY),
|
|
340
|
-
maxCachedStates: _zod.z.number().int().min(1).default(DEFAULT_MAX_CACHED_STATES)
|
|
341
|
-
});
|
|
342
|
-
function resolveFoldConfig(options) {
|
|
343
|
-
return FoldOptionsSchema.parse(options);
|
|
344
|
-
}
|
|
345
|
-
function check_store(store3) {
|
|
346
|
-
if (store3.commit.length === 4)
|
|
347
|
-
throw new Error(
|
|
348
|
-
"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"
|
|
349
|
-
);
|
|
350
|
-
}
|
|
351
|
-
|
|
352
215
|
// src/utils.ts
|
|
353
216
|
|
|
354
217
|
var validate = (target, payload, schema) => {
|
|
@@ -356,65 +219,14 @@ var validate = (target, payload, schema) => {
|
|
|
356
219
|
return schema ? schema.parse(payload) : payload;
|
|
357
220
|
} catch (error) {
|
|
358
221
|
if (error instanceof _zod.ZodError) {
|
|
359
|
-
throw new (0,
|
|
222
|
+
throw new (0, _chunk7VYSJIXDcjs.ValidationError)(target, payload, _zod.prettifyError.call(void 0, error));
|
|
360
223
|
}
|
|
361
|
-
throw new (0,
|
|
224
|
+
throw new (0, _chunk7VYSJIXDcjs.ValidationError)(target, payload, error);
|
|
362
225
|
}
|
|
363
226
|
};
|
|
364
|
-
var extend = (source, schema, target) => {
|
|
365
|
-
const value = validate("config", source, schema);
|
|
366
|
-
return { ...target, ...value };
|
|
367
|
-
};
|
|
368
227
|
async function sleep(ms) {
|
|
369
228
|
return new Promise((resolve) => setTimeout(resolve, _nullishCoalesce(ms, () => ( config().sleepMs))));
|
|
370
229
|
}
|
|
371
|
-
function is_literal_source(source, target) {
|
|
372
|
-
return source === target || !source.startsWith("^") && !source.endsWith("$");
|
|
373
|
-
}
|
|
374
|
-
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])?$/;
|
|
375
|
-
var dateReviver = (_key, value) => typeof value === "string" && ISO_8601.test(value) ? new Date(value) : value;
|
|
376
|
-
function check_appends(appends) {
|
|
377
|
-
const seen = /* @__PURE__ */ new Set();
|
|
378
|
-
for (const { stream, msgs } of appends) {
|
|
379
|
-
if (!msgs.length)
|
|
380
|
-
throw new Error(`commit: the append to "${stream}" has no events`);
|
|
381
|
-
if (seen.has(stream))
|
|
382
|
-
throw new Error(`commit: stream "${stream}" is named twice`);
|
|
383
|
-
seen.add(stream);
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
function concurrency_error(append, head) {
|
|
387
|
-
return new (0, _chunkVD4BLAY4cjs.ConcurrencyError)(
|
|
388
|
-
append.stream,
|
|
389
|
-
head,
|
|
390
|
-
append.msgs,
|
|
391
|
-
_nullishCoalesce(append.expectedVersion, () => ( -1))
|
|
392
|
-
);
|
|
393
|
-
}
|
|
394
|
-
function throw_if_stale(append, head) {
|
|
395
|
-
if (typeof append.expectedVersion === "number" && head !== append.expectedVersion)
|
|
396
|
-
throw concurrency_error(append, head);
|
|
397
|
-
}
|
|
398
|
-
function seed_event(snapshot, meta) {
|
|
399
|
-
return {
|
|
400
|
-
name: snapshot !== void 0 ? _chunkVD4BLAY4cjs.SNAP_EVENT : _chunkVD4BLAY4cjs.TOMBSTONE_EVENT,
|
|
401
|
-
data: _nullishCoalesce(snapshot, () => ( {})),
|
|
402
|
-
meta: _nullishCoalesce(meta, () => ( { correlation: "", causation: {} }))
|
|
403
|
-
};
|
|
404
|
-
}
|
|
405
|
-
function fair_slots(lagging) {
|
|
406
|
-
return lagging >= 2 ? Math.max(1, Math.floor(lagging / 4)) : 0;
|
|
407
|
-
}
|
|
408
|
-
function notification_of(raw) {
|
|
409
|
-
if (!raw || typeof raw !== "object") return void 0;
|
|
410
|
-
const { stream, events } = raw;
|
|
411
|
-
if (typeof stream !== "string" || !Array.isArray(events)) return void 0;
|
|
412
|
-
const kept = events.filter(
|
|
413
|
-
(e) => !!e && typeof e === "object" && typeof e.id === "number" && typeof e.name === "string"
|
|
414
|
-
);
|
|
415
|
-
return kept.length ? { stream, events: kept.map(({ id, name }) => ({ id, name })) } : void 0;
|
|
416
|
-
}
|
|
417
|
-
var DEFAULT_QUERY_STREAMS_LIMIT = 100;
|
|
418
230
|
|
|
419
231
|
// src/adapters/in-memory-store.ts
|
|
420
232
|
var InMemoryStream = (_class2 = class {
|
|
@@ -432,7 +244,7 @@ var InMemoryStream = (_class2 = class {
|
|
|
432
244
|
__init8() {this._deferred_at = void 0}
|
|
433
245
|
// Work mark; `undefined` = never correlated, so `claim` skips it.
|
|
434
246
|
__init9() {this._correlated_at = void 0}
|
|
435
|
-
constructor(stream, source, priority = 0, lane =
|
|
247
|
+
constructor(stream, source, priority = 0, lane = _chunk7VYSJIXDcjs.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);
|
|
436
248
|
this.stream = stream;
|
|
437
249
|
this.source = source;
|
|
438
250
|
this._priority = priority;
|
|
@@ -607,7 +419,7 @@ var InMemoryStore = (_class3 = class {constructor() { _class3.prototype.__init10
|
|
|
607
419
|
// Allocation-free for events without PII, the common case.
|
|
608
420
|
_with_pii(e, wanted = true) {
|
|
609
421
|
if (!wanted) return e;
|
|
610
|
-
const pii = _optionalChain([this, 'access',
|
|
422
|
+
const pii = _optionalChain([this, 'access', _2 => _2._pii, 'access', _3 => _3.get, 'call', _4 => _4(e.stream), 'optionalAccess', _5 => _5.get, 'call', _6 => _6(e.id)]);
|
|
611
423
|
return pii ? { ...e, pii } : e;
|
|
612
424
|
}
|
|
613
425
|
async dispose() {
|
|
@@ -627,9 +439,9 @@ var InMemoryStore = (_class3 = class {constructor() { _class3.prototype.__init10
|
|
|
627
439
|
return (e) => {
|
|
628
440
|
if (stream_ok && !stream_ok(e.stream)) return false;
|
|
629
441
|
if (query.names && !query.names.includes(e.name)) return false;
|
|
630
|
-
if (query.correlation && _optionalChain([e, 'access',
|
|
442
|
+
if (query.correlation && _optionalChain([e, 'access', _7 => _7.meta, 'optionalAccess', _8 => _8.correlation]) !== query.correlation)
|
|
631
443
|
return false;
|
|
632
|
-
if (e.name ===
|
|
444
|
+
if (e.name === _chunk7VYSJIXDcjs.SNAP_EVENT && !query.with_snaps) return false;
|
|
633
445
|
if (query.created_after && e.created <= query.created_after) return false;
|
|
634
446
|
if (query.created_before && e.created >= query.created_before)
|
|
635
447
|
return false;
|
|
@@ -638,38 +450,38 @@ var InMemoryStore = (_class3 = class {constructor() { _class3.prototype.__init10
|
|
|
638
450
|
}
|
|
639
451
|
// Index of the stream's latest snapshot, or -1; an explicit `after` wins.
|
|
640
452
|
_snap_floor(query) {
|
|
641
|
-
if (!_optionalChain([query, 'optionalAccess',
|
|
453
|
+
if (!_optionalChain([query, 'optionalAccess', _9 => _9.with_snaps]) || !query.stream_exact || query.stream === void 0 || query.after !== void 0)
|
|
642
454
|
return -1;
|
|
643
455
|
for (let j = this._events.length - 1; j >= 0; j--) {
|
|
644
456
|
const e = this._events[j];
|
|
645
|
-
if (e.stream === query.stream && e.name ===
|
|
457
|
+
if (e.stream === query.stream && e.name === _chunk7VYSJIXDcjs.SNAP_EVENT) return j;
|
|
646
458
|
}
|
|
647
459
|
return -1;
|
|
648
460
|
}
|
|
649
461
|
async query(callback, query) {
|
|
650
462
|
await sleep();
|
|
651
463
|
const floor = this._snap_floor(query);
|
|
652
|
-
const lo = floor >= 0 ? floor : this._first_index_after(_nullishCoalesce(_optionalChain([query, 'optionalAccess',
|
|
653
|
-
const hi = _optionalChain([query, 'optionalAccess',
|
|
654
|
-
const with_pii = _optionalChain([query, 'optionalAccess',
|
|
464
|
+
const lo = floor >= 0 ? floor : this._first_index_after(_nullishCoalesce(_optionalChain([query, 'optionalAccess', _10 => _10.after]), () => ( -1)));
|
|
465
|
+
const hi = _optionalChain([query, 'optionalAccess', _11 => _11.before]) !== void 0 ? this._first_index_after(query.before - 1) : this._events.length;
|
|
466
|
+
const with_pii = _optionalChain([query, 'optionalAccess', _12 => _12.with_pii]) !== false;
|
|
655
467
|
const in_query = this._in_query(_nullishCoalesce(query, () => ( {})));
|
|
656
468
|
let count = 0;
|
|
657
469
|
for (let k = 0; k < hi - lo; k++) {
|
|
658
|
-
const e = this._events[_optionalChain([query, 'optionalAccess',
|
|
470
|
+
const e = this._events[_optionalChain([query, 'optionalAccess', _13 => _13.backward]) ? hi - 1 - k : lo + k];
|
|
659
471
|
if (!in_query(e)) continue;
|
|
660
472
|
await Promise.resolve(
|
|
661
473
|
callback(this._with_pii(e, with_pii))
|
|
662
474
|
);
|
|
663
475
|
count++;
|
|
664
|
-
if (_optionalChain([query, 'optionalAccess',
|
|
476
|
+
if (_optionalChain([query, 'optionalAccess', _14 => _14.limit]) && count >= query.limit) break;
|
|
665
477
|
}
|
|
666
478
|
return count;
|
|
667
479
|
}
|
|
668
480
|
async commit(appends, meta) {
|
|
669
481
|
await sleep();
|
|
670
|
-
|
|
482
|
+
_chunkPZQXTGWFcjs.checkAppends.call(void 0, appends);
|
|
671
483
|
for (const append of appends)
|
|
672
|
-
|
|
484
|
+
_chunkPZQXTGWFcjs.checkVersion.call(void 0, append, _nullishCoalesce(this._stream_versions.get(append.stream), () => ( -1)));
|
|
673
485
|
const created = /* @__PURE__ */ new Date();
|
|
674
486
|
return appends.flatMap(({ stream, msgs }) => {
|
|
675
487
|
let version = _nullishCoalesce(this._stream_versions.get(stream), () => ( -1));
|
|
@@ -697,7 +509,7 @@ var InMemoryStore = (_class3 = class {constructor() { _class3.prototype.__init10
|
|
|
697
509
|
const available = [...this._streams.values()].filter(
|
|
698
510
|
(s) => s.is_available && has_work(s) && (lane === void 0 || s.lane === lane)
|
|
699
511
|
);
|
|
700
|
-
const fair =
|
|
512
|
+
const fair = _chunkPZQXTGWFcjs.fairSlots.call(void 0, lagging);
|
|
701
513
|
const by_priority = [...available].sort(
|
|
702
514
|
(a, b) => b.priority - a.priority || a.at - b.at
|
|
703
515
|
);
|
|
@@ -723,7 +535,7 @@ var InMemoryStore = (_class3 = class {constructor() { _class3.prototype.__init10
|
|
|
723
535
|
return true;
|
|
724
536
|
});
|
|
725
537
|
return combined.map(
|
|
726
|
-
(p) => _optionalChain([this, 'access',
|
|
538
|
+
(p) => _optionalChain([this, 'access', _15 => _15._streams, 'access', _16 => _16.get, 'call', _17 => _17(p.stream), 'optionalAccess', _18 => _18.lease, 'call', _19 => _19({ ...p, by, retry: 0 }, millis)])
|
|
727
539
|
).filter((l) => !!l);
|
|
728
540
|
}
|
|
729
541
|
async subscribe(streams, correlated_at, correlator) {
|
|
@@ -733,7 +545,7 @@ var InMemoryStore = (_class3 = class {constructor() { _class3.prototype.__init10
|
|
|
733
545
|
if (correlator) {
|
|
734
546
|
const now = Date.now();
|
|
735
547
|
const held = this._correlators.get(correlator.key);
|
|
736
|
-
const at = Math.max(_nullishCoalesce(_optionalChain([held, 'optionalAccess',
|
|
548
|
+
const at = Math.max(_nullishCoalesce(_optionalChain([held, 'optionalAccess', _20 => _20.at]), () => ( this._correlated_at)), _nullishCoalesce(correlated_at, () => ( -1)));
|
|
737
549
|
keyed_at = at;
|
|
738
550
|
if (!held || held.until < now || held.by === correlator.by) {
|
|
739
551
|
correlating = true;
|
|
@@ -756,7 +568,7 @@ var InMemoryStore = (_class3 = class {constructor() { _class3.prototype.__init10
|
|
|
756
568
|
stream,
|
|
757
569
|
source,
|
|
758
570
|
priority = 0,
|
|
759
|
-
lane =
|
|
571
|
+
lane = _chunk7VYSJIXDcjs.DEFAULT_LANE,
|
|
760
572
|
correlated_at: correlated_at2
|
|
761
573
|
} of streams) {
|
|
762
574
|
const existing = this._streams.get(stream);
|
|
@@ -783,11 +595,11 @@ var InMemoryStore = (_class3 = class {constructor() { _class3.prototype.__init10
|
|
|
783
595
|
}
|
|
784
596
|
async ack(leases) {
|
|
785
597
|
await sleep();
|
|
786
|
-
return leases.map((l) => _optionalChain([this, 'access',
|
|
598
|
+
return leases.map((l) => _optionalChain([this, 'access', _21 => _21._streams, 'access', _22 => _22.get, 'call', _23 => _23(l.stream), 'optionalAccess', _24 => _24.ack, 'call', _25 => _25(l)])).filter((l) => !!l);
|
|
787
599
|
}
|
|
788
600
|
async block(leases) {
|
|
789
601
|
await sleep();
|
|
790
|
-
return leases.map((l) => _optionalChain([this, 'access',
|
|
602
|
+
return leases.map((l) => _optionalChain([this, 'access', _26 => _26._streams, 'access', _27 => _27.get, 'call', _28 => _28(l.stream), 'optionalAccess', _29 => _29.block, 'call', _30 => _30(l, l.error)])).filter((l) => !!l);
|
|
791
603
|
}
|
|
792
604
|
async defer(input, deferred_at) {
|
|
793
605
|
await sleep();
|
|
@@ -822,7 +634,7 @@ var InMemoryStore = (_class3 = class {constructor() { _class3.prototype.__init10
|
|
|
822
634
|
}
|
|
823
635
|
async forget_pii(stream) {
|
|
824
636
|
await sleep();
|
|
825
|
-
const count = _nullishCoalesce(_optionalChain([this, 'access',
|
|
637
|
+
const count = _nullishCoalesce(_optionalChain([this, 'access', _31 => _31._pii, 'access', _32 => _32.get, 'call', _33 => _33(stream), 'optionalAccess', _34 => _34.size]), () => ( 0));
|
|
826
638
|
this._pii.delete(stream);
|
|
827
639
|
return count;
|
|
828
640
|
}
|
|
@@ -841,9 +653,9 @@ var InMemoryStore = (_class3 = class {constructor() { _class3.prototype.__init10
|
|
|
841
653
|
}
|
|
842
654
|
async query_streams(callback, query) {
|
|
843
655
|
await sleep();
|
|
844
|
-
const limit = _nullishCoalesce(_optionalChain([query, 'optionalAccess',
|
|
845
|
-
const after = _optionalChain([query, 'optionalAccess',
|
|
846
|
-
const source_matches = _optionalChain([query, 'optionalAccess',
|
|
656
|
+
const limit = _nullishCoalesce(_optionalChain([query, 'optionalAccess', _35 => _35.limit]), () => ( _chunk7VYSJIXDcjs.DEFAULT_QUERY_STREAMS_LIMIT));
|
|
657
|
+
const after = _optionalChain([query, 'optionalAccess', _36 => _36.after]);
|
|
658
|
+
const source_matches = _optionalChain([query, 'optionalAccess', _37 => _37.source_matches]);
|
|
847
659
|
const matches = this._filter_predicate(_nullishCoalesce(query, () => ( {})));
|
|
848
660
|
const reverse_match = (source) => {
|
|
849
661
|
const re = new RegExp(source);
|
|
@@ -874,24 +686,24 @@ var InMemoryStore = (_class3 = class {constructor() { _class3.prototype.__init10
|
|
|
874
686
|
});
|
|
875
687
|
count++;
|
|
876
688
|
}
|
|
877
|
-
return { maxEventId: _nullishCoalesce(_optionalChain([this, 'access',
|
|
689
|
+
return { maxEventId: _nullishCoalesce(_optionalChain([this, 'access', _38 => _38._events, 'access', _39 => _39.at, 'call', _40 => _40(-1), 'optionalAccess', _41 => _41.id]), () => ( -1)), count };
|
|
878
690
|
}
|
|
879
691
|
async query_stats(input, options) {
|
|
880
692
|
await sleep();
|
|
881
|
-
const exclude = new Set(_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
882
|
-
const want_tail = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
883
|
-
const want_count = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
884
|
-
const want_names = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
885
|
-
const before = _optionalChain([options, 'optionalAccess',
|
|
886
|
-
const after = _optionalChain([options, 'optionalAccess',
|
|
887
|
-
const limit = _optionalChain([options, 'optionalAccess',
|
|
693
|
+
const exclude = new Set(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _42 => _42.exclude]), () => ( [])));
|
|
694
|
+
const want_tail = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _43 => _43.tail]), () => ( false));
|
|
695
|
+
const want_count = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _44 => _44.count]), () => ( false));
|
|
696
|
+
const want_names = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _45 => _45.names]), () => ( false));
|
|
697
|
+
const before = _optionalChain([options, 'optionalAccess', _46 => _46.before]);
|
|
698
|
+
const after = _optionalChain([options, 'optionalAccess', _47 => _47.after]);
|
|
699
|
+
const limit = _optionalChain([options, 'optionalAccess', _48 => _48.limit]);
|
|
888
700
|
const array_targets = Array.isArray(input) ? new Set(input) : null;
|
|
889
701
|
const stream_ok = !Array.isArray(input) && input.stream !== void 0 ? name_test(input.stream, input.stream_exact) : void 0;
|
|
890
702
|
const scope_cache = /* @__PURE__ */ new Map();
|
|
891
703
|
const in_scope = (stream) => {
|
|
892
704
|
const cached = scope_cache.get(stream);
|
|
893
705
|
if (cached !== void 0) return cached;
|
|
894
|
-
const ok = array_targets ? array_targets.has(stream) : _nullishCoalesce(_optionalChain([stream_ok, 'optionalCall',
|
|
706
|
+
const ok = array_targets ? array_targets.has(stream) : _nullishCoalesce(_optionalChain([stream_ok, 'optionalCall', _49 => _49(stream)]), () => ( true));
|
|
895
707
|
scope_cache.set(stream, ok);
|
|
896
708
|
return ok;
|
|
897
709
|
};
|
|
@@ -935,7 +747,7 @@ var InMemoryStore = (_class3 = class {constructor() { _class3.prototype.__init10
|
|
|
935
747
|
for (const { stream, before, max_id } of windowed) {
|
|
936
748
|
let boundary;
|
|
937
749
|
for (const e of this._events) {
|
|
938
|
-
if (e.stream === stream && e.name ===
|
|
750
|
+
if (e.stream === stream && e.name === _chunk7VYSJIXDcjs.SNAP_EVENT && e.created < before && (max_id === void 0 || e.id <= max_id) && (!boundary || e.id > boundary.id))
|
|
939
751
|
boundary = e;
|
|
940
752
|
}
|
|
941
753
|
if (!boundary) continue;
|
|
@@ -943,7 +755,7 @@ var InMemoryStore = (_class3 = class {constructor() { _class3.prototype.__init10
|
|
|
943
755
|
let deleted = 0;
|
|
944
756
|
this._events = this._events.filter((e) => {
|
|
945
757
|
if (e.stream !== stream || e.id >= below) return true;
|
|
946
|
-
_optionalChain([this, 'access',
|
|
758
|
+
_optionalChain([this, 'access', _50 => _50._pii, 'access', _51 => _51.get, 'call', _52 => _52(stream), 'optionalAccess', _53 => _53.delete, 'call', _54 => _54(e.id)]);
|
|
947
759
|
deleted++;
|
|
948
760
|
return false;
|
|
949
761
|
});
|
|
@@ -964,7 +776,7 @@ var InMemoryStore = (_class3 = class {constructor() { _class3.prototype.__init10
|
|
|
964
776
|
stream,
|
|
965
777
|
version: 0,
|
|
966
778
|
created: /* @__PURE__ */ new Date(),
|
|
967
|
-
...
|
|
779
|
+
..._chunkPZQXTGWFcjs.seedEvent.call(void 0, snapshot, meta)
|
|
968
780
|
};
|
|
969
781
|
this._events.push(event);
|
|
970
782
|
this._stream_versions.set(stream, 0);
|
|
@@ -1044,6 +856,155 @@ var run_disposers = async () => {
|
|
|
1044
856
|
}
|
|
1045
857
|
};
|
|
1046
858
|
|
|
859
|
+
// src/internal/config.ts
|
|
860
|
+
|
|
861
|
+
var BackoffOptionsSchema = _zod.z.object({
|
|
862
|
+
strategy: _zod.z.enum(["fixed", "linear", "exponential"]),
|
|
863
|
+
baseMs: _zod.z.number().min(0),
|
|
864
|
+
maxMs: _zod.z.number().gt(0).optional(),
|
|
865
|
+
jitter: _zod.z.boolean().optional()
|
|
866
|
+
});
|
|
867
|
+
var DEFAULT_BACKOFF = {
|
|
868
|
+
strategy: "fixed",
|
|
869
|
+
baseMs: 1e4
|
|
870
|
+
};
|
|
871
|
+
var DEFAULT_MAX_RETRIES = 3;
|
|
872
|
+
var DEFAULT_BLOCK_ON_ERROR = true;
|
|
873
|
+
var ReactionOptionsSchema = _zod.z.object({
|
|
874
|
+
blockOnError: _zod.z.boolean(),
|
|
875
|
+
maxRetries: _zod.z.number().int().min(0),
|
|
876
|
+
backoff: BackoffOptionsSchema.optional()
|
|
877
|
+
});
|
|
878
|
+
function resolveReactionConfig(options) {
|
|
879
|
+
return ReactionOptionsSchema.parse(options);
|
|
880
|
+
}
|
|
881
|
+
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
|
+
var ActionOptionsSchema = _zod.z.object({
|
|
889
|
+
maxRetries: _zod.z.number().int().min(0).optional(),
|
|
890
|
+
backoff: BackoffOptionsSchema.optional()
|
|
891
|
+
});
|
|
892
|
+
function resolveActionConfig(options) {
|
|
893
|
+
return ActionOptionsSchema.parse(options);
|
|
894
|
+
}
|
|
895
|
+
var LaneConfigSchema = _zod.z.object({
|
|
896
|
+
name: _zod.z.string().min(1),
|
|
897
|
+
leaseMillis: _zod.z.number().min(0).optional(),
|
|
898
|
+
streamLimit: _zod.z.number().int().min(0).optional(),
|
|
899
|
+
cycleMs: _zod.z.number().min(0).optional()
|
|
900
|
+
});
|
|
901
|
+
function resolveLaneConfig(options) {
|
|
902
|
+
LaneConfigSchema.parse(options);
|
|
903
|
+
return options;
|
|
904
|
+
}
|
|
905
|
+
var DEFAULT_STREAM_LIMIT = 10;
|
|
906
|
+
var DEFAULT_EVENT_LIMIT = 10;
|
|
907
|
+
var DEFAULT_LEASE_MILLIS = 1e4;
|
|
908
|
+
var DrainOptionsSchema = _zod.z.object({
|
|
909
|
+
streamLimit: _zod.z.number().int().min(0).optional(),
|
|
910
|
+
eventLimit: _zod.z.number().int().min(0).optional(),
|
|
911
|
+
leaseMillis: _zod.z.number().min(0).optional()
|
|
912
|
+
});
|
|
913
|
+
function resolveDrainConfig(options) {
|
|
914
|
+
if (options === void 0) return void 0;
|
|
915
|
+
DrainOptionsSchema.parse(options);
|
|
916
|
+
return options;
|
|
917
|
+
}
|
|
918
|
+
var SettleOptionsSchema = DrainOptionsSchema.extend({
|
|
919
|
+
debounceMs: _zod.z.number().min(0).optional(),
|
|
920
|
+
// `maxPasses` defaults to Infinity (no cap) when omitted; a present value is
|
|
921
|
+
// a non-negative integer — `0` is legal and means "run no passes".
|
|
922
|
+
//
|
|
923
|
+
// `Infinity` is accepted explicitly. It is the documented default
|
|
924
|
+
// (`Act.settle`'s doc-comment and `SettleOptions.maxPasses` both name it),
|
|
925
|
+
// and `settle.ts` destructures `maxPasses = Infinity`, so the one value the
|
|
926
|
+
// docs advertise was the one value `z.number().int()` refused — Zod 4
|
|
927
|
+
// rejects `±Infinity`, and an integer check cannot pass it either. Wrapper
|
|
928
|
+
// code normalizing an optional cap (`maxPasses: opts.maxPasses ?? Infinity`)
|
|
929
|
+
// is the natural way to hit it. Accepting it also honors this module's own
|
|
930
|
+
// rule that a value which works today is never newly rejected.
|
|
931
|
+
maxPasses: _zod.z.union([_zod.z.number().int().min(0), _zod.z.literal(Number.POSITIVE_INFINITY)]).optional()
|
|
932
|
+
}).loose();
|
|
933
|
+
function resolveSettleConfig(options) {
|
|
934
|
+
if (options === void 0) return void 0;
|
|
935
|
+
SettleOptionsSchema.parse(options);
|
|
936
|
+
return options;
|
|
937
|
+
}
|
|
938
|
+
var MAX_SHUTDOWN_GRACE_MS = 3e4;
|
|
939
|
+
var ShutdownOptionsSchema = _zod.z.object({
|
|
940
|
+
// `0` is legal and is exactly today's behavior: stop scheduling and
|
|
941
|
+
// return without waiting.
|
|
942
|
+
graceMs: _zod.z.number().min(0).optional()
|
|
943
|
+
}).loose();
|
|
944
|
+
function resolveShutdownConfig(options) {
|
|
945
|
+
if (options === void 0) return void 0;
|
|
946
|
+
ShutdownOptionsSchema.parse(options);
|
|
947
|
+
return options;
|
|
948
|
+
}
|
|
949
|
+
var ActOptionsSchema = _zod.z.object({
|
|
950
|
+
maxSubscribedStreams: _zod.z.number().int().min(1).optional(),
|
|
951
|
+
settleDebounceMs: _zod.z.number().int().min(0).optional(),
|
|
952
|
+
autoSettle: _zod.z.boolean().optional()
|
|
953
|
+
}).loose();
|
|
954
|
+
function resolveActConfig(options) {
|
|
955
|
+
if (options === void 0) return void 0;
|
|
956
|
+
ActOptionsSchema.parse(options);
|
|
957
|
+
return options;
|
|
958
|
+
}
|
|
959
|
+
var DEFAULT_AUTOCLOSE_WINDOW_TZ = "UTC";
|
|
960
|
+
function is_valid_time_zone(tz) {
|
|
961
|
+
try {
|
|
962
|
+
new Intl.DateTimeFormat("en-US", { timeZone: tz });
|
|
963
|
+
return true;
|
|
964
|
+
} catch (e4) {
|
|
965
|
+
return false;
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
var AutocloseWindowSchema = _zod.z.object({
|
|
969
|
+
start: _zod.z.number().int().min(0).max(23, { message: "autocloseWindow.start must be an hour in [0, 23]" }),
|
|
970
|
+
end: _zod.z.number().int().min(0).max(23, { message: "autocloseWindow.end must be an hour in [0, 23]" }),
|
|
971
|
+
timeZone: _zod.z.string().refine(is_valid_time_zone, {
|
|
972
|
+
message: "autocloseWindow.timeZone must be a valid IANA time zone"
|
|
973
|
+
}).default(DEFAULT_AUTOCLOSE_WINDOW_TZ)
|
|
974
|
+
}).refine((w) => w.start !== w.end, {
|
|
975
|
+
message: "autocloseWindow.start and end must differ \u2014 an empty window disables autoclose"
|
|
976
|
+
});
|
|
977
|
+
var AutocloseOptionsSchema = _zod.z.object({
|
|
978
|
+
autocloseWindow: AutocloseWindowSchema.optional()
|
|
979
|
+
});
|
|
980
|
+
function resolveAutocloseConfig(options) {
|
|
981
|
+
return AutocloseOptionsSchema.parse({
|
|
982
|
+
autocloseWindow: _optionalChain([options, 'optionalAccess', _55 => _55.autocloseWindow])
|
|
983
|
+
});
|
|
984
|
+
}
|
|
985
|
+
var DEFAULT_CIRCUIT_FAILURE_THRESHOLD = 5;
|
|
986
|
+
var DEFAULT_CIRCUIT_COOLDOWN_MS = 3e4;
|
|
987
|
+
var CircuitBreakerOptionsSchema = _zod.z.object({
|
|
988
|
+
failureThreshold: _zod.z.number().int().min(1).default(DEFAULT_CIRCUIT_FAILURE_THRESHOLD),
|
|
989
|
+
cooldownMs: _zod.z.number().int().min(100).max(36e5).default(DEFAULT_CIRCUIT_COOLDOWN_MS)
|
|
990
|
+
});
|
|
991
|
+
var resolveCircuitBreakerConfig = (options) => CircuitBreakerOptionsSchema.parse(_nullishCoalesce(options, () => ( {})));
|
|
992
|
+
var DEFAULT_FOLD_FLUSH_EVERY = 1e3;
|
|
993
|
+
var DEFAULT_MAX_CACHED_STATES = 1e4;
|
|
994
|
+
var FoldOptionsSchema = _zod.z.object({
|
|
995
|
+
flushEvery: _zod.z.number().int().min(1).default(DEFAULT_FOLD_FLUSH_EVERY),
|
|
996
|
+
maxCachedStates: _zod.z.number().int().min(1).default(DEFAULT_MAX_CACHED_STATES)
|
|
997
|
+
});
|
|
998
|
+
function resolveFoldConfig(options) {
|
|
999
|
+
return FoldOptionsSchema.parse(options);
|
|
1000
|
+
}
|
|
1001
|
+
function check_store(store3) {
|
|
1002
|
+
if (store3.commit.length === 4)
|
|
1003
|
+
throw new Error(
|
|
1004
|
+
"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"
|
|
1005
|
+
);
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1047
1008
|
// src/scoped.ts
|
|
1048
1009
|
var _async_hooks = require('async_hooks');
|
|
1049
1010
|
var scoped = new (0, _async_hooks.AsyncLocalStorage)();
|
|
@@ -1106,7 +1067,7 @@ var _cache = port(function cache(adapter) {
|
|
|
1106
1067
|
var cache2 = ((adapter) => {
|
|
1107
1068
|
return _nullishCoalesce(_optionalChain([current_ports, 'call', _64 => _64(), 'optionalAccess', _65 => _65.cache]), () => ( _cache(adapter)));
|
|
1108
1069
|
});
|
|
1109
|
-
var
|
|
1070
|
+
var unscoped_ports = () => DEFAULT_SCOPE;
|
|
1110
1071
|
var DEFAULT_SCOPE = {
|
|
1111
1072
|
get store() {
|
|
1112
1073
|
return _store();
|
|
@@ -1136,7 +1097,7 @@ function dispose(disposer) {
|
|
|
1136
1097
|
}
|
|
1137
1098
|
|
|
1138
1099
|
// src/config.ts
|
|
1139
|
-
var
|
|
1100
|
+
var package_schema = _zod.z.object({
|
|
1140
1101
|
name: _zod.z.string().min(1),
|
|
1141
1102
|
version: _zod.z.string().min(1),
|
|
1142
1103
|
description: _zod.z.string().min(1).optional(),
|
|
@@ -1156,7 +1117,7 @@ var get_package = () => {
|
|
|
1156
1117
|
name: FALLBACK_PACKAGE.name,
|
|
1157
1118
|
version: FALLBACK_PACKAGE.version
|
|
1158
1119
|
};
|
|
1159
|
-
for (const [key, schema] of Object.entries(
|
|
1120
|
+
for (const [key, schema] of Object.entries(package_schema.shape)) {
|
|
1160
1121
|
const field = schema.safeParse(_optionalChain([raw, 'optionalAccess', _66 => _66[key]]));
|
|
1161
1122
|
if (field.success && field.data !== void 0) pkg2[key] = field.data;
|
|
1162
1123
|
}
|
|
@@ -1167,9 +1128,9 @@ var get_package = () => {
|
|
|
1167
1128
|
}
|
|
1168
1129
|
};
|
|
1169
1130
|
var pkg_load_error;
|
|
1170
|
-
var BaseSchema =
|
|
1171
|
-
env: _zod.z.enum(
|
|
1172
|
-
logLevel: _zod.z.enum(
|
|
1131
|
+
var BaseSchema = package_schema.extend({
|
|
1132
|
+
env: _zod.z.enum(_chunk7VYSJIXDcjs.Environments),
|
|
1133
|
+
logLevel: _zod.z.enum(_chunk7VYSJIXDcjs.LogLevels),
|
|
1173
1134
|
logSingleLine: _zod.z.boolean(),
|
|
1174
1135
|
sleepMs: _zod.z.number().int().min(0).max(5e3)
|
|
1175
1136
|
});
|
|
@@ -1182,7 +1143,8 @@ var pkg = get_package();
|
|
|
1182
1143
|
var _validated;
|
|
1183
1144
|
var config = () => {
|
|
1184
1145
|
if (!_validated) {
|
|
1185
|
-
_validated =
|
|
1146
|
+
_validated = validate(
|
|
1147
|
+
"config",
|
|
1186
1148
|
{ ...pkg, env, logLevel, logSingleLine, sleepMs },
|
|
1187
1149
|
BaseSchema
|
|
1188
1150
|
);
|
|
@@ -1196,18 +1158,6 @@ var config = () => {
|
|
|
1196
1158
|
}
|
|
1197
1159
|
return _validated;
|
|
1198
1160
|
};
|
|
1199
|
-
function resolveAutocloseConfig2(options) {
|
|
1200
|
-
return resolveAutocloseConfig(options);
|
|
1201
|
-
}
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
1161
|
|
|
1212
1162
|
|
|
1213
1163
|
|
|
@@ -1250,5 +1200,5 @@ function resolveAutocloseConfig2(options) {
|
|
|
1250
1200
|
|
|
1251
1201
|
|
|
1252
1202
|
|
|
1253
|
-
exports.ConsoleLogger = ConsoleLogger; exports.LruMap = LruMap; exports.InMemoryCache = InMemoryCache; exports.
|
|
1254
|
-
//# sourceMappingURL=chunk-
|
|
1203
|
+
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.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;
|
|
1204
|
+
//# sourceMappingURL=chunk-LN3OP4OL.cjs.map
|