import type { MailOptions, SendResult, Transport, VerifyResult } from "./core/types.js"; /** Key-value store for idempotency deduplication. */ export interface IdempotencyStore { /** Returns true when the key was already recorded. */ has(key: string): Promise; /** Record a key, optionally expiring after `ttlMs` milliseconds. */ set(key: string, ttlMs?: number): Promise; } /** In-memory idempotency store with optional TTL expiry. Suitable for single-process use. */ export declare class MemoryIdempotencyStore implements IdempotencyStore { private readonly entries; /** Returns true when the key exists and has not expired. */ has(key: string): Promise; /** Record a key with optional TTL in milliseconds. */ set(key: string, ttlMs?: number): Promise; } /** Options for {@link IdempotencyTransport}. */ export interface IdempotencyTransportOptions { /** Store used to track sent keys. Defaults to {@link MemoryIdempotencyStore}. */ store?: IdempotencyStore; /** TTL in milliseconds for recorded keys. Default: 24 hours. */ ttlMs?: number; } /** * Transport decorator that skips duplicate sends when an idempotency key * was already recorded. Checks the store once before delegating to the inner * transport, so retries inside RetryTransport reuse the same key automatically. */ export declare class IdempotencyTransport implements Transport { /** Transport that performs the actual send when the key is new. */ private readonly inner; readonly provider = "idempotency"; private readonly store; private readonly ttlMs; /** Wraps an inner transport with idempotency deduplication. */ constructor( /** Transport that performs the actual send when the key is new. */ inner: Transport, options?: IdempotencyTransportOptions); /** Sends once per idempotency key; returns a synthetic result on duplicate keys. */ send(options: MailOptions): Promise; /** Delegates batch sends to the inner transport when available. */ sendBatch(messages: MailOptions[]): Promise; /** Delegates to the inner transport verify or returns a default success result. */ verify(): Promise; /** Delegates close to the inner transport if available. */ close(): Promise; }