jssm 5.143.5 → 5.143.7

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/README.md CHANGED
@@ -18,10 +18,10 @@ Please edit the file it's derived from, instead: `./src/md/readme_base.md`
18
18
 
19
19
 
20
20
 
21
- * Generated for version 5.143.5 at 6/11/2026, 7:42:31 PM
21
+ * Generated for version 5.143.7 at 6/11/2026, 8:01:49 PM
22
22
 
23
23
  -->
24
- # jssm 5.143.5
24
+ # jssm 5.143.7
25
25
 
26
26
  [**Try the live editor**](https://stonecypher.github.io/jssm-viz-demo/graph_explorer.html) ·
27
27
  [Documentation](https://stonecypher.github.io/jssm/docs/) ·
@@ -418,7 +418,7 @@ If your contribution is missing here, please open an issue.
418
418
 
419
419
  - 6,201 specs with 100.0% coverage
420
420
  - 526 fuzz tests with 3.3% coverage
421
- - 5,780 TypeScript lines - 1.2 tests per line, 10.2 generated tests per line
421
+ - 5,781 TypeScript lines - 1.2 tests per line, 10.2 generated tests per line
422
422
 
423
423
  [![Actions Status](https://github.com/StoneCypher/jssm/workflows/Node%20CI/badge.svg)](https://github.com/StoneCypher/jssm/actions)
424
424
  [![NPM version](https://img.shields.io/npm/v/jssm.svg)](https://www.npmjs.com/package/jssm)
@@ -22675,7 +22675,7 @@ var constants = /*#__PURE__*/Object.freeze({
22675
22675
  * Useful for runtime diagnostics and for embedding in serialized machine
22676
22676
  * snapshots so that deserializers can detect version-skew.
22677
22677
  */
22678
- const version = "5.143.5";
22678
+ const version = "5.143.7";
22679
22679
 
22680
22680
  // whargarbl lots of these return arrays could/should be sets
22681
22681
  const { state_name_chars, state_name_first_chars, action_label_chars } = constants;
@@ -23047,8 +23047,11 @@ class Machine {
23047
23047
  // membership so the dedup check is O(1) per edge rather than an O(out-degree)
23048
23048
  // array scan (which made construction O(V*E) on dense graphs). #673
23049
23049
  const seen_edges = new Map();
23050
- // walk the transitions
23051
- transitions.map((tr) => {
23050
+ // walk the transitions. single-lookup cursor fetches: each endpoint was
23051
+ // previously a get followed by a has on the same key (four hashes per
23052
+ // edge); the undefined check on the get's result carries the same
23053
+ // information. #706
23054
+ for (const tr of transitions) {
23052
23055
  if (tr.from === undefined) {
23053
23056
  throw new JssmError(this, `transition must define 'from': ${JSON.stringify(tr)}`);
23054
23057
  }
@@ -23056,14 +23059,14 @@ class Machine {
23056
23059
  throw new JssmError(this, `transition must define 'to': ${JSON.stringify(tr)}`);
23057
23060
  }
23058
23061
  // get the cursors. what a mess
23059
- const cursor_from = this._states.get(tr.from)
23060
- || { name: tr.from, from: [], to: [], complete: complete.includes(tr.from) };
23061
- if (!(this._states.has(tr.from))) {
23062
+ let cursor_from = this._states.get(tr.from);
23063
+ if (cursor_from === undefined) {
23064
+ cursor_from = { name: tr.from, from: [], to: [], complete: complete.includes(tr.from) };
23062
23065
  this._new_state(cursor_from);
23063
23066
  }
23064
- const cursor_to = this._states.get(tr.to)
23065
- || { name: tr.to, from: [], to: [], complete: complete.includes(tr.to) };
23066
- if (!(this._states.has(tr.to))) {
23067
+ let cursor_to = this._states.get(tr.to);
23068
+ if (cursor_to === undefined) {
23069
+ cursor_to = { name: tr.to, from: [], to: [], complete: complete.includes(tr.to) };
23067
23070
  this._new_state(cursor_to);
23068
23071
  }
23069
23072
  // guard against existing connections being re-added — O(1) via the
@@ -23103,8 +23106,9 @@ class Machine {
23103
23106
  this._after_mapping.set(tr.from, [tr.to, tr.after_time]);
23104
23107
  }
23105
23108
  // set up the mapping, so that edges can be looked up by endpoint pairs
23106
- const from_mapping = this._edge_map.get(tr.from) || new Map();
23107
- if (!(this._edge_map.has(tr.from))) {
23109
+ let from_mapping = this._edge_map.get(tr.from);
23110
+ if (from_mapping === undefined) {
23111
+ from_mapping = new Map();
23108
23112
  this._edge_map.set(tr.from, from_mapping);
23109
23113
  }
23110
23114
  // const to_mapping = from_mapping.get(tr.to);
@@ -23161,7 +23165,7 @@ class Machine {
23161
23165
  }
23162
23166
  */
23163
23167
  }
23164
- });
23168
+ }
23165
23169
  if (Array.isArray(property_definition)) {
23166
23170
  property_definition.forEach(pr => {
23167
23171
  this._property_keys.add(pr.name);
@@ -26613,6 +26617,26 @@ function _update_hook_fields(hook_args, res) {
26613
26617
  }
26614
26618
  return false;
26615
26619
  }
26620
+ /**
26621
+ *
26622
+ * Shared, frozen outcomes for the simple hook results. The transition
26623
+ * cascade runs up to ~10 hook steps per transition, and the overwhelmingly
26624
+ * common results — no hook installed, or a hook returning `undefined` /
26625
+ * `true` / `false` — previously allocated a fresh one-field object each
26626
+ * time, just to have `.pass` read once and be discarded. Callers only read
26627
+ * `pass` and probe for an own `data` property ({@link _update_hook_fields}),
26628
+ * so a shared instance is observationally identical; freezing turns that
26629
+ * read-only contract from incidental into enforced. Complex results (hooks
26630
+ * returning `{ pass, data, ... }`) still pass through untouched. #705
26631
+ *
26632
+ * @see abstract_hook_step
26633
+ * @see abstract_everything_hook_step
26634
+ *
26635
+ * @internal
26636
+ *
26637
+ */
26638
+ const HOOK_PASSED = Object.freeze({ pass: true }); // eslint-disable-line @typescript-eslint/no-explicit-any
26639
+ const HOOK_REJECTED = Object.freeze({ pass: false }); // eslint-disable-line @typescript-eslint/no-explicit-any
26616
26640
  /**
26617
26641
  *
26618
26642
  * Invoke an optional transition/action hook and normalize its return value
@@ -26654,16 +26678,16 @@ function abstract_hook_step(maybe_hook, hook_args) {
26654
26678
  if (maybe_hook !== undefined) {
26655
26679
  const result = maybe_hook(hook_args);
26656
26680
  if (result === undefined) {
26657
- return { pass: true };
26681
+ return HOOK_PASSED;
26658
26682
  }
26659
26683
  if (result === true) {
26660
- return { pass: true };
26684
+ return HOOK_PASSED;
26661
26685
  }
26662
26686
  if (result === false) {
26663
- return { pass: false };
26687
+ return HOOK_REJECTED;
26664
26688
  }
26665
26689
  if (result === null) {
26666
- return { pass: false };
26690
+ return HOOK_REJECTED;
26667
26691
  }
26668
26692
  if (is_hook_complex_result(result)) {
26669
26693
  return result;
@@ -26671,7 +26695,7 @@ function abstract_hook_step(maybe_hook, hook_args) {
26671
26695
  throw new TypeError(`Unknown hook result type ${result}`);
26672
26696
  }
26673
26697
  else {
26674
- return { pass: true };
26698
+ return HOOK_PASSED;
26675
26699
  }
26676
26700
  }
26677
26701
  /**
@@ -26712,16 +26736,16 @@ function abstract_everything_hook_step(maybe_hook, hook_args) {
26712
26736
  if (maybe_hook !== undefined) {
26713
26737
  const result = maybe_hook(hook_args);
26714
26738
  if (result === undefined) {
26715
- return { pass: true };
26739
+ return HOOK_PASSED;
26716
26740
  }
26717
26741
  if (result === true) {
26718
- return { pass: true };
26742
+ return HOOK_PASSED;
26719
26743
  }
26720
26744
  if (result === false) {
26721
- return { pass: false };
26745
+ return HOOK_REJECTED;
26722
26746
  }
26723
26747
  if (result === null) {
26724
- return { pass: false };
26748
+ return HOOK_REJECTED;
26725
26749
  }
26726
26750
  if (is_hook_complex_result(result)) {
26727
26751
  return result;
@@ -26729,7 +26753,7 @@ function abstract_everything_hook_step(maybe_hook, hook_args) {
26729
26753
  throw new TypeError(`Unknown hook result type ${result}`);
26730
26754
  }
26731
26755
  else {
26732
- return { pass: true };
26756
+ return HOOK_PASSED;
26733
26757
  }
26734
26758
  }
26735
26759
 
package/dist/cdn/viz.js CHANGED
@@ -22700,7 +22700,7 @@ var constants = /*#__PURE__*/Object.freeze({
22700
22700
  * Useful for runtime diagnostics and for embedding in serialized machine
22701
22701
  * snapshots so that deserializers can detect version-skew.
22702
22702
  */
22703
- const version = "5.143.5";
22703
+ const version = "5.143.7";
22704
22704
 
22705
22705
  // whargarbl lots of these return arrays could/should be sets
22706
22706
  const { state_name_chars, state_name_first_chars, action_label_chars } = constants;
@@ -23072,8 +23072,11 @@ class Machine {
23072
23072
  // membership so the dedup check is O(1) per edge rather than an O(out-degree)
23073
23073
  // array scan (which made construction O(V*E) on dense graphs). #673
23074
23074
  const seen_edges = new Map();
23075
- // walk the transitions
23076
- transitions.map((tr) => {
23075
+ // walk the transitions. single-lookup cursor fetches: each endpoint was
23076
+ // previously a get followed by a has on the same key (four hashes per
23077
+ // edge); the undefined check on the get's result carries the same
23078
+ // information. #706
23079
+ for (const tr of transitions) {
23077
23080
  if (tr.from === undefined) {
23078
23081
  throw new JssmError(this, `transition must define 'from': ${JSON.stringify(tr)}`);
23079
23082
  }
@@ -23081,14 +23084,14 @@ class Machine {
23081
23084
  throw new JssmError(this, `transition must define 'to': ${JSON.stringify(tr)}`);
23082
23085
  }
23083
23086
  // get the cursors. what a mess
23084
- const cursor_from = this._states.get(tr.from)
23085
- || { name: tr.from, from: [], to: [], complete: complete.includes(tr.from) };
23086
- if (!(this._states.has(tr.from))) {
23087
+ let cursor_from = this._states.get(tr.from);
23088
+ if (cursor_from === undefined) {
23089
+ cursor_from = { name: tr.from, from: [], to: [], complete: complete.includes(tr.from) };
23087
23090
  this._new_state(cursor_from);
23088
23091
  }
23089
- const cursor_to = this._states.get(tr.to)
23090
- || { name: tr.to, from: [], to: [], complete: complete.includes(tr.to) };
23091
- if (!(this._states.has(tr.to))) {
23092
+ let cursor_to = this._states.get(tr.to);
23093
+ if (cursor_to === undefined) {
23094
+ cursor_to = { name: tr.to, from: [], to: [], complete: complete.includes(tr.to) };
23092
23095
  this._new_state(cursor_to);
23093
23096
  }
23094
23097
  // guard against existing connections being re-added — O(1) via the
@@ -23128,8 +23131,9 @@ class Machine {
23128
23131
  this._after_mapping.set(tr.from, [tr.to, tr.after_time]);
23129
23132
  }
23130
23133
  // set up the mapping, so that edges can be looked up by endpoint pairs
23131
- const from_mapping = this._edge_map.get(tr.from) || new Map();
23132
- if (!(this._edge_map.has(tr.from))) {
23134
+ let from_mapping = this._edge_map.get(tr.from);
23135
+ if (from_mapping === undefined) {
23136
+ from_mapping = new Map();
23133
23137
  this._edge_map.set(tr.from, from_mapping);
23134
23138
  }
23135
23139
  // const to_mapping = from_mapping.get(tr.to);
@@ -23186,7 +23190,7 @@ class Machine {
23186
23190
  }
23187
23191
  */
23188
23192
  }
23189
- });
23193
+ }
23190
23194
  if (Array.isArray(property_definition)) {
23191
23195
  property_definition.forEach(pr => {
23192
23196
  this._property_keys.add(pr.name);
@@ -26638,6 +26642,26 @@ function _update_hook_fields(hook_args, res) {
26638
26642
  }
26639
26643
  return false;
26640
26644
  }
26645
+ /**
26646
+ *
26647
+ * Shared, frozen outcomes for the simple hook results. The transition
26648
+ * cascade runs up to ~10 hook steps per transition, and the overwhelmingly
26649
+ * common results — no hook installed, or a hook returning `undefined` /
26650
+ * `true` / `false` — previously allocated a fresh one-field object each
26651
+ * time, just to have `.pass` read once and be discarded. Callers only read
26652
+ * `pass` and probe for an own `data` property ({@link _update_hook_fields}),
26653
+ * so a shared instance is observationally identical; freezing turns that
26654
+ * read-only contract from incidental into enforced. Complex results (hooks
26655
+ * returning `{ pass, data, ... }`) still pass through untouched. #705
26656
+ *
26657
+ * @see abstract_hook_step
26658
+ * @see abstract_everything_hook_step
26659
+ *
26660
+ * @internal
26661
+ *
26662
+ */
26663
+ const HOOK_PASSED = Object.freeze({ pass: true }); // eslint-disable-line @typescript-eslint/no-explicit-any
26664
+ const HOOK_REJECTED = Object.freeze({ pass: false }); // eslint-disable-line @typescript-eslint/no-explicit-any
26641
26665
  /**
26642
26666
  *
26643
26667
  * Invoke an optional transition/action hook and normalize its return value
@@ -26679,16 +26703,16 @@ function abstract_hook_step(maybe_hook, hook_args) {
26679
26703
  if (maybe_hook !== undefined) {
26680
26704
  const result = maybe_hook(hook_args);
26681
26705
  if (result === undefined) {
26682
- return { pass: true };
26706
+ return HOOK_PASSED;
26683
26707
  }
26684
26708
  if (result === true) {
26685
- return { pass: true };
26709
+ return HOOK_PASSED;
26686
26710
  }
26687
26711
  if (result === false) {
26688
- return { pass: false };
26712
+ return HOOK_REJECTED;
26689
26713
  }
26690
26714
  if (result === null) {
26691
- return { pass: false };
26715
+ return HOOK_REJECTED;
26692
26716
  }
26693
26717
  if (is_hook_complex_result(result)) {
26694
26718
  return result;
@@ -26696,7 +26720,7 @@ function abstract_hook_step(maybe_hook, hook_args) {
26696
26720
  throw new TypeError(`Unknown hook result type ${result}`);
26697
26721
  }
26698
26722
  else {
26699
- return { pass: true };
26723
+ return HOOK_PASSED;
26700
26724
  }
26701
26725
  }
26702
26726
  /**
@@ -26737,16 +26761,16 @@ function abstract_everything_hook_step(maybe_hook, hook_args) {
26737
26761
  if (maybe_hook !== undefined) {
26738
26762
  const result = maybe_hook(hook_args);
26739
26763
  if (result === undefined) {
26740
- return { pass: true };
26764
+ return HOOK_PASSED;
26741
26765
  }
26742
26766
  if (result === true) {
26743
- return { pass: true };
26767
+ return HOOK_PASSED;
26744
26768
  }
26745
26769
  if (result === false) {
26746
- return { pass: false };
26770
+ return HOOK_REJECTED;
26747
26771
  }
26748
26772
  if (result === null) {
26749
- return { pass: false };
26773
+ return HOOK_REJECTED;
26750
26774
  }
26751
26775
  if (is_hook_complex_result(result)) {
26752
26776
  return result;
@@ -26754,7 +26778,7 @@ function abstract_everything_hook_step(maybe_hook, hook_args) {
26754
26778
  throw new TypeError(`Unknown hook result type ${result}`);
26755
26779
  }
26756
26780
  else {
26757
- return { pass: true };
26781
+ return HOOK_PASSED;
26758
26782
  }
26759
26783
  }
26760
26784