@rotorsoft/act 1.23.32 → 1.23.33

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.js CHANGED
@@ -1430,14 +1430,19 @@ async function scan_stream_heads(streams) {
1430
1430
  const stats = await store().query_stats(streams, {
1431
1431
  exclude: [SNAP_EVENT]
1432
1432
  });
1433
+ const domain_heads = await store().query_stats(streams, {
1434
+ exclude: [SNAP_EVENT, TOMBSTONE_EVENT]
1435
+ });
1433
1436
  const true_heads = await store().query_stats(streams, {});
1434
1437
  const out = /* @__PURE__ */ new Map();
1435
- for (const [stream, { head }] of stats) {
1436
- if (head.name === TOMBSTONE_EVENT) continue;
1438
+ for (const [stream, { head }] of domain_heads) {
1439
+ const marker_head = stats.get(stream)?.head;
1440
+ const interrupted = marker_head?.name === TOMBSTONE_EVENT;
1437
1441
  out.set(stream, {
1438
1442
  max_id: head.id,
1439
1443
  version: true_heads.get(stream).head.version,
1440
- last_event_name: head.name
1444
+ last_event_name: head.name,
1445
+ ...interrupted ? { resumed_guard: { id: marker_head.id } } : {}
1441
1446
  });
1442
1447
  }
1443
1448
  return out;
@@ -1486,6 +1491,11 @@ async function guard_with_tombstones(safe, stream_info, correlation, tombstone2,
1486
1491
  await Promise.all(
1487
1492
  safe.map(async (stream) => {
1488
1493
  const info = stream_info.get(stream);
1494
+ if (info.resumed_guard) {
1495
+ guarded.push(stream);
1496
+ guard_events.set(stream, { id: info.resumed_guard.id, stream });
1497
+ return;
1498
+ }
1489
1499
  const committed = await tombstone2(stream, info.version, correlation);
1490
1500
  if (committed) {
1491
1501
  guarded.push(stream);