@rotorsoft/act 1.21.0 → 1.22.0
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 +29 -42
- package/dist/@types/act.d.ts.map +1 -1
- package/dist/@types/internal/autoclose-config.d.ts +39 -15
- package/dist/@types/internal/autoclose-config.d.ts.map +1 -1
- package/dist/@types/internal/autoclose-reaction.d.ts.map +1 -1
- package/dist/@types/internal/index.d.ts +1 -1
- package/dist/@types/internal/index.d.ts.map +1 -1
- package/dist/index.cjs +9 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -538,6 +538,14 @@ function in_autoclose_window(window, now) {
|
|
|
538
538
|
const hour = hour_in_zone(now, window.timeZone);
|
|
539
539
|
return window.start < window.end ? hour >= window.start && hour < window.end : hour >= window.start || hour < window.end;
|
|
540
540
|
}
|
|
541
|
+
function next_window_open(window, now) {
|
|
542
|
+
for (let h = 0; h <= 48; h++) {
|
|
543
|
+
const candidate = new Date(now.getTime() + h * 36e5);
|
|
544
|
+
if (hour_in_zone(candidate, window.timeZone) === window.start)
|
|
545
|
+
return candidate;
|
|
546
|
+
}
|
|
547
|
+
return new Date(now.getTime() + 864e5);
|
|
548
|
+
}
|
|
541
549
|
|
|
542
550
|
// src/internal/autoclose-policy.ts
|
|
543
551
|
import { z as z2 } from "zod";
|
|
@@ -707,7 +715,7 @@ function synthesize_autoclose_reactions(registry, states, config2) {
|
|
|
707
715
|
const aggregate = event.stream;
|
|
708
716
|
if (!in_autoclose_window(config2.autocloseWindow, /* @__PURE__ */ new Date()))
|
|
709
717
|
throw new DeferSignal({
|
|
710
|
-
at:
|
|
718
|
+
at: next_window_open(config2.autocloseWindow, /* @__PURE__ */ new Date())
|
|
711
719
|
});
|
|
712
720
|
const stats = await store().query_stats([aggregate], {
|
|
713
721
|
count: true,
|