better-auth 1.4.5 → 1.4.6-beta.3
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/{access-vPNO48H4.mjs → access-BktEfzR6.mjs} +1 -1
- package/dist/{access-h-uttVNZ.mjs → access-DZRRE6Tq.mjs} +1 -1
- package/dist/adapters/drizzle-adapter/index.mjs +1 -6
- package/dist/adapters/index.d.mts +2 -237
- package/dist/adapters/index.mjs +1 -6
- package/dist/adapters/kysely-adapter/index.d.mts +1 -1
- package/dist/adapters/kysely-adapter/index.mjs +2 -7
- package/dist/adapters/memory-adapter/index.mjs +1 -6
- package/dist/adapters/mongodb-adapter/index.d.mts +1 -1
- package/dist/adapters/mongodb-adapter/index.mjs +1 -6
- package/dist/adapters/prisma-adapter/index.mjs +1 -6
- package/dist/adapters/test.mjs +2 -3
- package/dist/admin-6fpWm8vW.mjs +971 -0
- package/dist/{anonymous-DxoIOUPc.mjs → anonymous-BvvfPHFI.mjs} +5 -6
- package/dist/api/index.d.mts +2 -4
- package/dist/api/index.mjs +10 -13
- package/dist/{api-CkmycQ2x.mjs → api-B67AcvJ9.mjs} +67 -91
- package/dist/auth/minimal.d.mts +3 -4
- package/dist/auth/minimal.mjs +12 -15
- package/dist/{auth-DfR8_5w3.mjs → auth-D5QxgEcO.mjs} +3 -3
- package/dist/{base-CiRMFqet.mjs → base-CtTlmMzu.mjs} +40 -10
- package/dist/{bearer-C6RSCXv_.mjs → bearer-GIQo0kPs.mjs} +1 -1
- package/dist/{captcha-Dbvurc2Z.mjs → captcha-av_BAGRz.mjs} +1 -1
- package/dist/{chunk-DbI2OXuS.mjs → chunk-DieNfLhd.mjs} +2 -4
- package/dist/client/index.d.mts +38 -19
- package/dist/client/index.mjs +4 -5
- package/dist/client/lynx/index.d.mts +19 -21
- package/dist/client/lynx/index.mjs +5 -7
- package/dist/client/plugins/index.d.mts +36 -37
- package/dist/client/plugins/index.mjs +10 -11
- package/dist/client/react/index.d.mts +4 -6
- package/dist/client/react/index.mjs +5 -7
- package/dist/client/solid/index.d.mts +16 -17
- package/dist/client/solid/index.mjs +4 -4
- package/dist/client/svelte/index.d.mts +18 -19
- package/dist/client/svelte/index.mjs +4 -4
- package/dist/client/vue/index.d.mts +18 -19
- package/dist/client/vue/index.mjs +4 -4
- package/dist/{client-BN9e9KX1.mjs → client-BUwkFYja.mjs} +2 -2
- package/dist/cookies/index.d.mts +3 -5
- package/dist/cookies/index.mjs +4 -5
- package/dist/{cookies-D72PbWdz.mjs → cookies-DmQmKltR.mjs} +4 -4
- package/dist/crypto/index.mjs +1 -1
- package/dist/{custom-session-CaUbM_of.mjs → custom-session-BB-BwDl8.mjs} +2 -2
- package/dist/db/index.d.mts +3 -5
- package/dist/db/index.mjs +5 -10
- package/dist/device-authorization-Bo7zd0O8.mjs +593 -0
- package/dist/{dialect-D9ZUZA4J.mjs → dialect-BHuPIP4Z.mjs} +2 -2
- package/dist/email-otp-BDqXTWoL.mjs +736 -0
- package/dist/{esm-BXhcK_bt.mjs → esm-CyZgw_uF.mjs} +83 -83
- package/dist/{generic-oauth-BGbWWUh9.mjs → generic-oauth-DdO9dcA6.mjs} +385 -346
- package/dist/{get-migration-Bf0TuCzm.mjs → get-migration--xV8I5XU.mjs} +36 -8
- package/dist/{has-permission-qCjQqGds.mjs → has-permission-BxveqtYZ.mjs} +1 -1
- package/dist/{haveibeenpwned-BSsFUFTi.mjs → haveibeenpwned-DLiHZcSj.mjs} +1 -1
- package/dist/{index-Bv2nWTrZ.d.mts → index-1pOfmpZV.d.mts} +3 -3
- package/dist/{index-DUa0239y.d.mts → index-7pFhhF0x.d.mts} +6 -6
- package/dist/{index-rnNTrfA7.d.mts → index-B1fASdrI.d.mts} +1 -1
- package/dist/{index-alnYeOxT.d.mts → index-BDCxDMd9.d.mts} +36 -80
- package/dist/{index-Dk2q2Dnr.d.mts → index-BP8GKS1P.d.mts} +4 -4
- package/dist/{index-0IRW2A1b.d.mts → index-BfGjzoFj.d.mts} +18 -18
- package/dist/{index-DoUxtZgO.d.mts → index-BgCLcoV7.d.mts} +2 -2
- package/dist/{index-B64ouu9a.d.mts → index-BgRi_ahI.d.mts} +6 -6
- package/dist/{index-CCnWzVSV.d.mts → index-Bzvy2fZc.d.mts} +15 -15
- package/dist/{index-t-jeKL1G.d.mts → index-C-MbAsf4.d.mts} +9 -9
- package/dist/{index-CmcoO98i.d.mts → index-CVZJwI8R.d.mts} +5 -5
- package/dist/{index-D2CJIZCI.d.mts → index-CoRq_As_.d.mts} +6 -6
- package/dist/{index-cgrDi8bR.d.mts → index-D8JLGqFA.d.mts} +85 -181
- package/dist/{index-FTghQK8_.d.mts → index-DfQ1cHMu.d.mts} +2 -2
- package/dist/{index-Drqkvf7w.d.mts → index-GPso9wJG.d.mts} +33 -33
- package/dist/{index-DSwTw61P.d.mts → index-HVSLuFvF.d.mts} +8 -8
- package/dist/{index-COnelCGa.d.mts → index-ItLtiMMN.d.mts} +249 -257
- package/dist/{index-BaZax_le.d.mts → index-MexUZ7RH.d.mts} +4 -4
- package/dist/{index-DLNLFTLS.d.mts → index-P-wYkAD5.d.mts} +165 -192
- package/dist/{index-F8qM450o.d.mts → index-V081dNa-.d.mts} +808 -1024
- package/dist/{index-BMrJpdkv.d.mts → index-ZA57__3E.d.mts} +4 -4
- package/dist/{index-CWcnHbjn.d.mts → index-fnLzWr2C.d.mts} +2 -2
- package/dist/{index-CMfXEnyA.d.mts → index-veGVCQDP.d.mts} +7 -7
- package/dist/index.d.mts +5 -6
- package/dist/index.mjs +15 -18
- package/dist/integrations/next-js.d.mts +4 -4
- package/dist/integrations/next-js.mjs +4 -5
- package/dist/integrations/node.d.mts +2 -4
- package/dist/integrations/svelte-kit.d.mts +4 -6
- package/dist/integrations/svelte-kit.mjs +4 -5
- package/dist/integrations/tanstack-start.d.mts +4 -4
- package/dist/integrations/tanstack-start.mjs +4 -5
- package/dist/{jwt-Ar1sciI2.mjs → jwt-YwDmNjLC.mjs} +18 -15
- package/dist/{magic-link-QdHvtdfs.mjs → magic-link-DHqYwrFb.mjs} +19 -17
- package/dist/{multi-session-CbEYz_wJ.mjs → multi-session-DFQQVetu.mjs} +7 -5
- package/dist/{oauth-proxy-Dz1E1SVN.mjs → oauth-proxy-EqrMlSDE.mjs} +10 -9
- package/dist/oauth2/index.d.mts +2 -4
- package/dist/oauth2/index.mjs +10 -13
- package/dist/{oidc-provider-B9SsN23J.mjs → oidc-provider-iL1I_C0p.mjs} +56 -51
- package/dist/{one-tap-Bz8Q39Od.mjs → one-tap-DL0Yr6_1.mjs} +5 -4
- package/dist/{one-time-token-C8YQxf38.mjs → one-time-token-B14NUG5P.mjs} +5 -4
- package/dist/{open-api-DZG02vyi.mjs → open-api-DFxa4uca.mjs} +3 -3
- package/dist/{organization-BdJSRNgM.mjs → organization-BHI3Ry6r.mjs} +139 -112
- package/dist/phone-number-D4JdoQf_.mjs +565 -0
- package/dist/plugins/access/index.d.mts +1 -2
- package/dist/plugins/access/index.mjs +1 -1
- package/dist/plugins/admin/access/index.d.mts +23 -25
- package/dist/plugins/admin/access/index.mjs +2 -2
- package/dist/plugins/admin/index.d.mts +22 -25
- package/dist/plugins/admin/index.mjs +15 -18
- package/dist/plugins/anonymous/index.d.mts +3 -5
- package/dist/plugins/anonymous/index.mjs +11 -14
- package/dist/plugins/bearer/index.d.mts +1 -1
- package/dist/plugins/bearer/index.mjs +5 -6
- package/dist/plugins/captcha/index.d.mts +1 -1
- package/dist/plugins/captcha/index.mjs +2 -2
- package/dist/plugins/custom-session/index.d.mts +3 -5
- package/dist/plugins/custom-session/index.mjs +12 -15
- package/dist/plugins/device-authorization/index.d.mts +1 -1
- package/dist/plugins/device-authorization/index.mjs +9 -13
- package/dist/plugins/email-otp/index.d.mts +1 -1
- package/dist/plugins/email-otp/index.mjs +12 -15
- package/dist/plugins/generic-oauth/index.d.mts +1 -5
- package/dist/plugins/generic-oauth/index.mjs +11 -14
- package/dist/plugins/haveibeenpwned/index.d.mts +1 -1
- package/dist/plugins/haveibeenpwned/index.mjs +11 -14
- package/dist/plugins/index.d.mts +23 -25
- package/dist/plugins/index.mjs +41 -45
- package/dist/plugins/jwt/index.d.mts +3 -5
- package/dist/plugins/jwt/index.mjs +11 -14
- package/dist/plugins/magic-link/index.d.mts +1 -1
- package/dist/plugins/magic-link/index.mjs +11 -14
- package/dist/plugins/multi-session/index.d.mts +1 -1
- package/dist/plugins/multi-session/index.mjs +11 -14
- package/dist/plugins/oauth-proxy/index.d.mts +1 -1
- package/dist/plugins/oauth-proxy/index.mjs +12 -15
- package/dist/plugins/oidc-provider/index.d.mts +22 -25
- package/dist/plugins/oidc-provider/index.mjs +12 -15
- package/dist/plugins/one-tap/index.d.mts +1 -1
- package/dist/plugins/one-tap/index.mjs +11 -14
- package/dist/plugins/one-time-token/index.d.mts +3 -5
- package/dist/plugins/one-time-token/index.mjs +11 -14
- package/dist/plugins/open-api/index.d.mts +1 -2
- package/dist/plugins/open-api/index.mjs +11 -14
- package/dist/plugins/organization/access/index.d.mts +22 -25
- package/dist/plugins/organization/access/index.mjs +2 -2
- package/dist/plugins/organization/index.d.mts +22 -25
- package/dist/plugins/organization/index.mjs +14 -18
- package/dist/plugins/phone-number/index.d.mts +3 -5
- package/dist/plugins/phone-number/index.mjs +11 -14
- package/dist/plugins/siwe/index.d.mts +3 -5
- package/dist/plugins/siwe/index.mjs +11 -14
- package/dist/plugins/two-factor/index.d.mts +3 -5
- package/dist/plugins/two-factor/index.mjs +13 -16
- package/dist/plugins/username/index.d.mts +2 -3
- package/dist/plugins/username/index.mjs +11 -14
- package/dist/{plugins-Dmw3tk5H.d.mts → plugins-DLdyc73z.d.mts} +1 -1
- package/dist/{plugins-DgSTpOzm.mjs → plugins-qDvRRRie.mjs} +89 -83
- package/dist/{promise-B1BZ0y5h.mjs → promise-CL99vzc3.mjs} +245 -243
- package/dist/{proxy-DplNCOES.mjs → proxy-ehujpdXc.mjs} +2 -2
- package/dist/{schema-Bb7wzeK_.mjs → schema-dfOF7vRb.mjs} +4 -1
- package/dist/{session-AaRl3_x-.mjs → session-Dpj2Z_b_.mjs} +5 -5
- package/dist/{siwe-D81Y4fkp.mjs → siwe-CAoLY7AB.mjs} +10 -9
- package/dist/test-utils/index.d.mts +865 -866
- package/dist/test-utils/index.mjs +47 -52
- package/dist/{two-factor-BDQvVILL.mjs → two-factor-BjnAESdO.mjs} +41 -32
- package/dist/types/index.d.mts +3 -4
- package/dist/types/index.mjs +0 -2
- package/dist/{username-C_wmkXwt.mjs → username-BcWNDdCk.mjs} +13 -11
- package/dist/{utils-db7gNqd-.mjs → utils-D4_n6vJh.mjs} +4 -10
- package/package.json +8 -8
- package/dist/adapter-factory-HF3JB9cT.mjs +0 -820
- package/dist/admin-D-OMdNIc.mjs +0 -742
- package/dist/device-authorization-9_f1Up5D.mjs +0 -579
- package/dist/email-otp-CiznqFUN.mjs +0 -614
- package/dist/get-model-name-D4DUV7S2.mjs +0 -366
- package/dist/json-CnHxKYpj.mjs +0 -24
- package/dist/misc-BwNc0MKr.mjs +0 -7
- package/dist/phone-number-wU9XYnr8.mjs +0 -507
- package/dist/types-BOTDmeLz.mjs +0 -1
- /package/dist/{access-Dx8TLKnw.mjs → access-BCQibqkF.mjs} +0 -0
- /package/dist/{bun-sqlite-dialect-C3P_ISb5.mjs → bun-sqlite-dialect-BGIIaWxx.mjs} +0 -0
- /package/dist/{client-CMPEe5-e.mjs → client-7xkXfvW4.mjs} +0 -0
- /package/dist/{crypto-CFUhAR9W.mjs → crypto-DgVHxgLL.mjs} +0 -0
- /package/dist/{get-request-ip-D6st-mto.mjs → get-request-ip-G2Tcmzbb.mjs} +0 -0
- /package/dist/{helper-DFzV6jvx.d.mts → helper-BBvhhJRX.d.mts} +0 -0
- /package/dist/{node-sqlite-dialect-D6w8Ekdz.mjs → node-sqlite-dialect-DL3qojbZ.mjs} +0 -0
- /package/dist/{parser-pHp5yoAv.mjs → parser-CQYBJKoR.mjs} +0 -0
- /package/dist/{password-BFQK0cLg.mjs → password-BRmR7rWA.mjs} +0 -0
- /package/dist/{permission-JwliMugl.mjs → permission-BZUPzNK6.mjs} +0 -0
- /package/dist/{plugin-helper-zFdFWLgL.mjs → plugin-helper-BneBaGtD.mjs} +0 -0
- /package/dist/{types-CEepZ-RG.d.mts → types-Bde2wFm4.d.mts} +0 -0
- /package/dist/{url-CB8xCwz-.mjs → url-B7VXiggp.mjs} +0 -0
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import "../../get-model-name-D4DUV7S2.mjs";
|
|
2
|
-
import "../../utils-db7gNqd-.mjs";
|
|
3
|
-
import "../../crypto-CFUhAR9W.mjs";
|
|
4
|
-
import "../../misc-BwNc0MKr.mjs";
|
|
5
|
-
import "../../json-CnHxKYpj.mjs";
|
|
6
|
-
import { t as createAdapterFactory } from "../../adapter-factory-HF3JB9cT.mjs";
|
|
7
1
|
import { logger } from "@better-auth/core/env";
|
|
8
2
|
import { BetterAuthError } from "@better-auth/core/error";
|
|
3
|
+
import { createAdapterFactory } from "@better-auth/core/db/adapter";
|
|
9
4
|
import { and, asc, count, desc, eq, gt, gte, inArray, like, lt, lte, ne, notInArray, or, sql } from "drizzle-orm";
|
|
10
5
|
|
|
11
6
|
//#region src/adapters/drizzle-adapter/drizzle-adapter.ts
|
|
@@ -1,243 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../types-CEepZ-RG.mjs";
|
|
3
|
-
import { u as Prettify } from "../helper-DFzV6jvx.mjs";
|
|
4
|
-
import "../plugins-Dmw3tk5H.mjs";
|
|
5
|
-
import { BetterAuthOptions } from "@better-auth/core";
|
|
6
|
-
import * as _better_auth_core_db23 from "@better-auth/core/db";
|
|
7
|
-
import { BetterAuthDBSchema, DBFieldAttribute } from "@better-auth/core/db";
|
|
8
|
-
import { CustomAdapter as CustomAdapter$1, DBAdapter, DBAdapterFactoryConfig, JoinConfig } from "@better-auth/core/db/adapter";
|
|
1
|
+
import { AdapterFactory, AdapterFactoryConfig, AdapterFactoryCustomizeAdapterCreator, AdapterFactoryOptions, AdapterTestDebugLogs, CustomAdapter, createAdapterFactory, initGetDefaultFieldName, initGetDefaultModelName, initGetFieldAttributes, initGetFieldName, initGetIdField, initGetModelName } from "@better-auth/core/db/adapter";
|
|
9
2
|
export * from "@better-auth/core/db/adapter";
|
|
10
3
|
|
|
11
|
-
//#region src/adapters/adapter-factory/get-default-field-name.d.ts
|
|
12
|
-
declare const initGetDefaultFieldName: ({
|
|
13
|
-
schema,
|
|
14
|
-
usePlural
|
|
15
|
-
}: {
|
|
16
|
-
schema: BetterAuthDBSchema;
|
|
17
|
-
usePlural: boolean | undefined;
|
|
18
|
-
}) => ({
|
|
19
|
-
field,
|
|
20
|
-
model: unsafeModel
|
|
21
|
-
}: {
|
|
22
|
-
model: string;
|
|
23
|
-
field: string;
|
|
24
|
-
}) => string;
|
|
25
|
-
//#endregion
|
|
26
|
-
//#region src/adapters/adapter-factory/get-default-model-name.d.ts
|
|
27
|
-
declare const initGetDefaultModelName: ({
|
|
28
|
-
usePlural,
|
|
29
|
-
schema
|
|
30
|
-
}: {
|
|
31
|
-
usePlural: boolean | undefined;
|
|
32
|
-
schema: BetterAuthDBSchema;
|
|
33
|
-
}) => (model: string) => string;
|
|
34
|
-
//#endregion
|
|
35
|
-
//#region src/adapters/adapter-factory/get-field-attributes.d.ts
|
|
36
|
-
declare const initGetFieldAttributes: ({
|
|
37
|
-
usePlural,
|
|
38
|
-
schema,
|
|
39
|
-
options,
|
|
40
|
-
customIdGenerator,
|
|
41
|
-
disableIdGeneration
|
|
42
|
-
}: {
|
|
43
|
-
usePlural?: boolean;
|
|
44
|
-
schema: BetterAuthDBSchema;
|
|
45
|
-
options: BetterAuthOptions;
|
|
46
|
-
disableIdGeneration?: boolean;
|
|
47
|
-
customIdGenerator?: ((props: {
|
|
48
|
-
model: string;
|
|
49
|
-
}) => string) | undefined;
|
|
50
|
-
}) => ({
|
|
51
|
-
model,
|
|
52
|
-
field
|
|
53
|
-
}: {
|
|
54
|
-
model: string;
|
|
55
|
-
field: string;
|
|
56
|
-
}) => _better_auth_core_db23.DBFieldAttribute<_better_auth_core_db23.DBFieldType>;
|
|
57
|
-
//#endregion
|
|
58
|
-
//#region src/adapters/adapter-factory/get-field-name.d.ts
|
|
59
|
-
declare const initGetFieldName: ({
|
|
60
|
-
schema,
|
|
61
|
-
usePlural
|
|
62
|
-
}: {
|
|
63
|
-
schema: BetterAuthDBSchema;
|
|
64
|
-
usePlural: boolean | undefined;
|
|
65
|
-
}) => ({
|
|
66
|
-
model: modelName,
|
|
67
|
-
field: fieldName
|
|
68
|
-
}: {
|
|
69
|
-
model: string;
|
|
70
|
-
field: string;
|
|
71
|
-
}) => string;
|
|
72
|
-
//#endregion
|
|
73
|
-
//#region src/adapters/adapter-factory/get-id-field.d.ts
|
|
74
|
-
declare const initGetIdField: ({
|
|
75
|
-
usePlural,
|
|
76
|
-
schema,
|
|
77
|
-
disableIdGeneration,
|
|
78
|
-
options,
|
|
79
|
-
customIdGenerator,
|
|
80
|
-
supportsUUIDs
|
|
81
|
-
}: {
|
|
82
|
-
usePlural?: boolean;
|
|
83
|
-
schema: BetterAuthDBSchema;
|
|
84
|
-
options: BetterAuthOptions;
|
|
85
|
-
disableIdGeneration?: boolean;
|
|
86
|
-
customIdGenerator?: ((props: {
|
|
87
|
-
model: string;
|
|
88
|
-
}) => string) | undefined;
|
|
89
|
-
supportsUUIDs?: boolean;
|
|
90
|
-
}) => ({
|
|
91
|
-
customModelName,
|
|
92
|
-
forceAllowId
|
|
93
|
-
}: {
|
|
94
|
-
customModelName?: string;
|
|
95
|
-
forceAllowId?: boolean;
|
|
96
|
-
}) => {
|
|
97
|
-
transform: {
|
|
98
|
-
input: (value: _better_auth_core_db23.DBPrimitive) => string | number | true | Date | unknown[] | Record<string, unknown> | undefined;
|
|
99
|
-
output: (value: _better_auth_core_db23.DBPrimitive) => string | undefined;
|
|
100
|
-
};
|
|
101
|
-
defaultValue?: (() => string | false | undefined) | undefined;
|
|
102
|
-
type: "string" | "number";
|
|
103
|
-
required: boolean;
|
|
104
|
-
};
|
|
105
|
-
//#endregion
|
|
106
|
-
//#region src/adapters/adapter-factory/get-model-name.d.ts
|
|
107
|
-
declare const initGetModelName: ({
|
|
108
|
-
usePlural,
|
|
109
|
-
schema
|
|
110
|
-
}: {
|
|
111
|
-
usePlural: boolean | undefined;
|
|
112
|
-
schema: BetterAuthDBSchema;
|
|
113
|
-
}) => (model: string) => string;
|
|
114
|
-
//#endregion
|
|
115
|
-
//#region src/adapters/adapter-factory/types.d.ts
|
|
116
|
-
type AdapterFactoryOptions = {
|
|
117
|
-
config: AdapterFactoryConfig;
|
|
118
|
-
adapter: AdapterFactoryCustomizeAdapterCreator;
|
|
119
|
-
};
|
|
120
|
-
interface AdapterFactoryConfig extends Omit<DBAdapterFactoryConfig<BetterAuthOptions>, "transaction"> {
|
|
121
|
-
/**
|
|
122
|
-
* Execute multiple operations in a transaction.
|
|
123
|
-
*
|
|
124
|
-
* If the database doesn't support transactions, set this to `false` and operations will be executed sequentially.
|
|
125
|
-
*
|
|
126
|
-
* @default false
|
|
127
|
-
*/
|
|
128
|
-
transaction?: (false | (<R>(callback: (trx: TransactionAdapter) => Promise<R>) => Promise<R>)) | undefined;
|
|
129
|
-
}
|
|
130
|
-
type AdapterFactoryCustomizeAdapterCreator = (config: {
|
|
131
|
-
options: BetterAuthOptions;
|
|
132
|
-
/**
|
|
133
|
-
* The schema of the user's Better-Auth instance.
|
|
134
|
-
*/
|
|
135
|
-
schema: BetterAuthDBSchema;
|
|
136
|
-
/**
|
|
137
|
-
* The debug log function.
|
|
138
|
-
*
|
|
139
|
-
* If the config has defined `debugLogs` as `false`, no logs will be shown.
|
|
140
|
-
*/
|
|
141
|
-
debugLog: (...args: any[]) => void;
|
|
142
|
-
/**
|
|
143
|
-
* Get the model name which is expected to be saved in the database based on the user's schema.
|
|
144
|
-
*/
|
|
145
|
-
getModelName: (model: string) => string;
|
|
146
|
-
/**
|
|
147
|
-
* Get the field name which is expected to be saved in the database based on the user's schema.
|
|
148
|
-
*/
|
|
149
|
-
getFieldName: ({
|
|
150
|
-
model,
|
|
151
|
-
field
|
|
152
|
-
}: {
|
|
153
|
-
model: string;
|
|
154
|
-
field: string;
|
|
155
|
-
}) => string;
|
|
156
|
-
/**
|
|
157
|
-
* This function helps us get the default model name from the schema defined by devs.
|
|
158
|
-
* Often times, the user will be using the `modelName` which could had been customized by the users.
|
|
159
|
-
* This function helps us get the actual model name useful to match against the schema. (eg: schema[model])
|
|
160
|
-
*
|
|
161
|
-
* If it's still unclear what this does:
|
|
162
|
-
*
|
|
163
|
-
* 1. User can define a custom modelName.
|
|
164
|
-
* 2. When using a custom modelName, doing something like `schema[model]` will not work.
|
|
165
|
-
* 3. Using this function helps us get the actual model name based on the user's defined custom modelName.
|
|
166
|
-
* 4. Thus allowing us to use `schema[model]`.
|
|
167
|
-
*/
|
|
168
|
-
getDefaultModelName: (model: string) => string;
|
|
169
|
-
/**
|
|
170
|
-
* This function helps us get the default field name from the schema defined by devs.
|
|
171
|
-
* Often times, the user will be using the `fieldName` which could had been customized by the users.
|
|
172
|
-
* This function helps us get the actual field name useful to match against the schema. (eg: schema[model].fields[field])
|
|
173
|
-
*
|
|
174
|
-
* If it's still unclear what this does:
|
|
175
|
-
*
|
|
176
|
-
* 1. User can define a custom fieldName.
|
|
177
|
-
* 2. When using a custom fieldName, doing something like `schema[model].fields[field]` will not work.
|
|
178
|
-
*
|
|
179
|
-
*/
|
|
180
|
-
getDefaultFieldName: ({
|
|
181
|
-
model,
|
|
182
|
-
field
|
|
183
|
-
}: {
|
|
184
|
-
model: string;
|
|
185
|
-
field: string;
|
|
186
|
-
}) => string;
|
|
187
|
-
/**
|
|
188
|
-
* Get the field attributes for a given model and field.
|
|
189
|
-
*
|
|
190
|
-
* Note: any model name or field name is allowed, whether default to schema or not.
|
|
191
|
-
*/
|
|
192
|
-
getFieldAttributes: ({
|
|
193
|
-
model,
|
|
194
|
-
field
|
|
195
|
-
}: {
|
|
196
|
-
model: string;
|
|
197
|
-
field: string;
|
|
198
|
-
}) => DBFieldAttribute;
|
|
199
|
-
transformInput: (data: Record<string, any>, defaultModelName: string, action: "create" | "update", forceAllowId?: boolean | undefined) => Promise<Record<string, any>>;
|
|
200
|
-
transformOutput: (data: Record<string, any>, defaultModelName: string, select?: string[] | undefined, joinConfig?: JoinConfig | undefined) => Promise<Record<string, any>>;
|
|
201
|
-
transformWhereClause: <W extends Where$1[] | undefined>({
|
|
202
|
-
model,
|
|
203
|
-
where
|
|
204
|
-
}: {
|
|
205
|
-
where: W;
|
|
206
|
-
model: string;
|
|
207
|
-
}) => W extends undefined ? undefined : CleanedWhere[];
|
|
208
|
-
}) => CustomAdapter;
|
|
209
|
-
/**
|
|
210
|
-
* @deprecated Use `CustomAdapter` from `@better-auth/core/db/adapter` instead.
|
|
211
|
-
*/
|
|
212
|
-
interface CustomAdapter extends Omit<CustomAdapter$1, "createSchema"> {
|
|
213
|
-
createSchema?: ((props: {
|
|
214
|
-
/**
|
|
215
|
-
* The file the user may have passed in to the `generate` command as the expected schema file output path.
|
|
216
|
-
*/
|
|
217
|
-
file?: string;
|
|
218
|
-
/**
|
|
219
|
-
* The tables from the user's Better-Auth instance schema.
|
|
220
|
-
*/
|
|
221
|
-
tables: BetterAuthDBSchema;
|
|
222
|
-
}) => Promise<AdapterSchemaCreation>) | undefined;
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* @deprecated Use `CleanedWhere` from `@better-auth/core/db/adapter` instead.
|
|
226
|
-
*/
|
|
227
|
-
type CleanedWhere = Prettify<Required<Where$1>>;
|
|
228
|
-
type AdapterTestDebugLogs = {
|
|
229
|
-
resetDebugLogs: () => void;
|
|
230
|
-
printDebugLogs: () => void;
|
|
231
|
-
};
|
|
232
|
-
//#endregion
|
|
233
|
-
//#region src/adapters/adapter-factory/index.d.ts
|
|
234
|
-
type AdapterFactory = (options: BetterAuthOptions) => DBAdapter<BetterAuthOptions>;
|
|
235
|
-
declare const createAdapterFactory: ({
|
|
236
|
-
adapter: customAdapter,
|
|
237
|
-
config: cfg
|
|
238
|
-
}: AdapterFactoryOptions) => AdapterFactory;
|
|
239
|
-
//#endregion
|
|
240
4
|
//#region src/adapters/index.d.ts
|
|
5
|
+
|
|
241
6
|
/**
|
|
242
7
|
* @deprecated Use `createAdapterFactory` instead. This export will be removed in the next major version.
|
|
243
8
|
*/
|
package/dist/adapters/index.mjs
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../utils-db7gNqd-.mjs";
|
|
3
|
-
import "../crypto-CFUhAR9W.mjs";
|
|
4
|
-
import "../misc-BwNc0MKr.mjs";
|
|
5
|
-
import "../json-CnHxKYpj.mjs";
|
|
6
|
-
import { n as initGetFieldAttributes, r as initGetIdField, t as createAdapterFactory } from "../adapter-factory-HF3JB9cT.mjs";
|
|
1
|
+
import { createAdapterFactory, initGetDefaultFieldName, initGetDefaultModelName, initGetFieldAttributes, initGetFieldName, initGetIdField, initGetModelName } from "@better-auth/core/db/adapter";
|
|
7
2
|
|
|
8
3
|
export * from "@better-auth/core/db/adapter"
|
|
9
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as KyselyDatabaseType } from "../../types-
|
|
1
|
+
import { t as KyselyDatabaseType } from "../../types-Bde2wFm4.mjs";
|
|
2
2
|
import { BetterAuthOptions } from "@better-auth/core";
|
|
3
3
|
import { Kysely } from "kysely";
|
|
4
4
|
import { DBAdapter, DBAdapterDebugLogOption } from "@better-auth/core/db/adapter";
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import { n as getKyselyDatabaseType, t as createKyselyAdapter } from "../../dialect-
|
|
2
|
-
import "../../get-model-name-D4DUV7S2.mjs";
|
|
3
|
-
import "../../utils-db7gNqd-.mjs";
|
|
4
|
-
import "../../crypto-CFUhAR9W.mjs";
|
|
5
|
-
import "../../misc-BwNc0MKr.mjs";
|
|
6
|
-
import "../../json-CnHxKYpj.mjs";
|
|
7
|
-
import { t as createAdapterFactory } from "../../adapter-factory-HF3JB9cT.mjs";
|
|
1
|
+
import { n as getKyselyDatabaseType, t as createKyselyAdapter } from "../../dialect-BHuPIP4Z.mjs";
|
|
8
2
|
import { sql } from "kysely";
|
|
3
|
+
import { createAdapterFactory } from "@better-auth/core/db/adapter";
|
|
9
4
|
|
|
10
5
|
//#region src/adapters/kysely-adapter/kysely-adapter.ts
|
|
11
6
|
const kyselyAdapter = (db, config) => {
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import "../../get-model-name-D4DUV7S2.mjs";
|
|
2
|
-
import "../../utils-db7gNqd-.mjs";
|
|
3
|
-
import "../../crypto-CFUhAR9W.mjs";
|
|
4
|
-
import "../../misc-BwNc0MKr.mjs";
|
|
5
|
-
import "../../json-CnHxKYpj.mjs";
|
|
6
|
-
import { t as createAdapterFactory } from "../../adapter-factory-HF3JB9cT.mjs";
|
|
7
1
|
import { logger } from "@better-auth/core/env";
|
|
2
|
+
import { createAdapterFactory } from "@better-auth/core/db/adapter";
|
|
8
3
|
|
|
9
4
|
//#region src/adapters/memory-adapter/memory-adapter.ts
|
|
10
5
|
const memoryAdapter = (db, config) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BetterAuthOptions } from "@better-auth/core";
|
|
2
|
-
import { Db, MongoClient } from "mongodb";
|
|
3
2
|
import { DBAdapter, DBAdapterDebugLogOption } from "@better-auth/core/db/adapter";
|
|
3
|
+
import { Db, MongoClient } from "mongodb";
|
|
4
4
|
|
|
5
5
|
//#region src/adapters/mongodb-adapter/mongodb-adapter.d.ts
|
|
6
6
|
interface MongoDBAdapterConfig {
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import "
|
|
2
|
-
import "../../utils-db7gNqd-.mjs";
|
|
3
|
-
import "../../crypto-CFUhAR9W.mjs";
|
|
4
|
-
import "../../misc-BwNc0MKr.mjs";
|
|
5
|
-
import "../../json-CnHxKYpj.mjs";
|
|
6
|
-
import { t as createAdapterFactory } from "../../adapter-factory-HF3JB9cT.mjs";
|
|
1
|
+
import { createAdapterFactory } from "@better-auth/core/db/adapter";
|
|
7
2
|
import { ObjectId } from "mongodb";
|
|
8
3
|
|
|
9
4
|
//#region src/adapters/mongodb-adapter/mongodb-adapter.ts
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import "../../get-model-name-D4DUV7S2.mjs";
|
|
2
|
-
import "../../utils-db7gNqd-.mjs";
|
|
3
|
-
import "../../crypto-CFUhAR9W.mjs";
|
|
4
|
-
import "../../misc-BwNc0MKr.mjs";
|
|
5
|
-
import "../../json-CnHxKYpj.mjs";
|
|
6
|
-
import { t as createAdapterFactory } from "../../adapter-factory-HF3JB9cT.mjs";
|
|
7
1
|
import { BetterAuthError } from "@better-auth/core/error";
|
|
2
|
+
import { createAdapterFactory } from "@better-auth/core/db/adapter";
|
|
8
3
|
|
|
9
4
|
//#region src/adapters/prisma-adapter/prisma-adapter.ts
|
|
10
5
|
const prismaAdapter = (prisma, config) => {
|
package/dist/adapters/test.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { t as generateId } from "../utils-
|
|
2
|
-
import "../crypto-
|
|
3
|
-
import "../misc-BwNc0MKr.mjs";
|
|
1
|
+
import { t as generateId } from "../utils-D4_n6vJh.mjs";
|
|
2
|
+
import "../crypto-DgVHxgLL.mjs";
|
|
4
3
|
import { beforeAll, describe, expect, test } from "vitest";
|
|
5
4
|
|
|
6
5
|
//#region src/adapters/test.ts
|