Last active
November 4, 2020 12:10
-
-
Save saadshahd/30e6c3d66ea00c23ffdeead749a8dafe to your computer and use it in GitHub Desktop.
Revisions
-
saadshahd revised this gist
Nov 4, 2020 . 1 changed file with 77 additions and 5 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -15,6 +15,10 @@ const stateMachine = Machine({ states: { info: { initial: "Created", on: { FORFEITED: '.Forfeited', CANCELLED: '.Cancelled', }, states: { Created: { on: { @@ -31,14 +35,19 @@ const stateMachine = Machine({ INFO_READY_FOR_COLLECTION: "ReadyForCollection" } }, ReadyForCollection: {}, Forfeited: {}, Cancelled: {} } }, collection: { initial: "NotStarted", on: { FORFEITED: '.NotStarted', CANCELLED: '.NotStarted', }, states: { NotStarted: { on: { COLLECTION_START: "InProgress", COLLECTION_COMPLETE: "Complete" @@ -60,7 +69,10 @@ const stateMachine = Machine({ }, ops: { initial: "Unassigned", on: { FORFEITED: '.Unassigned', CANCELLED: '.Unassigned', }, states: { Unassigned: { on: { @@ -77,6 +89,10 @@ const stateMachine = Machine({ }, video: { initial: "Untracked", on: { FORFEITED: '.Untracked', CANCELLED: '.Untracked', }, states: { Untracked: { initial: "idle", @@ -121,6 +137,62 @@ const stateMachine = Machine({ Found: {} } }, sbd: { initial: 'NotImported', on: { FORFEITED: '.NotImported', CANCELLED: '.NotImported', }, states: { NotImported: { on: { SBD_IMPORT_START: 'Processing', SBD_IMPORT_SUCCESS: 'Available', SBD_IMPORT_FAILED: 'Failed', }, }, Processing: { on: { SBD_IMPORT_SUCCESS: 'Available', SBD_IMPORT_FAILED: 'Failed', }, }, Failed: { on: { SBD_IMPORT_START: 'Processing', }, }, Available: { on: { SBD_IMPORT_START: 'Updating', SBD_IMPORT_FAILED: 'Failed', }, }, Updating: { on: { SBD_IMPORT_SUCCESS: 'Updated', SBD_IMPORT_FAILED: 'FailedUpdate', }, }, Updated: { on: { SBD_IMPORT_START: 'Updating', SBD_IMPORT_FAILED: 'FailedUpdate', }, }, FailedUpdate: { on: { SBD_IMPORT_START: 'Updating', }, }, }, } } }); -
saadshahd created this gist
Sep 19, 2020 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,126 @@ // Available variables: // - Machine // - interpret // - assign // - send // - sendParent // - spawn // - raise // - actions // - XState (all XState exports) const stateMachine = Machine({ id: "status", type: "parallel", states: { info: { initial: "Created", states: { Created: { on: { INFO_OFFICIALLY_SCHEDULED: { target: "OfficiallyScheduled", actions: ["scheduleVideo"] }, INFO_READY_FOR_COLLECTION: "ReadyForCollection" } }, OfficiallyScheduled: { on: { INFO_READY_FOR_COLLECTION: "ReadyForCollection" } }, ReadyForCollection: {} } }, collection: { initial: "Unassigned", states: { Unassigned: { on: { COLLECTION_START: "InProgress", COLLECTION_COMPLETE: "Complete" } }, InProgress: { on: { COLLECTION_COMPLETE: "Complete" } }, Complete: { on: { COLLECTION_INCOMPLETE: "InProgress" } } } }, ops: { initial: "Unassigned", states: { Unassigned: { on: { OPS_ASSIGN: "Assigned" } }, Assigned: { on: { OPS_UNASSIGN: "Unassigned" } } } }, video: { initial: "Untracked", states: { Untracked: { initial: "idle", on: { VIDEO_SCHEDULED: "Scheduled", VIDEO_FOUND: "Found", VIDEO_NOT_FOUND: "NotFound" }, states: { idle: { on: { VIDEO_SCHEDULE: "scheduling" } }, scheduling: { invoke: { id: "scheduleVideo", src: "scheduleVideo", onDone: { target: "#VideoScheduled" } } } } }, Scheduled: { id: "VideoScheduled", on: { VIDEO_FOUND: "Found", VIDEO_NOT_FOUND: "NotFound" } }, NotFound: { on: { VIDEO_FOUND: "Found" } }, Found: {} } } } });