JS API Reference

Class: ActivityModuleImpl

activity/activity.module.ActivityModuleImpl

Implements

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new ActivityModuleImpl(services): ActivityModuleImpl

Parameters

NameType
servicesGolemServices

Returns

ActivityModuleImpl

Defined in

src/activity/activity.module.ts:115

Properties

events

Readonly events: EventEmitter<ActivityEvents, any>

Implementation of

ActivityModule.events

Defined in

src/activity/activity.module.ts:109

Methods

createScriptExecutor

createScriptExecutor(activity, options?): ExeScriptExecutor

Factory method for creating a script executor for the activity

Parameters

NameType
activityActivity
options?ExecutionOptions

Returns

ExeScriptExecutor

Implementation of

ActivityModule.createScriptExecutor

Defined in

src/activity/activity.module.ts:119


executeScript

executeScript(activity, script): Promise<string>

Execute a script on the activity.

Parameters

NameType
activityActivity
scriptExeScriptRequest

Returns

Promise<string>

Implementation of

ActivityModule.executeScript

Defined in

src/activity/activity.module.ts:123


getBatchResults

getBatchResults(activity, batchId, commandIndex?, timeout?): Promise<Result<any>[]>

Fetch the results of a batch execution.

Parameters

NameType
activityActivity
batchIdstring
commandIndex?number
timeout?number

Returns

Promise<Result<any>[]>

Implementation of

ActivityModule.getBatchResults

Defined in

src/activity/activity.module.ts:156


observeStreamingBatchEvents

observeStreamingBatchEvents(activity, batchId, commandIndex?): Observable<StreamingBatchEvent>

Create an observable that will emit events from the streaming batch.

Parameters

NameType
activityActivity
batchIdstring
commandIndex?number

Returns

Observable<StreamingBatchEvent>

Implementation of

ActivityModule.observeStreamingBatchEvents

Defined in

src/activity/activity.module.ts:186


createActivity

createActivity(agreement): Promise<Activity>

Create and start a new activity on the provider for the supplied agreement

Parameters

NameType
agreementAgreement

Returns

Promise<Activity>

The resulting activity on the provider for further use

Implementation of

ActivityModule.createActivity

Defined in

src/activity/activity.module.ts:217


destroyActivity

destroyActivity(activity): Promise<Activity>

Definitely terminate any work on the provider

Parameters

NameType
activityActivity

Returns

Promise<Activity>

The activity that was permanently terminated

Implementation of

ActivityModule.destroyActivity

Defined in

src/activity/activity.module.ts:237


refreshActivity

refreshActivity(staleActivity): Promise<Activity>

Fetches the latest state of the activity. It's recommended to use this method before performing any actions on the activity to make sure it's in the correct state. If the fetched activity's state is different from the one you have, an event will be emitted.

Parameters

NameType
staleActivityActivity

Returns

Promise<Activity>

Implementation of

ActivityModule.refreshActivity

Defined in

src/activity/activity.module.ts:258


findActivityById

findActivityById(activityId): Promise<Activity>

Fetches the activity by its ID from yagna. If the activity doesn't exist, an error will be thrown.

Parameters

NameType
activityIdstring

Returns

Promise<Activity>

Implementation of

ActivityModule.findActivityById

Defined in

src/activity/activity.module.ts:287


createExeUnit

createExeUnit(activity, options?): Promise<ExeUnit>

Create a exe-unit "within" the activity so that you can perform commands on the rented resources

Parameters

NameType
activityActivity
options?ExeUnitOptions

Returns

Promise<ExeUnit>

An ExeUnit that's fully commissioned and the user can execute their commands

Implementation of

ActivityModule.createExeUnit

Defined in

src/activity/activity.module.ts:292