@rotorsoft/act 1.31.17 → 1.31.18
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/adapters/in-memory-store.d.ts.map +1 -1
- package/dist/@types/builders/act-builder.d.ts.map +1 -1
- package/dist/@types/internal/autoclose-reaction.d.ts +12 -2
- package/dist/@types/internal/autoclose-reaction.d.ts.map +1 -1
- package/dist/@types/scoped.d.ts +37 -2
- package/dist/@types/scoped.d.ts.map +1 -1
- package/dist/@types/types/ports.d.ts +10 -3
- package/dist/@types/types/ports.d.ts.map +1 -1
- package/dist/{chunk-LTA7FYBC.js → chunk-34WL4DPW.js} +9 -7
- package/dist/chunk-34WL4DPW.js.map +1 -0
- package/dist/index.cjs +26 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +21 -8
- package/dist/index.js.map +1 -1
- package/dist/test/index.cjs +4 -6
- package/dist/test/index.cjs.map +1 -1
- package/dist/test/index.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-LTA7FYBC.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
TOMBSTONE_EVENT,
|
|
11
11
|
cache,
|
|
12
12
|
config,
|
|
13
|
+
current_autoclose_window,
|
|
13
14
|
current_reacting,
|
|
14
15
|
dateReviver,
|
|
15
16
|
default_scope,
|
|
@@ -25,7 +26,7 @@ import {
|
|
|
25
26
|
sleep,
|
|
26
27
|
store,
|
|
27
28
|
validate
|
|
28
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-34WL4DPW.js";
|
|
29
30
|
import {
|
|
30
31
|
ActorSchema,
|
|
31
32
|
CausationEventSchema,
|
|
@@ -805,7 +806,7 @@ var DeferSignal = class extends Error {
|
|
|
805
806
|
|
|
806
807
|
// src/internal/autoclose-reaction.ts
|
|
807
808
|
var AUTOCLOSE_TARGET_PREFIX = "__autoclose__:";
|
|
808
|
-
function synthesize_autoclose_reactions(registry, states,
|
|
809
|
+
function synthesize_autoclose_reactions(registry, states, read_window) {
|
|
809
810
|
for (const st of states.values()) {
|
|
810
811
|
const predicate = st.autoclose;
|
|
811
812
|
if (!predicate) continue;
|
|
@@ -828,10 +829,9 @@ function synthesize_autoclose_reactions(registry, states, config2) {
|
|
|
828
829
|
options: { blockOnError: false, maxRetries: 3 },
|
|
829
830
|
handler: async (event) => {
|
|
830
831
|
const aggregate = event.stream;
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
});
|
|
832
|
+
const window = read_window();
|
|
833
|
+
if (!in_autoclose_window(window, /* @__PURE__ */ new Date()))
|
|
834
|
+
throw new DeferSignal({ at: next_window_open(window, /* @__PURE__ */ new Date()) });
|
|
835
835
|
const stats = await store().query_stats([aggregate], {
|
|
836
836
|
count: true,
|
|
837
837
|
tail: keep_days !== void 0 ? true : void 0,
|
|
@@ -3521,7 +3521,20 @@ var Act = class {
|
|
|
3521
3521
|
this._lanes = lanes;
|
|
3522
3522
|
validate_only_lanes(options, lanes);
|
|
3523
3523
|
this._ports = options.scoped ?? default_scope();
|
|
3524
|
-
|
|
3524
|
+
const ports = this._ports;
|
|
3525
|
+
this._scoped = make_run_scoped({
|
|
3526
|
+
// Delegating getters, NOT a spread: `default_scope()` resolves the
|
|
3527
|
+
// process singletons lazily, so copying its properties would freeze
|
|
3528
|
+
// whichever adapters happened to be installed at construction and
|
|
3529
|
+
// ignore a later `store(...)` / `cache(...)`.
|
|
3530
|
+
get store() {
|
|
3531
|
+
return ports.store;
|
|
3532
|
+
},
|
|
3533
|
+
get cache() {
|
|
3534
|
+
return ports.cache;
|
|
3535
|
+
},
|
|
3536
|
+
autoclose_window: resolveAutocloseConfig(options).autocloseWindow
|
|
3537
|
+
});
|
|
3525
3538
|
this._correlator = options.correlator ?? default_correlator;
|
|
3526
3539
|
this._es = build_es(this._logger, this._correlator, patch_fn);
|
|
3527
3540
|
this._cd = build_drain(this._logger);
|
|
@@ -5313,7 +5326,7 @@ function act() {
|
|
|
5313
5326
|
synthesize_autoclose_reactions(
|
|
5314
5327
|
registry,
|
|
5315
5328
|
states,
|
|
5316
|
-
|
|
5329
|
+
current_autoclose_window
|
|
5317
5330
|
);
|
|
5318
5331
|
Object.freeze(registry.actions);
|
|
5319
5332
|
Object.freeze(registry.events);
|