JS API Reference

Interface: ActivityModule

activity/activity.module.ActivityModule

Implemented by

Table of contents

Properties

Methods

Properties

events

events: EventEmitter<ActivityEvents, any>

Defined in

src/activity/activity.module.ts:12

Methods

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

Defined in

src/activity/activity.module.ts:19


destroyActivity

destroyActivity(activity): Promise<Activity>

Definitely terminate any work on the provider

Parameters

NameType
activityActivity

Returns

Promise<Activity>

The activity that was permanently terminated

Defined in

src/activity/activity.module.ts:26


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>

Defined in

src/activity/activity.module.ts:33


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>

Defined in

src/activity/activity.module.ts:38


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

Defined in

src/activity/activity.module.ts:45


createScriptExecutor

createScriptExecutor(activity, options?): ExeScriptExecutor

Factory method for creating a script executor for the activity

Parameters

NameType
activityActivity
options?ExecutionOptions

Returns

ExeScriptExecutor

Defined in

src/activity/activity.module.ts:50


executeScript

executeScript(activity, script): Promise<string>

Execute a script on the activity.

Parameters

NameType
activityActivity
scriptExeScriptRequest

Returns

Promise<string>

Defined in

src/activity/activity.module.ts:55


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>[]>

Defined in

src/activity/activity.module.ts:60


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>

Defined in

src/activity/activity.module.ts:65

Was this helpful?