import { SqliteConnection } from "./connection.js"; //#region src/idempotency-store.d.ts /** * REST `Idempotency-Key` cache row. The key is the value sent by the * client; `requestHash` fingerprints the request body so a key reuse * with a different payload returns `409 Conflict` per the IETF * draft-07 (`DEC-142 / ADR-036`). * * @stable */ interface IdempotencyRecord { readonly key: string; readonly requestHash: string; readonly statusCode: number; /** Cached response body - adapter-specific encoding (JSON in v0.1). */ readonly response: unknown; readonly responseHeaders?: Readonly>; readonly scope?: string; readonly createdAt: number; readonly expiresAt: number; } /** * Pluggable idempotency cache. The `@graphorin/server` package * (Phase 14) consumes this surface; the schema itself ships in * Phase 05's migration 008 so the framework only owns one set of * SQL tables. * * @stable */ interface IdempotencyStore { put(record: IdempotencyRecord): Promise; get(key: string): Promise; delete(key: string): Promise; /** * Delete records whose expiry is older than the supplied epoch-ms * instant. Production caller: the server's hourly * `scheduleIdempotencyPruning` sweep (started by `app-lifecycle`), * so expired rows no longer accumulate forever. */ prune(olderThan: number): Promise; } /** * Default `IdempotencyStore` implementation. * * @stable */ declare class SqliteIdempotencyStore implements IdempotencyStore { #private; constructor(conn: SqliteConnection); put(record: IdempotencyRecord): Promise; get(key: string): Promise; delete(key: string): Promise; prune(olderThan: number): Promise; } //#endregion export { IdempotencyRecord, IdempotencyStore, SqliteIdempotencyStore }; //# sourceMappingURL=idempotency-store.d.ts.map