Skip to content

Instantly share code, notes, and snippets.

@gyula-ny
Created May 7, 2020 16:44
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 gyula-ny/b369e424589231c36b9dbc5d349c3cc2 to your computer and use it in GitHub Desktop.
Save gyula-ny/b369e424589231c36b9dbc5d349c3cc2 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: 'helloWorld',
initial: 'waitingForValidation',
states: {
waitingForValidation: {
on: {
Validated: "waitingForRequestForReview"
}
},
waitingForRequestForReview: {
on: {
RequestForReview: "PendingApproval"
}
},
PendingApproval: {
states: {
CatalogListing: {
initial: 'pending',
type: 'compound',
states: {
pending: {
on: {
CatalogListing_APPROVED: 'done',
CatalogListing_REJECTED: {
target: 'rejected'
}
}
},
rejected: {
on: {
CatalogListing_SUBMIT: 'pending'
}
},
done: {
type: 'final'
}
}
},
BusinessCase: {
initial: 'pending',
type: 'compound',
states: {
pending: {
on: {
BusinessCase_APPROVED: 'done',
BusinessCase_REJECTED: {
target: 'rejected'
}
}
},
rejected: {
on: {
BusinessCase_SUBMIT: 'pending'
}
},
done: {
type: 'final'
}
}
},
Security: {
initial: 'pending',
type: 'compound',
states: {
pending: {
on: {
Security_APPROVED: 'done',
Security_REJECTED: {
target: 'rejected'
}
}
},
rejected: {
on: {
Security_SUBMIT: 'pending'
}
},
done: {
type: 'final'
}
}
},
Monitoring: {
initial: 'pending',
type: 'compound',
states: {
pending: {
on: {
Monitoring_APPROVED: 'done',
Monitoring_REJECTED: {
target: 'rejected'
}
}
},
rejected: {
on: {
Monitoring_SUBMIT: 'pending'
}
},
done: {
type: 'final'
}
}
}
},
onDone: 'waitingForPublish',
type: 'parallel'
},
waitingForPublish: {
on: {
Publish: {
target: 'Published',
}
},
},
Published: {
type: 'final'
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment