Interface IPromiseStore

Promise Store API

interface IPromiseStore {
    cancel(id, ikey, strict, headers, data): Promise<DurablePromiseRecord>;
    create(id, ikey, strict, headers, data, timeout, tags): Promise<DurablePromiseRecord>;
    get(id): Promise<DurablePromiseRecord>;
    reject(id, ikey, strict, headers, data): Promise<DurablePromiseRecord>;
    resolve(id, ikey, strict, headers, data): Promise<DurablePromiseRecord>;
    search(id, state, tags, limit?): AsyncGenerator<DurablePromiseRecord[], void, unknown>;
}

Implemented by

Methods

  • Cancels a new promise.

    Parameters

    • id: string

      Unique identifier for the promise.

    • ikey: undefined | string

      Idempotency key associated with the create operation.

    • strict: boolean

      If true, deduplicates only if the promise is canceled.

    • headers: undefined | Record<string, string>

      Key value pairs associated with the data.

    • data: undefined | string

      Encoded data of type string.

    Returns Promise<DurablePromiseRecord>

    A durable promise that is canceled, resolved, or rejected.

  • Creates a new durable promise

    Parameters

    • id: string

      Unique identifier for the promise.

    • ikey: undefined | string

      Idempotency key associated with the create operation.

    • strict: boolean

      If true, deduplicates only if the promise is pending.

    • headers: undefined | Record<string, string>

      Key value pairs associated with the data.

    • data: undefined | string

      Encoded data of type string.

    • timeout: number

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

    • tags: undefined | Record<string, string>

      Key value pairs associated with the promise.

    Returns Promise<DurablePromiseRecord>

    A durable promise that is pending, canceled, resolved, or rejected.

  • Retrieves a promise based on its id.

    Parameters

    • id: string

      Unique identifier for the promise to be retrieved.

    Returns Promise<DurablePromiseRecord>

    A durable promise that is pending, canceled, resolved, or rejected.

  • Rejects a promise

    Parameters

    • id: string

      Unique identifier for the promise to be rejected.

    • ikey: undefined | string

      Integration key associated with the promise.

    • strict: boolean

      If true, deduplicates only if the promise is rejected.

    • headers: undefined | Record<string, string>

      Key value pairs associated with the data.

    • data: undefined | string

      Encoded data of type string.

    Returns Promise<DurablePromiseRecord>

    A durable promise that is canceled, resolved, or rejected.

  • Resolves a promise.

    Parameters

    • id: string

      Unique identifier for the promise to be resolved.

    • ikey: undefined | string

      Idempotency key associated with the resolve promise.

    • strict: boolean

      If true, deduplicates only if the promise is resolved.

    • headers: undefined | Record<string, string>

      Key value pairs associated with the data.

    • data: undefined | string

      Encoded data of type string.

    Returns Promise<DurablePromiseRecord>

    A durable promise that is canceled, resolved, or rejected.

  • Search for promises.

    Parameters

    • id: string

      Ids to match, can include wildcards.

    • state: undefined | string

      State to match.

    • tags: undefined | Record<string, string>

      Tags to match.

    • Optional limit: number

      Maximum number of promises to return.

    Returns AsyncGenerator<DurablePromiseRecord[], void, unknown>

    A list of Durable Promises.