
Product
Reachability for Ruby Now in Beta
Reachability analysis for Ruby is now in beta, helping teams identify which vulnerabilities are truly exploitable in their applications.
state-machine-builder-utility
Advanced tools
States
trafficLightStateMachine = createStateMachine({
initial_state: 'green',
states: {
green: {
/* ... */
},
red: {
/* ... */
}
}
});
State transitions are defined on state nodes, in the on property:
trafficLightStateMachine = createStateMachine({
initial_state: 'green',
states: {
green: {
on: {
NEXT: "yellow"
}
},
red: {
on: {
NEXT: {
target: "green"
}
}
}
}
});
Making Transition
trafficLightStateMachine.transition("NEXT")
trafficLightStateMachine = createStateMachine({
initial_state: 'green',
states: {
green: {
on: {
after: {
duration: 5000,
actions: [{
type: 'EVENT_TRIGGER',
event: 'NEXT'
}]
}
NEXT: "yellow"
}
},
red: {
on: {
NEXT: {
target: "green"
}
}
}
}
});
This type of transition is immediately taken without triggering an event as long as any given conditions are met
states: {
failure: {
on: {
"": [
{
target: "trigger_request",
condition: "gotBadResponse",
actions: [
{
type: "ASSIGN_CONTEXT",
eval_new_context: (context) => ({
retry_count: context.retry_count + 1
})
}
]
},
{ target: "fetching_failed", condition: "maxRetryError" }
]
}
}
}
This type of transition between states to only take place if certain conditions on the state are met.
maxRetryError: {
gotBadResponse: (context, event, data) => {
return context.retry_count > 3;
}
}
you can enable logging by setting it true in the state machine configuration. This will log the when the events are triggered and a state of the state machine has changed.
createStateMachine({
initial_state: 'green',
logging: true,
});
FAQs
States
We found that state-machine-builder-utility demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Reachability analysis for Ruby is now in beta, helping teams identify which vulnerabilities are truly exploitable in their applications.

Research
/Security News
Malicious npm packages use Adspect cloaking and fake CAPTCHAs to fingerprint visitors and redirect victims to crypto-themed scam sites.

Security News
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.