import type { Pool, PoolClient } from 'pg'; import type { ImportJob, JobCounts, StoredIssue } from '../services/job/types.js'; /** * What the PostgreSQL adapters of the jobs share: the columns of a job, how a * row becomes a job or a problem, and the rules for the text and the JSON that * go into the tables. */ export declare const COLUMNS = "import_job_id, uuid, entity, mode, status, stage, control, file_name,\n file_size, chunk_count, file_sha256, options, counts, error_message, attempt,\n worker, started_at, finished_at, heartbeat_at, expires_at, created_at,\n status_changed_at, validated_at, waiting_since, created_by"; export declare const ISSUES_PAGE = 1000; export declare const MAX_VALUE_LENGTH = 200; /** PostgreSQL text cannot hold U+0000, and a jsonb string cannot hold its escape. */ export declare const noNul: (text: string) => string; /** JSON text for a jsonb column: without the escape for U+0000 (an even number of backslashes before it is a backslash in the text, not an escape). */ export declare function jsonText(value: unknown): string; /** The counts of a row, with a default for whatever an older or newer writer left out. */ export declare function toCounts(raw: unknown): JobCounts; export declare function toJob(row: Record): ImportJob; /** Where the template of a sentence is kept: inside the parameters of the problem. */ export declare const SAY_KEY = "__say"; export declare function toIssue(row: Record): StoredIssue; /** One transaction on one connection; the connection is dropped if it cannot even roll back. */ export declare function inTransaction(pool: Pool, work: (client: PoolClient) => Promise): Promise;