Last active
July 28, 2020 13:51
-
-
Save sergiokopplin/75d3390a3f869b1f779cbd5d707690f9 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
const fetchMachine = Machine({ | |
id: 'importer', | |
initial: 'idle', | |
states: { | |
idle: { | |
on: { | |
start: 'registration', | |
}, | |
}, | |
registration: { | |
id: 'registration', | |
initial: 'command', | |
states: { | |
command: { | |
initial: 'running', | |
states: { | |
running: { | |
invoke: { | |
id: 'sendJob', | |
src: 'sendJob', | |
onDone: { | |
target: 'success', | |
}, | |
onError: { | |
target: '#failure', | |
}, | |
}, | |
}, | |
success: { | |
on: { | |
done: '#searching-registration' | |
} | |
}, | |
}, | |
}, | |
searching: { | |
id: 'searching-registration', | |
initial: 'running', | |
states: { | |
running: { | |
invoke: { | |
id: 'searchJob', | |
src: 'searchJob', | |
onDone: { | |
target: 'success', | |
}, | |
onError: { | |
target: '#failure', | |
}, | |
}, | |
}, | |
success: { | |
on: { | |
done: '#report-registration' | |
} | |
}, | |
}, | |
}, | |
report: { | |
id: 'report-registration', | |
on: { | |
done: '#transaction' | |
} | |
}, | |
}, | |
}, | |
transaction: { | |
id: 'transaction', | |
initial: 'command', | |
states: { | |
command: { | |
initial: 'running', | |
states: { | |
running: { | |
invoke: { | |
id: 'sendJob', | |
src: 'sendJob', | |
onDone: { | |
target: 'success', | |
}, | |
onError: { | |
target: '#failure', | |
}, | |
}, | |
}, | |
success: { | |
on: { | |
done: '#searching-transaction' | |
} | |
}, | |
}, | |
}, | |
searching: { | |
id: 'searching-transaction', | |
initial: 'running', | |
states: { | |
running: { | |
invoke: { | |
id: 'searchJob', | |
src: 'searchJob', | |
onDone: { | |
target: 'success', | |
}, | |
onError: { | |
target: '#failure', | |
}, | |
}, | |
}, | |
success: { | |
on: { | |
done: '#report-transaction' | |
} | |
}, | |
}, | |
}, | |
report: { | |
id: 'report-transaction', | |
on: { | |
done: '#report' | |
}, | |
}, | |
}, | |
}, | |
report: { | |
id: 'report', | |
type: 'final', | |
}, | |
failure: { | |
type: 'final', | |
id: 'failure', | |
}, | |
}, | |
}, { | |
actions: {}, | |
services: { | |
sendJob: () => ({}), | |
searchJob: () => ({}), | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment