jssm 5.72.3 → 5.72.4

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/CHANGELOG.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
- 922 merges; 114 releases; Changlogging the last 10 commits; Full changelog at [CHANGELOG.long.md](CHANGELOG.long.md)
5
+ 929 merges; 120 releases; Changlogging the last 10 commits; Full changelog at [CHANGELOG.long.md](CHANGELOG.long.md)
6
6
 
7
7
 
8
8
 
@@ -12,7 +12,7 @@ All notable changes to this project will be documented in this file.
12
12
 
13
13
  Published tags:
14
14
 
15
- <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>
15
+ <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>
16
16
 
17
17
 
18
18
 
@@ -22,13 +22,13 @@ Published tags:
22
22
 
23
23
  &nbsp;
24
24
 
25
- ## [Untagged] - 6/24/2022 7:36:27 PM
25
+ ## [Untagged] - 6/25/2022 7:15:46 AM
26
26
 
27
- Commit [adfa9069ba5e78d8a227896a5f7e14a8f4b80117](https://github.com/StoneCypher/jssm/commit/adfa9069ba5e78d8a227896a5f7e14a8f4b80117)
27
+ Commit [fb82aff27a911a29304c8b7c211e48c1b6ac454e](https://github.com/StoneCypher/jssm/commit/fb82aff27a911a29304c8b7c211e48c1b6ac454e)
28
28
 
29
29
  Author: `John Haugeland <stonecypher@gmail.com>`
30
30
 
31
- * the conversion continues
31
+ * prepping to test main and forced
32
32
 
33
33
 
34
34
 
@@ -37,13 +37,13 @@ Author: `John Haugeland <stonecypher@gmail.com>`
37
37
 
38
38
  &nbsp;
39
39
 
40
- ## [Untagged] - 6/24/2022 5:49:06 PM
40
+ ## [Untagged] - 6/25/2022 7:05:36 AM
41
41
 
42
- Commit [b0cbe1c1ae0199c8d78a82f624e8ee94b344cf71](https://github.com/StoneCypher/jssm/commit/b0cbe1c1ae0199c8d78a82f624e8ee94b344cf71)
42
+ Commit [3ffc6c2a0b76d1a4870cd80a0f94d745e1c976c9](https://github.com/StoneCypher/jssm/commit/3ffc6c2a0b76d1a4870cd80a0f94d745e1c976c9)
43
43
 
44
44
  Author: `John Haugeland <stonecypher@gmail.com>`
45
45
 
46
- * Normalize hook return pattern, fixes StoneCypher/fsl#930
46
+ * everything now tested but standard and main
47
47
 
48
48
 
49
49
 
@@ -52,13 +52,13 @@ Author: `John Haugeland <stonecypher@gmail.com>`
52
52
 
53
53
  &nbsp;
54
54
 
55
- ## [Untagged] - 6/24/2022 4:55:33 PM
55
+ ## [Untagged] - 6/25/2022 6:50:50 AM
56
56
 
57
- Commit [547e35599ed312bf5300d3f1685e2cb16b80a73e](https://github.com/StoneCypher/jssm/commit/547e35599ed312bf5300d3f1685e2cb16b80a73e)
57
+ Commit [e74cb836ae9c06a3261658ee969506c8dd3c9a24](https://github.com/StoneCypher/jssm/commit/e74cb836ae9c06a3261658ee969506c8dd3c9a24)
58
58
 
59
59
  Author: `John Haugeland <stonecypher@gmail.com>`
60
60
 
61
- * Can read data from outside, fixes StoneCypher/fsl#929
61
+ * six data kinds tested
62
62
 
63
63
 
64
64
 
@@ -67,13 +67,13 @@ Author: `John Haugeland <stonecypher@gmail.com>`
67
67
 
68
68
  &nbsp;
69
69
 
70
- ## [Untagged] - 6/24/2022 4:08:35 PM
70
+ ## [Untagged] - 6/24/2022 9:24:32 PM
71
71
 
72
- Commit [a1c43e9f65f2fd8e856a2544f7c3056b4c06d9d3](https://github.com/StoneCypher/jssm/commit/a1c43e9f65f2fd8e856a2544f7c3056b4c06d9d3)
72
+ Commit [df34e0fd36d969bcb80488c6609d6bf4140b89a4](https://github.com/StoneCypher/jssm/commit/df34e0fd36d969bcb80488c6609d6bf4140b89a4)
73
73
 
74
74
  Author: `John Haugeland <stonecypher@gmail.com>`
75
75
 
76
- * First steps towards being a Moore machine - initial data in constructor fixes StoneCypher/fsl#923 , can read in hooks fixes StoneCypher/fsl#924
76
+ * working test matrix
77
77
 
78
78
 
79
79
 
@@ -82,13 +82,13 @@ Author: `John Haugeland <stonecypher@gmail.com>`
82
82
 
83
83
  &nbsp;
84
84
 
85
- ## [Untagged] - 6/23/2022 6:34:38 PM
85
+ ## [Untagged] - 6/24/2022 8:34:59 PM
86
86
 
87
- Commit [1dc7c24bfb651eec57fddc902f78db796f71a6c5](https://github.com/StoneCypher/jssm/commit/1dc7c24bfb651eec57fddc902f78db796f71a6c5)
87
+ Commit [8db075dcd9a135e6757a11c5e497130bb3edb6a9](https://github.com/StoneCypher/jssm/commit/8db075dcd9a135e6757a11c5e497130bb3edb6a9)
88
88
 
89
89
  Author: `John Haugeland <stonecypher@gmail.com>`
90
90
 
91
- * Small documentation tweaks. First attempt to lodge on deno.land
91
+ * Hooks now change data on basic transitions, moving to handle the rest
92
92
 
93
93
 
94
94
 
@@ -97,30 +97,33 @@ Author: `John Haugeland <stonecypher@gmail.com>`
97
97
 
98
98
  &nbsp;
99
99
 
100
- ## [Untagged] - 6/23/2022 1:41:18 PM
100
+ <a name="5__72__3" />
101
+
102
+ ## [5.72.3] - 6/24/2022 7:48:13 PM
101
103
 
102
- Commit [67c3240798d31933413aab27db7ea9fbb5de3b2a](https://github.com/StoneCypher/jssm/commit/67c3240798d31933413aab27db7ea9fbb5de3b2a)
104
+ Commit [a1843247eb5c063910643f675f0a85764f3f3683](https://github.com/StoneCypher/jssm/commit/a1843247eb5c063910643f675f0a85764f3f3683)
103
105
 
104
106
  Author: `John Haugeland <stonecypher@gmail.com>`
105
107
 
106
- * Normalize arguments to hooks, fixes StoneCypher/fsl#895; more docs
108
+ Merges [b0cbe1c, d52217a]
107
109
 
110
+ * Merge pull request #501 from StoneCypher/MovingToAbstractHooks
111
+ * Moving to abstract hooks
108
112
 
109
113
 
110
114
 
111
- &nbsp;
112
115
 
113
116
  &nbsp;
114
117
 
115
- <a name="5__70__36" />
118
+ &nbsp;
116
119
 
117
- ## [5.70.36] - 6/21/2022 6:53:36 PM
120
+ ## [Untagged] - 6/24/2022 7:44:55 PM
118
121
 
119
- Commit [093db23b719161e35e477cc0fe7d9f1132bc28b8](https://github.com/StoneCypher/jssm/commit/093db23b719161e35e477cc0fe7d9f1132bc28b8)
122
+ Commit [d52217ab9dde2a5746cd0704597d337362057024](https://github.com/StoneCypher/jssm/commit/d52217ab9dde2a5746cd0704597d337362057024)
120
123
 
121
124
  Author: `John Haugeland <stonecypher@gmail.com>`
122
125
 
123
- * Another trivial build - this one to cause chain publishment
126
+ * Basic conversion to abstract hooks complete; fixes StoneCypher/fsl#931
124
127
 
125
128
 
126
129
 
@@ -129,15 +132,13 @@ Author: `John Haugeland <stonecypher@gmail.com>`
129
132
 
130
133
  &nbsp;
131
134
 
132
- <a name="5__70__35" />
133
-
134
- ## [5.70.35] - 6/19/2022 10:56:41 AM
135
+ ## [Untagged] - 6/24/2022 7:36:27 PM
135
136
 
136
- Commit [13ee9eb71ca9ab868699e535abf6ba30c8ad5829](https://github.com/StoneCypher/jssm/commit/13ee9eb71ca9ab868699e535abf6ba30c8ad5829)
137
+ Commit [adfa9069ba5e78d8a227896a5f7e14a8f4b80117](https://github.com/StoneCypher/jssm/commit/adfa9069ba5e78d8a227896a5f7e14a8f4b80117)
137
138
 
138
139
  Author: `John Haugeland <stonecypher@gmail.com>`
139
140
 
140
- * new trigger with replaced token - this time with a bump
141
+ * the conversion continues
141
142
 
142
143
 
143
144
 
@@ -146,13 +147,15 @@ Author: `John Haugeland <stonecypher@gmail.com>`
146
147
 
147
148
  &nbsp;
148
149
 
149
- ## [Untagged] - 6/19/2022 10:37:04 AM
150
+ <a name="5__72__2" />
150
151
 
151
- Commit [b3e69d9745b92d845bedcfbc08f342997137af3d](https://github.com/StoneCypher/jssm/commit/b3e69d9745b92d845bedcfbc08f342997137af3d)
152
+ ## [5.72.2] - 6/24/2022 5:49:06 PM
153
+
154
+ Commit [b0cbe1c1ae0199c8d78a82f624e8ee94b344cf71](https://github.com/StoneCypher/jssm/commit/b0cbe1c1ae0199c8d78a82f624e8ee94b344cf71)
152
155
 
153
156
  Author: `John Haugeland <stonecypher@gmail.com>`
154
157
 
155
- * new trigger with replaced token
158
+ * Normalize hook return pattern, fixes StoneCypher/fsl#930
156
159
 
157
160
 
158
161
 
@@ -161,12 +164,12 @@ Author: `John Haugeland <stonecypher@gmail.com>`
161
164
 
162
165
  &nbsp;
163
166
 
164
- <a name="5__70__34" />
167
+ <a name="5__72__1" />
165
168
 
166
- ## [5.70.34] - 6/18/2022 9:40:31 PM
169
+ ## [5.72.1] - 6/24/2022 4:55:33 PM
167
170
 
168
- Commit [a0f295f060c7f08a8b10b2208dd1c95dc7f3c97a](https://github.com/StoneCypher/jssm/commit/a0f295f060c7f08a8b10b2208dd1c95dc7f3c97a)
171
+ Commit [547e35599ed312bf5300d3f1685e2cb16b80a73e](https://github.com/StoneCypher/jssm/commit/547e35599ed312bf5300d3f1685e2cb16b80a73e)
169
172
 
170
173
  Author: `John Haugeland <stonecypher@gmail.com>`
171
174
 
172
- * another trigger commit with mild doc extension
175
+ * Can read data from outside, fixes StoneCypher/fsl#929
@@ -1,6 +1,6 @@
1
1
  declare type StateType = string;
2
2
  import { JssmGenericState, JssmGenericConfig, JssmTransition, JssmTransitionList, // JssmTransitionRule,
3
- JssmMachineInternalState, JssmParseTree, JssmStateDeclaration, JssmArrow, JssmArrowDirection, JssmArrowKind, JssmLayout, FslDirection, FslTheme, HookDescription, HookHandler, HookResult } from './jssm_types';
3
+ JssmMachineInternalState, JssmParseTree, JssmStateDeclaration, JssmArrow, JssmArrowDirection, JssmArrowKind, JssmLayout, FslDirection, FslTheme, HookDescription, HookHandler, HookContext, HookResult, HookComplexResult } from './jssm_types';
4
4
  import { seq, weighted_rand_select, weighted_sample_select, histograph, weighted_histo_key } from './jssm_util';
5
5
  import { shapes, gviz_shapes, named_colors } from './jssm_constants';
6
6
  import { version } from './version';
@@ -669,5 +669,7 @@ declare function sm<mDT>(template_strings: TemplateStringsArray, ...remainder: a
669
669
  *
670
670
  */
671
671
  declare function from<mDT>(MachineAsString: string, ExtraConstructorFields?: Partial<JssmGenericConfig<mDT>> | undefined): Machine<mDT>;
672
- declare function is_hook_rejection(hr: HookResult): boolean;
673
- 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 };
672
+ declare function is_hook_complex_result<mDT>(hr: unknown): hr is HookComplexResult<mDT>;
673
+ declare function is_hook_rejection<mDT>(hr: HookResult<mDT>): boolean;
674
+ declare function abstract_hook_step<mDT>(maybe_hook: HookHandler<mDT> | undefined, hook_args: HookContext<mDT>): HookComplexResult<mDT>;
675
+ 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 };
package/dist/es6/jssm.js CHANGED
@@ -1330,79 +1330,106 @@ class Machine {
1330
1330
  }
1331
1331
  if (valid) {
1332
1332
  if (this._has_hooks) {
1333
- const hook_args = { data: this._data, action: fromAction, from: this._state, to: newState, forced: wasForced };
1333
+ const hook_args = {
1334
+ data: this._data,
1335
+ action: fromAction,
1336
+ from: this._state,
1337
+ to: newState,
1338
+ forced: wasForced
1339
+ };
1340
+ function update_fields(res) {
1341
+ if (res.hasOwnProperty('data')) {
1342
+ hook_args.data = res.data;
1343
+ data_changed = true;
1344
+ }
1345
+ }
1346
+ let data_changed = false;
1334
1347
  if (wasAction) {
1335
1348
  // 1. any action hook
1336
- const outcome = AbstractHookStep(this._any_action_hook, hook_args);
1349
+ const outcome = abstract_hook_step(this._any_action_hook, hook_args);
1337
1350
  if (outcome.pass === false) {
1338
1351
  return false;
1339
1352
  }
1353
+ update_fields(outcome);
1340
1354
  // 2. global specific action hook
1341
- const outcome2 = AbstractHookStep(this._global_action_hooks.get(newStateOrAction), hook_args);
1355
+ const outcome2 = abstract_hook_step(this._global_action_hooks.get(newStateOrAction), hook_args);
1342
1356
  if (outcome2.pass === false) {
1343
1357
  return false;
1344
1358
  }
1359
+ update_fields(outcome2);
1345
1360
  }
1346
1361
  // 3. any transition hook
1347
1362
  if (this._any_transition_hook !== undefined) {
1348
- const outcome = AbstractHookStep(this._any_transition_hook, hook_args);
1363
+ const outcome = abstract_hook_step(this._any_transition_hook, hook_args);
1349
1364
  if (outcome.pass === false) {
1350
1365
  return false;
1351
1366
  }
1367
+ update_fields(outcome);
1352
1368
  }
1353
1369
  // 4. exit hook
1354
1370
  if (this._has_exit_hooks) {
1355
- const outcome = AbstractHookStep(this._exit_hooks.get(this._state), hook_args);
1371
+ const outcome = abstract_hook_step(this._exit_hooks.get(this._state), hook_args);
1356
1372
  if (outcome.pass === false) {
1357
1373
  return false;
1358
1374
  }
1375
+ update_fields(outcome);
1359
1376
  }
1360
1377
  // 5. named transition / action hook
1361
1378
  if (this._has_named_hooks) {
1362
1379
  if (wasAction) {
1363
- const nhn = named_hook_name(this._state, newState, newStateOrAction), outcome = AbstractHookStep(this._named_hooks.get(nhn), hook_args);
1380
+ const nhn = named_hook_name(this._state, newState, newStateOrAction), outcome = abstract_hook_step(this._named_hooks.get(nhn), hook_args);
1364
1381
  if (outcome.pass === false) {
1365
1382
  return false;
1366
1383
  }
1384
+ update_fields(outcome);
1367
1385
  }
1368
1386
  }
1369
1387
  // 6. regular hook
1370
1388
  if (this._has_basic_hooks) {
1371
- const hn = hook_name(this._state, newState), outcome = AbstractHookStep(this._hooks.get(hn), hook_args);
1389
+ const hn = hook_name(this._state, newState), outcome = abstract_hook_step(this._hooks.get(hn), hook_args);
1372
1390
  if (outcome.pass === false) {
1373
1391
  return false;
1374
1392
  }
1393
+ update_fields(outcome);
1375
1394
  }
1376
1395
  // 7. edge type hook
1377
1396
  // 7a. standard transition hook
1378
1397
  if (trans_type === 'legal') {
1379
- const outcome = AbstractHookStep(this._standard_transition_hook, hook_args);
1398
+ const outcome = abstract_hook_step(this._standard_transition_hook, hook_args);
1380
1399
  if (outcome.pass === false) {
1381
1400
  return false;
1382
1401
  }
1402
+ update_fields(outcome);
1383
1403
  }
1384
1404
  // 7b. main type hook
1385
1405
  if (trans_type === 'main') {
1386
- const outcome = AbstractHookStep(this._main_transition_hook, hook_args);
1406
+ const outcome = abstract_hook_step(this._main_transition_hook, hook_args);
1387
1407
  if (outcome.pass === false) {
1388
1408
  return false;
1389
1409
  }
1410
+ update_fields(outcome);
1390
1411
  }
1391
1412
  // 7c. forced transition hook
1392
1413
  if (trans_type === 'forced') {
1393
- const outcome = AbstractHookStep(this._forced_transition_hook, hook_args);
1414
+ const outcome = abstract_hook_step(this._forced_transition_hook, hook_args);
1394
1415
  if (outcome.pass === false) {
1395
1416
  return false;
1396
1417
  }
1418
+ update_fields(outcome);
1397
1419
  }
1398
1420
  // 8. entry hook
1399
1421
  if (this._has_entry_hooks) {
1400
- const outcome = AbstractHookStep(this._entry_hooks.get(newState), hook_args);
1422
+ const outcome = abstract_hook_step(this._entry_hooks.get(newState), hook_args);
1401
1423
  if (outcome.pass === false) {
1402
1424
  return false;
1403
1425
  }
1426
+ update_fields(outcome);
1404
1427
  }
1428
+ // all hooks passed! let's now establish the result
1405
1429
  this._state = newState;
1430
+ if (data_changed) {
1431
+ this._data = hook_args.data;
1432
+ }
1406
1433
  return true;
1407
1434
  // or without hooks
1408
1435
  }
@@ -1617,8 +1644,7 @@ function is_hook_rejection(hr) {
1617
1644
  }
1618
1645
  throw new TypeError('unknown hook rejection type result');
1619
1646
  }
1620
- // TODO hook_args: unknown
1621
- function AbstractHookStep(maybe_hook, hook_args) {
1647
+ function abstract_hook_step(maybe_hook, hook_args) {
1622
1648
  if (maybe_hook !== undefined) {
1623
1649
  const result = maybe_hook(hook_args);
1624
1650
  if (result === undefined) {
@@ -1630,9 +1656,9 @@ function AbstractHookStep(maybe_hook, hook_args) {
1630
1656
  if (result === false) {
1631
1657
  return { pass: false };
1632
1658
  }
1633
- // if (is_hook_complex_result(result)) {
1634
- // return result;
1635
- // }
1659
+ if (is_hook_complex_result(result)) {
1660
+ return result;
1661
+ }
1636
1662
  throw new TypeError(`Unknown hook result type ${result}`);
1637
1663
  }
1638
1664
  else {
@@ -1641,4 +1667,4 @@ function AbstractHookStep(maybe_hook, hook_args) {
1641
1667
  }
1642
1668
  export { version, transfer_state_properties, Machine, make, wrap_parse as parse, compile, sm, from, arrow_direction, arrow_left_kind, arrow_right_kind,
1643
1669
  // WHARGARBL TODO these should be exported to a utility library
1644
- seq, weighted_rand_select, histograph, weighted_sample_select, weighted_histo_key, shapes, gviz_shapes, named_colors, is_hook_rejection };
1670
+ 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 };
@@ -203,11 +203,11 @@ declare type HookComplexResult<mDT> = {
203
203
  state?: StateType;
204
204
  data?: mDT;
205
205
  };
206
- declare type HookResult = true | false | undefined | void;
206
+ declare type HookResult<mDT> = true | false | undefined | void | HookComplexResult<mDT>;
207
207
  declare type HookContext<mDT> = {
208
208
  data: mDT;
209
209
  };
210
- declare type HookHandler<mDT> = (hook_context: HookContext<mDT>) => HookResult;
210
+ declare type HookHandler<mDT> = (hook_context: HookContext<mDT>) => HookResult<mDT>;
211
211
  declare type JssmErrorExtendedInfo = {
212
212
  requested_state?: StateType | undefined;
213
213
  };
@@ -1,2 +1,2 @@
1
- const version = "5.72.3";
1
+ const version = "5.72.4";
2
2
  export { version };