@rotorsoft/act 1.14.1 → 1.15.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.
@@ -4854,8 +4854,18 @@ var InMemoryStore = class {
4854
4854
  const limit = query?.limit ?? 100;
4855
4855
  const after = query?.after;
4856
4856
  const blocked = query?.blocked;
4857
+ const source_matches = query?.source_matches;
4857
4858
  const stream_re = query?.stream && !query.stream_exact ? new RegExp(query.stream) : void 0;
4858
4859
  const source_re = query?.source && !query.source_exact ? new RegExp(query.source) : void 0;
4860
+ const reverse_cache = /* @__PURE__ */ new Map();
4861
+ const reverse_match = (source) => {
4862
+ let re = reverse_cache.get(source);
4863
+ if (!re) {
4864
+ re = new RegExp(source);
4865
+ reverse_cache.set(source, re);
4866
+ }
4867
+ return source_matches.some((name) => re.test(name));
4868
+ };
4859
4869
  const sorted = [...this._streams.values()].sort(
4860
4870
  (a, b2) => a.stream.localeCompare(b2.stream)
4861
4871
  );
@@ -4871,6 +4881,9 @@ var InMemoryStore = class {
4871
4881
  if (query.source_exact ? s.source !== query.source : !source_re.test(s.source))
4872
4882
  continue;
4873
4883
  }
4884
+ if (source_matches !== void 0) {
4885
+ if (s.source && !reverse_match(s.source)) continue;
4886
+ }
4874
4887
  if (blocked !== void 0 && s.blocked !== blocked) continue;
4875
4888
  if (query?.lane !== void 0 && s.lane !== query.lane) continue;
4876
4889
  callback({
@@ -4913,6 +4926,8 @@ var InMemoryStore = class {
4913
4926
  const want_count = options?.count ?? false;
4914
4927
  const want_names = options?.names ?? false;
4915
4928
  const before = options?.before;
4929
+ const after = options?.after;
4930
+ const limit = options?.limit;
4916
4931
  const array_targets = Array.isArray(input) ? new Set(input) : null;
4917
4932
  const filter = Array.isArray(input) ? null : input;
4918
4933
  const stream_re = filter?.stream && !filter.stream_exact ? new RegExp(filter.stream) : void 0;
@@ -4951,13 +4966,17 @@ var InMemoryStore = class {
4951
4966
  a.names[n] = (a.names[n] ?? 0) + 1;
4952
4967
  }
4953
4968
  }
4969
+ const ordered = [...acc.keys()].sort((x, y2) => x.localeCompare(y2));
4954
4970
  const out = /* @__PURE__ */ new Map();
4955
- for (const [stream, a] of acc) {
4971
+ for (const stream of ordered) {
4972
+ if (after !== void 0 && stream <= after) continue;
4973
+ const a = acc.get(stream);
4956
4974
  const stats = { head: a.head };
4957
4975
  if (want_tail) stats.tail = a.tail;
4958
4976
  if (want_count) stats.count = a.count;
4959
4977
  if (want_names) stats.names = a.names;
4960
4978
  out.set(stream, stats);
4979
+ if (limit !== void 0 && out.size >= limit) break;
4961
4980
  }
4962
4981
  return out;
4963
4982
  }