better-auth 1.3.0-beta.8 → 1.3.0-beta.9
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 +2 -2
- package/dist/adapters/drizzle-adapter/index.d.cts +6 -4
- package/dist/adapters/drizzle-adapter/index.d.mts +6 -4
- package/dist/adapters/drizzle-adapter/index.d.ts +6 -4
- package/dist/adapters/drizzle-adapter/index.mjs +2 -2
- package/dist/adapters/index.cjs +2 -2
- package/dist/adapters/index.d.cts +7 -5
- package/dist/adapters/index.d.mts +7 -5
- package/dist/adapters/index.d.ts +7 -5
- package/dist/adapters/index.mjs +2 -2
- package/dist/adapters/kysely-adapter/index.cjs +3 -3
- package/dist/adapters/kysely-adapter/index.d.cts +6 -4
- package/dist/adapters/kysely-adapter/index.d.mts +6 -4
- package/dist/adapters/kysely-adapter/index.d.ts +6 -4
- package/dist/adapters/kysely-adapter/index.mjs +3 -3
- package/dist/adapters/memory-adapter/index.cjs +3 -3
- package/dist/adapters/memory-adapter/index.d.cts +6 -4
- package/dist/adapters/memory-adapter/index.d.mts +6 -4
- package/dist/adapters/memory-adapter/index.d.ts +6 -4
- package/dist/adapters/memory-adapter/index.mjs +3 -3
- package/dist/adapters/mongodb-adapter/index.cjs +3 -3
- package/dist/adapters/mongodb-adapter/index.d.cts +6 -4
- package/dist/adapters/mongodb-adapter/index.d.mts +6 -4
- package/dist/adapters/mongodb-adapter/index.d.ts +6 -4
- package/dist/adapters/mongodb-adapter/index.mjs +3 -3
- package/dist/adapters/prisma-adapter/index.cjs +2 -2
- package/dist/adapters/prisma-adapter/index.d.cts +6 -4
- package/dist/adapters/prisma-adapter/index.d.mts +6 -4
- package/dist/adapters/prisma-adapter/index.d.ts +6 -4
- package/dist/adapters/prisma-adapter/index.mjs +2 -2
- package/dist/adapters/test.cjs +1 -1
- package/dist/adapters/test.d.cts +6 -4
- package/dist/adapters/test.d.mts +6 -4
- package/dist/adapters/test.d.ts +6 -4
- package/dist/adapters/test.mjs +1 -1
- package/dist/api/index.cjs +26 -8
- package/dist/api/index.d.cts +5 -3
- package/dist/api/index.d.mts +5 -3
- package/dist/api/index.d.ts +5 -3
- package/dist/api/index.mjs +13 -8
- package/dist/client/index.d.cts +8 -6
- package/dist/client/index.d.mts +8 -6
- package/dist/client/index.d.ts +8 -6
- package/dist/client/plugins/index.d.cts +18 -16
- package/dist/client/plugins/index.d.mts +18 -16
- package/dist/client/plugins/index.d.ts +18 -16
- package/dist/client/react/index.d.cts +14 -12
- package/dist/client/react/index.d.mts +14 -12
- package/dist/client/react/index.d.ts +14 -12
- package/dist/client/solid/index.d.cts +8 -6
- package/dist/client/solid/index.d.mts +8 -6
- package/dist/client/solid/index.d.ts +8 -6
- package/dist/client/svelte/index.d.cts +14 -12
- package/dist/client/svelte/index.d.mts +14 -12
- package/dist/client/svelte/index.d.ts +14 -12
- package/dist/client/vue/index.d.cts +8 -6
- package/dist/client/vue/index.d.mts +8 -6
- package/dist/client/vue/index.d.ts +8 -6
- package/dist/cookies/index.d.cts +6 -4
- package/dist/cookies/index.d.mts +6 -4
- package/dist/cookies/index.d.ts +6 -4
- package/dist/db/index.cjs +25 -11
- package/dist/db/index.d.cts +8 -6
- package/dist/db/index.d.mts +8 -6
- package/dist/db/index.d.ts +8 -6
- package/dist/db/index.mjs +7 -7
- package/dist/index.cjs +9 -9
- package/dist/index.d.cts +8 -6
- package/dist/index.d.mts +8 -6
- package/dist/index.d.ts +8 -6
- package/dist/index.mjs +9 -9
- package/dist/integrations/next-js.cjs +17 -6
- package/dist/integrations/next-js.d.cts +6 -4
- package/dist/integrations/next-js.d.mts +6 -4
- package/dist/integrations/next-js.d.ts +6 -4
- package/dist/integrations/next-js.mjs +17 -6
- package/dist/integrations/node.d.cts +6 -4
- package/dist/integrations/node.d.mts +6 -4
- package/dist/integrations/node.d.ts +6 -4
- package/dist/integrations/react-start.cjs +6 -5
- package/dist/integrations/react-start.d.cts +6 -4
- package/dist/integrations/react-start.d.mts +6 -4
- package/dist/integrations/react-start.d.ts +6 -4
- package/dist/integrations/react-start.mjs +6 -5
- package/dist/integrations/svelte-kit.cjs +3 -3
- package/dist/integrations/svelte-kit.d.cts +6 -4
- package/dist/integrations/svelte-kit.d.mts +6 -4
- package/dist/integrations/svelte-kit.d.ts +6 -4
- package/dist/integrations/svelte-kit.mjs +3 -3
- package/dist/oauth2/index.cjs +3 -3
- package/dist/oauth2/index.d.cts +13 -10
- package/dist/oauth2/index.d.mts +13 -10
- package/dist/oauth2/index.d.ts +13 -10
- package/dist/oauth2/index.mjs +3 -3
- package/dist/plugins/access/index.d.cts +1 -2
- package/dist/plugins/access/index.d.mts +1 -2
- package/dist/plugins/access/index.d.ts +1 -2
- package/dist/plugins/admin/access/index.d.cts +1 -2
- package/dist/plugins/admin/access/index.d.mts +1 -2
- package/dist/plugins/admin/access/index.d.ts +1 -2
- package/dist/plugins/admin/index.cjs +4 -3
- package/dist/plugins/admin/index.d.cts +114 -197
- package/dist/plugins/admin/index.d.mts +114 -197
- package/dist/plugins/admin/index.d.ts +114 -197
- package/dist/plugins/admin/index.mjs +4 -3
- package/dist/plugins/anonymous/index.cjs +4 -4
- package/dist/plugins/anonymous/index.d.cts +6 -4
- package/dist/plugins/anonymous/index.d.mts +6 -4
- package/dist/plugins/anonymous/index.d.ts +6 -4
- package/dist/plugins/anonymous/index.mjs +4 -4
- package/dist/plugins/bearer/index.cjs +3 -3
- package/dist/plugins/bearer/index.d.cts +6 -4
- package/dist/plugins/bearer/index.d.mts +6 -4
- package/dist/plugins/bearer/index.d.ts +6 -4
- package/dist/plugins/bearer/index.mjs +3 -3
- package/dist/plugins/captcha/index.d.cts +6 -4
- package/dist/plugins/captcha/index.d.mts +6 -4
- package/dist/plugins/captcha/index.d.ts +6 -4
- package/dist/plugins/custom-session/index.cjs +22 -8
- package/dist/plugins/custom-session/index.d.cts +8 -16
- package/dist/plugins/custom-session/index.d.mts +8 -16
- package/dist/plugins/custom-session/index.d.ts +8 -16
- package/dist/plugins/custom-session/index.mjs +5 -5
- package/dist/plugins/email-otp/index.cjs +24 -17
- package/dist/plugins/email-otp/index.d.cts +33 -61
- package/dist/plugins/email-otp/index.d.mts +33 -61
- package/dist/plugins/email-otp/index.d.ts +33 -61
- package/dist/plugins/email-otp/index.mjs +24 -17
- package/dist/plugins/generic-oauth/index.cjs +40 -24
- package/dist/plugins/generic-oauth/index.d.cts +23 -63
- package/dist/plugins/generic-oauth/index.d.mts +23 -63
- package/dist/plugins/generic-oauth/index.d.ts +23 -63
- package/dist/plugins/generic-oauth/index.mjs +21 -19
- package/dist/plugins/haveibeenpwned/index.cjs +3 -3
- package/dist/plugins/haveibeenpwned/index.d.cts +6 -4
- package/dist/plugins/haveibeenpwned/index.d.mts +6 -4
- package/dist/plugins/haveibeenpwned/index.d.ts +6 -4
- package/dist/plugins/haveibeenpwned/index.mjs +3 -3
- package/dist/plugins/index.cjs +112 -80
- package/dist/plugins/index.d.cts +53 -71
- package/dist/plugins/index.d.mts +53 -71
- package/dist/plugins/index.d.ts +53 -71
- package/dist/plugins/index.mjs +82 -64
- package/dist/plugins/jwt/index.cjs +9 -90
- package/dist/plugins/jwt/index.d.cts +10 -9
- package/dist/plugins/jwt/index.d.mts +10 -9
- package/dist/plugins/jwt/index.d.ts +10 -9
- package/dist/plugins/jwt/index.mjs +9 -89
- package/dist/plugins/magic-link/index.cjs +24 -10
- package/dist/plugins/magic-link/index.d.cts +4 -18
- package/dist/plugins/magic-link/index.d.mts +4 -18
- package/dist/plugins/magic-link/index.d.ts +4 -18
- package/dist/plugins/magic-link/index.mjs +8 -8
- package/dist/plugins/multi-session/index.cjs +21 -7
- package/dist/plugins/multi-session/index.d.cts +14 -20
- package/dist/plugins/multi-session/index.d.mts +14 -20
- package/dist/plugins/multi-session/index.d.ts +14 -20
- package/dist/plugins/multi-session/index.mjs +5 -5
- package/dist/plugins/oauth-proxy/index.cjs +20 -6
- package/dist/plugins/oauth-proxy/index.d.cts +7 -11
- package/dist/plugins/oauth-proxy/index.d.mts +7 -11
- package/dist/plugins/oauth-proxy/index.d.ts +7 -11
- package/dist/plugins/oauth-proxy/index.mjs +5 -5
- package/dist/plugins/oidc-provider/index.cjs +11 -6
- package/dist/plugins/oidc-provider/index.d.cts +106 -84
- package/dist/plugins/oidc-provider/index.d.mts +106 -84
- package/dist/plugins/oidc-provider/index.d.ts +106 -84
- package/dist/plugins/oidc-provider/index.mjs +10 -6
- package/dist/plugins/one-tap/index.cjs +19 -5
- package/dist/plugins/one-tap/index.d.cts +2 -6
- package/dist/plugins/one-tap/index.d.mts +2 -6
- package/dist/plugins/one-tap/index.d.ts +2 -6
- package/dist/plugins/one-tap/index.mjs +4 -4
- package/dist/plugins/one-time-token/index.cjs +7 -6
- package/dist/plugins/one-time-token/index.d.cts +9 -11
- package/dist/plugins/one-time-token/index.d.mts +9 -11
- package/dist/plugins/one-time-token/index.d.ts +9 -11
- package/dist/plugins/one-time-token/index.mjs +7 -6
- package/dist/plugins/open-api/index.cjs +21 -23
- package/dist/plugins/open-api/index.d.cts +6 -4
- package/dist/plugins/open-api/index.d.mts +6 -4
- package/dist/plugins/open-api/index.d.ts +6 -4
- package/dist/plugins/open-api/index.mjs +17 -19
- package/dist/plugins/organization/access/index.d.cts +1 -2
- package/dist/plugins/organization/access/index.d.mts +1 -2
- package/dist/plugins/organization/access/index.d.ts +1 -2
- package/dist/plugins/organization/index.cjs +5 -4
- package/dist/plugins/organization/index.d.cts +811 -1130
- package/dist/plugins/organization/index.d.mts +811 -1130
- package/dist/plugins/organization/index.d.ts +811 -1130
- package/dist/plugins/organization/index.mjs +5 -4
- package/dist/plugins/passkey/index.cjs +35 -19
- package/dist/plugins/passkey/index.d.cts +37 -60
- package/dist/plugins/passkey/index.d.mts +37 -60
- package/dist/plugins/passkey/index.d.ts +37 -60
- package/dist/plugins/passkey/index.mjs +13 -11
- package/dist/plugins/phone-number/index.cjs +36 -22
- package/dist/plugins/phone-number/index.d.cts +15 -66
- package/dist/plugins/phone-number/index.d.mts +15 -66
- package/dist/plugins/phone-number/index.d.ts +15 -66
- package/dist/plugins/phone-number/index.mjs +11 -11
- package/dist/plugins/sso/index.cjs +56 -42
- package/dist/plugins/sso/index.d.cts +32 -119
- package/dist/plugins/sso/index.d.mts +32 -119
- package/dist/plugins/sso/index.d.ts +32 -119
- package/dist/plugins/sso/index.mjs +31 -31
- package/dist/plugins/two-factor/index.cjs +43 -29
- package/dist/plugins/two-factor/index.d.cts +30 -78
- package/dist/plugins/two-factor/index.d.mts +30 -78
- package/dist/plugins/two-factor/index.d.ts +30 -78
- package/dist/plugins/two-factor/index.mjs +13 -13
- package/dist/plugins/username/index.cjs +25 -15
- package/dist/plugins/username/index.d.cts +10 -22
- package/dist/plugins/username/index.d.mts +10 -22
- package/dist/plugins/username/index.d.ts +10 -22
- package/dist/plugins/username/index.mjs +9 -13
- package/dist/shared/{better-auth.CcqPcsQw.d.ts → better-auth.4fWbQEA_.d.ts} +2 -2
- package/dist/shared/{better-auth.Cs9tnjbm.d.mts → better-auth.AjMhD7yz.d.mts} +44 -103
- package/dist/shared/{better-auth.CTYN90cw.cjs → better-auth.BFWSzd99.cjs} +5 -5
- package/dist/shared/{better-auth.DcWKCjjf.cjs → better-auth.BIMq4RPW.cjs} +53 -39
- package/dist/shared/{better-auth.M3B56FHf.d.cts → better-auth.BMs5wQpJ.d.ts} +45 -104
- package/dist/shared/{better-auth.CeC_YPBC.mjs → better-auth.BRkCkvkr.mjs} +4 -4
- package/dist/shared/{better-auth.BGqNvLSj.d.mts → better-auth.BTGXn6Wu.d.ts} +4 -3
- package/dist/shared/{better-auth.CkL-IpXS.cjs → better-auth.BUiVJvLO.cjs} +1 -1
- package/dist/shared/{better-auth.1U46rRCb.d.ts → better-auth.BalZRjl9.d.cts} +642 -1700
- package/dist/shared/{better-auth.CKaSQSiK.d.cts → better-auth.BbVHEJaq.d.mts} +642 -1700
- package/dist/shared/{better-auth.BjlnHtWM.mjs → better-auth.BdrJBkRw.mjs} +88 -45
- package/dist/shared/{better-auth.dkmWAMtv.d.mts → better-auth.Beq6UEbm.d.cts} +2 -2
- package/dist/shared/{better-auth.Lq361xtr.mjs → better-auth.BluEOpoj.mjs} +1 -1
- package/dist/shared/{better-auth.fsvwNeUx.mjs → better-auth.CGrHn1Ih.mjs} +1 -1
- package/dist/shared/{better-auth.DXFEde7S.d.mts → better-auth.CTHn60Kj.d.ts} +642 -1700
- package/dist/shared/{better-auth.B7cZ2juS.cjs → better-auth.CeLY0dLy.cjs} +1 -2
- package/dist/shared/{better-auth.KCmQsDm-.cjs → better-auth.Cg1dmr5y.cjs} +1 -1
- package/dist/shared/{better-auth.C9r4-D4D.cjs → better-auth.CgWmIFz1.cjs} +188 -75
- package/dist/shared/{better-auth.Bl6kZMTz.d.ts → better-auth.CmoI7VL1.d.ts} +5 -5
- package/dist/shared/{better-auth.DPYZ4lEW.mjs → better-auth.Cx_7nFZg.mjs} +78 -73
- package/dist/shared/{better-auth.CZaGcPOu.d.cts → better-auth.D3D9uwta.d.cts} +4 -3
- package/dist/shared/{better-auth.CiEL_3L9.d.mts → better-auth.D5KZfhN9.d.cts} +5 -5
- package/dist/shared/{better-auth.CxiUYpyi.mjs → better-auth.D6kyMvXP.mjs} +189 -77
- package/dist/shared/{better-auth.YhbwFO4I.cjs → better-auth.DBBvVNHz.cjs} +78 -73
- package/dist/shared/better-auth.DE4w3zEf.cjs +88 -0
- package/dist/shared/better-auth.DI0OyFsZ.cjs +44 -0
- package/dist/shared/{better-auth._dAJf_oa.cjs → better-auth.DOgvYMa8.cjs} +1 -1
- package/dist/shared/{better-auth.DEj39-fy.mjs → better-auth.DRCA5tuq.mjs} +1 -1
- package/dist/shared/better-auth.DUwl8-HL.mjs +85 -0
- package/dist/shared/{better-auth.BQ4_OHi3.cjs → better-auth.DZTOcfJ2.cjs} +66 -42
- package/dist/shared/{better-auth.iKoUsdFE.mjs → better-auth.DcfNPS8q.mjs} +1 -2
- package/dist/shared/{better-auth.wF952O4S.d.ts → better-auth.DgdqIOZX.d.cts} +45 -104
- package/dist/shared/{better-auth.B1UvcDzZ.mjs → better-auth.DwzM-9N1.mjs} +1 -1
- package/dist/shared/{better-auth.CGOCIshw.cjs → better-auth.DzBLnNed.cjs} +1 -1
- package/dist/shared/{better-auth.B7DsbyxZ.cjs → better-auth.Gx72AqAK.cjs} +4 -4
- package/dist/shared/{better-auth.J-FkYMpb.mjs → better-auth.H13TSpTJ.mjs} +5 -5
- package/dist/shared/{better-auth.Bvj_fvZF.d.cts → better-auth.IsSv8odO.d.mts} +5 -5
- package/dist/shared/{better-auth.DTKHr5aa.cjs → better-auth.JhO62CUu.cjs} +154 -97
- package/dist/shared/{better-auth.BJuT8WiU.mjs → better-auth.Rwb5CwA2.mjs} +46 -36
- package/dist/shared/{better-auth.9XhOL8gb.d.cts → better-auth.ZSfSbnQT.d.cts} +2 -3
- package/dist/shared/{better-auth.9XhOL8gb.d.mts → better-auth.ZSfSbnQT.d.mts} +2 -3
- package/dist/shared/{better-auth.9XhOL8gb.d.ts → better-auth.ZSfSbnQT.d.ts} +2 -3
- package/dist/shared/{better-auth.Di4b3h9T.cjs → better-auth.clHUhzUm.cjs} +171 -138
- package/dist/shared/{better-auth.BP35Nbhe.d.cts → better-auth.fpvODASA.d.mts} +2 -2
- package/dist/shared/{better-auth.C3eCZf9N.mjs → better-auth.gBl3F_xa.mjs} +1 -1
- package/dist/shared/{better-auth.dm850UlW.mjs → better-auth.jhSvrQhK.mjs} +100 -81
- package/dist/shared/{better-auth.Cc72UxUH.mjs → better-auth.n2KFGwjY.mjs} +1 -1
- package/dist/shared/{better-auth.D1VhCXSa.d.ts → better-auth.nM381a9n.d.mts} +4 -3
- package/dist/social-providers/index.cjs +3 -3
- package/dist/social-providers/index.d.cts +3 -3
- package/dist/social-providers/index.d.mts +3 -3
- package/dist/social-providers/index.d.ts +3 -3
- package/dist/social-providers/index.mjs +3 -3
- package/dist/test-utils/index.cjs +13 -12
- package/dist/test-utils/index.d.cts +1555 -3105
- package/dist/test-utils/index.d.mts +1555 -3105
- package/dist/test-utils/index.d.ts +1555 -3105
- package/dist/test-utils/index.mjs +13 -12
- package/dist/types/index.d.cts +7 -5
- package/dist/types/index.d.mts +7 -5
- package/dist/types/index.d.ts +7 -5
- package/package.json +2 -2
- package/dist/shared/better-auth.BG6vHVNT.cjs +0 -30
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { APIError } from 'better-call';
|
|
3
|
-
import { f as createAuthMiddleware, j as getSessionFromCtx, i as createAuthEndpoint } from './better-auth.
|
|
3
|
+
import { f as createAuthMiddleware, j as getSessionFromCtx, i as createAuthEndpoint } from './better-auth.jhSvrQhK.mjs';
|
|
4
|
+
import 'zod/v4';
|
|
4
5
|
import { setSessionCookie, deleteSessionCookie } from '../cookies/index.mjs';
|
|
5
|
-
import { m as mergeSchema } from './better-auth.
|
|
6
|
+
import { m as mergeSchema } from './better-auth.n2KFGwjY.mjs';
|
|
6
7
|
import './better-auth.8zoxzg-F.mjs';
|
|
7
8
|
import './better-auth.DBGfIDnh.mjs';
|
|
8
9
|
import 'defu';
|
|
@@ -26,6 +27,42 @@ const ADMIN_ERROR_CODES = {
|
|
|
26
27
|
BANNED_USER: "You have been banned from this application"
|
|
27
28
|
};
|
|
28
29
|
|
|
30
|
+
const schema = {
|
|
31
|
+
user: {
|
|
32
|
+
fields: {
|
|
33
|
+
role: {
|
|
34
|
+
type: "string",
|
|
35
|
+
required: false,
|
|
36
|
+
input: false
|
|
37
|
+
},
|
|
38
|
+
banned: {
|
|
39
|
+
type: "boolean",
|
|
40
|
+
defaultValue: false,
|
|
41
|
+
required: false,
|
|
42
|
+
input: false
|
|
43
|
+
},
|
|
44
|
+
banReason: {
|
|
45
|
+
type: "string",
|
|
46
|
+
required: false,
|
|
47
|
+
input: false
|
|
48
|
+
},
|
|
49
|
+
banExpires: {
|
|
50
|
+
type: "date",
|
|
51
|
+
required: false,
|
|
52
|
+
input: false
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
session: {
|
|
57
|
+
fields: {
|
|
58
|
+
impersonatedBy: {
|
|
59
|
+
type: "string",
|
|
60
|
+
required: false
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
29
66
|
function parseRoles(roles) {
|
|
30
67
|
return Array.isArray(roles) ? roles.join(",") : roles;
|
|
31
68
|
}
|
|
@@ -127,15 +164,15 @@ const admin = (options) => {
|
|
|
127
164
|
{
|
|
128
165
|
method: "POST",
|
|
129
166
|
body: z.object({
|
|
130
|
-
userId: z.coerce.string({
|
|
167
|
+
userId: z.coerce.string().meta({
|
|
131
168
|
description: "The user id"
|
|
132
169
|
}),
|
|
133
170
|
role: z.union([
|
|
134
|
-
z.string({
|
|
171
|
+
z.string().meta({
|
|
135
172
|
description: "The role to set. `admin` or `user` by default"
|
|
136
173
|
}),
|
|
137
174
|
z.array(
|
|
138
|
-
z.string({
|
|
175
|
+
z.string().meta({
|
|
139
176
|
description: "The roles to set. `admin` or `user` by default"
|
|
140
177
|
})
|
|
141
178
|
)
|
|
@@ -201,21 +238,21 @@ const admin = (options) => {
|
|
|
201
238
|
{
|
|
202
239
|
method: "POST",
|
|
203
240
|
body: z.object({
|
|
204
|
-
email: z.string({
|
|
241
|
+
email: z.string().meta({
|
|
205
242
|
description: "The email of the user"
|
|
206
243
|
}),
|
|
207
|
-
password: z.string({
|
|
244
|
+
password: z.string().meta({
|
|
208
245
|
description: "The password of the user"
|
|
209
246
|
}),
|
|
210
|
-
name: z.string({
|
|
247
|
+
name: z.string().meta({
|
|
211
248
|
description: "The name of the user"
|
|
212
249
|
}),
|
|
213
250
|
role: z.union([
|
|
214
|
-
z.string({
|
|
251
|
+
z.string().meta({
|
|
215
252
|
description: "The role of the user"
|
|
216
253
|
}),
|
|
217
254
|
z.array(
|
|
218
|
-
z.string({
|
|
255
|
+
z.string().meta({
|
|
219
256
|
description: "The roles of user"
|
|
220
257
|
})
|
|
221
258
|
)
|
|
@@ -224,7 +261,7 @@ const admin = (options) => {
|
|
|
224
261
|
* extra fields for user
|
|
225
262
|
*/
|
|
226
263
|
data: z.optional(
|
|
227
|
-
z.record(z.any(), {
|
|
264
|
+
z.record(z.any(), z.any()).meta({
|
|
228
265
|
description: "Extra fields for the user. Including custom additional fields."
|
|
229
266
|
})
|
|
230
267
|
)
|
|
@@ -285,12 +322,15 @@ const admin = (options) => {
|
|
|
285
322
|
message: ADMIN_ERROR_CODES.USER_ALREADY_EXISTS
|
|
286
323
|
});
|
|
287
324
|
}
|
|
288
|
-
const user = await ctx.context.internalAdapter.createUser(
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
325
|
+
const user = await ctx.context.internalAdapter.createUser(
|
|
326
|
+
{
|
|
327
|
+
email: ctx.body.email,
|
|
328
|
+
name: ctx.body.name,
|
|
329
|
+
role: (ctx.body.role && parseRoles(ctx.body.role)) ?? options?.defaultRole ?? "user",
|
|
330
|
+
...ctx.body.data
|
|
331
|
+
},
|
|
332
|
+
ctx
|
|
333
|
+
);
|
|
294
334
|
if (!user) {
|
|
295
335
|
throw new APIError("INTERNAL_SERVER_ERROR", {
|
|
296
336
|
message: ADMIN_ERROR_CODES.FAILED_TO_CREATE_USER
|
|
@@ -319,34 +359,34 @@ const admin = (options) => {
|
|
|
319
359
|
method: "GET",
|
|
320
360
|
use: [adminMiddleware],
|
|
321
361
|
query: z.object({
|
|
322
|
-
searchValue: z.string({
|
|
362
|
+
searchValue: z.string().meta({
|
|
323
363
|
description: "The value to search for"
|
|
324
364
|
}).optional(),
|
|
325
|
-
searchField: z.enum(["email", "name"]
|
|
365
|
+
searchField: z.enum(["email", "name"]).meta({
|
|
326
366
|
description: "The field to search in, defaults to email. Can be `email` or `name`"
|
|
327
367
|
}).optional(),
|
|
328
|
-
searchOperator: z.enum(["contains", "starts_with", "ends_with"]
|
|
368
|
+
searchOperator: z.enum(["contains", "starts_with", "ends_with"]).meta({
|
|
329
369
|
description: "The operator to use for the search. Can be `contains`, `starts_with` or `ends_with`"
|
|
330
370
|
}).optional(),
|
|
331
|
-
limit: z.string({
|
|
371
|
+
limit: z.string().meta({
|
|
332
372
|
description: "The number of users to return"
|
|
333
373
|
}).or(z.number()).optional(),
|
|
334
|
-
offset: z.string({
|
|
374
|
+
offset: z.string().meta({
|
|
335
375
|
description: "The offset to start from"
|
|
336
376
|
}).or(z.number()).optional(),
|
|
337
|
-
sortBy: z.string({
|
|
377
|
+
sortBy: z.string().meta({
|
|
338
378
|
description: "The field to sort by"
|
|
339
379
|
}).optional(),
|
|
340
|
-
sortDirection: z.enum(["asc", "desc"]
|
|
380
|
+
sortDirection: z.enum(["asc", "desc"]).meta({
|
|
341
381
|
description: "The direction to sort by"
|
|
342
382
|
}).optional(),
|
|
343
|
-
filterField: z.string({
|
|
383
|
+
filterField: z.string().meta({
|
|
344
384
|
description: "The field to filter by"
|
|
345
385
|
}).optional(),
|
|
346
|
-
filterValue: z.string({
|
|
386
|
+
filterValue: z.string().meta({
|
|
347
387
|
description: "The value to filter by"
|
|
348
388
|
}).or(z.number()).or(z.boolean()).optional(),
|
|
349
|
-
filterOperator: z.enum(["eq", "ne", "lt", "lte", "gt", "gte", "contains"]
|
|
389
|
+
filterOperator: z.enum(["eq", "ne", "lt", "lte", "gt", "gte", "contains"]).meta({
|
|
350
390
|
description: "The operator to use for the filter"
|
|
351
391
|
}).optional()
|
|
352
392
|
}),
|
|
@@ -451,7 +491,7 @@ const admin = (options) => {
|
|
|
451
491
|
method: "POST",
|
|
452
492
|
use: [adminMiddleware],
|
|
453
493
|
body: z.object({
|
|
454
|
-
userId: z.coerce.string({
|
|
494
|
+
userId: z.coerce.string().meta({
|
|
455
495
|
description: "The user id"
|
|
456
496
|
})
|
|
457
497
|
}),
|
|
@@ -511,7 +551,7 @@ const admin = (options) => {
|
|
|
511
551
|
{
|
|
512
552
|
method: "POST",
|
|
513
553
|
body: z.object({
|
|
514
|
-
userId: z.coerce.string({
|
|
554
|
+
userId: z.coerce.string().meta({
|
|
515
555
|
description: "The user id"
|
|
516
556
|
})
|
|
517
557
|
}),
|
|
@@ -575,19 +615,19 @@ const admin = (options) => {
|
|
|
575
615
|
{
|
|
576
616
|
method: "POST",
|
|
577
617
|
body: z.object({
|
|
578
|
-
userId: z.coerce.string({
|
|
618
|
+
userId: z.coerce.string().meta({
|
|
579
619
|
description: "The user id"
|
|
580
620
|
}),
|
|
581
621
|
/**
|
|
582
622
|
* Reason for the ban
|
|
583
623
|
*/
|
|
584
|
-
banReason: z.string({
|
|
624
|
+
banReason: z.string().meta({
|
|
585
625
|
description: "The reason for the ban"
|
|
586
626
|
}).optional(),
|
|
587
627
|
/**
|
|
588
628
|
* Number of seconds until the ban expires
|
|
589
629
|
*/
|
|
590
|
-
banExpiresIn: z.number({
|
|
630
|
+
banExpiresIn: z.number().meta({
|
|
591
631
|
description: "The number of seconds until the ban expires"
|
|
592
632
|
}).optional()
|
|
593
633
|
}),
|
|
@@ -658,7 +698,7 @@ const admin = (options) => {
|
|
|
658
698
|
{
|
|
659
699
|
method: "POST",
|
|
660
700
|
body: z.object({
|
|
661
|
-
userId: z.coerce.string({
|
|
701
|
+
userId: z.coerce.string().meta({
|
|
662
702
|
description: "The user id"
|
|
663
703
|
})
|
|
664
704
|
}),
|
|
@@ -808,7 +848,7 @@ const admin = (options) => {
|
|
|
808
848
|
{
|
|
809
849
|
method: "POST",
|
|
810
850
|
body: z.object({
|
|
811
|
-
sessionToken: z.string({
|
|
851
|
+
sessionToken: z.string().meta({
|
|
812
852
|
description: "The session token"
|
|
813
853
|
})
|
|
814
854
|
}),
|
|
@@ -866,7 +906,7 @@ const admin = (options) => {
|
|
|
866
906
|
{
|
|
867
907
|
method: "POST",
|
|
868
908
|
body: z.object({
|
|
869
|
-
userId: z.coerce.string({
|
|
909
|
+
userId: z.coerce.string().meta({
|
|
870
910
|
description: "The user id"
|
|
871
911
|
})
|
|
872
912
|
}),
|
|
@@ -922,7 +962,7 @@ const admin = (options) => {
|
|
|
922
962
|
{
|
|
923
963
|
method: "POST",
|
|
924
964
|
body: z.object({
|
|
925
|
-
userId: z.coerce.string({
|
|
965
|
+
userId: z.coerce.string().meta({
|
|
926
966
|
description: "The user id"
|
|
927
967
|
})
|
|
928
968
|
}),
|
|
@@ -986,10 +1026,10 @@ const admin = (options) => {
|
|
|
986
1026
|
{
|
|
987
1027
|
method: "POST",
|
|
988
1028
|
body: z.object({
|
|
989
|
-
newPassword: z.string({
|
|
1029
|
+
newPassword: z.string().meta({
|
|
990
1030
|
description: "The new password"
|
|
991
1031
|
}),
|
|
992
|
-
userId: z.coerce.string({
|
|
1032
|
+
userId: z.coerce.string().meta({
|
|
993
1033
|
description: "The user id"
|
|
994
1034
|
})
|
|
995
1035
|
}),
|
|
@@ -1151,40 +1191,5 @@ const admin = (options) => {
|
|
|
1151
1191
|
options
|
|
1152
1192
|
};
|
|
1153
1193
|
};
|
|
1154
|
-
const schema = {
|
|
1155
|
-
user: {
|
|
1156
|
-
fields: {
|
|
1157
|
-
role: {
|
|
1158
|
-
type: "string",
|
|
1159
|
-
required: false,
|
|
1160
|
-
input: false
|
|
1161
|
-
},
|
|
1162
|
-
banned: {
|
|
1163
|
-
type: "boolean",
|
|
1164
|
-
defaultValue: false,
|
|
1165
|
-
required: false,
|
|
1166
|
-
input: false
|
|
1167
|
-
},
|
|
1168
|
-
banReason: {
|
|
1169
|
-
type: "string",
|
|
1170
|
-
required: false,
|
|
1171
|
-
input: false
|
|
1172
|
-
},
|
|
1173
|
-
banExpires: {
|
|
1174
|
-
type: "date",
|
|
1175
|
-
required: false,
|
|
1176
|
-
input: false
|
|
1177
|
-
}
|
|
1178
|
-
}
|
|
1179
|
-
},
|
|
1180
|
-
session: {
|
|
1181
|
-
fields: {
|
|
1182
|
-
impersonatedBy: {
|
|
1183
|
-
type: "string",
|
|
1184
|
-
required: false
|
|
1185
|
-
}
|
|
1186
|
-
}
|
|
1187
|
-
}
|
|
1188
|
-
};
|
|
1189
1194
|
|
|
1190
1195
|
export { admin as a };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as LiteralString, a as Prettify } from './better-auth.
|
|
2
|
-
import
|
|
1
|
+
import { L as LiteralString, a as Prettify } from './better-auth.ZSfSbnQT.cjs';
|
|
2
|
+
import * as z from 'zod/v4';
|
|
3
3
|
|
|
4
4
|
interface OAuth2Tokens {
|
|
5
5
|
tokenType?: string;
|
|
@@ -993,6 +993,7 @@ interface DropboxProfile {
|
|
|
993
993
|
profile_photo_url: string;
|
|
994
994
|
}
|
|
995
995
|
interface DropboxOptions extends ProviderOptions<DropboxProfile> {
|
|
996
|
+
accessType?: "offline" | "online" | "legacy";
|
|
996
997
|
}
|
|
997
998
|
declare const dropbox: (options: DropboxOptions) => {
|
|
998
999
|
id: "dropbox";
|
|
@@ -1929,7 +1930,7 @@ declare const apple: (options: AppleOptions) => {
|
|
|
1929
1930
|
} | null>;
|
|
1930
1931
|
options: AppleOptions;
|
|
1931
1932
|
};
|
|
1932
|
-
declare const getApplePublicKey: (kid: string) => Promise<
|
|
1933
|
+
declare const getApplePublicKey: (kid: string) => Promise<Uint8Array<ArrayBufferLike> | CryptoKey>;
|
|
1933
1934
|
|
|
1934
1935
|
declare const socialProviders: {
|
|
1935
1936
|
apple: (options: AppleOptions) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as GenericEndpointContext } from './better-auth.
|
|
1
|
+
import { G as GenericEndpointContext } from './better-auth.BalZRjl9.cjs';
|
|
2
2
|
|
|
3
3
|
declare function generateState(c: GenericEndpointContext, link?: {
|
|
4
4
|
email: string;
|
|
@@ -8,16 +8,16 @@ declare function generateState(c: GenericEndpointContext, link?: {
|
|
|
8
8
|
codeVerifier: string;
|
|
9
9
|
}>;
|
|
10
10
|
declare function parseState(c: GenericEndpointContext): Promise<{
|
|
11
|
+
callbackURL: string;
|
|
11
12
|
codeVerifier: string;
|
|
12
13
|
expiresAt: number;
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
errorURL?: string | undefined;
|
|
15
|
+
newUserURL?: string | undefined;
|
|
15
16
|
link?: {
|
|
16
17
|
email: string;
|
|
17
18
|
userId: string;
|
|
18
19
|
} | undefined;
|
|
19
|
-
|
|
20
|
-
newUserURL?: string | undefined;
|
|
20
|
+
requestSignUp?: boolean | undefined;
|
|
21
21
|
}>;
|
|
22
22
|
|
|
23
23
|
export { generateState as g, parseState as p };
|