Action
An action in the context of a workflow is a specific operation or task that must be performed to trigger a transition from one state to another. Actions represent the work or decisions needed to move forward in the process and are often defined by the rules or conditions of the workflow.
An action indicates what needs to be done at that particular stage before the process can transition to another state.
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": []
}
]
}