Interface ResonatePromises

interface ResonatePromises {
    cancel<T>(id, error, opts?): Promise<DurablePromise<T>>;
    create<T>(id, timeout, opts?): Promise<DurablePromise<T>>;
    get<T>(id): Promise<DurablePromise<T>>;
    reject<T>(id, error, opts?): Promise<DurablePromise<T>>;
    resolve<T>(id, value, opts?): Promise<DurablePromise<T>>;
    search(id, state?, tags?, limit?): AsyncGenerator<DurablePromise<any>[], any, unknown>;
}

Methods

  • Cancel a durable promise.

    Type Parameters

    • T

      The type of the promise.

    Parameters

    • id: string

      Unique identifier for the promise.

    • error: any

      The cancel value.

    • Optional opts: Partial<CompleteOptions>

      Additional options.

    Returns Promise<DurablePromise<T>>

    A durable promise.

  • Create a durable promise.

    Type Parameters

    • T

      The type of the promise.

    Parameters

    • id: string

      Unique identifier for the promise.

    • timeout: number

      Time (in milliseconds) after which the promise is considered expired.

    • Optional opts: Partial<CreateOptions>

      Additional options.

    Returns Promise<DurablePromise<T>>

    A durable promise.

  • Reject a durable promise.

    Type Parameters

    • T

      The type of the promise.

    Parameters

    • id: string

      Unique identifier for the promise.

    • error: any

      The reject value.

    • Optional opts: Partial<CompleteOptions>

      Additional options.

    Returns Promise<DurablePromise<T>>

    A durable promise.

  • Resolve a durable promise.

    Type Parameters

    • T

      The type of the promise.

    Parameters

    • id: string

      Unique identifier for the promise.

    • value: T

      The resolved value.

    • Optional opts: Partial<CompleteOptions>

      Additional options.

    Returns Promise<DurablePromise<T>>

    A durable promise.

  • Search durable promises.

    Parameters

    • id: string

      Ids to match, can include wildcards.

    • Optional state: string

      State to match.

    • Optional tags: Record<string, string>

      Tags to match.

    • Optional limit: number

      Maximum number of durablePromises to return.

    Returns AsyncGenerator<DurablePromise<any>[], any, unknown>

    A generator that yields durable durablePromises.