@rotorsoft/act 0.33.2 → 0.33.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.
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  TargetSchema,
14
14
  ValidationError,
15
15
  ZodEmpty
16
- } from "./chunk-AWT7TU22.js";
16
+ } from "./chunk-AGWZY6YT.js";
17
17
 
18
18
  // src/adapters/console-logger.ts
19
19
  var LEVEL_VALUES = {
@@ -1091,8 +1091,8 @@ var CorrelateCycle = class {
1091
1091
  }
1092
1092
  /**
1093
1093
  * Start a periodic correlation worker. Returns false if one is already
1094
- * running. Errors from `correlate()` are sent to `console.error` (matches
1095
- * pre-extraction behavior; the timer keeps running on failure).
1094
+ * running. Errors from `correlate()` are routed through `log()` so they
1095
+ * land in the configured logger (the timer keeps running on failure).
1096
1096
  */
1097
1097
  startPolling(query = {}, frequency = 1e4, callback) {
1098
1098
  if (this._timer) return false;
@@ -1100,7 +1100,7 @@ var CorrelateCycle = class {
1100
1100
  this._timer = setInterval(
1101
1101
  () => this.correlate({ ...query, after: this._checkpoint, limit }).then((result) => {
1102
1102
  if (callback && result.subscribed) callback(result.subscribed);
1103
- }).catch(console.error),
1103
+ }).catch((err) => log().error(err)),
1104
1104
  frequency
1105
1105
  );
1106
1106
  return true;
@@ -1629,7 +1629,7 @@ async function load(me, stream, callback, asOf) {
1629
1629
  async function action(me, action2, target, payload, reactingTo, skipValidation = false) {
1630
1630
  const { stream, expectedVersion, actor } = target;
1631
1631
  if (!stream) throw new Error("Missing target stream");
1632
- payload = skipValidation ? payload : validate(action2, payload, me.actions[action2]);
1632
+ const validated = skipValidation ? payload : validate(action2, payload, me.actions[action2]);
1633
1633
  const snapshot = await load(me, stream);
1634
1634
  if (snapshot.event?.name === TOMBSTONE_EVENT)
1635
1635
  throw new StreamClosedError(stream);
@@ -1640,14 +1640,14 @@ async function action(me, action2, target, payload, reactingTo, skipValidation =
1640
1640
  if (!valid(snapshot.state, actor))
1641
1641
  throw new InvariantError(
1642
1642
  action2,
1643
- payload,
1643
+ validated,
1644
1644
  target,
1645
1645
  snapshot,
1646
1646
  description
1647
1647
  );
1648
1648
  });
1649
1649
  }
1650
- const result = me.on[action2](payload, snapshot, target);
1650
+ const result = me.on[action2](validated, snapshot, target);
1651
1651
  if (!result) return [snapshot];
1652
1652
  if (Array.isArray(result) && result.length === 0) {
1653
1653
  return [snapshot];