jssm 5.72.3 → 5.73.0

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
+ 933 merges; 122 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__5">5.72.5</a>, <a href="#5__72__4">5.72.4</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>
16
16
 
17
17
 
18
18
 
@@ -22,13 +22,18 @@ Published tags:
22
22
 
23
23
  &nbsp;
24
24
 
25
- ## [Untagged] - 6/24/2022 7:36:27 PM
25
+ <a name="5__72__5" />
26
26
 
27
- Commit [adfa9069ba5e78d8a227896a5f7e14a8f4b80117](https://github.com/StoneCypher/jssm/commit/adfa9069ba5e78d8a227896a5f7e14a8f4b80117)
27
+ ## [5.72.5] - 6/25/2022 11:07:29 AM
28
+
29
+ Commit [f1a61f1e967df66b87f2b6b39f75636659f496e9](https://github.com/StoneCypher/jssm/commit/f1a61f1e967df66b87f2b6b39f75636659f496e9)
28
30
 
29
31
  Author: `John Haugeland <stonecypher@gmail.com>`
30
32
 
31
- * the conversion continues
33
+ Merges [dc3096f, 751c5fd]
34
+
35
+ * Merge pull request #503 from StoneCypher/AttemptToCaptureTestResults
36
+ * Captures test results, fixes StoneCypher/fsl#944, tools readme, fixes StoneCypher/fsl#736
32
37
 
33
38
 
34
39
 
@@ -37,13 +42,13 @@ Author: `John Haugeland <stonecypher@gmail.com>`
37
42
 
38
43
  &nbsp;
39
44
 
40
- ## [Untagged] - 6/24/2022 5:49:06 PM
45
+ ## [Untagged] - 6/25/2022 11:04:20 AM
41
46
 
42
- Commit [b0cbe1c1ae0199c8d78a82f624e8ee94b344cf71](https://github.com/StoneCypher/jssm/commit/b0cbe1c1ae0199c8d78a82f624e8ee94b344cf71)
47
+ Commit [751c5fd0cc8c9751331e664e8f51af34f736ce31](https://github.com/StoneCypher/jssm/commit/751c5fd0cc8c9751331e664e8f51af34f736ce31)
43
48
 
44
49
  Author: `John Haugeland <stonecypher@gmail.com>`
45
50
 
46
- * Normalize hook return pattern, fixes StoneCypher/fsl#930
51
+ * Captures test results, fixes StoneCypher/fsl#944, tools readme, fixes StoneCypher/fsl#736
47
52
 
48
53
 
49
54
 
@@ -52,13 +57,18 @@ Author: `John Haugeland <stonecypher@gmail.com>`
52
57
 
53
58
  &nbsp;
54
59
 
55
- ## [Untagged] - 6/24/2022 4:55:33 PM
60
+ <a name="5__72__4" />
56
61
 
57
- Commit [547e35599ed312bf5300d3f1685e2cb16b80a73e](https://github.com/StoneCypher/jssm/commit/547e35599ed312bf5300d3f1685e2cb16b80a73e)
62
+ ## [5.72.4] - 6/25/2022 8:12:11 AM
63
+
64
+ Commit [dc3096f064e58ea616899b12d3d25c973f326c1c](https://github.com/StoneCypher/jssm/commit/dc3096f064e58ea616899b12d3d25c973f326c1c)
58
65
 
59
66
  Author: `John Haugeland <stonecypher@gmail.com>`
60
67
 
61
- * Can read data from outside, fixes StoneCypher/fsl#929
68
+ Merges [a184324, 8762d17]
69
+
70
+ * Merge pull request #502 from StoneCypher/AllowHooksToChangeData
71
+ * Allow hooks to change data
62
72
 
63
73
 
64
74
 
@@ -67,13 +77,13 @@ Author: `John Haugeland <stonecypher@gmail.com>`
67
77
 
68
78
  &nbsp;
69
79
 
70
- ## [Untagged] - 6/24/2022 4:08:35 PM
80
+ ## [Untagged] - 6/25/2022 8:08:38 AM
71
81
 
72
- Commit [a1c43e9f65f2fd8e856a2544f7c3056b4c06d9d3](https://github.com/StoneCypher/jssm/commit/a1c43e9f65f2fd8e856a2544f7c3056b4c06d9d3)
82
+ Commit [8762d17bd69cdf48f522dbd6ee188f46e29a0c06](https://github.com/StoneCypher/jssm/commit/8762d17bd69cdf48f522dbd6ee188f46e29a0c06)
73
83
 
74
84
  Author: `John Haugeland <stonecypher@gmail.com>`
75
85
 
76
- * First steps towards being a Moore machine - initial data in constructor fixes StoneCypher/fsl#923 , can read in hooks fixes StoneCypher/fsl#924
86
+ * Hooks can change data, fixes StoneCypher/fsl#932
77
87
 
78
88
 
79
89
 
@@ -82,13 +92,13 @@ Author: `John Haugeland <stonecypher@gmail.com>`
82
92
 
83
93
  &nbsp;
84
94
 
85
- ## [Untagged] - 6/23/2022 6:34:38 PM
95
+ ## [Untagged] - 6/25/2022 7:15:46 AM
86
96
 
87
- Commit [1dc7c24bfb651eec57fddc902f78db796f71a6c5](https://github.com/StoneCypher/jssm/commit/1dc7c24bfb651eec57fddc902f78db796f71a6c5)
97
+ Commit [fb82aff27a911a29304c8b7c211e48c1b6ac454e](https://github.com/StoneCypher/jssm/commit/fb82aff27a911a29304c8b7c211e48c1b6ac454e)
88
98
 
89
99
  Author: `John Haugeland <stonecypher@gmail.com>`
90
100
 
91
- * Small documentation tweaks. First attempt to lodge on deno.land
101
+ * prepping to test main and forced
92
102
 
93
103
 
94
104
 
@@ -97,13 +107,13 @@ Author: `John Haugeland <stonecypher@gmail.com>`
97
107
 
98
108
  &nbsp;
99
109
 
100
- ## [Untagged] - 6/23/2022 1:41:18 PM
110
+ ## [Untagged] - 6/25/2022 7:05:36 AM
101
111
 
102
- Commit [67c3240798d31933413aab27db7ea9fbb5de3b2a](https://github.com/StoneCypher/jssm/commit/67c3240798d31933413aab27db7ea9fbb5de3b2a)
112
+ Commit [3ffc6c2a0b76d1a4870cd80a0f94d745e1c976c9](https://github.com/StoneCypher/jssm/commit/3ffc6c2a0b76d1a4870cd80a0f94d745e1c976c9)
103
113
 
104
114
  Author: `John Haugeland <stonecypher@gmail.com>`
105
115
 
106
- * Normalize arguments to hooks, fixes StoneCypher/fsl#895; more docs
116
+ * everything now tested but standard and main
107
117
 
108
118
 
109
119
 
@@ -112,15 +122,13 @@ Author: `John Haugeland <stonecypher@gmail.com>`
112
122
 
113
123
  &nbsp;
114
124
 
115
- <a name="5__70__36" />
125
+ ## [Untagged] - 6/25/2022 6:50:50 AM
116
126
 
117
- ## [5.70.36] - 6/21/2022 6:53:36 PM
118
-
119
- Commit [093db23b719161e35e477cc0fe7d9f1132bc28b8](https://github.com/StoneCypher/jssm/commit/093db23b719161e35e477cc0fe7d9f1132bc28b8)
127
+ Commit [e74cb836ae9c06a3261658ee969506c8dd3c9a24](https://github.com/StoneCypher/jssm/commit/e74cb836ae9c06a3261658ee969506c8dd3c9a24)
120
128
 
121
129
  Author: `John Haugeland <stonecypher@gmail.com>`
122
130
 
123
- * Another trivial build - this one to cause chain publishment
131
+ * six data kinds tested
124
132
 
125
133
 
126
134
 
@@ -129,15 +137,13 @@ Author: `John Haugeland <stonecypher@gmail.com>`
129
137
 
130
138
  &nbsp;
131
139
 
132
- <a name="5__70__35" />
133
-
134
- ## [5.70.35] - 6/19/2022 10:56:41 AM
140
+ ## [Untagged] - 6/24/2022 9:24:32 PM
135
141
 
136
- Commit [13ee9eb71ca9ab868699e535abf6ba30c8ad5829](https://github.com/StoneCypher/jssm/commit/13ee9eb71ca9ab868699e535abf6ba30c8ad5829)
142
+ Commit [df34e0fd36d969bcb80488c6609d6bf4140b89a4](https://github.com/StoneCypher/jssm/commit/df34e0fd36d969bcb80488c6609d6bf4140b89a4)
137
143
 
138
144
  Author: `John Haugeland <stonecypher@gmail.com>`
139
145
 
140
- * new trigger with replaced token - this time with a bump
146
+ * working test matrix
141
147
 
142
148
 
143
149
 
@@ -146,13 +152,13 @@ Author: `John Haugeland <stonecypher@gmail.com>`
146
152
 
147
153
  &nbsp;
148
154
 
149
- ## [Untagged] - 6/19/2022 10:37:04 AM
155
+ ## [Untagged] - 6/24/2022 8:34:59 PM
150
156
 
151
- Commit [b3e69d9745b92d845bedcfbc08f342997137af3d](https://github.com/StoneCypher/jssm/commit/b3e69d9745b92d845bedcfbc08f342997137af3d)
157
+ Commit [8db075dcd9a135e6757a11c5e497130bb3edb6a9](https://github.com/StoneCypher/jssm/commit/8db075dcd9a135e6757a11c5e497130bb3edb6a9)
152
158
 
153
159
  Author: `John Haugeland <stonecypher@gmail.com>`
154
160
 
155
- * new trigger with replaced token
161
+ * Hooks now change data on basic transitions, moving to handle the rest
156
162
 
157
163
 
158
164
 
@@ -161,12 +167,15 @@ Author: `John Haugeland <stonecypher@gmail.com>`
161
167
 
162
168
  &nbsp;
163
169
 
164
- <a name="5__70__34" />
170
+ <a name="5__72__3" />
165
171
 
166
- ## [5.70.34] - 6/18/2022 9:40:31 PM
172
+ ## [5.72.3] - 6/24/2022 7:48:13 PM
167
173
 
168
- Commit [a0f295f060c7f08a8b10b2208dd1c95dc7f3c97a](https://github.com/StoneCypher/jssm/commit/a0f295f060c7f08a8b10b2208dd1c95dc7f3c97a)
174
+ Commit [a1843247eb5c063910643f675f0a85764f3f3683](https://github.com/StoneCypher/jssm/commit/a1843247eb5c063910643f675f0a85764f3f3683)
169
175
 
170
176
  Author: `John Haugeland <stonecypher@gmail.com>`
171
177
 
172
- * another trigger commit with mild doc extension
178
+ Merges [b0cbe1c, d52217a]
179
+
180
+ * Merge pull request #501 from StoneCypher/MovingToAbstractHooks
181
+ * Moving to abstract hooks
package/README.md CHANGED
@@ -1,8 +1,31 @@
1
+ <!--
2
+
3
+ I8, 8 ,8I 88
4
+ `8b d8b d8' ""
5
+ "8, ,8"8, ,8"
6
+ Y8 8P Y8 8P ,adPPYYba, 8b,dPPYba, 8b,dPPYba, 88 8b,dPPYba, ,adPPYb,d8
7
+ `8b d8' `8b d8' "" `Y8 88P' "Y8 88P' `"8a 88 88P' `"8a a8" `Y88
8
+ `8a a8' `8a a8' ,adPPPPP88 88 88 88 88 88 88 8b 88
9
+ `8a8' `8a8' 88, ,88 88 88 88 88 88 88 "8a, ,d88
10
+ `8' `8' `"8bbdP"Y8 88 88 88 88 88 88 `"YbbdP"Y8
11
+ aa, ,88
12
+ "Y8bbdP"
13
+
14
+ This file is generated. If you edit it, the edits ***will be lost***.
15
+ ----------------------
16
+
17
+ Please edit the file it's derived from, instead: `./src/md/readme_base.md`
18
+
19
+
20
+
21
+ * Generated for version 5.73.0 at 6/27/2022, 2:27:29 AM
22
+
23
+ -->
1
24
  # jssm
2
25
 
3
26
  Easy. Small. Fast. TS, es6, es5. Node, Browser. 100% coverage. Property
4
27
  tests. Fuzz tests. Language tests for a dozen languages and emoji. Easy to
5
- share online. Easy to embed.
28
+ share online. Easy to embed. ***4,617 tests***.
6
29
 
7
30
  Readable, useful state machines as one-liner strings.
8
31
 
@@ -1,6 +1,7 @@
1
1
  declare type StateType = string;
2
+ import { circular_buffer } from 'circular_buffer_js';
2
3
  import { JssmGenericState, JssmGenericConfig, JssmTransition, JssmTransitionList, // JssmTransitionRule,
3
- JssmMachineInternalState, JssmParseTree, JssmStateDeclaration, JssmArrow, JssmArrowDirection, JssmArrowKind, JssmLayout, FslDirection, FslTheme, HookDescription, HookHandler, HookResult } from './jssm_types';
4
+ JssmMachineInternalState, JssmParseTree, JssmStateDeclaration, JssmArrow, JssmArrowDirection, JssmArrowKind, JssmLayout, FslDirection, FslTheme, HookDescription, HookHandler, HookContext, HookResult, HookComplexResult } from './jssm_types';
4
5
  import { seq, weighted_rand_select, weighted_sample_select, histograph, weighted_histo_key } from './jssm_util';
5
6
  import { shapes, gviz_shapes, named_colors } from './jssm_constants';
6
7
  import { version } from './version';
@@ -233,7 +234,9 @@ declare class Machine<mDT> {
233
234
  _main_transition_hook: HookHandler<mDT> | undefined;
234
235
  _forced_transition_hook: HookHandler<mDT> | undefined;
235
236
  _any_transition_hook: HookHandler<mDT> | undefined;
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
+ _history: circular_buffer<[StateType, mDT]>;
238
+ _history_length: number;
239
+ 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, history, data }: JssmGenericConfig<mDT>);
237
240
  /********
238
241
  *
239
242
  * Internal method for fabricating states. Not meant for external use.
@@ -551,6 +554,88 @@ declare class Machine<mDT> {
551
554
  hook_exit(from: string, handler: HookHandler<mDT>): Machine<mDT>;
552
555
  edges_between(from: string, to: string): JssmTransition<mDT>[];
553
556
  transition_impl(newStateOrAction: StateType, newData: mDT | undefined, wasForced: boolean, wasAction: boolean): boolean;
557
+ /*********
558
+ *
559
+ * Get a truncated history of the recent states and data of the machine.
560
+ * Turned off by default; configure with `.from('...', {data: 5})` by length,
561
+ * or set `.history_length` at runtime.
562
+ *
563
+ * History *does not contain the current state*. If you want that, call
564
+ * `.history_inclusive` instead.
565
+ *
566
+ * ```typescript
567
+ * const foo = jssm.from(
568
+ * "a 'next' -> b 'next' -> c 'next' -> d 'next' -> e;",
569
+ * { history: 3 }
570
+ * );
571
+ *
572
+ * foo.action('next');
573
+ * foo.action('next');
574
+ * foo.action('next');
575
+ * foo.action('next');
576
+ *
577
+ * foo.history; // [ ['b',undefined], ['c',undefined], ['d',undefined] ]
578
+ * ```
579
+ *
580
+ * Notice that the machine's current state, `e`, is not in the returned list.
581
+ *
582
+ * @typeparam mDT The type of the machine data member; usually omitted
583
+ *
584
+ */
585
+ get history(): [string, mDT][];
586
+ /*********
587
+ *
588
+ * Get a truncated history of the recent states and data of the machine,
589
+ * including the current state. Turned off by default; configure with
590
+ * `.from('...', {data: 5})` by length, or set `.history_length` at runtime.
591
+ *
592
+ * History inclusive contains the current state. If you only want past
593
+ * states, call `.history` instead.
594
+ *
595
+ * The list returned will be one longer than the history buffer kept, as the
596
+ * history buffer kept gets the current state added to it to produce this
597
+ * list.
598
+ *
599
+ * ```typescript
600
+ * const foo = jssm.from(
601
+ * "a 'next' -> b 'next' -> c 'next' -> d 'next' -> e;",
602
+ * { history: 3 }
603
+ * );
604
+ *
605
+ * foo.action('next');
606
+ * foo.action('next');
607
+ * foo.action('next');
608
+ * foo.action('next');
609
+ *
610
+ * foo.history_inclusive; // [ ['b',undefined], ['c',undefined], ['d',undefined], ['e',undefined] ]
611
+ * ```
612
+ *
613
+ * Notice that the machine's current state, `e`, is in the returned list.
614
+ *
615
+ * @typeparam mDT The type of the machine data member; usually omitted
616
+ *
617
+ */
618
+ get history_inclusive(): [string, mDT][];
619
+ /*********
620
+ *
621
+ * Find out how long a history this machine is keeping. Defaults to zero.
622
+ * Settable directly.
623
+ *
624
+ * ```typescript
625
+ * const foo = jssm.from("a -> b;");
626
+ * foo.history_length; // 0
627
+ *
628
+ * const bar = jssm.from("a -> b;", { history: 3 });
629
+ * foo.history_length; // 3
630
+ * foo.history_length = 5;
631
+ * foo.history_length; // 5
632
+ * ```
633
+ *
634
+ * @typeparam mDT The type of the machine data member; usually omitted
635
+ *
636
+ */
637
+ get history_length(): number;
638
+ set history_length(to: number);
554
639
  /********
555
640
  *
556
641
  * Instruct the machine to complete an action.
@@ -669,5 +754,7 @@ declare function sm<mDT>(template_strings: TemplateStringsArray, ...remainder: a
669
754
  *
670
755
  */
671
756
  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 };
757
+ declare function is_hook_complex_result<mDT>(hr: unknown): hr is HookComplexResult<mDT>;
758
+ declare function is_hook_rejection<mDT>(hr: HookResult<mDT>): boolean;
759
+ declare function abstract_hook_step<mDT>(maybe_hook: HookHandler<mDT> | undefined, hook_args: HookContext<mDT>): HookComplexResult<mDT>;
760
+ 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
@@ -1,5 +1,6 @@
1
1
  // whargarbl lots of these return arrays could/should be sets
2
2
  import { reduce as reduce_to_639 } from 'reduce-to-639-1';
3
+ import { circular_buffer } from 'circular_buffer_js';
3
4
  import { seq, weighted_rand_select, weighted_sample_select, histograph, weighted_histo_key, array_box_if_string, hook_name, named_hook_name } from './jssm_util';
4
5
  import { shapes, gviz_shapes, named_colors } from './jssm_constants';
5
6
  import { parse } from './jssm-dot';
@@ -534,7 +535,7 @@ function transfer_state_properties(state_decl) {
534
535
  // TODO add a lotta docblock here
535
536
  class Machine {
536
537
  // whargarbl this badly needs to be broken up, monolith master
537
- 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 = undefined, arrange_declaration = [], arrange_start_declaration = [], arrange_end_declaration = [], theme = 'default', flow = 'down', graph_layout = 'dot', instance_name, data }) {
538
+ 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 = undefined, arrange_declaration = [], arrange_start_declaration = [], arrange_end_declaration = [], theme = 'default', flow = 'down', graph_layout = 'dot', instance_name, history, data }) {
538
539
  this._instance_name = instance_name;
539
540
  this._state = start_states[0];
540
541
  this._states = new Map();
@@ -582,6 +583,8 @@ class Machine {
582
583
  this._any_transition_hook = undefined;
583
584
  this._standard_transition_hook = undefined;
584
585
  this._data = data;
586
+ this._history_length = history || 0;
587
+ this._history = new circular_buffer(this._history_length);
585
588
  if (state_declaration) {
586
589
  state_declaration.map((state_decl) => {
587
590
  if (this._state_declarations.has(state_decl.state)) { // no repeats
@@ -1330,83 +1333,116 @@ class Machine {
1330
1333
  }
1331
1334
  if (valid) {
1332
1335
  if (this._has_hooks) {
1333
- const hook_args = { data: this._data, action: fromAction, from: this._state, to: newState, forced: wasForced };
1336
+ const hook_args = {
1337
+ data: this._data,
1338
+ action: fromAction,
1339
+ from: this._state,
1340
+ to: newState,
1341
+ forced: wasForced
1342
+ };
1343
+ function update_fields(res) {
1344
+ if (res.hasOwnProperty('data')) {
1345
+ hook_args.data = res.data;
1346
+ data_changed = true;
1347
+ }
1348
+ }
1349
+ let data_changed = false;
1334
1350
  if (wasAction) {
1335
1351
  // 1. any action hook
1336
- const outcome = AbstractHookStep(this._any_action_hook, hook_args);
1352
+ const outcome = abstract_hook_step(this._any_action_hook, hook_args);
1337
1353
  if (outcome.pass === false) {
1338
1354
  return false;
1339
1355
  }
1356
+ update_fields(outcome);
1340
1357
  // 2. global specific action hook
1341
- const outcome2 = AbstractHookStep(this._global_action_hooks.get(newStateOrAction), hook_args);
1358
+ const outcome2 = abstract_hook_step(this._global_action_hooks.get(newStateOrAction), hook_args);
1342
1359
  if (outcome2.pass === false) {
1343
1360
  return false;
1344
1361
  }
1362
+ update_fields(outcome2);
1345
1363
  }
1346
1364
  // 3. any transition hook
1347
1365
  if (this._any_transition_hook !== undefined) {
1348
- const outcome = AbstractHookStep(this._any_transition_hook, hook_args);
1366
+ const outcome = abstract_hook_step(this._any_transition_hook, hook_args);
1349
1367
  if (outcome.pass === false) {
1350
1368
  return false;
1351
1369
  }
1370
+ update_fields(outcome);
1352
1371
  }
1353
1372
  // 4. exit hook
1354
1373
  if (this._has_exit_hooks) {
1355
- const outcome = AbstractHookStep(this._exit_hooks.get(this._state), hook_args);
1374
+ const outcome = abstract_hook_step(this._exit_hooks.get(this._state), hook_args);
1356
1375
  if (outcome.pass === false) {
1357
1376
  return false;
1358
1377
  }
1378
+ update_fields(outcome);
1359
1379
  }
1360
1380
  // 5. named transition / action hook
1361
1381
  if (this._has_named_hooks) {
1362
1382
  if (wasAction) {
1363
- const nhn = named_hook_name(this._state, newState, newStateOrAction), outcome = AbstractHookStep(this._named_hooks.get(nhn), hook_args);
1383
+ const nhn = named_hook_name(this._state, newState, newStateOrAction), outcome = abstract_hook_step(this._named_hooks.get(nhn), hook_args);
1364
1384
  if (outcome.pass === false) {
1365
1385
  return false;
1366
1386
  }
1387
+ update_fields(outcome);
1367
1388
  }
1368
1389
  }
1369
1390
  // 6. regular hook
1370
1391
  if (this._has_basic_hooks) {
1371
- const hn = hook_name(this._state, newState), outcome = AbstractHookStep(this._hooks.get(hn), hook_args);
1392
+ const hn = hook_name(this._state, newState), outcome = abstract_hook_step(this._hooks.get(hn), hook_args);
1372
1393
  if (outcome.pass === false) {
1373
1394
  return false;
1374
1395
  }
1396
+ update_fields(outcome);
1375
1397
  }
1376
1398
  // 7. edge type hook
1377
1399
  // 7a. standard transition hook
1378
1400
  if (trans_type === 'legal') {
1379
- const outcome = AbstractHookStep(this._standard_transition_hook, hook_args);
1401
+ const outcome = abstract_hook_step(this._standard_transition_hook, hook_args);
1380
1402
  if (outcome.pass === false) {
1381
1403
  return false;
1382
1404
  }
1405
+ update_fields(outcome);
1383
1406
  }
1384
1407
  // 7b. main type hook
1385
1408
  if (trans_type === 'main') {
1386
- const outcome = AbstractHookStep(this._main_transition_hook, hook_args);
1409
+ const outcome = abstract_hook_step(this._main_transition_hook, hook_args);
1387
1410
  if (outcome.pass === false) {
1388
1411
  return false;
1389
1412
  }
1413
+ update_fields(outcome);
1390
1414
  }
1391
1415
  // 7c. forced transition hook
1392
1416
  if (trans_type === 'forced') {
1393
- const outcome = AbstractHookStep(this._forced_transition_hook, hook_args);
1417
+ const outcome = abstract_hook_step(this._forced_transition_hook, hook_args);
1394
1418
  if (outcome.pass === false) {
1395
1419
  return false;
1396
1420
  }
1421
+ update_fields(outcome);
1397
1422
  }
1398
1423
  // 8. entry hook
1399
1424
  if (this._has_entry_hooks) {
1400
- const outcome = AbstractHookStep(this._entry_hooks.get(newState), hook_args);
1425
+ const outcome = abstract_hook_step(this._entry_hooks.get(newState), hook_args);
1401
1426
  if (outcome.pass === false) {
1402
1427
  return false;
1403
1428
  }
1429
+ update_fields(outcome);
1430
+ }
1431
+ // all hooks passed! let's now establish the result
1432
+ if (this._history_length) {
1433
+ this._history.shove([this._state, this._data]);
1404
1434
  }
1405
1435
  this._state = newState;
1436
+ if (data_changed) {
1437
+ this._data = hook_args.data;
1438
+ }
1406
1439
  return true;
1407
1440
  // or without hooks
1408
1441
  }
1409
1442
  else {
1443
+ if (this._history_length) {
1444
+ this._history.shove([this._state, this._data]);
1445
+ }
1410
1446
  this._state = newState;
1411
1447
  return true;
1412
1448
  }
@@ -1416,6 +1452,99 @@ class Machine {
1416
1452
  return false;
1417
1453
  }
1418
1454
  }
1455
+ /*********
1456
+ *
1457
+ * Get a truncated history of the recent states and data of the machine.
1458
+ * Turned off by default; configure with `.from('...', {data: 5})` by length,
1459
+ * or set `.history_length` at runtime.
1460
+ *
1461
+ * History *does not contain the current state*. If you want that, call
1462
+ * `.history_inclusive` instead.
1463
+ *
1464
+ * ```typescript
1465
+ * const foo = jssm.from(
1466
+ * "a 'next' -> b 'next' -> c 'next' -> d 'next' -> e;",
1467
+ * { history: 3 }
1468
+ * );
1469
+ *
1470
+ * foo.action('next');
1471
+ * foo.action('next');
1472
+ * foo.action('next');
1473
+ * foo.action('next');
1474
+ *
1475
+ * foo.history; // [ ['b',undefined], ['c',undefined], ['d',undefined] ]
1476
+ * ```
1477
+ *
1478
+ * Notice that the machine's current state, `e`, is not in the returned list.
1479
+ *
1480
+ * @typeparam mDT The type of the machine data member; usually omitted
1481
+ *
1482
+ */
1483
+ get history() {
1484
+ return this._history.toArray();
1485
+ }
1486
+ /*********
1487
+ *
1488
+ * Get a truncated history of the recent states and data of the machine,
1489
+ * including the current state. Turned off by default; configure with
1490
+ * `.from('...', {data: 5})` by length, or set `.history_length` at runtime.
1491
+ *
1492
+ * History inclusive contains the current state. If you only want past
1493
+ * states, call `.history` instead.
1494
+ *
1495
+ * The list returned will be one longer than the history buffer kept, as the
1496
+ * history buffer kept gets the current state added to it to produce this
1497
+ * list.
1498
+ *
1499
+ * ```typescript
1500
+ * const foo = jssm.from(
1501
+ * "a 'next' -> b 'next' -> c 'next' -> d 'next' -> e;",
1502
+ * { history: 3 }
1503
+ * );
1504
+ *
1505
+ * foo.action('next');
1506
+ * foo.action('next');
1507
+ * foo.action('next');
1508
+ * foo.action('next');
1509
+ *
1510
+ * foo.history_inclusive; // [ ['b',undefined], ['c',undefined], ['d',undefined], ['e',undefined] ]
1511
+ * ```
1512
+ *
1513
+ * Notice that the machine's current state, `e`, is in the returned list.
1514
+ *
1515
+ * @typeparam mDT The type of the machine data member; usually omitted
1516
+ *
1517
+ */
1518
+ get history_inclusive() {
1519
+ const ret = this._history.toArray();
1520
+ ret.push([this.state(), this.data()]);
1521
+ return ret;
1522
+ }
1523
+ /*********
1524
+ *
1525
+ * Find out how long a history this machine is keeping. Defaults to zero.
1526
+ * Settable directly.
1527
+ *
1528
+ * ```typescript
1529
+ * const foo = jssm.from("a -> b;");
1530
+ * foo.history_length; // 0
1531
+ *
1532
+ * const bar = jssm.from("a -> b;", { history: 3 });
1533
+ * foo.history_length; // 3
1534
+ * foo.history_length = 5;
1535
+ * foo.history_length; // 5
1536
+ * ```
1537
+ *
1538
+ * @typeparam mDT The type of the machine data member; usually omitted
1539
+ *
1540
+ */
1541
+ get history_length() {
1542
+ return this._history_length;
1543
+ }
1544
+ set history_length(to) {
1545
+ this._history_length = to;
1546
+ this._history.resize(to, true);
1547
+ }
1419
1548
  /********
1420
1549
  *
1421
1550
  * Instruct the machine to complete an action.
@@ -1617,8 +1746,7 @@ function is_hook_rejection(hr) {
1617
1746
  }
1618
1747
  throw new TypeError('unknown hook rejection type result');
1619
1748
  }
1620
- // TODO hook_args: unknown
1621
- function AbstractHookStep(maybe_hook, hook_args) {
1749
+ function abstract_hook_step(maybe_hook, hook_args) {
1622
1750
  if (maybe_hook !== undefined) {
1623
1751
  const result = maybe_hook(hook_args);
1624
1752
  if (result === undefined) {
@@ -1630,9 +1758,9 @@ function AbstractHookStep(maybe_hook, hook_args) {
1630
1758
  if (result === false) {
1631
1759
  return { pass: false };
1632
1760
  }
1633
- // if (is_hook_complex_result(result)) {
1634
- // return result;
1635
- // }
1761
+ if (is_hook_complex_result(result)) {
1762
+ return result;
1763
+ }
1636
1764
  throw new TypeError(`Unknown hook result type ${result}`);
1637
1765
  }
1638
1766
  else {
@@ -1641,4 +1769,4 @@ function AbstractHookStep(maybe_hook, hook_args) {
1641
1769
  }
1642
1770
  export { version, transfer_state_properties, Machine, make, wrap_parse as parse, compile, sm, from, arrow_direction, arrow_left_kind, arrow_right_kind,
1643
1771
  // 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 };
1772
+ 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 };