Skip to content

Instantly share code, notes, and snippets.

@arturcarvalho
Last active May 18, 2021 17:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arturcarvalho/5ecc036e9a420da8f5720af16061a717 to your computer and use it in GitHub Desktop.
Save arturcarvalho/5ecc036e9a420da8f5720af16061a717 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const stateMachine = Machine({
id: 'schedules pass',
type: "parallel",
states: {
happy_path: {
initial:"init",
states: {
init: {
on:{
REQUEST_BOOKING:"booking_pending"
}
},
booking_pending:{
on:{
BOOKING_BOOKED: "booked",
},
},
booked: {
on:{
ENTER_PASS: "in_progress"
}
},
in_progress:{
on:{
PUT_ON_SAT: "scheduled"
}
},
scheduled:{
on:{
IN_THE_PAST: "verification_pending"
}
},
verification_pending:{
type: "final",
on:{
FEEDBACK_COMP: "complete",
}
},
complete:{type:"final"},
}
},
full_path: {
initial:"init",
states: {
init: {
on:{
REQUEST_BOOKING:"booking_pending" ,
BOOKING_FAILED:"booking_failed",
BOOKING_CANCELLED: "cancelled",
}
},
booking_failed:{type:"final"},
cancelled:{type:"final"},
booking_pending:{
on:{
BOOKING_BOOKED: "booked",
},
},
booked: {
on:{
ENTER_PASS: "in_progress",
BOOKED_CANCELLED: "cancelled"
}
},
in_progress:{
on:{
PUT_ON_SAT: "scheduled"
}
},
scheduled:{
on:{
IN_THE_PAST: "verification_pending"
}
},
verification_pending:{
type: "final",
on:{
FEEDBACK_COMP: "complete",
FEEDBACK_INCOMP: "incomplete",
FEEDBACK_FAIL: "failed",
}
},
complete:{type:"final"},
incomplete:{type:"final"},
failed:{type:"final"},
}
},
command_lifecycle: {
initial: "scheduled",
states:{
scheduled: {
on:{PUT_ON_SAT: "verification_pending"}
},
verification_pending:{
on:{
FEED_COMPLETE: "complete",
FEED_FAIL: "failed",
FEED_COMPLETE: "complete",
}
},
complete:{type:"final"},
failed:{type:"final"},
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment