@rotorsoft/act 1.32.20 → 1.32.22
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/act.d.ts +1 -2
- package/dist/@types/act.d.ts.map +1 -1
- package/dist/@types/adapters/in-memory-store.d.ts +2 -6
- package/dist/@types/adapters/in-memory-store.d.ts.map +1 -1
- package/dist/@types/builders/act-builder.d.ts.map +1 -1
- package/dist/@types/internal/audit.d.ts +1 -4
- package/dist/@types/internal/audit.d.ts.map +1 -1
- package/dist/@types/internal/config.d.ts +3 -9
- package/dist/@types/internal/config.d.ts.map +1 -1
- package/dist/@types/internal/correlate-cycle.d.ts +12 -11
- package/dist/@types/internal/correlate-cycle.d.ts.map +1 -1
- package/dist/@types/internal/defer-timer.d.ts +15 -10
- package/dist/@types/internal/defer-timer.d.ts.map +1 -1
- package/dist/@types/internal/drain-cycle.d.ts +6 -5
- package/dist/@types/internal/drain-cycle.d.ts.map +1 -1
- package/dist/@types/internal/index.d.ts +1 -1
- package/dist/@types/internal/index.d.ts.map +1 -1
- package/dist/@types/types/ports.d.ts +10 -10
- package/dist/@types/types/ports.d.ts.map +1 -1
- package/dist/@types/utils.d.ts +3 -2
- package/dist/@types/utils.d.ts.map +1 -1
- package/dist/{chunk-QOSQI3CA.js → chunk-T3CWXVGT.js} +14 -55
- package/dist/chunk-T3CWXVGT.js.map +1 -0
- package/dist/index.cjs +106 -113
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +94 -60
- package/dist/index.js.map +1 -1
- package/dist/test/index.cjs +13 -54
- package/dist/test/index.cjs.map +1 -1
- package/dist/test/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-QOSQI3CA.js.map +0 -1
package/dist/test/index.cjs
CHANGED
|
@@ -478,8 +478,7 @@ var InMemoryStream = class {
|
|
|
478
478
|
// in-process backoff, this is durable store state shared across workers.
|
|
479
479
|
_deferred_at = void 0;
|
|
480
480
|
// Work mark: highest event id observed to resolve to this target.
|
|
481
|
-
// `undefined` means
|
|
482
|
-
// back to the legacy has-work probe rather than treating it as "no work".
|
|
481
|
+
// `undefined` means the row was never correlated, so `claim` skips it.
|
|
483
482
|
_correlated_at = void 0;
|
|
484
483
|
constructor(stream, source, priority = 0, lane = DEFAULT_LANE) {
|
|
485
484
|
this.stream = stream;
|
|
@@ -682,12 +681,6 @@ var InMemoryStore = class {
|
|
|
682
681
|
_correlators = /* @__PURE__ */ new Map();
|
|
683
682
|
// last committed version per stream — O(1) replacement for filter-on-commit
|
|
684
683
|
_stream_versions = /* @__PURE__ */ new Map();
|
|
685
|
-
// max non-snapshot event id per stream — drives the has-work probe in
|
|
686
|
-
// claim(): an O(1) lookup for a literal source, and the per-stream max
|
|
687
|
-
// that a pattern source scans, without touching the full event log.
|
|
688
|
-
_max_event_id_by_stream = /* @__PURE__ */ new Map();
|
|
689
|
-
// global max non-snapshot event id — fast pre-check for source-less streams in claim()
|
|
690
|
-
_max_non_snap_event_id = -1;
|
|
691
684
|
// stream → (event_id → cloned sensitive payload). Two-level so `forget_pii`
|
|
692
685
|
// is O(1) — drop the inner Map for the stream and the wipe is done — mirroring
|
|
693
686
|
// the `DELETE WHERE stream = ?` scope that durable adapters get from their
|
|
@@ -699,10 +692,17 @@ var InMemoryStore = class {
|
|
|
699
692
|
this._next_id = 0;
|
|
700
693
|
this._correlated_at = -1;
|
|
701
694
|
this._stream_versions.clear();
|
|
702
|
-
this._max_event_id_by_stream.clear();
|
|
703
|
-
this._max_non_snap_event_id = -1;
|
|
704
695
|
this._pii.clear();
|
|
705
696
|
}
|
|
697
|
+
// Stores a cloned copy, so caller-side mutation can't reach it.
|
|
698
|
+
_put_pii(stream, id, pii) {
|
|
699
|
+
let per_stream = this._pii.get(stream);
|
|
700
|
+
if (!per_stream) {
|
|
701
|
+
per_stream = /* @__PURE__ */ new Map();
|
|
702
|
+
this._pii.set(stream, per_stream);
|
|
703
|
+
}
|
|
704
|
+
per_stream.set(id, structuredClone(pii));
|
|
705
|
+
}
|
|
706
706
|
// First index whose event id is greater than `after`. `_events` stays
|
|
707
707
|
// sorted ascending by id (append-only commits; deletions preserve
|
|
708
708
|
// order), so id-bounded scans binary-search their start instead of
|
|
@@ -822,7 +822,6 @@ var InMemoryStore = class {
|
|
|
822
822
|
);
|
|
823
823
|
}
|
|
824
824
|
let version = current_version + 1;
|
|
825
|
-
let last_non_snap_id = -1;
|
|
826
825
|
const committed = msgs.map(({ name, data, pii }) => {
|
|
827
826
|
const c = {
|
|
828
827
|
id: this._next_id++,
|
|
@@ -834,23 +833,11 @@ var InMemoryStore = class {
|
|
|
834
833
|
meta
|
|
835
834
|
};
|
|
836
835
|
this._events.push(c);
|
|
837
|
-
if (pii != null)
|
|
838
|
-
let per_stream = this._pii.get(stream);
|
|
839
|
-
if (!per_stream) {
|
|
840
|
-
per_stream = /* @__PURE__ */ new Map();
|
|
841
|
-
this._pii.set(stream, per_stream);
|
|
842
|
-
}
|
|
843
|
-
per_stream.set(c.id, structuredClone(pii));
|
|
844
|
-
}
|
|
845
|
-
if (name !== SNAP_EVENT) last_non_snap_id = c.id;
|
|
836
|
+
if (pii != null) this._put_pii(stream, c.id, pii);
|
|
846
837
|
version++;
|
|
847
838
|
return this._with_pii(c);
|
|
848
839
|
});
|
|
849
840
|
this._stream_versions.set(stream, version - 1);
|
|
850
|
-
if (last_non_snap_id >= 0) {
|
|
851
|
-
this._max_event_id_by_stream.set(stream, last_non_snap_id);
|
|
852
|
-
this._max_non_snap_event_id = last_non_snap_id;
|
|
853
|
-
}
|
|
854
841
|
return committed;
|
|
855
842
|
}
|
|
856
843
|
/**
|
|
@@ -1200,10 +1187,7 @@ var InMemoryStore = class {
|
|
|
1200
1187
|
* Scope rules:
|
|
1201
1188
|
* - Array `input` — explicit stream names, regardless of subscription.
|
|
1202
1189
|
* - Filter `input` — `stream`/`stream_exact` match against event-bearing
|
|
1203
|
-
* stream names
|
|
1204
|
-
* corresponding subscription in `_streams` (those are subscription
|
|
1205
|
-
* concepts, not event concepts). Empty filter `{}` matches every
|
|
1206
|
-
* event-bearing stream.
|
|
1190
|
+
* stream names. Empty filter `{}` matches every event-bearing stream.
|
|
1207
1191
|
*/
|
|
1208
1192
|
async query_stats(input, options) {
|
|
1209
1193
|
await sleep();
|
|
@@ -1309,7 +1293,6 @@ var InMemoryStore = class {
|
|
|
1309
1293
|
return false;
|
|
1310
1294
|
});
|
|
1311
1295
|
this._stream_versions.delete(stream);
|
|
1312
|
-
this._max_event_id_by_stream.delete(stream);
|
|
1313
1296
|
this._pii.delete(stream);
|
|
1314
1297
|
const event = {
|
|
1315
1298
|
id: this._next_id++,
|
|
@@ -1322,15 +1305,8 @@ var InMemoryStore = class {
|
|
|
1322
1305
|
};
|
|
1323
1306
|
this._events.push(event);
|
|
1324
1307
|
this._stream_versions.set(stream, 0);
|
|
1325
|
-
if (event.name !== SNAP_EVENT) {
|
|
1326
|
-
this._max_event_id_by_stream.set(stream, event.id);
|
|
1327
|
-
}
|
|
1328
1308
|
result.set(stream, { deleted, committed: event });
|
|
1329
1309
|
}
|
|
1330
|
-
let max = -1;
|
|
1331
|
-
for (const id of this._max_event_id_by_stream.values())
|
|
1332
|
-
if (id > max) max = id;
|
|
1333
|
-
this._max_non_snap_event_id = max;
|
|
1334
1310
|
return result;
|
|
1335
1311
|
}
|
|
1336
1312
|
/**
|
|
@@ -1351,8 +1327,6 @@ var InMemoryStore = class {
|
|
|
1351
1327
|
const prev_next_id = this._next_id;
|
|
1352
1328
|
const prev_streams = this._streams;
|
|
1353
1329
|
const prev_stream_versions = this._stream_versions;
|
|
1354
|
-
const prev_max_event_id_by_stream = this._max_event_id_by_stream;
|
|
1355
|
-
const prev_max_non_snap_event_id = this._max_non_snap_event_id;
|
|
1356
1330
|
const prev_pii = this._pii;
|
|
1357
1331
|
const prev_correlated_at = this._correlated_at;
|
|
1358
1332
|
const prev_correlators = new Map(
|
|
@@ -1364,8 +1338,6 @@ var InMemoryStore = class {
|
|
|
1364
1338
|
this._next_id = 0;
|
|
1365
1339
|
this._streams = /* @__PURE__ */ new Map();
|
|
1366
1340
|
this._stream_versions = /* @__PURE__ */ new Map();
|
|
1367
|
-
this._max_event_id_by_stream = /* @__PURE__ */ new Map();
|
|
1368
|
-
this._max_non_snap_event_id = -1;
|
|
1369
1341
|
this._pii = /* @__PURE__ */ new Map();
|
|
1370
1342
|
try {
|
|
1371
1343
|
await driver(async (event) => {
|
|
@@ -1373,19 +1345,8 @@ var InMemoryStore = class {
|
|
|
1373
1345
|
const { pii, ...rest } = event;
|
|
1374
1346
|
const committed = { ...rest, id };
|
|
1375
1347
|
this._events.push(committed);
|
|
1376
|
-
if (pii != null)
|
|
1377
|
-
let per_stream = this._pii.get(event.stream);
|
|
1378
|
-
if (!per_stream) {
|
|
1379
|
-
per_stream = /* @__PURE__ */ new Map();
|
|
1380
|
-
this._pii.set(event.stream, per_stream);
|
|
1381
|
-
}
|
|
1382
|
-
per_stream.set(id, structuredClone(pii));
|
|
1383
|
-
}
|
|
1348
|
+
if (pii != null) this._put_pii(event.stream, id, pii);
|
|
1384
1349
|
this._stream_versions.set(event.stream, event.version);
|
|
1385
|
-
if (event.name !== SNAP_EVENT) {
|
|
1386
|
-
this._max_event_id_by_stream.set(event.stream, id);
|
|
1387
|
-
this._max_non_snap_event_id = id;
|
|
1388
|
-
}
|
|
1389
1350
|
return id;
|
|
1390
1351
|
});
|
|
1391
1352
|
} catch (err) {
|
|
@@ -1393,8 +1354,6 @@ var InMemoryStore = class {
|
|
|
1393
1354
|
this._next_id = prev_next_id;
|
|
1394
1355
|
this._streams = prev_streams;
|
|
1395
1356
|
this._stream_versions = prev_stream_versions;
|
|
1396
|
-
this._max_event_id_by_stream = prev_max_event_id_by_stream;
|
|
1397
|
-
this._max_non_snap_event_id = prev_max_non_snap_event_id;
|
|
1398
1357
|
this._pii = prev_pii;
|
|
1399
1358
|
this._correlated_at = prev_correlated_at;
|
|
1400
1359
|
this._correlators = prev_correlators;
|