better-auth 1.2.8-beta.1 → 1.2.8-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/adapters/drizzle-adapter/index.cjs +10 -1
- package/dist/adapters/drizzle-adapter/index.d.cts +2 -2
- package/dist/adapters/drizzle-adapter/index.d.mts +2 -2
- package/dist/adapters/drizzle-adapter/index.d.ts +2 -2
- package/dist/adapters/drizzle-adapter/index.mjs +11 -2
- package/dist/adapters/index.cjs +1 -1
- package/dist/adapters/index.d.cts +3 -3
- package/dist/adapters/index.d.mts +3 -3
- package/dist/adapters/index.d.ts +3 -3
- package/dist/adapters/index.mjs +1 -1
- package/dist/adapters/kysely-adapter/index.cjs +2 -2
- package/dist/adapters/kysely-adapter/index.d.cts +2 -2
- package/dist/adapters/kysely-adapter/index.d.mts +2 -2
- package/dist/adapters/kysely-adapter/index.d.ts +2 -2
- package/dist/adapters/kysely-adapter/index.mjs +2 -2
- package/dist/adapters/memory-adapter/index.cjs +2 -2
- package/dist/adapters/memory-adapter/index.d.cts +2 -2
- package/dist/adapters/memory-adapter/index.d.mts +2 -2
- package/dist/adapters/memory-adapter/index.d.ts +2 -2
- package/dist/adapters/memory-adapter/index.mjs +2 -2
- package/dist/adapters/mongodb-adapter/index.d.cts +1 -1
- package/dist/adapters/mongodb-adapter/index.d.mts +1 -1
- package/dist/adapters/mongodb-adapter/index.d.ts +1 -1
- package/dist/adapters/prisma-adapter/index.cjs +1 -1
- package/dist/adapters/prisma-adapter/index.d.cts +2 -2
- package/dist/adapters/prisma-adapter/index.d.mts +2 -2
- package/dist/adapters/prisma-adapter/index.d.ts +2 -2
- package/dist/adapters/prisma-adapter/index.mjs +1 -1
- package/dist/adapters/test.d.cts +1 -1
- package/dist/adapters/test.d.mts +1 -1
- package/dist/adapters/test.d.ts +1 -1
- package/dist/api/index.cjs +1 -1
- package/dist/api/index.d.cts +1 -1
- package/dist/api/index.d.mts +1 -1
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.mjs +2 -2
- package/dist/client/index.d.cts +1 -1
- package/dist/client/index.d.mts +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/plugins/index.d.cts +2 -2
- package/dist/client/plugins/index.d.mts +2 -2
- package/dist/client/plugins/index.d.ts +2 -2
- package/dist/client/react/index.d.cts +1 -1
- package/dist/client/react/index.d.mts +1 -1
- package/dist/client/react/index.d.ts +1 -1
- package/dist/client/solid/index.d.cts +1 -1
- package/dist/client/solid/index.d.mts +1 -1
- package/dist/client/solid/index.d.ts +1 -1
- package/dist/client/svelte/index.d.cts +1 -1
- package/dist/client/svelte/index.d.mts +1 -1
- package/dist/client/svelte/index.d.ts +1 -1
- package/dist/client/vue/index.d.cts +1 -1
- package/dist/client/vue/index.d.mts +1 -1
- package/dist/client/vue/index.d.ts +1 -1
- package/dist/cookies/index.d.cts +1 -1
- package/dist/cookies/index.d.mts +1 -1
- package/dist/cookies/index.d.ts +1 -1
- package/dist/db/index.cjs +4 -4
- package/dist/db/index.d.cts +2 -2
- package/dist/db/index.d.mts +2 -2
- package/dist/db/index.d.ts +2 -2
- package/dist/db/index.mjs +4 -4
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +6 -6
- package/dist/integrations/next-js.cjs +2 -2
- package/dist/integrations/next-js.d.cts +1 -1
- package/dist/integrations/next-js.d.mts +1 -1
- package/dist/integrations/next-js.d.ts +1 -1
- package/dist/integrations/next-js.mjs +2 -2
- package/dist/integrations/node.d.cts +1 -1
- package/dist/integrations/node.d.mts +1 -1
- package/dist/integrations/node.d.ts +1 -1
- package/dist/integrations/react-start.cjs +2 -2
- package/dist/integrations/react-start.d.cts +1 -1
- package/dist/integrations/react-start.d.mts +1 -1
- package/dist/integrations/react-start.d.ts +1 -1
- package/dist/integrations/react-start.mjs +2 -2
- package/dist/integrations/svelte-kit.d.cts +1 -1
- package/dist/integrations/svelte-kit.d.mts +1 -1
- package/dist/integrations/svelte-kit.d.ts +1 -1
- package/dist/oauth2/index.d.cts +2 -2
- package/dist/oauth2/index.d.mts +2 -2
- package/dist/oauth2/index.d.ts +2 -2
- package/dist/plugins/admin/index.cjs +2 -2
- package/dist/plugins/admin/index.d.cts +1 -1
- package/dist/plugins/admin/index.d.mts +1 -1
- package/dist/plugins/admin/index.d.ts +1 -1
- package/dist/plugins/admin/index.mjs +2 -2
- package/dist/plugins/anonymous/index.cjs +1 -1
- package/dist/plugins/anonymous/index.d.cts +1 -1
- package/dist/plugins/anonymous/index.d.mts +1 -1
- package/dist/plugins/anonymous/index.d.ts +1 -1
- package/dist/plugins/anonymous/index.mjs +1 -1
- package/dist/plugins/bearer/index.cjs +1 -1
- package/dist/plugins/bearer/index.d.cts +1 -1
- package/dist/plugins/bearer/index.d.mts +1 -1
- package/dist/plugins/bearer/index.d.ts +1 -1
- package/dist/plugins/bearer/index.mjs +1 -1
- package/dist/plugins/captcha/index.d.cts +1 -1
- package/dist/plugins/captcha/index.d.mts +1 -1
- package/dist/plugins/captcha/index.d.ts +1 -1
- package/dist/plugins/custom-session/index.cjs +2 -2
- package/dist/plugins/custom-session/index.d.cts +2 -2
- package/dist/plugins/custom-session/index.d.mts +2 -2
- package/dist/plugins/custom-session/index.d.ts +2 -2
- package/dist/plugins/custom-session/index.mjs +2 -2
- package/dist/plugins/email-otp/index.cjs +1 -1
- package/dist/plugins/email-otp/index.d.cts +1 -1
- package/dist/plugins/email-otp/index.d.mts +1 -1
- package/dist/plugins/email-otp/index.d.ts +1 -1
- package/dist/plugins/email-otp/index.mjs +1 -1
- package/dist/plugins/generic-oauth/index.cjs +8 -14
- package/dist/plugins/generic-oauth/index.d.cts +2 -2
- package/dist/plugins/generic-oauth/index.d.mts +2 -2
- package/dist/plugins/generic-oauth/index.d.ts +2 -2
- package/dist/plugins/generic-oauth/index.mjs +8 -14
- package/dist/plugins/haveibeenpwned/index.cjs +1 -1
- package/dist/plugins/haveibeenpwned/index.d.cts +1 -1
- package/dist/plugins/haveibeenpwned/index.d.mts +1 -1
- package/dist/plugins/haveibeenpwned/index.d.ts +1 -1
- package/dist/plugins/haveibeenpwned/index.mjs +1 -1
- package/dist/plugins/index.cjs +3 -3
- package/dist/plugins/index.d.cts +3 -3
- package/dist/plugins/index.d.mts +3 -3
- package/dist/plugins/index.d.ts +3 -3
- package/dist/plugins/index.mjs +4 -4
- package/dist/plugins/jwt/index.cjs +1 -1
- package/dist/plugins/jwt/index.d.cts +1 -1
- package/dist/plugins/jwt/index.d.mts +1 -1
- package/dist/plugins/jwt/index.d.ts +1 -1
- package/dist/plugins/jwt/index.mjs +1 -1
- package/dist/plugins/magic-link/index.cjs +1 -1
- package/dist/plugins/magic-link/index.mjs +1 -1
- package/dist/plugins/multi-session/index.cjs +1 -1
- package/dist/plugins/multi-session/index.d.cts +1 -1
- package/dist/plugins/multi-session/index.d.mts +1 -1
- package/dist/plugins/multi-session/index.d.ts +1 -1
- package/dist/plugins/multi-session/index.mjs +1 -1
- package/dist/plugins/oauth-proxy/index.cjs +1 -1
- package/dist/plugins/oauth-proxy/index.d.cts +1 -1
- package/dist/plugins/oauth-proxy/index.d.mts +1 -1
- package/dist/plugins/oauth-proxy/index.d.ts +1 -1
- package/dist/plugins/oauth-proxy/index.mjs +1 -1
- package/dist/plugins/oidc-provider/index.cjs +1 -1
- package/dist/plugins/oidc-provider/index.d.cts +1 -1
- package/dist/plugins/oidc-provider/index.d.mts +1 -1
- package/dist/plugins/oidc-provider/index.d.ts +1 -1
- package/dist/plugins/oidc-provider/index.mjs +1 -1
- package/dist/plugins/one-tap/index.cjs +1 -1
- package/dist/plugins/one-tap/index.mjs +1 -1
- package/dist/plugins/one-time-token/index.cjs +2 -2
- package/dist/plugins/one-time-token/index.d.cts +1 -1
- package/dist/plugins/one-time-token/index.d.mts +1 -1
- package/dist/plugins/one-time-token/index.d.ts +1 -1
- package/dist/plugins/one-time-token/index.mjs +2 -2
- package/dist/plugins/open-api/index.cjs +1 -1
- package/dist/plugins/open-api/index.d.cts +1 -1
- package/dist/plugins/open-api/index.d.mts +1 -1
- package/dist/plugins/open-api/index.d.ts +1 -1
- package/dist/plugins/open-api/index.mjs +1 -1
- package/dist/plugins/organization/index.cjs +2 -2
- package/dist/plugins/organization/index.d.cts +1 -1
- package/dist/plugins/organization/index.d.mts +1 -1
- package/dist/plugins/organization/index.d.ts +1 -1
- package/dist/plugins/organization/index.mjs +2 -2
- package/dist/plugins/passkey/index.cjs +2 -1
- package/dist/plugins/passkey/index.d.cts +1 -1
- package/dist/plugins/passkey/index.d.mts +1 -1
- package/dist/plugins/passkey/index.d.ts +1 -1
- package/dist/plugins/passkey/index.mjs +2 -1
- package/dist/plugins/phone-number/index.cjs +1 -1
- package/dist/plugins/phone-number/index.d.cts +1 -1
- package/dist/plugins/phone-number/index.d.mts +1 -1
- package/dist/plugins/phone-number/index.d.ts +1 -1
- package/dist/plugins/phone-number/index.mjs +1 -1
- package/dist/plugins/sso/index.cjs +2 -2
- package/dist/plugins/sso/index.d.cts +1 -1
- package/dist/plugins/sso/index.d.mts +1 -1
- package/dist/plugins/sso/index.d.ts +1 -1
- package/dist/plugins/sso/index.mjs +2 -2
- package/dist/plugins/two-factor/index.cjs +7 -5
- package/dist/plugins/two-factor/index.d.cts +1 -1
- package/dist/plugins/two-factor/index.d.mts +1 -1
- package/dist/plugins/two-factor/index.d.ts +1 -1
- package/dist/plugins/two-factor/index.mjs +7 -5
- package/dist/plugins/username/index.cjs +1 -1
- package/dist/plugins/username/index.d.cts +1 -1
- package/dist/plugins/username/index.d.mts +1 -1
- package/dist/plugins/username/index.d.ts +1 -1
- package/dist/plugins/username/index.mjs +1 -1
- package/dist/shared/{better-auth.BKyK_ofH.d.mts → better-auth.BGbO1sDU.d.mts} +1 -1
- package/dist/shared/{better-auth.CVCo5Z2T.cjs → better-auth.BJiRPytD.cjs} +1 -1
- package/dist/shared/{better-auth.DjryM8pE.cjs → better-auth.BLnaKDpp.cjs} +1 -1
- package/dist/shared/{better-auth.-Dl1H7Rz.d.ts → better-auth.BRel8q6A.d.ts} +1 -1
- package/dist/shared/{better-auth.Dr138tsU.d.ts → better-auth.BqTWy4bR.d.ts} +1 -1
- package/dist/shared/{better-auth.UWJYhF5V.cjs → better-auth.BzlWwqx6.cjs} +1 -1
- package/dist/shared/{better-auth.CPDBY4hI.cjs → better-auth.C8liBIUN.cjs} +1 -1
- package/dist/shared/{better-auth.bolYzZ0S.d.cts → better-auth.C9h9IDuv.d.cts} +26 -1
- package/dist/shared/{better-auth.DURsStt9.mjs → better-auth.CkNopsdX.mjs} +1 -1
- package/dist/shared/{better-auth.RnGMlkGR.d.mts → better-auth.D05tOULo.d.mts} +1 -1
- package/dist/shared/{better-auth.DYoLD99C.cjs → better-auth.D7wPZeNW.cjs} +18 -2
- package/dist/shared/{better-auth.OXNpfBO8.d.cts → better-auth.DD23n9eA.d.cts} +1 -1
- package/dist/shared/{better-auth.1DR6suCQ.mjs → better-auth.DKF2BM5s.mjs} +1 -1
- package/dist/shared/{better-auth.xTHoeGxJ.d.cts → better-auth.DKG6z6wI.d.cts} +1 -1
- package/dist/shared/{better-auth.Bk5IMdhM.mjs → better-auth.DM4cRSFf.mjs} +18 -2
- package/dist/shared/{better-auth.rC5b9qdS.mjs → better-auth.DRnz6Qa6.mjs} +1 -1
- package/dist/shared/{better-auth.BzFIHfxT.d.cts → better-auth.DSaDbWe7.d.cts} +1 -1
- package/dist/shared/{better-auth.jNA-1f1K.d.ts → better-auth.DXuoyAUB.d.ts} +1 -1
- package/dist/shared/{better-auth.DvTP08Oe.mjs → better-auth.DZhGZ3hY.mjs} +18 -16
- package/dist/shared/{better-auth.ASptIaaI.d.mts → better-auth.DoH4g3oA.d.mts} +26 -1
- package/dist/shared/{better-auth.rSYJCd3o.mjs → better-auth.Du54XGQ5.mjs} +1 -1
- package/dist/shared/{better-auth.CCgUfvlh.d.mts → better-auth.E28-Tvud.d.mts} +1 -1
- package/dist/shared/{better-auth.b6379eQT.d.ts → better-auth.EetBIuJe.d.ts} +26 -1
- package/dist/shared/{better-auth.B0Si_s7N.mjs → better-auth.TuDfqYsl.mjs} +1 -1
- package/dist/shared/{better-auth.BfG24BjZ.cjs → better-auth.UARlElVH.cjs} +1 -1
- package/dist/shared/{better-auth.D7If6DrS.cjs → better-auth.zMvh8rLL.cjs} +18 -16
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.mts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/package.json +6 -3
|
@@ -184,6 +184,21 @@ declare const createInternalAdapter: (adapter: Adapter, ctx: {
|
|
|
184
184
|
accessTokenExpiresAt?: Date | null | undefined;
|
|
185
185
|
refreshTokenExpiresAt?: Date | null | undefined;
|
|
186
186
|
} | null>;
|
|
187
|
+
findAccountByProviderId: (accountId: string, providerId: string) => Promise<{
|
|
188
|
+
id: string;
|
|
189
|
+
createdAt: Date;
|
|
190
|
+
updatedAt: Date;
|
|
191
|
+
providerId: string;
|
|
192
|
+
accountId: string;
|
|
193
|
+
userId: string;
|
|
194
|
+
password?: string | null | undefined;
|
|
195
|
+
scope?: string | null | undefined;
|
|
196
|
+
refreshToken?: string | null | undefined;
|
|
197
|
+
accessToken?: string | null | undefined;
|
|
198
|
+
idToken?: string | null | undefined;
|
|
199
|
+
accessTokenExpiresAt?: Date | null | undefined;
|
|
200
|
+
refreshTokenExpiresAt?: Date | null | undefined;
|
|
201
|
+
} | null>;
|
|
187
202
|
findAccountByUserId: (userId: string) => Promise<{
|
|
188
203
|
id: string;
|
|
189
204
|
createdAt: Date;
|
|
@@ -975,7 +990,7 @@ type InferOptionSchema<S extends AuthPluginSchema> = S extends Record<string, {
|
|
|
975
990
|
}> ? {
|
|
976
991
|
[K in keyof S]?: {
|
|
977
992
|
modelName?: string;
|
|
978
|
-
fields
|
|
993
|
+
fields?: {
|
|
979
994
|
[P in keyof Fields]?: string;
|
|
980
995
|
};
|
|
981
996
|
};
|
|
@@ -1537,6 +1552,16 @@ type BetterAuthOptions = {
|
|
|
1537
1552
|
account?: {
|
|
1538
1553
|
modelName?: string;
|
|
1539
1554
|
fields?: Partial<Record<keyof OmitId<Account>, string>>;
|
|
1555
|
+
/**
|
|
1556
|
+
* When enabled (true), the user account data (accessToken, idToken, refreshToken, etc.)
|
|
1557
|
+
* will be updated on sign in with the latest data from the provider.
|
|
1558
|
+
*
|
|
1559
|
+
* @default true
|
|
1560
|
+
*/
|
|
1561
|
+
updateAccountOnSignIn?: boolean;
|
|
1562
|
+
/**
|
|
1563
|
+
* Configuration for account linking.
|
|
1564
|
+
*/
|
|
1540
1565
|
accountLinking?: {
|
|
1541
1566
|
/**
|
|
1542
1567
|
* Enable account linking
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as FieldAttribute, h as BetterAuthDbSchema, f as BetterAuthOptions, W as Where, i as AdapterSchemaCreation } from './better-auth.
|
|
1
|
+
import { F as FieldAttribute, h as BetterAuthDbSchema, f as BetterAuthOptions, W as Where, i as AdapterSchemaCreation } from './better-auth.DoH4g3oA.mjs';
|
|
2
2
|
import { P as Prettify } from './better-auth.CYegVoq1.mjs';
|
|
3
3
|
|
|
4
4
|
type AdapterDebugLogs = boolean | {
|
|
@@ -23,8 +23,8 @@ require('./better-auth.DiSjtgs9.cjs');
|
|
|
23
23
|
require('@better-auth/utils/random');
|
|
24
24
|
const getTables = require('./better-auth.BEphVDyL.cjs');
|
|
25
25
|
const index = require('./better-auth.ANpbi45u.cjs');
|
|
26
|
-
const kyselyAdapter = require('./better-auth.
|
|
27
|
-
const memoryAdapter = require('./better-auth.
|
|
26
|
+
const kyselyAdapter = require('./better-auth.BJiRPytD.cjs');
|
|
27
|
+
const memoryAdapter = require('./better-auth.UARlElVH.cjs');
|
|
28
28
|
require('kysely');
|
|
29
29
|
|
|
30
30
|
function getWithHooks(adapter, ctx) {
|
|
@@ -722,6 +722,22 @@ const createInternalAdapter = (adapter, ctx) => {
|
|
|
722
722
|
});
|
|
723
723
|
return account;
|
|
724
724
|
},
|
|
725
|
+
findAccountByProviderId: async (accountId, providerId) => {
|
|
726
|
+
const account = await adapter.findOne({
|
|
727
|
+
model: "account",
|
|
728
|
+
where: [
|
|
729
|
+
{
|
|
730
|
+
field: "accountId",
|
|
731
|
+
value: accountId
|
|
732
|
+
},
|
|
733
|
+
{
|
|
734
|
+
field: "providerId",
|
|
735
|
+
value: providerId
|
|
736
|
+
}
|
|
737
|
+
]
|
|
738
|
+
});
|
|
739
|
+
return account;
|
|
740
|
+
},
|
|
725
741
|
findAccountByUserId: async (userId) => {
|
|
726
742
|
const account = await adapter.findMany({
|
|
727
743
|
model: "account",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Kysely, SqliteDialect, MysqlDialect, PostgresDialect, MssqlDialect } from 'kysely';
|
|
2
|
-
import { c as createAdapter } from './better-auth.
|
|
2
|
+
import { c as createAdapter } from './better-auth.Du54XGQ5.mjs';
|
|
3
3
|
|
|
4
4
|
function getDatabaseType(db) {
|
|
5
5
|
if (!db) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as zod from 'zod';
|
|
2
2
|
import * as better_call from 'better-call';
|
|
3
|
-
import { G as GenericEndpointContext, I as InferOptionSchema, H as HookEndpointContext, l as AuthContext } from './better-auth.
|
|
3
|
+
import { G as GenericEndpointContext, I as InferOptionSchema, H as HookEndpointContext, l as AuthContext } from './better-auth.C9h9IDuv.cjs';
|
|
4
4
|
import { Statements } from '../plugins/access/index.cjs';
|
|
5
5
|
|
|
6
6
|
declare const apiKeySchema: ({ timeWindow, rateLimitMax, }: {
|
|
@@ -21,8 +21,8 @@ import './better-auth.8zoxzg-F.mjs';
|
|
|
21
21
|
import '@better-auth/utils/random';
|
|
22
22
|
import { g as getAuthTables } from './better-auth.DORkW_Ge.mjs';
|
|
23
23
|
import { B as BetterAuthError } from './better-auth.DdzSJf-n.mjs';
|
|
24
|
-
import { c as createKyselyAdapter, k as kyselyAdapter } from './better-auth.
|
|
25
|
-
import { m as memoryAdapter } from './better-auth.
|
|
24
|
+
import { c as createKyselyAdapter, k as kyselyAdapter } from './better-auth.DKF2BM5s.mjs';
|
|
25
|
+
import { m as memoryAdapter } from './better-auth.CkNopsdX.mjs';
|
|
26
26
|
import 'kysely';
|
|
27
27
|
|
|
28
28
|
function getWithHooks(adapter, ctx) {
|
|
@@ -720,6 +720,22 @@ const createInternalAdapter = (adapter, ctx) => {
|
|
|
720
720
|
});
|
|
721
721
|
return account;
|
|
722
722
|
},
|
|
723
|
+
findAccountByProviderId: async (accountId, providerId) => {
|
|
724
|
+
const account = await adapter.findOne({
|
|
725
|
+
model: "account",
|
|
726
|
+
where: [
|
|
727
|
+
{
|
|
728
|
+
field: "accountId",
|
|
729
|
+
value: accountId
|
|
730
|
+
},
|
|
731
|
+
{
|
|
732
|
+
field: "providerId",
|
|
733
|
+
value: providerId
|
|
734
|
+
}
|
|
735
|
+
]
|
|
736
|
+
});
|
|
737
|
+
return account;
|
|
738
|
+
},
|
|
723
739
|
findAccountByUserId: async (userId) => {
|
|
724
740
|
const account = await adapter.findMany({
|
|
725
741
|
model: "account",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { APIError } from 'better-call';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { c as createAuthMiddleware, s as sessionMiddleware, a as createAuthEndpoint, g as getSessionFromCtx, B as BASE_ERROR_CODES, N as requestOnlySessionMiddleware } from './better-auth.
|
|
3
|
+
import { c as createAuthMiddleware, s as sessionMiddleware, a as createAuthEndpoint, g as getSessionFromCtx, B as BASE_ERROR_CODES, N as requestOnlySessionMiddleware } from './better-auth.DZhGZ3hY.mjs';
|
|
4
4
|
import './better-auth.8zoxzg-F.mjs';
|
|
5
5
|
import '@better-auth/utils/base64';
|
|
6
6
|
import '@better-auth/utils/hmac';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as FieldAttribute, h as BetterAuthDbSchema, f as BetterAuthOptions, W as Where, i as AdapterSchemaCreation } from './better-auth.
|
|
1
|
+
import { F as FieldAttribute, h as BetterAuthDbSchema, f as BetterAuthOptions, W as Where, i as AdapterSchemaCreation } from './better-auth.C9h9IDuv.cjs';
|
|
2
2
|
import { P as Prettify } from './better-auth.CYegVoq1.cjs';
|
|
3
3
|
|
|
4
4
|
type AdapterDebugLogs = boolean | {
|
|
@@ -1171,22 +1171,24 @@ async function handleOAuthUserInfo(c, {
|
|
|
1171
1171
|
};
|
|
1172
1172
|
}
|
|
1173
1173
|
} else {
|
|
1174
|
-
|
|
1175
|
-
Object.
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
if (Object.keys(updateData).length > 0) {
|
|
1185
|
-
await c.context.internalAdapter.updateAccount(
|
|
1186
|
-
hasBeenLinked.id,
|
|
1187
|
-
updateData,
|
|
1188
|
-
c
|
|
1174
|
+
if (c.context.options.account?.updateAccountOnSignIn !== false) {
|
|
1175
|
+
const updateData = Object.fromEntries(
|
|
1176
|
+
Object.entries({
|
|
1177
|
+
accessToken: account.accessToken,
|
|
1178
|
+
idToken: account.idToken,
|
|
1179
|
+
refreshToken: account.refreshToken,
|
|
1180
|
+
accessTokenExpiresAt: account.accessTokenExpiresAt,
|
|
1181
|
+
refreshTokenExpiresAt: account.refreshTokenExpiresAt,
|
|
1182
|
+
scope: account.scope
|
|
1183
|
+
}).filter(([_, value]) => value !== void 0)
|
|
1189
1184
|
);
|
|
1185
|
+
if (Object.keys(updateData).length > 0) {
|
|
1186
|
+
await c.context.internalAdapter.updateAccount(
|
|
1187
|
+
hasBeenLinked.id,
|
|
1188
|
+
updateData,
|
|
1189
|
+
c
|
|
1190
|
+
);
|
|
1191
|
+
}
|
|
1190
1192
|
}
|
|
1191
1193
|
}
|
|
1192
1194
|
if (overrideUserInfo) {
|
|
@@ -1194,7 +1196,7 @@ async function handleOAuthUserInfo(c, {
|
|
|
1194
1196
|
await c.context.internalAdapter.updateUser(dbUser.user.id, {
|
|
1195
1197
|
...restUserInfo,
|
|
1196
1198
|
email: userInfo.email.toLowerCase(),
|
|
1197
|
-
emailVerified: userInfo.email.
|
|
1199
|
+
emailVerified: userInfo.email.toLowerCase() === dbUser.user.email ? dbUser.user.emailVerified || userInfo.emailVerified : userInfo.emailVerified
|
|
1198
1200
|
});
|
|
1199
1201
|
}
|
|
1200
1202
|
} else {
|
|
@@ -184,6 +184,21 @@ declare const createInternalAdapter: (adapter: Adapter, ctx: {
|
|
|
184
184
|
accessTokenExpiresAt?: Date | null | undefined;
|
|
185
185
|
refreshTokenExpiresAt?: Date | null | undefined;
|
|
186
186
|
} | null>;
|
|
187
|
+
findAccountByProviderId: (accountId: string, providerId: string) => Promise<{
|
|
188
|
+
id: string;
|
|
189
|
+
createdAt: Date;
|
|
190
|
+
updatedAt: Date;
|
|
191
|
+
providerId: string;
|
|
192
|
+
accountId: string;
|
|
193
|
+
userId: string;
|
|
194
|
+
password?: string | null | undefined;
|
|
195
|
+
scope?: string | null | undefined;
|
|
196
|
+
refreshToken?: string | null | undefined;
|
|
197
|
+
accessToken?: string | null | undefined;
|
|
198
|
+
idToken?: string | null | undefined;
|
|
199
|
+
accessTokenExpiresAt?: Date | null | undefined;
|
|
200
|
+
refreshTokenExpiresAt?: Date | null | undefined;
|
|
201
|
+
} | null>;
|
|
187
202
|
findAccountByUserId: (userId: string) => Promise<{
|
|
188
203
|
id: string;
|
|
189
204
|
createdAt: Date;
|
|
@@ -975,7 +990,7 @@ type InferOptionSchema<S extends AuthPluginSchema> = S extends Record<string, {
|
|
|
975
990
|
}> ? {
|
|
976
991
|
[K in keyof S]?: {
|
|
977
992
|
modelName?: string;
|
|
978
|
-
fields
|
|
993
|
+
fields?: {
|
|
979
994
|
[P in keyof Fields]?: string;
|
|
980
995
|
};
|
|
981
996
|
};
|
|
@@ -1537,6 +1552,16 @@ type BetterAuthOptions = {
|
|
|
1537
1552
|
account?: {
|
|
1538
1553
|
modelName?: string;
|
|
1539
1554
|
fields?: Partial<Record<keyof OmitId<Account>, string>>;
|
|
1555
|
+
/**
|
|
1556
|
+
* When enabled (true), the user account data (accessToken, idToken, refreshToken, etc.)
|
|
1557
|
+
* will be updated on sign in with the latest data from the provider.
|
|
1558
|
+
*
|
|
1559
|
+
* @default true
|
|
1560
|
+
*/
|
|
1561
|
+
updateAccountOnSignIn?: boolean;
|
|
1562
|
+
/**
|
|
1563
|
+
* Configuration for account linking.
|
|
1564
|
+
*/
|
|
1540
1565
|
accountLinking?: {
|
|
1541
1566
|
/**
|
|
1542
1567
|
* Enable account linking
|
|
@@ -153,7 +153,7 @@ const createAdapter = ({
|
|
|
153
153
|
if (config.disableIdGeneration) return void 0;
|
|
154
154
|
const useNumberId = options.advanced?.database?.useNumberId;
|
|
155
155
|
let generateId$1 = options.advanced?.database?.generateId;
|
|
156
|
-
if (options.advanced?.generateId) {
|
|
156
|
+
if (options.advanced?.generateId !== void 0) {
|
|
157
157
|
logger.warn(
|
|
158
158
|
"Your Better Auth config includes advanced.generateId which is deprecated. Please use advanced.database.generateId instead. This will be removed in future releases."
|
|
159
159
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as zod from 'zod';
|
|
2
2
|
import * as better_call from 'better-call';
|
|
3
|
-
import { G as GenericEndpointContext, I as InferOptionSchema, H as HookEndpointContext, l as AuthContext } from './better-auth.
|
|
3
|
+
import { G as GenericEndpointContext, I as InferOptionSchema, H as HookEndpointContext, l as AuthContext } from './better-auth.DoH4g3oA.mjs';
|
|
4
4
|
import { Statements } from '../plugins/access/index.mjs';
|
|
5
5
|
|
|
6
6
|
declare const apiKeySchema: ({ timeWindow, rateLimitMax, }: {
|
|
@@ -184,6 +184,21 @@ declare const createInternalAdapter: (adapter: Adapter, ctx: {
|
|
|
184
184
|
accessTokenExpiresAt?: Date | null | undefined;
|
|
185
185
|
refreshTokenExpiresAt?: Date | null | undefined;
|
|
186
186
|
} | null>;
|
|
187
|
+
findAccountByProviderId: (accountId: string, providerId: string) => Promise<{
|
|
188
|
+
id: string;
|
|
189
|
+
createdAt: Date;
|
|
190
|
+
updatedAt: Date;
|
|
191
|
+
providerId: string;
|
|
192
|
+
accountId: string;
|
|
193
|
+
userId: string;
|
|
194
|
+
password?: string | null | undefined;
|
|
195
|
+
scope?: string | null | undefined;
|
|
196
|
+
refreshToken?: string | null | undefined;
|
|
197
|
+
accessToken?: string | null | undefined;
|
|
198
|
+
idToken?: string | null | undefined;
|
|
199
|
+
accessTokenExpiresAt?: Date | null | undefined;
|
|
200
|
+
refreshTokenExpiresAt?: Date | null | undefined;
|
|
201
|
+
} | null>;
|
|
187
202
|
findAccountByUserId: (userId: string) => Promise<{
|
|
188
203
|
id: string;
|
|
189
204
|
createdAt: Date;
|
|
@@ -975,7 +990,7 @@ type InferOptionSchema<S extends AuthPluginSchema> = S extends Record<string, {
|
|
|
975
990
|
}> ? {
|
|
976
991
|
[K in keyof S]?: {
|
|
977
992
|
modelName?: string;
|
|
978
|
-
fields
|
|
993
|
+
fields?: {
|
|
979
994
|
[P in keyof Fields]?: string;
|
|
980
995
|
};
|
|
981
996
|
};
|
|
@@ -1537,6 +1552,16 @@ type BetterAuthOptions = {
|
|
|
1537
1552
|
account?: {
|
|
1538
1553
|
modelName?: string;
|
|
1539
1554
|
fields?: Partial<Record<keyof OmitId<Account>, string>>;
|
|
1555
|
+
/**
|
|
1556
|
+
* When enabled (true), the user account data (accessToken, idToken, refreshToken, etc.)
|
|
1557
|
+
* will be updated on sign in with the latest data from the provider.
|
|
1558
|
+
*
|
|
1559
|
+
* @default true
|
|
1560
|
+
*/
|
|
1561
|
+
updateAccountOnSignIn?: boolean;
|
|
1562
|
+
/**
|
|
1563
|
+
* Configuration for account linking.
|
|
1564
|
+
*/
|
|
1540
1565
|
accountLinking?: {
|
|
1541
1566
|
/**
|
|
1542
1567
|
* Enable account linking
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { APIError } from 'better-call';
|
|
3
|
-
import { c as createAuthMiddleware, g as getSessionFromCtx, a as createAuthEndpoint } from './better-auth.
|
|
3
|
+
import { c as createAuthMiddleware, g as getSessionFromCtx, a as createAuthEndpoint } from './better-auth.DZhGZ3hY.mjs';
|
|
4
4
|
import { setSessionCookie, deleteSessionCookie } from '../cookies/index.mjs';
|
|
5
5
|
import { m as mergeSchema } from './better-auth.Cc72UxUH.mjs';
|
|
6
6
|
import './better-auth.8zoxzg-F.mjs';
|
|
@@ -1173,22 +1173,24 @@ async function handleOAuthUserInfo(c, {
|
|
|
1173
1173
|
};
|
|
1174
1174
|
}
|
|
1175
1175
|
} else {
|
|
1176
|
-
|
|
1177
|
-
Object.
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
if (Object.keys(updateData).length > 0) {
|
|
1187
|
-
await c.context.internalAdapter.updateAccount(
|
|
1188
|
-
hasBeenLinked.id,
|
|
1189
|
-
updateData,
|
|
1190
|
-
c
|
|
1176
|
+
if (c.context.options.account?.updateAccountOnSignIn !== false) {
|
|
1177
|
+
const updateData = Object.fromEntries(
|
|
1178
|
+
Object.entries({
|
|
1179
|
+
accessToken: account.accessToken,
|
|
1180
|
+
idToken: account.idToken,
|
|
1181
|
+
refreshToken: account.refreshToken,
|
|
1182
|
+
accessTokenExpiresAt: account.accessTokenExpiresAt,
|
|
1183
|
+
refreshTokenExpiresAt: account.refreshTokenExpiresAt,
|
|
1184
|
+
scope: account.scope
|
|
1185
|
+
}).filter(([_, value]) => value !== void 0)
|
|
1191
1186
|
);
|
|
1187
|
+
if (Object.keys(updateData).length > 0) {
|
|
1188
|
+
await c.context.internalAdapter.updateAccount(
|
|
1189
|
+
hasBeenLinked.id,
|
|
1190
|
+
updateData,
|
|
1191
|
+
c
|
|
1192
|
+
);
|
|
1193
|
+
}
|
|
1192
1194
|
}
|
|
1193
1195
|
}
|
|
1194
1196
|
if (overrideUserInfo) {
|
|
@@ -1196,7 +1198,7 @@ async function handleOAuthUserInfo(c, {
|
|
|
1196
1198
|
await c.context.internalAdapter.updateUser(dbUser.user.id, {
|
|
1197
1199
|
...restUserInfo,
|
|
1198
1200
|
email: userInfo.email.toLowerCase(),
|
|
1199
|
-
emailVerified: userInfo.email.
|
|
1201
|
+
emailVerified: userInfo.email.toLowerCase() === dbUser.user.email ? dbUser.user.emailVerified || userInfo.emailVerified : userInfo.emailVerified
|
|
1200
1202
|
});
|
|
1201
1203
|
}
|
|
1202
1204
|
} else {
|
package/dist/types/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as BetterAuthPlugin, a5 as InferFieldsInputClient, a3 as InferFieldsOutput, U as User, S as Session, k as Auth } from '../shared/better-auth.
|
|
2
|
-
export { x as Account, g as Adapter, z as AdapterInstance, i as AdapterSchemaCreation, u as AdditionalSessionFieldsInput, v as AdditionalSessionFieldsOutput, s as AdditionalUserFieldsInput, t as AdditionalUserFieldsOutput, l as AuthContext, A as AuthPluginSchema, f as BetterAuthOptions, E as FilterActions, D as FilteredAPI, G as GenericEndpointContext, H as HookEndpointContext, L as InferAPI, I as InferOptionSchema, a as InferPluginErrorCodes, w as InferPluginTypes, n as InferSession, J as InferSessionAPI, m as InferUser, M as Models, R as RateLimit, C as SecondaryStorage, V as Verification, W as Where, y as init } from '../shared/better-auth.
|
|
1
|
+
import { B as BetterAuthPlugin, a5 as InferFieldsInputClient, a3 as InferFieldsOutput, U as User, S as Session, k as Auth } from '../shared/better-auth.C9h9IDuv.cjs';
|
|
2
|
+
export { x as Account, g as Adapter, z as AdapterInstance, i as AdapterSchemaCreation, u as AdditionalSessionFieldsInput, v as AdditionalSessionFieldsOutput, s as AdditionalUserFieldsInput, t as AdditionalUserFieldsOutput, l as AuthContext, A as AuthPluginSchema, f as BetterAuthOptions, E as FilterActions, D as FilteredAPI, G as GenericEndpointContext, H as HookEndpointContext, L as InferAPI, I as InferOptionSchema, a as InferPluginErrorCodes, w as InferPluginTypes, n as InferSession, J as InferSessionAPI, m as InferUser, M as Models, R as RateLimit, C as SecondaryStorage, V as Verification, W as Where, y as init } from '../shared/better-auth.C9h9IDuv.cjs';
|
|
3
3
|
import { BetterFetchOption, BetterFetchResponse, BetterFetch, BetterFetchPlugin } from '@better-fetch/fetch';
|
|
4
4
|
import { WritableAtom, Atom } from 'nanostores';
|
|
5
5
|
import { U as UnionToIntersection, H as HasRequiredKeys, P as Prettify, L as LiteralString, S as StripEmptyObjects } from '../shared/better-auth.CYegVoq1.cjs';
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as BetterAuthPlugin, a5 as InferFieldsInputClient, a3 as InferFieldsOutput, U as User, S as Session, k as Auth } from '../shared/better-auth.
|
|
2
|
-
export { x as Account, g as Adapter, z as AdapterInstance, i as AdapterSchemaCreation, u as AdditionalSessionFieldsInput, v as AdditionalSessionFieldsOutput, s as AdditionalUserFieldsInput, t as AdditionalUserFieldsOutput, l as AuthContext, A as AuthPluginSchema, f as BetterAuthOptions, E as FilterActions, D as FilteredAPI, G as GenericEndpointContext, H as HookEndpointContext, L as InferAPI, I as InferOptionSchema, a as InferPluginErrorCodes, w as InferPluginTypes, n as InferSession, J as InferSessionAPI, m as InferUser, M as Models, R as RateLimit, C as SecondaryStorage, V as Verification, W as Where, y as init } from '../shared/better-auth.
|
|
1
|
+
import { B as BetterAuthPlugin, a5 as InferFieldsInputClient, a3 as InferFieldsOutput, U as User, S as Session, k as Auth } from '../shared/better-auth.DoH4g3oA.mjs';
|
|
2
|
+
export { x as Account, g as Adapter, z as AdapterInstance, i as AdapterSchemaCreation, u as AdditionalSessionFieldsInput, v as AdditionalSessionFieldsOutput, s as AdditionalUserFieldsInput, t as AdditionalUserFieldsOutput, l as AuthContext, A as AuthPluginSchema, f as BetterAuthOptions, E as FilterActions, D as FilteredAPI, G as GenericEndpointContext, H as HookEndpointContext, L as InferAPI, I as InferOptionSchema, a as InferPluginErrorCodes, w as InferPluginTypes, n as InferSession, J as InferSessionAPI, m as InferUser, M as Models, R as RateLimit, C as SecondaryStorage, V as Verification, W as Where, y as init } from '../shared/better-auth.DoH4g3oA.mjs';
|
|
3
3
|
import { BetterFetchOption, BetterFetchResponse, BetterFetch, BetterFetchPlugin } from '@better-fetch/fetch';
|
|
4
4
|
import { WritableAtom, Atom } from 'nanostores';
|
|
5
5
|
import { U as UnionToIntersection, H as HasRequiredKeys, P as Prettify, L as LiteralString, S as StripEmptyObjects } from '../shared/better-auth.CYegVoq1.mjs';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as BetterAuthPlugin, a5 as InferFieldsInputClient, a3 as InferFieldsOutput, U as User, S as Session, k as Auth } from '../shared/better-auth.
|
|
2
|
-
export { x as Account, g as Adapter, z as AdapterInstance, i as AdapterSchemaCreation, u as AdditionalSessionFieldsInput, v as AdditionalSessionFieldsOutput, s as AdditionalUserFieldsInput, t as AdditionalUserFieldsOutput, l as AuthContext, A as AuthPluginSchema, f as BetterAuthOptions, E as FilterActions, D as FilteredAPI, G as GenericEndpointContext, H as HookEndpointContext, L as InferAPI, I as InferOptionSchema, a as InferPluginErrorCodes, w as InferPluginTypes, n as InferSession, J as InferSessionAPI, m as InferUser, M as Models, R as RateLimit, C as SecondaryStorage, V as Verification, W as Where, y as init } from '../shared/better-auth.
|
|
1
|
+
import { B as BetterAuthPlugin, a5 as InferFieldsInputClient, a3 as InferFieldsOutput, U as User, S as Session, k as Auth } from '../shared/better-auth.EetBIuJe.js';
|
|
2
|
+
export { x as Account, g as Adapter, z as AdapterInstance, i as AdapterSchemaCreation, u as AdditionalSessionFieldsInput, v as AdditionalSessionFieldsOutput, s as AdditionalUserFieldsInput, t as AdditionalUserFieldsOutput, l as AuthContext, A as AuthPluginSchema, f as BetterAuthOptions, E as FilterActions, D as FilteredAPI, G as GenericEndpointContext, H as HookEndpointContext, L as InferAPI, I as InferOptionSchema, a as InferPluginErrorCodes, w as InferPluginTypes, n as InferSession, J as InferSessionAPI, m as InferUser, M as Models, R as RateLimit, C as SecondaryStorage, V as Verification, W as Where, y as init } from '../shared/better-auth.EetBIuJe.js';
|
|
3
3
|
import { BetterFetchOption, BetterFetchResponse, BetterFetch, BetterFetchPlugin } from '@better-fetch/fetch';
|
|
4
4
|
import { WritableAtom, Atom } from 'nanostores';
|
|
5
5
|
import { U as UnionToIntersection, H as HasRequiredKeys, P as Prettify, L as LiteralString, S as StripEmptyObjects } from '../shared/better-auth.CYegVoq1.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "better-auth",
|
|
3
|
-
"version": "1.2.8-beta.
|
|
3
|
+
"version": "1.2.8-beta.3",
|
|
4
4
|
"description": "The most comprehensive authentication library for TypeScript.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -561,6 +561,9 @@
|
|
|
561
561
|
"react-start": [
|
|
562
562
|
"./dist/integrations/react-start.d.ts"
|
|
563
563
|
],
|
|
564
|
+
"adapters": [
|
|
565
|
+
"./dist/adapters/index.d.ts"
|
|
566
|
+
],
|
|
564
567
|
"adapters/prisma": [
|
|
565
568
|
"./dist/adapters/prisma-adapter/index.d.ts"
|
|
566
569
|
],
|
|
@@ -677,7 +680,7 @@
|
|
|
677
680
|
"better-call": "^1.0.8",
|
|
678
681
|
"defu": "^6.1.4",
|
|
679
682
|
"jose": "^5.9.6",
|
|
680
|
-
"kysely": "^0.
|
|
683
|
+
"kysely": "^0.28.1",
|
|
681
684
|
"nanostores": "^0.11.3",
|
|
682
685
|
"zod": "^3.24.1"
|
|
683
686
|
},
|
|
@@ -698,6 +701,6 @@
|
|
|
698
701
|
"prisma:normal:push": "prisma db push --schema src/adapters/prisma-adapter/test/normal-tests/schema.prisma",
|
|
699
702
|
"prisma:number-id:push": "prisma db push --schema src/adapters/prisma-adapter/test/number-id-tests/schema.prisma",
|
|
700
703
|
"bump": "bumpp",
|
|
701
|
-
"typecheck": "tsc --noEmit"
|
|
704
|
+
"typecheck": "pnpm prisma:normal:push && pnpm prisma:number-id:push && tsc --noEmit"
|
|
702
705
|
}
|
|
703
706
|
}
|