jssm 5.162.21 → 5.162.23

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.
@@ -24226,7 +24226,7 @@ function fslSemanticSpans(text) {
24226
24226
  * Useful for runtime diagnostics and for embedding in serialized machine
24227
24227
  * snapshots so that deserializers can detect version-skew.
24228
24228
  */
24229
- const version = "5.162.21";
24229
+ const version = "5.162.23";
24230
24230
 
24231
24231
  /**
24232
24232
  * The FSL Markdown fence convention parser — pure, host-agnostic logic that
@@ -28146,13 +28146,27 @@ class Machine {
28146
28146
  }
28147
28147
  }
28148
28148
  // all hooks passed! let's now establish the result
28149
+ // a hook may have redirected the destination via a complex result's
28150
+ // `state` (carried on hook_args.to). Apply it now, validating it names
28151
+ // a real state. Pre-transition hooks (including entry/exit) fired for
28152
+ // the original edge; the committed state and the post-hooks, observation
28153
+ // events, and after-timer all reflect the override. Last writer wins.
28154
+ // StoneCypher/fsl#1947
28155
+ if (hook_args.to !== newState) {
28156
+ const override_id = this._state_interner.id_of(hook_args.to);
28157
+ if (override_id === undefined) {
28158
+ throw new JssmError(this, `A hook overrode the transition destination to '${hook_args.to}', which is not a state in this machine`);
28159
+ }
28160
+ newState = hook_args.to;
28161
+ newStateId = override_id;
28162
+ }
28149
28163
  if (this._history_length) {
28150
28164
  this._history.shove([this._state, this._data]);
28151
28165
  }
28152
28166
  this._state = newState;
28153
28167
  this._state_id = newStateId;
28154
28168
  if (data_changed) {
28155
- this._data = hook_args.data;
28169
+ this._data = hook_args.next_data;
28156
28170
  }
28157
28171
  else if (dataProvided) {
28158
28172
  this._data = newData;
@@ -29732,18 +29746,36 @@ function is_hook_complex_result(hr) {
29732
29746
  function _update_hook_fields(hook_args, res) {
29733
29747
  // HOOK_PASSED is the shared frozen outcome for "no hook installed" and for
29734
29748
  // hooks returning true/undefined — the overwhelming majority of the up-to-
29735
- // ~10 steps per hooked transition. It can never carry `data` (frozen, built
29736
- // without one), so one pointer compare replaces the hasOwnProperty
29749
+ // ~10 steps per hooked transition. It can never carry `data`/`state` (frozen,
29750
+ // built without them), so one pointer compare replaces the hasOwnProperty
29737
29751
  // reflection call for the common case.
29738
29752
  if (res === HOOK_PASSED) {
29739
29753
  return false;
29740
29754
  }
29755
+ // a complex result's `state` redirects the transition's destination; carry it
29756
+ // on hook_args.to (the destination field), which transition_impl applies at
29757
+ // commit (last writer wins). An explicit `state: undefined` is not a
29758
+ // redirect. StoneCypher/fsl#1947
29759
+ if (Object.prototype.hasOwnProperty.call(res, 'state') && res.state !== undefined) {
29760
+ hook_args.to = res.state;
29761
+ }
29762
+ // Two channels (StoneCypher/fsl#1948): `data` overrides the value observed by
29763
+ // later hooks in this chain AND is the default committed value; `next_data`
29764
+ // overrides only the committed value. So `data` sets both, then an explicit
29765
+ // `next_data` overrides the commit channel. transition_impl commits
29766
+ // hook_args.next_data. hasOwnProperty (not truthiness) so a falsy override
29767
+ // (false/null/0/''/undefined) still commits (fsl#1264/#935).
29768
+ let changed = false;
29741
29769
  if (Object.prototype.hasOwnProperty.call(res, 'data')) {
29742
29770
  hook_args.data = res.data;
29771
+ hook_args.next_data = res.data;
29772
+ changed = true;
29773
+ }
29774
+ if (Object.prototype.hasOwnProperty.call(res, 'next_data')) {
29743
29775
  hook_args.next_data = res.next_data;
29744
- return true;
29776
+ changed = true;
29745
29777
  }
29746
- return false;
29778
+ return changed;
29747
29779
  }
29748
29780
  /**
29749
29781
  *