@better-auth/drizzle-adapter 1.6.18 → 1.6.20
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 +6 -4
- package/package.json +10 -6
package/dist/index.mjs
CHANGED
|
@@ -44,8 +44,8 @@ function insensitiveNe(column, value) {
|
|
|
44
44
|
* Drizzle's drivers report affected rows under different shapes: postgres-js
|
|
45
45
|
* exposes `rowCount`, mysql2 reports `affectedRows`/`rowsAffected` (sometimes as
|
|
46
46
|
* the first element of a result-header array), and better-sqlite3 uses
|
|
47
|
-
* `changes`. This normalizes those so
|
|
48
|
-
*
|
|
47
|
+
* `changes`. This normalizes those so write methods that depend on affected
|
|
48
|
+
* rows honor the adapter contract instead of leaking the raw driver result.
|
|
49
49
|
*/
|
|
50
50
|
function getAffectedRowCount(result, operation, context) {
|
|
51
51
|
let count = 0;
|
|
@@ -493,8 +493,10 @@ const drizzleAdapter = (db, config) => {
|
|
|
493
493
|
if (!target) return null;
|
|
494
494
|
const targetId = target[idField] ?? target.id;
|
|
495
495
|
if (targetId === void 0 || targetId === null || !idColumn) return null;
|
|
496
|
-
|
|
497
|
-
|
|
496
|
+
return getAffectedRowCount(await tx.delete(schemaModel).where(eq(idColumn, targetId)).execute(), "consumeOne", {
|
|
497
|
+
model,
|
|
498
|
+
where
|
|
499
|
+
}) > 0 ? target : null;
|
|
498
500
|
};
|
|
499
501
|
return inTransaction ? claimFromTransaction(db) : db.transaction(claimFromTransaction);
|
|
500
502
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-auth/drizzle-adapter",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.20",
|
|
4
|
+
"bugs": {
|
|
5
|
+
"url": "https://github.com/better-auth/better-auth/issues"
|
|
6
|
+
},
|
|
4
7
|
"description": "Drizzle adapter for Better Auth",
|
|
5
8
|
"type": "module",
|
|
6
9
|
"license": "MIT",
|
|
@@ -35,9 +38,9 @@
|
|
|
35
38
|
}
|
|
36
39
|
},
|
|
37
40
|
"peerDependencies": {
|
|
38
|
-
"@better-auth/utils": "0.4.
|
|
41
|
+
"@better-auth/utils": "0.4.2",
|
|
39
42
|
"drizzle-orm": "^0.45.2",
|
|
40
|
-
"@better-auth/core": "^1.6.
|
|
43
|
+
"@better-auth/core": "^1.6.20"
|
|
41
44
|
},
|
|
42
45
|
"peerDependenciesMeta": {
|
|
43
46
|
"drizzle-orm": {
|
|
@@ -45,11 +48,11 @@
|
|
|
45
48
|
}
|
|
46
49
|
},
|
|
47
50
|
"devDependencies": {
|
|
48
|
-
"@better-auth/utils": "0.4.
|
|
51
|
+
"@better-auth/utils": "0.4.2",
|
|
49
52
|
"drizzle-orm": "^0.45.2",
|
|
50
53
|
"tsdown": "0.21.1",
|
|
51
54
|
"typescript": "^5.9.3",
|
|
52
|
-
"@better-auth/core": "1.6.
|
|
55
|
+
"@better-auth/core": "1.6.20"
|
|
53
56
|
},
|
|
54
57
|
"scripts": {
|
|
55
58
|
"build": "tsdown",
|
|
@@ -57,6 +60,7 @@
|
|
|
57
60
|
"lint:package": "publint run --strict --pack false",
|
|
58
61
|
"lint:types": "attw --profile esm-only --pack .",
|
|
59
62
|
"typecheck": "tsc --noEmit",
|
|
60
|
-
"test": "vitest"
|
|
63
|
+
"test": "vitest",
|
|
64
|
+
"coverage": "vitest run --coverage --coverage.provider=istanbul"
|
|
61
65
|
}
|
|
62
66
|
}
|