Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@trigo/fsm

Package Overview
Dependencies
Maintainers
3
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@trigo/fsm - npm Package Compare versions

Comparing version
3.1.0
to
3.2.0
+176
-89
docs/ast/source/is-valid-state-value.js.json
{
"type": "File",
"start": 0,
"end": 132,
"end": 149,
"loc": {

@@ -11,3 +11,3 @@ "start": {

"end": {
"line": 5,
"line": 7,
"column": 0

@@ -19,3 +19,3 @@ }

"start": 0,
"end": 132,
"end": 149,
"loc": {

@@ -27,3 +27,3 @@ "start": {

"end": {
"line": 5,
"line": 7,
"column": 0

@@ -102,15 +102,33 @@ }

],
"kind": "const"
"kind": "const",
"trailingComments": [
{
"type": "CommentBlock",
"value": "* @private ",
"start": 79,
"end": 94,
"loc": {
"start": {
"line": 5,
"column": 0
},
"end": {
"line": 5,
"column": 15
}
}
}
]
},
{
"type": "ExportDefaultDeclaration",
"start": 78,
"end": 131,
"start": 95,
"end": 148,
"loc": {
"start": {
"line": 4,
"line": 6,
"column": 0
},
"end": {
"line": 4,
"line": 6,
"column": 53

@@ -121,11 +139,11 @@ }

"type": "ArrowFunctionExpression",
"start": 93,
"end": 130,
"start": 110,
"end": 147,
"loc": {
"start": {
"line": 4,
"line": 6,
"column": 15
},
"end": {
"line": 4,
"line": 6,
"column": 52

@@ -141,11 +159,11 @@ }

"type": "Identifier",
"start": 93,
"end": 98,
"start": 110,
"end": 115,
"loc": {
"start": {
"line": 4,
"line": 6,
"column": 15
},
"end": {
"line": 4,
"line": 6,
"column": 20

@@ -155,3 +173,4 @@ },

},
"name": "value"
"name": "value",
"leadingComments": null
}

@@ -161,11 +180,11 @@ ],

"type": "CallExpression",
"start": 102,
"end": 130,
"start": 119,
"end": 147,
"loc": {
"start": {
"line": 4,
"line": 6,
"column": 24
},
"end": {
"line": 4,
"line": 6,
"column": 52

@@ -176,11 +195,11 @@ }

"type": "MemberExpression",
"start": 102,
"end": 113,
"start": 119,
"end": 130,
"loc": {
"start": {
"line": 4,
"line": 6,
"column": 24
},
"end": {
"line": 4,
"line": 6,
"column": 35

@@ -191,11 +210,11 @@ }

"type": "Identifier",
"start": 102,
"end": 107,
"start": 119,
"end": 124,
"loc": {
"start": {
"line": 4,
"line": 6,
"column": 24
},
"end": {
"line": 4,
"line": 6,
"column": 29

@@ -209,11 +228,11 @@ },

"type": "Identifier",
"start": 108,
"end": 113,
"start": 125,
"end": 130,
"loc": {
"start": {
"line": 4,
"line": 6,
"column": 30
},
"end": {
"line": 4,
"line": 6,
"column": 35

@@ -230,11 +249,11 @@ },

"type": "Identifier",
"start": 114,
"end": 129,
"start": 131,
"end": 146,
"loc": {
"start": {
"line": 4,
"line": 6,
"column": 36
},
"end": {
"line": 4,
"line": 6,
"column": 51

@@ -248,5 +267,40 @@ },

},
"leadingComments": [],
"leadingComments": [
{
"type": "CommentBlock",
"value": "* @private ",
"start": 79,
"end": 94,
"loc": {
"start": {
"line": 5,
"column": 0
},
"end": {
"line": 5,
"column": 15
}
}
}
],
"trailingComments": []
}
},
"leadingComments": [
{
"type": "CommentBlock",
"value": "* @private ",
"start": 79,
"end": 94,
"loc": {
"start": {
"line": 5,
"column": 0
},
"end": {
"line": 5,
"column": 15
}
}
}
]
}

@@ -292,3 +346,20 @@ ],

},
"comments": [],
"comments": [
{
"type": "CommentBlock",
"value": "* @private ",
"start": 79,
"end": 94,
"loc": {
"start": {
"line": 5,
"column": 0
},
"end": {
"line": 5,
"column": 15
}
}
}
],
"tokens": [

@@ -486,2 +557,18 @@ {

{
"type": "CommentBlock",
"value": "* @private ",
"start": 79,
"end": 94,
"loc": {
"start": {
"line": 5,
"column": 0
},
"end": {
"line": 5,
"column": 15
}
}
},
{
"type": {

@@ -501,11 +588,11 @@ "label": "export",

"value": "export",
"start": 78,
"end": 84,
"start": 95,
"end": 101,
"loc": {
"start": {
"line": 4,
"line": 6,
"column": 0
},
"end": {
"line": 4,
"line": 6,
"column": 6

@@ -530,11 +617,11 @@ }

"value": "default",
"start": 85,
"end": 92,
"start": 102,
"end": 109,
"loc": {
"start": {
"line": 4,
"line": 6,
"column": 7
},
"end": {
"line": 4,
"line": 6,
"column": 14

@@ -557,11 +644,11 @@ }

"value": "value",
"start": 93,
"end": 98,
"start": 110,
"end": 115,
"loc": {
"start": {
"line": 4,
"line": 6,
"column": 15
},
"end": {
"line": 4,
"line": 6,
"column": 20

@@ -584,11 +671,11 @@ }

},
"start": 99,
"end": 101,
"start": 116,
"end": 118,
"loc": {
"start": {
"line": 4,
"line": 6,
"column": 21
},
"end": {
"line": 4,
"line": 6,
"column": 23

@@ -611,11 +698,11 @@ }

"value": "value",
"start": 102,
"end": 107,
"start": 119,
"end": 124,
"loc": {
"start": {
"line": 4,
"line": 6,
"column": 24
},
"end": {
"line": 4,
"line": 6,
"column": 29

@@ -638,11 +725,11 @@ }

},
"start": 107,
"end": 108,
"start": 124,
"end": 125,
"loc": {
"start": {
"line": 4,
"line": 6,
"column": 29
},
"end": {
"line": 4,
"line": 6,
"column": 30

@@ -665,11 +752,11 @@ }

"value": "match",
"start": 108,
"end": 113,
"start": 125,
"end": 130,
"loc": {
"start": {
"line": 4,
"line": 6,
"column": 30
},
"end": {
"line": 4,
"line": 6,
"column": 35

@@ -691,11 +778,11 @@ }

},
"start": 113,
"end": 114,
"start": 130,
"end": 131,
"loc": {
"start": {
"line": 4,
"line": 6,
"column": 35
},
"end": {
"line": 4,
"line": 6,
"column": 36

@@ -718,11 +805,11 @@ }

"value": "STATE_KEY_REGEX",
"start": 114,
"end": 129,
"start": 131,
"end": 146,
"loc": {
"start": {
"line": 4,
"line": 6,
"column": 36
},
"end": {
"line": 4,
"line": 6,
"column": 51

@@ -744,11 +831,11 @@ }

},
"start": 129,
"end": 130,
"start": 146,
"end": 147,
"loc": {
"start": {
"line": 4,
"line": 6,
"column": 51
},
"end": {
"line": 4,
"line": 6,
"column": 52

@@ -771,11 +858,11 @@ }

},
"start": 130,
"end": 131,
"start": 147,
"end": 148,
"loc": {
"start": {
"line": 4,
"line": 6,
"column": 52
},
"end": {
"line": 4,
"line": 6,
"column": 53

@@ -798,11 +885,11 @@ }

},
"start": 132,
"end": 132,
"start": 149,
"end": 149,
"loc": {
"start": {
"line": 5,
"line": 7,
"column": 0
},
"end": {
"line": 5,
"line": 7,
"column": 0

@@ -809,0 +896,0 @@ }

@@ -8,4 +8,4 @@ <svg xmlns="http://www.w3.org/2000/svg" width="104" height="20">

<rect rx="3" width="104" height="20" fill="#555"/>
<rect rx="3" x="64" width="40" height="20" fill="#dab226"/>
<path fill="#dab226" d="M64 0h4v20h-4z"/>
<rect rx="3" x="64" width="40" height="20" fill="#4fc921"/>
<path fill="#4fc921" d="M64 0h4v20h-4z"/>
<rect rx="3" width="104" height="20" fill="url(#a)"/>

@@ -15,5 +15,5 @@ <g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">

<text x="32" y="14">document</text>
<text x="84" y="15" fill="#010101" fill-opacity=".3">88%</text>
<text x="84" y="14">88%</text>
<text x="84" y="15" fill="#010101" fill-opacity=".3">100%</text>
<text x="84" y="14">100%</text>
</g>
</svg>

@@ -37,4 +37,2 @@ <!DOCTYPE html>

<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/lib/fsm.js~FSM.html">FSM</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-findpossibletransitions">findpossibletransitions</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-isvalidstatevalue">isvalidstatevalue</a></span></span></li>
</ul>

@@ -41,0 +39,0 @@ </div>

@@ -37,4 +37,2 @@ <!DOCTYPE html>

<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/lib/fsm.js~FSM.html">FSM</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-findpossibletransitions">findpossibletransitions</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-isvalidstatevalue">isvalidstatevalue</a></span></span></li>
</ul>

@@ -353,2 +351,36 @@ </div>

<span data-ice="name"><span><a href="class/lib/fsm.js~FSM.html#instance-method-allTransitions">allTransitions</a></span></span><span data-ice="signature">(): <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a></span></span>
</p>
</div>
<div>
<div data-ice="description"><p>Get all transititons that are defined for the state machine in the format</p>
<pre><code class="lang-javascript"><code class="source-code prettyprint">{
t1: { from: &apos;a&apos;, to: &apos;b&apos;, ...},
t2: { from: &apos;a&apos;, to: &apos;b&apos;, ...},
t3: { from: &apos;a&apos;, to: &apos;b&apos;, ...},
}</code>
</code></pre>
</div>
</div>
</td>
<td>
</td>
</tr>
<tr data-ice="target">
<td>
<span class="access" data-ice="access">public</span>
<span class="override" data-ice="override"></span>
</td>
<td>
<div>
<p>
<span data-ice="name"><span><a href="class/lib/fsm.js~FSM.html#instance-method-execute">execute</a></span></span><span data-ice="signature">(transition: <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span>, args: ...<span>any</span>): <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a></span></span>

@@ -416,3 +448,18 @@ </p>

<div data-ice="description"><p>Get rest API links for all currently available transitions than define the</p>
<div data-ice="description"><p>Get rest API links for all currently available transitions where defined</p>
<pre><code class="lang-javascript"><code class="source-code prettyprint">// example output:
{
self: {
href: &apos;/events/42&apos;,
method: &apos;get&apos;
},
&apos;transition:name:1&apos;: {
href: &apos;/events/42/transition/{param1}&apos;,
method: &apos;put&apos;,
params: {
param1: true,
}
}
}</code>
</code></pre>
</div>

@@ -663,3 +710,3 @@ </div>

<td data-ice="appendix"></td>
<td data-ice="description"><p>function with signature &quot;async (ctx, arg1, arg2...) =&gt; {...}&quot;</p>
<td data-ice="description"><p>function with signature <code>async (ctx, arg1, arg2...) =&gt; {...}</code></p>
</td>

@@ -671,3 +718,3 @@ </tr>

<td data-ice="appendix"></td>
<td data-ice="description"><p>function with signature &quot;async (ctx, arg1, arg2...) =&gt; {...}&quot;</p>
<td data-ice="description"><p>function with signature <code>async (ctx, arg1, arg2...) =&gt; {...}</code></p>
</td>

@@ -679,3 +726,3 @@ </tr>

<td data-ice="appendix"></td>
<td data-ice="description"><p>function with signature &quot;async (ctx, arg1, arg2...) =&gt; {...}&quot;</p>
<td data-ice="description"><p>function with signature <code>async (ctx, arg1, arg2...) =&gt; {...}</code></p>
</td>

@@ -687,3 +734,3 @@ </tr>

<td data-ice="appendix"></td>
<td data-ice="description"><p>function with signature &quot;async (ctx, arg1, arg2...) =&gt; {...}&quot;</p>
<td data-ice="description"><p>function with signature <code>async (ctx, arg1, arg2...) =&gt; {...}</code></p>
</td>

@@ -695,3 +742,3 @@ </tr>

<td data-ice="appendix"></td>
<td data-ice="description"><p>function with signature &quot;async (ctx, arg1, arg2...) =&gt; {...}&quot;</p>
<td data-ice="description"><p>function with signature <code>async (ctx, arg1, arg2...) =&gt; {...}</code></p>
</td>

@@ -766,3 +813,3 @@ </tr>

<span data-ice="source"><span><a href="file/lib/fsm.js.html#lineNumber266">source</a></span></span>
<span data-ice="source"><span><a href="file/lib/fsm.js.html#lineNumber292">source</a></span></span>
</span>

@@ -985,3 +1032,3 @@ </h3>

<span data-ice="source"><span><a href="file/lib/fsm.js.html#lineNumber236">source</a></span></span>
<span data-ice="source"><span><a href="file/lib/fsm.js.html#lineNumber262">source</a></span></span>
</span>

@@ -1028,9 +1075,11 @@ </h3>

transition can be triggered.<br><br>
Supported syntax:<br>
&apos;*&apos; =&gt; allow from any state
&apos;state1&apos; =&gt; allow only from state &apos;state1&apos;<br>
[&apos;state1&apos;, &apos;state2&apos;] =&gt; allow transition from state1 &amp; state2<br>
{ state: [&apos;s1&apos;, &apos;s2&apos;], substate: [&apos;sub1&apos;, &apos;sub2&apos;] } =&gt; allow transition from all states creates by calculating all<br>
permutations of the given states. &apos;state:s2|substate:sub1&apos; &apos;state:s2|substate:sub1&apos; &apos;state:s2|substate:sub2&apos;</p>
</td>
Supported syntax:</p>
<pre><code><code class="source-code prettyprint">&apos;*&apos; =&gt; allow from any state
&apos;state1&apos; =&gt; allow only from state &apos;state1&apos;
[&apos;state1&apos;, &apos;state2&apos;] =&gt; allow transition from state1 &amp; state2
{ state: [&apos;s1&apos;, &apos;s2&apos;], substate: [&apos;sub1&apos;, &apos;sub2&apos;] } =&gt; allow transition
from all states creates by calculating all
permutations of the given states. &apos;state:s2|substate:sub1&apos;
&apos;state:s2|substate:sub1&apos; and &apos;state:s2|substate:sub2&apos;</code>
</code></pre></td>
</tr>

@@ -1042,6 +1091,8 @@ <tr data-ice="property" data-depth="1">

<td data-ice="description"><p>defines the state that is created after the transition<br><br>
Supported syntax:<br>
&apos;*&apos; =&gt; do not change source state<br>
&apos;state1&apos; =&gt; sets target state to &apos;state1&apos;<br>
{ state: &apos;s1&apos; } =&gt; sets the property &quot;state&quot; of the current state to &quot;s1&quot; eg. patches the existing state object representation</p>
Supported syntax:</p>
<pre><code class="lang-javascript"><code class="source-code prettyprint">&apos;*&apos; =&gt; do not change source state
&apos;state1&apos; =&gt; sets target state to &apos;state1&apos;
{ state: &apos;s1&apos; } =&gt; sets the property &quot;state&quot; of the current state
to &quot;s1&quot; eg. patches the existing state object representation</code>
</code></pre>
</td>

@@ -1084,2 +1135,65 @@ </tr>

<div class="detail" data-ice="detail">
<h3 data-ice="anchor" id="instance-method-allTransitions">
<span class="access" data-ice="access">public</span>
<span data-ice="name">allTransitions</span><span data-ice="signature">(): <span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a></span></span>
<span class="right-info">
<span data-ice="source"><span><a href="file/lib/fsm.js.html#lineNumber166">source</a></span></span>
</span>
</h3>
<div data-ice="description"><p>Get all transititons that are defined for the state machine in the format</p>
<pre><code class="lang-javascript"><code class="source-code prettyprint">{
t1: { from: &apos;a&apos;, to: &apos;b&apos;, ...},
t2: { from: &apos;a&apos;, to: &apos;b&apos;, ...},
t3: { from: &apos;a&apos;, to: &apos;b&apos;, ...},
}</code>
</code></pre>
</div>
<div data-ice="properties">
</div>
<div class="return-params" data-ice="returnParams">
<h4>Return:</h4>
<table>
<tbody>
<tr>
<td class="return-type" data-ice="returnType"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a></span></td>
<td class="return-desc" data-ice="returnDescription"><p>transitions</p>
</td>
</tr>
</tbody>
</table>
<div data-ice="returnProperties">
</div>
</div>
</div>
<div class="detail" data-ice="detail">
<h3 data-ice="anchor" id="instance-method-execute">

@@ -1096,3 +1210,3 @@ <span class="access" data-ice="access">public</span>

<span data-ice="source"><span><a href="file/lib/fsm.js.html#lineNumber210">source</a></span></span>
<span data-ice="source"><span><a href="file/lib/fsm.js.html#lineNumber229">source</a></span></span>
</span>

@@ -1252,3 +1366,3 @@ </h3>

<span data-ice="source"><span><a href="file/lib/fsm.js.html#lineNumber176">source</a></span></span>
<span data-ice="source"><span><a href="file/lib/fsm.js.html#lineNumber195">source</a></span></span>
</span>

@@ -1260,17 +1374,3 @@ </h3>

<div data-ice="description"><p>Get rest API links for all currently available transitions than define the</p>
</div>
<div data-ice="properties">
</div>
<div class="return-params" data-ice="returnParams">
<h4>Return:</h4>
<table>
<tbody>
<tr>
<td class="return-type" data-ice="returnType"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a></span></td>
<td class="return-desc" data-ice="returnDescription"><p>&quot;restApi&quot; object.</p>
<div data-ice="description"><p>Get rest API links for all currently available transitions where defined</p>
<pre><code class="lang-javascript"><code class="source-code prettyprint">// example output:

@@ -1291,2 +1391,16 @@ {

</code></pre>
</div>
<div data-ice="properties">
</div>
<div class="return-params" data-ice="returnParams">
<h4>Return:</h4>
<table>
<tbody>
<tr>
<td class="return-type" data-ice="returnType"><span><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a></span></td>
<td class="return-desc" data-ice="returnDescription"><p>&quot;restApi&quot; object.</p>
</td>

@@ -1293,0 +1407,0 @@ </tr>

{
"coverage": "88.88%",
"expectCount": 18,
"actualCount": 16,
"coverage": "100%",
"expectCount": 17,
"actualCount": 17,
"files": {

@@ -12,21 +12,7 @@ "lib/composit-state.js": {

"lib/fsm.js": {
"expectCount": 13,
"actualCount": 13,
"expectCount": 14,
"actualCount": 14,
"undocumentLines": []
},
"lib/find-possible-transitions.js": {
"expectCount": 1,
"actualCount": 0,
"undocumentLines": [
36
]
},
"lib/is-valid-state-value.js": {
"expectCount": 1,
"actualCount": 0,
"undocumentLines": [
4
]
}
}
}

@@ -37,4 +37,2 @@ <!DOCTYPE html>

<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/lib/fsm.js~FSM.html">FSM</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-findpossibletransitions">findpossibletransitions</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-isvalidstatevalue">isvalidstatevalue</a></span></span></li>
</ul>

@@ -41,0 +39,0 @@ </div>

@@ -37,4 +37,2 @@ <!DOCTYPE html>

<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/lib/fsm.js~FSM.html">FSM</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-findpossibletransitions">findpossibletransitions</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-isvalidstatevalue">isvalidstatevalue</a></span></span></li>
</ul>

@@ -41,0 +39,0 @@ </div>

@@ -37,4 +37,2 @@ <!DOCTYPE html>

<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/lib/fsm.js~FSM.html">FSM</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-findpossibletransitions">findpossibletransitions</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-isvalidstatevalue">isvalidstatevalue</a></span></span></li>
</ul>

@@ -41,0 +39,0 @@ </div>

@@ -37,4 +37,2 @@ <!DOCTYPE html>

<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/lib/fsm.js~FSM.html">FSM</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-findpossibletransitions">findpossibletransitions</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-isvalidstatevalue">isvalidstatevalue</a></span></span></li>
</ul>

@@ -41,0 +39,0 @@ </div>

@@ -37,4 +37,2 @@ <!DOCTYPE html>

<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/lib/fsm.js~FSM.html">FSM</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-findpossibletransitions">findpossibletransitions</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-isvalidstatevalue">isvalidstatevalue</a></span></span></li>
</ul>

@@ -41,0 +39,0 @@ </div>

@@ -37,4 +37,2 @@ <!DOCTYPE html>

<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/lib/fsm.js~FSM.html">FSM</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-findpossibletransitions">findpossibletransitions</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-isvalidstatevalue">isvalidstatevalue</a></span></span></li>
</ul>

@@ -41,0 +39,0 @@ </div>

@@ -37,4 +37,2 @@ <!DOCTYPE html>

<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/lib/fsm.js~FSM.html">FSM</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-findpossibletransitions">findpossibletransitions</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-isvalidstatevalue">isvalidstatevalue</a></span></span></li>
</ul>

@@ -79,3 +77,3 @@ </div>

/** @private */
module.exports = (state, transitions) =&gt; transitions.filter(t =&gt; matchState(state, t));

@@ -82,0 +80,0 @@ </code></pre>

@@ -37,4 +37,2 @@ <!DOCTYPE html>

<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/lib/fsm.js~FSM.html">FSM</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-findpossibletransitions">findpossibletransitions</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-isvalidstatevalue">isvalidstatevalue</a></span></span></li>
</ul>

@@ -41,0 +39,0 @@ </div>

@@ -37,4 +37,2 @@ <!DOCTYPE html>

<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/lib/fsm.js~FSM.html">FSM</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-findpossibletransitions">findpossibletransitions</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-isvalidstatevalue">isvalidstatevalue</a></span></span></li>
</ul>

@@ -96,7 +94,7 @@ </div>

* @param {object} options.data the data that is stored in the state machine
* @param {function} options.saveState function with signature &quot;async (ctx, arg1, arg2...) =&gt; {...}&quot;
* @param {function} options.willChangeState function with signature &quot;async (ctx, arg1, arg2...) =&gt; {...}&quot;
* @param {function} options.didChangeState function with signature &quot;async (ctx, arg1, arg2...) =&gt; {...}&quot;
* @param {function} options.willSaveState function with signature &quot;async (ctx, arg1, arg2...) =&gt; {...}&quot;
* @param {function} options.didSaveState function with signature &quot;async (ctx, arg1, arg2...) =&gt; {...}&quot;
* @param {function} options.saveState function with signature `async (ctx, arg1, arg2...) =&gt; {...}`
* @param {function} options.willChangeState function with signature `async (ctx, arg1, arg2...) =&gt; {...}`
* @param {function} options.didChangeState function with signature `async (ctx, arg1, arg2...) =&gt; {...}`
* @param {function} options.willSaveState function with signature `async (ctx, arg1, arg2...) =&gt; {...}`
* @param {function} options.didSaveState function with signature `async (ctx, arg1, arg2...) =&gt; {...}`
* @param {object} options.eventHandler object containin hander for specific trasaction

@@ -202,5 +200,23 @@ * ```

/**
* Get rest API links for all currently available transitions than define the
* @return {object} &quot;restApi&quot; object.
* Get all transititons that are defined for the state machine in the format
* ```javascript
* {
* t1: { from: &apos;a&apos;, to: &apos;b&apos;, ...},
* t2: { from: &apos;a&apos;, to: &apos;b&apos;, ...},
* t3: { from: &apos;a&apos;, to: &apos;b&apos;, ...},
* }```
* @return {object} transitions
*/
allTransitions() {
const ts = {};
this._transitions.forEach((t) =&gt; {
ts[t.name] = Object.assign({}, t);
delete ts[t.name].name;
});
return ts;
}
/**
* Get rest API links for all currently available transitions where defined
* ```javascript
* // example output:

@@ -221,2 +237,3 @@ * {

* ```
* @return {object} &quot;restApi&quot; object.
*/

@@ -271,13 +288,20 @@ restApi() {

* transition can be triggered.&lt;br&gt;&lt;br&gt;
* Supported syntax:&lt;br&gt;
* Supported syntax:
* ```
* &apos;*&apos; =&gt; allow from any state
* &apos;state1&apos; =&gt; allow only from state &apos;state1&apos;&lt;br&gt;
* [&apos;state1&apos;, &apos;state2&apos;] =&gt; allow transition from state1 &amp; state2&lt;br&gt;
* { state: [&apos;s1&apos;, &apos;s2&apos;], substate: [&apos;sub1&apos;, &apos;sub2&apos;] } =&gt; allow transition from all states creates by calculating all&lt;br&gt;
* permutations of the given states. &apos;state:s2|substate:sub1&apos; &apos;state:s2|substate:sub1&apos; &apos;state:s2|substate:sub2&apos;
* &apos;state1&apos; =&gt; allow only from state &apos;state1&apos;
* [&apos;state1&apos;, &apos;state2&apos;] =&gt; allow transition from state1 &amp; state2
* { state: [&apos;s1&apos;, &apos;s2&apos;], substate: [&apos;sub1&apos;, &apos;sub2&apos;] } =&gt; allow transition
* from all states creates by calculating all
* permutations of the given states. &apos;state:s2|substate:sub1&apos;
* &apos;state:s2|substate:sub1&apos; and &apos;state:s2|substate:sub2&apos;
* ```
* @param {(string|object} transition.form defines the state that is created after the transition&lt;br&gt;&lt;br&gt;
* Supported syntax:&lt;br&gt;
* &apos;*&apos; =&gt; do not change source state&lt;br&gt;
* &apos;state1&apos; =&gt; sets target state to &apos;state1&apos;&lt;br&gt;
* { state: &apos;s1&apos; } =&gt; sets the property &quot;state&quot; of the current state to &quot;s1&quot; eg. patches the existing state object representation
* Supported syntax:
* ```javascript
* &apos;*&apos; =&gt; do not change source state
* &apos;state1&apos; =&gt; sets target state to &apos;state1&apos;
* { state: &apos;s1&apos; } =&gt; sets the property &quot;state&quot; of the current state
* to &quot;s1&quot; eg. patches the existing state object representation
* ```
*/

@@ -284,0 +308,0 @@ addTransition(transition) {

@@ -37,4 +37,2 @@ <!DOCTYPE html>

<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/lib/fsm.js~FSM.html">FSM</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-findpossibletransitions">findpossibletransitions</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-isvalidstatevalue">isvalidstatevalue</a></span></span></li>
</ul>

@@ -255,2 +253,10 @@ </div>

it.only(&apos;can list all transitions&apos;, async () =&gt; {
expect(fsm.allTransitions()).to.eql({
&apos;a-to-b&apos;: { from: &apos;a&apos;, to: &apos;b&apos; },
&apos;no:op&apos;: { from: &apos;a&apos;, to: &apos;*&apos; },
&apos;b-to-c&apos;: { from: &apos;b&apos;, to: &apos;c&apos; },
});
});
it(&apos;cannot run invalid transition&apos;, async () =&gt; {

@@ -257,0 +263,0 @@ let error;

@@ -37,4 +37,2 @@ <!DOCTYPE html>

<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/lib/fsm.js~FSM.html">FSM</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-findpossibletransitions">findpossibletransitions</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-isvalidstatevalue">isvalidstatevalue</a></span></span></li>
</ul>

@@ -41,0 +39,0 @@ </div>

@@ -37,4 +37,2 @@ <!DOCTYPE html>

<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/lib/fsm.js~FSM.html">FSM</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-findpossibletransitions">findpossibletransitions</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-isvalidstatevalue">isvalidstatevalue</a></span></span></li>
</ul>

@@ -48,2 +46,4 @@ </div>

const STATE_KEY_REGEX = /^([a-zA-Z0-9-_.#/@$%^!=&lt;&gt;+~?]+|\*)$/;
/** @private */
module.exports = value =&gt; value.match(STATE_KEY_REGEX);

@@ -50,0 +50,0 @@ </code></pre>

@@ -37,4 +37,2 @@ <!DOCTYPE html>

<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/lib/fsm.js~FSM.html">FSM</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-findpossibletransitions">findpossibletransitions</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-isvalidstatevalue">isvalidstatevalue</a></span></span></li>
</ul>

@@ -41,0 +39,0 @@ </div>

@@ -37,4 +37,2 @@ <!DOCTYPE html>

<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/lib/fsm.js~FSM.html">FSM</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-findpossibletransitions">findpossibletransitions</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-isvalidstatevalue">isvalidstatevalue</a></span></span></li>
</ul>

@@ -41,0 +39,0 @@ </div>

@@ -37,4 +37,2 @@ <!DOCTYPE html>

<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/lib/fsm.js~FSM.html">FSM</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-findpossibletransitions">findpossibletransitions</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-isvalidstatevalue">isvalidstatevalue</a></span></span></li>
</ul>

@@ -41,0 +39,0 @@ </div>

@@ -37,4 +37,2 @@ <!DOCTYPE html>

<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/lib/fsm.js~FSM.html">FSM</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-findpossibletransitions">findpossibletransitions</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-isvalidstatevalue">isvalidstatevalue</a></span></span></li>
</ul>

@@ -41,0 +39,0 @@ </div>

@@ -37,4 +37,2 @@ <!DOCTYPE html>

<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/lib/fsm.js~FSM.html">FSM</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-findpossibletransitions">findpossibletransitions</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-isvalidstatevalue">isvalidstatevalue</a></span></span></li>
</ul>

@@ -41,0 +39,0 @@ </div>

@@ -37,4 +37,2 @@ <!DOCTYPE html>

<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/lib/fsm.js~FSM.html">FSM</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-findpossibletransitions">findpossibletransitions</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-isvalidstatevalue">isvalidstatevalue</a></span></span></li>
</ul>

@@ -41,0 +39,0 @@ </div>

@@ -37,3 +37,2 @@ <!DOCTYPE html>

<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/lib/fsm.js~FSM.html">FSM</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-findpossibletransitions">findpossibletransitions</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-isvalidstatevalue">isvalidstatevalue</a></span></span></li>

@@ -62,29 +61,2 @@ </ul>

<span data-ice="name"><span><a href="function/index.html#static-function-findpossibletransitions">findpossibletransitions</a></span></span><span data-ice="signature">(state: <span>*</span>, transitions: <span>*</span>)</span>
</p>
</div>
<div>
</div>
</td>
<td>
</td>
</tr>
<tr data-ice="target">
<td>
<span class="access" data-ice="access">public</span>
<span class="override" data-ice="override"></span>
</td>
<td>
<div>
<p>
<span data-ice="name"><span><a href="function/index.html#static-function-isvalidstatevalue">isvalidstatevalue</a></span></span><span data-ice="signature">(value: <span>*</span>)</span>

@@ -110,67 +82,2 @@ </p>

<div class="detail" data-ice="detail">
<h3 data-ice="anchor" id="static-function-findpossibletransitions">
<span class="access" data-ice="access">public</span>
<span data-ice="name">findpossibletransitions</span><span data-ice="signature">(state: <span>*</span>, transitions: <span>*</span>)</span>
<span class="right-info">
<span data-ice="source"><span><a href="file/lib/find-possible-transitions.js.html#lineNumber36">source</a></span></span>
</span>
</h3>
<div data-ice="importPath" class="import-path"><pre class="prettyprint"><code data-ice="importPathCode">import findpossibletransitions from &apos;<span><a href="file/lib/find-possible-transitions.js.html#lineNumber36">@trigo/fsm/lib/find-possible-transitions.js</a></span>&apos;</code></pre></div>
<div data-ice="properties"><div data-ice="properties">
<h4 data-ice="title">Params:</h4>
<table class="params">
<thead>
<tr><td>Name</td><td>Type</td><td>Attribute</td><td>Description</td></tr>
</thead>
<tbody>
<tr data-ice="property" data-depth="0">
<td data-ice="name" data-depth="0">state</td>
<td data-ice="type"><span>*</span></td>
<td data-ice="appendix"></td>
<td data-ice="description"></td>
</tr>
<tr data-ice="property" data-depth="0">
<td data-ice="name" data-depth="0">transitions</td>
<td data-ice="type"><span>*</span></td>
<td data-ice="appendix"></td>
<td data-ice="description"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="detail" data-ice="detail">
<h3 data-ice="anchor" id="static-function-isvalidstatevalue">

@@ -177,0 +84,0 @@ <span class="access" data-ice="access">public</span>

@@ -37,4 +37,2 @@ <!DOCTYPE html>

<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/lib/fsm.js~FSM.html">FSM</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-findpossibletransitions">findpossibletransitions</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-isvalidstatevalue">isvalidstatevalue</a></span></span></li>
</ul>

@@ -109,66 +107,6 @@ </div>

<div data-ice="functionSummary"><h2 id="function">Function Summary</h2><table class="summary" data-ice="summary">
<thead><tr><td data-ice="title" colspan="3">Static Public Function Summary</td></tr></thead>
<tbody>
<tr data-ice="target">
<td>
<span class="access" data-ice="access">public</span>
<span class="override" data-ice="override"></span>
</td>
<td>
<div>
<p>
<span data-ice="name"><span><a href="function/index.html#static-function-findpossibletransitions">findpossibletransitions</a></span></span><span data-ice="signature">(state: <span>*</span>, transitions: <span>*</span>)</span>
</p>
</div>
<div>
</div>
</td>
<td>
</td>
</tr>
<tr data-ice="target">
<td>
<span class="access" data-ice="access">public</span>
<span class="override" data-ice="override"></span>
</td>
<td>
<div>
<p>
<span data-ice="name"><span><a href="function/index.html#static-function-isvalidstatevalue">isvalidstatevalue</a></span></span><span data-ice="signature">(value: <span>*</span>)</span>
</p>
</div>
<div>
</div>
</td>
<td>
</td>
</tr>
</tbody>
</table>
</div>
</div>

@@ -175,0 +113,0 @@

@@ -37,4 +37,2 @@ <!DOCTYPE html>

<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/lib/fsm.js~FSM.html">FSM</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-findpossibletransitions">findpossibletransitions</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-isvalidstatevalue">isvalidstatevalue</a></span></span></li>
</ul>

@@ -41,0 +39,0 @@ </div>

{
"name": "@trigo/fsm",
"version": "3.0.1",
"version": "3.1.0",
"description": "FSM - Finite State Machine",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -15,14 +15,2 @@ window.esdocSearchIndex = [

[
"@trigo/fsm/lib/find-possible-transitions.js~findpossibletransitions",
"function/index.html#static-function-findpossibletransitions",
"<span>findpossibletransitions</span> <span class=\"search-result-import-path\">@trigo/fsm/lib/find-possible-transitions.js</span>",
"function"
],
[
"@trigo/fsm/lib/is-valid-state-value.js~isvalidstatevalue",
"function/index.html#static-function-isvalidstatevalue",
"<span>isvalidstatevalue</span> <span class=\"search-result-import-path\">@trigo/fsm/lib/is-valid-state-value.js</span>",
"function"
],
[
"builtinexternal/ecmascriptexternal.js~array",

@@ -436,2 +424,8 @@ "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array",

[
"lib/fsm.js~fsm#alltransitions",
"class/lib/fsm.js~FSM.html#instance-method-allTransitions",
"lib/fsm.js~FSM#allTransitions",
"method"
],
[
"lib/fsm.js~fsm#constructor",

@@ -438,0 +432,0 @@ "class/lib/fsm.js~FSM.html#instance-constructor-constructor",

@@ -37,4 +37,2 @@ <!DOCTYPE html>

<li data-ice="doc"><span data-ice="kind" class="kind-class">C</span><span data-ice="name"><span><a href="class/lib/fsm.js~FSM.html">FSM</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-findpossibletransitions">findpossibletransitions</a></span></span></li>
<li data-ice="doc"><span data-ice="kind" class="kind-function">F</span><span data-ice="name"><span><a href="function/index.html#static-function-isvalidstatevalue">isvalidstatevalue</a></span></span></li>
</ul>

@@ -44,3 +42,3 @@ </div>

<div class="content" data-ice="content"><h1>Source <img data-ice="coverageBadge" src="./badge.svg"><span data-ice="totalCoverageCount" class="total-coverage-count">16/18</span></h1>
<div class="content" data-ice="content"><h1>Source <img data-ice="coverageBadge" src="./badge.svg"><span data-ice="totalCoverageCount" class="total-coverage-count">17/17</span></h1>

@@ -109,8 +107,8 @@ <table class="files-summary" data-ice="files" data-use-coverage="true">

<tr data-ice="file">
<td data-ice="filePath"><span><a href="file/lib/find-possible-transitions.js.html#errorLines=36">lib/find-possible-transitions.js</a></span></td>
<td data-ice="identifier" class="identifiers"><span><a href="function/index.html#static-function-findpossibletransitions">findpossibletransitions</a></span></td>
<td class="coverage"><span data-ice="coverage">0 %</span><span data-ice="coverageCount" class="coverage-count">0/1</span></td>
<td style="display: none;" data-ice="size">956 byte</td>
<td data-ice="filePath"><span><a href="file/lib/find-possible-transitions.js.html">lib/find-possible-transitions.js</a></span></td>
<td data-ice="identifier" class="identifiers">-</td>
<td class="coverage"><span data-ice="coverage">-</span></td>
<td style="display: none;" data-ice="size">971 byte</td>
<td style="display: none;" data-ice="lines">36</td>
<td style="display: none;" data-ice="updated">2017-05-03 11:52:05 (UTC)</td>
<td style="display: none;" data-ice="updated">2017-08-06 19:55:01 (UTC)</td>
</tr>

@@ -128,6 +126,6 @@ <tr data-ice="file">

<td data-ice="identifier" class="identifiers"><span><a href="class/lib/fsm.js~FSM.html">FSM</a></span></td>
<td class="coverage"><span data-ice="coverage">100 %</span><span data-ice="coverageCount" class="coverage-count">13/13</span></td>
<td style="display: none;" data-ice="size">10575 byte</td>
<td style="display: none;" data-ice="lines">336</td>
<td style="display: none;" data-ice="updated">2017-08-04 14:40:32 (UTC)</td>
<td class="coverage"><span data-ice="coverage">100 %</span><span data-ice="coverageCount" class="coverage-count">14/14</span></td>
<td style="display: none;" data-ice="size">11036 byte</td>
<td style="display: none;" data-ice="lines">362</td>
<td style="display: none;" data-ice="updated">2017-08-06 19:53:44 (UTC)</td>
</tr>

@@ -138,5 +136,5 @@ <tr data-ice="file">

<td class="coverage"><span data-ice="coverage">-</span></td>
<td style="display: none;" data-ice="size">18673 byte</td>
<td style="display: none;" data-ice="lines">737</td>
<td style="display: none;" data-ice="updated">2017-08-04 14:29:46 (UTC)</td>
<td style="display: none;" data-ice="size">18893 byte</td>
<td style="display: none;" data-ice="lines">745</td>
<td style="display: none;" data-ice="updated">2017-08-06 19:41:02 (UTC)</td>
</tr>

@@ -152,8 +150,8 @@ <tr data-ice="file">

<tr data-ice="file">
<td data-ice="filePath"><span><a href="file/lib/is-valid-state-value.js.html#errorLines=4">lib/is-valid-state-value.js</a></span></td>
<td data-ice="identifier" class="identifiers"><span><a href="function/index.html#static-function-isvalidstatevalue">isvalidstatevalue</a></span></td>
<td class="coverage"><span data-ice="coverage">0 %</span><span data-ice="coverageCount" class="coverage-count">0/1</span></td>
<td style="display: none;" data-ice="size">134 byte</td>
<td style="display: none;" data-ice="lines">4</td>
<td style="display: none;" data-ice="updated">2017-04-05 07:50:56 (UTC)</td>
<td data-ice="filePath"><span><a href="file/lib/is-valid-state-value.js.html">lib/is-valid-state-value.js</a></span></td>
<td data-ice="identifier" class="identifiers">-</td>
<td class="coverage"><span data-ice="coverage">-</span></td>
<td style="display: none;" data-ice="size">151 byte</td>
<td style="display: none;" data-ice="lines">6</td>
<td style="display: none;" data-ice="updated">2017-08-06 19:55:37 (UTC)</td>
</tr>

@@ -160,0 +158,0 @@ <tr data-ice="file">

@@ -35,3 +35,3 @@ 'use strict';

/** @private */
module.exports = (state, transitions) => transitions.filter(t => matchState(state, t));

@@ -52,7 +52,7 @@ 'use strict';

* @param {object} options.data the data that is stored in the state machine
* @param {function} options.saveState function with signature "async (ctx, arg1, arg2...) => {...}"
* @param {function} options.willChangeState function with signature "async (ctx, arg1, arg2...) => {...}"
* @param {function} options.didChangeState function with signature "async (ctx, arg1, arg2...) => {...}"
* @param {function} options.willSaveState function with signature "async (ctx, arg1, arg2...) => {...}"
* @param {function} options.didSaveState function with signature "async (ctx, arg1, arg2...) => {...}"
* @param {function} options.saveState function with signature `async (ctx, arg1, arg2...) => {...}`
* @param {function} options.willChangeState function with signature `async (ctx, arg1, arg2...) => {...}`
* @param {function} options.didChangeState function with signature `async (ctx, arg1, arg2...) => {...}`
* @param {function} options.willSaveState function with signature `async (ctx, arg1, arg2...) => {...}`
* @param {function} options.didSaveState function with signature `async (ctx, arg1, arg2...) => {...}`
* @param {object} options.eventHandler object containin hander for specific trasaction

@@ -158,5 +158,19 @@ * ```

/**
* Get rest API links for all currently available transitions than define the
* @return {object} "restApi" object.
* Get all transititons that are defined for the state machine in the format
* ```javascript
* [
* { name: 'a-to-b', from: 'a', to: 'b' },
* { name: 'no:op', from: 'a', to: '*' },
* { name: 'b-to-c', from: 'b', to: 'c' },
* ]
* }```
* @return {Array.<object>} transitions
*/
allTransitions() {
return this._transitions.map(t => Object.assign({}, t));
}
/**
* Get rest API links for all currently available transitions where defined
* ```javascript
* // example output:

@@ -177,2 +191,3 @@ * {

* ```
* @return {object} "restApi" object.
*/

@@ -227,13 +242,20 @@ restApi() {

* transition can be triggered.<br><br>
* Supported syntax:<br>
* Supported syntax:
* ```
* '*' => allow from any state
* 'state1' => allow only from state 'state1'<br>
* ['state1', 'state2'] => allow transition from state1 & state2<br>
* { state: ['s1', 's2'], substate: ['sub1', 'sub2'] } => allow transition from all states creates by calculating all<br>
* permutations of the given states. 'state:s2|substate:sub1' 'state:s2|substate:sub1' 'state:s2|substate:sub2'
* 'state1' => allow only from state 'state1'
* ['state1', 'state2'] => allow transition from state1 & state2
* { state: ['s1', 's2'], substate: ['sub1', 'sub2'] } => allow transition
* from all states creates by calculating all
* permutations of the given states. 'state:s2|substate:sub1'
* 'state:s2|substate:sub1' and 'state:s2|substate:sub2'
* ```
* @param {(string|object} transition.form defines the state that is created after the transition<br><br>
* Supported syntax:<br>
* '*' => do not change source state<br>
* 'state1' => sets target state to 'state1'<br>
* { state: 's1' } => sets the property "state" of the current state to "s1" eg. patches the existing state object representation
* Supported syntax:
* ```javascript
* '*' => do not change source state
* 'state1' => sets target state to 'state1'
* { state: 's1' } => sets the property "state" of the current state
* to "s1" eg. patches the existing state object representation
* ```
*/

@@ -240,0 +262,0 @@ addTransition(transition) {

@@ -211,2 +211,10 @@ 'use strict';

it('can list all transitions', async () => {
expect(fsm.allTransitions()).to.eql([
{ name: 'a-to-b', from: 'a', to: 'b' },
{ name: 'no:op', from: 'a', to: '*' },
{ name: 'b-to-c', from: 'b', to: 'c' },
]);
});
it('cannot run invalid transition', async () => {

@@ -213,0 +221,0 @@ let error;

'use strict';
const STATE_KEY_REGEX = /^([a-zA-Z0-9-_.#/@$%^!=<>+~?]+|\*)$/;
/** @private */
module.exports = value => value.match(STATE_KEY_REGEX);
{
"name": "@trigo/fsm",
"version": "3.1.0",
"version": "3.2.0",
"description": "FSM - Finite State Machine",

@@ -5,0 +5,0 @@ "main": "index.js",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display