import type { Clock } from './types.ts';
/**
 * When sql contains multiple queries, result is an array of objects with rows property
 * This function unwraps the result into a single object with rows property
 *
 * Some drivers (postgres.js, and therefore drizzle-orm/postgres-js) instead return the rows
 * themselves as a flat array. Those elements have no `rows` property, so treat the array
 * as the row set rather than flat-mapping undefined into it.
*/
declare function unwrapSQLResult(result: {
    rows: any[];
} | {
    rows: any[];
}[] | any[]): {
    rows: any[];
};
export interface AbortablePromise<T> extends Promise<T> {
    abort: () => void;
}
declare function delay(ms: number, error?: string): AbortablePromise<void>;
/**
 * Like delay(), but scheduled on the given clock so a test clock can fire it. Real-time
 * spin-waits on in-flight I/O keep using delay().
 */
declare function clockDelay(clock: Clock, ms: number, error?: string, abortController?: AbortController): AbortablePromise<void>;
declare function resolveWithinSeconds<T>(clock: Clock, promise: Promise<T>, seconds: number, message?: string, abortController?: AbortController): Promise<T | void>;
/**
 * Resolves a configured schema string to the name postgres actually stores in the catalog.
 *
 * the `schema` option is interpolated verbatim into identifier positions, so a caller may quote it
 * to reach names that are not legal bare identifiers, e.g. `'"My-Schema"'`. The catalog holds the
 * *resolved* name, so any comparison against `pg_namespace.nspname` (and anything else reading a
 * name back out of postgres) needs this rather than the raw config value.
 *
 * A quoted name resolves to its contents verbatim; a bare one is folded to lower case, as postgres
 * does on the way in. So `"MySchema"` and `MySchema` are different schemas, the latter stored as
 * `myschema`.
 *
 * Do NOT use this to derive the notify channel or the advisory lock - see normalizeSchemaName.
 */
declare function resolveSchemaName(schema: string): string;
/**
 * Canonicalizes a configured schema string for the values pg-boss *derives* from it rather than
 * looks up: the notify channel name and the advisory lock key.
 *
 * Those are hashes of a string, never compared against the catalog - the channel literal is
 * generated from the same expression for both LISTEN and NOTIFY, and the advisory key is opaque to
 * postgres. So the only requirement is that every instance pointed at the same physical schema
 * agrees, which means the *sole* transform needed is collapsing quoting that carries no meaning:
 * `'"pgboss"'` and `'pgboss'` are one schema and must not end up on separate channels.
 *
 * Deliberately NOT resolveSchemaName. Folding a bare `MySchema` to `myschema` would also be
 * "correct", but it changes the channel and lock key for a name that has always been legal, so a
 * rolling upgrade would leave old and new instances failing to coordinate. Leaving bare names
 * untouched keeps the derived values byte-identical to every prior release.
 */
declare function normalizeSchemaName(schema: string): string;
export { clockDelay, delay, normalizeSchemaName, resolveSchemaName, resolveWithinSeconds, unwrapSQLResult };
//# sourceMappingURL=tools.d.ts.map