Created
November 12, 2021 00:59
-
-
Save joaom182/8c9aeab84ab6a7acbe6ca680046cc4b0 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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