Class: WorkContext
task/work.WorkContext
Work Context
Description
Table of contents
Constructors
Properties
Methods
- before
- run
- uploadFile
- uploadJson
- uploadData
- downloadFile
- downloadData
- downloadJson
- beginBatch
- rejectResult
- getWebsocketUri
- getState
Constructors
constructor
• new WorkContext(activity, options?)
Parameters
| Name | Type | 
|---|---|
| activity | Activity | 
| options? | WorkOptions | 
Defined in
Properties
provider
• Optional Readonly provider: Object
Type declaration
| Name | Type | 
|---|---|
| name | string | 
| id | string | 
| networkConfig? | object | 
Defined in
agreementId
• Readonly agreementId: string
Defined in
activityId
• Readonly activityId: string
Defined in
Methods
before
▸ before(): Promise<void | Result<any>[]>
Returns
Promise<void | Result<any>[]>
Defined in
run
▸ run(commandLine, options?): Promise<Result<any>>
Execute a command on provider using a shell (/bin/sh).
Parameters
| Name | Type | Description | 
|---|---|---|
| commandLine | string | Shell command to execute. | 
| options? | CommandOptions | Additional run options. | 
Returns
Promise<Result<any>>
Defined in
▸ run(executable, args, options?): Promise<Result<any>>
Execute an executable on provider.
Parameters
| Name | Type | Description | 
|---|---|---|
| executable | string | Executable to run. | 
| args | string[] | Executable arguments. | 
| options? | CommandOptions | Additional run options. | 
Returns
Promise<Result<any>>
Defined in
uploadFile
▸ uploadFile(src, dst, options?): Promise<Result<any>>
Parameters
| Name | Type | 
|---|---|
| src | string | 
| dst | string | 
| options? | CommandOptions | 
Returns
Promise<Result<any>>
Defined in
uploadJson
▸ uploadJson(json, dst, options?): Promise<Result<any>>
Parameters
| Name | Type | 
|---|---|
| json | any | 
| dst | string | 
| options? | CommandOptions | 
Returns
Promise<Result<any>>
Defined in
uploadData
▸ uploadData(data, dst, options?): Promise<Result<any>>
Parameters
| Name | Type | 
|---|---|
| data | Uint8Array | 
| dst | string | 
| options? | CommandOptions | 
Returns
Promise<Result<any>>
Defined in
downloadFile
▸ downloadFile(src, dst, options?): Promise<Result<any>>
Parameters
| Name | Type | 
|---|---|
| src | string | 
| dst | string | 
| options? | CommandOptions | 
Returns
Promise<Result<any>>
Defined in
downloadData
▸ downloadData(src, options?): Promise<Result<Uint8Array>>
Parameters
| Name | Type | 
|---|---|
| src | string | 
| options? | CommandOptions | 
Returns
Promise<Result<Uint8Array>>
Defined in
downloadJson
▸ downloadJson(src, options?): Promise<Result<any>>
Parameters
| Name | Type | 
|---|---|
| src | string | 
| options? | CommandOptions | 
Returns
Promise<Result<any>>
Defined in
beginBatch
▸ beginBatch(): Batch
Returns
Defined in
rejectResult
▸ rejectResult(msg): void
Parameters
| Name | Type | 
|---|---|
| msg | string | 
Returns
void
Deprecated
This function is only used to throw errors from unit tests. It should be removed.
Defined in
getWebsocketUri
▸ getWebsocketUri(port): string
Parameters
| Name | Type | 
|---|---|
| port | number | 
Returns
string
Defined in
getState
▸ getState(): Promise<ActivityStateEnum>
Returns
Promise<ActivityStateEnum>