/** * PostgresIdempotencyStore — durable IdempotencyStore adapter backed by * PostgreSQL. * * Companion schema: src/manifest/idempotency/stores/postgres.sql. * * Persistence model: one row per idempotency key (PRIMARY KEY). The cached * `CommandResult` is stored in a single JSONB column so it round-trips * without a schema per result shape. * * First-write-wins: `set` uses `INSERT … ON CONFLICT (idempotency_key) DO * NOTHING` — a replay with the same key never overwrites the first recorded * result, so concurrent workers racing on the same key converge on one * stored outcome. The runtime only calls `set` after a `get` miss, so under * single-writer operation this is equivalent to any write policy; the choice * is load-bearing only when two callers execute the same key concurrently. * * DO NOT import this file in browser code — it requires `pg`. */ import type { Pool } from 'pg'; import type { CommandResult, IdempotencyStore } from '../../runtime-engine'; export interface PostgresIdempotencyStoreOptions { /** A pg Pool. The store does NOT own the pool's lifecycle. */ pool: Pool; /** Table name override. Default: `manifest_idempotency_keys`. */ tableName?: string; } export declare class PostgresIdempotencyStore implements IdempotencyStore { private pool; private tableName; constructor(opts: PostgresIdempotencyStoreOptions); has(key: string): Promise; get(key: string): Promise; /** * Record a result for `key`. When `tx` is a PoolClient bound to an open * transaction, the INSERT participates in that transaction so the cached * result commits atomically with the command's other writes; otherwise it * runs on a fresh pool connection. */ set(key: string, result: CommandResult, tx?: unknown): Promise; } //# sourceMappingURL=postgres.d.ts.map