Base class for all persistence layers. This class provides the basic functionality for saving, retrieving, and deleting idempotency records. It also provides the ability to configure the persistence layer from the idempotency config.

Abstract

Implements

Hierarchy (view full)

Implements

Constructors

Properties

idempotencyKeyPrefix: string

Methods

  • Validates an existing record against the data payload being processed. If the payload does not match the stored record, an IdempotencyValidationError error is thrown.

    Whenever a record is retrieved from the persistence layer, it should be validated against the data payload being processed. This is to ensure that the data payload being processed is the same as the one that was used to create the record in the first place.

    The record is also saved to the local cache if local caching is enabled.

    Parameters

    Returns IdempotencyRecord

  • Saves a record of the function completing successfully. This will create a record with a COMPLETED status and will save the result of the completed function in the idempotency record.

    Parameters

    • data: JSONValue

      the data payload that will be hashed to create the hash portion of the idempotency key

    • result: JSONValue

      the result of the successfully completed function

    Returns Promise<void>