better-auth 1.3.13 → 1.3.15
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.d.cts +1 -1
- package/dist/adapters/drizzle-adapter/index.d.mts +1 -1
- package/dist/adapters/drizzle-adapter/index.d.ts +1 -1
- package/dist/adapters/index.d.cts +2 -2
- package/dist/adapters/index.d.mts +2 -2
- package/dist/adapters/index.d.ts +2 -2
- package/dist/adapters/kysely-adapter/index.cjs +1 -1
- package/dist/adapters/kysely-adapter/index.d.cts +1 -1
- package/dist/adapters/kysely-adapter/index.d.mts +1 -1
- package/dist/adapters/kysely-adapter/index.d.ts +1 -1
- package/dist/adapters/kysely-adapter/index.mjs +1 -1
- package/dist/adapters/memory-adapter/index.cjs +1 -1
- package/dist/adapters/memory-adapter/index.d.cts +1 -1
- package/dist/adapters/memory-adapter/index.d.mts +1 -1
- package/dist/adapters/memory-adapter/index.d.ts +1 -1
- package/dist/adapters/memory-adapter/index.mjs +1 -1
- 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.d.cts +1 -1
- package/dist/adapters/prisma-adapter/index.d.mts +1 -1
- package/dist/adapters/prisma-adapter/index.d.ts +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 +3 -3
- 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 +5 -5
- package/dist/client/index.cjs +3 -3
- package/dist/client/index.d.cts +3 -3
- package/dist/client/index.d.mts +3 -3
- package/dist/client/index.d.ts +3 -3
- package/dist/client/index.mjs +3 -3
- package/dist/client/plugins/index.d.cts +3 -3
- package/dist/client/plugins/index.d.mts +3 -3
- package/dist/client/plugins/index.d.ts +3 -3
- package/dist/client/react/index.cjs +2 -2
- package/dist/client/react/index.d.cts +3 -3
- package/dist/client/react/index.d.mts +3 -3
- package/dist/client/react/index.d.ts +3 -3
- package/dist/client/react/index.mjs +2 -2
- package/dist/client/solid/index.cjs +2 -2
- package/dist/client/solid/index.d.cts +9 -9
- package/dist/client/solid/index.d.mts +9 -9
- package/dist/client/solid/index.d.ts +9 -9
- package/dist/client/solid/index.mjs +2 -2
- package/dist/client/svelte/index.cjs +2 -2
- package/dist/client/svelte/index.d.cts +3 -3
- package/dist/client/svelte/index.d.mts +3 -3
- package/dist/client/svelte/index.d.ts +3 -3
- package/dist/client/svelte/index.mjs +2 -2
- package/dist/client/vue/index.cjs +2 -2
- package/dist/client/vue/index.d.cts +3 -3
- package/dist/client/vue/index.d.mts +3 -3
- package/dist/client/vue/index.d.ts +3 -3
- package/dist/client/vue/index.mjs +2 -2
- package/dist/cookies/index.cjs +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/cookies/index.mjs +1 -1
- package/dist/db/index.cjs +3 -3
- 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 +3 -3
- package/dist/index.cjs +7 -7
- package/dist/index.d.cts +4 -4
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +7 -7
- package/dist/integrations/next-js.cjs +4 -4
- 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 +4 -4
- 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 +4 -4
- 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 +4 -4
- package/dist/integrations/svelte-kit.cjs +3 -3
- 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/integrations/svelte-kit.mjs +3 -3
- package/dist/oauth2/index.cjs +3 -3
- 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/oauth2/index.mjs +3 -3
- package/dist/plugins/admin/index.cjs +4 -4
- package/dist/plugins/admin/index.d.cts +16 -1
- package/dist/plugins/admin/index.d.mts +16 -1
- package/dist/plugins/admin/index.d.ts +16 -1
- package/dist/plugins/admin/index.mjs +4 -4
- package/dist/plugins/anonymous/index.cjs +3 -3
- 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 +3 -3
- package/dist/plugins/bearer/index.cjs +3 -3
- 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 +3 -3
- 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 +7 -9
- package/dist/plugins/custom-session/index.d.cts +1 -1
- package/dist/plugins/custom-session/index.d.mts +1 -1
- package/dist/plugins/custom-session/index.d.ts +1 -1
- package/dist/plugins/custom-session/index.mjs +7 -9
- package/dist/plugins/device-authorization/index.cjs +18 -50
- package/dist/plugins/device-authorization/index.d.cts +1 -1
- package/dist/plugins/device-authorization/index.d.mts +1 -1
- package/dist/plugins/device-authorization/index.d.ts +1 -1
- package/dist/plugins/device-authorization/index.mjs +18 -50
- package/dist/plugins/email-otp/index.cjs +20 -60
- 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 +20 -60
- package/dist/plugins/generic-oauth/index.cjs +24 -42
- package/dist/plugins/generic-oauth/index.d.cts +1 -1
- package/dist/plugins/generic-oauth/index.d.mts +1 -1
- package/dist/plugins/generic-oauth/index.d.ts +1 -1
- package/dist/plugins/generic-oauth/index.mjs +24 -42
- package/dist/plugins/haveibeenpwned/index.cjs +3 -3
- 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 +3 -3
- package/dist/plugins/index.cjs +10 -9
- 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 +12 -11
- package/dist/plugins/jwt/index.cjs +3 -3
- 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 +3 -3
- package/dist/plugins/magic-link/index.cjs +20 -30
- package/dist/plugins/magic-link/index.mjs +20 -30
- package/dist/plugins/multi-session/index.cjs +5 -9
- 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 +5 -9
- package/dist/plugins/oauth-proxy/index.cjs +8 -10
- package/dist/plugins/oauth-proxy/index.d.cts +2 -1
- package/dist/plugins/oauth-proxy/index.d.mts +2 -1
- package/dist/plugins/oauth-proxy/index.d.ts +2 -1
- package/dist/plugins/oauth-proxy/index.mjs +8 -10
- package/dist/plugins/oidc-provider/index.cjs +4 -4
- package/dist/plugins/oidc-provider/index.d.cts +9 -9
- package/dist/plugins/oidc-provider/index.d.mts +9 -9
- package/dist/plugins/oidc-provider/index.d.ts +9 -9
- package/dist/plugins/oidc-provider/index.mjs +4 -4
- package/dist/plugins/one-tap/index.cjs +6 -6
- package/dist/plugins/one-tap/index.mjs +6 -6
- package/dist/plugins/one-time-token/index.cjs +6 -6
- 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 +6 -6
- package/dist/plugins/open-api/index.cjs +3 -3
- 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 +3 -3
- package/dist/plugins/organization/access/index.d.cts +25 -25
- package/dist/plugins/organization/access/index.d.mts +25 -25
- package/dist/plugins/organization/access/index.d.ts +25 -25
- package/dist/plugins/organization/index.cjs +6 -6
- package/dist/plugins/organization/index.d.cts +77 -13
- package/dist/plugins/organization/index.d.mts +77 -13
- package/dist/plugins/organization/index.d.ts +77 -13
- package/dist/plugins/organization/index.mjs +6 -6
- package/dist/plugins/passkey/index.cjs +14 -18
- package/dist/plugins/passkey/index.d.cts +2 -2
- package/dist/plugins/passkey/index.d.mts +2 -2
- package/dist/plugins/passkey/index.d.ts +2 -2
- package/dist/plugins/passkey/index.mjs +14 -18
- package/dist/plugins/phone-number/index.cjs +23 -39
- 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 +23 -39
- package/dist/plugins/siwe/index.cjs +3 -3
- package/dist/plugins/siwe/index.d.cts +1 -1
- package/dist/plugins/siwe/index.d.mts +1 -1
- package/dist/plugins/siwe/index.d.ts +1 -1
- package/dist/plugins/siwe/index.mjs +3 -3
- package/dist/plugins/sso/index.cjs +61 -87
- package/dist/plugins/sso/index.d.cts +3 -3
- package/dist/plugins/sso/index.d.mts +3 -3
- package/dist/plugins/sso/index.d.ts +3 -3
- package/dist/plugins/sso/index.mjs +61 -87
- package/dist/plugins/two-factor/index.cjs +18 -48
- 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 +18 -48
- package/dist/plugins/username/index.cjs +31 -16
- package/dist/plugins/username/index.d.cts +3 -3
- package/dist/plugins/username/index.d.mts +3 -3
- package/dist/plugins/username/index.d.ts +3 -3
- package/dist/plugins/username/index.mjs +31 -16
- package/dist/shared/{better-auth.DNMTw_ds.d.ts → better-auth.6RZwqXI-.d.ts} +1 -1
- package/dist/shared/{better-auth.Btbv22jM.mjs → better-auth.7DsuGNVf.mjs} +5 -3
- package/dist/shared/{better-auth.C1AWk7z7.mjs → better-auth.AYS43XM1.mjs} +1 -1
- package/dist/shared/{better-auth.g33XFa_C.mjs → better-auth.B-3-wkBV.mjs} +167 -262
- package/dist/shared/{better-auth.BkcRiga0.cjs → better-auth.B-RhOtHf.cjs} +1 -1
- package/dist/shared/{better-auth.DTgTiHPJ.d.ts → better-auth.B1CNK_q_.d.ts} +1 -1
- package/dist/shared/{better-auth.BnOSz3eR.mjs → better-auth.BBFsjzvB.mjs} +2 -2
- package/dist/shared/{better-auth.Bhva6lEh.cjs → better-auth.BBk8MRta.cjs} +1 -1
- package/dist/shared/{better-auth.BYskLPvJ.d.ts → better-auth.BCHg51sY.d.ts} +1 -1
- package/dist/shared/{better-auth.C1Tqa_El.d.cts → better-auth.BTUgO__s.d.mts} +1 -1
- package/dist/shared/{better-auth.B5O-5tFi.cjs → better-auth.BclXpYOz.cjs} +5 -3
- package/dist/shared/{better-auth.DHi8l3iG.d.mts → better-auth.BeDYIF5-.d.mts} +1 -1
- package/dist/shared/{better-auth.yovXNUaS.d.cts → better-auth.BeOpqAwl.d.cts} +1 -1
- package/dist/shared/{better-auth.Brg-UO7k.d.ts → better-auth.BsnsCAjn.d.ts} +7 -7
- package/dist/shared/{better-auth.fV_ra52g.mjs → better-auth.C3bLnul-.mjs} +1 -1
- package/dist/shared/{better-auth.D6pGomIg.cjs → better-auth.C5s1d_o-.cjs} +75 -150
- package/dist/shared/{better-auth.C29_dxUJ.cjs → better-auth.CL5zQvRZ.cjs} +167 -262
- package/dist/shared/{better-auth.C0-0BnjK.d.mts → better-auth.CkCyjQ6r.d.mts} +1 -1
- package/dist/shared/{better-auth.CBY7cUGy.mjs → better-auth.Co88PbP3.mjs} +6 -10
- package/dist/shared/{better-auth.BPua9lvR.mjs → better-auth.D-4EtUes.mjs} +75 -150
- package/dist/shared/{better-auth.DXGtScCP.cjs → better-auth.D2444EHu.cjs} +2 -2
- package/dist/shared/{better-auth.DTyvXiMc.cjs → better-auth.DCOXb_2e.cjs} +48 -84
- package/dist/shared/{better-auth.DRukcsOo.d.mts → better-auth.DDOCnCqi.d.cts} +1 -1
- package/dist/shared/{better-auth.B1ufdjSo.mjs → better-auth.DFfA4Mzz.mjs} +5 -5
- package/dist/shared/{better-auth.CXM9s0dx.cjs → better-auth.DIfV2UBl.cjs} +1 -1
- package/dist/shared/{better-auth.spSlDaxD.cjs → better-auth.DP5SyJ_2.cjs} +68 -117
- package/dist/shared/{better-auth.DhsGZ30Q.cjs → better-auth.DUNU0obG.cjs} +1 -1
- package/dist/shared/{better-auth.Ddv1-cj-.mjs → better-auth.DUTxy-hg.mjs} +2 -2
- package/dist/shared/{better-auth.D07k8aB_.d.cts → better-auth.DY9WffSn.d.cts} +1 -1
- package/dist/shared/{better-auth.Bo_XNm3Z.mjs → better-auth.Df_5rmaV.mjs} +24 -48
- package/dist/shared/{better-auth.DL8idXrv.mjs → better-auth.DhQzyejE.mjs} +1 -1
- package/dist/shared/{better-auth.Gu1qAjVj.d.mts → better-auth.DhRmxPro.d.mts} +7 -7
- package/dist/shared/{better-auth.Bb_sp3q4.cjs → better-auth.DnBI2Nus.cjs} +5 -5
- package/dist/shared/{better-auth.Dsq5BCiY.mjs → better-auth.DteMRrRX.mjs} +68 -117
- package/dist/shared/{better-auth.demy6Fla.cjs → better-auth.DxN8-4Pz.cjs} +24 -48
- package/dist/shared/{better-auth.2jEckJ7k.cjs → better-auth.SS_wBML-.cjs} +2 -2
- package/dist/shared/{better-auth.3naUdTMW.mjs → better-auth.T3Ux10v9.mjs} +1 -1
- package/dist/shared/{better-auth.B1kKIM0o.d.cts → better-auth.U9CXSJA_.d.cts} +7 -7
- package/dist/shared/{better-auth.CvVm_hFg.cjs → better-auth.iE8wqp5_.cjs} +1 -1
- package/dist/shared/{better-auth.ffWeg50w.mjs → better-auth.msGOU0m9.mjs} +1 -1
- package/dist/shared/{better-auth.Cj28z0kQ.mjs → better-auth.vd9ibIsl.mjs} +48 -84
- package/dist/shared/{better-auth.CAcHGnwq.cjs → better-auth.wBgaxGEw.cjs} +6 -10
- package/dist/social-providers/index.cjs +3 -3
- package/dist/social-providers/index.mjs +3 -3
- package/dist/test-utils/index.cjs +11 -11
- package/dist/test-utils/index.d.cts +12 -12
- package/dist/test-utils/index.d.mts +12 -12
- package/dist/test-utils/index.d.ts +12 -12
- package/dist/test-utils/index.mjs +11 -11
- 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 +2 -6
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
const z = require('zod');
|
|
4
4
|
const betterCall = require('better-call');
|
|
5
|
-
const session = require('./better-auth.
|
|
6
|
-
require('./better-auth.
|
|
5
|
+
const session = require('./better-auth.wBgaxGEw.cjs');
|
|
6
|
+
require('./better-auth.C5s1d_o-.cjs');
|
|
7
7
|
require('./better-auth.B6fIklBU.cjs');
|
|
8
8
|
const base64 = require('@better-auth/utils/base64');
|
|
9
9
|
require('@better-auth/utils/hmac');
|
|
10
10
|
require('./better-auth.DTvRBuq4.cjs');
|
|
11
11
|
require('@better-auth/utils/binary');
|
|
12
12
|
const schema = require('./better-auth.C0qxpMUS.cjs');
|
|
13
|
-
require('./better-auth.
|
|
13
|
+
require('./better-auth.SS_wBML-.cjs');
|
|
14
14
|
require('../plugins/organization/access/index.cjs');
|
|
15
15
|
require('@better-auth/utils/random');
|
|
16
16
|
const hash = require('@better-auth/utils/hash');
|
|
@@ -29,7 +29,7 @@ require('@better-auth/utils');
|
|
|
29
29
|
require('../plugins/custom-session/index.cjs');
|
|
30
30
|
const date = require('./better-auth.C1hdVENX.cjs');
|
|
31
31
|
const getRequestIp = require('./better-auth.DkbzbiTb.cjs');
|
|
32
|
-
const parser = require('./better-auth.
|
|
32
|
+
const parser = require('./better-auth.DUNU0obG.cjs');
|
|
33
33
|
const json = require('./better-auth.DgMx7bVs.cjs');
|
|
34
34
|
const plugins_access_index = require('../plugins/access/index.cjs');
|
|
35
35
|
require('@noble/hashes/sha3.js');
|
|
@@ -250,38 +250,30 @@ function createApiKey({
|
|
|
250
250
|
{
|
|
251
251
|
method: "POST",
|
|
252
252
|
body: z__namespace.object({
|
|
253
|
-
name: z__namespace.string().
|
|
254
|
-
expiresIn: z__namespace.number().
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
}).optional(),
|
|
260
|
-
prefix: z__namespace.string().meta({ description: "Prefix of the Api Key" }).regex(/^[a-zA-Z0-9_-]+$/, {
|
|
253
|
+
name: z__namespace.string().describe("Name of the Api Key").optional(),
|
|
254
|
+
expiresIn: z__namespace.number().describe("Expiration time of the Api Key in seconds").min(1).optional().nullable().default(null),
|
|
255
|
+
userId: z__namespace.coerce.string().describe(
|
|
256
|
+
"User Id of the user that the Api Key belongs to. server-only"
|
|
257
|
+
).optional(),
|
|
258
|
+
prefix: z__namespace.string().describe("Prefix of the Api Key").regex(/^[a-zA-Z0-9_-]+$/, {
|
|
261
259
|
message: "Invalid prefix format, must be alphanumeric and contain only underscores and hyphens."
|
|
262
260
|
}).optional(),
|
|
263
|
-
remaining: z__namespace.number().
|
|
264
|
-
description: "Remaining number of requests. Server side only"
|
|
265
|
-
}).min(0).optional().nullable().default(null),
|
|
261
|
+
remaining: z__namespace.number().describe("Remaining number of requests. Server side only").min(0).optional().nullable().default(null),
|
|
266
262
|
metadata: z__namespace.any().optional(),
|
|
267
|
-
refillAmount: z__namespace.number().
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
refillInterval: z__namespace.number().
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
rateLimitTimeWindow: z__namespace.number().
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
rateLimitMax: z__namespace.number().
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
rateLimitEnabled: z__namespace.boolean().
|
|
280
|
-
|
|
281
|
-
}).optional(),
|
|
282
|
-
permissions: z__namespace.record(z__namespace.string(), z__namespace.array(z__namespace.string())).meta({
|
|
283
|
-
description: "Permissions of the Api Key."
|
|
284
|
-
}).optional()
|
|
263
|
+
refillAmount: z__namespace.number().describe(
|
|
264
|
+
"Amount to refill the remaining count of the Api Key. server-only"
|
|
265
|
+
).min(1).optional(),
|
|
266
|
+
refillInterval: z__namespace.number().describe(
|
|
267
|
+
"Interval to refill the Api Key in milliseconds. server-only"
|
|
268
|
+
).optional(),
|
|
269
|
+
rateLimitTimeWindow: z__namespace.number().describe(
|
|
270
|
+
"The duration in milliseconds where each request is counted. Once the `maxRequests` is reached, the request will be rejected until the `timeWindow` has passed, at which point the `timeWindow` will be reset. server-only"
|
|
271
|
+
).optional(),
|
|
272
|
+
rateLimitMax: z__namespace.number().describe(
|
|
273
|
+
"Maximum amount of requests allowed within a window. Once the `maxRequests` is reached, the request will be rejected until the `timeWindow` has passed, at which point the `timeWindow` will be reset. server-only"
|
|
274
|
+
).optional(),
|
|
275
|
+
rateLimitEnabled: z__namespace.boolean().describe("Whether the key has rate limiting enabled. server-only").optional(),
|
|
276
|
+
permissions: z__namespace.record(z__namespace.string(), z__namespace.array(z__namespace.string())).describe("Permissions of the Api Key.").optional()
|
|
285
277
|
}),
|
|
286
278
|
metadata: {
|
|
287
279
|
openapi: {
|
|
@@ -581,9 +573,7 @@ function deleteApiKey({
|
|
|
581
573
|
{
|
|
582
574
|
method: "POST",
|
|
583
575
|
body: z__namespace.object({
|
|
584
|
-
keyId: z__namespace.string().
|
|
585
|
-
description: "The id of the Api Key"
|
|
586
|
-
})
|
|
576
|
+
keyId: z__namespace.string().describe("The id of the Api Key")
|
|
587
577
|
}),
|
|
588
578
|
use: [session.sessionMiddleware],
|
|
589
579
|
metadata: {
|
|
@@ -682,9 +672,7 @@ function getApiKey({
|
|
|
682
672
|
{
|
|
683
673
|
method: "GET",
|
|
684
674
|
query: z__namespace.object({
|
|
685
|
-
id: z__namespace.string().
|
|
686
|
-
description: "The id of the Api Key"
|
|
687
|
-
})
|
|
675
|
+
id: z__namespace.string().describe("The id of the Api Key")
|
|
688
676
|
}),
|
|
689
677
|
use: [session.sessionMiddleware],
|
|
690
678
|
metadata: {
|
|
@@ -860,43 +848,25 @@ function updateApiKey({
|
|
|
860
848
|
{
|
|
861
849
|
method: "POST",
|
|
862
850
|
body: z__namespace.object({
|
|
863
|
-
keyId: z__namespace.string().
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
enabled: z__namespace.boolean().meta({
|
|
873
|
-
description: "Whether the Api Key is enabled or not"
|
|
874
|
-
}).optional(),
|
|
875
|
-
remaining: z__namespace.number().meta({
|
|
876
|
-
description: "The number of remaining requests"
|
|
877
|
-
}).min(1).optional(),
|
|
878
|
-
refillAmount: z__namespace.number().meta({
|
|
879
|
-
description: "The refill amount"
|
|
880
|
-
}).optional(),
|
|
881
|
-
refillInterval: z__namespace.number().meta({
|
|
882
|
-
description: "The refill interval"
|
|
883
|
-
}).optional(),
|
|
851
|
+
keyId: z__namespace.string().describe("The id of the Api Key"),
|
|
852
|
+
userId: z__namespace.coerce.string().describe(
|
|
853
|
+
"The id of the user which the api key belongs to. server-only. Eg: "
|
|
854
|
+
).optional(),
|
|
855
|
+
name: z__namespace.string().describe("The name of the key").optional(),
|
|
856
|
+
enabled: z__namespace.boolean().describe("Whether the Api Key is enabled or not").optional(),
|
|
857
|
+
remaining: z__namespace.number().describe("The number of remaining requests").min(1).optional(),
|
|
858
|
+
refillAmount: z__namespace.number().describe("The refill amount").optional(),
|
|
859
|
+
refillInterval: z__namespace.number().describe("The refill interval").optional(),
|
|
884
860
|
metadata: z__namespace.any().optional(),
|
|
885
|
-
expiresIn: z__namespace.number().
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
rateLimitMax: z__namespace.number().meta({
|
|
895
|
-
description: "Maximum amount of requests allowed within a window. Once the `maxRequests` is reached, the request will be rejected until the `timeWindow` has passed, at which point the `timeWindow` will be reset. server-only. Eg: 100"
|
|
896
|
-
}).optional(),
|
|
897
|
-
permissions: z__namespace.record(z__namespace.string(), z__namespace.array(z__namespace.string())).meta({
|
|
898
|
-
description: "Update the permissions on the API Key. server-only."
|
|
899
|
-
}).optional().nullable()
|
|
861
|
+
expiresIn: z__namespace.number().describe("Expiration time of the Api Key in seconds").min(1).optional().nullable(),
|
|
862
|
+
rateLimitEnabled: z__namespace.boolean().describe("Whether the key has rate limiting enabled.").optional(),
|
|
863
|
+
rateLimitTimeWindow: z__namespace.number().describe(
|
|
864
|
+
"The duration in milliseconds where each request is counted. server-only. Eg: 1000"
|
|
865
|
+
).optional(),
|
|
866
|
+
rateLimitMax: z__namespace.number().describe(
|
|
867
|
+
"Maximum amount of requests allowed within a window. Once the `maxRequests` is reached, the request will be rejected until the `timeWindow` has passed, at which point the `timeWindow` will be reset. server-only. Eg: 100"
|
|
868
|
+
).optional(),
|
|
869
|
+
permissions: z__namespace.record(z__namespace.string(), z__namespace.array(z__namespace.string())).describe("Update the permissions on the API Key. server-only.").optional().nullable()
|
|
900
870
|
}),
|
|
901
871
|
metadata: {
|
|
902
872
|
openapi: {
|
|
@@ -1399,12 +1369,8 @@ function verifyApiKey({
|
|
|
1399
1369
|
{
|
|
1400
1370
|
method: "POST",
|
|
1401
1371
|
body: z__namespace.object({
|
|
1402
|
-
key: z__namespace.string().
|
|
1403
|
-
|
|
1404
|
-
}),
|
|
1405
|
-
permissions: z__namespace.record(z__namespace.string(), z__namespace.array(z__namespace.string())).meta({
|
|
1406
|
-
description: "The permissions to verify."
|
|
1407
|
-
}).optional()
|
|
1372
|
+
key: z__namespace.string().describe("The key to verify"),
|
|
1373
|
+
permissions: z__namespace.record(z__namespace.string(), z__namespace.array(z__namespace.string())).describe("The permissions to verify.").optional()
|
|
1408
1374
|
}),
|
|
1409
1375
|
metadata: {
|
|
1410
1376
|
SERVER_ONLY: true
|
|
@@ -2102,9 +2068,7 @@ const oneTimeToken = (options) => {
|
|
|
2102
2068
|
{
|
|
2103
2069
|
method: "POST",
|
|
2104
2070
|
body: z__namespace.object({
|
|
2105
|
-
token: z__namespace.string().
|
|
2106
|
-
description: 'The token to verify. Eg: "some-token"'
|
|
2107
|
-
})
|
|
2071
|
+
token: z__namespace.string().describe("The token to verify. Eg: ")
|
|
2108
2072
|
})
|
|
2109
2073
|
},
|
|
2110
2074
|
async (c) => {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { checkEndpointConflicts, getEndpoints, router } from '../api/index.mjs';
|
|
2
2
|
import { defu } from 'defu';
|
|
3
3
|
import { hashToBase64, verifyPassword, hashPassword } from '../crypto/index.mjs';
|
|
4
|
-
import { a as getAdapter, c as createInternalAdapter, e as getMigrations } from './better-auth.
|
|
4
|
+
import { a as getAdapter, c as createInternalAdapter, e as getMigrations } from './better-auth.7DsuGNVf.mjs';
|
|
5
5
|
import { g as getAuthTables } from './better-auth.Cjw1GDsh.mjs';
|
|
6
6
|
import 'zod';
|
|
7
7
|
import './better-auth.Dlx1jCB2.mjs';
|
|
8
|
-
import { g as getCookies, c as createCookieGetter } from './better-auth.
|
|
8
|
+
import { g as getCookies, c as createCookieGetter } from './better-auth.C3bLnul-.mjs';
|
|
9
9
|
import { a as logger, c as createLogger } from './better-auth.C4g12FAA.mjs';
|
|
10
|
-
import { U as socialProviders } from './better-auth.
|
|
10
|
+
import { U as socialProviders } from './better-auth.D-4EtUes.mjs';
|
|
11
11
|
import { g as generateId } from './better-auth.BUPPRXfK.mjs';
|
|
12
12
|
import 'better-call';
|
|
13
13
|
import '@better-auth/utils/hash';
|
|
@@ -25,8 +25,8 @@ import '@better-auth/utils/hex';
|
|
|
25
25
|
import '@noble/hashes/utils.js';
|
|
26
26
|
import { betterFetch } from '@better-fetch/fetch';
|
|
27
27
|
import '@better-auth/utils/random';
|
|
28
|
-
import { g as getKyselyDatabaseType } from './better-auth.
|
|
29
|
-
import { B as BASE_ERROR_CODES } from './better-auth.
|
|
28
|
+
import { g as getKyselyDatabaseType } from './better-auth.DUTxy-hg.mjs';
|
|
29
|
+
import { B as BASE_ERROR_CODES } from './better-auth.Co88PbP3.mjs';
|
|
30
30
|
|
|
31
31
|
const DEFAULT_SECRET = "better-auth-secret-123456789";
|
|
32
32
|
|
|
@@ -107,7 +107,7 @@ function parseSetCookieHeader(setCookie) {
|
|
|
107
107
|
cookieArray.forEach((cookieString) => {
|
|
108
108
|
const parts = cookieString.split(";").map((part) => part.trim());
|
|
109
109
|
const [nameValue, ...attributes] = parts;
|
|
110
|
-
const [name, ...valueParts] = nameValue.split("=");
|
|
110
|
+
const [name, ...valueParts] = (nameValue || "").split("=");
|
|
111
111
|
const value = valueParts.join("=");
|
|
112
112
|
if (!name || value === void 0) {
|
|
113
113
|
return;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
const z = require('zod');
|
|
4
4
|
const betterCall = require('better-call');
|
|
5
|
-
require('./better-auth.
|
|
6
|
-
const session = require('./better-auth.
|
|
7
|
-
const cookies_index = require('./better-auth.
|
|
5
|
+
require('./better-auth.C5s1d_o-.cjs');
|
|
6
|
+
const session = require('./better-auth.wBgaxGEw.cjs');
|
|
7
|
+
const cookies_index = require('./better-auth.DIfV2UBl.cjs');
|
|
8
8
|
const schema$1 = require('./better-auth.C0qxpMUS.cjs');
|
|
9
9
|
require('./better-auth.B6fIklBU.cjs');
|
|
10
10
|
require('./better-auth.DTvRBuq4.cjs');
|
|
@@ -198,21 +198,15 @@ const admin = (options) => {
|
|
|
198
198
|
{
|
|
199
199
|
method: "POST",
|
|
200
200
|
body: z__namespace.object({
|
|
201
|
-
userId: z__namespace.coerce.string().
|
|
202
|
-
description: "The user id"
|
|
203
|
-
}),
|
|
201
|
+
userId: z__namespace.coerce.string().describe("The user id"),
|
|
204
202
|
role: z__namespace.union([
|
|
205
|
-
z__namespace.string().
|
|
206
|
-
description: "The role to set. `admin` or `user` by default"
|
|
207
|
-
}),
|
|
203
|
+
z__namespace.string().describe("The role to set. `admin` or `user` by default"),
|
|
208
204
|
z__namespace.array(
|
|
209
|
-
z__namespace.string().
|
|
210
|
-
description: "The roles to set. `admin` or `user` by default"
|
|
211
|
-
})
|
|
205
|
+
z__namespace.string().describe("The roles to set. `admin` or `user` by default")
|
|
212
206
|
)
|
|
213
|
-
]).
|
|
214
|
-
|
|
215
|
-
|
|
207
|
+
]).describe(
|
|
208
|
+
"The role to set, this can be a string or an array of strings. Eg: `admin` or `[admin, user]`"
|
|
209
|
+
)
|
|
216
210
|
}),
|
|
217
211
|
requireHeaders: true,
|
|
218
212
|
use: [adminMiddleware],
|
|
@@ -275,9 +269,7 @@ const admin = (options) => {
|
|
|
275
269
|
{
|
|
276
270
|
method: "GET",
|
|
277
271
|
query: z__namespace.object({
|
|
278
|
-
id: z__namespace.string().
|
|
279
|
-
description: "The id of the User"
|
|
280
|
-
})
|
|
272
|
+
id: z__namespace.string().describe("The id of the User")
|
|
281
273
|
}),
|
|
282
274
|
use: [adminMiddleware],
|
|
283
275
|
metadata: {
|
|
@@ -350,33 +342,21 @@ const admin = (options) => {
|
|
|
350
342
|
{
|
|
351
343
|
method: "POST",
|
|
352
344
|
body: z__namespace.object({
|
|
353
|
-
email: z__namespace.string().
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
password: z__namespace.string().meta({
|
|
357
|
-
description: "The password of the user"
|
|
358
|
-
}),
|
|
359
|
-
name: z__namespace.string().meta({
|
|
360
|
-
description: "The name of the user"
|
|
361
|
-
}),
|
|
345
|
+
email: z__namespace.string().describe("The email of the user"),
|
|
346
|
+
password: z__namespace.string().describe("The password of the user"),
|
|
347
|
+
name: z__namespace.string().describe("The name of the user"),
|
|
362
348
|
role: z__namespace.union([
|
|
363
|
-
z__namespace.string().
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
description: "The roles of user"
|
|
369
|
-
})
|
|
370
|
-
)
|
|
371
|
-
]).optional().meta({
|
|
372
|
-
description: `A string or array of strings representing the roles to apply to the new user. Eg: "user"`
|
|
373
|
-
}),
|
|
349
|
+
z__namespace.string().describe("The role of the user"),
|
|
350
|
+
z__namespace.array(z__namespace.string().describe("The roles of user"))
|
|
351
|
+
]).optional().describe(
|
|
352
|
+
`A string or array of strings representing the roles to apply to the new user. Eg: "user"`
|
|
353
|
+
),
|
|
374
354
|
/**
|
|
375
355
|
* extra fields for user
|
|
376
356
|
*/
|
|
377
|
-
data: z__namespace.record(z__namespace.string(), z__namespace.any()).optional().
|
|
378
|
-
|
|
379
|
-
|
|
357
|
+
data: z__namespace.record(z__namespace.string(), z__namespace.any()).optional().describe(
|
|
358
|
+
"Extra fields for the user. Including custom additional fields."
|
|
359
|
+
)
|
|
380
360
|
}),
|
|
381
361
|
metadata: {
|
|
382
362
|
openapi: {
|
|
@@ -465,17 +445,28 @@ const admin = (options) => {
|
|
|
465
445
|
});
|
|
466
446
|
}
|
|
467
447
|
),
|
|
448
|
+
/**
|
|
449
|
+
* ### Endpoint
|
|
450
|
+
*
|
|
451
|
+
* POST `/admin/update-user`
|
|
452
|
+
*
|
|
453
|
+
* ### API Methods
|
|
454
|
+
*
|
|
455
|
+
* **server:**
|
|
456
|
+
* `auth.api.adminUpdateUser`
|
|
457
|
+
*
|
|
458
|
+
* **client:**
|
|
459
|
+
* `authClient.admin.updateUser`
|
|
460
|
+
*
|
|
461
|
+
* @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/admin#api-method-admin-update-user)
|
|
462
|
+
*/
|
|
468
463
|
adminUpdateUser: session.createAuthEndpoint(
|
|
469
464
|
"/admin/update-user",
|
|
470
465
|
{
|
|
471
466
|
method: "POST",
|
|
472
467
|
body: z__namespace.object({
|
|
473
|
-
userId: z__namespace.coerce.string().
|
|
474
|
-
|
|
475
|
-
}),
|
|
476
|
-
data: z__namespace.record(z__namespace.any(), z__namespace.any()).meta({
|
|
477
|
-
description: "The user data to update"
|
|
478
|
-
})
|
|
468
|
+
userId: z__namespace.coerce.string().describe("The user id"),
|
|
469
|
+
data: z__namespace.record(z__namespace.any(), z__namespace.any()).describe("The user data to update")
|
|
479
470
|
}),
|
|
480
471
|
use: [adminMiddleware],
|
|
481
472
|
metadata: {
|
|
@@ -540,36 +531,20 @@ const admin = (options) => {
|
|
|
540
531
|
method: "GET",
|
|
541
532
|
use: [adminMiddleware],
|
|
542
533
|
query: z__namespace.object({
|
|
543
|
-
searchValue: z__namespace.string().optional().
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
}).or(z__namespace.number()).optional(),
|
|
558
|
-
sortBy: z__namespace.string().meta({
|
|
559
|
-
description: "The field to sort by"
|
|
560
|
-
}).optional(),
|
|
561
|
-
sortDirection: z__namespace.enum(["asc", "desc"]).meta({
|
|
562
|
-
description: "The direction to sort by"
|
|
563
|
-
}).optional(),
|
|
564
|
-
filterField: z__namespace.string().meta({
|
|
565
|
-
description: "The field to filter by"
|
|
566
|
-
}).optional(),
|
|
567
|
-
filterValue: z__namespace.string().meta({
|
|
568
|
-
description: "The value to filter by"
|
|
569
|
-
}).or(z__namespace.number()).or(z__namespace.boolean()).optional(),
|
|
570
|
-
filterOperator: z__namespace.enum(["eq", "ne", "lt", "lte", "gt", "gte", "contains"]).meta({
|
|
571
|
-
description: "The operator to use for the filter"
|
|
572
|
-
}).optional()
|
|
534
|
+
searchValue: z__namespace.string().optional().describe('The value to search for. Eg: "some name"'),
|
|
535
|
+
searchField: z__namespace.enum(["email", "name"]).describe(
|
|
536
|
+
'The field to search in, defaults to email. Can be `email` or `name`. Eg: "name"'
|
|
537
|
+
).optional(),
|
|
538
|
+
searchOperator: z__namespace.enum(["contains", "starts_with", "ends_with"]).describe(
|
|
539
|
+
'The operator to use for the search. Can be `contains`, `starts_with` or `ends_with`. Eg: "contains"'
|
|
540
|
+
).optional(),
|
|
541
|
+
limit: z__namespace.string().describe("The number of users to return").or(z__namespace.number()).optional(),
|
|
542
|
+
offset: z__namespace.string().describe("The offset to start from").or(z__namespace.number()).optional(),
|
|
543
|
+
sortBy: z__namespace.string().describe("The field to sort by").optional(),
|
|
544
|
+
sortDirection: z__namespace.enum(["asc", "desc"]).describe("The direction to sort by").optional(),
|
|
545
|
+
filterField: z__namespace.string().describe("The field to filter by").optional(),
|
|
546
|
+
filterValue: z__namespace.string().describe("The value to filter by").or(z__namespace.number()).or(z__namespace.boolean()).optional(),
|
|
547
|
+
filterOperator: z__namespace.enum(["eq", "ne", "lt", "lte", "gt", "gte", "contains"]).describe("The operator to use for the filter").optional()
|
|
573
548
|
}),
|
|
574
549
|
metadata: {
|
|
575
550
|
openapi: {
|
|
@@ -687,9 +662,7 @@ const admin = (options) => {
|
|
|
687
662
|
method: "POST",
|
|
688
663
|
use: [adminMiddleware],
|
|
689
664
|
body: z__namespace.object({
|
|
690
|
-
userId: z__namespace.coerce.string().
|
|
691
|
-
description: "The user id"
|
|
692
|
-
})
|
|
665
|
+
userId: z__namespace.coerce.string().describe("The user id")
|
|
693
666
|
}),
|
|
694
667
|
metadata: {
|
|
695
668
|
openapi: {
|
|
@@ -760,9 +733,7 @@ const admin = (options) => {
|
|
|
760
733
|
{
|
|
761
734
|
method: "POST",
|
|
762
735
|
body: z__namespace.object({
|
|
763
|
-
userId: z__namespace.coerce.string().
|
|
764
|
-
description: "The user id"
|
|
765
|
-
})
|
|
736
|
+
userId: z__namespace.coerce.string().describe("The user id")
|
|
766
737
|
}),
|
|
767
738
|
use: [adminMiddleware],
|
|
768
739
|
metadata: {
|
|
@@ -839,21 +810,15 @@ const admin = (options) => {
|
|
|
839
810
|
{
|
|
840
811
|
method: "POST",
|
|
841
812
|
body: z__namespace.object({
|
|
842
|
-
userId: z__namespace.coerce.string().
|
|
843
|
-
description: "The user id"
|
|
844
|
-
}),
|
|
813
|
+
userId: z__namespace.coerce.string().describe("The user id"),
|
|
845
814
|
/**
|
|
846
815
|
* Reason for the ban
|
|
847
816
|
*/
|
|
848
|
-
banReason: z__namespace.string().
|
|
849
|
-
description: "The reason for the ban"
|
|
850
|
-
}).optional(),
|
|
817
|
+
banReason: z__namespace.string().describe("The reason for the ban").optional(),
|
|
851
818
|
/**
|
|
852
819
|
* Number of seconds until the ban expires
|
|
853
820
|
*/
|
|
854
|
-
banExpiresIn: z__namespace.number().
|
|
855
|
-
description: "The number of seconds until the ban expires"
|
|
856
|
-
}).optional()
|
|
821
|
+
banExpiresIn: z__namespace.number().describe("The number of seconds until the ban expires").optional()
|
|
857
822
|
}),
|
|
858
823
|
use: [adminMiddleware],
|
|
859
824
|
metadata: {
|
|
@@ -945,9 +910,7 @@ const admin = (options) => {
|
|
|
945
910
|
{
|
|
946
911
|
method: "POST",
|
|
947
912
|
body: z__namespace.object({
|
|
948
|
-
userId: z__namespace.coerce.string().
|
|
949
|
-
description: "The user id"
|
|
950
|
-
})
|
|
913
|
+
userId: z__namespace.coerce.string().describe("The user id")
|
|
951
914
|
}),
|
|
952
915
|
use: [adminMiddleware],
|
|
953
916
|
metadata: {
|
|
@@ -1093,7 +1056,9 @@ const admin = (options) => {
|
|
|
1093
1056
|
});
|
|
1094
1057
|
}
|
|
1095
1058
|
const [adminSessionToken, dontRememberMeCookie] = adminCookie?.split(":");
|
|
1096
|
-
const adminSession = await ctx.context.internalAdapter.findSession(
|
|
1059
|
+
const adminSession = await ctx.context.internalAdapter.findSession(
|
|
1060
|
+
adminSessionToken
|
|
1061
|
+
);
|
|
1097
1062
|
if (!adminSession || adminSession.session.userId !== user.id) {
|
|
1098
1063
|
throw new betterCall.APIError("INTERNAL_SERVER_ERROR", {
|
|
1099
1064
|
message: "Failed to find admin session"
|
|
@@ -1126,9 +1091,7 @@ const admin = (options) => {
|
|
|
1126
1091
|
{
|
|
1127
1092
|
method: "POST",
|
|
1128
1093
|
body: z__namespace.object({
|
|
1129
|
-
sessionToken: z__namespace.string().
|
|
1130
|
-
description: "The session token"
|
|
1131
|
-
})
|
|
1094
|
+
sessionToken: z__namespace.string().describe("The session token")
|
|
1132
1095
|
}),
|
|
1133
1096
|
use: [adminMiddleware],
|
|
1134
1097
|
metadata: {
|
|
@@ -1199,9 +1162,7 @@ const admin = (options) => {
|
|
|
1199
1162
|
{
|
|
1200
1163
|
method: "POST",
|
|
1201
1164
|
body: z__namespace.object({
|
|
1202
|
-
userId: z__namespace.coerce.string().
|
|
1203
|
-
description: "The user id"
|
|
1204
|
-
})
|
|
1165
|
+
userId: z__namespace.coerce.string().describe("The user id")
|
|
1205
1166
|
}),
|
|
1206
1167
|
use: [adminMiddleware],
|
|
1207
1168
|
metadata: {
|
|
@@ -1270,9 +1231,7 @@ const admin = (options) => {
|
|
|
1270
1231
|
{
|
|
1271
1232
|
method: "POST",
|
|
1272
1233
|
body: z__namespace.object({
|
|
1273
|
-
userId: z__namespace.coerce.string().
|
|
1274
|
-
description: "The user id"
|
|
1275
|
-
})
|
|
1234
|
+
userId: z__namespace.coerce.string().describe("The user id")
|
|
1276
1235
|
}),
|
|
1277
1236
|
use: [adminMiddleware],
|
|
1278
1237
|
metadata: {
|
|
@@ -1354,12 +1313,8 @@ const admin = (options) => {
|
|
|
1354
1313
|
{
|
|
1355
1314
|
method: "POST",
|
|
1356
1315
|
body: z__namespace.object({
|
|
1357
|
-
newPassword: z__namespace.string().
|
|
1358
|
-
|
|
1359
|
-
}),
|
|
1360
|
-
userId: z__namespace.coerce.string().meta({
|
|
1361
|
-
description: "The user id"
|
|
1362
|
-
})
|
|
1316
|
+
newPassword: z__namespace.string().describe("The new password"),
|
|
1317
|
+
userId: z__namespace.coerce.string().describe("The user id")
|
|
1363
1318
|
}),
|
|
1364
1319
|
use: [adminMiddleware],
|
|
1365
1320
|
metadata: {
|
|
@@ -1433,12 +1388,8 @@ const admin = (options) => {
|
|
|
1433
1388
|
{
|
|
1434
1389
|
method: "POST",
|
|
1435
1390
|
body: z__namespace.object({
|
|
1436
|
-
userId: z__namespace.coerce.string().optional().
|
|
1437
|
-
|
|
1438
|
-
}),
|
|
1439
|
-
role: z__namespace.string().optional().meta({
|
|
1440
|
-
description: `The role to check permission for. Eg: "admin"`
|
|
1441
|
-
})
|
|
1391
|
+
userId: z__namespace.coerce.string().optional().describe(`The user id. Eg: "user-id"`),
|
|
1392
|
+
role: z__namespace.string().optional().describe(`The role to check permission for. Eg: "admin"`)
|
|
1442
1393
|
}).and(
|
|
1443
1394
|
z__namespace.union([
|
|
1444
1395
|
z__namespace.object({
|
|
@@ -64,7 +64,7 @@ function betterJSONParse(value, options = {}) {
|
|
|
64
64
|
return value;
|
|
65
65
|
}
|
|
66
66
|
const trimmed = value.trim();
|
|
67
|
-
if (trimmed[0] === '"' && trimmed.endsWith('"') && !trimmed.slice(1, -1).includes('"')) {
|
|
67
|
+
if (trimmed.length > 0 && trimmed[0] === '"' && trimmed.endsWith('"') && !trimmed.slice(1, -1).includes('"')) {
|
|
68
68
|
return trimmed.slice(1, -1);
|
|
69
69
|
}
|
|
70
70
|
const lowerValue = trimmed.toLowerCase();
|
|
@@ -135,12 +135,12 @@ const kyselyAdapter = (db, config) => {
|
|
|
135
135
|
let res;
|
|
136
136
|
if (config?.type === "mysql") {
|
|
137
137
|
await builder.execute();
|
|
138
|
-
const field = values.id ? "id" : where.length > 0 && where[0]
|
|
138
|
+
const field = values.id ? "id" : where.length > 0 && where[0]?.field ? where[0].field : "id";
|
|
139
139
|
if (!values.id && where.length === 0) {
|
|
140
140
|
res = await db2.selectFrom(model).selectAll().orderBy(getFieldName({ model, field }), "desc").limit(1).executeTakeFirst();
|
|
141
141
|
return res;
|
|
142
142
|
}
|
|
143
|
-
const value = values[field] || where[0]
|
|
143
|
+
const value = values[field] || where[0]?.value;
|
|
144
144
|
res = await db2.selectFrom(model).selectAll().orderBy(getFieldName({ model, field }), "desc").where(getFieldName({ model, field }), "=", value).limit(1).executeTakeFirst();
|
|
145
145
|
return res;
|
|
146
146
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as BetterAuthPlugin, B as BetterAuthOptions, ah as InferFieldsInputClient, af as InferFieldsOutput, U as User, S as Session, c as Auth } from './better-auth.
|
|
1
|
+
import { n as BetterAuthPlugin, B as BetterAuthOptions, ah as InferFieldsInputClient, af as InferFieldsOutput, U as User, S as Session, c as Auth } from './better-auth.U9CXSJA_.cjs';
|
|
2
2
|
import { BetterFetchOption, BetterFetchResponse, BetterFetch, BetterFetchPlugin } from '@better-fetch/fetch';
|
|
3
3
|
import { WritableAtom, Atom } from 'nanostores';
|
|
4
4
|
import { U as UnionToIntersection, H as HasRequiredKeys, a as Prettify, L as LiteralString, S as StripEmptyObjects } from './better-auth.DTtXpZYr.cjs';
|