export type MirrorQueryResult = { rows: Array>; rowCount: number | null; }; export type MirrorQuery = (sql: string, params: unknown[]) => Promise; export interface MirrorOptions { /** Table name (identifier — validated). */ table: string; /** WorkOS id column, e.g. "workos_org_id" or "workos_user_id". */ idColumn: string; /** JSON metadata column. Default "workos_metadata". */ metadataColumn?: string; /** Optional map of WorkOS-resource field → DB column, synced by syncResource * (e.g. { name: "name" } to keep a workspaces.name column in sync). */ columns?: Record; /** Query executor returning { rows, rowCount }. Keeps this package pg-free. */ query: MirrorQuery; } export interface Mirror { /** Insert the row from id + metadata if absent (no-op if it exists). */ ensure(workosId: string, metadata?: Record): Promise; /** Full row, or null. */ get(workosId: string): Promise | null>; /** Just the metadata blob, or null if the row is absent. */ getMetadata(workosId: string): Promise | null>; /** Overwrite the metadata blob on an existing row. */ setMetadata(workosId: string, metadata: Record): Promise; /** Sync a WorkOS resource onto the existing row: the mapped `columns` fields * + the metadata blob. Update-only (rows are created by the app). */ syncResource(workosId: string, resource: Record): Promise; /** Delete the row. */ remove(workosId: string): Promise; } export declare function createMirror(opts: MirrorOptions): Mirror; //# sourceMappingURL=mirror.d.ts.map