jssm 5.72.1 → 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 +39 -42
- package/dist/es6/jssm.d.ts +26 -23
- package/dist/es6/jssm.js +102 -52
- package/dist/es6/jssm_types.d.ts +32 -23
- package/dist/es6/version.js +1 -1
- package/dist/jssm.es5.cjs.js +1 -1
- package/dist/jssm.es5.iife.js +1 -1
- package/jssm.d.ts +26 -23
- package/jssm_types.d.ts +32 -23
- package/package.json +1 -1
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
|
-
|
|
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
|
|
|
24
24
|
|
|
25
|
-
## [Untagged] - 6/
|
|
25
|
+
## [Untagged] - 6/25/2022 7:15:46 AM
|
|
26
26
|
|
|
27
|
-
Commit [
|
|
27
|
+
Commit [fb82aff27a911a29304c8b7c211e48c1b6ac454e](https://github.com/StoneCypher/jssm/commit/fb82aff27a911a29304c8b7c211e48c1b6ac454e)
|
|
28
28
|
|
|
29
29
|
Author: `John Haugeland <stonecypher@gmail.com>`
|
|
30
30
|
|
|
31
|
-
*
|
|
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
|
|
|
39
39
|
|
|
40
|
-
## [Untagged] - 6/
|
|
40
|
+
## [Untagged] - 6/25/2022 7:05:36 AM
|
|
41
41
|
|
|
42
|
-
Commit [
|
|
42
|
+
Commit [3ffc6c2a0b76d1a4870cd80a0f94d745e1c976c9](https://github.com/StoneCypher/jssm/commit/3ffc6c2a0b76d1a4870cd80a0f94d745e1c976c9)
|
|
43
43
|
|
|
44
44
|
Author: `John Haugeland <stonecypher@gmail.com>`
|
|
45
45
|
|
|
46
|
-
*
|
|
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
|
|
|
54
54
|
|
|
55
|
-
## [Untagged] - 6/
|
|
55
|
+
## [Untagged] - 6/25/2022 6:50:50 AM
|
|
56
56
|
|
|
57
|
-
Commit [
|
|
57
|
+
Commit [e74cb836ae9c06a3261658ee969506c8dd3c9a24](https://github.com/StoneCypher/jssm/commit/e74cb836ae9c06a3261658ee969506c8dd3c9a24)
|
|
58
58
|
|
|
59
59
|
Author: `John Haugeland <stonecypher@gmail.com>`
|
|
60
60
|
|
|
61
|
-
*
|
|
61
|
+
* six data kinds tested
|
|
62
62
|
|
|
63
63
|
|
|
64
64
|
|
|
@@ -67,15 +67,13 @@ Author: `John Haugeland <stonecypher@gmail.com>`
|
|
|
67
67
|
|
|
68
68
|
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
## [Untagged] - 6/24/2022 9:24:32 PM
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
Commit [093db23b719161e35e477cc0fe7d9f1132bc28b8](https://github.com/StoneCypher/jssm/commit/093db23b719161e35e477cc0fe7d9f1132bc28b8)
|
|
72
|
+
Commit [df34e0fd36d969bcb80488c6609d6bf4140b89a4](https://github.com/StoneCypher/jssm/commit/df34e0fd36d969bcb80488c6609d6bf4140b89a4)
|
|
75
73
|
|
|
76
74
|
Author: `John Haugeland <stonecypher@gmail.com>`
|
|
77
75
|
|
|
78
|
-
*
|
|
76
|
+
* working test matrix
|
|
79
77
|
|
|
80
78
|
|
|
81
79
|
|
|
@@ -84,15 +82,13 @@ Author: `John Haugeland <stonecypher@gmail.com>`
|
|
|
84
82
|
|
|
85
83
|
|
|
86
84
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
## [5.70.35] - 6/19/2022 10:56:41 AM
|
|
85
|
+
## [Untagged] - 6/24/2022 8:34:59 PM
|
|
90
86
|
|
|
91
|
-
Commit [
|
|
87
|
+
Commit [8db075dcd9a135e6757a11c5e497130bb3edb6a9](https://github.com/StoneCypher/jssm/commit/8db075dcd9a135e6757a11c5e497130bb3edb6a9)
|
|
92
88
|
|
|
93
89
|
Author: `John Haugeland <stonecypher@gmail.com>`
|
|
94
90
|
|
|
95
|
-
*
|
|
91
|
+
* Hooks now change data on basic transitions, moving to handle the rest
|
|
96
92
|
|
|
97
93
|
|
|
98
94
|
|
|
@@ -101,30 +97,33 @@ Author: `John Haugeland <stonecypher@gmail.com>`
|
|
|
101
97
|
|
|
102
98
|
|
|
103
99
|
|
|
104
|
-
|
|
100
|
+
<a name="5__72__3" />
|
|
101
|
+
|
|
102
|
+
## [5.72.3] - 6/24/2022 7:48:13 PM
|
|
105
103
|
|
|
106
|
-
Commit [
|
|
104
|
+
Commit [a1843247eb5c063910643f675f0a85764f3f3683](https://github.com/StoneCypher/jssm/commit/a1843247eb5c063910643f675f0a85764f3f3683)
|
|
107
105
|
|
|
108
106
|
Author: `John Haugeland <stonecypher@gmail.com>`
|
|
109
107
|
|
|
110
|
-
|
|
108
|
+
Merges [b0cbe1c, d52217a]
|
|
111
109
|
|
|
110
|
+
* Merge pull request #501 from StoneCypher/MovingToAbstractHooks
|
|
111
|
+
* Moving to abstract hooks
|
|
112
112
|
|
|
113
113
|
|
|
114
114
|
|
|
115
|
-
|
|
116
115
|
|
|
117
116
|
|
|
118
117
|
|
|
119
|
-
|
|
118
|
+
|
|
120
119
|
|
|
121
|
-
## [
|
|
120
|
+
## [Untagged] - 6/24/2022 7:44:55 PM
|
|
122
121
|
|
|
123
|
-
Commit [
|
|
122
|
+
Commit [d52217ab9dde2a5746cd0704597d337362057024](https://github.com/StoneCypher/jssm/commit/d52217ab9dde2a5746cd0704597d337362057024)
|
|
124
123
|
|
|
125
124
|
Author: `John Haugeland <stonecypher@gmail.com>`
|
|
126
125
|
|
|
127
|
-
*
|
|
126
|
+
* Basic conversion to abstract hooks complete; fixes StoneCypher/fsl#931
|
|
128
127
|
|
|
129
128
|
|
|
130
129
|
|
|
@@ -133,15 +132,13 @@ Author: `John Haugeland <stonecypher@gmail.com>`
|
|
|
133
132
|
|
|
134
133
|
|
|
135
134
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
## [5.70.33] - 6/18/2022 8:57:42 PM
|
|
135
|
+
## [Untagged] - 6/24/2022 7:36:27 PM
|
|
139
136
|
|
|
140
|
-
Commit [
|
|
137
|
+
Commit [adfa9069ba5e78d8a227896a5f7e14a8f4b80117](https://github.com/StoneCypher/jssm/commit/adfa9069ba5e78d8a227896a5f7e14a8f4b80117)
|
|
141
138
|
|
|
142
139
|
Author: `John Haugeland <stonecypher@gmail.com>`
|
|
143
140
|
|
|
144
|
-
*
|
|
141
|
+
* the conversion continues
|
|
145
142
|
|
|
146
143
|
|
|
147
144
|
|
|
@@ -150,15 +147,15 @@ Author: `John Haugeland <stonecypher@gmail.com>`
|
|
|
150
147
|
|
|
151
148
|
|
|
152
149
|
|
|
153
|
-
<a name="
|
|
150
|
+
<a name="5__72__2" />
|
|
154
151
|
|
|
155
|
-
## [5.
|
|
152
|
+
## [5.72.2] - 6/24/2022 5:49:06 PM
|
|
156
153
|
|
|
157
|
-
Commit [
|
|
154
|
+
Commit [b0cbe1c1ae0199c8d78a82f624e8ee94b344cf71](https://github.com/StoneCypher/jssm/commit/b0cbe1c1ae0199c8d78a82f624e8ee94b344cf71)
|
|
158
155
|
|
|
159
156
|
Author: `John Haugeland <stonecypher@gmail.com>`
|
|
160
157
|
|
|
161
|
-
*
|
|
158
|
+
* Normalize hook return pattern, fixes StoneCypher/fsl#930
|
|
162
159
|
|
|
163
160
|
|
|
164
161
|
|
|
@@ -167,12 +164,12 @@ Author: `John Haugeland <stonecypher@gmail.com>`
|
|
|
167
164
|
|
|
168
165
|
|
|
169
166
|
|
|
170
|
-
<a name="
|
|
167
|
+
<a name="5__72__1" />
|
|
171
168
|
|
|
172
|
-
## [5.
|
|
169
|
+
## [5.72.1] - 6/24/2022 4:55:33 PM
|
|
173
170
|
|
|
174
|
-
Commit [
|
|
171
|
+
Commit [547e35599ed312bf5300d3f1685e2cb16b80a73e](https://github.com/StoneCypher/jssm/commit/547e35599ed312bf5300d3f1685e2cb16b80a73e)
|
|
175
172
|
|
|
176
173
|
Author: `John Haugeland <stonecypher@gmail.com>`
|
|
177
174
|
|
|
178
|
-
*
|
|
175
|
+
* Can read data from outside, fixes StoneCypher/fsl#929
|
package/dist/es6/jssm.d.ts
CHANGED
|
@@ -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 } 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';
|
|
@@ -223,16 +223,16 @@ declare class Machine<mDT> {
|
|
|
223
223
|
_has_exit_hooks: boolean;
|
|
224
224
|
_has_global_action_hooks: boolean;
|
|
225
225
|
_has_transition_hooks: boolean;
|
|
226
|
-
_hooks: Map<string,
|
|
227
|
-
_named_hooks: Map<string,
|
|
228
|
-
_entry_hooks: Map<string,
|
|
229
|
-
_exit_hooks: Map<string,
|
|
230
|
-
_global_action_hooks: Map<string,
|
|
231
|
-
_any_action_hook: HookHandler | undefined;
|
|
232
|
-
_standard_transition_hook: HookHandler | undefined;
|
|
233
|
-
_main_transition_hook: HookHandler | undefined;
|
|
234
|
-
_forced_transition_hook: HookHandler | undefined;
|
|
235
|
-
_any_transition_hook: HookHandler | undefined;
|
|
226
|
+
_hooks: Map<string, HookHandler<mDT>>;
|
|
227
|
+
_named_hooks: Map<string, HookHandler<mDT>>;
|
|
228
|
+
_entry_hooks: Map<string, HookHandler<mDT>>;
|
|
229
|
+
_exit_hooks: Map<string, HookHandler<mDT>>;
|
|
230
|
+
_global_action_hooks: Map<string, HookHandler<mDT>>;
|
|
231
|
+
_any_action_hook: HookHandler<mDT> | undefined;
|
|
232
|
+
_standard_transition_hook: HookHandler<mDT> | undefined;
|
|
233
|
+
_main_transition_hook: HookHandler<mDT> | undefined;
|
|
234
|
+
_forced_transition_hook: HookHandler<mDT> | undefined;
|
|
235
|
+
_any_transition_hook: HookHandler<mDT> | undefined;
|
|
236
236
|
constructor({ start_states, complete, transitions, machine_author, machine_comment, machine_contributor, machine_definition, machine_language, machine_license, machine_name, machine_version, state_declaration, fsl_version, dot_preamble, arrange_declaration, arrange_start_declaration, arrange_end_declaration, theme, flow, graph_layout, instance_name, data }: JssmGenericConfig<mDT>);
|
|
237
237
|
/********
|
|
238
238
|
*
|
|
@@ -538,17 +538,17 @@ declare class Machine<mDT> {
|
|
|
538
538
|
is_complete(): boolean;
|
|
539
539
|
state_is_complete(whichState: StateType): boolean;
|
|
540
540
|
has_completes(): boolean;
|
|
541
|
-
set_hook(HookDesc: HookDescription): void;
|
|
542
|
-
hook(from: string, to: string, handler: HookHandler): Machine<mDT>;
|
|
543
|
-
hook_action(from: string, to: string, action: string, handler: HookHandler): Machine<mDT>;
|
|
544
|
-
hook_global_action(action: string, handler: HookHandler): Machine<mDT>;
|
|
545
|
-
hook_any_action(handler: HookHandler): Machine<mDT>;
|
|
546
|
-
hook_standard_transition(handler: HookHandler): Machine<mDT>;
|
|
547
|
-
hook_main_transition(handler: HookHandler): Machine<mDT>;
|
|
548
|
-
hook_forced_transition(handler: HookHandler): Machine<mDT>;
|
|
549
|
-
hook_any_transition(handler: HookHandler): Machine<mDT>;
|
|
550
|
-
hook_entry(to: string, handler: HookHandler): Machine<mDT>;
|
|
551
|
-
hook_exit(from: string, handler: HookHandler): Machine<mDT>;
|
|
541
|
+
set_hook(HookDesc: HookDescription<mDT>): void;
|
|
542
|
+
hook(from: string, to: string, handler: HookHandler<mDT>): Machine<mDT>;
|
|
543
|
+
hook_action(from: string, to: string, action: string, handler: HookHandler<mDT>): Machine<mDT>;
|
|
544
|
+
hook_global_action(action: string, handler: HookHandler<mDT>): Machine<mDT>;
|
|
545
|
+
hook_any_action(handler: HookHandler<mDT>): Machine<mDT>;
|
|
546
|
+
hook_standard_transition(handler: HookHandler<mDT>): Machine<mDT>;
|
|
547
|
+
hook_main_transition(handler: HookHandler<mDT>): Machine<mDT>;
|
|
548
|
+
hook_forced_transition(handler: HookHandler<mDT>): Machine<mDT>;
|
|
549
|
+
hook_any_transition(handler: HookHandler<mDT>): Machine<mDT>;
|
|
550
|
+
hook_entry(to: string, handler: HookHandler<mDT>): Machine<mDT>;
|
|
551
|
+
hook_exit(from: string, handler: HookHandler<mDT>): Machine<mDT>;
|
|
552
552
|
edges_between(from: string, to: string): JssmTransition<mDT>[];
|
|
553
553
|
transition_impl(newStateOrAction: StateType, newData: mDT | undefined, wasForced: boolean, wasAction: boolean): boolean;
|
|
554
554
|
/********
|
|
@@ -669,4 +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
|
-
|
|
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
|
@@ -1328,102 +1328,108 @@ class Machine {
|
|
|
1328
1328
|
newState = newStateOrAction;
|
|
1329
1329
|
}
|
|
1330
1330
|
}
|
|
1331
|
-
// todo whargarbl implement data stuff
|
|
1332
|
-
// todo major incomplete whargarbl comeback
|
|
1333
1331
|
if (valid) {
|
|
1334
1332
|
if (this._has_hooks) {
|
|
1335
|
-
const hook_args = {
|
|
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;
|
|
1336
1347
|
if (wasAction) {
|
|
1337
1348
|
// 1. any action hook
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
}
|
|
1349
|
+
const outcome = abstract_hook_step(this._any_action_hook, hook_args);
|
|
1350
|
+
if (outcome.pass === false) {
|
|
1351
|
+
return false;
|
|
1342
1352
|
}
|
|
1353
|
+
update_fields(outcome);
|
|
1343
1354
|
// 2. global specific action hook
|
|
1344
|
-
const
|
|
1345
|
-
if (
|
|
1346
|
-
|
|
1347
|
-
return false;
|
|
1348
|
-
}
|
|
1355
|
+
const outcome2 = abstract_hook_step(this._global_action_hooks.get(newStateOrAction), hook_args);
|
|
1356
|
+
if (outcome2.pass === false) {
|
|
1357
|
+
return false;
|
|
1349
1358
|
}
|
|
1359
|
+
update_fields(outcome2);
|
|
1350
1360
|
}
|
|
1351
1361
|
// 3. any transition hook
|
|
1352
1362
|
if (this._any_transition_hook !== undefined) {
|
|
1353
|
-
|
|
1363
|
+
const outcome = abstract_hook_step(this._any_transition_hook, hook_args);
|
|
1364
|
+
if (outcome.pass === false) {
|
|
1354
1365
|
return false;
|
|
1355
1366
|
}
|
|
1367
|
+
update_fields(outcome);
|
|
1356
1368
|
}
|
|
1357
1369
|
// 4. exit hook
|
|
1358
1370
|
if (this._has_exit_hooks) {
|
|
1359
|
-
const
|
|
1360
|
-
if (
|
|
1361
|
-
|
|
1362
|
-
return false;
|
|
1363
|
-
}
|
|
1371
|
+
const outcome = abstract_hook_step(this._exit_hooks.get(this._state), hook_args);
|
|
1372
|
+
if (outcome.pass === false) {
|
|
1373
|
+
return false;
|
|
1364
1374
|
}
|
|
1375
|
+
update_fields(outcome);
|
|
1365
1376
|
}
|
|
1366
1377
|
// 5. named transition / action hook
|
|
1367
1378
|
if (this._has_named_hooks) {
|
|
1368
1379
|
if (wasAction) {
|
|
1369
|
-
const nhn = named_hook_name(this._state, newState, newStateOrAction),
|
|
1370
|
-
if (
|
|
1371
|
-
|
|
1372
|
-
return false;
|
|
1373
|
-
}
|
|
1380
|
+
const nhn = named_hook_name(this._state, newState, newStateOrAction), outcome = abstract_hook_step(this._named_hooks.get(nhn), hook_args);
|
|
1381
|
+
if (outcome.pass === false) {
|
|
1382
|
+
return false;
|
|
1374
1383
|
}
|
|
1384
|
+
update_fields(outcome);
|
|
1375
1385
|
}
|
|
1376
1386
|
}
|
|
1377
1387
|
// 6. regular hook
|
|
1378
1388
|
if (this._has_basic_hooks) {
|
|
1379
|
-
const hn = hook_name(this._state, newState),
|
|
1380
|
-
if (
|
|
1381
|
-
|
|
1382
|
-
return false;
|
|
1383
|
-
}
|
|
1389
|
+
const hn = hook_name(this._state, newState), outcome = abstract_hook_step(this._hooks.get(hn), hook_args);
|
|
1390
|
+
if (outcome.pass === false) {
|
|
1391
|
+
return false;
|
|
1384
1392
|
}
|
|
1393
|
+
update_fields(outcome);
|
|
1385
1394
|
}
|
|
1386
1395
|
// 7. edge type hook
|
|
1387
1396
|
// 7a. standard transition hook
|
|
1388
1397
|
if (trans_type === 'legal') {
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
if (this._standard_transition_hook(hook_args) === false) {
|
|
1393
|
-
return false;
|
|
1394
|
-
}
|
|
1398
|
+
const outcome = abstract_hook_step(this._standard_transition_hook, hook_args);
|
|
1399
|
+
if (outcome.pass === false) {
|
|
1400
|
+
return false;
|
|
1395
1401
|
}
|
|
1402
|
+
update_fields(outcome);
|
|
1396
1403
|
}
|
|
1397
1404
|
// 7b. main type hook
|
|
1398
1405
|
if (trans_type === 'main') {
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
if (this._main_transition_hook(hook_args) === false) {
|
|
1403
|
-
return false;
|
|
1404
|
-
}
|
|
1406
|
+
const outcome = abstract_hook_step(this._main_transition_hook, hook_args);
|
|
1407
|
+
if (outcome.pass === false) {
|
|
1408
|
+
return false;
|
|
1405
1409
|
}
|
|
1410
|
+
update_fields(outcome);
|
|
1406
1411
|
}
|
|
1407
1412
|
// 7c. forced transition hook
|
|
1408
1413
|
if (trans_type === 'forced') {
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
if (this._forced_transition_hook(hook_args) === false) {
|
|
1413
|
-
return false;
|
|
1414
|
-
}
|
|
1414
|
+
const outcome = abstract_hook_step(this._forced_transition_hook, hook_args);
|
|
1415
|
+
if (outcome.pass === false) {
|
|
1416
|
+
return false;
|
|
1415
1417
|
}
|
|
1418
|
+
update_fields(outcome);
|
|
1416
1419
|
}
|
|
1417
1420
|
// 8. entry hook
|
|
1418
1421
|
if (this._has_entry_hooks) {
|
|
1419
|
-
const
|
|
1420
|
-
if (
|
|
1421
|
-
|
|
1422
|
-
return false;
|
|
1423
|
-
}
|
|
1422
|
+
const outcome = abstract_hook_step(this._entry_hooks.get(newState), hook_args);
|
|
1423
|
+
if (outcome.pass === false) {
|
|
1424
|
+
return false;
|
|
1424
1425
|
}
|
|
1426
|
+
update_fields(outcome);
|
|
1425
1427
|
}
|
|
1428
|
+
// all hooks passed! let's now establish the result
|
|
1426
1429
|
this._state = newState;
|
|
1430
|
+
if (data_changed) {
|
|
1431
|
+
this._data = hook_args.data;
|
|
1432
|
+
}
|
|
1427
1433
|
return true;
|
|
1428
1434
|
// or without hooks
|
|
1429
1435
|
}
|
|
@@ -1615,6 +1621,50 @@ function from(MachineAsString, ExtraConstructorFields) {
|
|
|
1615
1621
|
}
|
|
1616
1622
|
return new Machine(to_decorate);
|
|
1617
1623
|
}
|
|
1624
|
+
function is_hook_complex_result(hr) {
|
|
1625
|
+
if (typeof hr === 'object') {
|
|
1626
|
+
if (typeof hr.pass === 'boolean') {
|
|
1627
|
+
return true;
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
return false;
|
|
1631
|
+
}
|
|
1632
|
+
function is_hook_rejection(hr) {
|
|
1633
|
+
if (hr === true) {
|
|
1634
|
+
return false;
|
|
1635
|
+
}
|
|
1636
|
+
if (hr === undefined) {
|
|
1637
|
+
return false;
|
|
1638
|
+
}
|
|
1639
|
+
if (hr === false) {
|
|
1640
|
+
return true;
|
|
1641
|
+
}
|
|
1642
|
+
if (is_hook_complex_result(hr)) {
|
|
1643
|
+
return (!(hr.pass));
|
|
1644
|
+
}
|
|
1645
|
+
throw new TypeError('unknown hook rejection type result');
|
|
1646
|
+
}
|
|
1647
|
+
function abstract_hook_step(maybe_hook, hook_args) {
|
|
1648
|
+
if (maybe_hook !== undefined) {
|
|
1649
|
+
const result = maybe_hook(hook_args);
|
|
1650
|
+
if (result === undefined) {
|
|
1651
|
+
return { pass: true };
|
|
1652
|
+
}
|
|
1653
|
+
if (result === true) {
|
|
1654
|
+
return { pass: true };
|
|
1655
|
+
}
|
|
1656
|
+
if (result === false) {
|
|
1657
|
+
return { pass: false };
|
|
1658
|
+
}
|
|
1659
|
+
if (is_hook_complex_result(result)) {
|
|
1660
|
+
return result;
|
|
1661
|
+
}
|
|
1662
|
+
throw new TypeError(`Unknown hook result type ${result}`);
|
|
1663
|
+
}
|
|
1664
|
+
else {
|
|
1665
|
+
return { pass: true };
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1618
1668
|
export { version, transfer_state_properties, Machine, make, wrap_parse as parse, compile, sm, from, arrow_direction, arrow_left_kind, arrow_right_kind,
|
|
1619
1669
|
// WHARGARBL TODO these should be exported to a utility library
|
|
1620
|
-
seq, weighted_rand_select, histograph, weighted_sample_select, weighted_histo_key, shapes, gviz_shapes, named_colors };
|
|
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 };
|
package/dist/es6/jssm_types.d.ts
CHANGED
|
@@ -149,57 +149,66 @@ declare type JssmCompileSeStart<DataType> = {
|
|
|
149
149
|
};
|
|
150
150
|
declare type JssmParseTree = Array<JssmCompileSeStart<StateType>>;
|
|
151
151
|
declare type JssmParseFunctionType = (string: any) => JssmParseTree;
|
|
152
|
-
declare type
|
|
153
|
-
declare type BasicHookDescription = {
|
|
152
|
+
declare type BasicHookDescription<mDT> = {
|
|
154
153
|
kind: 'hook';
|
|
155
154
|
from: string;
|
|
156
155
|
to: string;
|
|
157
|
-
handler: HookHandler
|
|
156
|
+
handler: HookHandler<mDT>;
|
|
158
157
|
};
|
|
159
|
-
declare type HookDescriptionWithAction = {
|
|
158
|
+
declare type HookDescriptionWithAction<mDT> = {
|
|
160
159
|
kind: 'named';
|
|
161
160
|
from: string;
|
|
162
161
|
to: string;
|
|
163
162
|
action: string;
|
|
164
|
-
handler: HookHandler
|
|
163
|
+
handler: HookHandler<mDT>;
|
|
165
164
|
};
|
|
166
|
-
declare type StandardTransitionHook = {
|
|
165
|
+
declare type StandardTransitionHook<mDT> = {
|
|
167
166
|
kind: 'standard transition';
|
|
168
|
-
handler: HookHandler
|
|
167
|
+
handler: HookHandler<mDT>;
|
|
169
168
|
};
|
|
170
|
-
declare type MainTransitionHook = {
|
|
169
|
+
declare type MainTransitionHook<mDT> = {
|
|
171
170
|
kind: 'main transition';
|
|
172
|
-
handler: HookHandler
|
|
171
|
+
handler: HookHandler<mDT>;
|
|
173
172
|
};
|
|
174
|
-
declare type ForcedTransitionHook = {
|
|
173
|
+
declare type ForcedTransitionHook<mDT> = {
|
|
175
174
|
kind: 'forced transition';
|
|
176
|
-
handler: HookHandler
|
|
175
|
+
handler: HookHandler<mDT>;
|
|
177
176
|
};
|
|
178
|
-
declare type AnyTransitionHook = {
|
|
177
|
+
declare type AnyTransitionHook<mDT> = {
|
|
179
178
|
kind: 'any transition';
|
|
180
|
-
handler: HookHandler
|
|
179
|
+
handler: HookHandler<mDT>;
|
|
181
180
|
};
|
|
182
|
-
declare type GlobalActionHook = {
|
|
181
|
+
declare type GlobalActionHook<mDT> = {
|
|
183
182
|
kind: 'global action';
|
|
184
183
|
action: string;
|
|
185
|
-
handler: HookHandler
|
|
184
|
+
handler: HookHandler<mDT>;
|
|
186
185
|
};
|
|
187
|
-
declare type AnyActionHook = {
|
|
186
|
+
declare type AnyActionHook<mDT> = {
|
|
188
187
|
kind: 'any action';
|
|
189
|
-
handler: HookHandler
|
|
188
|
+
handler: HookHandler<mDT>;
|
|
190
189
|
};
|
|
191
|
-
declare type EntryHook = {
|
|
190
|
+
declare type EntryHook<mDT> = {
|
|
192
191
|
kind: 'entry';
|
|
193
192
|
to: string;
|
|
194
|
-
handler: HookHandler
|
|
193
|
+
handler: HookHandler<mDT>;
|
|
195
194
|
};
|
|
196
|
-
declare type ExitHook = {
|
|
195
|
+
declare type ExitHook<mDT> = {
|
|
197
196
|
kind: 'exit';
|
|
198
197
|
from: string;
|
|
199
|
-
handler: HookHandler
|
|
198
|
+
handler: HookHandler<mDT>;
|
|
200
199
|
};
|
|
201
|
-
declare type HookDescription = BasicHookDescription | HookDescriptionWithAction | GlobalActionHook | AnyActionHook | StandardTransitionHook | MainTransitionHook | ForcedTransitionHook | AnyTransitionHook | EntryHook | ExitHook
|
|
200
|
+
declare type HookDescription<mDT> = BasicHookDescription<mDT> | HookDescriptionWithAction<mDT> | GlobalActionHook<mDT> | AnyActionHook<mDT> | StandardTransitionHook<mDT> | MainTransitionHook<mDT> | ForcedTransitionHook<mDT> | AnyTransitionHook<mDT> | EntryHook<mDT> | ExitHook<mDT>;
|
|
201
|
+
declare type HookComplexResult<mDT> = {
|
|
202
|
+
pass: boolean;
|
|
203
|
+
state?: StateType;
|
|
204
|
+
data?: mDT;
|
|
205
|
+
};
|
|
206
|
+
declare type HookResult<mDT> = true | false | undefined | void | HookComplexResult<mDT>;
|
|
207
|
+
declare type HookContext<mDT> = {
|
|
208
|
+
data: mDT;
|
|
209
|
+
};
|
|
210
|
+
declare type HookHandler<mDT> = (hook_context: HookContext<mDT>) => HookResult<mDT>;
|
|
202
211
|
declare type JssmErrorExtendedInfo = {
|
|
203
212
|
requested_state?: StateType | undefined;
|
|
204
213
|
};
|
|
205
|
-
export { JssmColor, JssmTransition, JssmTransitions, JssmTransitionList, JssmTransitionRule, JssmArrow, JssmArrowKind, JssmArrowDirection, JssmGenericConfig, JssmGenericState, JssmGenericMachine, JssmParseTree, JssmCompileSe, JssmCompileSeStart, JssmCompileRule, JssmPermitted, JssmPermittedOpt, JssmResult, JssmStateDeclaration, JssmStateDeclarationRule, JssmLayout, JssmParseFunctionType, JssmMachineInternalState, JssmErrorExtendedInfo, FslDirection, FslTheme, HookDescription, HookHandler };
|
|
214
|
+
export { JssmColor, JssmTransition, JssmTransitions, JssmTransitionList, JssmTransitionRule, JssmArrow, JssmArrowKind, JssmArrowDirection, JssmGenericConfig, JssmGenericState, JssmGenericMachine, JssmParseTree, JssmCompileSe, JssmCompileSeStart, JssmCompileRule, JssmPermitted, JssmPermittedOpt, JssmResult, JssmStateDeclaration, JssmStateDeclarationRule, JssmLayout, JssmParseFunctionType, JssmMachineInternalState, JssmErrorExtendedInfo, FslDirection, FslTheme, HookDescription, HookHandler, HookContext, HookResult, HookComplexResult };
|
package/dist/es6/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const version = "5.72.
|
|
1
|
+
const version = "5.72.4";
|
|
2
2
|
export { version };
|