@better-auth/kysely-adapter 1.7.14 → 1.7.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/index.mjs +4 -4
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -321,18 +321,18 @@ const kyselyAdapter = (db, config) => {
|
|
|
321
321
|
field: reselectField
|
|
322
322
|
}), reselectValue === null ? "is" : "=", reselectValue).limit(1).executeTakeFirst();
|
|
323
323
|
}
|
|
324
|
-
await builder.
|
|
324
|
+
const insertId = (await builder.executeTakeFirst())?.insertId;
|
|
325
325
|
const fetchInserted = async (trx) => {
|
|
326
326
|
if (values.id) return await trx.selectFrom(model).selectAll().where(getFieldName({
|
|
327
327
|
model: modelKey,
|
|
328
328
|
field: "id"
|
|
329
329
|
}), "=", values.id).limit(1).executeTakeFirst();
|
|
330
330
|
if (options.advanced?.database?.generateId === "serial") {
|
|
331
|
-
|
|
332
|
-
|
|
331
|
+
if (insertId === void 0) throw new BetterAuthError(`[Kysely Adapter] MySQL did not report an auto-increment id for the inserted "${model}" row. With generateId: "serial" the "id" column must be AUTO_INCREMENT.`);
|
|
332
|
+
return await trx.selectFrom(model).selectAll().where(getFieldName({
|
|
333
333
|
model: modelKey,
|
|
334
334
|
field: "id"
|
|
335
|
-
}), "=",
|
|
335
|
+
}), "=", insertId <= BigInt(Number.MAX_SAFE_INTEGER) ? Number(insertId) : insertId.toString()).limit(1).executeTakeFirst();
|
|
336
336
|
}
|
|
337
337
|
const modelSchema = schema[modelKey]?.fields;
|
|
338
338
|
if (modelSchema) for (const [fieldKey, fieldAttr] of Object.entries(modelSchema)) {
|
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.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.2 || ^0.5.0",
|
|
44
44
|
"kysely": "^0.28.17 || ^0.29.0",
|
|
45
|
-
"@better-auth/core": "^1.7.
|
|
45
|
+
"@better-auth/core": "^1.7.16"
|
|
46
46
|
},
|
|
47
47
|
"peerDependenciesMeta": {
|
|
48
48
|
"kysely": {
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"pg": "^8.0.0",
|
|
58
58
|
"tsdown": "0.23.1",
|
|
59
59
|
"typescript": "^6.0.3",
|
|
60
|
-
"@better-auth/core": "1.7.
|
|
60
|
+
"@better-auth/core": "1.7.16"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
|
63
63
|
"build": "tsdown",
|