@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.
55 lines • 1.98 kB
TypeScript
import type { JSONValue } from '@aws-lambda-powertools/commons/types';
import type { IdempotencyRecordOptions, IdempotencyRecordStatusValue } from '../types/IdempotencyRecord.js';
/**
* Class representing an idempotency record.
* The properties of this class will be reflected in the persistence layer.
*/
declare class IdempotencyRecord {
/**
* The expiry timestamp of the record in seconds UTC.
*/
expiryTimestamp?: number;
/**
* The idempotency key of the record that is used to identify the record.
*/
idempotencyKey: string;
/**
* An optional sort key that can be used with the {@link DynamoDBPersistenceLayer | `DynamoDBPersistenceLayer`}.
*/
sortKey?: string;
/**
* The expiry timestamp of the in progress record in milliseconds UTC.
*/
inProgressExpiryTimestamp?: number;
/**
* The hash of the payload of the request, used for comparing requests.
*/
payloadHash?: string;
/**
* The response data of the request, this will be returned if the payload hash matches.
*/
responseData?: JSONValue;
/**
* The idempotency record status can be COMPLETED, IN_PROGRESS or EXPIRED.
* We check the status during idempotency processing to make sure we don't process an expired record and handle concurrent requests.
* {@link constants.IdempotencyRecordStatusValue | IdempotencyRecordStatusValue}
* @private
*/
private readonly status;
constructor(config: IdempotencyRecordOptions);
/**
* Get the response data of the record.
*/
getResponse(): JSONValue;
/**
* Get the status of the record.
* @throws {IdempotencyInvalidStatusError} If the status is not a valid status.
*/
getStatus(): IdempotencyRecordStatusValue;
/**
* Returns true if the record is expired or undefined.
*/
isExpired(): boolean;
}
export { IdempotencyRecord };
//# sourceMappingURL=IdempotencyRecord.d.ts.map