Event
An event in the context of a workflow is a trigger or occurrence that determines which action or state the workflow should transition to next. It represents the outcome or result of an action, a condition being met, or an external input, which then influences the direction of the workflow.
Events serve as decision points that enable the workflow to move forward, typically by evaluating conditions or results and then determining the appropriate next step based on predefined rules.
Interface
interface Action {
name: string;
when?: string;
who?: any[]; // default []
on: {
[eventName: string]: {
name: string;
type: 'ACTION' | 'STATE';
};
};
}
Example
{
"name": "example_workflow",
"maxChainCount": 10,
"states": [
{
"name": "start",
"actions": [
{
"name": "manual_action_1", // After completing this action, the state transit to the final stage
"on": {
"done": {
"name": "final",
"type": "STATE"
}
}
},
{
"name": "manual_action_2", // After completing this action, it will find and perform action named chained_action
"on": {
"done": {
"name": "chained_action",
"type": "ACTION"
},
"error": {
"name": "final",
"type": "STATE"
}
}
},
{
"name": "chained_action", // After completing this action, the state transit to the final stage
"on": {
"done": {
"name": "final",
"type": "STATE"
}
}
}
]
},
{
"name": "final",
"actions": []
}
]
}