/** * Shared utilities for drizzle-fastify route helpers. */ /** * Coerce a path-param id to number when numeric, else keep the string key. * * @deprecated UNSAFE for any context that has a column (or metadata) to inspect: * on a TEXT/string primary key a numeric-LOOKING id is silently converted * ('0123' → 123), and SQLite's comparison affinity then matches the OTHER row * ('123') — a wrong-row read/update/DELETE. Use `coerceIdForColumn` with the * PK column ref instead. This remains only as the fallback for raw-SQL views * with no declared columns (via `coerceIdForColumn`/`rawIdLiteral`). */ export declare function parseId(raw: string): number | string; /** * Coerce a path-param id to what the PK column actually expects. * * A Drizzle column carries its own JS `dataType`, so a mount can read the PK's type * straight off the view rather than assuming it is numeric. Forcing every id through * `Number()` makes a uuid/text PK unfindable: `Number()` is NaN, and `eq(col, NaN)` * matches no row (libsql throws outright) — so a row that is plainly present in the list * response 404s on its own detail route. * * Returns `undefined` only when the id is malformed FOR A NUMERIC column — the one case * in which a bad id is actually knowable — so the caller can answer 400. With no column * to inspect (a raw-SQL view with no declared columns) it falls back to `parseId`. */ export declare function coerceIdForColumn(colRef: unknown, raw: string): number | string | undefined; /** * SQL literal for an id on a raw-SQL view (no declared columns to inspect). Numeric ids * stay unquoted; anything else is emitted as a quote-escaped string literal, so a uuid * key is matched rather than coerced to NaN. SQLite applies column affinity on comparison, * so both forms land on the right column type. */ export declare function rawIdLiteral(raw: string): string; export declare function isTruthyFlag(v: unknown): boolean; export declare function contractErrorCode(internal: string): string; //# sourceMappingURL=util.d.ts.map