Comparing version 5.72.3 to 5.72.4
@@ -5,3 +5,3 @@ # Changelog | ||
922 merges; 114 releases; Changlogging the last 10 commits; Full changelog at [CHANGELOG.long.md](CHANGELOG.long.md) | ||
929 merges; 120 releases; Changlogging the last 10 commits; Full changelog at [CHANGELOG.long.md](CHANGELOG.long.md) | ||
@@ -16,3 +16,3 @@ | ||
<a href="#5__70__36">5.70.36</a>, <a href="#5__70__35">5.70.35</a>, <a href="#5__70__34">5.70.34</a>, <a href="#5__70__33">5.70.33</a>, <a href="#5__70__32">5.70.32</a>, <a href="#5__70__31">5.70.31</a>, <a href="#5__70__30">5.70.30</a>, <a href="#5__70__29">5.70.29</a>, <a href="#5__70__28">5.70.28</a>, <a href="#5__70__27">5.70.27</a>, <a href="#5__70__26">5.70.26</a>, <a href="#5__70__25">5.70.25</a>, <a href="#5__70__24">5.70.24</a>, <a href="#5__70__23">5.70.23</a>, <a href="#5__70__22">5.70.22</a>, <a href="#5__70__21">5.70.21</a>, <a href="#5__70__20">5.70.20</a>, <a href="#5__70__19">5.70.19</a>, <a href="#5__70__18">5.70.18</a>, <a href="#5__70__16">5.70.16</a>, <a href="#5__70__15">5.70.15</a>, <a href="#5__70__14">5.70.14</a>, <a href="#5__70__13">5.70.13</a>, <a href="#5__70__12">5.70.12</a>, <a href="#5__70__11">5.70.11</a>, <a href="#5__70__10">5.70.10</a>, <a href="#5__70__9">5.70.9</a>, <a href="#5__70__8">5.70.8</a>, <a href="#5__70__7">5.70.7</a>, <a href="#5__70__6">5.70.6</a>, <a href="#5__70__5">5.70.5</a>, <a href="#5__70__4">5.70.4</a>, <a href="#5__70__3">5.70.3</a>, <a href="#5__70__2">5.70.2</a>, <a href="#5__70__1">5.70.1</a>, <a href="#5__70__0">5.70.0</a>, <a href="#5__69__4">5.69.4</a>, <a href="#5__69__3">5.69.3</a>, <a href="#5__69__2">5.69.2</a>, <a href="#5__69__0">5.69.0</a>, <a href="#5__68__0">5.68.0</a>, <a href="#5__67__2">5.67.2</a>, <a href="#5__67__0">5.67.0</a>, <a href="#5__66__0">5.66.0</a>, <a href="#5__65__14">5.65.14</a>, <a href="#5__65__12">5.65.12</a>, <a href="#5__65__11">5.65.11</a>, <a href="#5__65__10">5.65.10</a>, <a href="#5__65__9">5.65.9</a>, <a href="#5__65__8">5.65.8</a>, <a href="#5__65__7">5.65.7</a>, <a href="#5__65__5">5.65.5</a>, <a href="#5__65__4">5.65.4</a>, <a href="#5__65__3">5.65.3</a>, <a href="#5__65__2">5.65.2</a>, <a href="#5__65__1">5.65.1</a>, <a href="#5__65__0">5.65.0</a>, <a href="#5__64__2">5.64.2</a>, <a href="#5__64__1">5.64.1</a>, <a href="#5__64__0">5.64.0</a>, <a href="#5__63__0">5.63.0</a>, <a href="#5__62__0">5.62.0</a>, <a href="#5__61__4">5.61.4</a>, <a href="#5__61__3">5.61.3</a>, <a href="#5__61__2">5.61.2</a>, <a href="#5__61__1">5.61.1</a>, <a href="#5__60__4">5.60.4</a>, <a href="#5__60__3">5.60.3</a>, <a href="#5__60__0">5.60.0</a>, <a href="#5__59__1">5.59.1</a>, <a href="#5__59__0">5.59.0</a>, <a href="#5__58__1">5.58.1</a>, <a href="#5__58__0">5.58.0</a>, <a href="#5__57__1">5.57.1</a>, <a href="#5__57__0">5.57.0</a>, <a href="#5__56__2">5.56.2</a>, <a href="#5__56__1">5.56.1</a>, <a href="#5__55__0">5.55.0</a>, <a href="#5__54__0">5.54.0</a>, <a href="#5__53__0">5.53.0</a>, <a href="#5__52__0">5.52.0</a>, <a href="#5__51__0">5.51.0</a>, <a href="#5__50__0">5.50.0</a>, <a href="#5__49__0">5.49.0</a>, <a href="#5__48__0">5.48.0</a>, <a href="#5__47__0">5.47.0</a>, <a href="#5__46__0">5.46.0</a>, <a href="#5__45__2">5.45.2</a>, <a href="#5__45__0">5.45.0</a>, <a href="#5__44__0">5.44.0</a>, <a href="#5__43__2">5.43.2</a>, <a href="#v5__42__0">v5.42.0</a>, <a href="#5__42__0">5.42.0</a>, <a href="#v5__41__15">v5.41.15</a>, <a href="#5__41__15">5.41.15</a>, <a href="#v5__41__14">v5.41.14</a>, <a href="#5__41__14">5.41.14</a>, <a href="#v5__41__12">v5.41.12</a>, <a href="#5__41__12">5.41.12</a>, <a href="#v5__41__10">v5.41.10</a>, <a href="#5__41__10">5.41.10</a>, <a href="#v5__41__9">v5.41.9</a>, <a href="#5__41__9">5.41.9</a>, <a href="#v5__41__8">v5.41.8</a>, <a href="#5__41__8">5.41.8</a>, <a href="#v5__41__7">v5.41.7</a>, <a href="#v5__41__2">v5.41.2</a>, <a href="#v5__41__1">v5.41.1</a>, <a href="#v5__32__14">v5.32.14</a>, <a href="#5__14__0">5.14.0</a>, <a href="#5__12__0">5.12.0</a>, <a href="#5__11__12">5.11.12</a>, <a href="#5__11__1">5.11.1</a>, <a href="#5__11__0">5.11.0</a> | ||
<a href="#5__72__3">5.72.3</a>, <a href="#5__72__2">5.72.2</a>, <a href="#5__72__1">5.72.1</a>, <a href="#5__72__0">5.72.0</a>, <a href="#5__71__1">5.71.1</a>, <a href="#5__71__0">5.71.0</a>, <a href="#5__70__36">5.70.36</a>, <a href="#5__70__35">5.70.35</a>, <a href="#5__70__34">5.70.34</a>, <a href="#5__70__33">5.70.33</a>, <a href="#5__70__32">5.70.32</a>, <a href="#5__70__31">5.70.31</a>, <a href="#5__70__30">5.70.30</a>, <a href="#5__70__29">5.70.29</a>, <a href="#5__70__28">5.70.28</a>, <a href="#5__70__27">5.70.27</a>, <a href="#5__70__26">5.70.26</a>, <a href="#5__70__25">5.70.25</a>, <a href="#5__70__24">5.70.24</a>, <a href="#5__70__23">5.70.23</a>, <a href="#5__70__22">5.70.22</a>, <a href="#5__70__21">5.70.21</a>, <a href="#5__70__20">5.70.20</a>, <a href="#5__70__19">5.70.19</a>, <a href="#5__70__18">5.70.18</a>, <a href="#5__70__16">5.70.16</a>, <a href="#5__70__15">5.70.15</a>, <a href="#5__70__14">5.70.14</a>, <a href="#5__70__13">5.70.13</a>, <a href="#5__70__12">5.70.12</a>, <a href="#5__70__11">5.70.11</a>, <a href="#5__70__10">5.70.10</a>, <a href="#5__70__9">5.70.9</a>, <a href="#5__70__8">5.70.8</a>, <a href="#5__70__7">5.70.7</a>, <a href="#5__70__6">5.70.6</a>, <a href="#5__70__5">5.70.5</a>, <a href="#5__70__4">5.70.4</a>, <a href="#5__70__3">5.70.3</a>, <a href="#5__70__2">5.70.2</a>, <a href="#5__70__1">5.70.1</a>, <a href="#5__70__0">5.70.0</a>, <a href="#5__69__4">5.69.4</a>, <a href="#5__69__3">5.69.3</a>, <a href="#5__69__2">5.69.2</a>, <a href="#5__69__0">5.69.0</a>, <a href="#5__68__0">5.68.0</a>, <a href="#5__67__2">5.67.2</a>, <a href="#5__67__0">5.67.0</a>, <a href="#5__66__0">5.66.0</a>, <a href="#5__65__14">5.65.14</a>, <a href="#5__65__12">5.65.12</a>, <a href="#5__65__11">5.65.11</a>, <a href="#5__65__10">5.65.10</a>, <a href="#5__65__9">5.65.9</a>, <a href="#5__65__8">5.65.8</a>, <a href="#5__65__7">5.65.7</a>, <a href="#5__65__5">5.65.5</a>, <a href="#5__65__4">5.65.4</a>, <a href="#5__65__3">5.65.3</a>, <a href="#5__65__2">5.65.2</a>, <a href="#5__65__1">5.65.1</a>, <a href="#5__65__0">5.65.0</a>, <a href="#5__64__2">5.64.2</a>, <a href="#5__64__1">5.64.1</a>, <a href="#5__64__0">5.64.0</a>, <a href="#5__63__0">5.63.0</a>, <a href="#5__62__0">5.62.0</a>, <a href="#5__61__4">5.61.4</a>, <a href="#5__61__3">5.61.3</a>, <a href="#5__61__2">5.61.2</a>, <a href="#5__61__1">5.61.1</a>, <a href="#5__60__4">5.60.4</a>, <a href="#5__60__3">5.60.3</a>, <a href="#5__60__0">5.60.0</a>, <a href="#5__59__1">5.59.1</a>, <a href="#5__59__0">5.59.0</a>, <a href="#5__58__1">5.58.1</a>, <a href="#5__58__0">5.58.0</a>, <a href="#5__57__1">5.57.1</a>, <a href="#5__57__0">5.57.0</a>, <a href="#5__56__2">5.56.2</a>, <a href="#5__56__1">5.56.1</a>, <a href="#5__55__0">5.55.0</a>, <a href="#5__54__0">5.54.0</a>, <a href="#5__53__0">5.53.0</a>, <a href="#5__52__0">5.52.0</a>, <a href="#5__51__0">5.51.0</a>, <a href="#5__50__0">5.50.0</a>, <a href="#5__49__0">5.49.0</a>, <a href="#5__48__0">5.48.0</a>, <a href="#5__47__0">5.47.0</a>, <a href="#5__46__0">5.46.0</a>, <a href="#5__45__2">5.45.2</a>, <a href="#5__45__0">5.45.0</a>, <a href="#5__44__0">5.44.0</a>, <a href="#5__43__2">5.43.2</a>, <a href="#v5__42__0">v5.42.0</a>, <a href="#5__42__0">5.42.0</a>, <a href="#v5__41__15">v5.41.15</a>, <a href="#5__41__15">5.41.15</a>, <a href="#v5__41__14">v5.41.14</a>, <a href="#5__41__14">5.41.14</a>, <a href="#v5__41__12">v5.41.12</a>, <a href="#5__41__12">5.41.12</a>, <a href="#v5__41__10">v5.41.10</a>, <a href="#5__41__10">5.41.10</a>, <a href="#v5__41__9">v5.41.9</a>, <a href="#5__41__9">5.41.9</a>, <a href="#v5__41__8">v5.41.8</a>, <a href="#5__41__8">5.41.8</a>, <a href="#v5__41__7">v5.41.7</a>, <a href="#v5__41__2">v5.41.2</a>, <a href="#v5__41__1">v5.41.1</a>, <a href="#v5__32__14">v5.32.14</a>, <a href="#5__14__0">5.14.0</a>, <a href="#5__12__0">5.12.0</a>, <a href="#5__11__12">5.11.12</a>, <a href="#5__11__1">5.11.1</a>, <a href="#5__11__0">5.11.0</a> | ||
@@ -27,9 +27,9 @@ | ||
## [Untagged] - 6/24/2022 7:36:27 PM | ||
## [Untagged] - 6/25/2022 7:15:46 AM | ||
Commit [adfa9069ba5e78d8a227896a5f7e14a8f4b80117](https://github.com/StoneCypher/jssm/commit/adfa9069ba5e78d8a227896a5f7e14a8f4b80117) | ||
Commit [fb82aff27a911a29304c8b7c211e48c1b6ac454e](https://github.com/StoneCypher/jssm/commit/fb82aff27a911a29304c8b7c211e48c1b6ac454e) | ||
Author: `John Haugeland <stonecypher@gmail.com>` | ||
* the conversion continues | ||
* prepping to test main and forced | ||
@@ -43,9 +43,9 @@ | ||
## [Untagged] - 6/24/2022 5:49:06 PM | ||
## [Untagged] - 6/25/2022 7:05:36 AM | ||
Commit [b0cbe1c1ae0199c8d78a82f624e8ee94b344cf71](https://github.com/StoneCypher/jssm/commit/b0cbe1c1ae0199c8d78a82f624e8ee94b344cf71) | ||
Commit [3ffc6c2a0b76d1a4870cd80a0f94d745e1c976c9](https://github.com/StoneCypher/jssm/commit/3ffc6c2a0b76d1a4870cd80a0f94d745e1c976c9) | ||
Author: `John Haugeland <stonecypher@gmail.com>` | ||
* Normalize hook return pattern, fixes StoneCypher/fsl#930 | ||
* everything now tested but standard and main | ||
@@ -59,9 +59,9 @@ | ||
## [Untagged] - 6/24/2022 4:55:33 PM | ||
## [Untagged] - 6/25/2022 6:50:50 AM | ||
Commit [547e35599ed312bf5300d3f1685e2cb16b80a73e](https://github.com/StoneCypher/jssm/commit/547e35599ed312bf5300d3f1685e2cb16b80a73e) | ||
Commit [e74cb836ae9c06a3261658ee969506c8dd3c9a24](https://github.com/StoneCypher/jssm/commit/e74cb836ae9c06a3261658ee969506c8dd3c9a24) | ||
Author: `John Haugeland <stonecypher@gmail.com>` | ||
* Can read data from outside, fixes StoneCypher/fsl#929 | ||
* six data kinds tested | ||
@@ -75,9 +75,9 @@ | ||
## [Untagged] - 6/24/2022 4:08:35 PM | ||
## [Untagged] - 6/24/2022 9:24:32 PM | ||
Commit [a1c43e9f65f2fd8e856a2544f7c3056b4c06d9d3](https://github.com/StoneCypher/jssm/commit/a1c43e9f65f2fd8e856a2544f7c3056b4c06d9d3) | ||
Commit [df34e0fd36d969bcb80488c6609d6bf4140b89a4](https://github.com/StoneCypher/jssm/commit/df34e0fd36d969bcb80488c6609d6bf4140b89a4) | ||
Author: `John Haugeland <stonecypher@gmail.com>` | ||
* First steps towards being a Moore machine - initial data in constructor fixes StoneCypher/fsl#923 , can read in hooks fixes StoneCypher/fsl#924 | ||
* working test matrix | ||
@@ -91,9 +91,9 @@ | ||
## [Untagged] - 6/23/2022 6:34:38 PM | ||
## [Untagged] - 6/24/2022 8:34:59 PM | ||
Commit [1dc7c24bfb651eec57fddc902f78db796f71a6c5](https://github.com/StoneCypher/jssm/commit/1dc7c24bfb651eec57fddc902f78db796f71a6c5) | ||
Commit [8db075dcd9a135e6757a11c5e497130bb3edb6a9](https://github.com/StoneCypher/jssm/commit/8db075dcd9a135e6757a11c5e497130bb3edb6a9) | ||
Author: `John Haugeland <stonecypher@gmail.com>` | ||
* Small documentation tweaks. First attempt to lodge on deno.land | ||
* Hooks now change data on basic transitions, moving to handle the rest | ||
@@ -107,13 +107,18 @@ | ||
## [Untagged] - 6/23/2022 1:41:18 PM | ||
<a name="5__72__3" /> | ||
Commit [67c3240798d31933413aab27db7ea9fbb5de3b2a](https://github.com/StoneCypher/jssm/commit/67c3240798d31933413aab27db7ea9fbb5de3b2a) | ||
## [5.72.3] - 6/24/2022 7:48:13 PM | ||
Commit [a1843247eb5c063910643f675f0a85764f3f3683](https://github.com/StoneCypher/jssm/commit/a1843247eb5c063910643f675f0a85764f3f3683) | ||
Author: `John Haugeland <stonecypher@gmail.com>` | ||
* Normalize arguments to hooks, fixes StoneCypher/fsl#895; more docs | ||
Merges [b0cbe1c, d52217a] | ||
* Merge pull request #501 from StoneCypher/MovingToAbstractHooks | ||
* Moving to abstract hooks | ||
| ||
@@ -123,11 +128,9 @@ | ||
<a name="5__70__36" /> | ||
## [Untagged] - 6/24/2022 7:44:55 PM | ||
## [5.70.36] - 6/21/2022 6:53:36 PM | ||
Commit [d52217ab9dde2a5746cd0704597d337362057024](https://github.com/StoneCypher/jssm/commit/d52217ab9dde2a5746cd0704597d337362057024) | ||
Commit [093db23b719161e35e477cc0fe7d9f1132bc28b8](https://github.com/StoneCypher/jssm/commit/093db23b719161e35e477cc0fe7d9f1132bc28b8) | ||
Author: `John Haugeland <stonecypher@gmail.com>` | ||
* Another trivial build - this one to cause chain publishment | ||
* Basic conversion to abstract hooks complete; fixes StoneCypher/fsl#931 | ||
@@ -141,11 +144,9 @@ | ||
<a name="5__70__35" /> | ||
## [Untagged] - 6/24/2022 7:36:27 PM | ||
## [5.70.35] - 6/19/2022 10:56:41 AM | ||
Commit [adfa9069ba5e78d8a227896a5f7e14a8f4b80117](https://github.com/StoneCypher/jssm/commit/adfa9069ba5e78d8a227896a5f7e14a8f4b80117) | ||
Commit [13ee9eb71ca9ab868699e535abf6ba30c8ad5829](https://github.com/StoneCypher/jssm/commit/13ee9eb71ca9ab868699e535abf6ba30c8ad5829) | ||
Author: `John Haugeland <stonecypher@gmail.com>` | ||
* new trigger with replaced token - this time with a bump | ||
* the conversion continues | ||
@@ -159,9 +160,11 @@ | ||
## [Untagged] - 6/19/2022 10:37:04 AM | ||
<a name="5__72__2" /> | ||
Commit [b3e69d9745b92d845bedcfbc08f342997137af3d](https://github.com/StoneCypher/jssm/commit/b3e69d9745b92d845bedcfbc08f342997137af3d) | ||
## [5.72.2] - 6/24/2022 5:49:06 PM | ||
Commit [b0cbe1c1ae0199c8d78a82f624e8ee94b344cf71](https://github.com/StoneCypher/jssm/commit/b0cbe1c1ae0199c8d78a82f624e8ee94b344cf71) | ||
Author: `John Haugeland <stonecypher@gmail.com>` | ||
* new trigger with replaced token | ||
* Normalize hook return pattern, fixes StoneCypher/fsl#930 | ||
@@ -175,10 +178,10 @@ | ||
<a name="5__70__34" /> | ||
<a name="5__72__1" /> | ||
## [5.70.34] - 6/18/2022 9:40:31 PM | ||
## [5.72.1] - 6/24/2022 4:55:33 PM | ||
Commit [a0f295f060c7f08a8b10b2208dd1c95dc7f3c97a](https://github.com/StoneCypher/jssm/commit/a0f295f060c7f08a8b10b2208dd1c95dc7f3c97a) | ||
Commit [547e35599ed312bf5300d3f1685e2cb16b80a73e](https://github.com/StoneCypher/jssm/commit/547e35599ed312bf5300d3f1685e2cb16b80a73e) | ||
Author: `John Haugeland <stonecypher@gmail.com>` | ||
* another trigger commit with mild doc extension | ||
* Can read data from outside, fixes StoneCypher/fsl#929 |
@@ -206,7 +206,7 @@ declare type StateType = string; | ||
}; | ||
declare type HookResult = true | false | undefined | void; | ||
declare type HookResult<mDT> = true | false | undefined | void | HookComplexResult<mDT>; | ||
declare type HookContext<mDT> = { | ||
data: mDT; | ||
}; | ||
declare type HookHandler<mDT> = (hook_context: HookContext<mDT>) => HookResult; | ||
declare type HookHandler<mDT> = (hook_context: HookContext<mDT>) => HookResult<mDT>; | ||
declare type JssmErrorExtendedInfo = { | ||
@@ -213,0 +213,0 @@ requested_state?: StateType | undefined; |
declare type StateType = string; | ||
import { JssmGenericState, JssmGenericConfig, JssmTransition, JssmTransitionList, // JssmTransitionRule, | ||
JssmMachineInternalState, JssmParseTree, JssmStateDeclaration, JssmArrow, JssmArrowDirection, JssmArrowKind, JssmLayout, FslDirection, FslTheme, HookDescription, HookHandler, HookResult } from './jssm_types'; | ||
JssmMachineInternalState, JssmParseTree, JssmStateDeclaration, JssmArrow, JssmArrowDirection, JssmArrowKind, JssmLayout, FslDirection, FslTheme, HookDescription, HookHandler, HookContext, HookResult, HookComplexResult } from './jssm_types'; | ||
import { seq, weighted_rand_select, weighted_sample_select, histograph, weighted_histo_key } from './jssm_util'; | ||
@@ -672,3 +672,5 @@ import { shapes, gviz_shapes, named_colors } from './jssm_constants'; | ||
declare function from<mDT>(MachineAsString: string, ExtraConstructorFields?: Partial<JssmGenericConfig<mDT>> | undefined): Machine<mDT>; | ||
declare function is_hook_rejection(hr: HookResult): boolean; | ||
export { version, transfer_state_properties, Machine, make, wrap_parse as parse, compile, sm, from, arrow_direction, arrow_left_kind, arrow_right_kind, seq, weighted_rand_select, histograph, weighted_sample_select, weighted_histo_key, shapes, gviz_shapes, named_colors, is_hook_rejection }; | ||
declare function is_hook_complex_result<mDT>(hr: unknown): hr is HookComplexResult<mDT>; | ||
declare function is_hook_rejection<mDT>(hr: HookResult<mDT>): boolean; | ||
declare function abstract_hook_step<mDT>(maybe_hook: HookHandler<mDT> | undefined, hook_args: HookContext<mDT>): HookComplexResult<mDT>; | ||
export { version, transfer_state_properties, Machine, make, wrap_parse as parse, compile, sm, from, arrow_direction, arrow_left_kind, arrow_right_kind, seq, weighted_rand_select, histograph, weighted_sample_select, weighted_histo_key, shapes, gviz_shapes, named_colors, is_hook_rejection, is_hook_complex_result, abstract_hook_step }; |
@@ -1333,28 +1333,45 @@ // whargarbl lots of these return arrays could/should be sets | ||
if (this._has_hooks) { | ||
const hook_args = { data: this._data, action: fromAction, from: this._state, to: newState, forced: wasForced }; | ||
const hook_args = { | ||
data: this._data, | ||
action: fromAction, | ||
from: this._state, | ||
to: newState, | ||
forced: wasForced | ||
}; | ||
function update_fields(res) { | ||
if (res.hasOwnProperty('data')) { | ||
hook_args.data = res.data; | ||
data_changed = true; | ||
} | ||
} | ||
let data_changed = false; | ||
if (wasAction) { | ||
// 1. any action hook | ||
const outcome = AbstractHookStep(this._any_action_hook, hook_args); | ||
const outcome = abstract_hook_step(this._any_action_hook, hook_args); | ||
if (outcome.pass === false) { | ||
return false; | ||
} | ||
update_fields(outcome); | ||
// 2. global specific action hook | ||
const outcome2 = AbstractHookStep(this._global_action_hooks.get(newStateOrAction), hook_args); | ||
const outcome2 = abstract_hook_step(this._global_action_hooks.get(newStateOrAction), hook_args); | ||
if (outcome2.pass === false) { | ||
return false; | ||
} | ||
update_fields(outcome2); | ||
} | ||
// 3. any transition hook | ||
if (this._any_transition_hook !== undefined) { | ||
const outcome = AbstractHookStep(this._any_transition_hook, hook_args); | ||
const outcome = abstract_hook_step(this._any_transition_hook, hook_args); | ||
if (outcome.pass === false) { | ||
return false; | ||
} | ||
update_fields(outcome); | ||
} | ||
// 4. exit hook | ||
if (this._has_exit_hooks) { | ||
const outcome = AbstractHookStep(this._exit_hooks.get(this._state), hook_args); | ||
const outcome = abstract_hook_step(this._exit_hooks.get(this._state), hook_args); | ||
if (outcome.pass === false) { | ||
return false; | ||
} | ||
update_fields(outcome); | ||
} | ||
@@ -1364,6 +1381,7 @@ // 5. named transition / action hook | ||
if (wasAction) { | ||
const nhn = named_hook_name(this._state, newState, newStateOrAction), outcome = AbstractHookStep(this._named_hooks.get(nhn), hook_args); | ||
const nhn = named_hook_name(this._state, newState, newStateOrAction), outcome = abstract_hook_step(this._named_hooks.get(nhn), hook_args); | ||
if (outcome.pass === false) { | ||
return false; | ||
} | ||
update_fields(outcome); | ||
} | ||
@@ -1373,6 +1391,7 @@ } | ||
if (this._has_basic_hooks) { | ||
const hn = hook_name(this._state, newState), outcome = AbstractHookStep(this._hooks.get(hn), hook_args); | ||
const hn = hook_name(this._state, newState), outcome = abstract_hook_step(this._hooks.get(hn), hook_args); | ||
if (outcome.pass === false) { | ||
return false; | ||
} | ||
update_fields(outcome); | ||
} | ||
@@ -1382,29 +1401,37 @@ // 7. edge type hook | ||
if (trans_type === 'legal') { | ||
const outcome = AbstractHookStep(this._standard_transition_hook, hook_args); | ||
const outcome = abstract_hook_step(this._standard_transition_hook, hook_args); | ||
if (outcome.pass === false) { | ||
return false; | ||
} | ||
update_fields(outcome); | ||
} | ||
// 7b. main type hook | ||
if (trans_type === 'main') { | ||
const outcome = AbstractHookStep(this._main_transition_hook, hook_args); | ||
const outcome = abstract_hook_step(this._main_transition_hook, hook_args); | ||
if (outcome.pass === false) { | ||
return false; | ||
} | ||
update_fields(outcome); | ||
} | ||
// 7c. forced transition hook | ||
if (trans_type === 'forced') { | ||
const outcome = AbstractHookStep(this._forced_transition_hook, hook_args); | ||
const outcome = abstract_hook_step(this._forced_transition_hook, hook_args); | ||
if (outcome.pass === false) { | ||
return false; | ||
} | ||
update_fields(outcome); | ||
} | ||
// 8. entry hook | ||
if (this._has_entry_hooks) { | ||
const outcome = AbstractHookStep(this._entry_hooks.get(newState), hook_args); | ||
const outcome = abstract_hook_step(this._entry_hooks.get(newState), hook_args); | ||
if (outcome.pass === false) { | ||
return false; | ||
} | ||
update_fields(outcome); | ||
} | ||
// all hooks passed! let's now establish the result | ||
this._state = newState; | ||
if (data_changed) { | ||
this._data = hook_args.data; | ||
} | ||
return true; | ||
@@ -1624,4 +1651,3 @@ // or without hooks | ||
} | ||
// TODO hook_args: unknown | ||
function AbstractHookStep(maybe_hook, hook_args) { | ||
function abstract_hook_step(maybe_hook, hook_args) { | ||
if (maybe_hook !== undefined) { | ||
@@ -1638,5 +1664,5 @@ const result = maybe_hook(hook_args); | ||
} | ||
// if (is_hook_complex_result(result)) { | ||
// return result; | ||
// } | ||
if (is_hook_complex_result(result)) { | ||
return result; | ||
} | ||
throw new TypeError(`Unknown hook result type ${result}`); | ||
@@ -1650,2 +1676,2 @@ } | ||
// WHARGARBL TODO these should be exported to a utility library | ||
seq, weighted_rand_select, histograph, weighted_sample_select, weighted_histo_key, shapes, gviz_shapes, named_colors, is_hook_rejection }; | ||
seq, weighted_rand_select, histograph, weighted_sample_select, weighted_histo_key, shapes, gviz_shapes, named_colors, is_hook_rejection, is_hook_complex_result, abstract_hook_step }; |
@@ -1,2 +0,2 @@ | ||
const version = "5.72.3"; | ||
const version = "5.72.4"; | ||
export { version }; |
@@ -206,7 +206,7 @@ declare type StateType = string; | ||
}; | ||
declare type HookResult = true | false | undefined | void; | ||
declare type HookResult<mDT> = true | false | undefined | void | HookComplexResult<mDT>; | ||
declare type HookContext<mDT> = { | ||
data: mDT; | ||
}; | ||
declare type HookHandler<mDT> = (hook_context: HookContext<mDT>) => HookResult; | ||
declare type HookHandler<mDT> = (hook_context: HookContext<mDT>) => HookResult<mDT>; | ||
declare type JssmErrorExtendedInfo = { | ||
@@ -213,0 +213,0 @@ requested_state?: StateType | undefined; |
declare type StateType = string; | ||
import { JssmGenericState, JssmGenericConfig, JssmTransition, JssmTransitionList, // JssmTransitionRule, | ||
JssmMachineInternalState, JssmParseTree, JssmStateDeclaration, JssmArrow, JssmArrowDirection, JssmArrowKind, JssmLayout, FslDirection, FslTheme, HookDescription, HookHandler, HookResult } from './jssm_types'; | ||
JssmMachineInternalState, JssmParseTree, JssmStateDeclaration, JssmArrow, JssmArrowDirection, JssmArrowKind, JssmLayout, FslDirection, FslTheme, HookDescription, HookHandler, HookContext, HookResult, HookComplexResult } from './jssm_types'; | ||
import { seq, weighted_rand_select, weighted_sample_select, histograph, weighted_histo_key } from './jssm_util'; | ||
@@ -672,3 +672,5 @@ import { shapes, gviz_shapes, named_colors } from './jssm_constants'; | ||
declare function from<mDT>(MachineAsString: string, ExtraConstructorFields?: Partial<JssmGenericConfig<mDT>> | undefined): Machine<mDT>; | ||
declare function is_hook_rejection(hr: HookResult): boolean; | ||
export { version, transfer_state_properties, Machine, make, wrap_parse as parse, compile, sm, from, arrow_direction, arrow_left_kind, arrow_right_kind, seq, weighted_rand_select, histograph, weighted_sample_select, weighted_histo_key, shapes, gviz_shapes, named_colors, is_hook_rejection }; | ||
declare function is_hook_complex_result<mDT>(hr: unknown): hr is HookComplexResult<mDT>; | ||
declare function is_hook_rejection<mDT>(hr: HookResult<mDT>): boolean; | ||
declare function abstract_hook_step<mDT>(maybe_hook: HookHandler<mDT> | undefined, hook_args: HookContext<mDT>): HookComplexResult<mDT>; | ||
export { version, transfer_state_properties, Machine, make, wrap_parse as parse, compile, sm, from, arrow_direction, arrow_left_kind, arrow_right_kind, seq, weighted_rand_select, histograph, weighted_sample_select, weighted_histo_key, shapes, gviz_shapes, named_colors, is_hook_rejection, is_hook_complex_result, abstract_hook_step }; |
{ | ||
"name": "jssm", | ||
"version": "5.72.3", | ||
"version": "5.72.4", | ||
"engines": { | ||
@@ -5,0 +5,0 @@ "node": ">=10.0.0" |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1010563
7110