import { _ as StringLoggerOptions, a as Logger, p as QueryFormatter } from "./types-D_rumhHT.cjs"; //#region src/colorful-syntax.d.ts /** ANSI color for a SQL token role. `false` disables coloring for that role. */ type ColorfulSyntaxColor = string | false; /** Partial ANSI color theme used by `colorful-syntax` helpers. */ interface ColorfulSyntaxThemeInput { /** SQL reserved keywords. */ keyword?: ColorfulSyntaxColor; /** SQL functions. */ fn?: ColorfulSyntaxColor; /** Numbers. */ number?: ColorfulSyntaxColor; /** Strings. */ string?: ColorfulSyntaxColor; /** Special characters. */ special?: ColorfulSyntaxColor; /** Brackets / parentheses. */ bracket?: ColorfulSyntaxColor; /** Comments. */ comment?: ColorfulSyntaxColor; /** Clear code inserted after each colored match. */ clear?: string; } /** * Complete ANSI color theme used by `colorful-syntax` helpers. * * Exactly `ColorfulSyntaxThemeInput` with every role resolved and frozen, plus * `extend`. Kept in sync with the input via `Required` so the two can't drift. */ interface ColorfulSyntaxTheme extends Readonly> { /** Return a new theme with these overrides applied. */ extend(overrides: ColorfulSyntaxThemeInput): ColorfulSyntaxTheme; } /** Options accepted by `colorizeSql` and `colorfulSyntaxFormatter`. */ interface ColorfulSyntaxOptions { /** Partial theme merged over `colorfulSyntaxThemes.default`. */ theme?: ColorfulSyntaxThemeInput; } /** Built-in SQL syntax color themes. */ declare const colorfulSyntaxThemes: Readonly<{ /** Adaptive 16-color ANSI theme. Used when no theme is provided. */ default: ColorfulSyntaxTheme; dracula: ColorfulSyntaxTheme; nord: ColorfulSyntaxTheme; monokai: ColorfulSyntaxTheme; oneDark: ColorfulSyntaxTheme; solarizedDark: ColorfulSyntaxTheme; tokyoNight: ColorfulSyntaxTheme; catppuccinMocha: ColorfulSyntaxTheme; solarizedLight: ColorfulSyntaxTheme; githubLight: ColorfulSyntaxTheme; oneLight: ColorfulSyntaxTheme; catppuccinLatte: ColorfulSyntaxTheme; }>; /** Create a query formatter that syntax-colors another query formatter's SQL output. */ declare function colorfulSyntaxFormatter(formatter: QueryFormatter, options?: ColorfulSyntaxOptions): QueryFormatter; /** Syntax-color a SQL string with ANSI colors. */ declare function colorizeSql(sql: string, options?: ColorfulSyntaxOptions): string; //#endregion //#region src/colorful-logger.d.ts /** * Options accepted by `colorfulLogger`. * * Same formatting options as `defaultLogger`, plus optional syntax highlighting. */ type ColorfulLoggerOptions = StringLoggerOptions & ({ /** * Syntax-highlight the SQL body instead of tinting the whole line by state. * * Defaults to `false`. */ highlight?: false; theme?: never; } | { highlight: true; /** * SQL syntax color theme. Applies only in highlight mode. * * Defaults to `colorfulSyntaxThemes.default`. */ theme?: ColorfulSyntaxThemeInput; }); /** * Create the built-in ANSI-colored string logger. * * It behaves like `defaultLogger`, but colors output by query state: the * `SQL` / `SQL ERROR` label is cyan for successful queries and red for failed * ones. By default the SQL body shares that state color. * * Set `highlight: true` to syntax-highlight the SQL body instead; the label * keeps carrying the query state. Pass `theme` to pick the syntax colors. * * It writes to `console.log` by default. * * By default, it asks Knex to interpolate bindings into the logged SQL. * `bindings: false` writes the original SQL with placeholders. * * `formatter` lets you replace SQL formatting completely. * * @example * ```ts * import knexTinyLogger from 'knex-tiny-logger' * import { colorfulLogger, colorfulSyntaxThemes } from 'knex-tiny-logger/colorful' * * knexTinyLogger(knex, { * logger: colorfulLogger(), * }) * * knexTinyLogger(knex, { * logger: colorfulLogger({ highlight: true, theme: colorfulSyntaxThemes.dracula }), * }) * ``` */ declare function colorfulLogger(options?: ColorfulLoggerOptions): Logger; //#endregion export { type ColorfulLoggerOptions, type ColorfulSyntaxColor, type ColorfulSyntaxOptions, type ColorfulSyntaxTheme, type ColorfulSyntaxThemeInput, colorfulLogger, colorfulSyntaxFormatter, colorfulSyntaxThemes, colorizeSql };