Created
June 26, 2021 14:41
-
-
Save diestrin/2f584a1b31cf5cdf0c56cc49cb97f17a 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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions | |
// - XState (all XState exports) | |
const fetchMachine = Machine({ | |
"id": "44", | |
"context": { | |
"$inputs": {}, | |
"$entities": {}, | |
"$replyPolicy": {}, | |
"$signatures": {} | |
}, | |
"initial": "idle", | |
"states": { | |
"idle": { | |
"on": { | |
"LOAD": { | |
"target": "waiting", | |
"actions": [ | |
"calculateEntityUpdate", | |
"calculateInputsUpdate", | |
"calculateReplyPolicyUpdate", | |
"syncState", | |
"notifyCreated" | |
] | |
} | |
} | |
}, | |
"waiting": { | |
"initial": "draft", | |
"states": { | |
"draft": { | |
"on": { | |
"PROPOSE": [ | |
{ | |
"target": "proposed", | |
"cond": "canProposeAsOwner", | |
"actions": [ | |
"calculateInputsUpdate", | |
"calculateReplyPolicyUpdate", | |
"syncState", | |
"notifyProposed" | |
] | |
} | |
], | |
"UPDATE": { | |
"cond": "isOwnerEntity", | |
"actions": [ | |
"calculateInputsUpdate", | |
"calculateReplyPolicyUpdate", | |
"syncState", | |
"notifyProposed" | |
] | |
}, | |
"JOIN": { | |
"actions": [ | |
"calculateEntityUpdate", | |
"syncState", | |
"notifyJoin" | |
] | |
} | |
} | |
}, | |
"proposed": { | |
"on": { | |
"CONFIRM": { | |
"target": "confirmed", | |
"cond": "isRentalEntity", | |
"actions": [ | |
"notifyConfirm" | |
] | |
}, | |
"PROPOSE": { | |
"target": "replied", | |
"cond": "isRentalEntity", | |
"actions": [ | |
"calculateInputsUpdate", | |
"syncState", | |
"notifyProposed" | |
] | |
} | |
} | |
}, | |
"replied": { | |
"on": { | |
"CONFIRM": { | |
"target": "confirmed", | |
"cond": "isOwnerEntity", | |
"actions": [ | |
"notifyConfirm" | |
] | |
}, | |
"PROPOSE": { | |
"target": "proposed", | |
"cond": "isOwnerEntity", | |
"actions": [ | |
"calculateInputsUpdate", | |
"calculateReplyPolicyUpdate", | |
"syncState", | |
"notifyProposed" | |
] | |
} | |
} | |
}, | |
"confirmed": { | |
"on": { | |
"CONFIRM_SIGNATURE": { | |
"target": "signed", | |
"cond": "allSignaturesPresent", | |
"actions": [ | |
"notifySignature" | |
] | |
}, | |
"SIGNATURE": { | |
"actions": [ | |
"collectSignature", | |
"confirmSignature", | |
"syncState", | |
"notifySignature" | |
] | |
}, | |
"PROPOSE": [ | |
{ | |
"target": "proposed", | |
"cond": "isOwnerEntity", | |
"actions": [ | |
"notifyProposed" | |
] | |
}, | |
{ | |
"target": "replied", | |
"cond": "isRentalEntity", | |
"actions": [ | |
"notifyProposed" | |
] | |
} | |
] | |
} | |
}, | |
"signed": { | |
"type": "final" | |
} | |
}, | |
"onDone": { | |
"target": "ready", | |
"actions": [ | |
"notifyReady" | |
] | |
} | |
}, | |
"ready": { | |
"type": "parallel", | |
"states": { | |
"$chapters.7.group.1": { | |
"initial": "idle", | |
"states": { | |
"idle": { | |
"on": { | |
"unfunfilledClause": [ | |
{ | |
"target": "active", | |
"actions": [] | |
} | |
] | |
} | |
}, | |
"active": { | |
"type": "parallel", | |
"states": { | |
"atomic": { | |
"initial": "configuring", | |
"states": { | |
"configuring": { | |
"always": "active" | |
}, | |
"active": { | |
"on": { | |
"$chapters.7.group.1.configure": "configuring" | |
} | |
} | |
} | |
}, | |
"valid": { | |
"initial": "unfunfilledClause", | |
"states": { | |
"unfunfilledClause": { | |
"id": "unfunfilledClause", | |
"on": {} | |
}, | |
"requestExtensionNotification": { | |
"id": "requestExtensionNotification", | |
"on": { | |
"$chapters.7.group.1.flow#requestExtensionNotification.requestExtension": { | |
"target": "requestExtension", | |
"actions": [ | |
{ | |
"type": "xstate.send", | |
"event": { | |
"type": "$chapters.7.group.1.configure" | |
}, | |
"id": "$chapters.7.group.1.configure" | |
} | |
] | |
}, | |
"$chapters.7.group.1.flow#requestExtensionNotification.rejectExtension": { | |
"target": "rejectExtension", | |
"actions": [ | |
{ | |
"type": "xstate.send", | |
"event": { | |
"type": "$chapters.7.group.1.configure" | |
}, | |
"id": "$chapters.7.group.1.configure" | |
} | |
] | |
} | |
} | |
}, | |
"requestExtension": { | |
"id": "requestExtension", | |
"on": { | |
"$chapters.7.group.1.flow#requestExtensionNotification.requestExtensionApproval": { | |
"target": "requestExtensionApproval", | |
"actions": [ | |
{ | |
"type": "xstate.send", | |
"event": { | |
"type": "$chapters.7.group.1.configure" | |
}, | |
"id": "$chapters.7.group.1.configure" | |
} | |
] | |
}, | |
"$chapters.7.group.1.flow#requestExtensionNotification.requestExtensionRejection": { | |
"target": "requestExtensionRejection", | |
"actions": [ | |
{ | |
"type": "xstate.send", | |
"event": { | |
"type": "$chapters.7.group.1.configure" | |
}, | |
"id": "$chapters.7.group.1.configure" | |
} | |
] | |
} | |
} | |
}, | |
"rejectExtension": { | |
"id": "rejectExtension", | |
"on": {} | |
}, | |
"requestExtensionApproval": { | |
"id": "requestExtensionApproval", | |
"on": {} | |
}, | |
"requestExtensionRejection": { | |
"id": "requestExtensionRejection", | |
"on": {} | |
}, | |
"extensionEndingNotification": { | |
"id": "extensionEndingNotification", | |
"on": {} | |
}, | |
"confirmClause": { | |
"id": "confirmClause", | |
"on": { | |
"$chapters.7.group.1.flow#confirmClauseNotification.closeEvent": { | |
"target": "closeEvent", | |
"actions": [ | |
{ | |
"type": "xstate.send", | |
"event": { | |
"type": "$chapters.7.group.1.configure" | |
}, | |
"id": "$chapters.7.group.1.configure" | |
} | |
] | |
}, | |
"$chapters.7.group.1.flow#confirmClauseNotification.cancelContract": { | |
"target": "cancelContract", | |
"actions": [ | |
{ | |
"type": "xstate.send", | |
"event": { | |
"type": "$chapters.7.group.1.configure" | |
}, | |
"id": "$chapters.7.group.1.configure" | |
} | |
] | |
} | |
} | |
}, | |
"cancelContract": { | |
"id": "cancelContract", | |
"on": {}, | |
"type": "final" | |
}, | |
"closeEvent": { | |
"id": "closeEvent", | |
"on": {}, | |
"type": "final" | |
} | |
}, | |
"onDone": { | |
"actions": { | |
"type": "xstate.send", | |
"event": { | |
"type": "$chapters.7.group.1.resolve", | |
"sourceEntity": 3 | |
}, | |
"id": "$chapters.7.group.1.resolve" | |
} | |
} | |
} | |
}, | |
"on": { | |
"$chapters.7.group.1.resolve": { | |
"target": "close", | |
"cond": "isApi", | |
"actions": [] | |
}, | |
"$chapters.7.group.1.close": { | |
"target": "close", | |
"cond": "isApi", | |
"actions": [] | |
} | |
} | |
}, | |
"close": { | |
"type": "final" | |
} | |
} | |
} | |
} | |
} | |
} | |
}, { | |
guards: { | |
canProposeAsOwner: () => true, | |
isOwnerEntity: () => true, | |
isRentalEntity: () => true, | |
allSignaturesPresent: () => true | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment