/** * PostgresApprovalStore — durable ApprovalStore adapter backed by PostgreSQL. * * Companion schema: src/manifest/approval/stores/postgres.sql. * * Persistence model: one row per approval request, keyed by the runtime's * opaque `${entity}:${instanceId}:${approvalName}` key (PRIMARY KEY). The * full request state is stored across typed columns; `required_stages` and * `grants` are JSONB so they round-trip without a join table. * * Upsert: `save` uses `INSERT … ON CONFLICT (key) DO UPDATE` so creating a * pending request and later recording grants/denials are both a single * statement. The latest write wins — the runtime always saves the complete * state, never a partial patch. * * Expiry: `expire` is a single set-based `UPDATE … WHERE status='pending' * AND expires_at <= $1 RETURNING *`, so a cron/worker can sweep timeouts * without loading the table. See * https://www.postgresql.org/docs/current/sql-update.html § "Outputs". * * DO NOT import this file in browser code — it requires `pg`. */ import type { Pool } from 'pg'; import type { ApprovalRequestState } from '../../runtime-engine'; import type { ApprovalStore } from '../approval-store'; export interface PostgresApprovalStoreOptions { /** A pg Pool. The store does NOT own the pool's lifecycle. */ pool: Pool; /** Table name override. Default: `manifest_approval_requests`. */ tableName?: string; } export declare class PostgresApprovalStore implements ApprovalStore { private pool; private tableName; constructor(opts: PostgresApprovalStoreOptions); load(key: string): Promise; save(key: string, state: ApprovalRequestState, tx?: unknown): Promise; list(): Promise; expire(now: number): Promise; } //# sourceMappingURL=postgres.d.ts.map