import * as Store from './Store.js'; /** * API-level retry coordination for idempotent write endpoints, letting a * caller recover a successful response after a transport timeout. * * A key moves from missing to pending to complete. Only the claim token may * finish or release pending state, preventing an older request from * overwriting a newer owner. */ /** Identity for one caller-supplied idempotent request. */ export type Identity = { /** API key that submitted the request. */ apiKeyId: string; /** Opaque caller-supplied idempotency key. */ idempotencyKey: string; /** Hash of the request content bound to this idempotency key. */ inputHash: string; }; /** Returns a stable digest without retaining request contents in durable state. */ export declare function inputHash(input: unknown): string; /** Creates an idempotency coordinator over one durable-store key namespace. */ export declare function create(options: create.Options): { claim: (options: claim.Options) => Promise>; complete: (options: complete.Options) => Promise; release: (options: release.Options) => Promise; }; export declare namespace create { /** Coordinator configuration bound at creation. */ type Options = { /** Durable-store key namespace (e.g. `mpp:relay:v1`). */ namespace: string; /** How long a pending claim blocks equivalent requests, in milliseconds. */ pendingTtl: number; /** How long a completed response replays, in milliseconds. */ receiptTtl: number; }; } export declare namespace claim { /** Dependencies for claiming one idempotency key. */ type Options = { /** API-key-scoped idempotency identity. */ identity: Identity; /** Authoritative state with atomic compare-and-swap, normally a Durable Object. */ state: Store.State; }; /** Outcome from attempting to claim an idempotency key. */ type Result = { token: string; type: 'claimed'; } | { type: 'mismatch'; } | { response: response; type: 'replay'; } | { type: 'pending'; }; } export declare namespace complete { /** Dependencies for persisting one terminal response. */ type Options = { /** API-key-scoped idempotency identity. */ identity: Identity; /** Terminal successful response to replay. */ response: response; /** Authoritative state with atomic compare-and-swap, normally a Durable Object. */ state: Store.State; /** Token returned by the successful claim. */ token: string; }; } export declare namespace release { /** Dependencies for releasing one idempotency claim. */ type Options = { /** API-key-scoped idempotency identity. */ identity: Identity; /** Authoritative state with atomic compare-and-swap, normally a Durable Object. */ state: Store.State; /** Token returned by the successful claim. */ token: string; }; } //# sourceMappingURL=Idempotency.d.ts.map