@rotorsoft/act 1.23.21 → 1.23.23

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/index.cjs CHANGED
@@ -1122,7 +1122,7 @@ var InMemoryStore = class {
1122
1122
  await sleep();
1123
1123
  let count = 0;
1124
1124
  if (Array.isArray(input)) {
1125
- for (const name of input) {
1125
+ for (const name of new Set(input)) {
1126
1126
  const s = this._streams.get(name);
1127
1127
  if (s) {
1128
1128
  s.defer(deferred_at);
@@ -1176,7 +1176,7 @@ var InMemoryStore = class {
1176
1176
  await sleep();
1177
1177
  let count = 0;
1178
1178
  if (Array.isArray(input)) {
1179
- for (const name of input) {
1179
+ for (const name of new Set(input)) {
1180
1180
  const s = this._streams.get(name);
1181
1181
  if (s) {
1182
1182
  s.reset();
@@ -1381,7 +1381,7 @@ var InMemoryStore = class {
1381
1381
  a.names[n] = (a.names[n] ?? 0) + 1;
1382
1382
  }
1383
1383
  }
1384
- const ordered = [...acc.keys()].sort((x, y) => x.localeCompare(y));
1384
+ const ordered = [...acc.keys()].sort();
1385
1385
  const out = /* @__PURE__ */ new Map();
1386
1386
  for (const stream of ordered) {
1387
1387
  if (after !== void 0 && stream <= after) continue;
@@ -2269,7 +2269,7 @@ function synthesize_autoclose_reactions(registry, states, config2) {
2269
2269
  const stats = await store2().query_stats([aggregate], {
2270
2270
  count: true,
2271
2271
  tail: keep_days !== void 0 ? true : void 0,
2272
- exclude: keep_days !== void 0 ? [TOMBSTONE_EVENT, SNAP_EVENT] : [TOMBSTONE_EVENT]
2272
+ exclude: [TOMBSTONE_EVENT, SNAP_EVENT]
2273
2273
  });
2274
2274
  const entry = stats.get(aggregate);
2275
2275
  if (!entry) return;
@@ -2921,12 +2921,13 @@ async function scan_stream_heads(streams) {
2921
2921
  const stats = await store2().query_stats(streams, {
2922
2922
  exclude: [SNAP_EVENT]
2923
2923
  });
2924
+ const true_heads = await store2().query_stats(streams, {});
2924
2925
  const out = /* @__PURE__ */ new Map();
2925
2926
  for (const [stream, { head }] of stats) {
2926
2927
  if (head.name === TOMBSTONE_EVENT) continue;
2927
2928
  out.set(stream, {
2928
2929
  max_id: head.id,
2929
- version: head.version,
2930
+ version: true_heads.get(stream).head.version,
2930
2931
  last_event_name: head.name
2931
2932
  });
2932
2933
  }