@better-auth/kysely-adapter 1.7.21 → 1.7.22
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-DN2jcl8c.mjs → bun-sqlite-dialect-C1xgdqho.mjs} +2 -3
- package/dist/{d1-sqlite-dialect-BgJMzZQp.mjs → d1-sqlite-dialect-CFQyWgtB.mjs} +2 -3
- package/dist/index.d.mts +0 -8
- package/dist/index.mjs +7 -11
- package/dist/node-sqlite-dialect.d.mts +1 -3
- package/dist/node-sqlite-dialect.mjs +2 -3
- package/dist/{sqlite-introspector-_wy6Ac6e.mjs → sqlite-introspector-DeY-XxNH.mjs} +2 -4
- package/package.json +5 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as createSqliteIntrospector } from "./sqlite-introspector-
|
|
1
|
+
import { t as createSqliteIntrospector } from "./sqlite-introspector-DeY-XxNH.mjs";
|
|
2
2
|
import { CompiledQuery, DefaultQueryCompiler } from "kysely";
|
|
3
|
-
|
|
3
|
+
// src/bun-sqlite-dialect.ts
|
|
4
4
|
var BunSqliteAdapter = class {
|
|
5
5
|
get supportsCreateIfNotExists() {
|
|
6
6
|
return true;
|
|
@@ -119,5 +119,4 @@ var BunSqliteDialect = class {
|
|
|
119
119
|
return createSqliteIntrospector(db);
|
|
120
120
|
}
|
|
121
121
|
};
|
|
122
|
-
//#endregion
|
|
123
122
|
export { BunSqliteDialect };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as DEFAULT_MIGRATION_LOCK_TABLE, i as toSqliteTableMetadata, o as DEFAULT_MIGRATION_TABLE, r as sqliteIntegerPrimaryKeyColumn } from "./sqlite-introspector-
|
|
1
|
+
import { a as DEFAULT_MIGRATION_LOCK_TABLE, i as toSqliteTableMetadata, o as DEFAULT_MIGRATION_TABLE, r as sqliteIntegerPrimaryKeyColumn } from "./sqlite-introspector-DeY-XxNH.mjs";
|
|
2
2
|
import { SqliteAdapter, SqliteQueryCompiler } from "kysely";
|
|
3
|
-
|
|
3
|
+
// src/d1-sqlite-dialect.ts
|
|
4
4
|
function quoteSqliteStringLiteral(value) {
|
|
5
5
|
return `'${value.replaceAll("'", "''")}'`;
|
|
6
6
|
}
|
|
@@ -134,5 +134,4 @@ var D1SqliteDialect = class {
|
|
|
134
134
|
return new D1SqliteIntrospector(db, this.#config.database);
|
|
135
135
|
}
|
|
136
136
|
};
|
|
137
|
-
//#endregion
|
|
138
137
|
export { D1SqliteDialect, createD1IndexIntrospector };
|
package/dist/index.d.mts
CHANGED
|
@@ -2,7 +2,6 @@ import { Kysely, TableMetadata } from "kysely";
|
|
|
2
2
|
import { DBAdapter, DBAdapterDebugLogOption } from "@better-auth/core/db/adapter";
|
|
3
3
|
import { ExpectedSchema, IntrospectedTable } from "@better-auth/core/db/internal";
|
|
4
4
|
import { BetterAuthOptions } from "@better-auth/core";
|
|
5
|
-
//#region src/types.d.ts
|
|
6
5
|
export type KyselyDatabaseType = "postgres" | "mysql" | "sqlite" | "mssql";
|
|
7
6
|
/**
|
|
8
7
|
* Metadata for a column that participates in a database index.
|
|
@@ -33,8 +32,6 @@ export interface DatabaseIndexMetadata {
|
|
|
33
32
|
* Reads normalized index metadata for the provided database tables.
|
|
34
33
|
*/
|
|
35
34
|
export type DatabaseIndexIntrospector = (tableNames: readonly string[]) => Promise<readonly DatabaseIndexMetadata[]>;
|
|
36
|
-
//#endregion
|
|
37
|
-
//#region src/dialect.d.ts
|
|
38
35
|
export declare function getKyselyDatabaseType(db: BetterAuthOptions["database"]): KyselyDatabaseType | null;
|
|
39
36
|
export declare const createKyselyAdapter: (config: BetterAuthOptions) => Promise<{
|
|
40
37
|
kysely: Kysely<any>;
|
|
@@ -49,8 +46,6 @@ export declare const createKyselyAdapter: (config: BetterAuthOptions) => Promise
|
|
|
49
46
|
schemaName: undefined;
|
|
50
47
|
transaction: boolean | undefined;
|
|
51
48
|
}>;
|
|
52
|
-
//#endregion
|
|
53
|
-
//#region src/kysely-adapter.d.ts
|
|
54
49
|
interface KyselyAdapterConfig {
|
|
55
50
|
/**
|
|
56
51
|
* Database type.
|
|
@@ -91,8 +86,6 @@ interface KyselyAdapterConfig {
|
|
|
91
86
|
transaction?: boolean | undefined;
|
|
92
87
|
}
|
|
93
88
|
export declare const kyselyAdapter: (db: Kysely<any>, config?: KyselyAdapterConfig | undefined) => (options: BetterAuthOptions) => DBAdapter<BetterAuthOptions>;
|
|
94
|
-
//#endregion
|
|
95
|
-
//#region src/schema-check.d.ts
|
|
96
89
|
/**
|
|
97
90
|
* Converts Kysely table metadata into the shape `diffSchema` compares.
|
|
98
91
|
*/
|
|
@@ -120,5 +113,4 @@ export declare function getMssqlSchema(db: Kysely<unknown>): Promise<string>;
|
|
|
120
113
|
export declare function introspectPostgresTables(db: Kysely<unknown>, schemas: readonly string[]): Promise<(TableMetadata & {
|
|
121
114
|
isForeign: boolean;
|
|
122
115
|
})[]>;
|
|
123
|
-
//#endregion
|
|
124
116
|
export {};
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { n as introspectSqliteTables } from "./sqlite-introspector-
|
|
1
|
+
import { n as introspectSqliteTables } from "./sqlite-introspector-DeY-XxNH.mjs";
|
|
2
2
|
import { BetterAuthError } from "@better-auth/core/error";
|
|
3
3
|
import { ColumnNode, Kysely, MssqlDialect, MysqlDialect, PostgresDialect, ReferenceNode, SelectQueryNode, SqliteDialect, TableNode, sql } from "kysely";
|
|
4
4
|
import { createAdapterFactory } from "@better-auth/core/db/adapter";
|
|
5
5
|
import { checksSchema, createSchemaCheck, diffSchema, getExpectedSchema, registerSchemaCheck } from "@better-auth/core/db/internal";
|
|
6
6
|
import { logger } from "@better-auth/core/env";
|
|
7
7
|
import { capitalizeFirstLetter } from "@better-auth/core/utils/string";
|
|
8
|
-
|
|
8
|
+
// src/dialect.ts
|
|
9
9
|
function getKyselyDatabaseType(db) {
|
|
10
10
|
if (!db) return null;
|
|
11
11
|
if ("dialect" in db) return getKyselyDatabaseType(db.dialect);
|
|
@@ -78,7 +78,7 @@ const createKyselyAdapter = async (config) => {
|
|
|
78
78
|
transaction = true;
|
|
79
79
|
}
|
|
80
80
|
if ("fileControl" in db) {
|
|
81
|
-
const { BunSqliteDialect } = await import("./bun-sqlite-dialect-
|
|
81
|
+
const { BunSqliteDialect } = await import("./bun-sqlite-dialect-C1xgdqho.mjs");
|
|
82
82
|
dialect = new BunSqliteDialect({ database: db });
|
|
83
83
|
transaction = true;
|
|
84
84
|
}
|
|
@@ -101,7 +101,7 @@ const createKyselyAdapter = async (config) => {
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
if ("batch" in db && "exec" in db && "prepare" in db) {
|
|
104
|
-
const { createD1IndexIntrospector, D1SqliteDialect } = await import("./d1-sqlite-dialect-
|
|
104
|
+
const { createD1IndexIntrospector, D1SqliteDialect } = await import("./d1-sqlite-dialect-CFQyWgtB.mjs");
|
|
105
105
|
dialect = new D1SqliteDialect({ database: db });
|
|
106
106
|
introspectIndexes = createD1IndexIntrospector(db);
|
|
107
107
|
transaction = false;
|
|
@@ -114,8 +114,7 @@ const createKyselyAdapter = async (config) => {
|
|
|
114
114
|
transaction
|
|
115
115
|
};
|
|
116
116
|
};
|
|
117
|
-
|
|
118
|
-
//#region src/query-builders.ts
|
|
117
|
+
// src/query-builders.ts
|
|
119
118
|
/**
|
|
120
119
|
* Case-insensitive ILIKE/LIKE for pattern matching.
|
|
121
120
|
* Uses ILIKE on PostgreSQL, LOWER()+LIKE on MySQL/SQLite/MSSQL.
|
|
@@ -161,8 +160,7 @@ function insensitiveNe(columnRef, value) {
|
|
|
161
160
|
value: value.toLowerCase()
|
|
162
161
|
};
|
|
163
162
|
}
|
|
164
|
-
|
|
165
|
-
//#region src/schema-check.ts
|
|
163
|
+
// src/schema-check.ts
|
|
166
164
|
/**
|
|
167
165
|
* Converts Kysely table metadata into the shape `diffSchema` compares.
|
|
168
166
|
*/
|
|
@@ -319,8 +317,7 @@ async function findSchemaProblems(db, dbType, expected) {
|
|
|
319
317
|
return diffSchema(physical, tables);
|
|
320
318
|
});
|
|
321
319
|
}
|
|
322
|
-
|
|
323
|
-
//#region src/kysely-adapter.ts
|
|
320
|
+
// src/kysely-adapter.ts
|
|
324
321
|
const kyselyAdapter = (db, config) => {
|
|
325
322
|
let lazyOptions = null;
|
|
326
323
|
let mysqlNoIdWarned = false;
|
|
@@ -775,5 +772,4 @@ const kyselyAdapter = (db, config) => {
|
|
|
775
772
|
return instance;
|
|
776
773
|
};
|
|
777
774
|
};
|
|
778
|
-
//#endregion
|
|
779
775
|
export { createKyselyAdapter, getKyselyDatabaseType, getMssqlSchema, getPostgresSchema, introspectPostgresTables, kyselyAdapter, toIntrospectedTables, toPhysicalSchema };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { DatabaseConnection, DatabaseIntrospector, Dialect, DialectAdapter, Driver, Kysely, QueryCompiler } from "kysely";
|
|
2
2
|
import { DatabaseSync } from "node:sqlite";
|
|
3
|
-
//#region src/node-sqlite-dialect.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Config for the SQLite dialect.
|
|
6
5
|
*/
|
|
@@ -21,5 +20,4 @@ export declare class NodeSqliteDialect implements Dialect {
|
|
|
21
20
|
createQueryCompiler(): QueryCompiler;
|
|
22
21
|
createAdapter(): DialectAdapter;
|
|
23
22
|
createIntrospector(db: Kysely<any>): DatabaseIntrospector;
|
|
24
|
-
}
|
|
25
|
-
//#endregion
|
|
23
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as createSqliteIntrospector } from "./sqlite-introspector-
|
|
1
|
+
import { t as createSqliteIntrospector } from "./sqlite-introspector-DeY-XxNH.mjs";
|
|
2
2
|
import { CompiledQuery, DefaultQueryCompiler } from "kysely";
|
|
3
|
-
|
|
3
|
+
// src/node-sqlite-dialect.ts
|
|
4
4
|
var NodeSqliteAdapter = class {
|
|
5
5
|
get supportsCreateIfNotExists() {
|
|
6
6
|
return true;
|
|
@@ -119,5 +119,4 @@ var NodeSqliteDialect = class {
|
|
|
119
119
|
return createSqliteIntrospector(db);
|
|
120
120
|
}
|
|
121
121
|
};
|
|
122
|
-
//#endregion
|
|
123
122
|
export { NodeSqliteDialect };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { sql } from "kysely";
|
|
2
|
-
|
|
2
|
+
// src/kysely-migration-tables.ts
|
|
3
3
|
/**
|
|
4
4
|
* Kysely's internal migration table names, mirrored as local constants.
|
|
5
5
|
*
|
|
@@ -14,8 +14,7 @@ import { sql } from "kysely";
|
|
|
14
14
|
*/
|
|
15
15
|
const DEFAULT_MIGRATION_TABLE = "kysely_migration";
|
|
16
16
|
const DEFAULT_MIGRATION_LOCK_TABLE = "kysely_migration_lock";
|
|
17
|
-
|
|
18
|
-
//#region src/sqlite-introspector.ts
|
|
17
|
+
// src/sqlite-introspector.ts
|
|
19
18
|
function sqliteIntegerPrimaryKeyColumn(columns) {
|
|
20
19
|
const primaryKeys = columns.filter((column) => column.pk > 0);
|
|
21
20
|
const primaryKey = primaryKeys.length === 1 ? primaryKeys[0] : void 0;
|
|
@@ -86,5 +85,4 @@ function createSqliteIntrospector(db) {
|
|
|
86
85
|
getMetadata: async (options) => ({ tables: await getTables(options) })
|
|
87
86
|
};
|
|
88
87
|
}
|
|
89
|
-
//#endregion
|
|
90
88
|
export { DEFAULT_MIGRATION_LOCK_TABLE as a, toSqliteTableMetadata as i, introspectSqliteTables as n, DEFAULT_MIGRATION_TABLE as o, sqliteIntegerPrimaryKeyColumn as r, createSqliteIntrospector as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-auth/kysely-adapter",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.22",
|
|
4
4
|
"description": "Kysely adapter for Better Auth",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
+
"@better-auth/core": "^1.7.22",
|
|
43
44
|
"@better-auth/utils": "^0.4.2 || ^0.5.0",
|
|
44
|
-
"kysely": "^0.28.17 || ^0.29.0"
|
|
45
|
-
"@better-auth/core": "^1.7.21"
|
|
45
|
+
"kysely": "^0.28.17 || ^0.29.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependenciesMeta": {
|
|
48
48
|
"kysely": {
|
|
@@ -50,14 +50,14 @@
|
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
+
"@better-auth/core": "1.7.22",
|
|
53
54
|
"@better-auth/utils": "0.5.1",
|
|
54
55
|
"@cloudflare/workers-types": "^4.20250121.0",
|
|
55
56
|
"@types/pg": "^8.20.0",
|
|
56
57
|
"kysely": "^0.28.17 || ^0.29.0",
|
|
57
58
|
"pg": "^8.0.0",
|
|
58
59
|
"tsdown": "0.23.1",
|
|
59
|
-
"typescript": "^6.0.3"
|
|
60
|
-
"@better-auth/core": "1.7.21"
|
|
60
|
+
"typescript": "^6.0.3"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
|
63
63
|
"build": "tsdown",
|