JS API 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: string

activity ID

Defined in

src/activity/activity.ts:62


agreement

Readonly agreement: Agreement

Agreement

Defined in

src/activity/activity.ts:63


yagnaApi

Protected Readonly yagnaApi: YagnaApi

YagnaApi

Defined in

src/activity/activity.ts:64


options

Protected Readonly options: ActivityConfig

ActivityOptions

Defined in

src/activity/activity.ts:65

Methods

create

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

Create activity for given agreement ID

Parameters

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

Returns

Promise<Activity>

Activity

Defined in

src/activity/activity.ts:79


getProviderInfo

getProviderInfo(): ProviderInfo

Returns

ProviderInfo

Defined in

src/activity/activity.ts:89


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:100


stop

stop(): Promise<boolean>

Stop and destroy activity

Returns

Promise<boolean>

boolean

Defined in

src/activity/activity.ts:138


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:150


send

send(script): Promise<string>

Parameters

NameType
scriptExeScriptRequest

Returns

Promise<string>

Defined in

src/activity/activity.ts:176