import type { ApprovalState, ApprovalTargetKind } from './store.js'; /** * Read surface over `work_item_approvals` (Todos v2 slice 4) — the only storage * for approval facts, since PLA-48 dropped the `approval_*` columns from * work_items. Every read resolves through the "current row": the PENDING row * when one exists (the partial unique index guarantees at most one), else the * most recently decided row. * * This module is deliberately free of work-item runtime imports (types only) so * `store.ts` can hydrate a WorkItem's approval fields from it without an import * cycle; the WRITE orchestration (request/decide/escalate) stays in `approvals.ts`. */ export interface WorkItemApproval { id: string; workItemId: string; state: ApprovalState; request: string; /** Opaque correlation reference carried by the request contract (sources the * legacy `approvalRef` payload field). */ ref: string | null; /** Offered variants for a CHOICE approval (null = plain approve/reject). */ options: string[] | null; /** The picked option, once an approve decision carried one. */ choice: string | null; /** Reserved for the human operator: no employee may decide it, not the COO * and not through escalation. */ operatorOnly: boolean; target: string | null; targetKind: ApprovalTargetKind | null; requestedBy: string; requestedAt: string; escalatedAt: string | null; decidedBy: string | null; decidedAt: string | null; note: string | null; } /** Full approval history for one item, oldest request first. */ export declare function listApprovals(workItemId: string): WorkItemApproval[]; /** The item's current approval: the pending row, else the most recently decided. */ export declare function currentApproval(workItemId: string): WorkItemApproval | undefined; /** Batched current-row lookup — ONE query per ≤500-id chunk, for list pages and * trees (never per item). Items with no approval history are simply absent. */ export declare function currentApprovalsByItem(workItemIds: readonly string[]): Map; //# sourceMappingURL=approval-rows.d.ts.map