import type { UserContext, FindOptions, CreateOptions, UpdateOptions, UpsertOptions, DeleteOptions } from '../schema/types'; import type { ColumnValidationRule } from './sheetClient'; /** * CRUDOperations' public shape, extracted so a non-Sheets storage engine (Phase 16.2, e.g. a * Postgres/MySQL adapter) can back `adapter.table(name)` with its own implementation instead * of the Sheets-specific CRUDOperations class — see TODO.md Phase 16. */ export interface TableOperations { create(data: Record, options?: CreateOptions): Promise>; createMany(records: Record[], options?: CreateOptions): Promise[]>; findMany(options?: FindOptions): Promise[]>; findOne(options?: FindOptions): Promise | null>; update(options: UpdateOptions): Promise; upsert(options: UpsertOptions): Promise>; delete(options: DeleteOptions): Promise; count(options?: Pick): Promise; } /** * SheetAdapter's public shape, extracted so a non-Sheets DatabaseAdapter (Phase 16.2) can be * swapped in behind `createSheetAdapter`'s call sites at production cutover without rewriting * application CRUD code — see TODO.md Phase 16. */ export interface DatabaseAdapter { withContext(context: UserContext): DatabaseAdapter; asActor(targetActor: string, targetSheetId: string): DatabaseAdapter; table(tableName: string): TableOperations; } /** * The subset of SheetClient that CRUDOperations actually depends on. Depending on this * interface instead of the concrete SheetClient class means a SQL-backed equivalent (Phase * 16.2) can either implement it directly to reuse CRUDOperations' validation/serialization * logic, or ignore it entirely behind its own TableOperations implementation. * * `extendValidation` is optional — it re-applies Sheets checkbox/dropdown validation ranges * (see FAQ.md #10) and has no equivalent concept in a SQL engine. */ export interface StorageClient { getAllRows(spreadsheetId: string, sheetName: string): Promise; appendRow(spreadsheetId: string, sheetName: string, values: string[]): Promise; appendRows(spreadsheetId: string, sheetName: string, rows: string[][]): Promise; updateRow(spreadsheetId: string, sheetName: string, rowIndex: number, values: string[]): Promise; deleteRow(spreadsheetId: string, sheetName: string, rowIndex: number): Promise; writeHeader(spreadsheetId: string, sheetName: string, headers: string[]): Promise; extendValidation?(spreadsheetId: string, sheetName: string, rules: ColumnValidationRule[], dataRowCount: number): Promise; } //# sourceMappingURL=types.d.ts.map