reference

Class: WorkContext

task/work.WorkContext

Work Context

Description

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new WorkContext(activity, options?)

Parameters

NameType
activityActivity
options?WorkOptions

Defined in

src/task/work.ts:60

Properties

provider

Optional Readonly provider: Object

Type declaration

NameType
namestring
idstring
networkConfig?object

Defined in

src/task/work.ts:51


agreementId

Readonly agreementId: string

Defined in

src/task/work.ts:52


activityId

Readonly activityId: string

Defined in

src/task/work.ts:53

Methods

before

before(): Promise<void | Result<any>[]>

Returns

Promise<void | Result<any>[]>

Defined in

src/task/work.ts:73


run

run(commandLine, options?): Promise<Result<any>>

Execute a command on provider using a shell (/bin/sh).

Parameters

NameTypeDescription
commandLinestringShell command to execute.
options?CommandOptionsAdditional run options.

Returns

Promise<Result<any>>

Defined in

src/task/work.ts:116

run(executable, args, options?): Promise<Result<any>>

Execute an executable on provider.

Parameters

NameTypeDescription
executablestringExecutable to run.
argsstring[]Executable arguments.
options?CommandOptionsAdditional run options.

Returns

Promise<Result<any>>

Defined in

src/task/work.ts:125


uploadFile

uploadFile(src, dst, options?): Promise<Result<any>>

Parameters

NameType
srcstring
dststring
options?CommandOptions

Returns

Promise<Result<any>>

Defined in

src/task/work.ts:137


uploadJson

uploadJson(json, dst, options?): Promise<Result<any>>

Parameters

NameType
jsonany
dststring
options?CommandOptions

Returns

Promise<Result<any>>

Defined in

src/task/work.ts:142


uploadData

uploadData(data, dst, options?): Promise<Result<any>>

Parameters

NameType
dataUint8Array
dststring
options?CommandOptions

Returns

Promise<Result<any>>

Defined in

src/task/work.ts:147


downloadFile

downloadFile(src, dst, options?): Promise<Result<any>>

Parameters

NameType
srcstring
dststring
options?CommandOptions

Returns

Promise<Result<any>>

Defined in

src/task/work.ts:151


downloadData

downloadData(src, options?): Promise<Result<Uint8Array>>

Parameters

NameType
srcstring
options?CommandOptions

Returns

Promise<Result<Uint8Array>>

Defined in

src/task/work.ts:155


downloadJson

downloadJson(src, options?): Promise<Result<any>>

Parameters

NameType
srcstring
options?CommandOptions

Returns

Promise<Result<any>>

Defined in

src/task/work.ts:160


beginBatch

beginBatch(): Batch

Returns

Batch

Defined in

src/task/work.ts:175


rejectResult

rejectResult(msg): void

Parameters

NameType
msgstring

Returns

void

Deprecated

This function is only used to throw errors from unit tests. It should be removed.

Defined in

src/task/work.ts:182


getWebsocketUri

getWebsocketUri(port): string

Parameters

NameType
portnumber

Returns

string

Defined in

src/task/work.ts:186


getState

getState(): Promise<ActivityStateEnum>

Returns

Promise<ActivityStateEnum>

Defined in

src/task/work.ts:191