UNPKG

@node-idempotency/core

Version:

A Race-Condition free Node.js library that ensures idempotency for requests, preventing unintended duplicate operations.

18 lines 913 B
import { type StorageAdapter } from "@node-idempotency/storage"; import { type IdempotencyParams, type IdempotencyParamsWithDefaults, type IdempotencyResponse, type IdempotencyOptions } from "./types"; export declare class Idempotency { private readonly storage; options: IdempotencyParamsWithDefaults["options"]; constructor(storage: StorageAdapter, options?: IdempotencyOptions); private buildRequestOptions; private getInternalRequest; private getIdempotencyKey; private isEnabled; private validateRequest; private getIdempotencyCacheKey; private hash; private getFingerPrint; onRequest<BodyType, ErrorType>(req: IdempotencyParams): Promise<IdempotencyResponse<BodyType, ErrorType> | undefined>; onResponse<BodyType, ErrorType>(req: IdempotencyParams, res: IdempotencyResponse<BodyType, ErrorType>): Promise<void>; } //# sourceMappingURL=idempotency.d.ts.map