Last active
May 14, 2020 12:39
-
-
Save jklapacz/13a642a9b3d9b71d404774c8d062a56d to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains hidden or 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 include = assign({ | |
| included: (context, event) => event.value | |
| }) | |
| const exclude = assign({ | |
| excluded: (context, event) => event.value | |
| }) | |
| const fetchMachine = Machine({ | |
| id: 'cases', | |
| initial: 'newCases', | |
| context: { | |
| included: [], | |
| excluded: [], | |
| }, | |
| states: { | |
| newCases: { | |
| on: { | |
| ASSIGN_SELF: { | |
| target: 'assignedCases', | |
| actions: 'include', | |
| }, | |
| ASSIGN_OTHER: { | |
| target: 'newCases', | |
| actions: 'exclude', | |
| }, | |
| DELETE: { | |
| target: 'newCases', | |
| actions: 'exclude', | |
| }, | |
| BULK_ASSIGN_SELF: { | |
| target: 'assignedCases', | |
| actions: 'include', | |
| }, | |
| BULK_ASSIGN_OTHER: { | |
| target: 'newCases', | |
| actions: 'exclude', | |
| }, | |
| VISIT_NEW: 'newCases', | |
| VISIT_ASSIGNED: 'assignedCases', | |
| VISIT_CLOSED: 'closedCases', | |
| VISIT_ALL: 'allCases', | |
| } | |
| }, | |
| assignedCases: { | |
| on: { | |
| DELETE: { | |
| target: 'assignedCases', | |
| actions: 'exclude', | |
| }, | |
| DISPOSITION: { | |
| target: 'assignedCases', | |
| actions: 'exclude', | |
| }, | |
| REASSIGN: { | |
| target: 'assignedCases', | |
| actions: 'exclude', | |
| }, | |
| UNASSIGN: { | |
| target: 'assignedCases', | |
| actions: 'exclude', | |
| }, | |
| BULK_DISPOSITION: { | |
| target: 'assignedCases', | |
| actions: 'exclude', | |
| }, | |
| BULK_REASSIGN: { | |
| target: 'assignedCases', | |
| actions: 'exclude', | |
| }, | |
| BULK_UNASSIGN: { | |
| target: 'assignedCases', | |
| actions: 'exclude', | |
| }, | |
| VISIT_NEW: 'newCases', | |
| VISIT_ASSIGNED: 'assignedCases', | |
| VISIT_CLOSED: 'closedCases', | |
| VISIT_ALL: 'allCases', | |
| } | |
| }, | |
| closedCases: { | |
| on: { | |
| DELETE: { | |
| target: 'closedCases', | |
| actions: 'exclude', | |
| }, | |
| REOPEN: { | |
| target: 'assignedCases', | |
| actions: 'include', | |
| }, | |
| VISIT_NEW: 'newCases', | |
| VISIT_ASSIGNED: 'assignedCases', | |
| VISIT_CLOSED: 'closedCases', | |
| VISIT_ALL: 'allCases', | |
| } | |
| }, | |
| allCases: { | |
| on: { | |
| ASSIGN_SELF: { | |
| target: 'assignedCases', | |
| actions: 'include', | |
| }, | |
| DELETE: { | |
| target: 'allCases', | |
| actions: 'exclude', | |
| }, | |
| DISPOSITION: { | |
| target: 'allCases', | |
| actions: 'include', | |
| }, | |
| REASSIGN: { | |
| target: 'allCases', | |
| actions: 'include', | |
| }, | |
| REOPEN: { | |
| target: 'assignedCases', | |
| actions: 'include', | |
| }, | |
| UNASSIGN: { | |
| target: 'allCases', | |
| actions: 'include', | |
| }, | |
| VISIT_NEW: 'newCases', | |
| VISIT_ASSIGNED: 'assignedCases', | |
| VISIT_CLOSED: 'closedCases', | |
| VISIT_ALL: 'allCases', | |
| } | |
| }, | |
| } | |
| }); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment