import { type Client } from "@libsql/client"; import { type ReadOnlySqliteQueryClient } from "../sqlite/read-only-client.js"; import type { Inverse, SyncHorizon } from "./operation.js"; export type OpStatus = "pending" | "applied" | "aborted"; export interface OpLogInput { kind: string; horizon: SyncHorizon; fileSet: string[]; inverse: Inverse; } export interface OpLogRow { id: Uint8Array; kind: string; horizon: SyncHorizon; fileSet: string[]; inverse: Inverse; status: OpStatus; createdAt: string; appliedAt: string | null; } export declare function getOperationLogStoreIdentity(db: Client): string; export declare const POD_REPAIR_OPERATION_ID_SQL = "CASE\n WHEN json_valid(file_set)\n AND json_array_length(file_set) = 1\n AND json_type(file_set, '$[0]') = 'text'\n AND json_valid(json_extract(file_set, '$[0]'))\n THEN json_extract(json_extract(file_set, '$[0]'), '$.operation_id')\n ELSE NULL\nEND"; export declare function getOpLogPath(): string; export type ReadOnlyOperationLogClient = ReadOnlySqliteQueryClient; export type ReadOnlyOperationLogOpenResult = Readonly<{ kind: "missing"; path: string; }> | Readonly<{ kind: "open"; path: string; client: ReadOnlyOperationLogClient; close(): void; }>; export declare function openOpLogReadOnly(opts?: { path?: string; }): Promise; export declare function openOpLog(opts?: { path?: string; }): Promise; export declare function closeOpLog(db: Client): Promise; export declare function appendPendingOp(db: Client, input: OpLogInput, nowIso: string): Promise; export declare function markOpApplied(db: Client, id: Uint8Array, outcome: { horizon: SyncHorizon; inverse: Inverse; fileSet?: string[]; }, nowIso: string): Promise; export declare function markOpAborted(db: Client, id: Uint8Array, reason: string, nowIso: string): Promise; export declare function readLastAppliedOp(db: Client): Promise; export declare function readPendingOps(db: Client): Promise; export declare function listOps(db: Client, limit?: number): Promise; export declare function countOps(db: Client): Promise; //# sourceMappingURL=operation-log.d.ts.map