jssm 5.89.6 → 5.90.1

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/.gitattributes ADDED
@@ -0,0 +1,6 @@
1
+ docs/* linguist-generated=true
2
+ build/* linguist-generated=true
3
+ dist/* linguist-generated=true
4
+ src/ts/generated_code/* linguist-generated=true
5
+ benchmark/* linguist-generated=true
6
+ coverage/* linguist-generated=true
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
- 1100 merges; 187 releases; Changlogging the last 10 commits; Full changelog at [CHANGELOG.long.md](CHANGELOG.long.md)
5
+ 1104 merges; 187 releases; Changlogging the last 10 commits; Full changelog at [CHANGELOG.long.md](CHANGELOG.long.md)
6
6
 
7
7
 
8
8
 
@@ -22,15 +22,13 @@ Published tags:
22
22
 
23
23
   
24
24
 
25
- ## [Untagged] - 10/25/2023 11:23:28 AM
25
+ ## [Untagged] - 10/25/2023 12:51:12 PM
26
26
 
27
- Commit [21be69d4b3e592534342a113d259f59bbea4e23b](https://github.com/StoneCypher/jssm/commit/21be69d4b3e592534342a113d259f59bbea4e23b)
27
+ Commit [7ef88f2a668a45f1cd2e027072e933a813ac65c6](https://github.com/StoneCypher/jssm/commit/7ef88f2a668a45f1cd2e027072e933a813ac65c6)
28
28
 
29
29
  Author: `John Haugeland <stonecypher@gmail.com>`
30
30
 
31
- Merges [1401a08, a0fa6f3]
32
-
33
- * Merge branch 'UpdateWorkflowNodeVersions'
31
+ * Suppress generated code and directories from reviews using .gitattributes, fixes StoneCypher/fsl#1242
34
32
 
35
33
 
36
34
 
@@ -39,13 +37,13 @@ Merges [1401a08, a0fa6f3]
39
37
 
40
38
  &nbsp;
41
39
 
42
- ## [Untagged] - 10/25/2023 11:21:44 AM
40
+ ## [Untagged] - 10/25/2023 12:33:52 PM
43
41
 
44
- Commit [1401a08396ff0f47bf67f52f8895a513513b3c17](https://github.com/StoneCypher/jssm/commit/1401a08396ff0f47bf67f52f8895a513513b3c17)
42
+ Commit [e88d784320e4d3bfbabfe9365578d32b869b6831](https://github.com/StoneCypher/jssm/commit/e88d784320e4d3bfbabfe9365578d32b869b6831)
45
43
 
46
44
  Author: `John Haugeland <stonecypher@gmail.com>`
47
45
 
48
- * replace mulberry with splitmix32, fixes StoneCypher/fsl#1250
46
+ * Proper stochastics. Seedable RNG. Fixes StoneCypher/fsl#990, StoneCypher/fsl#991
49
47
 
50
48
 
51
49
 
@@ -54,15 +52,15 @@ Author: `John Haugeland <stonecypher@gmail.com>`
54
52
 
55
53
  &nbsp;
56
54
 
57
- <a name="5__89__3" />
58
-
59
- ## [5.89.3] - 10/25/2023 10:58:24 AM
55
+ ## [Untagged] - 10/25/2023 11:31:11 AM
60
56
 
61
- Commit [e1ef14c5268547a18010d378267f7196e186a08c](https://github.com/StoneCypher/jssm/commit/e1ef14c5268547a18010d378267f7196e186a08c)
57
+ Commit [966c142a44db8c5f890b2cc4edadca9faee2d625](https://github.com/StoneCypher/jssm/commit/966c142a44db8c5f890b2cc4edadca9faee2d625)
62
58
 
63
59
  Author: `John Haugeland <stonecypher@gmail.com>`
64
60
 
65
- * silence most build warnings
61
+ Merges [9944585, bba1f0a]
62
+
63
+ * Merge branch 'main' into NewGraphicAssets
66
64
 
67
65
 
68
66
 
@@ -71,13 +69,13 @@ Author: `John Haugeland <stonecypher@gmail.com>`
71
69
 
72
70
  &nbsp;
73
71
 
74
- ## [Untagged] - 10/25/2023 10:48:13 AM
72
+ ## [Untagged] - 10/25/2023 11:29:11 AM
75
73
 
76
- Commit [a0fa6f3a6f58169ae45ed294c4fd7ae1d1f84a26](https://github.com/StoneCypher/jssm/commit/a0fa6f3a6f58169ae45ed294c4fd7ae1d1f84a26)
74
+ Commit [bba1f0a273ca73ffe105eed27619fc6b31247568](https://github.com/StoneCypher/jssm/commit/bba1f0a273ca73ffe105eed27619fc6b31247568)
77
75
 
78
76
  Author: `John Haugeland <stonecypher@gmail.com>`
79
77
 
80
- * Newer node stuff
78
+ * update github action to cover more modern node versions to cover 20 and 21
81
79
 
82
80
 
83
81
 
@@ -86,31 +84,30 @@ Author: `John Haugeland <stonecypher@gmail.com>`
86
84
 
87
85
  &nbsp;
88
86
 
89
- ## [Untagged] - 10/25/2023 10:47:08 AM
87
+ ## [Untagged] - 10/25/2023 11:23:28 AM
90
88
 
91
- Commit [99445857bb32492c06ef0d766177260b3221bb70](https://github.com/StoneCypher/jssm/commit/99445857bb32492c06ef0d766177260b3221bb70)
89
+ Commit [21be69d4b3e592534342a113d259f59bbea4e23b](https://github.com/StoneCypher/jssm/commit/21be69d4b3e592534342a113d259f59bbea4e23b)
92
90
 
93
91
  Author: `John Haugeland <stonecypher@gmail.com>`
94
92
 
95
- * Purty
93
+ Merges [1401a08, a0fa6f3]
96
94
 
95
+ * Merge branch 'UpdateWorkflowNodeVersions'
97
96
 
98
97
 
99
98
 
100
- &nbsp;
101
99
 
102
100
  &nbsp;
103
101
 
104
- <a name="5__89__2" />
102
+ &nbsp;
105
103
 
106
- ## [5.89.2] - 6/6/2023 12:30:48 AM
104
+ ## [Untagged] - 10/25/2023 11:21:44 AM
107
105
 
108
- Commit [66725ae01f4692e7720a6b7a0add6cd71b77ce85](https://github.com/StoneCypher/jssm/commit/66725ae01f4692e7720a6b7a0add6cd71b77ce85)
106
+ Commit [1401a08396ff0f47bf67f52f8895a513513b3c17](https://github.com/StoneCypher/jssm/commit/1401a08396ff0f47bf67f52f8895a513513b3c17)
109
107
 
110
108
  Author: `John Haugeland <stonecypher@gmail.com>`
111
109
 
112
- * Update package.json
113
- * bumping version for readme error by alpine discord @toomanyusershavethisname as mentioned in prior patch
110
+ * replace mulberry with splitmix32, fixes StoneCypher/fsl#1250
114
111
 
115
112
 
116
113
 
@@ -119,17 +116,15 @@ Author: `John Haugeland <stonecypher@gmail.com>`
119
116
 
120
117
  &nbsp;
121
118
 
122
- ## [Untagged] - 6/6/2023 12:29:53 AM
119
+ <a name="5__89__3" />
120
+
121
+ ## [5.89.3] - 10/25/2023 10:58:24 AM
123
122
 
124
- Commit [e04f055eec397f7c1679579caec8c4565dd993a4](https://github.com/StoneCypher/jssm/commit/e04f055eec397f7c1679579caec8c4565dd993a4)
123
+ Commit [e1ef14c5268547a18010d378267f7196e186a08c](https://github.com/StoneCypher/jssm/commit/e1ef14c5268547a18010d378267f7196e186a08c)
125
124
 
126
125
  Author: `John Haugeland <stonecypher@gmail.com>`
127
126
 
128
- * Update README_base.md
129
- * alpine linux discord @toomanyusershavethisname noticed an error in the readme.
130
- * i'll have to manually trigger a second build to clear this because for some nightmare reason i'm doing this in the web editor on a tablet instead of just going upstairs and using the computer like an adult, and that means i can't do two files at once and so this build will bounce when the version number isn't yet bounced
131
- * "but you could start a branch"
132
- * yeah but i won't, is the thing
127
+ * silence most build warnings
133
128
 
134
129
 
135
130
 
@@ -138,18 +133,13 @@ Author: `John Haugeland <stonecypher@gmail.com>`
138
133
 
139
134
  &nbsp;
140
135
 
141
- <a name="5__89__1" />
142
-
143
- ## [5.89.1] - 5/13/2023 11:42:13 PM
136
+ ## [Untagged] - 10/25/2023 10:48:13 AM
144
137
 
145
- Commit [7fb4622f3b8651ea259f8a785210810bd0ae328a](https://github.com/StoneCypher/jssm/commit/7fb4622f3b8651ea259f8a785210810bd0ae328a)
138
+ Commit [a0fa6f3a6f58169ae45ed294c4fd7ae1d1f84a26](https://github.com/StoneCypher/jssm/commit/a0fa6f3a6f58169ae45ed294c4fd7ae1d1f84a26)
146
139
 
147
140
  Author: `John Haugeland <stonecypher@gmail.com>`
148
141
 
149
- Merges [d04a575, 6337159]
150
-
151
- * Merge pull request #556 from StoneCypher/FinalizeDenoSupport
152
- * Standard deno support
142
+ * Newer node stuff
153
143
 
154
144
 
155
145
 
@@ -158,13 +148,13 @@ Merges [d04a575, 6337159]
158
148
 
159
149
  &nbsp;
160
150
 
161
- ## [Untagged] - 5/13/2023 11:35:56 PM
151
+ ## [Untagged] - 10/25/2023 10:47:08 AM
162
152
 
163
- Commit [6337159890e2a5f96af18a926096d82876660903](https://github.com/StoneCypher/jssm/commit/6337159890e2a5f96af18a926096d82876660903)
153
+ Commit [99445857bb32492c06ef0d766177260b3221bb70](https://github.com/StoneCypher/jssm/commit/99445857bb32492c06ef0d766177260b3221bb70)
164
154
 
165
155
  Author: `John Haugeland <stonecypher@gmail.com>`
166
156
 
167
- * Standard deno support
157
+ * Purty
168
158
 
169
159
 
170
160
 
@@ -173,15 +163,13 @@ Author: `John Haugeland <stonecypher@gmail.com>`
173
163
 
174
164
  &nbsp;
175
165
 
176
- <a name="5__89__0" />
166
+ <a name="5__89__2" />
177
167
 
178
- ## [5.89.0] - 5/7/2023 12:34:42 PM
168
+ ## [5.89.2] - 6/6/2023 12:30:48 AM
179
169
 
180
- Commit [d04a57542edb377085437d38e31d13a65fccdce8](https://github.com/StoneCypher/jssm/commit/d04a57542edb377085437d38e31d13a65fccdce8)
170
+ Commit [66725ae01f4692e7720a6b7a0add6cd71b77ce85](https://github.com/StoneCypher/jssm/commit/66725ae01f4692e7720a6b7a0add6cd71b77ce85)
181
171
 
182
172
  Author: `John Haugeland <stonecypher@gmail.com>`
183
173
 
184
- Merges [ef4285a, 2a87cf1]
185
-
186
- * Merge pull request #555 from StoneCypher/ReattemptDenoSupport
187
- * draft support for deno
174
+ * Update package.json
175
+ * bumping version for readme error by alpine discord @toomanyusershavethisname as mentioned in prior patch
package/README.md CHANGED
@@ -18,10 +18,10 @@ Please edit the file it's derived from, instead: `./src/md/readme_base.md`
18
18
 
19
19
 
20
20
 
21
- * Generated for version 5.89.6 at 10/25/2023, 11:25:13 AM
21
+ * Generated for version 5.90.1 at 10/25/2023, 12:53:01 PM
22
22
 
23
23
  -->
24
- # jssm 5.89.6
24
+ # jssm 5.90.1
25
25
 
26
26
  Easy. Small. Fast. TS, es6, es5. Node, Browser. 100% coverage. Property
27
27
  tests. Fuzz tests. Language tests for a dozen languages and emoji. Easy to
@@ -29,7 +29,7 @@ share online. Easy to embed.
29
29
 
30
30
  Readable, useful state machines as one-liner strings.
31
31
 
32
- ***4,923 tests*** run 5,814 times. 4,914 specs with 100.0% coverage, 9 fuzz tests with 13.1% coverage. With 2,834 lines, that's about 1.7 tests per line, or {{line_run_ratio}} generated tests per line.
32
+ ***4,937 tests*** run 5,828 times. 4,928 specs with 100.0% coverage, 9 fuzz tests with 13.0% coverage. With 2,855 lines, that's about 1.7 tests per line, or {{line_run_ratio}} generated tests per line.
33
33
 
34
34
  ***Meet your new state machine library.***
35
35
 
@@ -1,6 +1,6 @@
1
1
  declare type StateType = string;
2
2
  import { JssmGenericState, JssmGenericConfig, JssmStateConfig, JssmTransition, JssmTransitionList, // JssmTransitionRule,
3
- JssmMachineInternalState, JssmAllowsOverride, JssmStateDeclaration, JssmStateStyleKeyList, JssmLayout, JssmHistory, JssmSerialization, FslDirection, FslDirections, FslTheme, HookDescription, HookHandler, HookContext, HookResult, HookComplexResult } from './jssm_types';
3
+ JssmMachineInternalState, JssmAllowsOverride, JssmStateDeclaration, JssmStateStyleKeyList, JssmLayout, JssmHistory, JssmSerialization, FslDirection, FslDirections, FslTheme, HookDescription, HookHandler, HookContext, HookResult, HookComplexResult, JssmRng } from './jssm_types';
4
4
  import { arrow_direction, arrow_left_kind, arrow_right_kind } from './jssm_arrow';
5
5
  import { compile, make, wrap_parse } from './jssm_compiler';
6
6
  import { seq, unique, find_repeated, weighted_rand_select, weighted_sample_select, histograph, weighted_histo_key } from './jssm_util';
@@ -40,8 +40,10 @@ declare class Machine<mDT> {
40
40
  _fsl_version?: string;
41
41
  _raw_state_declaration?: Array<Object>;
42
42
  _state_declarations: Map<StateType, JssmStateDeclaration>;
43
- _instance_name: string;
44
43
  _data?: mDT;
44
+ _instance_name: string;
45
+ _rng_seed: number;
46
+ _rng: JssmRng;
45
47
  _graph_layout: JssmLayout;
46
48
  _dot_preamble: string;
47
49
  _arrange_declaration: Array<Array<StateType>>;
@@ -99,7 +101,7 @@ declare class Machine<mDT> {
99
101
  _start_state_style: JssmStateConfig;
100
102
  _end_state_style: JssmStateConfig;
101
103
  _state_labels: Map<string, string>;
102
- constructor({ start_states, end_states, complete, transitions, machine_author, machine_comment, machine_contributor, machine_definition, machine_language, machine_license, machine_name, machine_version, state_declaration, property_definition, state_property, fsl_version, dot_preamble, arrange_declaration, arrange_start_declaration, arrange_end_declaration, theme, flow, graph_layout, instance_name, history, data, default_state_config, default_active_state_config, default_hooked_state_config, default_terminal_state_config, default_start_state_config, default_end_state_config, allows_override, config_allows_override }: JssmGenericConfig<StateType, mDT>);
104
+ constructor({ start_states, end_states, complete, transitions, machine_author, machine_comment, machine_contributor, machine_definition, machine_language, machine_license, machine_name, machine_version, state_declaration, property_definition, state_property, fsl_version, dot_preamble, arrange_declaration, arrange_start_declaration, arrange_end_declaration, theme, flow, graph_layout, instance_name, history, data, default_state_config, default_active_state_config, default_hooked_state_config, default_terminal_state_config, default_start_state_config, default_end_state_config, allows_override, config_allows_override, rng_seed }: JssmGenericConfig<StateType, mDT>);
103
105
  /********
104
106
  *
105
107
  * Internal method for fabricating states. Not meant for external use.
@@ -668,6 +670,8 @@ declare class Machine<mDT> {
668
670
  post_hook_any_transition(handler: HookHandler<mDT>): Machine<mDT>;
669
671
  post_hook_entry(to: string, handler: HookHandler<mDT>): Machine<mDT>;
670
672
  post_hook_exit(from: string, handler: HookHandler<mDT>): Machine<mDT>;
673
+ get rng_seed(): number;
674
+ set rng_seed(to: number | undefined);
671
675
  edges_between(from: string, to: string): JssmTransition<StateType, mDT>[];
672
676
  /*********
673
677
  *
package/dist/es6/jssm.js CHANGED
@@ -4,7 +4,7 @@ import { FslDirections } from './jssm_types';
4
4
  import { arrow_direction, arrow_left_kind, arrow_right_kind } from './jssm_arrow';
5
5
  import { compile, make, wrap_parse } from './jssm_compiler';
6
6
  import { theme_mapping, base_theme } from './jssm_theme';
7
- import { seq, unique, find_repeated, weighted_rand_select, weighted_sample_select, histograph, weighted_histo_key, array_box_if_string, name_bind_prop_and_state, hook_name, named_hook_name } from './jssm_util';
7
+ import { seq, unique, find_repeated, weighted_rand_select, weighted_sample_select, histograph, weighted_histo_key, array_box_if_string, name_bind_prop_and_state, hook_name, named_hook_name, gen_splitmix32 } from './jssm_util';
8
8
  import * as constants from './jssm_constants';
9
9
  const { shapes, gviz_shapes, named_colors } = constants;
10
10
  import { version, build_time } from './version'; // replaced from package.js in build
@@ -126,7 +126,7 @@ function state_style_condense(jssk) {
126
126
  // TODO add a lotta docblock here
127
127
  class Machine {
128
128
  // whargarbl this badly needs to be broken up, monolith master
129
- constructor({ start_states, end_states = [], complete = [], transitions, machine_author, machine_comment, machine_contributor, machine_definition, machine_language, machine_license, machine_name, machine_version, state_declaration, property_definition, state_property, fsl_version, dot_preamble = undefined, arrange_declaration = [], arrange_start_declaration = [], arrange_end_declaration = [], theme = ['default'], flow = 'down', graph_layout = 'dot', instance_name, history, data, default_state_config, default_active_state_config, default_hooked_state_config, default_terminal_state_config, default_start_state_config, default_end_state_config, allows_override, config_allows_override }) {
129
+ constructor({ start_states, end_states = [], complete = [], transitions, machine_author, machine_comment, machine_contributor, machine_definition, machine_language, machine_license, machine_name, machine_version, state_declaration, property_definition, state_property, fsl_version, dot_preamble = undefined, arrange_declaration = [], arrange_start_declaration = [], arrange_end_declaration = [], theme = ['default'], flow = 'down', graph_layout = 'dot', instance_name, history, data, default_state_config, default_active_state_config, default_hooked_state_config, default_terminal_state_config, default_start_state_config, default_end_state_config, allows_override, config_allows_override, rng_seed }) {
130
130
  this._instance_name = instance_name;
131
131
  this._state = start_states[0];
132
132
  this._states = new Map();
@@ -212,6 +212,8 @@ class Machine {
212
212
  this._history_length = history || 0;
213
213
  this._history = new circular_buffer(this._history_length);
214
214
  this._state_labels = new Map();
215
+ this._rng_seed = rng_seed !== null && rng_seed !== void 0 ? rng_seed : new Date().getTime();
216
+ this._rng = gen_splitmix32(this._rng_seed);
215
217
  // consolidate the state declarations
216
218
  if (state_declaration) {
217
219
  state_declaration.map((state_decl) => {
@@ -1076,7 +1078,7 @@ class Machine {
1076
1078
  return wtf;
1077
1079
  }
1078
1080
  probabilistic_transition() {
1079
- const selected = weighted_rand_select(this.probable_exits_for(this.state()));
1081
+ const selected = weighted_rand_select(this.probable_exits_for(this.state()), undefined, this._rng);
1080
1082
  return this.transition(selected.to);
1081
1083
  }
1082
1084
  probabilistic_walk(n) {
@@ -1419,6 +1421,17 @@ class Machine {
1419
1421
  this.set_hook({ kind: 'post exit', from, handler });
1420
1422
  return this;
1421
1423
  }
1424
+ get rng_seed() {
1425
+ return this._rng_seed;
1426
+ }
1427
+ set rng_seed(to) {
1428
+ if (typeof to === 'undefined') {
1429
+ this._rng_seed = new Date().getTime();
1430
+ }
1431
+ else {
1432
+ this._rng_seed = to;
1433
+ }
1434
+ }
1422
1435
  // remove_hook(HookDesc: HookDescription) {
1423
1436
  // throw new JssmError(this, 'TODO: Should remove hook here');
1424
1437
  // }
@@ -219,6 +219,7 @@ declare type JssmGenericConfig<StateType, DataType> = {
219
219
  default_hooked_state_config?: JssmStateStyleKeyList;
220
220
  default_terminal_state_config?: JssmStateStyleKeyList;
221
221
  default_active_state_config?: JssmStateStyleKeyList;
222
+ rng_seed?: number | undefined;
222
223
  };
223
224
  declare type JssmCompileRule<StateType> = {
224
225
  agg_as: string;
@@ -359,4 +360,5 @@ declare type JssmErrorExtendedInfo = {
359
360
  requested_state?: StateType | undefined;
360
361
  };
361
362
  declare type JssmHistory<mDT> = circular_buffer<[StateType, mDT]>;
362
- export { JssmColor, JssmShape, JssmTransition, JssmTransitions, JssmTransitionList, JssmTransitionRule, JssmArrow, JssmArrowKind, JssmArrowDirection, JssmGenericConfig, JssmGenericState, JssmGenericMachine, JssmParseTree, JssmCompileSe, JssmCompileSeStart, JssmCompileRule, JssmPermitted, JssmPermittedOpt, JssmResult, JssmStateDeclaration, JssmStateDeclarationRule, JssmStateConfig, JssmStateStyleKey, JssmStateStyleKeyList, JssmBaseTheme, JssmTheme, JssmLayout, JssmHistory, JssmSerialization, JssmPropertyDefinition, JssmAllowsOverride, JssmParseFunctionType, JssmMachineInternalState, JssmErrorExtendedInfo, FslDirections, FslDirection, FslThemes, FslTheme, HookDescription, HookHandler, HookContext, HookResult, HookComplexResult };
363
+ declare type JssmRng = () => number;
364
+ export { JssmColor, JssmShape, JssmTransition, JssmTransitions, JssmTransitionList, JssmTransitionRule, JssmArrow, JssmArrowKind, JssmArrowDirection, JssmGenericConfig, JssmGenericState, JssmGenericMachine, JssmParseTree, JssmCompileSe, JssmCompileSeStart, JssmCompileRule, JssmPermitted, JssmPermittedOpt, JssmResult, JssmStateDeclaration, JssmStateDeclarationRule, JssmStateConfig, JssmStateStyleKey, JssmStateStyleKeyList, JssmBaseTheme, JssmTheme, JssmLayout, JssmHistory, JssmSerialization, JssmPropertyDefinition, JssmAllowsOverride, JssmParseFunctionType, JssmMachineInternalState, JssmErrorExtendedInfo, FslDirections, FslDirection, FslThemes, FslTheme, HookDescription, HookHandler, HookContext, HookResult, HookComplexResult, JssmRng };
@@ -11,7 +11,7 @@ function arr_uniq_p(el, i, source) {
11
11
  const array_box_if_string = n => typeof n === 'string' ? [n] : n;
12
12
  // this is explicitly about other peoples' data, so it has to be weakly typed
13
13
  /* eslint-disable flowtype/no-weak-types */
14
- const weighted_rand_select = (options, probability_property = 'probability') => {
14
+ const weighted_rand_select = (options, probability_property = 'probability', rng) => {
15
15
  if (!Array.isArray(options)) {
16
16
  throw new TypeError('options must be a non-empty array of objects');
17
17
  }
@@ -1,2 +1,2 @@
1
- const version = "5.89.6", build_time = 1698258231844;
1
+ const version = "5.90.1", build_time = 1698263492649;
2
2
  export { version, build_time };