@better-auth/kysely-adapter 1.7.0-rc.2 → 1.7.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +1 -5
- package/dist/index.mjs +17 -4
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -7,13 +7,9 @@ type KyselyDatabaseType = "postgres" | "mysql" | "sqlite" | "mssql";
|
|
|
7
7
|
//#region src/dialect.d.ts
|
|
8
8
|
declare function getKyselyDatabaseType(db: BetterAuthOptions["database"]): KyselyDatabaseType | null;
|
|
9
9
|
declare const createKyselyAdapter: (config: BetterAuthOptions) => Promise<{
|
|
10
|
-
kysely: Kysely<any>;
|
|
11
|
-
databaseType: "postgres" | "mysql" | "sqlite" | "mssql";
|
|
12
|
-
transaction: boolean | undefined;
|
|
13
|
-
} | {
|
|
14
10
|
kysely: Kysely<any> | null;
|
|
15
11
|
databaseType: KyselyDatabaseType | null;
|
|
16
|
-
transaction: undefined;
|
|
12
|
+
transaction: boolean | undefined;
|
|
17
13
|
}>;
|
|
18
14
|
//#endregion
|
|
19
15
|
//#region src/kysely-adapter.d.ts
|
package/dist/index.mjs
CHANGED
|
@@ -38,14 +38,25 @@ const createKyselyAdapter = async (config) => {
|
|
|
38
38
|
transaction: db.transaction
|
|
39
39
|
};
|
|
40
40
|
let dialect = void 0;
|
|
41
|
+
let transaction = void 0;
|
|
41
42
|
const databaseType = getKyselyDatabaseType(db);
|
|
42
43
|
if ("createDriver" in db) dialect = db;
|
|
43
|
-
if ("aggregate" in db && !("createSession" in db))
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
if ("aggregate" in db && !("createSession" in db)) {
|
|
45
|
+
dialect = new SqliteDialect({ database: db });
|
|
46
|
+
transaction = true;
|
|
47
|
+
}
|
|
48
|
+
if ("getConnection" in db) {
|
|
49
|
+
dialect = new MysqlDialect(db);
|
|
50
|
+
transaction = true;
|
|
51
|
+
}
|
|
52
|
+
if ("connect" in db) {
|
|
53
|
+
dialect = new PostgresDialect({ pool: db });
|
|
54
|
+
transaction = true;
|
|
55
|
+
}
|
|
46
56
|
if ("fileControl" in db) {
|
|
47
57
|
const { BunSqliteDialect } = await import("./bun-sqlite-dialect-ChDhLV_M.mjs");
|
|
48
58
|
dialect = new BunSqliteDialect({ database: db });
|
|
59
|
+
transaction = true;
|
|
49
60
|
}
|
|
50
61
|
if ("createSession" in db) {
|
|
51
62
|
let DatabaseSync = void 0;
|
|
@@ -62,16 +73,18 @@ const createKyselyAdapter = async (config) => {
|
|
|
62
73
|
if (DatabaseSync && db instanceof DatabaseSync) {
|
|
63
74
|
const { NodeSqliteDialect } = await import("./node-sqlite-dialect.mjs");
|
|
64
75
|
dialect = new NodeSqliteDialect({ database: db });
|
|
76
|
+
transaction = true;
|
|
65
77
|
}
|
|
66
78
|
}
|
|
67
79
|
if ("batch" in db && "exec" in db && "prepare" in db) {
|
|
68
80
|
const { D1SqliteDialect } = await import("./d1-sqlite-dialect-zindL8uv.mjs");
|
|
69
81
|
dialect = new D1SqliteDialect({ database: db });
|
|
82
|
+
transaction = false;
|
|
70
83
|
}
|
|
71
84
|
return {
|
|
72
85
|
kysely: dialect ? new Kysely({ dialect }) : null,
|
|
73
86
|
databaseType,
|
|
74
|
-
transaction
|
|
87
|
+
transaction
|
|
75
88
|
};
|
|
76
89
|
};
|
|
77
90
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-auth/kysely-adapter",
|
|
3
|
-
"version": "1.7.0-rc.
|
|
3
|
+
"version": "1.7.0-rc.3",
|
|
4
4
|
"description": "Kysely adapter for Better Auth",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"@better-auth/utils": "0.4.2",
|
|
44
44
|
"kysely": "^0.28.17 || ^0.29.0",
|
|
45
|
-
"@better-auth/core": "^1.7.0-rc.
|
|
45
|
+
"@better-auth/core": "^1.7.0-rc.3"
|
|
46
46
|
},
|
|
47
47
|
"peerDependenciesMeta": {
|
|
48
48
|
"kysely": {
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"kysely": "^0.28.17 || ^0.29.0",
|
|
56
56
|
"tsdown": "0.22.7",
|
|
57
57
|
"typescript": "^6.0.3",
|
|
58
|
-
"@better-auth/core": "1.7.0-rc.
|
|
58
|
+
"@better-auth/core": "1.7.0-rc.3"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
61
|
"build": "tsdown",
|