durable-execution - v0.8.0
    Preparing search index...

    Type Alias DurableTaskHandle<TOutput>

    A handle to a durable task execution. See Durable task execution docs for more details on how task executions work.

    const handle = await executor.enqueueTask(uploadFile, {filePath: 'file.txt'})
    // Get the task execution
    const execution = await handle.getExecution()

    // Wait for the task execution to be finished and get it
    const finishedExecution = await handle.waitAndGetExecution()
    if (finishedExecution.status === 'completed') {
    // Do something with the result
    } else if (finishedExecution.status === 'failed') {
    // Do something with the error
    } else if (finishedExecution.status === 'timed_out') {
    // Do something with the timeout
    } else if (finishedExecution.status === 'cancelled') {
    // Do something with the cancellation
    } else if (finishedExecution.status === 'children_tasks_failed') {
    // Do something with the children tasks failure
    } else if (finishedExecution.status === 'finalize_task_failed') {
    // Do something with the finalize task failure
    }

    // Cancel the task execution
    await handle.cancel()
    type DurableTaskHandle<TOutput = unknown> = {
        getTaskId: () => string;
        getTaskExecutionId: () => string;
        getTaskExecution: () => Promise<DurableTaskExecution<TOutput>>;
        waitAndGetTaskFinishedExecution: (
            options?: {
                signal?: CancelSignal | AbortSignal;
                pollingIntervalMs?: number;
            },
        ) => Promise<DurableTaskFinishedExecution<TOutput>>;
        cancel: () => Promise<void>;
    }

    Type Parameters

    • TOutput = unknown
    Index

    Properties

    getTaskId: () => string

    Get the task id of the durable task.

    Type declaration

      • (): string
      • Returns string

        The task id of the durable task.

    getTaskExecutionId: () => string

    Get the execution id of the durable task execution.

    Type declaration

      • (): string
      • Returns string

        The execution id of the durable task execution.

    getTaskExecution: () => Promise<DurableTaskExecution<TOutput>>

    Get the durable task execution.

    Type declaration

    waitAndGetTaskFinishedExecution: (
        options?: {
            signal?: CancelSignal | AbortSignal;
            pollingIntervalMs?: number;
        },
    ) => Promise<DurableTaskFinishedExecution<TOutput>>

    Wait for the durable task execution to be finished and get it.

    Type declaration

    cancel: () => Promise<void>

    Cancel the durable task execution.