Skip to main content

Class: Workflow

This class helps to manipulate raw JSON workflows.

Constructors

new Workflow()

new Workflow(data: RawWorkflow): Workflow

Parameters

ParameterType

data

RawWorkflow

Returns

Workflow

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
ParameterTypeDescription

name

string

Task name to search for

Returns

RawWorkflowTask[]

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
ParameterTypeDescription

idOrName

string | number

Task id (number) or name (string) to search for

Returns

RawWorkflowTask[]

List of tasks with the given name or id


getFinalTasks()

getFinalTasks(): RawWorkflowTask[]

Get all leaf tasks of the workflow.

Returns

RawWorkflowTask[]

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

RawWorkflowTask

The first final task

Throws

NoFinalTaskFoundError if no final task is found


getInputTasks()

getInputTasks(): RawWorkflowTask[]

Get all input tasks of the workflow.

Returns

RawWorkflowTask[]

List of input tasks


getTask()

getTask(id)

getTask(id: number): RawWorkflowTask

Get a task by its id.

Parameters
ParameterTypeDescription

id

number

Task id to retrieve

Returns

RawWorkflowTask

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
ParameterTypeDescription

name

string

Task name to search for

Returns

RawWorkflowTask

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
ParameterTypeDescription

idOrName

string | number

Task id (number) or name (string) to search for

Returns

RawWorkflowTask

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

RawWorkflowTask[]

All tasks in the workflow