durcno@1.0.0-alpha.3
Major Changes
-
45107b5 - Thanks to @almahdi404 !
change!: unify connector options into single-object defineConfig API
defineConfignow accepts a single configuration object with a requiredconnectorfield, instead of taking the connector as a first argument and the config as a second.dbCredentials,logger, andpoolare no longer top-level fields ofConfig. They are now passed directly inside the connector factory call asConnectorOptions.// Beforeexport default defineConfig(pg(), {schema: "db/schema.ts",dbCredentials: { url: process.env.DATABASE_URL! },logger: createDurcnoLogger(),});// Afterexport default defineConfig({schema: "db/schema.ts",connector: pg({dbCredentials: { url: process.env.DATABASE_URL! },logger: createDurcnoLogger(),}),});The
DurcnoSetup<T>type has been removed. UseConfig<T>instead — it now carries the connector type generic directly.ConnectorOptionsis now exported as a public type for use in tests or shared config helpers.
Minor Changes
-
7a54dd4 - Thanks to @almahdi404 !
impr(logger): log query execution duration
execQuerynow measures wall-clock time around each query and passesdurationMsto the logger alongside the existingsqlandargumentsfields.The built-in Winston formatter renders the new field as a
Durationsection in the box-drawing output:├ Duration│ 3.21msInternally,
$Clientand$Poolwere unified under a shared abstract base class$QueryExecutorso the timing logic only lives in one place. -
505f4c2 - Thanks to @almahdi404 !
feat(logger): add query logging support
Introduces a
loggeroption toConfigthat enables per-query logging across all connectors and query builders.A new
DurcnoLoggerinterface is exported fromdurcno. Any object with a compatibleinfo(message, meta?)method satisfies it, making the logger adapter-agnostic (Winston, Pino, custom objects, etc.).A ready-to-use Winston logger is available via
durcno/logger:import { createDurcnoLogger } from "durcno/logger";export default defineConfig(pg(), {schema: "db/schema.ts",dbCredentials: { url: process.env.DATABASE_URL! },logger: createDurcnoLogger(),});The built-in logger renders each query in a box-drawing style with the SQL and bound arguments printed inline:
2026-04-24T10:00:00.000Z [durcno] INFO: Query┌ SQL│ SELECT "id", "name" FROM "public"."users" WHERE "id" = $1├ Arguments│ $1 = 42└Internally, all query builders now call
execQuery()on the executor ($Client/$Pool) instead ofquery()directly.execQuery()logs the query before forwarding it to the underlying driver, and is a no-op when no logger is configured.