UNPKG

@aws-lambda-powertools/idempotency

Version:

The idempotency package for the Powertools for AWS Lambda (TypeScript) library. It provides options to make your Lambda functions idempotent and safe to retry.

37 lines (36 loc) 1.29 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PERSISTENCE_ATTRIBUTE_KEY_MAPPINGS = exports.MAX_RETRIES = exports.IdempotencyRecordStatus = void 0; /** * Number of times to retry a request in case of `IdempotencyInconsistentStateError` * * Used in `IdempotencyHandler` and `makeHandlerIdempotent` * * @internal */ const MAX_RETRIES = 2; exports.MAX_RETRIES = MAX_RETRIES; /** * Idempotency record status. * * A record is created when a request is received. The status is set to `INPROGRESS` and the request is processed. * After the request is processed, the status is set to `COMPLETED`. If the request is not processed within the * `inProgressExpiryTimestamp`, the status is set to `EXPIRED`. */ const IdempotencyRecordStatus = { INPROGRESS: 'INPROGRESS', COMPLETED: 'COMPLETED', EXPIRED: 'EXPIRED', }; exports.IdempotencyRecordStatus = IdempotencyRecordStatus; /** * Base persistence attribute key names for persistence layers */ const PERSISTENCE_ATTRIBUTE_KEY_MAPPINGS = { statusAttr: 'status', expiryAttr: 'expiration', inProgressExpiryAttr: 'in_progress_expiration', dataAttr: 'data', validationKeyAttr: 'validation', }; exports.PERSISTENCE_ATTRIBUTE_KEY_MAPPINGS = PERSISTENCE_ATTRIBUTE_KEY_MAPPINGS;