Last active
February 24, 2020 12:21
-
-
Save shreybatra/0a3369bc505121cac5beb14549526437 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 parallelApis = Machine({ | |
id: "Parallel-apis", | |
type: "parallel", | |
states: { | |
userInfo: { | |
initial: "apiCall", | |
states: { | |
apiCall: { | |
on: { | |
RESPONSE: "buildUserMap" | |
} | |
}, | |
buildUserMap: { | |
type: "final" | |
} | |
} | |
}, | |
patientInfo: { | |
initial: "apiCall", | |
states: { | |
apiCall: { | |
on: { | |
RESPONSE: "buildPatientMap" | |
} | |
}, | |
buildPatientMap: { | |
type: "final" | |
} | |
} | |
}, | |
breakglassInfo: { | |
initial: "apiCall", | |
states: { | |
apiCall: { | |
on: { | |
RESPONSE: "userList" | |
} | |
}, | |
userList: { | |
type: "final" | |
} | |
} | |
} | |
} | |
}); | |
const strategyMachine = Machine({ | |
id: "Worklist-Search", | |
initial: "ui", | |
states: { | |
ui: { | |
on: { | |
GET_TODOS: "fetchTodosLoop" | |
} | |
}, | |
fetchTodosLoop: { | |
on: { | |
NON_EMPTY_LIST: "referrals", | |
EMPTY_LIST: "sendResponse" | |
} | |
}, | |
referrals: { | |
on: { | |
GET_SENT_REFERRALS: "getExternalInformation" | |
} | |
}, | |
getExternalInformation: { | |
on: { | |
GET_INFO: "state1" | |
}, | |
...parallelApis | |
}, | |
state1: { | |
on: { | |
MISSING_INFORMATION: "logger", | |
ELSE: "checkBreakglass" | |
} | |
}, | |
logger: { | |
on: { | |
LOG_INFO: "checkBreakglass" | |
} | |
}, | |
checkBreakglass: { | |
on: { | |
ALLOWED_EMPI: "addPatient", | |
CAN_BREAK_GLASS: "addPatient", | |
CANNOT_BREAKGLASS: "maskPatient" | |
} | |
}, | |
maskPatient: { | |
on: { | |
MASK_PATIENT: "addPatient" | |
} | |
}, | |
addPatient: { | |
on: { | |
ADD_PATIENT_TO_RESPONSE: "checkResponseLimit" | |
} | |
}, | |
checkResponseLimit: { | |
on: { | |
LEN_RESPONSE_LT_LIMIT: "fetchTodosLoop", | |
LEN_RESPONSE_GTE_LIMIT: "sendResponse" | |
} | |
}, | |
sendResponse: { | |
type: "final" | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment