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
agreementId
• Readonly agreementId: any
agreement ID
Defined in
yagnaApi
• Protected Readonly yagnaApi: YagnaApi
Defined in
options
• Protected Readonly options: ActivityConfig
Defined in
Methods
create
▸ Static create(agreementId, yagnaApi, options?, secure?): Promise<Activity>
Create activity for given agreement ID
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
agreementId | string | undefined | |
yagnaApi | YagnaApi | undefined | |
options? | ActivityOptions | undefined | ActivityOptions |
secure | boolean | false | defines if activity will be secure type |
Returns
Promise<Activity>
Activity
Defined in
execute
▸ execute(script, stream?, timeout?): Promise<Readable>
Execute script
Parameters
| Name | Type | Description |
|---|---|---|
script | ExeScriptRequest | exe script request |
stream? | boolean | define type of getting results from execution (polling or streaming) |
timeout? | number | execution timeout |
Returns
Promise<Readable>
Defined in
stop
▸ stop(): Promise<boolean>
Stop and destroy activity
Returns
Promise<boolean>
boolean
Defined in
getState
▸ getState(): Promise<ActivityStateEnum>
Getting current state of activity
Returns
Promise<ActivityStateEnum>
state
Throws
Error when cannot query the state
Defined in
send
▸ Protected send(script): Promise<string>
Parameters
| Name | Type |
|---|---|
script | ExeScriptRequest |
Returns
Promise<string>