@enfo/shake-state-machine

1.0.0 • Public • Published

@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.

Hello World State Machine

Execution is successful.

Successful execution

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.

State "Hello" is not reachable

Copy the definition into your clipboard and run the package. Paste to the definition input field afterwards

shake-state-machine

Just World

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

Package Sidebar

Install

npm i @enfo/shake-state-machine

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

7.84 kB

Total Files

4

Last publish

Collaborators

  • castodius
  • enfogroup