better-auth 1.2.0-beta.1 → 1.2.0-beta.5
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/adapters/drizzle.cjs +11 -4
- package/dist/adapters/drizzle.d.cts +6 -2
- package/dist/adapters/drizzle.d.ts +6 -2
- package/dist/adapters/drizzle.js +10 -3
- package/dist/adapters/kysely.cjs +4 -4
- package/dist/adapters/kysely.d.cts +6 -2
- package/dist/adapters/kysely.d.ts +6 -2
- package/dist/adapters/kysely.js +2 -2
- package/dist/adapters/memory.cjs +3 -3
- package/dist/adapters/memory.d.cts +6 -2
- package/dist/adapters/memory.d.ts +6 -2
- package/dist/adapters/memory.js +2 -2
- package/dist/adapters/mongodb.cjs +9 -4
- package/dist/adapters/mongodb.d.cts +6 -2
- package/dist/adapters/mongodb.d.ts +6 -2
- package/dist/adapters/mongodb.js +7 -2
- package/dist/adapters/prisma.cjs +17 -4
- package/dist/adapters/prisma.d.cts +6 -2
- package/dist/adapters/prisma.d.ts +6 -2
- package/dist/adapters/prisma.js +15 -2
- package/dist/adapters/test.cjs +1 -1
- package/dist/adapters/test.d.cts +2 -2
- package/dist/adapters/test.d.ts +2 -2
- package/dist/adapters/test.js +1 -1
- package/dist/api.cjs +47 -43
- package/dist/api.d.cts +2 -2
- package/dist/api.d.ts +2 -2
- package/dist/api.js +4 -4
- package/dist/{auth-DcMc3BIq.d.ts → auth-BIKkqX3w.d.ts} +130 -35
- package/dist/{auth-D4rdpxtI.d.cts → auth-DYJ8ix3G.d.cts} +130 -35
- package/dist/{chunk-5E75URIA.cjs → chunk-2Z6CVQHH.cjs} +0 -4
- package/dist/{chunk-E6LJZ5ME.js → chunk-3BXU3Z5H.js} +1 -1
- package/dist/{chunk-JNZYTS3B.js → chunk-5LTLUS6A.js} +1 -1
- package/dist/{chunk-BAPXDO3E.cjs → chunk-5RIBF22K.cjs} +109 -12
- package/dist/{chunk-764RYNTE.cjs → chunk-6FRITF4C.cjs} +4 -4
- package/dist/{chunk-2LQ7T2GE.js → chunk-6QI5735F.js} +1 -1
- package/dist/{chunk-UHGAA4GH.cjs → chunk-7H42DKFN.cjs} +5 -5
- package/dist/{chunk-5KMF6HGF.js → chunk-7P2P7Y35.js} +70 -49
- package/dist/{chunk-RGG6OEA3.js → chunk-7S7YLBK4.js} +1 -1
- package/dist/{chunk-3BWJXTLC.cjs → chunk-C37NPGBI.cjs} +46 -52
- package/dist/{chunk-QFYRLTM5.cjs → chunk-C5LREWPU.cjs} +24 -33
- package/dist/{chunk-MGJLVQOV.js → chunk-CLHJAEU2.js} +34 -0
- package/dist/{chunk-WDOY7YUW.cjs → chunk-CV5JTF37.cjs} +34 -0
- package/dist/{chunk-5RY45WFV.js → chunk-CYI7H6T2.js} +1 -7
- package/dist/{chunk-JLATHUM5.cjs → chunk-DSB4P3WF.cjs} +5 -5
- package/dist/{chunk-ADGXBH3Y.js → chunk-E3CHTKRP.js} +1 -10
- package/dist/{chunk-UP6VJQDB.js → chunk-G365UCY7.js} +1 -1
- package/dist/{chunk-S6MI7ZLE.js → chunk-G6W6UQWJ.js} +2 -2
- package/dist/{chunk-WLXFBYQ6.cjs → chunk-H4A3GCFC.cjs} +19 -5
- package/dist/{chunk-VPCROEJW.cjs → chunk-HCHSHY7R.cjs} +120 -102
- package/dist/{chunk-PJ4KWXLQ.cjs → chunk-HQFWDJO3.cjs} +5 -5
- package/dist/{chunk-5XAVWKUN.js → chunk-IBIVHEIM.js} +15 -1
- package/dist/{chunk-NU4SXYJ5.cjs → chunk-JDAHD767.cjs} +198 -42
- package/dist/{chunk-LZ5DEQVH.cjs → chunk-K46S33M5.cjs} +3 -3
- package/dist/{chunk-OSBTXYDD.cjs → chunk-LHWLPZ6K.cjs} +16 -13
- package/dist/{chunk-YW3B2ST3.js → chunk-MHZNWING.js} +7 -4
- package/dist/{chunk-G7HOSQ5N.cjs → chunk-OLGASOBP.cjs} +11 -11
- package/dist/{chunk-YRUDZRY3.cjs → chunk-QBBUTLKA.cjs} +73 -52
- package/dist/{chunk-CVDYU5OC.js → chunk-QG2HKEKG.js} +1 -1
- package/dist/{chunk-GTQM7JU7.js → chunk-R42K7GPF.js} +3 -1
- package/dist/{chunk-3EY3LSQR.js → chunk-R62AOMGV.js} +21 -9
- package/dist/{chunk-FA6UYV37.js → chunk-SOFKSYNA.js} +1 -1
- package/dist/{chunk-V6RGXSG4.cjs → chunk-SVC7H7K4.cjs} +3 -1
- package/dist/{chunk-VXDYNCOX.js → chunk-TODG5RSV.js} +172 -19
- package/dist/{chunk-WVLPJXQR.cjs → chunk-TV24P5IW.cjs} +44 -30
- package/dist/{chunk-WGCTQNSQ.js → chunk-VG5Y5QXC.js} +1 -1
- package/dist/{chunk-FXNG3YQA.js → chunk-VLA6IUW4.js} +96 -78
- package/dist/{chunk-GTM45OYP.cjs → chunk-WKBV4PRW.cjs} +3 -3
- package/dist/{chunk-PIWBUHRB.cjs → chunk-WKXM7XUV.cjs} +26 -13
- package/dist/{chunk-6O2GLU2U.cjs → chunk-XWK7ZOPU.cjs} +8 -8
- package/dist/{chunk-BKFMDM3P.js → chunk-XXGFGD3E.js} +100 -3
- package/dist/{chunk-5OBRFII2.js → chunk-YTMPZIP7.js} +17 -3
- package/dist/{chunk-EM73ZZSP.cjs → chunk-YZFX73MG.cjs} +20 -20
- package/dist/{chunk-NPO64SVN.js → chunk-ZFUBVSZD.js} +0 -4
- package/dist/client/plugins.d.cts +3 -3
- package/dist/client/plugins.d.ts +3 -3
- package/dist/client.d.cts +6 -7
- package/dist/client.d.ts +6 -7
- package/dist/cookies.d.cts +2 -2
- package/dist/cookies.d.ts +2 -2
- package/dist/db.cjs +13 -13
- package/dist/db.d.cts +3 -3
- package/dist/db.d.ts +3 -3
- package/dist/db.js +2 -2
- package/dist/{index-CvlKSqnF.d.cts → index-BL6paKGE.d.cts} +91 -9
- package/dist/{index-Ba5bMY6A.d.cts → index-BuRgaJZR.d.cts} +194 -2
- package/dist/{index-Ivs2EsUL.d.ts → index-DOB91DVD.d.ts} +91 -9
- package/dist/{index-XrJz4AYF.d.ts → index-moQjyfmm.d.ts} +194 -2
- package/dist/index.cjs +15 -15
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +5 -5
- package/dist/next-js.cjs +23 -23
- package/dist/next-js.d.cts +2 -2
- package/dist/next-js.d.ts +2 -2
- package/dist/next-js.js +22 -22
- package/dist/node.d.cts +2 -2
- package/dist/node.d.ts +2 -2
- package/dist/oauth2.cjs +9 -9
- package/dist/oauth2.d.cts +6 -5
- package/dist/oauth2.d.ts +6 -5
- package/dist/oauth2.js +2 -2
- package/dist/plugins/admin.cjs +6 -6
- package/dist/plugins/admin.d.cts +23 -2
- package/dist/plugins/admin.d.ts +23 -2
- package/dist/plugins/admin.js +5 -5
- package/dist/plugins/anonymous.cjs +6 -6
- package/dist/plugins/anonymous.d.cts +2 -2
- package/dist/plugins/anonymous.d.ts +2 -2
- package/dist/plugins/anonymous.js +5 -5
- package/dist/plugins/bearer.cjs +6 -6
- package/dist/plugins/bearer.d.cts +2 -2
- package/dist/plugins/bearer.d.ts +2 -2
- package/dist/plugins/bearer.js +5 -5
- package/dist/{plugin → plugins}/custom-session.cjs +6 -6
- package/dist/{plugin → plugins}/custom-session.d.cts +2 -2
- package/dist/{plugin → plugins}/custom-session.d.ts +2 -2
- package/dist/{plugin → plugins}/custom-session.js +5 -5
- package/dist/plugins/email-otp.cjs +6 -6
- package/dist/plugins/email-otp.d.cts +2 -2
- package/dist/plugins/email-otp.d.ts +2 -2
- package/dist/plugins/email-otp.js +5 -5
- package/dist/plugins/generic-oauth.cjs +6 -6
- package/dist/plugins/generic-oauth.d.cts +6 -2
- package/dist/plugins/generic-oauth.d.ts +6 -2
- package/dist/plugins/generic-oauth.js +5 -5
- package/dist/plugins/jwt.cjs +6 -6
- package/dist/plugins/jwt.d.cts +16 -2
- package/dist/plugins/jwt.d.ts +16 -2
- package/dist/plugins/jwt.js +5 -5
- package/dist/plugins/magic-link.cjs +6 -6
- package/dist/plugins/magic-link.js +5 -5
- package/dist/plugins/multi-session.cjs +6 -6
- package/dist/plugins/multi-session.d.cts +2 -2
- package/dist/plugins/multi-session.d.ts +2 -2
- package/dist/plugins/multi-session.js +5 -5
- package/dist/plugins/oidc-provider.cjs +6 -6
- package/dist/plugins/oidc-provider.js +5 -5
- package/dist/plugins/one-tap.cjs +6 -6
- package/dist/plugins/one-tap.js +5 -5
- package/dist/plugins/open-api.cjs +7 -7
- package/dist/plugins/open-api.d.cts +2 -2
- package/dist/plugins/open-api.d.ts +2 -2
- package/dist/plugins/open-api.js +6 -6
- package/dist/plugins/organization.cjs +6 -6
- package/dist/plugins/organization.d.cts +3 -3
- package/dist/plugins/organization.d.ts +3 -3
- package/dist/plugins/organization.js +5 -5
- package/dist/plugins/passkey.cjs +17 -17
- package/dist/plugins/passkey.d.cts +2 -2
- package/dist/plugins/passkey.d.ts +2 -2
- package/dist/plugins/passkey.js +4 -4
- package/dist/plugins/phone-number.cjs +6 -6
- package/dist/plugins/phone-number.d.cts +95 -2
- package/dist/plugins/phone-number.d.ts +95 -2
- package/dist/plugins/phone-number.js +5 -5
- package/dist/plugins/sso.cjs +26 -18
- package/dist/plugins/sso.d.cts +6 -2
- package/dist/plugins/sso.d.ts +6 -2
- package/dist/plugins/sso.js +13 -5
- package/dist/plugins/two-factor.cjs +6 -6
- package/dist/plugins/two-factor.d.cts +2 -2
- package/dist/plugins/two-factor.d.ts +2 -2
- package/dist/plugins/two-factor.js +5 -5
- package/dist/plugins/username.cjs +6 -6
- package/dist/plugins/username.d.cts +11 -3
- package/dist/plugins/username.d.ts +11 -3
- package/dist/plugins/username.js +5 -5
- package/dist/plugins.cjs +42 -42
- package/dist/plugins.d.cts +5 -5
- package/dist/plugins.d.ts +5 -5
- package/dist/plugins.js +22 -22
- package/dist/react.d.cts +7 -8
- package/dist/react.d.ts +7 -8
- package/dist/social.cjs +32 -20
- package/dist/social.d.cts +1 -1
- package/dist/social.d.ts +1 -1
- package/dist/social.js +3 -3
- package/dist/solid.d.cts +7 -7
- package/dist/solid.d.ts +7 -7
- package/dist/{state-DcraY2_H.d.cts → state-CEqdZ_y_.d.cts} +1 -1
- package/dist/{state-Cm8el5M1.d.ts → state-DXzHe8jb.d.ts} +1 -1
- package/dist/svelte-kit.d.cts +2 -2
- package/dist/svelte-kit.d.ts +2 -2
- package/dist/svelte.d.cts +7 -7
- package/dist/svelte.d.ts +7 -7
- package/dist/types.d.cts +3 -3
- package/dist/types.d.ts +3 -3
- package/dist/vue.d.cts +7 -7
- package/dist/vue.d.ts +7 -7
- package/package.json +3 -3
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkCV5JTF37_cjs = require('../chunk-CV5JTF37.cjs');
|
|
4
4
|
require('../chunk-B5UCLTPZ.cjs');
|
|
5
5
|
var chunkH74YRRNV_cjs = require('../chunk-H74YRRNV.cjs');
|
|
6
|
-
require('../chunk-
|
|
6
|
+
require('../chunk-2Z6CVQHH.cjs');
|
|
7
7
|
require('../chunk-NIMYOIVU.cjs');
|
|
8
8
|
require('../chunk-CCKQSGIR.cjs');
|
|
9
9
|
require('../chunk-G2LZ73E2.cjs');
|
|
@@ -14,7 +14,7 @@ var chunkPEZRSDZS_cjs = require('../chunk-PEZRSDZS.cjs');
|
|
|
14
14
|
var drizzleOrm = require('drizzle-orm');
|
|
15
15
|
|
|
16
16
|
var createTransform = (db, config, options) => {
|
|
17
|
-
const schema =
|
|
17
|
+
const schema = chunkCV5JTF37_cjs.getAuthTables(options);
|
|
18
18
|
function getField(model, field) {
|
|
19
19
|
if (field === "id") {
|
|
20
20
|
return field;
|
|
@@ -116,7 +116,7 @@ var createTransform = (db, config, options) => {
|
|
|
116
116
|
if (value === void 0 && !fields[field].defaultValue) {
|
|
117
117
|
continue;
|
|
118
118
|
}
|
|
119
|
-
transformedData[fields[field].fieldName || field] =
|
|
119
|
+
transformedData[fields[field].fieldName || field] = chunkCV5JTF37_cjs.withApplyDefault(
|
|
120
120
|
value,
|
|
121
121
|
fields[field],
|
|
122
122
|
action
|
|
@@ -222,6 +222,13 @@ var drizzleAdapter = (db, config) => (options) => {
|
|
|
222
222
|
const res = await builder.where(...clause);
|
|
223
223
|
return res.map((r) => transformOutput(r, model));
|
|
224
224
|
},
|
|
225
|
+
async count(data) {
|
|
226
|
+
const { model, where } = data;
|
|
227
|
+
const schemaModel = getSchema(model);
|
|
228
|
+
const clause = where ? convertWhereClause(where, model) : [];
|
|
229
|
+
const res = await db.select({ count: drizzleOrm.count() }).from(schemaModel).where(...clause);
|
|
230
|
+
return res.count;
|
|
231
|
+
},
|
|
225
232
|
async update(data) {
|
|
226
233
|
const { model, where, update: values } = data;
|
|
227
234
|
const schemaModel = getSchema(model);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { B as BetterAuthOptions, W as Where } from '../auth-
|
|
1
|
+
import { B as BetterAuthOptions, W as Where } from '../auth-DYJ8ix3G.cjs';
|
|
2
2
|
import 'zod';
|
|
3
3
|
import 'kysely';
|
|
4
4
|
import 'better-call';
|
|
5
5
|
import '../helper-Bi8FQwDD.cjs';
|
|
6
|
-
import '../index-
|
|
6
|
+
import '../index-BuRgaJZR.cjs';
|
|
7
7
|
import 'jose';
|
|
8
8
|
import 'better-sqlite3';
|
|
9
9
|
|
|
@@ -48,6 +48,10 @@ declare const drizzleAdapter: (db: DB, config: DrizzleAdapterConfig) => (options
|
|
|
48
48
|
};
|
|
49
49
|
offset?: number;
|
|
50
50
|
}): Promise<any[]>;
|
|
51
|
+
count(data: {
|
|
52
|
+
model: string;
|
|
53
|
+
where?: Where[];
|
|
54
|
+
}): Promise<any>;
|
|
51
55
|
update<T>(data: {
|
|
52
56
|
model: string;
|
|
53
57
|
where: Where[];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { B as BetterAuthOptions, W as Where } from '../auth-
|
|
1
|
+
import { B as BetterAuthOptions, W as Where } from '../auth-BIKkqX3w.js';
|
|
2
2
|
import 'zod';
|
|
3
3
|
import 'kysely';
|
|
4
4
|
import 'better-call';
|
|
5
5
|
import '../helper-Bi8FQwDD.js';
|
|
6
|
-
import '../index-
|
|
6
|
+
import '../index-moQjyfmm.js';
|
|
7
7
|
import 'jose';
|
|
8
8
|
import 'better-sqlite3';
|
|
9
9
|
|
|
@@ -48,6 +48,10 @@ declare const drizzleAdapter: (db: DB, config: DrizzleAdapterConfig) => (options
|
|
|
48
48
|
};
|
|
49
49
|
offset?: number;
|
|
50
50
|
}): Promise<any[]>;
|
|
51
|
+
count(data: {
|
|
52
|
+
model: string;
|
|
53
|
+
where?: Where[];
|
|
54
|
+
}): Promise<any>;
|
|
51
55
|
update<T>(data: {
|
|
52
56
|
model: string;
|
|
53
57
|
where: Where[];
|
package/dist/adapters/drizzle.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { getAuthTables, withApplyDefault } from '../chunk-
|
|
1
|
+
import { getAuthTables, withApplyDefault } from '../chunk-CLHJAEU2.js';
|
|
2
2
|
import '../chunk-HZBNUY7E.js';
|
|
3
3
|
import { generateId } from '../chunk-KLDFBLYL.js';
|
|
4
|
-
import '../chunk-
|
|
4
|
+
import '../chunk-ZFUBVSZD.js';
|
|
5
5
|
import '../chunk-SK6Y2YH6.js';
|
|
6
6
|
import '../chunk-3XTQSPPA.js';
|
|
7
7
|
import '../chunk-DBPOZRMS.js';
|
|
@@ -9,7 +9,7 @@ import '../chunk-53IPO2PJ.js';
|
|
|
9
9
|
import '../chunk-FURNA6HY.js';
|
|
10
10
|
import '../chunk-TQQSPPNA.js';
|
|
11
11
|
import { BetterAuthError } from '../chunk-UNWCXKMP.js';
|
|
12
|
-
import { desc, asc, eq, inArray, like, and, or } from 'drizzle-orm';
|
|
12
|
+
import { desc, asc, count, eq, inArray, like, and, or } from 'drizzle-orm';
|
|
13
13
|
|
|
14
14
|
var createTransform = (db, config, options) => {
|
|
15
15
|
const schema = getAuthTables(options);
|
|
@@ -220,6 +220,13 @@ var drizzleAdapter = (db, config) => (options) => {
|
|
|
220
220
|
const res = await builder.where(...clause);
|
|
221
221
|
return res.map((r) => transformOutput(r, model));
|
|
222
222
|
},
|
|
223
|
+
async count(data) {
|
|
224
|
+
const { model, where } = data;
|
|
225
|
+
const schemaModel = getSchema(model);
|
|
226
|
+
const clause = where ? convertWhereClause(where, model) : [];
|
|
227
|
+
const res = await db.select({ count: count() }).from(schemaModel).where(...clause);
|
|
228
|
+
return res.count;
|
|
229
|
+
},
|
|
223
230
|
async update(data) {
|
|
224
231
|
const { model, where, update: values } = data;
|
|
225
232
|
const schemaModel = getSchema(model);
|
package/dist/adapters/kysely.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkCV5JTF37_cjs = require('../chunk-CV5JTF37.cjs');
|
|
4
4
|
require('../chunk-B5UCLTPZ.cjs');
|
|
5
5
|
require('../chunk-H74YRRNV.cjs');
|
|
6
|
-
require('../chunk-
|
|
6
|
+
require('../chunk-2Z6CVQHH.cjs');
|
|
7
7
|
require('../chunk-NIMYOIVU.cjs');
|
|
8
8
|
require('../chunk-CCKQSGIR.cjs');
|
|
9
9
|
require('../chunk-G2LZ73E2.cjs');
|
|
@@ -16,9 +16,9 @@ require('../chunk-PEZRSDZS.cjs');
|
|
|
16
16
|
|
|
17
17
|
Object.defineProperty(exports, "createKyselyAdapter", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: function () { return
|
|
19
|
+
get: function () { return chunkCV5JTF37_cjs.createKyselyAdapter; }
|
|
20
20
|
});
|
|
21
21
|
Object.defineProperty(exports, "kyselyAdapter", {
|
|
22
22
|
enumerable: true,
|
|
23
|
-
get: function () { return
|
|
23
|
+
get: function () { return chunkCV5JTF37_cjs.kyselyAdapter; }
|
|
24
24
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Kysely } from 'kysely';
|
|
2
|
-
import { B as BetterAuthOptions, K as KyselyDatabaseType, W as Where } from '../auth-
|
|
2
|
+
import { B as BetterAuthOptions, K as KyselyDatabaseType, W as Where } from '../auth-DYJ8ix3G.cjs';
|
|
3
3
|
import 'zod';
|
|
4
4
|
import 'better-call';
|
|
5
5
|
import '../helper-Bi8FQwDD.cjs';
|
|
6
|
-
import '../index-
|
|
6
|
+
import '../index-BuRgaJZR.cjs';
|
|
7
7
|
import 'jose';
|
|
8
8
|
import 'better-sqlite3';
|
|
9
9
|
|
|
@@ -50,6 +50,10 @@ declare const kyselyAdapter: (db: Kysely<any>, config?: KyselyAdapterConfig) =>
|
|
|
50
50
|
where: Where[];
|
|
51
51
|
update: Record<string, any>;
|
|
52
52
|
}): Promise<number>;
|
|
53
|
+
count(data: {
|
|
54
|
+
model: string;
|
|
55
|
+
where?: Where[];
|
|
56
|
+
}): Promise<number>;
|
|
53
57
|
delete<T>(data: {
|
|
54
58
|
model: string;
|
|
55
59
|
where: Where[];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Kysely } from 'kysely';
|
|
2
|
-
import { B as BetterAuthOptions, K as KyselyDatabaseType, W as Where } from '../auth-
|
|
2
|
+
import { B as BetterAuthOptions, K as KyselyDatabaseType, W as Where } from '../auth-BIKkqX3w.js';
|
|
3
3
|
import 'zod';
|
|
4
4
|
import 'better-call';
|
|
5
5
|
import '../helper-Bi8FQwDD.js';
|
|
6
|
-
import '../index-
|
|
6
|
+
import '../index-moQjyfmm.js';
|
|
7
7
|
import 'jose';
|
|
8
8
|
import 'better-sqlite3';
|
|
9
9
|
|
|
@@ -50,6 +50,10 @@ declare const kyselyAdapter: (db: Kysely<any>, config?: KyselyAdapterConfig) =>
|
|
|
50
50
|
where: Where[];
|
|
51
51
|
update: Record<string, any>;
|
|
52
52
|
}): Promise<number>;
|
|
53
|
+
count(data: {
|
|
54
|
+
model: string;
|
|
55
|
+
where?: Where[];
|
|
56
|
+
}): Promise<number>;
|
|
53
57
|
delete<T>(data: {
|
|
54
58
|
model: string;
|
|
55
59
|
where: Where[];
|
package/dist/adapters/kysely.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { createKyselyAdapter, kyselyAdapter } from '../chunk-
|
|
1
|
+
export { createKyselyAdapter, kyselyAdapter } from '../chunk-CLHJAEU2.js';
|
|
2
2
|
import '../chunk-HZBNUY7E.js';
|
|
3
3
|
import '../chunk-KLDFBLYL.js';
|
|
4
|
-
import '../chunk-
|
|
4
|
+
import '../chunk-ZFUBVSZD.js';
|
|
5
5
|
import '../chunk-SK6Y2YH6.js';
|
|
6
6
|
import '../chunk-3XTQSPPA.js';
|
|
7
7
|
import '../chunk-DBPOZRMS.js';
|
package/dist/adapters/memory.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkCV5JTF37_cjs = require('../chunk-CV5JTF37.cjs');
|
|
4
4
|
require('../chunk-B5UCLTPZ.cjs');
|
|
5
5
|
require('../chunk-H74YRRNV.cjs');
|
|
6
|
-
require('../chunk-
|
|
6
|
+
require('../chunk-2Z6CVQHH.cjs');
|
|
7
7
|
require('../chunk-NIMYOIVU.cjs');
|
|
8
8
|
require('../chunk-CCKQSGIR.cjs');
|
|
9
9
|
require('../chunk-G2LZ73E2.cjs');
|
|
@@ -16,5 +16,5 @@ require('../chunk-PEZRSDZS.cjs');
|
|
|
16
16
|
|
|
17
17
|
Object.defineProperty(exports, "memoryAdapter", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: function () { return
|
|
19
|
+
get: function () { return chunkCV5JTF37_cjs.memoryAdapter; }
|
|
20
20
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { B as BetterAuthOptions, W as Where } from '../auth-
|
|
1
|
+
import { B as BetterAuthOptions, W as Where } from '../auth-DYJ8ix3G.cjs';
|
|
2
2
|
import 'zod';
|
|
3
3
|
import 'kysely';
|
|
4
4
|
import 'better-call';
|
|
5
5
|
import '../helper-Bi8FQwDD.cjs';
|
|
6
|
-
import '../index-
|
|
6
|
+
import '../index-BuRgaJZR.cjs';
|
|
7
7
|
import 'jose';
|
|
8
8
|
import 'better-sqlite3';
|
|
9
9
|
|
|
@@ -32,6 +32,10 @@ declare const memoryAdapter: (db: MemoryDB) => (options: BetterAuthOptions) => {
|
|
|
32
32
|
};
|
|
33
33
|
offset?: number;
|
|
34
34
|
}) => Promise<any[]>;
|
|
35
|
+
count: ({ model }: {
|
|
36
|
+
model: string;
|
|
37
|
+
where?: Where[];
|
|
38
|
+
}) => Promise<number>;
|
|
35
39
|
update: <T>({ model, where, update }: {
|
|
36
40
|
model: string;
|
|
37
41
|
where: Where[];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { B as BetterAuthOptions, W as Where } from '../auth-
|
|
1
|
+
import { B as BetterAuthOptions, W as Where } from '../auth-BIKkqX3w.js';
|
|
2
2
|
import 'zod';
|
|
3
3
|
import 'kysely';
|
|
4
4
|
import 'better-call';
|
|
5
5
|
import '../helper-Bi8FQwDD.js';
|
|
6
|
-
import '../index-
|
|
6
|
+
import '../index-moQjyfmm.js';
|
|
7
7
|
import 'jose';
|
|
8
8
|
import 'better-sqlite3';
|
|
9
9
|
|
|
@@ -32,6 +32,10 @@ declare const memoryAdapter: (db: MemoryDB) => (options: BetterAuthOptions) => {
|
|
|
32
32
|
};
|
|
33
33
|
offset?: number;
|
|
34
34
|
}) => Promise<any[]>;
|
|
35
|
+
count: ({ model }: {
|
|
36
|
+
model: string;
|
|
37
|
+
where?: Where[];
|
|
38
|
+
}) => Promise<number>;
|
|
35
39
|
update: <T>({ model, where, update }: {
|
|
36
40
|
model: string;
|
|
37
41
|
where: Where[];
|
package/dist/adapters/memory.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { memoryAdapter } from '../chunk-
|
|
1
|
+
export { memoryAdapter } from '../chunk-CLHJAEU2.js';
|
|
2
2
|
import '../chunk-HZBNUY7E.js';
|
|
3
3
|
import '../chunk-KLDFBLYL.js';
|
|
4
|
-
import '../chunk-
|
|
4
|
+
import '../chunk-ZFUBVSZD.js';
|
|
5
5
|
import '../chunk-SK6Y2YH6.js';
|
|
6
6
|
import '../chunk-3XTQSPPA.js';
|
|
7
7
|
import '../chunk-DBPOZRMS.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkCV5JTF37_cjs = require('../chunk-CV5JTF37.cjs');
|
|
4
4
|
require('../chunk-B5UCLTPZ.cjs');
|
|
5
5
|
require('../chunk-H74YRRNV.cjs');
|
|
6
|
-
require('../chunk-
|
|
6
|
+
require('../chunk-2Z6CVQHH.cjs');
|
|
7
7
|
require('../chunk-NIMYOIVU.cjs');
|
|
8
8
|
require('../chunk-CCKQSGIR.cjs');
|
|
9
9
|
require('../chunk-G2LZ73E2.cjs');
|
|
@@ -14,7 +14,7 @@ require('../chunk-PEZRSDZS.cjs');
|
|
|
14
14
|
var mongodb = require('mongodb');
|
|
15
15
|
|
|
16
16
|
var createTransform = (options) => {
|
|
17
|
-
const schema =
|
|
17
|
+
const schema = chunkCV5JTF37_cjs.getAuthTables(options);
|
|
18
18
|
function serializeID(field, value, model) {
|
|
19
19
|
if (field === "id" || field === "_id" || schema[model].fields[field].references?.field === "id") {
|
|
20
20
|
if (typeof value !== "string") {
|
|
@@ -81,7 +81,7 @@ var createTransform = (options) => {
|
|
|
81
81
|
if (value === void 0 && (!fields[field].defaultValue || action === "update")) {
|
|
82
82
|
continue;
|
|
83
83
|
}
|
|
84
|
-
transformedData[fields[field].fieldName || field] =
|
|
84
|
+
transformedData[fields[field].fieldName || field] = chunkCV5JTF37_cjs.withApplyDefault(
|
|
85
85
|
serializeID(field, value, model),
|
|
86
86
|
fields[field],
|
|
87
87
|
action
|
|
@@ -215,6 +215,11 @@ var mongodbAdapter = (db) => (options) => {
|
|
|
215
215
|
const res = await cursor.toArray();
|
|
216
216
|
return res.map((r) => transform.transformOutput(r, model));
|
|
217
217
|
},
|
|
218
|
+
async count(data) {
|
|
219
|
+
const { model } = data;
|
|
220
|
+
const res = await db.collection(transform.getModelName(model)).countDocuments();
|
|
221
|
+
return res;
|
|
222
|
+
},
|
|
218
223
|
async update(data) {
|
|
219
224
|
const { model, where, update: values } = data;
|
|
220
225
|
const clause = transform.convertWhereClause(where, model);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Db } from 'mongodb';
|
|
2
|
-
import { B as BetterAuthOptions, W as Where } from '../auth-
|
|
2
|
+
import { B as BetterAuthOptions, W as Where } from '../auth-DYJ8ix3G.cjs';
|
|
3
3
|
import 'zod';
|
|
4
4
|
import 'kysely';
|
|
5
5
|
import 'better-call';
|
|
6
6
|
import '../helper-Bi8FQwDD.cjs';
|
|
7
|
-
import '../index-
|
|
7
|
+
import '../index-BuRgaJZR.cjs';
|
|
8
8
|
import 'jose';
|
|
9
9
|
import 'better-sqlite3';
|
|
10
10
|
|
|
@@ -30,6 +30,10 @@ declare const mongodbAdapter: (db: Db) => (options: BetterAuthOptions) => {
|
|
|
30
30
|
};
|
|
31
31
|
offset?: number;
|
|
32
32
|
}): Promise<any[]>;
|
|
33
|
+
count(data: {
|
|
34
|
+
model: string;
|
|
35
|
+
where?: Where[];
|
|
36
|
+
}): Promise<number>;
|
|
33
37
|
update<T>(data: {
|
|
34
38
|
model: string;
|
|
35
39
|
where: Where[];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Db } from 'mongodb';
|
|
2
|
-
import { B as BetterAuthOptions, W as Where } from '../auth-
|
|
2
|
+
import { B as BetterAuthOptions, W as Where } from '../auth-BIKkqX3w.js';
|
|
3
3
|
import 'zod';
|
|
4
4
|
import 'kysely';
|
|
5
5
|
import 'better-call';
|
|
6
6
|
import '../helper-Bi8FQwDD.js';
|
|
7
|
-
import '../index-
|
|
7
|
+
import '../index-moQjyfmm.js';
|
|
8
8
|
import 'jose';
|
|
9
9
|
import 'better-sqlite3';
|
|
10
10
|
|
|
@@ -30,6 +30,10 @@ declare const mongodbAdapter: (db: Db) => (options: BetterAuthOptions) => {
|
|
|
30
30
|
};
|
|
31
31
|
offset?: number;
|
|
32
32
|
}): Promise<any[]>;
|
|
33
|
+
count(data: {
|
|
34
|
+
model: string;
|
|
35
|
+
where?: Where[];
|
|
36
|
+
}): Promise<number>;
|
|
33
37
|
update<T>(data: {
|
|
34
38
|
model: string;
|
|
35
39
|
where: Where[];
|
package/dist/adapters/mongodb.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { getAuthTables, withApplyDefault } from '../chunk-
|
|
1
|
+
import { getAuthTables, withApplyDefault } from '../chunk-CLHJAEU2.js';
|
|
2
2
|
import '../chunk-HZBNUY7E.js';
|
|
3
3
|
import '../chunk-KLDFBLYL.js';
|
|
4
|
-
import '../chunk-
|
|
4
|
+
import '../chunk-ZFUBVSZD.js';
|
|
5
5
|
import '../chunk-SK6Y2YH6.js';
|
|
6
6
|
import '../chunk-3XTQSPPA.js';
|
|
7
7
|
import '../chunk-DBPOZRMS.js';
|
|
@@ -213,6 +213,11 @@ var mongodbAdapter = (db) => (options) => {
|
|
|
213
213
|
const res = await cursor.toArray();
|
|
214
214
|
return res.map((r) => transform.transformOutput(r, model));
|
|
215
215
|
},
|
|
216
|
+
async count(data) {
|
|
217
|
+
const { model } = data;
|
|
218
|
+
const res = await db.collection(transform.getModelName(model)).countDocuments();
|
|
219
|
+
return res;
|
|
220
|
+
},
|
|
216
221
|
async update(data) {
|
|
217
222
|
const { model, where, update: values } = data;
|
|
218
223
|
const clause = transform.convertWhereClause(where, model);
|
package/dist/adapters/prisma.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkCV5JTF37_cjs = require('../chunk-CV5JTF37.cjs');
|
|
4
4
|
require('../chunk-B5UCLTPZ.cjs');
|
|
5
5
|
var chunkH74YRRNV_cjs = require('../chunk-H74YRRNV.cjs');
|
|
6
|
-
require('../chunk-
|
|
6
|
+
require('../chunk-2Z6CVQHH.cjs');
|
|
7
7
|
require('../chunk-NIMYOIVU.cjs');
|
|
8
8
|
require('../chunk-CCKQSGIR.cjs');
|
|
9
9
|
require('../chunk-G2LZ73E2.cjs');
|
|
@@ -14,7 +14,7 @@ var chunkPEZRSDZS_cjs = require('../chunk-PEZRSDZS.cjs');
|
|
|
14
14
|
|
|
15
15
|
// src/adapters/prisma-adapter/prisma-adapter.ts
|
|
16
16
|
var createTransform = (config, options) => {
|
|
17
|
-
const schema =
|
|
17
|
+
const schema = chunkCV5JTF37_cjs.getAuthTables(options);
|
|
18
18
|
function getField(model, field) {
|
|
19
19
|
if (field === "id") {
|
|
20
20
|
return field;
|
|
@@ -49,7 +49,7 @@ var createTransform = (config, options) => {
|
|
|
49
49
|
if (value === void 0 && (!fields[field].defaultValue || action === "update")) {
|
|
50
50
|
continue;
|
|
51
51
|
}
|
|
52
|
-
transformedData[fields[field].fieldName || field] =
|
|
52
|
+
transformedData[fields[field].fieldName || field] = chunkCV5JTF37_cjs.withApplyDefault(
|
|
53
53
|
value,
|
|
54
54
|
fields[field],
|
|
55
55
|
action
|
|
@@ -181,6 +181,19 @@ var prismaAdapter = (prisma, config) => (options) => {
|
|
|
181
181
|
});
|
|
182
182
|
return result.map((r) => transformOutput(r, model));
|
|
183
183
|
},
|
|
184
|
+
async count(data) {
|
|
185
|
+
const { model, where } = data;
|
|
186
|
+
const whereClause = convertWhereClause(model, where);
|
|
187
|
+
if (!db[getModelName(model)]) {
|
|
188
|
+
throw new chunkPEZRSDZS_cjs.BetterAuthError(
|
|
189
|
+
`Model ${model} does not exist in the database. If you haven't generated the Prisma client, you need to run 'npx prisma generate'`
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
const result = await db[getModelName(model)].count({
|
|
193
|
+
where: whereClause
|
|
194
|
+
});
|
|
195
|
+
return result;
|
|
196
|
+
},
|
|
184
197
|
async update(data) {
|
|
185
198
|
const { model, where, update } = data;
|
|
186
199
|
if (!db[getModelName(model)]) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { B as BetterAuthOptions, W as Where } from '../auth-
|
|
1
|
+
import { B as BetterAuthOptions, W as Where } from '../auth-DYJ8ix3G.cjs';
|
|
2
2
|
import 'zod';
|
|
3
3
|
import 'kysely';
|
|
4
4
|
import 'better-call';
|
|
5
5
|
import '../helper-Bi8FQwDD.cjs';
|
|
6
|
-
import '../index-
|
|
6
|
+
import '../index-BuRgaJZR.cjs';
|
|
7
7
|
import 'jose';
|
|
8
8
|
import 'better-sqlite3';
|
|
9
9
|
|
|
@@ -37,6 +37,10 @@ declare const prismaAdapter: (prisma: PrismaClient, config: PrismaConfig) => (op
|
|
|
37
37
|
};
|
|
38
38
|
offset?: number;
|
|
39
39
|
}): Promise<any[]>;
|
|
40
|
+
count(data: {
|
|
41
|
+
model: string;
|
|
42
|
+
where?: Where[];
|
|
43
|
+
}): Promise<any>;
|
|
40
44
|
update<T>(data: {
|
|
41
45
|
model: string;
|
|
42
46
|
where: Where[];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { B as BetterAuthOptions, W as Where } from '../auth-
|
|
1
|
+
import { B as BetterAuthOptions, W as Where } from '../auth-BIKkqX3w.js';
|
|
2
2
|
import 'zod';
|
|
3
3
|
import 'kysely';
|
|
4
4
|
import 'better-call';
|
|
5
5
|
import '../helper-Bi8FQwDD.js';
|
|
6
|
-
import '../index-
|
|
6
|
+
import '../index-moQjyfmm.js';
|
|
7
7
|
import 'jose';
|
|
8
8
|
import 'better-sqlite3';
|
|
9
9
|
|
|
@@ -37,6 +37,10 @@ declare const prismaAdapter: (prisma: PrismaClient, config: PrismaConfig) => (op
|
|
|
37
37
|
};
|
|
38
38
|
offset?: number;
|
|
39
39
|
}): Promise<any[]>;
|
|
40
|
+
count(data: {
|
|
41
|
+
model: string;
|
|
42
|
+
where?: Where[];
|
|
43
|
+
}): Promise<any>;
|
|
40
44
|
update<T>(data: {
|
|
41
45
|
model: string;
|
|
42
46
|
where: Where[];
|
package/dist/adapters/prisma.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { getAuthTables, withApplyDefault } from '../chunk-
|
|
1
|
+
import { getAuthTables, withApplyDefault } from '../chunk-CLHJAEU2.js';
|
|
2
2
|
import '../chunk-HZBNUY7E.js';
|
|
3
3
|
import { generateId } from '../chunk-KLDFBLYL.js';
|
|
4
|
-
import '../chunk-
|
|
4
|
+
import '../chunk-ZFUBVSZD.js';
|
|
5
5
|
import '../chunk-SK6Y2YH6.js';
|
|
6
6
|
import '../chunk-3XTQSPPA.js';
|
|
7
7
|
import '../chunk-DBPOZRMS.js';
|
|
@@ -179,6 +179,19 @@ var prismaAdapter = (prisma, config) => (options) => {
|
|
|
179
179
|
});
|
|
180
180
|
return result.map((r) => transformOutput(r, model));
|
|
181
181
|
},
|
|
182
|
+
async count(data) {
|
|
183
|
+
const { model, where } = data;
|
|
184
|
+
const whereClause = convertWhereClause(model, where);
|
|
185
|
+
if (!db[getModelName(model)]) {
|
|
186
|
+
throw new BetterAuthError(
|
|
187
|
+
`Model ${model} does not exist in the database. If you haven't generated the Prisma client, you need to run 'npx prisma generate'`
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
const result = await db[getModelName(model)].count({
|
|
191
|
+
where: whereClause
|
|
192
|
+
});
|
|
193
|
+
return result;
|
|
194
|
+
},
|
|
182
195
|
async update(data) {
|
|
183
196
|
const { model, where, update } = data;
|
|
184
197
|
if (!db[getModelName(model)]) {
|
package/dist/adapters/test.cjs
CHANGED
package/dist/adapters/test.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { B as BetterAuthOptions, A as Adapter } from '../auth-
|
|
1
|
+
import { B as BetterAuthOptions, A as Adapter } from '../auth-DYJ8ix3G.cjs';
|
|
2
2
|
import 'zod';
|
|
3
3
|
import 'kysely';
|
|
4
4
|
import 'better-call';
|
|
5
5
|
import '../helper-Bi8FQwDD.cjs';
|
|
6
|
-
import '../index-
|
|
6
|
+
import '../index-BuRgaJZR.cjs';
|
|
7
7
|
import 'jose';
|
|
8
8
|
import 'better-sqlite3';
|
|
9
9
|
|
package/dist/adapters/test.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { B as BetterAuthOptions, A as Adapter } from '../auth-
|
|
1
|
+
import { B as BetterAuthOptions, A as Adapter } from '../auth-BIKkqX3w.js';
|
|
2
2
|
import 'zod';
|
|
3
3
|
import 'kysely';
|
|
4
4
|
import 'better-call';
|
|
5
5
|
import '../helper-Bi8FQwDD.js';
|
|
6
|
-
import '../index-
|
|
6
|
+
import '../index-moQjyfmm.js';
|
|
7
7
|
import 'jose';
|
|
8
8
|
import 'better-sqlite3';
|
|
9
9
|
|
package/dist/adapters/test.js
CHANGED