-
-
Save massimoselvi/6a454e83ee19acb9ab1a79b0657dd60f 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
/* | |
* User centric API | |
* preview: https://xstate.js.org/viz/?gist=6a454e83ee19acb9ab1a79b0657dd60f | |
*/ | |
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions | |
// - XState (all XState exports) | |
const fetchMachine = Machine({ | |
"initial": "APP", | |
"states": { | |
"APP": { | |
"id": "AUTHENTICATION", | |
"initial": "NOT_PROCESSED", | |
"context": { | |
"failedAttempts": 0, | |
"inputErrors": [], | |
"systemErrors": [] | |
}, | |
"states": { | |
"NOT_PROCESSED": { | |
"on": { | |
"process": { | |
"target": "PROCESSING", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": { | |
"inputErrors": [] | |
} | |
} | |
} | |
} | |
}, | |
"PROCESSING": { | |
"on": { | |
"succeed": { | |
"target": "PROCESSED", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": {} | |
} | |
}, | |
"reject": { | |
"target": "NOT_PROCESSED", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": {} | |
} | |
}, | |
"fail": { | |
"target": "PROCESS_ERRORED", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": {} | |
} | |
} | |
} | |
}, | |
"PROCESS_ERRORED": { | |
"on": { | |
"retry": { | |
"target": "PROCESSING", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": { | |
"systemErrors": [] | |
} | |
} | |
} | |
} | |
}, | |
"PROCESSED": { | |
"name": "AUTHENTICATED", | |
"type": "parallel", | |
"states": { | |
"USER_FILES_MACHINE": { | |
"id": "USER_FILES_MACHINE", | |
"type": "parallel", | |
"initial": "NOT_PROCESSED", | |
"states": { | |
"GET_FILE_LIST_MACHINE": { | |
"id": "GET_FILE_LIST_MACHINE", | |
"initial": "NOT_PROCESSED", | |
"context": { | |
"failedAttempts": 0, | |
"inputErrors": [], | |
"systemErrors": [] | |
}, | |
"states": { | |
"NOT_PROCESSED": { | |
"on": { | |
"process": { | |
"target": "PROCESSING", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": { | |
"inputErrors": [] | |
} | |
} | |
} | |
} | |
}, | |
"PROCESSING": { | |
"on": { | |
"succeed": { | |
"target": "PROCESSED", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": {} | |
} | |
}, | |
"reject": { | |
"target": "NOT_PROCESSED", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": {} | |
} | |
}, | |
"fail": { | |
"target": "PROCESS_ERRORED", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": {} | |
} | |
} | |
} | |
}, | |
"PROCESS_ERRORED": { | |
"on": { | |
"retry": { | |
"target": "PROCESSING", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": { | |
"systemErrors": [] | |
} | |
} | |
} | |
} | |
}, | |
"PROCESSED": { | |
"on": { | |
"refresh": { | |
"target": "PROCESSING", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": { | |
"failedAttempts": 0 | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"DELETE_FILE_MACHINE": { | |
"id": "DELETE_FILE_MACHINE", | |
"initial": "NOT_PROCESSED", | |
"context": { | |
"failedAttempts": 0, | |
"inputErrors": [], | |
"systemErrors": [] | |
}, | |
"states": { | |
"NOT_PROCESSED": { | |
"on": { | |
"process": { | |
"target": "PROCESSING", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": { | |
"inputErrors": [] | |
} | |
} | |
} | |
} | |
}, | |
"PROCESSING": { | |
"on": { | |
"succeed": { | |
"target": "PROCESSED", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": {} | |
} | |
}, | |
"reject": { | |
"target": "NOT_PROCESSED", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": {} | |
} | |
}, | |
"fail": { | |
"target": "PROCESS_ERRORED", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": {} | |
} | |
} | |
} | |
}, | |
"PROCESS_ERRORED": { | |
"on": { | |
"retry": { | |
"target": "PROCESSING", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": { | |
"systemErrors": [] | |
} | |
} | |
} | |
} | |
}, | |
"PROCESSED": { | |
"on": { | |
"refresh": { | |
"target": "PROCESSING", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": { | |
"failedAttempts": 0 | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"UPLOAD_FILE_MACHINE": { | |
"id": "UPLOAD_FILE_MACHINE", | |
"initial": "NOT_PROCESSED", | |
"context": { | |
"failedAttempts": 0, | |
"inputErrors": [], | |
"systemErrors": [] | |
}, | |
"states": { | |
"NOT_PROCESSED": { | |
"on": { | |
"process": { | |
"target": "PROCESSING", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": { | |
"inputErrors": [] | |
} | |
} | |
} | |
} | |
}, | |
"PROCESSING": { | |
"on": { | |
"succeed": { | |
"target": "PROCESSED", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": {} | |
} | |
}, | |
"reject": { | |
"target": "NOT_PROCESSED", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": {} | |
} | |
}, | |
"fail": { | |
"target": "PROCESS_ERRORED", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": {} | |
} | |
} | |
} | |
}, | |
"PROCESS_ERRORED": { | |
"on": { | |
"retry": { | |
"target": "PROCESSING", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": { | |
"systemErrors": [] | |
} | |
} | |
} | |
} | |
}, | |
"PROCESSED": { | |
"on": { | |
"refresh": { | |
"target": "PROCESSING", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": { | |
"failedAttempts": 0 | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"RENAME_FILE_MACHINE": { | |
"id": "RENAME_FILE_MACHINE", | |
"initial": "NOT_PROCESSED", | |
"context": { | |
"failedAttempts": 0, | |
"inputErrors": [], | |
"systemErrors": [] | |
}, | |
"states": { | |
"NOT_PROCESSED": { | |
"on": { | |
"process": { | |
"target": "PROCESSING", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": { | |
"inputErrors": [] | |
} | |
} | |
} | |
} | |
}, | |
"PROCESSING": { | |
"on": { | |
"succeed": { | |
"target": "PROCESSED", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": {} | |
} | |
}, | |
"reject": { | |
"target": "NOT_PROCESSED", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": {} | |
} | |
}, | |
"fail": { | |
"target": "PROCESS_ERRORED", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": {} | |
} | |
} | |
} | |
}, | |
"PROCESS_ERRORED": { | |
"on": { | |
"retry": { | |
"target": "PROCESSING", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": { | |
"systemErrors": [] | |
} | |
} | |
} | |
} | |
}, | |
"PROCESSED": { | |
"on": { | |
"refresh": { | |
"target": "PROCESSING", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": { | |
"failedAttempts": 0 | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"GET_USER_LIST_MACHINE": { | |
"id": "GET_USER_LIST_MACHINE", | |
"initial": "NOT_PROCESSED", | |
"context": { | |
"failedAttempts": 0, | |
"inputErrors": [], | |
"systemErrors": [] | |
}, | |
"states": { | |
"NOT_PROCESSED": { | |
"on": { | |
"process": { | |
"target": "PROCESSING", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": { | |
"inputErrors": [] | |
} | |
} | |
} | |
} | |
}, | |
"PROCESSING": { | |
"on": { | |
"succeed": { | |
"target": "PROCESSED", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": {} | |
} | |
}, | |
"reject": { | |
"target": "NOT_PROCESSED", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": {} | |
} | |
}, | |
"fail": { | |
"target": "PROCESS_ERRORED", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": {} | |
} | |
} | |
} | |
}, | |
"PROCESS_ERRORED": { | |
"on": { | |
"retry": { | |
"target": "PROCESSING", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": { | |
"systemErrors": [] | |
} | |
} | |
} | |
} | |
}, | |
"PROCESSED": { | |
"id": "USER_LIST_AVAILABLE", | |
"initial": "NOT_SELECTED", | |
"states": { | |
"NOT_SELECTED": { | |
"on": { | |
"select": "SELECTED" | |
} | |
}, | |
"SELECTED": { | |
"id": "MANAGED_USER_FILES_MACHINE", | |
"type": "parallel", | |
"initial": "NOT_PROCESSED", | |
"states": { | |
"GET_FILE_LIST_MACHINE": { | |
"id": "GET_FILE_LIST_MACHINE", | |
"initial": "NOT_PROCESSED", | |
"context": { | |
"failedAttempts": 0, | |
"inputErrors": [], | |
"systemErrors": [] | |
}, | |
"states": { | |
"NOT_PROCESSED": { | |
"on": { | |
"process": { | |
"target": "PROCESSING", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": { | |
"inputErrors": [] | |
} | |
} | |
} | |
} | |
}, | |
"PROCESSING": { | |
"on": { | |
"succeed": { | |
"target": "PROCESSED", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": {} | |
} | |
}, | |
"reject": { | |
"target": "NOT_PROCESSED", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": {} | |
} | |
}, | |
"fail": { | |
"target": "PROCESS_ERRORED", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": {} | |
} | |
} | |
} | |
}, | |
"PROCESS_ERRORED": { | |
"on": { | |
"retry": { | |
"target": "PROCESSING", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": { | |
"systemErrors": [] | |
} | |
} | |
} | |
} | |
}, | |
"PROCESSED": { | |
"on": { | |
"refresh": { | |
"target": "PROCESSING", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": { | |
"failedAttempts": 0 | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"DELETE_FILE_MACHINE": { | |
"id": "DELETE_FILE_MACHINE", | |
"initial": "NOT_PROCESSED", | |
"context": { | |
"failedAttempts": 0, | |
"inputErrors": [], | |
"systemErrors": [] | |
}, | |
"states": { | |
"NOT_PROCESSED": { | |
"on": { | |
"process": { | |
"target": "PROCESSING", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": { | |
"inputErrors": [] | |
} | |
} | |
} | |
} | |
}, | |
"PROCESSING": { | |
"on": { | |
"succeed": { | |
"target": "PROCESSED", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": {} | |
} | |
}, | |
"reject": { | |
"target": "NOT_PROCESSED", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": {} | |
} | |
}, | |
"fail": { | |
"target": "PROCESS_ERRORED", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": {} | |
} | |
} | |
} | |
}, | |
"PROCESS_ERRORED": { | |
"on": { | |
"retry": { | |
"target": "PROCESSING", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": { | |
"systemErrors": [] | |
} | |
} | |
} | |
} | |
}, | |
"PROCESSED": { | |
"on": { | |
"refresh": { | |
"target": "PROCESSING", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": { | |
"failedAttempts": 0 | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"UPLOAD_FILE_MACHINE": { | |
"id": "UPLOAD_FILE_MACHINE", | |
"initial": "NOT_PROCESSED", | |
"context": { | |
"failedAttempts": 0, | |
"inputErrors": [], | |
"systemErrors": [] | |
}, | |
"states": { | |
"NOT_PROCESSED": { | |
"on": { | |
"process": { | |
"target": "PROCESSING", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": { | |
"inputErrors": [] | |
} | |
} | |
} | |
} | |
}, | |
"PROCESSING": { | |
"on": { | |
"succeed": { | |
"target": "PROCESSED", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": {} | |
} | |
}, | |
"reject": { | |
"target": "NOT_PROCESSED", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": {} | |
} | |
}, | |
"fail": { | |
"target": "PROCESS_ERRORED", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": {} | |
} | |
} | |
} | |
}, | |
"PROCESS_ERRORED": { | |
"on": { | |
"retry": { | |
"target": "PROCESSING", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": { | |
"systemErrors": [] | |
} | |
} | |
} | |
} | |
}, | |
"PROCESSED": { | |
"on": { | |
"refresh": { | |
"target": "PROCESSING", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": { | |
"failedAttempts": 0 | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"RENAME_FILE_MACHINE": { | |
"id": "RENAME_FILE_MACHINE", | |
"initial": "NOT_PROCESSED", | |
"context": { | |
"failedAttempts": 0, | |
"inputErrors": [], | |
"systemErrors": [] | |
}, | |
"states": { | |
"NOT_PROCESSED": { | |
"on": { | |
"process": { | |
"target": "PROCESSING", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": { | |
"inputErrors": [] | |
} | |
} | |
} | |
} | |
}, | |
"PROCESSING": { | |
"on": { | |
"succeed": { | |
"target": "PROCESSED", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": {} | |
} | |
}, | |
"reject": { | |
"target": "NOT_PROCESSED", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": {} | |
} | |
}, | |
"fail": { | |
"target": "PROCESS_ERRORED", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": {} | |
} | |
} | |
} | |
}, | |
"PROCESS_ERRORED": { | |
"on": { | |
"retry": { | |
"target": "PROCESSING", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": { | |
"systemErrors": [] | |
} | |
} | |
} | |
} | |
}, | |
"PROCESSED": { | |
"on": { | |
"refresh": { | |
"target": "PROCESSING", | |
"actions": { | |
"type": "xstate.assign", | |
"assignment": { | |
"failedAttempts": 0 | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment