Skip to main content

Class: Context

Object to manage deployment call context

Constructors

new Context()

new Context(workflow: Workflow): Context

Initialize a new context

Parameters

ParameterTypeDescription

workflow

Workflow

Workflow object

Returns

Context

Properties

workflow

workflow: Workflow;

Methods

payload()

payload(inputs: RawTaskIO[]): Payload

Generate the payload to be sent to the deployment call

Parameters

ParameterTypeDescription

inputs

RawTaskIO[]

A list of input data

Returns

Payload

Payload data

Throws

OutputsNotDefinedException if no output is defined


setOutput()

setOutput(taskName, outputIndex)

setOutput(taskName: string, outputIndex?: number): void

Mark a task output as a wanted output to be returned by the deployment call

Parameters
ParameterTypeDescription

taskName

string

A task name

outputIndex?

number

Zero-based index of the output to be returned among all task outputs (if not set, all task outputs will be returned)

Returns

void

Throws

TaskNotFoundError if no task with the given name is found

Throws

MultipleTaskFoundError if multiple tasks are found with the same given name

setOutput(taskId, outputIndex)

setOutput(taskId: number, outputIndex?: number): void

Mark a task output as a wanted output to be returned by the deployment call

Parameters
ParameterTypeDescription

taskId

number

Task id

outputIndex?

number

Zero-based index of the output to be returned among all task outputs (if not set, all task outputs will be returned)

Returns

void

Throws

TaskNotFoundError if no task with the given id is found


setParameters()

setParameters(taskName, parameters)

setParameters(taskName: string, parameters: Record<string, string | number | boolean>): void

Set parameters for a task

Parameters
ParameterTypeDescription

taskName

string

A task name

parameters

Record<string, string | number | boolean>

parameters values for given task

Returns

void

Throws

TaskNotFoundError if no task with the given name is found

Throws

MultipleTaskFoundError if multiple tasks are found with the same given name

Throws

TaskParameterNotFoundException if a given parameter name is not found in the task parameters

setParameters(taskId, parameters)

setParameters(taskId: number, parameters: Record<string, string | number | boolean>): void

Set parameters for a task

Parameters
ParameterTypeDescription

taskId

number

Task id

parameters

Record<string, string | number | boolean>

parameters values for given task

Returns

void

Throws

TaskNotFoundError if no task with the given id is found

Throws

TaskParameterNotFoundException if a given parameter name is not found in the task parameters