Skip to content

NPM package for shaking an AWS state machine removing unused states

License

Notifications You must be signed in to change notification settings

enfogroup/shake-state-machine

Repository files navigation

@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

About

NPM package for shaking an AWS state machine removing unused states

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published