@rotorsoft/act 2.1.1 → 2.1.3

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.
Files changed (41) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/@types/act.d.ts.map +1 -1
  3. package/dist/@types/csv.d.ts +2 -1
  4. package/dist/@types/csv.d.ts.map +1 -1
  5. package/dist/@types/internal/correlate-cycle.d.ts.map +1 -1
  6. package/dist/@types/internal/event-sourcing.d.ts.map +1 -1
  7. package/dist/@types/scoped.d.ts +2 -4
  8. package/dist/@types/scoped.d.ts.map +1 -1
  9. package/dist/@types/types/action.d.ts +1 -213
  10. package/dist/@types/types/action.d.ts.map +1 -1
  11. package/dist/@types/types/index.d.ts +1 -0
  12. package/dist/@types/types/index.d.ts.map +1 -1
  13. package/dist/@types/types/ports.d.ts +2 -1
  14. package/dist/@types/types/ports.d.ts.map +1 -1
  15. package/dist/@types/types/restore.d.ts +222 -0
  16. package/dist/@types/types/restore.d.ts.map +1 -0
  17. package/dist/adapter.cjs +3 -3
  18. package/dist/adapter.js +2 -2
  19. package/dist/{chunk-QPVUARKL.js → chunk-ADMH76IO.js} +3 -3
  20. package/dist/{chunk-QPVUARKL.js.map → chunk-ADMH76IO.js.map} +1 -1
  21. package/dist/{chunk-W3PHEA5Q.js → chunk-C35J3SNT.js} +1 -1
  22. package/dist/chunk-C35J3SNT.js.map +1 -0
  23. package/dist/{chunk-PZQXTGWF.cjs → chunk-D7LQNOEV.cjs} +4 -4
  24. package/dist/{chunk-PZQXTGWF.cjs.map → chunk-D7LQNOEV.cjs.map} +1 -1
  25. package/dist/{chunk-7VYSJIXD.cjs → chunk-QFYPSI6P.cjs} +1 -1
  26. package/dist/chunk-QFYPSI6P.cjs.map +1 -0
  27. package/dist/{chunk-LN3OP4OL.cjs → chunk-QWYMR7ZP.cjs} +17 -17
  28. package/dist/{chunk-LN3OP4OL.cjs.map → chunk-QWYMR7ZP.cjs.map} +1 -1
  29. package/dist/{chunk-UXDNSZAD.js → chunk-TUALNYW2.js} +2 -2
  30. package/dist/index.cjs +195 -196
  31. package/dist/index.cjs.map +1 -1
  32. package/dist/index.js +13 -14
  33. package/dist/index.js.map +1 -1
  34. package/dist/test/index.cjs +5 -5
  35. package/dist/test/index.js +3 -3
  36. package/dist/types/index.cjs +2 -2
  37. package/dist/types/index.js +1 -1
  38. package/package.json +1 -1
  39. package/dist/chunk-7VYSJIXD.cjs.map +0 -1
  40. package/dist/chunk-W3PHEA5Q.js.map +0 -1
  41. /package/dist/{chunk-UXDNSZAD.js.map → chunk-TUALNYW2.js.map} +0 -0
package/dist/index.js CHANGED
@@ -39,7 +39,7 @@ import {
39
39
  store,
40
40
  unscoped_ports,
41
41
  validate
42
- } from "./chunk-QPVUARKL.js";
42
+ } from "./chunk-ADMH76IO.js";
43
43
  import {
44
44
  checkAppends,
45
45
  checkVersion,
@@ -48,7 +48,7 @@ import {
48
48
  isStreamName,
49
49
  parseNotification,
50
50
  seedEvent
51
- } from "./chunk-UXDNSZAD.js";
51
+ } from "./chunk-TUALNYW2.js";
52
52
  import {
53
53
  ActorSchema,
54
54
  CausationEventSchema,
@@ -83,7 +83,7 @@ import {
83
83
  pii_schemas,
84
84
  sensitive,
85
85
  sensitiveFields
86
- } from "./chunk-W3PHEA5Q.js";
86
+ } from "./chunk-C35J3SNT.js";
87
87
 
88
88
  // src/signals.ts
89
89
  process.once("SIGINT", async (arg) => {
@@ -1263,6 +1263,7 @@ async function scan(source, opts = {}, callback) {
1263
1263
  let migrated_count = 0;
1264
1264
  let processed = 0;
1265
1265
  let at;
1266
+ const started = /* @__PURE__ */ new Set();
1266
1267
  const closed_streams = /* @__PURE__ */ new Set();
1267
1268
  if (drop_closed_streams) {
1268
1269
  await source.query(
@@ -1291,7 +1292,9 @@ async function scan(source, opts = {}, callback) {
1291
1292
  if (!is_valid(event))
1292
1293
  throw new Error(`Invalid event at index ${processed}`);
1293
1294
  if (on_progress) on_progress({ processed, id: event.id, max_id });
1294
- if (drop_snapshots && event.name === SNAP_EVENT) {
1295
+ const has_history = started.has(event.stream);
1296
+ started.add(event.stream);
1297
+ if (drop_snapshots && event.name === SNAP_EVENT && has_history) {
1295
1298
  dropped_snaps++;
1296
1299
  return;
1297
1300
  }
@@ -2727,8 +2730,8 @@ function report_undeclared_lane(seen, handler, target, lane, declared) {
2727
2730
  function report_bad_priority(seen, handler, target, priority) {
2728
2731
  report_once(
2729
2732
  seen,
2730
- `priority|${handler}|${String(priority)}`,
2731
- `Reaction "${handler}" resolved priority ${String(priority)} for target "${target}", which isn't a 32-bit integer. Skipping that event for this reaction; other reactions keep running. The equivalent static \`.to({ priority })\` is rejected at build; a dynamic resolver's priority is only knowable here.`
2733
+ `priority|${handler}`,
2734
+ `Reaction "${handler}" resolved priority ${String(priority)} for target "${target}", which isn't a 32-bit integer. Running it at priority 0 instead. The equivalent static \`.to({ priority })\` is rejected at build; a dynamic resolver's priority is only knowable here.`
2732
2735
  );
2733
2736
  }
2734
2737
  function report_lane_conflict(seen, handler, target, kept, dropped) {
@@ -2905,7 +2908,7 @@ var CorrelateCycle = class {
2905
2908
  resolved.target,
2906
2909
  resolved.priority
2907
2910
  );
2908
- continue;
2911
+ resolved = { ...resolved, priority: 0 };
2909
2912
  }
2910
2913
  let lane = resolved.lane;
2911
2914
  if (lane !== void 0 && !this._declared_lanes.has(lane)) {
@@ -3802,13 +3805,9 @@ var Act = class {
3802
3805
  * @see {@link query} for large result sets
3803
3806
  */
3804
3807
  async query_array(query) {
3805
- return this._scoped(async () => {
3806
- const events = [];
3807
- await store().query((e) => {
3808
- events.push(this.registry.query_gate(e.name)(e));
3809
- }, query);
3810
- return events;
3811
- });
3808
+ const events = [];
3809
+ await this.query(query, (e) => events.push(e));
3810
+ return events;
3812
3811
  }
3813
3812
  /**
3814
3813
  * Wipe the sensitive-data payload for every event on the stream — see