@rotorsoft/act 1.22.2 → 1.22.4
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/internal/correlate-cycle.d.ts +9 -1
- package/dist/@types/internal/correlate-cycle.d.ts.map +1 -1
- package/dist/@types/internal/drain-cycle.d.ts +8 -0
- package/dist/@types/internal/drain-cycle.d.ts.map +1 -1
- package/dist/@types/internal/event-sourcing.d.ts.map +1 -1
- package/dist/@types/types/ports.d.ts +17 -2
- package/dist/@types/types/ports.d.ts.map +1 -1
- package/dist/@types/types/reaction.d.ts +6 -3
- package/dist/@types/types/reaction.d.ts.map +1 -1
- package/dist/{chunk-KBTC3NGQ.js → chunk-2FN4RFBQ.js} +4 -16
- package/dist/chunk-2FN4RFBQ.js.map +1 -0
- package/dist/index.cjs +39 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +37 -11
- package/dist/index.js.map +1 -1
- package/dist/test/index.cjs +3 -15
- package/dist/test/index.cjs.map +1 -1
- package/dist/test/index.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-KBTC3NGQ.js.map +0 -1
package/dist/test/index.cjs
CHANGED
|
@@ -649,7 +649,7 @@ var InMemoryStore = class {
|
|
|
649
649
|
_streams = /* @__PURE__ */ new Map();
|
|
650
650
|
// last committed version per stream — O(1) replacement for filter-on-commit
|
|
651
651
|
_stream_versions = /* @__PURE__ */ new Map();
|
|
652
|
-
// max non-snapshot event id per stream — drives the source
|
|
652
|
+
// max non-snapshot event id per stream — drives the exact-source probe in claim()
|
|
653
653
|
// without scanning the full event log.
|
|
654
654
|
_max_event_id_by_stream = /* @__PURE__ */ new Map();
|
|
655
655
|
// global max non-snapshot event id — fast pre-check for source-less streams in claim()
|
|
@@ -837,23 +837,11 @@ var InMemoryStore = class {
|
|
|
837
837
|
*/
|
|
838
838
|
async claim(lagging, leading, by, millis, lane) {
|
|
839
839
|
await sleep();
|
|
840
|
-
const source_regex = /* @__PURE__ */ new Map();
|
|
841
|
-
const get_regex = (source) => {
|
|
842
|
-
let re = source_regex.get(source);
|
|
843
|
-
if (!re) {
|
|
844
|
-
re = new RegExp(source);
|
|
845
|
-
source_regex.set(source, re);
|
|
846
|
-
}
|
|
847
|
-
return re;
|
|
848
|
-
};
|
|
849
840
|
const has_work = (s) => {
|
|
850
841
|
if (s.at < 0) return true;
|
|
851
842
|
if (!s.source) return s.at < this._max_non_snap_event_id;
|
|
852
|
-
const
|
|
853
|
-
|
|
854
|
-
if (maxId > s.at && re.test(stream_name)) return true;
|
|
855
|
-
}
|
|
856
|
-
return false;
|
|
843
|
+
const max_id = this._max_event_id_by_stream.get(s.source);
|
|
844
|
+
return max_id !== void 0 && max_id > s.at;
|
|
857
845
|
};
|
|
858
846
|
const available = [...this._streams.values()].filter(
|
|
859
847
|
(s) => s.is_available && has_work(s) && (lane === void 0 || s.lane === lane)
|