• ------------------------------
  • JS API Reference

    Class: ExeScriptExecutor

    activity/exe-script-executor.ExeScriptExecutor

    Table of contents

    Constructors

    Properties

    Methods

    Constructors

    constructor

    new ExeScriptExecutor(activity, activityModule, logger, options?): ExeScriptExecutor

    Parameters

    NameType
    activityActivity
    activityModuleActivityModule
    loggerLogger
    options?ExecutionOptions

    Returns

    ExeScriptExecutor

    Defined in

    src/activity/exe-script-executor.ts:46

    Properties

    activity

    Readonly activity: Activity

    Defined in

    src/activity/exe-script-executor.ts:47

    Methods

    execute

    execute(script): Promise<ScriptExecutionMetadata>

    Executes the provided script and returns the batch id and batch size that can be used to fetch it's results

    Parameters

    NameType
    scriptExeScriptRequest

    Returns

    Promise<ScriptExecutionMetadata>

    script execution metadata - batch id and batch size that can be used to fetch results using getResultsObservable

    Defined in

    src/activity/exe-script-executor.ts:62


    getResultsObservable

    getResultsObservable(batch, stream?, signalOrTimeout?, maxRetries?): Observable<Result<any>>

    Given a batch id and batch size collect the results from yagna. You can choose to either stream them as they go or poll for them. When a timeout is reached (by either the timeout provided as an argument here or in the constructor) the observable will emit an error.

    Parameters

    NameTypeDescription
    batchScriptExecutionMetadatabatch id and batch size
    stream?booleandefine type of getting results from execution (polling or streaming)
    signalOrTimeout?number | AbortSignalthe timeout in milliseconds or an AbortSignal that will be used to cancel the execution
    maxRetries?numbermaximum number of retries retrieving results when an error occurs, default: 10

    Returns

    Observable<Result<any>>

    Defined in

    src/activity/exe-script-executor.ts:102


    send

    send(script): Promise<string>

    Parameters

    NameType
    scriptExeScriptRequest

    Returns

    Promise<string>

    Defined in

    src/activity/exe-script-executor.ts:130