Sanity Library Reference Docs
    Preparing search index...

    Interface BatchResult<TResult>Beta

    Using durables is considered experimental and may change in the future.

    interface BatchResult<TResult> {
        all: BatchItem<TResult>[];
        completionReason: CompletionReason;
        failureCount: number;
        hasFailure: boolean;
        startedCount: number;
        status: "SUCCEEDED" | "FAILED";
        successCount: number;
        totalCount: number;
        failed(): (BatchItem<TResult> & { error: Error })[];
        getErrors(): Error[];
        getResults(): TResult[];
        started(): (BatchItem<TResult> & { status: "STARTED" })[];
        succeeded(): (BatchItem<TResult> & { result: TResult })[];
        throwIfError(): void;
    }

    Type Parameters

    • TResult
    Index

    Properties

    All items in the batch with their results/errors.

    completionReason: CompletionReason

    Reason why the batch completed

    failureCount: number

    Number of failed items

    hasFailure: boolean

    Whether any item in the batch failed

    startedCount: number

    Number of started but not completed items. Not guaranteed to be stable across suspend/resume

    status: "SUCCEEDED" | "FAILED"

    Overall status of the batch (SUCCEEDED if no failures, FAILED otherwise)

    successCount: number

    Number of successful items

    totalCount: number

    Total number of items

    Methods