reference

Class: Activity

activity/activity.Activity

Activity module - an object representing the runtime environment on the provider in accordance with the Package specification. As part of a given activity, it is possible to execute exe script commands and capture their results.

Table of contents

Properties

Methods

Properties

id

Readonly id: any

activity ID

Defined in

src/activity/activity.ts:54


agreementId

Readonly agreementId: any

agreement ID

Defined in

src/activity/activity.ts:55


yagnaApi

Protected Readonly yagnaApi: YagnaApi

YagnaApi

Defined in

src/activity/activity.ts:56


options

Protected Readonly options: ActivityConfig

ActivityOptions

Defined in

src/activity/activity.ts:57

Methods

create

Static create(agreementId, yagnaApi, options?, secure?): Promise<Activity>

Create activity for given agreement ID

Parameters

NameTypeDefault valueDescription
agreementIdstringundefined
yagnaApiYagnaApiundefined
options?ActivityOptionsundefinedActivityOptions
securebooleanfalsedefines if activity will be secure type

Returns

Promise<Activity>

Activity

Defined in

src/activity/activity.ts:71


execute

execute(script, stream?, timeout?): Promise<Readable>

Execute script

Parameters

NameTypeDescription
scriptExeScriptRequestexe script request
stream?booleandefine type of getting results from execution (polling or streaming)
timeout?numberexecution timeout

Returns

Promise<Readable>

Defined in

src/activity/activity.ts:88


stop

stop(): Promise<boolean>

Stop and destroy activity

Returns

Promise<boolean>

boolean

Defined in

src/activity/activity.ts:113


getState

getState(): Promise<ActivityStateEnum>

Getting current state of activity

Returns

Promise<ActivityStateEnum>

state

Throws

Error when cannot query the state

Defined in

src/activity/activity.ts:125


send

Protected send(script): Promise<string>

Parameters

NameType
scriptExeScriptRequest

Returns

Promise<string>

Defined in

src/activity/activity.ts:142