update(kysley-adapter): Allow providing debug logs

This commit is contained in:
Maxwell
2025-05-25 06:57:26 +10:00
committed by GitHub
3 changed files with 17 additions and 1 deletions

View File

@@ -15,13 +15,14 @@ exports[`init > should match config 1`] = `
"adapterConfig": {
"adapterId": "kysely",
"adapterName": "Kysely Adapter",
"debugLogs": undefined,
"debugLogs": false,
"supportsBooleans": false,
"supportsDates": false,
"supportsJSON": false,
"supportsNumericIds": true,
"usePlural": undefined,
},
"debugLogs": false,
"type": "sqlite",
},
"update": [Function],

View File

@@ -30,6 +30,8 @@ export async function getAdapter(options: BetterAuthOptions): Promise<Adapter> {
}
return kyselyAdapter(kysely, {
type: databaseType || "sqlite",
debugLogs:
"debugLogs" in options.database ? options.database.debugLogs : false,
})(options);
}

View File

@@ -18,6 +18,7 @@ import type { Database } from "better-sqlite3";
import type { Logger } from "../utils";
import type { AuthMiddleware } from "../plugins";
import type { LiteralUnion, OmitId } from "./helper";
import type { AdapterDebugLogs } from "../adapters";
//@ts-ignore - we need to import this to get the type of the database
import type { Database as BunDatabase } from "bun:sqlite";
@@ -92,6 +93,12 @@ export type BetterAuthOptions = {
* @default "camel"
*/
casing?: "snake" | "camel";
/**
* Enable debug logs for the adapter
*
* @default false
*/
debugLogs?: AdapterDebugLogs;
}
| {
/**
@@ -108,6 +115,12 @@ export type BetterAuthOptions = {
* @default "camel"
*/
casing?: "snake" | "camel";
/**
* Enable debug logs for the adapter
*
* @default false
*/
debugLogs?: AdapterDebugLogs;
};
/**
* Secondary storage configuration