Skip to content

Instantly share code, notes, and snippets.

@joaom182
Created November 12, 2021 00:59
Show Gist options
  • Save joaom182/8c9aeab84ab6a7acbe6ca680046cc4b0 to your computer and use it in GitHub Desktop.
Save joaom182/8c9aeab84ab6a7acbe6ca680046cc4b0 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
const fetchMachine = Machine({
id: 'entity-information',
initial: 'get_entity_ownership',
entry: ['assignUpstreamEntities', 'assignInitialEntity'],
states: {
get_entity_ownership: {
exit: ['assignUpstreamEntities'],
on: {
NEXT: [
{
target: 'entity_authorized_signers',
cond: 'currentEntityIsRoot'
},
{
target: 'final',
cond: 'isLastEntity'
},
{
actions: ['assignNextEntity'],
target: 'get_entity_ownership'
}
],
BACK: [
{
target: 'disclosures_loop',
cond: 'currentEntityIsRoot'
},
{
target: 'entity_authorized_signers',
cond: 'previousEntityIsRoot',
actions: 'assignPreviousEntity'
},
{
target: 'get_entity_ownership',
actions: ['assignPreviousEntity']
}
]
}
},
disclosures_loop: {},
entity_authorized_signers: {
on: {
NEXT: [
{
target: 'final',
cond: 'hasOnlyOneEntity'
},
{
target: 'final',
cond: 'isLastEntity'
},
{
target: 'get_entity_ownership',
actions: ['assignNextEntity']
}
],
BACK: {
target: 'get_entity_ownership'
}
}
},
final: {
type: 'final'
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment