@rotorsoft/act 1.32.0 → 1.32.2

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.
@@ -1324,20 +1324,16 @@ var InMemoryStore = class {
1324
1324
  if (drop.size) this._events = this._events.filter((e) => !drop.has(e.id));
1325
1325
  }
1326
1326
  const full = targets.filter((t) => t.before === void 0);
1327
- const deleted_counts = /* @__PURE__ */ new Map();
1328
- const stream_set = new Set(full.map((t) => t.stream));
1329
- for (const e of this._events) {
1330
- if (stream_set.has(e.stream)) {
1331
- deleted_counts.set(e.stream, (deleted_counts.get(e.stream) ?? 0) + 1);
1332
- }
1333
- }
1334
- this._events = this._events.filter((e) => !stream_set.has(e.stream));
1335
- for (const stream of stream_set) {
1327
+ for (const { stream, snapshot, meta } of full) {
1328
+ let deleted = 0;
1329
+ this._events = this._events.filter((e) => {
1330
+ if (e.stream !== stream) return true;
1331
+ deleted++;
1332
+ return false;
1333
+ });
1336
1334
  this._stream_versions.delete(stream);
1337
1335
  this._max_event_id_by_stream.delete(stream);
1338
1336
  this._pii.delete(stream);
1339
- }
1340
- for (const { stream, snapshot, meta } of full) {
1341
1337
  const event = {
1342
1338
  id: this._next_id++,
1343
1339
  stream,
@@ -1352,10 +1348,7 @@ var InMemoryStore = class {
1352
1348
  if (event.name !== SNAP_EVENT) {
1353
1349
  this._max_event_id_by_stream.set(stream, event.id);
1354
1350
  }
1355
- result.set(stream, {
1356
- deleted: deleted_counts.get(stream) ?? 0,
1357
- committed: event
1358
- });
1351
+ result.set(stream, { deleted, committed: event });
1359
1352
  }
1360
1353
  let max = -1;
1361
1354
  for (const id of this._max_event_id_by_stream.values())