@better-auth/kysely-adapter 1.6.14 → 1.6.16
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/{bun-sqlite-dialect-DzNwOpKv.mjs → bun-sqlite-dialect-DApWON3g.mjs} +7 -5
- package/dist/{d1-sqlite-dialect-C2B7YsIT.mjs → d1-sqlite-dialect-BLC8LXE6.mjs} +3 -4
- package/dist/index.mjs +2 -2
- package/dist/kysely-migration-tables-JkVUjPF_.mjs +19 -0
- package/dist/node-sqlite-dialect.mjs +7 -5
- package/package.json +3 -3
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as DEFAULT_MIGRATION_TABLE, t as DEFAULT_MIGRATION_LOCK_TABLE } from "./kysely-migration-tables-JkVUjPF_.mjs";
|
|
2
|
+
import { CompiledQuery, DefaultQueryCompiler, sql } from "kysely";
|
|
2
3
|
//#region src/bun-sqlite-dialect.ts
|
|
3
4
|
var BunSqliteAdapter = class {
|
|
4
5
|
get supportsCreateIfNotExists() {
|
|
@@ -7,6 +8,9 @@ var BunSqliteAdapter = class {
|
|
|
7
8
|
get supportsTransactionalDdl() {
|
|
8
9
|
return false;
|
|
9
10
|
}
|
|
11
|
+
get supportsMultipleConnections() {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
10
14
|
get supportsReturning() {
|
|
11
15
|
return true;
|
|
12
16
|
}
|
|
@@ -93,9 +97,6 @@ var BunSqliteIntrospector = class {
|
|
|
93
97
|
const tables = await query.execute();
|
|
94
98
|
return Promise.all(tables.map(({ name }) => this.#getTableMetadata(name)));
|
|
95
99
|
}
|
|
96
|
-
async getMetadata(options) {
|
|
97
|
-
return { tables: await this.getTables(options) };
|
|
98
|
-
}
|
|
99
100
|
async #getTableMetadata(table) {
|
|
100
101
|
const db = this.#db;
|
|
101
102
|
const autoIncrementCol = (await db.selectFrom("sqlite_master").where("name", "=", table).select("sql").$castTo().execute())[0]?.sql?.split(/[\(\),]/)?.find((it) => it.toLowerCase().includes("autoincrement"))?.split(/\s+/)?.[0]?.replace(/["`]/g, "");
|
|
@@ -113,7 +114,8 @@ var BunSqliteIntrospector = class {
|
|
|
113
114
|
isAutoIncrementing: col.name === autoIncrementCol,
|
|
114
115
|
hasDefaultValue: col.dflt_value != null
|
|
115
116
|
})),
|
|
116
|
-
isView: false
|
|
117
|
+
isView: false,
|
|
118
|
+
isForeign: false
|
|
117
119
|
};
|
|
118
120
|
}
|
|
119
121
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as DEFAULT_MIGRATION_TABLE, t as DEFAULT_MIGRATION_LOCK_TABLE } from "./kysely-migration-tables-JkVUjPF_.mjs";
|
|
2
|
+
import { SqliteAdapter, SqliteQueryCompiler } from "kysely";
|
|
2
3
|
//#region src/d1-sqlite-dialect.ts
|
|
3
4
|
var D1SqliteAdapter = class extends SqliteAdapter {};
|
|
4
5
|
var D1SqliteDriver = class {
|
|
@@ -76,6 +77,7 @@ var D1SqliteIntrospector = class {
|
|
|
76
77
|
return {
|
|
77
78
|
name: table.name,
|
|
78
79
|
isView: table.type === "view",
|
|
80
|
+
isForeign: false,
|
|
79
81
|
columns: columnInfo.map((col) => ({
|
|
80
82
|
name: col.name,
|
|
81
83
|
dataType: col.type,
|
|
@@ -86,9 +88,6 @@ var D1SqliteIntrospector = class {
|
|
|
86
88
|
};
|
|
87
89
|
});
|
|
88
90
|
}
|
|
89
|
-
async getMetadata(options) {
|
|
90
|
-
return { tables: await this.getTables(options) };
|
|
91
|
-
}
|
|
92
91
|
};
|
|
93
92
|
var D1SqliteQueryCompiler = class extends SqliteQueryCompiler {};
|
|
94
93
|
var D1SqliteDialect = class {
|
package/dist/index.mjs
CHANGED
|
@@ -44,7 +44,7 @@ const createKyselyAdapter = async (config) => {
|
|
|
44
44
|
if ("getConnection" in db) dialect = new MysqlDialect(db);
|
|
45
45
|
if ("connect" in db) dialect = new PostgresDialect({ pool: db });
|
|
46
46
|
if ("fileControl" in db) {
|
|
47
|
-
const { BunSqliteDialect } = await import("./bun-sqlite-dialect-
|
|
47
|
+
const { BunSqliteDialect } = await import("./bun-sqlite-dialect-DApWON3g.mjs");
|
|
48
48
|
dialect = new BunSqliteDialect({ database: db });
|
|
49
49
|
}
|
|
50
50
|
if ("createSession" in db) {
|
|
@@ -65,7 +65,7 @@ const createKyselyAdapter = async (config) => {
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
if ("batch" in db && "exec" in db && "prepare" in db) {
|
|
68
|
-
const { D1SqliteDialect } = await import("./d1-sqlite-dialect-
|
|
68
|
+
const { D1SqliteDialect } = await import("./d1-sqlite-dialect-BLC8LXE6.mjs");
|
|
69
69
|
dialect = new D1SqliteDialect({ database: db });
|
|
70
70
|
}
|
|
71
71
|
return {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/kysely-migration-tables.ts
|
|
2
|
+
/**
|
|
3
|
+
* Kysely's internal migration table names, mirrored as local constants.
|
|
4
|
+
*
|
|
5
|
+
* Kysely 0.29 moved these from its main entry to the `kysely/migration`
|
|
6
|
+
* subpath (which 0.28 lacks), and the main entry now exports only type stubs
|
|
7
|
+
* with no runtime value, which breaks strict ESM bundlers such as Turbopack.
|
|
8
|
+
* The values are a stable part of Kysely's public migration contract, so
|
|
9
|
+
* mirroring them lets the SQLite dialects run on both Kysely 0.28 and 0.29
|
|
10
|
+
* without importing from a moving path.
|
|
11
|
+
* TODO: Revisit this mirror if Better Auth drops Kysely 0.28 support and can
|
|
12
|
+
* depend on Kysely's `kysely/migration` export.
|
|
13
|
+
*
|
|
14
|
+
* @see https://github.com/better-auth/better-auth/issues/9810
|
|
15
|
+
*/
|
|
16
|
+
const DEFAULT_MIGRATION_TABLE = "kysely_migration";
|
|
17
|
+
const DEFAULT_MIGRATION_LOCK_TABLE = "kysely_migration_lock";
|
|
18
|
+
//#endregion
|
|
19
|
+
export { DEFAULT_MIGRATION_TABLE as n, DEFAULT_MIGRATION_LOCK_TABLE as t };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as DEFAULT_MIGRATION_TABLE, t as DEFAULT_MIGRATION_LOCK_TABLE } from "./kysely-migration-tables-JkVUjPF_.mjs";
|
|
2
|
+
import { CompiledQuery, DefaultQueryCompiler, sql } from "kysely";
|
|
2
3
|
//#region src/node-sqlite-dialect.ts
|
|
3
4
|
var NodeSqliteAdapter = class {
|
|
4
5
|
get supportsCreateIfNotExists() {
|
|
@@ -7,6 +8,9 @@ var NodeSqliteAdapter = class {
|
|
|
7
8
|
get supportsTransactionalDdl() {
|
|
8
9
|
return false;
|
|
9
10
|
}
|
|
11
|
+
get supportsMultipleConnections() {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
10
14
|
get supportsReturning() {
|
|
11
15
|
return true;
|
|
12
16
|
}
|
|
@@ -93,9 +97,6 @@ var NodeSqliteIntrospector = class {
|
|
|
93
97
|
const tables = await query.execute();
|
|
94
98
|
return Promise.all(tables.map(({ name }) => this.#getTableMetadata(name)));
|
|
95
99
|
}
|
|
96
|
-
async getMetadata(options) {
|
|
97
|
-
return { tables: await this.getTables(options) };
|
|
98
|
-
}
|
|
99
100
|
async #getTableMetadata(table) {
|
|
100
101
|
const db = this.#db;
|
|
101
102
|
const autoIncrementCol = (await db.selectFrom("sqlite_master").where("name", "=", table).select("sql").$castTo().execute())[0]?.sql?.split(/[\(\),]/)?.find((it) => it.toLowerCase().includes("autoincrement"))?.split(/\s+/)?.[0]?.replace(/["`]/g, "");
|
|
@@ -113,7 +114,8 @@ var NodeSqliteIntrospector = class {
|
|
|
113
114
|
isAutoIncrementing: col.name === autoIncrementCol,
|
|
114
115
|
hasDefaultValue: col.dflt_value != null
|
|
115
116
|
})),
|
|
116
|
-
isView: false
|
|
117
|
+
isView: false,
|
|
118
|
+
isForeign: false
|
|
117
119
|
};
|
|
118
120
|
}
|
|
119
121
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-auth/kysely-adapter",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.16",
|
|
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.1",
|
|
44
44
|
"kysely": "^0.28.17 || ^0.29.0",
|
|
45
|
-
"@better-auth/core": "^1.6.
|
|
45
|
+
"@better-auth/core": "^1.6.16"
|
|
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.21.1",
|
|
57
57
|
"typescript": "^5.9.3",
|
|
58
|
-
"@better-auth/core": "1.6.
|
|
58
|
+
"@better-auth/core": "1.6.16"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
61
|
"build": "tsdown",
|