Config
A workflow is a defined sequence of states, actions, or processes that are followed to achieve a specific goal or complete a project. Workflows outline how work moves from one state to another, often involving multiple people, systems, or departments. They help in organizing and streamlining tasks to ensure consistency, efficiency, and accountability.
config params
The above api route states 'api/workflow/config/:path__workflowName'
Interface
interface WorkflowConfig {
name: string;
meta?: object;
maxChainCount?: number; // default 20
states: State[];
}
interface State {
name: string;
actions: Action[];
}
interface Action {
name: string;
when?: string;
who?: any[]; // default []
on: {
[eventName: string]: {
name: string;
type: 'ACTION' | 'STATE';
};
};
}
Property Description
Name
- The name property functions as a unique identifier, distinguishing one workflow from another.
- Described as
name. - The name can include patterns such as
- Upper case letters
[A-Z] - Lower case letters
[a-z] - Underscore
_
- Upper case letters
Meta
- The metadata is added to the workflow to provide valuable information for users who run or manage the workflow.
- Described as
meta.
Max Chain Count
- The maximum chain count specifies the limit on how many actions can be chained together during a single execution.
- Described as
maxChainCount. - Default value is 20.
States
- The states array contains all the state data and outlines the flow of actions that the workflow can execute.
- Described as
states.
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": []
}
]
}
Change config
path query
The path query in the API above specifies the folder path where the workflow is located.