Class: Workflow
This class helps to manipulate raw JSON workflows.
Constructors
new Workflow()
new Workflow(data: RawWorkflow): Workflow
Parameters
Parameter | Type |
---|---|
|
Returns
Properties
data
data: RawWorkflow;
Accessors
name
get name(): string
Returns
string
Methods
findTasks()
findTasks(name)
findTasks(name: string): RawWorkflowTask[]
Return the list of tasks that match the given name.
Parameters
Parameter | Type | Description |
---|---|---|
|
| Task name to search for |
Returns
List of tasks with the given name
findTasks(idOrName)
findTasks(idOrName: string | number): RawWorkflowTask[]
Return the list of tasks that match the given name or id.
Parameters
Parameter | Type | Description |
---|---|---|
|
| Task id (number) or name (string) to search for |
Returns
List of tasks with the given name or id
getFinalTasks()
getFinalTasks(): RawWorkflowTask[]
Get all leaf tasks of the workflow.
Returns
A list of tasks that are not connected as input of any other task.
getFirstFinalTask()
getFirstFinalTask(): RawWorkflowTask
Return the first final task of the workflow.
Returns
The first final task
Throws
NoFinalTaskFoundError if no final task is found
getInputTasks()
getInputTasks(): RawWorkflowTask[]
Get all input tasks of the workflow.
Returns
List of input tasks
getTask()
getTask(id)
getTask(id: number): RawWorkflowTask
Get a task by its id.
Parameters
Parameter | Type | Description |
---|---|---|
|
| Task id to retrieve |
Returns
The retrieved task
Throws
TaskNotFoundError if no task with the given id is found
getTask(name)
getTask(name: string): RawWorkflowTask
Get a task by name.
Parameters
Parameter | Type | Description |
---|---|---|
|
| Task name to search for |
Returns
Task with the given name
Throws
TaskNotFoundError if no task with the given name is found
Throws
MultipleTaskFoundError if multiple tasks are found with the same given name
getTask(idOrName)
getTask(idOrName: string | number): RawWorkflowTask
Get a task by its id or name.
Parameters
Parameter | Type | Description |
---|---|---|
|
| Task id (number) or name (string) to search for |
Returns
Task with the given name or id
Throws
TaskNotFoundError if no task with the given id or name is found
Throws
MultipleTaskFoundError if provided a name and multiple tasks are found
getTasks()
getTasks(): RawWorkflowTask[]
Return the list of tasks in the workflow.
Returns
All tasks in the workflow