import type { Selectable } from 'kysely'; import type * as Db from '../Db.js'; import type * as db_Schema from '../Schema.js'; /** Columns of the `funding_idempotency_requests` table. */ export type Table = db_Schema.FundingIdempotencyRequest; /** A stored idempotency claim. */ export type Record = Selectable; /** * Claims `(apiKeyId, keyHash)` for one creation attempt. A live claim rejects * mismatches, blocks pending work, resumes checkpoints, or replays completion. */ export declare function claim(db: Db.Db, input: claim.Input): Promise; export declare namespace claim { /** Claim identity and retention. */ type Input = { /** API key id (`key_…`) the claim is scoped to. */ apiKeyId: string; /** SHA-256 of the caller Idempotency-Key. */ keyHash: string; /** SHA-256 fingerprint of the canonical validated request. */ requestHash: string; /** Lease duration for the pending execution, in milliseconds. */ ttlMs: number; }; /** Outcome of a claim attempt. */ type Result = { createdAt: string; type: 'claimed'; } | { type: 'mismatch'; } | { type: 'pending'; } | { response: string; type: 'replay'; } | { createdAt: string; response: string; type: 'resume'; }; } /** Stores a provider result before committing its API resource and replay response. */ export declare function checkpoint(db: Db.Db, input: checkpoint.Input): Promise; export declare namespace checkpoint { /** Provider result and owned claim required for durable recovery. */ type Input = { /** API key id (`key_…`) the claim is scoped to. */ apiKeyId: string; /** Creation time returned by the successful claim. */ createdAt: string; /** SHA-256 of the caller Idempotency-Key. */ keyHash: string; /** Recovery checkpoint retention in milliseconds. */ replayTtlMs: number; /** Serialized provider result required to resume resource creation. */ response: string; }; } /** Completes an owned pending or provisioned claim with its replay response. */ export declare function complete(db: Db.Db, input: complete.Input): Promise; export declare namespace complete { /** Completion fields. */ type Input = { /** API key id (`key_…`) the claim is scoped to. */ apiKeyId: string; /** Creation time returned by the successful claim. */ createdAt: string; /** SHA-256 of the caller Idempotency-Key. */ keyHash: string; /** Successful-response replay retention from completion, in milliseconds. */ replayTtlMs: number; /** Serialized success response replayed for the retention window. */ response: string; /** Transfer id (`ftr_…`) when the request created a funding transfer. */ transferId?: string | undefined; }; } /** Releases a pending claim after a retryable failure. */ export declare function release(db: Db.Db, input: release.Input): Promise; export declare namespace release { /** Pending claim identity. */ type Input = { /** API key id (`key_…`) the claim is scoped to. */ apiKeyId: string; /** Creation time returned by the successful claim. */ createdAt: string; /** SHA-256 of the caller Idempotency-Key. */ keyHash: string; }; } //# sourceMappingURL=fundingIdempotency.d.ts.map