/** * @fileoverview Handler for persisting a chat message, plus a driver-error formatting utility. * * createMessagesHandler validates and inserts a message row scoped to the * authenticated user; describeError flattens Drizzle/D1's wrapped `cause` * chain into a single readable string for logging. */ import type { MessagesDeps } from "../types"; /** * Flattens an error's `cause` chain into one string. Drizzle wraps driver * errors (e.g. D1's "no such column" / constraint failures) in a generic * "Failed query" error and puts the real one in `cause`, which structured * log sinks drop unless serialized explicitly. */ export declare function describeError(err: unknown): string; export declare function createMessagesHandler(deps: MessagesDeps): { POST: (req: Request) => Promise; };