@enfo/shake-state-machine
v1.0.0
Published
NPM package for shaking an AWS State Machine removing unused states
Downloads
10
Readme
@enfo/shake-state-machine
Remove unused states from an AWS State Machine definition with minimal effort
Usage
npm i @enfo/shake-state-machine -g
Add a state machine definition to your clipboard with your desired start state as StartAt. Invoke the package and if all went well your clipboard will now contain a state machine with no unreachable states.
shake-state-machine
Alternatively the package can be invoked using npx.
npx @enfo/shake-state-machine
Practical example
Let us have a look at an AWS State Machine definition.
Execution is successful.
Let us try to modify the State Machine so it skips the Hello state and starts at World. Attempting to save will result in an error regarding an unreachable state.
Copy the definition into your clipboard and run the package. Paste to the definition input field afterwards
shake-state-machine
The new state machine definition is ready to be used. When used in the wild you can have your State Machine fixed in a matter of seconds!
How it works
Under the hood the package runs a Depth-first search starting at StartAt. After completing it builds a new state machine using only the visited states.
License
MIT