@rotorsoft/act 1.22.4 → 1.22.5
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/adapters/in-memory-store.d.ts.map +1 -1
- package/dist/@types/internal/drain.d.ts.map +1 -1
- package/dist/@types/types/ports.d.ts +15 -9
- package/dist/@types/types/ports.d.ts.map +1 -1
- package/dist/@types/types/reaction.d.ts +8 -6
- package/dist/@types/types/reaction.d.ts.map +1 -1
- package/dist/@types/utils.d.ts +20 -0
- package/dist/@types/utils.d.ts.map +1 -1
- package/dist/{chunk-2FN4RFBQ.js → chunk-CWBI4NQD.js} +18 -5
- package/dist/chunk-CWBI4NQD.js.map +1 -0
- package/dist/index.cjs +20 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/test/index.cjs +16 -4
- package/dist/test/index.cjs.map +1 -1
- package/dist/test/index.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-2FN4RFBQ.js.map +0 -1
package/dist/test/index.cjs
CHANGED
|
@@ -373,6 +373,10 @@ var extend = (source, schema, target) => {
|
|
|
373
373
|
async function sleep(ms) {
|
|
374
374
|
return new Promise((resolve) => setTimeout(resolve, ms ?? config().sleepMs));
|
|
375
375
|
}
|
|
376
|
+
var SOURCE_METACHARACTERS = /[\^$.*+?()[\]{}|\\]/;
|
|
377
|
+
function is_literal_source(source) {
|
|
378
|
+
return !SOURCE_METACHARACTERS.test(source);
|
|
379
|
+
}
|
|
376
380
|
|
|
377
381
|
// src/config.ts
|
|
378
382
|
var PackageSchema = import_zod4.z.object({
|
|
@@ -649,8 +653,9 @@ var InMemoryStore = class {
|
|
|
649
653
|
_streams = /* @__PURE__ */ new Map();
|
|
650
654
|
// last committed version per stream — O(1) replacement for filter-on-commit
|
|
651
655
|
_stream_versions = /* @__PURE__ */ new Map();
|
|
652
|
-
// max non-snapshot event id per stream — drives the
|
|
653
|
-
//
|
|
656
|
+
// max non-snapshot event id per stream — drives the has-work probe in
|
|
657
|
+
// claim(): an O(1) lookup for a literal source, and the per-stream max
|
|
658
|
+
// that a pattern source scans, without touching the full event log.
|
|
654
659
|
_max_event_id_by_stream = /* @__PURE__ */ new Map();
|
|
655
660
|
// global max non-snapshot event id — fast pre-check for source-less streams in claim()
|
|
656
661
|
_max_non_snap_event_id = -1;
|
|
@@ -840,8 +845,15 @@ var InMemoryStore = class {
|
|
|
840
845
|
const has_work = (s) => {
|
|
841
846
|
if (s.at < 0) return true;
|
|
842
847
|
if (!s.source) return s.at < this._max_non_snap_event_id;
|
|
843
|
-
|
|
844
|
-
|
|
848
|
+
if (is_literal_source(s.source)) {
|
|
849
|
+
const max_id = this._max_event_id_by_stream.get(s.source);
|
|
850
|
+
return max_id !== void 0 && max_id > s.at;
|
|
851
|
+
}
|
|
852
|
+
const re = new RegExp(s.source);
|
|
853
|
+
for (const [stream_name, max_id] of this._max_event_id_by_stream) {
|
|
854
|
+
if (max_id > s.at && re.test(stream_name)) return true;
|
|
855
|
+
}
|
|
856
|
+
return false;
|
|
845
857
|
};
|
|
846
858
|
const available = [...this._streams.values()].filter(
|
|
847
859
|
(s) => s.is_available && has_work(s) && (lane === void 0 || s.lane === lane)
|